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