changeset 4491:1e30d38d5c74

(minibuffer-window-active-p): New function.
author Richard M. Stallman <rms@gnu.org>
date Sun, 08 Aug 1993 19:18:26 +0000
parents 8362b57424dc
children 264d488d5bc7
files lisp/subr.el
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Sun Aug 08 19:16:42 1993 +0000
+++ b/lisp/subr.el	Sun Aug 08 19:18:26 1993 +0000
@@ -83,6 +83,19 @@
 	     (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)))))
 
 ;;;; Keymap support.