comparison lisp/window.el @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 2c611d1463a6
children aabb7f5b1c81
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of 17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details. 19 ;; General Public License for more details.
20 20
21 ;; You should have received a copy of the GNU General Public License 21 ;; You should have received a copy of the GNU General Public License
22 ;; along with XEmacs; see the file COPYING. If not, write to the 22 ;; along with XEmacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, 59 Temple Place - Suite 330, 23 ;; Free Software Foundation, 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA. 24 ;; Boston, MA 02111-1307, USA.
25 25
26 ;;; Synched up with: Emacs/Mule zeta. 26 ;;; Synched up with: Emacs/Mule zeta.
27 27
32 ;;; Code: 32 ;;; Code:
33 33
34 ;;;; Window tree functions. 34 ;;;; Window tree functions.
35 35
36 (defun one-window-p (&optional nomini all-frames device) 36 (defun one-window-p (&optional nomini all-frames device)
37 "Returns non-nil if the selected window is the only window (in its frame). 37 "Return non-nil if the selected window is the only window (in its frame).
38 Optional arg NOMINI non-nil means don't count the minibuffer 38 Optional arg NOMINI non-nil means don't count the minibuffer
39 even if it is active. 39 even if it is active.
40 40
41 The optional arg ALL-FRAMES t means count windows on all frames. 41 The optional arg ALL-FRAMES t means count windows on all frames.
42 If it is `visible', count windows on all visible frames. 42 If it is `visible', count windows on all visible frames.
43 ALL-FRAMES nil or omitted means count only the selected frame, 43 ALL-FRAMES nil or omitted means count only the selected frame,
44 plus the minibuffer it uses (which may be on another frame). 44 plus the minibuffer it uses (which may be on another frame).
45 ALL-FRAMES = 0 means count windows on all visible and iconified frames. 45 ALL-FRAMES = 0 means count windows on all visible and iconified frames.
46 If ALL-FRAMES is any other value, count only the selected frame. 46 If ALL-FRAMES is any other value, count only the selected frame.
47 47
48 If optional third argument DEVICE is nil or omitted, count frames 48 If optional third argument DEVICE is nil or omitted, count frames
85 If a device type, include frames only on devices of that type. 85 If a device type, include frames only on devices of that type.
86 Otherwise, include frames only on the selected device." 86 Otherwise, include frames only on the selected device."
87 ;; If we start from the minibuffer window, don't fail to come back to it. 87 ;; If we start from the minibuffer window, don't fail to come back to it.
88 (if (window-minibuffer-p (selected-window)) 88 (if (window-minibuffer-p (selected-window))
89 (setq minibuf t)) 89 (setq minibuf t))
90 ;; Note that, like next-window & previous-window, this behaves a little 90 ;; Note that, like next-window & previous-window, this behaves a little
91 ;; strangely if the selected window is on an invisible frame: it hits 91 ;; strangely if the selected window is on an invisible frame: it hits
92 ;; some of the windows on that frame, and all windows on visible frames. 92 ;; some of the windows on that frame, and all windows on visible frames.
93 (let* ((walk-windows-start (selected-window)) 93 (let* ((walk-windows-start (selected-window))
94 (walk-windows-current walk-windows-start)) 94 (walk-windows-current walk-windows-start))
95 (while (progn 95 (while (progn
127 (list 'and ; XEmacs 127 (list 'and ; XEmacs
128 (list 'window-live-p 'save-selected-window-window) 128 (list 'window-live-p 'save-selected-window-window)
129 (list 'select-window 'save-selected-window-window))))) 129 (list 'select-window 'save-selected-window-window)))))
130 130
131 (defun count-windows (&optional minibuf) 131 (defun count-windows (&optional minibuf)
132 "Returns the number of visible windows. 132 "Return the number of visible windows.
133 Optional arg MINIBUF non-nil means count the minibuffer 133 Optional arg MINIBUF non-nil means count the minibuffer
134 even if it is inactive." 134 even if it is inactive."
135 (let ((count 0)) 135 (let ((count 0))
136 (walk-windows (function (lambda (w) 136 (walk-windows (function (lambda (w)
137 (setq count (+ count 1)))) 137 (setq count (+ count 1))))
138 minibuf) 138 minibuf)
139 count)) 139 count))
140 140
141 (defun balance-windows () 141 (defun balance-windows ()
142 "Makes all visible windows the same height (approximately)." 142 "Make all visible windows the same height (approximately)."
143 (interactive) 143 (interactive)
144 (let ((count -1) levels newsizes size) 144 (let ((count -1) levels newsizes size)
145 ;FSFmacs 145 ;FSFmacs
146 ;;; Don't count the lines that are above the uppermost windows. 146 ;;; Don't count the lines that are above the uppermost windows.
147 ;;; (These are the menu bar lines, if any.) 147 ;;; (These are the menu bar lines, if any.)