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
7db3c58f
Commit
7db3c58f
authored
Jun 25, 2005
by
Richard M. Stallman
Browse files
(save-selected-window): Use save-current-buffer.
parent
3e215e30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
13 deletions
+21
-13
lisp/window.el
lisp/window.el
+21
-13
No files found.
lisp/window.el
View file @
7db3c58f
...
@@ -40,11 +40,18 @@ unless you explicitly change the size, or Emacs has no other choice.")
...
@@ -40,11 +40,18 @@ unless you explicitly change the size, or Emacs has no other choice.")
(
defmacro
save-selected-window
(
&rest
body
)
(
defmacro
save-selected-window
(
&rest
body
)
"Execute BODY, then select the window that was selected before BODY.
"Execute BODY, then select the window that was selected before BODY.
Also restore the selected window of each frame as it was at the start
The value returned is the value of the last form in BODY.
of this construct.
However, if a window has become dead, don't get an error,
This macro saves and restores the current buffer, since otherwise
just refrain from reselecting it.
its normal operation could potentially make a different
Return the value of the last form in BODY."
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
no longer live, then whatever window is selected at the end of
BODY remains selected."
`
(
let
((
save-selected-window-window
(
selected-window
))
`
(
let
((
save-selected-window-window
(
selected-window
))
;; It is necessary to save all of these, because calling
;; It is necessary to save all of these, because calling
;; select-window changes frame-selected-window for whatever
;; select-window changes frame-selected-window for whatever
...
@@ -52,14 +59,15 @@ Return the value of the last form in BODY."
...
@@ -52,14 +59,15 @@ Return the value of the last form in BODY."
(
save-selected-window-alist
(
save-selected-window-alist
(
mapcar
(
lambda
(
frame
)
(
list
frame
(
frame-selected-window
frame
)))
(
mapcar
(
lambda
(
frame
)
(
list
frame
(
frame-selected-window
frame
)))
(
frame-list
))))
(
frame-list
))))
(
unwind-protect
(
save-current-buffer
(
progn
,@
body
)
(
unwind-protect
(
dolist
(
elt
save-selected-window-alist
)
(
progn
,@
body
)
(
and
(
frame-live-p
(
car
elt
))
(
dolist
(
elt
save-selected-window-alist
)
(
window-live-p
(
cadr
elt
))
(
and
(
frame-live-p
(
car
elt
))
(
set-frame-selected-window
(
car
elt
)
(
cadr
elt
))))
(
window-live-p
(
cadr
elt
))
(
if
(
window-live-p
save-selected-window-window
)
(
set-frame-selected-window
(
car
elt
)
(
cadr
elt
))))
(
select-window
save-selected-window-window
)))))
(
if
(
window-live-p
save-selected-window-window
)
(
select-window
save-selected-window-window
))))))
(
defun
window-body-height
(
&optional
window
)
(
defun
window-body-height
(
&optional
window
)
"Return number of lines in window WINDOW for actual buffer text.
"Return number of lines in window WINDOW for actual buffer text.
...
...
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