Mercurial > hg > xemacs-beta
annotate lisp/window-xemacs.el @ 5753:dbd8305e13cb
Warn about non-string non-integer ARG to #'gensym, bytecomp.el.
lisp/ChangeLog addition:
2013-08-21 Aidan Kehoe <kehoea@parhasard.net>
* bytecomp.el:
* bytecomp.el (gensym):
* bytecomp.el (byte-compile-gensym): New.
Warn that gensym called in a for-effect context is unlikely to be
useful.
Warn about non-string non-integer ARGs, this is incorrect.
Am not changing the function to error with same, most code that
makes the mistake is has no problems, which is why it has survived
so long.
* window-xemacs.el (save-window-excursion/mapping):
* window.el (save-window-excursion):
Call #'gensym with a string, not a symbol.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 21 Aug 2013 19:02:59 +0100 |
parents | c6b1500299a7 |
children |
rev | line source |
---|---|
428 | 1 ;;; window-xemacs.el --- XEmacs window commands aside from those written in C. |
2 | |
5686
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
3 ;; Copyright (C) 1985, 1989, 1993-94, 1997, 2012 Free Software Foundation, Inc. |
428 | 4 ;; Copyright (C) 1995, 1996 Ben Wing. |
5 | |
6 ;; Maintainer: XEmacs Development Team | |
7 ;; Keywords: frames, extensions, dumped | |
8 | |
9 ;; This file is part of XEmacs. | |
10 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
11 ;; XEmacs is free software: you can redistribute it and/or modify it |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
12 ;; under the terms of the GNU General Public License as published by the |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
13 ;; Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
14 ;; option) any later version. |
428 | 15 |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
16 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
17 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
18 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
19 ;; for more details. |
428 | 20 |
21 ;; You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4674
diff
changeset
|
22 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
428 | 23 |
5686
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
24 ;;; Synched up with: Not synched except for partial sync of |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
25 ;;; recenter-top-bottom |
428 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; This file is dumped with XEmacs. | |
30 | |
31 ;; slb - 5/29/97 | |
32 ;; Split apart from window.el in order to keep that file better in synch | |
33 ;; with Emacs. | |
34 | |
35 ;;; Code: | |
36 | |
37 (defgroup windows nil | |
38 "Windows within a frame." | |
39 :group 'environment) | |
40 | |
41 (defun recenter (&optional n window) | |
42 "Center point in WINDOW and redisplay frame. With N, put point on line N. | |
43 The desired position of point is always relative to the window. | |
44 Just C-u as prefix means put point in the center of the window. | |
45 No N (i.e., it is nil) erases the entire frame and then | |
46 redraws with point in the center of the window. | |
47 If WINDOW is nil, the selected window is used." | |
48 (interactive "_P") | |
49 (center-to-window-line (if (consp n) nil n) window) | |
50 (when (null n) | |
51 (redraw-frame (window-frame window) t))) | |
52 | |
5686
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
53 (defvar recenter-last-op nil |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
54 "Indicates the last recenter operation performed. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
55 Possible values: `top', `middle', `bottom', integer or float numbers.") |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
56 |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
57 ;; Merged from FSF 23.2 with use of scroll-margin for top and bottom |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
58 ;; destinations removed. We don't support scroll-margin. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
59 (defcustom recenter-positions '(middle top bottom) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
60 "Cycling order for `recenter-top-bottom'. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
61 A list of elements with possible values `top', `middle', `bottom', |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
62 integer or float numbers that define the cycling order for |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
63 the command `recenter-top-bottom'. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
64 |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
65 Top and bottom destinations are the window top and bottom. Middle |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
66 redraws the frame and centers point vertically within the window. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
67 Integer number moves current line to the specified absolute |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
68 window-line. Float number between 0.0 and 1.0 means the percentage of |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
69 the screen space from the top. The default cycling order is middle -> |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
70 top -> bottom." |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
71 :type '(repeat (choice |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
72 (const :tag "Top" top) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
73 (const :tag "Middle" middle) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
74 (const :tag "Bottom" bottom) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
75 (integer :tag "Line number") |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
76 (float :tag "Percentage"))) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
77 :version "23.2" |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
78 :group 'windows) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
79 |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
80 (defun recenter-top-bottom (&optional arg) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
81 "Move current buffer line to the specified window line. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
82 With no prefix argument, successive calls place point according |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
83 to the cycling order defined by `recenter-positions'. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
84 |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
85 A prefix argument is handled like `recenter': |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
86 With numeric prefix ARG, move current line to window-line ARG. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
87 With plain `C-u', move current line to window center." |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
88 (interactive "P") |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
89 (cond |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
90 (arg (recenter arg)) ; Always respect ARG. |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
91 (t |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
92 (setq recenter-last-op |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
93 (if (eq this-command last-command) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
94 (car (or (cdr (member recenter-last-op recenter-positions)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
95 recenter-positions)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
96 (car recenter-positions))) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
97 (cond ((eq recenter-last-op 'middle) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
98 (recenter)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
99 ((eq recenter-last-op 'top) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
100 (recenter 0)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
101 ((eq recenter-last-op 'bottom) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
102 (recenter -1)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
103 ((integerp recenter-last-op) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
104 (recenter recenter-last-op)) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
105 ((floatp recenter-last-op) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
106 (recenter (round (* recenter-last-op (window-height))))))))) |
c6b1500299a7
recenter-top-bottom synced from GNU and new default for C-l
Mats Lidell <mats.lidell@cag.se>
parents:
5645
diff
changeset
|
107 |
444 | 108 (defun backward-other-window (count &optional which-frames which-devices) |
109 "Select the COUNT'th different window on this frame, going backwards. | |
110 This is just like calling `other-window' with COUNT negated." | |
428 | 111 (interactive "p") |
444 | 112 (other-window (- count) which-frames which-devices)) |
428 | 113 |
114 (defalias 'windows-of-buffer 'get-buffer-window-list) | |
115 | |
116 (defun buffer-in-multiple-windows-p (&optional buffer) | |
117 "Return t if BUFFER is in multiple windows. | |
118 If BUFFER is not specified, the current buffer will be used." | |
119 (setq buffer (or buffer | |
120 (get-buffer buffer) | |
121 (get-file-buffer buffer) | |
122 (current-buffer))) | |
123 (> (length (windows-of-buffer buffer)) 1)) | |
124 | |
125 (defun window-list (&optional frame minibuf window) | |
126 "Return a list of windows on FRAME, beginning with WINDOW. | |
127 FRAME and WINDOW default to the selected ones. | |
128 Optional second arg MINIBUF t means count the minibuffer window | |
129 even if not active. If MINIBUF is neither t nor nil it means | |
130 not to count the minibuffer even if it is active." | |
1261 | 131 (setq frame (or frame (selected-frame)) |
132 window (or window (selected-window frame))) | |
428 | 133 (if (not (eq (window-frame window) frame)) |
134 (error "Window must be on frame.")) | |
135 (let ((current-frame (selected-frame)) | |
136 list) | |
137 (unwind-protect | |
138 (save-window-excursion | |
139 (select-frame frame) | |
140 (walk-windows | |
141 (function (lambda (cur-window) | |
142 (if (not (eq window cur-window)) | |
143 (setq list (cons cur-window list))))) | |
144 minibuf) | |
145 (setq list (cons window list))) | |
146 (select-frame current-frame)))) | |
147 | |
148 ;; We used to have set-window-dedicated-p as an obsolete version | |
149 ;; of set-window-buffer-dedicated, but it really makes more sense | |
150 ;; this way. | |
151 | |
152 (make-obsolete 'set-window-buffer-dedicated 'set-window-dedicated-p) | |
153 (defun set-window-buffer-dedicated (window buffer) | |
154 "Make WINDOW display BUFFER and be dedicated to that buffer. | |
155 Then Emacs will not automatically change which buffer appears in WINDOW. | |
156 If BUFFER is nil, make WINDOW not be dedicated (but don't change which | |
157 buffer appears in it currently)." | |
158 (if (bufferp buffer) | |
159 (set-window-buffer window (get-buffer-create buffer))) | |
160 (set-window-dedicated-p window (not (null buffer)))) | |
1149 | 161 |
162 ;; Window configurations | |
428 | 163 |
3646 | 164 (defcustom window-configuration-includes-position nil |
165 "*Whether restoring window configurations will restore positions too. | |
166 If nil, only the size of windows will be restored. | |
167 | |
168 Note that setting this value to t may have counterintuitive consequences, | |
169 if a window manager employing virtual desktops is in use." | |
170 :type 'boolean | |
171 :group 'windows) | |
172 | |
1149 | 173 (defstruct saved-window |
174 currentp minibufferp minibuffer-scrollp | |
175 buffer mark-marker | |
176 start-marker | |
177 point-marker | |
178 pixel-left pixel-top pixel-right pixel-bottom | |
179 hscroll modeline-hscroll | |
180 dedicatedp | |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
181 first-hchild first-vchild next-child |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
182 window) |
1149 | 183 |
184 (defstruct window-configuration | |
185 frame | |
2872 | 186 frame-top frame-left |
1149 | 187 frame-pixel-width frame-pixel-height |
188 current-buffer | |
189 minibuffer-pixel-height | |
190 min-width min-height | |
191 saved-root-window) | |
192 | |
4444
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
193 ; make sure we don't get affected by harmful advice |
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
194 (fset 'real-split-window (symbol-function 'split-window)) |
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
195 (fset 'real-delete-window (symbol-function 'delete-window)) |
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
196 |
1149 | 197 (defun window-configuration-equal (conf-1 conf-2) |
198 "Returns a boolean indicating whether the two given configurations | |
3646 | 199 are identical. |
200 | |
201 Window configurations containing windows with different window | |
202 positions are not identical iff `window-configuration-includes-position' | |
203 is t." | |
1149 | 204 (or (eq conf-1 conf-2) |
205 (and (eq (window-configuration-frame conf-1) | |
206 (window-configuration-frame conf-2)) | |
207 (= (window-configuration-frame-pixel-width conf-1) | |
208 (window-configuration-frame-pixel-width conf-2)) | |
209 (= (window-configuration-frame-pixel-height conf-1) | |
210 (window-configuration-frame-pixel-height conf-2)) | |
3646 | 211 (if window-configuration-includes-position |
212 (and (equal (window-configuration-frame-top conf-1) | |
213 (window-configuration-frame-top conf-2)) | |
214 (equal (window-configuration-frame-left conf-1) | |
215 (window-configuration-frame-left conf-2))) | |
216 t) | |
1149 | 217 (eq (window-configuration-current-buffer conf-1) |
218 (window-configuration-current-buffer conf-2)) | |
219 (saved-window-equal (window-configuration-saved-root-window conf-1) | |
220 (window-configuration-saved-root-window conf-2))))) | |
221 | |
222 (defun saved-window-equal (saved-1 saved-2) | |
223 "Returns a boolean indicating whether the two given saved windows | |
224 are identical." | |
225 (or (eq saved-1 saved-2) | |
226 (and (eq (saved-window-currentp saved-1) | |
227 (saved-window-currentp saved-2)) | |
228 (eq (saved-window-minibuffer-scrollp saved-1) | |
229 (saved-window-minibuffer-scrollp saved-2)) | |
230 (eq (saved-window-buffer saved-1) | |
231 (saved-window-buffer saved-2)) | |
232 (equal (saved-window-mark-marker saved-1) | |
233 (saved-window-mark-marker saved-2)) | |
234 (or (and (saved-window-currentp saved-1) | |
235 (saved-window-currentp saved-2)) | |
236 (equal (saved-window-start-marker saved-1) | |
237 (saved-window-start-marker saved-2))) | |
238 (or (and (saved-window-currentp saved-1) | |
239 (saved-window-currentp saved-2)) | |
240 (equal (saved-window-point-marker saved-1) | |
241 (saved-window-point-marker saved-2))) | |
242 (= (saved-window-pixel-left saved-1) | |
243 (saved-window-pixel-left saved-2)) | |
244 (= (saved-window-pixel-top saved-1) | |
245 (saved-window-pixel-top saved-2)) | |
246 (= (saved-window-pixel-right saved-1) | |
247 (saved-window-pixel-right saved-2)) | |
248 (= (saved-window-pixel-bottom saved-1) | |
249 (saved-window-pixel-bottom saved-2)) | |
250 (= (saved-window-hscroll saved-1) | |
251 (saved-window-hscroll saved-2)) | |
1387 | 252 (equal (saved-window-modeline-hscroll saved-1) |
253 (saved-window-modeline-hscroll saved-2)) | |
1149 | 254 (eq (saved-window-dedicatedp saved-1) |
255 (saved-window-dedicatedp saved-2)) | |
256 (maybe-saved-window-equal (saved-window-first-hchild saved-1) | |
257 (saved-window-first-hchild saved-2)) | |
258 (maybe-saved-window-equal (saved-window-first-vchild saved-1) | |
259 (saved-window-first-vchild saved-2)) | |
260 (maybe-saved-window-equal (saved-window-next-child saved-1) | |
261 (saved-window-next-child saved-2))))) | |
262 | |
263 (defun maybe-saved-window-equal (maybe-saved-1 maybe-saved-2) | |
264 "Returns a boolean indicating whether the two given saved windows | |
265 or NILs are identical." | |
266 (cond | |
267 ((and (not maybe-saved-1) (not maybe-saved-2)) t) | |
268 ((not maybe-saved-1) (not maybe-saved-2)) | |
269 ((not maybe-saved-2) (not maybe-saved-1)) | |
270 (t (saved-window-equal maybe-saved-1 maybe-saved-2)))) | |
271 | |
272 (defun current-window-configuration (&optional frame) | |
273 "Return an object representing the current window configuration of FRAME. | |
274 If FRAME is nil or omitted, use the selected frame. | |
275 This describes the number of windows, their sizes and current buffers, | |
276 and for each window on FRAME the displayed buffer, where display | |
277 starts, and the positions of point and mark. | |
278 An exception is made for point in the current buffer: | |
279 its value is -not- saved." | |
280 (let ((frame (or frame (selected-frame)))) | |
281 ;; The original C code used complicated but still incomplete logic | |
282 ;; to decide if and how to restore the size of the minibuffer. It | |
283 ;; goes something like this: | |
284 ; (let ((real-font-height | |
285 ; (font-height (face-font 'default) frame)) | |
286 ; (minibuffer-height | |
287 ; (if (and (minibuffer-window frame) | |
288 ; (not (frame-minibuffer-only-p frame))) | |
289 ; (window-pixel-height (minibuffer-window frame)) | |
290 ; 0))) | |
291 ; ...) | |
292 | |
293 (make-window-configuration | |
294 :frame frame | |
2885 | 295 :frame-top (frame-property frame 'top) |
296 :frame-left (frame-property frame 'left) | |
1149 | 297 :frame-pixel-width (frame-pixel-width frame) |
298 :frame-pixel-height (frame-pixel-height frame) | |
299 :current-buffer (current-buffer) | |
300 :min-width window-min-width :min-height window-min-height | |
301 :minibuffer-pixel-height (window-pixel-height (minibuffer-window frame)) | |
302 ;; this tries to do what the old code did: | |
303 ; :minibuffer-height (if (zerop (% minibuffer-height real-font-height)) | |
304 ; (- (/ minibuffer-height real-font-height)) ; lines | |
305 ; minibuffer-height) ; pixels | |
306 :saved-root-window (root-window->saved-window (frame-root-window frame))))) | |
307 | |
308 (defun root-window->saved-window (window) | |
309 "Converts a root window into a tree of saved-window structures." | |
310 (let ((buffer (window-buffer window)) | |
311 (edges (window-pixel-edges window))) | |
312 (let ((left (nth 0 edges)) | |
313 (top (nth 1 edges)) | |
314 (right (nth 2 edges)) | |
315 (bottom (nth 3 edges))) | |
316 (let ((saved-window | |
317 (make-saved-window | |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
318 :window window |
1149 | 319 :currentp (eq window (selected-window (window-frame window))) |
320 :minibufferp (eq window (minibuffer-window (window-frame window))) | |
321 :minibuffer-scrollp (eq window minibuffer-scroll-window) | |
322 :buffer buffer | |
323 :pixel-left left :pixel-top top :pixel-right right :pixel-bottom bottom | |
324 :hscroll (window-hscroll window) | |
325 :modeline-hscroll (modeline-hscroll window) | |
326 :dedicatedp (window-dedicated-p window) | |
327 :first-hchild (if (window-first-hchild window) | |
328 (root-window->saved-window (window-first-hchild window)) | |
329 nil) | |
330 :first-vchild (if (window-first-vchild window) | |
331 (root-window->saved-window (window-first-vchild window)) | |
332 nil) | |
333 :next-child (if (window-next-child window) | |
334 (root-window->saved-window (window-next-child window)) | |
335 nil)))) | |
336 (if buffer | |
337 (progn | |
338 (let ((marker (make-marker))) | |
339 (set-marker marker (window-start window) buffer) | |
340 (setf (saved-window-start-marker saved-window) marker)) | |
4136 | 341 (if (not (eq buffer (current-buffer))) |
342 (let ((marker (make-marker))) | |
343 (set-marker marker (window-point window) buffer) | |
344 (setf (saved-window-point-marker saved-window) marker))) | |
1149 | 345 (setf (saved-window-mark-marker saved-window) |
346 (copy-marker (mark-marker t buffer))))) | |
347 saved-window)))) | |
348 | |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
349 (defmacro save-window-excursion/mapping (&rest body) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
350 "Execute body, preserving window sizes and contents. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
351 Restores which buffer appears in which window, where display starts, |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
352 as well as the current buffer. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
353 Return alist mapping old windows to new windows. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
354 This alist maps the originally captured windows to the windows that correspond |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
355 to them in the restored configuration. It does not include entries for |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
356 windows that have not changed identity. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
357 Does not restore the value of point in current buffer." |
5753
dbd8305e13cb
Warn about non-string non-integer ARG to #'gensym, bytecomp.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5686
diff
changeset
|
358 (let ((window-config (gensym "window-config")) |
dbd8305e13cb
Warn about non-string non-integer ARG to #'gensym, bytecomp.el.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5686
diff
changeset
|
359 (mapping (gensym "mapping"))) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
360 `(let ((,window-config (current-window-configuration)) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
361 (,mapping)) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
362 (unwind-protect |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
363 (progn ,@body) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
364 (setq ,mapping (set-window-configuration/mapping ,window-config))) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
365 ,mapping))) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
366 |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
367 (defun set-window-configuration (configuration &optional set-frame-size-p) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
368 "Set the configuration of windows and buffers as specified by CONFIGURATION. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
369 CONFIGURATION must be a value previously returned |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
370 by `current-window-configuration'. |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
371 If SET-FRAME-SIZE-P is true, the frame size is also restored. |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
372 " |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
373 (set-window-configuration/mapping configuration set-frame-size-p) |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
374 nil) ; make sure nobody relies on mapping return value |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
375 |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
376 (defun set-window-configuration/mapping (configuration &optional set-frame-size-p) |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
377 "Set the configuration of windows and buffers as specified by CONFIGURATION. |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
378 CONFIGURATION must be a value previously returned |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
379 by `current-window-configuration'. |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
380 If SET-FRAME-SIZE-P is true, the frame size is also restored. |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
381 Return alist mapping old windows to new windows. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
382 This alist maps the originally captured windows to the windows that correspond |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
383 to them in the restored configuration. It does not include entries for |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
384 windows that have not changed identity." |
1149 | 385 (let ((frame (window-configuration-frame configuration))) |
386 (if (and (frame-live-p frame) | |
387 (not (window-configuration-equal configuration | |
388 (current-window-configuration)))) | |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
389 (really-set-window-configuration frame configuration set-frame-size-p)))) |
1149 | 390 |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
391 (defun really-set-window-configuration (frame configuration set-frame-size-p) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
392 "Set the window configuration CONFIGURATION on live frame FRAME. |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
393 If SET-FRAME-SIZE-P is true, the frame size is also restored. |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
394 Return alist mapping old windows to new windows." |
1149 | 395 ;; avoid potential temporary problems |
396 (setq window-min-width 0) | |
397 (setq window-min-height 0) | |
398 (setq minibuffer-scroll-window nil) | |
399 | |
400 (frame-reduce-to-one-window frame) | |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
401 (if set-frame-size-p |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
402 (set-window-configuration-frame-size configuration)) |
2888 | 403 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
404 ;; avoid setting these if they're already up-to-date |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
405 ;; This also avoids potential inaccuracies in these settings --Mike |
3646 | 406 (when window-configuration-includes-position |
407 (let ((left (window-configuration-frame-left configuration)) | |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
408 (top (window-configuration-frame-top configuration))) |
3646 | 409 (if (not (equal left (frame-property frame 'left))) |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
410 (set-frame-property frame 'left left)) |
3646 | 411 (if (not (equal top (frame-property frame 'top))) |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
412 (set-frame-property frame 'top top)))) |
1149 | 413 |
414 ;; these may have changed because of the delete | |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
415 (set-window-pixel-height (minibuffer-window frame) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
416 (window-configuration-minibuffer-pixel-height configuration)) |
1149 | 417 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
418 ;; avoid that `set-window-point' will set the buffer's point for |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
419 ;; the selected window |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
420 (select-window (minibuffer-window frame)) |
1149 | 421 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
422 (let ((window-configuration-current-window nil) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
423 (mapping (list nil))) ; poor man's box |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
424 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
425 (declare (special window-configuration-current-window)) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
426 (restore-saved-window configuration |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
427 (frame-root-window frame) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
428 (window-configuration-saved-root-window configuration) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
429 'vertical |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
430 mapping) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
431 (if window-configuration-current-window |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
432 (select-window window-configuration-current-window)) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
433 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
434 (setq window-min-width (window-configuration-min-width configuration)) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
435 (setq window-min-height (window-configuration-min-height configuration)) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
436 |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
437 (let ((buffer (window-configuration-current-buffer configuration))) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
438 (if (buffer-live-p buffer) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
439 (set-buffer buffer) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
440 (set-buffer (car (buffer-list))))) |
4674
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
441 ; this resets the window configuration so that the frame is filled |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
442 (if (not set-frame-size-p) |
e95ddfd6a409
In `set-window-configuration', don't restore frame size unconditionally.
Mike Sperber <sperber@deinprogramm.de>
parents:
4673
diff
changeset
|
443 (set-frame-pixel-size frame (frame-pixel-width frame) (frame-pixel-height frame))) |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
444 (car mapping))) |
1149 | 445 |
446 (defun set-window-configuration-frame-size (configuration) | |
447 "Restore the frame size of a window configuration." | |
448 (set-frame-pixel-size | |
449 (window-configuration-frame configuration) | |
450 (window-configuration-frame-pixel-width configuration) | |
451 (window-configuration-frame-pixel-height configuration))) | |
452 | |
453 (defun frame-reduce-to-one-window (frame) | |
454 "Delete all windows except the minibuffer and one other in FRAME." | |
455 (let* ((root-window (frame-root-window frame)) | |
456 (combination-start (or (window-first-hchild root-window) | |
457 (window-first-vchild root-window)))) | |
458 (if combination-start | |
459 (window-reduce-to-one combination-start)))) | |
460 | |
1230 | 461 ;; Note that simply using `delete-other-windows' causes obscure |
462 ;; breakage. --Mike | |
463 | |
1149 | 464 (defun window-reduce-to-one (window) |
465 "Make sure only one subwindow of WINDOW is left." | |
1230 | 466 (let ((window (window-next-child window))) |
467 (while window | |
468 (if (window-live-p window) | |
469 (let ((next (window-next-child window))) | |
4444
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
470 (real-delete-window window) |
1230 | 471 (setq window next))))) |
472 (cond | |
473 ((window-first-hchild window) | |
474 (window-reduce-to-one (window-first-hchild window))) | |
475 ((window-first-vchild window) | |
476 (window-reduce-to-one (window-first-vchild window))))) | |
1149 | 477 |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
478 (defun restore-saved-window (configuration window saved-window direction mapping) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
479 "Within CONFIGURATION, restore WINDOW to the state of SAVED-WINDOW. |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
480 MAPPING is a one-element list whose element is an old-window-to-new-window |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
481 mapping, which this function will extend." |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
482 (if (not (eq (saved-window-window saved-window) window)) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
483 (rplaca mapping |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
484 (cons (cons (saved-window-window saved-window) window) |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
485 (car mapping)))) |
4438
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
486 (cond |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
487 ((and (saved-window-next-child saved-window) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
488 (not (saved-window-minibufferp (saved-window-next-child saved-window)))) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
489 (cond ((eq direction 'vertical) |
4444
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
490 (real-split-window window nil nil)) |
4438
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
491 ((eq direction 'horizontal) |
4444
715c3ced8fa8
Use `real-split-window', `real-delete-window' in window-config code.
Mike Sperber <sperber@deinprogramm.de>
parents:
4438
diff
changeset
|
492 (real-split-window window nil t))) |
4438
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
493 (if (not (saved-window-minibufferp saved-window)) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
494 (restore-saved-window-parameters configuration window saved-window)) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
495 (restore-saved-window configuration |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
496 (window-next-child window) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
497 (saved-window-next-child saved-window) |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
498 direction |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
499 mapping)) |
4438
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
500 ((not (saved-window-minibufferp saved-window)) |
2785829fe37c
Fix window-configuration problem.
Mike Sperber <sperber@deinprogramm.de>
parents:
4136
diff
changeset
|
501 (restore-saved-window-parameters configuration window saved-window))) |
1149 | 502 |
1576 | 503 (if (saved-window-first-hchild saved-window) |
504 (restore-saved-window configuration | |
505 window | |
506 (saved-window-first-hchild saved-window) | |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
507 'horizontal |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
508 mapping)) |
1576 | 509 (if (saved-window-first-vchild saved-window) |
510 (restore-saved-window configuration | |
511 window | |
512 (saved-window-first-vchild saved-window) | |
4445
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
513 'vertical |
1d41b9bcf74f
Add `set-window-configuration/mapping' and `save-window-excursion/mapping'.
Mike Sperber <sperber@deinprogramm.de>
parents:
4444
diff
changeset
|
514 mapping))) |
1149 | 515 |
516 (defun restore-saved-window-parameters (configuration window saved-window) | |
517 "Restore the window parameters stored in SAVED-WINDOW on WINDOW." | |
1261 | 518 (declare (special window-configuration-current-window)) |
1149 | 519 (let ((buffer (saved-window-buffer saved-window))) |
520 (if (and buffer (buffer-live-p buffer)) | |
521 (progn | |
522 (set-window-buffer window | |
523 (saved-window-buffer saved-window)) | |
524 (set-window-start window | |
1161 | 525 (marker-position (saved-window-start-marker saved-window)) |
526 t) | |
4136 | 527 (if (markerp (saved-window-point-marker saved-window)) |
528 (set-window-point window | |
529 (marker-position (saved-window-point-marker saved-window)))) | |
1149 | 530 (set-marker (mark-marker t buffer) |
531 (marker-position (saved-window-mark-marker saved-window)) | |
532 buffer) | |
533 (if (not (eq buffer (window-configuration-current-buffer configuration))) | |
534 (goto-char (window-point window) buffer))))) | |
535 | |
536 (if (and (not (saved-window-first-hchild saved-window)) | |
537 (not (saved-window-first-vchild saved-window))) | |
538 ;; only set size for non-container windows | |
539 (progn | |
540 ;; If this is the root window, it may be the only window. | |
541 ;; Because of mismatches between actual and reported frame | |
542 ;; size, it may not let us actually set the size of the root | |
543 ;; window to what we want. --Mike | |
544 (if (not (eq window (frame-root-window (window-frame window)))) | |
545 (progn | |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
546 (set-window-pixel-width window |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
547 (saved-window-pixel-width saved-window)) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
548 (set-window-pixel-height window |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
549 (saved-window-pixel-height saved-window)))) |
1149 | 550 (set-window-hscroll window (saved-window-hscroll saved-window)) |
551 (set-modeline-hscroll window | |
552 (saved-window-modeline-hscroll saved-window)) | |
553 (set-window-dedicated-p window (saved-window-dedicatedp saved-window)))) | |
554 | |
555 (if (saved-window-currentp saved-window) | |
556 (setq window-configuration-current-window window)) | |
557 (if (saved-window-minibuffer-scrollp saved-window) | |
558 (setq minibuffer-scroll-window window))) | |
559 | |
560 (defun saved-window-pixel-width (saved-window) | |
561 "Compute the pixel width of SAVED-WINDOW." | |
562 (- (saved-window-pixel-right saved-window) | |
563 (saved-window-pixel-left saved-window))) | |
564 | |
565 (defun saved-window-pixel-height (saved-window) | |
566 "Compute the pixel height of SAVED-WINDOW." | |
567 (- (saved-window-pixel-bottom saved-window) | |
568 (saved-window-pixel-top saved-window))) | |
4673
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
569 |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
570 (defun set-window-pixel-width (window width) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
571 "Set the pixel width of WINDOW." |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
572 (enlarge-window-pixels (- width (window-pixel-width window)) t window)) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
573 |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
574 (defun set-window-pixel-height (window height) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
575 "Set the pixel height of WINDOW." |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
576 (enlarge-window-pixels (- height (window-pixel-height window)) nil window)) |
11d71be1c232
Add `set-window-pixel-{width,height} convenience functions.
Mike Sperber <sperber@deinprogramm.de>
parents:
4445
diff
changeset
|
577 |
428 | 578 |
579 ;; The window-config stack is stored as a list in frame property | |
580 ;; 'window-config-stack, with the most recent element at the front. | |
581 ;; When you pop off an element, the popped off element gets put at the | |
582 ;; front of frame property 'window-config-unpop-stack, so you can | |
583 ;; retrieve it using unpop-window-configuration. | |
584 | |
585 (defcustom window-config-stack-max 16 | |
586 "*Maximum size of window configuration stack. | |
587 Start discarding off end if it gets this big." | |
588 :type 'integer | |
589 :group 'windows) | |
590 | |
591 (defun window-config-stack (&optional frame) | |
592 (or frame (setq frame (selected-frame))) | |
593 (let ((stack (frame-property frame 'window-config-stack))) | |
594 (if stack | |
595 (set-undoable-stack-max stack window-config-stack-max) | |
596 (progn | |
597 (setq stack (make-undoable-stack window-config-stack-max)) | |
598 (set-frame-property frame 'window-config-stack stack))) | |
599 stack)) | |
600 | |
601 (defun push-window-configuration (&optional config) | |
602 "Push the current window configuration onto the window-config stack. | |
603 If CONFIG is specified, push it instead of the current window configuration. | |
604 Each frame has its own window-config stack." | |
605 (interactive) | |
606 (let ((wc (or config (current-window-configuration))) | |
607 (stack (window-config-stack))) | |
5366
f00192e1cd49
Examining the result of #'length: `eql', not `=', it's better style & cheaper
Aidan Kehoe <kehoea@parhasard.net>
parents:
4674
diff
changeset
|
608 (if (or (eql 0 (undoable-stack-a-length stack)) |
428 | 609 (not (equal (undoable-stack-a-top stack) wc))) |
610 (undoable-stack-push stack wc)))) | |
611 | |
612 (defun pop-window-configuration () | |
613 "Pop the top window configuration off the window-config stack and set it. | |
614 Before setting the new window configuration, the current window configuration | |
615 is pushed onto the \"unpop\" stack. | |
616 `unpop-window-configuration' undoes what this function does. | |
617 Each frame has its own window-config and \"unpop\" stack." | |
618 (interactive) | |
619 (let ((stack (window-config-stack)) | |
620 (wc (current-window-configuration)) | |
621 popped) | |
622 (condition-case nil | |
623 (progn | |
624 (setq popped (undoable-stack-pop stack)) | |
625 (while (equal popped wc) | |
626 (setq popped (undoable-stack-pop stack))) | |
627 (undoable-stack-push stack wc) | |
628 (undoable-stack-undo stack) | |
629 (set-window-configuration popped) | |
630 popped) | |
631 (trunc-stack-bottom | |
632 (error "Bottom of window config stack"))))) | |
633 | |
634 (defun unpop-window-configuration () | |
635 "Undo the effect of the most recent `pop-window-configuration'. | |
636 This does exactly the inverse of what `pop-window-configuration' does: | |
637 i.e. it pops a window configuration off of the \"unpop\" stack and | |
638 pushes the current window configuration onto the window-config stack. | |
639 Each frame has its own window-config and \"unpop\" stack." | |
640 (interactive) | |
641 (let ((stack (window-config-stack)) | |
642 (wc (current-window-configuration)) | |
643 popped) | |
644 (condition-case nil | |
645 (progn | |
646 (setq popped | |
647 (progn | |
648 (undoable-stack-redo stack) | |
649 (undoable-stack-pop stack))) | |
650 (while (equal popped wc) | |
651 (setq popped | |
652 (progn | |
653 (undoable-stack-redo stack) | |
654 (undoable-stack-pop stack)))) | |
655 (undoable-stack-push stack wc) | |
656 (set-window-configuration popped) | |
657 popped) | |
658 (trunc-stack-bottom | |
659 (error "Top of window config stack"))))) | |
660 | |
661 | |
662 ;;;;;;;;;;;;; display-buffer, moved here from C. Hallelujah. | |
663 | |
442 | 664 (make-variable-buffer-local '__buffer-dedicated-frame) |
665 | |
666 (defun buffer-dedicated-frame (&optional buffer) | |
667 "Return the frame dedicated to this BUFFER, or nil if there is none. | |
668 No argument or nil as argument means use current buffer as BUFFER." | |
669 (let ((buffer (decode-buffer buffer))) | |
670 (let ((frame (symbol-value-in-buffer '__buffer-dedicated-frame buffer))) | |
671 ;; XEmacs addition: if the frame is dead, silently make it go away. | |
672 (when (and (framep frame) (not (frame-live-p frame))) | |
673 (with-current-buffer buffer | |
674 (setq __buffer-dedicated-frame nil)) | |
675 (setq frame nil)) | |
676 frame))) | |
677 | |
678 (defun set-buffer-dedicated-frame (buffer frame) | |
679 "For this BUFFER, set the FRAME dedicated to it. | |
680 FRAME must be a frame or nil." | |
681 (let ((buffer (decode-buffer buffer))) | |
682 (and frame | |
683 (check-argument-type #'frame-live-p frame)) | |
684 (with-current-buffer buffer | |
685 (setq __buffer-dedicated-frame frame)))) | |
686 | |
428 | 687 (defvar display-buffer-function nil |
688 "If non-nil, function to call to handle `display-buffer'. | |
903 | 689 It will receive four args: the same as those to `display-buffer'.") |
428 | 690 |
691 (defvar pre-display-buffer-function nil | |
692 "If non-nil, function that will be called from `display-buffer' | |
903 | 693 as the first action. It will receive four args: the same as those |
428 | 694 to `display-buffer'. |
695 This function may be used to select an appropriate frame for the buffer, | |
696 for example. See also the variable `display-buffer-function', which may | |
697 be used to completely replace the `display-buffer' function. | |
698 If the return value of this function is non-nil, it should be a frame, | |
699 and that frame will be used to display the buffer.") | |
700 | |
701 (defcustom pop-up-frames nil | |
702 "*Non-nil means `display-buffer' should make a separate frame." | |
703 :type 'boolean | |
704 :group 'frames) | |
705 | |
706 (defvar pop-up-frame-function nil | |
707 "Function to call to handle automatic new frame creation. | |
708 It is called with no arguments and should return a newly created frame. | |
709 | |
710 A typical value might be `(lambda () (new-frame pop-up-frame-alist))' | |
711 where `pop-up-frame-alist' would hold the default frame parameters.") | |
712 | |
713 (defcustom special-display-buffer-names nil | |
714 "*List of buffer names that should have their own special frames. | |
715 Displaying a buffer whose name is in this list makes a special frame for it | |
716 using `special-display-function'. | |
717 | |
718 An element of the list can be a cons cell instead of just a string. | |
719 Then the car should be a buffer name, and the cdr specifies frame | |
720 parameters for creating the frame for that buffer. | |
721 More precisely, the cdr is passed as the second argument to | |
722 the function found in `special-display-function', when making that frame. | |
723 See also `special-display-regexps'." | |
724 :type '(repeat (choice :value "" | |
725 (string :tag "Name") | |
726 (cons :menu-tag "Properties" | |
727 :value ("" . nil) | |
728 (string :tag "Name") | |
729 (repeat :tag "Properties" | |
730 (group :inline t | |
731 (symbol :tag "Property") | |
732 (sexp :tag "Value")))))) | |
733 :group 'frames) | |
734 | |
735 (defcustom special-display-regexps nil | |
736 "*List of regexps saying which buffers should have their own special frames. | |
737 If a buffer name matches one of these regexps, it gets its own frame. | |
738 Displaying a buffer whose name is in this list makes a special frame for it | |
739 using `special-display-function'. | |
740 | |
741 An element of the list can be a cons cell instead of just a string. | |
742 Then the car should be the regexp, and the cdr specifies frame | |
743 parameters for creating the frame for buffers that match. | |
744 More precisely, the cdr is passed as the second argument to | |
745 the function found in `special-display-function', when making that frame. | |
746 See also `special-display-buffer-names'." | |
747 :type '(repeat (choice :value "" | |
748 regexp | |
749 (cons :menu-tag "Properties" | |
750 :value ("" . nil) | |
751 regexp | |
752 (repeat :tag "Properties" | |
753 (group :inline t | |
754 (symbol :tag "Property") | |
755 (sexp :tag "Value")))))) | |
756 :group 'frames) | |
757 | |
758 (defvar special-display-function nil | |
759 "Function to call to make a new frame for a special buffer. | |
760 It is called with two arguments, the buffer and optional buffer specific | |
761 data, and should return a window displaying that buffer. | |
762 The default value makes a separate frame for the buffer, | |
763 using `special-display-frame-alist' to specify the frame parameters. | |
764 | |
765 A buffer is special if its is listed in `special-display-buffer-names' | |
766 or matches a regexp in `special-display-regexps'.") | |
767 | |
768 (defcustom same-window-buffer-names nil | |
769 "*List of buffer names that should appear in the selected window. | |
770 Displaying one of these buffers using `display-buffer' or `pop-to-buffer' | |
771 switches to it in the selected window, rather than making it appear | |
772 in some other window. | |
773 | |
774 An element of the list can be a cons cell instead of just a string. | |
775 Then the car must be a string, which specifies the buffer name. | |
776 This is for compatibility with `special-display-buffer-names'; | |
777 the cdr of the cons cell is ignored. | |
778 | |
779 See also `same-window-regexps'." | |
780 :type '(repeat (string :tag "Name")) | |
781 :group 'windows) | |
782 | |
783 (defcustom same-window-regexps nil | |
784 "*List of regexps saying which buffers should appear in the selected window. | |
785 If a buffer name matches one of these regexps, then displaying it | |
786 using `display-buffer' or `pop-to-buffer' switches to it | |
787 in the selected window, rather than making it appear in some other window. | |
788 | |
789 An element of the list can be a cons cell instead of just a string. | |
790 Then the car must be a string, which specifies the buffer name. | |
791 This is for compatibility with `special-display-buffer-names'; | |
792 the cdr of the cons cell is ignored. | |
793 | |
794 See also `same-window-buffer-names'." | |
795 :type '(repeat regexp) | |
796 :group 'windows) | |
797 | |
798 (defcustom pop-up-windows t | |
799 "*Non-nil means display-buffer should make new windows." | |
800 :type 'boolean | |
801 :group 'windows) | |
802 | |
803 (defcustom split-height-threshold 500 | |
804 "*display-buffer would prefer to split the largest window if this large. | |
805 If there is only one window, it is split regardless of this value." | |
806 :type 'integer | |
807 :group 'windows) | |
808 | |
809 (defcustom split-width-threshold 500 | |
810 "*display-buffer would prefer to split the largest window if this large. | |
811 If there is only one window, it is split regardless of this value." | |
812 :type 'integer | |
813 :group 'windows) | |
814 | |
815 ;; Can you believe that all of this crap was formerly in C? | |
816 ;; Praise Jesus that it's not there any more. | |
817 | |
903 | 818 (defun display-buffer (buffer &optional not-this-window-p override-frame |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
819 shrink-to-fit) |
428 | 820 "Make BUFFER appear in some window on the current frame, but don't select it. |
821 BUFFER can be a buffer or a buffer name. | |
822 If BUFFER is shown already in some window in the current frame, | |
823 just uses that one, unless the window is the selected window and | |
824 NOT-THIS-WINDOW-P is non-nil (interactively, with prefix arg). | |
825 | |
826 If BUFFER has a dedicated frame, display on that frame instead of | |
827 the current frame, unless OVERRIDE-FRAME is non-nil. | |
828 | |
829 If OVERRIDE-FRAME is non-nil, display on that frame instead of | |
830 the current frame (or the dedicated frame). | |
831 | |
903 | 832 If SHRINK-TO-FIT is non-nil and splitting the window is appropriate, give |
833 the new buffer less than half the space if it is small enough to fit. | |
834 | |
428 | 835 If `pop-up-windows' is non-nil, always use the |
836 current frame and create a new window regardless of whether the | |
837 buffer has a dedicated frame, and regardless of whether | |
838 OVERRIDE-FRAME was specified. | |
839 | |
840 If `pop-up-frames' is non-nil, make a new frame if no window shows BUFFER. | |
841 | |
2590 | 842 If the buffer name is a member of the `same-window-buffer-names' list, |
843 or matches one of the `same-window-regexps' expressions, display the | |
844 buffer in the currently selected window. | |
845 | |
428 | 846 Returns the window displaying BUFFER." |
847 (interactive "BDisplay buffer:\nP") | |
848 | |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
849 (let ((wconfig (current-window-configuration))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
850 (prog1 |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
851 ;; We just simulate a `return' in C. This function is way |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
852 ;; ugly and does `returns' all over the place and there's |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
853 ;; no sense in trying to rewrite it to be more Lispy. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
854 (block nil |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
855 (labels |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
856 ((display-buffer-1 (window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
857 ;; Deiconify the frame containing the window WINDOW, then |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
858 ;; return WINDOW. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
859 (if (frame-iconified-p (window-frame window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
860 (make-frame-visible (window-frame window))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
861 window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
862 (let (window old-frame target-frame explicit-frame shrink-it) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
863 (setq old-frame (or (last-nonminibuf-frame) (selected-frame))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
864 (setq buffer (get-buffer buffer)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
865 (check-argument-type 'bufferp buffer) |
428 | 866 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
867 (setq explicit-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
868 (if pre-display-buffer-function |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
869 (funcall pre-display-buffer-function buffer |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
870 not-this-window-p |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
871 override-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
872 shrink-to-fit))) |
428 | 873 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
874 ;; Give the user the ability to completely reimplement |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
875 ;; this function via the `display-buffer-function'. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
876 (if display-buffer-function |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
877 (return (funcall display-buffer-function buffer |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
878 not-this-window-p |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
879 override-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
880 shrink-to-fit))) |
428 | 881 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
882 ;; If the buffer has a dedicated frame, that takes |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
883 ;; precedence over the current frame, and over what the |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
884 ;; pre-display-buffer-function did. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
885 (let ((dedi (buffer-dedicated-frame buffer))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
886 (if (frame-live-p dedi) (setq explicit-frame dedi))) |
428 | 887 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
888 ;; if override-frame is supplied, that takes precedence over |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
889 ;; everything. This is gonna look bad if the |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
890 ;; pre-display-buffer-function raised some other frame already. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
891 (if override-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
892 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
893 (check-argument-type 'frame-live-p override-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
894 (setq explicit-frame override-frame))) |
428 | 895 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
896 (setq target-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
897 (or explicit-frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
898 (last-nonminibuf-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
899 (selected-frame))) |
428 | 900 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
901 ;; If we have switched frames, then set not-this-window-p to |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
902 ;; false. Switching frames means that selected-window is no |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
903 ;; longer the same as it was on entry -- it's the |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
904 ;; selected-window of target_frame instead of old_frame, so |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
905 ;; it's a fine candidate for display. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
906 (if (not (eq old-frame target-frame)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
907 (setq not-this-window-p nil)) |
428 | 908 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
909 ;; if it's in the selected window, and that's ok, then we're |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
910 ;; done. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
911 (if (and (not not-this-window-p) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
912 (eq buffer (window-buffer (selected-window)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
913 (return (display-buffer-1 (selected-window)))) |
428 | 914 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
915 ;; See if the user has specified this buffer should |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
916 ;; appear in the selected window. |
428 | 917 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
918 (if not-this-window-p |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
919 nil |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
920 (if (or (member (buffer-name buffer) same-window-buffer-names) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
921 (assoc (buffer-name buffer) same-window-buffer-names)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
922 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
923 (switch-to-buffer buffer) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
924 (return (display-buffer-1 (selected-window))))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
925 |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
926 (let ((tem same-window-regexps)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
927 (while tem |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
928 (let ((car (car tem))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
929 (if (or |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
930 (and (stringp car) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
931 (string-match car (buffer-name buffer))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
932 (and (consp car) (stringp (car car)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
933 (string-match (car car) (buffer-name buffer)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
934 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
935 (switch-to-buffer buffer) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
936 (return (display-buffer-1 (selected-window)))))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
937 (setq tem (cdr tem))))) |
428 | 938 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
939 ;; If pop-up-frames, look for a window showing BUFFER |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
940 ;; on any visible or iconified frame. Otherwise search |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
941 ;; only the current frame. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
942 (if (and (not explicit-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
943 (or pop-up-frames (not (last-nonminibuf-frame)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
944 (setq target-frame 0)) |
428 | 945 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
946 ;; Otherwise, find some window that it's already in, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
947 ;; and return that, unless that window is the selected |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
948 ;; window and that isn't ok. What a contorted mess! |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
949 (setq window (or (if (not explicit-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
950 ;; search the selected frame |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
951 ;; first if the user didn't |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
952 ;; specify an explicit frame. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
953 (get-buffer-window buffer nil)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
954 (get-buffer-window buffer target-frame))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
955 (if (and window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
956 (or (not not-this-window-p) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
957 (not (eq window (selected-window))))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
958 (return (display-buffer-1 window))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
959 ;; Certain buffer names get special handling. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
960 (if special-display-function |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
961 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
962 (if (member (buffer-name buffer) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
963 special-display-buffer-names) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
964 (return (funcall special-display-function buffer))) |
428 | 965 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
966 (let ((tem (assoc (buffer-name buffer) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
967 special-display-buffer-names))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
968 (if tem |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
969 (return (funcall special-display-function |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
970 buffer (cdr tem))))) |
428 | 971 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
972 (let ((tem special-display-regexps)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
973 (while tem |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
974 (let ((car (car tem))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
975 (if (and (stringp car) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
976 (string-match car (buffer-name buffer))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
977 (return |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
978 (funcall special-display-function buffer))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
979 (if (and (consp car) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
980 (stringp (car car)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
981 (string-match (car car) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
982 (buffer-name buffer))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
983 (return (funcall special-display-function buffer |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
984 (cdr car))))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
985 (setq tem (cdr tem)))))) |
428 | 986 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
987 ;; If there are no frames open that have more than a minibuffer, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
988 ;; we need to create a new frame. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
989 (if (or pop-up-frames |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
990 (null (last-nonminibuf-frame))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
991 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
992 (setq window (frame-selected-window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
993 (funcall pop-up-frame-function))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
994 (set-window-buffer window buffer) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
995 (return (display-buffer-1 window)))) |
428 | 996 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
997 ;; Otherwise, make it be in some window, splitting if |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
998 ;; appropriate/possible. Do not split a window if we |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
999 ;; are displaying the buffer in a different frame than |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1000 ;; that which was current when we were called. (It is |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1001 ;; already in a different window by virtue of being in |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1002 ;; another frame.) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1003 (if (or (and pop-up-windows (eq target-frame old-frame)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1004 (eq 'only (frame-property (selected-frame) 'minibuffer)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1005 ;; If the current frame is a special display frame, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1006 ;; don't try to reuse its windows. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1007 (window-dedicated-p |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1008 (frame-root-window (selected-frame)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1009 (progn |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1010 (if (eq 'only (frame-property (selected-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1011 'minibuffer)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1012 (setq target-frame (last-nonminibuf-frame))) |
428 | 1013 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1014 ;; Don't try to create a window if would get an error with |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1015 ;; height. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1016 (if (< split-height-threshold (* 2 window-min-height)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1017 (setq split-height-threshold (* 2 window-min-height))) |
428 | 1018 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1019 ;; Same with width. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1020 (if (< split-width-threshold (* 2 window-min-width)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1021 (setq split-width-threshold (* 2 window-min-width))) |
428 | 1022 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1023 ;; If the frame we would try to split cannot be split, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1024 ;; try other frames. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1025 (if (frame-property (if (null target-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1026 (selected-frame) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1027 (last-nonminibuf-frame)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1028 'unsplittable) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1029 (setq window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1030 ;; Try visible frames first. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1031 (or (get-largest-window 'visible) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1032 ;; If that didn't work, try iconified frames. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1033 (get-largest-window 0) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1034 (get-largest-window t))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1035 (setq window (get-largest-window target-frame))) |
428 | 1036 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1037 ;; If we got a tall enough full-width window that |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1038 ;; can be split, split it. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1039 (if (and window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1040 (not (frame-property (window-frame window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1041 'unsplittable)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1042 (>= (window-height window) split-height-threshold) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1043 (or (>= (window-width window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1044 split-width-threshold) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1045 (and (window-leftmost-p window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1046 (window-rightmost-p window)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1047 (setq window (split-window window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1048 (let (upper other) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1049 (setq window (get-lru-window target-frame)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1050 ;; If the LRU window is selected, and big enough, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1051 ;; and can be split, split it. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1052 (if (and window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1053 (not (frame-property (window-frame window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1054 'unsplittable)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1055 (or (eq window (selected-window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1056 (not (window-parent window))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1057 (>= (window-height window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1058 (* 2 window-min-height))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1059 (setq window (split-window window))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1060 ;; If get-lru-window returned nil, try other |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1061 ;; approaches. Try visible frames first. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1062 (or window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1063 (setq window (or (get-largest-window 'visible) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1064 ;; If that didn't work, try |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1065 ;; iconified frames. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1066 (get-largest-window 0) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1067 ;; Try invisible frames. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1068 (get-largest-window t) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1069 ;; As a last resort, make |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1070 ;; a new frame. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1071 (frame-selected-window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1072 (funcall |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1073 pop-up-frame-function))))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1074 ;; If window appears above or below another, |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1075 ;; even out their heights. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1076 (if (window-previous-child window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1077 (setq other (window-previous-child window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1078 upper other)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1079 (if (window-next-child window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1080 (setq other (window-next-child window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1081 upper window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1082 ;; Check that OTHER and WINDOW are vertically arrayed. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1083 (if (and other |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1084 (not (= (nth 1 (window-pixel-edges other)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1085 (nth 1 (window-pixel-edges window)))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1086 (> (window-pixel-height other) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1087 (window-pixel-height window))) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1088 (enlarge-window (- (/ (+ (window-height other) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1089 (window-height window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1090 2) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1091 (window-height upper)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1092 nil upper)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1093 ;; Klaus Berndl <klaus.berndl@sdm.de>: Only in |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1094 ;; this situation we shrink-to-fit but we can do |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1095 ;; this first after we have displayed buffer in |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1096 ;; window (s.b. (set-window-buffer window buffer)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1097 (setq shrink-it shrink-to-fit)))) |
428 | 1098 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1099 (setq window (get-lru-window target-frame))) |
428 | 1100 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1101 ;; Bring the window's previous buffer to the top of the |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1102 ;; MRU chain. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1103 (if (window-buffer window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1104 (save-excursion |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1105 (save-selected-window |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1106 (select-window window) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1107 (record-buffer (window-buffer window))))) |
428 | 1108 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1109 (set-window-buffer window buffer) |
1669 | 1110 |
5645
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1111 ;; Now window's previous buffer has been brought to the |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1112 ;; top of the MRU chain and window displays buffer - |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1113 ;; now we can shrink-to-fit if necessary |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1114 (if shrink-it |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1115 (shrink-window-if-larger-than-buffer window)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1116 (display-buffer-1 window)))) ;; End of prog1's 1th form. |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1117 (or (equal wconfig (current-window-configuration)) |
5d3bb1100832
Remove some utility functions from the global namespace, lisp/
Aidan Kehoe <kehoea@parhasard.net>
parents:
5473
diff
changeset
|
1118 (push-window-configuration wconfig))))) |
428 | 1119 |
1120 ;;; window-xemacs.el ends here |