1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
37 (defgroup gnus-group nil
41 (defcustom gnus-group-archive-directory
42 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
43 "*The address of the (ding) archives."
47 (defcustom gnus-group-recent-archive-directory
48 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
49 "*The address of the most recent (ding) articles."
53 ;; Suggested by Andrew Eskilsson <pi92ae@lelle.pt.hk-r.se>.
54 (defcustom gnus-no-groups-message "No news is horrible news"
55 "*Message displayed by Gnus when no groups are available."
59 (defcustom gnus-keep-same-level nil
60 "*Non-nil means that the next newsgroup after the current will be on the same level.
61 When you type, for instance, `n' after reading the last article in the
62 current newsgroup, you will go to the next newsgroup. If this variable
63 is nil, the next newsgroup will be the next from the group
65 If this variable is non-nil, Gnus will either put you in the
66 next newsgroup with the same level, or, if no such newsgroup is
67 available, the next newsgroup with the lowest possible level higher
68 than the current level.
69 If this variable is `best', Gnus will make the next newsgroup the one
72 :type '(choice (const nil)
74 (sexp :tag "other" t)))
76 (defcustom gnus-group-goto-unread t
77 "*If non-nil, movement commands will go to the next unread and subscribed group."
81 (defcustom gnus-goto-next-group-when-activating t
82 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
86 (defcustom gnus-permanently-visible-groups nil
87 "*Regexp to match groups that should always be listed in the group buffer.
88 This means that they will still be listed when there are no unread
89 articles in the groups."
93 (defcustom gnus-list-groups-with-ticked-articles t
94 "*If non-nil, list groups that have only ticked articles.
95 If nil, only list groups that have unread articles."
99 (defcustom gnus-group-default-list-level gnus-level-subscribed
100 "*Default listing level.
101 Ignored if `gnus-group-use-permanent-levels' is non-nil."
105 (defcustom gnus-group-list-inactive-groups t
106 "*If non-nil, inactive groups will be listed."
110 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
111 "*Function used for sorting the group buffer.
112 This function will be called with group info entries as the arguments
113 for the groups to be sorted. Pre-made functions include
114 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
115 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
116 `gnus-group-sort-by-score', `gnus-group-sort-by-method', and
117 `gnus-group-sort-by-rank'.
119 This variable can also be a list of sorting functions. In that case,
120 the most significant sort function should be the last function in the
123 :type '(radio (function-item gnus-group-sort-by-alphabet)
124 (function-item gnus-group-sort-by-real-name)
125 (function-item gnus-group-sort-by-unread)
126 (function-item gnus-group-sort-by-level)
127 (function-item gnus-group-sort-by-score)
128 (function-item gnus-group-sort-by-method)
129 (function-item gnus-group-sort-by-rank)
130 (function :tag "other" nil)))
132 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y: %(%g%)%l\n"
133 "*Format of group lines.
134 It works along the same lines as a normal formatting string,
135 with some simple extensions.
137 %M Only marked articles (character, \"*\" or \" \")
138 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
139 %L Level of subscribedness (integer)
140 %N Number of unread articles (integer)
141 %I Number of dormant articles (integer)
142 %i Number of ticked and dormant (integer)
143 %T Number of ticked articles (integer)
144 %R Number of read articles (integer)
145 %t Estimated total number of articles (integer)
146 %y Number of unread, unticked articles (integer)
147 %G Group name (string)
148 %g Qualified group name (string)
149 %D Group description (string)
150 %s Select method (string)
151 %o Moderated group (char, \"m\")
152 %p Process mark (char)
153 %O Moderated group (string, \"(m)\" or \"\")
154 %P Topic indentation (string)
155 %m Whether there is new(ish) mail in the group (char, \"%\")
156 %l Whether there are GroupLens predictions for this group (string)
157 %n Select from where (string)
158 %z A string that look like `<%s:%n>' if a foreign select method is used
159 ?d The date the group was last entered.
160 %u User defined specifier. The next character in the format string should
161 be a letter. Gnus will call the function gnus-user-format-function-X,
162 where X is the letter following %u. The function will be passed the
163 current header as argument. The function should return a string, which
164 will be inserted into the buffer just like information from any other
167 Text between %( and %) will be highlighted with `gnus-mouse-face' when
168 the mouse point move inside the area. There can only be one such area.
170 Note that this format specification is not always respected. For
171 reasons of efficiency, when listing killed groups, this specification
172 is ignored altogether. If the spec is changed considerably, your
173 output may end up looking strange when listing both alive and killed
176 If you use %o or %O, reading the active file will be slower and quite
177 a bit of extra memory will be used. %D will also worsen performance.
178 Also note that if you change the format specification to include any
179 of these specs, you must probably re-start Gnus to see them go into
184 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
185 "*The format specification for the group mode line.
186 It works along the same lines as a normal formatting string,
187 with some simple extensions:
189 %S The native news server.
190 %M The native select method.
191 %: \":\" if %S isn't \"\"."
195 (defcustom gnus-group-mode-hook nil
196 "Hook for Gnus group mode."
200 (defcustom gnus-group-menu-hook nil
201 "Hook run after the creation of the group mode menu."
205 (defcustom gnus-group-catchup-group-hook nil
206 "Hook run when catching up a group from the group buffer."
210 (defcustom gnus-group-update-group-hook nil
211 "Hook called when updating group lines."
215 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
216 "*A function that is called to generate the group buffer.
217 The function is called with three arguments: The first is a number;
218 all group with a level less or equal to that number should be listed,
219 if the second is non-nil, empty groups should also be displayed. If
220 the third is non-nil, it is a number. No groups with a level lower
221 than this number should be displayed.
223 The only current function implemented is `gnus-group-prepare-flat'."
227 (defcustom gnus-group-prepare-hook nil
228 "Hook called after the group buffer has been generated.
229 If you want to modify the group buffer, you can use this hook."
233 (defcustom gnus-suspend-gnus-hook nil
234 "Hook called when suspending (not exiting) Gnus."
238 (defcustom gnus-exit-gnus-hook nil
239 "Hook called when exiting Gnus."
243 (defcustom gnus-after-exiting-gnus-hook nil
244 "Hook called after exiting Gnus."
248 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
249 "Hook called when a group line is changed.
250 The hook will not be called if `gnus-visual' is nil.
252 The default function `gnus-group-highlight-line' will
253 highlight the line according to the `gnus-group-highlight'
258 (defcustom gnus-useful-groups
259 `(("(ding) mailing list mirrored at sunsite.auc.dk"
261 (nntp "sunsite.auc.dk"
262 (nntp-address "sunsite.auc.dk")))
266 (nndoc-article-type mbox)
267 (eval `(nndoc-address
268 ,(let ((file (nnheader-find-etc-directory
271 (error "Couldn't find doc group"))
273 "Alist of useful group-server pairs."
275 :type '(repeat (list (string :tag "Description")
277 (sexp :tag "Method"))))
279 (defface gnus-group-news-1-face
282 (:foreground "PaleTurquoise" :bold t))
285 (:foreground "ForestGreen" :bold t))
288 "Level 1 newsgroup face.")
290 (defface gnus-group-news-1-empty-face
293 (:foreground "PaleTurquoise"))
296 (:foreground "ForestGreen"))
299 "Level 1 empty newsgroup face.")
301 (defface gnus-group-news-2-face
304 (:foreground "turquoise" :bold t))
307 (:foreground "CadetBlue4" :bold t))
310 "Level 2 newsgroup face.")
312 (defface gnus-group-news-2-empty-face
315 (:foreground "turquoise"))
318 (:foreground "CadetBlue4"))
321 "Level 2 empty newsgroup face.")
323 (defface gnus-group-news-3-face
332 "Level 3 newsgroup face.")
334 (defface gnus-group-news-3-empty-face
343 "Level 3 empty newsgroup face.")
345 (defface gnus-group-news-low-face
348 (:foreground "DarkTurquoise" :bold t))
351 (:foreground "DarkGreen" :bold t))
354 "Low level newsgroup face.")
356 (defface gnus-group-news-low-empty-face
359 (:foreground "DarkTurquoise"))
362 (:foreground "DarkGreen"))
365 "Low level empty newsgroup face.")
367 (defface gnus-group-mail-1-face
370 (:foreground "aquamarine1" :bold t))
373 (:foreground "DeepPink3" :bold t))
376 "Level 1 mailgroup face.")
378 (defface gnus-group-mail-1-empty-face
381 (:foreground "aquamarine1"))
384 (:foreground "DeepPink3"))
386 (:italic t :bold t)))
387 "Level 1 empty mailgroup face.")
389 (defface gnus-group-mail-2-face
392 (:foreground "aquamarine2" :bold t))
395 (:foreground "HotPink3" :bold t))
398 "Level 2 mailgroup face.")
400 (defface gnus-group-mail-2-empty-face
403 (:foreground "aquamarine2"))
406 (:foreground "HotPink3"))
409 "Level 2 empty mailgroup face.")
411 (defface gnus-group-mail-3-face
414 (:foreground "aquamarine3" :bold t))
417 (:foreground "magenta4" :bold t))
420 "Level 3 mailgroup face.")
422 (defface gnus-group-mail-3-empty-face
425 (:foreground "aquamarine3"))
428 (:foreground "magenta4"))
431 "Level 3 empty mailgroup face.")
433 (defface gnus-group-mail-low-face
436 (:foreground "aquamarine4" :bold t))
439 (:foreground "DeepPink4" :bold t))
442 "Low level mailgroup face.")
444 (defface gnus-group-mail-low-empty-face
447 (:foreground "aquamarine4"))
450 (:foreground "DeepPink4"))
453 "Low level empty mailgroup face.")
455 (defcustom gnus-group-highlight
457 ((and (= unread 0) (not mailp) (eq level 1)) .
458 gnus-group-news-1-empty-face)
459 ((and (not mailp) (eq level 1)) .
460 gnus-group-news-1-face)
461 ((and (= unread 0) (not mailp) (eq level 2)) .
462 gnus-group-news-2-empty-face)
463 ((and (not mailp) (eq level 2)) .
464 gnus-group-news-2-face)
465 ((and (= unread 0) (not mailp) (eq level 3)) .
466 gnus-group-news-3-empty-face)
467 ((and (not mailp) (eq level 3)) .
468 gnus-group-news-3-face)
469 ((and (= unread 0) (not mailp)) .
470 gnus-group-news-low-empty-face)
472 gnus-group-news-low-face)
474 ((and (= unread 0) (eq level 1)) .
475 gnus-group-mail-1-empty-face)
477 gnus-group-mail-1-face)
478 ((and (= unread 0) (eq level 2)) .
479 gnus-group-mail-2-empty-face)
481 gnus-group-mail-2-face)
482 ((and (= unread 0) (eq level 3)) .
483 gnus-group-mail-3-empty-face)
485 gnus-group-mail-3-face)
487 gnus-group-mail-low-empty-face)
489 gnus-group-mail-low-face))
490 "Controls the highlighting of group buffer lines.
492 Below is a list of `Form'/`Face' pairs. When deciding how a a
493 particular group line should be displayed, each form is
494 evaluated. The content of the face field after the first true form is
495 used. You can change how those group lines are displayed by
496 editing the face field.
498 It is also possible to change and add form fields, but currently that
499 requires an understanding of Lisp expressions. Hopefully this will
500 change in a future release. For now, you can use the following
501 variables in the Lisp expression:
503 group: The name of the group.
504 unread: The number of unread articles in the group.
505 method: The select method used.
506 mailp: Whether it's a mail group or not.
507 level: The level of the group.
508 score: The score of the group.
509 ticked: The number of ticked articles."
511 :type '(repeat (cons (sexp :tag "Form") face)))
513 (defcustom gnus-new-mail-mark ?%
514 "Mark used for groups with new mail."
518 ;;; Internal variables
520 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
521 "Function for sorting the group buffer.")
523 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
524 "Function for sorting the selected groups in the group buffer.")
526 (defvar gnus-group-indentation-function nil)
527 (defvar gnus-goto-missing-group-function nil)
528 (defvar gnus-group-update-group-function nil)
529 (defvar gnus-group-goto-next-group-function nil
530 "Function to override finding the next group after listing groups.")
532 (defvar gnus-group-edit-buffer nil)
534 (defvar gnus-group-line-format-alist
535 `((?M gnus-tmp-marked-mark ?c)
536 (?S gnus-tmp-subscribed ?c)
537 (?L gnus-tmp-level ?d)
538 (?N (cond ((eq number t) "*" )
542 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
543 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
545 (?R gnus-tmp-number-of-read ?s)
546 (?t gnus-tmp-number-total ?d)
547 (?y gnus-tmp-number-of-unread ?s)
548 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
549 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
550 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
551 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
552 (?g gnus-tmp-group ?s)
553 (?G gnus-tmp-qualified-group ?s)
554 (?c (gnus-short-group-name gnus-tmp-group) ?s)
555 (?D gnus-tmp-newsgroup-description ?s)
556 (?o gnus-tmp-moderated ?c)
557 (?O gnus-tmp-moderated-string ?s)
558 (?p gnus-tmp-process-marked ?c)
559 (?s gnus-tmp-news-server ?s)
560 (?n gnus-tmp-news-method ?s)
561 (?P gnus-group-indentation ?s)
562 (?l gnus-tmp-grouplens ?s)
563 (?z gnus-tmp-news-method-string ?s)
564 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
565 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
566 (?u gnus-tmp-user-defined ?s)))
568 (defvar gnus-group-mode-line-format-alist
569 `((?S gnus-tmp-news-server ?s)
570 (?M gnus-tmp-news-method ?s)
571 (?u gnus-tmp-user-defined ?s)
572 (?: gnus-tmp-colon ?s)))
574 (defvar gnus-topic-topology nil
575 "The complete topic hierarchy.")
577 (defvar gnus-topic-alist nil
578 "The complete topic-group alist.")
580 (defvar gnus-group-marked nil)
582 (defvar gnus-group-list-mode nil)
588 (put 'gnus-group-mode 'mode-class 'special)
591 (gnus-define-keys gnus-group-mode-map
592 " " gnus-group-read-group
593 "=" gnus-group-select-group
594 "\r" gnus-group-select-group
595 "\M-\r" gnus-group-quick-select-group
596 "j" gnus-group-jump-to-group
597 "n" gnus-group-next-unread-group
598 "p" gnus-group-prev-unread-group
599 "\177" gnus-group-prev-unread-group
600 [delete] gnus-group-prev-unread-group
601 "N" gnus-group-next-group
602 "P" gnus-group-prev-group
603 "\M-n" gnus-group-next-unread-group-same-level
604 "\M-p" gnus-group-prev-unread-group-same-level
605 "," gnus-group-best-unread-group
606 "." gnus-group-first-unread-group
607 "u" gnus-group-unsubscribe-current-group
608 "U" gnus-group-unsubscribe-group
609 "c" gnus-group-catchup-current
610 "C" gnus-group-catchup-current-all
611 "\M-c" gnus-group-clear-data
612 "l" gnus-group-list-groups
613 "L" gnus-group-list-all-groups
615 "g" gnus-group-get-new-news
616 "\M-g" gnus-group-get-new-news-this-group
617 "R" gnus-group-restart
618 "r" gnus-group-read-init-file
619 "B" gnus-group-browse-foreign-server
620 "b" gnus-group-check-bogus-groups
621 "F" gnus-find-new-newsgroups
622 "\C-c\C-d" gnus-group-describe-group
623 "\M-d" gnus-group-describe-all-groups
624 "\C-c\C-a" gnus-group-apropos
625 "\C-c\M-\C-a" gnus-group-description-apropos
626 "a" gnus-group-post-news
627 "\ek" gnus-group-edit-local-kill
628 "\eK" gnus-group-edit-global-kill
629 "\C-k" gnus-group-kill-group
630 "\C-y" gnus-group-yank-group
631 "\C-w" gnus-group-kill-region
632 "\C-x\C-t" gnus-group-transpose-groups
633 "\C-c\C-l" gnus-group-list-killed
634 "\C-c\C-x" gnus-group-expire-articles
635 "\C-c\M-\C-x" gnus-group-expire-all-groups
637 "s" gnus-group-save-newsrc
638 "z" gnus-group-suspend
641 "?" gnus-group-describe-briefly
642 "\C-c\C-i" gnus-info-find-node
643 "\M-e" gnus-group-edit-group-method
644 "^" gnus-group-enter-server-mode
645 gnus-mouse-2 gnus-mouse-pick-group
646 "<" beginning-of-buffer
649 "\C-c\C-s" gnus-group-sort-groups
651 "\C-c\M-g" gnus-activate-all-groups
652 "\M-&" gnus-group-universal-argument
653 "#" gnus-group-mark-group
654 "\M-#" gnus-group-unmark-group)
656 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
657 "m" gnus-group-mark-group
658 "u" gnus-group-unmark-group
659 "w" gnus-group-mark-region
660 "m" gnus-group-mark-buffer
661 "r" gnus-group-mark-regexp
662 "U" gnus-group-unmark-all-groups)
664 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
665 "d" gnus-group-make-directory-group
666 "h" gnus-group-make-help-group
667 "u" gnus-group-make-useful-group
668 "a" gnus-group-make-archive-group
669 "k" gnus-group-make-kiboze-group
670 "m" gnus-group-make-group
671 "E" gnus-group-edit-group
672 "e" gnus-group-edit-group-method
673 "p" gnus-group-edit-group-parameters
674 "v" gnus-group-add-to-virtual
675 "V" gnus-group-make-empty-virtual
676 "D" gnus-group-enter-directory
677 "f" gnus-group-make-doc-group
678 "w" gnus-group-make-web-group
679 "r" gnus-group-rename-group
680 "c" gnus-group-customize
681 "\177" gnus-group-delete-group
682 [delete] gnus-group-delete-group)
684 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
685 "b" gnus-group-brew-soup
686 "w" gnus-soup-save-areas
687 "s" gnus-soup-send-replies
688 "p" gnus-soup-pack-packet
689 "r" nnsoup-pack-replies)
691 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
692 "s" gnus-group-sort-groups
693 "a" gnus-group-sort-groups-by-alphabet
694 "u" gnus-group-sort-groups-by-unread
695 "l" gnus-group-sort-groups-by-level
696 "v" gnus-group-sort-groups-by-score
697 "r" gnus-group-sort-groups-by-rank
698 "m" gnus-group-sort-groups-by-method)
700 (gnus-define-keys (gnus-group-sort-map "P" gnus-group-group-map)
701 "s" gnus-group-sort-selected-groups
702 "a" gnus-group-sort-selected-groups-by-alphabet
703 "u" gnus-group-sort-selected-groups-by-unread
704 "l" gnus-group-sort-selected-groups-by-level
705 "v" gnus-group-sort-selected-groups-by-score
706 "r" gnus-group-sort-selected-groups-by-rank
707 "m" gnus-group-sort-selected-groups-by-method)
709 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
710 "k" gnus-group-list-killed
711 "z" gnus-group-list-zombies
712 "s" gnus-group-list-groups
713 "u" gnus-group-list-all-groups
714 "A" gnus-group-list-active
715 "a" gnus-group-apropos
716 "d" gnus-group-description-apropos
717 "m" gnus-group-list-matching
718 "M" gnus-group-list-all-matching
719 "l" gnus-group-list-level)
721 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
722 "f" gnus-score-flush-cache)
724 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
725 "d" gnus-group-describe-group
726 "f" gnus-group-fetch-faq)
728 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
729 "l" gnus-group-set-current-level
730 "t" gnus-group-unsubscribe-current-group
731 "s" gnus-group-unsubscribe-group
732 "k" gnus-group-kill-group
733 "y" gnus-group-yank-group
734 "w" gnus-group-kill-region
735 "\C-k" gnus-group-kill-level
736 "z" gnus-group-kill-all-zombies))
738 (defun gnus-group-make-menu-bar ()
739 (gnus-turn-off-edit-menu 'group)
740 (unless (boundp 'gnus-group-reading-menu)
743 gnus-group-reading-menu gnus-group-mode-map ""
745 ["Read" gnus-group-read-group (gnus-group-group-name)]
746 ["Select" gnus-group-select-group (gnus-group-group-name)]
747 ["See old articles" (gnus-group-select-group 'all)
748 :keys "C-u SPC" :active (gnus-group-group-name)]
749 ["Catch up" gnus-group-catchup-current (gnus-group-group-name)]
750 ["Catch up all articles" gnus-group-catchup-current-all
751 (gnus-group-group-name)]
752 ["Check for new articles" gnus-group-get-new-news-this-group
753 (gnus-group-group-name)]
754 ["Toggle subscription" gnus-group-unsubscribe-current-group
755 (gnus-group-group-name)]
756 ["Kill" gnus-group-kill-group (gnus-group-group-name)]
757 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
758 ["Describe" gnus-group-describe-group (gnus-group-group-name)]
759 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
760 ["Edit kill file" gnus-group-edit-local-kill
761 (gnus-group-group-name)]
762 ;; Actually one should check, if any of the marked groups gives t for
763 ;; (gnus-check-backend-function 'request-expire-articles ...)
764 ["Expire articles" gnus-group-expire-articles
765 (or (and (gnus-group-group-name)
766 (gnus-check-backend-function
767 'request-expire-articles
768 (gnus-group-group-name))) gnus-group-marked)]
769 ["Set group level" gnus-group-set-current-level
770 (gnus-group-group-name)]
771 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
775 gnus-group-group-menu gnus-group-mode-map ""
778 ["List unread subscribed groups" gnus-group-list-groups t]
779 ["List (un)subscribed groups" gnus-group-list-all-groups t]
780 ["List killed groups" gnus-group-list-killed gnus-killed-list]
781 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
782 ["List level..." gnus-group-list-level t]
783 ["Describe all groups" gnus-group-describe-all-groups t]
784 ["Group apropos..." gnus-group-apropos t]
785 ["Group and description apropos..." gnus-group-description-apropos t]
786 ["List groups matching..." gnus-group-list-matching t]
787 ["List all groups matching..." gnus-group-list-all-matching t]
788 ["List active file" gnus-group-list-active t])
790 ["Default sort" gnus-group-sort-groups t]
791 ["Sort by method" gnus-group-sort-groups-by-method t]
792 ["Sort by rank" gnus-group-sort-groups-by-rank t]
793 ["Sort by score" gnus-group-sort-groups-by-score t]
794 ["Sort by level" gnus-group-sort-groups-by-level t]
795 ["Sort by unread" gnus-group-sort-groups-by-unread t]
796 ["Sort by name" gnus-group-sort-groups-by-alphabet t])
797 ("Sort process/prefixed"
798 ["Default sort" gnus-group-sort-selected-groups
799 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
800 ["Sort by method" gnus-group-sort-selected-groups-by-method
801 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
802 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
803 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
804 ["Sort by score" gnus-group-sort-selected-groups-by-score
805 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
806 ["Sort by level" gnus-group-sort-selected-groups-by-level
807 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
808 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
809 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
810 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
811 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
813 ["Mark group" gnus-group-mark-group
814 (and (gnus-group-group-name)
815 (not (memq (gnus-group-group-name) gnus-group-marked)))]
816 ["Unmark group" gnus-group-unmark-group
817 (and (gnus-group-group-name)
818 (memq (gnus-group-group-name) gnus-group-marked))]
819 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
820 ["Mark regexp..." gnus-group-mark-regexp t]
821 ["Mark region" gnus-group-mark-region t]
822 ["Mark buffer" gnus-group-mark-buffer t]
823 ["Execute command" gnus-group-universal-argument
824 (or gnus-group-marked (gnus-group-group-name))])
826 ["Subscribe to a group" gnus-group-unsubscribe-group t]
827 ["Kill all newsgroups in region" gnus-group-kill-region t]
828 ["Kill all zombie groups" gnus-group-kill-all-zombies
830 ["Kill all groups on level..." gnus-group-kill-level t])
832 ["Make a foreign group" gnus-group-make-group t]
833 ["Add a directory group" gnus-group-make-directory-group t]
834 ["Add the help group" gnus-group-make-help-group t]
835 ["Add the archive group" gnus-group-make-archive-group t]
836 ["Make a doc group" gnus-group-make-doc-group t]
837 ["Make a web group" gnus-group-make-web-group t]
838 ["Make a kiboze group" gnus-group-make-kiboze-group t]
839 ["Make a virtual group" gnus-group-make-empty-virtual t]
840 ["Add a group to a virtual" gnus-group-add-to-virtual t]
841 ["Rename group" gnus-group-rename-group
842 (gnus-check-backend-function
843 'request-rename-group (gnus-group-group-name))]
844 ["Delete group" gnus-group-delete-group
845 (gnus-check-backend-function
846 'request-delete-group (gnus-group-group-name))])
848 ["Parameters" gnus-group-edit-group-parameters
849 (gnus-group-group-name)]
850 ["Select method" gnus-group-edit-group-method
851 (gnus-group-group-name)]
852 ["Info" gnus-group-edit-group (gnus-group-group-name)])
854 ["Flush cache" gnus-score-flush-cache t])
856 ["Next" gnus-group-next-group t]
857 ["Previous" gnus-group-prev-group t]
858 ["Next unread" gnus-group-next-unread-group t]
859 ["Previous unread" gnus-group-prev-unread-group t]
860 ["Next unread same level" gnus-group-next-unread-group-same-level t]
861 ["Previous unread same level"
862 gnus-group-prev-unread-group-same-level t]
863 ["Jump to group" gnus-group-jump-to-group t]
864 ["First unread group" gnus-group-first-unread-group t]
865 ["Best unread group" gnus-group-best-unread-group t])
866 ["Transpose" gnus-group-transpose-groups
867 (gnus-group-group-name)]
868 ["Read a directory as a group..." gnus-group-enter-directory t]
872 gnus-group-misc-menu gnus-group-mode-map ""
874 ["Send a bug report" gnus-bug t]
875 ["Customize" gnus-group-customize t]
876 ["Send a mail" gnus-group-mail t]
877 ["Post an article..." gnus-group-post-news t]
878 ["Check for new news" gnus-group-get-new-news t]
879 ["Activate all groups" gnus-activate-all-groups t]
880 ["Delete bogus groups" gnus-group-check-bogus-groups t]
881 ["Find new newsgroups" gnus-find-new-newsgroups t]
882 ["Restart Gnus" gnus-group-restart t]
883 ["Read init file" gnus-group-read-init-file t]
884 ["Browse foreign server" gnus-group-browse-foreign-server t]
885 ["Enter server buffer" gnus-group-enter-server-mode t]
886 ["Expire all expirable articles" gnus-group-expire-all-groups t]
887 ["Generate any kiboze groups" nnkiboze-generate-groups t]
888 ["Gnus version" gnus-version t]
889 ["Save .newsrc files" gnus-group-save-newsrc t]
890 ["Suspend Gnus" gnus-group-suspend t]
891 ["Clear dribble buffer" gnus-group-clear-dribble t]
892 ["Edit global kill file" gnus-group-edit-global-kill t]
893 ["Read manual" gnus-info-find-node t]
894 ["Toggle topics" gnus-topic-mode t]
896 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
897 ["Send replies" gnus-soup-send-replies
898 (fboundp 'gnus-soup-pack-packet)]
899 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
900 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
901 ["Brew SOUP" gnus-soup-brew-soup (fboundp 'gnus-soup-pack-packet)])
902 ["Exit from Gnus" gnus-group-exit t]
903 ["Exit without saving" gnus-group-quit t]
906 (run-hooks 'gnus-group-menu-hook)
909 (defun gnus-group-mode ()
910 "Major mode for reading news.
912 All normal editing commands are switched off.
913 \\<gnus-group-mode-map>
914 The group buffer lists (some of) the groups available. For instance,
915 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
916 lists all zombie groups.
918 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
919 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
921 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
923 The following commands are available:
925 \\{gnus-group-mode-map}"
927 (when (and menu-bar-mode
928 (gnus-visual-p 'group-menu 'menu))
929 (gnus-group-make-menu-bar))
930 (kill-all-local-variables)
931 (gnus-simplify-mode-line)
932 (setq major-mode 'gnus-group-mode)
933 (setq mode-name "Group")
934 (gnus-group-set-mode-line)
935 (setq mode-line-process nil)
936 (use-local-map gnus-group-mode-map)
937 (buffer-disable-undo (current-buffer))
938 (setq truncate-lines t)
939 (setq buffer-read-only t)
940 (gnus-set-default-directory)
941 (gnus-update-format-specifications nil 'group 'group-mode)
942 (gnus-update-group-mark-positions)
943 (gnus-make-local-hook 'post-command-hook)
944 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
947 (run-hooks 'gnus-group-mode-hook))
949 (defun gnus-update-group-mark-positions ()
951 (let ((gnus-process-mark 128)
952 (gnus-group-marked '("dummy.group"))
953 (gnus-active-hashtb (make-vector 10 0)))
954 (gnus-set-active "dummy.group" '(0 . 0))
955 (gnus-set-work-buffer)
956 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
957 (goto-char (point-min))
958 (setq gnus-group-mark-positions
959 (list (cons 'process (and (search-forward "\200" nil t)
962 (defun gnus-clear-inboxes-moved ()
963 (setq nnmail-moved-inboxes nil))
965 (defun gnus-mouse-pick-group (e)
966 "Enter the group under the mouse pointer."
969 (gnus-group-read-group nil))
971 ;; Look at LEVEL and find out what the level is really supposed to be.
972 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
973 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
974 (defun gnus-group-default-level (&optional level number-or-nil)
976 (gnus-group-use-permanent-levels
977 (or (setq gnus-group-use-permanent-levels
978 (or level (if (numberp gnus-group-use-permanent-levels)
979 gnus-group-use-permanent-levels
980 (or gnus-group-default-list-level
981 gnus-level-subscribed))))
982 gnus-group-default-list-level gnus-level-subscribed))
986 (or level gnus-group-default-list-level gnus-level-subscribed))))
988 (defun gnus-group-setup-buffer ()
989 (switch-to-buffer gnus-group-buffer)
990 (unless (eq major-mode 'gnus-group-mode)
991 (gnus-add-current-to-buffer-list)
994 (gnus-carpal-setup-buffer 'group))))
996 (defun gnus-group-list-groups (&optional level unread lowest)
997 "List newsgroups with level LEVEL or lower that have unread articles.
998 Default is all subscribed groups.
999 If argument UNREAD is non-nil, groups with no unread articles are also
1002 (list (if current-prefix-arg
1003 (prefix-numeric-value current-prefix-arg)
1005 (gnus-group-default-level nil t)
1006 gnus-group-default-list-level
1007 gnus-level-subscribed))))
1008 ;; Just do this here, for no particular good reason.
1009 (gnus-clear-inboxes-moved)
1011 (setq level (car gnus-group-list-mode)
1012 unread (cdr gnus-group-list-mode)))
1013 (setq level (gnus-group-default-level level))
1014 (gnus-group-setup-buffer) ;May call from out of group buffer
1015 (gnus-update-format-specifications nil 'group 'group-mode)
1016 (let ((case-fold-search nil)
1017 (props (text-properties-at (gnus-point-at-bol)))
1018 (group (gnus-group-group-name)))
1019 (set-buffer gnus-group-buffer)
1020 (funcall gnus-group-prepare-function level unread lowest)
1021 (if (zerop (buffer-size))
1022 (gnus-message 5 gnus-no-groups-message)
1023 (goto-char (point-max))
1024 (when (or (not gnus-group-goto-next-group-function)
1025 (not (funcall gnus-group-goto-next-group-function
1028 ;; Go to the first group with unread articles.
1029 (gnus-group-search-forward t)
1030 ;; Find the right group to put point on. If the current group
1031 ;; has disappeared in the new listing, try to find the next
1032 ;; one. If no next one can be found, just leave point at the
1033 ;; first newsgroup in the buffer.
1034 (when (not (gnus-goto-char
1036 (point-min) (point-max)
1037 'gnus-group (gnus-intern-safe
1038 group gnus-active-hashtb))))
1039 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb))))
1041 (not (gnus-goto-char
1043 (point-min) (point-max) 'gnus-group
1045 (caar newsrc) gnus-active-hashtb)))))
1046 (setq newsrc (cdr newsrc)))
1048 (goto-char (point-max))
1049 (forward-line -1))))))
1050 ;; Adjust cursor point.
1051 (gnus-group-position-point))))
1053 (defun gnus-group-list-level (level &optional all)
1054 "List groups on LEVEL.
1055 If ALL (the prefix), also list groups that have no unread articles."
1056 (interactive "nList groups on level: \nP")
1057 (gnus-group-list-groups level all level))
1059 (defun gnus-group-prepare-flat (level &optional all lowest regexp)
1060 "List all newsgroups with unread articles of level LEVEL or lower.
1061 If ALL is non-nil, list groups that have no unread articles.
1062 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1063 If REGEXP, only list groups matching REGEXP."
1064 (set-buffer gnus-group-buffer)
1065 (let ((buffer-read-only nil)
1066 (newsrc (cdr gnus-newsrc-alist))
1067 (lowest (or lowest 1))
1068 info clevel unread group params)
1070 (when (< lowest gnus-level-zombie)
1071 ;; List living groups.
1073 (setq info (car newsrc)
1074 group (gnus-info-group info)
1075 params (gnus-info-params info)
1077 unread (car (gnus-gethash group gnus-newsrc-hashtb)))
1078 (and unread ; This group might be bogus
1080 (string-match regexp group))
1081 (<= (setq clevel (gnus-info-level info)) level)
1083 (or all ; We list all groups?
1084 (if (eq unread t) ; Unactivated?
1085 gnus-group-list-inactive-groups ; We list unactivated
1086 (> unread 0)) ; We list groups with unread articles
1087 (and gnus-list-groups-with-ticked-articles
1088 (cdr (assq 'tick (gnus-info-marks info))))
1089 ; And groups with tickeds
1090 ;; Check for permanent visibility.
1091 (and gnus-permanently-visible-groups
1092 (string-match gnus-permanently-visible-groups
1094 (memq 'visible params)
1095 (cdr (assq 'visible params)))
1096 (gnus-group-insert-group-line
1097 group (gnus-info-level info)
1098 (gnus-info-marks info) unread (gnus-info-method info)))))
1100 ;; List dead groups.
1101 (and (>= level gnus-level-zombie) (<= lowest gnus-level-zombie)
1102 (gnus-group-prepare-flat-list-dead
1103 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1104 gnus-level-zombie ?Z
1106 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)
1107 (gnus-group-prepare-flat-list-dead
1108 (setq gnus-killed-list (sort gnus-killed-list 'string<))
1109 gnus-level-killed ?K regexp))
1111 (gnus-group-set-mode-line)
1112 (setq gnus-group-list-mode (cons level all))
1113 (run-hooks 'gnus-group-prepare-hook)))
1115 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1116 ;; List zombies and killed lists somewhat faster, which was
1117 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1118 ;; this by ignoring the group format specification altogether.
1121 ;; This loop is used when listing groups that match some
1124 (setq group (pop groups))
1125 (when (string-match regexp group)
1126 (gnus-add-text-properties
1127 (point) (prog1 (1+ (point))
1128 (insert " " mark " *: " group "\n"))
1129 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1131 'gnus-level level))))
1132 ;; This loop is used when listing all groups.
1134 (gnus-add-text-properties
1135 (point) (prog1 (1+ (point))
1136 (insert " " mark " *: "
1137 (setq group (pop groups)) "\n"))
1138 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1140 'gnus-level level))))))
1142 (defun gnus-group-update-group-line ()
1143 "Update the current line in the group buffer."
1144 (let* ((buffer-read-only nil)
1145 (group (gnus-group-group-name))
1146 (entry (and group (gnus-gethash group gnus-newsrc-hashtb)))
1147 gnus-group-indentation)
1150 (not (gnus-ephemeral-group-p group))
1152 (concat "(gnus-group-set-info '"
1153 (gnus-prin1-to-string (nth 2 entry))
1155 (setq gnus-group-indentation (gnus-group-group-indentation))
1157 (gnus-group-insert-group-line-info group)
1159 (gnus-group-position-point))))
1161 (defun gnus-group-insert-group-line-info (group)
1162 "Insert GROUP on the current line."
1163 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
1164 (gnus-group-indentation (gnus-group-group-indentation))
1168 ;; (Un)subscribed group.
1169 (setq info (nth 2 entry))
1170 (gnus-group-insert-group-line
1171 group (gnus-info-level info) (gnus-info-marks info)
1172 (or (car entry) t) (gnus-info-method info)))
1173 ;; This group is dead.
1174 (gnus-group-insert-group-line
1176 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1178 (if (setq active (gnus-active group))
1179 (- (1+ (cdr active)) (car active)) 0)
1182 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1183 gnus-tmp-marked number
1185 "Insert a group line in the group buffer."
1186 (let* ((gnus-tmp-active (gnus-active gnus-tmp-group))
1187 (gnus-tmp-number-total
1189 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1191 (gnus-tmp-number-of-unread
1192 (if (numberp number) (int-to-string (max 0 number))
1194 (gnus-tmp-number-of-read
1195 (if (numberp number)
1196 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1198 (gnus-tmp-subscribed
1199 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1200 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1201 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1203 (gnus-tmp-qualified-group (gnus-group-real-name gnus-tmp-group))
1204 (gnus-tmp-newsgroup-description
1205 (if gnus-description-hashtb
1206 (or (gnus-gethash gnus-tmp-group gnus-description-hashtb) "")
1209 (if (member gnus-tmp-group gnus-moderated-list) ?m ? ))
1210 (gnus-tmp-moderated-string
1211 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1213 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1214 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1215 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1216 (gnus-tmp-news-method-string
1218 (format "(%s:%s)" (car gnus-tmp-method)
1219 (cadr gnus-tmp-method)) ""))
1220 (gnus-tmp-marked-mark
1221 (if (and (numberp number)
1223 (cdr (assq 'tick gnus-tmp-marked)))
1225 (gnus-tmp-process-marked
1226 (if (member gnus-tmp-group gnus-group-marked)
1227 gnus-process-mark ? ))
1229 (or (and gnus-use-grouplens
1230 (bbb-grouplens-group-p gnus-tmp-group))
1232 (buffer-read-only nil)
1233 header gnus-tmp-header) ; passed as parameter to user-funcs.
1235 (gnus-add-text-properties
1239 (eval gnus-group-line-format-spec))
1240 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1241 gnus-unread ,(if (numberp number)
1242 (string-to-int gnus-tmp-number-of-unread)
1244 gnus-marked ,gnus-tmp-marked-mark
1245 gnus-indentation ,gnus-group-indentation
1246 gnus-level ,gnus-tmp-level))
1247 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1249 (run-hooks 'gnus-group-update-hook)
1251 ;; Allow XEmacs to remove front-sticky text properties.
1252 (gnus-group-remove-excess-properties)))
1254 (defun gnus-group-highlight-line ()
1255 "Highlight the current line according to `gnus-group-highlight'."
1256 (let* ((list gnus-group-highlight)
1258 (end (progn (end-of-line) (point)))
1259 ;; now find out where the line starts and leave point there.
1260 (beg (progn (beginning-of-line) (point)))
1261 (group (gnus-group-group-name))
1262 (entry (gnus-group-entry group))
1263 (unread (if (numberp (car entry)) (car entry) 0))
1264 (active (gnus-active group))
1265 (total (if active (1+ (- (cdr active) (car active))) 0))
1266 (info (nth 2 entry))
1267 (method (gnus-server-get-method group (gnus-info-method info)))
1268 (marked (gnus-info-marks info))
1269 (mailp (memq 'mail (assoc (symbol-name
1270 (car (or method gnus-select-method)))
1271 gnus-valid-select-methods)))
1272 (level (or (gnus-info-level info) 9))
1273 (score (or (gnus-info-score info) 0))
1274 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1275 (inhibit-read-only t))
1276 ;; Eval the cars of the lists until we find a match.
1278 (not (eval (caar list))))
1279 (setq list (cdr list)))
1280 (let ((face (cdar list)))
1281 (unless (eq face (get-text-property beg 'face))
1282 (gnus-put-text-property
1284 (setq face (if (boundp face) (symbol-value face) face)))
1285 (gnus-extent-start-open beg)))
1288 (defun gnus-group-update-group (group &optional visible-only)
1289 "Update all lines where GROUP appear.
1290 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1293 (set-buffer gnus-group-buffer)
1294 ;; The buffer may be narrowed.
1297 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1299 found buffer-read-only)
1300 ;; Enter the current status into the dribble buffer.
1301 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
1302 (when (and entry (not (gnus-ephemeral-group-p group)))
1304 (concat "(gnus-group-set-info '"
1305 (gnus-prin1-to-string (nth 2 entry))
1307 ;; Find all group instances. If topics are in use, each group
1308 ;; may be listed in more than once.
1309 (while (setq loc (text-property-any
1310 loc (point-max) 'gnus-group ident))
1313 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1315 (gnus-group-insert-group-line-info group)
1318 (run-hooks 'gnus-group-update-group-hook)))
1319 (setq loc (1+ loc)))
1320 (unless (or found visible-only)
1321 ;; No such line in the buffer, find out where it's supposed to
1322 ;; go, and insert it there (or at the end of the buffer).
1323 (if gnus-goto-missing-group-function
1324 (funcall gnus-goto-missing-group-function group)
1325 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb))))
1326 (while (and entry (car entry)
1330 (point-min) (point-max)
1331 'gnus-group (gnus-intern-safe
1332 (caar entry) gnus-active-hashtb)))))
1333 (setq entry (cdr entry)))
1334 (or entry (goto-char (point-max)))))
1335 ;; Finally insert the line.
1336 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1337 (gnus-group-insert-group-line-info group)
1340 (run-hooks 'gnus-group-update-group-hook))))
1341 (when gnus-group-update-group-function
1342 (funcall gnus-group-update-group-function group))
1343 (gnus-group-set-mode-line)))))
1345 (defun gnus-group-set-mode-line ()
1346 "Update the mode line in the group buffer."
1347 (when (memq 'group gnus-updated-mode-lines)
1348 ;; Yes, we want to keep this mode line updated.
1350 (set-buffer gnus-group-buffer)
1351 (let* ((gformat (or gnus-group-mode-line-format-spec
1352 (setq gnus-group-mode-line-format-spec
1354 gnus-group-mode-line-format
1355 gnus-group-mode-line-format-alist))))
1356 (gnus-tmp-news-server (cadr gnus-select-method))
1357 (gnus-tmp-news-method (car gnus-select-method))
1358 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1360 gnus-tmp-header ;Dummy binding for user-defined formats
1361 ;; Get the resulting string.
1363 (and gnus-dribble-buffer
1364 (buffer-name gnus-dribble-buffer)
1365 (buffer-modified-p gnus-dribble-buffer)
1367 (set-buffer gnus-dribble-buffer)
1368 (not (zerop (buffer-size))))))
1369 (mode-string (eval gformat)))
1370 ;; Say whether the dribble buffer has been modified.
1371 (setq mode-line-modified
1372 (if modified "---*- " "----- "))
1373 ;; If the line is too long, we chop it off.
1374 (when (> (length mode-string) max-len)
1375 (setq mode-string (substring mode-string 0 (- max-len 4))))
1377 (setq mode-line-buffer-identification
1378 (gnus-mode-line-buffer-identification
1379 (list mode-string)))
1380 (set-buffer-modified-p modified))))))
1382 (defun gnus-group-group-name ()
1383 "Get the name of the newsgroup on the current line."
1384 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
1385 (and group (symbol-name group))))
1387 (defun gnus-group-group-level ()
1388 "Get the level of the newsgroup on the current line."
1389 (get-text-property (gnus-point-at-bol) 'gnus-level))
1391 (defun gnus-group-group-indentation ()
1392 "Get the indentation of the newsgroup on the current line."
1393 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation)
1394 (and gnus-group-indentation-function
1395 (funcall gnus-group-indentation-function))
1398 (defun gnus-group-group-unread ()
1399 "Get the number of unread articles of the newsgroup on the current line."
1400 (get-text-property (gnus-point-at-bol) 'gnus-unread))
1402 (defun gnus-group-new-mail (group)
1403 (if (nnmail-new-mail-p (gnus-group-real-name group))
1407 (defun gnus-group-search-forward (&optional backward all level first-too)
1408 "Find the next newsgroup with unread articles.
1409 If BACKWARD is non-nil, find the previous newsgroup instead.
1410 If ALL is non-nil, just find any newsgroup.
1411 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1413 If FIRST-TOO, the current line is also eligible as a target."
1414 (let ((way (if backward -1 1))
1415 (low gnus-level-killed)
1418 (if (and backward (progn (beginning-of-line)) (bobp))
1429 (get-text-property (point) 'gnus-unread)))
1430 (and (numberp unread) (> unread 0)))
1431 (setq lev (get-text-property (point)
1433 (<= lev gnus-level-subscribed)))
1435 (and (setq lev (get-text-property (point)
1444 (zerop (forward-line way)))))
1446 (progn (gnus-group-position-point) t)
1447 (goto-char (or pos beg))
1450 ;;; Gnus group mode commands
1454 (defun gnus-group-mark-group (n &optional unmark no-advance)
1455 "Mark the current group."
1457 (let ((buffer-read-only nil)
1461 (when (setq group (gnus-group-group-name))
1462 ;; Go to the mark position.
1464 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1465 (subst-char-in-region
1466 (point) (1+ (point)) (following-char)
1469 (setq gnus-group-marked (delete group gnus-group-marked))
1471 (setq gnus-group-marked
1472 (cons group (delete group gnus-group-marked)))
1473 gnus-process-mark)))
1475 (gnus-group-next-group 1))
1477 (gnus-summary-position-point)
1480 (defun gnus-group-unmark-group (n)
1481 "Remove the mark from the current group."
1483 (gnus-group-mark-group n 'unmark)
1484 (gnus-group-position-point))
1486 (defun gnus-group-unmark-all-groups ()
1487 "Unmark all groups."
1489 (let ((groups gnus-group-marked))
1492 (gnus-group-remove-mark (pop groups)))))
1493 (gnus-group-position-point))
1495 (defun gnus-group-mark-region (unmark beg end)
1496 "Mark all groups between point and mark.
1497 If UNMARK, remove the mark instead."
1498 (interactive "P\nr")
1499 (let ((num (count-lines beg end)))
1502 (- num (gnus-group-mark-group num unmark)))))
1504 (defun gnus-group-mark-buffer (&optional unmark)
1505 "Mark all groups in the buffer.
1506 If UNMARK, remove the mark instead."
1508 (gnus-group-mark-region unmark (point-min) (point-max)))
1510 (defun gnus-group-mark-regexp (regexp)
1511 "Mark all groups that match some regexp."
1512 (interactive "sMark (regexp): ")
1513 (let ((alist (cdr gnus-newsrc-alist))
1516 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1517 (gnus-group-set-mark group))))
1518 (gnus-group-position-point))
1520 (defun gnus-group-remove-mark (group)
1521 "Remove the process mark from GROUP and move point there.
1522 Return nil if the group isn't displayed."
1523 (if (gnus-group-goto-group group)
1525 (gnus-group-mark-group 1 'unmark t)
1527 (setq gnus-group-marked
1528 (delete group gnus-group-marked))
1531 (defun gnus-group-set-mark (group)
1532 "Set the process mark on GROUP."
1533 (if (gnus-group-goto-group group)
1535 (gnus-group-mark-group 1 nil t))
1536 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1538 (defun gnus-group-universal-argument (arg &optional groups func)
1539 "Perform any command on all groups according to the process/prefix convention."
1541 (let ((groups (or groups (gnus-group-process-prefix arg))))
1542 (if (eq (setq func (or func
1545 (substitute-command-keys
1546 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1548 (gnus-error 1 "Undefined key")
1550 (gnus-group-remove-mark (pop groups))
1551 (command-execute func))))
1552 (gnus-group-position-point))
1554 (defun gnus-group-process-prefix (n)
1555 "Return a list of groups to work on.
1556 Take into consideration N (the prefix) and the list of marked groups."
1559 (setq n (prefix-numeric-value n))
1560 ;; There is a prefix, so we return a list of the N next
1562 (let ((way (if (< n 0) -1 1))
1567 (setq group (gnus-group-group-name)))
1570 (gnus-group-next-group way)))
1572 ((and (boundp 'transient-mark-mode)
1574 (boundp 'mark-active)
1576 ;; Work on the region between point and mark.
1577 (let ((max (max (point) (mark)))
1580 (goto-char (min (point) (mark)))
1583 (push (gnus-group-group-name) groups)
1584 (zerop (gnus-group-next-group 1))
1586 (nreverse groups))))
1588 ;; No prefix, but a list of marked articles.
1589 (reverse gnus-group-marked))
1591 ;; Neither marked articles or a prefix, so we return the
1593 (let ((group (gnus-group-group-name)))
1594 (and group (list group))))))
1596 ;; Selecting groups.
1598 (defun gnus-group-read-group (&optional all no-article group)
1599 "Read news in this newsgroup.
1600 If the prefix argument ALL is non-nil, already read articles become
1601 readable. IF ALL is a number, fetch this number of articles. If the
1602 optional argument NO-ARTICLE is non-nil, no article will be
1603 auto-selected upon group entry. If GROUP is non-nil, fetch that
1606 (let ((no-display (eq all 0))
1607 (group (or group (gnus-group-group-name)))
1608 number active marked entry)
1612 (error "No group on current line"))
1613 (setq marked (gnus-info-marks