1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
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 '(repeat :value-to-internal (lambda (widget value)
130 (if (listp value) value (list value)))
131 :match (lambda (widget value)
133 (widget-editable-list-match widget value)))
134 (choice (function-item gnus-group-sort-by-alphabet)
135 (function-item gnus-group-sort-by-real-name)
136 (function-item gnus-group-sort-by-unread)
137 (function-item gnus-group-sort-by-level)
138 (function-item gnus-group-sort-by-score)
139 (function-item gnus-group-sort-by-method)
140 (function-item gnus-group-sort-by-server)
141 (function-item gnus-group-sort-by-rank)
142 (function :tag "other" nil))))
144 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y: %(%g%)%l %O\n"
145 "*Format of group lines.
146 It works along the same lines as a normal formatting string,
147 with some simple extensions.
149 %M Only marked articles (character, \"*\" or \" \")
150 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
151 %L Level of subscribedness (integer)
152 %N Number of unread articles (integer)
153 %I Number of dormant articles (integer)
154 %i Number of ticked and dormant (integer)
155 %T Number of ticked articles (integer)
156 %R Number of read articles (integer)
157 %t Estimated total number of articles (integer)
158 %y Number of unread, unticked articles (integer)
159 %G Group name (string)
160 %g Qualified group name (string)
161 %c Short (collapsed) group name. See `gnus-group-uncollapsed-levels'.
162 %D Group description (string)
163 %s Select method (string)
164 %o Moderated group (char, \"m\")
165 %p Process mark (char)
166 %O Moderated group (string, \"(m)\" or \"\")
167 %P Topic indentation (string)
168 %m Whether there is new(ish) mail in the group (char, \"%\")
169 %l Whether there are GroupLens predictions for this group (string)
170 %n Select from where (string)
171 %z A string that look like `<%s:%n>' if a foreign select method is used
172 %d The date the group was last entered.
173 %E Icon as defined by `gnus-group-icon-list'.
174 %u User defined specifier. The next character in the format string should
175 be a letter. Gnus will call the function gnus-user-format-function-X,
176 where X is the letter following %u. The function will be passed the
177 current header as argument. The function should return a string, which
178 will be inserted into the buffer just like information from any other
181 Text between %( and %) will be highlighted with `gnus-mouse-face' when
182 the mouse point move inside the area. There can only be one such area.
184 Note that this format specification is not always respected. For
185 reasons of efficiency, when listing killed groups, this specification
186 is ignored altogether. If the spec is changed considerably, your
187 output may end up looking strange when listing both alive and killed
190 If you use %o or %O, reading the active file will be slower and quite
191 a bit of extra memory will be used. %D will also worsen performance.
192 Also note that if you change the format specification to include any
193 of these specs, you must probably re-start Gnus to see them go into
195 :group 'gnus-group-visual
198 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
199 "*The format specification for the group mode line.
200 It works along the same lines as a normal formatting string,
201 with some simple extensions:
203 %S The native news server.
204 %M The native select method.
205 %: \":\" if %S isn't \"\"."
206 :group 'gnus-group-visual
209 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
210 (when (featurep 'xemacs)
211 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
212 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
214 (defcustom gnus-group-menu-hook nil
215 "Hook run after the creation of the group mode menu."
216 :group 'gnus-group-various
219 (defcustom gnus-group-catchup-group-hook nil
220 "Hook run when catching up a group from the group buffer."
221 :group 'gnus-group-various
222 :link '(custom-manual "(gnus)Group Data")
225 (defcustom gnus-group-update-group-hook nil
226 "Hook called when updating group lines."
227 :group 'gnus-group-visual
230 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
231 "*A function that is called to generate the group buffer.
232 The function is called with three arguments: The first is a number;
233 all group with a level less or equal to that number should be listed,
234 if the second is non-nil, empty groups should also be displayed. If
235 the third is non-nil, it is a number. No groups with a level lower
236 than this number should be displayed.
238 The only current function implemented is `gnus-group-prepare-flat'."
239 :group 'gnus-group-listing
242 (defcustom gnus-group-prepare-hook nil
243 "Hook called after the group buffer has been generated.
244 If you want to modify the group buffer, you can use this hook."
245 :group 'gnus-group-listing
248 (defcustom gnus-suspend-gnus-hook nil
249 "Hook called when suspending (not exiting) Gnus."
253 (defcustom gnus-exit-gnus-hook nil
254 "Hook called when exiting Gnus."
258 (defcustom gnus-after-exiting-gnus-hook nil
259 "Hook called after exiting Gnus."
263 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
264 "Hook called when a group line is changed.
265 The hook will not be called if `gnus-visual' is nil.
267 The default function `gnus-group-highlight-line' will
268 highlight the line according to the `gnus-group-highlight'
270 :group 'gnus-group-visual
273 (defcustom gnus-useful-groups
274 '(("(ding) mailing list mirrored at sunsite.auc.dk"
276 (nntp "sunsite.auc.dk"
277 (nntp-address "sunsite.auc.dk")))
280 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
284 (nndoc-article-type mbox)
285 (eval `(nndoc-address
286 ,(let ((file (nnheader-find-etc-directory
289 (error "Couldn't find doc group"))
291 "*Alist of useful group-server pairs."
292 :group 'gnus-group-listing
293 :type '(repeat (list (string :tag "Description")
295 (sexp :tag "Method"))))
297 (defcustom gnus-group-highlight
299 ((and mailp (= unread 0) (eq level 1)) .
300 gnus-group-mail-1-empty-face)
301 ((and mailp (eq level 1)) .
302 gnus-group-mail-1-face)
303 ((and mailp (= unread 0) (eq level 2)) .
304 gnus-group-mail-2-empty-face)
305 ((and mailp (eq level 2)) .
306 gnus-group-mail-2-face)
307 ((and mailp (= unread 0) (eq level 3)) .
308 gnus-group-mail-3-empty-face)
309 ((and mailp (eq level 3)) .
310 gnus-group-mail-3-face)
311 ((and mailp (= unread 0)) .
312 gnus-group-mail-low-empty-face)
314 gnus-group-mail-low-face)
316 ((and (= unread 0) (eq level 1)) .
317 gnus-group-news-1-empty-face)
318 ((and (eq level 1)) .
319 gnus-group-news-1-face)
320 ((and (= unread 0) (eq level 2)) .
321 gnus-group-news-2-empty-face)
322 ((and (eq level 2)) .
323 gnus-group-news-2-face)
324 ((and (= unread 0) (eq level 3)) .
325 gnus-group-news-3-empty-face)
326 ((and (eq level 3)) .
327 gnus-group-news-3-face)
328 ((and (= unread 0) (eq level 4)) .
329 gnus-group-news-4-empty-face)
330 ((and (eq level 4)) .
331 gnus-group-news-4-face)
332 ((and (= unread 0) (eq level 5)) .
333 gnus-group-news-5-empty-face)
334 ((and (eq level 5)) .
335 gnus-group-news-5-face)
336 ((and (= unread 0) (eq level 6)) .
337 gnus-group-news-6-empty-face)
338 ((and (eq level 6)) .
339 gnus-group-news-6-face)
340 ((and (= unread 0)) .
341 gnus-group-news-low-empty-face)
343 gnus-group-news-low-face))
344 "*Controls the highlighting of group buffer lines.
346 Below is a list of `Form'/`Face' pairs. When deciding how a a
347 particular group line should be displayed, each form is
348 evaluated. The content of the face field after the first true form is
349 used. You can change how those group lines are displayed by
350 editing the face field.
352 It is also possible to change and add form fields, but currently that
353 requires an understanding of Lisp expressions. Hopefully this will
354 change in a future release. For now, you can use the following
355 variables in the Lisp expression:
357 group: The name of the group.
358 unread: The number of unread articles in the group.
359 method: The select method used.
360 mailp: Whether it's a mail group or not.
361 level: The level of the group.
362 score: The score of the group.
363 ticked: The number of ticked articles."
364 :group 'gnus-group-visual
365 :type '(repeat (cons (sexp :tag "Form") face)))
367 (defcustom gnus-new-mail-mark ?%
368 "Mark used for groups with new mail."
369 :group 'gnus-group-visual
372 (defgroup gnus-group-icons nil
373 "Add Icons to your group buffer. "
374 :group 'gnus-group-visual)
376 (defcustom gnus-group-icon-list
378 "*Controls the insertion of icons into group buffer lines.
380 Below is a list of `Form'/`File' pairs. When deciding how a
381 particular group line should be displayed, each form is evaluated.
382 The icon from the file field after the first true form is used. You
383 can change how those group lines are displayed by editing the file
384 field. The File will either be found in the
385 `gnus-group-glyph-directory' or by designating absolute path to the
388 It is also possible to change and add form fields, but currently that
389 requires an understanding of Lisp expressions. Hopefully this will
390 change in a future release. For now, you can use the following
391 variables in the Lisp expression:
393 group: The name of the group.
394 unread: The number of unread articles in the group.
395 method: The select method used.
396 mailp: Whether it's a mail group or not.
397 newsp: Whether it's a news group or not
398 level: The level of the group.
399 score: The score of the group.
400 ticked: The number of ticked articles."
401 :group 'gnus-group-icons
402 :type '(repeat (cons (sexp :tag "Form") file)))
404 (defcustom gnus-group-name-charset-method-alist nil
405 "Alist of method and the charset for group names.
408 (((nntp \"news.com.cn\") . cn-gb-2312))"
411 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
413 (defcustom gnus-group-name-charset-group-alist
414 (if (or (and (fboundp 'find-coding-system) (find-coding-system 'utf-8))
415 (and (fboundp 'coding-system-p) (coding-system-p 'utf-8)))
418 "Alist of group regexp and the charset for group names.
421 ((\"\\.com\\.cn:\" . cn-gb-2312))"
423 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
425 (defcustom gnus-group-jump-to-group-prompt nil
426 "Default prompt for `gnus-group-jump-to-group'.
427 If non-nil, the value should be a string, e.g. \"nnml:\",
428 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
429 in the minibuffer prompt."
430 :group 'gnus-group-various
431 :type '(choice (string :tag "Prompt string")
432 (const :tag "Empty" nil)))
434 (defvar gnus-group-listing-limit 1000
435 "*A limit of the number of groups when listing.
436 If the number of groups is larger than the limit, list them in a
439 ;;; Internal variables
441 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
442 "Function for sorting the group buffer.")
444 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
445 "Function for sorting the selected groups in the group buffer.")
447 (defvar gnus-group-indentation-function nil)
448 (defvar gnus-goto-missing-group-function nil)
449 (defvar gnus-group-update-group-function nil)
450 (defvar gnus-group-goto-next-group-function nil
451 "Function to override finding the next group after listing groups.")
453 (defvar gnus-group-edit-buffer nil)
455 (defvar gnus-group-line-format-alist
456 `((?M gnus-tmp-marked-mark ?c)
457 (?S gnus-tmp-subscribed ?c)
458 (?L gnus-tmp-level ?d)
459 (?N (cond ((eq number t) "*" )
463 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
464 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
466 (?R gnus-tmp-number-of-read ?s)
467 (?t gnus-tmp-number-total ?d)
468 (?y gnus-tmp-number-of-unread ?s)
469 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
470 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
471 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
472 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
473 (?g gnus-tmp-group ?s)
474 (?G gnus-tmp-qualified-group ?s)
475 (?c (gnus-short-group-name gnus-tmp-group) ?s)
476 (?D gnus-tmp-newsgroup-description ?s)
477 (?o gnus-tmp-moderated ?c)
478 (?O gnus-tmp-moderated-string ?s)
479 (?p gnus-tmp-process-marked ?c)
480 (?s gnus-tmp-news-server ?s)
481 (?n gnus-tmp-news-method ?s)
482 (?P gnus-group-indentation ?s)
483 (?E gnus-tmp-group-icon ?s)
484 (?l gnus-tmp-grouplens ?s)
485 (?z gnus-tmp-news-method-string ?s)
486 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
487 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
488 (?u gnus-tmp-user-defined ?s)))
490 (defvar gnus-group-mode-line-format-alist
491 `((?S gnus-tmp-news-server ?s)
492 (?M gnus-tmp-news-method ?s)
493 (?u gnus-tmp-user-defined ?s)
494 (?: gnus-tmp-colon ?s)))
496 (defvar gnus-topic-topology nil
497 "The complete topic hierarchy.")
499 (defvar gnus-topic-alist nil
500 "The complete topic-group alist.")
502 (defvar gnus-group-marked nil)
504 (defvar gnus-group-list-mode nil)
507 (defvar gnus-group-icon-cache nil)
509 (defvar gnus-group-listed-groups nil)
510 (defvar gnus-group-list-option nil)
516 (put 'gnus-group-mode 'mode-class 'special)
519 (gnus-define-keys gnus-group-mode-map
520 " " gnus-group-read-group
521 "=" gnus-group-select-group
522 "\r" gnus-group-select-group
523 "\M-\r" gnus-group-quick-select-group
524 "\M- " gnus-group-visible-select-group
525 [(meta control return)] gnus-group-select-group-ephemerally
526 "j" gnus-group-jump-to-group
527 "n" gnus-group-next-unread-group
528 "p" gnus-group-prev-unread-group
529 "\177" gnus-group-prev-unread-group
530 [delete] gnus-group-prev-unread-group
531 [backspace] gnus-group-prev-unread-group
532 "N" gnus-group-next-group
533 "P" gnus-group-prev-group
534 "\M-n" gnus-group-next-unread-group-same-level
535 "\M-p" gnus-group-prev-unread-group-same-level
536 "," gnus-group-best-unread-group
537 "." gnus-group-first-unread-group
538 "u" gnus-group-unsubscribe-current-group
539 "U" gnus-group-unsubscribe-group
540 "c" gnus-group-catchup-current
541 "C" gnus-group-catchup-current-all
542 "\M-c" gnus-group-clear-data
543 "l" gnus-group-list-groups
544 "L" gnus-group-list-all-groups
547 "g" gnus-group-get-new-news
548 "\M-g" gnus-group-get-new-news-this-group
549 "R" gnus-group-restart
550 "r" gnus-group-read-init-file
551 "B" gnus-group-browse-foreign-server
552 "b" gnus-group-check-bogus-groups
553 "F" gnus-group-find-new-groups
554 "\C-c\C-d" gnus-group-describe-group
555 "\M-d" gnus-group-describe-all-groups
556 "\C-c\C-a" gnus-group-apropos
557 "\C-c\M-\C-a" gnus-group-description-apropos
558 "a" gnus-group-post-news
559 "\ek" gnus-group-edit-local-kill
560 "\eK" gnus-group-edit-global-kill
561 "\C-k" gnus-group-kill-group
562 "\C-y" gnus-group-yank-group
563 "\C-w" gnus-group-kill-region
564 "\C-x\C-t" gnus-group-transpose-groups
565 "\C-c\C-l" gnus-group-list-killed
566 "\C-c\C-x" gnus-group-expire-articles
567 "\C-c\M-\C-x" gnus-group-expire-all-groups
569 "s" gnus-group-save-newsrc
570 "z" gnus-group-suspend
573 "?" gnus-group-describe-briefly
574 "\C-c\C-i" gnus-info-find-node
575 "\M-e" gnus-group-edit-group-method
576 "^" gnus-group-enter-server-mode
577 gnus-mouse-2 gnus-mouse-pick-group
578 "<" beginning-of-buffer
581 "\C-c\C-s" gnus-group-sort-groups
583 "\C-c\M-g" gnus-activate-all-groups
584 "\M-&" gnus-group-universal-argument
585 "#" gnus-group-mark-group
586 "\M-#" gnus-group-unmark-group)
588 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
589 "m" gnus-group-mark-group
590 "u" gnus-group-unmark-group
591 "w" gnus-group-mark-region
592 "b" gnus-group-mark-buffer
593 "r" gnus-group-mark-regexp
594 "U" gnus-group-unmark-all-groups)
596 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
597 "u" gnus-sieve-update
598 "g" gnus-sieve-generate)
600 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
601 "d" gnus-group-make-directory-group
602 "h" gnus-group-make-help-group
603 "u" gnus-group-make-useful-group
604 "a" gnus-group-make-archive-group
605 "k" gnus-group-make-kiboze-group
606 "l" gnus-group-nnimap-edit-acl
607 "m" gnus-group-make-group
608 "E" gnus-group-edit-group
609 "e" gnus-group-edit-group-method
610 "p" gnus-group-edit-group-parameters
611 "v" gnus-group-add-to-virtual
612 "V" gnus-group-make-empty-virtual
613 "D" gnus-group-enter-directory
614 "f" gnus-group-make-doc-group
615 "w" gnus-group-make-web-group
616 "r" gnus-group-rename-group
617 "c" gnus-group-customize
618 "x" gnus-group-nnimap-expunge
619 "\177" gnus-group-delete-group
620 [delete] gnus-group-delete-group)
622 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
623 "b" gnus-group-brew-soup
624 "w" gnus-soup-save-areas
625 "s" gnus-soup-send-replies
626 "p" gnus-soup-pack-packet
627 "r" nnsoup-pack-replies)
629 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
630 "s" gnus-group-sort-groups
631 "a" gnus-group-sort-groups-by-alphabet
632 "u" gnus-group-sort-groups-by-unread
633 "l" gnus-group-sort-groups-by-level
634 "v" gnus-group-sort-groups-by-score
635 "r" gnus-group-sort-groups-by-rank
636 "m" gnus-group-sort-groups-by-method)
638 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
639 "s" gnus-group-sort-selected-groups
640 "a" gnus-group-sort-selected-groups-by-alphabet
641 "u" gnus-group-sort-selected-groups-by-unread
642 "l" gnus-group-sort-selected-groups-by-level
643 "v" gnus-group-sort-selected-groups-by-score
644 "r" gnus-group-sort-selected-groups-by-rank
645 "m" gnus-group-sort-selected-groups-by-method)
647 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
648 "k" gnus-group-list-killed
649 "z" gnus-group-list-zombies
650 "s" gnus-group-list-groups
651 "u" gnus-group-list-all-groups
652 "A" gnus-group-list-active
653 "a" gnus-group-apropos
654 "d" gnus-group-description-apropos
655 "m" gnus-group-list-matching
656 "M" gnus-group-list-all-matching
657 "l" gnus-group-list-level
658 "c" gnus-group-list-cached
659 "?" gnus-group-list-dormant)
661 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
662 "k" gnus-group-list-limit
663 "z" gnus-group-list-limit
664 "s" gnus-group-list-limit
665 "u" gnus-group-list-limit
666 "A" gnus-group-list-limit
667 "m" gnus-group-list-limit
668 "M" gnus-group-list-limit
669 "l" gnus-group-list-limit
670 "c" gnus-group-list-limit
671 "?" gnus-group-list-limit)
673 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
674 "k" gnus-group-list-flush
675 "z" gnus-group-list-flush
676 "s" gnus-group-list-flush
677 "u" gnus-group-list-flush
678 "A" gnus-group-list-flush
679 "m" gnus-group-list-flush
680 "M" gnus-group-list-flush
681 "l" gnus-group-list-flush
682 "c" gnus-group-list-flush
683 "?" gnus-group-list-flush)
685 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
686 "k" gnus-group-list-plus
687 "z" gnus-group-list-plus
688 "s" gnus-group-list-plus
689 "u" gnus-group-list-plus
690 "A" gnus-group-list-plus
691 "m" gnus-group-list-plus
692 "M" gnus-group-list-plus
693 "l" gnus-group-list-plus
694 "c" gnus-group-list-plus
695 "?" gnus-group-list-plus)
697 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
698 "f" gnus-score-flush-cache)
700 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
701 "d" gnus-group-describe-group
702 "f" gnus-group-fetch-faq
705 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
706 "l" gnus-group-set-current-level
707 "t" gnus-group-unsubscribe-current-group
708 "s" gnus-group-unsubscribe-group
709 "k" gnus-group-kill-group
710 "y" gnus-group-yank-group
711 "w" gnus-group-kill-region
712 "\C-k" gnus-group-kill-level
713 "z" gnus-group-kill-all-zombies))
715 (defun gnus-group-make-menu-bar ()
716 (gnus-turn-off-edit-menu 'group)
717 (unless (boundp 'gnus-group-reading-menu)
720 gnus-group-reading-menu gnus-group-mode-map ""
722 ["Read" gnus-group-read-group (gnus-group-group-name)]
723 ["Select" gnus-group-select-group (gnus-group-group-name)]
724 ["See old articles" (gnus-group-select-group 'all)
725 :keys "C-u SPC" :active (gnus-group-group-name)]
726 ["Catch up" gnus-group-catchup-current :active (gnus-group-group-name)
727 ,@(if (featurep 'xemacs) nil
728 '(:help "Mark unread articles in the current group as read"))]
729 ["Catch up all articles" gnus-group-catchup-current-all
730 (gnus-group-group-name)]
731 ["Check for new articles" gnus-group-get-new-news-this-group
732 :active (gnus-group-group-name)
733 ,@(if (featurep 'xemacs) nil
734 '(:help "Check for new messages in current group"))]
735 ["Toggle subscription" gnus-group-unsubscribe-current-group
736 (gnus-group-group-name)]
737 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
738 ,@(if (featurep 'xemacs) nil
739 '(:help "Kill (remove) current group"))]
740 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
741 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
742 ,@(if (featurep 'xemacs) nil
743 '(:help "Display description of the current group"))]
744 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
745 ;; Actually one should check, if any of the marked groups gives t for
746 ;; (gnus-check-backend-function 'request-expire-articles ...)
747 ["Expire articles" gnus-group-expire-articles
748 (or (and (gnus-group-group-name)
749 (gnus-check-backend-function
750 'request-expire-articles
751 (gnus-group-group-name))) gnus-group-marked)]
752 ["Set group level" gnus-group-set-current-level
753 (gnus-group-group-name)]
754 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
755 ["Customize" gnus-group-customize (gnus-group-group-name)]
757 ["Parameters" gnus-group-edit-group-parameters
758 (gnus-group-group-name)]
759 ["Select method" gnus-group-edit-group-method
760 (gnus-group-group-name)]
761 ["Info" gnus-group-edit-group (gnus-group-group-name)]
762 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
763 ["Global kill file" gnus-group-edit-global-kill t])))
766 gnus-group-group-menu gnus-group-mode-map ""
769 ["List unread subscribed groups" gnus-group-list-groups t]
770 ["List (un)subscribed groups" gnus-group-list-all-groups t]
771 ["List killed groups" gnus-group-list-killed gnus-killed-list]
772 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
773 ["List level..." gnus-group-list-level t]
774 ["Describe all groups" gnus-group-describe-all-groups t]
775 ["Group apropos..." gnus-group-apropos t]
776 ["Group and description apropos..." gnus-group-description-apropos t]
777 ["List groups matching..." gnus-group-list-matching t]
778 ["List all groups matching..." gnus-group-list-all-matching t]
779 ["List active file" gnus-group-list-active t]
780 ["List groups with cached" gnus-group-list-cached t]
781 ["List groups with dormant" gnus-group-list-dormant t])
783 ["Default sort" gnus-group-sort-groups t]
784 ["Sort by method" gnus-group-sort-groups-by-method t]
785 ["Sort by rank" gnus-group-sort-groups-by-rank t]
786 ["Sort by score" gnus-group-sort-groups-by-score t]
787 ["Sort by level" gnus-group-sort-groups-by-level t]
788 ["Sort by unread" gnus-group-sort-groups-by-unread t]
789 ["Sort by name" gnus-group-sort-groups-by-alphabet t])
790 ("Sort process/prefixed"
791 ["Default sort" gnus-group-sort-selected-groups
792 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
793 ["Sort by method" gnus-group-sort-selected-groups-by-method
794 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
795 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
796 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
797 ["Sort by score" gnus-group-sort-selected-groups-by-score
798 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
799 ["Sort by level" gnus-group-sort-selected-groups-by-level
800 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
801 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
802 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
803 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
804 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
806 ["Mark group" gnus-group-mark-group
807 (and (gnus-group-group-name)
808 (not (memq (gnus-group-group-name) gnus-group-marked)))]
809 ["Unmark group" gnus-group-unmark-group
810 (and (gnus-group-group-name)
811 (memq (gnus-group-group-name) gnus-group-marked))]
812 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
813 ["Mark regexp..." gnus-group-mark-regexp t]
814 ["Mark region" gnus-group-mark-region t]
815 ["Mark buffer" gnus-group-mark-buffer t]
816 ["Execute command" gnus-group-universal-argument
817 (or gnus-group-marked (gnus-group-group-name))])
819 ["Subscribe to a group" gnus-group-unsubscribe-group t]
820 ["Kill all newsgroups in region" gnus-group-kill-region t]
821 ["Kill all zombie groups" gnus-group-kill-all-zombies
823 ["Kill all groups on level..." gnus-group-kill-level t])
825 ["Make a foreign group" gnus-group-make-group t]
826 ["Add a directory group" gnus-group-make-directory-group t]
827 ["Add the help group" gnus-group-make-help-group t]
828 ["Add the archive group" gnus-group-make-archive-group t]
829 ["Make a doc group" gnus-group-make-doc-group t]
830 ["Make a web group" gnus-group-make-web-group t]
831 ["Make a kiboze group" gnus-group-make-kiboze-group t]
832 ["Make a virtual group" gnus-group-make-empty-virtual t]
833 ["Add a group to a virtual" gnus-group-add-to-virtual t]
834 ["Rename group" gnus-group-rename-group
835 (gnus-check-backend-function
836 'request-rename-group (gnus-group-group-name))]
837 ["Delete group" gnus-group-delete-group
838 (gnus-check-backend-function
839 'request-delete-group (gnus-group-group-name))])
841 ["Next" gnus-group-next-group t]
842 ["Previous" gnus-group-prev-group t]
843 ["Next unread" gnus-group-next-unread-group t]
844 ["Previous unread" gnus-group-prev-unread-group t]
845 ["Next unread same level" gnus-group-next-unread-group-same-level t]
846 ["Previous unread same level"
847 gnus-group-prev-unread-group-same-level t]
848 ["Jump to group" gnus-group-jump-to-group t]
849 ["First unread group" gnus-group-first-unread-group t]
850 ["Best unread group" gnus-group-best-unread-group t])
852 ["Generate" gnus-sieve-generate t]
853 ["Generate and update" gnus-sieve-update t])
854 ["Delete bogus groups" gnus-group-check-bogus-groups t]
855 ["Find new newsgroups" gnus-group-find-new-groups t]
856 ["Transpose" gnus-group-transpose-groups
857 (gnus-group-group-name)]
858 ["Read a directory as a group..." gnus-group-enter-directory t]))
861 gnus-group-misc-menu gnus-group-mode-map ""
864 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
865 ["Send replies" gnus-soup-send-replies
866 (fboundp 'gnus-soup-pack-packet)]
867 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
868 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
869 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
870 ["Send a mail" gnus-group-mail t]
871 ["Send a message (mail or news)" gnus-group-post-news t]
872 ["Create a local message" gnus-group-news t]
873 ["Check for new news" gnus-group-get-new-news
874 ,@(if (featurep 'xemacs) '(t)
875 '(:help "Get newly arrived articles"))
877 ["Send queued messages" gnus-delay-send-queue
878 ,@(if (featurep 'xemacs) '(t)
879 '(:help "Send all messages that are scheduled to be sent now"))
881 ["Activate all groups" gnus-activate-all-groups t]
882 ["Restart Gnus" gnus-group-restart t]
883 ["Read init file" gnus-group-read-init-file t]
884 ["Browse foreign server" gnus-group-browse-foreign-server t]
885 ["Enter server buffer" gnus-group-enter-server-mode t]
886 ["Expire all expirable articles" gnus-group-expire-all-groups t]
887 ["Generate any kiboze groups" nnkiboze-generate-groups t]
888 ["Gnus version" gnus-version t]
889 ["Save .newsrc files" gnus-group-save-newsrc t]
890 ["Suspend Gnus" gnus-group-suspend t]
891 ["Clear dribble buffer" gnus-group-clear-dribble t]
892 ["Read manual" gnus-info-find-node t]
893 ["Flush score cache" gnus-score-flush-cache t]
894 ["Toggle topics" gnus-topic-mode t]
895 ["Send a bug report" gnus-bug t]
896 ["Exit from Gnus" gnus-group-exit
897 ,@(if (featurep 'xemacs) '(t)
898 '(:help "Quit reading news"))]
899 ["Exit without saving" gnus-group-quit t]))
901 (gnus-run-hooks 'gnus-group-menu-hook)))
903 (defvar gnus-group-toolbar-map nil)
905 ;; Emacs 21 tool bar. Should be no-op otherwise.
906 (defun gnus-group-make-tool-bar ()
907 (if (and (fboundp 'tool-bar-add-item-from-menu)
908 (default-value 'tool-bar-mode)
909 (not gnus-group-toolbar-map))
910 (setq gnus-group-toolbar-map
911 (let ((tool-bar-map (make-sparse-keymap))
912 (load-path (mm-image-load-path)))
913 (tool-bar-add-item-from-menu
914 'gnus-group-get-new-news "get-news" gnus-group-mode-map)
915 (tool-bar-add-item-from-menu
916 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map)
917 (tool-bar-add-item-from-menu
918 'gnus-group-catchup-current "catchup" gnus-group-mode-map)
919 (tool-bar-add-item-from-menu
920 'gnus-group-describe-group "describe-group" gnus-group-mode-map)
921 (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe
922 :help "Subscribe to the current group")
923 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
925 :help "Unsubscribe from the current group")
926 (tool-bar-add-item-from-menu
927 'gnus-group-exit "exit-gnus" gnus-group-mode-map)
929 (if gnus-group-toolbar-map
930 (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map)))
932 (defun gnus-group-mode ()
933 "Major mode for reading news.
935 All normal editing commands are switched off.
936 \\<gnus-group-mode-map>
937 The group buffer lists (some of) the groups available. For instance,
938 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
939 lists all zombie groups.
941 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
942 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
944 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
946 The following commands are available:
948 \\{gnus-group-mode-map}"
950 (kill-all-local-variables)
951 (when (gnus-visual-p 'group-menu 'menu)
952 (gnus-group-make-menu-bar)
953 (gnus-group-make-tool-bar))
954 (gnus-simplify-mode-line)
955 (setq major-mode 'gnus-group-mode)
956 (setq mode-name "Group")
957 (gnus-group-set-mode-line)
958 (setq mode-line-process nil)
959 (use-local-map gnus-group-mode-map)
960 (buffer-disable-undo)
961 (setq truncate-lines t)
962 (setq buffer-read-only t)
963 (gnus-set-default-directory)
964 (gnus-update-format-specifications nil 'group 'group-mode)
965 (gnus-update-group-mark-positions)
970 (gnus-run-hooks 'gnus-group-mode-hook))
972 (defun gnus-update-group-mark-positions ()
974 (let ((gnus-process-mark ?\200)
975 (gnus-group-update-hook nil)
976 (gnus-group-marked '("dummy.group"))
977 (gnus-active-hashtb (make-vector 10 0))
979 (gnus-set-active "dummy.group" '(0 . 0))
980 (gnus-set-work-buffer)
981 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
982 (goto-char (point-min))
983 (setq gnus-group-mark-positions
984 (list (cons 'process (and (search-forward "\200" nil t)
987 (defun gnus-mouse-pick-group (e)
988 "Enter the group under the mouse pointer."
991 (gnus-group-read-group nil))
993 ;; Look at LEVEL and find out what the level is really supposed to be.
994 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
995 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
996 (defun gnus-group-default-level (&optional level number-or-nil)
998 (gnus-group-use-permanent-levels
999 (or (setq gnus-group-use-permanent-levels
1000 (or level (if (numberp gnus-group-use-permanent-levels)
1001 gnus-group-use-permanent-levels
1002 (or gnus-group-default-list-level
1003 gnus-level-subscribed))))
1004 gnus-group-default-list-level gnus-level-subscribed))
1008 (or level gnus-group-default-list-level gnus-level-subscribed))))
1010 (defun gnus-group-setup-buffer ()
1011 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1012 (unless (eq major-mode 'gnus-group-mode)
1015 (gnus-carpal-setup-buffer 'group))))
1017 (defun gnus-group-name-charset (method group)
1019 (setq method (gnus-find-method-for-group group)))
1020 (let ((item (assoc method gnus-group-name-charset-method-alist))
1021 (alist gnus-group-name-charset-group-alist)
1025 (while (setq item (pop alist))
1026 (if (string-match (car item) group)
1028 result (cdr item))))
1031 (defun gnus-group-name-decode (string charset)
1032 (if (and string charset (featurep 'mule)
1033 (not (mm-multibyte-string-p string)))
1034 (mm-decode-coding-string string charset)
1037 (defun gnus-group-decoded-name (string)
1038 (let ((charset (gnus-group-name-charset nil string)))
1039 (gnus-group-name-decode string charset)))
1041 (defun gnus-group-list-groups (&optional level unread lowest)
1042 "List newsgroups with level LEVEL or lower that have unread articles.
1043 Default is all subscribed groups.
1044 If argument UNREAD is non-nil, groups with no unread articles are also
1047 Also see the `gnus-group-use-permanent-levels' variable."
1049 (list (if current-prefix-arg
1050 (prefix-numeric-value current-prefix-arg)
1052 (gnus-group-default-level nil t)
1053 gnus-group-default-list-level
1054 gnus-level-subscribed))))
1056 (setq level (car gnus-group-list-mode)
1057 unread (cdr gnus-group-list-mode)))
1058 (setq level (gnus-group-default-level level))
1059 (gnus-group-setup-buffer)
1060 (gnus-update-format-specifications nil 'group 'group-mode)
1061 (let ((case-fold-search nil)
1062 (props (text-properties-at (gnus-point-at-bol)))
1063 (empty (= (point-min) (point-max)))
1064 (group (gnus-group-group-name))
1066 (set-buffer gnus-group-buffer)
1067 (setq number (funcall gnus-group-prepare-function level unread lowest))
1068 (when (or (and (numberp number)
1070 (zerop (buffer-size)))
1071 ;; No groups in the buffer.
1072 (gnus-message 5 gnus-no-groups-message))
1073 ;; We have some groups displayed.
1074 (goto-char (point-max))
1075 (when (or (not gnus-group-goto-next-group-function)
1076 (not (funcall gnus-group-goto-next-group-function
1080 (goto-char (point-min)))
1082 ;; Go to the first group with unread articles.
1083 (gnus-group-search-forward t))
1085 ;; Find the right group to put point on. If the current group
1086 ;; has disappeared in the new listing, try to find the next
1087 ;; one. If no next one can be found, just leave point at the
1088 ;; first newsgroup in the buffer.
1089 (when (not (gnus-goto-char
1091 (point-min) (point-max)
1092 'gnus-group (gnus-intern-safe
1093 group gnus-active-hashtb))))
1094 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb))))
1096 (not (gnus-goto-char
1098 (point-min) (point-max) 'gnus-group
1100 (caar newsrc) gnus-active-hashtb)))))
1101 (setq newsrc (cdr newsrc)))
1103 (goto-char (point-max))
1104 (forward-line -1)))))))
1105 ;; Adjust cursor point.
1106 (gnus-group-position-point)))
1108 (defun gnus-group-list-level (level &optional all)
1109 "List groups on LEVEL.
1110 If ALL (the prefix), also list groups that have no unread articles."
1111 (interactive "nList groups on level: \nP")
1112 (gnus-group-list-groups level all level))
1114 (defun gnus-group-prepare-logic (group test)
1115 (or (and gnus-group-listed-groups
1116 (null gnus-group-list-option)
1117 (member group gnus-group-listed-groups))
1119 ((null gnus-group-listed-groups) test)
1120 ((null gnus-group-list-option) test)
1121 (t (and (member group gnus-group-listed-groups)
1122 (if (eq gnus-group-list-option 'flush)
1126 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
1127 "List all newsgroups with unread articles of level LEVEL or lower.
1128 If PREDICATE is a function, list groups that the function returns non-nil;
1129 if it is t, list groups that have no unread articles.
1130 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1131 If REGEXP is a function, list dead groups that the function returns non-nil;
1132 if it is a string, only list groups matching REGEXP."
1133 (set-buffer gnus-group-buffer)
1134 (let ((buffer-read-only nil)
1135 (newsrc (cdr gnus-newsrc-alist))
1136 (lowest (or lowest 1))
1137 (not-in-list (and gnus-group-listed-groups
1138 (copy-sequence gnus-group-listed-groups)))
1139 info clevel unread group params)
1141 (when (or (< lowest gnus-level-zombie)
1142 gnus-group-listed-groups)
1143 ;; List living groups.
1145 (setq info (car newsrc)
1146 group (gnus-info-group info)
1147 params (gnus-info-params info)
1149 unread (car (gnus-gethash group gnus-newsrc-hashtb)))
1151 (setq not-in-list (delete group not-in-list)))
1153 (gnus-group-prepare-logic
1155 (and unread ; This group might be unchecked
1156 (or (not (stringp regexp))
1157 (string-match regexp group))
1158 (<= (setq clevel (gnus-info-level info)) level)
1161 ((functionp predicate)
1162 (funcall predicate info))
1163 (predicate t) ; We list all groups?
1166 (if (eq unread t) ; Unactivated?
1167 gnus-group-list-inactive-groups
1168 ; We list unactivated
1170 ; We list groups with unread articles
1171 (and gnus-list-groups-with-ticked-articles
1172 (cdr (assq 'tick (gnus-info-marks info))))
1173 ; And groups with tickeds
1174 ;; Check for permanent visibility.
1175 (and gnus-permanently-visible-groups
1176 (string-match gnus-permanently-visible-groups group))
1177 (memq 'visible params)
1178 (cdr (assq 'visible params)))))))
1179 (gnus-group-insert-group-line
1180 group (gnus-info-level info)
1181 (gnus-info-marks info) unread (gnus-info-method info)))))
1183 ;; List dead groups.
1184 (if (or gnus-group-listed-groups
1185 (and (>= level gnus-level-zombie)
1186 (<= lowest gnus-level-zombie)))
1187 (gnus-group-prepare-flat-list-dead
1188 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1189 gnus-level-zombie ?Z
1192 (dolist (group gnus-zombie-list)
1193 (setq not-in-list (delete group not-in-list))))
1194 (if (or gnus-group-listed-groups
1195 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
1196 (gnus-group-prepare-flat-list-dead
1199 (setq gnus-killed-list (sort gnus-killed-list 'string<)))
1200 gnus-level-killed ?K regexp))
1202 (gnus-group-set-mode-line)
1203 (setq gnus-group-list-mode (cons level predicate))
1204 (gnus-run-hooks 'gnus-group-prepare-hook)
1207 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1208 ;; List zombies and killed lists somewhat faster, which was
1209 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1210 ;; this by ignoring the group format specification altogether.
1212 (if (> (length groups) gnus-group-listing-limit)
1214 (setq group (pop groups))
1215 (when (gnus-group-prepare-logic
1218 (and (stringp regexp) (string-match regexp group))
1219 (and (functionp regexp) (funcall regexp group))))
1220 (gnus-add-text-properties
1221 (point) (prog1 (1+ (point))
1222 (insert " " mark " *: "
1223 (gnus-group-decoded-name group)
1225 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1227 'gnus-level level))))
1229 (setq group (pop groups))
1230 (when (gnus-group-prepare-logic
1233 (and (stringp regexp) (string-match regexp group))
1234 (and (functionp regexp) (funcall regexp group))))
1235 (gnus-group-insert-group-line
1237 (let ((active (gnus-active group)))
1239 (if (zerop (cdr active))
1241 (- (1+ (cdr active)) (car active)))
1243 (gnus-method-simplify (gnus-find-method-for-group group))))))))
1245 (defun gnus-group-update-group-line ()
1246 "Update the current line in the group buffer."
1247 (let* ((buffer-read-only nil)
1248 (group (gnus-group-group-name))
1249 (entry (and group (gnus-gethash group gnus-newsrc-hashtb)))
1250 gnus-group-indentation)
1253 (not (gnus-ephemeral-group-p group))
1255 (concat "(gnus-group-set-info '"
1256 (gnus-prin1-to-string (nth 2 entry))
1258 (setq gnus-group-indentation (gnus-group-group-indentation))
1260 (gnus-group-insert-group-line-info group)
1262 (gnus-group-position-point))))
1264 (defun gnus-group-insert-group-line-info (group)
1265 "Insert GROUP on the current line."
1266 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
1267 (gnus-group-indentation (gnus-group-group-indentation))
1271 ;; (Un)subscribed group.
1272 (setq info (nth 2 entry))
1273 (gnus-group-insert-group-line
1274 group (gnus-info-level info) (gnus-info-marks info)
1275 (or (car entry) t) (gnus-info-method info)))
1276 ;; This group is dead.
1277 (gnus-group-insert-group-line
1279 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1281 (if (setq active (gnus-active group))
1282 (if (zerop (cdr active))
1284 (- (1+ (cdr active)) (car active)))
1286 (gnus-method-simplify (gnus-find-method-for-group group))))))
1288 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1289 gnus-tmp-marked number
1291 "Insert a group line in the group buffer."
1292 (let* ((gnus-tmp-method
1293 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1294 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1296 (gnus-tmp-active (gnus-active gnus-tmp-group))
1297 (gnus-tmp-number-total
1299 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1301 (gnus-tmp-number-of-unread
1302 (if (numberp number) (int-to-string (max 0 number))
1304 (gnus-tmp-number-of-read
1305 (if (numberp number)
1306 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1308 (gnus-tmp-subscribed
1309 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1310 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1311 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1313 (gnus-tmp-qualified-group
1314 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
1315 group-name-charset))
1316 (gnus-tmp-newsgroup-description
1317 (if gnus-description-hashtb
1318 (or (gnus-group-name-decode
1319 (gnus-gethash gnus-tmp-group gnus-description-hashtb)
1320 group-name-charset) "")
1323 (if (and gnus-moderated-hashtb
1324 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
1326 (gnus-tmp-moderated-string
1327 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1328 (gnus-tmp-group-icon "==&&==")
1329 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1330 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1331 (gnus-tmp-news-method-string
1333 (format "(%s:%s)" (car gnus-tmp-method)
1334 (cadr gnus-tmp-method)) ""))
1335 (gnus-tmp-marked-mark
1336 (if (and (numberp number)
1338 (cdr (assq 'tick gnus-tmp-marked)))
1340 (gnus-tmp-process-marked
1341 (if (member gnus-tmp-group gnus-group-marked)
1342 gnus-process-mark ? ))
1344 (or (and gnus-use-grouplens
1345 (bbb-grouplens-group-p gnus-tmp-group))
1347 (buffer-read-only nil)
1348 header gnus-tmp-header) ; passed as parameter to user-funcs.
1350 (gnus-add-text-properties
1354 (let ((gnus-tmp-group (gnus-group-name-decode
1355 gnus-tmp-group group-name-charset)))
1356 (eval gnus-group-line-format-spec)))
1357 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1358 gnus-unread ,(if (numberp number)
1359 (string-to-int gnus-tmp-number-of-unread)
1361 gnus-marked ,gnus-tmp-marked-mark
1362 gnus-indentation ,gnus-group-indentation
1363 gnus-level ,gnus-tmp-level))
1365 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1366 (gnus-run-hooks 'gnus-group-update-hook))
1368 ;; Allow XEmacs to remove front-sticky text properties.
1369 (gnus-group-remove-excess-properties)))
1371 (defun gnus-group-highlight-line ()
1372 "Highlight the current line according to `gnus-group-highlight'."
1373 (let* ((list gnus-group-highlight)
1375 (end (progn (end-of-line) (point)))
1376 ;; now find out where the line starts and leave point there.
1377 (beg (progn (beginning-of-line) (point)))
1378 (group (gnus-group-group-name))
1379 (entry (gnus-group-entry group))
1380 (unread (if (numberp (car entry)) (car entry) 0))
1381 (active (gnus-active group))
1382 (total (if active (1+ (- (cdr active) (car active))) 0))
1383 (info (nth 2 entry))
1384 (method (gnus-server-get-method group (gnus-info-method info)))
1385 (marked (gnus-info-marks info))
1386 (mailp (apply 'append
1389 (memq x (assoc (symbol-name
1390 (car (or method gnus-select-method)))
1391 gnus-valid-select-methods)))
1392 '(mail post-mail))))
1393 (level (or (gnus-info-level info) gnus-level-killed))
1394 (score (or (gnus-info-score info) 0))
1395 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1396 (group-age (gnus-group-timestamp-delta group))
1397 (inhibit-read-only t))
1398 ;; Eval the cars of the lists until we find a match.
1400 (not (eval (caar list))))
1401 (setq list (cdr list)))
1402 (let ((face (cdar list)))
1403 (unless (eq face (get-text-property beg 'face))
1404 (gnus-put-text-property-excluding-characters-with-faces
1406 (setq face (if (boundp face) (symbol-value face) face)))
1407 (gnus-extent-start-open beg)))
1410 (defun gnus-group-update-group (group &optional visible-only)
1411 "Update all lines where GROUP appear.
1412 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1414 ;; Can't use `save-excursion' here, so we do it manually.
1415 (let ((buf (current-buffer))
1417 (set-buffer gnus-group-buffer)
1418 (setq mark (point-marker))
1419 ;; The buffer may be narrowed.
1422 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1424 found buffer-read-only)
1425 ;; Enter the current status into the dribble buffer.
1426 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
1428 (not (gnus-ephemeral-group-p group)))
1430 (concat "(gnus-group-set-info '"
1431 (gnus-prin1-to-string (nth 2 entry))
1433 ;; Find all group instances. If topics are in use, each group
1434 ;; may be listed in more than once.
1435 (while (setq loc (text-property-any
1436 loc (point-max) 'gnus-group ident))
1439 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1441 (gnus-group-insert-group-line-info group)
1444 (gnus-run-hooks 'gnus-group-update-group-hook)))
1445 (setq loc (1+ loc)))
1446 (unless (or found visible-only)
1447 ;; No such line in the buffer, find out where it's supposed to
1448 ;; go, and insert it there (or at the end of the buffer).
1449 (if gnus-goto-missing-group-function
1450 (funcall gnus-goto-missing-group-function group)
1451 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb))))
1452 (while (and entry (car entry)
1456 (point-min) (point-max)
1457 'gnus-group (gnus-intern-safe
1458 (caar entry) gnus-active-hashtb)))))
1459 (setq entry (cdr entry)))
1460 (or entry (goto-char (point-max)))))
1461 ;; Finally insert the line.
1462 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1463 (gnus-group-insert-group-line-info group)
1466 (gnus-run-hooks 'gnus-group-update-group-hook))))
1467 (when gnus-group-update-group-function
1468 (funcall gnus-group-update-group-function group))
1469 (gnus-group-set-mode-line)))
1471 (set-marker mark nil)
1474 (defun gnus-group-set-mode-line ()
1475 "Update the mode line in the group buffer."
1476 (when (memq 'group gnus-updated-mode-lines)
1477 ;; Yes, we want to keep this mode line updated.
1479 (set-buffer gnus-group-buffer)
1480 (let* ((gformat (or gnus-group-mode-line-format-spec
1481 (gnus-set-format 'group-mode)))
1482 (gnus-tmp-news-server (cadr gnus-select-method))
1483 (gnus-tmp-news-method (car gnus-select-method))
1484 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1486 gnus-tmp-header ;Dummy binding for user-defined formats
1487 ;; Get the resulting string.
1489 (and gnus-dribble-buffer
1490 (buffer-name gnus-dribble-buffer)
1491 (buffer-modified-p gnus-dribble-buffer)
1493 (set-buffer gnus-dribble-buffer)
1494 (not (zerop (buffer-size))))))
1495 (mode-string (eval gformat)))
1496 ;; Say whether the dribble buffer has been modified.
1497 (setq mode-line-modified
1498 (if modified (car gnus-mode-line-modified)
1499 (cdr gnus-mode-line-modified)))
1500 ;; If the line is too long, we chop it off.
1501 (when (> (length mode-string) max-len)
1502 (setq mode-string (substring mode-string 0 (- max-len 4))))
1504 (setq mode-line-buffer-identification
1505 (gnus-mode-line-buffer-identification
1506 (list mode-string)))
1507 (set-buffer-modified-p modified))))))
1509 (defun gnus-group-group-name ()
1510 "Get the name of the newsgroup on the current line."
1511 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
1513 (symbol-name group))))
1515 (defun gnus-group-group-level ()
1516 "Get the level of the newsgroup on the current line."
1517 (get-text-property (gnus-point-at-bol) 'gnus-level))
1519 (defun gnus-group-group-indentation ()
1520 "Get the indentation of the newsgroup on the current line."
1521 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation)
1522 (and gnus-group-indentation-function
1523 (funcall gnus-group-indentation-function))
1526 (defun gnus-group-group-unread ()
1527 "Get the number of unread articles of the newsgroup on the current line."
1528 (get-text-property (gnus-point-at-bol) 'gnus-unread))
1530 (defun gnus-group-new-mail (group)
1531 (if (nnmail-new-mail-p (gnus-group-real-name group))
1535 (defun gnus-group-level (group)
1536 "Return the estimated level of GROUP."
1537 (or (gnus-info-level (gnus-get-info group))
1538 (and (member group gnus-zombie-list) gnus-level-zombie)
1541 (defun gnus-group-search-forward (&optional backward all level first-too)
1542 "Find the next newsgroup with unread articles.
1543 If BACKWARD is non-nil, find the previous newsgroup instead.
1544 If ALL is non-nil, just find any newsgroup.
1545 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1547 If FIRST-TOO, the current line is also eligible as a target."
1548 (let ((way (if backward -1 1))
1549 (low gnus-level-killed)
1552 (if (and backward (progn (beginning-of-line)) (bobp))
1561 (get-text-property (point) 'gnus-group)
1565 (get-text-property (point) 'gnus-unread)))
1566 (and (numberp unread) (> unread 0)))
1567 (setq lev (get-text-property (point)
1569 (<= lev gnus-level-subscribed)))
1571 (and (setq lev (get-text-property (point)
1580 (zerop (forward-line way)))))
1582 (progn (gnus-group-position-point) t)
1583 (goto-char (or pos beg))
1586 ;;; Gnus group mode commands
1590 (defun gnus-group-mark-line-p ()
1593 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1594 (eq (char-after) gnus-process-mark)))
1596 (defun gnus-group-mark-group (n &optional unmark no-advance)
1597 "Mark the current group."
1599 (let ((buffer-read-only nil)
1603 (when (setq group (gnus-group-group-name))
1604 ;; Go to the mark position.
1606 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1607 (subst-char-in-region
1608 (point) (1+ (point)) (char-after)
1611 (setq gnus-group-marked (delete group gnus-group-marked))
1613 (setq gnus-group-marked
1614 (cons group (delete group gnus-group-marked)))
1615 gnus-process-mark)))
1617 (gnus-group-next-group 1))
1619 (gnus-summary-position-point)
1622 (defun gnus-group-unmark-group (n)
1623 "Remove the mark from the current group."
1625 (gnus-group-mark-group n 'unmark)
1626 (gnus-group-position-point))
1628 (defun gnus-group-unmark-all-groups ()
1629 "Unmark all groups."
1631 (let ((groups gnus-group-marked))
1634 (gnus-group-remove-mark (pop groups)))))
1635 (gnus-group-position-point))
1637 (defun gnus-group-mark-region (unmark beg end)
1638 "Mark all groups between point and mark.
1639 If UNMARK, remove the mark instead."
1640 (interactive "P\nr")
1641 (let ((num (count-lines beg end)))
1644 (- num (gnus-group-mark-group num unmark)))))
1646 (defun gnus-group-mark-buffer (&optional unmark)
1647 "Mark all groups in the buffer.
1648 If UNMARK, remove the mark instead."
1650 (gnus-group-mark-region unmark (point-min) (point-max)))
1652 (defun gnus-group-mark-regexp (regexp)
1653 "Mark all groups that match some regexp."
1654 (interactive "sMark (regexp): ")
1655 (let ((alist (cdr gnus-newsrc-alist))
1658 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1659 (gnus-group-set-mark group))))
1660 (gnus-group-position-point))
1662 (defun gnus-group-remove-mark (group &optional test-marked)
1663 "Remove the process mark from GROUP and move point there.
1664 Return nil if the group isn't displayed."
1665 (if (gnus-group-goto-group group nil test-marked)
1667 (gnus-group-mark-group 1 'unmark t)
1669 (setq gnus-group-marked
1670 (delete group gnus-group-marked))
1673 (defun gnus-group-set-mark (group)
1674 "Set the process mark on GROUP."
1675 (if (gnus-group-goto-group group)
1677 (gnus-group-mark-group 1 nil t))
1678 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1680 (defun gnus-group-universal-argument (arg &optional groups func)
1681 "Perform any command on all groups according to the process/prefix convention."
1683 (if (eq (setq func (or func
1686 (substitute-command-keys
1687 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1689 (gnus-error 1 "Undefined key")
1690 (gnus-group-iterate arg
1692 (command-execute func))))
1693 (gnus-group-position-point))
1695 (defun gnus-group-process-prefix (n)
1696 "Return a list of groups to work on.
1697 Take into consideration N (the prefix) and the list of marked groups."
1700 (setq n (prefix-numeric-value n))
1701 ;; There is a prefix, so we return a list of the N next
1703 (let ((way (if (< n 0) -1 1))
1708 (if (setq group (gnus-group-group-name))
1709 (push group groups))
1711 (gnus-group-next-group way)))
1713 ((gnus-region-active-p)
1714 ;; Work on the region between point and mark.
1715 (let ((max (max (point) (mark)))
1718 (goto-char (min (point) (mark)))
1721 (push (gnus-group-group-name) groups)
1722 (zerop (gnus-group-next-group 1))
1724 (nreverse groups))))
1726 ;; No prefix, but a list of marked articles.
1727 (reverse gnus-group-marked))
1729 ;; Neither marked articles or a prefix, so we return the
1731 (let ((group (gnus-group-group-name)))
1732 (and group (list group))))))
1734 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1735 ;;; imagine why I went through these contortions...
1737 (let ((function (make-symbol "gnus-group-iterate-function"))
1738 (window (make-symbol "gnus-group-iterate-window"))
1739 (groups (make-symbol "gnus-group-iterate-groups"))
1740 (group (make-symbol "gnus-group-iterate-group")))
1742 `(defun gnus-group-iterate (arg ,function)
1743 "Iterate FUNCTION over all process/prefixed groups.
1744 FUNCTION will be called with the group name as the parameter
1745 and with point over the group in question."
1746 (let ((,groups (gnus-group-process-prefix arg))
1747 (,window (selected-window))
1750 (setq ,group (car ,groups)
1751 ,groups (cdr ,groups))
1752 (select-window ,window)
1753 (gnus-group-remove-mark ,group)
1754 (save-selected-window
1756 (funcall ,function ,group)))))))))
1758 (put 'gnus-group-iterate 'lisp-indent-function 1)
1760 ;; Selecting groups.
1762 (defun gnus-group-read-group (&optional all no-article group select-articles)
1763 "Read news in this newsgroup.
1764 If the prefix argument ALL is non-nil, already read articles become
1765 readable. IF ALL is a number, fetch this number of articles. If the
1766 optional argument NO-ARTICLE is non-nil, no article will be
1767 auto-selected upon group entry. If GROUP is non-nil, fetch that
1770 (let ((no-display (eq all 0))
1771 (group (or group (gnus-group-group-name)))
1772 number active marked entry)
1776 (error "No group on current line"))
1777 (setq marked (gnus-info-marks
1778 (nth 2 (setq entry (gnus-gethash
1779 group gnus-newsrc-hashtb)))))
1780 ;; This group might be a dead group. In that case we have to get
1781 ;; the number of unread articles from `gnus-active-hashtb'.
1783 (cond ((numberp all) all)
1785 ((setq active (gnus-active group))
1786 (- (1+ (cdr active)) (car active)))))
1787 (gnus-summary-read-group
1788 group (or all (and (numberp number)
1789 (zerop (+ number (gnus-range-length
1790 (cdr (assq 'tick marked)))
1792 (cdr (assq 'dormant marked)))))))
1793 no-article nil no-display nil select-articles)))
1795 (defun gnus-group-select-group (&optional all)
1796 "Select this newsgroup.
1797 No article is selected automatically.
1798 If the group is opened, just switch the summary buffer.
1799 If ALL is non-nil, already read articles become readable.
1800 If ALL is a number, fetch this number of articles."
1802 (gnus-group-read-group all t))
1804 (defun gnus-group-quick-select-group (&optional all)
1805 "Select the current group \"quickly\".
1806 This means that no highlighting or scoring will be performed.
1807 If ALL (the prefix argument) is 0, don't even generate the summary
1810 This might be useful if you want to toggle threading
1811 before entering the group."
1813 (require 'gnus-score)
1815 gnus-score-find-score-files-function
1816 gnus-home-score-file
1817 gnus-apply-kill-hook
1818 gnus-summary-expunge-below)
1819 (gnus-group-read-group all t)))
1821 (defun gnus-group-visible-select-group (&optional all)
1822 "Select the current group without hiding any articles."
1824 (let ((gnus-inhibit-limiting t))
1825 (gnus-group-read-group all t)))
1827 (defun gnus-group-select-group-ephemerally ()
1828 "Select the current group without doing any processing whatsoever.
1829 You will actually be entered into a group that's a copy of
1830 the current group; no changes you make while in this group will
1833 (require 'gnus-score)
1835 gnus-score-find-score-files-function gnus-apply-kill-hook
1836 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1837 gnus-summary-mode-hook gnus-select-group-hook
1838 (group (gnus-group-group-name))
1839 (method (gnus-find-method-for-group group)))
1840 (gnus-group-read-ephemeral-group
1841 (gnus-group-prefixed-name group method) method)))
1844 (defun gnus-fetch-group (group)
1845 "Start Gnus if necessary and enter GROUP.
1846 Returns whether the fetching was successful or not."
1847 (interactive (list (completing-read "Group name: " gnus-active-hashtb)))
1848 (unless (get-buffer gnus-group-buffer)
1850 (gnus-group-read-group nil nil group))
1853 (defun gnus-fetch-group-other-frame (group)
1854 "Pop up a frame and enter GROUP."
1856 (let ((window (get-buffer-window gnus-group-buffer)))
1858 (select-frame (window-frame window)))
1859 ((= (length (frame-list)) 1)
1860 (select-frame (make-frame)))
1863 (gnus-fetch-group group))
1865 (defvar gnus-ephemeral-group-server 0)
1867 ;; Enter a group that is not in the group buffer. Non-nil is returned
1868 ;; if selection was successful.
1869 (defun gnus-group-read-ephemeral-group (group method &optional activate
1870 quit-config request-only
1872 "Read GROUP from METHOD as an ephemeral group.
1873 If ACTIVATE, request the group first.
1874 If QUIT-CONFIG, use that window configuration when exiting from the
1876 If REQUEST-ONLY, don't actually read the group; just request it.
1877 If SELECT-ARTICLES, only select those articles.
1879 Return the name of the group if selection was successful."
1880 ;; Transform the select method into a unique server.
1881 (when (stringp method)
1882 (setq method (gnus-server-to-method method)))
1884 `(,(car method) ,(concat (cadr method) "-ephemeral")
1885 (,(intern (format "%s-address" (car method))) ,(cadr method))
1887 (let ((group (if (gnus-group-foreign-p group) group
1888 (gnus-group-prefixed-name (gnus-group-real-name group)
1893 ,gnus-level-default-subscribed nil nil ,method
1895 ,(if quit-config quit-config
1896 (cons gnus-summary-buffer
1897 gnus-current-window-configuration))))))
1899 (push method gnus-ephemeral-servers)
1900 (set-buffer gnus-group-buffer)
1901 (unless (gnus-check-server method)
1902 (error "Unable to contact server: %s" (gnus-status-message method)))
1904 (gnus-activate-group group 'scan)
1905 (unless (gnus-request-group group)
1906 (error "Couldn't request group: %s"
1907 (nnheader-get-report (car method)))))
1911 (when (gnus-group-read-group t t group select-articles)
1915 (message "Quit reading the ephemeral group")
1918 (defun gnus-group-jump-to-group (group)
1919 "Jump to newsgroup GROUP."
1921 (list (completing-read
1922 "Group: " gnus-active-hashtb nil
1923 (gnus-read-active-file-p)
1924 gnus-group-jump-to-group-prompt
1925 'gnus-group-history)))
1927 (when (equal group "")
1928 (error "Empty group name"))
1930 (unless (gnus-ephemeral-group-p group)
1931 ;; Either go to the line in the group buffer...
1932 (unless (gnus-group-goto-group group)
1933 ;; ... or insert the line.
1934 (gnus-group-update-group group)
1935 (gnus-group-goto-group group)))
1936 ;; Adjust cursor point.
1937 (gnus-group-position-point))
1939 (defun gnus-group-goto-group (group &optional far test-marked)
1940 "Goto to newsgroup GROUP.
1941 If FAR, it is likely that the group is not on the current line.
1942 If TEST-MARKED, the line must be marked."
1946 ;; It's quite likely that we are on the right line, so
1947 ;; we check the current line first.
1949 (eq (get-text-property (point) 'gnus-group)
1950 (gnus-intern-safe group gnus-active-hashtb))
1951 (or (not test-marked) (gnus-group-mark-line-p)))
1953 ;; Previous and next line are also likely, so we check them as well.
1957 (and (eq (get-text-property (point) 'gnus-group)
1958 (gnus-intern-safe group gnus-active-hashtb))
1959 (or (not test-marked) (gnus-group-mark-line-p)))))
1965 (and (eq (get-text-property (point) 'gnus-group)
1966 (gnus-intern-safe group gnus-active-hashtb))
1967 (or (not test-marked) (gnus-group-mark-line-p)))))
1971 (goto-char (point-min))
1973 (while (and (not found)
1978 (gnus-intern-safe group gnus-active-hashtb))))
1979 (if (gnus-group-mark-line-p)
1984 ;; Search through the entire buffer.
1987 (point-min) (point-max)
1988 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))))))
1990 (defun gnus-group-next-group (n &optional silent)
1991 "Go to next N'th newsgroup.
1992 If N is negative, search backward instead.
1993 Returns the difference between N and the number of skips actually
1996 (gnus-group-next-unread-group n t nil silent))
1998 (defun gnus-group-next-unread-group (n &optional all level silent)
1999 "Go to next N'th unread newsgroup.
2000 If N is negative, search backward instead.
2001 If ALL is non-nil, choose any newsgroup, unread or not.
2002 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
2003 such group can be found, the next group with a level higher than
2005 Returns the difference between N and the number of skips actually
2008 (let ((backward (< n 0))
2011 (gnus-group-search-forward
2012 backward (or (not gnus-group-goto-unread) all) level))
2016 (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread")
2017 (if level " on this level or higher" "")))
2020 (defun gnus-group-prev-group (n)
2021 "Go to previous N'th newsgroup.
2022 Returns the difference between N and the number of skips actually
2025 (gnus-group-next-unread-group (- n) t))
2027 (defun gnus-group-prev-unread-group (n)
2028 "Go to previous N'th unread newsgroup.
2029 Returns the difference between N and the number of skips actually
2032 (gnus-group-next-unread-group (- n)))
2034 (defun gnus-group-next-unread-group-same-level (n)
2035 "Go to next N'th unread newsgroup on the same level.
2036 If N is negative, search backward instead.
2037 Returns the difference between N and the number of skips actually
2040 (gnus-group-next-unread-group n t (gnus-group-group-level))
2041 (gnus-group-position-point))
2043 (defun gnus-group-prev-unread-group-same-level (n)
2044 "Go to next N'th unread newsgroup on the same level.
2045 Returns the difference between N and the number of skips actually
2048 (gnus-group-next-unread-group (- n) t (gnus-group-group-level))
2049 (gnus-group-position-point))
2051 (defun gnus-group-best-unread-group (&optional exclude-group)
2052 "Go to the group with the highest level.
2053 If EXCLUDE-GROUP, do not go to that group."
2055 (goto-char (point-min))
2059 (setq unread (get-text-property (point) 'gnus-unread))
2060 (when (and (numberp unread) (> unread 0))
2061 (when (and (get-text-property (point) 'gnus-level)
2062 (< (get-text-property (point) 'gnus-level) best)
2063 (or (not exclude-group)
2064 (not (equal exclude-group (gnus-group-group-name)))))
2065 (setq best (get-text-property (point) 'gnus-level))
2066 (setq best-point (point))))
2069 (goto-char best-point))
2070 (gnus-summary-position-point)
2071 (and best-point (gnus-group-group-name))))
2073 (defun gnus-group-first-unread-group ()
2074 "Go to the first group with unread articles."
2077 (let ((opoint (point))
2079 (goto-char (point-min))
2080 (if (or (eq (setq unread (gnus-group-group-unread)) t) ; Not active.
2081 (and (numberp unread) ; Not a topic.
2082 (not (zerop unread))) ; Has unread articles.
2083 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2086 nil)) ; Not success.
2087 (gnus-group-position-point)))
2089 (defun gnus-group-enter-server-mode ()
2090 "Jump to the server buffer."
2092 (gnus-enter-server-buffer))
2094 (defun gnus-group-make-group (name &optional method address args)
2095 "Add a new newsgroup.
2096 The user will be prompted for a NAME, for a select METHOD, and an
2100 (gnus-read-group "Group name: ")
2101 (gnus-read-method "From method: ")))
2103 (when (stringp method)
2104 (setq method (or (gnus-server-to-method method) method)))
2105 (let* ((meth (gnus-method-simplify
2107 (not (gnus-server-equal method gnus-select-method)))
2108 (if address (list (intern method) address)
2110 (nname (if method (gnus-group-prefixed-name name meth) name))
2112 (when (gnus-gethash nname gnus-newsrc-hashtb)
2113 (error "Group %s already exists" nname))
2114 ;; Subscribe to the new group.
2115 (gnus-group-change-level
2116 (setq info (list t nname gnus-level-default-subscribed nil nil meth))
2117 gnus-level-default-subscribed gnus-level-killed
2118 (and (gnus-group-group-name)
2119 (gnus-gethash (gnus-group-group-name)
2120 gnus-newsrc-hashtb))
2123 (gnus-set-active nname (cons 1 0))
2124 (unless (gnus-ephemeral-group-p name)
2126 (concat "(gnus-group-set-info '"
2127 (gnus-prin1-to-string (cdr info)) ")")))
2129 (gnus-group-insert-group-line-info nname)
2131 (gnus-group-position-point)
2133 ;; Load the backend and try to make the backend create
2134 ;; the group as well.
2135 (when (assoc (symbol-name (setq backend (car (gnus-server-get-method
2137 gnus-valid-select-methods)
2139 (gnus-check-server meth)
2140 (when (gnus-check-backend-function 'request-create-group nname)
2141 (gnus-request-create-group nname nil args))
2144 (defun gnus-group-delete-groups (&optional arg)
2145 "Delete the current group. Only meaningful with editable groups."
2147 (let ((n (length (gnus-group-process-prefix arg))))
2148 (when (gnus-yes-or-no-p
2150 "Delete this 1 group? "
2151 (format "Delete these %d groups? " n)))
2152 (gnus-group-iterate arg
2154 (gnus-group-delete-group group nil t))))))
2156 (defun gnus-group-delete-group (group &optional force no-prompt)
2157 "Delete the current group. Only meaningful with editable groups.
2158 If FORCE (the prefix) is non-nil, all the articles in the group will
2159 be deleted. This is \"deleted\" as in \"removed forever from the face
2160 of the Earth\". There is no undo. The user will be prompted before
2161 doing the deletion."
2163 (list (gnus-group-group-name)
2164 current-prefix-arg))
2166 (error "No group to delete"))
2167 (unless (gnus-check-backend-function 'request-delete-group group)
2168 (error "This backend does not support group deletion"))
2170 (if (and (not no-prompt)
2171 (not (gnus-yes-or-no-p
2173 "Do you really want to delete %s%s? "
2174 group (if force " and all its contents" "")))))
2176 (gnus-message 6 "Deleting group %s..." group)
2177 (if (not (gnus-request-delete-group group force))
2178 (gnus-error 3 "Couldn't delete group %s" group)
2179 (gnus-message 6 "Deleting group %s...done" group)
2180 (gnus-group-goto-group group)
2181 (gnus-group-kill-group 1 t)
2182 (gnus-sethash group nil gnus-active-hashtb)
2184 (gnus-group-position-point)))
2186 (defun gnus-group-rename-group (group new-name)
2187 "Rename group from GROUP to NEW-NAME.
2188 When used interactively, GROUP is the group under point
2189 and NEW-NAME will be prompted for."
2192 (gnus-group-group-name)
2194 (unless (gnus-check-backend-function
2195 'request-rename-group (gnus-group-group-name))
2196 (error "This backend does not support renaming groups"))
2197 (gnus-read-group "Rename group to: "
2198 (gnus-group-real-name (gnus-group-group-name))))))
2200 (unless (gnus-check-backend-function 'request-rename-group group)
2201 (error "This backend does not support renaming groups"))
2203 (error "No group to rename"))
2204 (when (equal (gnus-group-real-name group) new-name)
2205 (error "Can't rename to the same name"))
2207 ;; We find the proper prefixed name.
2209 (if (gnus-group-native-p group)
2213 (gnus-group-prefixed-name
2214 (gnus-group-real-name new-name)
2215 (gnus-info-method (gnus-get-info group)))))
2217 (gnus-message 6 "Renaming group %s to %s..." group new-name)
2220 (gnus-group-goto-group group)
2221 (not (when (< (gnus-group-group-level) gnus-level-zombie)
2222 (gnus-request-rename-group group new-name))))
2223 (gnus-error 3 "Couldn't rename group %s to %s" group new-name)
2224 ;; We rename the group internally by killing it...
2225 (gnus-group-kill-group)
2226 ;; ... changing its name ...
2227 (setcar (cdar gnus-list-of-killed-groups) new-name)
2228 ;; ... and then yanking it. Magic!
2229 (gnus-group-yank-group)
2230 (gnus-set-active new-name (gnus-active group))
2231 (gnus-message 6 "Renaming group %s to %s...done" group new-name)
2233 (setq gnus-killed-list (delete group gnus-killed-list))
2234 (gnus-set-active group nil)
2235 (gnus-dribble-touch)
2236 (gnus-group-position-point)))
2238 (defun gnus-group-edit-group (group &optional part)
2239 "Edit the group on the current line."
2240 (interactive (list (gnus-group-group-name)))
2241 (let ((part (or part 'info))
2244 (error "No group on current line"))
2245 (unless (setq info (gnus-get-info group))
2246 (error "Killed group; can't be edited"))
2248 (gnus-close-group group))
2250 ;; Find the proper form to edit.
2251 (cond ((eq part 'method)
2252 (or (gnus-info-method info) "native"))
2254 (gnus-info-params info))
2256 ;; The proper documentation.
2258 "Editing the %s for `%s'."
2260 ((eq part 'method) "select method")
2261 ((eq part 'params) "group parameters")
2263 (gnus-group-decoded-name group))
2265 (gnus-group-edit-group-done ',part ,group form)))
2268 (gnus-create-info-command
2271 "(gnus)Select Methods")
2273 "(gnus)Group Parameters")
2275 "(gnus)Group Info"))))))
2277 (defun gnus-group-edit-group-method (group)
2278 "Edit the select method of GROUP."
2279 (interactive (list (gnus-group-group-name)))
2280 (gnus-group-edit-group group 'method))
2282 (defun gnus-group-edit-group-parameters (group)
2283 "Edit the group parameters of GROUP."
2284 (interactive (list (gnus-group-group-name)))
2285 (gnus-group-edit-group group 'params))
2287 (defun gnus-group-edit-group-done (part group form)
2289 (let* ((method (cond ((eq part 'info) (nth 4 form))
2290 ((eq part 'method) form)
2292 (info (cond ((eq part 'info) form)
2293 ((eq part 'method) (gnus-get-info group))
2296 (if (or (not method)
2298 gnus-select-method method))
2299 (gnus-group-real-name (car info))
2300 (gnus-group-prefixed-name
2301 (gnus-group-real-name (car info)) method))
2303 (when (and new-group
2304 (not (equal new-group group)))
2305 (when (gnus-group-goto-group group)
2306 (gnus-group-kill-group 1))
2307 (gnus-activate-group new-group))
2309 (if (not (and info new-group))
2310 (gnus-group-set-info form (or new-group group) part)
2311 (setq info (gnus-copy-sequence info))
2312 (setcar info new-group)
2313 (unless (gnus-server-equal method "native")
2314 (unless (nthcdr 3 info)
2315 (nconc info (list nil nil)))
2316 (unless (nthcdr 4 info)
2317 (nconc info (list nil)))
2318 (gnus-info-set-method info method))
2319 (gnus-group-set-info info))
2320 (gnus-group-update-group (or new-group group))
2321 (gnus-group-position-point)))
2323 (defun gnus-group-make-useful-group (group method)
2324 "Create one of the groups described in `gnus-useful-groups'."
2326 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2328 gnus-useful-groups)))
2329 (list (cadr entry) (caddr entry))))
2330 (setq method (gnus-copy-sequence method))
2332 (while (setq entry (memq (assq 'eval method) method))
2333 (setcar entry (eval (cadar entry)))))
2334 (gnus-group-make-group group method))
2336 (defun gnus-group-make-help-group (&optional noerror)
2337 "Create the Gnus documentation group.
2338 Optional argument NOERROR modifies the behavior of this function when the
2339 group already exists:
2340 - if not given, and error is signaled,
2341 - if t, stay silent,
2342 - if anything else, just print a message."
2344 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2345 (file (nnheader-find-etc-directory "gnus-tut.txt" t)))
2346 (if (gnus-gethash name gnus-newsrc-hashtb)
2347 (cond ((eq noerror nil)
2348 (error "Documentation group already exists"))
2353 (gnus-message 1 "Documentation group already exists")))
2356 (gnus-message 1 "Couldn't find doc group")
2357 (gnus-group-make-group
2358 (gnus-group-real-name name)
2359 (list 'nndoc "gnus-help"
2360 (list 'nndoc-address file)
2361 (list 'nndoc-article-type 'mbox))))
2363 (gnus-group-position-point))
2365 (defun gnus-group-make-doc-group (file type)
2366 "Create a group that uses a single file as the source."
2368 (list (read-file-name "File name: ")
2369 (and current-prefix-arg 'ask)))
2370 (when (eq type 'ask)
2375 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: "
2377 (setq found (cond ((= (setq char (read-char)) ?m) 'mbox)
2378 ((= char ?b) 'babyl)
2379 ((= char ?d) 'digest)
2380 ((= char ?f) 'forward)
2382 ((= char ?g) 'guess)
2383 (t (setq err (format "%c unknown. " char))
2386 (let* ((file (expand-file-name file))
2387 (name (gnus-generate-new-group-name
2388 (gnus-group-prefixed-name
2389 (file-name-nondirectory file) '(nndoc "")))))
2390 (gnus-group-make-group
2391 (gnus-group-real-name name)
2393 (list 'nndoc-address file)
2394 (list 'nndoc-article-type (or type 'guess))))))
2396 (defvar nnweb-type-definition)
2397 (defvar gnus-group-web-type-history nil)
2398 (defvar gnus-group-web-search-history nil)
2399 (defun gnus-group-make-web-group (&optional solid)
2400 "Create an ephemeral nnweb group.
2401 If SOLID (the prefix), create a solid group."
2405 (if solid (gnus-read-group "Group name: ")
2406 (message-unique-id)))
2407 (default-type (or (car gnus-group-web-type-history)
2408 (symbol-name (caar nnweb-type-definition))))
2412 (format "Search engine type (default %s): " default-type)
2413 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2414 nnweb-type-definition)
2415 nil t nil 'gnus-group-web-type-history)
2420 (cons (or (car gnus-group-web-search-history) "") 0)
2421 'gnus-group-web-search-history))
2423 `(nnweb ,group (nnweb-search ,search)
2424 (nnweb-type ,(intern type))
2425 (nnweb-ephemeral-p t))))
2427 (gnus-group-make-group group "nnweb" "" `(,(intern type) ,search))
2428 (gnus-group-read-ephemeral-group
2430 (cons (current-buffer)
2431 (if (eq major-mode 'gnus-summary-mode) 'summary 'group))))))
2433 (defvar nnwarchive-type-definition)
2434 (defvar gnus-group-warchive-type-history nil)
2435 (defvar gnus-group-warchive-login-history nil)
2436 (defvar gnus-group-warchive-address-history nil)
2438 (defun gnus-group-make-warchive-group ()
2439 "Create a nnwarchive group."
2441 (require 'nnwarchive)
2442 (let* ((group (gnus-read-group "Group name: "))
2443 (default-type (or (car gnus-group-warchive-type-history)
2444 (symbol-name (caar nnwarchive-type-definition))))
2448 (format "Warchive type (default %s): " default-type)
2449 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2450 nnwarchive-type-definition)
2451 nil t nil 'gnus-group-warchive-type-history)
2453 (address (read-string "Warchive address: "
2454 nil 'gnus-group-warchive-address-history))
2455 (default-login (or (car gnus-group-warchive-login-history)
2460 (format "Warchive login (default %s): " user-mail-address)
2461 default-login 'gnus-group-warchive-login-history)
2464 `(nnwarchive ,address
2465 (nnwarchive-type ,(intern type))
2466 (nnwarchive-login ,login))))
2467 (gnus-group-make-group group method)))
2469 (defun gnus-group-make-archive-group (&optional all)
2470 "Create the (ding) Gnus archive group of the most recent articles.
2471 Given a prefix, create a full group."
2473 (let ((group (gnus-group-prefixed-name
2474 (if all "ding.archives" "ding.recent") '(nndir ""))))
2475 (when (gnus-gethash group gnus-newsrc-hashtb)
2476 (error "Archive group already exists"))
2477 (gnus-group-make-group
2478 (gnus-group-real-name group)
2479 (list 'nndir (if all "hpc" "edu")
2480 (list 'nndir-directory
2481 (if all gnus-group-archive-directory
2482 gnus-group-recent-archive-directory))))
2483 (gnus-group-add-parameter group (cons 'to-address "ding@gnus.org"))))
2485 (defun gnus-group-make-directory-group (dir)
2486 "Create an nndir group.
2487 The user will be prompted for a directory. The contents of this
2488 directory will be used as a newsgroup. The directory should contain
2489 mail messages or news articles in files that have numeric names."
2491 (list (read-file-name "Create group from directory: ")))
2492 (unless (file-exists-p dir)
2493 (error "No such directory"))
2494 (unless (file-directory-p dir)
2495 (error "Not a directory"))
2499 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb))
2501 (gnus-group-prefixed-name
2502 (expand-file-name ext dir)
2504 (setq ext (format "<%d>" (setq i (1+ i)))))
2505 (gnus-group-make-group
2506 (gnus-group-real-name group)
2507 (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir)))))
2509 (eval-when-compile (defvar nnkiboze-score-file))
2510 (defun gnus-group-make-kiboze-group (group address scores)
2511 "Create an nnkiboze group.
2512 The user will be prompted for a name, a regexp to match groups, and
2513 score file entries for articles to include in the group."
2516 (read-string "nnkiboze group name: ")
2517 (read-string "Source groups (regexp): ")
2518 (let ((headers (mapcar (lambda (group) (list group))
2519 '("subject" "from" "number" "date" "message-id"
2520 "references" "chars" "lines" "xref"
2521 "followup" "all" "body" "head")))
2522 scores header regexp regexps)
2523 (while (not (equal "" (setq header (completing-read
2524 "Match on header: " headers nil t))))
2526 (while (not (equal "" (setq regexp (read-string
2527 (format "Match on %s (regexp): "
2529 (push (list regexp nil nil 'r) regexps))
2530 (push (cons header regexps) scores))
2532 (gnus-group-make-group group "nnkiboze" address)
2533 (let* ((nnkiboze-current-group group)
2534 (score-file (car (nnkiboze-score-file "")))
2535 (score-dir (file-name-directory score-file)))
2536 (unless (file-exists-p score-dir)
2537 (make-directory score-dir))
2538 (with-temp-file score-file
2539 (let (emacs-lisp-mode-hook)
2540 (pp scores (current-buffer))))))
2542 (defun gnus-group-add-to-virtual (n vgroup)
2543 "Add the current group to a virtual group."
2545 (list current-prefix-arg
2546 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2548 (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
2549 (error "%s is not an nnvirtual group" vgroup))
2550 (gnus-close-group vgroup)
2551 (let* ((groups (gnus-group-process-prefix n))
2552 (method (gnus-info-method (gnus-get-info vgroup))))
2553 (setcar (cdr method)
2555 (nth 1 method) "\\|"
2558 (gnus-group-remove-mark s)
2559 (concat "\\(^" (regexp-quote s) "$\\)"))
2561 (gnus-group-position-point))
2563 (defun gnus-group-make-empty-virtual (group)
2564 "Create a new, fresh, empty virtual group."
2565 (interactive "sCreate new, empty virtual group: ")
2566 (let* ((method (list 'nnvirtual "^$"))
2567 (pgroup (gnus-group-prefixed-name group method)))
2568 ;; Check whether it exists already.
2569 (when (gnus-gethash pgroup gnus-newsrc-hashtb)
2570 (error "Group %s already exists" pgroup))
2571 ;; Subscribe the new group after the group on the current line.
2572 (gnus-subscribe-group pgroup (gnus-group-group-name) method)
2573 (gnus-group-update-group pgroup)
2575 (gnus-group-position-point)))
2577 (defun gnus-group-enter-directory (dir)
2578 "Enter an ephemeral nneething group."
2579 (interactive "DDirectory to read: ")
2580 (let* ((method (list 'nneething dir '(nneething-read-only t)))
2581 (leaf (gnus-group-prefixed-name
2582 (file-name-nondirectory (directory-file-name dir))
2584 (name (gnus-generate-new-group-name leaf)))
2585 (unless (gnus-group-read-ephemeral-group
2587 (cons (current-buffer)
2588 (if (eq major-mode 'gnus-summary-mode)
2590 (error "Couldn't enter %s" dir))))
2593 (autoload 'nnimap-expunge "nnimap")
2594 (autoload 'nnimap-acl-get "nnimap")
2595 (autoload 'nnimap-acl-edit "nnimap"))
2597 (defun gnus-group-nnimap-expunge (group)
2598 "Expunge deleted articles in current nnimap GROUP."
2599 (interactive (list (gnus-group-group-name)))
2600 (let ((mailbox (gnus-group-real-name group)) method)
2602 (error "No group on current line"))
2603 (unless (gnus-get-info group)
2604 (error "Killed group; can't be edited"))
2605 (unless (eq 'nnimap (car (setq method (gnus-find-method-for-group group))))
2606 (error "%s is not an nnimap group" group))
2607 (nnimap-expunge mailbox (cadr method))))
2609 (defun gnus-group-nnimap-edit-acl (group)
2610 "Edit the Access Control List of current nnimap GROUP."
2611 (interactive (list (gnus-group-group-name)))
2612 (let ((mailbox (gnus-group-real-name group)) method acl)
2614 (error "No group on current line"))
2615 (unless (gnus-get-info group)
2616 (error "Killed group; can't be edited"))
2617 (unless (eq (car (setq method (gnus-find-method-for-group group))) 'nnimap)
2618 (error "%s is not an nnimap group" group))
2619 (unless (setq acl (nnimap-acl-get mailbox (cadr method)))
2620 (error "Server does not support ACL's"))
2621 (gnus-edit-form acl (format "Editing the access control list for `%s'.
2623 An access control list is a list of (identifier . rights) elements.
2625 The identifier string specifies the corresponding user. The
2626 identifier \"anyone\" is reserved to refer to the universal identity.
2628 Rights is a string listing a (possibly empty) set of alphanumeric
2629 characters, each character listing a set of operations which is being
2630 controlled. Letters are reserved for ``standard'' rights, listed
2631 below. Digits are reserved for implementation or site defined rights.
2633 l - lookup (mailbox is visible to LIST/LSUB commands)
2634 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2635 SEARCH, COPY from mailbox)
2636 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2637 w - write (STORE flags other than \\SEEN and \\DELETED)
2638 i - insert (perform APPEND, COPY into mailbox)
2639 p - post (send mail to submission address for mailbox,
2640 not enforced by IMAP4 itself)
2641 c - create and delete mailbox (CREATE new sub-mailboxes in any
2642 implementation-defined hierarchy, RENAME or DELETE mailbox)
2643 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2644 a - administer (perform SETACL)" group)
2647 ,mailbox ',method ',acl form)))))
2649 ;; Group sorting commands
2650 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2652 (defun gnus-group-sort-groups (func &optional reverse)
2653 "Sort the group buffer according to FUNC.
2654 When used interactively, the sorting function used will be
2655 determined by the `gnus-group-sort-function' variable.
2656 If REVERSE (the prefix), reverse the sorting order."
2657 (interactive (list gnus-group-sort-function current-prefix-arg))
2658 (funcall gnus-group-sort-alist-function
2659 (gnus-make-sort-function func) reverse)
2660 (gnus-group-unmark-all-groups)
2661 (gnus-group-list-groups)
2662 (gnus-dribble-touch))
2664 (defun gnus-group-sort-flat (func reverse)
2665 ;; We peel off the dummy group from the alist.
2667 (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group")
2668 (pop gnus-newsrc-alist))
2670 (setq gnus-newsrc-alist
2671 (sort gnus-newsrc-alist func))
2673 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
2674 ;; Regenerate the hash table.
2675 (gnus-make-hashtable-from-newsrc-alist)))
2677 (defun gnus-group-sort-groups-by-alphabet (&optional reverse)
2678 "Sort the group buffer alphabetically by group name.
2679 If REVERSE, sort in reverse order."
2681 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse))
2683 (defun gnus-group-sort-groups-by-unread (&optional reverse)
2684 "Sort the group buffer by number of unread articles.
2685 If REVERSE, sort in reverse order."
2687 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse))
2689 (defun gnus-group-sort-groups-by-level (&optional reverse)
2690 "Sort the group buffer by group level.
2691 If REVERSE, sort in reverse order."
2693 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse))
2695 (defun gnus-group-sort-groups-by-score (&optional reverse)
2696 "Sort the group buffer by group score.
2697 If REVERSE, sort in reverse order."
2699 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse))
2701 (defun gnus-group-sort-groups-by-rank (&optional reverse)
2702 "Sort the group buffer by group rank.
2703 If REVERSE, sort in reverse order."
2705 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse))
2707 (defun gnus-group-sort-groups-by-method (&optional reverse)
2708 "Sort the group buffer alphabetically by backend name.
2709 If REVERSE, sort in reverse order."
2711 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse))
2713 (defun gnus-group-sort-groups-by-server (&optional reverse)
2714 "Sort the group buffer alphabetically by server name.
2715 If REVERSE, sort in reverse order."
2717 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse))
2719 ;;; Selected group sorting.
2721 (defun gnus-group-sort-selected-groups (n func &optional reverse)
2722 "Sort the process/prefixed groups."
2723 (interactive (list current-prefix-arg gnus-group-sort-function))
2724 (let ((groups (gnus-group-process-prefix n)))
2725 (funcall gnus-group-sort-selected-function
2726 groups (gnus-make-sort-function func) reverse)
2727 (gnus-group-unmark-all-groups)
2728 (gnus-group-list-groups)
2729 (gnus-dribble-touch)))
2731 (defun gnus-group-sort-selected-flat (groups func reverse)
2732 (let (entries infos)
2733 ;; First find all the group entries for these groups.
2735 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb))
2737 ;; Then sort the infos.
2741 (lambda (entry) (car entry))
2742 (setq entries (nreverse entries)))
2745 (setq infos (nreverse infos)))
2746 ;; Go through all the infos and replace the old entries
2747 ;; with the new infos.
2749 (setcar (car entries) (pop infos))
2751 ;; Update the hashtable.
2752 (gnus-make-hashtable-from-newsrc-alist)))
2754 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse)
2755 "Sort the group buffer alphabetically by group name.
2756 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2757 sort in reverse order."
2758 (interactive (gnus-interactive "P\ny"))
2759 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-alphabet reverse))
2761 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse)
2762 "Sort the group buffer by number of unread articles.
2763 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2764 sort in reverse order."
2765 (interactive (gnus-interactive "P\ny"))
2766 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-unread reverse))
2768 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse)
2769 "Sort the group buffer by group level.
2770 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2771 sort in reverse order."
2772 (interactive (gnus-interactive "P\ny"))
2773 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-level reverse))
2775 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse)
2776 "Sort the group buffer by group score.
2777 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2778 sort in reverse order."
2779 (interactive (gnus-interactive "P\ny"))
2780 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-score reverse))
2782 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse)
2783 "Sort the group buffer by group rank.
2784 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2785 sort in reverse order."
2786 (interactive (gnus-interactive "P\ny"))
2787 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-rank reverse))
2789 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse)
2790 "Sort the group buffer alphabetically by backend name.
2791 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2792 sort in reverse order."
2793 (interactive (gnus-interactive "P\ny"))
2794 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-method reverse))
2796 ;;; Sorting predicates.
2798 (defun gnus-group-sort-by-alphabet (info1 info2)
2799 "Sort alphabetically."
2800 (string< (gnus-info-group info1) (gnus-info-group info2)))
2802 (defun gnus-group-sort-by-real-name (info1 info2)
2803 "Sort alphabetically on real (unprefixed) names."
2804 (string< (gnus-group-real-name (gnus-info-group info1))
2805 (gnus-group-real-name (gnus-info-group info2))))
2807 (defun gnus-group-sort-by-unread (info1 info2)
2808 "Sort by number of unread articles."
2809 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb)))
2810 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb))))
2811 (< (or (and (numberp n1) n1) 0)
2812 (or (and (numberp n2) n2) 0))))
2814 (defun gnus-group-sort-by-level (info1 info2)
2816 (< (gnus-info-level info1) (gnus-info-level info2)))
2818 (defun gnus-group-sort-by-method (info1 info2)
2819 "Sort alphabetically by backend name."
2820 (string< (symbol-name (car (gnus-find-method-for-group
2821 (gnus-info-group info1) info1)))
2822 (symbol-name (car (gnus-find-method-for-group
2823 (gnus-info-group info2) info2)))))
2825 (defun gnus-group-sort-by-server (info1 info2)
2826 "Sort alphabetically by server name."
2827 (string< (gnus-method-to-full-server-name
2828 (gnus-find-method-for-group
2829 (gnus-info-group info1) info1))
2830 (gnus-method-to-full-server-name
2831 (gnus-find-method-for-group
2832 (gnus-info-group info2) info2))))
2834 (defun gnus-group-sort-by-score (info1 info2)
2835 "Sort by group score."
2836 (> (gnus-info-score info1) (gnus-info-score info2)))
2838 (defun gnus-group-sort-by-rank (info1 info2)
2839 "Sort by level and score."
2840 (let ((level1 (gnus-info-level info1))
2841 (level2 (gnus-info-level info2)))
2842 (or (< level1 level2)
2843 (and (= level1 level2)
2844 (> (gnus-info-score info1) (gnus-info-score info2))))))
2848 (defun gnus-group-clear-data (&optional arg)
2849 "Clear all marks and read ranges from the current group."
2851 (gnus-group-iterate arg
2854 (gnus-info-clear-data (setq info (gnus-get-info group)))
2855 (gnus-get-unread-articles-in-group info (gnus-active group) t)
2856 (when (gnus-group-goto-group group)
2857 (gnus-group-update-group-line))))))
2859 (defun gnus-group-clear-data-on-native-groups ()
2860 "Clear all marks and read ranges from all native groups."
2862 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
2863 (let ((alist (cdr gnus-newsrc-alist))
2865 (while (setq info (pop alist))
2866 (when (gnus-group-native-p (gnus-info-group info))
2867 (gnus-info-clear-data info)))
2868 (gnus-get-unread-articles)
2869 (gnus-dribble-touch)
2870 (when (gnus-y-or-n-p
2871 "Move the cache away to avoid problems in the future? ")
2872 (call-interactively 'gnus-cache-move-cache)))))
2874 (defun gnus-info-clear-data (info)
2875 "Clear all marks and read ranges from INFO."
2876 (let ((group (gnus-info-group info))
2878 (dolist (el (gnus-info-marks info))
2879 (push `(,(cdr el) add (,(car el))) action))
2880 (push `(,(gnus-info-read info) add (read)) action)
2883 (gnus-request-set-mark ,group ',action)
2884 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
2885 (gnus-info-set-read ',info ',(gnus-info-read info))
2886 (when (gnus-group-goto-group ,group)
2887 (gnus-get-unread-articles-in-group ',info ',(gnus-active group) t)
2888 (gnus-group-update-group-line))))
2889 (setq action (mapcar (lambda (el) (list (nth 0 el) 'del (nth 2 el)))
2891 (gnus-request-set-mark group action)
2892 (gnus-info-set-read info nil)
2893 (when (gnus-info-marks info)
2894 (gnus-info-set-marks info nil))))
2896 ;; Group catching up.
2898 (defun gnus-group-catchup-current (&optional n all)
2899 "Mark all unread articles in the current newsgroup as read.
2900 If prefix argument N is numeric, the next N newsgroups will be
2901 caught up. If ALL is non-nil, marked articles will also be marked as
2902 read. Cross references (Xref: header) of articles are ignored.
2903 The number of newsgroups that this function was unable to catch
2906 (let ((groups (gnus-group-process-prefix n))
2909 (unless groups (error "No groups selected"))
2911 (or (not gnus-interactive-catchup) ;Without confirmation?
2916 "Do you really want to mark all articles in %s as read? "
2917 "Mark all unread articles in %s as read? ")
2918 (if (= (length groups) 1)
2920 (format "these %d groups" (length groups)))))))
2922 (while (setq group (pop groups))
2923 (gnus-group-remove-mark group)
2924 ;; Virtual groups have to be given special treatment.
2925 (let ((method (gnus-find-method-for-group group)))
2926 (when (eq 'nnvirtual (car method))
2927 (nnvirtual-catchup-group
2928 (gnus-group-real-name group) (nth 1 method) all)))
2929 (if (>= (gnus-group-level group) gnus-level-zombie)
2930 (gnus-message 2 "Dead groups can't be caught up")
2932 (gnus-group-goto-group group)
2933 (gnus-group-catchup group all))
2934 (gnus-group-update-group-line)
2935 (setq ret (1+ ret)))))
2936 (gnus-group-next-unread-group 1)
2939 (defun gnus-group-catchup-current-all (&optional n)
2940 "Mark all articles in current newsgroup as read.
2941 Cross references (Xref: header) of articles are ignored."
2943 (gnus-group-catchup-current n 'all))
2945 (defun gnus-group-catchup (group &optional all)
2946 "Mark all articles in GROUP as read.
2947 If ALL is non-nil, all articles are marked as read.
2948 The return value is the number of articles that were marked as read,
2949 or nil if no action could be taken."
2950 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
2952 (marks (nth 3 (nth 2 entry)))
2953 (unread (gnus-list-of-unread-articles group)))
2954 ;; Remove entries for this group.
2955 (nnmail-purge-split-history (gnus-group-real-name group))
2956 ;; Do the updating only if the newsgroup isn't killed.
2957 (if (not (numberp (car entry)))
2958 (gnus-message 1 "Can't catch up %s; non-active group" group)
2959 (gnus-update-read-articles group nil)
2961 ;; Nix out the lists of marks and dormants.
2962 (gnus-request-set-mark group (list (list (cdr (assq 'tick marks))
2964 (list (cdr (assq 'dormant marks))
2966 (setq unread (gnus-uncompress-range
2967 (gnus-range-add (gnus-range-add
2968 unread (cdr (assq 'dormant marks)))
2969 (cdr (assq 'tick marks)))))
2970 (gnus-add-marked-articles group 'tick nil nil 'force)
2971 (gnus-add-marked-articles group 'dormant nil nil 'force))
2972 ;; Do auto-expirable marks if that's required.
2973 (when (gnus-group-auto-expirable-p group)
2974 (gnus-add-marked-articles group 'expire unread)
2975 (gnus-request-set-mark group (list (list unread 'add '(expire)))))
2976 (let ((gnus-newsgroup-name group))
2977 (gnus-run-hooks 'gnus-group-catchup-group-hook))
2980 (defun gnus-group-expire-articles (&optional n)
2981 "Expire all expirable articles in the current newsgroup."
2983 (let ((groups (gnus-group-process-prefix n))
2986 (error "No groups to expire"))
2987 (while (setq group (pop groups))
2988 (gnus-group-remove-mark group)
2989 (gnus-group-expire-articles-1 group)
2990 (gnus-dribble-touch)
2991 (gnus-group-position-point))))
2993 (defun gnus-group-expire-articles-1 (group)
2994 (when (gnus-check-backend-function 'request-expire-articles group)
2995 (gnus-message 6 "Expiring articles in %s..." group)
2996 (let* ((info (gnus-get-info group))
2997 (expirable (if (gnus-group-total-expirable-p group)
2998 (cons nil (gnus-list-of-read-articles group))
2999 (assq 'expire (gnus-info-marks info))))
3000 (expiry-wait (gnus-group-find-parameter group 'expiry-wait))
3001 (nnmail-expiry-target
3002 (or (gnus-group-find-parameter group 'expiry-target)
3003 nnmail-expiry-target)))
3005 (gnus-check-group group)
3008 (gnus-compress-sequence
3010 ;; We set the expiry variables to the group
3012 (let ((nnmail-expiry-wait-function nil)
3013 (nnmail-expiry-wait expiry-wait))
3014 (gnus-request-expire-articles
3015 (gnus-uncompress-sequence (cdr expirable)) group))
3016 ;; Just expire using the normal expiry values.
3017 (gnus-request-expire-articles
3018 (gnus-uncompress-sequence (cdr expirable)) group))))
3019 (gnus-close-group group))
3020 (gnus-message 6 "Expiring articles in %s...done" group)
3021 ;; Return the list of un-expired articles.
3024 (defun gnus-group-expire-all-groups ()
3025 "Expire all expirable articles in all newsgroups."
3028 (gnus-message 5 "Expiring...")
3029 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info))
3030 (cdr gnus-newsrc-alist))))
3031 (gnus-group-expire-articles nil)))
3032 (gnus-group-position-point)
3033 (gnus-message 5 "Expiring...done"))
3035 (defun gnus-group-set-current-level (n level)
3036 "Set the level of the next N groups to LEVEL."
3041 (let ((s (read-string
3042 (format "Level (default %s): "
3043 (or (gnus-group-group-level)
3044 gnus-level-default-subscribed)))))
3045 (if (string-match "^\\s-*$" s)
3046 (int-to-string (or (gnus-group-group-level)
3047 gnus-level-default-subscribed))
3049 (unless (and (>= level 1) (<= level gnus-level-killed))
3050 (error "Invalid level: %d" level))
3051 (let ((groups (gnus-group-process-prefix n))
3053 (while (setq group (pop groups))
3054 (gnus-group-remove-mark group)
3055 (gnus-message 6 "Changed level of %s from %d to %d"
3056 group (or (gnus-group-group-level) gnus-level-killed)
3058 (gnus-group-change-level
3059 group level (or (gnus-group-group-level) gnus-level-killed))
3060 (gnus-group-update-group-line)))
3061 (gnus-group-position-point))
3063 (defun gnus-group-unsubscribe (&optional n)
3064 "Unsubscribe the current group."
3066 (gnus-group-unsubscribe-current-group n 'unsubscribe))
3068 (defun gnus-group-subscribe (&optional n)
3069 "Subscribe the current group."
3071 (gnus-group-unsubscribe-current-group n 'subscribe))
3073 (defun gnus-group-unsubscribe-current-group (&optional n do-sub)
3074 "Toggle subscription of the current group.
3075 If given numerical prefix, toggle the N next groups."
3077 (let ((groups (gnus-group-process-prefix n))
3080 (setq group (car groups)
3081 groups (cdr groups))
3082 (gnus-group-remove-mark group)
3083 (gnus-group-unsubscribe-group
3086 ((eq do-sub 'unsubscribe)
3087 gnus-level-default-unsubscribed)
3088 ((eq do-sub 'subscribe)
3089 gnus-level-default-subscribed)
3090 ((<= (gnus-group-group-level) gnus-level-subscribed)
3091 gnus-level-default-unsubscribed)
3093 gnus-level-default-subscribed))
3095 (gnus-group-update-group-line))
3096 (gnus-group-next-group 1)))
3098 (defun gnus-group-unsubscribe-group (group &optional level silent)
3099 "Toggle subscription to GROUP.
3100 Killed newsgroups are subscribed. If SILENT, don't try to update the
3103 (list (completing-read
3104 "Group: " gnus-active-hashtb nil
3105 (gnus-read-active-file-p)
3107 'gnus-group-history)))
3108 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
3110 ((string-match "^[ \t]*$" group)
3111 (error "Empty group name"))
3113 ;; Toggle subscription flag.
3114 (gnus-group-change-level
3115 newsrc (if level level (if (<= (gnus-info-level (nth 2 newsrc))
3116 gnus-level-subscribed)
3117 (1+ gnus-level-subscribed)
3118 gnus-level-default-subscribed)))
3120 (gnus-group-update-group group)))
3121 ((and (stringp group)
3122 (or (not (gnus-read-active-file-p))
3123 (gnus-active group)))
3124 ;; Add new newsgroup.
3125 (gnus-group-change-level
3127 (if level level gnus-level-default-subscribed)
3128 (or (and (member group gnus-zombie-list)
3131 (when (gnus-group-group-name)
3132 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb)))
3134 (gnus-group-update-group group)))
3135 (t (error "No such newsgroup: %s" group)))
3136 (gnus-group-position-point)))
3138 (defun gnus-group-transpose-groups (n)
3139 "Move the current newsgroup up N places.
3140 If given a negative prefix, move down instead. The difference between
3141 N and the number of steps taken is returned."
3143 (unless (gnus-group-group-name)
3144 (error "No group on current line"))
3145 (gnus-group-kill-group 1)
3147 (forward-line (- n))
3148 (gnus-group-yank-group)
3149 (gnus-group-position-point)))
3151 (defun gnus-group-kill-all-zombies (&optional dummy)
3152 "Kill all zombie newsgroups.
3153 The optional DUMMY should always be nil."
3154 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3156 (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list))
3157 (setq gnus-zombie-list nil)
3158 (gnus-dribble-touch)
3159 (gnus-group-list-groups)))
3161 (defun gnus-group-kill-region (begin end)
3162 "Kill newsgroups in current region (excluding current point).
3163 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3178 (beginning-of-line) ;Important when LINES < 1
3179 (gnus-group-kill-group lines)))
3181 (defun gnus-group-kill-group (&optional n discard)
3182 "Kill the next N groups.
3183 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3184 However, only groups that were alive can be yanked; already killed
3185 groups or zombie groups can't be yanked.
3186 The return value is the name of the group that was killed, or a list
3189 (let ((buffer-read-only nil)
3190 (groups (gnus-group-process-prefix n))
3191 group entry level out)
3192 (if (< (length groups) 10)
3193 ;; This is faster when there are few groups.
3195 (push (setq group (pop groups)) out)
3196 (gnus-group-remove-mark group)
3197 (setq level (gnus-group-group-level))
3199 (when (and (not discard)
3200 (setq entry (gnus-gethash group gnus-newsrc-hashtb)))
3203 (gnus-group-goto-group ,(gnus-group-group-name))
3204 (gnus-group-yank-group)))
3205 (push (cons (car entry) (nth 2 entry))
3206 gnus-list-of-killed-groups))
3207 (gnus-group-change-level
3208 (if entry entry group) gnus-level-killed (if entry nil level))
3209 (message "Killed group %s" group))
3210 ;; If there are lots and lots of groups to be killed, we use
3211 ;; this thing instead.
3213 (setq groups (nreverse groups))
3215 (gnus-group-remove-mark (setq group (pop groups)))
3217 (push group gnus-killed-list)
3218 (setq gnus-newsrc-alist
3219 (delq (assoc group gnus-newsrc-alist)
3221 (when gnus-group-change-level-function
3222 (funcall gnus-group-change-level-function
3223 group gnus-level-killed 3))
3225 ((setq entry (gnus-gethash group gnus-newsrc-hashtb))
3226 (push (cons (car entry) (nth 2 entry))
3227 gnus-list-of-killed-groups)
3228 (setcdr (cdr entry) (cdddr entry)))
3229 ((member group gnus-zombie-list)
3230 (setq gnus-zombie-list (delete group gnus-zombie-list))))
3231 ;; There may be more than one instance displayed.
3232 (while (gnus-group-goto-group group)
3233 (gnus-delete-line)))
3234 (gnus-make-hashtable-from-newsrc-alist)))
3236 (gnus-group-position-point)
3237 (if (< (length out) 2) (car out) (nreverse out))))
3239 (defun gnus-group-yank-group (&optional arg)
3240 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3241 The numeric ARG specifies how many newsgroups are to be yanked. The
3242 name of the newsgroup yanked is returned, or (if several groups are
3243 yanked) a list of yanked groups is returned."
3245 (setq arg (or arg 1))
3246 (let (info group prev out)
3247 (while (>= (decf arg) 0)
3248 (when (not (setq info (pop gnus-list-of-killed-groups)))
3249 (error "No more newsgroups to yank"))
3250 (push (setq group (nth 1 info)) out)
3251 ;; Find which newsgroup to insert this one before - search
3252 ;; backward until something suitable is found. If there are no
3253 ;; other newsgroups in this buffer, just make this newsgroup the
3255 (setq prev (gnus-group-group-name))
3256 (gnus-group-change-level
3257 info (gnus-info-level (cdr info)) gnus-level-killed
3258 (and prev (gnus-gethash prev gnus-newsrc-hashtb))
3260 (gnus-group-insert-group-line-info group)
3262 `(when (gnus-group-goto-group ,group)
3263 (gnus-group-kill-group 1))))
3265 (gnus-group-position-point)
3266 (if (< (length out) 2) (car out) (nreverse out))))
3268 (defun gnus-group-kill-level (level)
3269 "Kill all groups that is on a certain LEVEL."
3270 (interactive "nKill all groups on level: ")
3272 ((= level gnus-level-zombie)
3273 (setq gnus-killed-list
3274 (nconc gnus-zombie-list gnus-killed-list))
3275 (setq gnus-zombie-list nil))
3276 ((and (< level gnus-level-zombie)
3278 (or gnus-expert-user
3281 "Do you really want to kill all groups on level %d? "
3283 (let* ((prev gnus-newsrc-alist)
3286 (if (= (gnus-info-level (car alist)) level)
3288 (push (gnus-info-group (car alist)) gnus-killed-list)
3289 (setcdr prev (cdr alist)))
3291 (setq alist (cdr alist)))
3292 (gnus-make-hashtable-from-newsrc-alist)
3293 (gnus-group-list-groups)))
3295 (error "Can't kill; invalid level: %d" level))))
3297 (defun gnus-group-list-all-groups (&optional arg)
3298 "List all newsgroups with level ARG or lower.
3299 Default is gnus-level-unsubscribed, which lists all subscribed and most
3300 unsubscribed groups."
3302 (gnus-group-list-groups (or arg gnus-level-unsubscribed) t))
3304 ;; Redefine this to list ALL killed groups if prefix arg used.
3305 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3306 (defun gnus-group-list-killed (&optional arg)
3307 "List all killed newsgroups in the group buffer.
3308 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3309 entail asking the server for the groups."
3311 ;; Find all possible killed newsgroups if arg.
3313 (gnus-get-killed-groups))
3314 (if (not gnus-killed-list)
3315 (gnus-message 6 "No killed groups")
3316 (let (gnus-group-list-mode)
3317 (funcall gnus-group-prepare-function
3318 gnus-level-killed t gnus-level-killed))
3319 (goto-char (point-min)))
3320 (gnus-group-position-point))
3322 (defun gnus-group-list-zombies ()
3323 "List all zombie newsgroups in the group buffer."
3325 (if (not gnus-zombie-list)
3326 (gnus-message 6 "No zombie groups")
3327 (let (gnus-group-list-mode)
3328 (funcall gnus-group-prepare-function
3329 gnus-level-zombie t gnus-level-zombie))
3330 (goto-char (point-min)))
3331 (gnus-group-position-point))
3333 (defun gnus-group-list-active ()
3334 "List all groups that are available from the server(s)."
3336 ;; First we make sure that we have really read the active file.
3337 (unless (gnus-read-active-file-p)
3338 (let ((gnus-read-active-file t)
3339 (gnus-agent nil)) ; Trick the agent into ignoring the active file.
3340 (gnus-read-active-file)))
3341 ;; Find all groups and sort them.
3349 (push (symbol-name sym) list)))
3353 (buffer-read-only nil)
3357 (setq group (pop groups))
3358 (gnus-add-text-properties
3359 (point) (prog1 (1+ (point))
3361 (gnus-group-decoded-name group)
3363 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
3365 'gnus-level (inline (gnus-group-level group)))))
3366 (goto-char (point-min))))
3368 (defun gnus-activate-all-groups (level)
3369 "Activate absolutely all groups."
3370 (interactive (list gnus-level-unsubscribed))
3371 (let ((gnus-activate-level level)
3372 (gnus-activate-foreign-newsgroups level))
3373 (gnus-group-get-new-news)))
3375 (defun gnus-group-get-new-news (&optional arg)
3376 "Get newly arrived articles.
3377 If ARG is a number, it specifies which levels you are interested in
3378 re-scanning. If ARG is non-nil and not a number, this will force
3379 \"hard\" re-reading of the active files from all servers."
3382 (let ((gnus-inhibit-demon t)
3383 ;; Binding this variable will inhibit multiple fetchings
3384 ;; of the same mail source.
3385 (nnmail-fetched-sources (list t)))
3386 (gnus-run-hooks 'gnus-get-new-news-hook)
3388 ;; Read any slave files.
3390 (gnus-master-read-slave-newsrc))
3392 ;; We might read in new NoCeM messages here.
3393 (when (and gnus-use-nocem
3395 (gnus-nocem-scan-groups))
3396 ;; If ARG is not a number, then we read the active file.
3397 (when (and arg (not (numberp arg)))
3398 (let ((gnus-read-active-file t))
3399 (gnus-read-active-file))
3402 ;; If the user wants it, we scan for new groups.
3403 (when (eq gnus-check-new-newsgroups 'always)
3404 (gnus-find-new-newsgroups)))
3406 (setq arg (gnus-group-default-level arg t))
3407 (if (and gnus-read-active-file (not arg))
3409 (gnus-read-active-file)
3410 (gnus-get-unread-articles arg))
3411 (let ((gnus-read-active-file (if arg nil gnus-read-active-file)))
3412 (gnus-get-unread-articles arg)))
3413 (gnus-run-hooks 'gnus-after-getting-new-news-hook)
3414 (gnus-group-list-groups (and (numberp arg)
3415 (max (car gnus-group-list-mode) arg)))))
3417 (defun gnus-group-get-new-news-this-group (&optional n dont-scan)
3418 "Check for newly arrived news in the current group (and the N-1 next groups).
3419 The difference between N and the number of newsgroup checked is returned.
3420 If N is negative, this group and the N-1 previous groups will be checked."
3422 (let* ((groups (gnus-group-process-prefix n))
3423 (ret (if (numberp n) (- n (length groups)) 0))
3427 (gnus-inhibit-demon t)
3428 ;; Binding this variable will inhibit multiple fetchings
3429 ;; of the same mail source.
3430 (nnmail-fetched-sources (list t)))
3431 (gnus-run-hooks 'gnus-get-new-news-hook)
3432 (while (setq group (pop groups))
3433 (gnus-group-remove-mark group)
3434 ;; Bypass any previous denials from the server.
3435 (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
3436 (if (gnus-activate-group group (if dont-scan nil 'scan))
3438 (gnus-get-unread-articles-in-group
3439 (gnus-get-info group) (gnus-active group) t)
3440 (unless (gnus-virtual-group-p group)
3441 (gnus-close-group group))
3443 (gnus-agent-save-group-info
3444 method (gnus-group-real-name group) (gnus-active group)))
3445 (gnus-group-update-group group))
3446 (if (eq (gnus-server-status (gnus-find-method-for-group group))
3448 (gnus-error 3 "Server denied access")
3449 (gnus-error 3 "%s error: %s" group (gnus-status-message group)))))
3452 (when gnus-goto-next-group-when-activating
3453 (gnus-group-next-unread-group 1 t))
3454 (gnus-summary-position-point)
3457 (defun gnus-group-fetch-faq (group &optional faq-dir)
3458 "Fetch the FAQ for the current group.
3459 If given a prefix argument, prompt for the FAQ dir
3463 (gnus-group-group-name)
3464 (when current-prefix-arg
3466 "Faq dir: " (and (listp gnus-group-faq-directory)
3468 gnus-group-faq-directory))))))
3470 (error "No group name given"))
3471 (let ((dirs (or faq-dir gnus-group-faq-directory))
3473 (unless (listp dirs)
3474 (setq dirs (list dirs)))
3475 (while (and (not found)
3476 (setq dir (pop dirs)))
3477 (let ((name (gnus-group-real-name group)))
3478 (setq file (expand-file-name name dir)))
3479 (if (not (file-exists-p file))
3480 (gnus-message 1 "No such file: %s" file)
3481 (let ((enable-local-variables nil))
3485 (defun gnus-group-describe-group (force &optional group)
3486 "Display a description of the current newsgroup."
3487 (interactive (list current-prefix-arg (gnus-group-group-name)))
3488 (let* ((method (gnus-find-method-for-group group))
3489 (mname (gnus-group-prefixed-name "" method))
3492 gnus-description-hashtb)
3493 (gnus-sethash mname nil gnus-description-hashtb))
3495 (error "No group name given"))
3496 (when (or (and gnus-description-hashtb
3497 ;; We check whether this group's method has been
3498 ;; queried for a description file.
3499 (gnus-gethash mname gnus-description-hashtb))
3500 (setq desc (gnus-group-get-description group))
3501 (gnus-read-descriptions-file method))
3503 (or desc (gnus-gethash group gnus-description-hashtb)
3504 "No description available")))))
3506 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3507 (defun gnus-group-describe-all-groups (&optional force)
3508 "Pop up a buffer with descriptions of all newsgroups."
3511 (setq gnus-description-hashtb nil))
3512 (when (not (or gnus-description-hashtb
3513 (gnus-read-all-descriptions-files)))
3514 (error "Couldn't request descriptions file"))
3515 (let ((buffer-read-only nil)
3521 (let ((charset (gnus-group-name-charset nil (symbol-name group))))
3522 (insert (format " *: %-20s %s\n"
3523 (gnus-group-name-decode
3524 (symbol-name group) charset)
3525 (gnus-group-name-decode
3526 (symbol-value group) charset))))
3527 (gnus-add-text-properties
3528 b (1+ b) (list 'gnus-group group
3529 'gnus-unread t 'gnus-marked nil
3530 'gnus-level (1+ gnus-level-subscribed))))
3531 gnus-description-hashtb)
3532 (goto-char (point-min))
3533 (gnus-group-position-point)))
3535 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3536 (defun gnus-group-apropos (regexp &optional search-description)
3537 "List all newsgroups that have names that match a regexp."
3538 (interactive "sGnus apropos (regexp): ")
3540 (obuf (current-buffer))
3542 ;; Go through all newsgroups that are known to Gnus.
3545 (and (symbol-name group)
3546 (string-match regexp (symbol-name group))
3547 (symbol-value group)
3548 (push (symbol-name group) groups)))
3550 ;; Also go through all descriptions that are known to Gnus.
3551 (when search-description
3554 (and (string-match regexp (symbol-value group))
3555 (push (symbol-name group) groups)))
3556 gnus-description-hashtb))
3558 (gnus-message 3 "No groups matched \"%s\"." regexp)
3559 ;; Print out all the groups.
3561 (pop-to-buffer "*Gnus Help*")
3562 (buffer-disable-undo)
3564 (setq groups (sort groups 'string<))
3566 ;; Groups may be entered twice into the list of groups.
3567 (when (not (string= (car groups) prev))
3568 (setq prev (car groups))
3569 (let ((charset (gnus-group-name-charset nil prev)))
3570 (insert (gnus-group-name-decode prev charset) "\n")
3571 (when (and gnus-description-hashtb
3572 (setq des (gnus-gethash (car groups)
3573 gnus-description-hashtb)))
3574 (insert " " (gnus-group-name-decode des charset) "\n"))))
3575 (setq groups (cdr groups)))
3576 (goto-char (point-min))))
3577 (pop-to-buffer obuf)))
3579 (defun gnus-group-description-apropos (regexp)
3580 "List all newsgroups that have names or descriptions that match a regexp."
3581 (interactive "sGnus description apropos (regexp): ")
3582 (when (not (or gnus-description-hashtb
3583 (gnus-read-all-descriptions-files)))
3584 (error "Couldn't request descriptions file"))
3585 (gnus-group-apropos regexp t))
3587 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3588 (defun gnus-group-list-matching (level regexp &optional all lowest)
3589 "List all groups with unread articles that match REGEXP.
3590 If the prefix LEVEL is non-nil, it should be a number that says which
3591 level to cut off listing groups.
3592 If ALL, also list groups with no unread articles.
3593 If LOWEST, don't list groups with level lower than LOWEST.
3595 This command may read the active file."
3596 (interactive "P\nsList newsgroups matching: ")
3597 ;; First make sure active file has been read.
3599 (> (prefix-numeric-value level) gnus-level-killed))
3600 (gnus-get-killed-groups))
3601 (funcall gnus-group-prepare-function
3602 (or level gnus-level-subscribed) (and all t) (or lowest 1) regexp)
3603 (goto-char (point-min))
3604 (gnus-group-position-point))
3606 (defun gnus-group-list-all-matching (level regexp &optional lowest)
3607 "List all groups that match REGEXP.
3608 If the prefix LEVEL is non-nil, it should be a number that says which
3609 level to cut off listing groups.
3610 If LOWEST, don't list groups with level lower than LOWEST."
3611 (interactive "P\nsList newsgroups matching: ")
3613 (setq level (prefix-numeric-value level)))
3614 (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest))
3616 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3617 (defun gnus-group-save-newsrc (&optional force)
3618 "Save the Gnus startup files.
3619 If FORCE, force saving whether it is necessary or not."
3621 (gnus-save-newsrc-file force))
3623 (defun gnus-group-restart (&optional arg)
3624 "Force Gnus to read the .newsrc file."
3626 (when (gnus-yes-or-no-p
3627 (format "Are you sure you want to restart Gnus? "))
3628 (gnus-save-newsrc-file)
3632 (defun gnus-group-read-init-file ()
3633 "Read the Gnus elisp init file."
3635 (gnus-read-init-file)
3636 (gnus-message 5 "Read %s" gnus-init-file))
3638 (defun gnus-group-check-bogus-groups (&optional silent)
3639 "Check bogus newsgroups.
3640 If given a prefix, don't ask for confirmation before removing a bogus
3643 (gnus-check-bogus-newsgroups (and (not silent) (not gnus-expert-user)))
3644 (gnus-group-list-groups))
3646 (defun gnus-group-find-new-groups (&optional arg)
3647 "Search for new groups and add them.
3648 Each new group will be treated with `gnus-subscribe-newsgroup-method'.
3649 With 1 C-u, use the `ask-server' method to query the server for new
3651 With 2 C-u's, use most complete method possible to query the server
3652 for new groups, and subscribe the new groups as zombies."
3654 (gnus-find-new-newsgroups (or arg 1))
3655 (gnus-group-list-groups))
3657 (defun gnus-group-edit-global-kill (&optional article group)
3658 "Edit the global kill file.
3659 If GROUP, edit that local kill file instead."
3661 (setq gnus-current-kill-article article)
3662 (gnus-kill-file-edit-file group)
3665 (substitute-command-keys
3666 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3667 (if group "local" "global")))))
3669 (defun gnus-group-edit-local-kill (article group)
3670 "Edit a local kill file."
3671 (interactive (list nil (gnus-group-group-name)))
3672 (gnus-group-edit-global-kill article group))
3674 (defun gnus-group-force-update ()
3675 "Update `.newsrc' file."
3677 (gnus-save-newsrc-file))
3679 (defun gnus-group-suspend ()
3680 "Suspend the current Gnus session.
3681 In fact, cleanup buffers except for group mode buffer.
3682 The hook gnus-suspend-gnus-hook is called before actually suspending."
3684 (gnus-run-hooks 'gnus-suspend-gnus-hook)
3685 (gnus-offer-save-summaries)
3686 ;; Kill Gnus buffers except for group mode buffer.
3687 (let ((group-buf (get-buffer gnus-group-buffer)))
3688 (mapcar (lambda (buf)
3689 (unless (member buf (list group-buf gnus-dribble-buffer))
3690 (gnus-kill-buffer buf)))
3692 (gnus-kill-gnus-frames)
3694 (bury-buffer group-buf)
3695 (delete-windows-on group-buf t))))
3697 (defun gnus-group-clear-dribble ()
3698 "Clear all information from the dribble buffer."
3700 (gnus-dribble-clear)
3701 (gnus-message 7 "Cleared dribble buffer"))
3703 (defun gnus-group-exit ()
3704 "Quit reading news after updating .newsrc.eld and .newsrc.
3705 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3708 (or noninteractive ;For gnus-batch-kill
3709 (not gnus-interactive-exit) ;Without confirmation
3711 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3712 (gnus-run-hooks 'gnus-exit-gnus-hook)
3713 ;; Offer to save data from non-quitted summary buffers.
3714 (gnus-offer-save-summaries)
3715 ;; Save the newsrc file(s).
3716 (gnus-save-newsrc-file)
3718 (gnus-close-backends)
3719 ;; Reset everything.
3721 ;; Allow the user to do things after cleaning up.
3722 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3724 (defun gnus-group-quit ()
3725 "Quit reading news without updating .newsrc.eld or .newsrc.
3726 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3728 (when (or noninteractive ;For gnus-batch-kill
3729 (zerop (buffer-size))
3730 (not (gnus-server-opened gnus-select-method))
3732 (not gnus-current-startup-file)
3734 (format "Quit reading news without saving %s? "
3735 (file-name-nondirectory gnus-current-startup-file))))
3736 (gnus-run-hooks 'gnus-exit-gnus-hook)
3737 (gnus-configure-windows 'group t)
3738 (when (and (gnus-buffer-live-p gnus-dribble-buffer)
3739 (not (zerop (save-excursion
3740 (set-buffer gnus-dribble-buffer)
3743 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3745 (gnus-close-backends)
3747 (gnus-kill-buffer gnus-group-buffer)
3748 ;; Allow the user to do things after cleaning up.
3749 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3751 (defun gnus-group-describe-briefly ()
3752 "Give a one line description of the group mode commands."
3754 (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")))
3756 (defun gnus-group-browse-foreign-server (method)
3757 "Browse a foreign news server.
3758 If called interactively, this function will ask for a select method
3759 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
3760 If not, METHOD should be a list where the first element is the method
3761 and the second element is the address."
3763 (list (let ((how (completing-read
3765 (append gnus-valid-select-methods gnus-server-alist)
3766 nil t (cons "nntp" 0) 'gnus-method-history)))
3767 ;; We either got a backend name or a virtual server name.
3768 ;; If the first, we also need an address.
3769 (if (assoc how gnus-valid-select-methods)
3771 ;; Suggested by mapjph@bath.ac.uk.
3774 (mapcar (lambda (server) (list server))
3775 gnus-secondary-servers)))
3776 ;; We got a server name.
3778 (gnus-browse-foreign-server method))
3780 (defun gnus-group-set-info (info &optional method-only-group part)
3781 (when (or info part)
3782 (let* ((entry (gnus-gethash
3783 (or method-only-group (gnus-info-group info))
3784 gnus-newsrc-hashtb))
3786 (info (if method-only-group (nth 2 entry) info))
3788 (when method-only-group
3790 (error "Trying to change non-existent group %s" method-only-group))
3791 ;; We have received parts of the actual group info - either the
3792 ;; select method or the group parameters. We first check
3793 ;; whether we have to extend the info, and if so, do that.
3794 (let ((len (length info))
3795 (total (if (eq part 'method) 5 6)))
3797 (setcdr (nthcdr (1- len) info)
3798 (make-list (- total len) nil)))
3799 ;; Then we enter the new info.
3800 (setcar (nthcdr (1- total) info) part-info)))
3802 ;; This is a new group, so we just create it.
3804 (set-buffer gnus-group-buffer)
3805 (setq method (gnus-info-method info))
3806 (when (gnus-server-equal method "native")
3809 (set-buffer gnus-group-buffer)
3811 ;; It's a foreign group...
3812 (gnus-group-make-group
3813 (gnus-group-real-name (gnus-info-group info))
3814 (if (stringp method) method
3815 (prin1-to-string (car method)))
3817 (nth 1 (gnus-info-method info))))
3818 ;; It's a native group.
3819 (gnus-group-make-group (gnus-info-group info))))
3820 (gnus-message 6 "Note: New group created")
3822 (gnus-gethash (gnus-group-prefixed-name
3823 (gnus-group-real-name (gnus-info-group info))
3824 (or (gnus-info-method info) gnus-select-method))
3825 gnus-newsrc-hashtb))))
3826 ;; Whether it was a new group or not, we now have the entry, so we
3827 ;; can do the update.
3830 (setcar (nthcdr 2 entry) info)
3831 (when (and (not (eq (car entry) t))
3832 (gnus-active (gnus-info-group info)))
3833 (setcar entry (length
3834 (gnus-list-of-unread-articles (car info))))))
3835 (error "No such group: %s" (gnus-info-group info))))))
3837 (defun gnus-group-set-method-info (group select-method)
3838 (gnus-group-set-info select-method group 'method))
3840 (defun gnus-group-set-params-info (group params)
3841 (gnus-group-set-info params group 'params))
3843 (defun gnus-add-marked-articles (group type articles &optional info force)
3844 ;; Add ARTICLES of TYPE to the info of GROUP.
3845 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
3846 ;; add, but replace marked articles of TYPE with ARTICLES.
3847 (let ((info (or info (gnus-get-info group)))
3850 (and (not (setq marked (nthcdr 3 info)))
3852 (setcdr (nthcdr 2 info)
3853 (list (list (cons type (gnus-compress-sequence
3855 (and (not (setq m (assq type (car marked))))
3858 (cons (cons type (gnus-compress-sequence articles t) )
3862 (setcar (nthcdr 3 info)
3863 (gnus-delete-alist type (car marked)))
3864 (setcdr m (gnus-compress-sequence articles t)))
3865 (setcdr m (gnus-compress-sequence
3866 (sort (nconc (gnus-uncompress-range (cdr m))
3867 (copy-sequence articles)) '<) t))))))
3869 (defun gnus-add-mark (group mark article)
3870 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
3871 (let ((buffer (gnus-summary-buffer-name group)))
3872 (if (gnus-buffer-live-p buffer)
3874 (set-buffer (get-buffer buffer))
3875 (gnus-summary-add-mark article mark))
3876 (gnus-add-marked-articles group (cdr (assq mark gnus-article-mark-lists))
3880 ;;; Group timestamps
3883 (defun gnus-group-set-timestamp ()
3884 "Change the timestamp of the current group to the current time.
3885 This function can be used in hooks like `gnus-select-group-hook'
3886 or `gnus-group-catchup-group-hook'."
3887 (when gnus-newsgroup-name
3888 (let ((time (current-time)))
3889 (setcdr (cdr time) nil)
3890 (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
3892 (defsubst gnus-group-timestamp (group)
3893 "Return the timestamp for GROUP."
3894 (gnus-group-get-parameter group 'timestamp t))
3896 (defun gnus-group-timestamp-delta (group)
3897 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
3898 (let* ((time (or (gnus-group-timestamp group)
3900 (delta (subtract-time (current-time) time)))
3901 (+ (* (nth 0 delta) 65536.0)
3904 (defun gnus-group-timestamp-string (group)
3905 "Return a string of the timestamp for GROUP."
3906 (let ((time (gnus-group-timestamp group)))
3909 (gnus-time-iso8601 time))))
3911 (defun gnus-group-list-cached (level &optional lowest)
3912 "List all groups with cached articles.
3913 If the prefix LEVEL is non-nil, it should be a number that says which
3914 level to cut off listing groups.
3915 If LOWEST, don't list groups with level lower than LOWEST.
3917 This command may read the active file."
3920 (setq level (prefix-numeric-value level)))
3921 (when (or (not level) (>= level gnus-level-zombie))
3923 (funcall gnus-group-prepare-function
3924 (or level gnus-level-subscribed)
3926 (let ((marks (gnus-info-marks info)))
3927 (assq 'cache marks)))
3930 (or (gnus-gethash group
3931 gnus-cache-active-hashtb)
3932 ;; Cache active file might use "."
3935 (mapconcat 'identity
3936 (split-string group ":")
3938 gnus-cache-active-hashtb))))
3939 (goto-char (point-min))
3940 (gnus-group-position-point))
3942 (defun gnus-group-list-dormant (level &optional lowest)
3943 "List all groups with dormant articles.
3944 If the prefix LEVEL is non-nil, it should be a number that says which
3945 level to cut off listing groups.
3946 If LOWEST, don't list groups with level lower than LOWEST.
3948 This command may read the active file."
3951 (setq level (prefix-numeric-value level)))
3952 (when (or (not level) (>= level gnus-level-zombie))
3954 (funcall gnus-group-prepare-function
3955 (or level gnus-level-subscribed)
3957 (let ((marks (gnus-info-marks info)))
3958 (assq 'dormant marks)))
3961 (goto-char (point-min))
3962 (gnus-group-position-point))
3964 (defun gnus-group-listed-groups ()
3965 "Return a list of listed groups."
3967 (goto-char (point-min))
3968 (while (setq point (text-property-not-all (point) (point-max)
3971 (push (symbol-name (get-text-property point 'gnus-group)) groups)
3975 (defun gnus-group-list-plus (&optional args)
3976 "List groups plus the current selection."
3978 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
3979 (gnus-group-list-mode gnus-group-list-mode) ;; Save it.
3981 (push last-command-event unread-command-events)
3982 (if (featurep 'xemacs)
3983 (push (make-event 'key-press '(key ?A)) unread-command-events)
3984 (push ?A unread-command-events))
3985 (let (gnus-pick-mode keys)
3986 (setq keys (if (featurep 'xemacs)
3987 (events-to-keys (read-key-sequence nil))
3988 (read-key-sequence nil)))
3989 (setq func (lookup-key (current-local-map) keys)))
3993 (call-interactively func))))
3995 (defun gnus-group-list-flush (&optional args)
3996 "Flush groups from the current selection."
3998 (let ((gnus-group-list-option 'flush))
3999 (gnus-group-list-plus args)))
4001 (defun gnus-group-list-limit (&optional args)
4002 "List groups limited within the current selection."
4004 (let ((gnus-group-list-option 'limit))
4005 (gnus-group-list-plus args)))
4007 (defun gnus-group-mark-article-read (group article)
4008 "Mark ARTICLE read."
4009 (gnus-activate-group group)
4010 (let ((buffer (gnus-summary-buffer-name group))
4011 (mark gnus-read-mark))
4015 (with-current-buffer buffer
4016 (when gnus-newsgroup-prepared
4017 (when (and gnus-newsgroup-auto-expire
4018 (memq mark gnus-auto-expirable-marks))
4019 (setq mark gnus-expirable-mark))
4020 (setq mark (gnus-request-update-mark
4021 group article mark))
4022 (gnus-mark-article-as-read article mark)
4023 (setq gnus-newsgroup-active (gnus-active group))
4025 (gnus-group-make-articles-read group
4027 (when (gnus-group-auto-expirable-p group)
4028 (gnus-add-marked-articles
4029 group 'expire (list article))))))
4031 (provide 'gnus-group)
4033 ;;; gnus-group.el ends here