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