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 %w Number of new(ish) mails in the group (integer)
170 %l Whether there are GroupLens predictions for this group (string)
171 %n Select from where (string)
172 %z A string that look like `<%s:%n>' if a foreign select method is used
173 %d The date the group was last entered.
174 %E Icon as defined by `gnus-group-icon-list'.
175 %u User defined specifier. The next character in the format string should
176 be a letter. Gnus will call the function gnus-user-format-function-X,
177 where X is the letter following %u. The function will be passed the
178 current header as argument. The function should return a string, which
179 will be inserted into the buffer just like information from any other
182 Note that this format specification is not always respected. For
183 reasons of efficiency, when listing killed groups, this specification
184 is ignored altogether. If the spec is changed considerably, your
185 output may end up looking strange when listing both alive and killed
188 If you use %o or %O, reading the active file will be slower and quite
189 a bit of extra memory will be used. %D will also worsen performance.
190 Also note that if you change the format specification to include any
191 of these specs, you must probably re-start Gnus to see them go into
194 General format specifiers can also be used.
195 See (gnus)Formatting Variables."
196 :link '(custom-manual "(gnus)Formatting Variables")
197 :group 'gnus-group-visual
200 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
201 "*The format specification for the group mode line.
202 It works along the same lines as a normal formatting string,
203 with some simple extensions:
205 %S The native news server.
206 %M The native select method.
207 %: \":\" if %S isn't \"\"."
208 :group 'gnus-group-visual
211 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
212 (when (featurep 'xemacs)
213 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
214 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
216 (defcustom gnus-group-menu-hook nil
217 "Hook run after the creation of the group mode menu."
218 :group 'gnus-group-various
221 (defcustom gnus-group-catchup-group-hook nil
222 "Hook run when catching up a group from the group buffer."
223 :group 'gnus-group-various
224 :link '(custom-manual "(gnus)Group Data")
227 (defcustom gnus-group-update-group-hook nil
228 "Hook called when updating group lines."
229 :group 'gnus-group-visual
232 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
233 "*A function that is called to generate the group buffer.
234 The function is called with three arguments: The first is a number;
235 all group with a level less or equal to that number should be listed,
236 if the second is non-nil, empty groups should also be displayed. If
237 the third is non-nil, it is a number. No groups with a level lower
238 than this number should be displayed.
240 The only current function implemented is `gnus-group-prepare-flat'."
241 :group 'gnus-group-listing
244 (defcustom gnus-group-prepare-hook nil
245 "Hook called after the group buffer has been generated.
246 If you want to modify the group buffer, you can use this hook."
247 :group 'gnus-group-listing
250 (defcustom gnus-suspend-gnus-hook nil
251 "Hook called when suspending (not exiting) Gnus."
255 (defcustom gnus-exit-gnus-hook nil
256 "Hook called when exiting Gnus."
260 (defcustom gnus-after-exiting-gnus-hook nil
261 "Hook called after exiting Gnus."
265 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
266 "Hook called when a group line is changed.
267 The hook will not be called if `gnus-visual' is nil.
269 The default function `gnus-group-highlight-line' will
270 highlight the line according to the `gnus-group-highlight'
272 :group 'gnus-group-visual
275 (defcustom gnus-useful-groups
276 '(("(ding) mailing list mirrored at sunsite.auc.dk"
278 (nntp "sunsite.auc.dk"
279 (nntp-address "sunsite.auc.dk")))
282 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
286 (nndoc-article-type mbox)
287 (eval `(nndoc-address
288 ,(let ((file (nnheader-find-etc-directory
291 (error "Couldn't find doc group"))
293 "*Alist of useful group-server pairs."
294 :group 'gnus-group-listing
295 :type '(repeat (list (string :tag "Description")
297 (sexp :tag "Method"))))
299 (defcustom gnus-group-highlight
301 ((and mailp (= unread 0) (eq level 1)) .
302 gnus-group-mail-1-empty-face)
303 ((and mailp (eq level 1)) .
304 gnus-group-mail-1-face)
305 ((and mailp (= unread 0) (eq level 2)) .
306 gnus-group-mail-2-empty-face)
307 ((and mailp (eq level 2)) .
308 gnus-group-mail-2-face)
309 ((and mailp (= unread 0) (eq level 3)) .
310 gnus-group-mail-3-empty-face)
311 ((and mailp (eq level 3)) .
312 gnus-group-mail-3-face)
313 ((and mailp (= unread 0)) .
314 gnus-group-mail-low-empty-face)
316 gnus-group-mail-low-face)
318 ((and (= unread 0) (eq level 1)) .
319 gnus-group-news-1-empty-face)
320 ((and (eq level 1)) .
321 gnus-group-news-1-face)
322 ((and (= unread 0) (eq level 2)) .
323 gnus-group-news-2-empty-face)
324 ((and (eq level 2)) .
325 gnus-group-news-2-face)
326 ((and (= unread 0) (eq level 3)) .
327 gnus-group-news-3-empty-face)
328 ((and (eq level 3)) .
329 gnus-group-news-3-face)
330 ((and (= unread 0) (eq level 4)) .
331 gnus-group-news-4-empty-face)
332 ((and (eq level 4)) .
333 gnus-group-news-4-face)
334 ((and (= unread 0) (eq level 5)) .
335 gnus-group-news-5-empty-face)
336 ((and (eq level 5)) .
337 gnus-group-news-5-face)
338 ((and (= unread 0) (eq level 6)) .
339 gnus-group-news-6-empty-face)
340 ((and (eq level 6)) .
341 gnus-group-news-6-face)
342 ((and (= unread 0)) .
343 gnus-group-news-low-empty-face)
345 gnus-group-news-low-face))
346 "*Controls the highlighting of group buffer lines.
348 Below is a list of `Form'/`Face' pairs. When deciding how a a
349 particular group line should be displayed, each form is
350 evaluated. The content of the face field after the first true form is
351 used. You can change how those group lines are displayed by
352 editing the face field.
354 It is also possible to change and add form fields, but currently that
355 requires an understanding of Lisp expressions. Hopefully this will
356 change in a future release. For now, you can use the following
357 variables in the Lisp expression:
359 group: The name of the group.
360 unread: The number of unread articles in the group.
361 method: The select method used.
362 mailp: Whether it's a mail group or not.
363 level: The level of the group.
364 score: The score of the group.
365 ticked: The number of ticked articles."
366 :group 'gnus-group-visual
367 :type '(repeat (cons (sexp :tag "Form") face)))
369 (defcustom gnus-new-mail-mark ?%
370 "Mark used for groups with new mail."
371 :group 'gnus-group-visual
374 (defgroup gnus-group-icons nil
375 "Add Icons to your group buffer. "
376 :group 'gnus-group-visual)
378 (defcustom gnus-group-icon-list
380 "*Controls the insertion of icons into group buffer lines.
382 Below is a list of `Form'/`File' pairs. When deciding how a
383 particular group line should be displayed, each form is evaluated.
384 The icon from the file field after the first true form is used. You
385 can change how those group lines are displayed by editing the file
386 field. The File will either be found in the
387 `gnus-group-glyph-directory' or by designating absolute path to the
390 It is also possible to change and add form fields, but currently that
391 requires an understanding of Lisp expressions. Hopefully this will
392 change in a future release. For now, you can use the following
393 variables in the Lisp expression:
395 group: The name of the group.
396 unread: The number of unread articles in the group.
397 method: The select method used.
398 mailp: Whether it's a mail group or not.
399 newsp: Whether it's a news group or not
400 level: The level of the group.
401 score: The score of the group.
402 ticked: The number of ticked articles."
403 :group 'gnus-group-icons
404 :type '(repeat (cons (sexp :tag "Form") file)))
406 (defcustom gnus-group-name-charset-method-alist nil
407 "Alist of method and the charset for group names.
410 (((nntp \"news.com.cn\") . cn-gb-2312))"
413 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
415 (defcustom gnus-group-name-charset-group-alist
416 (if (or (and (fboundp 'find-coding-system) (find-coding-system 'utf-8))
417 (and (fboundp 'coding-system-p) (coding-system-p 'utf-8)))
420 "Alist of group regexp and the charset for group names.
423 ((\"\\.com\\.cn:\" . cn-gb-2312))"
425 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
427 (defcustom gnus-group-jump-to-group-prompt nil
428 "Default prompt for `gnus-group-jump-to-group'.
429 If non-nil, the value should be a string, e.g. \"nnml:\",
430 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
431 in the minibuffer prompt."
432 :group 'gnus-group-various
433 :type '(choice (string :tag "Prompt string")
434 (const :tag "Empty" nil)))
436 (defvar gnus-group-listing-limit 1000
437 "*A limit of the number of groups when listing.
438 If the number of groups is larger than the limit, list them in a
441 ;;; Internal variables
443 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
444 "Function for sorting the group buffer.")
446 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
447 "Function for sorting the selected groups in the group buffer.")
449 (defvar gnus-group-indentation-function nil)
450 (defvar gnus-goto-missing-group-function nil)
451 (defvar gnus-group-update-group-function nil)
452 (defvar gnus-group-goto-next-group-function nil
453 "Function to override finding the next group after listing groups.")
455 (defvar gnus-group-edit-buffer nil)
457 (defvar gnus-group-line-format-alist
458 `((?M gnus-tmp-marked-mark ?c)
459 (?S gnus-tmp-subscribed ?c)
460 (?L gnus-tmp-level ?d)
461 (?N (cond ((eq number t) "*" )
465 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
466 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
468 (?R gnus-tmp-number-of-read ?s)
469 (?t gnus-tmp-number-total ?d)
470 (?y gnus-tmp-number-of-unread ?s)
471 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
472 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
473 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
474 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
475 (?g gnus-tmp-group ?s)
476 (?G gnus-tmp-qualified-group ?s)
477 (?c (gnus-short-group-name gnus-tmp-group) ?s)
478 (?D gnus-tmp-newsgroup-description ?s)
479 (?o gnus-tmp-moderated ?c)
480 (?O gnus-tmp-moderated-string ?s)
481 (?p gnus-tmp-process-marked ?c)
482 (?s gnus-tmp-news-server ?s)
483 (?n gnus-tmp-news-method ?s)
484 (?P gnus-group-indentation ?s)
485 (?E gnus-tmp-group-icon ?s)
486 (?l gnus-tmp-grouplens ?s)
487 (?z gnus-tmp-news-method-string ?s)
488 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
489 (?w (if (gnus-news-group-p gnus-tmp-group)
493 (nnmail-new-mail-numbers (gnus-group-real-name gnus-tmp-group))
496 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
497 (?u gnus-tmp-user-defined ?s)))
499 (defvar gnus-group-mode-line-format-alist
500 `((?S gnus-tmp-news-server ?s)
501 (?M gnus-tmp-news-method ?s)
502 (?u gnus-tmp-user-defined ?s)
503 (?: gnus-tmp-colon ?s)))
505 (defvar gnus-topic-topology nil
506 "The complete topic hierarchy.")
508 (defvar gnus-topic-alist nil
509 "The complete topic-group alist.")
511 (defvar gnus-group-marked nil)
513 (defvar gnus-group-list-mode nil)
516 (defvar gnus-group-icon-cache nil)
518 (defvar gnus-group-listed-groups nil)
519 (defvar gnus-group-list-option nil)
525 (put 'gnus-group-mode 'mode-class 'special)
528 (gnus-define-keys gnus-group-mode-map
529 " " gnus-group-read-group
530 "=" gnus-group-select-group
531 "\r" gnus-group-select-group
532 "\M-\r" gnus-group-quick-select-group
533 "\M- " gnus-group-visible-select-group
534 [(meta control return)] gnus-group-select-group-ephemerally
535 "j" gnus-group-jump-to-group
536 "n" gnus-group-next-unread-group
537 "p" gnus-group-prev-unread-group
538 "\177" gnus-group-prev-unread-group
539 [delete] gnus-group-prev-unread-group
540 [backspace] gnus-group-prev-unread-group
541 "N" gnus-group-next-group
542 "P" gnus-group-prev-group
543 "\M-n" gnus-group-next-unread-group-same-level
544 "\M-p" gnus-group-prev-unread-group-same-level
545 "," gnus-group-best-unread-group
546 "." gnus-group-first-unread-group
547 "u" gnus-group-unsubscribe-current-group
548 "U" gnus-group-unsubscribe-group
549 "c" gnus-group-catchup-current
550 "C" gnus-group-catchup-current-all
551 "\M-c" gnus-group-clear-data
552 "l" gnus-group-list-groups
553 "L" gnus-group-list-all-groups
556 "g" gnus-group-get-new-news
557 "\M-g" gnus-group-get-new-news-this-group
558 "R" gnus-group-restart
559 "r" gnus-group-read-init-file
560 "B" gnus-group-browse-foreign-server
561 "b" gnus-group-check-bogus-groups
562 "F" gnus-group-find-new-groups
563 "\C-c\C-d" gnus-group-describe-group
564 "\M-d" gnus-group-describe-all-groups
565 "\C-c\C-a" gnus-group-apropos
566 "\C-c\M-\C-a" gnus-group-description-apropos
567 "a" gnus-group-post-news
568 "\ek" gnus-group-edit-local-kill
569 "\eK" gnus-group-edit-global-kill
570 "\C-k" gnus-group-kill-group
571 "\C-y" gnus-group-yank-group
572 "\C-w" gnus-group-kill-region
573 "\C-x\C-t" gnus-group-transpose-groups
574 "\C-c\C-l" gnus-group-list-killed
575 "\C-c\C-x" gnus-group-expire-articles
576 "\C-c\M-\C-x" gnus-group-expire-all-groups
578 "s" gnus-group-save-newsrc
579 "z" gnus-group-suspend
582 "?" gnus-group-describe-briefly
583 "\C-c\C-i" gnus-info-find-node
584 "\M-e" gnus-group-edit-group-method
585 "^" gnus-group-enter-server-mode
586 gnus-mouse-2 gnus-mouse-pick-group
587 "<" beginning-of-buffer
590 "\C-c\C-n" gnus-namazu-search
591 "\C-c\C-s" gnus-group-sort-groups
593 "\C-c\M-g" gnus-activate-all-groups
594 "\M-&" gnus-group-universal-argument
595 "#" gnus-group-mark-group
596 "\M-#" gnus-group-unmark-group)
598 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
599 "m" gnus-group-mark-group
600 "u" gnus-group-unmark-group
601 "w" gnus-group-mark-region
602 "b" gnus-group-mark-buffer
603 "r" gnus-group-mark-regexp
604 "U" gnus-group-unmark-all-groups)
606 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
607 "u" gnus-sieve-update
608 "g" gnus-sieve-generate)
610 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
611 "d" gnus-group-make-directory-group
612 "h" gnus-group-make-help-group
613 "u" gnus-group-make-useful-group
614 "a" gnus-group-make-archive-group
615 "k" gnus-group-make-kiboze-group
616 "l" gnus-group-nnimap-edit-acl
617 "m" gnus-group-make-group
618 "n" gnus-group-make-shimbun-group
619 "E" gnus-group-edit-group
620 "e" gnus-group-edit-group-method
621 "p" gnus-group-edit-group-parameters
622 "v" gnus-group-add-to-virtual
623 "V" gnus-group-make-empty-virtual
624 "D" gnus-group-enter-directory
625 "f" gnus-group-make-doc-group
626 "G" gnus-group-make-nnir-group
627 "w" gnus-group-make-web-group
628 "r" gnus-group-rename-group
629 "c" gnus-group-customize
630 "x" gnus-group-nnimap-expunge
631 "\177" gnus-group-delete-group
632 [delete] gnus-group-delete-group)
634 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
635 "b" gnus-group-brew-soup
636 "w" gnus-soup-save-areas
637 "s" gnus-soup-send-replies
638 "p" gnus-soup-pack-packet
639 "r" nnsoup-pack-replies)
641 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
642 "s" gnus-group-sort-groups
643 "a" gnus-group-sort-groups-by-alphabet
644 "u" gnus-group-sort-groups-by-unread
645 "l" gnus-group-sort-groups-by-level
646 "v" gnus-group-sort-groups-by-score
647 "r" gnus-group-sort-groups-by-rank
648 "m" gnus-group-sort-groups-by-method)
650 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
651 "s" gnus-group-sort-selected-groups
652 "a" gnus-group-sort-selected-groups-by-alphabet
653 "u" gnus-group-sort-selected-groups-by-unread
654 "l" gnus-group-sort-selected-groups-by-level
655 "v" gnus-group-sort-selected-groups-by-score
656 "r" gnus-group-sort-selected-groups-by-rank
657 "m" gnus-group-sort-selected-groups-by-method)
659 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
660 "k" gnus-group-list-killed
661 "z" gnus-group-list-zombies
662 "s" gnus-group-list-groups
663 "u" gnus-group-list-all-groups
664 "A" gnus-group-list-active
665 "a" gnus-group-apropos
666 "d" gnus-group-description-apropos
667 "m" gnus-group-list-matching
668 "M" gnus-group-list-all-matching
669 "l" gnus-group-list-level
670 "c" gnus-group-list-cached
671 "?" gnus-group-list-dormant)
673 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
674 "k" gnus-group-list-limit
675 "z" gnus-group-list-limit
676 "s" gnus-group-list-limit
677 "u" gnus-group-list-limit
678 "A" gnus-group-list-limit
679 "m" gnus-group-list-limit
680 "M" gnus-group-list-limit
681 "l" gnus-group-list-limit
682 "c" gnus-group-list-limit
683 "?" gnus-group-list-limit)
685 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
686 "k" gnus-group-list-flush
687 "z" gnus-group-list-flush
688 "s" gnus-group-list-flush
689 "u" gnus-group-list-flush
690 "A" gnus-group-list-flush
691 "m" gnus-group-list-flush
692 "M" gnus-group-list-flush
693 "l" gnus-group-list-flush
694 "c" gnus-group-list-flush
695 "?" gnus-group-list-flush)
697 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
698 "k" gnus-group-list-plus
699 "z" gnus-group-list-plus
700 "s" gnus-group-list-plus
701 "u" gnus-group-list-plus
702 "A" gnus-group-list-plus
703 "m" gnus-group-list-plus
704 "M" gnus-group-list-plus
705 "l" gnus-group-list-plus
706 "c" gnus-group-list-plus
707 "?" gnus-group-list-plus)
709 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
710 "f" gnus-score-flush-cache)
712 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
713 "d" gnus-group-describe-group
714 "f" gnus-group-fetch-faq
717 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
718 "l" gnus-group-set-current-level
719 "t" gnus-group-unsubscribe-current-group
720 "s" gnus-group-unsubscribe-group
721 "k" gnus-group-kill-group
722 "y" gnus-group-yank-group
723 "w" gnus-group-kill-region
724 "\C-k" gnus-group-kill-level
725 "z" gnus-group-kill-all-zombies))
727 (defun gnus-group-make-menu-bar ()
728 (gnus-turn-off-edit-menu 'group)
729 (unless (boundp 'gnus-group-reading-menu)
732 gnus-group-reading-menu gnus-group-mode-map ""
734 ["Read" gnus-group-read-group (gnus-group-group-name)]
735 ["Select" gnus-group-select-group (gnus-group-group-name)]
736 ["See old articles" (gnus-group-select-group 'all)
737 :keys "C-u SPC" :active (gnus-group-group-name)]
738 ["Catch up" gnus-group-catchup-current :active (gnus-group-group-name)
739 ,@(if (featurep 'xemacs) nil
740 '(:help "Mark unread articles in the current group as read"))]
741 ["Catch up all articles" gnus-group-catchup-current-all
742 (gnus-group-group-name)]
743 ["Check for new articles" gnus-group-get-new-news-this-group
744 :active (gnus-group-group-name)
745 ,@(if (featurep 'xemacs) nil
746 '(:help "Check for new messages in current group"))]
747 ["Toggle subscription" gnus-group-unsubscribe-current-group
748 (gnus-group-group-name)]
749 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
750 ,@(if (featurep 'xemacs) nil
751 '(:help "Kill (remove) current group"))]
752 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
753 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
754 ,@(if (featurep 'xemacs) nil
755 '(:help "Display description of the current group"))]
756 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
757 ;; Actually one should check, if any of the marked groups gives t for
758 ;; (gnus-check-backend-function 'request-expire-articles ...)
759 ["Expire articles" gnus-group-expire-articles
760 (or (and (gnus-group-group-name)
761 (gnus-check-backend-function
762 'request-expire-articles
763 (gnus-group-group-name))) gnus-group-marked)]
764 ["Set group level" gnus-group-set-current-level
765 (gnus-group-group-name)]
766 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
767 ["Customize" gnus-group-customize (gnus-group-group-name)]
769 ["Parameters" gnus-group-edit-group-parameters
770 (gnus-group-group-name)]
771 ["Select method" gnus-group-edit-group-method
772 (gnus-group-group-name)]
773 ["Info" gnus-group-edit-group (gnus-group-group-name)]
774 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
775 ["Global kill file" gnus-group-edit-global-kill t])))
778 gnus-group-group-menu gnus-group-mode-map ""
781 ["List unread subscribed groups" gnus-group-list-groups t]
782 ["List (un)subscribed groups" gnus-group-list-all-groups t]
783 ["List killed groups" gnus-group-list-killed gnus-killed-list]
784 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
785 ["List level..." gnus-group-list-level t]
786 ["Describe all groups" gnus-group-describe-all-groups t]
787 ["Group apropos..." gnus-group-apropos t]
788 ["Group and description apropos..." gnus-group-description-apropos t]
789 ["List groups matching..." gnus-group-list-matching t]
790 ["List all groups matching..." gnus-group-list-all-matching t]
791 ["List active file" gnus-group-list-active t]
792 ["List groups with cached" gnus-group-list-cached t]
793 ["List groups with dormant" gnus-group-list-dormant t])
795 ["Default sort" gnus-group-sort-groups t]
796 ["Sort by method" gnus-group-sort-groups-by-method t]
797 ["Sort by rank" gnus-group-sort-groups-by-rank t]
798 ["Sort by score" gnus-group-sort-groups-by-score t]
799 ["Sort by level" gnus-group-sort-groups-by-level t]
800 ["Sort by unread" gnus-group-sort-groups-by-unread t]
801 ["Sort by name" gnus-group-sort-groups-by-alphabet t])
802 ("Sort process/prefixed"
803 ["Default sort" gnus-group-sort-selected-groups
804 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
805 ["Sort by method" gnus-group-sort-selected-groups-by-method
806 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
807 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
808 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
809 ["Sort by score" gnus-group-sort-selected-groups-by-score
810 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
811 ["Sort by level" gnus-group-sort-selected-groups-by-level
812 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
813 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
814 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
815 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
816 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
818 ["Mark group" gnus-group-mark-group
819 (and (gnus-group-group-name)
820 (not (memq (gnus-group-group-name) gnus-group-marked)))]
821 ["Unmark group" gnus-group-unmark-group
822 (and (gnus-group-group-name)
823 (memq (gnus-group-group-name) gnus-group-marked))]
824 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
825 ["Mark regexp..." gnus-group-mark-regexp t]
826 ["Mark region" gnus-group-mark-region t]
827 ["Mark buffer" gnus-group-mark-buffer t]
828 ["Execute command" gnus-group-universal-argument
829 (or gnus-group-marked (gnus-group-group-name))])
831 ["Subscribe to a group" gnus-group-unsubscribe-group t]
832 ["Kill all newsgroups in region" gnus-group-kill-region t]
833 ["Kill all zombie groups" gnus-group-kill-all-zombies
835 ["Kill all groups on level..." gnus-group-kill-level t])
837 ["Make a foreign group" gnus-group-make-group t]
838 ["Make a shimbun group" gnus-group-make-shimbun-group t]
839 ["Add a directory group" gnus-group-make-directory-group t]
840 ["Add the help group" gnus-group-make-help-group t]
841 ["Add the archive group" gnus-group-make-archive-group t]
842 ["Make a doc group" gnus-group-make-doc-group t]
843 ["Make a web group" gnus-group-make-web-group t]
844 ["Make a kiboze group" gnus-group-make-kiboze-group t]
845 ["Make a virtual group" gnus-group-make-empty-virtual t]
846 ["Add a group to a virtual" gnus-group-add-to-virtual t]
847 ["Rename group" gnus-group-rename-group
848 (gnus-check-backend-function
849 'request-rename-group (gnus-group-group-name))]
850 ["Delete group" gnus-group-delete-group
851 (gnus-check-backend-function
852 'request-delete-group (gnus-group-group-name))])
854 ["Next" gnus-group-next-group t]
855 ["Previous" gnus-group-prev-group t]
856 ["Next unread" gnus-group-next-unread-group t]
857 ["Previous unread" gnus-group-prev-unread-group t]
858 ["Next unread same level" gnus-group-next-unread-group-same-level t]
859 ["Previous unread same level"
860 gnus-group-prev-unread-group-same-level t]
861 ["Jump to group" gnus-group-jump-to-group t]
862 ["First unread group" gnus-group-first-unread-group t]
863 ["Best unread group" gnus-group-best-unread-group t])
865 ["Generate" gnus-sieve-generate t]
866 ["Generate and update" gnus-sieve-update t])
867 ["Delete bogus groups" gnus-group-check-bogus-groups t]
868 ["Find new newsgroups" gnus-group-find-new-groups t]
869 ["Transpose" gnus-group-transpose-groups
870 (gnus-group-group-name)]
871 ["Read a directory as a group..." gnus-group-enter-directory t]))
874 gnus-group-misc-menu gnus-group-mode-map ""
877 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
878 ["Send replies" gnus-soup-send-replies
879 (fboundp 'gnus-soup-pack-packet)]
880 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
881 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
882 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
883 ["Send a mail" gnus-group-mail t]
884 ["Send a message (mail or news)" gnus-group-post-news t]
885 ["Create a local message" gnus-group-news t]
886 ["Check for new news" gnus-group-get-new-news
887 ,@(if (featurep 'xemacs) '(t)
888 '(:help "Get newly arrived articles"))
890 ["Send queued messages" gnus-delay-send-queue
891 ,@(if (featurep 'xemacs) '(t)
892 '(:help "Send all messages that are scheduled to be sent now"))
894 ["Activate all groups" gnus-activate-all-groups t]
895 ["Restart Gnus" gnus-group-restart t]
896 ["Read init file" gnus-group-read-init-file t]
897 ["Browse foreign server" gnus-group-browse-foreign-server t]
898 ["Enter server buffer" gnus-group-enter-server-mode t]
899 ["Expire all expirable articles" gnus-group-expire-all-groups t]
900 ["Generate any kiboze groups" nnkiboze-generate-groups t]
901 ["Gnus version" gnus-version t]
902 ["Save .newsrc files" gnus-group-save-newsrc t]
903 ["Suspend Gnus" gnus-group-suspend t]
904 ["Clear dribble buffer" gnus-group-clear-dribble t]
905 ["Read manual" gnus-info-find-node t]
906 ["Flush score cache" gnus-score-flush-cache t]
907 ["Toggle topics" gnus-topic-mode t]
908 ["Send a bug report" gnus-bug t]
909 ["Exit from Gnus" gnus-group-exit
910 ,@(if (featurep 'xemacs) '(t)
911 '(:help "Quit reading news"))]
912 ["Exit without saving" gnus-group-quit t]))
914 (gnus-run-hooks 'gnus-group-menu-hook)))
916 (defvar gnus-group-toolbar-map nil)
918 ;; Emacs 21 tool bar. Should be no-op otherwise.
919 (defun gnus-group-make-tool-bar ()
920 (if (and (fboundp 'tool-bar-add-item-from-menu)
921 (default-value 'tool-bar-mode)
922 (not gnus-group-toolbar-map))
923 (setq gnus-group-toolbar-map
924 (let ((tool-bar-map (make-sparse-keymap))
925 (load-path (mm-image-load-path)))
926 (tool-bar-add-item-from-menu
927 'gnus-group-get-new-news "get-news" gnus-group-mode-map)
928 (tool-bar-add-item-from-menu
929 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map)
930 (tool-bar-add-item-from-menu
931 'gnus-group-catchup-current "catchup" gnus-group-mode-map)
932 (tool-bar-add-item-from-menu
933 'gnus-group-describe-group "describe-group" gnus-group-mode-map)
934 (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe
935 :help "Subscribe to the current group")
936 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
938 :help "Unsubscribe from the current group")
939 (tool-bar-add-item-from-menu
940 'gnus-group-exit "exit-gnus" gnus-group-mode-map)
942 (if gnus-group-toolbar-map
943 (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map)))
945 (defun gnus-group-mode ()
946 "Major mode for reading news.
948 All normal editing commands are switched off.
949 \\<gnus-group-mode-map>
950 The group buffer lists (some of) the groups available. For instance,
951 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
952 lists all zombie groups.
954 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
955 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
957 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
959 The following commands are available:
961 \\{gnus-group-mode-map}"
963 (kill-all-local-variables)
964 (when (gnus-visual-p 'group-menu 'menu)
965 (gnus-group-make-menu-bar)
966 (gnus-group-make-tool-bar))
967 (gnus-simplify-mode-line)
968 (setq major-mode 'gnus-group-mode)
969 (setq mode-name "Group")
970 (gnus-group-set-mode-line)
971 (setq mode-line-process nil)
972 (use-local-map gnus-group-mode-map)
973 (buffer-disable-undo)
974 (setq truncate-lines t)
975 (setq buffer-read-only t)
976 (gnus-set-default-directory)
977 (gnus-update-format-specifications nil 'group 'group-mode)
978 (gnus-update-group-mark-positions)
983 (gnus-run-hooks 'gnus-group-mode-hook))
985 (defun gnus-update-group-mark-positions ()
987 (let ((gnus-process-mark ?\200)
988 (gnus-group-update-hook nil)
989 (gnus-group-marked '("dummy.group"))
990 (gnus-active-hashtb (make-vector 10 0))
992 (gnus-set-active "dummy.group" '(0 . 0))
993 (gnus-set-work-buffer)
994 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
995 (goto-char (point-min))
996 (setq gnus-group-mark-positions
997 (list (cons 'process (and (search-forward "\200" nil t)
1000 (defun gnus-mouse-pick-group (e)
1001 "Enter the group under the mouse pointer."
1004 (gnus-group-read-group nil))
1006 ;; Look at LEVEL and find out what the level is really supposed to be.
1007 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
1008 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
1009 (defun gnus-group-default-level (&optional level number-or-nil)
1011 (gnus-group-use-permanent-levels
1012 (or (setq gnus-group-use-permanent-levels
1013 (or level (if (numberp gnus-group-use-permanent-levels)
1014 gnus-group-use-permanent-levels
1015 (or gnus-group-default-list-level
1016 gnus-level-subscribed))))
1017 gnus-group-default-list-level gnus-level-subscribed))
1021 (or level gnus-group-default-list-level gnus-level-subscribed))))
1023 (defun gnus-group-setup-buffer ()
1024 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1025 (unless (eq major-mode 'gnus-group-mode)
1028 (gnus-carpal-setup-buffer 'group))))
1030 (defun gnus-group-name-charset (method group)
1032 (setq method (gnus-find-method-for-group group)))
1033 (let ((item (assoc method gnus-group-name-charset-method-alist))
1034 (alist gnus-group-name-charset-group-alist)
1038 (while (setq item (pop alist))
1039 (if (string-match (car item) group)
1041 result (cdr item))))
1044 (defun gnus-group-name-decode (string charset)
1045 (if (and string charset (featurep 'mule))
1046 (decode-coding-string string charset)
1049 (defun gnus-group-decoded-name (string)
1050 (let ((charset (gnus-group-name-charset nil string)))
1051 (gnus-group-name-decode string charset)))
1053 (defun gnus-group-name-encode (string charset)
1054 (if (and string charset (featurep 'mule))
1055 (encode-coding-string string charset)
1058 (defun gnus-group-encoded-name (string)
1059 (let ((charset (gnus-group-name-charset nil string)))
1060 (gnus-group-name-encode string charset)))
1062 (defun gnus-group-completing-read-group-name
1063 (prompt table &optional predicate require-match initial-contents history)
1065 (let ((decoded-table (make-vector (length table) 0)))
1068 (set (intern (gnus-group-decoded-name (symbol-name atom))
1070 (symbol-value atom)))
1072 (setq table decoded-table))
1075 (cons (gnus-group-decoded-name
1079 (gnus-group-encoded-name
1081 prompt table predicate
1086 (defun gnus-group-list-groups (&optional level unread lowest)
1087 "List newsgroups with level LEVEL or lower that have unread articles.
1088 Default is all subscribed groups.
1089 If argument UNREAD is non-nil, groups with no unread articles are also
1092 Also see the `gnus-group-use-permanent-levels' variable."
1094 (list (if current-prefix-arg
1095 (prefix-numeric-value current-prefix-arg)
1097 (gnus-group-default-level nil t)
1098 gnus-group-default-list-level
1099 gnus-level-subscribed))))
1101 (setq level (car gnus-group-list-mode)
1102 unread (cdr gnus-group-list-mode)))
1103 (setq level (gnus-group-default-level level))
1104 (gnus-group-setup-buffer)
1105 (gnus-update-format-specifications nil 'group 'group-mode)
1106 (let ((case-fold-search nil)
1107 (props (text-properties-at (gnus-point-at-bol)))
1108 (empty (= (point-min) (point-max)))
1109 (group (gnus-group-group-name))
1111 (set-buffer gnus-group-buffer)
1112 (setq number (funcall gnus-group-prepare-function level unread lowest))
1113 (when (or (and (numberp number)
1115 (zerop (buffer-size)))
1116 ;; No groups in the buffer.
1117 (gnus-message 5 gnus-no-groups-message))
1118 ;; We have some groups displayed.
1119 (goto-char (point-max))
1120 (when (or (not gnus-group-goto-next-group-function)
1121 (not (funcall gnus-group-goto-next-group-function
1125 (goto-char (point-min)))
1127 ;; Go to the first group with unread articles.
1128 (gnus-group-search-forward t))
1130 ;; Find the right group to put point on. If the current group
1131 ;; has disappeared in the new listing, try to find the next
1132 ;; one. If no next one can be found, just leave point at the
1133 ;; first newsgroup in the buffer.
1134 (when (not (gnus-goto-char
1136 (point-min) (point-max)
1137 'gnus-group (gnus-intern-safe
1138 group gnus-active-hashtb))))
1139 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb))))
1141 (not (gnus-goto-char
1143 (point-min) (point-max) 'gnus-group
1145 (caar newsrc) gnus-active-hashtb)))))
1146 (setq newsrc (cdr newsrc)))
1148 (goto-char (point-max))
1149 (forward-line -1)))))))
1150 ;; Adjust cursor point.
1151 (gnus-group-position-point)))
1153 (defun gnus-group-list-level (level &optional all)
1154 "List groups on LEVEL.
1155 If ALL (the prefix), also list groups that have no unread articles."
1156 (interactive "nList groups on level: \nP")
1157 (gnus-group-list-groups level all level))
1159 (defun gnus-group-prepare-logic (group test)
1160 (or (and gnus-group-listed-groups
1161 (null gnus-group-list-option)
1162 (member group gnus-group-listed-groups))
1164 ((null gnus-group-listed-groups) test)
1165 ((null gnus-group-list-option) test)
1166 (t (and (member group gnus-group-listed-groups)
1167 (if (eq gnus-group-list-option 'flush)
1171 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
1172 "List all newsgroups with unread articles of level LEVEL or lower.
1173 If PREDICATE is a function, list groups that the function returns non-nil;
1174 if it is t, list groups that have no unread articles.
1175 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1176 If REGEXP is a function, list dead groups that the function returns non-nil;
1177 if it is a string, only list groups matching REGEXP."
1178 (set-buffer gnus-group-buffer)
1179 (let ((buffer-read-only nil)
1180 (newsrc (cdr gnus-newsrc-alist))
1181 (lowest (or lowest 1))
1182 (not-in-list (and gnus-group-listed-groups
1183 (copy-sequence gnus-group-listed-groups)))
1184 info clevel unread group params)
1186 (when (or (< lowest gnus-level-zombie)
1187 gnus-group-listed-groups)
1188 ;; List living groups.
1190 (setq info (car newsrc)
1191 group (gnus-info-group info)
1192 params (gnus-info-params info)
1194 unread (car (gnus-gethash group gnus-newsrc-hashtb)))
1196 (setq not-in-list (delete group not-in-list)))
1198 (gnus-group-prepare-logic
1200 (and unread ; This group might be unchecked
1201 (or (not (stringp regexp))
1202 (string-match regexp group))
1203 (<= (setq clevel (gnus-info-level info)) level)
1206 ((functionp predicate)
1207 (funcall predicate info))
1208 (predicate t) ; We list all groups?
1211 (if (eq unread t) ; Unactivated?
1212 gnus-group-list-inactive-groups
1213 ; We list unactivated
1215 ; We list groups with unread articles
1216 (and gnus-list-groups-with-ticked-articles
1217 (cdr (assq 'tick (gnus-info-marks info))))
1218 ; And groups with tickeds
1219 ;; Check for permanent visibility.
1220 (and gnus-permanently-visible-groups
1221 (string-match gnus-permanently-visible-groups group))
1222 (memq 'visible params)
1223 (cdr (assq 'visible params)))))))
1224 (gnus-group-insert-group-line
1225 group (gnus-info-level info)
1226 (gnus-info-marks info) unread (gnus-info-method info)))))
1228 ;; List dead groups.
1229 (if (or gnus-group-listed-groups
1230 (and (>= level gnus-level-zombie)
1231 (<= lowest gnus-level-zombie)))
1232 (gnus-group-prepare-flat-list-dead
1233 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1234 gnus-level-zombie ?Z
1237 (dolist (group gnus-zombie-list)
1238 (setq not-in-list (delete group not-in-list))))
1239 (if (or gnus-group-listed-groups
1240 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
1241 (gnus-group-prepare-flat-list-dead
1244 (setq gnus-killed-list (sort gnus-killed-list 'string<)))
1245 gnus-level-killed ?K regexp))
1247 (gnus-group-set-mode-line)
1248 (setq gnus-group-list-mode (cons level predicate))
1249 (gnus-run-hooks 'gnus-group-prepare-hook)
1252 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1253 ;; List zombies and killed lists somewhat faster, which was
1254 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1255 ;; this by ignoring the group format specification altogether.
1257 (if (> (length groups) gnus-group-listing-limit)
1259 (setq group (pop groups))
1260 (when (gnus-group-prepare-logic
1263 (and (stringp regexp) (string-match regexp group))
1264 (and (functionp regexp) (funcall regexp group))))
1265 (gnus-add-text-properties
1266 (point) (prog1 (1+ (point))
1267 (insert " " mark " *: "
1268 (gnus-group-decoded-name group)
1270 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1272 'gnus-level level))))
1274 (setq group (pop groups))
1275 (when (gnus-group-prepare-logic
1278 (and (stringp regexp) (string-match regexp group))
1279 (and (functionp regexp) (funcall regexp group))))
1280 (gnus-group-insert-group-line
1282 (let ((active (gnus-active group)))
1284 (if (zerop (cdr active))
1286 (- (1+ (cdr active)) (car active)))
1288 (gnus-method-simplify (gnus-find-method-for-group group))))))))
1290 (defun gnus-group-update-group-line ()
1291 "Update the current line in the group buffer."
1292 (let* ((buffer-read-only nil)
1293 (group (gnus-group-group-name))
1294 (entry (and group (gnus-gethash group gnus-newsrc-hashtb)))
1295 gnus-group-indentation)
1298 (not (gnus-ephemeral-group-p group))
1300 (concat "(gnus-group-set-info '"
1301 (gnus-prin1-to-string (nth 2 entry))
1303 (setq gnus-group-indentation (gnus-group-group-indentation))
1305 (gnus-group-insert-group-line-info group)
1307 (gnus-group-position-point))))
1309 (defun gnus-group-insert-group-line-info (group)
1310 "Insert GROUP on the current line."
1311 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
1312 (gnus-group-indentation (gnus-group-group-indentation))
1316 ;; (Un)subscribed group.
1317 (setq info (nth 2 entry))
1318 (gnus-group-insert-group-line
1319 group (gnus-info-level info) (gnus-info-marks info)
1320 (or (car entry) t) (gnus-info-method info)))
1321 ;; This group is dead.
1322 (gnus-group-insert-group-line
1324 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1326 (if (setq active (gnus-active group))
1327 (if (zerop (cdr active))
1329 (- (1+ (cdr active)) (car active)))
1331 (gnus-method-simplify (gnus-find-method-for-group group))))))
1333 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1334 gnus-tmp-marked number
1336 "Insert a group line in the group buffer."
1337 (let* ((gnus-tmp-method
1338 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1339 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1341 (gnus-tmp-active (gnus-active gnus-tmp-group))
1342 (gnus-tmp-number-total
1344 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1346 (gnus-tmp-number-of-unread
1347 (if (numberp number) (int-to-string (max 0 number))
1349 (gnus-tmp-number-of-read
1350 (if (numberp number)
1351 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1353 (gnus-tmp-subscribed
1354 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1355 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1356 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1358 (gnus-tmp-qualified-group
1359 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
1360 group-name-charset))
1361 (gnus-tmp-newsgroup-description
1362 (if gnus-description-hashtb
1363 (or (gnus-group-name-decode
1364 (gnus-gethash gnus-tmp-group gnus-description-hashtb)
1365 group-name-charset) "")
1368 (if (and gnus-moderated-hashtb
1369 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
1371 (gnus-tmp-moderated-string
1372 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1373 (gnus-tmp-group-icon "==&&==")
1374 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1375 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1376 (gnus-tmp-news-method-string
1378 (format "(%s:%s)" (car gnus-tmp-method)
1379 (cadr gnus-tmp-method)) ""))
1380 (gnus-tmp-marked-mark
1381 (if (and (numberp number)
1383 (cdr (assq 'tick gnus-tmp-marked)))
1385 (gnus-tmp-process-marked
1386 (if (member gnus-tmp-group gnus-group-marked)
1387 gnus-process-mark ? ))
1389 (or (and gnus-use-grouplens
1390 (bbb-grouplens-group-p gnus-tmp-group))
1392 (buffer-read-only nil)
1393 header gnus-tmp-header) ; passed as parameter to user-funcs.
1395 (gnus-add-text-properties
1399 (let ((gnus-tmp-group (gnus-group-name-decode
1400 gnus-tmp-group group-name-charset)))
1401 (eval gnus-group-line-format-spec)))
1402 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1403 gnus-unread ,(if (numberp number)
1404 (string-to-int gnus-tmp-number-of-unread)
1406 gnus-marked ,gnus-tmp-marked-mark
1407 gnus-indentation ,gnus-group-indentation
1408 gnus-level ,gnus-tmp-level))
1410 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1411 (gnus-run-hooks 'gnus-group-update-hook))
1413 ;; Allow XEmacs to remove front-sticky text properties.
1414 (gnus-group-remove-excess-properties)))
1416 (defun gnus-group-highlight-line ()
1417 "Highlight the current line according to `gnus-group-highlight'."
1418 (let* ((list gnus-group-highlight)
1420 (end (progn (end-of-line) (point)))
1421 ;; now find out where the line starts and leave point there.
1422 (beg (progn (beginning-of-line) (point)))
1423 (group (gnus-group-group-name))
1424 (entry (gnus-group-entry group))
1425 (unread (if (numberp (car entry)) (car entry) 0))
1426 (active (gnus-active group))
1427 (total (if active (1+ (- (cdr active) (car active))) 0))
1428 (info (nth 2 entry))
1429 (method (gnus-server-get-method group (gnus-info-method info)))
1430 (marked (gnus-info-marks info))
1431 (mailp (apply 'append
1434 (memq x (assoc (symbol-name
1435 (car (or method gnus-select-method)))
1436 gnus-valid-select-methods)))
1437 '(mail post-mail))))
1438 (level (or (gnus-info-level info) gnus-level-killed))
1439 (score (or (gnus-info-score info) 0))
1440 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1441 (group-age (gnus-group-timestamp-delta group))
1442 (inhibit-read-only t))
1443 ;; Eval the cars of the lists until we find a match.
1445 (not (eval (caar list))))
1446 (setq list (cdr list)))
1447 (let ((face (cdar list)))
1448 (unless (eq face (get-text-property beg 'face))
1449 (gnus-put-text-property-excluding-characters-with-faces
1451 (setq face (if (boundp face) (symbol-value face) face)))
1452 (gnus-extent-start-open beg)))
1455 (defun gnus-group-update-group (group &optional visible-only)
1456 "Update all lines where GROUP appear.
1457 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1459 ;; Can't use `save-excursion' here, so we do it manually.
1460 (let ((buf (current-buffer))
1462 (set-buffer gnus-group-buffer)
1463 (setq mark (point-marker))
1464 ;; The buffer may be narrowed.
1467 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1469 found buffer-read-only)
1470 ;; Enter the current status into the dribble buffer.
1471 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
1473 (not (gnus-ephemeral-group-p group)))
1475 (concat "(gnus-group-set-info '"
1476 (gnus-prin1-to-string (nth 2 entry))
1478 ;; Find all group instances. If topics are in use, each group
1479 ;; may be listed in more than once.
1480 (while (setq loc (text-property-any
1481 loc (point-max) 'gnus-group ident))
1484 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1486 (gnus-group-insert-group-line-info group)
1489 (gnus-run-hooks 'gnus-group-update-group-hook)))
1490 (setq loc (1+ loc)))
1491 (unless (or found visible-only)
1492 ;; No such line in the buffer, find out where it's supposed to
1493 ;; go, and insert it there (or at the end of the buffer).
1494 (if gnus-goto-missing-group-function
1495 (funcall gnus-goto-missing-group-function group)
1496 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb))))
1497 (while (and entry (car entry)
1501 (point-min) (point-max)
1502 'gnus-group (gnus-intern-safe
1503 (caar entry) gnus-active-hashtb)))))
1504 (setq entry (cdr entry)))
1505 (or entry (goto-char (point-max)))))
1506 ;; Finally insert the line.
1507 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1508 (gnus-group-insert-group-line-info group)
1511 (gnus-run-hooks 'gnus-group-update-group-hook))))
1512 (when gnus-group-update-group-function
1513 (funcall gnus-group-update-group-function group))
1514 (gnus-group-set-mode-line)))
1516 (set-marker mark nil)
1519 (defun gnus-group-set-mode-line ()
1520 "Update the mode line in the group buffer."
1521 (when (memq 'group gnus-updated-mode-lines)
1522 ;; Yes, we want to keep this mode line updated.
1524 (set-buffer gnus-group-buffer)
1525 (let* ((gformat (or gnus-group-mode-line-format-spec
1526 (gnus-set-format 'group-mode)))
1527 (gnus-tmp-news-server (cadr gnus-select-method))
1528 (gnus-tmp-news-method (car gnus-select-method))
1529 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1531 gnus-tmp-header ;Dummy binding for user-defined formats
1532 ;; Get the resulting string.
1534 (and gnus-dribble-buffer
1535 (buffer-name gnus-dribble-buffer)
1536 (buffer-modified-p gnus-dribble-buffer)
1538 (set-buffer gnus-dribble-buffer)
1539 (not (zerop (buffer-size))))))
1540 (mode-string (eval gformat)))
1541 ;; Say whether the dribble buffer has been modified.
1542 (setq mode-line-modified
1543 (if modified (car gnus-mode-line-modified)
1544 (cdr gnus-mode-line-modified)))
1545 ;; If the line is too long, we chop it off.
1546 (when (> (length mode-string) max-len)
1547 (setq mode-string (substring mode-string 0 (- max-len 4))))
1549 (setq mode-line-buffer-identification
1550 (gnus-mode-line-buffer-identification
1551 (list mode-string)))
1552 (set-buffer-modified-p modified))))))
1554 (defun gnus-group-group-name ()
1555 "Get the name of the newsgroup on the current line."
1556 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
1558 (symbol-name group))))
1560 (defun gnus-group-group-level ()
1561 "Get the level of the newsgroup on the current line."
1562 (get-text-property (gnus-point-at-bol) 'gnus-level))
1564 (defun gnus-group-group-indentation ()
1565 "Get the indentation of the newsgroup on the current line."
1566 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation)
1567 (and gnus-group-indentation-function
1568 (funcall gnus-group-indentation-function))
1571 (defun gnus-group-group-unread ()
1572 "Get the number of unread articles of the newsgroup on the current line."
1573 (get-text-property (gnus-point-at-bol) 'gnus-unread))
1575 (defun gnus-group-new-mail (group)
1576 (if (nnmail-new-mail-p (gnus-group-real-name group))
1580 (defun gnus-group-level (group)
1581 "Return the estimated level of GROUP."
1582 (or (gnus-info-level (gnus-get-info group))
1583 (and (member group gnus-zombie-list) gnus-level-zombie)
1586 (defun gnus-group-search-forward (&optional backward all level first-too)
1587 "Find the next newsgroup with unread articles.
1588 If BACKWARD is non-nil, find the previous newsgroup instead.
1589 If ALL is non-nil, just find any newsgroup.
1590 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1592 If FIRST-TOO, the current line is also eligible as a target."
1593 (let ((way (if backward -1 1))
1594 (low gnus-level-killed)
1597 (if (and backward (progn (beginning-of-line)) (bobp))
1606 (get-text-property (point) 'gnus-group)
1610 (get-text-property (point) 'gnus-unread)))
1611 (and (numberp unread) (> unread 0)))
1612 (setq lev (get-text-property (point)
1614 (<= lev gnus-level-subscribed)))
1616 (and (setq lev (get-text-property (point)
1625 (zerop (forward-line way)))))
1627 (progn (gnus-group-position-point) t)
1628 (goto-char (or pos beg))
1631 ;;; Gnus group mode commands
1635 (defun gnus-group-mark-line-p ()
1638 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1639 (eq (char-after) gnus-process-mark)))
1641 (defun gnus-group-mark-group (n &optional unmark no-advance)
1642 "Mark the current group."
1644 (let ((buffer-read-only nil)
1648 (when (setq group (gnus-group-group-name))
1649 ;; Go to the mark position.
1651 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1652 (subst-char-in-region
1653 (point) (1+ (point)) (char-after)
1656 (setq gnus-group-marked (delete group gnus-group-marked))
1658 (setq gnus-group-marked
1659 (cons group (delete group gnus-group-marked)))
1660 gnus-process-mark)))
1662 (gnus-group-next-group 1))
1664 (gnus-summary-position-point)
1667 (defun gnus-group-unmark-group (n)
1668 "Remove the mark from the current group."
1670 (gnus-group-mark-group n 'unmark)
1671 (gnus-group-position-point))
1673 (defun gnus-group-unmark-all-groups ()
1674 "Unmark all groups."
1676 (let ((groups gnus-group-marked))
1679 (gnus-group-remove-mark (pop groups)))))
1680 (gnus-group-position-point))
1682 (defun gnus-group-mark-region (unmark beg end)
1683 "Mark all groups between point and mark.
1684 If UNMARK, remove the mark instead."
1685 (interactive "P\nr")
1686 (let ((num (count-lines beg end)))
1689 (- num (gnus-group-mark-group num unmark)))))
1691 (defun gnus-group-mark-buffer (&optional unmark)
1692 "Mark all groups in the buffer.
1693 If UNMARK, remove the mark instead."
1695 (gnus-group-mark-region unmark (point-min) (point-max)))
1697 (defun gnus-group-mark-regexp (regexp)
1698 "Mark all groups that match some regexp."
1699 (interactive "sMark (regexp): ")
1700 (let ((alist (cdr gnus-newsrc-alist))
1703 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1704 (gnus-group-set-mark group))))
1705 (gnus-group-position-point))
1707 (defun gnus-group-remove-mark (group &optional test-marked)
1708 "Remove the process mark from GROUP and move point there.
1709 Return nil if the group isn't displayed."
1710 (if (gnus-group-goto-group group nil test-marked)
1712 (gnus-group-mark-group 1 'unmark t)
1714 (setq gnus-group-marked
1715 (delete group gnus-group-marked))
1718 (defun gnus-group-set-mark (group)
1719 "Set the process mark on GROUP."
1720 (if (gnus-group-goto-group group)
1722 (gnus-group-mark-group 1 nil t))
1723 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1725 (defun gnus-group-universal-argument (arg &optional groups func)
1726 "Perform any command on all groups according to the process/prefix convention."
1728 (if (eq (setq func (or func
1731 (substitute-command-keys
1732 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1734 (gnus-error 1 "Undefined key")
1735 (gnus-group-iterate arg
1737 (command-execute func))))
1738 (gnus-group-position-point))
1740 (defun gnus-group-process-prefix (n)
1741 "Return a list of groups to work on.
1742 Take into consideration N (the prefix) and the list of marked groups."
1745 (setq n (prefix-numeric-value n))
1746 ;; There is a prefix, so we return a list of the N next
1748 (let ((way (if (< n 0) -1 1))
1753 (if (setq group (gnus-group-group-name))
1754 (push group groups))
1756 (gnus-group-next-group way)))
1758 ((gnus-region-active-p)
1759 ;; Work on the region between point and mark.
1760 (let ((max (max (point) (mark)))
1763 (goto-char (min (point) (mark)))
1766 (push (gnus-group-group-name) groups)
1767 (zerop (gnus-group-next-group 1))
1769 (nreverse groups))))
1771 ;; No prefix, but a list of marked articles.
1772 (reverse gnus-group-marked))
1774 ;; Neither marked articles or a prefix, so we return the
1776 (let ((group (gnus-group-group-name)))
1777 (and group (list group))))))
1779 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1780 ;;; imagine why I went through these contortions...
1782 (let ((function (make-symbol "gnus-group-iterate-function"))
1783 (window (make-symbol "gnus-group-iterate-window"))
1784 (groups (make-symbol "gnus-group-iterate-groups"))
1785 (group (make-symbol "gnus-group-iterate-group")))
1787 `(defun gnus-group-iterate (arg ,function)
1788 "Iterate FUNCTION over all process/prefixed groups.
1789 FUNCTION will be called with the group name as the parameter
1790 and with point over the group in question."
1791 (let ((,groups (gnus-group-process-prefix arg))
1792 (,window (selected-window))
1795 (setq ,group (car ,groups)
1796 ,groups (cdr ,groups))
1797 (select-window ,window)
1798 (gnus-group-remove-mark ,group)
1799 (save-selected-window
1801 (funcall ,function ,group)))))))))
1803 (put 'gnus-group-iterate 'lisp-indent-function 1)
1805 ;; Selecting groups.
1807 (defun gnus-group-read-group (&optional all no-article group select-articles)
1808 "Read news in this newsgroup.
1809 If the prefix argument ALL is non-nil, already read articles become
1810 readable. IF ALL is a number, fetch this number of articles. If the
1811 optional argument NO-ARTICLE is non-nil, no article will be
1812 auto-selected upon group entry. If GROUP is non-nil, fetch that
1815 (let ((no-display (eq all 0))
1816 (group (or group (gnus-group-group-name)))
1817 number active marked entry)
1821 (error "No group on current line"))
1822 (setq marked (gnus-info-marks
1823 (nth 2 (setq entry (gnus-gethash
1824 group gnus-newsrc-hashtb)))))
1825 ;; This group might be a dead group. In that case we have to get
1826 ;; the number of unread articles from `gnus-active-hashtb'.
1828 (cond ((numberp all) all)
1830 ((setq active (gnus-active group))
1831 (- (1+ (cdr active)) (car active)))))
1832 (gnus-summary-read-group
1833 group (or all (and (numberp number)
1834 (zerop (+ number (gnus-range-length
1835 (cdr (assq 'tick marked)))
1837 (cdr (assq 'dormant marked)))))))
1838 no-article nil no-display nil select-articles)))
1840 (defun gnus-group-select-group (&optional all)
1841 "Select this newsgroup.
1842 No article is selected automatically.
1843 If the group is opened, just switch the summary buffer.
1844 If ALL is non-nil, already read articles become readable.
1845 If ALL is a number, fetch this number of articles."
1847 (gnus-group-read-group all t))
1849 (defun gnus-group-quick-select-group (&optional all)
1850 "Select the current group \"quickly\".
1851 This means that no highlighting or scoring will be performed.
1852 If ALL (the prefix argument) is 0, don't even generate the summary
1855 This might be useful if you want to toggle threading
1856 before entering the group."
1858 (require 'gnus-score)
1860 gnus-score-find-score-files-function
1861 gnus-home-score-file
1862 gnus-apply-kill-hook
1863 gnus-summary-expunge-below)
1864 (gnus-group-read-group all t)))
1866 (defun gnus-group-visible-select-group (&optional all)
1867 "Select the current group without hiding any articles."
1869 (let ((gnus-inhibit-limiting t))
1870 (gnus-group-read-group all t)))
1872 (defun gnus-group-select-group-ephemerally ()
1873 "Select the current group without doing any processing whatsoever.
1874 You will actually be entered into a group that's a copy of
1875 the current group; no changes you make while in this group will
1878 (require 'gnus-score)
1880 gnus-score-find-score-files-function gnus-apply-kill-hook
1881 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1882 gnus-summary-mode-hook gnus-select-group-hook
1883 (group (gnus-group-group-name))
1884 (method (gnus-find-method-for-group group)))
1885 (gnus-group-read-ephemeral-group
1886 (gnus-group-prefixed-name group method) method)))
1889 (defun gnus-fetch-group (group)
1890 "Start Gnus if necessary and enter GROUP.
1891 Returns whether the fetching was successful or not."
1892 (interactive (list (gnus-group-completing-read-group-name
1893 "Group name: " gnus-active-hashtb)))
1894 (unless (get-buffer gnus-group-buffer)
1896 (gnus-group-read-group nil nil group))
1899 (defun gnus-fetch-group-other-frame (group)
1900 "Pop up a frame and enter GROUP."
1902 (let ((window (get-buffer-window gnus-group-buffer)))
1904 (select-frame (window-frame window)))
1905 ((= (length (frame-list)) 1)
1906 (select-frame (make-frame)))
1909 (gnus-fetch-group group))
1911 (defvar gnus-ephemeral-group-server 0)
1913 ;; Enter a group that is not in the group buffer. Non-nil is returned
1914 ;; if selection was successful.
1915 (defun gnus-group-read-ephemeral-group (group method &optional activate
1916 quit-config request-only
1919 "Read GROUP from METHOD as an ephemeral group.
1920 If ACTIVATE, request the group first.
1921 If QUIT-CONFIG, use that window configuration when exiting from the
1923 If REQUEST-ONLY, don't actually read the group; just request it.
1924 If SELECT-ARTICLES, only select those articles.
1925 If PARAMETERS, use those as the group parameters.
1927 Return the name of the group if selection was successful."
1928 ;; Transform the select method into a unique server.
1929 (when (stringp method)
1930 (setq method (gnus-server-to-method method)))
1932 `(,(car method) ,(concat (cadr method) "-ephemeral")
1933 (,(intern (format "%s-address" (car method))) ,(cadr method))
1935 (let ((group (if (gnus-group-foreign-p group) group
1936 (gnus-group-prefixed-name (gnus-group-real-name group)
1941 ,gnus-level-default-subscribed nil nil ,method
1944 (cons 'quit-config quit-config)
1946 (cons gnus-summary-buffer
1947 gnus-current-window-configuration)))
1950 (push method gnus-ephemeral-servers)
1951 (set-buffer gnus-group-buffer)
1952 (unless (gnus-check-server method)
1953 (error "Unable to contact server: %s" (gnus-status-message method)))
1955 (gnus-activate-group group 'scan)
1956 (unless (gnus-request-group group)
1957 (error "Couldn't request group: %s"
1958 (nnheader-get-report (car method)))))
1962 (when (gnus-group-read-group t t group select-articles)
1966 (message "Quit reading the ephemeral group")
1969 (defun gnus-group-jump-to-group (group)
1970 "Jump to newsgroup GROUP."
1972 (list (gnus-group-completing-read-group-name
1973 "Group: " gnus-active-hashtb nil
1974 (gnus-read-active-file-p)
1975 gnus-group-jump-to-group-prompt
1976 'gnus-group-history)))
1978 (when (equal group "")
1979 (error "Empty group name"))
1981 (unless (gnus-ephemeral-group-p group)
1982 ;; Either go to the line in the group buffer...
1983 (unless (gnus-group-goto-group group)
1984 ;; ... or insert the line.
1985 (gnus-group-update-group group)
1986 (gnus-group-goto-group group)))
1987 ;; Adjust cursor point.
1988 (gnus-group-position-point))
1990 (defun gnus-group-goto-group (group &optional far test-marked)
1991 "Goto to newsgroup GROUP.
1992 If FAR, it is likely that the group is not on the current line.
1993 If TEST-MARKED, the line must be marked."
1997 ;; It's quite likely that we are on the right line, so
1998 ;; we check the current line first.
2000 (eq (get-text-property (point) 'gnus-group)
2001 (gnus-intern-safe group gnus-active-hashtb))
2002 (or (not test-marked) (gnus-group-mark-line-p)))
2004 ;; Previous and next line are also likely, so we check them as well.
2008 (and (eq (get-text-property (point) 'gnus-group)
2009 (gnus-intern-safe group gnus-active-hashtb))
2010 (or (not test-marked) (gnus-group-mark-line-p)))))
2016 (and (eq (get-text-property (point) 'gnus-group)
2017 (gnus-intern-safe group gnus-active-hashtb))
2018 (or (not test-marked) (gnus-group-mark-line-p)))))
2022 (goto-char (point-min))
2024 (while (and (not found)
2029 (gnus-intern-safe group gnus-active-hashtb))))
2030 (if (gnus-group-mark-line-p)
2035 ;; Search through the entire buffer.
2038 (point-min) (point-max)
2039 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))))))
2041 (defun gnus-group-next-group (n &optional silent)
2042 "Go to next N'th newsgroup.
2043 If N is negative, search backward instead.
2044 Returns the difference between N and the number of skips actually
2047 (gnus-group-next-unread-group n t nil silent))
2049 (defun gnus-group-next-unread-group (n &optional all level silent)
2050 "Go to next N'th unread newsgroup.
2051 If N is negative, search backward instead.
2052 If ALL is non-nil, choose any newsgroup, unread or not.
2053 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
2054 such group can be found, the next group with a level higher than
2056 Returns the difference between N and the number of skips actually
2059 (let ((backward (< n 0))
2062 (gnus-group-search-forward
2063 backward (or (not gnus-group-goto-unread) all) level))
2067 (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread")
2068 (if level " on this level or higher" "")))
2071 (defun gnus-group-prev-group (n)
2072 "Go to previous N'th newsgroup.
2073 Returns the difference between N and the number of skips actually
2076 (gnus-group-next-unread-group (- n) t))
2078 (defun gnus-group-prev-unread-group (n)
2079 "Go to previous N'th unread newsgroup.
2080 Returns the difference between N and the number of skips actually
2083 (gnus-group-next-unread-group (- n)))
2085 (defun gnus-group-next-unread-group-same-level (n)
2086 "Go to next N'th unread newsgroup on the same level.
2087 If N is negative, search backward instead.
2088 Returns the difference between N and the number of skips actually
2091 (gnus-group-next-unread-group n t (gnus-group-group-level))
2092 (gnus-group-position-point))
2094 (defun gnus-group-prev-unread-group-same-level (n)
2095 "Go to next N'th unread newsgroup on the same level.
2096 Returns the difference between N and the number of skips actually
2099 (gnus-group-next-unread-group (- n) t (gnus-group-group-level))
2100 (gnus-group-position-point))
2102 (defun gnus-group-best-unread-group (&optional exclude-group)
2103 "Go to the group with the highest level.
2104 If EXCLUDE-GROUP, do not go to that group."
2106 (goto-char (point-min))
2110 (setq unread (get-text-property (point) 'gnus-unread))
2111 (when (and (numberp unread) (> unread 0))
2112 (when (and (get-text-property (point) 'gnus-level)
2113 (< (get-text-property (point) 'gnus-level) best)
2114 (or (not exclude-group)
2115 (not (equal exclude-group (gnus-group-group-name)))))
2116 (setq best (get-text-property (point) 'gnus-level))
2117 (setq best-point (point))))
2120 (goto-char best-point))
2121 (gnus-group-position-point)
2122 (and best-point (gnus-group-group-name))))
2124 (defun gnus-group-first-unread-group ()
2125 "Go to the first group with unread articles."
2128 (let ((opoint (point))
2130 (goto-char (point-min))
2131 (if (or (eq (setq unread (gnus-group-group-unread)) t) ; Not active.
2132 (and (numberp unread) ; Not a topic.
2133 (not (zerop unread))) ; Has unread articles.
2134 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2137 nil)) ; Not success.
2138 (gnus-group-position-point)))
2140 (defun gnus-group-enter-server-mode ()
2141 "Jump to the server buffer."
2143 (gnus-enter-server-buffer))
2145 (defun gnus-group-make-group (name &optional method address args)
2146 "Add a new newsgroup.
2147 The user will be prompted for a NAME, for a select METHOD, and an
2151 (gnus-read-group "Group name: ")
2152 (gnus-read-method "From method: ")))
2154 (when (stringp method)
2155 (setq method (or (gnus-server-to-method method) method)))
2156 (let* ((meth (gnus-method-simplify
2158 (not (gnus-server-equal method gnus-select-method)))
2159 (if address (list (intern method) address)
2161 (nname (if method (gnus-group-prefixed-name name meth) name))
2163 (when (gnus-gethash nname gnus-newsrc-hashtb)
2164 (error "Group %s already exists" nname))
2165 ;; Subscribe to the new group.
2166 (gnus-group-change-level
2167 (setq info (list t nname gnus-level-default-subscribed nil nil meth))
2168 gnus-level-default-subscribed gnus-level-killed
2169 (and (gnus-group-group-name)
2170 (gnus-gethash (gnus-group-group-name)
2171 gnus-newsrc-hashtb))
2174 (gnus-set-active nname (cons 1 0))
2175 (unless (gnus-ephemeral-group-p name)
2177 (concat "(gnus-group-set-info '"
2178 (gnus-prin1-to-string (cdr info)) ")")))
2180 (gnus-group-insert-group-line-info nname)
2182 (gnus-group-position-point)
2184 ;; Load the backend and try to make the backend create
2185 ;; the group as well.
2186 (when (assoc (symbol-name (setq backend (car (gnus-server-get-method
2188 gnus-valid-select-methods)
2190 (gnus-check-server meth)
2191 (when (gnus-check-backend-function 'request-create-group nname)
2192 (gnus-request-create-group nname nil args))
2195 (defun gnus-group-delete-groups (&optional arg)
2196 "Delete the current group. Only meaningful with editable groups."
2198 (let ((n (length (gnus-group-process-prefix arg))))
2199 (when (gnus-yes-or-no-p
2201 "Delete this 1 group? "
2202 (format "Delete these %d groups? " n)))
2203 (gnus-group-iterate arg
2205 (gnus-group-delete-group group nil t))))))
2207 (defun gnus-group-delete-group (group &optional force no-prompt)
2208 "Delete the current group. Only meaningful with editable groups.
2209 If FORCE (the prefix) is non-nil, all the articles in the group will
2210 be deleted. This is \"deleted\" as in \"removed forever from the face
2211 of the Earth\". There is no undo. The user will be prompted before
2212 doing the deletion."
2214 (list (gnus-group-group-name)
2215 current-prefix-arg))
2217 (error "No group to delete"))
2218 (unless (gnus-check-backend-function 'request-delete-group group)
2219 (error "This backend does not support group deletion"))
2221 (if (and (not no-prompt)
2222 (not (gnus-yes-or-no-p
2224 "Do you really want to delete %s%s? "
2225 group (if force " and all its contents" "")))))
2227 (gnus-message 6 "Deleting group %s..." group)
2228 (if (not (gnus-request-delete-group group force))
2229 (gnus-error 3 "Couldn't delete group %s" group)
2230 (gnus-message 6 "Deleting group %s...done" group)
2231 (gnus-group-goto-group group)
2232 (gnus-group-kill-group 1 t)
2233 (gnus-sethash group nil gnus-active-hashtb)
2234 (when gnus-cache-active-hashtb
2235 (gnus-sethash group nil gnus-cache-active-hashtb)
2236 (setq gnus-cache-active-altered t))
2238 (gnus-group-position-point)))
2240 (defun gnus-group-rename-group (group new-name)
2241 "Rename group from GROUP to NEW-NAME.
2242 When used interactively, GROUP is the group under point
2243 and NEW-NAME will be prompted for."
2246 (gnus-group-group-name)
2248 (unless (gnus-check-backend-function
2249 'request-rename-group (gnus-group-group-name))
2250 (error "This backend does not support renaming groups"))
2251 (gnus-read-group "Rename group to: "
2252 (gnus-group-real-name (gnus-group-group-name))))))
2254 (unless (gnus-check-backend-function 'request-rename-group group)
2255 (error "This backend does not support renaming groups"))
2257 (error "No group to rename"))
2258 (when (equal (gnus-group-real-name group) new-name)
2259 (error "Can't rename to the same name"))
2261 ;; We find the proper prefixed name.
2263 (if (gnus-group-native-p group)
2267 (gnus-group-prefixed-name
2268 (gnus-group-real-name new-name)
2269 (gnus-info-method (gnus-get-info group)))))
2271 (gnus-message 6 "Renaming group %s to %s..." group new-name)
2274 (gnus-group-goto-group group)
2275 (not (when (< (gnus-group-group-level) gnus-level-zombie)
2276 (gnus-request-rename-group group new-name))))
2277 (gnus-error 3 "Couldn't rename group %s to %s" group new-name)
2278 ;; We rename the group internally by killing it...
2279 (gnus-group-kill-group)
2280 ;; ... changing its name ...
2281 (setcar (cdar gnus-list-of-killed-groups) new-name)
2282 ;; ... and then yanking it. Magic!
2283 (gnus-group-yank-group)
2284 (gnus-set-active new-name (gnus-active group))
2285 (gnus-message 6 "Renaming group %s to %s...done" group new-name)
2287 (setq gnus-killed-list (delete group gnus-killed-list))
2288 (gnus-set-active group nil)
2289 (gnus-dribble-touch)
2290 (gnus-group-position-point)))
2292 (defun gnus-group-edit-group (group &optional part)
2293 "Edit the group on the current line."
2294 (interactive (list (gnus-group-group-name)))
2295 (let ((part (or part 'info))
2298 (error "No group on current line"))
2299 (unless (setq info (gnus-get-info group))
2300 (error "Killed group; can't be edited"))
2302 (gnus-close-group group))
2304 ;; Find the proper form to edit.
2305 (cond ((eq part 'method)
2306 (or (gnus-info-method info) "native"))
2308 (gnus-info-params info))
2310 ;; The proper documentation.
2312 "Editing the %s for `%s'."
2314 ((eq part 'method) "select method")
2315 ((eq part 'params) "group parameters")
2317 (gnus-group-decoded-name group))
2319 (gnus-group-edit-group-done ',part ,group form)))
2322 (gnus-create-info-command
2325 "(gnus)Select Methods")
2327 "(gnus)Group Parameters")
2329 "(gnus)Group Info"))))))
2331 (defun gnus-group-edit-group-method (group)
2332 "Edit the select method of GROUP."
2333 (interactive (list (gnus-group-group-name)))
2334 (gnus-group-edit-group group 'method))
2336 (defun gnus-group-edit-group-parameters (group)
2337 "Edit the group parameters of GROUP."
2338 (interactive (list (gnus-group-group-name)))
2339 (gnus-group-edit-group group 'params))
2341 (defun gnus-group-edit-group-done (part group form)
2343 (let* ((method (cond ((eq part 'info) (nth 4 form))
2344 ((eq part 'method) form)
2346 (info (cond ((eq part 'info) form)
2347 ((eq part 'method) (gnus-get-info group))
2350 (if (or (not method)
2352 gnus-select-method method))
2353 (gnus-group-real-name (car info))
2354 (gnus-group-prefixed-name
2355 (gnus-group-real-name (car info)) method))
2357 (when (and new-group
2358 (not (equal new-group group)))
2359 (when (gnus-group-goto-group group)
2360 (gnus-group-kill-group 1))
2361 (gnus-activate-group new-group))
2363 (if (not (and info new-group))
2364 (gnus-group-set-info form (or new-group group) part)
2365 (setq info (gnus-copy-sequence info))
2366 (setcar info new-group)
2367 (unless (gnus-server-equal method "native")
2368 (unless (nthcdr 3 info)
2369 (nconc info (list nil nil)))
2370 (unless (nthcdr 4 info)
2371 (nconc info (list nil)))
2372 (gnus-info-set-method info method))
2373 (gnus-group-set-info info))
2374 (gnus-group-update-group (or new-group group))
2375 (gnus-group-position-point)))
2377 (defun gnus-group-make-useful-group (group method)
2378 "Create one of the groups described in `gnus-useful-groups'."
2380 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2382 gnus-useful-groups)))
2383 (list (cadr entry) (caddr entry))))
2384 (setq method (gnus-copy-sequence method))
2386 (while (setq entry (memq (assq 'eval method) method))
2387 (setcar entry (eval (cadar entry)))))
2388 (gnus-group-make-group group method))
2390 (defun gnus-group-make-help-group (&optional noerror)
2391 "Create the Gnus documentation group.
2392 Optional argument NOERROR modifies the behavior of this function when the
2393 group already exists:
2394 - if not given, and error is signaled,
2395 - if t, stay silent,
2396 - if anything else, just print a message."
2398 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2399 (file (nnheader-find-etc-directory "gnus-tut.txt" t)))
2400 (if (gnus-gethash name gnus-newsrc-hashtb)
2401 (cond ((eq noerror nil)
2402 (error "Documentation group already exists"))
2407 (gnus-message 1 "Documentation group already exists")))
2410 (gnus-message 1 "Couldn't find doc group")
2411 (gnus-group-make-group
2412 (gnus-group-real-name name)
2413 (list 'nndoc "gnus-help"
2414 (list 'nndoc-address file)
2415 (list 'nndoc-article-type 'mbox))))
2417 (gnus-group-position-point))
2419 (defun gnus-group-make-doc-group (file type)
2420 "Create a group that uses a single file as the source."
2422 (list (read-file-name "File name: ")
2423 (and current-prefix-arg 'ask)))
2424 (when (eq type 'ask)
2429 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: "
2431 (setq found (cond ((= (setq char (read-char)) ?m) 'mbox)
2432 ((= char ?b) 'babyl)
2433 ((= char ?d) 'digest)
2434 ((= char ?f) 'forward)
2436 ((= char ?g) 'guess)
2437 (t (setq err (format "%c unknown. " char))
2440 (let* ((file (expand-file-name file))
2441 (name (gnus-generate-new-group-name
2442 (gnus-group-prefixed-name
2443 (file-name-nondirectory file) '(nndoc "")))))
2444 (gnus-group-make-group
2445 (gnus-group-real-name name)
2447 (list 'nndoc-address file)
2448 (list 'nndoc-article-type (or type 'guess))))))
2450 (defvar nnweb-type-definition)
2451 (defvar gnus-group-web-type-history nil)
2452 (defvar gnus-group-web-search-history nil)
2453 (defun gnus-group-make-web-group (&optional solid)
2454 "Create an ephemeral nnweb group.
2455 If SOLID (the prefix), create a solid group."
2459 (if solid (gnus-read-group "Group name: ")
2460 (message-unique-id)))
2461 (default-type (or (car gnus-group-web-type-history)
2462 (symbol-name (caar nnweb-type-definition))))
2466 (format "Search engine type (default %s): " default-type)
2467 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2468 nnweb-type-definition)
2469 nil t nil 'gnus-group-web-type-history)
2474 (cons (or (car gnus-group-web-search-history) "") 0)
2475 'gnus-group-web-search-history))
2477 `(nnweb ,group (nnweb-search ,search)
2478 (nnweb-type ,(intern type))
2479 (nnweb-ephemeral-p t))))
2481 (gnus-group-make-group group "nnweb" "" `(,(intern type) ,search))
2482 (gnus-group-read-ephemeral-group
2484 (cons (current-buffer)
2485 (if (eq major-mode 'gnus-summary-mode) 'summary 'group))))))
2487 (defvar nnwarchive-type-definition)
2488 (defvar gnus-group-warchive-type-history nil)
2489 (defvar gnus-group-warchive-login-history nil)
2490 (defvar gnus-group-warchive-address-history nil)
2492 (defun gnus-group-make-warchive-group ()
2493 "Create a nnwarchive group."
2495 (require 'nnwarchive)
2496 (let* ((group (gnus-read-group "Group name: "))
2497 (default-type (or (car gnus-group-warchive-type-history)
2498 (symbol-name (caar nnwarchive-type-definition))))
2502 (format "Warchive type (default %s): " default-type)
2503 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2504 nnwarchive-type-definition)
2505 nil t nil 'gnus-group-warchive-type-history)
2507 (address (read-string "Warchive address: "
2508 nil 'gnus-group-warchive-address-history))
2509 (default-login (or (car gnus-group-warchive-login-history)
2514 (format "Warchive login (default %s): " user-mail-address)
2515 default-login 'gnus-group-warchive-login-history)
2518 `(nnwarchive ,address
2519 (nnwarchive-type ,(intern type))
2520 (nnwarchive-login ,login))))
2521 (gnus-group-make-group group method)))
2523 (defun gnus-group-make-archive-group (&optional all)
2524 "Create the (ding) Gnus archive group of the most recent articles.
2525 Given a prefix, create a full group."
2527 (let ((group (gnus-group-prefixed-name
2528 (if all "ding.archives" "ding.recent") '(nndir ""))))
2529 (when (gnus-gethash group gnus-newsrc-hashtb)
2530 (error "Archive group already exists"))
2531 (gnus-group-make-group
2532 (gnus-group-real-name group)
2533 (list 'nndir (if all "hpc" "edu")
2534 (list 'nndir-directory
2535 (if all gnus-group-archive-directory
2536 gnus-group-recent-archive-directory))))
2537 (gnus-group-add-parameter group (cons 'to-address "ding@gnus.org"))))
2539 (defun gnus-group-make-directory-group (dir)
2540 "Create an nndir group.
2541 The user will be prompted for a directory. The contents of this
2542 directory will be used as a newsgroup. The directory should contain
2543 mail messages or news articles in files that have numeric names."
2545 (list (read-file-name "Create group from directory: ")))
2546 (unless (file-exists-p dir)
2547 (error "No such directory"))
2548 (unless (file-directory-p dir)
2549 (error "Not a directory"))
2553 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb))
2555 (gnus-group-prefixed-name
2556 (expand-file-name ext dir)
2558 (setq ext (format "<%d>" (setq i (1+ i)))))
2559 (gnus-group-make-group
2560 (gnus-group-real-name group)
2561 (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir)))))
2563 (eval-when-compile (defvar nnkiboze-score-file))
2564 (defun gnus-group-make-kiboze-group (group address scores)
2565 "Create an nnkiboze group.
2566 The user will be prompted for a name, a regexp to match groups, and
2567 score file entries for articles to include in the group."
2570 (read-string "nnkiboze group name: ")
2571 (read-string "Source groups (regexp): ")
2572 (let ((headers (mapcar (lambda (group) (list group))
2573 '("subject" "from" "number" "date" "message-id"
2574 "references" "chars" "lines" "xref"
2575 "followup" "all" "body" "head")))
2576 scores header regexp regexps)
2577 (while (not (equal "" (setq header (completing-read
2578 "Match on header: " headers nil t))))
2580 (while (not (equal "" (setq regexp (read-string
2581 (format "Match on %s (regexp): "
2583 (push (list regexp nil nil 'r) regexps))
2584 (push (cons header regexps) scores))
2586 (gnus-group-make-group group "nnkiboze" address)
2587 (let* ((nnkiboze-current-group group)
2588 (score-file (car (nnkiboze-score-file "")))
2589 (score-dir (file-name-directory score-file)))
2590 (unless (file-exists-p score-dir)
2591 (make-directory score-dir))
2592 (with-temp-file score-file
2593 (let (emacs-lisp-mode-hook)
2594 (pp scores (current-buffer))))))
2596 (defun gnus-group-add-to-virtual (n vgroup)
2597 "Add the current group to a virtual group."
2599 (list current-prefix-arg
2600 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2602 (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
2603 (error "%s is not an nnvirtual group" vgroup))
2604 (gnus-close-group vgroup)
2605 (let* ((groups (gnus-group-process-prefix n))
2606 (method (gnus-info-method (gnus-get-info vgroup))))
2607 (setcar (cdr method)
2609 (nth 1 method) "\\|"
2612 (gnus-group-remove-mark s)
2613 (concat "\\(^" (regexp-quote s) "$\\)"))
2615 (gnus-group-position-point))
2617 (defun gnus-group-make-empty-virtual (group)
2618 "Create a new, fresh, empty virtual group."
2619 (interactive "sCreate new, empty virtual group: ")
2620 (let* ((method (list 'nnvirtual "^$"))
2621 (pgroup (gnus-group-prefixed-name group method)))
2622 ;; Check whether it exists already.
2623 (when (gnus-gethash pgroup gnus-newsrc-hashtb)
2624 (error "Group %s already exists" pgroup))
2625 ;; Subscribe the new group after the group on the current line.
2626 (gnus-subscribe-group pgroup (gnus-group-group-name) method)
2627 (gnus-group-update-group pgroup)
2629 (gnus-group-position-point)))
2631 (defun gnus-group-enter-directory (dir)
2632 "Enter an ephemeral nneething group."
2633 (interactive "DDirectory to read: ")
2634 (let* ((method (list 'nneething dir '(nneething-read-only t)))
2635 (leaf (gnus-group-prefixed-name
2636 (file-name-nondirectory (directory-file-name dir))
2638 (name (gnus-generate-new-group-name leaf)))
2639 (unless (gnus-group-read-ephemeral-group
2641 (cons (current-buffer)
2642 (if (eq major-mode 'gnus-summary-mode)
2644 (error "Couldn't enter %s" dir))))
2647 (autoload 'nnimap-expunge "nnimap")
2648 (autoload 'nnimap-acl-get "nnimap")
2649 (autoload 'nnimap-acl-edit "nnimap"))
2651 (defun gnus-group-nnimap-expunge (group)
2652 "Expunge deleted articles in current nnimap GROUP."
2653 (interactive (list (gnus-group-group-name)))
2654 (let ((mailbox (gnus-group-real-name group)) method)
2656 (error "No group on current line"))
2657 (unless (gnus-get-info group)
2658 (error "Killed group; can't be edited"))
2659 (unless (eq 'nnimap (car (setq method (gnus-find-method-for-group group))))
2660 (error "%s is not an nnimap group" group))
2661 (nnimap-expunge mailbox (cadr method))))
2663 (defun gnus-group-nnimap-edit-acl (group)
2664 "Edit the Access Control List of current nnimap GROUP."
2665 (interactive (list (gnus-group-group-name)))
2666 (let ((mailbox (gnus-group-real-name group)) method acl)
2668 (error "No group on current line"))
2669 (unless (gnus-get-info group)
2670 (error "Killed group; can't be edited"))
2671 (unless (eq (car (setq method (gnus-find-method-for-group group))) 'nnimap)
2672 (error "%s is not an nnimap group" group))
2673 (unless (setq acl (nnimap-acl-get mailbox (cadr method)))
2674 (error "Server does not support ACL's"))
2675 (gnus-edit-form acl (format "Editing the access control list for `%s'.
2677 An access control list is a list of (identifier . rights) elements.
2679 The identifier string specifies the corresponding user. The
2680 identifier \"anyone\" is reserved to refer to the universal identity.
2682 Rights is a string listing a (possibly empty) set of alphanumeric
2683 characters, each character listing a set of operations which is being
2684 controlled. Letters are reserved for ``standard'' rights, listed
2685 below. Digits are reserved for implementation or site defined rights.
2687 l - lookup (mailbox is visible to LIST/LSUB commands)
2688 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2689 SEARCH, COPY from mailbox)
2690 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2691 w - write (STORE flags other than \\SEEN and \\DELETED)
2692 i - insert (perform APPEND, COPY into mailbox)
2693 p - post (send mail to submission address for mailbox,
2694 not enforced by IMAP4 itself)
2695 c - create and delete mailbox (CREATE new sub-mailboxes in any
2696 implementation-defined hierarchy, RENAME or DELETE mailbox)
2697 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2698 a - administer (perform SETACL)" group)
2701 ,mailbox ',method ',acl form)))))
2703 ;; Group sorting commands
2704 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2706 (defun gnus-group-sort-groups (func &optional reverse)
2707 "Sort the group buffer according to FUNC.
2708 When used interactively, the sorting function used will be
2709 determined by the `gnus-group-sort-function' variable.
2710 If REVERSE (the prefix), reverse the sorting order."
2711 (interactive (list gnus-group-sort-function current-prefix-arg))
2712 (funcall gnus-group-sort-alist-function
2713 (gnus-make-sort-function func) reverse)
2714 (gnus-group-unmark-all-groups)
2715 (gnus-group-list-groups)
2716 (gnus-dribble-touch))
2718 (defun gnus-group-sort-flat (func reverse)
2719 ;; We peel off the dummy group from the alist.
2721 (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group")
2722 (pop gnus-newsrc-alist))
2724 (setq gnus-newsrc-alist
2725 (sort gnus-newsrc-alist func))
2727 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
2728 ;; Regenerate the hash table.
2729 (gnus-make-hashtable-from-newsrc-alist)))
2731 (defun gnus-group-sort-groups-by-alphabet (&optional reverse)
2732 "Sort the group buffer alphabetically by group name.
2733 If REVERSE, sort in reverse order."
2735 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse))
2737 (defun gnus-group-sort-groups-by-unread (&optional reverse)
2738 "Sort the group buffer by number of unread articles.
2739 If REVERSE, sort in reverse order."
2741 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse))
2743 (defun gnus-group-sort-groups-by-level (&optional reverse)
2744 "Sort the group buffer by group level.
2745 If REVERSE, sort in reverse order."
2747 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse))
2749 (defun gnus-group-sort-groups-by-score (&optional reverse)
2750 "Sort the group buffer by group score.
2751 If REVERSE, sort in reverse order."
2753 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse))
2755 (defun gnus-group-sort-groups-by-rank (&optional reverse)
2756 "Sort the group buffer by group rank.
2757 If REVERSE, sort in reverse order."
2759 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse))
2761 (defun gnus-group-sort-groups-by-method (&optional reverse)
2762 "Sort the group buffer alphabetically by backend name.
2763 If REVERSE, sort in reverse order."
2765 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse))
2767 (defun gnus-group-sort-groups-by-server (&optional reverse)
2768 "Sort the group buffer alphabetically by server name.
2769 If REVERSE, sort in reverse order."
2771 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse))
2773 ;;; Selected group sorting.
2775 (defun gnus-group-sort-selected-groups (n func &optional reverse)
2776 "Sort the process/prefixed groups."
2777 (interactive (list current-prefix-arg gnus-group-sort-function))
2778 (let ((groups (gnus-group-process-prefix n)))
2779 (funcall gnus-group-sort-selected-function
2780 groups (gnus-make-sort-function func) reverse)
2781 (gnus-group-unmark-all-groups)
2782 (gnus-group-list-groups)
2783 (gnus-dribble-touch)))
2785 (defun gnus-group-sort-selected-flat (groups func reverse)
2786 (let (entries infos)
2787 ;; First find all the group entries for these groups.
2789 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb))
2791 ;; Then sort the infos.
2795 (lambda (entry) (car entry))
2796 (setq entries (nreverse entries)))
2799 (setq infos (nreverse infos)))
2800 ;; Go through all the infos and replace the old entries
2801 ;; with the new infos.
2803 (setcar (car entries) (pop infos))
2805 ;; Update the hashtable.
2806 (gnus-make-hashtable-from-newsrc-alist)))
2808 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse)
2809 "Sort the group buffer alphabetically by group name.
2810 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2811 sort in reverse order."
2812 (interactive (gnus-interactive "P\ny"))
2813 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-alphabet reverse))
2815 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse)
2816 "Sort the group buffer by number of unread articles.
2817 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2818 sort in reverse order."
2819 (interactive (gnus-interactive "P\ny"))
2820 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-unread reverse))
2822 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse)
2823 "Sort the group buffer by group level.
2824 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2825 sort in reverse order."
2826 (interactive (gnus-interactive "P\ny"))
2827 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-level reverse))
2829 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse)
2830 "Sort the group buffer by group score.
2831 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2832 sort in reverse order."
2833 (interactive (gnus-interactive "P\ny"))
2834 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-score reverse))
2836 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse)
2837 "Sort the group buffer by group rank.
2838 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2839 sort in reverse order."
2840 (interactive (gnus-interactive "P\ny"))
2841 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-rank reverse))
2843 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse)
2844 "Sort the group buffer alphabetically by backend name.
2845 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2846 sort in reverse order."
2847 (interactive (gnus-interactive "P\ny"))
2848 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-method reverse))
2850 ;;; Sorting predicates.
2852 (defun gnus-group-sort-by-alphabet (info1 info2)
2853 "Sort alphabetically."
2854 (string< (gnus-info-group info1) (gnus-info-group info2)))
2856 (defun gnus-group-sort-by-real-name (info1 info2)
2857 "Sort alphabetically on real (unprefixed) names."
2858 (string< (gnus-group-real-name (gnus-info-group info1))
2859 (gnus-group-real-name (gnus-info-group info2))))
2861 (defun gnus-group-sort-by-unread (info1 info2)
2862 "Sort by number of unread articles."
2863 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb)))
2864 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb))))
2865 (< (or (and (numberp n1) n1) 0)
2866 (or (and (numberp n2) n2) 0))))
2868 (defun gnus-group-sort-by-level (info1 info2)
2870 (< (gnus-info-level info1) (gnus-info-level info2)))
2872 (defun gnus-group-sort-by-method (info1 info2)
2873 "Sort alphabetically by backend name."
2874 (string< (symbol-name (car (gnus-find-method-for-group
2875 (gnus-info-group info1) info1)))
2876 (symbol-name (car (gnus-find-method-for-group
2877 (gnus-info-group info2) info2)))))
2879 (defun gnus-group-sort-by-server (info1 info2)
2880 "Sort alphabetically by server name."
2881 (string< (gnus-method-to-full-server-name
2882 (gnus-find-method-for-group
2883 (gnus-info-group info1) info1))
2884 (gnus-method-to-full-server-name
2885 (gnus-find-method-for-group
2886 (gnus-info-group info2) info2))))
2888 (defun gnus-group-sort-by-score (info1 info2)
2889 "Sort by group score."
2890 (> (gnus-info-score info1) (gnus-info-score info2)))
2892 (defun gnus-group-sort-by-rank (info1 info2)
2893 "Sort by level and score."
2894 (let ((level1 (gnus-info-level info1))
2895 (level2 (gnus-info-level info2)))
2896 (or (< level1 level2)
2897 (and (= level1 level2)
2898 (> (gnus-info-score info1) (gnus-info-score info2))))))
2902 (defun gnus-group-clear-data (&optional arg)
2903 "Clear all marks and read ranges from the current group."
2905 (gnus-group-iterate arg
2908 (gnus-info-clear-data (setq info (gnus-get-info group)))
2909 (gnus-get-unread-articles-in-group info (gnus-active group) t)
2910 (when (gnus-group-goto-group group)
2911 (gnus-group-update-group-line))))))
2913 (defun gnus-group-clear-data-on-native-groups ()
2914 "Clear all marks and read ranges from all native groups."
2916 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
2917 (let ((alist (cdr gnus-newsrc-alist))
2919 (while (setq info (pop alist))
2920 (when (gnus-group-native-p (gnus-info-group info))
2921 (gnus-info-clear-data info)))
2922 (gnus-get-unread-articles)
2923 (gnus-dribble-touch)
2924 (when (gnus-y-or-n-p
2925 "Move the cache away to avoid problems in the future? ")
2926 (call-interactively 'gnus-cache-move-cache)))))
2928 (defun gnus-info-clear-data (info)
2929 "Clear all marks and read ranges from INFO."
2930 (let ((group (gnus-info-group info))
2932 (dolist (el (gnus-info-marks info))
2933 (push `(,(cdr el) add (,(car el))) action))
2934 (push `(,(gnus-info-read info) add (read)) action)
2937 (gnus-request-set-mark ,group ',action)
2938 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
2939 (gnus-info-set-read ',info ',(gnus-info-read info))
2940 (when (gnus-group-goto-group ,group)
2941 (gnus-get-unread-articles-in-group ',info ',(gnus-active group) t)
2942 (gnus-group-update-group-line))))
2943 (setq action (mapcar (lambda (el) (list (nth 0 el) 'del (nth 2 el)))
2945 (gnus-request-set-mark group action)
2946 (gnus-info-set-read info nil)
2947 (when (gnus-info-marks info)
2948 (gnus-info-set-marks info nil))))
2950 ;; Group catching up.
2952 (defun gnus-group-catchup-current (&optional n all)
2953 "Mark all unread articles in the current newsgroup as read.
2954 If prefix argument N is numeric, the next N newsgroups will be
2955 caught up. If ALL is non-nil, marked articles will also be marked as
2956 read. Cross references (Xref: header) of articles are ignored.
2957 The number of newsgroups that this function was unable to catch
2960 (let ((groups (gnus-group-process-prefix n))
2963 (unless groups (error "No groups selected"))
2965 (or (not gnus-interactive-catchup) ;Without confirmation?
2970 "Do you really want to mark all articles in %s as read? "
2971 "Mark all unread articles in %s as read? ")
2972 (if (= (length groups) 1)
2974 (format "these %d groups" (length groups)))))))
2976 (while (setq group (pop groups))
2977 (gnus-group-remove-mark group)
2978 ;; Virtual groups have to be given special treatment.
2979 (let ((method (gnus-find-method-for-group group)))
2980 (when (eq 'nnvirtual (car method))
2981 (nnvirtual-catchup-group
2982 (gnus-group-real-name group) (nth 1 method) all)))
2983 (if (>= (gnus-group-level group) gnus-level-zombie)
2984 (gnus-message 2 "Dead groups can't be caught up")
2986 (gnus-group-goto-group group)
2987 (gnus-group-catchup group all))
2988 (gnus-group-update-group-line)
2989 (setq ret (1+ ret)))))
2990 (gnus-group-next-unread-group 1)
2993 (defun gnus-group-catchup-current-all (&optional n)
2994 "Mark all articles in current newsgroup as read.
2995 Cross references (Xref: header) of articles are ignored."
2997 (gnus-group-catchup-current n 'all))
2999 (defun gnus-group-catchup (group &optional all)
3000 "Mark all articles in GROUP as read.
3001 If ALL is non-nil, all articles are marked as read.
3002 The return value is the number of articles that were marked as read,
3003 or nil if no action could be taken."
3004 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
3006 (marks (nth 3 (nth 2 entry)))
3007 (unread (gnus-list-of-unread-articles group)))
3008 ;; Remove entries for this group.
3009 (nnmail-purge-split-history (gnus-group-real-name group))
3010 ;; Do the updating only if the newsgroup isn't killed.
3011 (if (not (numberp (car entry)))
3012 (gnus-message 1 "Can't catch up %s; non-active group" group)
3013 (gnus-update-read-articles group nil)
3015 ;; Nix out the lists of marks and dormants.
3016 (gnus-request-set-mark group (list (list (cdr (assq 'tick marks))
3018 (list (cdr (assq 'dormant marks))
3020 (setq unread (gnus-uncompress-range
3021 (gnus-range-add (gnus-range-add
3022 unread (cdr (assq 'dormant marks)))
3023 (cdr (assq 'tick marks)))))
3024 (gnus-add-marked-articles group 'tick nil nil 'force)
3025 (gnus-add-marked-articles group 'dormant nil nil 'force))
3026 ;; Do auto-expirable marks if that's required.
3027 (when (gnus-group-auto-expirable-p group)
3028 (gnus-add-marked-articles group 'expire unread)
3029 (gnus-request-set-mark group (list (list unread 'add '(expire)))))
3030 (let ((gnus-newsgroup-name group))
3031 (gnus-run-hooks 'gnus-group-catchup-group-hook))
3034 (defun gnus-group-expire-articles (&optional n)
3035 "Expire all expirable articles in the current newsgroup."
3037 (let ((groups (gnus-group-process-prefix n))
3040 (error "No groups to expire"))
3041 (while (setq group (pop groups))
3042 (gnus-group-remove-mark group)
3043 (gnus-group-expire-articles-1 group)
3044 (gnus-dribble-touch)
3045 (gnus-group-position-point))))
3047 (defun gnus-group-expire-articles-1 (group)
3048 (when (gnus-check-backend-function 'request-expire-articles group)
3049 (gnus-message 6 "Expiring articles in %s..." group)
3050 (let* ((info (gnus-get-info group))
3051 (expirable (if (gnus-group-total-expirable-p group)
3052 (cons nil (gnus-list-of-read-articles group))
3053 (assq 'expire (gnus-info-marks info))))
3054 (expiry-wait (gnus-group-find-parameter group 'expiry-wait))
3055 (nnmail-expiry-target
3056 (or (gnus-group-find-parameter group 'expiry-target)
3057 nnmail-expiry-target)))
3059 (gnus-check-group group)
3062 (gnus-compress-sequence
3064 ;; We set the expiry variables to the group
3066 (let ((nnmail-expiry-wait-function nil)
3067 (nnmail-expiry-wait expiry-wait))
3068 (gnus-request-expire-articles
3069 (gnus-uncompress-sequence (cdr expirable)) group))
3070 ;; Just expire using the normal expiry values.
3071 (gnus-request-expire-articles
3072 (gnus-uncompress-sequence (cdr expirable)) group))))
3073 (gnus-close-group group))
3074 (gnus-message 6 "Expiring articles in %s...done" group)
3075 ;; Return the list of un-expired articles.
3078 (defun gnus-group-expire-all-groups ()
3079 "Expire all expirable articles in all newsgroups."
3082 (gnus-message 5 "Expiring...")
3083 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info))
3084 (cdr gnus-newsrc-alist))))
3085 (gnus-group-expire-articles nil)))
3086 (gnus-group-position-point)
3087 (gnus-message 5 "Expiring...done"))
3089 (defun gnus-group-set-current-level (n level)
3090 "Set the level of the next N groups to LEVEL."
3095 (let ((s (read-string
3096 (format "Level (default %s): "
3097 (or (gnus-group-group-level)
3098 gnus-level-default-subscribed)))))
3099 (if (string-match "^\\s-*$" s)
3100 (int-to-string (or (gnus-group-group-level)
3101 gnus-level-default-subscribed))
3103 (unless (and (>= level 1) (<= level gnus-level-killed))
3104 (error "Invalid level: %d" level))
3105 (let ((groups (gnus-group-process-prefix n))
3107 (while (setq group (pop groups))
3108 (gnus-group-remove-mark group)
3109 (gnus-message 6 "Changed level of %s from %d to %d"
3110 group (or (gnus-group-group-level) gnus-level-killed)
3112 (gnus-group-change-level
3113 group level (or (gnus-group-group-level) gnus-level-killed))
3114 (gnus-group-update-group-line)))
3115 (gnus-group-position-point))
3117 (defun gnus-group-unsubscribe (&optional n)
3118 "Unsubscribe the current group."
3120 (gnus-group-unsubscribe-current-group n 'unsubscribe))
3122 (defun gnus-group-subscribe (&optional n)
3123 "Subscribe the current group."
3125 (gnus-group-unsubscribe-current-group n 'subscribe))
3127 (defun gnus-group-unsubscribe-current-group (&optional n do-sub)
3128 "Toggle subscription of the current group.
3129 If given numerical prefix, toggle the N next groups."
3131 (let ((groups (gnus-group-process-prefix n))
3134 (setq group (car groups)
3135 groups (cdr groups))
3136 (gnus-group-remove-mark group)
3137 (gnus-group-unsubscribe-group
3140 ((eq do-sub 'unsubscribe)
3141 gnus-level-default-unsubscribed)
3142 ((eq do-sub 'subscribe)
3143 gnus-level-default-subscribed)
3144 ((<= (gnus-group-group-level) gnus-level-subscribed)
3145 gnus-level-default-unsubscribed)
3147 gnus-level-default-subscribed))
3149 (gnus-group-update-group-line))
3150 (gnus-group-next-group 1)))
3152 (defun gnus-group-unsubscribe-group (group &optional level silent)
3153 "Toggle subscription to GROUP.
3154 Killed newsgroups are subscribed. If SILENT, don't try to update the
3157 (list (gnus-group-completing-read-group-name
3158 "Group: " gnus-active-hashtb nil
3159 (gnus-read-active-file-p)
3161 'gnus-group-history)))
3162 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
3164 ((string-match "^[ \t]*$" group)
3165 (error "Empty group name"))
3167 ;; Toggle subscription flag.
3168 (gnus-group-change-level
3169 newsrc (if level level (if (<= (gnus-info-level (nth 2 newsrc))
3170 gnus-level-subscribed)
3171 (1+ gnus-level-subscribed)
3172 gnus-level-default-subscribed)))
3174 (gnus-group-update-group group)))
3175 ((and (stringp group)
3176 (or (not (gnus-read-active-file-p))
3177 (gnus-active group)))
3178 ;; Add new newsgroup.
3179 (gnus-group-change-level
3181 (if level level gnus-level-default-subscribed)
3182 (or (and (member group gnus-zombie-list)
3185 (when (gnus-group-group-name)
3186 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb)))
3188 (gnus-group-update-group group)))
3189 (t (error "No such newsgroup: %s" group)))
3190 (gnus-group-position-point)))
3192 (defun gnus-group-transpose-groups (n)
3193 "Move the current newsgroup up N places.
3194 If given a negative prefix, move down instead. The difference between
3195 N and the number of steps taken is returned."
3197 (unless (gnus-group-group-name)
3198 (error "No group on current line"))
3199 (gnus-group-kill-group 1)
3201 (forward-line (- n))
3202 (gnus-group-yank-group)
3203 (gnus-group-position-point)))
3205 (defun gnus-group-kill-all-zombies (&optional dummy)
3206 "Kill all zombie newsgroups.
3207 The optional DUMMY should always be nil."
3208 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3210 (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list))
3211 (setq gnus-zombie-list nil)
3212 (gnus-dribble-touch)
3213 (gnus-group-list-groups)))
3215 (defun gnus-group-kill-region (begin end)
3216 "Kill newsgroups in current region (excluding current point).
3217 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3232 (beginning-of-line) ;Important when LINES < 1
3233 (gnus-group-kill-group lines)))
3235 (defun gnus-group-kill-group (&optional n discard)
3236 "Kill the next N groups.
3237 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3238 However, only groups that were alive can be yanked; already killed
3239 groups or zombie groups can't be yanked.
3240 The return value is the name of the group that was killed, or a list
3243 (let ((buffer-read-only nil)
3244 (groups (gnus-group-process-prefix n))
3245 group entry level out)
3246 (if (< (length groups) 10)
3247 ;; This is faster when there are few groups.
3249 (push (setq group (pop groups)) out)
3250 (gnus-group-remove-mark group)
3251 (setq level (gnus-group-group-level))
3253 (when (and (not discard)
3254 (setq entry (gnus-gethash group gnus-newsrc-hashtb)))
3257 (gnus-group-goto-group ,(gnus-group-group-name))
3258 (gnus-group-yank-group)))
3259 (push (cons (car entry) (nth 2 entry))
3260 gnus-list-of-killed-groups))
3261 (gnus-group-change-level
3262 (if entry entry group) gnus-level-killed (if entry nil level))
3263 (message "Killed group %s" group))
3264 ;; If there are lots and lots of groups to be killed, we use
3265 ;; this thing instead.
3267 (setq groups (nreverse groups))
3269 (gnus-group-remove-mark (setq group (pop groups)))
3271 (push group gnus-killed-list)
3272 (setq gnus-newsrc-alist
3273 (delq (assoc group gnus-newsrc-alist)
3275 (when gnus-group-change-level-function
3276 (funcall gnus-group-change-level-function
3277 group gnus-level-killed 3))
3279 ((setq entry (gnus-gethash group gnus-newsrc-hashtb))
3280 (push (cons (car entry) (nth 2 entry))
3281 gnus-list-of-killed-groups)
3282 (setcdr (cdr entry) (cdddr entry)))
3283 ((member group gnus-zombie-list)
3284 (setq gnus-zombie-list (delete group gnus-zombie-list))))
3285 ;; There may be more than one instance displayed.
3286 (while (gnus-group-goto-group group)
3287 (gnus-delete-line)))
3288 (gnus-make-hashtable-from-newsrc-alist)))
3290 (gnus-group-position-point)
3291 (if (< (length out) 2) (car out) (nreverse out))))
3293 (defun gnus-group-yank-group (&optional arg)
3294 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3295 The numeric ARG specifies how many newsgroups are to be yanked. The
3296 name of the newsgroup yanked is returned, or (if several groups are
3297 yanked) a list of yanked groups is returned."
3299 (setq arg (or arg 1))
3300 (let (info group prev out)
3301 (while (>= (decf arg) 0)
3302 (when (not (setq info (pop gnus-list-of-killed-groups)))
3303 (error "No more newsgroups to yank"))
3304 (push (setq group (nth 1 info)) out)
3305 ;; Find which newsgroup to insert this one before - search
3306 ;; backward until something suitable is found. If there are no
3307 ;; other newsgroups in this buffer, just make this newsgroup the
3309 (setq prev (gnus-group-group-name))
3310 (gnus-group-change-level
3311 info (gnus-info-level (cdr info)) gnus-level-killed
3312 (and prev (gnus-gethash prev gnus-newsrc-hashtb))
3314 (gnus-group-insert-group-line-info group)
3316 `(when (gnus-group-goto-group ,group)
3317 (gnus-group-kill-group 1))))
3319 (gnus-group-position-point)
3320 (if (< (length out) 2) (car out) (nreverse out))))
3322 (defun gnus-group-kill-level (level)
3323 "Kill all groups that is on a certain LEVEL."
3324 (interactive "nKill all groups on level: ")
3326 ((= level gnus-level-zombie)
3327 (setq gnus-killed-list
3328 (nconc gnus-zombie-list gnus-killed-list))
3329 (setq gnus-zombie-list nil))
3330 ((and (< level gnus-level-zombie)
3332 (or gnus-expert-user
3335 "Do you really want to kill all groups on level %d? "
3337 (let* ((prev gnus-newsrc-alist)
3340 (if (= (gnus-info-level (car alist)) level)
3342 (push (gnus-info-group (car alist)) gnus-killed-list)
3343 (setcdr prev (cdr alist)))
3345 (setq alist (cdr alist)))
3346 (gnus-make-hashtable-from-newsrc-alist)
3347 (gnus-group-list-groups)))
3349 (error "Can't kill; invalid level: %d" level))))
3351 (defun gnus-group-list-all-groups (&optional arg)
3352 "List all newsgroups with level ARG or lower.
3353 Default is gnus-level-unsubscribed, which lists all subscribed and most
3354 unsubscribed groups."
3356 (gnus-group-list-groups (or arg gnus-level-unsubscribed) t))
3358 ;; Redefine this to list ALL killed groups if prefix arg used.
3359 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3360 (defun gnus-group-list-killed (&optional arg)
3361 "List all killed newsgroups in the group buffer.
3362 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3363 entail asking the server for the groups."
3365 ;; Find all possible killed newsgroups if arg.
3367 (gnus-get-killed-groups))
3368 (if (not gnus-killed-list)
3369 (gnus-message 6 "No killed groups")
3370 (let (gnus-group-list-mode)
3371 (funcall gnus-group-prepare-function
3372 gnus-level-killed t gnus-level-killed))
3373 (goto-char (point-min)))
3374 (gnus-group-position-point))
3376 (defun gnus-group-list-zombies ()
3377 "List all zombie newsgroups in the group buffer."
3379 (if (not gnus-zombie-list)
3380 (gnus-message 6 "No zombie groups")
3381 (let (gnus-group-list-mode)
3382 (funcall gnus-group-prepare-function
3383 gnus-level-zombie t gnus-level-zombie))
3384 (goto-char (point-min)))
3385 (gnus-group-position-point))
3387 (defun gnus-group-list-active ()
3388 "List all groups that are available from the server(s)."
3390 ;; First we make sure that we have really read the active file.
3391 (unless (gnus-read-active-file-p)
3392 (let ((gnus-read-active-file t)
3393 (gnus-agent nil)) ; Trick the agent into ignoring the active file.
3394 (gnus-read-active-file)))
3395 ;; Find all groups and sort them.
3403 (push (symbol-name sym) list)))
3407 (buffer-read-only nil)
3411 (setq group (pop groups))
3412 (gnus-add-text-properties
3413 (point) (prog1 (1+ (point))
3415 (gnus-group-decoded-name group)
3417 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
3419 'gnus-level (inline (gnus-group-level group)))))
3420 (goto-char (point-min))))
3422 (defun gnus-activate-all-groups (level)
3423 "Activate absolutely all groups."
3424 (interactive (list gnus-level-unsubscribed))
3425 (let ((gnus-activate-level level)
3426 (gnus-activate-foreign-newsgroups level))
3427 (gnus-group-get-new-news)))
3429 (defun gnus-group-get-new-news (&optional arg)
3430 "Get newly arrived articles.
3431 If ARG is a number, it specifies which levels you are interested in
3432 re-scanning. If ARG is non-nil and not a number, this will force
3433 \"hard\" re-reading of the active files from all servers."
3436 (let ((gnus-inhibit-demon t)
3437 ;; Binding this variable will inhibit multiple fetchings
3438 ;; of the same mail source.
3439 (nnmail-fetched-sources (list t)))
3440 (gnus-run-hooks 'gnus-get-new-news-hook)
3442 ;; Read any slave files.
3444 (gnus-master-read-slave-newsrc))
3446 ;; We might read in new NoCeM messages here.
3447 (when (and gnus-use-nocem
3449 (gnus-nocem-scan-groups))
3450 ;; If ARG is not a number, then we read the active file.
3451 (when (and arg (not (numberp arg)))
3452 (let ((gnus-read-active-file t))
3453 (gnus-read-active-file))
3456 ;; If the user wants it, we scan for new groups.
3457 (when (eq gnus-check-new-newsgroups 'always)
3458 (gnus-find-new-newsgroups)))
3460 (setq arg (gnus-group-default-level arg t))
3461 (if (and gnus-read-active-file (not arg))
3463 (gnus-read-active-file)
3464 (gnus-get-unread-articles arg))
3465 (let ((gnus-read-active-file (if arg nil gnus-read-active-file)))
3466 (gnus-get-unread-articles arg)))
3467 (gnus-run-hooks 'gnus-after-getting-new-news-hook)
3468 (gnus-group-list-groups (and (numberp arg)
3469 (max (car gnus-group-list-mode) arg))))
3471 (when (and gnus-agent (not (interactive-p)))
3472 (gnus-agent-toggle-plugged gnus-plugged)))
3474 (defun gnus-group-get-new-news-this-group (&optional n dont-scan)
3475 "Check for newly arrived news in the current group (and the N-1 next groups).
3476 The difference between N and the number of newsgroup checked is returned.
3477 If N is negative, this group and the N-1 previous groups will be checked."
3479 (let* ((groups (gnus-group-process-prefix n))
3480 (ret (if (numberp n) (- n (length groups)) 0))
3484 (gnus-inhibit-demon t)
3485 ;; Binding this variable will inhibit multiple fetchings
3486 ;; of the same mail source.
3487 (nnmail-fetched-sources (list t)))
3488 (gnus-run-hooks 'gnus-get-new-news-hook)
3489 (while (setq group (pop groups))
3490 (gnus-group-remove-mark group)
3491 ;; Bypass any previous denials from the server.
3492 (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
3493 (if (gnus-activate-group group (if dont-scan nil 'scan))
3495 (gnus-get-unread-articles-in-group
3496 (gnus-get-info group) (gnus-active group) t)
3497 (unless (gnus-virtual-group-p group)
3498 (gnus-close-group group))
3500 (gnus-agent-save-group-info
3501 method (gnus-group-real-name group) (gnus-active group)))
3502 (gnus-group-update-group group))
3503 (if (eq (gnus-server-status (gnus-find-method-for-group group))
3505 (gnus-error 3 "Server denied access")
3506 (gnus-error 3 "%s error: %s" group (gnus-status-message group)))))
3509 (when gnus-goto-next-group-when-activating
3510 (gnus-group-next-unread-group 1 t))
3511 (gnus-summary-position-point)
3514 (defun gnus-group-fetch-faq (group &optional faq-dir)
3515 "Fetch the FAQ for the current group.
3516 If given a prefix argument, prompt for the FAQ dir
3520 (gnus-group-group-name)
3521 (when current-prefix-arg
3523 "Faq dir: " (and (listp gnus-group-faq-directory)
3525 gnus-group-faq-directory))))))
3527 (error "No group name given"))
3528 (let ((dirs (or faq-dir gnus-group-faq-directory))
3530 (unless (listp dirs)
3531 (setq dirs (list dirs)))
3532 (while (and (not found)
3533 (setq dir (pop dirs)))
3534 (let ((name (gnus-group-real-name group)))
3535 (setq file (expand-file-name name dir)))
3536 (if (not (file-exists-p file))
3537 (gnus-message 1 "No such file: %s" file)
3538 (let ((enable-local-variables nil))
3542 (defun gnus-group-describe-group (force &optional group)
3543 "Display a description of the current newsgroup."
3544 (interactive (list current-prefix-arg (gnus-group-group-name)))
3545 (let* ((method (gnus-find-method-for-group group))
3546 (mname (gnus-group-prefixed-name "" method))
3549 gnus-description-hashtb)
3550 (gnus-sethash mname nil gnus-description-hashtb))
3552 (error "No group name given"))
3553 (when (or (and gnus-description-hashtb
3554 ;; We check whether this group's method has been
3555 ;; queried for a description file.
3556 (gnus-gethash mname gnus-description-hashtb))
3557 (setq desc (gnus-group-get-description group))
3558 (gnus-read-descriptions-file method))
3560 (or desc (gnus-gethash group gnus-description-hashtb)
3561 "No description available")))))
3563 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3564 (defun gnus-group-describe-all-groups (&optional force)
3565 "Pop up a buffer with descriptions of all newsgroups."
3568 (setq gnus-description-hashtb nil))
3569 (when (not (or gnus-description-hashtb
3570 (gnus-read-all-descriptions-files)))
3571 (error "Couldn't request descriptions file"))
3572 (let ((buffer-read-only nil)
3578 (let ((charset (gnus-group-name-charset nil (symbol-name group))))
3579 (insert (format " *: %-20s %s\n"
3580 (gnus-group-name-decode
3581 (symbol-name group) charset)
3582 (gnus-group-name-decode
3583 (symbol-value group) charset))))
3584 (gnus-add-text-properties
3585 b (1+ b) (list 'gnus-group group
3586 'gnus-unread t 'gnus-marked nil
3587 'gnus-level (1+ gnus-level-subscribed))))
3588 gnus-description-hashtb)
3589 (goto-char (point-min))
3590 (gnus-group-position-point)))
3592 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3593 (defun gnus-group-apropos (regexp &optional search-description)
3594 "List all newsgroups that have names that match a regexp."
3595 (interactive "sGnus apropos (regexp): ")
3597 (obuf (current-buffer))
3599 ;; Go through all newsgroups that are known to Gnus.
3602 (and (symbol-name group)
3603 (string-match regexp (symbol-name group))
3604 (symbol-value group)
3605 (push (symbol-name group) groups)))
3607 ;; Also go through all descriptions that are known to Gnus.
3608 (when search-description
3611 (and (string-match regexp (symbol-value group))
3612 (push (symbol-name group) groups)))
3613 gnus-description-hashtb))
3615 (gnus-message 3 "No groups matched \"%s\"." regexp)
3616 ;; Print out all the groups.
3618 (pop-to-buffer "*Gnus Help*")
3619 (buffer-disable-undo)
3621 (setq groups (sort groups 'string<))
3623 ;; Groups may be entered twice into the list of groups.
3624 (when (not (string= (car groups) prev))
3625 (setq prev (car groups))
3626 (let ((charset (gnus-group-name-charset nil prev)))
3627 (insert (gnus-group-name-decode prev charset) "\n")
3628 (when (and gnus-description-hashtb
3629 (setq des (gnus-gethash (car groups)
3630 gnus-description-hashtb)))
3631 (insert " " (gnus-group-name-decode des charset) "\n"))))
3632 (setq groups (cdr groups)))
3633 (goto-char (point-min))))
3634 (pop-to-buffer obuf)))
3636 (defun gnus-group-description-apropos (regexp)
3637 "List all newsgroups that have names or descriptions that match a regexp."
3638 (interactive "sGnus description apropos (regexp): ")
3639 (when (not (or gnus-description-hashtb
3640 (gnus-read-all-descriptions-files)))
3641 (error "Couldn't request descriptions file"))
3642 (gnus-group-apropos regexp t))
3644 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3645 (defun gnus-group-list-matching (level regexp &optional all lowest)
3646 "List all groups with unread articles that match REGEXP.
3647 If the prefix LEVEL is non-nil, it should be a number that says which
3648 level to cut off listing groups.
3649 If ALL, also list groups with no unread articles.
3650 If LOWEST, don't list groups with level lower than LOWEST.
3652 This command may read the active file."
3653 (interactive "P\nsList newsgroups matching: ")
3654 ;; First make sure active file has been read.
3656 (> (prefix-numeric-value level) gnus-level-killed))
3657 (gnus-get-killed-groups))
3658 (funcall gnus-group-prepare-function
3659 (or level gnus-level-subscribed) (and all t) (or lowest 1) regexp)
3660 (goto-char (point-min))
3661 (gnus-group-position-point))
3663 (defun gnus-group-list-all-matching (level regexp &optional lowest)
3664 "List all groups that match REGEXP.
3665 If the prefix LEVEL is non-nil, it should be a number that says which
3666 level to cut off listing groups.
3667 If LOWEST, don't list groups with level lower than LOWEST."
3668 (interactive "P\nsList newsgroups matching: ")
3670 (setq level (prefix-numeric-value level)))
3671 (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest))
3673 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3674 (defun gnus-group-save-newsrc (&optional force)
3675 "Save the Gnus startup files.
3676 If FORCE, force saving whether it is necessary or not."
3678 (gnus-save-newsrc-file force))
3680 (defun gnus-group-restart (&optional arg)
3681 "Force Gnus to read the .newsrc file."
3683 (when (gnus-yes-or-no-p
3684 (format "Are you sure you want to restart Gnus? "))
3685 (gnus-save-newsrc-file)
3689 (defun gnus-group-read-init-file ()
3690 "Read the Gnus elisp init file."
3692 (gnus-read-init-file)
3693 (gnus-message 5 "Read %s" gnus-init-file))
3695 (defun gnus-group-check-bogus-groups (&optional silent)
3696 "Check bogus newsgroups.
3697 If given a prefix, don't ask for confirmation before removing a bogus
3700 (gnus-check-bogus-newsgroups (and (not silent) (not gnus-expert-user)))
3701 (gnus-group-list-groups))
3703 (defun gnus-group-find-new-groups (&optional arg)
3704 "Search for new groups and add them.
3705 Each new group will be treated with `gnus-subscribe-newsgroup-method'.
3706 With 1 C-u, use the `ask-server' method to query the server for new
3708 With 2 C-u's, use most complete method possible to query the server
3709 for new groups, and subscribe the new groups as zombies."
3711 (gnus-find-new-newsgroups (or arg 1))
3712 (gnus-group-list-groups))
3714 (defun gnus-group-edit-global-kill (&optional article group)
3715 "Edit the global kill file.
3716 If GROUP, edit that local kill file instead."
3718 (setq gnus-current-kill-article article)
3719 (gnus-kill-file-edit-file group)
3722 (substitute-command-keys
3723 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3724 (if group "local" "global")))))
3726 (defun gnus-group-edit-local-kill (article group)
3727 "Edit a local kill file."
3728 (interactive (list nil (gnus-group-group-name)))
3729 (gnus-group-edit-global-kill article group))
3731 (defun gnus-group-force-update ()
3732 "Update `.newsrc' file."
3734 (gnus-save-newsrc-file))
3736 (defun gnus-group-suspend ()
3737 "Suspend the current Gnus session.
3738 In fact, cleanup buffers except for group mode buffer.
3739 The hook gnus-suspend-gnus-hook is called before actually suspending."
3741 (gnus-run-hooks 'gnus-suspend-gnus-hook)
3742 (gnus-offer-save-summaries)
3743 ;; Kill Gnus buffers except for group mode buffer.
3744 (let ((group-buf (get-buffer gnus-group-buffer)))
3745 (mapcar (lambda (buf)
3746 (unless (or (member buf (list group-buf gnus-dribble-buffer))
3750 (eq major-mode 'message-mode))))
3751 (gnus-kill-buffer buf)))
3753 (gnus-kill-gnus-frames)
3755 (bury-buffer group-buf)
3756 (delete-windows-on group-buf t))))
3758 (defun gnus-group-clear-dribble ()
3759 "Clear all information from the dribble buffer."
3761 (gnus-dribble-clear)
3762 (gnus-message 7 "Cleared dribble buffer"))
3764 (defun gnus-group-exit ()
3765 "Quit reading news after updating .newsrc.eld and .newsrc.
3766 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3769 (or noninteractive ;For gnus-batch-kill
3770 (not gnus-interactive-exit) ;Without confirmation
3772 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3773 (gnus-run-hooks 'gnus-exit-gnus-hook)
3774 ;; Offer to save data from non-quitted summary buffers.
3775 (gnus-offer-save-summaries)
3776 ;; Save the newsrc file(s).
3777 (gnus-save-newsrc-file)
3779 (gnus-close-backends)
3780 ;; Reset everything.
3782 ;; Allow the user to do things after cleaning up.
3783 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3785 (defun gnus-group-quit ()
3786 "Quit reading news without updating .newsrc.eld or .newsrc.
3787 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3789 (when (or noninteractive ;For gnus-batch-kill
3790 (zerop (buffer-size))
3791 (not (gnus-server-opened gnus-select-method))
3793 (not gnus-current-startup-file)
3795 (format "Quit reading news without saving %s? "
3796 (file-name-nondirectory gnus-current-startup-file))))
3797 (gnus-run-hooks 'gnus-exit-gnus-hook)
3798 (gnus-configure-windows 'group t)
3799 (when (and (gnus-buffer-live-p gnus-dribble-buffer)
3800 (not (zerop (save-excursion
3801 (set-buffer gnus-dribble-buffer)
3804 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3806 (gnus-close-backends)
3808 (gnus-kill-buffer gnus-group-buffer)
3809 ;; Allow the user to do things after cleaning up.
3810 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3812 (defun gnus-group-describe-briefly ()
3813 "Give a one line description of the group mode commands."
3815 (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")))
3817 (defun gnus-group-browse-foreign-server (method)
3818 "Browse a foreign news server.
3819 If called interactively, this function will ask for a select method
3820 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
3821 If not, METHOD should be a list where the first element is the method
3822 and the second element is the address."
3824 (list (let ((how (completing-read
3826 (append gnus-valid-select-methods gnus-server-alist)
3827 nil t (cons "nntp" 0) 'gnus-method-history)))
3828 ;; We either got a backend name or a virtual server name.
3829 ;; If the first, we also need an address.
3830 (if (assoc how gnus-valid-select-methods)
3832 ;; Suggested by mapjph@bath.ac.uk.
3835 (mapcar (lambda (server) (list server))
3836 gnus-secondary-servers)))
3837 ;; We got a server name.
3839 (gnus-browse-foreign-server method))
3841 (defun gnus-group-set-info (info &optional method-only-group part)
3842 (when (or info part)
3843 (let* ((entry (gnus-gethash
3844 (or method-only-group (gnus-info-group info))
3845 gnus-newsrc-hashtb))
3847 (info (if method-only-group (nth 2 entry) info))
3849 (when method-only-group
3851 (error "Trying to change non-existent group %s" method-only-group))
3852 ;; We have received parts of the actual group info - either the
3853 ;; select method or the group parameters. We first check
3854 ;; whether we have to extend the info, and if so, do that.
3855 (let ((len (length info))
3856 (total (if (eq part 'method) 5 6)))
3858 (setcdr (nthcdr (1- len) info)
3859 (make-list (- total len) nil)))
3860 ;; Then we enter the new info.
3861 (setcar (nthcdr (1- total) info) part-info)))
3863 ;; This is a new group, so we just create it.
3865 (set-buffer gnus-group-buffer)
3866 (setq method (gnus-info-method info))
3867 (when (gnus-server-equal method "native")
3870 (set-buffer gnus-group-buffer)
3872 ;; It's a foreign group...
3873 (gnus-group-make-group
3874 (gnus-group-real-name (gnus-info-group info))
3875 (if (stringp method) method
3876 (prin1-to-string (car method)))
3878 (nth 1 (gnus-info-method info))))
3879 ;; It's a native group.
3880 (gnus-group-make-group (gnus-info-group info))))
3881 (gnus-message 6 "Note: New group created")
3883 (gnus-gethash (gnus-group-prefixed-name
3884 (gnus-group-real-name (gnus-info-group info))
3885 (or (gnus-info-method info) gnus-select-method))
3886 gnus-newsrc-hashtb))))
3887 ;; Whether it was a new group or not, we now have the entry, so we
3888 ;; can do the update.
3891 (setcar (nthcdr 2 entry) info)
3892 (when (and (not (eq (car entry) t))
3893 (gnus-active (gnus-info-group info)))
3894 (setcar entry (length
3895 (gnus-list-of-unread-articles (car info))))))
3896 (error "No such group: %s" (gnus-info-group info))))))
3898 (defun gnus-group-set-method-info (group select-method)
3899 (gnus-group-set-info select-method group 'method))
3901 (defun gnus-group-set-params-info (group params)
3902 (gnus-group-set-info params group 'params))
3904 (defun gnus-add-marked-articles (group type articles &optional info force)
3905 ;; Add ARTICLES of TYPE to the info of GROUP.
3906 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
3907 ;; add, but replace marked articles of TYPE with ARTICLES.
3908 (let ((info (or info (gnus-get-info group)))
3911 (and (not (setq marked (nthcdr 3 info)))
3913 (setcdr (nthcdr 2 info)
3914 (list (list (cons type (gnus-compress-sequence
3916 (and (not (setq m (assq type (car marked))))
3919 (cons (cons type (gnus-compress-sequence articles t) )
3923 (setcar (nthcdr 3 info)
3924 (gnus-delete-alist type (car marked)))
3925 (setcdr m (gnus-compress-sequence articles t)))
3926 (setcdr m (gnus-compress-sequence
3927 (sort (nconc (gnus-uncompress-range (cdr m))
3928 (copy-sequence articles)) '<) t))))))
3930 (defun gnus-add-mark (group mark article)
3931 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
3932 (let ((buffer (gnus-summary-buffer-name group)))
3933 (if (gnus-buffer-live-p buffer)
3935 (set-buffer (get-buffer buffer))
3936 (gnus-summary-add-mark article mark))
3937 (gnus-add-marked-articles group (cdr (assq mark gnus-article-mark-lists))
3941 ;;; Group timestamps
3944 (defun gnus-group-set-timestamp ()
3945 "Change the timestamp of the current group to the current time.
3946 This function can be used in hooks like `gnus-select-group-hook'
3947 or `gnus-group-catchup-group-hook'."
3948 (when gnus-newsgroup-name
3949 (let ((time (current-time)))
3950 (setcdr (cdr time) nil)
3951 (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
3953 (defsubst gnus-group-timestamp (group)
3954 "Return the timestamp for GROUP."
3955 (gnus-group-get-parameter group 'timestamp t))
3957 (defun gnus-group-timestamp-delta (group)
3958 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
3959 (let* ((time (or (gnus-group-timestamp group)
3961 (delta (subtract-time (current-time) time)))
3962 (+ (* (nth 0 delta) 65536.0)
3965 (defun gnus-group-timestamp-string (group)
3966 "Return a string of the timestamp for GROUP."
3967 (let ((time (gnus-group-timestamp group)))
3970 (gnus-time-iso8601 time))))
3972 (defun gnus-group-list-cached (level &optional lowest)
3973 "List all groups with cached articles.
3974 If the prefix LEVEL is non-nil, it should be a number that says which
3975 level to cut off listing groups.
3976 If LOWEST, don't list groups with level lower than LOWEST.
3978 This command may read the active file."
3981 (setq level (prefix-numeric-value level)))
3982 (when (or (not level) (>= level gnus-level-zombie))
3984 (funcall gnus-group-prepare-function
3985 (or level gnus-level-subscribed)
3987 (let ((marks (gnus-info-marks info)))
3988 (assq 'cache marks)))
3991 (or (gnus-gethash group
3992 gnus-cache-active-hashtb)
3993 ;; Cache active file might use "."
3996 (mapconcat 'identity
3997 (split-string group ":")
3999 gnus-cache-active-hashtb))))
4000 (goto-char (point-min))
4001 (gnus-group-position-point))
4003 (defun gnus-group-list-dormant (level &optional lowest)
4004 "List all groups with dormant articles.
4005 If the prefix LEVEL is non-nil, it should be a number that says which
4006 level to cut off listing groups.
4007 If LOWEST, don't list groups with level lower than LOWEST.
4009 This command may read the active file."
4012 (setq level (prefix-numeric-value level)))
4013 (when (or (not level) (>= level gnus-level-zombie))
4015 (funcall gnus-group-prepare-function
4016 (or level gnus-level-subscribed)
4018 (let ((marks (gnus-info-marks info)))
4019 (assq 'dormant marks)))
4022 (goto-char (point-min))
4023 (gnus-group-position-point))
4025 (defun gnus-group-listed-groups ()
4026 "Return a list of listed groups."
4028 (goto-char (point-min))
4029 (while (setq point (text-property-not-all (point) (point-max)
4032 (push (symbol-name (get-text-property point 'gnus-group)) groups)
4036 (defun gnus-group-list-plus (&optional args)
4037 "List groups plus the current selection."
4039 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
4040 (gnus-group-list-mode gnus-group-list-mode) ;; Save it.
4042 (push last-command-event unread-command-events)
4043 (if (featurep 'xemacs)
4044 (push (make-event 'key-press '(key ?A)) unread-command-events)
4045 (push ?A unread-command-events))
4046 (let (gnus-pick-mode keys)
4047 (setq keys (if (featurep 'xemacs)
4048 (events-to-keys (read-key-sequence nil))
4049 (read-key-sequence nil)))
4050 (setq func (lookup-key (current-local-map) keys)))
4054 (call-interactively func))))
4056 (defun gnus-group-list-flush (&optional args)
4057 "Flush groups from the current selection."
4059 (let ((gnus-group-list-option 'flush))
4060 (gnus-group-list-plus args)))
4062 (defun gnus-group-list-limit (&optional args)
4063 "List groups limited within the current selection."
4065 (let ((gnus-group-list-option 'limit))
4066 (gnus-group-list-plus args)))
4068 (defun gnus-group-mark-article-read (group article)
4069 "Mark ARTICLE read."
4070 (let ((buffer (gnus-summary-buffer-name group))
4071 (mark gnus-read-mark)
4073 (if (get-buffer buffer)
4074 (with-current-buffer buffer
4075 (setq active gnus-newsgroup-active)
4076 (gnus-activate-group group)
4077 (when gnus-newsgroup-prepared
4078 (when (and gnus-newsgroup-auto-expire
4079 (memq mark gnus-auto-expirable-marks))
4080 (setq mark gnus-expirable-mark))
4081 (setq mark (gnus-request-update-mark
4082 group article mark))
4083 (gnus-mark-article-as-read article mark)
4084 (setq gnus-newsgroup-active (gnus-active group))
4086 (setq n (1+ (cdr active)))
4087 (while (<= n (cdr gnus-newsgroup-active))
4088 (unless (eq n article)
4089 (push n gnus-newsgroup-unselected))
4091 (setq gnus-newsgroup-unselected
4092 (nreverse gnus-newsgroup-unselected)))))
4093 (gnus-activate-group group)
4094 (gnus-group-make-articles-read group
4096 (when (gnus-group-auto-expirable-p group)
4097 (gnus-add-marked-articles
4098 group 'expire (list article))))))
4100 (provide 'gnus-group)
4102 ;;; gnus-group.el ends here