diff options
| author | Martin Rudalics | 2008-11-02 11:02:58 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-11-02 11:02:58 +0000 |
| commit | a5094f72a896a22b525df3c189918a153ef4b4fd (patch) | |
| tree | 4e6dbb72a161a562b4cecac07b0142f5cd28d03c | |
| parent | ad91ba441399416d407e0cdc10a913db33bf1225 (diff) | |
| download | emacs-a5094f72a896a22b525df3c189918a153ef4b4fd.tar.gz emacs-a5094f72a896a22b525df3c189918a153ef4b4fd.zip | |
(with-selected-window): Call set-frame-selected-window
with new argument NORECORD set. Update doc-string.
(with-selected-frame): Call select-frame with new argument
NORECORD set. Update doc-string.
| -rw-r--r-- | lisp/subr.el | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index f0fe7be0700..4564d141a86 100644 --- a/lisp/subr.el +++ b/lisp/subr.el | |||
| @@ -2499,17 +2499,18 @@ also `with-temp-buffer'." | |||
| 2499 | "Execute the forms in BODY with WINDOW as the selected window. | 2499 | "Execute the forms in BODY with WINDOW as the selected window. |
| 2500 | The value returned is the value of the last form in BODY. | 2500 | The value returned is the value of the last form in BODY. |
| 2501 | 2501 | ||
| 2502 | This macro saves and restores the current buffer, since otherwise | 2502 | This macro saves and restores the selected window, as well as the |
| 2503 | its normal operation could potentially make a different | 2503 | selected window of each frame. It does not change the order of |
| 2504 | buffer current. It does not alter the buffer list ordering. | 2504 | recently selected windows. If the previously selected window of |
| 2505 | 2505 | some frame is no longer live at the end of BODY, that frame's | |
| 2506 | This macro saves and restores the selected window, as well as | 2506 | selected window is left alone. If the selected window is no |
| 2507 | the selected window in each frame. If the previously selected | 2507 | longer live, then whatever window is selected at the end of BODY |
| 2508 | window of some frame is no longer live at the end of BODY, that | 2508 | remains selected. |
| 2509 | frame's selected window is left alone. If the selected window is | 2509 | |
| 2510 | no longer live, then whatever window is selected at the end of | 2510 | This macro uses `save-current-buffer' to save and restore the |
| 2511 | BODY remains selected. | 2511 | current buffer, since otherwise its normal operation could |
| 2512 | See also `with-temp-buffer'." | 2512 | potentially make a different buffer current. It does not alter |
| 2513 | the buffer list ordering." | ||
| 2513 | (declare (indent 1) (debug t)) | 2514 | (declare (indent 1) (debug t)) |
| 2514 | ;; Most of this code is a copy of save-selected-window. | 2515 | ;; Most of this code is a copy of save-selected-window. |
| 2515 | `(let ((save-selected-window-window (selected-window)) | 2516 | `(let ((save-selected-window-window (selected-window)) |
| @@ -2526,26 +2527,28 @@ See also `with-temp-buffer'." | |||
| 2526 | (dolist (elt save-selected-window-alist) | 2527 | (dolist (elt save-selected-window-alist) |
| 2527 | (and (frame-live-p (car elt)) | 2528 | (and (frame-live-p (car elt)) |
| 2528 | (window-live-p (cadr elt)) | 2529 | (window-live-p (cadr elt)) |
| 2529 | (set-frame-selected-window (car elt) (cadr elt)))) | 2530 | (set-frame-selected-window (car elt) (cadr elt) 'norecord))) |
| 2530 | (if (window-live-p save-selected-window-window) | 2531 | (when (window-live-p save-selected-window-window) |
| 2531 | (select-window save-selected-window-window 'norecord)))))) | 2532 | (select-window save-selected-window-window 'norecord)))))) |
| 2532 | 2533 | ||
| 2533 | (defmacro with-selected-frame (frame &rest body) | 2534 | (defmacro with-selected-frame (frame &rest body) |
| 2534 | "Execute the forms in BODY with FRAME as the selected frame. | 2535 | "Execute the forms in BODY with FRAME as the selected frame. |
| 2535 | The value returned is the value of the last form in BODY. | 2536 | The value returned is the value of the last form in BODY. |
| 2536 | See also `with-temp-buffer'." | 2537 | |
| 2538 | This macro neither changes the order of recently selected windows | ||
| 2539 | nor the buffer list." | ||
| 2537 | (declare (indent 1) (debug t)) | 2540 | (declare (indent 1) (debug t)) |
| 2538 | (let ((old-frame (make-symbol "old-frame")) | 2541 | (let ((old-frame (make-symbol "old-frame")) |
| 2539 | (old-buffer (make-symbol "old-buffer"))) | 2542 | (old-buffer (make-symbol "old-buffer"))) |
| 2540 | `(let ((,old-frame (selected-frame)) | 2543 | `(let ((,old-frame (selected-frame)) |
| 2541 | (,old-buffer (current-buffer))) | 2544 | (,old-buffer (current-buffer))) |
| 2542 | (unwind-protect | 2545 | (unwind-protect |
| 2543 | (progn (select-frame ,frame) | 2546 | (progn (select-frame ,frame 'norecord) |
| 2544 | ,@body) | 2547 | ,@body) |
| 2545 | (if (frame-live-p ,old-frame) | 2548 | (when (frame-live-p ,old-frame) |
| 2546 | (select-frame ,old-frame)) | 2549 | (select-frame ,old-frame 'norecord)) |
| 2547 | (if (buffer-live-p ,old-buffer) | 2550 | (when (buffer-live-p ,old-buffer) |
| 2548 | (set-buffer ,old-buffer)))))) | 2551 | (set-buffer ,old-buffer)))))) |
| 2549 | 2552 | ||
| 2550 | (defmacro with-temp-file (file &rest body) | 2553 | (defmacro with-temp-file (file &rest body) |
| 2551 | "Create a new buffer, evaluate BODY there, and write the buffer to FILE. | 2554 | "Create a new buffer, evaluate BODY there, and write the buffer to FILE. |