# HG changeset patch # User Richard M. Stallman # Date 744837506 0 # Node ID 1e30d38d5c74a74e0a078608165441bfc125c843 # Parent 8362b57424dc244fe0a662209ccaf37da31e3190 (minibuffer-window-active-p): New function. diff -r 8362b57424dc -r 1e30d38d5c74 lisp/subr.el --- 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.