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.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
31 (defvar tool-bar-map))
46 (let ((features (cons 'gnus-group features)))
48 (unless (boundp 'gnus-cache-active-hashtb)
49 (defvar gnus-cache-active-hashtb nil)))
51 (autoload 'gnus-agent-total-fetched-for "gnus-agent")
52 (autoload 'gnus-cache-total-fetched-for "gnus-cache")
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
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
66 (defcustom gnus-no-groups-message "No Gnus is good news"
67 "*Message displayed by Gnus when no groups are available."
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
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
83 :group 'gnus-group-levels
84 :type '(choice (const nil)
86 (sexp :tag "other" t)))
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
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
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.
105 If nil, no groups are permanently visible."
106 :group 'gnus-group-listing
107 :type '(choice regexp (const nil)))
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
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
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
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'.
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
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)
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))))
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.
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.
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
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
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
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:
219 %S The native news server.
220 %M The native select method.
221 %: \":\" if %S isn't \"\"."
222 :group 'gnus-group-visual
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))
230 (defcustom gnus-group-menu-hook nil
231 "Hook run after the creation of the group mode menu."
232 :group 'gnus-group-various
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")
241 (defcustom gnus-group-update-group-hook nil
242 "Hook called when updating group lines."
243 :group 'gnus-group-visual
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.
254 The only current function implemented is `gnus-group-prepare-flat'."
255 :group 'gnus-group-listing
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
264 (defcustom gnus-suspend-gnus-hook nil
265 "Hook called when suspending (not exiting) Gnus."
269 (defcustom gnus-exit-gnus-hook nil
270 "Hook called when exiting Gnus."
274 (defcustom gnus-after-exiting-gnus-hook nil
275 "Hook called after exiting Gnus."
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.
283 The default function `gnus-group-highlight-line' will
284 highlight the line according to the `gnus-group-highlight'
286 :group 'gnus-group-visual
289 (defcustom gnus-useful-groups
290 '(("(ding) mailing list mirrored at sunsite.auc.dk"
292 (nntp "sunsite.auc.dk"
293 (nntp-address "sunsite.auc.dk")))
296 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
300 (nndoc-article-type mbox)
301 (eval `(nndoc-address
302 ,(let ((file (nnheader-find-etc-directory
305 (error "Couldn't find doc group"))
307 "*Alist of useful group-server pairs."
308 :group 'gnus-group-listing
309 :type '(repeat (list (string :tag "Description")
311 (sexp :tag "Method"))))
313 (defcustom gnus-group-highlight
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)
330 gnus-group-mail-low-face)
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)
359 gnus-group-news-low-face))
360 "*Controls the highlighting of group buffer lines.
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.
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:
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)))
383 (defcustom gnus-new-mail-mark ?%
384 "Mark used for groups with new mail."
385 :group 'gnus-group-visual
388 (defgroup gnus-group-icons nil
389 "Add Icons to your group buffer. "
390 :group 'gnus-group-visual)
392 (defcustom gnus-group-icon-list
394 "*Controls the insertion of icons into group buffer lines.
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
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:
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)))
420 (defcustom gnus-group-name-charset-method-alist nil
421 "Alist of method and the charset for group names.
424 (((nntp \"news.com.cn\") . cn-gb-2312))"
427 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
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))
434 "Alist of group regexp and the charset for group names.
437 ((\"\\.com\\.cn:\" . cn-gb-2312))"
439 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
441 (defcustom gnus-group-jump-to-group-prompt nil
442 "Default prompt for `gnus-group-jump-to-group'.
443 If non-nil, the value should be a string, e.g. \"nnml:\",
444 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
445 in the minibuffer prompt."
446 :group 'gnus-group-various
447 :type '(choice (string :tag "Prompt string")
448 (const :tag "Empty" nil)))
450 (defvar gnus-group-listing-limit 1000
451 "*A limit of the number of groups when listing.
452 If the number of groups is larger than the limit, list them in a
455 ;;; Internal variables
457 (defvar gnus-group-is-exiting-p nil)
458 (defvar gnus-group-is-exiting-without-update-p nil)
459 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
460 "Function for sorting the group buffer.")
462 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
463 "Function for sorting the selected groups in the group buffer.")
465 (defvar gnus-group-indentation-function nil)
466 (defvar gnus-goto-missing-group-function nil)
467 (defvar gnus-group-update-group-function nil)
468 (defvar gnus-group-goto-next-group-function nil
469 "Function to override finding the next group after listing groups.")
471 (defvar gnus-group-edit-buffer nil)
473 (defvar gnus-group-line-format-alist
474 `((?M gnus-tmp-marked-mark ?c)
475 (?S gnus-tmp-subscribed ?c)
476 (?L gnus-tmp-level ?d)
477 (?N (cond ((eq number t) "*" )
481 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
482 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
484 (?R gnus-tmp-number-of-read ?s)
485 (?U (gnus-number-of-unseen-articles-in-group gnus-tmp-group) ?d)
486 (?t gnus-tmp-number-total ?d)
487 (?y gnus-tmp-number-of-unread ?s)
488 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
489 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
490 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
491 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
492 (?g gnus-tmp-group ?s)
493 (?G gnus-tmp-qualified-group ?s)
494 (?c (gnus-short-group-name gnus-tmp-group) ?s)
495 (?C gnus-tmp-comment ?s)
496 (?D gnus-tmp-newsgroup-description ?s)
497 (?o gnus-tmp-moderated ?c)
498 (?O gnus-tmp-moderated-string ?s)
499 (?p gnus-tmp-process-marked ?c)
500 (?s gnus-tmp-news-server ?s)
501 (?n gnus-tmp-news-method ?s)
502 (?P gnus-group-indentation ?s)
503 (?E gnus-tmp-group-icon ?s)
504 (?B gnus-tmp-summary-live ?c)
505 (?z gnus-tmp-news-method-string ?s)
506 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
507 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
508 (?u gnus-tmp-user-defined ?s)
509 (?F (gnus-total-fetched-for gnus-tmp-group) ?s)
512 (defvar gnus-group-mode-line-format-alist
513 `((?S gnus-tmp-news-server ?s)
514 (?M gnus-tmp-news-method ?s)
515 (?u gnus-tmp-user-defined ?s)
516 (?: gnus-tmp-colon ?s)))
518 (defvar gnus-topic-topology nil
519 "The complete topic hierarchy.")
521 (defvar gnus-topic-alist nil
522 "The complete topic-group alist.")
524 (defvar gnus-group-marked nil)
526 (defvar gnus-group-list-mode nil)
529 (defvar gnus-group-icon-cache nil)
531 (defvar gnus-group-listed-groups nil)
532 (defvar gnus-group-list-option nil)
538 (put 'gnus-group-mode 'mode-class 'special)
540 (gnus-define-keys gnus-group-mode-map
541 " " gnus-group-read-group
542 "=" gnus-group-select-group
543 "\r" gnus-group-select-group
544 "\M-\r" gnus-group-quick-select-group
545 "\M- " gnus-group-visible-select-group
546 [(meta control return)] gnus-group-select-group-ephemerally
547 "j" gnus-group-jump-to-group
548 "n" gnus-group-next-unread-group
549 "p" gnus-group-prev-unread-group
550 "\177" gnus-group-prev-unread-group
551 [delete] gnus-group-prev-unread-group
552 [backspace] gnus-group-prev-unread-group
553 "N" gnus-group-next-group
554 "P" gnus-group-prev-group
555 "\M-n" gnus-group-next-unread-group-same-level
556 "\M-p" gnus-group-prev-unread-group-same-level
557 "," gnus-group-best-unread-group
558 "." gnus-group-first-unread-group
559 "u" gnus-group-unsubscribe-current-group
560 "U" gnus-group-unsubscribe-group
561 "c" gnus-group-catchup-current
562 "C" gnus-group-catchup-current-all
563 "\M-c" gnus-group-clear-data
564 "l" gnus-group-list-groups
565 "L" gnus-group-list-all-groups
568 "g" gnus-group-get-new-news
569 "\M-g" gnus-group-get-new-news-this-group
570 "R" gnus-group-restart
571 "r" gnus-group-read-init-file
572 "B" gnus-group-browse-foreign-server
573 "b" gnus-group-check-bogus-groups
574 "F" gnus-group-find-new-groups
575 "\C-c\C-d" gnus-group-describe-group
576 "\M-d" gnus-group-describe-all-groups
577 "\C-c\C-a" gnus-group-apropos
578 "\C-c\M-\C-a" gnus-group-description-apropos
579 "a" gnus-group-post-news
580 "\ek" gnus-group-edit-local-kill
581 "\eK" gnus-group-edit-global-kill
582 "\C-k" gnus-group-kill-group
583 "\C-y" gnus-group-yank-group
584 "\C-w" gnus-group-kill-region
585 "\C-x\C-t" gnus-group-transpose-groups
586 "\C-c\C-l" gnus-group-list-killed
587 "\C-c\C-x" gnus-group-expire-articles
588 "\C-c\M-\C-x" gnus-group-expire-all-groups
590 "s" gnus-group-save-newsrc
591 "z" gnus-group-suspend
594 "?" gnus-group-describe-briefly
595 "\C-c\C-i" gnus-info-find-node
596 "\M-e" gnus-group-edit-group-method
597 "^" gnus-group-enter-server-mode
598 gnus-mouse-2 gnus-mouse-pick-group
599 "<" beginning-of-buffer
602 "\C-c\C-s" gnus-group-sort-groups
604 "\C-c\M-g" gnus-activate-all-groups
605 "\M-&" gnus-group-universal-argument
606 "#" gnus-group-mark-group
607 "\M-#" gnus-group-unmark-group)
609 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
610 "m" gnus-group-mark-group
611 "u" gnus-group-unmark-group
612 "w" gnus-group-mark-region
613 "b" gnus-group-mark-buffer
614 "r" gnus-group-mark-regexp
615 "U" gnus-group-unmark-all-groups)
617 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
618 "u" gnus-sieve-update
619 "g" gnus-sieve-generate)
621 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
622 "d" gnus-group-make-directory-group
623 "h" gnus-group-make-help-group
624 "u" gnus-group-make-useful-group
625 "a" gnus-group-make-archive-group
626 "k" gnus-group-make-kiboze-group
627 "l" gnus-group-nnimap-edit-acl
628 "m" gnus-group-make-group
629 "E" gnus-group-edit-group
630 "e" gnus-group-edit-group-method
631 "p" gnus-group-edit-group-parameters
632 "v" gnus-group-add-to-virtual
633 "V" gnus-group-make-empty-virtual
634 "D" gnus-group-enter-directory
635 "f" gnus-group-make-doc-group
636 "w" gnus-group-make-web-group
637 "M" gnus-group-read-ephemeral-group
638 "r" gnus-group-rename-group
639 "R" gnus-group-make-rss-group
640 "c" gnus-group-customize
641 "x" gnus-group-nnimap-expunge
642 "\177" gnus-group-delete-group
643 [delete] gnus-group-delete-group)
645 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
646 "b" gnus-group-brew-soup
647 "w" gnus-soup-save-areas
648 "s" gnus-soup-send-replies
649 "p" gnus-soup-pack-packet
650 "r" nnsoup-pack-replies)
652 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
653 "s" gnus-group-sort-groups
654 "a" gnus-group-sort-groups-by-alphabet
655 "u" gnus-group-sort-groups-by-unread
656 "l" gnus-group-sort-groups-by-level
657 "v" gnus-group-sort-groups-by-score
658 "r" gnus-group-sort-groups-by-rank
659 "m" gnus-group-sort-groups-by-method
660 "n" gnus-group-sort-groups-by-real-name)
662 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
663 "s" gnus-group-sort-selected-groups
664 "a" gnus-group-sort-selected-groups-by-alphabet
665 "u" gnus-group-sort-selected-groups-by-unread
666 "l" gnus-group-sort-selected-groups-by-level
667 "v" gnus-group-sort-selected-groups-by-score
668 "r" gnus-group-sort-selected-groups-by-rank
669 "m" gnus-group-sort-selected-groups-by-method
670 "n" gnus-group-sort-selected-groups-by-real-name)
672 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
673 "k" gnus-group-list-killed
674 "z" gnus-group-list-zombies
675 "s" gnus-group-list-groups
676 "u" gnus-group-list-all-groups
677 "A" gnus-group-list-active
678 "a" gnus-group-apropos
679 "d" gnus-group-description-apropos
680 "m" gnus-group-list-matching
681 "M" gnus-group-list-all-matching
682 "l" gnus-group-list-level
683 "c" gnus-group-list-cached
684 "?" gnus-group-list-dormant)
686 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
687 "k" gnus-group-list-limit
688 "z" gnus-group-list-limit
689 "s" gnus-group-list-limit
690 "u" gnus-group-list-limit
691 "A" gnus-group-list-limit
692 "m" gnus-group-list-limit
693 "M" gnus-group-list-limit
694 "l" gnus-group-list-limit
695 "c" gnus-group-list-limit
696 "?" gnus-group-list-limit)
698 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
699 "k" gnus-group-list-flush
700 "z" gnus-group-list-flush
701 "s" gnus-group-list-flush
702 "u" gnus-group-list-flush
703 "A" gnus-group-list-flush
704 "m" gnus-group-list-flush
705 "M" gnus-group-list-flush
706 "l" gnus-group-list-flush
707 "c" gnus-group-list-flush
708 "?" gnus-group-list-flush)
710 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
711 "k" gnus-group-list-plus
712 "z" gnus-group-list-plus
713 "s" gnus-group-list-plus
714 "u" gnus-group-list-plus
715 "A" gnus-group-list-plus
716 "m" gnus-group-list-plus
717 "M" gnus-group-list-plus
718 "l" gnus-group-list-plus
719 "c" gnus-group-list-plus
720 "?" gnus-group-list-plus)
722 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
723 "f" gnus-score-flush-cache
724 "e" gnus-score-edit-all-score)
726 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
727 "c" gnus-group-fetch-charter
728 "C" gnus-group-fetch-control
729 "d" gnus-group-describe-group
730 "f" gnus-group-fetch-faq
733 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
734 "l" gnus-group-set-current-level
735 "t" gnus-group-unsubscribe-current-group
736 "s" gnus-group-unsubscribe-group
737 "k" gnus-group-kill-group
738 "y" gnus-group-yank-group
739 "w" gnus-group-kill-region
740 "\C-k" gnus-group-kill-level
741 "z" gnus-group-kill-all-zombies)
743 (defun gnus-topic-mode-p ()
744 "Return non-nil in `gnus-topic-mode'."
745 (and (boundp 'gnus-topic-mode)
746 (symbol-value 'gnus-topic-mode)))
748 (defun gnus-group-make-menu-bar ()
749 (gnus-turn-off-edit-menu 'group)
750 (unless (boundp 'gnus-group-reading-menu)
753 gnus-group-reading-menu gnus-group-mode-map ""
755 ["Read" gnus-group-read-group
756 :included (not (gnus-topic-mode-p))
757 :active (gnus-group-group-name)]
758 ["Read " gnus-topic-read-group
759 :included (gnus-topic-mode-p)]
760 ["Select" gnus-group-select-group
761 :included (not (gnus-topic-mode-p))
762 :active (gnus-group-group-name)]
763 ["Select " gnus-topic-select-group
764 :included (gnus-topic-mode-p)]
765 ["See old articles" (gnus-group-select-group 'all)
766 :keys "C-u SPC" :active (gnus-group-group-name)]
767 ["Catch up" gnus-group-catchup-current
768 :included (not (gnus-topic-mode-p))
769 :active (gnus-group-group-name)
770 ,@(if (featurep 'xemacs) nil
771 '(:help "Mark unread articles in the current group as read"))]
772 ["Catch up " gnus-topic-catchup-articles
773 :included (gnus-topic-mode-p)
774 ,@(if (featurep 'xemacs) nil
775 '(:help "Mark unread articles in the current group or topic as read"))]
776 ["Catch up all articles" gnus-group-catchup-current-all
777 (gnus-group-group-name)]
778 ["Check for new articles" gnus-group-get-new-news-this-group
779 :included (not (gnus-topic-mode-p))
780 :active (gnus-group-group-name)
781 ,@(if (featurep 'xemacs) nil
782 '(:help "Check for new messages in current group"))]
783 ["Check for new articles " gnus-topic-get-new-news-this-topic
784 :included (gnus-topic-mode-p)
785 ,@(if (featurep 'xemacs) nil
786 '(:help "Check for new messages in current group or topic"))]
787 ["Toggle subscription" gnus-group-unsubscribe-current-group
788 (gnus-group-group-name)]
789 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
790 ,@(if (featurep 'xemacs) nil
791 '(:help "Kill (remove) current group"))]
792 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
793 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
794 ,@(if (featurep 'xemacs) nil
795 '(:help "Display description of the current group"))]
796 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
797 ["Fetch charter" gnus-group-fetch-charter
798 :active (gnus-group-group-name)
799 ,@(if (featurep 'xemacs) nil
800 '(:help "Display the charter of the current group"))]
801 ["Fetch control message" gnus-group-fetch-control
802 :active (gnus-group-group-name)
803 ,@(if (featurep 'xemacs) nil
804 '(:help "Display the archived control message for the current group"))]
805 ;; Actually one should check, if any of the marked groups gives t for
806 ;; (gnus-check-backend-function 'request-expire-articles ...)
807 ["Expire articles" gnus-group-expire-articles
808 :included (not (gnus-topic-mode-p))
809 :active (or (and (gnus-group-group-name)
810 (gnus-check-backend-function
811 'request-expire-articles
812 (gnus-group-group-name))) gnus-group-marked)]
813 ["Expire articles " gnus-topic-expire-articles
814 :included (gnus-topic-mode-p)]
815 ["Set group level..." gnus-group-set-current-level
816 (gnus-group-group-name)]
817 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
818 ["Customize" gnus-group-customize (gnus-group-group-name)]
820 ["Parameters" gnus-group-edit-group-parameters
821 :included (not (gnus-topic-mode-p))
822 :active (gnus-group-group-name)]
823 ["Parameters " gnus-topic-edit-parameters
824 :included (gnus-topic-mode-p)]
825 ["Select method" gnus-group-edit-group-method
826 (gnus-group-group-name)]
827 ["Info" gnus-group-edit-group (gnus-group-group-name)]
828 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
829 ["Global kill file" gnus-group-edit-global-kill t])))
832 gnus-group-group-menu gnus-group-mode-map ""
835 ["List unread subscribed groups" gnus-group-list-groups t]
836 ["List (un)subscribed groups" gnus-group-list-all-groups t]
837 ["List killed groups" gnus-group-list-killed gnus-killed-list]
838 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
839 ["List level..." gnus-group-list-level t]
840 ["Describe all groups" gnus-group-describe-all-groups t]
841 ["Group apropos..." gnus-group-apropos t]
842 ["Group and description apropos..." gnus-group-description-apropos t]
843 ["List groups matching..." gnus-group-list-matching t]
844 ["List all groups matching..." gnus-group-list-all-matching t]
845 ["List active file" gnus-group-list-active t]
846 ["List groups with cached" gnus-group-list-cached t]
847 ["List groups with dormant" gnus-group-list-dormant t])
849 ["Default sort" gnus-group-sort-groups t]
850 ["Sort by method" gnus-group-sort-groups-by-method t]
851 ["Sort by rank" gnus-group-sort-groups-by-rank t]
852 ["Sort by score" gnus-group-sort-groups-by-score t]
853 ["Sort by level" gnus-group-sort-groups-by-level t]
854 ["Sort by unread" gnus-group-sort-groups-by-unread t]
855 ["Sort by name" gnus-group-sort-groups-by-alphabet t]
856 ["Sort by real name" gnus-group-sort-groups-by-real-name t])
857 ("Sort process/prefixed"
858 ["Default sort" gnus-group-sort-selected-groups
859 (not (gnus-topic-mode-p))]
860 ["Sort by method" gnus-group-sort-selected-groups-by-method
861 (not (gnus-topic-mode-p))]
862 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
863 (not (gnus-topic-mode-p))]
864 ["Sort by score" gnus-group-sort-selected-groups-by-score
865 (not (gnus-topic-mode-p))]
866 ["Sort by level" gnus-group-sort-selected-groups-by-level
867 (not (gnus-topic-mode-p))]
868 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
869 (not (gnus-topic-mode-p))]
870 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
871 (not (gnus-topic-mode-p))]
872 ["Sort by real name" gnus-group-sort-selected-groups-by-real-name
873 (not (gnus-topic-mode-p))])
875 ["Mark group" gnus-group-mark-group
876 (and (gnus-group-group-name)
877 (not (memq (gnus-group-group-name) gnus-group-marked)))]
878 ["Unmark group" gnus-group-unmark-group
879 (and (gnus-group-group-name)
880 (memq (gnus-group-group-name) gnus-group-marked))]
881 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
882 ["Mark regexp..." gnus-group-mark-regexp t]
883 ["Mark region" gnus-group-mark-region :active (gnus-mark-active-p)]
884 ["Mark buffer" gnus-group-mark-buffer t]
885 ["Execute command" gnus-group-universal-argument
886 (or gnus-group-marked (gnus-group-group-name))])
888 ["Subscribe to a group..." gnus-group-unsubscribe-group t]
889 ["Kill all newsgroups in region" gnus-group-kill-region
890 :active (gnus-mark-active-p)]
891 ["Kill all zombie groups" gnus-group-kill-all-zombies
893 ["Kill all groups on level..." gnus-group-kill-level t])
895 ["Make a foreign group..." gnus-group-make-group t]
896 ["Add a directory group..." gnus-group-make-directory-group t]
897 ["Add the help group" gnus-group-make-help-group t]
898 ["Add the archive group" gnus-group-make-archive-group t]
899 ["Make a doc group..." gnus-group-make-doc-group t]
900 ["Make a web group..." gnus-group-make-web-group t]
901 ["Make a kiboze group..." gnus-group-make-kiboze-group t]
902 ["Make a virtual group..." gnus-group-make-empty-virtual t]
903 ["Add a group to a virtual..." gnus-group-add-to-virtual t]
904 ["Make an ephemeral group..." gnus-group-read-ephemeral-group t]
905 ["Make an RSS group..." gnus-group-make-rss-group t]
906 ["Rename group..." gnus-group-rename-group
907 (gnus-check-backend-function
908 'request-rename-group (gnus-group-group-name))]
909 ["Delete group" gnus-group-delete-group
910 (gnus-check-backend-function
911 'request-delete-group (gnus-group-group-name))])
913 ["Next" gnus-group-next-group t]
914 ["Previous" gnus-group-prev-group t]
915 ["Next unread" gnus-group-next-unread-group t]
916 ["Previous unread" gnus-group-prev-unread-group t]
917 ["Next unread same level" gnus-group-next-unread-group-same-level t]
918 ["Previous unread same level"
919 gnus-group-prev-unread-group-same-level t]
920 ["Jump to group..." gnus-group-jump-to-group t]
921 ["First unread group" gnus-group-first-unread-group t]
922 ["Best unread group" gnus-group-best-unread-group t])
924 ["Generate" gnus-sieve-generate t]
925 ["Generate and update" gnus-sieve-update t])
926 ["Delete bogus groups" gnus-group-check-bogus-groups t]
927 ["Find new newsgroups" gnus-group-find-new-groups t]
928 ["Transpose" gnus-group-transpose-groups
929 (gnus-group-group-name)]
930 ["Read a directory as a group..." gnus-group-enter-directory t]))
933 gnus-group-misc-menu gnus-group-mode-map ""
936 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
937 ["Send replies" gnus-soup-send-replies
938 (fboundp 'gnus-soup-pack-packet)]
939 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
940 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
941 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
942 ["Send a mail" gnus-group-mail t]
943 ["Send a message (mail or news)" gnus-group-post-news t]
944 ["Create a local message" gnus-group-news t]
945 ["Check for new news" gnus-group-get-new-news
946 ,@(if (featurep 'xemacs) '(t)
947 '(:help "Get newly arrived articles"))
949 ["Send queued messages" gnus-delay-send-queue
950 ,@(if (featurep 'xemacs) '(t)
951 '(:help "Send all messages that are scheduled to be sent now"))
953 ["Activate all groups" gnus-activate-all-groups t]
954 ["Restart Gnus" gnus-group-restart t]
955 ["Read init file" gnus-group-read-init-file t]
956 ["Browse foreign server..." gnus-group-browse-foreign-server t]
957 ["Enter server buffer" gnus-group-enter-server-mode t]
958 ["Expire all expirable articles" gnus-group-expire-all-groups t]
959 ["Generate any kiboze groups" nnkiboze-generate-groups t]
960 ["Gnus version" gnus-version t]
961 ["Save .newsrc files" gnus-group-save-newsrc t]
962 ["Suspend Gnus" gnus-group-suspend t]
963 ["Clear dribble buffer" gnus-group-clear-dribble t]
964 ["Read manual" gnus-info-find-node t]
965 ["Flush score cache" gnus-score-flush-cache t]
966 ["Toggle topics" gnus-topic-mode t]
967 ["Send a bug report" gnus-bug t]
968 ["Exit from Gnus" gnus-group-exit
969 ,@(if (featurep 'xemacs) '(t)
970 '(:help "Quit reading news"))]
971 ["Exit without saving" gnus-group-quit t]))
973 (gnus-run-hooks 'gnus-group-menu-hook)))
975 (defvar gnus-group-toolbar-map nil)
977 ;; Emacs 21 tool bar. Should be no-op otherwise.
978 (defun gnus-group-make-tool-bar ()
980 (condition-case nil (require 'tool-bar) (error nil))
981 (fboundp 'tool-bar-add-item-from-menu)
982 (default-value 'tool-bar-mode)
983 (not gnus-group-toolbar-map))
984 (setq gnus-group-toolbar-map
985 (let ((tool-bar-map (make-sparse-keymap))
986 (load-path (mm-image-load-path)))
987 (tool-bar-add-item-from-menu
988 'gnus-group-get-new-news "get-news" gnus-group-mode-map)
989 (tool-bar-add-item-from-menu
990 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map)
991 (tool-bar-add-item-from-menu
992 'gnus-group-catchup-current "catchup" gnus-group-mode-map)
993 (tool-bar-add-item-from-menu
994 'gnus-group-describe-group "describe-group" gnus-group-mode-map)
995 (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe
996 :help "Subscribe to the current group")
997 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
999 :help "Unsubscribe from the current group")
1000 (tool-bar-add-item-from-menu
1001 'gnus-group-exit "exit-gnus" gnus-group-mode-map)
1003 (if gnus-group-toolbar-map
1004 (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map)))
1006 (defun gnus-group-mode ()
1007 "Major mode for reading news.
1009 All normal editing commands are switched off.
1010 \\<gnus-group-mode-map>
1011 The group buffer lists (some of) the groups available. For instance,
1012 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
1013 lists all zombie groups.
1015 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
1016 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
1018 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
1020 The following commands are available:
1022 \\{gnus-group-mode-map}"
1024 (kill-all-local-variables)
1025 (when (gnus-visual-p 'group-menu 'menu)
1026 (gnus-group-make-menu-bar)
1027 (gnus-group-make-tool-bar))
1028 (gnus-simplify-mode-line)
1029 (setq major-mode 'gnus-group-mode)
1030 (setq mode-name "Group")
1031 (gnus-group-set-mode-line)
1032 (setq mode-line-process nil)
1033 (use-local-map gnus-group-mode-map)
1034 (buffer-disable-undo)
1035 (setq truncate-lines t)
1036 (setq buffer-read-only t)
1037 (gnus-set-default-directory)
1038 (gnus-update-format-specifications nil 'group 'group-mode)
1039 (gnus-update-group-mark-positions)
1044 (gnus-run-hooks 'gnus-group-mode-hook))
1046 (defun gnus-update-group-mark-positions ()
1048 (let ((gnus-process-mark ?\200)
1049 (gnus-group-update-hook nil)
1050 (gnus-group-marked '("dummy.group"))
1051 (gnus-active-hashtb (make-vector 10 0))
1053 (gnus-set-active "dummy.group" '(0 . 0))
1054 (gnus-set-work-buffer)
1055 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
1056 (goto-char (point-min))
1057 (setq gnus-group-mark-positions
1058 (list (cons 'process (and (search-forward "\200" nil t)
1059 (- (point) 2))))))))
1061 (defun gnus-mouse-pick-group (e)
1062 "Enter the group under the mouse pointer."
1065 (gnus-group-read-group nil))
1067 ;; Look at LEVEL and find out what the level is really supposed to be.
1068 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
1069 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
1070 (defun gnus-group-default-level (&optional level number-or-nil)
1072 (gnus-group-use-permanent-levels
1073 (or (setq gnus-group-use-permanent-levels
1074 (or level (if (numberp gnus-group-use-permanent-levels)
1075 gnus-group-use-permanent-levels
1076 (or gnus-group-default-list-level
1077 gnus-level-subscribed))))
1078 gnus-group-default-list-level gnus-level-subscribed))
1082 (or level gnus-group-default-list-level gnus-level-subscribed))))
1084 (defun gnus-group-setup-buffer ()
1085 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1086 (unless (eq major-mode 'gnus-group-mode)
1089 (gnus-carpal-setup-buffer 'group))))
1091 (defun gnus-group-name-charset (method group)
1093 (setq method (gnus-find-method-for-group group)))
1094 (let ((item (assoc method gnus-group-name-charset-method-alist))
1095 (alist gnus-group-name-charset-group-alist)
1099 (while (setq item (pop alist))
1100 (if (string-match (car item) group)
1102 result (cdr item))))