]> git.eshelyaron.com Git - emacs.git/commitdiff
(minibuffer-window-active-p): New function.
authorRichard M. Stallman <rms@gnu.org>
Sun, 8 Aug 1993 19:18:26 +0000 (19:18 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sun, 8 Aug 1993 19:18:26 +0000 (19:18 +0000)
lisp/subr.el

index c1717f553d30ec84ad63d325f52d7b636ee7d7eb..e5f4189ebcbff8089154caf52d42161c1827b062 100644 (file)
@@ -83,6 +83,19 @@ If ALL-FRAMES is neither nil nor t, stick strictly to the selected frame."
             (funcall proc walk-windows-current)
             (not (eq walk-windows-current walk-windows-start))))))
 
+(defun minibuffer-window-active-p (window)
+  "Return t if WINDOW (a minibuffer window) is now active."
+  ;; nil nil means include WINDOW's frame
+  ;; and other frames using WINDOW as minibuffer,
+  ;; and include minibuffer if active.
+  (let ((prev (previous-window window nil nil)))
+    ;; If PREV equals WINDOW, WINDOW must be on a minibuffer-only frame
+    ;; and it's not currently being used.  So return nil.
+    (and (not (eq window prev))
+        (let ((should-be-same (next-window prev nil nil)))
+          ;; If next-window doesn't reverse previous-window,
+          ;; WINDOW must be outside the cycle specified by nil nil.
+          (eq should-be-same window)))))
 \f
 ;;;; Keymap support.