]> code.delx.au - gnu-emacs/blobdiff - lisp/window.el
(turn-off-xterm-mouse-tracking): Doc fix.
[gnu-emacs] / lisp / window.el
index 19c3fa71c3069849c0543fd1ecce68984c874036..532a1cc0009026938fb4b6a4be6f04237a47f240 100644 (file)
@@ -84,7 +84,8 @@ Anything else means restrict to the selected frame."
              (cons walk-windows-current walk-windows-already-seen))
        (funcall proc walk-windows-current)))))
 
-(defun some-window (predicate &optional minibuf all-frames default)
+(defun get-window-with-predicate (predicate &optional minibuf
+                                           all-frames default)
   "Return a window satisfying PREDICATE.
 
 This function cycles through all visible windows using `walk-windows',
@@ -119,16 +120,21 @@ Anything else means restrict to the selected frame."
                  minibuf all-frames)
     default))
 
+(defalias 'some-window 'get-window-with-predicate)
+
 (defun minibuffer-window-active-p (window)
   "Return t if WINDOW (a minibuffer window) is now active."
   (eq window (active-minibuffer-window)))
 
 (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.
+However, if that window has become dead, don't get an error,
+just refrain from switching to it."
   `(let ((save-selected-window-window (selected-window)))
      (unwind-protect
         (progn ,@body)
-       (select-window save-selected-window-window))))
+       (if (window-live-p save-selected-window-window)
+          (select-window save-selected-window-window)))))
 \f
 (defun count-windows (&optional minibuf)
    "Return the number of visible windows.