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