Mercurial > emacs
annotate lisp/gnus/gnus-win.el @ 107782:2acfb2283cec
* help.el (describe-mode): Return nil (for IELM's sake).
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Mon, 05 Apr 2010 12:36:45 +0200 |
parents | 1d1d5d9bd884 |
children | 8d09094063d0 376148b31b5e |
rev | line source |
---|---|
17493 | 1 ;;; gnus-win.el --- window configuration functions for Gnus |
64754
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
2 |
fafd692d1e40
Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
106815 | 4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
17493 | 5 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 7 ;; Keywords: news |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93617
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
17493 | 12 ;; it under the terms of the GNU General Public License as published by |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93617
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93617
diff
changeset
|
14 ;; (at your option) any later version. |
17493 | 15 |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93617
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17493 | 19 ;; GNU General Public License for more details. |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
94662
f42ef85caf91
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93617
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
17493 | 23 |
24 ;;; Commentary: | |
25 | |
26 ;;; Code: | |
27 | |
19521
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
28 (eval-when-compile (require 'cl)) |
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
29 |
17493 | 30 (require 'gnus) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
31 (require 'gnus-util) |
17493 | 32 |
33 (defgroup gnus-windows nil | |
34 "Window configuration." | |
35 :group 'gnus) | |
36 | |
37 (defcustom gnus-use-full-window t | |
38 "*If non-nil, use the entire Emacs screen." | |
39 :group 'gnus-windows | |
40 :type 'boolean) | |
41 | |
42 (defvar gnus-window-configuration nil | |
43 "Obsolete variable. See `gnus-buffer-configuration'.") | |
44 | |
45 (defcustom gnus-window-min-width 2 | |
46 "*Minimum width of Gnus buffers." | |
47 :group 'gnus-windows | |
48 :type 'integer) | |
49 | |
50 (defcustom gnus-window-min-height 1 | |
51 "*Minimum height of Gnus buffers." | |
52 :group 'gnus-windows | |
53 :type 'integer) | |
54 | |
55 (defcustom gnus-always-force-window-configuration nil | |
56 "*If non-nil, always force the Gnus window configurations." | |
57 :group 'gnus-windows | |
58 :type 'boolean) | |
59 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
60 (defcustom gnus-use-frames-on-any-display nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
61 "*If non-nil, frames on all displays will be considered useable by Gnus. |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
62 When nil, only frames on the same display as the selected frame will be |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
63 used to display Gnus windows." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
57856
diff
changeset
|
64 :version "22.1" |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
65 :group 'gnus-windows |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
66 :type 'boolean) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
67 |
17493 | 68 (defvar gnus-buffer-configuration |
69 '((group | |
70 (vertical 1.0 | |
71 (group 1.0 point) | |
72 (if gnus-carpal '(group-carpal 4)))) | |
73 (summary | |
74 (vertical 1.0 | |
75 (summary 1.0 point) | |
76 (if gnus-carpal '(summary-carpal 4)))) | |
77 (article | |
78 (cond | |
79 (gnus-use-trees | |
80 '(vertical 1.0 | |
81 (summary 0.25 point) | |
82 (tree 0.25) | |
83 (article 1.0))) | |
84 (t | |
85 '(vertical 1.0 | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
86 (summary 0.25 point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
87 (if gnus-carpal '(summary-carpal 4)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
88 (article 1.0))))) |
17493 | 89 (server |
90 (vertical 1.0 | |
91 (server 1.0 point) | |
92 (if gnus-carpal '(server-carpal 2)))) | |
93 (browse | |
94 (vertical 1.0 | |
95 (browse 1.0 point) | |
96 (if gnus-carpal '(browse-carpal 2)))) | |
97 (message | |
98 (vertical 1.0 | |
99 (message 1.0 point))) | |
100 (pick | |
101 (vertical 1.0 | |
102 (article 1.0 point))) | |
103 (info | |
104 (vertical 1.0 | |
105 (info 1.0 point))) | |
106 (summary-faq | |
107 (vertical 1.0 | |
108 (summary 0.25) | |
109 (faq 1.0 point))) | |
110 (edit-article | |
111 (vertical 1.0 | |
112 (article 1.0 point))) | |
113 (edit-form | |
114 (vertical 1.0 | |
115 (group 0.5) | |
116 (edit-form 1.0 point))) | |
117 (edit-score | |
118 (vertical 1.0 | |
119 (summary 0.25) | |
120 (edit-score 1.0 point))) | |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
121 (edit-server |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
122 (vertical 1.0 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
123 (server 0.5) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
124 (edit-form 1.0 point))) |
17493 | 125 (post |
126 (vertical 1.0 | |
127 (post 1.0 point))) | |
128 (reply | |
129 (vertical 1.0 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
130 (article 0.5) |
17493 | 131 (message 1.0 point))) |
132 (forward | |
133 (vertical 1.0 | |
134 (message 1.0 point))) | |
135 (reply-yank | |
136 (vertical 1.0 | |
137 (message 1.0 point))) | |
138 (mail-bounce | |
139 (vertical 1.0 | |
140 (article 0.5) | |
141 (message 1.0 point))) | |
142 (pipe | |
143 (vertical 1.0 | |
144 (summary 0.25 point) | |
145 (if gnus-carpal '(summary-carpal 4)) | |
146 ("*Shell Command Output*" 1.0))) | |
147 (bug | |
148 (vertical 1.0 | |
39354
6bc5624fb330
(gnus-buffer-configuration): Respect `gnus-bug-create-help-buffer'.
Sam Steingold <sds@gnu.org>
parents:
35453
diff
changeset
|
149 (if gnus-bug-create-help-buffer '("*Gnus Help Bug*" 0.5)) |
17493 | 150 ("*Gnus Bug*" 1.0 point))) |
151 (score-trace | |
152 (vertical 1.0 | |
153 (summary 0.5 point) | |
154 ("*Score Trace*" 1.0))) | |
155 (score-words | |
156 (vertical 1.0 | |
157 (summary 0.5 point) | |
158 ("*Score Words*" 1.0))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
159 (split-trace |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
160 (vertical 1.0 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
161 (summary 0.5 point) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
162 ("*Split Trace*" 1.0))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
163 (category |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
164 (vertical 1.0 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
165 (category 1.0))) |
17493 | 166 (compose-bounce |
167 (vertical 1.0 | |
168 (article 0.5) | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
169 (message 1.0 point))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
170 (display-term |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
171 (vertical 1.0 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
172 ("*display*" 1.0))) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
173 (mml-preview |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
174 (vertical 1.0 |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
175 (message 0.5) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
176 (mml-preview 1.0 point)))) |
17493 | 177 "Window configuration for all possible Gnus buffers. |
178 See the Gnus manual for an explanation of the syntax used.") | |
179 | |
180 (defvar gnus-window-to-buffer | |
181 '((group . gnus-group-buffer) | |
182 (summary . gnus-summary-buffer) | |
183 (article . gnus-article-buffer) | |
184 (server . gnus-server-buffer) | |
185 (browse . "*Gnus Browse Server*") | |
186 (edit-group . gnus-group-edit-buffer) | |
187 (edit-form . gnus-edit-form-buffer) | |
188 (edit-server . gnus-server-edit-buffer) | |
189 (group-carpal . gnus-carpal-group-buffer) | |
190 (summary-carpal . gnus-carpal-summary-buffer) | |
191 (server-carpal . gnus-carpal-server-buffer) | |
192 (browse-carpal . gnus-carpal-browse-buffer) | |
193 (edit-score . gnus-score-edit-buffer) | |
194 (message . gnus-message-buffer) | |
195 (mail . gnus-message-buffer) | |
196 (post-news . gnus-message-buffer) | |
197 (faq . gnus-faq-buffer) | |
198 (tree . gnus-tree-buffer) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
199 (score-trace . "*Score Trace*") |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
200 (split-trace . "*Split Trace*") |
17493 | 201 (info . gnus-info-buffer) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
202 (category . gnus-category-buffer) |
17493 | 203 (article-copy . gnus-article-copy) |
85712
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
204 (draft . gnus-draft-buffer) |
a3c27999decb
Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents:
79143
diff
changeset
|
205 (mml-preview . mml-preview-buffer)) |
17493 | 206 "Mapping from short symbols to buffer names or buffer variables.") |
207 | |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
208 (defcustom gnus-configure-windows-hook nil |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
209 "*A hook called when configuring windows." |
59996
aac0a33f5772
Change release version from 21.4 to 22.1 throughout.
Kim F. Storm <storm@cua.dk>
parents:
57856
diff
changeset
|
210 :version "22.1" |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
211 :group 'gnus-windows |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
212 :type 'hook) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
213 |
17493 | 214 ;;; Internal variables. |
215 | |
216 (defvar gnus-current-window-configuration nil | |
217 "The most recently set window configuration.") | |
218 | |
219 (defvar gnus-created-frames nil) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
220 (defvar gnus-window-frame-focus nil) |
17493 | 221 |
222 (defun gnus-kill-gnus-frames () | |
223 "Kill all frames Gnus has created." | |
224 (while gnus-created-frames | |
225 (when (frame-live-p (car gnus-created-frames)) | |
226 ;; We slap a condition-case around this `delete-frame' to ensure | |
227 ;; against errors if we try do delete the single frame that's left. | |
228 (ignore-errors | |
229 (delete-frame (car gnus-created-frames)))) | |
230 (pop gnus-created-frames))) | |
231 | |
232 (defun gnus-window-configuration-element (list) | |
233 (while (and list | |
234 (not (assq (car list) gnus-window-configuration))) | |
235 (pop list)) | |
236 (cadr (assq (car list) gnus-window-configuration))) | |
237 | |
238 (defun gnus-windows-old-to-new (setting) | |
239 ;; First we take care of the really, really old Gnus 3 actions. | |
240 (when (symbolp setting) | |
241 (setq setting | |
242 ;; Take care of ooold GNUS 3.x values. | |
243 (cond ((eq setting 'SelectArticle) 'article) | |
244 ((memq setting '(SelectNewsgroup SelectSubject ExpandSubject)) | |
245 'summary) | |
246 ((memq setting '(ExitNewsgroup)) 'group) | |
247 (t setting)))) | |
248 (if (or (listp setting) | |
249 (not (and gnus-window-configuration | |
250 (memq setting '(group summary article))))) | |
251 setting | |
252 (let* ((elem | |
253 (cond | |
254 ((eq setting 'group) | |
255 (gnus-window-configuration-element | |
256 '(group newsgroups ExitNewsgroup))) | |
257 ((eq setting 'summary) | |
258 (gnus-window-configuration-element | |
259 '(summary SelectNewsgroup SelectSubject ExpandSubject))) | |
260 ((eq setting 'article) | |
261 (gnus-window-configuration-element | |
262 '(article SelectArticle))))) | |
263 (total (apply '+ elem)) | |
264 (types '(group summary article)) | |
265 (pbuf (if (eq setting 'newsgroups) 'group 'summary)) | |
266 (i 0) | |
267 perc out) | |
268 (while (< i 3) | |
269 (or (not (numberp (nth i elem))) | |
270 (zerop (nth i elem)) | |
271 (progn | |
272 (setq perc (if (= i 2) | |
273 1.0 | |
274 (/ (float (nth i elem)) total))) | |
275 (push (if (eq pbuf (nth i types)) | |
276 (list (nth i types) perc 'point) | |
277 (list (nth i types) perc)) | |
278 out))) | |
279 (incf i)) | |
280 `(vertical 1.0 ,@(nreverse out))))) | |
281 | |
282 ;;;###autoload | |
283 (defun gnus-add-configuration (conf) | |
284 "Add the window configuration CONF to `gnus-buffer-configuration'." | |
285 (setq gnus-buffer-configuration | |
286 (cons conf (delq (assq (car conf) gnus-buffer-configuration) | |
287 gnus-buffer-configuration)))) | |
288 | |
289 (defvar gnus-frame-list nil) | |
290 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
291 (defun gnus-window-to-buffer-helper (obj) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
292 (cond ((not (symbolp obj)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
293 obj) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
294 ((boundp obj) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
295 (symbol-value obj)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
296 ((fboundp obj) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
297 (funcall obj)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
298 (t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
299 nil))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
300 |
17493 | 301 (defun gnus-configure-frame (split &optional window) |
302 "Split WINDOW according to SPLIT." | |
34193
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
303 (let ((current-window |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
304 (or (get-buffer-window (current-buffer)) (selected-window)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
305 (unless window |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
306 (setq window current-window)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
307 (select-window window) |
48588 | 308 ;; This might be an old-style buffer config. |
34193
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
309 (when (vectorp split) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
310 (setq split (append split nil))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
311 (when (or (consp (car split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
312 (vectorp (car split))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
313 (push 1.0 split) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
314 (push 'vertical split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
315 ;; The SPLIT might be something that is to be evaled to |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
316 ;; return a new SPLIT. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
317 (while (and (not (assq (car split) gnus-window-to-buffer)) |
93617
af178a811324
(gnus-configure-frame, gnus-all-windows-visible-p):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93105
diff
changeset
|
318 (symbolp (car split)) (fboundp (car split))) |
34193
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
319 (setq split (eval split))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
320 (let* ((type (car split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
321 (subs (cddr split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
322 (len (if (eq type 'horizontal) (window-width) (window-height))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
323 (total 0) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
324 (window-min-width (or gnus-window-min-width window-min-width)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
325 (window-min-height (or gnus-window-min-height window-min-height)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
326 s result new-win rest comp-subs size sub) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
327 (cond |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
328 ;; Nothing to do here. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
329 ((null split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
330 ;; Don't switch buffers. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
331 ((null type) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
332 (and (memq 'point split) window)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
333 ;; This is a buffer to be selected. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
334 ((not (memq type '(frame horizontal vertical))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
335 (let ((buffer (cond ((stringp type) type) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
336 (t (cdr (assq type gnus-window-to-buffer)))))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
337 (unless buffer |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
338 (error "Invalid buffer type: %s" type)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
339 (let ((buf (gnus-get-buffer-create |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
340 (gnus-window-to-buffer-helper buffer)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
341 (if (eq buf (window-buffer (selected-window))) (set-buffer buf) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
342 (switch-to-buffer buf))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
343 (when (memq 'frame-focus split) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
344 (setq gnus-window-frame-focus window)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
345 ;; We return the window if it has the `point' spec. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
346 (and (memq 'point split) window))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
347 ;; This is a frame split. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
348 ((eq type 'frame) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
349 (unless gnus-frame-list |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
350 (setq gnus-frame-list (list (window-frame current-window)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
351 (let ((i 0) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
352 params frame fresult) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
353 (while (< i (length subs)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
354 ;; Frame parameter is gotten from the sub-split. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
355 (setq params (cadr (elt subs i))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
356 ;; It should be a list. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
357 (unless (listp params) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
358 (setq params nil)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
359 ;; Create a new frame? |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
360 (unless (setq frame (elt gnus-frame-list i)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
361 (nconc gnus-frame-list (list (setq frame (make-frame params)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
362 (push frame gnus-created-frames)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
363 ;; Is the old frame still alive? |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
364 (unless (frame-live-p frame) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
365 (setcar (nthcdr i gnus-frame-list) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
366 (setq frame (make-frame params)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
367 ;; Select the frame in question and do more splits there. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
368 (select-frame frame) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
369 (setq fresult (or (gnus-configure-frame (elt subs i)) fresult)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
370 (incf i)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
371 ;; Select the frame that has the selected buffer. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
372 (when fresult |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
373 (select-frame (window-frame fresult))))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
374 ;; This is a normal split. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
375 (t |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
376 (when (> (length subs) 0) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
377 ;; First we have to compute the sizes of all new windows. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
378 (while subs |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
379 (setq sub (append (pop subs) nil)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
380 (while (and (not (assq (car sub) gnus-window-to-buffer)) |
93617
af178a811324
(gnus-configure-frame, gnus-all-windows-visible-p):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93105
diff
changeset
|
381 (symbolp (car sub)) (fboundp (car sub))) |
34193
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
382 (setq sub (eval sub))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
383 (when sub |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
384 (push sub comp-subs) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
385 (setq size (cadar comp-subs)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
386 (cond ((equal size 1.0) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
387 (setq rest (car comp-subs)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
388 (setq s 0)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
389 ((floatp size) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
390 (setq s (floor (* size len)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
391 ((integerp size) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
392 (setq s size)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
393 (t |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
394 (error "Invalid size: %s" size))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
395 ;; Try to make sure that we are inside the safe limits. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
396 (cond ((zerop s)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
397 ((eq type 'horizontal) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
398 (setq s (max s window-min-width))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
399 ((eq type 'vertical) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
400 (setq s (max s window-min-height)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
401 (setcar (cdar comp-subs) s) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
402 (incf total s))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
403 ;; Take care of the "1.0" spec. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
404 (if rest |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
405 (setcar (cdr rest) (- len total)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
406 (error "No 1.0 specs in %s" split)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
407 ;; The we do the actual splitting in a nice recursive |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
408 ;; fashion. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
409 (setq comp-subs (nreverse comp-subs)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
410 (while comp-subs |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
411 (if (null (cdr comp-subs)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
412 (setq new-win window) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
413 (setq new-win |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
414 (split-window window (cadar comp-subs) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
415 (eq type 'horizontal)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
416 (setq result (or (gnus-configure-frame |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
417 (car comp-subs) window) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
418 result)) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
419 (select-window new-win) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
420 (setq window new-win) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
421 (setq comp-subs (cdr comp-subs)))) |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
422 ;; Return the proper window, if any. |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
423 (when result |
31766be242f6
(gnus-configure-frame): Save selected window.
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34192
diff
changeset
|
424 (select-window result))))))) |
17493 | 425 |
426 (defvar gnus-frame-split-p nil) | |
427 | |
428 (defun gnus-configure-windows (setting &optional force) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
429 (if (window-configuration-p setting) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
430 (set-window-configuration setting) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
431 (setq gnus-current-window-configuration setting) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
432 (setq force (or force gnus-always-force-window-configuration)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
433 (setq setting (gnus-windows-old-to-new setting)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
434 (let ((split (if (symbolp setting) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
435 (cadr (assq setting gnus-buffer-configuration)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
436 setting)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
437 all-visible) |
17493 | 438 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
439 (setq gnus-frame-split-p nil) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
440 |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
441 (unless split |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
442 (error "No such setting in `gnus-buffer-configuration': %s" setting)) |
17493 | 443 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
444 (if (and (setq all-visible (gnus-all-windows-visible-p split)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
445 (not force)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
446 ;; All the windows mentioned are already visible, so we just |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
447 ;; put point in the assigned buffer, and do not touch the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
448 ;; winconf. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
449 (select-window all-visible) |
39354
6bc5624fb330
(gnus-buffer-configuration): Respect `gnus-bug-create-help-buffer'.
Sam Steingold <sds@gnu.org>
parents:
35453
diff
changeset
|
450 |
34192
57a15e35e75b
* gnus-msg.el (gnus-msg-mail): COMPOSEFUNC should return t if
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33711
diff
changeset
|
451 ;; Make sure "the other" buffer, nntp-server-buffer, is live. |
57a15e35e75b
* gnus-msg.el (gnus-msg-mail): COMPOSEFUNC should return t if
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33711
diff
changeset
|
452 (unless (gnus-buffer-live-p nntp-server-buffer) |
57a15e35e75b
* gnus-msg.el (gnus-msg-mail): COMPOSEFUNC should return t if
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
33711
diff
changeset
|
453 (nnheader-init-server-buffer)) |
17493 | 454 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
455 ;; Either remove all windows or just remove all Gnus windows. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
456 (let ((frame (selected-frame))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
457 (unwind-protect |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
458 (if gnus-use-full-window |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
459 ;; We want to remove all other windows. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
460 (if (not gnus-frame-split-p) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
461 ;; This is not a `frame' split, so we ignore the |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
462 ;; other frames. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
463 (delete-other-windows) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
464 ;; This is a `frame' split, so we delete all windows |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
465 ;; on all frames. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
466 (gnus-delete-windows-in-gnusey-frames)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
467 ;; Just remove some windows. |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
468 (gnus-remove-some-windows) |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
469 (if (featurep 'xemacs) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
470 (switch-to-buffer nntp-server-buffer) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
471 (set-buffer nntp-server-buffer))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
472 (select-frame frame))) |
17493 | 473 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
474 (let (gnus-window-frame-focus) |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
475 (if (featurep 'xemacs) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
476 (switch-to-buffer nntp-server-buffer) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
477 (set-buffer nntp-server-buffer)) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
478 (gnus-configure-frame split) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
479 (run-hooks 'gnus-configure-windows-hook) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
480 (when gnus-window-frame-focus |
79143 | 481 (gnus-select-frame-set-input-focus |
482 (window-frame gnus-window-frame-focus)))))))) | |
17493 | 483 |
484 (defun gnus-delete-windows-in-gnusey-frames () | |
485 "Do a `delete-other-windows' in all frames that have Gnus windows." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
486 (let ((buffers (gnus-buffers))) |
17493 | 487 (mapcar |
488 (lambda (frame) | |
489 (unless (eq (cdr (assq 'minibuffer | |
490 (frame-parameters frame))) | |
491 'only) | |
492 (select-frame frame) | |
493 (let (do-delete) | |
494 (walk-windows | |
495 (lambda (window) | |
496 (when (memq (window-buffer window) buffers) | |
497 (setq do-delete t)))) | |
498 (when do-delete | |
499 (delete-other-windows))))) | |
500 (frame-list)))) | |
501 | |
502 (defun gnus-all-windows-visible-p (split) | |
503 "Say whether all buffers in SPLIT are currently visible. | |
504 In particular, the value returned will be the window that | |
505 should have point." | |
506 (let ((stack (list split)) | |
507 (all-visible t) | |
508 type buffer win buf) | |
509 (while (and (setq split (pop stack)) | |
510 all-visible) | |
511 ;; Be backwards compatible. | |
512 (when (vectorp split) | |
513 (setq split (append split nil))) | |
514 (when (or (consp (car split)) | |
515 (vectorp (car split))) | |
516 (push 1.0 split) | |
517 (push 'vertical split)) | |
518 ;; The SPLIT might be something that is to be evaled to | |
519 ;; return a new SPLIT. | |
520 (while (and (not (assq (car split) gnus-window-to-buffer)) | |
93617
af178a811324
(gnus-configure-frame, gnus-all-windows-visible-p):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
93105
diff
changeset
|
521 (symbolp (car split)) (fboundp (car split))) |
17493 | 522 (setq split (eval split))) |
523 | |
524 (setq type (elt split 0)) | |
525 (cond | |
526 ;; Nothing here. | |
527 ((null split) t) | |
528 ;; A buffer. | |
529 ((not (memq type '(horizontal vertical frame))) | |
530 (setq buffer (cond ((stringp type) type) | |
531 (t (cdr (assq type gnus-window-to-buffer))))) | |
532 (unless buffer | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
533 (error "Invalid buffer type: %s" type)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
534 (if (and (setq buf (get-buffer (gnus-window-to-buffer-helper buffer))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
535 (setq win (gnus-get-buffer-window buf t))) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
536 (if (memq 'point split) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
537 (setq all-visible win)) |
17493 | 538 (setq all-visible nil))) |
539 (t | |
540 (when (eq type 'frame) | |
541 (setq gnus-frame-split-p t)) | |
542 (setq stack (append (cddr split) stack))))) | |
543 (unless (eq all-visible t) | |
544 all-visible))) | |
545 | |
546 (defun gnus-window-top-edge (&optional window) | |
547 (nth 1 (window-edges window))) | |
548 | |
549 (defun gnus-remove-some-windows () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
550 (let ((buffers (gnus-buffers)) |
17493 | 551 buf bufs lowest-buf lowest) |
552 (save-excursion | |
553 ;; Remove windows on all known Gnus buffers. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
554 (while (setq buf (pop buffers)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
555 (when (get-buffer-window buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
556 (push buf bufs) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
557 (pop-to-buffer buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
558 (when (or (not lowest) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
559 (< (gnus-window-top-edge) lowest)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
560 (setq lowest (gnus-window-top-edge) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
561 lowest-buf buf)))) |
17493 | 562 (when lowest-buf |
563 (pop-to-buffer lowest-buf) | |
35453
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
564 (if (featurep 'xemacs) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
565 (switch-to-buffer nntp-server-buffer) |
26726eff41ca
2001-01-21 ShengHuo ZHU <zsh@cs.rochester.edu>
ShengHuo ZHU <zsh@cs.rochester.edu>
parents:
34193
diff
changeset
|
566 (set-buffer nntp-server-buffer))) |
56927
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
567 (mapcar (lambda (b) (delete-windows-on b t)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
568 (delq lowest-buf bufs))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
569 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
570 (eval-and-compile |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
571 (cond |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
572 ((fboundp 'frames-on-display-list) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
573 (defalias 'gnus-frames-on-display-list 'frames-on-display-list)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
574 ((and (featurep 'xemacs) (fboundp 'frame-device)) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
575 (defun gnus-frames-on-display-list () |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
576 (apply 'filtered-frame-list 'identity (list (frame-device nil))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
577 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
578 (defalias 'gnus-frames-on-display-list 'frame-list)))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
579 |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
580 (defun gnus-get-buffer-window (buffer &optional frame) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
581 (cond ((and (null gnus-use-frames-on-any-display) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
582 (memq frame '(t 0 visible))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
583 (car |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
584 (let ((frames (gnus-frames-on-display-list))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
585 (gnus-remove-if (lambda (win) (not (memq (window-frame win) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
586 frames))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
587 (get-buffer-window-list buffer nil frame))))) |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
588 (t |
55fd4f77387a
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents:
55668
diff
changeset
|
589 (get-buffer-window buffer frame)))) |
17493 | 590 |
591 (provide 'gnus-win) | |
592 | |
93105
29263b6aa4c7
(gnus-configure-frame, gnus-all-windows-visible-p):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
87649
diff
changeset
|
593 ;; arch-tag: ccd5a394-2ddf-4397-b8f8-6d80d3e46e2b |
17493 | 594 ;;; gnus-win.el ends here |