Mercurial > emacs
annotate lisp/gnus/gnus-srvr.el @ 34931:debb78d4e934
(print-fontset): Indent font name by 24 columns, not 25.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 30 Dec 2000 01:08:10 +0000 |
parents | 9968f55ad26e |
children | 2bdf0118b0a8 |
rev | line source |
---|---|
17493 | 1 ;;; gnus-srvr.el --- virtual server support for Gnus |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000 |
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) |
32 (require 'gnus-spec) | |
33 (require 'gnus-group) | |
34 (require 'gnus-int) | |
35 (require 'gnus-range) | |
36 | |
37 (defvar gnus-server-mode-hook nil | |
38 "Hook run in `gnus-server-mode' buffers.") | |
39 | |
40 (defconst gnus-server-line-format " {%(%h:%w%)} %s\n" | |
41 "Format of server lines. | |
42 It works along the same lines as a normal formatting string, | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
43 with some simple extensions. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
44 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
45 The following specs are understood: |
17493 | 46 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
47 %h backend |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
48 %n name |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
49 %w address |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
50 %s status") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
51 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
52 (defvar gnus-server-mode-line-format "Gnus: %%b" |
17493 | 53 "The format specification for the server mode line.") |
54 | |
55 (defvar gnus-server-exit-hook nil | |
56 "*Hook run when exiting the server buffer.") | |
57 | |
58 ;;; Internal variables. | |
59 | |
60 (defvar gnus-inserted-opened-servers nil) | |
61 | |
62 (defvar gnus-server-line-format-alist | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
63 `((?h gnus-tmp-how ?s) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
64 (?n gnus-tmp-name ?s) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
65 (?w gnus-tmp-where ?s) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
66 (?s gnus-tmp-status ?s))) |
17493 | 67 |
68 (defvar gnus-server-mode-line-format-alist | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
69 `((?S gnus-tmp-news-server ?s) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
70 (?M gnus-tmp-news-method ?s) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
71 (?u gnus-tmp-user-defined ?s))) |
17493 | 72 |
73 (defvar gnus-server-line-format-spec nil) | |
74 (defvar gnus-server-mode-line-format-spec nil) | |
75 (defvar gnus-server-killed-servers nil) | |
76 | |
77 (defvar gnus-server-mode-map) | |
78 | |
79 (defvar gnus-server-menu-hook nil | |
80 "*Hook run after the creation of the server mode menu.") | |
81 | |
82 (defun gnus-server-make-menu-bar () | |
83 (gnus-turn-off-edit-menu 'server) | |
84 (unless (boundp 'gnus-server-server-menu) | |
85 (easy-menu-define | |
86 gnus-server-server-menu gnus-server-mode-map "" | |
87 '("Server" | |
88 ["Add" gnus-server-add-server t] | |
89 ["Browse" gnus-server-read-server t] | |
90 ["Scan" gnus-server-scan-server t] | |
91 ["List" gnus-server-list-servers t] | |
92 ["Kill" gnus-server-kill-server t] | |
93 ["Yank" gnus-server-yank-server t] | |
94 ["Copy" gnus-server-copy-server t] | |
95 ["Edit" gnus-server-edit-server t] | |
96 ["Regenerate" gnus-server-regenerate-server t] | |
97 ["Exit" gnus-server-exit t])) | |
98 | |
99 (easy-menu-define | |
100 gnus-server-connections-menu gnus-server-mode-map "" | |
101 '("Connections" | |
102 ["Open" gnus-server-open-server t] | |
103 ["Close" gnus-server-close-server t] | |
104 ["Deny" gnus-server-deny-server t] | |
105 "---" | |
106 ["Open All" gnus-server-open-all-servers t] | |
107 ["Close All" gnus-server-close-all-servers t] | |
108 ["Reset All" gnus-server-remove-denials t])) | |
109 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
110 (gnus-run-hooks 'gnus-server-menu-hook))) |
17493 | 111 |
112 (defvar gnus-server-mode-map nil) | |
113 (put 'gnus-server-mode 'mode-class 'special) | |
114 | |
115 (unless gnus-server-mode-map | |
116 (setq gnus-server-mode-map (make-sparse-keymap)) | |
117 (suppress-keymap gnus-server-mode-map) | |
118 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
119 (gnus-define-keys gnus-server-mode-map |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
120 " " gnus-server-read-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
121 "\r" gnus-server-read-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
122 gnus-mouse-2 gnus-server-pick-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
123 "q" gnus-server-exit |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
124 "l" gnus-server-list-servers |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
125 "k" gnus-server-kill-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
126 "y" gnus-server-yank-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
127 "c" gnus-server-copy-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
128 "a" gnus-server-add-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
129 "e" gnus-server-edit-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
130 "s" gnus-server-scan-server |
17493 | 131 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
132 "O" gnus-server-open-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
133 "\M-o" gnus-server-open-all-servers |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
134 "C" gnus-server-close-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
135 "\M-c" gnus-server-close-all-servers |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
136 "D" gnus-server-deny-server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
137 "R" gnus-server-remove-denials |
17493 | 138 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
139 "n" next-line |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
140 "p" previous-line |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
141 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
142 "g" gnus-server-regenerate-server |
17493 | 143 |
144 "\C-c\C-i" gnus-info-find-node | |
145 "\C-c\C-b" gnus-bug)) | |
146 | |
147 (defun gnus-server-mode () | |
148 "Major mode for listing and editing servers. | |
149 | |
150 All normal editing commands are switched off. | |
151 \\<gnus-server-mode-map> | |
152 For more in-depth information on this mode, read the manual | |
153 (`\\[gnus-info-find-node]'). | |
154 | |
155 The following commands are available: | |
156 | |
157 \\{gnus-server-mode-map}" | |
158 (interactive) | |
159 (when (gnus-visual-p 'server-menu 'menu) | |
160 (gnus-server-make-menu-bar)) | |
161 (kill-all-local-variables) | |
162 (gnus-simplify-mode-line) | |
163 (setq major-mode 'gnus-server-mode) | |
164 (setq mode-name "Server") | |
165 (gnus-set-default-directory) | |
166 (setq mode-line-process nil) | |
167 (use-local-map gnus-server-mode-map) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
168 (buffer-disable-undo) |
17493 | 169 (setq truncate-lines t) |
170 (setq buffer-read-only t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
171 (gnus-run-hooks 'gnus-server-mode-hook)) |
17493 | 172 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
173 (defun gnus-server-insert-server-line (gnus-tmp-name method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
174 (let* ((gnus-tmp-how (car method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
175 (gnus-tmp-where (nth 1 method)) |
17493 | 176 (elem (assoc method gnus-opened-servers)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
177 (gnus-tmp-status (cond ((eq (nth 1 elem) 'denied) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
178 "(denied)") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
179 ((or (gnus-server-opened method) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
180 (eq (nth 1 elem) 'ok)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
181 "(opened)") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
182 (t |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
183 "(closed)")))) |
17493 | 184 (beginning-of-line) |
185 (gnus-add-text-properties | |
186 (point) | |
187 (prog1 (1+ (point)) | |
188 ;; Insert the text. | |
189 (eval gnus-server-line-format-spec)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
190 (list 'gnus-server (intern gnus-tmp-name))))) |
17493 | 191 |
192 (defun gnus-enter-server-buffer () | |
193 "Set up the server buffer." | |
194 (gnus-server-setup-buffer) | |
195 (gnus-configure-windows 'server) | |
196 (gnus-server-prepare)) | |
197 | |
198 (defun gnus-server-setup-buffer () | |
199 "Initialize the server buffer." | |
200 (unless (get-buffer gnus-server-buffer) | |
201 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
202 (set-buffer (gnus-get-buffer-create gnus-server-buffer)) |
17493 | 203 (gnus-server-mode) |
204 (when gnus-carpal | |
205 (gnus-carpal-setup-buffer 'server))))) | |
206 | |
207 (defun gnus-server-prepare () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
208 (gnus-set-format 'server-mode) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
209 (gnus-set-format 'server t) |
17493 | 210 (let ((alist gnus-server-alist) |
211 (buffer-read-only nil) | |
212 (opened gnus-opened-servers) | |
213 done server op-ser) | |
214 (erase-buffer) | |
215 (setq gnus-inserted-opened-servers nil) | |
216 ;; First we do the real list of servers. | |
217 (while alist | |
218 (unless (member (cdar alist) done) | |
219 (push (cdar alist) done) | |
220 (cdr (setq server (pop alist))) | |
221 (when (and server (car server) (cdr server)) | |
222 (gnus-server-insert-server-line (car server) (cdr server)))) | |
223 (when (member (cdar alist) done) | |
224 (pop alist))) | |
225 ;; Then we insert the list of servers that have been opened in | |
226 ;; this session. | |
227 (while opened | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
228 (when (and (not (member (caar opened) done)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
229 ;; Just ignore ephemeral servers. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
230 (not (member (caar opened) gnus-ephemeral-servers))) |
17493 | 231 (push (caar opened) done) |
232 (gnus-server-insert-server-line | |
233 (setq op-ser (format "%s:%s" (caaar opened) (nth 1 (caar opened)))) | |
234 (caar opened)) | |
235 (push (list op-ser (caar opened)) gnus-inserted-opened-servers)) | |
236 (setq opened (cdr opened)))) | |
237 (goto-char (point-min)) | |
238 (gnus-server-position-point)) | |
239 | |
240 (defun gnus-server-server-name () | |
241 (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server))) | |
242 (and server (symbol-name server)))) | |
243 | |
244 (defalias 'gnus-server-position-point 'gnus-goto-colon) | |
245 | |
246 (defconst gnus-server-edit-buffer "*Gnus edit server*") | |
247 | |
248 (defun gnus-server-update-server (server) | |
249 (save-excursion | |
250 (set-buffer gnus-server-buffer) | |
251 (let* ((buffer-read-only nil) | |
252 (entry (assoc server gnus-server-alist)) | |
253 (oentry (assoc (gnus-server-to-method server) | |
254 gnus-opened-servers))) | |
255 (when entry | |
256 (gnus-dribble-enter | |
257 (concat "(gnus-server-set-info \"" server "\" '" | |
258 (prin1-to-string (cdr entry)) ")\n"))) | |
259 (when (or entry oentry) | |
260 ;; Buffer may be narrowed. | |
261 (save-restriction | |
262 (widen) | |
263 (when (gnus-server-goto-server server) | |
264 (gnus-delete-line)) | |
265 (if entry | |
266 (gnus-server-insert-server-line (car entry) (cdr entry)) | |
267 (gnus-server-insert-server-line | |
268 (format "%s:%s" (caar oentry) (nth 1 (car oentry))) | |
269 (car oentry))) | |
270 (gnus-server-position-point)))))) | |
271 | |
272 (defun gnus-server-set-info (server info) | |
273 ;; Enter a select method into the virtual server alist. | |
274 (when (and server info) | |
275 (gnus-dribble-enter | |
276 (concat "(gnus-server-set-info \"" server "\" '" | |
277 (prin1-to-string info) ")")) | |
278 (let* ((server (nth 1 info)) | |
279 (entry (assoc server gnus-server-alist))) | |
280 (if entry (setcdr entry info) | |
281 (setq gnus-server-alist | |
282 (nconc gnus-server-alist (list (cons server info)))))))) | |
283 | |
284 ;;; Interactive server functions. | |
285 | |
286 (defun gnus-server-kill-server (server) | |
287 "Kill the server on the current line." | |
288 (interactive (list (gnus-server-server-name))) | |
289 (unless (gnus-server-goto-server server) | |
290 (if server (error "No such server: %s" server) | |
291 (error "No server on the current line"))) | |
292 (unless (assoc server gnus-server-alist) | |
293 (error "Read-only server %s" server)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
294 (gnus-dribble-touch) |
17493 | 295 (let ((buffer-read-only nil)) |
296 (gnus-delete-line)) | |
297 (push (assoc server gnus-server-alist) gnus-server-killed-servers) | |
298 (setq gnus-server-alist (delq (car gnus-server-killed-servers) | |
299 gnus-server-alist)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
300 (let ((groups (gnus-groups-from-server server))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
301 (when (and groups |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
302 (gnus-yes-or-no-p |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
303 (format "Kill all %s groups from this server? " |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
304 (length groups)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
305 (dolist (group groups) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
306 (setq gnus-newsrc-alist |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
307 (delq (assoc group gnus-newsrc-alist) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
308 gnus-newsrc-alist)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
309 (when gnus-group-change-level-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
310 (funcall gnus-group-change-level-function |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
311 group gnus-level-killed 3))))) |
17493 | 312 (gnus-server-position-point)) |
313 | |
314 (defun gnus-server-yank-server () | |
315 "Yank the previously killed server." | |
316 (interactive) | |
317 (unless gnus-server-killed-servers | |
318 (error "No killed servers to be yanked")) | |
319 (let ((alist gnus-server-alist) | |
320 (server (gnus-server-server-name)) | |
321 (killed (car gnus-server-killed-servers))) | |
322 (if (not server) | |
323 (setq gnus-server-alist (nconc gnus-server-alist (list killed))) | |
324 (if (string= server (caar gnus-server-alist)) | |
325 (push killed gnus-server-alist) | |
326 (while (and (cdr alist) | |
327 (not (string= server (caadr alist)))) | |
328 (setq alist (cdr alist))) | |
329 (if alist | |
330 (setcdr alist (cons killed (cdr alist))) | |
331 (setq gnus-server-alist (list killed))))) | |
332 (gnus-server-update-server (car killed)) | |
333 (setq gnus-server-killed-servers (cdr gnus-server-killed-servers)) | |
334 (gnus-server-position-point))) | |
335 | |
336 (defun gnus-server-exit () | |
337 "Return to the group buffer." | |
338 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
339 (gnus-run-hooks 'gnus-server-exit-hook) |
17493 | 340 (kill-buffer (current-buffer)) |
341 (gnus-configure-windows 'group t)) | |
342 | |
343 (defun gnus-server-list-servers () | |
344 "List all available servers." | |
345 (interactive) | |
346 (let ((cur (gnus-server-server-name))) | |
347 (gnus-server-prepare) | |
348 (if cur (gnus-server-goto-server cur) | |
349 (goto-char (point-max)) | |
350 (forward-line -1)) | |
351 (gnus-server-position-point))) | |
352 | |
353 (defun gnus-server-set-status (method status) | |
354 "Make METHOD have STATUS." | |
355 (let ((entry (assoc method gnus-opened-servers))) | |
356 (if entry | |
357 (setcar (cdr entry) status) | |
358 (push (list method status) gnus-opened-servers)))) | |
359 | |
360 (defun gnus-opened-servers-remove (method) | |
361 "Remove METHOD from the list of opened servers." | |
362 (setq gnus-opened-servers (delq (assoc method gnus-opened-servers) | |
363 gnus-opened-servers))) | |
364 | |
365 (defun gnus-server-open-server (server) | |
366 "Force an open of SERVER." | |
367 (interactive (list (gnus-server-server-name))) | |
368 (let ((method (gnus-server-to-method server))) | |
369 (unless method | |
370 (error "No such server: %s" server)) | |
371 (gnus-server-set-status method 'ok) | |
372 (prog1 | |
373 (or (gnus-open-server method) | |
374 (progn (message "Couldn't open %s" server) nil)) | |
375 (gnus-server-update-server server) | |
376 (gnus-server-position-point)))) | |
377 | |
378 (defun gnus-server-open-all-servers () | |
379 "Open all servers." | |
380 (interactive) | |
381 (let ((servers gnus-inserted-opened-servers)) | |
382 (while servers | |
383 (gnus-server-open-server (car (pop servers)))))) | |
384 | |
385 (defun gnus-server-close-server (server) | |
386 "Close SERVER." | |
387 (interactive (list (gnus-server-server-name))) | |
388 (let ((method (gnus-server-to-method server))) | |
389 (unless method | |
390 (error "No such server: %s" server)) | |
391 (gnus-server-set-status method 'closed) | |
392 (prog1 | |
393 (gnus-close-server method) | |
394 (gnus-server-update-server server) | |
395 (gnus-server-position-point)))) | |
396 | |
397 (defun gnus-server-close-all-servers () | |
398 "Close all servers." | |
399 (interactive) | |
400 (let ((servers gnus-inserted-opened-servers)) | |
401 (while servers | |
402 (gnus-server-close-server (car (pop servers)))))) | |
403 | |
404 (defun gnus-server-deny-server (server) | |
405 "Make sure SERVER will never be attempted opened." | |
406 (interactive (list (gnus-server-server-name))) | |
407 (let ((method (gnus-server-to-method server))) | |
408 (unless method | |
409 (error "No such server: %s" server)) | |
410 (gnus-server-set-status method 'denied)) | |
411 (gnus-server-update-server server) | |
412 (gnus-server-position-point) | |
413 t) | |
414 | |
415 (defun gnus-server-remove-denials () | |
416 "Make all denied servers into closed servers." | |
417 (interactive) | |
418 (let ((servers gnus-opened-servers)) | |
419 (while servers | |
420 (when (eq (nth 1 (car servers)) 'denied) | |
421 (setcar (nthcdr 1 (car servers)) 'closed)) | |
422 (setq servers (cdr servers)))) | |
423 (gnus-server-list-servers)) | |
424 | |
425 (defun gnus-server-copy-server (from to) | |
426 (interactive | |
427 (list | |
428 (or (gnus-server-server-name) | |
429 (error "No server on the current line")) | |
430 (read-string "Copy to: "))) | |
431 (unless from | |
432 (error "No server on current line")) | |
433 (unless (and to (not (string= to ""))) | |
434 (error "No name to copy to")) | |
435 (when (assoc to gnus-server-alist) | |
436 (error "%s already exists" to)) | |
437 (unless (gnus-server-to-method from) | |
438 (error "%s: no such server" from)) | |
439 (let ((to-entry (cons from (gnus-copy-sequence | |
440 (gnus-server-to-method from))))) | |
441 (setcar to-entry to) | |
442 (setcar (nthcdr 2 to-entry) to) | |
443 (push to-entry gnus-server-killed-servers) | |
444 (gnus-server-yank-server))) | |
445 | |
446 (defun gnus-server-add-server (how where) | |
447 (interactive | |
448 (list (intern (completing-read "Server method: " | |
449 gnus-valid-select-methods nil t)) | |
450 (read-string "Server name: "))) | |
451 (when (assq where gnus-server-alist) | |
452 (error "Server with that name already defined")) | |
453 (push (list where how where) gnus-server-killed-servers) | |
454 (gnus-server-yank-server)) | |
455 | |
456 (defun gnus-server-goto-server (server) | |
457 "Jump to a server line." | |
458 (interactive | |
459 (list (completing-read "Goto server: " gnus-server-alist nil t))) | |
460 (let ((to (text-property-any (point-min) (point-max) | |
461 'gnus-server (intern server)))) | |
462 (when to | |
463 (goto-char to) | |
464 (gnus-server-position-point)))) | |
465 | |
466 (defun gnus-server-edit-server (server) | |
467 "Edit the server on the current line." | |
468 (interactive (list (gnus-server-server-name))) | |
469 (unless server | |
470 (error "No server on current line")) | |
471 (unless (assoc server gnus-server-alist) | |
472 (error "This server can't be edited")) | |
473 (let ((info (cdr (assoc server gnus-server-alist)))) | |
474 (gnus-close-server info) | |
475 (gnus-edit-form | |
476 info "Editing the server." | |
477 `(lambda (form) | |
478 (gnus-server-set-info ,server form) | |
479 (gnus-server-list-servers) | |
480 (gnus-server-position-point))))) | |
481 | |
482 (defun gnus-server-scan-server (server) | |
483 "Request a scan from the current server." | |
484 (interactive (list (gnus-server-server-name))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
485 (let ((method (gnus-server-to-method server))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
486 (if (not (gnus-get-function method 'request-scan)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
487 (error "Server %s can't scan" (car method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
488 (gnus-message 3 "Scanning %s..." server) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
489 (gnus-request-scan nil method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
490 (gnus-message 3 "Scanning %s...done" server)))) |
17493 | 491 |
492 (defun gnus-server-read-server (server) | |
493 "Browse a server." | |
494 (interactive (list (gnus-server-server-name))) | |
495 (let ((buf (current-buffer))) | |
496 (prog1 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
497 (gnus-browse-foreign-server server buf) |
17493 | 498 (save-excursion |
499 (set-buffer buf) | |
500 (gnus-server-update-server (gnus-server-server-name)) | |
501 (gnus-server-position-point))))) | |
502 | |
503 (defun gnus-server-pick-server (e) | |
504 (interactive "e") | |
505 (mouse-set-point e) | |
506 (gnus-server-read-server (gnus-server-server-name))) | |
507 | |
508 | |
509 ;;; | |
510 ;;; Browse Server Mode | |
511 ;;; | |
512 | |
513 (defvar gnus-browse-menu-hook nil | |
514 "*Hook run after the creation of the browse mode menu.") | |
515 | |
516 (defvar gnus-browse-mode-hook nil) | |
517 (defvar gnus-browse-mode-map nil) | |
518 (put 'gnus-browse-mode 'mode-class 'special) | |
519 | |
520 (unless gnus-browse-mode-map | |
521 (setq gnus-browse-mode-map (make-keymap)) | |
522 (suppress-keymap gnus-browse-mode-map) | |
523 | |
524 (gnus-define-keys | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
525 gnus-browse-mode-map |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
526 " " gnus-browse-read-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
527 "=" gnus-browse-select-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
528 "n" gnus-browse-next-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
529 "p" gnus-browse-prev-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
530 "\177" gnus-browse-prev-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
531 [delete] gnus-browse-prev-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
532 "N" gnus-browse-next-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
533 "P" gnus-browse-prev-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
534 "\M-n" gnus-browse-next-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
535 "\M-p" gnus-browse-prev-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
536 "\r" gnus-browse-select-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
537 "u" gnus-browse-unsubscribe-current-group |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
538 "l" gnus-browse-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
539 "L" gnus-browse-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
540 "q" gnus-browse-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
541 "Q" gnus-browse-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
542 "\C-c\C-c" gnus-browse-exit |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
543 "?" gnus-browse-describe-briefly |
17493 | 544 |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
545 "\C-c\C-i" gnus-info-find-node |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
546 "\C-c\C-b" gnus-bug)) |
17493 | 547 |
548 (defun gnus-browse-make-menu-bar () | |
549 (gnus-turn-off-edit-menu 'browse) | |
550 (unless (boundp 'gnus-browse-menu) | |
551 (easy-menu-define | |
552 gnus-browse-menu gnus-browse-mode-map "" | |
553 '("Browse" | |
554 ["Subscribe" gnus-browse-unsubscribe-current-group t] | |
555 ["Read" gnus-browse-read-group t] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
556 ["Select" gnus-browse-select-group t] |
17493 | 557 ["Next" gnus-browse-next-group t] |
558 ["Prev" gnus-browse-next-group t] | |
559 ["Exit" gnus-browse-exit t])) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
560 (gnus-run-hooks 'gnus-browse-menu-hook))) |
17493 | 561 |
562 (defvar gnus-browse-current-method nil) | |
563 (defvar gnus-browse-return-buffer nil) | |
564 | |
565 (defvar gnus-browse-buffer "*Gnus Browse Server*") | |
566 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
567 (defun gnus-browse-foreign-server (server &optional return-buffer) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
568 "Browse the server SERVER." |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
569 (setq gnus-browse-current-method (gnus-server-to-method server)) |
17493 | 570 (setq gnus-browse-return-buffer return-buffer) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
571 (let* ((method gnus-browse-current-method) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
572 (gnus-select-method method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
573 groups group) |
17493 | 574 (gnus-message 5 "Connecting to %s..." (nth 1 method)) |
575 (cond | |
576 ((not (gnus-check-server method)) | |
577 (gnus-message | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
578 1 "Unable to contact server %s: %s" (nth 1 method) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
579 (gnus-status-message method)) |
17493 | 580 nil) |
581 ((not | |
582 (prog2 | |
583 (gnus-message 6 "Reading active file...") | |
584 (gnus-request-list method) | |
585 (gnus-message 6 "Reading active file...done"))) | |
586 (gnus-message | |
587 1 "Couldn't request list: %s" (gnus-status-message method)) | |
588 nil) | |
589 (t | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
590 (gnus-get-buffer-create gnus-browse-buffer) |
17493 | 591 (when gnus-carpal |
592 (gnus-carpal-setup-buffer 'browse)) | |
593 (gnus-configure-windows 'browse) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
594 (buffer-disable-undo) |
17493 | 595 (let ((buffer-read-only nil)) |
596 (erase-buffer)) | |
597 (gnus-browse-mode) | |
598 (setq mode-line-buffer-identification | |
599 (list | |
600 (format | |
601 "Gnus: %%b {%s:%s}" (car method) (cadr method)))) | |
602 (save-excursion | |
603 (set-buffer nntp-server-buffer) | |
604 (let ((cur (current-buffer))) | |
605 (goto-char (point-min)) | |
606 (unless (string= gnus-ignored-newsgroups "") | |
607 (delete-matching-lines gnus-ignored-newsgroups)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
608 (while (not (eobp)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
609 (ignore-errors |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
610 (push (cons |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
611 (if (eq (char-after) ?\") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
612 (read cur) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
613 (let ((p (point)) (name "")) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
614 (skip-chars-forward "^ \t\\\\") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
615 (setq name (buffer-substring p (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
616 (while (eq (char-after) ?\\) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
617 (setq p (1+ (point))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
618 (forward-char 2) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
619 (skip-chars-forward "^ \t\\\\") |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
620 (setq name (concat name (buffer-substring |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
621 p (point))))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
622 name)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
623 (max 0 (- (1+ (read cur)) (read cur)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
624 groups)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
625 (forward-line)))) |
17493 | 626 (setq groups (sort groups |
627 (lambda (l1 l2) | |
628 (string< (car l1) (car l2))))) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
629 (let ((buffer-read-only nil) charset) |
17493 | 630 (while groups |
631 (setq group (car groups)) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
632 (setq charset (gnus-group-name-charset method group)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
633 (gnus-add-text-properties |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
634 (point) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
635 (prog1 (1+ (point)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
636 (insert |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
637 (format "K%7d: %s\n" (cdr group) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
638 (gnus-group-name-decode (car group) charset)))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
639 (list 'gnus-group (car group))) |
17493 | 640 (setq groups (cdr groups)))) |
641 (switch-to-buffer (current-buffer)) | |
642 (goto-char (point-min)) | |
643 (gnus-group-position-point) | |
644 (gnus-message 5 "Connecting to %s...done" (nth 1 method)) | |
645 t)))) | |
646 | |
647 (defun gnus-browse-mode () | |
648 "Major mode for browsing a foreign server. | |
649 | |
650 All normal editing commands are switched off. | |
651 | |
652 \\<gnus-browse-mode-map> | |
653 The only things you can do in this buffer is | |
654 | |
655 1) `\\[gnus-browse-unsubscribe-current-group]' to subscribe to a group. | |
656 The group will be inserted into the group buffer upon exit from this | |
657 buffer. | |
658 | |
659 2) `\\[gnus-browse-read-group]' to read a group ephemerally. | |
660 | |
661 3) `\\[gnus-browse-exit]' to return to the group buffer." | |
662 (interactive) | |
663 (kill-all-local-variables) | |
664 (when (gnus-visual-p 'browse-menu 'menu) | |
665 (gnus-browse-make-menu-bar)) | |
666 (gnus-simplify-mode-line) | |
667 (setq major-mode 'gnus-browse-mode) | |
668 (setq mode-name "Browse Server") | |
669 (setq mode-line-process nil) | |
670 (use-local-map gnus-browse-mode-map) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
671 (buffer-disable-undo) |
17493 | 672 (setq truncate-lines t) |
673 (gnus-set-default-directory) | |
674 (setq buffer-read-only t) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
675 (gnus-run-hooks 'gnus-browse-mode-hook)) |
17493 | 676 |
677 (defun gnus-browse-read-group (&optional no-article) | |
678 "Enter the group at the current line." | |
679 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
680 (let ((group (gnus-browse-group-name))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
681 (if (or (not (gnus-get-info group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
682 (gnus-ephemeral-group-p group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
683 (unless (gnus-group-read-ephemeral-group |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
684 (gnus-group-real-name group) gnus-browse-current-method nil |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
685 (cons (current-buffer) 'browse)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
686 (error "Couldn't enter %s" group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
687 (unless (gnus-group-read-group nil no-article group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
688 (error "Couldn't enter %s" group))))) |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
689 |
17493 | 690 (defun gnus-browse-select-group () |
691 "Select the current group." | |
692 (interactive) | |
693 (gnus-browse-read-group 'no)) | |
694 | |
695 (defun gnus-browse-next-group (n) | |
696 "Go to the next group." | |
697 (interactive "p") | |
698 (prog1 | |
699 (forward-line n) | |
700 (gnus-group-position-point))) | |
701 | |
702 (defun gnus-browse-prev-group (n) | |
703 "Go to the next group." | |
704 (interactive "p") | |
705 (gnus-browse-next-group (- n))) | |
706 | |
707 (defun gnus-browse-unsubscribe-current-group (arg) | |
708 "(Un)subscribe to the next ARG groups." | |
709 (interactive "p") | |
710 (when (eobp) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
711 (error "No group at current line")) |
17493 | 712 (let ((ward (if (< arg 0) -1 1)) |
713 (arg (abs arg))) | |
714 (while (and (> arg 0) | |
715 (not (eobp)) | |
716 (gnus-browse-unsubscribe-group) | |
717 (zerop (gnus-browse-next-group ward))) | |
718 (decf arg)) | |
719 (gnus-group-position-point) | |
720 (when (/= 0 arg) | |
721 (gnus-message 7 "No more newsgroups")) | |
722 arg)) | |
723 | |
724 (defun gnus-browse-group-name () | |
725 (save-excursion | |
726 (beginning-of-line) | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
727 (let ((name (get-text-property (point) 'gnus-group))) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
728 (when (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
729 (gnus-group-prefixed-name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
730 (or name |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
731 (match-string-no-properties 1)) |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
732 gnus-browse-current-method))))) |
17493 | 733 |
734 (defun gnus-browse-unsubscribe-group () | |
735 "Toggle subscription of the current group in the browse buffer." | |
736 (let ((sub nil) | |
737 (buffer-read-only nil) | |
738 group) | |
739 (save-excursion | |
740 (beginning-of-line) | |
741 ;; If this group it killed, then we want to subscribe it. | |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
742 (when (eq (char-after) ?K) |
17493 | 743 (setq sub t)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
744 (setq group (gnus-browse-group-name)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
745 (when (and sub |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
746 (cadr (gnus-gethash group gnus-newsrc-hashtb))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
747 (error "Group already subscribed")) |
17493 | 748 (delete-char 1) |
749 (if sub | |
750 (progn | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
751 ;; Make sure the group has been properly removed before we |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
752 ;; subscribe to it. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
753 (gnus-kill-ephemeral-group group) |
17493 | 754 (gnus-group-change-level |
755 (list t group gnus-level-default-subscribed | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
756 nil nil (if (gnus-server-equal |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
757 gnus-browse-current-method "native") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
758 nil |
31716
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
759 (gnus-method-simplify |
9968f55ad26e
Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents:
24357
diff
changeset
|
760 gnus-browse-current-method))) |
17493 | 761 gnus-level-default-subscribed gnus-level-killed |
762 (and (car (nth 1 gnus-newsrc-alist)) | |
763 (gnus-gethash (car (nth 1 gnus-newsrc-alist)) | |
764 gnus-newsrc-hashtb)) | |
765 t) | |
766 (insert ? )) | |
767 (gnus-group-change-level | |
768 group gnus-level-killed gnus-level-default-subscribed) | |
769 (insert ?K))) | |
770 t)) | |
771 | |
772 (defun gnus-browse-exit () | |
773 "Quit browsing and return to the group buffer." | |
774 (interactive) | |
775 (when (eq major-mode 'gnus-browse-mode) | |
776 (kill-buffer (current-buffer))) | |
777 ;; Insert the newly subscribed groups in the group buffer. | |
778 (save-excursion | |
779 (set-buffer gnus-group-buffer) | |
780 (gnus-group-list-groups nil)) | |
781 (if gnus-browse-return-buffer | |
782 (gnus-configure-windows 'server 'force) | |
783 (gnus-configure-windows 'group 'force))) | |
784 | |
785 (defun gnus-browse-describe-briefly () | |
786 "Give a one line description of the group mode commands." | |
787 (interactive) | |
788 (gnus-message 6 | |
789 (substitute-command-keys "\\<gnus-browse-mode-map>\\[gnus-group-next-group]:Forward \\[gnus-group-prev-group]:Backward \\[gnus-browse-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-browse-describe-briefly]:This help"))) | |
790 | |
791 (defun gnus-server-regenerate-server () | |
792 "Issue a command to the server to regenerate all its data structures." | |
793 (interactive) | |
794 (let ((server (gnus-server-server-name))) | |
795 (unless server | |
796 (error "No server on the current line")) | |
797 (if (not (gnus-check-backend-function | |
798 'request-regenerate (car (gnus-server-to-method server)))) | |
799 (error "This backend doesn't support regeneration") | |
800 (gnus-message 5 "Requesting regeneration of %s..." server) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
801 (unless (gnus-open-server server) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19521
diff
changeset
|
802 (error "Couldn't open server")) |
17493 | 803 (if (gnus-request-regenerate server) |
804 (gnus-message 5 "Requesting regeneration of %s...done" server) | |
805 (gnus-message 5 "Couldn't regenerate %s" server))))) | |
806 | |
807 (provide 'gnus-srvr) | |
808 | |
809 ;;; gnus-srvr.el ends here. |