2005-03-08 Bjorn Solberg <bjorn_ding@hekneby.org> (tiny change)
[gnus] / lisp / gnus-group.el
1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
3 ;;        Free Software Foundation, Inc.
4
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
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
29 (eval-when-compile
30   (require 'cl)
31   (defvar tool-bar-map))
32
33 (require 'gnus)
34 (require 'gnus-start)
35 (require 'nnmail)
36 (require 'gnus-spec)
37 (require 'gnus-int)
38 (require 'gnus-range)
39 (require 'gnus-win)
40 (require 'gnus-undo)
41 (require 'time-date)
42 (require 'gnus-ems)
43
44 (eval-when-compile 
45   (require 'mm-url)
46   (let ((features (cons 'gnus-group features)))
47     (require 'gnus-sum))
48   (unless (boundp 'gnus-cache-active-hashtb)
49     (defvar gnus-cache-active-hashtb nil)))
50
51 (autoload 'gnus-agent-total-fetched-for "gnus-agent")
52 (autoload 'gnus-cache-total-fetched-for "gnus-cache")
53
54 (defcustom gnus-group-archive-directory
55   "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
56   "*The address of the (ding) archives."
57   :group 'gnus-group-foreign
58   :type 'directory)
59
60 (defcustom gnus-group-recent-archive-directory
61   "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
62   "*The address of the most recent (ding) articles."
63   :group 'gnus-group-foreign
64   :type 'directory)
65
66 (defcustom gnus-no-groups-message "No Gnus is good news"
67   "*Message displayed by Gnus when no groups are available."
68   :group 'gnus-start
69   :type 'string)
70
71 (defcustom gnus-keep-same-level nil
72   "*Non-nil means that the next newsgroup after the current will be on the same level.
73 When you type, for instance, `n' after reading the last article in the
74 current newsgroup, you will go to the next newsgroup.  If this variable
75 is nil, the next newsgroup will be the next from the group
76 buffer.
77 If this variable is non-nil, Gnus will either put you in the
78 next newsgroup with the same level, or, if no such newsgroup is
79 available, the next newsgroup with the lowest possible level higher
80 than the current level.
81 If this variable is `best', Gnus will make the next newsgroup the one
82 with the best level."
83   :group 'gnus-group-levels
84   :type '(choice (const nil)
85                  (const best)
86                  (sexp :tag "other" t)))
87
88 (defcustom gnus-group-goto-unread t
89   "*If non-nil, movement commands will go to the next unread and subscribed group."
90   :link '(custom-manual "(gnus)Group Maneuvering")
91   :group 'gnus-group-various
92   :type 'boolean)
93
94 (defcustom gnus-goto-next-group-when-activating t
95   "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
96   :link '(custom-manual "(gnus)Scanning New Messages")
97   :group 'gnus-group-various
98   :type 'boolean)
99
100 (defcustom gnus-permanently-visible-groups nil
101   "*Regexp to match groups that should always be listed in the group buffer.
102 This means that they will still be listed even when there are no
103 unread articles in the groups.
104
105 If nil, no groups are permanently visible."
106   :group 'gnus-group-listing
107   :type '(choice regexp (const nil)))
108
109 (defcustom gnus-list-groups-with-ticked-articles t
110   "*If non-nil, list groups that have only ticked articles.
111 If nil, only list groups that have unread articles."
112   :group 'gnus-group-listing
113   :type 'boolean)
114
115 (defcustom gnus-group-default-list-level gnus-level-subscribed
116   "*Default listing level.
117 Ignored if `gnus-group-use-permanent-levels' is non-nil."
118   :group 'gnus-group-listing
119   :type 'integer)
120
121 (defcustom gnus-group-list-inactive-groups t
122   "*If non-nil, inactive groups will be listed."
123   :group 'gnus-group-listing
124   :group 'gnus-group-levels
125   :type 'boolean)
126
127 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
128   "*Function used for sorting the group buffer.
129 This function will be called with group info entries as the arguments
130 for the groups to be sorted.  Pre-made functions include
131 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
132 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
133 `gnus-group-sort-by-score', `gnus-group-sort-by-method',
134 `gnus-group-sort-by-server', and `gnus-group-sort-by-rank'.
135
136 This variable can also be a list of sorting functions.  In that case,
137 the most significant sort function should be the last function in the
138 list."
139   :group 'gnus-group-listing
140   :link '(custom-manual "(gnus)Sorting Groups")
141   :type '(repeat :value-to-internal (lambda (widget value)
142                                       (if (listp value) value (list value)))
143                  :match (lambda (widget value)
144                           (or (symbolp value)
145                               (widget-editable-list-match widget value)))
146                  (choice (function-item gnus-group-sort-by-alphabet)
147                          (function-item gnus-group-sort-by-real-name)
148                          (function-item gnus-group-sort-by-unread)
149                          (function-item gnus-group-sort-by-level)
150                          (function-item gnus-group-sort-by-score)
151                          (function-item gnus-group-sort-by-method)
152                          (function-item gnus-group-sort-by-server)
153                          (function-item gnus-group-sort-by-rank)
154                          (function :tag "other" nil))))
155
156 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y:%B%(%g%)%O\n"
157   "*Format of group lines.
158 It works along the same lines as a normal formatting string,
159 with some simple extensions.
160
161 %M    Only marked articles (character, \"*\" or \" \")
162 %S    Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
163 %L    Level of subscribedness (integer)
164 %N    Number of unread articles (integer)
165 %I    Number of dormant articles (integer)
166 %i    Number of ticked and dormant (integer)
167 %T    Number of ticked articles (integer)
168 %R    Number of read articles (integer)
169 %U    Number of unseen articles (integer)
170 %t    Estimated total number of articles (integer)
171 %y    Number of unread, unticked articles (integer)
172 %G    Group name (string)
173 %g    Qualified group name (string)
174 %c    Short (collapsed) group name.  See `gnus-group-uncollapsed-levels'.
175 %C    Group comment (string)
176 %D    Group description (string)
177 %s    Select method (string)
178 %o    Moderated group (char, \"m\")
179 %p    Process mark (char)
180 %B    Whether a summary buffer for the group is open (char, \"*\")
181 %O    Moderated group (string, \"(m)\" or \"\")
182 %P    Topic indentation (string)
183 %m    Whether there is new(ish) mail in the group (char, \"%\")
184 %n    Select from where (string)
185 %z    A string that look like `<%s:%n>' if a foreign select method is used
186 %d    The date the group was last entered.
187 %E    Icon as defined by `gnus-group-icon-list'.
188 %F    The disk space used by the articles fetched by both the cache and agent.
189 %u    User defined specifier.  The next character in the format string should
190       be a letter.  Gnus will call the function gnus-user-format-function-X,
191       where X is the letter following %u.  The function will be passed a
192       single dummy parameter as argument.  The function should return a
193       string, which will be inserted into the buffer just like information
194       from any other group specifier.
195
196 Note that this format specification is not always respected.  For
197 reasons of efficiency, when listing killed groups, this specification
198 is ignored altogether.  If the spec is changed considerably, your
199 output may end up looking strange when listing both alive and killed
200 groups.
201
202 If you use %o or %O, reading the active file will be slower and quite
203 a bit of extra memory will be used.  %D and %F will also worsen
204 performance.  Also note that if you change the format specification to
205 include any of these specs, you must probably re-start Gnus to see
206 them go into effect.
207
208 General format specifiers can also be used.
209 See Info node `(gnus)Formatting Variables'."
210   :link '(custom-manual "(gnus)Formatting Variables")
211   :group 'gnus-group-visual
212   :type 'string)
213
214 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
215   "*The format specification for the group mode line.
216 It works along the same lines as a normal formatting string,
217 with some simple extensions:
218
219 %S   The native news server.
220 %M   The native select method.
221 %:   \":\" if %S isn't \"\"."
222   :group 'gnus-group-visual
223   :type 'string)
224
225 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
226 (when (featurep 'xemacs)
227   (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
228   (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
229
230 (defcustom gnus-group-menu-hook nil
231   "Hook run after the creation of the group mode menu."
232   :group 'gnus-group-various
233   :type 'hook)
234
235 (defcustom gnus-group-catchup-group-hook nil
236   "Hook run when catching up a group from the group buffer."
237   :group 'gnus-group-various
238   :link '(custom-manual "(gnus)Group Data")
239   :type 'hook)
240
241 (defcustom gnus-group-update-group-hook nil
242   "Hook called when updating group lines."
243   :group 'gnus-group-visual
244   :type 'hook)
245
246 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
247   "*A function that is called to generate the group buffer.
248 The function is called with three arguments: The first is a number;
249 all group with a level less or equal to that number should be listed,
250 if the second is non-nil, empty groups should also be displayed.  If
251 the third is non-nil, it is a number.  No groups with a level lower
252 than this number should be displayed.
253
254 The only current function implemented is `gnus-group-prepare-flat'."
255   :group 'gnus-group-listing
256   :type 'function)
257
258 (defcustom gnus-group-prepare-hook nil
259   "Hook called after the group buffer has been generated.
260 If you want to modify the group buffer, you can use this hook."
261   :group 'gnus-group-listing
262   :type 'hook)
263
264 (defcustom gnus-suspend-gnus-hook nil
265   "Hook called when suspending (not exiting) Gnus."
266   :group 'gnus-exit
267   :type 'hook)
268
269 (defcustom gnus-exit-gnus-hook nil
270   "Hook called when exiting Gnus."
271   :group 'gnus-exit
272   :type 'hook)
273
274 (defcustom gnus-after-exiting-gnus-hook nil
275   "Hook called after exiting Gnus."
276   :group 'gnus-exit
277   :type 'hook)
278
279 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
280   "Hook called when a group line is changed.
281 The hook will not be called if `gnus-visual' is nil.
282
283 The default function `gnus-group-highlight-line' will
284 highlight the line according to the `gnus-group-highlight'
285 variable."
286   :group 'gnus-group-visual
287   :type 'hook)
288
289 (defcustom gnus-useful-groups
290   '(("(ding) mailing list mirrored at sunsite.auc.dk"
291      "emacs.ding"
292      (nntp "sunsite.auc.dk"
293            (nntp-address "sunsite.auc.dk")))
294     ("gnus-bug archive"
295      "gnus-bug"
296      (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
297     ("Gnus help group"
298      "gnus-help"
299      (nndoc "gnus-help"
300             (nndoc-article-type mbox)
301             (eval `(nndoc-address
302                     ,(let ((file (nnheader-find-etc-directory
303                                   "gnus-tut.txt" t)))
304                        (unless file
305                          (error "Couldn't find doc group"))
306                        file))))))
307   "*Alist of useful group-server pairs."
308   :group 'gnus-group-listing
309   :type '(repeat (list (string :tag "Description")
310                        (string :tag "Name")
311                        (sexp :tag "Method"))))
312
313 (defcustom gnus-group-highlight
314   '(;; Mail.
315     ((and mailp (= unread 0) (eq level 1)) .
316      gnus-group-mail-1-empty-face)
317     ((and mailp (eq level 1)) .
318      gnus-group-mail-1-face)
319     ((and mailp (= unread 0) (eq level 2)) .
320      gnus-group-mail-2-empty-face)
321     ((and mailp (eq level 2)) .
322      gnus-group-mail-2-face)
323     ((and mailp (= unread 0) (eq level 3)) .
324      gnus-group-mail-3-empty-face)
325     ((and mailp (eq level 3)) .
326      gnus-group-mail-3-face)
327     ((and mailp (= unread 0)) .
328      gnus-group-mail-low-empty-face)
329     ((and mailp) .
330      gnus-group-mail-low-face)
331     ;; News.
332     ((and (= unread 0) (eq level 1)) .
333      gnus-group-news-1-empty-face)
334     ((and (eq level 1)) .
335      gnus-group-news-1-face)
336     ((and (= unread 0) (eq level 2)) .
337      gnus-group-news-2-empty-face)
338     ((and (eq level 2)) .
339      gnus-group-news-2-face)
340     ((and (= unread 0) (eq level 3)) .
341      gnus-group-news-3-empty-face)
342     ((and (eq level 3)) .
343      gnus-group-news-3-face)
344     ((and (= unread 0) (eq level 4)) .
345      gnus-group-news-4-empty-face)
346     ((and (eq level 4)) .
347      gnus-group-news-4-face)
348     ((and (= unread 0) (eq level 5)) .
349      gnus-group-news-5-empty-face)
350     ((and (eq level 5)) .
351      gnus-group-news-5-face)
352     ((and (= unread 0) (eq level 6)) .
353      gnus-group-news-6-empty-face)
354     ((and (eq level 6)) .
355      gnus-group-news-6-face)
356     ((and (= unread 0)) .
357      gnus-group-news-low-empty-face)
358     (t .
359      gnus-group-news-low-face))
360   "*Controls the highlighting of group buffer lines.
361
362 Below is a list of `Form'/`Face' pairs.  When deciding how a a
363 particular group line should be displayed, each form is
364 evaluated.  The content of the face field after the first true form is
365 used.  You can change how those group lines are displayed by
366 editing the face field.
367
368 It is also possible to change and add form fields, but currently that
369 requires an understanding of Lisp expressions.  Hopefully this will
370 change in a future release.  For now, you can use the following
371 variables in the Lisp expression:
372
373 group: The name of the group.
374 unread: The number of unread articles in the group.
375 method: The select method used.
376 mailp: Whether it's a mail group or not.
377 level: The level of the group.
378 score: The score of the group.
379 ticked: The number of ticked articles."
380   :group 'gnus-group-visual
381   :type '(repeat (cons (sexp :tag "Form") face)))
382
383 (defcustom gnus-new-mail-mark ?%
384   "Mark used for groups with new mail."
385   :group 'gnus-group-visual
386   :type 'character)
387
388 (defgroup gnus-group-icons nil
389   "Add Icons to your group buffer.  "
390   :group 'gnus-group-visual)
391
392 (defcustom gnus-group-icon-list
393   nil
394   "*Controls the insertion of icons into group buffer lines.
395
396 Below is a list of `Form'/`File' pairs.  When deciding how a
397 particular group line should be displayed, each form is evaluated.
398 The icon from the file field after the first true form is used.  You
399 can change how those group lines are displayed by editing the file
400 field.  The File will either be found in the
401 `gnus-group-glyph-directory' or by designating absolute name of the
402 file.
403
404 It is also possible to change and add form fields, but currently that
405 requires an understanding of Lisp expressions.  Hopefully this will
406 change in a future release.  For now, you can use the following
407 variables in the Lisp expression:
408
409 group: The name of the group.
410 unread: The number of unread articles in the group.
411 method: The select method used.
412 mailp: Whether it's a mail group or not.
413 newsp: Whether it's a news group or not
414 level: The level of the group.
415 score: The score of the group.
416 ticked: The number of ticked articles."
417   :group 'gnus-group-icons
418   :type '(repeat (cons (sexp :tag "Form") file)))
419
420 (defcustom gnus-group-name-charset-method-alist nil
421   "Alist of method and the charset for group names.
422
423 For example:
424     (((nntp \"news.com.cn\") . cn-gb-2312))"
425   :version "21.1"
426   :group 'gnus-charset
427   :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
428
429 (defcustom gnus-group-name-charset-group-alist
430   (if (or (and (fboundp 'find-coding-system) (find-coding-system 'utf-8))
431           (mm-coding-system-p 'utf-8))
432       '((".*" . utf-8))
433     nil)
434   "Alist of group regexp and the charset for group names.
435
436 For example:
437     ((\"\\.com\\.cn:\" . cn-gb-2312))"
438   :group 'gnus-charset
439   :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
440
441 (defcustom gnus-group-jump-to-group-prompt nil
442   "Default prompt for `gnus-group-jump-to-group'.
443
444 If non-nil, the value should be a string or an alist.  If it is a string,
445 e.g. \"nnml:\", in which case `gnus-group-jump-to-group' offers \"Group:
446 nnml:\" in the minibuffer prompt.
447
448 If it is an alist, it must consist of \(NUMBER .  PROMPT\) pairs, for example:
449 \((1 .  \"\") (2 .  \"nnfolder+archive:\")).  The element with number 0 is
450 used when no prefix argument is given to `gnus-group-jump-to-group'."
451   :version "22.1"
452   :group 'gnus-group-various
453   :type '(choice (string :tag "Prompt string")
454                  (const :tag "Empty" nil)
455                  (repeat (cons (integer :tag "Argument")
456                                (string :tag "Prompt string")))))
457
458 (defvar gnus-group-listing-limit 1000
459   "*A limit of the number of groups when listing.
460 If the number of groups is larger than the limit, list them in a
461 simple manner.")
462
463 ;;; Internal variables
464
465 (defvar gnus-group-is-exiting-p nil)
466 (defvar gnus-group-is-exiting-without-update-p nil)
467 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
468   "Function for sorting the group buffer.")
469
470 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
471   "Function for sorting the selected groups in the group buffer.")
472
473 (defvar gnus-group-indentation-function nil)
474 (defvar gnus-goto-missing-group-function nil)
475 (defvar gnus-group-update-group-function nil)
476 (defvar gnus-group-goto-next-group-function nil
477   "Function to override finding the next group after listing groups.")
478
479 (defvar gnus-group-edit-buffer nil)
480
481 (defvar gnus-group-line-format-alist
482   `((?M gnus-tmp-marked-mark ?c)
483     (?S gnus-tmp-subscribed ?c)
484     (?L gnus-tmp-level ?d)
485     (?N (cond ((eq number t) "*" )
486               ((numberp number)
487                (int-to-string
488                 (+ number
489                    (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
490                    (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
491               (t number)) ?s)
492     (?R gnus-tmp-number-of-read ?s)
493     (?U (gnus-number-of-unseen-articles-in-group gnus-tmp-group) ?d)
494     (?t gnus-tmp-number-total ?d)
495     (?y gnus-tmp-number-of-unread ?s)
496     (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
497     (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
498     (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
499            (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
500     (?g (if (boundp 'gnus-tmp-decoded-group)
501             gnus-tmp-decoded-group
502           gnus-tmp-group)
503         ?s)
504     (?G gnus-tmp-qualified-group ?s)
505     (?c (gnus-short-group-name (if (boundp 'gnus-tmp-decoded-group)
506                                    gnus-tmp-decoded-group
507                                  gnus-tmp-group))
508         ?s)
509     (?C gnus-tmp-comment ?s)
510     (?D gnus-tmp-newsgroup-description ?s)
511     (?o gnus-tmp-moderated ?c)
512     (?O gnus-tmp-moderated-string ?s)
513     (?p gnus-tmp-process-marked ?c)
514     (?s gnus-tmp-news-server ?s)
515     (?n ,(if (featurep 'xemacs)
516              '(symbol-name gnus-tmp-news-method)
517            'gnus-tmp-news-method)
518         ?s)
519     (?P gnus-group-indentation ?s)
520     (?E gnus-tmp-group-icon ?s)
521     (?B gnus-tmp-summary-live ?c)
522     (?z gnus-tmp-news-method-string ?s)
523     (?m (gnus-group-new-mail gnus-tmp-group) ?c)
524     (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
525     (?u gnus-tmp-user-defined ?s)
526     (?F (gnus-total-fetched-for gnus-tmp-group) ?s)
527     ))
528
529 (defvar gnus-group-mode-line-format-alist
530   `((?S gnus-tmp-news-server ?s)
531     (?M gnus-tmp-news-method ?s)
532     (?u gnus-tmp-user-defined ?s)
533     (?: gnus-tmp-colon ?s)))
534
535 (defvar gnus-topic-topology nil
536   "The complete topic hierarchy.")
537
538 (defvar gnus-topic-alist nil
539   "The complete topic-group alist.")
540
541 (defvar gnus-group-marked nil)
542
543 (defvar gnus-group-list-mode nil)
544
545
546 (defvar gnus-group-icon-cache nil)
547
548 (defvar gnus-group-listed-groups nil)
549 (defvar gnus-group-list-option nil)
550
551 ;;;
552 ;;; Gnus group mode
553 ;;;
554
555 (put 'gnus-group-mode 'mode-class 'special)
556
557 (gnus-define-keys gnus-group-mode-map
558   " " gnus-group-read-group
559   "=" gnus-group-select-group
560   "\r" gnus-group-select-group
561   "\M-\r" gnus-group-quick-select-group
562   "\M- " gnus-group-visible-select-group
563   [(meta control return)] gnus-group-select-group-ephemerally
564   "j" gnus-group-jump-to-group
565   "n" gnus-group-next-unread-group
566   "p" gnus-group-prev-unread-group
567   "\177" gnus-group-prev-unread-group
568   [delete] gnus-group-prev-unread-group
569   [backspace] gnus-group-prev-unread-group
570   "N" gnus-group-next-group
571   "P" gnus-group-prev-group
572   "\M-n" gnus-group-next-unread-group-same-level
573   "\M-p" gnus-group-prev-unread-group-same-level
574   "," gnus-group-best-unread-group
575   "." gnus-group-first-unread-group
576   "u" gnus-group-unsubscribe-current-group
577   "U" gnus-group-unsubscribe-group
578   "c" gnus-group-catchup-current
579   "C" gnus-group-catchup-current-all
580   "\M-c" gnus-group-clear-data
581   "l" gnus-group-list-groups
582   "L" gnus-group-list-all-groups
583   "m" gnus-group-mail
584   "i" gnus-group-news
585   "g" gnus-group-get-new-news
586   "\M-g" gnus-group-get-new-news-this-group
587   "R" gnus-group-restart
588   "r" gnus-group-read-init-file
589   "B" gnus-group-browse-foreign-server
590   "b" gnus-group-check-bogus-groups
591   "F" gnus-group-find-new-groups
592   "\C-c\C-d" gnus-group-describe-group
593   "\M-d" gnus-group-describe-all-groups
594   "\C-c\C-a" gnus-group-apropos
595   "\C-c\M-\C-a" gnus-group-description-apropos
596   "a" gnus-group-post-news
597   "\ek" gnus-group-edit-local-kill
598   "\eK" gnus-group-edit-global-kill
599   "\C-k" gnus-group-kill-group
600   "\C-y" gnus-group-yank-group
601   "\C-w" gnus-group-kill-region
602   "\C-x\C-t" gnus-group-transpose-groups
603   "\C-c\C-l" gnus-group-list-killed
604   "\C-c\C-x" gnus-group-expire-articles
605   "\C-c\M-\C-x" gnus-group-expire-all-groups
606   "V" gnus-version
607   "s" gnus-group-save-newsrc
608   "z" gnus-group-suspend
609   "q" gnus-group-exit
610   "Q" gnus-group-quit
611   "?" gnus-group-describe-briefly
612   "\C-c\C-i" gnus-info-find-node
613   "\M-e" gnus-group-edit-group-method
614   "^" gnus-group-enter-server-mode
615   gnus-mouse-2 gnus-mouse-pick-group
616   [follow-link] mouse-face
617   "<" beginning-of-buffer
618   ">" end-of-buffer
619   "\C-c\C-b" gnus-bug
620   "\C-c\C-s" gnus-group-sort-groups
621   "t" gnus-topic-mode
622   "\C-c\M-g" gnus-activate-all-groups
623   "\M-&" gnus-group-universal-argument
624   "#" gnus-group-mark-group
625   "\M-#" gnus-group-unmark-group)
626
627 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
628   "m" gnus-group-mark-group
629   "u" gnus-group-unmark-group
630   "w" gnus-group-mark-region
631   "b" gnus-group-mark-buffer
632   "r" gnus-group-mark-regexp
633   "U" gnus-group-unmark-all-groups)
634
635 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
636   "u" gnus-sieve-update
637   "g" gnus-sieve-generate)
638
639 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
640   "d" gnus-group-make-directory-group
641   "h" gnus-group-make-help-group
642   "u" gnus-group-make-useful-group
643   "a" gnus-group-make-archive-group
644   "k" gnus-group-make-kiboze-group
645   "l" gnus-group-nnimap-edit-acl
646   "m" gnus-group-make-group
647   "E" gnus-group-edit-group
648   "e" gnus-group-edit-group-method
649   "p" gnus-group-edit-group-parameters
650   "v" gnus-group-add-to-virtual
651   "V" gnus-group-make-empty-virtual
652   "D" gnus-group-enter-directory
653   "f" gnus-group-make-doc-group
654   "w" gnus-group-make-web-group
655   "M" gnus-group-read-ephemeral-group
656   "r" gnus-group-rename-group
657   "R" gnus-group-make-rss-group
658   "c" gnus-group-customize
659   "x" gnus-group-nnimap-expunge
660   "\177" gnus-group-delete-group
661   [delete] gnus-group-delete-group)
662
663 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
664   "b" gnus-group-brew-soup
665   "w" gnus-soup-save-areas
666   "s" gnus-soup-send-replies
667   "p" gnus-soup-pack-packet
668   "r" nnsoup-pack-replies)
669
670 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
671   "s" gnus-group-sort-groups
672   "a" gnus-group-sort-groups-by-alphabet
673   "u" gnus-group-sort-groups-by-unread
674   "l" gnus-group-sort-groups-by-level
675   "v" gnus-group-sort-groups-by-score
676   "r" gnus-group-sort-groups-by-rank
677   "m" gnus-group-sort-groups-by-method
678   "n" gnus-group-sort-groups-by-real-name)
679
680 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
681   "s" gnus-group-sort-selected-groups
682   "a" gnus-group-sort-selected-groups-by-alphabet
683   "u" gnus-group-sort-selected-groups-by-unread
684   "l" gnus-group-sort-selected-groups-by-level
685   "v" gnus-group-sort-selected-groups-by-score
686   "r" gnus-group-sort-selected-groups-by-rank
687   "m" gnus-group-sort-selected-groups-by-method
688   "n" gnus-group-sort-selected-groups-by-real-name)
689
690 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
691   "k" gnus-group-list-killed
692   "z" gnus-group-list-zombies
693   "s" gnus-group-list-groups
694   "u" gnus-group-list-all-groups
695   "A" gnus-group-list-active
696   "a" gnus-group-apropos
697   "d" gnus-group-description-apropos
698   "m" gnus-group-list-matching
699   "M" gnus-group-list-all-matching
700   "l" gnus-group-list-level
701   "c" gnus-group-list-cached
702   "?" gnus-group-list-dormant)
703
704 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
705   "k"  gnus-group-list-limit
706   "z"  gnus-group-list-limit
707   "s"  gnus-group-list-limit
708   "u"  gnus-group-list-limit
709   "A"  gnus-group-list-limit
710   "m"  gnus-group-list-limit
711   "M"  gnus-group-list-limit
712   "l"  gnus-group-list-limit
713   "c"  gnus-group-list-limit
714   "?"  gnus-group-list-limit)
715
716 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
717   "k"  gnus-group-list-flush
718   "z"  gnus-group-list-flush
719   "s"  gnus-group-list-flush
720   "u"  gnus-group-list-flush
721   "A"  gnus-group-list-flush
722   "m"  gnus-group-list-flush
723   "M"  gnus-group-list-flush
724   "l"  gnus-group-list-flush
725   "c"  gnus-group-list-flush
726   "?"  gnus-group-list-flush)
727
728 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
729   "k"  gnus-group-list-plus
730   "z"  gnus-group-list-plus
731   "s"  gnus-group-list-plus
732   "u"  gnus-group-list-plus
733   "A"  gnus-group-list-plus
734   "m"  gnus-group-list-plus
735   "M"  gnus-group-list-plus
736   "l"  gnus-group-list-plus
737   "c"  gnus-group-list-plus
738   "?"  gnus-group-list-plus)
739
740 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
741   "f" gnus-score-flush-cache
742   "e" gnus-score-edit-all-score)
743
744 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
745   "c" gnus-group-fetch-charter
746   "C" gnus-group-fetch-control
747   "d" gnus-group-describe-group
748   "f" gnus-group-fetch-faq
749   "v" gnus-version)
750
751 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
752   "l" gnus-group-set-current-level
753   "t" gnus-group-unsubscribe-current-group
754   "s" gnus-group-unsubscribe-group
755   "k" gnus-group-kill-group
756   "y" gnus-group-yank-group
757   "w" gnus-group-kill-region
758   "\C-k" gnus-group-kill-level
759   "z" gnus-group-kill-all-zombies)
760
761 (defun gnus-topic-mode-p ()
762   "Return non-nil in `gnus-topic-mode'."
763   (and (boundp 'gnus-topic-mode)
764        (symbol-value 'gnus-topic-mode)))
765
766 (defun gnus-group-make-menu-bar ()
767   (gnus-turn-off-edit-menu 'group)
768   (unless (boundp 'gnus-group-reading-menu)
769
770     (easy-menu-define
771      gnus-group-reading-menu gnus-group-mode-map ""
772      `("Group"
773        ["Read" gnus-group-read-group
774         :included (not (gnus-topic-mode-p))
775         :active (gnus-group-group-name)]
776        ["Read " gnus-topic-read-group
777         :included (gnus-topic-mode-p)]
778        ["Select" gnus-group-select-group
779         :included (not (gnus-topic-mode-p))
780         :active (gnus-group-group-name)]
781        ["Select " gnus-topic-select-group
782         :included (gnus-topic-mode-p)]
783        ["See old articles" (gnus-group-select-group 'all)
784         :keys "C-u SPC" :active (gnus-group-group-name)]
785        ["Catch up" gnus-group-catchup-current
786         :included (not (gnus-topic-mode-p))
787         :active (gnus-group-group-name)
788         ,@(if (featurep 'xemacs) nil
789             '(:help "Mark unread articles in the current group as read"))]
790        ["Catch up " gnus-topic-catchup-articles
791         :included (gnus-topic-mode-p)
792         ,@(if (featurep 'xemacs) nil
793             '(:help "Mark unread articles in the current group or topic as read"))]
794        ["Catch up all articles" gnus-group-catchup-current-all
795         (gnus-group-group-name)]
796        ["Check for new articles" gnus-group-get-new-news-this-group
797         :included (not (gnus-topic-mode-p))
798         :active (gnus-group-group-name)
799         ,@(if (featurep 'xemacs) nil
800             '(:help "Check for new messages in current group"))]
801        ["Check for new articles " gnus-topic-get-new-news-this-topic
802         :included (gnus-topic-mode-p)
803         ,@(if (featurep 'xemacs) nil
804             '(:help "Check for new messages in current group or topic"))]
805        ["Toggle subscription" gnus-group-unsubscribe-current-group
806         (gnus-group-group-name)]
807        ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
808         ,@(if (featurep 'xemacs) nil
809               '(:help "Kill (remove) current group"))]
810        ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
811        ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
812         ,@(if (featurep 'xemacs) nil
813             '(:help "Display description of the current group"))]
814        ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
815        ["Fetch charter" gnus-group-fetch-charter
816         :active (gnus-group-group-name)
817         ,@(if (featurep 'xemacs) nil
818             '(:help "Display the charter of the current group"))]
819        ["Fetch control message" gnus-group-fetch-control
820         :active (gnus-group-group-name)
821         ,@(if (featurep 'xemacs) nil
822             '(:help "Display the archived control message for the current group"))]
823        ;; Actually one should check, if any of the marked groups gives t for
824        ;; (gnus-check-backend-function 'request-expire-articles ...)
825        ["Expire articles" gnus-group-expire-articles
826         :included (not (gnus-topic-mode-p))
827         :active (or (and (gnus-group-group-name)
828                          (gnus-check-backend-function
829                           'request-expire-articles
830                           (gnus-group-group-name))) gnus-group-marked)]
831        ["Expire articles " gnus-topic-expire-articles
832         :included (gnus-topic-mode-p)]
833        ["Set group level..." gnus-group-set-current-level
834         (gnus-group-group-name)]
835        ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
836        ["Customize" gnus-group-customize (gnus-group-group-name)]
837        ("Edit"
838         ["Parameters" gnus-group-edit-group-parameters
839          :included (not (gnus-topic-mode-p))
840          :active (gnus-group-group-name)]
841         ["Parameters " gnus-topic-edit-parameters
842          :included (gnus-topic-mode-p)]
843         ["Select method" gnus-group-edit-group-method
844          (gnus-group-group-name)]
845         ["Info" gnus-group-edit-group (gnus-group-group-name)]
846         ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
847         ["Global kill file" gnus-group-edit-global-kill t])))
848
849     (easy-menu-define
850      gnus-group-group-menu gnus-group-mode-map ""
851      '("Groups"
852        ("Listing"
853         ["List unread subscribed groups" gnus-group-list-groups t]
854         ["List (un)subscribed groups" gnus-group-list-all-groups t]
855         ["List killed groups" gnus-group-list-killed gnus-killed-list]
856         ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
857         ["List level..." gnus-group-list-level t]
858         ["Describe all groups" gnus-group-describe-all-groups t]
859         ["Group apropos..." gnus-group-apropos t]
860         ["Group and description apropos..." gnus-group-description-apropos t]
861         ["List groups matching..." gnus-group-list-matching t]
862         ["List all groups matching..." gnus-group-list-all-matching t]
863         ["List active file" gnus-group-list-active t]
864         ["List groups with cached" gnus-group-list-cached t]
865         ["List groups with dormant" gnus-group-list-dormant t])
866        ("Sort"
867         ["Default sort" gnus-group-sort-groups t]
868         ["Sort by method" gnus-group-sort-groups-by-method t]
869         ["Sort by rank" gnus-group-sort-groups-by-rank t]
870         ["Sort by score" gnus-group-sort-groups-by-score t]
871         ["Sort by level" gnus-group-sort-groups-by-level t]
872         ["Sort by unread" gnus-group-sort-groups-by-unread t]
873         ["Sort by name" gnus-group-sort-groups-by-alphabet t]
874         ["Sort by real name" gnus-group-sort-groups-by-real-name t])
875        ("Sort process/prefixed"
876         ["Default sort" gnus-group-sort-selected-groups
877          (not (gnus-topic-mode-p))]
878         ["Sort by method" gnus-group-sort-selected-groups-by-method
879          (not (gnus-topic-mode-p))]
880         ["Sort by rank" gnus-group-sort-selected-groups-by-rank
881          (not (gnus-topic-mode-p))]
882         ["Sort by score" gnus-group-sort-selected-groups-by-score
883          (not (gnus-topic-mode-p))]
884         ["Sort by level" gnus-group-sort-selected-groups-by-level
885          (not (gnus-topic-mode-p))]
886         ["Sort by unread" gnus-group-sort-selected-groups-by-unread
887          (not (gnus-topic-mode-p))]
888         ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
889          (not (gnus-topic-mode-p))]
890         ["Sort by real name" gnus-group-sort-selected-groups-by-real-name
891          (not (gnus-topic-mode-p))])
892        ("Mark"
893         ["Mark group" gnus-group-mark-group
894          (and (gnus-group-group-name)
895               (not (memq (gnus-group-group-name) gnus-group-marked)))]
896         ["Unmark group" gnus-group-unmark-group
897          (and (gnus-group-group-name)
898               (memq (gnus-group-group-name) gnus-group-marked))]
899         ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
900         ["Mark regexp..." gnus-group-mark-regexp t]
901         ["Mark region" gnus-group-mark-region :active (gnus-mark-active-p)]
902         ["Mark buffer" gnus-group-mark-buffer t]
903         ["Execute command" gnus-group-universal-argument
904          (or gnus-group-marked (gnus-group-group-name))])
905        ("Subscribe"
906         ["Subscribe to a group..." gnus-group-unsubscribe-group t]
907         ["Kill all newsgroups in region" gnus-group-kill-region
908          :active (gnus-mark-active-p)]
909         ["Kill all zombie groups" gnus-group-kill-all-zombies
910          gnus-zombie-list]
911         ["Kill all groups on level..." gnus-group-kill-level t])
912        ("Foreign groups"
913         ["Make a foreign group..." gnus-group-make-group t]
914         ["Add a directory group..." gnus-group-make-directory-group t]
915         ["Add the help group" gnus-group-make-help-group t]
916         ["Add the archive group" gnus-group-make-archive-group t]
917         ["Make a doc group..." gnus-group-make-doc-group t]
918         ["Make a web group..." gnus-group-make-web-group t]
919         ["Make a kiboze group..." gnus-group-make-kiboze-group t]
920         ["Make a virtual group..." gnus-group-make-empty-virtual t]
921         ["Add a group to a virtual..." gnus-group-add-to-virtual t]
922         ["Make an ephemeral group..." gnus-group-read-ephemeral-group t]
923         ["Make an RSS group..." gnus-group-make-rss-group t]
924         ["Rename group..." gnus-group-rename-group
925          (gnus-check-backend-function
926           'request-rename-group (gnus-group-group-name))]
927         ["Delete group" gnus-group-delete-group
928          (gnus-check-backend-function
929           'request-delete-group (gnus-group-group-name))])
930        ("Move"
931         ["Next" gnus-group-next-group t]
932         ["Previous" gnus-group-prev-group t]
933         ["Next unread" gnus-group-next-unread-group t]
934         ["Previous unread" gnus-group-prev-unread-group t]
935         ["Next unread same level" gnus-group-next-unread-group-same-level t]
936         ["Previous unread same level"
937          gnus-group-prev-unread-group-same-level t]
938         ["Jump to group..." gnus-group-jump-to-group t]
939         ["First unread group" gnus-group-first-unread-group t]
940         ["Best unread group" gnus-group-best-unread-group t])
941        ("Sieve"
942         ["Generate" gnus-sieve-generate t]
943         ["Generate and update" gnus-sieve-update t])
944        ["Delete bogus groups" gnus-group-check-bogus-groups t]
945        ["Find new newsgroups" gnus-group-find-new-groups t]
946        ["Transpose" gnus-group-transpose-groups
947         (gnus-group-group-name)]
948        ["Read a directory as a group..." gnus-group-enter-directory t]))
949
950     (easy-menu-define
951      gnus-group-misc-menu gnus-group-mode-map ""
952      `("Gnus"
953        ("SOUP"
954         ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
955         ["Send replies" gnus-soup-send-replies
956          (fboundp 'gnus-soup-pack-packet)]
957         ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
958         ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
959         ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
960        ["Send a mail" gnus-group-mail t]
961        ["Send a message (mail or news)" gnus-group-post-news t]
962        ["Create a local message" gnus-group-news t]
963        ["Check for new news" gnus-group-get-new-news
964         ,@(if (featurep 'xemacs) '(t)
965             '(:help "Get newly arrived articles"))
966         ]
967        ["Send queued messages" gnus-delay-send-queue
968         ,@(if (featurep 'xemacs) '(t)
969             '(:help "Send all messages that are scheduled to be sent now"))
970         ]
971        ["Activate all groups" gnus-activate-all-groups t]
972        ["Restart Gnus" gnus-group-restart t]
973        ["Read init file" gnus-group-read-init-file t]
974        ["Browse foreign server..." gnus-group-browse-foreign-server t]
975        ["Enter server buffer" gnus-group-enter-server-mode t]
976        ["Expire all expirable articles" gnus-group-expire-all-groups t]
977        ["Generate any kiboze groups" nnkiboze-generate-groups t]
978        ["Gnus version" gnus-version t]
979        ["Save .newsrc files" gnus-group-save-newsrc t]
980        ["Suspend Gnus" gnus-group-suspend t]
981        ["Clear dribble buffer" gnus-group-clear-dribble t]
982        ["Read manual" gnus-info-find-node t]
983        ["Flush score cache" gnus-score-flush-cache t]
984        ["Toggle&