aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-03-22 16:58:14 +0000
committerRichard M. Stallman1995-03-22 16:58:14 +0000
commit28fc169ba4a40b09a1160178a6298a9dcc986eca (patch)
treec0a864d021d07aae397fb144f2ddfeeb11df27ab
parent82e6d8cb34d547a56945c539ada22be8533b7fb1 (diff)
downloademacs-28fc169ba4a40b09a1160178a6298a9dcc986eca.tar.gz
emacs-28fc169ba4a40b09a1160178a6298a9dcc986eca.zip
(one-window-p, walk-windows, minibuffer-window-active-p):
Functions moved to window.el.
-rw-r--r--lisp/subr.el64
1 files changed, 0 insertions, 64 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index f7bbad7b405..09a32af1f43 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -52,70 +52,6 @@ BODY should be a list of lisp expressions."
52;; 'args)))) 52;; 'args))))
53 53
54 54
55;;;; Window tree functions.
56
57(defun one-window-p (&optional nomini all-frames)
58 "Returns non-nil if the selected window is the only window (in its frame).
59Optional arg NOMINI non-nil means don't count the minibuffer
60even if it is active.
61
62The optional arg ALL-FRAMES t means count windows on all frames.
63If it is `visible', count windows on all visible frames.
64ALL-FRAMES nil or omitted means count only the selected frame,
65plus the minibuffer it uses (which may be on another frame).
66If ALL-FRAMES is neither nil nor t, count only the selected frame."
67 (let ((base-window (selected-window)))
68 (if (and nomini (eq base-window (minibuffer-window)))
69 (setq base-window (next-window base-window)))
70 (eq base-window
71 (next-window base-window (if nomini 'arg) all-frames))))
72
73(defun walk-windows (proc &optional minibuf all-frames)
74 "Cycle through all visible windows, calling PROC for each one.
75PROC is called with a window as argument.
76
77Optional second arg MINIBUF t means count the minibuffer window even
78if not active. MINIBUF nil or omitted means count the minibuffer iff
79it is active. MINIBUF neither t nor nil means not to count the
80minibuffer even if it is active.
81
82Several frames may share a single minibuffer; if the minibuffer
83counts, all windows on all frames that share that minibuffer count
84too. Therefore, when a separate minibuffer frame is active,
85`walk-windows' includes the windows in the frame from which you
86entered the minibuffer, as well as the minibuffer window. But if the
87minibuffer does not count, only windows from WINDOW's frame count.
88
89Optional third arg ALL-FRAMES t means include windows on all frames.
90ALL-FRAMES nil or omitted means cycle within the frames as specified
91above. ALL-FRAMES = `visible' means include windows on all visible frames.
92ALL-FRAMES = 0 means include windows on all visible and iconified frames.
93Anything else means restrict to WINDOW's frame."
94 ;; If we start from the minibuffer window, don't fail to come back to it.
95 (if (window-minibuffer-p (selected-window))
96 (setq minibuf t))
97 (let* ((walk-windows-start (selected-window))
98 (walk-windows-current walk-windows-start))
99 (while (progn
100 (setq walk-windows-current
101 (next-window walk-windows-current minibuf all-frames))
102 (funcall proc walk-windows-current)
103 (not (eq walk-windows-current walk-windows-start))))))
104
105(defun minibuffer-window-active-p (window)
106 "Return t if WINDOW (a minibuffer window) is now active."
107 ;; nil nil means include WINDOW's frame
108 ;; and other frames using WINDOW as minibuffer,
109 ;; and include minibuffer if active.
110 (let ((prev (previous-window window nil nil)))
111 ;; If PREV equals WINDOW, WINDOW must be on a minibuffer-only frame
112 ;; and it's not currently being used. So return nil.
113 (and (not (eq window prev))
114 (let ((should-be-same (next-window prev nil nil)))
115 ;; If next-window doesn't reverse previous-window,
116 ;; WINDOW must be outside the cycle specified by nil nil.
117 (eq should-be-same window)))))
118
119;;;; Keymap support. 55;;;; Keymap support.
120 56
121(defun undefined () 57(defun undefined ()