1 ;;; gnus-group.el --- group mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
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)
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.
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.
32 (defvar tool-bar-mode))
48 (let ((features (cons 'gnus-group features)))
50 (unless (boundp 'gnus-cache-active-hashtb)
51 (defvar gnus-cache-active-hashtb nil)))
53 (autoload 'gnus-agent-total-fetched-for "gnus-agent")
54 (autoload 'gnus-cache-total-fetched-for "gnus-cache")
56 (defcustom gnus-group-archive-directory
57 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
58 "*The address of the (ding) archives."
59 :group 'gnus-group-foreign
62 (defcustom gnus-group-recent-archive-directory
63 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
64 "*The address of the most recent (ding) articles."
65 :group 'gnus-group-foreign
68 (defcustom gnus-no-groups-message "No Gnus is good news"
69 "*Message displayed by Gnus when no groups are available."
73 (defcustom gnus-keep-same-level nil
74 "*Non-nil means that the next newsgroup after the current will be on the same level.
75 When you type, for instance, `n' after reading the last article in the
76 current newsgroup, you will go to the next newsgroup. If this variable
77 is nil, the next newsgroup will be the next from the group
79 If this variable is non-nil, Gnus will either put you in the
80 next newsgroup with the same level, or, if no such newsgroup is
81 available, the next newsgroup with the lowest possible level higher
82 than the current level.
83 If this variable is `best', Gnus will make the next newsgroup the one
85 :group 'gnus-group-levels
86 :type '(choice (const nil)
88 (sexp :tag "other" t)))
90 (defcustom gnus-group-goto-unread t
91 "*If non-nil, movement commands will go to the next unread and subscribed group."
92 :link '(custom-manual "(gnus)Group Maneuvering")
93 :group 'gnus-group-various
96 (defcustom gnus-goto-next-group-when-activating t
97 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
98 :link '(custom-manual "(gnus)Scanning New Messages")
99 :group 'gnus-group-various
102 (defcustom gnus-permanently-visible-groups nil
103 "*Regexp to match groups that should always be listed in the group buffer.
104 This means that they will still be listed even when there are no
105 unread articles in the groups.
107 If nil, no groups are permanently visible."
108 :group 'gnus-group-listing
109 :type '(choice regexp (const nil)))
111 (defcustom gnus-list-groups-with-ticked-articles t
112 "*If non-nil, list groups that have only ticked articles.
113 If nil, only list groups that have unread articles."
114 :group 'gnus-group-listing
117 (defcustom gnus-group-default-list-level gnus-level-subscribed
118 "*Default listing level.
119 Ignored if `gnus-group-use-permanent-levels' is non-nil."
120 :group 'gnus-group-listing
123 (defcustom gnus-group-list-inactive-groups t
124 "*If non-nil, inactive groups will be listed."
125 :group 'gnus-group-listing
126 :group 'gnus-group-levels
129 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
130 "*Function used for sorting the group buffer.
131 This function will be called with group info entries as the arguments
132 for the groups to be sorted. Pre-made functions include
133 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
134 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
135 `gnus-group-sort-by-score', `gnus-group-sort-by-method',
136 `gnus-group-sort-by-server', and `gnus-group-sort-by-rank'.
138 This variable can also be a list of sorting functions. In that case,
139 the most significant sort function should be the last function in the
141 :group 'gnus-group-listing
142 :link '(custom-manual "(gnus)Sorting Groups")
143 :type '(repeat :value-to-internal (lambda (widget value)
144 (if (listp value) value (list value)))
145 :match (lambda (widget value)
147 (widget-editable-list-match widget value)))
148 (choice (function-item gnus-group-sort-by-alphabet)
149 (function-item gnus-group-sort-by-real-name)
150 (function-item gnus-group-sort-by-unread)
151 (function-item gnus-group-sort-by-level)
152 (function-item gnus-group-sort-by-score)
153 (function-item gnus-group-sort-by-method)
154 (function-item gnus-group-sort-by-server)
155 (function-item gnus-group-sort-by-rank)
156 (function :tag "other" nil))))
158 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y:%B%(%g%)%O\n"
159 "*Format of group lines.
160 It works along the same lines as a normal formatting string,
161 with some simple extensions.
163 %M Only marked articles (character, \"*\" or \" \")
164 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
165 %L Level of subscribedness (integer)
166 %N Number of unread articles (integer)
167 %I Number of dormant articles (integer)
168 %i Number of ticked and dormant (integer)
169 %T Number of ticked articles (integer)
170 %R Number of read articles (integer)
171 %U Number of unseen articles (integer)
172 %t Estimated total number of articles (integer)
173 %y Number of unread, unticked articles (integer)
174 %G Group name (string)
175 %g Qualified group name (string)
176 %c Short (collapsed) group name. See `gnus-group-uncollapsed-levels'.
177 %C Group comment (string)
178 %D Group description (string)
179 %s Select method (string)
180 %o Moderated group (char, \"m\")
181 %p Process mark (char)
182 %B Whether a summary buffer for the group is open (char, \"*\")
183 %O Moderated group (string, \"(m)\" or \"\")
184 %P Topic indentation (string)
185 %m Whether there is new(ish) mail in the group (char, \"%\")
186 %n Select from where (string)
187 %z A string that look like `<%s:%n>' if a foreign select method is used
188 %d The date the group was last entered.
189 %E Icon as defined by `gnus-group-icon-list'.
190 %F The disk space used by the articles fetched by both the cache and agent.
191 %u User defined specifier. The next character in the format string should
192 be a letter. Gnus will call the function gnus-user-format-function-X,
193 where X is the letter following %u. The function will be passed a
194 single dummy parameter as argument. The function should return a
195 string, which will be inserted into the buffer just like information
196 from any other group specifier.
198 Note that this format specification is not always respected. For
199 reasons of efficiency, when listing killed groups, this specification
200 is ignored altogether. If the spec is changed considerably, your
201 output may end up looking strange when listing both alive and killed
204 If you use %o or %O, reading the active file will be slower and quite
205 a bit of extra memory will be used. %D and %F will also worsen
206 performance. Also note that if you change the format specification to
207 include any of these specs, you must probably re-start Gnus to see
210 General format specifiers can also be used.
211 See Info node `(gnus)Formatting Variables'."
212 :link '(custom-manual "(gnus)Formatting Variables")
213 :group 'gnus-group-visual
216 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
217 "*The format specification for the group mode line.
218 It works along the same lines as a normal formatting string,
219 with some simple extensions:
221 %S The native news server.
222 %M The native select method.
223 %: \":\" if %S isn't \"\"."
224 :group 'gnus-group-visual
227 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
228 (when (featurep 'xemacs)
229 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
230 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
232 (defcustom gnus-group-menu-hook nil
233 "Hook run after the creation of the group mode menu."
234 :group 'gnus-group-various
237 (defcustom gnus-group-catchup-group-hook nil
238 "Hook run when catching up a group from the group buffer."
239 :group 'gnus-group-various
240 :link '(custom-manual "(gnus)Group Data")
243 (defcustom gnus-group-update-group-hook nil
244 "Hook called when updating group lines."
245 :group 'gnus-group-visual
248 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
249 "*A function that is called to generate the group buffer.
250 The function is called with three arguments: The first is a number;
251 all group with a level less or equal to that number should be listed,
252 if the second is non-nil, empty groups should also be displayed. If
253 the third is non-nil, it is a number. No groups with a level lower
254 than this number should be displayed.
256 The only current function implemented is `gnus-group-prepare-flat'."
257 :group 'gnus-group-listing
260 (defcustom gnus-group-prepare-hook nil
261 "Hook called after the group buffer has been generated.
262 If you want to modify the group buffer, you can use this hook."
263 :group 'gnus-group-listing
266 (defcustom gnus-suspend-gnus-hook nil
267 "Hook called when suspending (not exiting) Gnus."
271 (defcustom gnus-exit-gnus-hook nil
272 "Hook called when exiting Gnus."
276 (defcustom gnus-after-exiting-gnus-hook nil
277 "Hook called after exiting Gnus."
281 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
282 "Hook called when a group line is changed.
283 The hook will not be called if `gnus-visual' is nil.
285 The default function `gnus-group-highlight-line' will
286 highlight the line according to the `gnus-group-highlight'
288 :group 'gnus-group-visual
291 (defcustom gnus-useful-groups
292 '(("(ding) mailing list mirrored at gmane.org"
293 "gmane.emacs.gnus.general"
295 (nntp-address "news.gmane.org")))
298 (nntp "news.gnus.org"
299 (nntp-address "news.gnus.org")))
300 ("Local Gnus help group"
303 (nndoc-article-type mbox)
304 (eval `(nndoc-address
305 ,(let ((file (nnheader-find-etc-directory
308 (error "Couldn't find doc group"))
310 "*Alist of useful group-server pairs."
311 :group 'gnus-group-listing
312 :type '(repeat (list (string :tag "Description")
314 (sexp :tag "Method"))))
316 (defcustom gnus-group-highlight
318 ((and mailp (= unread 0) (eq level 1)) .
319 gnus-group-mail-1-empty)
320 ((and mailp (eq level 1)) .
322 ((and mailp (= unread 0) (eq level 2)) .
323 gnus-group-mail-2-empty)
324 ((and mailp (eq level 2)) .
326 ((and mailp (= unread 0) (eq level 3)) .
327 gnus-group-mail-3-empty)
328 ((and mailp (eq level 3)) .
330 ((and mailp (= unread 0)) .
331 gnus-group-mail-low-empty)
335 ((and (= unread 0) (eq level 1)) .
336 gnus-group-news-1-empty)
337 ((and (eq level 1)) .
339 ((and (= unread 0) (eq level 2)) .
340 gnus-group-news-2-empty)
341 ((and (eq level 2)) .
343 ((and (= unread 0) (eq level 3)) .
344 gnus-group-news-3-empty)
345 ((and (eq level 3)) .
347 ((and (= unread 0) (eq level 4)) .
348 gnus-group-news-4-empty)
349 ((and (eq level 4)) .
351 ((and (= unread 0) (eq level 5)) .
352 gnus-group-news-5-empty)
353 ((and (eq level 5)) .
355 ((and (= unread 0) (eq level 6)) .
356 gnus-group-news-6-empty)
357 ((and (eq level 6)) .
359 ((and (= unread 0)) .
360 gnus-group-news-low-empty)
362 gnus-group-news-low))
363 "*Controls the highlighting of group buffer lines.
365 Below is a list of `Form'/`Face' pairs. When deciding how a a
366 particular group line should be displayed, each form is
367 evaluated. The content of the face field after the first true form is
368 used. You can change how those group lines are displayed by
369 editing the face field.
371 It is also possible to change and add form fields, but currently that
372 requires an understanding of Lisp expressions. Hopefully this will
373 change in a future release. For now, you can use the following
374 variables in the Lisp expression:
376 group: The name of the group.
377 unread: The number of unread articles in the group.
378 method: The select method used.
379 mailp: Whether it's a mail group or not.
380 level: The level of the group.
381 score: The score of the group.
382 ticked: The number of ticked articles."
383 :group 'gnus-group-visual
384 :type '(repeat (cons (sexp :tag "Form") face)))
386 (defcustom gnus-new-mail-mark ?%
387 "Mark used for groups with new mail."
388 :group 'gnus-group-visual
391 (defgroup gnus-group-icons nil
392 "Add Icons to your group buffer."
393 :group 'gnus-group-visual)
395 (defcustom gnus-group-icon-list
397 "*Controls the insertion of icons into group buffer lines.
399 Below is a list of `Form'/`File' pairs. When deciding how a
400 particular group line should be displayed, each form is evaluated.
401 The icon from the file field after the first true form is used. You
402 can change how those group lines are displayed by editing the file
403 field. The File will either be found in the
404 `gnus-group-glyph-directory' or by designating absolute name of the
407 It is also possible to change and add form fields, but currently that
408 requires an understanding of Lisp expressions. Hopefully this will
409 change in a future release. For now, you can use the following
410 variables in the Lisp expression:
412 group: The name of the group.
413 unread: The number of unread articles in the group.
414 method: The select method used.
415 mailp: Whether it's a mail group or not.
416 newsp: Whether it's a news group or not
417 level: The level of the group.
418 score: The score of the group.
419 ticked: The number of ticked articles."
420 :group 'gnus-group-icons
421 :type '(repeat (cons (sexp :tag "Form") file)))
423 (defcustom gnus-group-name-charset-method-alist nil
424 "Alist of method and the charset for group names.
427 (((nntp \"news.com.cn\") . cn-gb-2312))"
430 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
432 (defcustom gnus-group-name-charset-group-alist
433 (if (or (and (fboundp 'find-coding-system) (find-coding-system 'utf-8))
434 (mm-coding-system-p 'utf-8))
437 "Alist of group regexp and the charset for group names.
440 ((\"\\.com\\.cn:\" . cn-gb-2312))"
442 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
444 (defcustom gnus-group-jump-to-group-prompt nil
445 "Default prompt for `gnus-group-jump-to-group'.
447 If non-nil, the value should be a string or an alist. If it is a string,
448 e.g. \"nnml:\", in which case `gnus-group-jump-to-group' offers \"Group:
449 nnml:\" in the minibuffer prompt.
451 If it is an alist, it must consist of \(NUMBER . PROMPT\) pairs, for example:
452 \((1 . \"\") (2 . \"nnfolder+archive:\")). The element with number 0 is
453 used when no prefix argument is given to `gnus-group-jump-to-group'."
455 :group 'gnus-group-various
456 :type '(choice (string :tag "Prompt string")
457 (const :tag "Empty" nil)
458 (repeat (cons (integer :tag "Argument")
459 (string :tag "Prompt string")))))
461 (defvar gnus-group-listing-limit 1000
462 "*A limit of the number of groups when listing.
463 If the number of groups is larger than the limit, list them in a
466 ;;; Internal variables
468 (defvar gnus-group-is-exiting-p nil)
469 (defvar gnus-group-is-exiting-without-update-p nil)
470 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
471 "Function for sorting the group buffer.")
473 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
474 "Function for sorting the selected groups in the group buffer.")
476 (defvar gnus-group-indentation-function nil)
477 (defvar gnus-goto-missing-group-function nil)
478 (defvar gnus-group-update-group-function nil)
479 (defvar gnus-group-goto-next-group-function nil
480 "Function to override finding the next group after listing groups.")
482 (defvar gnus-group-edit-buffer nil)
484 (defvar gnus-group-line-format-alist
485 `((?M gnus-tmp-marked-mark ?c)
486 (?S gnus-tmp-subscribed ?c)
487 (?L gnus-tmp-level ?d)
488 (?N (cond ((eq number t) "*" )
492 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
493 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
495 (?R gnus-tmp-number-of-read ?s)
496 (?U (gnus-number-of-unseen-articles-in-group gnus-tmp-group) ?d)
497 (?t gnus-tmp-number-total ?d)
498 (?y gnus-tmp-number-of-unread ?s)
499 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
500 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
501 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
502 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
503 (?g (if (boundp 'gnus-tmp-decoded-group)
504 gnus-tmp-decoded-group
507 (?G gnus-tmp-qualified-group ?s)
508 (?c (gnus-short-group-name (if (boundp 'gnus-tmp-decoded-group)
509 gnus-tmp-decoded-group
512 (?C gnus-tmp-comment ?s)
513 (?D gnus-tmp-newsgroup-description ?s)
514 (?o gnus-tmp-moderated ?c)
515 (?O gnus-tmp-moderated-string ?s)
516 (?p gnus-tmp-process-marked ?c)
517 (?s gnus-tmp-news-server ?s)
518 (?n ,(if (featurep 'xemacs)
519 '(symbol-name gnus-tmp-news-method)
520 'gnus-tmp-news-method)
522 (?P gnus-group-indentation ?s)
523 (?E gnus-tmp-group-icon ?s)
524 (?B gnus-tmp-summary-live ?c)
525 (?z gnus-tmp-news-method-string ?s)
526 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
527 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
528 (?u gnus-tmp-user-defined ?s)
529 (?F (gnus-total-fetched-for gnus-tmp-group) ?s)
532 (defvar gnus-group-mode-line-format-alist
533 `((?S gnus-tmp-news-server ?s)
534 (?M gnus-tmp-news-method ?s)
535 (?u gnus-tmp-user-defined ?s)
536 (?: gnus-tmp-colon ?s)))
538 (defvar gnus-topic-topology nil
539 "The complete topic hierarchy.")
541 (defvar gnus-topic-alist nil
542 "The complete topic-group alist.")
544 (defvar gnus-group-marked nil)
546 (defvar gnus-group-list-mode nil)
549 (defvar gnus-group-icon-cache nil)
551 (defvar gnus-group-listed-groups nil)
552 (defvar gnus-group-list-option nil)
558 (put 'gnus-group-mode 'mode-class 'special)
560 (gnus-define-keys gnus-group-mode-map
561 " " gnus-group-read-group
562 "=" gnus-group-select-group
563 "\r" gnus-group-select-group
564 "\M-\r" gnus-group-quick-select-group
565 "\M- " gnus-group-visible-select-group
566 [(meta control return)] gnus-group-select-group-ephemerally
567 "j" gnus-group-jump-to-group
568 "n" gnus-group-next-unread-group
569 "p" gnus-group-prev-unread-group
570 "\177" gnus-group-prev-unread-group
571 [delete] gnus-group-prev-unread-group
572 [backspace] gnus-group-prev-unread-group
573 "N" gnus-group-next-group
574 "P" gnus-group-prev-group
575 "\M-n" gnus-group-next-unread-group-same-level
576 "\M-p" gnus-group-prev-unread-group-same-level
577 "," gnus-group-best-unread-group
578 "." gnus-group-first-unread-group
579 "u" gnus-group-unsubscribe-current-group
580 "U" gnus-group-unsubscribe-group
581 "c" gnus-group-catchup-current
582 "C" gnus-group-catchup-current-all
583 "\M-c" gnus-group-clear-data
584 "l" gnus-group-list-groups
585 "L" gnus-group-list-all-groups
588 "g" gnus-group-get-new-news
589 "\M-g" gnus-group-get-new-news-this-group
590 "R" gnus-group-restart
591 "r" gnus-group-read-init-file
592 "B" gnus-group-browse-foreign-server
593 "b" gnus-group-check-bogus-groups
594 "F" gnus-group-find-new-groups
595 "\C-c\C-d" gnus-group-describe-group
596 "\M-d" gnus-group-describe-all-groups
597 "\C-c\C-a" gnus-group-apropos
598 "\C-c\M-\C-a" gnus-group-description-apropos
599 "a" gnus-group-post-news
600 "\ek" gnus-group-edit-local-kill
601 "\eK" gnus-group-edit-global-kill
602 "\C-k" gnus-group-kill-group
603 "\C-y" gnus-group-yank-group
604 "\C-w" gnus-group-kill-region
605 "\C-x\C-t" gnus-group-transpose-groups
606 "\C-c\C-l" gnus-group-list-killed
607 "\C-c\C-x" gnus-group-expire-articles
608 "\C-c\M-\C-x" gnus-group-expire-all-groups
610 "s" gnus-group-save-newsrc
611 "z" gnus-group-suspend
614 "?" gnus-group-describe-briefly
615 "\C-c\C-i" gnus-info-find-node
616 "\M-e" gnus-group-edit-group-method
617 "^" gnus-group-enter-server-mode
618 gnus-mouse-2 gnus-mouse-pick-group
619 [follow-link] mouse-face
620 "<" beginning-of-buffer
623 "\C-c\C-s" gnus-group-sort-groups
625 "\C-c\M-g" gnus-activate-all-groups
626 "\M-&" gnus-group-universal-argument
627 "#" gnus-group-mark-group
628 "\M-#" gnus-group-unmark-group)
630 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
631 "m" gnus-group-mark-group
632 "u" gnus-group-unmark-group
633 "w" gnus-group-mark-region
634 "b" gnus-group-mark-buffer
635 "r" gnus-group-mark-regexp
636 "U" gnus-group-unmark-all-groups)
638 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
639 "u" gnus-sieve-update
640 "g" gnus-sieve-generate)
642 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
643 "d" gnus-group-make-directory-group
644 "h" gnus-group-make-help-group
645 "u" gnus-group-make-useful-group
646 "a" gnus-group-make-archive-group
647 "k" gnus-group-make-kiboze-group
648 "l" gnus-group-nnimap-edit-acl
649 "m" gnus-group-make-group
650 "E" gnus-group-edit-group
651 "e" gnus-group-edit-group-method
652 "p" gnus-group-edit-group-parameters
653 "v" gnus-group-add-to-virtual
654 "V" gnus-group-make-empty-virtual
655 "D" gnus-group-enter-directory
656 "f" gnus-group-make-doc-group
657 "w" gnus-group-make-web-group
658 "M" gnus-group-read-ephemeral-group
659 "r" gnus-group-rename-group
660 "R" gnus-group-make-rss-group
661 "c" gnus-group-customize
662 "z" gnus-group-compact-group
663 "x" gnus-group-nnimap-expunge
664 "\177" gnus-group-delete-group
665 [delete] gnus-group-delete-group)
667 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
668 "b" gnus-group-brew-soup
669 "w" gnus-soup-save-areas
670 "s" gnus-soup-send-replies
671 "p" gnus-soup-pack-packet
672 "r" nnsoup-pack-replies)
674 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
675 "s" gnus-group-sort-groups
676 "a" gnus-group-sort-groups-by-alphabet
677 "u" gnus-group-sort-groups-by-unread
678 "l" gnus-group-sort-groups-by-level
679 "v" gnus-group-sort-groups-by-score
680 "r" gnus-group-sort-groups-by-rank
681 "m" gnus-group-sort-groups-by-method
682 "n" gnus-group-sort-groups-by-real-name)
684 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
685 "s" gnus-group-sort-selected-groups
686 "a" gnus-group-sort-selected-groups-by-alphabet
687 "u" gnus-group-sort-selected-groups-by-unread
688 "l" gnus-group-sort-selected-groups-by-level
689 "v" gnus-group-sort-selected-groups-by-score
690 "r" gnus-group-sort-selected-groups-by-rank
691 "m" gnus-group-sort-selected-groups-by-method
692 "n" gnus-group-sort-selected-groups-by-real-name)
694 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
695 "k" gnus-group-list-killed
696 "z" gnus-group-list-zombies
697 "s" gnus-group-list-groups
698 "u" gnus-group-list-all-groups
699 "A" gnus-group-list-active
700 "a" gnus-group-apropos
701 "d" gnus-group-description-apropos
702 "m" gnus-group-list-matching
703 "M" gnus-group-list-all-matching
704 "l" gnus-group-list-level
705 "c" gnus-group-list-cached
706 "?" gnus-group-list-dormant)
708 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
709 "k" gnus-group-list-limit
710 "z" gnus-group-list-limit
711 "s" gnus-group-list-limit
712 "u" gnus-group-list-limit
713 "A" gnus-group-list-limit
714 "m" gnus-group-list-limit
715 "M" gnus-group-list-limit
716 "l" gnus-group-list-limit
717 "c" gnus-group-list-limit
718 "?" gnus-group-list-limit)
720 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
721 "k" gnus-group-list-flush
722 "z" gnus-group-list-flush
723 "s" gnus-group-list-flush
724 "u" gnus-group-list-flush
725 "A" gnus-group-list-flush
726 "m" gnus-group-list-flush
727 "M" gnus-group-list-flush
728 "l" gnus-group-list-flush
729 "c" gnus-group-list-flush
730 "?" gnus-group-list-flush)
732 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
733 "k" gnus-group-list-plus
734 "z" gnus-group-list-plus
735 "s" gnus-group-list-plus
736 "u" gnus-group-list-plus
737 "A" gnus-group-list-plus
738 "m" gnus-group-list-plus
739 "M" gnus-group-list-plus
740 "l" gnus-group-list-plus
741 "c" gnus-group-list-plus
742 "?" gnus-group-list-plus)
744 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
745 "f" gnus-score-flush-cache
746 "e" gnus-score-edit-all-score)
748 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
749 "c" gnus-group-fetch-charter
750 "C" gnus-group-fetch-control
751 "d" gnus-group-describe-group
752 "f" gnus-group-fetch-faq
755 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
756 "l" gnus-group-set-current-level
757 "t" gnus-group-unsubscribe-current-group
758 "s" gnus-group-unsubscribe-group
759 "k" gnus-group-kill-group
760 "y" gnus-group-yank-group
761 "w" gnus-group-kill-region
762 "\C-k" gnus-group-kill-level
763 "z" gnus-group-kill-all-zombies)
765 (defun gnus-topic-mode-p ()
766 "Return non-nil in `gnus-topic-mode'."
767 (and (boundp 'gnus-topic-mode)
768 (symbol-value 'gnus-topic-mode)))
770 (defun gnus-group-make-menu-bar ()
771 (gnus-turn-off-edit-menu 'group)
772 (unless (boundp 'gnus-group-reading-menu)
775 gnus-group-reading-menu gnus-group-mode-map ""
777 ["Read" gnus-group-read-group
778 :included (not (gnus-topic-mode-p))
779 :active (gnus-group-group-name)]
780 ["Read " gnus-topic-read-group
781 :included (gnus-topic-mode-p)]
782 ["Select" gnus-group-select-group
783 :included (not (gnus-topic-mode-p))
784 :active (gnus-group-group-name)]
785 ["Select " gnus-topic-select-group
786 :included (gnus-topic-mode-p)]
787 ["See old articles" (gnus-group-select-group 'all)
788 :keys "C-u SPC" :active (gnus-group-group-name)]
789 ["Catch up" gnus-group-catchup-current
790 :included (not (gnus-topic-mode-p))
791 :active (gnus-group-group-name)
792 ,@(if (featurep 'xemacs) nil
793 '(:help "Mark unread articles in the current group as read"))]
794 ["Catch up " gnus-topic-catchup-articles
795 :included (gnus-topic-mode-p)
796 ,@(if (featurep 'xemacs) nil
797 '(:help "Mark unread articles in the current group or topic as read"))]
798 ["Catch up all articles" gnus-group-catchup-current-all
799 (gnus-group-group-name)]
800 ["Check for new articles" gnus-group-get-new-news-this-group
801 :included (not (gnus-topic-mode-p))
802 :active (gnus-group-group-name)
803 ,@(if (featurep 'xemacs) nil
804 '(:help "Check for new messages in current group"))]
805 ["Check for new articles " gnus-topic-get-new-news-this-topic
806 :included (gnus-topic-mode-p)
807 ,@(if (featurep 'xemacs) nil
808 '(:help "Check for new messages in current group or topic"))]
809 ["Toggle subscription" gnus-group-unsubscribe-current-group
810 (gnus-group-group-name)]
811 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
812 ,@(if (featurep 'xemacs) nil
813 '(:help "Kill (remove) current group"))]
814 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
815 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
816 ,@(if (featurep 'xemacs) nil
817 '(:help "Display description of the current group"))]
818 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
819 ["Fetch charter" gnus-group-fetch-charter
820 :active (gnus-group-group-name)
821 ,@(if (featurep 'xemacs) nil
822 '(:help "Display the charter of the current group"))]
823 ["Fetch control message" gnus-group-fetch-control
824 :active (gnus-group-group-name)
825 ,@(if (featurep 'xemacs) nil
826 '(:help "Display the archived control message for the current group"))]
827 ;; Actually one should check, if any of the marked groups gives t for
828 ;; (gnus-check-backend-function 'request-expire-articles ...)
829 ["Expire articles" gnus-group-expire-articles
830 :included (not (gnus-topic-mode-p))
831 :active (or (and (gnus-group-group-name)
832 (gnus-check-backend-function
833 'request-expire-articles
834 (gnus-group-group-name))) gnus-group-marked)]
835 ["Expire articles " gnus-topic-expire-articles
836 :included (gnus-topic-mode-p)]
837 ["Set group level..." gnus-group-set-current-level
838 (gnus-group-group-name)]
839 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
840 ["Customize" gnus-group-customize (gnus-group-group-name)]
841 ["Compact" gnus-group-compact-group
842 :active (gnus-group-group-name)]
844 ["Parameters" gnus-group-edit-group-parameters
845 :included (not (gnus-topic-mode-p))
846 :active (gnus-group-group-name)]
847 ["Parameters " gnus-topic-edit-parameters
848 :included (gnus-topic-mode-p)]
849 ["Select method" gnus-group-edit-group-method
850 (gnus-group-group-name)]
851 ["Info" gnus-group-edit-group (gnus-group-group-name)]
852 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
853 ["Global kill file" gnus-group-edit-global-kill t])))
856 gnus-group-group-menu gnus-group-mode-map ""
859 ["List unread subscribed groups" gnus-group-list-groups t]
860 ["List (un)subscribed groups" gnus-group-list-all-groups t]
861 ["List killed groups" gnus-group-list-killed gnus-killed-list]
862 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
863 ["List level..." gnus-group-list-level t]
864 ["Describe all groups" gnus-group-describe-all-groups t]
865 ["Group apropos..." gnus-group-apropos t]
866 ["Group and description apropos..." gnus-group-description-apropos t]
867 ["List groups matching..." gnus-group-list-matching t]
868 ["List all groups matching..." gnus-group-list-all-matching t]
869 ["List active file" gnus-group-list-active t]
870 ["List groups with cached" gnus-group-list-cached t]
871 ["List groups with dormant" gnus-group-list-dormant t])
873 ["Default sort" gnus-group-sort-groups t]
874 ["Sort by method" gnus-group-sort-groups-by-method t]
875 ["Sort by rank" gnus-group-sort-groups-by-rank t]
876 ["Sort by score" gnus-group-sort-groups-by-score t]
877 ["Sort by level" gnus-group-sort-groups-by-level t]
878 ["Sort by unread" gnus-group-sort-groups-by-unread t]
879 ["Sort by name" gnus-group-sort-groups-by-alphabet t]
880 ["Sort by real name" gnus-group-sort-groups-by-real-name t])
881 ("Sort process/prefixed"
882 ["Default sort" gnus-group-sort-selected-groups
883 (not (gnus-topic-mode-p))]
884 ["Sort by method" gnus-group-sort-selected-groups-by-method
885 (not (gnus-topic-mode-p))]
886 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
887 (not (gnus-topic-mode-p))]
888 ["Sort by score" gnus-group-sort-selected-groups-by-score
889 (not (gnus-topic-mode-p))]
890 ["Sort by level" gnus-group-sort-selected-groups-by-level
891 (not (gnus-topic-mode-p))]
892 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
893 (not (gnus-topic-mode-p))]
894 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
895 (not (gnus-topic-mode-p))]
896 ["Sort by real name" gnus-group-sort-selected-groups-by-real-name
897 (not (gnus-topic-mode-p))])
899 ["Mark group" gnus-group-mark-group
900 (and (gnus-group-group-name)
901 (not (memq (gnus-group-group-name) gnus-group-marked)))]
902 ["Unmark group" gnus-group-unmark-group
903 (and (gnus-group-group-name)
904 (memq (gnus-group-group-name) gnus-group-marked))]
905 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
906 ["Mark regexp..." gnus-group-mark-regexp t]
907 ["Mark region" gnus-group-mark-region :active (gnus-mark-active-p)]
908 ["Mark buffer" gnus-group-mark-buffer t]
909 ["Execute command" gnus-group-universal-argument
910 (or gnus-group-marked (gnus-group-group-name))])
912 ["Subscribe to a group..." gnus-group-unsubscribe-group t]
913 ["Kill all newsgroups in region" gnus-group-kill-region
914 :active (gnus-mark-active-p)]
915 ["Kill all zombie groups" gnus-group-kill-all-zombies
917 ["Kill all groups on level..." gnus-group-kill-level t])
919 ["Make a foreign group..." gnus-group-make-group t]
920 ["Add a directory group..." gnus-group-make-directory-group t]
921 ["Add the help group" gnus-group-make-help-group t]
922 ["Add the archive group" gnus-group-make-archive-group t]
923 ["Make a doc group..." gnus-group-make-doc-group t]
924 ["Make a web group..." gnus-group-make-web-group t]
925 ["Make a kiboze group..." gnus-group-make-kiboze-group t]
926 ["Make a virtual group..." gnus-group-make-empty-virtual t]
927 ["Add a group to a virtual..." gnus-group-add-to-virtual t]
928 ["Make an ephemeral group..." gnus-group-read-ephemeral-group t]
929 ["Make an RSS group..." gnus-group-make-rss-group t]
930 ["Rename group..." gnus-group-rename-group
931 (gnus-check-backend-function
932 'request-rename-group (gnus-group-group-name))]
933 ["Delete group" gnus-group-delete-group
934 (gnus-check-backend-function
935 'request-delete-group (gnus-group-group-name))])
937 ["Next" gnus-group-next-group t]
938 ["Previous" gnus-group-prev-group t]
939 ["Next unread" gnus-group-next-unread-group t]
940 ["Previous unread" gnus-group-prev-unread-group t]
941 ["Next unread same level" gnus-group-next-unread-group-same-level t]
942 ["Previous unread same level"
943 gnus-group-prev-unread-group-same-level t]
944 ["Jump to group..." gnus-group-jump-to-group t]
945 ["First unread group" gnus-group-first-unread-group t]
946 ["Best unread group" gnus-group-best-unread-group t])
948 ["Generate" gnus-sieve-generate t]
949 ["Generate and update" gnus-sieve-update t])
950 ["Delete bogus groups" gnus-group-check-bogus-groups t]
951 ["Find new newsgroups" gnus-group-find-new-groups t]
952 ["Transpose" gnus-group-transpose-groups
953 (gnus-group-group-name)]
954 ["Read a directory as a group..." gnus-group-enter-directory t]))
957 gnus-group-misc-menu gnus-group-mode-map ""
960 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
961 ["Send replies" gnus-soup-send-replies
962 (fboundp 'gnus-soup-pack-packet)]
963 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
964 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
965 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
966 ["Send a mail" gnus-group-mail t]
967 ["Send a message (mail or news)" gnus-group-post-news t]
968 ["Create a local message" gnus-group-news t]
969 ["Check for new news" gnus-group-get-new-news
970 ,@(if (featurep 'xemacs) '(t)
971 '(:help "Get newly arrived articles"))
973 ["Send queued messages" gnus-delay-send-queue
974 ,@(if (featurep 'xemacs) '(t)
975 '(:help "Send all messages that are scheduled to be sent now"))
977 ["Activate all groups" gnus-activate-all-groups t]
978 ["Restart Gnus" gnus-group-restart t]
979 ["Read init file" gnus-group-read-init-file t]
980 ["Browse foreign server..." gnus-group-browse-foreign-server t]
981 ["Enter server buffer" gnus-group-enter-server-mode t]
982 ["Expire all expirable articles" gnus-group-expire-all-groups t]
983 ["Generate any kiboze groups" nnkiboze-generate-groups t]
984 ["Gnus version" gnus-version t]
985 ["Save .newsrc files" gnus-group-save-newsrc t]
986 ["Suspend Gnus" gnus-group-suspend t]
987 ["Clear dribble buffer" gnus-group-clear-dribble t]
988 ["Read manual" gnus-info-find-node t]
989 ["Flush score cache" gnus-score-flush-cache t]
990 ["Toggle topics" gnus-topic-mode t]
991 ["Send a bug report" gnus-bug t]
992 ["Exit from Gnus" gnus-group-exit
993 ,@(if (featurep 'xemacs) '(t)
994 '(:help "Quit reading news"))]
995 ["Exit without saving" gnus-group-quit t]))
997 (gnus-run-hooks 'gnus-group-menu-hook)))
1000 (defvar gnus-group-tool-bar-map nil)
1002 (defun gnus-group-tool-bar-update (&optional symbol value)
1003 "Update group buffer toolbar.
1004 Setter function for custom variables."
1006 (set-default symbol value))
1007 ;; (setq-default gnus-group-tool-bar-map nil)
1008 ;; (use-local-map gnus-group-mode-map)
1009 (when (gnus-alive-p)
1010 (with-current-buffer gnus-group-buffer
1011 (gnus-group-make-tool-bar t))))
1013 (defcustom gnus-group-tool-bar (if (eq gmm-tool-bar-style 'gnome)
1014 'gnus-group-tool-bar-gnome
1015 'gnus-group-tool-bar-retro)
1016 "Specifies the Gnus group tool bar.
1018 It can be either a list or a symbol refering to a list. See
1019 `gmm-tool-bar-from-list' for the format of the list. The
1020 default key map is `gnus-group-mode-map'.
1022 Pre-defined symbols include `gnus-group-tool-bar-gnome' and
1023 `gnus-group-tool-bar-retro'."
1024 :type '(choice (const :tag "GNOME style" gnus-group-tool-bar-gnome)
1025 (const :tag "Retro look" gnus-group-tool-bar-retro)
1026 (repeat :tag "User defined list" gmm-tool-bar-item)
1028 :version "23.0" ;; No Gnus
1029 :initialize 'custom-initialize-default
1030 :set 'gnus-group-tool-bar-update
1033 (defcustom gnus-group-tool-bar-gnome
1034 '((gnus-group-post-news "mail/compose")
1035 ;; Some useful agent icons? I don't use the agent so agent users should
1036 ;; suggest useful commands:
1037 (gnus-agent-toggle-plugged "connect" t
1038 :visible (and gnus-agent (not gnus-plugged)))
1039 (gnus-agent-toggle-plugged "disconnect" t
1040 :visible (and gnus-agent gnus-plugged))
1041 ;; FIXME: gnus-agent-toggle-plugged (in gnus-agent-group-make-menu-bar)
1042 ;; should have a better help text.
1043 (gnus-group-send-queue "mail/outbox" t
1044 :visible (and gnus-agent gnus-plugged)
1045 :help "Send articles from the queue group")
1046 (gnus-group-get-new-news "mail/inbox" nil
1047 :visible (or (not gnus-agent)
1049 ;; FIXME: gnus-*-read-group should have a better help text.
1050 (gnus-topic-read-group "open" nil
1051 :visible (and (boundp 'gnus-topic-mode)
1053 (gnus-group-read-group "open" nil
1054 :visible (not (and (boundp 'gnus-topic-mode)
1056 ;; (gnus-group-find-new-groups "???" nil)
1057 (gnus-group-save-newsrc "save")
1058 (gnus-group-describe-group "describe")
1059 (gnus-group-unsubscribe-current-group "gnus/toggle-subscription")
1060 (gnus-group-prev-unread-group "left-arrow")
1061 (gnus-group-next-unread-group "right-arrow")
1062 (gnus-group-exit "exit")
1063 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
1064 (gnus-info-find-node "help"))
1065 "List of functions for the group tool bar (GNOME style).
1067 See `gmm-tool-bar-from-list' for the format of the list."
1068 :type '(repeat gmm-tool-bar-item)
1069 :version "23.0" ;; No Gnus
1070 :initialize 'custom-initialize-default
1071 :set 'gnus-group-tool-bar-update
1074 (defcustom gnus-group-tool-bar-retro
1075 '((gnus-group-get-new-news "gnus/get-news")
1076 (gnus-group-get-new-news-this-group "gnus/gnntg")
1077 (gnus-group-catchup-current "gnus/catchup")
1078 (gnus-group-describe-group "gnus/describe-group")
1079 (gnus-group-subscribe "gnus/subscribe" t
1080 :help "Subscribe to the current group")
1081 (gnus-group-unsubscribe "gnus/unsubscribe" t
1082 :help "Unsubscribe from the current group")
1083 (gnus-group-exit "gnus/exit-gnus" gnus-group-mode-map))
1084 "List of functions for the group tool bar (retro look).
1086 See `gmm-tool-bar-from-list' for the format of the list."
1087 :type '(repeat gmm-tool-bar-item)
1088 :version "23.0" ;; No Gnus
1089 :initialize 'custom-initialize-default
1090 :set 'gnus-group-tool-bar-update
1093 (defcustom gnus-group-tool-bar-zap-list t
1094 "List of icon items from the global tool bar.
1095 These items are not displayed in the Gnus group mode tool bar.
1097 See `gmm-tool-bar-from-list' for the format of the list."
1098 :type 'gmm-tool-bar-zap-list
1099 :version "23.0" ;; No Gnus
1100 :initialize 'custom-initialize-default
1101 :set 'gnus-group-tool-bar-update
1104 (defvar image-load-path)
1106 (defun gnus-group-make-tool-bar (&optional force)
1107 "Make a group mode tool bar from `gnus-group-tool-bar'.
1108 When FORCE, rebuild the tool bar."
1109 (when (and (not (featurep 'xemacs))
1110 (boundp 'tool-bar-mode)
1112 ;; The Gnus 5.10.6 code checked (default-value 'tool-bar-mode).
1114 (or (not gnus-group-tool-bar-map) force))
1116 (gmm-image-load-path-for-library "gnus"
1117 "gnus/toggle-subscription.xpm"
1119 (image-load-path (cons (car load-path)
1120 (when (boundp 'image-load-path)
1122 (map (gmm-tool-bar-from-list gnus-group-tool-bar
1123 gnus-group-tool-bar-zap-list
1124 'gnus-group-mode-map)))
1126 (set (make-local-variable 'tool-bar-map) map))))
1127 gnus-group-tool-bar-map)
1129 (defun gnus-group-mode ()
1130 "Major mode for reading news.
1132 All normal editing commands are switched off.
1133 \\<gnus-group-mode-map>
1134 The group buffer lists (some of) the groups available. For instance,
1135 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
1136 lists all zombie groups.
1138 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
1139 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
1141 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
1143 The following commands are available:
1145 \\{gnus-group-mode-map}"
1147 (kill-all-local-variables)
1148 (when (gnus-visual-p 'group-menu 'menu)
1149 (gnus-group-make-menu-bar)
1150 (gnus-group-make-tool-bar))
1151 (gnus-simplify-mode-line)
1152 (setq major-mode 'gnus-group-mode)
1153 (setq mode-name "Group")
1154 (gnus-group-set-mode-line)
1155 (setq mode-line-process nil)
1156 (use-local-map gnus-group-mode-map)
1157 (buffer-disable-undo)
1158 (setq truncate-lines t)
1159 (setq buffer-read-only t
1160 show-trailing-whitespace nil)
1161 (gnus-set-default-directory)
1162 (gnus-update-format-specifications nil 'group 'group-mode)
1163 (gnus-update-group-mark-positions)
1168 (gnus-run-mode-hooks 'gnus-group-mode-hook))
1170 (defun gnus-update-group-mark-positions ()
1172 (let ((gnus-process-mark ?\200)
1173 (gnus-group-update-hook nil)
1174 (gnus-group-marked '("dummy.group"))
1175 (gnus-active-hashtb (make-vector 10 0))
1177 (gnus-set-active "dummy.group" '(0 . 0))
1178 (gnus-set-work-buffer)
1179 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
1180 (goto-char (point-min))
1181 (setq gnus-group-mark-positions
1182 (list (cons 'process (and (search-forward
1183 (mm-string-as-multibyte "\200") nil t)
1184 (- (point) 2))))))))
1186 (defun gnus-mouse-pick-group (e)
1187 "Enter the group under the mouse pointer."
1190 (gnus-group-read-group nil))
1192 ;; Look at LEVEL and find out what the level is really supposed to be.
1193 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
1194 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
1195 (defun gnus-group-default-level (&optional level number-or-nil)
1197 (gnus-group-use-permanent-levels
1198 (or (setq gnus-group-use-permanent-levels
1199 (or level (if (numberp gnus-group-use-permanent-levels)
1200 gnus-group-use-permanent-levels
1201 (or gnus-group-default-list-level
1202 gnus-level-subscribed))))
1203 gnus-group-default-list-level gnus-level-subscribed))
1207 (or level gnus-group-default-list-level gnus-level-subscribed))))
1209 (defun gnus-group-setup-buffer ()
1210 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1211 (unless (eq major-mode 'gnus-group-mode)
1214 (gnus-carpal-setup-buffer 'group))))
1216 (defun gnus-group-name-charset (method group)
1218 (setq method (gnus-find-method-for-group group)))
1219 (let ((item (assoc method gnus-group-name-charset-method-alist))
1220 (alist gnus-group-name-charset-group-alist)
1224 (while (setq item (pop alist))
1225 (if (string-match (car item) group)
1227 result (cdr item))))
1230 (defun gnus-group-name-decode (string charset)
1231 ;; Fixme: Don't decode in unibyte mode.
1232 (if (and string charset (featurep 'mule))
1233 (mm-decode-coding-string string charset)
1236 (defun gnus-group-decoded-name (string)
1237 (let ((charset (gnus-group-name-charset nil string)))
1238 (gnus-group-name-decode string charset)))
1240 (defun gnus-group-list-groups (&optional level unread lowest)
1241 "List newsgroups with level LEVEL or lower that have unread articles.
1242 Default is all subscribed groups.
1243 If argument UNREAD is non-nil, groups with no unread articles are also
1246 Also see the `gnus-group-use-permanent-levels' variable."
1248 (list (if current-prefix-arg
1249 (prefix-numeric-value current-prefix-arg)
1251 (gnus-group-default-level nil t)
1252 gnus-group-default-list-level
1253 gnus-level-subscribed))))
1255 (setq level (car gnus-group-list-mode)
1256 unread (cdr gnus-group-list-mode)))
1257 (setq level (gnus-group-default-level level))
1258 (gnus-group-setup-buffer)
1259 (gnus-update-format-specifications nil 'group 'group-mode)
1260 (let ((case-fold-search nil)
1261 (props (text-properties-at (point-at-bol)))
1262 (empty (= (point-min) (point-max)))
1263 (group (gnus-group-group-name))
1265 (set-buffer gnus-group-buffer)
1266 (setq number (funcall gnus-group-prepare-function level unread lowest))
1267 (when (or (and (numberp number)
1269 (zerop (buffer-size)))
1270 ;; No groups in the buffer.
1271 (gnus-message 5 gnus-no-groups-message))
1272 ;; We have some groups displayed.
1273 (goto-char (point-max))
1274 (when (or (not gnus-group-goto-next-group-function)
1275 (not (funcall gnus-group-goto-next-group-function
1279 (goto-char (point-min)))
1281 ;; Go to the first group with unread articles.
1282 (gnus-group-search-forward t))
1284 ;; Find the right group to put point on. If the current group
1285 ;; has disappeared in the new listing, try to find the next
1286 ;; one. If no next one can be found, just leave point at the
1287 ;; first newsgroup in the buffer.
1288 (when (not (gnus-goto-char
1290 (point-min) (point-max)
1291 'gnus-group (gnus-intern-safe
1292 group gnus-active-hashtb))))
1293 (let ((newsrc (cdddr (gnus-group-entry group))))
1295 (not (gnus-goto-char
1297 (point-min) (point-max) 'gnus-group
1299 (caar newsrc) gnus-active-hashtb)))))
1300 (setq newsrc (cdr newsrc)))
1302 (goto-char (point-max))
1303 (forward-line -1)))))))
1304 ;; Adjust cursor point.
1305 (gnus-group-position-point)))
1307 (defun gnus-group-list-level (level &optional all)
1308 "List groups on LEVEL.
1309 If ALL (the prefix), also list groups that have no unread articles."
1310 (interactive "nList groups on level: \nP")
1311 (gnus-group-list-groups level all level))
1313 (defun gnus-group-prepare-logic (group test)
1314 (or (and gnus-group-listed-groups
1315 (null gnus-group-list-option)
1316 (member group gnus-group-listed-groups))
1318 ((null gnus-group-listed-groups) test)
1319 ((null gnus-group-list-option) test)
1320 (t (and (member group gnus-group-listed-groups)
1321 (if (eq gnus-group-list-option 'flush)
1325 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
1326 "List all newsgroups with unread articles of level LEVEL or lower.
1327 If PREDICATE is a function, list groups that the function returns non-nil;
1328 if it is t, list groups that have no unread articles.
1329 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1330 If REGEXP is a function, list dead groups that the function returns non-nil;
1331 if it is a string, only list groups matching REGEXP."
1332 (set-buffer gnus-group-buffer)
1333 (let ((buffer-read-only nil)
1334 (newsrc (cdr gnus-newsrc-alist))
1335 (lowest (or lowest 1))
1336 (not-in-list (and gnus-group-listed-groups
1337 (copy-sequence gnus-group-listed-groups)))
1338 info clevel unread group params)
1340 (when (or (< lowest gnus-level-zombie)
1341 gnus-group-listed-groups)
1342 ;; List living groups.
1344 (setq info (car newsrc)
1345 group (gnus-info-group info)
1346 params (gnus-info-params info)
1348 unread (gnus-group-unread group))
1350 (setq not-in-list (delete group not-in-list)))
1351 (when (gnus-group-prepare-logic
1353 (and unread ; This group might be unchecked
1354 (or (not (stringp regexp))
1355 (string-match regexp group))
1356 (<= (setq clevel (gnus-info-level info)) level)
1359 ((functionp predicate)
1360 (funcall predicate info))
1361 (predicate t) ; We list all groups?
1364 (if (eq unread t) ; Unactivated?
1365 gnus-group-list-inactive-groups
1366 ; We list unactivated
1368 ; We list groups with unread articles
1369 (and gnus-list-groups-with-ticked-articles
1370 (cdr (assq 'tick (gnus-info-marks info))))
1371 ; And groups with tickeds
1372 ;; Check for permanent visibility.
1373 (and gnus-permanently-visible-groups
1374 (string-match gnus-permanently-visible-groups
1376 (memq 'visible params)
1377 (cdr (assq 'visible params)))))))
1378 (gnus-group-insert-group-line
1379 group (gnus-info-level info)
1380 (gnus-info-marks info) unread (gnus-info-method info)))))
1382 ;; List dead groups.
1383 (when (or gnus-group-listed-groups
1384 (and (>= level gnus-level-zombie)
1385 (<= lowest gnus-level-zombie)))
1386 (gnus-group-prepare-flat-list-dead
1387 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1388 gnus-level-zombie ?Z
1391 (dolist (group gnus-zombie-list)
1392 (setq not-in-list (delete group not-in-list))))
1393 (when (or gnus-group-listed-groups
1394 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
1395 (gnus-group-prepare-flat-list-dead
1398 (setq gnus-killed-list (sort gnus-killed-list 'string<)))
1399 gnus-level-killed ?K regexp))
1401 (gnus-group-set-mode-line)
1402 (setq gnus-group-list-mode (cons level predicate))
1403 (gnus-run-hooks 'gnus-group-prepare-hook)
1406 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1407 ;; List zombies and killed lists somewhat faster, which was
1408 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1409 ;; this by ignoring the group format specification altogether.
1411 (if (> (length groups) gnus-group-listing-limit)
1413 (setq group (pop groups))
1414 (when (gnus-group-prepare-logic
1417 (and (stringp regexp) (string-match regexp group))
1418 (and (functionp regexp) (funcall regexp group))))
1419 (gnus-add-text-properties
1420 (point) (prog1 (1+ (point))
1421 (insert " " mark " *: "
1422 (gnus-group-decoded-name group)
1424 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1426 'gnus-level level))))
1428 (setq group (pop groups))
1429 (when (gnus-group-prepare-logic
1432 (and (stringp regexp) (string-match regexp group))
1433 (and (functionp regexp) (funcall regexp group))))
1434 (gnus-group-insert-group-line
1436 (let ((active (gnus-active group)))
1438 (if (zerop (cdr active))
1440 (- (1+ (cdr active)) (car active)))
1442 (gnus-method-simplify (gnus-find-method-for-group group))))))))
1444 (defun gnus-group-update-group-line ()
1445 "Update the current line in the group buffer."
1446 (let* ((buffer-read-only nil)
1447 (group (gnus-group-group-name))
1448 (entry (and group (gnus-group-entry group)))
1449 gnus-group-indentation)
1452 (not (gnus-ephemeral-group-p group))
1454 (concat "(gnus-group-set-info '"
1455 (gnus-prin1-to-string (nth 2 entry))
1457 (setq gnus-group-indentation (gnus-group-group-indentation))
1459 (gnus-group-insert-group-line-info group)
1461 (gnus-group-position-point))))
1463 (defun gnus-group-insert-group-line-info (group)
1464 "Insert GROUP on the current line."
1465 (let ((entry (gnus-group-entry group))
1466 (gnus-group-indentation (gnus-group-group-indentation))
1470 ;; (Un)subscribed group.
1471 (setq info (nth 2 entry))
1472 (gnus-group-insert-group-line
1473 group (gnus-info-level info) (gnus-info-marks info)
1474 (or (car entry) t) (gnus-info-method info)))
1475 ;; This group is dead.
1476 (gnus-group-insert-group-line
1478 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1480 (if (setq active (gnus-active group))
1481 (if (zerop (cdr active))
1483 (- (1+ (cdr active)) (car active)))
1485 (gnus-method-simplify (gnus-find-method-for-group group))))))
1487 (defun gnus-number-of-unseen-articles-in-group (group)
1488 (let* ((info (nth 2 (gnus-group-entry group)))
1489 (marked (gnus-info-marks info))
1490 (seen (cdr (assq 'seen marked)))
1491 (active (gnus-active group)))
1494 (length (gnus-uncompress-range
1495 (gnus-range-difference
1496 (gnus-range-difference (list active) (gnus-info-read info))
1499 ;; Moving through the Group buffer (in topic mode) e.g. with C-n doesn't
1500 ;; update the state (enabled/disabled) of the icon `gnus-group-describe-group'
1501 ;; automatically. After `C-l' the state is correct. See the following report
1503 ;; <http://thread.gmane.org/v9acdmrcse.fsf@marauder.physik.uni-ulm.de>:
1504 ;; From: Reiner Steib
1505 ;; Subject: tool bar icons not updated according to :active condition
1506 ;; Newsgroups: gmane.emacs.devel
1507 ;; Date: Mon, 23 Jan 2006 19:59:13 +0100
1508 ;; Message-ID: <v9acdmrcse.fsf@marauder.physik.uni-ulm.de>
1510 (defcustom gnus-group-update-tool-bar
1511 (and (not (featurep 'xemacs))
1512 (boundp 'tool-bar-mode)
1514 ;; Using `redraw-frame' (see `gnus-tool-bar-update') in Emacs 21 might
1515 ;; be confusing, so maybe we shouldn't call it by default.
1516 (fboundp 'force-window-update))
1517 "Force updating the group buffer tool bar."
1520 :initialize 'custom-initialize-default
1521 :set (lambda (symbol value)
1522 (set-default symbol value)
1523 (when (gnus-alive-p)
1524 (with-current-buffer gnus-group-buffer
1525 ;; FIXME: Is there a better way to redraw the group buffer?
1526 (gnus-group-get-new-news 0))))
1529 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1530 gnus-tmp-marked number
1532 "Insert a group line in the group buffer."
1533 (let* ((gnus-tmp-method
1534 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1535 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1537 (gnus-tmp-active (gnus-active gnus-tmp-group))
1538 (gnus-tmp-number-total
1540 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1542 (gnus-tmp-number-of-unread
1543 (if (numberp number) (int-to-string (max 0 number))
1545 (gnus-tmp-number-of-read
1546 (if (numberp number)
1547 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1549 (gnus-tmp-subscribed
1550 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1551 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1552 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1554 (gnus-tmp-qualified-group
1555 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
1556 group-name-charset))
1558 (or (gnus-group-get-parameter gnus-tmp-group 'comment t)
1560 (gnus-tmp-newsgroup-description
1561 (if gnus-description-hashtb
1562 (or (gnus-group-name-decode
1563 (gnus-gethash gnus-tmp-group gnus-description-hashtb)
1564 group-name-charset) "")
1567 (if (and gnus-moderated-hashtb
1568 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
1570 (gnus-tmp-moderated-string
1571 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1572 (gnus-tmp-group-icon "==&&==")
1573 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1574 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1575 (gnus-tmp-news-method-string
1577 (format "(%s:%s)" (car gnus-tmp-method)
1578 (cadr gnus-tmp-method)) ""))
1579 (gnus-tmp-marked-mark
1580 (if (and (numberp number)
1582 (cdr (assq 'tick gnus-tmp-marked)))
1584 (gnus-tmp-summary-live
1585 (if (and (not gnus-group-is-exiting-p)
1586 (gnus-buffer-live-p (gnus-summary-buffer-name
1589 (gnus-tmp-process-marked
1590 (if (member gnus-tmp-group gnus-group-marked)
1591 gnus-process-mark ? ))
1592 (buffer-read-only nil)
1594 header gnus-tmp-header) ; passed as parameter to user-funcs.
1597 (gnus-add-text-properties
1601 (let ((gnus-tmp-decoded-group (gnus-group-name-decode
1602 gnus-tmp-group group-name-charset)))
1603 (eval gnus-group-line-format-spec)))
1604 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1605 gnus-unread ,(if (numberp number)
1606 (string-to-number gnus-tmp-number-of-unread)
1608 gnus-marked ,gnus-tmp-marked-mark
1609 gnus-indentation ,gnus-group-indentation
1610 gnus-level ,gnus-tmp-level))
1612 (when gnus-group-update-tool-bar
1613 (gnus-put-text-property beg end 'point-entered
1614 'gnus-tool-bar-update)
1615 (gnus-put-text-property beg end 'point-left
1616 'gnus-tool-bar-update))
1618 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1619 (gnus-run-hooks 'gnus-group-update-hook))
1621 ;; Allow XEmacs to remove front-sticky text properties.
1622 (gnus-group-remove-excess-properties)))
1624 (defun gnus-group-highlight-line ()
1625 "Highlight the current line according to `gnus-group-highlight'."
1626 (let* ((list gnus-group-highlight)
1628 (end (point-at-eol))
1629 ;; now find out where the line starts and leave point there.
1630 (beg (progn (beginning-of-line) (point)))
1631 (group (gnus-group-group-name))
1632 (entry (gnus-group-entry group))
1633 (unread (if (numberp (car entry)) (car entry) 0))
1634 (active (gnus-active group))
1635 (total (if active (1+ (- (cdr active) (car active))) 0))
1636 (info (nth 2 entry))
1637 (method (inline (gnus-server-get-method group (gnus-info-method info))))
1638 (marked (gnus-info-marks info))
1639 (mailp (apply 'append
1642 (memq x (assoc (symbol-name
1643 (car (or method gnus-select-method)))
1644 gnus-valid-select-methods)))
1645 '(mail post-mail))))
1646 (level (or (gnus-info-level info) gnus-level-killed))
1647 (score (or (gnus-info-score info) 0))
1648 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1649 (group-age (gnus-group-timestamp-delta group))
1650 (inhibit-read-only t))
1651 ;; Eval the cars of the lists until we find a match.
1653 (not (eval (caar list))))
1654 (setq list (cdr list)))
1655 (let ((face (cdar list)))
1656 (unless (eq face (get-text-property beg 'face))
1657 (gnus-put-text-property-excluding-characters-with-faces
1659 (setq face (if (boundp face) (symbol-value face) face)))
1660 (gnus-extent-start-open beg)))
1663 (defun gnus-group-update-group (group &optional visible-only)
1664 "Update all lines where GROUP appear.
1665 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1667 ;; Can't use `save-excursion' here, so we do it manually.
1668 (let ((buf (current-buffer))
1670 (set-buffer gnus-group-buffer)
1671 (setq mark (point-marker))
1672 ;; The buffer may be narrowed.
1675 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1677 found buffer-read-only)
1678 ;; Enter the current status into the dribble buffer.
1679 (let ((entry (gnus-group-entry group)))
1681 (not (gnus-ephemeral-group-p group)))
1683 (concat "(gnus-group-set-info '"
1684 (gnus-prin1-to-string (nth 2 entry))
1686 ;; Find all group instances. If topics are in use, each group
1687 ;; may be listed in more than once.
1688 (while (setq loc (text-property-any
1689 loc (point-max) 'gnus-group ident))
1692 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1694 (gnus-group-insert-group-line-info group)
1697 (gnus-run-hooks 'gnus-group-update-group-hook)))
1698 (setq loc (1+ loc)))
1699 (unless (or found visible-only)
1700 ;; No such line in the buffer, find out where it's supposed to
1701 ;; go, and insert it there (or at the end of the buffer).
1702 (if gnus-goto-missing-group-function
1703 (funcall gnus-goto-missing-group-function group)
1704 (let ((entry (cddr (gnus-group-entry group))))
1705 (while (and entry (car entry)
1709 (point-min) (point-max)
1710 'gnus-group (gnus-intern-safe
1711 (caar entry) gnus-active-hashtb)))))
1712 (setq entry (cdr entry)))
1713 (or entry (goto-char (point-max)))))
1714 ;; Finally insert the line.
1715 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1716 (gnus-group-insert-group-line-info group)
1719 (gnus-run-hooks 'gnus-group-update-group-hook))))
1720 (when gnus-group-update-group-function
1721 (funcall gnus-group-update-group-function group))
1722 (gnus-group-set-mode-line)))
1724 (set-marker mark nil)
1727 (defun gnus-group-set-mode-line ()
1728 "Update the mode line in the group buffer."
1729 (when (memq 'group gnus-updated-mode-lines)
1730 ;; Yes, we want to keep this mode line updated.
1732 (set-buffer gnus-group-buffer)
1733 (let* ((gformat (or gnus-group-mode-line-format-spec
1734 (gnus-set-format 'group-mode)))
1735 (gnus-tmp-news-server (cadr gnus-select-method))
1736 (gnus-tmp-news-method (car gnus-select-method))
1737 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1739 gnus-tmp-header ;Dummy binding for user-defined formats
1740 ;; Get the resulting string.
1742 (and gnus-dribble-buffer
1743 (buffer-name gnus-dribble-buffer)
1744 (buffer-modified-p gnus-dribble-buffer)
1746 (set-buffer gnus-dribble-buffer)
1747 (not (zerop (buffer-size))))))
1748 (mode-string (eval gformat)))
1749 ;; Say whether the dribble buffer has been modified.
1750 (setq mode-line-modified
1751 (if modified (car gnus-mode-line-modified)
1752 (cdr gnus-mode-line-modified)))
1753 ;; If the line is too long, we chop it off.
1754 (when (> (length mode-string) max-len)
1755 (setq mode-string (substring mode-string 0 (- max-len 4))))
1757 (setq mode-line-buffer-identification
1758 (gnus-mode-line-buffer-identification
1759 (list mode-string)))
1760 (set-buffer-modified-p modified))))))
1762 (defun gnus-group-group-name ()
1763 "Get the name of the newsgroup on the current line."
1764 (let ((group (get-text-property (point-at-bol) 'gnus-group)))
1766 (symbol-name group))))
1768 (defun gnus-group-group-level ()
1769 "Get the level of the newsgroup on the current line."
1770 (get-text-property (point-at-bol) 'gnus-level))
1772 (defun gnus-group-group-indentation ()
1773 "Get the indentation of the newsgroup on the current line."
1774 (or (get-text-property (point-at-bol) 'gnus-indentation)
1775 (and gnus-group-indentation-function
1776 (funcall gnus-group-indentation-function))
1779 (defun gnus-group-group-unread ()
1780 "Get the number of unread articles of the newsgroup on the current line."
1781 (get-text-property (point-at-bol) 'gnus-unread))
1783 (defun gnus-group-new-mail (group)
1784 (if (nnmail-new-mail-p (gnus-group-real-name group))
1788 (defun gnus-group-level (group)
1789 "Return the estimated level of GROUP."
1790 (or (gnus-info-level (gnus-get-info group))
1791 (and (member group gnus-zombie-list) gnus-level-zombie)
1794 (defun gnus-group-search-forward (&optional backward all level first-too)
1795 "Find the next newsgroup with unread articles.
1796 If BACKWARD is non-nil, find the previous newsgroup instead.
1797 If ALL is non-nil, just find any newsgroup.
1798 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1800 If FIRST-TOO, the current line is also eligible as a target."
1801 (let ((way (if backward -1 1))
1802 (low gnus-level-killed)
1805 (if (and backward (progn (beginning-of-line)) (bobp))
1814 (get-text-property (point) 'gnus-group)
1818 (get-text-property (point) 'gnus-unread)))
1819 (and (numberp unread) (> unread 0)))
1820 (setq lev (get-text-property (point)
1822 (<= lev gnus-level-subscribed)))
1824 (and (setq lev (get-text-property (point)
1833 (zerop (forward-line way)))))
1835 (progn (gnus-group-position-point) t)
1836 (goto-char (or pos beg))
1839 (defun gnus-total-fetched-for (group)
1840 (let* ((size-in-cache (or (gnus-cache-total-fetched-for group) 0))
1841 (size-in-agent (or (gnus-agent-total-fetched-for group) 0))
1842 (size (+ size-in-cache size-in-agent))
1843 (suffix '("B" "K" "M" "G"))
1846 (while (> size cutoff)
1847 (setq size (/ size scale)
1848 suffix (cdr suffix)))
1849 (format "%5.1f%s" size (car suffix))))
1851 ;;; Gnus group mode commands
1855 (defun gnus-group-mark-line-p ()
1858 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1859 (eq (char-after) gnus-process-mark)))
1861 (defun gnus-group-mark-group (n &optional unmark no-advance)
1862 "Mark the current group."
1864 (let ((buffer-read-only nil)
1868 (when (setq group (gnus-group-group-name))
1869 ;; Go to the mark position.
1871 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1875 (setq gnus-group-marked (delete group gnus-group-marked))
1876 (insert-char ? 1 t))
1877 (setq gnus-group-marked
1878 (cons group (delete group gnus-group-marked)))
1879 (insert-char gnus-process-mark 1 t)))
1881 (gnus-group-next-group 1))
1883 (gnus-summary-position-point)
1886 (defun gnus-group-unmark-group (n)
1887 "Remove the mark from the current group."
1889 (gnus-group-mark-group n 'unmark)
1890 (gnus-group-position-point))
1892 (defun gnus-group-unmark-all-groups ()
1893 "Unmark all groups."
1896 (mapc 'gnus-group-remove-mark gnus-group-marked))
1897 (gnus-group-position-point))
1899 (defun gnus-group-mark-region (unmark beg end)
1900 "Mark all groups between point and mark.
1901 If UNMARK, remove the mark instead."
1902 (interactive "P\nr")
1903 (let ((num (count-lines beg end)))
1906 (- num (gnus-group-mark-group num unmark)))))
1908 (defun gnus-group-mark-buffer (&optional unmark)
1909 "Mark all groups in the buffer.
1910 If UNMARK, remove the mark instead."
1912 (gnus-group-mark-region unmark (point-min) (point-max)))
1914 (defun gnus-group-mark-regexp (regexp)
1915 "Mark all groups that match some regexp."
1916 (interactive "sMark (regexp): ")
1917 (let ((alist (cdr gnus-newsrc-alist))
1921 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1922 (gnus-group-jump-to-group group)
1923 (gnus-group-set-mark group)))))
1924 (gnus-group-position-point))
1926 (defun gnus-group-remove-mark (group &optional test-marked)
1927 "Remove the process mark from GROUP and move point there.
1928 Return nil if the group isn't displayed."
1929 (if (gnus-group-goto-group group nil test-marked)
1931 (gnus-group-mark-group 1 'unmark t)
1933 (setq gnus-group-marked
1934 (delete group gnus-group-marked))
1937 (defun gnus-group-set-mark (group)
1938 "Set the process mark on GROUP."
1939 (if (gnus-group-goto-group group)
1941 (gnus-group-mark-group 1 nil t))
1942 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1944 (defun gnus-group-universal-argument (arg &optional groups func)
1945 "Perform any command on all groups according to the process/prefix convention."
1947 (if (eq (setq func (or func
1950 (substitute-command-keys
1951 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1953 (gnus-error 1 "Undefined key")
1954 (gnus-group-iterate arg
1956 (command-execute func))))
1957 (gnus-group-position-point))
1959 (defun gnus-group-process-prefix (n)
1960 "Return a list of groups to work on.
1961 Take into consideration N (the prefix) and the list of marked groups."
1964 (setq n (prefix-numeric-value n))
1965 ;; There is a prefix, so we return a list of the N next
1967 (let ((way (if (< n 0) -1 1))
1972 (if (setq group (gnus-group-group-name))
1973 (push group groups))
1975 (gnus-group-next-group way)))
1977 ((and (gnus-region-active-p) (mark))
1978 ;; Work on the region between point and mark.
1979 (let ((max (max (point) (mark)))
1982 (goto-char (min (point) (mark)))
1985 (push (gnus-group-group-name) groups)
1986 (zerop (gnus-group-next-group 1))
1988 (nreverse groups))))
1990 ;; No prefix, but a list of marked articles.
1991 (reverse gnus-group-marked))
1993 ;; Neither marked articles or a prefix, so we return the
1995 (let ((group (gnus-group-group-name)))
1996 (and group (list group))))))
1998 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1999 ;;; imagine why I went through these contortions...
2001 (let ((function (make-symbol "gnus-group-iterate-function"))
2002 (window (make-symbol "gnus-group-iterate-window"))
2003 (groups (make-symbol "gnus-group-iterate-groups"))
2004 (group (make-symbol "gnus-group-iterate-group")))
2006 `(defun gnus-group-iterate (arg ,function)
2007 "Iterate FUNCTION over all process/prefixed groups.
2008 FUNCTION will be called with the group name as the parameter
2009 and with point over the group in question."
2010 (let ((,groups (gnus-group-process-prefix arg))
2011 (,window (selected-window))
2014 (setq ,group (car ,groups)
2015 ,groups (cdr ,groups))
2016 (select-window ,window)
2017 (gnus-group-remove-mark ,group)
2018 (save-selected-window
2020 (funcall ,function ,group)))))))))
2022 (put 'gnus-group-iterate 'lisp-indent-function 1)
2024 ;; Selecting groups.
2026 (defun gnus-group-read-group (&optional all no-article group select-articles)
2027 "Read news in this newsgroup.
2028 If the prefix argument ALL is non-nil, already read articles become
2029 readable. IF ALL is a number, fetch this number of articles. If the
2030 optional argument NO-ARTICLE is non-nil, no article will be
2031 auto-selected upon group entry. If GROUP is non-nil, fetch that
2034 (let ((no-display (eq all 0))
2035 (group (or group (gnus-group-group-name)))
2036 number active marked entry)
2040 (error "No group on current line"))
2041 (setq marked (gnus-info-marks
2042 (nth 2 (setq entry (gnus-group-entry group)))))
2043 ;; This group might be a dead group. In that case we have to get
2044 ;; the number of unread articles from `gnus-active-hashtb'.
2046 (cond ((numberp all) all)
2048 ((setq active (gnus-active group))
2049 (- (1+ (cdr active)) (car active)))))
2050 (gnus-summary-read-group
2051 group (or all (and (numberp number)
2052 (zerop (+ number (gnus-range-length
2053 (cdr (assq 'tick marked)))
2055 (cdr (assq 'dormant marked)))))))
2056 no-article nil no-display nil select-articles)))
2058 (defun gnus-group-select-group (&optional all)
2059 "Select this newsgroup.
2060 No article is selected automatically.
2061 If the group is opened, just switch the summary buffer.
2062 If ALL is non-nil, already read articles become readable.
2063 If ALL is a positive number, fetch this number of the latest
2064 articles in the group.
2065 If ALL is a negative number, fetch this number of the earliest
2066 articles in the group."
2068 (when (and (eobp) (not (gnus-group-group-name)))
2070 (gnus-group-read-group all t))
2072 (defun gnus-group-quick-select-group (&optional all group)
2073 "Select the GROUP \"quickly\".
2074 This means that no highlighting or scoring will be performed. If
2075 ALL (the prefix argument) is 0, don't even generate the summary
2076 buffer. If GROUP is nil, use current group.
2078 This might be useful if you want to toggle threading
2079 before entering the group."
2081 (require 'gnus-score)
2083 gnus-score-find-score-files-function
2084 gnus-home-score-file
2085 gnus-apply-kill-hook
2086 gnus-summary-expunge-below)
2087 (gnus-group-read-group all t group)))
2089 (defun gnus-group-visible-select-group (&optional all)
2090 "Select the current group without hiding any articles."
2092 (let ((gnus-inhibit-limiting t))
2093 (gnus-group-read-group all t)))
2095 (defun gnus-group-select-group-ephemerally ()
2096 "Select the current group without doing any processing whatsoever.
2097 You will actually be entered into a group that's a copy of
2098 the current group; no changes you make while in this group will
2101 (require 'gnus-score)
2103 gnus-score-find-score-files-function gnus-apply-kill-hook
2104 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
2105 gnus-summary-mode-hook gnus-select-group-hook
2106 (group (gnus-group-group-name))
2107 (method (gnus-find-method-for-group group)))
2108 (gnus-group-read-ephemeral-group
2109 (gnus-group-prefixed-name group method) method)))
2111 (defun group-name-at-point ()
2112 (let ((regexp "[^-a-zA-Z+.:_]"))
2116 (re-search-backward regexp nil t)
2120 (re-search-forward regexp nil t)
2125 (defun gnus-fetch-group (group &optional articles)
2126 "Start Gnus if necessary and enter GROUP.
2127 If ARTICLES, display those articles.
2128 Returns whether the fetching was successful or not."
2129 (interactive (list (completing-read "Group name: " gnus-active-hashtb
2131 (group-name-at-point))))
2132 (unless (get-buffer gnus-group-buffer)
2134 (gnus-group-read-group (if articles nil t) nil group articles))
2137 (defun gnus-fetch-group-other-frame (group)
2138 "Pop up a frame and enter GROUP."
2140 (let ((window (get-buffer-window gnus-group-buffer)))
2142 (select-frame (window-frame window)))
2143 ((= (length (frame-list)) 1)
2144 (select-frame (make-frame)))
2147 (gnus-fetch-group group))
2149 (defvar gnus-ephemeral-group-server 0)
2151 (defcustom gnus-large-ephemeral-newsgroup 200
2152 "The number of articles which indicates a large ephemeral newsgroup.
2153 Same as `gnus-large-newsgroup', but only used for ephemeral newsgroups.
2155 If the number of articles in a newsgroup is greater than this value,
2156 confirmation is required for selecting the newsgroup. If it is nil, no
2157 confirmation is required."
2159 :group 'gnus-group-select
2160 :type '(choice (const :tag "No limit" nil)
2163 (defcustom gnus-fetch-old-ephemeral-headers nil
2164 "Same as `gnus-fetch-old-headers', but only used for ephemeral newsgroups."
2167 :type '(choice (const :tag "off" nil)
2170 (sexp :menu-tag "other" t)))
2172 ;; Enter a group that is not in the group buffer. Non-nil is returned
2173 ;; if selection was successful.
2174 (defun gnus-group-read-ephemeral-group (group method &optional activate
2175 quit-config request-only
2179 "Read GROUP from METHOD as an ephemeral group.
2180 If ACTIVATE, request the group first.
2181 If QUIT-CONFIG, use that window configuration when exiting from the
2183 If REQUEST-ONLY, don't actually read the group; just request it.
2184 If SELECT-ARTICLES, only select those articles.
2185 If PARAMETERS, use those as the group parameters.
2186 If NUMBER, fetch this number of articles.
2188 Return the name of the group if selection was successful."
2191 ;; (gnus-read-group "Group name: ")
2193 "Group: " gnus-active-hashtb
2195 'gnus-group-history)
2196 (gnus-read-method "From method: ")))
2197 ;; Transform the select method into a unique server.
2198 (when (stringp method)
2199 (setq method (gnus-server-to-method method)))
2201 `(,(car method) ,(concat (cadr method) "-ephemeral")
2202 (,(intern (format "%s-address" (car method))) ,(cadr method))
2204 (let ((group (if (gnus-group-foreign-p group) group
2205 (gnus-group-prefixed-name (gnus-group-real-name group)
2210 ,gnus-level-default-subscribed nil nil ,method
2213 (cons 'quit-config quit-config)
2215 (cons gnus-summary-buffer
2216 gnus-current-window-configuration)))
2219 (push method gnus-ephemeral-servers)
2220 (set-buffer gnus-group-buffer)
2221 (unless (gnus-check-server method)
2222 (error "Unable to contact server: %s" (gnus-status-message method)))
2224 (gnus-activate-group group 'scan)
2225 (unless (gnus-request-group group)
2226 (error "Couldn't request group: %s"
2227 (nnheader-get-report (car method)))))
2231 (when (let ((gnus-large-newsgroup gnus-large-ephemeral-newsgroup)
2232 (gnus-fetch-old-headers
2233 gnus-fetch-old-ephemeral-headers))
2234 (gnus-group-read-group (or number t) t group select-articles))
2238 (message "Quit reading the ephemeral group")