1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
42 (defcustom gnus-group-archive-directory
43 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
44 "*The address of the (ding) archives."
45 :group 'gnus-group-foreign
48 (defcustom gnus-group-recent-archive-directory
49 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
50 "*The address of the most recent (ding) articles."
51 :group 'gnus-group-foreign
54 (defcustom gnus-no-groups-message "No gnus is bad 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
71 :group 'gnus-group-levels
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."
78 :link '(custom-manual "(gnus)Group Maneuvering")
79 :group 'gnus-group-various
82 (defcustom gnus-goto-next-group-when-activating t
83 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
84 :link '(custom-manual "(gnus)Scanning New Messages")
85 :group 'gnus-group-various
88 (defcustom gnus-permanently-visible-groups nil
89 "*Regexp to match groups that should always be listed in the group buffer.
90 This means that they will still be listed even when there are no
91 unread articles in the groups.
93 If nil, no groups are permanently visible."
94 :group 'gnus-group-listing
95 :type '(choice regexp (const nil)))
97 (defcustom gnus-list-groups-with-ticked-articles t
98 "*If non-nil, list groups that have only ticked articles.
99 If nil, only list groups that have unread articles."
100 :group 'gnus-group-listing
103 (defcustom gnus-group-default-list-level gnus-level-subscribed
104 "*Default listing level.
105 Ignored if `gnus-group-use-permanent-levels' is non-nil."
106 :group 'gnus-group-listing
109 (defcustom gnus-group-list-inactive-groups t
110 "*If non-nil, inactive groups will be listed."
111 :group 'gnus-group-listing
112 :group 'gnus-group-levels
115 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
116 "*Function used for sorting the group buffer.
117 This function will be called with group info entries as the arguments
118 for the groups to be sorted. Pre-made functions include
119 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
120 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
121 `gnus-group-sort-by-score', `gnus-group-sort-by-method',
122 `gnus-group-sort-by-server', and `gnus-group-sort-by-rank'.
124 This variable can also be a list of sorting functions. In that case,
125 the most significant sort function should be the last function in the
127 :group 'gnus-group-listing
128 :link '(custom-manual "(gnus)Sorting Groups")
129 :type '(radio (function-item gnus-group-sort-by-alphabet)
130 (function-item gnus-group-sort-by-real-name)
131 (function-item gnus-group-sort-by-unread)
132 (function-item gnus-group-sort-by-level)
133 (function-item gnus-group-sort-by-score)
134 (function-item gnus-group-sort-by-method)
135 (function-item gnus-group-sort-by-server)
136 (function-item gnus-group-sort-by-rank)
137 (function :tag "other" nil)))
139 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y: %(%g%)%l\n"
140 "*Format of group lines.
141 It works along the same lines as a normal formatting string,
142 with some simple extensions.
144 %M Only marked articles (character, \"*\" or \" \")
145 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
146 %L Level of subscribedness (integer)
147 %N Number of unread articles (integer)
148 %I Number of dormant articles (integer)
149 %i Number of ticked and dormant (integer)
150 %T Number of ticked articles (integer)
151 %R Number of read articles (integer)
152 %t Estimated total number of articles (integer)
153 %y Number of unread, unticked articles (integer)
154 %G Group name (string)
155 %g Qualified group name (string)
156 %D Group description (string)
157 %s Select method (string)
158 %o Moderated group (char, \"m\")
159 %p Process mark (char)
160 %O Moderated group (string, \"(m)\" or \"\")
161 %P Topic indentation (string)
162 %m Whether there is new(ish) mail in the group (char, \"%\")
163 %w Number of new(ish) mails in the group (integer)
164 %l Whether there are GroupLens predictions for this group (string)
165 %n Select from where (string)
166 %z A string that look like `<%s:%n>' if a foreign select method is used
167 %d The date the group was last entered.
168 %E Icon as defined by `gnus-group-icon-list'.
169 %u User defined specifier. The next character in the format string should
170 be a letter. Gnus will call the function gnus-user-format-function-X,
171 where X is the letter following %u. The function will be passed the
172 current header as argument. The function should return a string, which
173 will be inserted into the buffer just like information from any other
176 Text between %( and %) will be highlighted with `gnus-mouse-face' when
177 the mouse point move inside the area. There can only be one such area.
179 Note that this format specification is not always respected. For
180 reasons of efficiency, when listing killed groups, this specification
181 is ignored altogether. If the spec is changed considerably, your
182 output may end up looking strange when listing both alive and killed
185 If you use %o or %O, reading the active file will be slower and quite
186 a bit of extra memory will be used. %D will also worsen performance.
187 Also note that if you change the format specification to include any
188 of these specs, you must probably re-start Gnus to see them go into
190 :group 'gnus-group-visual
193 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
194 "*The format specification for the group mode line.
195 It works along the same lines as a normal formatting string,
196 with some simple extensions:
198 %S The native news server.
199 %M The native select method.
200 %: \":\" if %S isn't \"\"."
201 :group 'gnus-group-visual
204 (defcustom gnus-group-mode-hook nil
205 "Hook for Gnus group mode."
206 :group 'gnus-group-various
207 :options '(gnus-topic-mode)
210 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
211 (when (featurep 'xemacs)
212 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
213 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
215 (defcustom gnus-group-menu-hook nil
216 "Hook run after the creation of the group mode menu."
217 :group 'gnus-group-various
220 (defcustom gnus-group-catchup-group-hook nil
221 "Hook run when catching up a group from the group buffer."
222 :group 'gnus-group-various
223 :link '(custom-manual "(gnus)Group Data")
226 (defcustom gnus-group-update-group-hook nil
227 "Hook called when updating group lines."
228 :group 'gnus-group-visual
231 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
232 "*A function that is called to generate the group buffer.
233 The function is called with three arguments: The first is a number;
234 all group with a level less or equal to that number should be listed,
235 if the second is non-nil, empty groups should also be displayed. If
236 the third is non-nil, it is a number. No groups with a level lower
237 than this number should be displayed.
239 The only current function implemented is `gnus-group-prepare-flat'."
240 :group 'gnus-group-listing
243 (defcustom gnus-group-prepare-hook nil
244 "Hook called after the group buffer has been generated.
245 If you want to modify the group buffer, you can use this hook."
246 :group 'gnus-group-listing
249 (defcustom gnus-suspend-gnus-hook nil
250 "Hook called when suspending (not exiting) Gnus."
254 (defcustom gnus-exit-gnus-hook nil
255 "Hook called when exiting Gnus."
259 (defcustom gnus-after-exiting-gnus-hook nil
260 "Hook called after exiting Gnus."
264 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
265 "Hook called when a group line is changed.
266 The hook will not be called if `gnus-visual' is nil.
268 The default function `gnus-group-highlight-line' will
269 highlight the line according to the `gnus-group-highlight'
271 :group 'gnus-group-visual
274 (defcustom gnus-useful-groups
275 '(("(ding) mailing list mirrored at sunsite.auc.dk"
277 (nntp "sunsite.auc.dk"
278 (nntp-address "sunsite.auc.dk")))
281 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
285 (nndoc-article-type mbox)
286 (eval `(nndoc-address
287 ,(let ((file (nnheader-find-etc-directory
290 (error "Couldn't find doc group"))
292 "*Alist of useful group-server pairs."
293 :group 'gnus-group-listing
294 :type '(repeat (list (string :tag "Description")
296 (sexp :tag "Method"))))
298 (defcustom gnus-group-highlight
300 ((and mailp (= unread 0) (eq level 1)) .
301 gnus-group-mail-1-empty-face)
302 ((and mailp (eq level 1)) .
303 gnus-group-mail-1-face)
304 ((and mailp (= unread 0) (eq level 2)) .
305 gnus-group-mail-2-empty-face)
306 ((and mailp (eq level 2)) .
307 gnus-group-mail-2-face)
308 ((and mailp (= unread 0) (eq level 3)) .
309 gnus-group-mail-3-empty-face)
310 ((and mailp (eq level 3)) .
311 gnus-group-mail-3-face)
312 ((and mailp (= unread 0)) .
313 gnus-group-mail-low-empty-face)
315 gnus-group-mail-low-face)
317 ((and (= unread 0) (eq level 1)) .
318 gnus-group-news-1-empty-face)
319 ((and (eq level 1)) .
320 gnus-group-news-1-face)
321 ((and (= unread 0) (eq level 2)) .
322 gnus-group-news-2-empty-face)
323 ((and (eq level 2)) .
324 gnus-group-news-2-face)
325 ((and (= unread 0) (eq level 3)) .
326 gnus-group-news-3-empty-face)
327 ((and (eq level 3)) .
328 gnus-group-news-3-face)
329 ((and (= unread 0) (eq level 4)) .
330 gnus-group-news-4-empty-face)
331 ((and (eq level 4)) .
332 gnus-group-news-4-face)
333 ((and (= unread 0) (eq level 5)) .
334 gnus-group-news-5-empty-face)
335 ((and (eq level 5)) .
336 gnus-group-news-5-face)
337 ((and (= unread 0) (eq level 6)) .
338 gnus-group-news-6-empty-face)
339 ((and (eq level 6)) .
340 gnus-group-news-6-face)
341 ((and (= unread 0)) .
342 gnus-group-news-low-empty-face)
344 gnus-group-news-low-face))
345 "*Controls the highlighting of group buffer lines.
347 Below is a list of `Form'/`Face' pairs. When deciding how a a
348 particular group line should be displayed, each form is
349 evaluated. The content of the face field after the first true form is
350 used. You can change how those group lines are displayed by
351 editing the face field.
353 It is also possible to change and add form fields, but currently that
354 requires an understanding of Lisp expressions. Hopefully this will
355 change in a future release. For now, you can use the following
356 variables in the Lisp expression:
358 group: The name of the group.
359 unread: The number of unread articles in the group.
360 method: The select method used.
361 mailp: Whether it's a mail group or not.
362 level: The level of the group.
363 score: The score of the group.
364 ticked: The number of ticked articles."
365 :group 'gnus-group-visual
366 :type '(repeat (cons (sexp :tag "Form") face)))
368 (defcustom gnus-new-mail-mark ?%
369 "Mark used for groups with new mail."
370 :group 'gnus-group-visual
373 (defgroup gnus-group-icons nil
374 "Add Icons to your group buffer. "
375 :group 'gnus-group-visual)
377 (defcustom gnus-group-icon-list
379 "*Controls the insertion of icons into group buffer lines.
381 Below is a list of `Form'/`File' pairs. When deciding how a
382 particular group line should be displayed, each form is evaluated.
383 The icon from the file field after the first true form is used. You
384 can change how those group lines are displayed by editing the file
385 field. The File will either be found in the
386 `gnus-group-glyph-directory' or by designating absolute path to the
389 It is also possible to change and add form fields, but currently that
390 requires an understanding of Lisp expressions. Hopefully this will
391 change in a future release. For now, you can use the following
392 variables in the Lisp expression:
394 group: The name of the group.
395 unread: The number of unread articles in the group.
396 method: The select method used.
397 mailp: Whether it's a mail group or not.
398 newsp: Whether it's a news group or not
399 level: The level of the group.
400 score: The score of the group.
401 ticked: The number of ticked articles."
402 :group 'gnus-group-icons
403 :type '(repeat (cons (sexp :tag "Form") file)))
405 (defcustom gnus-group-name-charset-method-alist nil
406 "*Alist of method and the charset for group names.
409 (((nntp \"news.com.cn\") . cn-gb-2312))
413 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
415 (defcustom gnus-group-name-charset-group-alist nil
416 "*Alist of group regexp and the charset for group names.
419 ((\"\\.com\\.cn:\" . cn-gb-2312))
422 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
424 (defcustom gnus-group-jump-to-group-prompt nil
425 "Default prompt for `gnus-group-jump-to-group'.
426 If non-nil, the value should be a string, e.g. \"nnml:\",
427 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
428 in the minibuffer prompt."
429 :group 'gnus-group-various
430 :type '(choice (string :tag "Prompt string")
431 (const :tag "Empty" nil)))
433 (defvar gnus-group-listing-limit 1000
434 "*A limit of the number of groups when listing.
435 If the number of groups is larger than the limit, list them in a
438 ;;; Internal variables
440 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
441 "Function for sorting the group buffer.")
443 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
444 "Function for sorting the selected groups in the group buffer.")
446 (defvar gnus-group-indentation-function nil)
447 (defvar gnus-goto-missing-group-function nil)
448 (defvar gnus-group-update-group-function nil)
449 (defvar gnus-group-goto-next-group-function nil
450 "Function to override finding the next group after listing groups.")
452 (defvar gnus-group-edit-buffer nil)
454 (defvar gnus-group-line-format-alist
455 `((?M gnus-tmp-marked-mark ?c)
456 (?S gnus-tmp-subscribed ?c)
457 (?L gnus-tmp-level ?d)
458 (?N (cond ((eq number t) "*" )
462 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
463 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
465 (?R gnus-tmp-number-of-read ?s)
466 (?t gnus-tmp-number-total ?d)
467 (?y gnus-tmp-number-of-unread ?s)
468 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
469 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
470 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
471 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
472 (?g gnus-tmp-group ?s)
473 (?G gnus-tmp-qualified-group ?s)
474 (?c (gnus-short-group-name gnus-tmp-group) ?s)
475 (?D gnus-tmp-newsgroup-description ?s)
476 (?o gnus-tmp-moderated ?c)
477 (?O gnus-tmp-moderated-string ?s)
478 (?p gnus-tmp-process-marked ?c)
479 (?s gnus-tmp-news-server ?s)
480 (?n gnus-tmp-news-method ?s)
481 (?P gnus-group-indentation ?s)
482 (?E gnus-tmp-group-icon ?s)
483 (?l gnus-tmp-grouplens ?s)
484 (?z gnus-tmp-news-method-string ?s)
485 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
486 (?w (if (gnus-news-group-p gnus-tmp-group)
490 (nnmail-new-mail-numbers (gnus-group-real-name gnus-tmp-group))
493 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
494 (?u gnus-tmp-user-defined ?s)))
496 (defvar gnus-group-mode-line-format-alist
497 `((?S gnus-tmp-news-server ?s)
498 (?M gnus-tmp-news-method ?s)
499 (?u gnus-tmp-user-defined ?s)
500 (?: gnus-tmp-colon ?s)))
502 (defvar gnus-topic-topology nil
503 "The complete topic hierarchy.")
505 (defvar gnus-topic-alist nil
506 "The complete topic-group alist.")
508 (defvar gnus-group-marked nil)
510 (defvar gnus-group-list-mode nil)
513 (defvar gnus-group-icon-cache nil)
515 (defvar gnus-group-listed-groups nil)
516 (defvar gnus-group-list-option nil)
522 (put 'gnus-group-mode 'mode-class 'special)
525 (gnus-define-keys gnus-group-mode-map
526 " " gnus-group-read-group
527 "=" gnus-group-select-group
528 "\r" gnus-group-select-group
529 "\M-\r" gnus-group-quick-select-group
530 "\M- " gnus-group-visible-select-group
531 [(meta control return)] gnus-group-select-group-ephemerally
532 "j" gnus-group-jump-to-group
533 "n" gnus-group-next-unread-group
534 "p" gnus-group-prev-unread-group
535 "\177" gnus-group-prev-unread-group
536 [delete] gnus-group-prev-unread-group
537 [backspace] gnus-group-prev-unread-group
538 "N" gnus-group-next-group
539 "P" gnus-group-prev-group
540 "\M-n" gnus-group-next-unread-group-same-level
541 "\M-p" gnus-group-prev-unread-group-same-level
542 "," gnus-group-best-unread-group
543 "." gnus-group-first-unread-group
544 "u" gnus-group-unsubscribe-current-group
545 "U" gnus-group-unsubscribe-group
546 "c" gnus-group-catchup-current
547 "C" gnus-group-catchup-current-all
548 "\M-c" gnus-group-clear-data
549 "l" gnus-group-list-groups
550 "L" gnus-group-list-all-groups
552 "g" gnus-group-get-new-news
553 "\M-g" gnus-group-get-new-news-this-group
554 "R" gnus-group-restart
555 "r" gnus-group-read-init-file
556 "B" gnus-group-browse-foreign-server
557 "b" gnus-group-check-bogus-groups
558 "F" gnus-group-find-new-groups
559 "\C-c\C-d" gnus-group-describe-group
560 "\M-d" gnus-group-describe-all-groups
561 "\C-c\C-a" gnus-group-apropos
562 "\C-c\M-\C-a" gnus-group-description-apropos
563 "a" gnus-group-post-news
564 "\ek" gnus-group-edit-local-kill
565 "\eK" gnus-group-edit-global-kill
566 "\C-k" gnus-group-kill-group
567 "\C-y" gnus-group-yank-group
568 "\C-w" gnus-group-kill-region
569 "\C-x\C-t" gnus-group-transpose-groups
570 "\C-c\C-l" gnus-group-list-killed
571 "\C-c\C-x" gnus-group-expire-articles
572 "\C-c\M-\C-x" gnus-group-expire-all-groups
574 "s" gnus-group-save-newsrc
575 "z" gnus-group-suspend
578 "?" gnus-group-describe-briefly
579 "\C-c\C-i" gnus-info-find-node
580 "\M-e" gnus-group-edit-group-method
581 "^" gnus-group-enter-server-mode
582 gnus-mouse-2 gnus-mouse-pick-group
583 "<" beginning-of-buffer
586 "\C-c\C-s" gnus-group-sort-groups
588 "\C-c\M-g" gnus-activate-all-groups
589 "\M-&" gnus-group-universal-argument
590 "#" gnus-group-mark-group
591 "\M-#" gnus-group-unmark-group)
593 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
594 "m" gnus-group-mark-group
595 "u" gnus-group-unmark-group
596 "w" gnus-group-mark-region
597 "b" gnus-group-mark-buffer
598 "r" gnus-group-mark-regexp
599 "U" gnus-group-unmark-all-groups)
601 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
602 "d" gnus-group-make-directory-group
603 "h" gnus-group-make-help-group
604 "u" gnus-group-make-useful-group
605 "a" gnus-group-make-archive-group
606 "k" gnus-group-make-kiboze-group
607 "l" gnus-group-nnimap-edit-acl
608 "m" gnus-group-make-group
609 "E" gnus-group-edit-group
610 "e" gnus-group-edit-group-method
611 "p" gnus-group-edit-group-parameters
612 "v" gnus-group-add-to-virtual
613 "V" gnus-group-make-empty-virtual
614 "D" gnus-group-enter-directory
615 "f" gnus-group-make-doc-group
616 "w" gnus-group-make-web-group
617 "r" gnus-group-rename-group
618 "c" gnus-group-customize
619 "x" gnus-group-nnimap-expunge
620 "\177" gnus-group-delete-group
621 [delete] gnus-group-delete-group)
623 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
624 "b" gnus-group-brew-soup
625 "w" gnus-soup-save-areas
626 "s" gnus-soup-send-replies
627 "p" gnus-soup-pack-packet
628 "r" nnsoup-pack-replies)
630 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
631 "s" gnus-group-sort-groups
632 "a" gnus-group-sort-groups-by-alphabet
633 "u" gnus-group-sort-groups-by-unread
634 "l" gnus-group-sort-groups-by-level
635 "v" gnus-group-sort-groups-by-score
636 "r" gnus-group-sort-groups-by-rank
637 "m" gnus-group-sort-groups-by-method)
639 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
640 "s" gnus-group-sort-selected-groups
641 "a" gnus-group-sort-selected-groups-by-alphabet
642 "u" gnus-group-sort-selected-groups-by-unread
643 "l" gnus-group-sort-selected-groups-by-level
644 "v" gnus-group-sort-selected-groups-by-score
645 "r" gnus-group-sort-selected-groups-by-rank
646 "m" gnus-group-sort-selected-groups-by-method)
648 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
649 "k" gnus-group-list-killed
650 "z" gnus-group-list-zombies
651 "s" gnus-group-list-groups
652 "u" gnus-group-list-all-groups
653 "A" gnus-group-list-active
654 "a" gnus-group-apropos
655 "d" gnus-group-description-apropos
656 "m" gnus-group-list-matching
657 "M" gnus-group-list-all-matching
658 "l" gnus-group-list-level
659 "c" gnus-group-list-cached
660 "?" gnus-group-list-dormant)
662 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
663 "k" gnus-group-list-limit
664 "z" gnus-group-list-limit
665 "s" gnus-group-list-limit
666 "u" gnus-group-list-limit
667 "A" gnus-group-list-limit
668 "m" gnus-group-list-limit
669 "M" gnus-group-list-limit
670 "l" gnus-group-list-limit
671 "c" gnus-group-list-limit
672 "?" gnus-group-list-limit)
674 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
675 "k" gnus-group-list-flush
676 "z" gnus-group-list-flush
677 "s" gnus-group-list-flush
678 "u" gnus-group-list-flush
679 "A" gnus-group-list-flush
680 "m" gnus-group-list-flush
681 "M" gnus-group-list-flush
682 "l" gnus-group-list-flush
683 "c" gnus-group-list-flush
684 "?" gnus-group-list-flush)
686 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
687 "k" gnus-group-list-plus
688 "z" gnus-group-list-plus
689 "s" gnus-group-list-plus
690 "u" gnus-group-list-plus
691 "A" gnus-group-list-plus
692 "m" gnus-group-list-plus
693 "M" gnus-group-list-plus
694 "l" gnus-group-list-plus
695 "c" gnus-group-list-plus
696 "?" gnus-group-list-plus)
698 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
699 "f" gnus-score-flush-cache)
701 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
702 "d" gnus-group-describe-group
703 "f" gnus-group-fetch-faq
706 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
707 "l" gnus-group-set-current-level
708 "t" gnus-group-unsubscribe-current-group
709 "s" gnus-group-unsubscribe-group
710 "k" gnus-group-kill-group
711 "y" gnus-group-yank-group
712 "w" gnus-group-kill-region
713 "\C-k" gnus-group-kill-level
714 "z" gnus-group-kill-all-zombies))
716 (defun gnus-group-make-menu-bar ()
717 (gnus-turn-off-edit-menu 'group)
718 (unless (boundp 'gnus-group-reading-menu)
721 gnus-group-reading-menu gnus-group-mode-map ""
723 ["Read" gnus-group-read-group (gnus-group-group-name)]
724 ["Select" gnus-group-select-group (gnus-group-group-name)]
725 ["See old articles" (gnus-group-select-group 'all)
726 :keys "C-u SPC" :active (gnus-group-group-name)]
727 ["Catch up" gnus-group-catchup-current :active (gnus-group-group-name)
728 ,@(if (featurep 'xemacs) nil
729 '(:help "Mark unread articles in the current group as read"))]
730 ["Catch up all articles" gnus-group-catchup-current-all
731 (gnus-group-group-name)]
732 ["Check for new articles" gnus-group-get-new-news-this-group
733 :active (gnus-group-group-name)
734 ,@(if (featurep 'xemacs) nil
735 '(:help "Check for new messages in current group"))]
736 ["Toggle subscription" gnus-group-unsubscribe-current-group
737 (gnus-group-group-name)]
738 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
739 ,@(if (featurep 'xemacs) nil
740 '(:help "Kill (remove) current group"))]
741 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
742 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
743 ,@(if (featurep 'xemacs) nil
744 '(:help "Display description of the current group"))]
745 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
746 ;; Actually one should check, if any of the marked groups gives t for
747 ;; (gnus-check-backend-function 'request-expire-articles ...)
748 ["Expire articles" gnus-group-expire-articles
749 (or (and (gnus-group-group-name)
750 (gnus-check-backend-function
751 'request-expire-articles
752 (gnus-group-group-name))) gnus-group-marked)]
753 ["Set group level" gnus-group-set-current-level
754 (gnus-group-group-name)]
755 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
756 ["Customize" gnus-group-customize (gnus-group-group-name)]
758 ["Parameters" gnus-group-edit-group-parameters
759 (gnus-group-group-name)]
760 ["Select method" gnus-group-edit-group-method
761 (gnus-group-group-name)]
762 ["Info" gnus-group-edit-group (gnus-group-group-name)]
763 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
764 ["Global kill file" gnus-group-edit-global-kill t])))
767 gnus-group-group-menu gnus-group-mode-map ""
770 ["List unread subscribed groups" gnus-group-list-groups t]
771 ["List (un)subscribed groups" gnus-group-list-all-groups t]
772 ["List killed groups" gnus-group-list-killed gnus-killed-list]
773 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
774 ["List level..." gnus-group-list-level t]
775 ["Describe all groups" gnus-group-describe-all-groups t]
776 ["Group apropos..." gnus-group-apropos t]
777 ["Group and description apropos..." gnus-group-description-apropos t]
778 ["List groups matching..." gnus-group-list-matching t]
779 ["List all groups matching..." gnus-group-list-all-matching t]
780 ["List active file" gnus-group-list-active t]
781 ["List groups with cached" gnus-group-list-cached t]
782 ["List groups with dormant" gnus-group-list-dormant t])
784 ["Default sort" gnus-group-sort-groups t]
785 ["Sort by method" gnus-group-sort-groups-by-method t]
786 ["Sort by rank" gnus-group-sort-groups-by-rank t]
787 ["Sort by score" gnus-group-sort-groups-by-score t]
788 ["Sort by level" gnus-group-sort-groups-by-level t]
789 ["Sort by unread" gnus-group-sort-groups-by-unread t]
790 ["Sort by name" gnus-group-sort-groups-by-alphabet t])
791 ("Sort process/prefixed"
792 ["Default sort" gnus-group-sort-selected-groups
793 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
794 ["Sort by method" gnus-group-sort-selected-groups-by-method
795 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
796 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
797 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
798 ["Sort by score" gnus-group-sort-selected-groups-by-score
799 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
800 ["Sort by level" gnus-group-sort-selected-groups-by-level
801 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
802 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
803 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
804 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
805 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
807 ["Mark group" gnus-group-mark-group
808 (and (gnus-group-group-name)
809 (not (memq (gnus-group-group-name) gnus-group-marked)))]
810 ["Unmark group" gnus-group-unmark-group
811 (and (gnus-group-group-name)
812 (memq (gnus-group-group-name) gnus-group-marked))]
813 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
814 ["Mark regexp..." gnus-group-mark-regexp t]
815 ["Mark region" gnus-group-mark-region t]
816 ["Mark buffer" gnus-group-mark-buffer t]
817 ["Execute command" gnus-group-universal-argument
818 (or gnus-group-marked (gnus-group-group-name))])
820 ["Subscribe to a group" gnus-group-unsubscribe-group t]
821 ["Kill all newsgroups in region" gnus-group-kill-region t]
822 ["Kill all zombie groups" gnus-group-kill-all-zombies
824 ["Kill all groups on level..." gnus-group-kill-level t])
826 ["Make a foreign group" gnus-group-make-group t]
827 ["Add a directory group" gnus-group-make-directory-group t]
828 ["Add the help group" gnus-group-make-help-group t]
829 ["Add the archive group" gnus-group-make-archive-group t]
830 ["Make a doc group" gnus-group-make-doc-group t]
831 ["Make a web group" gnus-group-make-web-group t]
832 ["Make a kiboze group" gnus-group-make-kiboze-group t]
833 ["Make a virtual group" gnus-group-make-empty-virtual t]
834 ["Add a group to a virtual" gnus-group-add-to-virtual t]
835 ["Rename group" gnus-group-rename-group
836 (gnus-check-backend-function
837 'request-rename-group (gnus-group-group-name))]
838 ["Delete group" gnus-group-delete-group
839 (gnus-check-backend-function
840 'request-delete-group (gnus-group-group-name))])
842 ["Next" gnus-group-next-group t]
843 ["Previous" gnus-group-prev-group t]
844 ["Next unread" gnus-group-next-unread-group t]
845 ["Previous unread" gnus-group-prev-unread-group t]
846 ["Next unread same level" gnus-group-next-unread-group-same-level t]
847 ["Previous unread same level"
848 gnus-group-prev-unread-group-same-level t]
849 ["Jump to group" gnus-group-jump-to-group t]
850 ["First unread group" gnus-group-first-unread-group t]
851 ["Best unread group" gnus-group-best-unread-group t])
852 ["Delete bogus groups" gnus-group-check-bogus-groups t]
853 ["Find new newsgroups" gnus-group-find-new-groups t]
854 ["Transpose" gnus-group-transpose-groups
855 (gnus-group-group-name)]
856 ["Read a directory as a group..." gnus-group-enter-directory t]))
859 gnus-group-misc-menu gnus-group-mode-map ""
862 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
863 ["Send replies" gnus-soup-send-replies
864 (fboundp 'gnus-soup-pack-packet)]
865 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
866 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
867 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
868 ["Send a mail" gnus-group-mail t]
869 ["Post an article..." gnus-group-post-news t]
870 ["Check for new news" gnus-group-get-new-news
871 ,@(if (featurep 'xemacs) '(t)
872 '(:help "Get newly arrived articles"))
874 ["Activate all groups" gnus-activate-all-groups t]
875 ["Restart Gnus" gnus-group-restart t]
876 ["Read init file" gnus-group-read-init-file t]
877 ["Browse foreign server" gnus-group-browse-foreign-server t]
878 ["Enter server buffer" gnus-group-enter-server-mode t]
879 ["Expire all expirable articles" gnus-group-expire-all-groups t]
880 ["Generate any kiboze groups" nnkiboze-generate-groups t]
881 ["Gnus version" gnus-version t]
882 ["Save .newsrc files" gnus-group-save-newsrc t]
883 ["Suspend Gnus" gnus-group-suspend t]
884 ["Clear dribble buffer" gnus-group-clear-dribble t]
885 ["Read manual" gnus-info-find-node t]
886 ["Flush score cache" gnus-score-flush-cache t]
887 ["Toggle topics" gnus-topic-mode t]
888 ["Send a bug report" gnus-bug t]
889 ["Exit from Gnus" gnus-group-exit
890 ,@(if (featurep 'xemacs) '(t)
891 '(:help "Quit reading news"))]
892 ["Exit without saving" gnus-group-quit t]))
894 (gnus-run-hooks 'gnus-group-menu-hook)))
896 (defvar gnus-group-toolbar-map nil)
898 ;; Emacs 21 tool bar. Should be no-op otherwise.
899 (defun gnus-group-make-tool-bar ()
900 (if (and (fboundp 'tool-bar-add-item-from-menu)
901 (default-value 'tool-bar-mode)
902 (not gnus-group-toolbar-map))
903 (setq gnus-group-toolbar-map
904 (let ((tool-bar-map (make-sparse-keymap))
905 (load-path (mm-image-load-path)))
906 (tool-bar-add-item-from-menu
907 'gnus-group-get-new-news "get-news" gnus-group-mode-map)
908 (tool-bar-add-item-from-menu
909 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map)
910 (tool-bar-add-item-from-menu
911 'gnus-group-catchup-current "catchup" gnus-group-mode-map)
912 (tool-bar-add-item-from-menu
913 'gnus-group-describe-group "describe-group" gnus-group-mode-map)
914 (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe
915 :help "Subscribe to the current group")
916 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
918 :help "Unsubscribe from the current group")
919 (tool-bar-add-item-from-menu
920 'gnus-group-exit "exit-gnus" gnus-group-mode-map)
922 (if gnus-group-toolbar-map
923 (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map)))
925 (defun gnus-group-mode ()
926 "Major mode for reading news.
928 All normal editing commands are switched off.
929 \\<gnus-group-mode-map>
930 The group buffer lists (some of) the groups available. For instance,
931 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
932 lists all zombie groups.
934 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
935 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
937 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
939 The following commands are available:
941 \\{gnus-group-mode-map}"
943 (kill-all-local-variables)
944 (when (gnus-visual-p 'group-menu 'menu)
945 (gnus-group-make-menu-bar)
946 (gnus-group-make-tool-bar))
947 (gnus-simplify-mode-line)
948 (setq major-mode 'gnus-group-mode)
949 (setq mode-name "Group")
950 (gnus-group-set-mode-line)
951 (setq mode-line-process nil)
952 (use-local-map gnus-group-mode-map)
953 (buffer-disable-undo)
954 (setq truncate-lines t)
955 (setq buffer-read-only t)
956 (gnus-set-default-directory)
957 (gnus-update-format-specifications nil 'group 'group-mode)
958 (gnus-update-group-mark-positions)
963 (gnus-run-hooks 'gnus-group-mode-hook))
965 (defun gnus-update-group-mark-positions ()
967 (let ((gnus-process-mark ?\200)
968 (gnus-group-marked '("dummy.group"))
969 (gnus-active-hashtb (make-vector 10 0))
971 (gnus-set-active "dummy.group" '(0 . 0))
972 (gnus-set-work-buffer)
973 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
974 (goto-char (point-min))
975 (setq gnus-group-mark-positions
976 (list (cons 'process (and (search-forward "\200" nil t)
979 (defun gnus-mouse-pick-group (e)
980 "Enter the group under the mouse pointer."
983 (gnus-group-read-group nil))
985 ;; Look at LEVEL and find out what the level is really supposed to be.
986 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
987 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
988 (defun gnus-group-default-level (&optional level number-or-nil)
990 (gnus-group-use-permanent-levels
991 (or (setq gnus-group-use-permanent-levels
992 (or level (if (numberp gnus-group-use-permanent-levels)
993 gnus-group-use-permanent-levels
994 (or gnus-group-default-list-level
995 gnus-level-subscribed))))
996 gnus-group-default-list-level gnus-level-subscribed))
1000 (or level gnus-group-default-list-level gnus-level-subscribed))))
1002 (defun gnus-group-setup-buffer ()
1003 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1004 (unless (eq major-mode 'gnus-group-mode)
1007 (gnus-carpal-setup-buffer 'group))))
1009 (defsubst gnus-group-name-charset (method group)
1011 (setq method (gnus-find-method-for-group group)))
1012 (let ((item (assoc method gnus-group-name-charset-method-alist))
1013 (alist gnus-group-name-charset-group-alist)
1017 (while (setq item (pop alist))
1018 (if (string-match (car item) group)
1020 result (cdr item))))
1023 (defsubst gnus-group-name-decode (string charset)
1024 (if (and string charset (featurep 'mule))
1025 (decode-coding-string string charset)
1028 (defun gnus-group-decoded-name (string)
1029 (let ((charset (gnus-group-name-charset nil string)))
1030 (gnus-group-name-decode string charset)))
1032 (defun gnus-group-list-groups (&optional level unread lowest)
1033 "List newsgroups with level LEVEL or lower that have unread articles.
1034 Default is all subscribed groups.
1035 If argument UNREAD is non-nil, groups with no unread articles are also
1038 Also see the `gnus-group-use-permanent-levels' variable."
1040 (list (if current-prefix-arg
1041 (prefix-numeric-value current-prefix-arg)
1043 (gnus-group-default-level nil t)
1044 gnus-group-default-list-level
1045 gnus-level-subscribed))))
1047 (setq level (car gnus-group-list-mode)
1048 unread (cdr gnus-group-list-mode)))
1049 (setq level (gnus-group-default-level level))
1050 (gnus-group-setup-buffer)
1051 (gnus-update-format-specifications nil 'group 'group-mode)
1052 (let ((case-fold-search nil)
1053 (props (text-properties-at (gnus-point-at-bol)))
1054 (empty (= (point-min) (point-max)))
1055 (group (gnus-group-group-name))
1057 (set-buffer gnus-group-buffer)
1058 (setq number (funcall gnus-group-prepare-function level unread lowest))
1059 (when (or (and (numberp number)
1061 (zerop (buffer-size)))
1062 ;; No groups in the buffer.
1063 (gnus-message 5 gnus-no-groups-message))
1064 ;; We have some groups displayed.
1065 (goto-char (point-max))
1066 (when (or (not gnus-group-goto-next-group-function)
1067 (not (funcall gnus-group-goto-next-group-function
1071 (goto-char (point-min)))
1073 ;; Go to the first group with unread articles.
1074 (gnus-group-search-forward t))
1076 ;; Find the right group to put point on. If the current group
1077 ;; has disappeared in the new listing, try to find the next
1078 ;; one. If no next one can be found, just leave point at the
1079 ;; first newsgroup in the buffer.
1080 (when (not (gnus-goto-char
1082 (point-min) (point-max)
1083 'gnus-group (gnus-intern-safe
1084 group gnus-active-hashtb))))
1085 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb))))
1087 (not (gnus-goto-char
1089 (point-min) (point-max) 'gnus-group
1091 (caar newsrc) gnus-active-hashtb)))))
1092 (setq newsrc (cdr newsrc)))
1094 (goto-char (point-max))
1095 (forward-line -1)))))))
1096 ;; Adjust cursor point.
1097 (gnus-group-position-point)))
1099 (defun gnus-group-list-level (level &optional all)
1100 "List groups on LEVEL.
1101 If ALL (the prefix), also list groups that have no unread articles."
1102 (interactive "nList groups on level: \nP")
1103 (gnus-group-list-groups level all level))
1105 (defun gnus-group-prepare-logic (group test)
1106 (or (and gnus-group-listed-groups
1107 (null gnus-group-list-option)
1108 (member group gnus-group-listed-groups))
1110 ((null gnus-group-listed-groups) test)
1111 ((null gnus-group-list-option) test)
1112 (t (and (member group gnus-group-listed-groups)
1113 (if (eq gnus-group-list-option 'flush)
1117 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
1118 "List all newsgroups with unread articles of level LEVEL or lower.
1119 If PREDICATE is a function, list groups that the function returns non-nil;
1120 if it is t, list groups that have no unread articles.
1121 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1122 If REGEXP is a function, list dead groups that the function returns non-nil;
1123 if it is a string, only list groups matching REGEXP."
1124 (set-buffer gnus-group-buffer)
1125 (let ((buffer-read-only nil)
1126 (newsrc (cdr gnus-newsrc-alist))
1127 (lowest (or lowest 1))
1128 (not-in-list (and gnus-group-listed-groups
1129 (copy-sequence gnus-group-listed-groups)))
1130 info clevel unread group params)
1132 (when (or (< lowest gnus-level-zombie)
1133 gnus-group-listed-groups)
1134 ;; List living groups.
1136 (setq info (car newsrc)
1137 group (gnus-info-group info)
1138 params (gnus-info-params info)
1140 unread (car (gnus-gethash group gnus-newsrc-hashtb)))
1142 (setq not-in-list (delete group not-in-list)))
1144 (gnus-group-prepare-logic
1146 (and unread ; This group might be unchecked
1147 (or (not (stringp regexp))
1148 (string-match regexp group))
1149 (<= (setq clevel (gnus-info-level info)) level)
1152 ((functionp predicate)
1153 (funcall predicate info))
1154 (predicate t) ; We list all groups?
1157 (if (eq unread t) ; Unactivated?
1158 gnus-group-list-inactive-groups
1159 ; We list unactivated
1161 ; We list groups with unread articles
1162 (and gnus-list-groups-with-ticked-articles
1163 (cdr (assq 'tick (gnus-info-marks info))))
1164 ; And groups with tickeds
1165 ;; Check for permanent visibility.
1166 (and gnus-permanently-visible-groups
1167 (string-match gnus-permanently-visible-groups group))
1168 (memq 'visible params)
1169 (cdr (assq 'visible params)))))))
1170 (gnus-group-insert-group-line
1171 group (gnus-info-level info)
1172 (gnus-info-marks info) unread (gnus-info-method info)))))
1174 ;; List dead groups.
1175 (if (or gnus-group-listed-groups
1176 (and (>= level gnus-level-zombie)
1177 (<= lowest gnus-level-zombie)))
1178 (gnus-group-prepare-flat-list-dead
1179 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1180 gnus-level-zombie ?Z
1183 (dolist (group gnus-zombie-list)
1184 (setq not-in-list (delete group not-in-list))))
1185 (if (or gnus-group-listed-groups
1186 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
1187 (gnus-group-prepare-flat-list-dead
1190 (setq gnus-killed-list (sort gnus-killed-list 'string<)))
1191 gnus-level-killed ?K regexp))
1193 (gnus-group-set-mode-line)
1194 (setq gnus-group-list-mode (cons level predicate))
1195 (gnus-run-hooks 'gnus-group-prepare-hook)
1198 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1199 ;; List zombies and killed lists somewhat faster, which was
1200 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1201 ;; this by ignoring the group format specification altogether.
1203 (if (> (length groups) gnus-group-listing-limit)
1205 (setq group (pop groups))
1206 (when (gnus-group-prepare-logic
1209 (and (stringp regexp) (string-match regexp group))
1210 (and (functionp regexp) (funcall regexp group))))
1211 (gnus-add-text-properties
1212 (point) (prog1 (1+ (point))
1213 (insert " " mark " *: "
1214 (gnus-group-decoded-name group)
1216 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1218 'gnus-level level))))
1220 (setq group (pop groups))
1221 (when (gnus-group-prepare-logic
1224 (and (stringp regexp) (string-match regexp group))
1225 (and (functionp regexp) (funcall regexp group))))
1226 (gnus-group-insert-group-line
1228 (let ((active (gnus-active group)))
1230 (if (zerop (cdr active))
1232 (- (1+ (cdr active)) (car active)))
1234 (gnus-method-simplify (gnus-find-method-for-group group))))))))
1236 (defun gnus-group-update-group-line ()
1237 "Update the current line in the group buffer."
1238 (let* ((buffer-read-only nil)
1239 (group (gnus-group-group-name))
1240 (entry (and group (gnus-gethash group gnus-newsrc-hashtb)))
1241 gnus-group-indentation)
1244 (not (gnus-ephemeral-group-p group))
1246 (concat "(gnus-group-set-info '"
1247 (gnus-prin1-to-string (nth 2 entry))
1249 (setq gnus-group-indentation (gnus-group-group-indentation))
1251 (gnus-group-insert-group-line-info group)
1253 (gnus-group-position-point))))
1255 (defun gnus-group-insert-group-line-info (group)
1256 "Insert GROUP on the current line."
1257 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
1258 (gnus-group-indentation (gnus-group-group-indentation))
1262 ;; (Un)subscribed group.
1263 (setq info (nth 2 entry))
1264 (gnus-group-insert-group-line
1265 group (gnus-info-level info) (gnus-info-marks info)
1266 (or (car entry) t) (gnus-info-method info)))
1267 ;; This group is dead.
1268 (gnus-group-insert-group-line
1270 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1272 (if (setq active (gnus-active group))
1273 (if (zerop (cdr active))
1275 (- (1+ (cdr active)) (car active)))
1277 (gnus-method-simplify (gnus-find-method-for-group group))))))
1279 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1280 gnus-tmp-marked number
1282 "Insert a group line in the group buffer."
1283 (let* ((gnus-tmp-method
1284 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1285 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1287 (gnus-tmp-active (gnus-active gnus-tmp-group))
1288 (gnus-tmp-number-total
1290 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1292 (gnus-tmp-number-of-unread
1293 (if (numberp number) (int-to-string (max 0 number))
1295 (gnus-tmp-number-of-read
1296 (if (numberp number)
1297 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1299 (gnus-tmp-subscribed
1300 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1301 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1302 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1304 (gnus-tmp-qualified-group
1305 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
1306 group-name-charset))
1307 (gnus-tmp-newsgroup-description
1308 (if gnus-description-hashtb
1309 (or (gnus-group-name-decode
1310 (gnus-gethash gnus-tmp-group gnus-description-hashtb)
1311 group-name-charset) "")
1314 (if (and gnus-moderated-hashtb
1315 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
1317 (gnus-tmp-moderated-string
1318 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1319 (gnus-tmp-group-icon "==&&==")
1320 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1321 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1322 (gnus-tmp-news-method-string
1324 (format "(%s:%s)" (car gnus-tmp-method)
1325 (cadr gnus-tmp-method)) ""))
1326 (gnus-tmp-marked-mark
1327 (if (and (numberp number)
1329 (cdr (assq 'tick gnus-tmp-marked)))
1331 (gnus-tmp-process-marked
1332 (if (member gnus-tmp-group gnus-group-marked)
1333 gnus-process-mark ? ))
1335 (or (and gnus-use-grouplens
1336 (bbb-grouplens-group-p gnus-tmp-group))
1338 (buffer-read-only nil)
1339 header gnus-tmp-header) ; passed as parameter to user-funcs.
1341 (gnus-add-text-properties
1345 (eval gnus-group-line-format-spec))
1346 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1347 gnus-unread ,(if (numberp number)
1348 (string-to-int gnus-tmp-number-of-unread)
1350 gnus-marked ,gnus-tmp-marked-mark
1351 gnus-indentation ,gnus-group-indentation
1352 gnus-level ,gnus-tmp-level))
1354 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1355 (gnus-run-hooks 'gnus-group-update-hook))
1357 ;; Allow XEmacs to remove front-sticky text properties.
1358 (gnus-group-remove-excess-properties)))
1360 (defun gnus-group-highlight-line ()
1361 "Highlight the current line according to `gnus-group-highlight'."
1362 (let* ((list gnus-group-highlight)
1364 (end (progn (end-of-line) (point)))
1365 ;; now find out where the line starts and leave point there.
1366 (beg (progn (beginning-of-line) (point)))
1367 (group (gnus-group-group-name))
1368 (entry (gnus-group-entry group))
1369 (unread (if (numberp (car entry)) (car entry) 0))
1370 (active (gnus-active group))
1371 (total (if active (1+ (- (cdr active) (car active))) 0))
1372 (info (nth 2 entry))
1373 (method (gnus-server-get-method group (gnus-info-method info)))
1374 (marked (gnus-info-marks info))
1375 (mailp (apply 'append
1378 (memq x (assoc (symbol-name
1379 (car (or method gnus-select-method)))
1380 gnus-valid-select-methods)))
1381 '(mail post-mail))))
1382 (level (or (gnus-info-level info) gnus-level-killed))
1383 (score (or (gnus-info-score info) 0))
1384 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1385 (group-age (gnus-group-timestamp-delta group))
1386 (inhibit-read-only t))
1387 ;; Eval the cars of the lists until we find a match.
1389 (not (eval (caar list))))
1390 (setq list (cdr list)))
1391 (let ((face (cdar list)))
1392 (unless (eq face (get-text-property beg 'face))
1393 (gnus-put-text-property-excluding-characters-with-faces
1395 (setq face (if (boundp face) (symbol-value face) face)))
1396 (gnus-extent-start-open beg)))
1399 (defun gnus-group-update-group (group &optional visible-only)
1400 "Update all lines where GROUP appear.
1401 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1403 ;; Can't use `save-excursion' here, so we do it manually.
1404 (let ((buf (current-buffer))
1406 (set-buffer gnus-group-buffer)
1407 (setq mark (point-marker))
1408 ;; The buffer may be narrowed.
1411 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1413 found buffer-read-only)
1414 ;; Enter the current status into the dribble buffer.
1415 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
1417 (not (gnus-ephemeral-group-p group)))
1419 (concat "(gnus-group-set-info '"
1420 (gnus-prin1-to-string (nth 2 entry))
1422 ;; Find all group instances. If topics are in use, each group
1423 ;; may be listed in more than once.
1424 (while (setq loc (text-property-any
1425 loc (point-max) 'gnus-group ident))
1428 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1430 (gnus-group-insert-group-line-info group)
1433 (gnus-run-hooks 'gnus-group-update-group-hook)))
1434 (setq loc (1+ loc)))
1435 (unless (or found visible-only)
1436 ;; No such line in the buffer, find out where it's supposed to
1437 ;; go, and insert it there (or at the end of the buffer).
1438 (if gnus-goto-missing-group-function
1439 (funcall gnus-goto-missing-group-function group)
1440 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb))))
1441 (while (and entry (car entry)
1445 (point-min) (point-max)
1446 'gnus-group (gnus-intern-safe
1447 (caar entry) gnus-active-hashtb)))))
1448 (setq entry (cdr entry)))
1449 (or entry (goto-char (point-max)))))
1450 ;; Finally insert the line.
1451 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1452 (gnus-group-insert-group-line-info group)
1455 (gnus-run-hooks 'gnus-group-update-group-hook))))
1456 (when gnus-group-update-group-function
1457 (funcall gnus-group-update-group-function group))
1458 (gnus-group-set-mode-line)))
1460 (set-marker mark nil)
1463 (defun gnus-group-set-mode-line ()
1464 "Update the mode line in the group buffer."
1465 (when (memq 'group gnus-updated-mode-lines)
1466 ;; Yes, we want to keep this mode line updated.
1468 (set-buffer gnus-group-buffer)
1469 (let* ((gformat (or gnus-group-mode-line-format-spec
1470 (gnus-set-format 'group-mode)))
1471 (gnus-tmp-news-server (cadr gnus-select-method))
1472 (gnus-tmp-news-method (car gnus-select-method))
1473 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1475 gnus-tmp-header ;Dummy binding for user-defined formats
1476 ;; Get the resulting string.
1478 (and gnus-dribble-buffer
1479 (buffer-name gnus-dribble-buffer)
1480 (buffer-modified-p gnus-dribble-buffer)
1482 (set-buffer gnus-dribble-buffer)
1483 (not (zerop (buffer-size))))))
1484 (mode-string (eval gformat)))
1485 ;; Say whether the dribble buffer has been modified.
1486 (setq mode-line-modified
1487 (if modified (car gnus-mode-line-modified)
1488 (cdr gnus-mode-line-modified)))
1489 ;; If the line is too long, we chop it off.
1490 (when (> (length mode-string) max-len)
1491 (setq mode-string (substring mode-string 0 (- max-len 4))))
1493 (setq mode-line-buffer-identification
1494 (gnus-mode-line-buffer-identification
1495 (list mode-string)))
1496 (set-buffer-modified-p modified))))))
1498 (defun gnus-group-group-name ()
1499 "Get the name of the newsgroup on the current line."
1500 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
1502 (symbol-name group))))
1504 (defun gnus-group-group-level ()
1505 "Get the level of the newsgroup on the current line."
1506 (get-text-property (gnus-point-at-bol) 'gnus-level))
1508 (defun gnus-group-group-indentation ()
1509 "Get the indentation of the newsgroup on the current line."
1510 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation)
1511 (and gnus-group-indentation-function
1512 (funcall gnus-group-indentation-function))
1515 (defun gnus-group-group-unread ()
1516 "Get the number of unread articles of the newsgroup on the current line."
1517 (get-text-property (gnus-point-at-bol) 'gnus-unread))
1519 (defun gnus-group-new-mail (group)
1520 (if (nnmail-new-mail-p (gnus-group-real-name group))
1524 (defun gnus-group-level (group)
1525 "Return the estimated level of GROUP."
1526 (or (gnus-info-level (gnus-get-info group))
1527 (and (member group gnus-zombie-list) gnus-level-zombie)
1530 (defun gnus-group-search-forward (&optional backward all level first-too)
1531 "Find the next newsgroup with unread articles.
1532 If BACKWARD is non-nil, find the previous newsgroup instead.
1533 If ALL is non-nil, just find any newsgroup.
1534 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1536 If FIRST-TOO, the current line is also eligible as a target."
1537 (let ((way (if backward -1 1))
1538 (low gnus-level-killed)
1541 (if (and backward (progn (beginning-of-line)) (bobp))
1550 (get-text-property (point) 'gnus-group)
1554 (get-text-property (point) 'gnus-unread)))
1555 (and (numberp unread) (> unread 0)))
1556 (setq lev (get-text-property (point)
1558 (<= lev gnus-level-subscribed)))
1560 (and (setq lev (get-text-property (point)
1569 (zerop (forward-line way)))))
1571 (progn (gnus-group-position-point) t)
1572 (goto-char (or pos beg))
1575 ;;; Gnus group mode commands
1579 (defun gnus-group-mark-line-p ()
1582 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1583 (eq (char-after) gnus-process-mark)))
1585 (defun gnus-group-mark-group (n &optional unmark no-advance)
1586 "Mark the current group."
1588 (let ((buffer-read-only nil)
1592 (when (setq group (gnus-group-group-name))
1593 ;; Go to the mark position.
1595 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1596 (subst-char-in-region
1597 (point) (1+ (point)) (char-after)
1600 (setq gnus-group-marked (delete group gnus-group-marked))
1602 (setq gnus-group-marked
1603 (cons group (delete group gnus-group-marked)))
1604 gnus-process-mark)))
1606 (gnus-group-next-group 1))
1608 (gnus-summary-position-point)
1611 (defun gnus-group-unmark-group (n)
1612 "Remove the mark from the current group."
1614 (gnus-group-mark-group n 'unmark)
1615 (gnus-group-position-point))
1617 (defun gnus-group-unmark-all-groups ()
1618 "Unmark all groups."
1620 (let ((groups gnus-group-marked))
1623 (gnus-group-remove-mark (pop groups)))))
1624 (gnus-group-position-point))
1626 (defun gnus-group-mark-region (unmark beg end)
1627 "Mark all groups between point and mark.
1628 If UNMARK, remove the mark instead."
1629 (interactive "P\nr")
1630 (let ((num (count-lines beg end)))
1633 (- num (gnus-group-mark-group num unmark)))))
1635 (defun gnus-group-mark-buffer (&optional unmark)
1636 "Mark all groups in the buffer.
1637 If UNMARK, remove the mark instead."
1639 (gnus-group-mark-region unmark (point-min) (point-max)))
1641 (defun gnus-group-mark-regexp (regexp)
1642 "Mark all groups that match some regexp."
1643 (interactive "sMark (regexp): ")
1644 (let ((alist (cdr gnus-newsrc-alist))
1647 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1648 (gnus-group-set-mark group))))
1649 (gnus-group-position-point))
1651 (defun gnus-group-remove-mark (group &optional test-marked)
1652 "Remove the process mark from GROUP and move point there.
1653 Return nil if the group isn't displayed."
1654 (if (gnus-group-goto-group group nil test-marked)
1656 (gnus-group-mark-group 1 'unmark t)
1658 (setq gnus-group-marked
1659 (delete group gnus-group-marked))
1662 (defun gnus-group-set-mark (group)
1663 "Set the process mark on GROUP."
1664 (if (gnus-group-goto-group group)
1666 (gnus-group-mark-group 1 nil t))
1667 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1669 (defun gnus-group-universal-argument (arg &optional groups func)
1670 "Perform any command on all groups according to the process/prefix convention."
1672 (if (eq (setq func (or func
1675 (substitute-command-keys
1676 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1678 (gnus-error 1 "Undefined key")
1679 (gnus-group-iterate arg
1681 (command-execute func))))
1682 (gnus-group-position-point))
1684 (defun gnus-group-process-prefix (n)
1685 "Return a list of groups to work on.
1686 Take into consideration N (the prefix) and the list of marked groups."
1689 (setq n (prefix-numeric-value n))
1690 ;; There is a prefix, so we return a list of the N next
1692 (let ((way (if (< n 0) -1 1))
1697 (if (setq group (gnus-group-group-name))
1698 (push group groups))
1700 (gnus-group-next-group way)))
1702 ((gnus-region-active-p)
1703 ;; Work on the region between point and mark.
1704 (let ((max (max (point) (mark)))
1707 (goto-char (min (point) (mark)))
1710 (push (gnus-group-group-name) groups)
1711 (zerop (gnus-group-next-group 1))
1713 (nreverse groups))))
1715 ;; No prefix, but a list of marked articles.
1716 (reverse gnus-group-marked))
1718 ;; Neither marked articles or a prefix, so we return the
1720 (let ((group (gnus-group-group-name)))
1721 (and group (list group))))))
1723 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1724 ;;; imagine why I went through these contortions...
1726 (let ((function (make-symbol "gnus-group-iterate-function"))
1727 (window (make-symbol "gnus-group-iterate-window"))
1728 (groups (make-symbol "gnus-group-iterate-groups"))
1729 (group (make-symbol "gnus-group-iterate-group")))
1731 `(defun gnus-group-iterate (arg ,function)
1732 "Iterate FUNCTION over all process/prefixed groups.
1733 FUNCTION will be called with the group name as the parameter
1734 and with point over the group in question."
1735 (let ((,groups (gnus-group-process-prefix arg))
1736 (,window (selected-window))
1739 (setq ,group (car ,groups)
1740 ,groups (cdr ,groups))
1741 (select-window ,window)
1742 (gnus-group-remove-mark ,group)
1743 (save-selected-window
1745 (funcall ,function ,group)))))))))
1747 (put 'gnus-group-iterate 'lisp-indent-function 1)
1749 ;; Selecting groups.
1751 (defun gnus-group-read-group (&optional all no-article group select-articles)
1752 "Read news in this newsgroup.
1753 If the prefix argument ALL is non-nil, already read articles become
1754 readable. IF ALL is a number, fetch this number of articles. If the
1755 optional argument NO-ARTICLE is non-nil, no article will be
1756 auto-selected upon group entry. If GROUP is non-nil, fetch that
1759 (let ((no-display (eq all 0))
1760 (group (or group (gnus-group-group-name)))
1761 number active marked entry)
1765 (error "No group on current line"))
1766 (setq marked (gnus-info-marks
1767 (nth 2 (setq entry (gnus-gethash
1768 group gnus-newsrc-hashtb)))))
1769 ;; This group might be a dead group. In that case we have to get
1770 ;; the number of unread articles from `gnus-active-hashtb'.
1772 (cond ((numberp all) all)
1774 ((setq active (gnus-active group))
1775 (- (1+ (cdr active)) (car active)))))
1776 (gnus-summary-read-group
1777 group (or all (and (numberp number)
1778 (zerop (+ number (gnus-range-length
1779 (cdr (assq 'tick marked)))
1781 (cdr (assq 'dormant marked)))))))
1782 no-article nil no-display nil select-articles)))
1784 (defun gnus-group-select-group (&optional all)
1785 "Select this newsgroup.
1786 No article is selected automatically.
1787 If the group is opened, just switch the summary buffer.
1788 If ALL is non-nil, already read articles become readable.
1789 If ALL is a number, fetch this number of articles."
1791 (gnus-group-read-group all t))
1793 (defun gnus-group-quick-select-group (&optional all)
1794 "Select the current group \"quickly\".
1795 This means that no highlighting or scoring will be performed.
1796 If ALL (the prefix argument) is 0, don't even generate the summary
1799 This might be useful if you want to toggle threading
1800 before entering the group."
1802 (require 'gnus-score)
1804 gnus-score-find-score-files-function
1805 gnus-home-score-file
1806 gnus-apply-kill-hook
1807 gnus-summary-expunge-below)
1808 (gnus-group-read-group all t)))
1810 (defun gnus-group-visible-select-group (&optional all)
1811 "Select the current group without hiding any articles."
1813 (let ((gnus-inhibit-limiting t))
1814 (gnus-group-read-group all t)))
1816 (defun gnus-group-select-group-ephemerally ()
1817 "Select the current group without doing any processing whatsoever.
1818 You will actually be entered into a group that's a copy of
1819 the current group; no changes you make while in this group will
1822 (require 'gnus-score)
1824 gnus-score-find-score-files-function gnus-apply-kill-hook
1825 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1826 gnus-summary-mode-hook gnus-select-group-hook
1827 (group (gnus-group-group-name))
1828 (method (gnus-find-method-for-group group)))
1829 (gnus-group-read-ephemeral-group
1830 (gnus-group-prefixed-name group method) method)))
1833 (defun gnus-fetch-group (group)
1834 "Start Gnus if necessary and enter GROUP.
1835 Returns whether the fetching was successful or not."
1836 (interactive (list (completing-read "Group name: " gnus-active-hashtb)))
1837 (unless (get-buffer gnus-group-buffer)
1839 (gnus-group-read-group nil nil group))
1842 (defun gnus-fetch-group-other-frame (group)
1843 "Pop up a frame and enter GROUP."
1845 (let ((window (get-buffer-window gnus-group-buffer)))
1847 (select-frame (window-frame window)))
1848 ((= (length (frame-list)) 1)
1849 (select-frame (make-frame)))
1852 (gnus-fetch-group group))
1854 (defvar gnus-ephemeral-group-server 0)
1856 ;; Enter a group that is not in the group buffer. Non-nil is returned
1857 ;; if selection was successful.
1858 (defun gnus-group-read-ephemeral-group (group method &optional activate
1859 quit-config request-only
1861 "Read GROUP from METHOD as an ephemeral group.
1862 If ACTIVATE, request the group first.
1863 If QUIT-CONFIG, use that window configuration when exiting from the
1865 If REQUEST-ONLY, don't actually read the group; just request it.
1866 If SELECT-ARTICLES, only select those articles.
1868 Return the name of the group if selection was successful."
1869 ;; Transform the select method into a unique server.
1870 (when (stringp method)
1871 (setq method (gnus-server-to-method method)))
1873 `(,(car method) ,(concat (cadr method) "-ephemeral")
1874 (,(intern (format "%s-address" (car method))) ,(cadr method))
1876 (let ((group (if (gnus-group-foreign-p group) group
1877 (gnus-group-prefixed-name group method))))
1881 ,gnus-level-default-subscribed nil nil ,method
1883 ,(if quit-config quit-config
1884 (cons gnus-summary-buffer
1885 gnus-current-window-configuration))))))
1887 (push method gnus-ephemeral-servers)
1888 (set-buffer gnus-group-buffer)
1889 (unless (gnus-check-server method)
1890 (error "Unable to contact server: %s" (gnus-status-message method)))
1892 (gnus-activate-group group 'scan)
1893 (unless (gnus-request-group group)
1894 (error "Couldn't request group: %s"
1895 (nnheader-get-report (car method)))))
1899 (when (gnus-group-read-group t t group select-articles)
1903 (message "Quit reading the ephemeral group")
1906 (defun gnus-group-jump-to-group (group)
1907 "Jump to newsgroup GROUP."
1909 (list (completing-read
1910 "Group: " gnus-active-hashtb nil
1911 (gnus-read-active-file-p)
1912 gnus-group-jump-to-group-prompt
1913 'gnus-group-history)))
1915 (when (equal group "")
1916 (error "Empty group name"))
1918 (unless (gnus-ephemeral-group-p group)
1919 ;; Either go to the line in the group buffer...
1920 (unless (gnus-group-goto-group group)
1921 ;; ... or insert the line.
1922 (gnus-group-update-group group)
1923 (gnus-group-goto-group group)))
1924 ;; Adjust cursor point.
1925 (gnus-group-position-point))
1927 (defun gnus-group-goto-group (group &optional far test-marked)
1928 "Goto to newsgroup GROUP.
1929 If FAR, it is likely that the group is not on the current line.
1930 If TEST-MARKED, the line must be marked."
1934 ;; It's quite likely that we are on the right line, so
1935 ;; we check the current line first.
1937 (eq (get-text-property (point) 'gnus-group)
1938 (gnus-intern-safe group gnus-active-hashtb))
1939 (or (not test-marked) (gnus-group-mark-line-p)))
1941 ;; Previous and next line are also likely, so we check them as well.
1945 (and (eq (get-text-property (point) 'gnus-group)
1946 (gnus-intern-safe group gnus-active-hashtb))
1947 (or (not test-marked) (gnus-group-mark-line-p)))))
1953 (and (eq (get-text-property (point) 'gnus-group)
1954 (gnus-intern-safe group gnus-active-hashtb))
1955 (or (not test-marked) (gnus-group-mark-line-p)))))
1959 (goto-char (point-min))
1961 (while (and (not found)
1966 (gnus-intern-safe group gnus-active-hashtb))))
1967 (if (gnus-group-mark-line-p)
1972 ;; Search through the entire buffer.
1975 (point-min) (point-max)
1976 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))))))
1978 (defun gnus-group-next-group (n &optional silent)
1979 "Go to next N'th newsgroup.
1980 If N is negative, search backward instead.
1981 Returns the difference between N and the number of skips actually
1984 (gnus-group-next-unread-group n t nil silent))
1986 (defun gnus-group-next-unread-group (n &optional all level silent)
1987 "Go to next N'th unread newsgroup.
1988 If N is negative, search backward instead.
1989 If ALL is non-nil, choose any newsgroup, unread or not.
1990 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
1991 such group can be found, the next group with a level higher than
1993 Returns the difference between N and the number of skips actually
1996 (let ((backward (< n 0))
1999 (gnus-group-search-forward
2000 backward (or (not gnus-group-goto-unread) all) level))
2004 (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread")
2005 (if level " on this level or higher" "")))
2008 (defun gnus-group-prev-group (n)
2009 "Go to previous N'th newsgroup.
2010 Returns the difference between N and the number of skips actually
2013 (gnus-group-next-unread-group (- n) t))
2015 (defun gnus-group-prev-unread-group (n)
2016 "Go to previous N'th unread newsgroup.
2017 Returns the difference between N and the number of skips actually
2020 (gnus-group-next-unread-group (- n)))
2022 (defun gnus-group-next-unread-group-same-level (n)
2023 "Go to next N'th unread newsgroup on the same level.
2024 If N is negative, search backward instead.
2025 Returns the difference between N and the number of skips actually
2028 (gnus-group-next-unread-group n t (gnus-group-group-level))
2029 (gnus-group-position-point))
2031 (defun gnus-group-prev-unread-group-same-level (n)
2032 "Go to next N'th unread newsgroup on the same level.
2033 Returns the difference between N and the number of skips actually
2036 (gnus-group-next-unread-group (- n) t (gnus-group-group-level))
2037 (gnus-group-position-point))
2039 (defun gnus-group-best-unread-group (&optional exclude-group)
2040 "Go to the group with the highest level.
2041 If EXCLUDE-GROUP, do not go to that group."
2043 (goto-char (point-min))
2047 (setq unread (get-text-property (point) 'gnus-unread))
2048 (when (and (numberp unread) (> unread 0))
2049 (when (and (get-text-property (point) 'gnus-level)
2050 (< (get-text-property (point) 'gnus-level) best)
2051 (or (not exclude-group)
2052 (not (equal exclude-group (gnus-group-group-name)))))
2053 (setq best (get-text-property (point) 'gnus-level))
2054 (setq best-point (point))))
2057 (goto-char best-point))
2058 (gnus-summary-position-point)
2059 (and best-point (gnus-group-group-name))))
2061 (defun gnus-group-first-unread-group ()
2062 "Go to the first group with unread articles."
2065 (let ((opoint (point))
2067 (goto-char (point-min))
2068 (if (or (eq (setq unread (gnus-group-group-unread)) t) ; Not active.
2069 (and (numberp unread) ; Not a topic.
2070 (not (zerop unread))) ; Has unread articles.
2071 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2074 nil)) ; Not success.
2075 (gnus-group-position-point)))
2077 (defun gnus-group-enter-server-mode ()
2078 "Jump to the server buffer."
2080 (gnus-enter-server-buffer))
2082 (defun gnus-group-make-group (name &optional method address args)
2083 "Add a new newsgroup.
2084 The user will be prompted for a NAME, for a select METHOD, and an
2088 (gnus-read-group "Group name: ")
2089 (gnus-read-method "From method: ")))
2091 (when (stringp method)
2092 (setq method (or (gnus-server-to-method method) method)))
2093 (let* ((meth (gnus-method-simplify
2095 (not (gnus-server-equal method gnus-select-method)))
2096 (if address (list (intern method) address)
2098 (nname (if method (gnus-group-prefixed-name name meth) name))
2100 (when (gnus-gethash nname gnus-newsrc-hashtb)
2101 (error "Group %s already exists" nname))
2102 ;; Subscribe to the new group.
2103 (gnus-group-change-level
2104 (setq info (list t nname gnus-level-default-subscribed nil nil meth))
2105 gnus-level-default-subscribed gnus-level-killed
2106 (and (gnus-group-group-name)
2107 (gnus-gethash (gnus-group-group-name)
2108 gnus-newsrc-hashtb))
2111 (gnus-set-active nname (cons 1 0))
2112 (unless (gnus-ephemeral-group-p name)
2114 (concat "(gnus-group-set-info '"
2115 (gnus-prin1-to-string (cdr info)) ")")))
2117 (gnus-group-insert-group-line-info nname)
2119 (gnus-group-position-point)
2121 ;; Load the backend and try to make the backend create
2122 ;; the group as well.
2123 (when (assoc (symbol-name (setq backend (car (gnus-server-get-method
2125 gnus-valid-select-methods)
2127 (gnus-check-server meth)
2128 (when (gnus-check-backend-function 'request-create-group nname)
2129 (gnus-request-create-group nname nil args))
2132 (defun gnus-group-delete-groups (&optional arg)
2133 "Delete the current group. Only meaningful with editable groups."
2135 (let ((n (length (gnus-group-process-prefix arg))))
2136 (when (gnus-yes-or-no-p
2138 "Delete this 1 group? "
2139 (format "Delete these %d groups? " n)))
2140 (gnus-group-iterate arg
2142 (gnus-group-delete-group group nil t))))))
2144 (defun gnus-group-delete-group (group &optional force no-prompt)
2145 "Delete the current group. Only meaningful with editable groups.
2146 If FORCE (the prefix) is non-nil, all the articles in the group will
2147 be deleted. This is \"deleted\" as in \"removed forever from the face
2148 of the Earth\". There is no undo. The user will be prompted before
2149 doing the deletion."
2151 (list (gnus-group-group-name)
2152 current-prefix-arg))
2154 (error "No group to rename"))
2155 (unless (gnus-check-backend-function 'request-delete-group group)
2156 (error "This backend does not support group deletion"))
2158 (if (and (not no-prompt)
2159 (not (gnus-yes-or-no-p
2161 "Do you really want to delete %s%s? "
2162 group (if force " and all its contents" "")))))
2164 (gnus-message 6 "Deleting group %s..." group)
2165 (if (not (gnus-request-delete-group group force))
2166 (gnus-error 3 "Couldn't delete group %s" group)
2167 (gnus-message 6 "Deleting group %s...done" group)
2168 (gnus-group-goto-group group)
2169 (gnus-group-kill-group 1 t)
2170 (gnus-sethash group nil gnus-active-hashtb)
2172 (gnus-group-position-point)))
2174 (defun gnus-group-rename-group (group new-name)
2175 "Rename group from GROUP to NEW-NAME.
2176 When used interactively, GROUP is the group under point
2177 and NEW-NAME will be prompted for."
2180 (gnus-group-group-name)
2182 (unless (gnus-check-backend-function
2183 'request-rename-group (gnus-group-group-name))
2184 (error "This backend does not support renaming groups"))
2185 (gnus-read-group "Rename group to: "
2186 (gnus-group-real-name (gnus-group-group-name))))))
2188 (unless (gnus-check-backend-function 'request-rename-group group)
2189 (error "This backend does not support renaming groups"))
2191 (error "No group to rename"))
2192 (when (equal (gnus-group-real-name group) new-name)
2193 (error "Can't rename to the same name"))
2195 ;; We find the proper prefixed name.
2197 (if (gnus-group-native-p group)
2201 (gnus-group-prefixed-name
2202 (gnus-group-real-name new-name)
2203 (gnus-info-method (gnus-get-info group)))))
2205 (gnus-message 6 "Renaming group %s to %s..." group new-name)
2208 (gnus-group-goto-group group)
2209 (not (when (< (gnus-group-group-level) gnus-level-zombie)
2210 (gnus-request-rename-group group new-name))))
2211 (gnus-error 3 "Couldn't rename group %s to %s" group new-name)
2212 ;; We rename the group internally by killing it...
2213 (gnus-group-kill-group)
2214 ;; ... changing its name ...
2215 (setcar (cdar gnus-list-of-killed-groups) new-name)
2216 ;; ... and then yanking it. Magic!
2217 (gnus-group-yank-group)
2218 (gnus-set-active new-name (gnus-active group))
2219 (gnus-message 6 "Renaming group %s to %s...done" group new-name)
2221 (setq gnus-killed-list (delete group gnus-killed-list))
2222 (gnus-set-active group nil)
2223 (gnus-dribble-touch)
2224 (gnus-group-position-point)))
2226 (defun gnus-group-edit-group (group &optional part)
2227 "Edit the group on the current line."
2228 (interactive (list (gnus-group-group-name)))
2229 (let ((part (or part 'info))
2232 (error "No group on current line"))
2233 (unless (setq info (gnus-get-info group))
2234 (error "Killed group; can't be edited"))
2236 (gnus-close-group group))
2238 ;; Find the proper form to edit.
2239 (cond ((eq part 'method)
2240 (or (gnus-info-method info) "native"))
2242 (gnus-info-params info))
2244 ;; The proper documentation.
2246 "Editing the %s for `%s'."
2248 ((eq part 'method) "select method")
2249 ((eq part 'params) "group parameters")
2251 (gnus-group-decoded-name group))
2253 (gnus-group-edit-group-done ',part ,group form)))))
2255 (defun gnus-group-edit-group-method (group)
2256 "Edit the select method of GROUP."
2257 (interactive (list (gnus-group-group-name)))
2258 (gnus-group-edit-group group 'method))
2260 (defun gnus-group-edit-group-parameters (group)
2261 "Edit the group parameters of GROUP."
2262 (interactive (list (gnus-group-group-name)))
2263 (gnus-group-edit-group group 'params))
2265 (defun gnus-group-edit-group-done (part group form)
2267 (let* ((method (cond ((eq part 'info) (nth 4 form))
2268 ((eq part 'method) form)
2270 (info (cond ((eq part 'info) form)
2271 ((eq part 'method) (gnus-get-info group))
2274 (if (or (not method)
2276 gnus-select-method method))
2277 (gnus-group-real-name (car info))
2278 (gnus-group-prefixed-name
2279 (gnus-group-real-name (car info)) method))
2281 (when (and new-group
2282 (not (equal new-group group)))
2283 (when (gnus-group-goto-group group)
2284 (gnus-group-kill-group 1))
2285 (gnus-activate-group new-group))
2287 (if (not (and info new-group))
2288 (gnus-group-set-info form (or new-group group) part)
2289 (setq info (gnus-copy-sequence info))
2290 (setcar info new-group)
2291 (unless (gnus-server-equal method "native")
2292 (unless (nthcdr 3 info)
2293 (nconc info (list nil nil)))
2294 (unless (nthcdr 4 info)
2295 (nconc info (list nil)))
2296 (gnus-info-set-method info method))
2297 (gnus-group-set-info info))
2298 (gnus-group-update-group (or new-group group))
2299 (gnus-group-position-point)))
2301 (defun gnus-group-make-useful-group (group method)
2302 "Create one of the groups described in `gnus-useful-groups'."
2304 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2306 gnus-useful-groups)))
2307 (list (cadr entry) (caddr entry))))
2308 (setq method (gnus-copy-sequence method))
2310 (while (setq entry (memq (assq 'eval method) method))
2311 (setcar entry (eval (cadar entry)))))
2312 (gnus-group-make-group group method))
2314 (defun gnus-group-make-help-group ()
2315 "Create the Gnus documentation group."
2317 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2318 (file (nnheader-find-etc-directory "gnus-tut.txt" t)))
2319 (when (gnus-gethash name gnus-newsrc-hashtb)
2320 (error "Documentation group already exists"))
2322 (gnus-message 1 "Couldn't find doc group")
2323 (gnus-group-make-group
2324 (gnus-group-real-name name)
2325 (list 'nndoc "gnus-help"
2326 (list 'nndoc-address file)
2327 (list 'nndoc-article-type 'mbox)))))
2328 (gnus-group-position-point))
2330 (defun gnus-group-make-doc-group (file type)
2331 "Create a group that uses a single file as the source."
2333 (list (read-file-name "File name: ")
2334 (and current-prefix-arg 'ask)))
2335 (when (eq type 'ask)
2340 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: "
2342 (setq found (cond ((= (setq char (read-char)) ?m) 'mbox)
2343 ((= char ?b) 'babyl)
2344 ((= char ?d) 'digest)
2345 ((= char ?f) 'forward)
2347 ((= char ?g) 'guess)
2348 (t (setq err (format "%c unknown. " char))
2351 (let* ((file (expand-file-name file))
2352 (name (gnus-generate-new-group-name
2353 (gnus-group-prefixed-name
2354 (file-name-nondirectory file) '(nndoc "")))))
2355 (gnus-group-make-group
2356 (gnus-group-real-name name)
2358 (list 'nndoc-address file)
2359 (list 'nndoc-article-type (or type 'guess))))))
2361 (defvar nnweb-type-definition)
2362 (defvar gnus-group-web-type-history nil)
2363 (defvar gnus-group-web-search-history nil)
2364 (defun gnus-group-make-web-group (&optional solid)
2365 "Create an ephemeral nnweb group.
2366 If SOLID (the prefix), create a solid group."
2370 (if solid (gnus-read-group "Group name: ")
2371 (message-unique-id)))
2372 (default-type (or (car gnus-group-web-type-history)
2373 (symbol-name (caar nnweb-type-definition))))
2377 (format "Search engine type (default %s): " default-type)
2378 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2379 nnweb-type-definition)
2380 nil t nil 'gnus-group-web-type-history)
2385 (cons (or (car gnus-group-web-search-history) "") 0)
2386 'gnus-group-web-search-history))
2388 `(nnweb ,group (nnweb-search ,search)
2389 (nnweb-type ,(intern type))
2390 (nnweb-ephemeral-p t))))
2392 (gnus-group-make-group group "nnweb" "" `(,(intern type) ,search))
2393 (gnus-group-read-ephemeral-group
2395 (cons (current-buffer)
2396 (if (eq major-mode 'gnus-summary-mode) 'summary 'group))))))
2398 (defvar nnwarchive-type-definition)
2399 (defvar gnus-group-warchive-type-history nil)
2400 (defvar gnus-group-warchive-login-history nil)
2401 (defvar gnus-group-warchive-address-history nil)
2403 (defun gnus-group-make-warchive-group ()
2404 "Create a nnwarchive group."
2406 (require 'nnwarchive)
2407 (let* ((group (gnus-read-group "Group name: "))
2408 (default-type (or (car gnus-group-warchive-type-history)
2409 (symbol-name (caar nnwarchive-type-definition))))
2413 (format "Warchive type (default %s): " default-type)
2414 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2415 nnwarchive-type-definition)
2416 nil t nil 'gnus-group-warchive-type-history)
2418 (address (read-string "Warchive address: "
2419 nil 'gnus-group-warchive-address-history))
2420 (default-login (or (car gnus-group-warchive-login-history)
2425 (format "Warchive login (default %s): " user-mail-address)
2426 default-login 'gnus-group-warchive-login-history)
2429 `(nnwarchive ,address
2430 (nnwarchive-type ,(intern type))
2431 (nnwarchive-login ,login))))
2432 (gnus-group-make-group group method)))
2434 (defun gnus-group-make-archive-group (&optional all)
2435 "Create the (ding) Gnus archive group of the most recent articles.
2436 Given a prefix, create a full group."
2438 (let ((group (gnus-group-prefixed-name
2439 (if all "ding.archives" "ding.recent") '(nndir ""))))
2440 (when (gnus-gethash group gnus-newsrc-hashtb)
2441 (error "Archive group already exists"))
2442 (gnus-group-make-group
2443 (gnus-group-real-name group)
2444 (list 'nndir (if all "hpc" "edu")
2445 (list 'nndir-directory
2446 (if all gnus-group-archive-directory
2447 gnus-group-recent-archive-directory))))
2448 (gnus-group-add-parameter group (cons 'to-address "ding@gnus.org"))))
2450 (defun gnus-group-make-directory-group (dir)
2451 "Create an nndir group.
2452 The user will be prompted for a directory. The contents of this
2453 directory will be used as a newsgroup. The directory should contain
2454 mail messages or news articles in files that have numeric names."
2456 (list (read-file-name "Create group from directory: ")))
2457 (unless (file-exists-p dir)
2458 (error "No such directory"))
2459 (unless (file-directory-p dir)
2460 (error "Not a directory"))
2464 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb))
2466 (gnus-group-prefixed-name
2467 (expand-file-name ext dir)
2469 (setq ext (format "<%d>" (setq i (1+ i)))))
2470 (gnus-group-make-group
2471 (gnus-group-real-name group)
2472 (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir)))))
2474 (eval-when-compile (defvar nnkiboze-score-file))
2475 (defun gnus-group-make-kiboze-group (group address scores)
2476 "Create an nnkiboze group.
2477 The user will be prompted for a name, a regexp to match groups, and
2478 score file entries for articles to include in the group."
2481 (read-string "nnkiboze group name: ")
2482 (read-string "Source groups (regexp): ")
2483 (let ((headers (mapcar (lambda (group) (list group))
2484 '("subject" "from" "number" "date" "message-id"
2485 "references" "chars" "lines" "xref"
2486 "followup" "all" "body" "head")))
2487 scores header regexp regexps)
2488 (while (not (equal "" (setq header (completing-read
2489 "Match on header: " headers nil t))))
2491 (while (not (equal "" (setq regexp (read-string
2492 (format "Match on %s (regexp): "
2494 (push (list regexp nil nil 'r) regexps))
2495 (push (cons header regexps) scores))
2497 (gnus-group-make-group group "nnkiboze" address)
2498 (let* ((nnkiboze-current-group group)
2499 (score-file (car (nnkiboze-score-file "")))
2500 (score-dir (file-name-directory score-file)))
2501 (unless (file-exists-p score-dir)
2502 (make-directory score-dir))
2503 (with-temp-file score-file
2504 (let (emacs-lisp-mode-hook)
2505 (pp scores (current-buffer))))))
2507 (defun gnus-group-add-to-virtual (n vgroup)
2508 "Add the current group to a virtual group."
2510 (list current-prefix-arg
2511 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2513 (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
2514 (error "%s is not an nnvirtual group" vgroup))
2515 (gnus-close-group vgroup)
2516 (let* ((groups (gnus-group-process-prefix n))
2517 (method (gnus-info-method (gnus-get-info vgroup))))
2518 (setcar (cdr method)
2520 (nth 1 method) "\\|"
2523 (gnus-group-remove-mark s)
2524 (concat "\\(^" (regexp-quote s) "$\\)"))
2526 (gnus-group-position-point))
2528 (defun gnus-group-make-empty-virtual (group)
2529 "Create a new, fresh, empty virtual group."
2530 (interactive "sCreate new, empty virtual group: ")
2531 (let* ((method (list 'nnvirtual "^$"))
2532 (pgroup (gnus-group-prefixed-name group method)))
2533 ;; Check whether it exists already.
2534 (when (gnus-gethash pgroup gnus-newsrc-hashtb)
2535 (error "Group %s already exists" pgroup))
2536 ;; Subscribe the new group after the group on the current line.
2537 (gnus-subscribe-group pgroup (gnus-group-group-name) method)
2538 (gnus-group-update-group pgroup)
2540 (gnus-group-position-point)))
2542 (defun gnus-group-enter-directory (dir)
2543 "Enter an ephemeral nneething group."
2544 (interactive "DDirectory to read: ")
2545 (let* ((method (list 'nneething dir '(nneething-read-only t)))
2546 (leaf (gnus-group-prefixed-name
2547 (file-name-nondirectory (directory-file-name dir))
2549 (name (gnus-generate-new-group-name leaf)))
2550 (unless (gnus-group-read-ephemeral-group
2552 (cons (current-buffer)
2553 (if (eq major-mode 'gnus-summary-mode)
2555 (error "Couldn't enter %s" dir))))
2558 (autoload 'nnimap-expunge "nnimap")
2559 (autoload 'nnimap-acl-get "nnimap")
2560 (autoload 'nnimap-acl-edit "nnimap"))
2562 (defun gnus-group-nnimap-expunge (group)
2563 "Expunge deleted articles in current nnimap GROUP."
2564 (interactive (list (gnus-group-group-name)))
2565 (let ((mailbox (gnus-group-real-name group)) method)
2567 (error "No group on current line"))
2568 (unless (gnus-get-info group)
2569 (error "Killed group; can't be edited"))
2570 (unless (eq 'nnimap (car (setq method (gnus-find-method-for-group group))))
2571 (error "%s is not an nnimap group" group))
2572 (nnimap-expunge mailbox (cadr method))))
2574 (defun gnus-group-nnimap-edit-acl (group)
2575 "Edit the Access Control List of current nnimap GROUP."
2576 (interactive (list (gnus-group-group-name)))
2577 (let ((mailbox (gnus-group-real-name group)) method acl)
2579 (error "No group on current line"))
2580 (unless (gnus-get-info group)
2581 (error "Killed group; can't be edited"))
2582 (unless (eq (car (setq method (gnus-find-method-for-group group))) 'nnimap)
2583 (error "%s is not an nnimap group" group))
2584 (unless (setq acl (nnimap-acl-get mailbox (cadr method)))
2585 (error "Server does not support ACL's"))
2586 (gnus-edit-form acl (format "Editing the access control list for `%s'.
2588 An access control list is a list of (identifier . rights) elements.
2590 The identifier string specifies the corresponding user. The
2591 identifier \"anyone\" is reserved to refer to the universal identity.
2593 Rights is a string listing a (possibly empty) set of alphanumeric
2594 characters, each character listing a set of operations which is being
2595 controlled. Letters are reserved for ``standard'' rights, listed
2596 below. Digits are reserved for implementation or site defined rights.
2598 l - lookup (mailbox is visible to LIST/LSUB commands)
2599 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2600 SEARCH, COPY from mailbox)
2601 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2602 w - write (STORE flags other than \\SEEN and \\DELETED)
2603 i - insert (perform APPEND, COPY into mailbox)
2604 p - post (send mail to submission address for mailbox,
2605 not enforced by IMAP4 itself)
2606 c - create and delete mailbox (CREATE new sub-mailboxes in any
2607 implementation-defined hierarchy, RENAME or DELETE mailbox)
2608 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2609 a - administer (perform SETACL)" group)
2612 ,mailbox ',method ',acl form)))))
2614 ;; Group sorting commands
2615 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2617 (defun gnus-group-sort-groups (func &optional reverse)
2618 "Sort the group buffer according to FUNC.
2619 When used interactively, the sorting function used will be
2620 determined by the `gnus-group-sort-function' variable.
2621 If REVERSE (the prefix), reverse the sorting order."
2622 (interactive (list gnus-group-sort-function current-prefix-arg))
2623 (funcall gnus-group-sort-alist-function
2624 (gnus-make-sort-function func) reverse)
2625 (gnus-group-list-groups)
2626 (gnus-dribble-touch))
2628 (defun gnus-group-sort-flat (func reverse)
2629 ;; We peel off the dummy group from the alist.
2631 (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group")
2632 (pop gnus-newsrc-alist))
2634 (setq gnus-newsrc-alist
2635 (sort gnus-newsrc-alist func))
2637 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
2638 ;; Regenerate the hash table.
2639 (gnus-make-hashtable-from-newsrc-alist)))
2641 (defun gnus-group-sort-groups-by-alphabet (&optional reverse)
2642 "Sort the group buffer alphabetically by group name.
2643 If REVERSE, sort in reverse order."
2645 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse))
2647 (defun gnus-group-sort-groups-by-unread (&optional reverse)
2648 "Sort the group buffer by number of unread articles.
2649 If REVERSE, sort in reverse order."
2651 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse))
2653 (defun gnus-group-sort-groups-by-level (&optional reverse)
2654 "Sort the group buffer by group level.
2655 If REVERSE, sort in reverse order."
2657 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse))
2659 (defun gnus-group-sort-groups-by-score (&optional reverse)
2660 "Sort the group buffer by group score.
2661 If REVERSE, sort in reverse order."
2663 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse))
2665 (defun gnus-group-sort-groups-by-rank (&optional reverse)
2666 "Sort the group buffer by group rank.
2667 If REVERSE, sort in reverse order."
2669 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse))
2671 (defun gnus-group-sort-groups-by-method (&optional reverse)
2672 "Sort the group buffer alphabetically by backend name.
2673 If REVERSE, sort in reverse order."
2675 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse))
2677 (defun gnus-group-sort-groups-by-server (&optional reverse)
2678 "Sort the group buffer alphabetically by server name.
2679 If REVERSE, sort in reverse order."
2681 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse))
2683 ;;; Selected group sorting.
2685 (defun gnus-group-sort-selected-groups (n func &optional reverse)
2686 "Sort the process/prefixed groups."
2687 (interactive (list current-prefix-arg gnus-group-sort-function))
2688 (let ((groups (gnus-group-process-prefix n)))
2689 (funcall gnus-group-sort-selected-function
2690 groups (gnus-make-sort-function func) reverse)
2691 (gnus-group-list-groups)))
2693 (defun gnus-group-sort-selected-flat (groups func reverse)
2694 (let (entries infos)
2695 ;; First find all the group entries for these groups.
2697 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb))
2699 ;; Then sort the infos.
2703 (lambda (entry) (car entry))
2704 (setq entries (nreverse entries)))
2707 (setq infos (nreverse infos)))
2708 ;; Go through all the infos and replace the old entries
2709 ;; with the new infos.
2711 (setcar (car entries) (pop infos))
2713 ;; Update the hashtable.
2714 (gnus-make-hashtable-from-newsrc-alist)))
2716 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse)
2717 "Sort the group buffer alphabetically by group name.
2718 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2719 sort in reverse order."
2720 (interactive (gnus-interactive "P\ny"))
2721 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-alphabet reverse))
2723 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse)
2724 "Sort the group buffer by number of unread articles.
2725 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2726 sort in reverse order."
2727 (interactive (gnus-interactive "P\ny"))
2728 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-unread reverse))
2730 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse)
2731 "Sort the group buffer by group level.
2732 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2733 sort in reverse order."
2734 (interactive (gnus-interactive "P\ny"))
2735 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-level reverse))
2737 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse)
2738 "Sort the group buffer by group score.
2739 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2740 sort in reverse order."
2741 (interactive (gnus-interactive "P\ny"))
2742 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-score reverse))
2744 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse)
2745 "Sort the group buffer by group rank.
2746 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2747 sort in reverse order."
2748 (interactive (gnus-interactive "P\ny"))
2749 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-rank reverse))
2751 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse)
2752 "Sort the group buffer alphabetically by backend name.
2753 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2754 sort in reverse order."
2755 (interactive (gnus-interactive "P\ny"))
2756 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-method reverse))
2758 ;;; Sorting predicates.
2760 (defun gnus-group-sort-by-alphabet (info1 info2)
2761 "Sort alphabetically."
2762 (string< (gnus-info-group info1) (gnus-info-group info2)))
2764 (defun gnus-group-sort-by-real-name (info1 info2)
2765 "Sort alphabetically on real (unprefixed) names."
2766 (string< (gnus-group-real-name (gnus-info-group info1))
2767 (gnus-group-real-name (gnus-info-group info2))))
2769 (defun gnus-group-sort-by-unread (info1 info2)
2770 "Sort by number of unread articles."
2771 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb)))
2772 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb))))
2773 (< (or (and (numberp n1) n1) 0)
2774 (or (and (numberp n2) n2) 0))))
2776 (defun gnus-group-sort-by-level (info1 info2)
2778 (< (gnus-info-level info1) (gnus-info-level info2)))
2780 (defun gnus-group-sort-by-method (info1 info2)
2781 "Sort alphabetically by backend name."
2782 (string< (symbol-name (car (gnus-find-method-for-group
2783 (gnus-info-group info1) info1)))
2784 (symbol-name (car (gnus-find-method-for-group
2785 (gnus-info-group info2) info2)))))
2787 (defun gnus-group-sort-by-server (info1 info2)
2788 "Sort alphabetically by server name."
2789 (string< (gnus-method-to-server-name
2790 (gnus-find-method-for-group
2791 (gnus-info-group info1) info1))
2792 (gnus-method-to-server-name
2793 (gnus-find-method-for-group
2794 (gnus-info-group info2) info2))))
2796 (defun gnus-group-sort-by-score (info1 info2)
2797 "Sort by group score."
2798 (> (gnus-info-score info1) (gnus-info-score info2)))
2800 (defun gnus-group-sort-by-rank (info1 info2)
2801 "Sort by level and score."
2802 (let ((level1 (gnus-info-level info1))
2803 (level2 (gnus-info-level info2)))
2804 (or (< level1 level2)
2805 (and (= level1 level2)
2806 (> (gnus-info-score info1) (gnus-info-score info2))))))
2810 (defun gnus-group-clear-data (&optional arg)
2811 "Clear all marks and read ranges from the current group."
2813 (gnus-group-iterate arg
2816 (gnus-info-clear-data (setq info (gnus-get-info group)))
2817 (gnus-get-unread-articles-in-group info (gnus-active group) t)
2818 (when (gnus-group-goto-group group)
2819 (gnus-group-update-group-line))))))
2821 (defun gnus-group-clear-data-on-native-groups ()
2822 "Clear all marks and read ranges from all native groups."
2824 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
2825 (let ((alist (cdr gnus-newsrc-alist))
2827 (while (setq info (pop alist))
2828 (when (gnus-group-native-p (gnus-info-group info))
2829 (gnus-info-clear-data info)))
2830 (gnus-get-unread-articles)
2831 (gnus-dribble-touch)
2832 (when (gnus-y-or-n-p
2833 "Move the cache away to avoid problems in the future? ")
2834 (call-interactively 'gnus-cache-move-cache)))))
2836 (defun gnus-info-clear-data (info)
2837 "Clear all marks and read ranges from INFO."
2838 (let ((group (gnus-info-group info)))
2841 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
2842 (gnus-info-set-read ',info ',(gnus-info-read info))
2843 (when (gnus-group-goto-group ,group)
2844 (gnus-group-update-group-line))))
2845 (gnus-info-set-read info nil)
2846 (when (gnus-info-marks info)
2847 (gnus-info-set-marks info nil))))
2849 ;; Group catching up.
2851 (defun gnus-group-catchup-current (&optional n all)
2852 "Mark all unread articles in the current newsgroup as read.
2853 If prefix argument N is numeric, the next N newsgroups will be
2854 caught up. If ALL is non-nil, marked articles will also be marked as
2855 read. Cross references (Xref: header) of articles are ignored.
2856 The number of newsgroups that this function was unable to catch
2859 (let ((groups (gnus-group-process-prefix n))
2862 (unless groups (error "No groups selected"))
2864 (or (not gnus-interactive-catchup) ;Without confirmation?
2869 "Do you really want to mark all articles in %s as read? "
2870 "Mark all unread articles in %s as read? ")
2871 (if (= (length groups) 1)
2873 (format "these %d groups" (length groups)))))))
2875 (while (setq group (pop groups))
2876 (gnus-group-remove-mark group)
2877 ;; Virtual groups have to be given special treatment.
2878 (let ((method (gnus-find-method-for-group group)))
2879 (when (eq 'nnvirtual (car method))
2880 (nnvirtual-catchup-group
2881 (gnus-group-real-name group) (nth 1 method) all)))
2882 (if (>= (gnus-group-level group) gnus-level-zombie)
2883 (gnus-message 2 "Dead groups can't be caught up")
2885 (gnus-group-goto-group group)
2886 (gnus-group-catchup group all))
2887 (gnus-group-update-group-line)
2888 (setq ret (1+ ret)))))
2889 (gnus-group-next-unread-group 1)
2892 (defun gnus-group-catchup-current-all (&optional n)
2893 "Mark all articles in current newsgroup as read.
2894 Cross references (Xref: header) of articles are ignored."
2896 (gnus-group-catchup-current n 'all))
2898 (defun gnus-group-catchup (group &optional all)
2899 "Mark all articles in GROUP as read.
2900 If ALL is non-nil, all articles are marked as read.
2901 The return value is the number of articles that were marked as read,
2902 or nil if no action could be taken."
2903 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
2905 ;; Remove entries for this group.
2906 (nnmail-purge-split-history (gnus-group-real-name group))
2907 ;; Do the updating only if the newsgroup isn't killed.
2908 (if (not (numberp (car entry)))
2909 (gnus-message 1 "Can't catch up %s; non-active group" group)
2910 ;; Do auto-expirable marks if that's required.
2911 (when (gnus-group-auto-expirable-p group)
2912 (gnus-add-marked-articles
2913 group 'expire (gnus-list-of-unread-articles group))
2915 (let ((marks (nth 3 (nth 2 entry))))
2916 (gnus-add-marked-articles
2917 group 'expire (gnus-uncompress-range (cdr (assq 'tick marks))))
2918 (gnus-add-marked-articles
2919 group 'expire (gnus-uncompress-range (cdr (assq 'tick marks)))))))
2921 (gnus-update-read-articles group nil)
2922 ;; Also nix out the lists of marks and dormants.
2924 (gnus-add-marked-articles group 'tick nil nil 'force)
2925 (gnus-add-marked-articles group 'dormant nil nil 'force))
2926 (let ((gnus-newsgroup-name group))
2927 (gnus-run-hooks 'gnus-group-catchup-group-hook))
2930 (defun gnus-group-expire-articles (&optional n)
2931 "Expire all expirable articles in the current newsgroup."
2933 (let ((groups (gnus-group-process-prefix n))
2936 (error "No groups to expire"))
2937 (while (setq group (pop groups))
2938 (gnus-group-remove-mark group)
2939 (gnus-group-expire-articles-1 group)
2940 (gnus-dribble-touch)
2941 (gnus-group-position-point))))
2943 (defun gnus-group-expire-articles-1 (group)
2944 (when (gnus-check-backend-function 'request-expire-articles group)
2945 (gnus-message 6 "Expiring articles in %s..." group)
2946 (let* ((info (gnus-get-info group))
2947 (expirable (if (gnus-group-total-expirable-p group)
2948 (cons nil (gnus-list-of-read-articles group))
2949 (assq 'expire (gnus-info-marks info))))
2950 (expiry-wait (gnus-group-find-parameter group 'expiry-wait))
2951 (nnmail-expiry-target
2952 (or (gnus-group-find-parameter group 'expiry-target)
2953 nnmail-expiry-target)))
2955 (gnus-check-group group)
2958 (gnus-compress-sequence
2960 ;; We set the expiry variables to the group
2962 (let ((nnmail-expiry-wait-function nil)
2963 (nnmail-expiry-wait expiry-wait))
2964 (gnus-request-expire-articles
2965 (gnus-uncompress-sequence (cdr expirable)) group))
2966 ;; Just expire using the normal expiry values.
2967 (gnus-request-expire-articles
2968 (gnus-uncompress-sequence (cdr expirable)) group))))
2969 (gnus-close-group group))
2970 (gnus-message 6 "Expiring articles in %s...done" group)
2971 ;; Return the list of un-expired articles.
2974 (defun gnus-group-expire-all-groups ()
2975 "Expire all expirable articles in all newsgroups."
2978 (gnus-message 5 "Expiring...")
2979 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info))
2980 (cdr gnus-newsrc-alist))))
2981 (gnus-group-expire-articles nil)))
2982 (gnus-group-position-point)
2983 (gnus-message 5 "Expiring...done"))
2985 (defun gnus-group-set-current-level (n level)
2986 "Set the level of the next N groups to LEVEL."
2991 (let ((s (read-string
2992 (format "Level (default %s): "
2993 (or (gnus-group-group-level)
2994 gnus-level-default-subscribed)))))
2995 (if (string-match "^\\s-*$" s)
2996 (int-to-string (or (gnus-group-group-level)
2997 gnus-level-default-subscribed))
2999 (unless (and (>= level 1) (<= level gnus-level-killed))
3000 (error "Invalid level: %d" level))
3001 (let ((groups (gnus-group-process-prefix n))
3003 (while (setq group (pop groups))
3004 (gnus-group-remove-mark group)
3005 (gnus-message 6 "Changed level of %s from %d to %d"
3006 group (or (gnus-group-group-level) gnus-level-killed)
3008 (gnus-group-change-level
3009 group level (or (gnus-group-group-level) gnus-level-killed))
3010 (gnus-group-update-group-line)))
3011 (gnus-group-position-point))
3013 (defun gnus-group-unsubscribe (&optional n)
3014 "Unsubscribe the current group."
3016 (gnus-group-unsubscribe-current-group n 'unsubscribe))
3018 (defun gnus-group-subscribe (&optional n)
3019 "Subscribe the current group."
3021 (gnus-group-unsubscribe-current-group n 'subscribe))
3023 (defun gnus-group-unsubscribe-current-group (&optional n do-sub)
3024 "Toggle subscription of the current group.
3025 If given numerical prefix, toggle the N next groups."
3027 (let ((groups (gnus-group-process-prefix n))
3030 (setq group (car groups)
3031 groups (cdr groups))
3032 (gnus-group-remove-mark group)
3033 (gnus-group-unsubscribe-group
3036 ((eq do-sub 'unsubscribe)
3037 gnus-level-default-unsubscribed)
3038 ((eq do-sub 'subscribe)
3039 gnus-level-default-subscribed)
3040 ((<= (gnus-group-group-level) gnus-level-subscribed)
3041 gnus-level-default-unsubscribed)
3043 gnus-level-default-subscribed))
3045 (gnus-group-update-group-line))
3046 (gnus-group-next-group 1)))
3048 (defun gnus-group-unsubscribe-group (group &optional level silent)
3049 "Toggle subscription to GROUP.
3050 Killed newsgroups are subscribed. If SILENT, don't try to update the
3053 (list (completing-read
3054 "Group: " gnus-active-hashtb nil
3055 (gnus-read-active-file-p)
3057 'gnus-group-history)))
3058 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
3060 ((string-match "^[ \t]*$" group)
3061 (error "Empty group name"))
3063 ;; Toggle subscription flag.
3064 (gnus-group-change-level
3065 newsrc (if level level (if (<= (gnus-info-level (nth 2 newsrc))
3066 gnus-level-subscribed)
3067 (1+ gnus-level-subscribed)
3068 gnus-level-default-subscribed)))
3070 (gnus-group-update-group group)))
3071 ((and (stringp group)
3072 (or (not (gnus-read-active-file-p))
3073 (gnus-active group)))
3074 ;; Add new newsgroup.
3075 (gnus-group-change-level
3077 (if level level gnus-level-default-subscribed)
3078 (or (and (member group gnus-zombie-list)
3081 (when (gnus-group-group-name)
3082 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb)))
3084 (gnus-group-update-group group)))
3085 (t (error "No such newsgroup: %s" group)))
3086 (gnus-group-position-point)))
3088 (defun gnus-group-transpose-groups (n)
3089 "Move the current newsgroup up N places.
3090 If given a negative prefix, move down instead. The difference between
3091 N and the number of steps taken is returned."
3093 (unless (gnus-group-group-name)
3094 (error "No group on current line"))
3095 (gnus-group-kill-group 1)
3097 (forward-line (- n))
3098 (gnus-group-yank-group)
3099 (gnus-group-position-point)))
3101 (defun gnus-group-kill-all-zombies (&optional dummy)
3102 "Kill all zombie newsgroups.
3103 The optional DUMMY should always be nil."
3104 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3106 (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list))
3107 (setq gnus-zombie-list nil)
3108 (gnus-dribble-touch)
3109 (gnus-group-list-groups)))
3111 (defun gnus-group-kill-region (begin end)
3112 "Kill newsgroups in current region (excluding current point).
3113 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3128 (beginning-of-line) ;Important when LINES < 1
3129 (gnus-group-kill-group lines)))
3131 (defun gnus-group-kill-group (&optional n discard)
3132 "Kill the next N groups.
3133 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3134 However, only groups that were alive can be yanked; already killed
3135 groups or zombie groups can't be yanked.
3136 The return value is the name of the group that was killed, or a list
3139 (let ((buffer-read-only nil)
3140 (groups (gnus-group-process-prefix n))
3141 group entry level out)
3142 (if (< (length groups) 10)
3143 ;; This is faster when there are few groups.
3145 (push (setq group (pop groups)) out)
3146 (gnus-group-remove-mark group)
3147 (setq level (gnus-group-group-level))
3149 (when (and (not discard)
3150 (setq entry (gnus-gethash group gnus-newsrc-hashtb)))
3153 (gnus-group-goto-group ,(gnus-group-group-name))
3154 (gnus-group-yank-group)))
3155 (push (cons (car entry) (nth 2 entry))
3156 gnus-list-of-killed-groups))
3157 (gnus-group-change-level
3158 (if entry entry group) gnus-level-killed (if entry nil level))
3159 (message "Killed group %s" group))
3160 ;; If there are lots and lots of groups to be killed, we use
3161 ;; this thing instead.
3163 (setq groups (nreverse groups))
3165 (gnus-group-remove-mark (setq group (pop groups)))
3167 (push group gnus-killed-list)
3168 (setq gnus-newsrc-alist
3169 (delq (assoc group gnus-newsrc-alist)
3171 (when gnus-group-change-level-function
3172 (funcall gnus-group-change-level-function
3173 group gnus-level-killed 3))
3175 ((setq entry (gnus-gethash group gnus-newsrc-hashtb))
3176 (push (cons (car entry) (nth 2 entry))
3177 gnus-list-of-killed-groups)
3178 (setcdr (cdr entry) (cdddr entry)))
3179 ((member group gnus-zombie-list)
3180 (setq gnus-zombie-list (delete group gnus-zombie-list))))
3181 ;; There may be more than one instance displayed.
3182 (while (gnus-group-goto-group group)
3183 (gnus-delete-line)))
3184 (gnus-make-hashtable-from-newsrc-alist)))
3186 (gnus-group-position-point)
3187 (if (< (length out) 2) (car out) (nreverse out))))
3189 (defun gnus-group-yank-group (&optional arg)
3190 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3191 The numeric ARG specifies how many newsgroups are to be yanked. The
3192 name of the newsgroup yanked is returned, or (if several groups are
3193 yanked) a list of yanked groups is returned."
3195 (setq arg (or arg 1))
3196 (let (info group prev out)
3197 (while (>= (decf arg) 0)
3198 (when (not (setq info (pop gnus-list-of-killed-groups)))
3199 (error "No more newsgroups to yank"))
3200 (push (setq group (nth 1 info)) out)
3201 ;; Find which newsgroup to insert this one before - search
3202 ;; backward until something suitable is found. If there are no
3203 ;; other newsgroups in this buffer, just make this newsgroup the
3205 (setq prev (gnus-group-group-name))
3206 (gnus-group-change-level
3207 info (gnus-info-level (cdr info)) gnus-level-killed
3208 (and prev (gnus-gethash prev gnus-newsrc-hashtb))
3210 (gnus-group-insert-group-line-info group)
3212 `(when (gnus-group-goto-group ,group)
3213 (gnus-group-kill-group 1))))
3215 (gnus-group-position-point)
3216 (if (< (length out) 2) (car out) (nreverse out))))
3218 (defun gnus-group-kill-level (level)
3219 "Kill all groups that is on a certain LEVEL."
3220 (interactive "nKill all groups on level: ")
3222 ((= level gnus-level-zombie)
3223 (setq gnus-killed-list
3224 (nconc gnus-zombie-list gnus-killed-list))
3225 (setq gnus-zombie-list nil))
3226 ((and (< level gnus-level-zombie)
3228 (or gnus-expert-user
3231 "Do you really want to kill all groups on level %d? "
3233 (let* ((prev gnus-newsrc-alist)
3236 (if (= (gnus-info-level (car alist)) level)
3238 (push (gnus-info-group (car alist)) gnus-killed-list)
3239 (setcdr prev (cdr alist)))
3241 (setq alist (cdr alist)))
3242 (gnus-make-hashtable-from-newsrc-alist)
3243 (gnus-group-list-groups)))
3245 (error "Can't kill; invalid level: %d" level))))
3247 (defun gnus-group-list-all-groups (&optional arg)
3248 "List all newsgroups with level ARG or lower.
3249 Default is gnus-level-unsubscribed, which lists all subscribed and most
3250 unsubscribed groups."
3252 (gnus-group-list-groups (or arg gnus-level-unsubscribed) t))
3254 ;; Redefine this to list ALL killed groups if prefix arg used.
3255 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3256 (defun gnus-group-list-killed (&optional arg)
3257 "List all killed newsgroups in the group buffer.
3258 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3259 entail asking the server for the groups."
3261 ;; Find all possible killed newsgroups if arg.
3263 (gnus-get-killed-groups))
3264 (if (not gnus-killed-list)
3265 (gnus-message 6 "No killed groups")
3266 (let (gnus-group-list-mode)
3267 (funcall gnus-group-prepare-function
3268 gnus-level-killed t gnus-level-killed))
3269 (goto-char (point-min)))
3270 (gnus-group-position-point))
3272 (defun gnus-group-list-zombies ()
3273 "List all zombie newsgroups in the group buffer."
3275 (if (not gnus-zombie-list)
3276 (gnus-message 6 "No zombie groups")
3277 (let (gnus-group-list-mode)
3278 (funcall gnus-group-prepare-function
3279 gnus-level-zombie t gnus-level-zombie))
3280 (goto-char (point-min)))
3281 (gnus-group-position-point))
3283 (defun gnus-group-list-active ()
3284 "List all groups that are available from the server(s)."
3286 ;; First we make sure that we have really read the active file.
3287 (unless (gnus-read-active-file-p)
3288 (let ((gnus-read-active-file t)
3289 (gnus-agent nil)) ; Trick the agent into ignoring the active file.
3290 (gnus-read-active-file)))
3291 ;; Find all groups and sort them.
3299 (push (symbol-name sym) list)))
3303 (buffer-read-only nil)
3307 (setq group (pop groups))
3308 (gnus-add-text-properties
3309 (point) (prog1 (1+ (point))
3311 (gnus-group-decoded-name group)
3313 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
3315 'gnus-level (inline (gnus-group-level group)))))
3316 (goto-char (point-min))))
3318 (defun gnus-activate-all-groups (level)
3319 "Activate absolutely all groups."
3320 (interactive (list gnus-level-unsubscribed))
3321 (let ((gnus-activate-level level)
3322 (gnus-activate-foreign-newsgroups level))
3323 (gnus-group-get-new-news)))
3325 (defun gnus-group-get-new-news (&optional arg)
3326 "Get newly arrived articles.
3327 If ARG is a number, it specifies which levels you are interested in
3328 re-scanning. If ARG is non-nil and not a number, this will force
3329 \"hard\" re-reading of the active files from all servers."
3332 (let ((gnus-inhibit-demon t)
3333 ;; Binding this variable will inhibit multiple fetchings
3334 ;; of the same mail source.
3335 (nnmail-fetched-sources (list t)))
3336 (gnus-run-hooks 'gnus-get-new-news-hook)
3338 ;; Read any slave files.
3340 (gnus-master-read-slave-newsrc))
3342 ;; We might read in new NoCeM messages here.
3343 (when (and gnus-use-nocem
3345 (gnus-nocem-scan-groups))
3346 ;; If ARG is not a number, then we read the active file.
3347 (when (and arg (not (numberp arg)))
3348 (let ((gnus-read-active-file t))
3349 (gnus-read-active-file))
3352 ;; If the user wants it, we scan for new groups.
3353 (when (eq gnus-check-new-newsgroups 'always)
3354 (gnus-find-new-newsgroups)))
3356 (setq arg (gnus-group-default-level arg t))
3357 (if (and gnus-read-active-file (not arg))
3359 (gnus-read-active-file)
3360 (gnus-get-unread-articles arg))
3361 (let ((gnus-read-active-file (if arg nil gnus-read-active-file)))
3362 (gnus-get-unread-articles arg)))
3363 (gnus-run-hooks 'gnus-after-getting-new-news-hook)
3364 (gnus-group-list-groups (and (numberp arg)
3365 (max (car gnus-group-list-mode) arg))))
3367 (when (and gnus-agent (not (interactive-p)))
3368 (gnus-agent-toggle-plugged gnus-plugged)))
3370 (defun gnus-group-get-new-news-this-group (&optional n dont-scan)
3371 "Check for newly arrived news in the current group (and the N-1 next groups).
3372 The difference between N and the number of newsgroup checked is returned.
3373 If N is negative, this group and the N-1 previous groups will be checked."
3375 (let* ((groups (gnus-group-process-prefix n))
3376 (ret (if (numberp n) (- n (length groups)) 0))
3380 (gnus-inhibit-demon t)
3381 ;; Binding this variable will inhibit multiple fetchings
3382 ;; of the same mail source.
3383 (nnmail-fetched-sources (list t)))
3384 (gnus-run-hooks 'gnus-get-new-news-hook)
3385 (while (setq group (pop groups))
3386 (gnus-group-remove-mark group)
3387 ;; Bypass any previous denials from the server.
3388 (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
3389 (if (gnus-activate-group group (if dont-scan nil 'scan))
3391 (gnus-get-unread-articles-in-group
3392 (gnus-get-info group) (gnus-active group) t)
3393 (unless (gnus-virtual-group-p group)
3394 (gnus-close-group group))
3396 (gnus-agent-save-group-info
3397 method (gnus-group-real-name group) (gnus-active group)))
3398 (gnus-group-update-group group))
3399 (if (eq (gnus-server-status (gnus-find-method-for-group group))
3401 (gnus-error 3 "Server denied access")
3402 (gnus-error 3 "%s error: %s" group (gnus-status-message group)))))
3405 (when gnus-goto-next-group-when-activating
3406 (gnus-group-next-unread-group 1 t))
3407 (gnus-summary-position-point)
3410 (defun gnus-group-fetch-faq (group &optional faq-dir)
3411 "Fetch the FAQ for the current group.
3412 If given a prefix argument, prompt for the FAQ dir
3416 (gnus-group-group-name)
3417 (when current-prefix-arg
3419 "Faq dir: " (and (listp gnus-group-faq-directory)
3421 gnus-group-faq-directory))))))
3423 (error "No group name given"))
3424 (let ((dirs (or faq-dir gnus-group-faq-directory))
3426 (unless (listp dirs)
3427 (setq dirs (list dirs)))
3428 (while (and (not found)
3429 (setq dir (pop dirs)))
3430 (let ((name (gnus-group-real-name group)))
3431 (setq file (expand-file-name name dir)))
3432 (if (not (file-exists-p file))
3433 (gnus-message 1 "No such file: %s" file)
3434 (let ((enable-local-variables nil))
3438 (defun gnus-group-describe-group (force &optional group)
3439 "Display a description of the current newsgroup."
3440 (interactive (list current-prefix-arg (gnus-group-group-name)))
3441 (let* ((method (gnus-find-method-for-group group))
3442 (mname (gnus-group-prefixed-name "" method))
3445 gnus-description-hashtb)
3446 (gnus-sethash mname nil gnus-description-hashtb))
3448 (error "No group name given"))
3449 (when (or (and gnus-description-hashtb
3450 ;; We check whether this group's method has been
3451 ;; queried for a description file.
3452 (gnus-gethash mname gnus-description-hashtb))
3453 (setq desc (gnus-group-get-description group))
3454 (gnus-read-descriptions-file method))
3456 (or desc (gnus-gethash group gnus-description-hashtb)
3457 "No description available")))))
3459 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3460 (defun gnus-group-describe-all-groups (&optional force)
3461 "Pop up a buffer with descriptions of all newsgroups."
3464 (setq gnus-description-hashtb nil))
3465 (when (not (or gnus-description-hashtb
3466 (gnus-read-all-descriptions-files)))
3467 (error "Couldn't request descriptions file"))
3468 (let ((buffer-read-only nil)
3474 (let ((charset (gnus-group-name-charset nil (symbol-name group))))
3475 (insert (format " *: %-20s %s\n"
3476 (gnus-group-name-decode
3477 (symbol-name group) charset)
3478 (gnus-group-name-decode
3479 (symbol-value group) charset))))
3480 (gnus-add-text-properties
3481 b (1+ b) (list 'gnus-group group
3482 'gnus-unread t 'gnus-marked nil
3483 'gnus-level (1+ gnus-level-subscribed))))
3484 gnus-description-hashtb)
3485 (goto-char (point-min))
3486 (gnus-group-position-point)))
3488 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3489 (defun gnus-group-apropos (regexp &optional search-description)
3490 "List all newsgroups that have names that match a regexp."
3491 (interactive "sGnus apropos (regexp): ")
3493 (obuf (current-buffer))
3495 ;; Go through all newsgroups that are known to Gnus.
3498 (and (symbol-name group)
3499 (string-match regexp (symbol-name group))
3500 (symbol-value group)
3501 (push (symbol-name group) groups)))
3503 ;; Also go through all descriptions that are known to Gnus.
3504 (when search-description
3507 (and (string-match regexp (symbol-value group))
3508 (push (symbol-name group) groups)))
3509 gnus-description-hashtb))
3511 (gnus-message 3 "No groups matched \"%s\"." regexp)
3512 ;; Print out all the groups.
3514 (pop-to-buffer "*Gnus Help*")
3515 (buffer-disable-undo)
3517 (setq groups (sort groups 'string<))
3519 ;; Groups may be entered twice into the list of groups.
3520 (when (not (string= (car groups) prev))
3521 (setq prev (car groups))
3522 (let ((charset (gnus-group-name-charset nil prev)))
3523 (insert (gnus-group-name-decode prev charset) "\n")
3524 (when (and gnus-description-hashtb
3525 (setq des (gnus-gethash (car groups)
3526 gnus-description-hashtb)))
3527 (insert " " (gnus-group-name-decode des charset) "\n"))))
3528 (setq groups (cdr groups)))
3529 (goto-char (point-min))))
3530 (pop-to-buffer obuf)))
3532 (defun gnus-group-description-apropos (regexp)
3533 "List all newsgroups that have names or descriptions that match a regexp."
3534 (interactive "sGnus description apropos (regexp): ")
3535 (when (not (or gnus-description-hashtb
3536 (gnus-read-all-descriptions-files)))
3537 (error "Couldn't request descriptions file"))
3538 (gnus-group-apropos regexp t))
3540 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3541 (defun gnus-group-list-matching (level regexp &optional all lowest)
3542 "List all groups with unread articles that match REGEXP.
3543 If the prefix LEVEL is non-nil, it should be a number that says which
3544 level to cut off listing groups.
3545 If ALL, also list groups with no unread articles.
3546 If LOWEST, don't list groups with level lower than LOWEST.
3548 This command may read the active file."
3549 (interactive "P\nsList newsgroups matching: ")
3550 ;; First make sure active file has been read.
3552 (> (prefix-numeric-value level) gnus-level-killed))
3553 (gnus-get-killed-groups))
3554 (funcall gnus-group-prepare-function
3555 (or level gnus-level-subscribed) (and all t) (or lowest 1) regexp)
3556 (goto-char (point-min))
3557 (gnus-group-position-point))
3559 (defun gnus-group-list-all-matching (level regexp &optional lowest)
3560 "List all groups that match REGEXP.
3561 If the prefix LEVEL is non-nil, it should be a number that says which
3562 level to cut off listing groups.
3563 If LOWEST, don't list groups with level lower than LOWEST."
3564 (interactive "P\nsList newsgroups matching: ")
3566 (setq level (prefix-numeric-value level)))
3567 (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest))
3569 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3570 (defun gnus-group-save-newsrc (&optional force)
3571 "Save the Gnus startup files.
3572 If FORCE, force saving whether it is necessary or not."
3574 (gnus-save-newsrc-file force))
3576 (defun gnus-group-restart (&optional arg)
3577 "Force Gnus to read the .newsrc file."
3579 (when (gnus-yes-or-no-p
3580 (format "Are you sure you want to restart Gnus? "))
3581 (gnus-save-newsrc-file)
3585 (defun gnus-group-read-init-file ()
3586 "Read the Gnus elisp init file."
3588 (gnus-read-init-file)
3589 (gnus-message 5 "Read %s" gnus-init-file))
3591 (defun gnus-group-check-bogus-groups (&optional silent)
3592 "Check bogus newsgroups.
3593 If given a prefix, don't ask for confirmation before removing a bogus
3596 (gnus-check-bogus-newsgroups (and (not silent) (not gnus-expert-user)))
3597 (gnus-group-list-groups))
3599 (defun gnus-group-find-new-groups (&optional arg)
3600 "Search for new groups and add them.
3601 Each new group will be treated with `gnus-subscribe-newsgroup-method.'
3602 With 1 C-u, use the `ask-server' method to query the server for new
3604 With 2 C-u's, use most complete method possible to query the server
3605 for new groups, and subscribe the new groups as zombies."
3607 (gnus-find-new-newsgroups (or arg 1))
3608 (gnus-group-list-groups))
3610 (defun gnus-group-edit-global-kill (&optional article group)
3611 "Edit the global kill file.
3612 If GROUP, edit that local kill file instead."
3614 (setq gnus-current-kill-article article)
3615 (gnus-kill-file-edit-file group)
3618 (substitute-command-keys
3619 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3620 (if group "local" "global")))))
3622 (defun gnus-group-edit-local-kill (article group)
3623 "Edit a local kill file."
3624 (interactive (list nil (gnus-group-group-name)))
3625 (gnus-group-edit-global-kill article group))
3627 (defun gnus-group-force-update ()
3628 "Update `.newsrc' file."
3630 (gnus-save-newsrc-file))
3632 (defun gnus-group-suspend ()
3633 "Suspend the current Gnus session.
3634 In fact, cleanup buffers except for group mode buffer.
3635 The hook gnus-suspend-gnus-hook is called before actually suspending."
3637 (gnus-run-hooks 'gnus-suspend-gnus-hook)
3638 (gnus-offer-save-summaries)
3639 ;; Kill Gnus buffers except for group mode buffer.
3640 (let ((group-buf (get-buffer gnus-group-buffer)))
3641 (mapcar (lambda (buf)
3642 (unless (member buf (list group-buf gnus-dribble-buffer))
3643 (gnus-kill-buffer buf)))
3645 (gnus-kill-gnus-frames)
3647 (bury-buffer group-buf)
3648 (delete-windows-on group-buf t))))
3650 (defun gnus-group-clear-dribble ()
3651 "Clear all information from the dribble buffer."
3653 (gnus-dribble-clear)
3654 (gnus-message 7 "Cleared dribble buffer"))
3656 (defun gnus-group-exit ()
3657 "Quit reading news after updating .newsrc.eld and .newsrc.
3658 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3661 (or noninteractive ;For gnus-batch-kill
3662 (not gnus-interactive-exit) ;Without confirmation
3664 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3665 (gnus-run-hooks 'gnus-exit-gnus-hook)
3666 ;; Offer to save data from non-quitted summary buffers.
3667 (gnus-offer-save-summaries)
3668 ;; Save the newsrc file(s).
3669 (gnus-save-newsrc-file)
3671 (gnus-close-backends)
3672 ;; Reset everything.
3674 ;; Allow the user to do things after cleaning up.
3675 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3677 (defun gnus-group-quit ()
3678 "Quit reading news without updating .newsrc.eld or .newsrc.
3679 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3681 (when (or noninteractive ;For gnus-batch-kill
3682 (zerop (buffer-size))
3683 (not (gnus-server-opened gnus-select-method))
3685 (not gnus-current-startup-file)
3687 (format "Quit reading news without saving %s? "
3688 (file-name-nondirectory gnus-current-startup-file))))
3689 (gnus-run-hooks 'gnus-exit-gnus-hook)
3690 (gnus-configure-windows 'group t)
3691 (when (and (gnus-buffer-live-p gnus-dribble-buffer)
3692 (not (zerop (save-excursion
3693 (set-buffer gnus-dribble-buffer)
3696 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3698 (gnus-close-backends)
3700 (gnus-kill-buffer gnus-group-buffer)
3701 ;; Allow the user to do things after cleaning up.
3702 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3704 (defun gnus-group-describe-briefly ()
3705 "Give a one line description of the group mode commands."
3707 (gnus-message 7 (substitute-command-keys "\\<gnus-group-mode-map>\\[gnus-group-read-group]:Select \\[gnus-group-next-unread-group]:Forward \\[gnus-group-prev-unread-group]:Backward \\[gnus-group-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-group-describe-briefly]:This help")))
3709 (defun gnus-group-browse-foreign-server (method)
3710 "Browse a foreign news server.
3711 If called interactively, this function will ask for a select method
3712 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
3713 If not, METHOD should be a list where the first element is the method
3714 and the second element is the address."
3716 (list (let ((how (completing-read
3718 (append gnus-valid-select-methods gnus-server-alist)
3719 nil t (cons "nntp" 0) 'gnus-method-history)))
3720 ;; We either got a backend name or a virtual server name.
3721 ;; If the first, we also need an address.
3722 (if (assoc how gnus-valid-select-methods)
3724 ;; Suggested by mapjph@bath.ac.uk.
3727 (mapcar (lambda (server) (list server))
3728 gnus-secondary-servers)))
3729 ;; We got a server name.
3731 (gnus-browse-foreign-server method))
3733 (defun gnus-group-set-info (info &optional method-only-group part)
3734 (when (or info part)
3735 (let* ((entry (gnus-gethash
3736 (or method-only-group (gnus-info-group info))
3737 gnus-newsrc-hashtb))
3739 (info (if method-only-group (nth 2 entry) info))
3741 (when method-only-group
3743 (error "Trying to change non-existent group %s" method-only-group))
3744 ;; We have received parts of the actual group info - either the
3745 ;; select method or the group parameters. We first check
3746 ;; whether we have to extend the info, and if so, do that.
3747 (let ((len (length info))
3748 (total (if (eq part 'method) 5 6)))
3750 (setcdr (nthcdr (1- len) info)
3751 (make-list (- total len) nil)))
3752 ;; Then we enter the new info.
3753 (setcar (nthcdr (1- total) info) part-info)))
3755 ;; This is a new group, so we just create it.
3757 (set-buffer gnus-group-buffer)
3758 (setq method (gnus-info-method info))
3759 (when (gnus-server-equal method "native")
3762 (set-buffer gnus-group-buffer)
3764 ;; It's a foreign group...
3765 (gnus-group-make-group
3766 (gnus-group-real-name (gnus-info-group info))
3767 (if (stringp method) method
3768 (prin1-to-string (car method)))
3770 (nth 1 (gnus-info-method info))))
3771 ;; It's a native group.
3772 (gnus-group-make-group (gnus-info-group info))))
3773 (gnus-message 6 "Note: New group created")
3775 (gnus-gethash (gnus-group-prefixed-name
3776 (gnus-group-real-name (gnus-info-group info))
3777 (or (gnus-info-method info) gnus-select-method))
3778 gnus-newsrc-hashtb))))
3779 ;; Whether it was a new group or not, we now have the entry, so we
3780 ;; can do the update.
3783 (setcar (nthcdr 2 entry) info)
3784 (when (and (not (eq (car entry) t))
3785 (gnus-active (gnus-info-group info)))
3786 (setcar entry (length
3787 (gnus-list-of-unread-articles (car info))))))
3788 (error "No such group: %s" (gnus-info-group info))))))
3790 (defun gnus-group-set-method-info (group select-method)
3791 (gnus-group-set-info select-method group 'method))
3793 (defun gnus-group-set-params-info (group params)
3794 (gnus-group-set-info params group 'params))
3796 (defun gnus-add-marked-articles (group type articles &optional info force)
3797 ;; Add ARTICLES of TYPE to the info of GROUP.
3798 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
3799 ;; add, but replace marked articles of TYPE with ARTICLES.
3800 (let ((info (or info (gnus-get-info group)))
3803 (and (not (setq marked (nthcdr 3 info)))
3805 (setcdr (nthcdr 2 info)
3806 (list (list (cons type (gnus-compress-sequence
3808 (and (not (setq m (assq type (car marked))))
3811 (cons (cons type (gnus-compress-sequence articles t) )
3815 (setcar (nthcdr 3 info)
3816 (gnus-delete-alist type (car marked)))
3817 (setcdr m (gnus-compress-sequence articles t)))
3818 (setcdr m (gnus-compress-sequence
3819 (sort (nconc (gnus-uncompress-range (cdr m))
3820 (copy-sequence articles)) '<) t))))))
3822 (defun gnus-add-mark (group mark article)
3823 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
3824 (let ((buffer (gnus-summary-buffer-name group)))
3825 (if (gnus-buffer-live-p buffer)
3827 (set-buffer (get-buffer buffer))
3828 (gnus-summary-add-mark article mark))
3829 (gnus-add-marked-articles group (cdr (assq mark gnus-article-mark-lists))
3833 ;;; Group timestamps
3836 (defun gnus-group-set-timestamp ()
3837 "Change the timestamp of the current group to the current time.
3838 This function can be used in hooks like `gnus-select-group-hook'
3839 or `gnus-group-catchup-group-hook'."
3840 (when gnus-newsgroup-name
3841 (let ((time (current-time)))
3842 (setcdr (cdr time) nil)
3843 (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
3845 (defsubst gnus-group-timestamp (group)
3846 "Return the timestamp for GROUP."
3847 (gnus-group-get-parameter group 'timestamp t))
3849 (defun gnus-group-timestamp-delta (group)
3850 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
3851 (let* ((time (or (gnus-group-timestamp group)
3853 (delta (subtract-time (current-time) time)))
3854 (+ (* (nth 0 delta) 65536.0)
3857 (defun gnus-group-timestamp-string (group)
3858 "Return a string of the timestamp for GROUP."
3859 (let ((time (gnus-group-timestamp group)))
3862 (gnus-time-iso8601 time))))
3864 (defun gnus-group-list-cached (level &optional lowest)
3865 "List all groups with cached articles.
3866 If the prefix LEVEL is non-nil, it should be a number that says which
3867 level to cut off listing groups.
3868 If LOWEST, don't list groups with level lower than LOWEST.
3870 This command may read the active file."
3873 (setq level (prefix-numeric-value level)))
3874 (when (or (not level) (>= level gnus-level-zombie))
3876 (funcall gnus-group-prepare-function
3877 (or level gnus-level-subscribed)
3879 (let ((marks (gnus-info-marks info)))
3880 (assq 'cache marks)))
3883 (or (gnus-gethash group
3884 gnus-cache-active-hashtb)
3885 ;; Cache active file might use "."
3888 (mapconcat 'identity
3889 (split-string group ":")
3891 gnus-cache-active-hashtb))))
3892 (goto-char (point-min))
3893 (gnus-group-position-point))
3895 (defun gnus-group-list-dormant (level &optional lowest)
3896 "List all groups with dormant articles.
3897 If the prefix LEVEL is non-nil, it should be a number that says which
3898 level to cut off listing groups.
3899 If LOWEST, don't list groups with level lower than LOWEST.
3901 This command may read the active file."
3904 (setq level (prefix-numeric-value level)))
3905 (when (or (not level) (>= level gnus-level-zombie))
3907 (funcall gnus-group-prepare-function
3908 (or level gnus-level-subscribed)
3910 (let ((marks (gnus-info-marks info)))
3911 (assq 'dormant marks)))
3914 (goto-char (point-min))
3915 (gnus-group-position-point))
3917 (defun gnus-group-listed-groups ()
3918 "Return a list of listed groups."
3920 (goto-char (point-min))
3921 (while (setq point (text-property-not-all (point) (point-max)
3924 (push (symbol-name (get-text-property point 'gnus-group)) groups)
3928 (defun gnus-group-list-plus (&optional args)
3929 "List groups plus the current selection."
3931 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
3932 (gnus-group-list-mode gnus-group-list-mode) ;; Save it.
3934 (push last-command-event unread-command-events)
3935 (if (featurep 'xemacs)
3936 (push (make-event 'key-press '(key ?A)) unread-command-events)
3937 (push ?A unread-command-events))
3938 (let (gnus-pick-mode keys)
3939 (setq keys (if (featurep 'xemacs)
3940 (events-to-keys (read-key-sequence nil))
3941 (read-key-sequence nil)))
3942 (setq func (lookup-key (current-local-map) keys)))
3946 (call-interactively func))))
3948 (defun gnus-group-list-flush (&optional args)
3949 "Flush groups from the current selection."
3951 (let ((gnus-group-list-option 'flush))
3952 (gnus-group-list-plus args)))
3954 (defun gnus-group-list-limit (&optional args)
3955 "List groups limited within the current selection."
3957 (let ((gnus-group-list-option 'limit))
3958 (gnus-group-list-plus args)))
3960 (defun gnus-group-mark-article-read (group article)
3961 "Mark ARTICLE read."
3962 (gnus-activate-group group)
3963 (let ((buffer (gnus-summary-buffer-name group))
3964 (mark gnus-read-mark))
3968 (with-current-buffer buffer
3969 (when gnus-newsgroup-prepared
3970 (when (and gnus-newsgroup-auto-expire
3971 (memq mark gnus-auto-expirable-marks))
3972 (setq mark gnus-expirable-mark))
3973 (setq mark (gnus-request-update-mark
3974 group article mark))
3975 (gnus-mark-article-as-read article mark)
3976 (setq gnus-newsgroup-active (gnus-active group))
3978 (gnus-group-make-articles-read group
3980 (when (gnus-group-auto-expirable-p group)
3981 (gnus-add-marked-articles
3982 group 'expire (list article))))))
3984 (provide 'gnus-group)
3986 ;;; gnus-group.el ends here