1 ;;; gnus-srvr.el --- virtual server support for Gnus
2 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
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)
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.
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.
29 (eval-when-compile (require 'cl
))
37 (defvar gnus-server-mode-hook nil
38 "Hook run in `gnus-server-mode' buffers.")
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,
43 with some simple extensions.
45 The following specs are understood:
52 (defvar gnus-server-mode-line-format
"Gnus: %%b"
53 "The format specification for the server mode line.")
55 (defvar gnus-server-exit-hook nil
56 "*Hook run when exiting the server buffer.")
58 ;;; Internal variables.
60 (defvar gnus-inserted-opened-servers nil
)
62 (defvar gnus-server-line-format-alist
63 `((?h gnus-tmp-how ?s
)
65 (?w gnus-tmp-where ?s
)
66 (?s gnus-tmp-status ?s
)))
68 (defvar gnus-server-mode-line-format-alist
69 `((?S gnus-tmp-news-server ?s
)
70 (?M gnus-tmp-news-method ?s
)
71 (?u gnus-tmp-user-defined ?s
)))
73 (defvar gnus-server-line-format-spec nil
)
74 (defvar gnus-server-mode-line-format-spec nil
)
75 (defvar gnus-server-killed-servers nil
)
77 (defvar gnus-server-mode-map
)
79 (defvar gnus-server-menu-hook nil
80 "*Hook run after the creation of the server mode menu.")
82 (defun gnus-server-make-menu-bar ()
83 (gnus-turn-off-edit-menu 'server
)
84 (unless (boundp 'gnus-server-server-menu
)
86 gnus-server-server-menu gnus-server-mode-map
""
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
]))
100 gnus-server-connections-menu gnus-server-mode-map
""
102 ["Open" gnus-server-open-server t
]
103 ["Close" gnus-server-close-server t
]
104 ["Deny" gnus-server-deny-server t
]
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
]))
110 (gnus-run-hooks 'gnus-server-menu-hook
)))
112 (defvar gnus-server-mode-map nil
)
113 (put 'gnus-server-mode
'mode-class
'special
)
115 (unless gnus-server-mode-map
116 (setq gnus-server-mode-map
(make-sparse-keymap))
117 (suppress-keymap gnus-server-mode-map
)
119 (gnus-define-keys gnus-server-mode-map
120 " " gnus-server-read-server
121 "\r" gnus-server-read-server
122 gnus-mouse-2 gnus-server-pick-server
124 "l" gnus-server-list-servers
125 "k" gnus-server-kill-server
126 "y" gnus-server-yank-server
127 "c" gnus-server-copy-server
128 "a" gnus-server-add-server
129 "e" gnus-server-edit-server
130 "s" gnus-server-scan-server
132 "O" gnus-server-open-server
133 "\M-o" gnus-server-open-all-servers
134 "C" gnus-server-close-server
135 "\M-c" gnus-server-close-all-servers
136 "D" gnus-server-deny-server
137 "R" gnus-server-remove-denials
142 "g" gnus-server-regenerate-server
144 "\C-c\C-i" gnus-info-find-node
145 "\C-c\C-b" gnus-bug
))
147 (defun gnus-server-mode ()
148 "Major mode for listing and editing servers.
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]').
155 The following commands are available:
157 \\{gnus-server-mode-map}"
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
)
168 (buffer-disable-undo)
169 (setq truncate-lines t
)
170 (setq buffer-read-only t
)
171 (gnus-run-hooks 'gnus-server-mode-hook
))
173 (defun gnus-server-insert-server-line (gnus-tmp-name method
)
174 (let* ((gnus-tmp-how (car method
))
175 (gnus-tmp-where (nth 1 method
))
176 (elem (assoc method gnus-opened-servers
))
178 (if (eq (nth 1 elem
) 'denied
)
181 (if (or (gnus-server-opened method
)
182 (eq (nth 1 elem
) 'ok
))
185 ((error) "(error)")))))
187 (gnus-add-text-properties
191 (eval gnus-server-line-format-spec
))
192 (list 'gnus-server
(intern gnus-tmp-name
)))))
194 (defun gnus-enter-server-buffer ()
195 "Set up the server buffer."
196 (gnus-server-setup-buffer)
197 (gnus-configure-windows 'server
)
198 (gnus-server-prepare))
200 (defun gnus-server-setup-buffer ()
201 "Initialize the server buffer."
202 (unless (get-buffer gnus-server-buffer
)
204 (set-buffer (gnus-get-buffer-create gnus-server-buffer
))
207 (gnus-carpal-setup-buffer 'server
)))))
209 (defun gnus-server-prepare ()
210 (gnus-set-format 'server-mode
)
211 (gnus-set-format 'server t
)
212 (let ((alist gnus-server-alist
)
213 (buffer-read-only nil
)
214 (opened gnus-opened-servers
)
217 (setq gnus-inserted-opened-servers nil
)
218 ;; First we do the real list of servers.
220 (unless (member (cdar alist
) done
)
221 (push (cdar alist
) done
)
222 (cdr (setq server
(pop alist
)))
223 (when (and server
(car server
) (cdr server
))
224 (gnus-server-insert-server-line (car server
) (cdr server
))))
225 (when (member (cdar alist
) done
)
227 ;; Then we insert the list of servers that have been opened in
230 (when (and (not (member (caar opened
) done
))
231 ;; Just ignore ephemeral servers.
232 (not (member (caar opened
) gnus-ephemeral-servers
)))
233 (push (caar opened
) done
)
234 (gnus-server-insert-server-line
235 (setq op-ser
(format "%s:%s" (caaar opened
) (nth 1 (caar opened
))))
237 (push (list op-ser
(caar opened
)) gnus-inserted-opened-servers
))
238 (setq opened
(cdr opened
))))
239 (goto-char (point-min))
240 (gnus-server-position-point))
242 (defun gnus-server-server-name ()
243 (let ((server (get-text-property (gnus-point-at-bol) 'gnus-server
)))
244 (and server
(symbol-name server
))))
246 (defalias 'gnus-server-position-point
'gnus-goto-colon
)
248 (defconst gnus-server-edit-buffer
"*Gnus edit server*")
250 (defun gnus-server-update-server (server)
252 (set-buffer gnus-server-buffer
)
253 (let* ((buffer-read-only nil
)
254 (entry (assoc server gnus-server-alist
))
255 (oentry (assoc (gnus-server-to-method server
)
256 gnus-opened-servers
)))
259 (concat "(gnus-server-set-info \"" server
"\" '"
260 (prin1-to-string (cdr entry
)) ")\n")))
261 (when (or entry oentry
)
262 ;; Buffer may be narrowed.
265 (when (gnus-server-goto-server server
)
268 (gnus-server-insert-server-line (car entry
) (cdr entry
))
269 (gnus-server-insert-server-line
270 (format "%s:%s" (caar oentry
) (nth 1 (car oentry
)))
272 (gnus-server-position-point))))))
274 (defun gnus-server-set-info (server info
)
275 ;; Enter a select method into the virtual server alist.
276 (when (and server info
)
278 (concat "(gnus-server-set-info \"" server
"\" '"
279 (prin1-to-string info
) ")"))
280 (let* ((server (nth 1 info
))
281 (entry (assoc server gnus-server-alist
)))
282 (if entry
(setcdr entry info
)
283 (setq gnus-server-alist
284 (nconc gnus-server-alist
(list (cons server info
))))))))
286 ;;; Interactive server functions.
288 (defun gnus-server-kill-server (server)
289 "Kill the server on the current line."
290 (interactive (list (gnus-server-server-name)))
291 (unless (gnus-server-goto-server server
)
292 (if server
(error "No such server: %s" server
)
293 (error "No server on the current line")))
294 (unless (assoc server gnus-server-alist
)
295 (error "Read-only server %s" server
))
297 (let ((buffer-read-only nil
))
299 (push (assoc server gnus-server-alist
) gnus-server-killed-servers
)
300 (setq gnus-server-alist
(delq (car gnus-server-killed-servers
)
302 (let ((groups (gnus-groups-from-server server
)))
305 (format "Kill all %s groups from this server? "
307 (dolist (group groups
)
308 (setq gnus-newsrc-alist
309 (delq (assoc group gnus-newsrc-alist
)
311 (when gnus-group-change-level-function
312 (funcall gnus-group-change-level-function
313 group gnus-level-killed
3)))))
314 (gnus-server-position-point))
316 (defun gnus-server-yank-server ()
317 "Yank the previously killed server."
319 (unless gnus-server-killed-servers
320 (error "No killed servers to be yanked"))
321 (let ((alist gnus-server-alist
)
322 (server (gnus-server-server-name))
323 (killed (car gnus-server-killed-servers
)))
325 (setq gnus-server-alist
(nconc gnus-server-alist
(list killed
)))
326 (if (string= server
(caar gnus-server-alist
))
327 (push killed gnus-server-alist
)
328 (while (and (cdr alist
)
329 (not (string= server
(caadr alist
))))
330 (setq alist
(cdr alist
)))
332 (setcdr alist
(cons killed
(cdr alist
)))
333 (setq gnus-server-alist
(list killed
)))))
334 (gnus-server-update-server (car killed
))
335 (setq gnus-server-killed-servers
(cdr gnus-server-killed-servers
))
336 (gnus-server-position-point)))
338 (defun gnus-server-exit ()
339 "Return to the group buffer."
341 (gnus-run-hooks 'gnus-server-exit-hook
)
342 (kill-buffer (current-buffer))
343 (gnus-configure-windows 'group t
))
345 (defun gnus-server-list-servers ()
346 "List all available servers."
348 (let ((cur (gnus-server-server-name)))
349 (gnus-server-prepare)
350 (if cur
(gnus-server-goto-server cur
)
351 (goto-char (point-max))
353 (gnus-server-position-point)))
355 (defun gnus-server-set-status (method status
)
356 "Make METHOD have STATUS."
357 (let ((entry (assoc method gnus-opened-servers
)))
359 (setcar (cdr entry
) status
)
360 (push (list method status
) gnus-opened-servers
))))
362 (defun gnus-opened-servers-remove (method)
363 "Remove METHOD from the list of opened servers."
364 (setq gnus-opened-servers
(delq (assoc method gnus-opened-servers
)
365 gnus-opened-servers
)))
367 (defun gnus-server-open-server (server)
368 "Force an open of SERVER."
369 (interactive (list (gnus-server-server-name)))
370 (let ((method (gnus-server-to-method server
)))
372 (error "No such server: %s" server
))
373 (gnus-server-set-status method
'ok
)
375 (or (gnus-open-server method
)
376 (progn (message "Couldn't open %s" server
) nil
))
377 (gnus-server-update-server server
)
378 (gnus-server-position-point))))
380 (defun gnus-server-open-all-servers ()
383 (let ((servers gnus-inserted-opened-servers
))
385 (gnus-server-open-server (car (pop servers
))))))
387 (defun gnus-server-close-server (server)
389 (interactive (list (gnus-server-server-name)))
390 (let ((method (gnus-server-to-method server
)))
392 (error "No such server: %s" server
))
393 (gnus-server-set-status method
'closed
)
395 (gnus-close-server method
)
396 (gnus-server-update-server server
)
397 (gnus-server-position-point))))
399 (defun gnus-server-close-all-servers ()
402 (let ((servers gnus-inserted-opened-servers
))
404 (gnus-server-close-server (car (pop servers
))))))
406 (defun gnus-server-deny-server (server)
407 "Make sure SERVER will never be attempted opened."
408 (interactive (list (gnus-server-server-name)))
409 (let ((method (gnus-server-to-method server
)))
411 (error "No such server: %s" server
))
412 (gnus-server-set-status method
'denied
))
413 (gnus-server-update-server server
)
414 (gnus-server-position-point)
417 (defun gnus-server-remove-denials ()
418 "Make all denied servers into closed servers."
420 (let ((servers gnus-opened-servers
))
422 (when (eq (nth 1 (car servers
)) 'denied
)
423 (setcar (nthcdr 1 (car servers
)) 'closed
))
424 (setq servers
(cdr servers
))))
425 (gnus-server-list-servers))
427 (defun gnus-server-copy-server (from to
)
430 (or (gnus-server-server-name)
431 (error "No server on the current line"))
432 (read-string "Copy to: ")))
434 (error "No server on current line"))
435 (unless (and to
(not (string= to
"")))
436 (error "No name to copy to"))
437 (when (assoc to gnus-server-alist
)
438 (error "%s already exists" to
))
439 (unless (gnus-server-to-method from
)
440 (error "%s: no such server" from
))
441 (let ((to-entry (cons from
(gnus-copy-sequence
442 (gnus-server-to-method from
)))))
444 (setcar (nthcdr 2 to-entry
) to
)
445 (push to-entry gnus-server-killed-servers
)
446 (gnus-server-yank-server)))
448 (defun gnus-server-add-server (how where
)
450 (list (intern (completing-read "Server method: "
451 gnus-valid-select-methods nil t
))
452 (read-string "Server name: ")))
453 (when (assq where gnus-server-alist
)
454 (error "Server with that name already defined"))
455 (push (list where how where
) gnus-server-killed-servers
)
456 (gnus-server-yank-server))
458 (defun gnus-server-goto-server (server)
459 "Jump to a server line."
461 (list (completing-read "Goto server: " gnus-server-alist nil t
)))
462 (let ((to (text-property-any (point-min) (point-max)
463 'gnus-server
(intern server
))))
466 (gnus-server-position-point))))
468 (defun gnus-server-edit-server (server)
469 "Edit the server on the current line."
470 (interactive (list (gnus-server-server-name)))
472 (error "No server on current line"))
473 (unless (assoc server gnus-server-alist
)
474 (error "This server can't be edited"))
475 (let ((info (cdr (assoc server gnus-server-alist
))))
476 (gnus-close-server info
)
478 info
"Editing the server."
480 (gnus-server-set-info ,server form
)
481 (gnus-server-list-servers)
482 (gnus-server-position-point)))))
484 (defun gnus-server-scan-server (server)
485 "Request a scan from the current server."
486 (interactive (list (gnus-server-server-name)))
487 (let ((method (gnus-server-to-method server
)))
488 (if (not (gnus-get-function method
'request-scan
))
489 (error "Server %s can't scan" (car method
))
490 (gnus-message 3 "Scanning %s..." server
)
491 (gnus-request-scan nil method
)
492 (gnus-message 3 "Scanning %s...done" server
))))
494 (defun gnus-server-read-server (server)
496 (interactive (list (gnus-server-server-name)))
497 (let ((buf (current-buffer)))
499 (gnus-browse-foreign-server server buf
)
502 (gnus-server-update-server (gnus-server-server-name))
503 (gnus-server-position-point)))))
505 (defun gnus-server-pick-server (e)
508 (gnus-server-read-server (gnus-server-server-name)))
512 ;;; Browse Server Mode
515 (defvar gnus-browse-menu-hook nil
516 "*Hook run after the creation of the browse mode menu.")
518 (defvar gnus-browse-mode-hook nil
)
519 (defvar gnus-browse-mode-map nil
)
520 (put 'gnus-browse-mode
'mode-class
'special
)
522 (unless gnus-browse-mode-map
523 (setq gnus-browse-mode-map
(make-keymap))
524 (suppress-keymap gnus-browse-mode-map
)
528 " " gnus-browse-read-group
529 "=" gnus-browse-select-group
530 "n" gnus-browse-next-group
531 "p" gnus-browse-prev-group
532 "\177" gnus-browse-prev-group
533 [delete] gnus-browse-prev-group
534 "N" gnus-browse-next-group
535 "P" gnus-browse-prev-group
536 "\M-n" gnus-browse-next-group
537 "\M-p" gnus-browse-prev-group
538 "\r" gnus-browse-select-group
539 "u" gnus-browse-unsubscribe-current-group
544 "\C-c\C-c" gnus-browse-exit
545 "?" gnus-browse-describe-briefly
547 "\C-c\C-i" gnus-info-find-node
548 "\C-c\C-b" gnus-bug))
550 (defun gnus-browse-make-menu-bar ()
551 (gnus-turn-off-edit-menu 'browse)
552 (unless (boundp 'gnus-browse-menu)
554 gnus-browse-menu gnus-browse-mode-map ""
556 ["Subscribe" gnus-browse-unsubscribe-current-group t]
557 ["Read" gnus-browse-read-group t]
558 ["Select" gnus-browse-select-group t]
559 ["Next" gnus-browse-next-group t]
560 ["Prev" gnus-browse-prev-group t]
561 ["Exit" gnus-browse-exit t]))
562 (gnus-run-hooks 'gnus-browse-menu-hook)))
564 (defvar gnus-browse-current-method nil)
565 (defvar gnus-browse-return-buffer nil)
567 (defvar gnus-browse-buffer "*Gnus Browse Server*")
569 (defun gnus-browse-foreign-server (server &optional return-buffer)
570 "Browse the server SERVER."
571 (setq gnus-browse-current-method (gnus-server-to-method server))
572 (setq gnus-browse-return-buffer return-buffer)
573 (let* ((method gnus-browse-current-method)
574 (gnus-select-method method)
576 (gnus-message 5 "Connecting to %s..." (nth 1 method))
578 ((not (gnus-check-server method))
580 1 "Unable to contact server %s: %s" (nth 1 method)
581 (gnus-status-message method))
585 (gnus-message 6 "Reading active file...")
586 (gnus-request-list method)
587 (gnus-message 6 "Reading active file...done")))
589 1 "Couldn't request list: %s" (gnus-status-message method))
592 (gnus-get-buffer-create gnus-browse-buffer)
594 (gnus-carpal-setup-buffer 'browse))
595 (gnus-configure-windows 'browse)
596 (buffer-disable-undo)
597 (let ((buffer-read-only nil))
600 (setq mode-line-buffer-identification
603 "Gnus: %%b {%s:%s}" (car method) (cadr method))))
605 (set-buffer nntp-server-buffer)
606 (let ((cur (current-buffer)))
607 (goto-char (point-min))
608 (unless (string= gnus-ignored-newsgroups "")
609 (delete-matching-lines gnus-ignored-newsgroups))
613 (if (eq (char-after) ?\")
615 (let ((p (point)) (name ""))
616 (skip-chars-forward "^ \t\\\\")
617 (setq name (buffer-substring p (point)))
618 (while (eq (char-after) ?\\)
619 (setq p (1+ (point)))
621 (skip-chars-forward "^ \t\\\\")
622 (setq name (concat name (buffer-substring
625 (max 0 (- (1+ (read cur)) (read cur))))
628 (setq groups (sort groups
630 (string< (car l1) (car l2)))))
631 (let ((buffer-read-only nil) charset)
633 (setq group (car groups))
634 (setq charset (gnus-group-name-charset method group))
635 (gnus-add-text-properties
639 (format "K%7d: %s\n" (cdr group)
640 (gnus-group-name-decode (car group) charset))))
641 (list 'gnus-group (car group)))
642 (setq groups (cdr groups))))
643 (switch-to-buffer (current-buffer))
644 (goto-char (point-min))
645 (gnus-group-position-point)
646 (gnus-message 5 "Connecting to %s...done" (nth 1 method))
649 (defun gnus-browse-mode ()
650 "Major mode for browsing a foreign server.
652 All normal editing commands are switched off.
654 \\<gnus-browse-mode-map>
655 The only things you can do in this buffer is
657 1) `\\[gnus-browse-unsubscribe-current-group]' to subscribe to a group.
658 The group will be inserted into the group buffer upon exit from this
661 2) `\\[gnus-browse-read-group]' to read a group ephemerally.
663 3) `\\[gnus-browse-exit]' to return to the group buffer."
665 (kill-all-local-variables)
666 (when (gnus-visual-p 'browse-menu 'menu)
667 (gnus-browse-make-menu-bar))
668 (gnus-simplify-mode-line)
669 (setq major-mode 'gnus-browse-mode)
670 (setq mode-name "Browse Server")
671 (setq mode-line-process nil)
672 (use-local-map gnus-browse-mode-map)
673 (buffer-disable-undo)
674 (setq truncate-lines t)
675 (gnus-set-default-directory)
676 (setq buffer-read-only t)
677 (gnus-run-hooks 'gnus-browse-mode-hook))
679 (defun gnus-browse-read-group (&optional no-article)
680 "Enter the group at the current line."
682 (let ((group (gnus-browse-group-name)))
683 (if (or (not (gnus-get-info group))
684 (gnus-ephemeral-group-p group))
685 (unless (gnus-group-read-ephemeral-group
686 (gnus-group-real-name group) gnus-browse-current-method nil
687 (cons (current-buffer) 'browse))
688 (error "Couldn't enter %s" group))
689 (unless (gnus-group-read-group nil no-article group)
690 (error "Couldn't enter %s" group)))))
692 (defun gnus-browse-select-group ()
693 "Select the current group."
695 (gnus-browse-read-group 'no))
697 (defun gnus-browse-next-group (n)
698 "Go to the next group."
702 (gnus-group-position-point)))
704 (defun gnus-browse-prev-group (n)
705 "Go to the next group."
707 (gnus-browse-next-group (- n)))
709 (defun gnus-browse-unsubscribe-current-group (arg)
710 "(Un)subscribe to the next ARG groups."
713 (error "No group at current line"))
714 (let ((ward (if (< arg 0) -1 1))
716 (while (and (> arg 0)
718 (gnus-browse-unsubscribe-group)
719 (zerop (gnus-browse-next-group ward)))
721 (gnus-group-position-point)
723 (gnus-message 7 "No more newsgroups"))
726 (defun gnus-browse-group-name ()
729 (let ((name (get-text-property (point) 'gnus-group)))
730 (when (re-search-forward ": \\(.*\\)$" (gnus-point-at-eol) t)
731 (gnus-group-prefixed-name
733 (match-string-no-properties 1))
734 gnus-browse-current-method)))))
736 (defun gnus-browse-unsubscribe-group ()
737 "Toggle subscription of the current group in the browse buffer."
739 (buffer-read-only nil)
743 ;; If this group it killed, then we want to subscribe it.
744 (when (eq (char-after) ?K)
746 (setq group (gnus-browse-group-name))
748 (cadr (gnus-gethash group gnus-newsrc-hashtb)))
749 (error "Group already subscribed"))
753 ;; Make sure the group has been properly removed before we
755 (gnus-kill-ephemeral-group group)
756 (gnus-group-change-level
757 (list t group gnus-level-default-subscribed
758 nil nil (if (gnus-server-equal
759 gnus-browse-current-method "native")
761 (gnus-method-simplify
762 gnus-browse-current-method)))
763 gnus-level-default-subscribed gnus-level-killed
764 (and (car (nth 1 gnus-newsrc-alist))
765 (gnus-gethash (car (nth 1 gnus-newsrc-alist))
769 (gnus-group-change-level
770 group gnus-level-killed gnus-level-default-subscribed)
774 (defun gnus-browse-exit ()
775 "Quit browsing and return to the group buffer."
777 (when (eq major-mode 'gnus-browse-mode)
778 (kill-buffer (current-buffer)))
779 ;; Insert the newly subscribed groups in the group buffer.
781 (set-buffer gnus-group-buffer)
782 (gnus-group-list-groups nil))
783 (if gnus-browse-return-buffer
784 (gnus-configure-windows 'server 'force)
785 (gnus-configure-windows 'group 'force)))
787 (defun gnus-browse-describe-briefly ()
788 "Give a one line description of the group mode commands."
791 (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")))
793 (defun gnus-server-regenerate-server ()
794 "Issue a command to the server to regenerate all its data structures."
796 (let ((server (gnus-server-server-name)))
798 (error "No server on the current line"))
799 (if (not (gnus-check-backend-function
800 'request-regenerate (car (gnus-server-to-method server))))
801 (error "This backend doesn't support regeneration")
802 (gnus-message 5 "Requesting regeneration of %s..." server)
803 (unless (gnus-open-server server)
804 (error "Couldn't open server"))
805 (if (gnus-request-regenerate server)
806 (gnus-message 5 "Requesting regeneration of %s...done" server)
807 (gnus-message 5 "Couldn't regenerate %s" server)))))
811 ;;; gnus-srvr.el ends here