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