Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
4c6d1e16
Commit
4c6d1e16
authored
Jun 25, 2005
by
Richard M. Stallman
Browse files
(with-selected-window): Use save-current-buffer.
parent
198081c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
lisp/subr.el
lisp/subr.el
+16
-11
No files found.
lisp/subr.el
View file @
4c6d1e16
...
...
@@ -1717,8 +1717,12 @@ See also `with-temp-buffer'."
(defmacro with-selected-window (window &rest body)
"Execute the forms in BODY with WINDOW as the selected window.
The value returned is the value of the last form in BODY.
This does not alter the buffer list ordering.
This function saves and restores the selected window, as well as
This macro saves and restores the current buffer, since otherwise
its normal operation could potentially make a different
buffer current. It does not alter the buffer list ordering.
This macro saves and restores the selected window, as well as
the selected window in each frame. If the previously selected
window of some frame is no longer live at the end of BODY, that
frame's selected window is left alone. If the selected window is
...
...
@@ -1734,15 +1738,16 @@ See also `with-temp-buffer'."
(save-selected-window-alist
(mapcar (lambda (frame) (list frame (frame-selected-window frame)))
(frame-list))))
(
unwind-protect
(
progn
(
select-window
,
window
'norecord
)
,@
body
)
(
dolist
(
elt
save-selected-window-alist
)
(
and
(
frame-live-p
(
car
elt
))
(
window-live-p
(
cadr
elt
))
(
set-frame-selected-window
(
car
elt
)
(
cadr
elt
))))
(
if
(
window-live-p
save-selected-window-window
)
(
select-window
save-selected-window-window
'norecord
)))))
(save-current-buffer
(unwind-protect
(progn (select-window ,window 'norecord)
,@body)
(dolist (elt save-selected-window-alist)
(and (frame-live-p (car elt))
(window-live-p (cadr elt))
(set-frame-selected-window (car elt) (cadr elt))))
(if (window-live-p save-selected-window-window)
(select-window save-selected-window-window 'norecord))))))
(defmacro with-temp-file (file &rest body)
"Create a new buffer, evaluate BODY there, and write the buffer to FILE.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment