annotate lisp/gnus/gnus-win.el @ 16:0293115a14e9 r19-15b91

Import from CVS: tag r19-15b91
author cvs
date Mon, 13 Aug 2007 08:49:20 +0200
parents
children ec9a17fef872
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
1 ;;; gnus-win.el --- window configuration functions for Gnus
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
3
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
5 ;; Keywords: news
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
6
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
8
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
12 ;; any later version.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
13
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
18
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
23
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
24 ;;; Commentary:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
25
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
26 ;;; Code:
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
27
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
28 (require 'gnus)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
29
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
30 (defgroup gnus-windows nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
31 "Window configuration."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
32 :group 'gnus)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
33
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
34 (defcustom gnus-use-full-window t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
35 "*If non-nil, use the entire Emacs screen."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
36 :group 'gnus-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
37 :type 'boolean)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
38
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
39 (defvar gnus-window-configuration nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
40 "Obsolete variable. See `gnus-buffer-configuration'.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
41
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
42 (defcustom gnus-window-min-width 2
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
43 "*Minimum width of Gnus buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
44 :group 'gnus-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
45 :type 'integer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
46
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
47 (defcustom gnus-window-min-height 1
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
48 "*Minimum height of Gnus buffers."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
49 :group 'gnus-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
50 :type 'integer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
51
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
52 (defcustom gnus-always-force-window-configuration nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
53 "*If non-nil, always force the Gnus window configurations."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
54 :group 'gnus-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
55 :type 'boolean)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
56
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
57 (defvar gnus-buffer-configuration
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
58 '((group
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
59 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
60 (group 1.0 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
61 (if gnus-carpal '(group-carpal 4))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
62 (summary
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
63 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
64 (summary 1.0 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
65 (if gnus-carpal '(summary-carpal 4))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
66 (article
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
67 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
68 ((and gnus-use-picons
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
69 (eq gnus-picons-display-where 'picons))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
70 '(frame 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
71 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
72 (summary 0.25 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
73 (if gnus-carpal '(summary-carpal 4))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
74 (article 1.0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
75 (vertical ((height . 5) (width . 15)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
76 (user-position . t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
77 (left . -1) (top . 1))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
78 (picons 1.0))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
79 (gnus-use-trees
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
80 '(vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
81 (summary 0.25 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
82 (tree 0.25)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
83 (article 1.0)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
84 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
85 '(vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
86 (summary 0.25 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
87 (if gnus-carpal '(summary-carpal 4))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
88 (article 1.0)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
89 (server
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
90 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
91 (server 1.0 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
92 (if gnus-carpal '(server-carpal 2))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
93 (browse
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
94 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
95 (browse 1.0 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
96 (if gnus-carpal '(browse-carpal 2))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
97 (message
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
98 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
99 (message 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
100 (pick
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
101 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
102 (article 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
103 (info
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
104 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
105 (info 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
106 (summary-faq
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
107 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
108 (summary 0.25)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
109 (faq 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
110 (edit-article
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
111 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
112 (article 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
113 (edit-form
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
114 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
115 (group 0.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
116 (edit-form 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
117 (edit-score
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
118 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
119 (summary 0.25)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
120 (edit-score 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
121 (post
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
122 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
123 (post 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
124 (reply
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
125 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
126 (article-copy 0.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
127 (message 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
128 (forward
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
129 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
130 (message 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
131 (reply-yank
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
132 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
133 (message 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
134 (mail-bounce
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
135 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
136 (article 0.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
137 (message 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
138 (draft
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
139 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
140 (draft 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
141 (pipe
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
142 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
143 (summary 0.25 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
144 (if gnus-carpal '(summary-carpal 4))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
145 ("*Shell Command Output*" 1.0)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
146 (bug
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
147 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
148 ("*Gnus Help Bug*" 0.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
149 ("*Gnus Bug*" 1.0 point)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
150 (score-trace
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
151 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
152 (summary 0.5 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
153 ("*Score Trace*" 1.0)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
154 (score-words
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
155 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
156 (summary 0.5 point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
157 ("*Score Words*" 1.0)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
158 (compose-bounce
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
159 (vertical 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
160 (article 0.5)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
161 (message 1.0 point))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
162 "Window configuration for all possible Gnus buffers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
163 See the Gnus manual for an explanation of the syntax used.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
164
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
165 (defvar gnus-window-to-buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
166 '((group . gnus-group-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
167 (summary . gnus-summary-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
168 (article . gnus-article-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
169 (server . gnus-server-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
170 (browse . "*Gnus Browse Server*")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
171 (edit-group . gnus-group-edit-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
172 (edit-form . gnus-edit-form-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
173 (edit-server . gnus-server-edit-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
174 (group-carpal . gnus-carpal-group-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
175 (summary-carpal . gnus-carpal-summary-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
176 (server-carpal . gnus-carpal-server-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
177 (browse-carpal . gnus-carpal-browse-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
178 (edit-score . gnus-score-edit-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
179 (message . gnus-message-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
180 (mail . gnus-message-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
181 (post-news . gnus-message-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
182 (faq . gnus-faq-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
183 (picons . "*Picons*")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
184 (tree . gnus-tree-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
185 (info . gnus-info-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
186 (article-copy . gnus-article-copy)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
187 (draft . gnus-draft-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
188 "Mapping from short symbols to buffer names or buffer variables.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
189
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
190 ;;; Internal variables.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
191
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
192 (defvar gnus-current-window-configuration nil
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
193 "The most recently set window configuration.")
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
194
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
195 (defvar gnus-created-frames nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
196
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
197 (defun gnus-kill-gnus-frames ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
198 "Kill all frames Gnus has created."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
199 (while gnus-created-frames
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
200 (when (frame-live-p (car gnus-created-frames))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
201 ;; We slap a condition-case around this `delete-frame' to ensure
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
202 ;; against errors if we try do delete the single frame that's left.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
203 (ignore-errors
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
204 (delete-frame (car gnus-created-frames))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
205 (pop gnus-created-frames)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
206
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
207 (defun gnus-window-configuration-element (list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
208 (while (and list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
209 (not (assq (car list) gnus-window-configuration)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
210 (pop list))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
211 (cadr (assq (car list) gnus-window-configuration)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
212
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
213 (defun gnus-windows-old-to-new (setting)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
214 ;; First we take care of the really, really old Gnus 3 actions.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
215 (when (symbolp setting)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
216 (setq setting
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
217 ;; Take care of ooold GNUS 3.x values.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
218 (cond ((eq setting 'SelectArticle) 'article)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
219 ((memq setting '(SelectNewsgroup SelectSubject ExpandSubject))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
220 'summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
221 ((memq setting '(ExitNewsgroup)) 'group)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
222 (t setting))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
223 (if (or (listp setting)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
224 (not (and gnus-window-configuration
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
225 (memq setting '(group summary article)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
226 setting
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
227 (let* ((elem
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
228 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
229 ((eq setting 'group)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
230 (gnus-window-configuration-element
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
231 '(group newsgroups ExitNewsgroup)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
232 ((eq setting 'summary)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
233 (gnus-window-configuration-element
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
234 '(summary SelectNewsgroup SelectSubject ExpandSubject)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
235 ((eq setting 'article)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
236 (gnus-window-configuration-element
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
237 '(article SelectArticle)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
238 (total (apply '+ elem))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
239 (types '(group summary article))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
240 (pbuf (if (eq setting 'newsgroups) 'group 'summary))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
241 (i 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
242 perc out)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
243 (while (< i 3)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
244 (or (not (numberp (nth i elem)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
245 (zerop (nth i elem))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
246 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
247 (setq perc (if (= i 2)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
248 1.0
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
249 (/ (float (nth i elem)) total)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
250 (push (if (eq pbuf (nth i types))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
251 (list (nth i types) perc 'point)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
252 (list (nth i types) perc))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
253 out)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
254 (incf i))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
255 `(vertical 1.0 ,@(nreverse out)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
256
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
257 ;;;###autoload
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
258 (defun gnus-add-configuration (conf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
259 "Add the window configuration CONF to `gnus-buffer-configuration'."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
260 (setq gnus-buffer-configuration
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
261 (cons conf (delq (assq (car conf) gnus-buffer-configuration)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
262 gnus-buffer-configuration))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
263
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
264 (defvar gnus-frame-list nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
265
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
266 (defun gnus-configure-frame (split &optional window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
267 "Split WINDOW according to SPLIT."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
268 (unless window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
269 (setq window (get-buffer-window (current-buffer))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
270 (select-window window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
271 ;; This might be an old-stylee buffer config.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
272 (when (vectorp split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
273 (setq split (append split nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
274 (when (or (consp (car split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
275 (vectorp (car split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
276 (push 1.0 split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
277 (push 'vertical split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
278 ;; The SPLIT might be something that is to be evaled to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
279 ;; return a new SPLIT.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
280 (while (and (not (assq (car split) gnus-window-to-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
281 (gnus-functionp (car split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
282 (setq split (eval split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
283 (let* ((type (car split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
284 (subs (cddr split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
285 (len (if (eq type 'horizontal) (window-width) (window-height)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
286 (total 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
287 (window-min-width (or gnus-window-min-width window-min-width))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
288 (window-min-height (or gnus-window-min-height window-min-height))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
289 s result new-win rest comp-subs size sub)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
290 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
291 ;; Nothing to do here.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
292 ((null split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
293 ;; Don't switch buffers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
294 ((null type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
295 (and (memq 'point split) window))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
296 ;; This is a buffer to be selected.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
297 ((not (memq type '(frame horizontal vertical)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
298 (let ((buffer (cond ((stringp type) type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
299 (t (cdr (assq type gnus-window-to-buffer)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
300 buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
301 (unless buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
302 (error "Illegal buffer type: %s" type))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
303 (unless (setq buf (get-buffer (if (symbolp buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
304 (symbol-value buffer) buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
305 (setq buf (get-buffer-create (if (symbolp buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
306 (symbol-value buffer) buffer))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
307 (switch-to-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
308 ;; We return the window if it has the `point' spec.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
309 (and (memq 'point split) window)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
310 ;; This is a frame split.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
311 ((eq type 'frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
312 (unless gnus-frame-list
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
313 (setq gnus-frame-list (list (window-frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
314 (get-buffer-window (current-buffer))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
315 (let ((i 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
316 params frame fresult)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
317 (while (< i (length subs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
318 ;; Frame parameter is gotten from the sub-split.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
319 (setq params (cadr (elt subs i)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
320 ;; It should be a list.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
321 (unless (listp params)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
322 (setq params nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
323 ;; Create a new frame?
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
324 (unless (setq frame (elt gnus-frame-list i))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
325 (nconc gnus-frame-list (list (setq frame (make-frame params))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
326 (push frame gnus-created-frames))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
327 ;; Is the old frame still alive?
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
328 (unless (frame-live-p frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
329 (setcar (nthcdr i gnus-frame-list)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
330 (setq frame (make-frame params))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
331 ;; Select the frame in question and do more splits there.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
332 (select-frame frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
333 (setq fresult (or (gnus-configure-frame (elt subs i)) fresult))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
334 (incf i))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
335 ;; Select the frame that has the selected buffer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
336 (when fresult
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
337 (select-frame (window-frame fresult)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
338 ;; This is a normal split.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
339 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
340 (when (> (length subs) 0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
341 ;; First we have to compute the sizes of all new windows.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
342 (while subs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
343 (setq sub (append (pop subs) nil))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
344 (while (and (not (assq (car sub) gnus-window-to-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
345 (gnus-functionp (car sub)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
346 (setq sub (eval sub)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
347 (when sub
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
348 (push sub comp-subs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
349 (setq size (cadar comp-subs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
350 (cond ((equal size 1.0)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
351 (setq rest (car comp-subs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
352 (setq s 0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
353 ((floatp size)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
354 (setq s (floor (* size len))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
355 ((integerp size)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
356 (setq s size))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
357 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
358 (error "Illegal size: %s" size)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
359 ;; Try to make sure that we are inside the safe limits.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
360 (cond ((zerop s))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
361 ((eq type 'horizontal)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
362 (setq s (max s window-min-width)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
363 ((eq type 'vertical)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
364 (setq s (max s window-min-height))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
365 (setcar (cdar comp-subs) s)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
366 (incf total s)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
367 ;; Take care of the "1.0" spec.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
368 (if rest
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
369 (setcar (cdr rest) (- len total))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
370 (error "No 1.0 specs in %s" split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
371 ;; The we do the actual splitting in a nice recursive
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
372 ;; fashion.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
373 (setq comp-subs (nreverse comp-subs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
374 (while comp-subs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
375 (if (null (cdr comp-subs))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
376 (setq new-win window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
377 (setq new-win
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
378 (split-window window (cadar comp-subs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
379 (eq type 'horizontal))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
380 (setq result (or (gnus-configure-frame
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
381 (car comp-subs) window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
382 result))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
383 (select-window new-win)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
384 (setq window new-win)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
385 (setq comp-subs (cdr comp-subs))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
386 ;; Return the proper window, if any.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
387 (when result
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
388 (select-window result))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
389
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
390 (defvar gnus-frame-split-p nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
391
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
392 (defun gnus-configure-windows (setting &optional force)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
393 (setq gnus-current-window-configuration setting)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
394 (setq force (or force gnus-always-force-window-configuration))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
395 (setq setting (gnus-windows-old-to-new setting))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
396 (let ((split (if (symbolp setting)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
397 (cadr (assq setting gnus-buffer-configuration))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
398 setting))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
399 all-visible)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
400
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
401 (setq gnus-frame-split-p nil)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
402
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
403 (unless split
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
404 (error "No such setting: %s" setting))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
405
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
406 (if (and (setq all-visible (gnus-all-windows-visible-p split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
407 (not force))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
408 ;; All the windows mentioned are already visible, so we just
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
409 ;; put point in the assigned buffer, and do not touch the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
410 ;; winconf.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
411 (select-window all-visible)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
412
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
413 ;; Either remove all windows or just remove all Gnus windows.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
414 (let ((frame (selected-frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
415 (unwind-protect
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
416 (if gnus-use-full-window
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
417 ;; We want to remove all other windows.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
418 (if (not gnus-frame-split-p)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
419 ;; This is not a `frame' split, so we ignore the
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
420 ;; other frames.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
421 (delete-other-windows)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
422 ;; This is a `frame' split, so we delete all windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
423 ;; on all frames.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
424 (gnus-delete-windows-in-gnusey-frames))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
425 ;; Just remove some windows.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
426 (gnus-remove-some-windows)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
427 (switch-to-buffer nntp-server-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
428 (select-frame frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
429
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
430 (switch-to-buffer nntp-server-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
431 (gnus-configure-frame split (get-buffer-window (current-buffer))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
432
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
433 (defun gnus-delete-windows-in-gnusey-frames ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
434 "Do a `delete-other-windows' in all frames that have Gnus windows."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
435 (let ((buffers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
436 (mapcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
437 (lambda (elem)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
438 (if (symbolp (cdr elem))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
439 (when (and (boundp (cdr elem))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
440 (symbol-value (cdr elem)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
441 (get-buffer (symbol-value (cdr elem))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
442 (when (cdr elem)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
443 (get-buffer (cdr elem)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
444 gnus-window-to-buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
445 (mapcar
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
446 (lambda (frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
447 (unless (eq (cdr (assq 'minibuffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
448 (frame-parameters frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
449 'only)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
450 (select-frame frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
451 (let (do-delete)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
452 (walk-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
453 (lambda (window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
454 (when (memq (window-buffer window) buffers)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
455 (setq do-delete t))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
456 (when do-delete
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
457 (delete-other-windows)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
458 (frame-list))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
459
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
460 (defun gnus-all-windows-visible-p (split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
461 "Say whether all buffers in SPLIT are currently visible.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
462 In particular, the value returned will be the window that
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
463 should have point."
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
464 (let ((stack (list split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
465 (all-visible t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
466 type buffer win buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
467 (while (and (setq split (pop stack))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
468 all-visible)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
469 ;; Be backwards compatible.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
470 (when (vectorp split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
471 (setq split (append split nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
472 (when (or (consp (car split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
473 (vectorp (car split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
474 (push 1.0 split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
475 (push 'vertical split))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
476 ;; The SPLIT might be something that is to be evaled to
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
477 ;; return a new SPLIT.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
478 (while (and (not (assq (car split) gnus-window-to-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
479 (gnus-functionp (car split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
480 (setq split (eval split)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
481
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
482 (setq type (elt split 0))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
483 (cond
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
484 ;; Nothing here.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
485 ((null split) t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
486 ;; A buffer.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
487 ((not (memq type '(horizontal vertical frame)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
488 (setq buffer (cond ((stringp type) type)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
489 (t (cdr (assq type gnus-window-to-buffer)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
490 (unless buffer
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
491 (error "Illegal buffer type: %s" type))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
492 (when (setq buf (get-buffer (if (symbolp buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
493 (symbol-value buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
494 buffer)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
495 (setq win (get-buffer-window buf t)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
496 (if win
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
497 (when (memq 'point split)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
498 (setq all-visible win))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
499 (setq all-visible nil)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
500 (t
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
501 (when (eq type 'frame)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
502 (setq gnus-frame-split-p t))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
503 (setq stack (append (cddr split) stack)))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
504 (unless (eq all-visible t)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
505 all-visible)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
506
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
507 (defun gnus-window-top-edge (&optional window)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
508 (nth 1 (window-edges window)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
509
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
510 (defun gnus-remove-some-windows ()
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
511 (let ((buffers gnus-window-to-buffer)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
512 buf bufs lowest-buf lowest)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
513 (save-excursion
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
514 ;; Remove windows on all known Gnus buffers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
515 (while buffers
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
516 (setq buf (cdar buffers))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
517 (when (symbolp buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
518 (setq buf (and (boundp buf) (symbol-value buf))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
519 (and buf
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
520 (get-buffer-window buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
521 (progn
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
522 (push buf bufs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
523 (pop-to-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
524 (when (or (not lowest)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
525 (< (gnus-window-top-edge) lowest))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
526 (setq lowest (gnus-window-top-edge))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
527 (setq lowest-buf buf))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
528 (setq buffers (cdr buffers)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
529 ;; Remove windows on *all* summary buffers.
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
530 (walk-windows
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
531 (lambda (win)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
532 (let ((buf (window-buffer win)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
533 (when (string-match "^\\*Summary" (buffer-name buf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
534 (push buf bufs)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
535 (pop-to-buffer buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
536 (when (or (not lowest)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
537 (< (gnus-window-top-edge) lowest))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
538 (setq lowest-buf buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
539 (setq lowest (gnus-window-top-edge)))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
540 (when lowest-buf
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
541 (pop-to-buffer lowest-buf)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
542 (switch-to-buffer nntp-server-buffer))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
543 (while bufs
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
544 (when (not (eq (car bufs) lowest-buf))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
545 (delete-windows-on (car bufs)))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
546 (setq bufs (cdr bufs))))))
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
547
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
548 (provide 'gnus-win)
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
549
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents:
diff changeset
550 ;;; gnus-win.el ends here