1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
42 (defcustom gnus-group-archive-directory
43 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
44 "*The address of the (ding) archives."
45 :group 'gnus-group-foreign
48 (defcustom gnus-group-recent-archive-directory
49 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
50 "*The address of the most recent (ding) articles."
51 :group 'gnus-group-foreign
54 (defcustom gnus-no-groups-message "No gnus is bad news"
55 "*Message displayed by Gnus when no groups are available."
59 (defcustom gnus-keep-same-level nil
60 "*Non-nil means that the next newsgroup after the current will be on the same level.
61 When you type, for instance, `n' after reading the last article in the
62 current newsgroup, you will go to the next newsgroup. If this variable
63 is nil, the next newsgroup will be the next from the group
65 If this variable is non-nil, Gnus will either put you in the
66 next newsgroup with the same level, or, if no such newsgroup is
67 available, the next newsgroup with the lowest possible level higher
68 than the current level.
69 If this variable is `best', Gnus will make the next newsgroup the one
71 :group 'gnus-group-levels
72 :type '(choice (const nil)
74 (sexp :tag "other" t)))
76 (defcustom gnus-group-goto-unread t
77 "*If non-nil, movement commands will go to the next unread and subscribed group."
78 :link '(custom-manual "(gnus)Group Maneuvering")
79 :group 'gnus-group-various
82 (defcustom gnus-goto-next-group-when-activating t
83 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
84 :link '(custom-manual "(gnus)Scanning New Messages")
85 :group 'gnus-group-various
88 (defcustom gnus-permanently-visible-groups nil
89 "*Regexp to match groups that should always be listed in the group buffer.
90 This means that they will still be listed even when there are no
91 unread articles in the groups.
93 If nil, no groups are permanently visible."
94 :group 'gnus-group-listing
95 :type '(choice regexp (const nil)))
97 (defcustom gnus-list-groups-with-ticked-articles t
98 "*If non-nil, list groups that have only ticked articles.
99 If nil, only list groups that have unread articles."
100 :group 'gnus-group-listing
103 (defcustom gnus-group-default-list-level gnus-level-subscribed
104 "*Default listing level.
105 Ignored if `gnus-group-use-permanent-levels' is non-nil."
106 :group 'gnus-group-listing
109 (defcustom gnus-group-list-inactive-groups t
110 "*If non-nil, inactive groups will be listed."
111 :group 'gnus-group-listing
112 :group 'gnus-group-levels
115 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet
116 "*Function used for sorting the group buffer.
117 This function will be called with group info entries as the arguments
118 for the groups to be sorted. Pre-made functions include
119 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
120 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
121 `gnus-group-sort-by-score', `gnus-group-sort-by-method',
122 `gnus-group-sort-by-server', and `gnus-group-sort-by-rank'.
124 This variable can also be a list of sorting functions. In that case,
125 the most significant sort function should be the last function in the
127 :group 'gnus-group-listing
128 :link '(custom-manual "(gnus)Sorting Groups")
129 :type '(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\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 Text between %( and %) will be highlighted with `gnus-mouse-face' when
183 the mouse point move inside the area. There can only be one such area.
185 Note that this format specification is not always respected. For
186 reasons of efficiency, when listing killed groups, this specification
187 is ignored altogether. If the spec is changed considerably, your
188 output may end up looking strange when listing both alive and killed
191 If you use %o or %O, reading the active file will be slower and quite
192 a bit of extra memory will be used. %D will also worsen performance.
193 Also note that if you change the format specification to include any
194 of these specs, you must probably re-start Gnus to see them go into
196 :group 'gnus-group-visual
199 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}"
200 "*The format specification for the group mode line.
201 It works along the same lines as a normal formatting string,
202 with some simple extensions:
204 %S The native news server.
205 %M The native select method.
206 %: \":\" if %S isn't \"\"."
207 :group 'gnus-group-visual
210 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
211 (when (featurep 'xemacs)
212 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
213 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar))
215 (defcustom gnus-group-menu-hook nil
216 "Hook run after the creation of the group mode menu."
217 :group 'gnus-group-various
220 (defcustom gnus-group-catchup-group-hook nil
221 "Hook run when catching up a group from the group buffer."
222 :group 'gnus-group-various
223 :link '(custom-manual "(gnus)Group Data")
226 (defcustom gnus-group-update-group-hook nil
227 "Hook called when updating group lines."
228 :group 'gnus-group-visual
231 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat
232 "*A function that is called to generate the group buffer.
233 The function is called with three arguments: The first is a number;
234 all group with a level less or equal to that number should be listed,
235 if the second is non-nil, empty groups should also be displayed. If
236 the third is non-nil, it is a number. No groups with a level lower
237 than this number should be displayed.
239 The only current function implemented is `gnus-group-prepare-flat'."
240 :group 'gnus-group-listing
243 (defcustom gnus-group-prepare-hook nil
244 "Hook called after the group buffer has been generated.
245 If you want to modify the group buffer, you can use this hook."
246 :group 'gnus-group-listing
249 (defcustom gnus-suspend-gnus-hook nil
250 "Hook called when suspending (not exiting) Gnus."
254 (defcustom gnus-exit-gnus-hook nil
255 "Hook called when exiting Gnus."
259 (defcustom gnus-after-exiting-gnus-hook nil
260 "Hook called after exiting Gnus."
264 (defcustom gnus-group-update-hook '(gnus-group-highlight-line)
265 "Hook called when a group line is changed.
266 The hook will not be called if `gnus-visual' is nil.
268 The default function `gnus-group-highlight-line' will
269 highlight the line according to the `gnus-group-highlight'
271 :group 'gnus-group-visual
274 (defcustom gnus-useful-groups
275 '(("(ding) mailing list mirrored at sunsite.auc.dk"
277 (nntp "sunsite.auc.dk"
278 (nntp-address "sunsite.auc.dk")))
281 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
285 (nndoc-article-type mbox)
286 (eval `(nndoc-address
287 ,(let ((file (nnheader-find-etc-directory
290 (error "Couldn't find doc group"))
292 "*Alist of useful group-server pairs."
293 :group 'gnus-group-listing
294 :type '(repeat (list (string :tag "Description")
296 (sexp :tag "Method"))))
298 (defcustom gnus-group-highlight
300 ((and mailp (= unread 0) (eq level 1)) .
301 gnus-group-mail-1-empty-face)
302 ((and mailp (eq level 1)) .
303 gnus-group-mail-1-face)
304 ((and mailp (= unread 0) (eq level 2)) .
305 gnus-group-mail-2-empty-face)
306 ((and mailp (eq level 2)) .
307 gnus-group-mail-2-face)
308 ((and mailp (= unread 0) (eq level 3)) .
309 gnus-group-mail-3-empty-face)
310 ((and mailp (eq level 3)) .
311 gnus-group-mail-3-face)
312 ((and mailp (= unread 0)) .
313 gnus-group-mail-low-empty-face)
315 gnus-group-mail-low-face)
317 ((and (= unread 0) (eq level 1)) .
318 gnus-group-news-1-empty-face)
319 ((and (eq level 1)) .
320 gnus-group-news-1-face)
321 ((and (= unread 0) (eq level 2)) .
322 gnus-group-news-2-empty-face)
323 ((and (eq level 2)) .
324 gnus-group-news-2-face)
325 ((and (= unread 0) (eq level 3)) .
326 gnus-group-news-3-empty-face)
327 ((and (eq level 3)) .
328 gnus-group-news-3-face)
329 ((and (= unread 0) (eq level 4)) .
330 gnus-group-news-4-empty-face)
331 ((and (eq level 4)) .
332 gnus-group-news-4-face)
333 ((and (= unread 0) (eq level 5)) .
334 gnus-group-news-5-empty-face)
335 ((and (eq level 5)) .
336 gnus-group-news-5-face)
337 ((and (= unread 0) (eq level 6)) .
338 gnus-group-news-6-empty-face)
339 ((and (eq level 6)) .
340 gnus-group-news-6-face)
341 ((and (= unread 0)) .
342 gnus-group-news-low-empty-face)
344 gnus-group-news-low-face))
345 "*Controls the highlighting of group buffer lines.
347 Below is a list of `Form'/`Face' pairs. When deciding how a a
348 particular group line should be displayed, each form is
349 evaluated. The content of the face field after the first true form is
350 used. You can change how those group lines are displayed by
351 editing the face field.
353 It is also possible to change and add form fields, but currently that
354 requires an understanding of Lisp expressions. Hopefully this will
355 change in a future release. For now, you can use the following
356 variables in the Lisp expression:
358 group: The name of the group.
359 unread: The number of unread articles in the group.
360 method: The select method used.
361 mailp: Whether it's a mail group or not.
362 level: The level of the group.
363 score: The score of the group.
364 ticked: The number of ticked articles."
365 :group 'gnus-group-visual
366 :type '(repeat (cons (sexp :tag "Form") face)))
368 (defcustom gnus-new-mail-mark ?%
369 "Mark used for groups with new mail."
370 :group 'gnus-group-visual
373 (defgroup gnus-group-icons nil
374 "Add Icons to your group buffer. "
375 :group 'gnus-group-visual)
377 (defcustom gnus-group-icon-list
379 "*Controls the insertion of icons into group buffer lines.
381 Below is a list of `Form'/`File' pairs. When deciding how a
382 particular group line should be displayed, each form is evaluated.
383 The icon from the file field after the first true form is used. You
384 can change how those group lines are displayed by editing the file
385 field. The File will either be found in the
386 `gnus-group-glyph-directory' or by designating absolute path to the
389 It is also possible to change and add form fields, but currently that
390 requires an understanding of Lisp expressions. Hopefully this will
391 change in a future release. For now, you can use the following
392 variables in the Lisp expression:
394 group: The name of the group.
395 unread: The number of unread articles in the group.
396 method: The select method used.
397 mailp: Whether it's a mail group or not.
398 newsp: Whether it's a news group or not
399 level: The level of the group.
400 score: The score of the group.
401 ticked: The number of ticked articles."
402 :group 'gnus-group-icons
403 :type '(repeat (cons (sexp :tag "Form") file)))
405 (defcustom gnus-group-name-charset-method-alist nil
406 "Alist of method and the charset for group names.
409 (((nntp \"news.com.cn\") . cn-gb-2312))"
412 :type '(repeat (cons (sexp :tag "Method") (symbol :tag "Charset"))))
414 (defcustom gnus-group-name-charset-group-alist
415 (if (or (and (fboundp 'find-coding-system) (find-coding-system 'utf-8))
416 (and (fboundp 'coding-system-p) (coding-system-p 'utf-8)))
419 "Alist of group regexp and the charset for group names.
422 ((\"\\.com\\.cn:\" . cn-gb-2312))"
424 :type '(repeat (cons (regexp :tag "Group") (symbol :tag "Charset"))))
426 (defcustom gnus-group-jump-to-group-prompt nil
427 "Default prompt for `gnus-group-jump-to-group'.
428 If non-nil, the value should be a string, e.g. \"nnml:\",
429 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
430 in the minibuffer prompt."
431 :group 'gnus-group-various
432 :type '(choice (string :tag "Prompt string")
433 (const :tag "Empty" nil)))
435 (defvar gnus-group-listing-limit 1000
436 "*A limit of the number of groups when listing.
437 If the number of groups is larger than the limit, list them in a
440 ;;; Internal variables
442 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat
443 "Function for sorting the group buffer.")
445 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat
446 "Function for sorting the selected groups in the group buffer.")
448 (defvar gnus-group-indentation-function nil)
449 (defvar gnus-goto-missing-group-function nil)
450 (defvar gnus-group-update-group-function nil)
451 (defvar gnus-group-goto-next-group-function nil
452 "Function to override finding the next group after listing groups.")
454 (defvar gnus-group-edit-buffer nil)
456 (defvar gnus-group-line-format-alist
457 `((?M gnus-tmp-marked-mark ?c)
458 (?S gnus-tmp-subscribed ?c)
459 (?L gnus-tmp-level ?d)
460 (?N (cond ((eq number t) "*" )
464 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
465 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))))))
467 (?R gnus-tmp-number-of-read ?s)
468 (?t gnus-tmp-number-total ?d)
469 (?y gnus-tmp-number-of-unread ?s)
470 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d)
471 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d)
472 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked)))
473 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d)
474 (?g gnus-tmp-group ?s)
475 (?G gnus-tmp-qualified-group ?s)
476 (?c (gnus-short-group-name gnus-tmp-group) ?s)
477 (?D gnus-tmp-newsgroup-description ?s)
478 (?o gnus-tmp-moderated ?c)
479 (?O gnus-tmp-moderated-string ?s)
480 (?p gnus-tmp-process-marked ?c)
481 (?s gnus-tmp-news-server ?s)
482 (?n gnus-tmp-news-method ?s)
483 (?P gnus-group-indentation ?s)
484 (?E gnus-tmp-group-icon ?s)
485 (?l gnus-tmp-grouplens ?s)
486 (?z gnus-tmp-news-method-string ?s)
487 (?m (gnus-group-new-mail gnus-tmp-group) ?c)
488 (?w (if (gnus-news-group-p gnus-tmp-group)
492 (nnmail-new-mail-numbers (gnus-group-real-name gnus-tmp-group))
495 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s)
496 (?u gnus-tmp-user-defined ?s)))
498 (defvar gnus-group-mode-line-format-alist
499 `((?S gnus-tmp-news-server ?s)
500 (?M gnus-tmp-news-method ?s)
501 (?u gnus-tmp-user-defined ?s)
502 (?: gnus-tmp-colon ?s)))
504 (defvar gnus-topic-topology nil
505 "The complete topic hierarchy.")
507 (defvar gnus-topic-alist nil
508 "The complete topic-group alist.")
510 (defvar gnus-group-marked nil)
512 (defvar gnus-group-list-mode nil)
515 (defvar gnus-group-icon-cache nil)
517 (defvar gnus-group-listed-groups nil)
518 (defvar gnus-group-list-option nil)
524 (put 'gnus-group-mode 'mode-class 'special)
527 (gnus-define-keys gnus-group-mode-map
528 " " gnus-group-read-group
529 "=" gnus-group-select-group
530 "\r" gnus-group-select-group
531 "\M-\r" gnus-group-quick-select-group
532 "\M- " gnus-group-visible-select-group
533 [(meta control return)] gnus-group-select-group-ephemerally
534 "j" gnus-group-jump-to-group
535 "n" gnus-group-next-unread-group
536 "p" gnus-group-prev-unread-group
537 "\177" gnus-group-prev-unread-group
538 [delete] gnus-group-prev-unread-group
539 [backspace] gnus-group-prev-unread-group
540 "N" gnus-group-next-group
541 "P" gnus-group-prev-group
542 "\M-n" gnus-group-next-unread-group-same-level
543 "\M-p" gnus-group-prev-unread-group-same-level
544 "," gnus-group-best-unread-group
545 "." gnus-group-first-unread-group
546 "u" gnus-group-unsubscribe-current-group
547 "U" gnus-group-unsubscribe-group
548 "c" gnus-group-catchup-current
549 "C" gnus-group-catchup-current-all
550 "\M-c" gnus-group-clear-data
551 "l" gnus-group-list-groups
552 "L" gnus-group-list-all-groups
554 "g" gnus-group-get-new-news
555 "\M-g" gnus-group-get-new-news-this-group
556 "R" gnus-group-restart
557 "r" gnus-group-read-init-file
558 "B" gnus-group-browse-foreign-server
559 "b" gnus-group-check-bogus-groups
560 "F" gnus-group-find-new-groups
561 "\C-c\C-d" gnus-group-describe-group
562 "\M-d" gnus-group-describe-all-groups
563 "\C-c\C-a" gnus-group-apropos
564 "\C-c\M-\C-a" gnus-group-description-apropos
565 "a" gnus-group-post-news
566 "\ek" gnus-group-edit-local-kill
567 "\eK" gnus-group-edit-global-kill
568 "\C-k" gnus-group-kill-group
569 "\C-y" gnus-group-yank-group
570 "\C-w" gnus-group-kill-region
571 "\C-x\C-t" gnus-group-transpose-groups
572 "\C-c\C-l" gnus-group-list-killed
573 "\C-c\C-x" gnus-group-expire-articles
574 "\C-c\M-\C-x" gnus-group-expire-all-groups
576 "s" gnus-group-save-newsrc
577 "z" gnus-group-suspend
580 "?" gnus-group-describe-briefly
581 "\C-c\C-i" gnus-info-find-node
582 "\M-e" gnus-group-edit-group-method
583 "^" gnus-group-enter-server-mode
584 gnus-mouse-2 gnus-mouse-pick-group
585 "<" beginning-of-buffer
588 "\C-c\C-n" gnus-namazu-search
589 "\C-c\C-s" gnus-group-sort-groups
591 "\C-c\M-g" gnus-activate-all-groups
592 "\M-&" gnus-group-universal-argument
593 "#" gnus-group-mark-group
594 "\M-#" gnus-group-unmark-group)
596 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
597 "m" gnus-group-mark-group
598 "u" gnus-group-unmark-group
599 "w" gnus-group-mark-region
600 "b" gnus-group-mark-buffer
601 "r" gnus-group-mark-regexp
602 "U" gnus-group-unmark-all-groups)
604 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
605 "u" gnus-sieve-update
606 "g" gnus-sieve-generate)
608 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
609 "d" gnus-group-make-directory-group
610 "h" gnus-group-make-help-group
611 "u" gnus-group-make-useful-group
612 "a" gnus-group-make-archive-group
613 "k" gnus-group-make-kiboze-group
614 "l" gnus-group-nnimap-edit-acl
615 "m" gnus-group-make-group
616 "s" gnus-group-make-shimbun-group
617 "E" gnus-group-edit-group
618 "e" gnus-group-edit-group-method
619 "p" gnus-group-edit-group-parameters
620 "v" gnus-group-add-to-virtual
621 "V" gnus-group-make-empty-virtual
622 "D" gnus-group-enter-directory
623 "f" gnus-group-make-doc-group
624 "G" gnus-group-make-nnir-group
625 "w" gnus-group-make-web-group
626 "r" gnus-group-rename-group
627 "c" gnus-group-customize
628 "x" gnus-group-nnimap-expunge
629 "\177" gnus-group-delete-group
630 [delete] gnus-group-delete-group)
632 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map)
633 "b" gnus-group-brew-soup
634 "w" gnus-soup-save-areas
635 "s" gnus-soup-send-replies
636 "p" gnus-soup-pack-packet
637 "r" nnsoup-pack-replies)
639 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map)
640 "s" gnus-group-sort-groups
641 "a" gnus-group-sort-groups-by-alphabet
642 "u" gnus-group-sort-groups-by-unread
643 "l" gnus-group-sort-groups-by-level
644 "v" gnus-group-sort-groups-by-score
645 "r" gnus-group-sort-groups-by-rank
646 "m" gnus-group-sort-groups-by-method)
648 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map)
649 "s" gnus-group-sort-selected-groups
650 "a" gnus-group-sort-selected-groups-by-alphabet
651 "u" gnus-group-sort-selected-groups-by-unread
652 "l" gnus-group-sort-selected-groups-by-level
653 "v" gnus-group-sort-selected-groups-by-score
654 "r" gnus-group-sort-selected-groups-by-rank
655 "m" gnus-group-sort-selected-groups-by-method)
657 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map)
658 "k" gnus-group-list-killed
659 "z" gnus-group-list-zombies
660 "s" gnus-group-list-groups
661 "u" gnus-group-list-all-groups
662 "A" gnus-group-list-active
663 "a" gnus-group-apropos
664 "d" gnus-group-description-apropos
665 "m" gnus-group-list-matching
666 "M" gnus-group-list-all-matching
667 "l" gnus-group-list-level
668 "c" gnus-group-list-cached
669 "?" gnus-group-list-dormant)
671 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map)
672 "k" gnus-group-list-limit
673 "z" gnus-group-list-limit
674 "s" gnus-group-list-limit
675 "u" gnus-group-list-limit
676 "A" gnus-group-list-limit
677 "m" gnus-group-list-limit
678 "M" gnus-group-list-limit
679 "l" gnus-group-list-limit
680 "c" gnus-group-list-limit
681 "?" gnus-group-list-limit)
683 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map)
684 "k" gnus-group-list-flush
685 "z" gnus-group-list-flush
686 "s" gnus-group-list-flush
687 "u" gnus-group-list-flush
688 "A" gnus-group-list-flush
689 "m" gnus-group-list-flush
690 "M" gnus-group-list-flush
691 "l" gnus-group-list-flush
692 "c" gnus-group-list-flush
693 "?" gnus-group-list-flush)
695 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map)
696 "k" gnus-group-list-plus
697 "z" gnus-group-list-plus
698 "s" gnus-group-list-plus
699 "u" gnus-group-list-plus
700 "A" gnus-group-list-plus
701 "m" gnus-group-list-plus
702 "M" gnus-group-list-plus
703 "l" gnus-group-list-plus
704 "c" gnus-group-list-plus
705 "?" gnus-group-list-plus)
707 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map)
708 "f" gnus-score-flush-cache)
710 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map)
711 "d" gnus-group-describe-group
712 "f" gnus-group-fetch-faq
715 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map)
716 "l" gnus-group-set-current-level
717 "t" gnus-group-unsubscribe-current-group
718 "s" gnus-group-unsubscribe-group
719 "k" gnus-group-kill-group
720 "y" gnus-group-yank-group
721 "w" gnus-group-kill-region
722 "\C-k" gnus-group-kill-level
723 "z" gnus-group-kill-all-zombies))
725 (defun gnus-group-make-menu-bar ()
726 (gnus-turn-off-edit-menu 'group)
727 (unless (boundp 'gnus-group-reading-menu)
730 gnus-group-reading-menu gnus-group-mode-map ""
732 ["Read" gnus-group-read-group (gnus-group-group-name)]
733 ["Select" gnus-group-select-group (gnus-group-group-name)]
734 ["See old articles" (gnus-group-select-group 'all)
735 :keys "C-u SPC" :active (gnus-group-group-name)]
736 ["Catch up" gnus-group-catchup-current :active (gnus-group-group-name)
737 ,@(if (featurep 'xemacs) nil
738 '(:help "Mark unread articles in the current group as read"))]
739 ["Catch up all articles" gnus-group-catchup-current-all
740 (gnus-group-group-name)]
741 ["Check for new articles" gnus-group-get-new-news-this-group
742 :active (gnus-group-group-name)
743 ,@(if (featurep 'xemacs) nil
744 '(:help "Check for new messages in current group"))]
745 ["Toggle subscription" gnus-group-unsubscribe-current-group
746 (gnus-group-group-name)]
747 ["Kill" gnus-group-kill-group :active (gnus-group-group-name)
748 ,@(if (featurep 'xemacs) nil
749 '(:help "Kill (remove) current group"))]
750 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups]
751 ["Describe" gnus-group-describe-group :active (gnus-group-group-name)
752 ,@(if (featurep 'xemacs) nil
753 '(:help "Display description of the current group"))]
754 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)]
755 ;; Actually one should check, if any of the marked groups gives t for
756 ;; (gnus-check-backend-function 'request-expire-articles ...)
757 ["Expire articles" gnus-group-expire-articles
758 (or (and (gnus-group-group-name)
759 (gnus-check-backend-function
760 'request-expire-articles
761 (gnus-group-group-name))) gnus-group-marked)]
762 ["Set group level" gnus-group-set-current-level
763 (gnus-group-group-name)]
764 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)]
765 ["Customize" gnus-group-customize (gnus-group-group-name)]
767 ["Parameters" gnus-group-edit-group-parameters
768 (gnus-group-group-name)]
769 ["Select method" gnus-group-edit-group-method
770 (gnus-group-group-name)]
771 ["Info" gnus-group-edit-group (gnus-group-group-name)]
772 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)]
773 ["Global kill file" gnus-group-edit-global-kill t])))
776 gnus-group-group-menu gnus-group-mode-map ""
779 ["List unread subscribed groups" gnus-group-list-groups t]
780 ["List (un)subscribed groups" gnus-group-list-all-groups t]
781 ["List killed groups" gnus-group-list-killed gnus-killed-list]
782 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list]
783 ["List level..." gnus-group-list-level t]
784 ["Describe all groups" gnus-group-describe-all-groups t]
785 ["Group apropos..." gnus-group-apropos t]
786 ["Group and description apropos..." gnus-group-description-apropos t]
787 ["List groups matching..." gnus-group-list-matching t]
788 ["List all groups matching..." gnus-group-list-all-matching t]
789 ["List active file" gnus-group-list-active t]
790 ["List groups with cached" gnus-group-list-cached t]
791 ["List groups with dormant" gnus-group-list-dormant t])
793 ["Default sort" gnus-group-sort-groups t]
794 ["Sort by method" gnus-group-sort-groups-by-method t]
795 ["Sort by rank" gnus-group-sort-groups-by-rank t]
796 ["Sort by score" gnus-group-sort-groups-by-score t]
797 ["Sort by level" gnus-group-sort-groups-by-level t]
798 ["Sort by unread" gnus-group-sort-groups-by-unread t]
799 ["Sort by name" gnus-group-sort-groups-by-alphabet t])
800 ("Sort process/prefixed"
801 ["Default sort" gnus-group-sort-selected-groups
802 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
803 ["Sort by method" gnus-group-sort-selected-groups-by-method
804 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
805 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
806 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
807 ["Sort by score" gnus-group-sort-selected-groups-by-score
808 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
809 ["Sort by level" gnus-group-sort-selected-groups-by-level
810 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
811 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
812 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]
813 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
814 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))])
816 ["Mark group" gnus-group-mark-group
817 (and (gnus-group-group-name)
818 (not (memq (gnus-group-group-name) gnus-group-marked)))]
819 ["Unmark group" gnus-group-unmark-group
820 (and (gnus-group-group-name)
821 (memq (gnus-group-group-name) gnus-group-marked))]
822 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked]
823 ["Mark regexp..." gnus-group-mark-regexp t]
824 ["Mark region" gnus-group-mark-region t]
825 ["Mark buffer" gnus-group-mark-buffer t]
826 ["Execute command" gnus-group-universal-argument
827 (or gnus-group-marked (gnus-group-group-name))])
829 ["Subscribe to a group" gnus-group-unsubscribe-group t]
830 ["Kill all newsgroups in region" gnus-group-kill-region t]
831 ["Kill all zombie groups" gnus-group-kill-all-zombies
833 ["Kill all groups on level..." gnus-group-kill-level t])
835 ["Make a foreign group" gnus-group-make-group t]
836 ["Make a shimbun group" gnus-group-make-shimbun-group t]
837 ["Add a directory group" gnus-group-make-directory-group t]
838 ["Add the help group" gnus-group-make-help-group t]
839 ["Add the archive group" gnus-group-make-archive-group t]
840 ["Make a doc group" gnus-group-make-doc-group t]
841 ["Make a web group" gnus-group-make-web-group t]
842 ["Make a kiboze group" gnus-group-make-kiboze-group t]
843 ["Make a virtual group" gnus-group-make-empty-virtual t]
844 ["Add a group to a virtual" gnus-group-add-to-virtual t]
845 ["Rename group" gnus-group-rename-group
846 (gnus-check-backend-function
847 'request-rename-group (gnus-group-group-name))]
848 ["Delete group" gnus-group-delete-group
849 (gnus-check-backend-function
850 'request-delete-group (gnus-group-group-name))])
852 ["Next" gnus-group-next-group t]
853 ["Previous" gnus-group-prev-group t]
854 ["Next unread" gnus-group-next-unread-group t]
855 ["Previous unread" gnus-group-prev-unread-group t]
856 ["Next unread same level" gnus-group-next-unread-group-same-level t]
857 ["Previous unread same level"
858 gnus-group-prev-unread-group-same-level t]
859 ["Jump to group" gnus-group-jump-to-group t]
860 ["First unread group" gnus-group-first-unread-group t]
861 ["Best unread group" gnus-group-best-unread-group t])
863 ["Generate" gnus-sieve-generate t]
864 ["Generate and update" gnus-sieve-update t])
865 ["Delete bogus groups" gnus-group-check-bogus-groups t]
866 ["Find new newsgroups" gnus-group-find-new-groups t]
867 ["Transpose" gnus-group-transpose-groups
868 (gnus-group-group-name)]
869 ["Read a directory as a group..." gnus-group-enter-directory t]))
872 gnus-group-misc-menu gnus-group-mode-map ""
875 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)]
876 ["Send replies" gnus-soup-send-replies
877 (fboundp 'gnus-soup-pack-packet)]
878 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)]
879 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)]
880 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)])
881 ["Send a mail" gnus-group-mail t]
882 ["Post an article..." gnus-group-post-news t]
883 ["Check for new news" gnus-group-get-new-news
884 ,@(if (featurep 'xemacs) '(t)
885 '(:help "Get newly arrived articles"))
887 ["Send delayed articles" gnus-delay-send-drafts
888 ,@(if (featurep 'xemacs) '(t)
889 '(:help "Send all articles that are scheduled to be sent now"))
891 ["Activate all groups" gnus-activate-all-groups t]
892 ["Restart Gnus" gnus-group-restart t]
893 ["Read init file" gnus-group-read-init-file t]
894 ["Browse foreign server" gnus-group-browse-foreign-server t]
895 ["Enter server buffer" gnus-group-enter-server-mode t]
896 ["Expire all expirable articles" gnus-group-expire-all-groups t]
897 ["Generate any kiboze groups" nnkiboze-generate-groups t]
898 ["Gnus version" gnus-version t]
899 ["Save .newsrc files" gnus-group-save-newsrc t]
900 ["Suspend Gnus" gnus-group-suspend t]
901 ["Clear dribble buffer" gnus-group-clear-dribble t]
902 ["Read manual" gnus-info-find-node t]
903 ["Flush score cache" gnus-score-flush-cache t]
904 ["Toggle topics" gnus-topic-mode t]
905 ["Send a bug report" gnus-bug t]
906 ["Exit from Gnus" gnus-group-exit
907 ,@(if (featurep 'xemacs) '(t)
908 '(:help "Quit reading news"))]
909 ["Exit without saving" gnus-group-quit t]))
911 (gnus-run-hooks 'gnus-group-menu-hook)))
913 (defvar gnus-group-toolbar-map nil)
915 ;; Emacs 21 tool bar. Should be no-op otherwise.
916 (defun gnus-group-make-tool-bar ()
917 (if (and (fboundp 'tool-bar-add-item-from-menu)
918 (default-value 'tool-bar-mode)
919 (not gnus-group-toolbar-map))
920 (setq gnus-group-toolbar-map
921 (let ((tool-bar-map (make-sparse-keymap))
922 (load-path (mm-image-load-path)))
923 (tool-bar-add-item-from-menu
924 'gnus-group-get-new-news "get-news" gnus-group-mode-map)
925 (tool-bar-add-item-from-menu
926 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map)
927 (tool-bar-add-item-from-menu
928 'gnus-group-catchup-current "catchup" gnus-group-mode-map)
929 (tool-bar-add-item-from-menu
930 'gnus-group-describe-group "describe-group" gnus-group-mode-map)
931 (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe
932 :help "Subscribe to the current group")
933 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
935 :help "Unsubscribe from the current group")
936 (tool-bar-add-item-from-menu
937 'gnus-group-exit "exit-gnus" gnus-group-mode-map)
939 (if gnus-group-toolbar-map
940 (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map)))
942 (defun gnus-group-mode ()
943 "Major mode for reading news.
945 All normal editing commands are switched off.
946 \\<gnus-group-mode-map>
947 The group buffer lists (some of) the groups available. For instance,
948 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
949 lists all zombie groups.
951 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
952 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
954 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
956 The following commands are available:
958 \\{gnus-group-mode-map}"
960 (kill-all-local-variables)
961 (when (gnus-visual-p 'group-menu 'menu)
962 (gnus-group-make-menu-bar)
963 (gnus-group-make-tool-bar))
964 (gnus-simplify-mode-line)
965 (setq major-mode 'gnus-group-mode)
966 (setq mode-name "Group")
967 (gnus-group-set-mode-line)
968 (setq mode-line-process nil)
969 (use-local-map gnus-group-mode-map)
970 (buffer-disable-undo)
971 (setq truncate-lines t)
972 (setq buffer-read-only t)
973 (gnus-set-default-directory)
974 (gnus-update-format-specifications nil 'group 'group-mode)
975 (gnus-update-group-mark-positions)
980 (gnus-run-hooks 'gnus-group-mode-hook))
982 (defun gnus-update-group-mark-positions ()
984 (let ((gnus-process-mark ?\200)
985 (gnus-group-update-hook nil)
986 (gnus-group-marked '("dummy.group"))
987 (gnus-active-hashtb (make-vector 10 0))
989 (gnus-set-active "dummy.group" '(0 . 0))
990 (gnus-set-work-buffer)
991 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
992 (goto-char (point-min))
993 (setq gnus-group-mark-positions
994 (list (cons 'process (and (search-forward "\200" nil t)
997 (defun gnus-mouse-pick-group (e)
998 "Enter the group under the mouse pointer."
1001 (gnus-group-read-group nil))
1003 ;; Look at LEVEL and find out what the level is really supposed to be.
1004 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
1005 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
1006 (defun gnus-group-default-level (&optional level number-or-nil)
1008 (gnus-group-use-permanent-levels
1009 (or (setq gnus-group-use-permanent-levels
1010 (or level (if (numberp gnus-group-use-permanent-levels)
1011 gnus-group-use-permanent-levels
1012 (or gnus-group-default-list-level
1013 gnus-level-subscribed))))
1014 gnus-group-default-list-level gnus-level-subscribed))
1018 (or level gnus-group-default-list-level gnus-level-subscribed))))
1020 (defun gnus-group-setup-buffer ()
1021 (set-buffer (gnus-get-buffer-create gnus-group-buffer))
1022 (unless (eq major-mode 'gnus-group-mode)
1025 (gnus-carpal-setup-buffer 'group))))
1027 (defsubst gnus-group-name-charset (method group)
1029 (setq method (gnus-find-method-for-group group)))
1030 (let ((item (assoc method gnus-group-name-charset-method-alist))
1031 (alist gnus-group-name-charset-group-alist)
1035 (while (setq item (pop alist))
1036 (if (string-match (car item) group)
1038 result (cdr item))))
1041 (defsubst gnus-group-name-decode (string charset)
1042 (if (and string charset (featurep 'mule))
1043 (decode-coding-string string charset)
1046 (defun gnus-group-decoded-name (string)
1047 (let ((charset (gnus-group-name-charset nil string)))
1048 (gnus-group-name-decode string charset)))
1050 (defun gnus-group-list-groups (&optional level unread lowest)
1051 "List newsgroups with level LEVEL or lower that have unread articles.
1052 Default is all subscribed groups.
1053 If argument UNREAD is non-nil, groups with no unread articles are also
1056 Also see the `gnus-group-use-permanent-levels' variable."
1058 (list (if current-prefix-arg
1059 (prefix-numeric-value current-prefix-arg)
1061 (gnus-group-default-level nil t)
1062 gnus-group-default-list-level
1063 gnus-level-subscribed))))
1065 (setq level (car gnus-group-list-mode)
1066 unread (cdr gnus-group-list-mode)))
1067 (setq level (gnus-group-default-level level))
1068 (gnus-group-setup-buffer)
1069 (gnus-update-format-specifications nil 'group 'group-mode)
1070 (let ((case-fold-search nil)
1071 (props (text-properties-at (gnus-point-at-bol)))
1072 (empty (= (point-min) (point-max)))
1073 (group (gnus-group-group-name))
1075 (set-buffer gnus-group-buffer)
1076 (setq number (funcall gnus-group-prepare-function level unread lowest))
1077 (when (or (and (numberp number)
1079 (zerop (buffer-size)))
1080 ;; No groups in the buffer.
1081 (gnus-message 5 gnus-no-groups-message))
1082 ;; We have some groups displayed.
1083 (goto-char (point-max))
1084 (when (or (not gnus-group-goto-next-group-function)
1085 (not (funcall gnus-group-goto-next-group-function
1089 (goto-char (point-min)))
1091 ;; Go to the first group with unread articles.
1092 (gnus-group-search-forward t))
1094 ;; Find the right group to put point on. If the current group
1095 ;; has disappeared in the new listing, try to find the next
1096 ;; one. If no next one can be found, just leave point at the
1097 ;; first newsgroup in the buffer.
1098 (when (not (gnus-goto-char
1100 (point-min) (point-max)
1101 'gnus-group (gnus-intern-safe
1102 group gnus-active-hashtb))))
1103 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb))))
1105 (not (gnus-goto-char
1107 (point-min) (point-max) 'gnus-group
1109 (caar newsrc) gnus-active-hashtb)))))
1110 (setq newsrc (cdr newsrc)))
1112 (goto-char (point-max))
1113 (forward-line -1)))))))
1114 ;; Adjust cursor point.
1115 (gnus-group-position-point)))
1117 (defun gnus-group-list-level (level &optional all)
1118 "List groups on LEVEL.
1119 If ALL (the prefix), also list groups that have no unread articles."
1120 (interactive "nList groups on level: \nP")
1121 (gnus-group-list-groups level all level))
1123 (defun gnus-group-prepare-logic (group test)
1124 (or (and gnus-group-listed-groups
1125 (null gnus-group-list-option)
1126 (member group gnus-group-listed-groups))
1128 ((null gnus-group-listed-groups) test)
1129 ((null gnus-group-list-option) test)
1130 (t (and (member group gnus-group-listed-groups)
1131 (if (eq gnus-group-list-option 'flush)
1135 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp)
1136 "List all newsgroups with unread articles of level LEVEL or lower.
1137 If PREDICATE is a function, list groups that the function returns non-nil;
1138 if it is t, list groups that have no unread articles.
1139 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1140 If REGEXP is a function, list dead groups that the function returns non-nil;
1141 if it is a string, only list groups matching REGEXP."
1142 (set-buffer gnus-group-buffer)
1143 (let ((buffer-read-only nil)
1144 (newsrc (cdr gnus-newsrc-alist))
1145 (lowest (or lowest 1))
1146 (not-in-list (and gnus-group-listed-groups
1147 (copy-sequence gnus-group-listed-groups)))
1148 info clevel unread group params)
1150 (when (or (< lowest gnus-level-zombie)
1151 gnus-group-listed-groups)
1152 ;; List living groups.
1154 (setq info (car newsrc)
1155 group (gnus-info-group info)
1156 params (gnus-info-params info)
1158 unread (car (gnus-gethash group gnus-newsrc-hashtb)))
1160 (setq not-in-list (delete group not-in-list)))
1162 (gnus-group-prepare-logic
1164 (and unread ; This group might be unchecked
1165 (or (not (stringp regexp))
1166 (string-match regexp group))
1167 (<= (setq clevel (gnus-info-level info)) level)
1170 ((functionp predicate)
1171 (funcall predicate info))
1172 (predicate t) ; We list all groups?
1175 (if (eq unread t) ; Unactivated?
1176 gnus-group-list-inactive-groups
1177 ; We list unactivated
1179 ; We list groups with unread articles
1180 (and gnus-list-groups-with-ticked-articles
1181 (cdr (assq 'tick (gnus-info-marks info))))
1182 ; And groups with tickeds
1183 ;; Check for permanent visibility.
1184 (and gnus-permanently-visible-groups
1185 (string-match gnus-permanently-visible-groups group))
1186 (memq 'visible params)
1187 (cdr (assq 'visible params)))))))
1188 (gnus-group-insert-group-line
1189 group (gnus-info-level info)
1190 (gnus-info-marks info) unread (gnus-info-method info)))))
1192 ;; List dead groups.
1193 (if (or gnus-group-listed-groups
1194 (and (>= level gnus-level-zombie)
1195 (<= lowest gnus-level-zombie)))
1196 (gnus-group-prepare-flat-list-dead
1197 (setq gnus-zombie-list (sort gnus-zombie-list 'string<))
1198 gnus-level-zombie ?Z
1201 (dolist (group gnus-zombie-list)
1202 (setq not-in-list (delete group not-in-list))))
1203 (if (or gnus-group-listed-groups
1204 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed)))
1205 (gnus-group-prepare-flat-list-dead
1208 (setq gnus-killed-list (sort gnus-killed-list 'string<)))
1209 gnus-level-killed ?K regexp))
1211 (gnus-group-set-mode-line)
1212 (setq gnus-group-list-mode (cons level predicate))
1213 (gnus-run-hooks 'gnus-group-prepare-hook)
1216 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp)
1217 ;; List zombies and killed lists somewhat faster, which was
1218 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1219 ;; this by ignoring the group format specification altogether.
1221 (if (> (length groups) gnus-group-listing-limit)
1223 (setq group (pop groups))
1224 (when (gnus-group-prepare-logic
1227 (and (stringp regexp) (string-match regexp group))
1228 (and (functionp regexp) (funcall regexp group))))
1229 (gnus-add-text-properties
1230 (point) (prog1 (1+ (point))
1231 (insert " " mark " *: "
1232 (gnus-group-decoded-name group)
1234 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
1236 'gnus-level level))))
1238 (setq group (pop groups))
1239 (when (gnus-group-prepare-logic
1242 (and (stringp regexp) (string-match regexp group))
1243 (and (functionp regexp) (funcall regexp group))))
1244 (gnus-group-insert-group-line
1246 (let ((active (gnus-active group)))
1248 (if (zerop (cdr active))
1250 (- (1+ (cdr active)) (car active)))
1252 (gnus-method-simplify (gnus-find-method-for-group group))))))))
1254 (defun gnus-group-update-group-line ()
1255 "Update the current line in the group buffer."
1256 (let* ((buffer-read-only nil)
1257 (group (gnus-group-group-name))
1258 (entry (and group (gnus-gethash group gnus-newsrc-hashtb)))
1259 gnus-group-indentation)
1262 (not (gnus-ephemeral-group-p group))
1264 (concat "(gnus-group-set-info '"
1265 (gnus-prin1-to-string (nth 2 entry))
1267 (setq gnus-group-indentation (gnus-group-group-indentation))
1269 (gnus-group-insert-group-line-info group)
1271 (gnus-group-position-point))))
1273 (defun gnus-group-insert-group-line-info (group)
1274 "Insert GROUP on the current line."
1275 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))
1276 (gnus-group-indentation (gnus-group-group-indentation))
1280 ;; (Un)subscribed group.
1281 (setq info (nth 2 entry))
1282 (gnus-group-insert-group-line
1283 group (gnus-info-level info) (gnus-info-marks info)
1284 (or (car entry) t) (gnus-info-method info)))
1285 ;; This group is dead.
1286 (gnus-group-insert-group-line
1288 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed)
1290 (if (setq active (gnus-active group))
1291 (if (zerop (cdr active))
1293 (- (1+ (cdr active)) (car active)))
1295 (gnus-method-simplify (gnus-find-method-for-group group))))))
1297 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1298 gnus-tmp-marked number
1300 "Insert a group line in the group buffer."
1301 (let* ((gnus-tmp-method
1302 (gnus-server-get-method gnus-tmp-group gnus-tmp-method))
1303 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1305 (gnus-tmp-active (gnus-active gnus-tmp-group))
1306 (gnus-tmp-number-total
1308 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active)))
1310 (gnus-tmp-number-of-unread
1311 (if (numberp number) (int-to-string (max 0 number))
1313 (gnus-tmp-number-of-read
1314 (if (numberp number)
1315 (int-to-string (max 0 (- gnus-tmp-number-total number)))
1317 (gnus-tmp-subscribed
1318 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? )
1319 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U)
1320 ((= gnus-tmp-level gnus-level-zombie) ?Z)
1322 (gnus-tmp-qualified-group
1323 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group)
1324 group-name-charset))
1325 (gnus-tmp-newsgroup-description
1326 (if gnus-description-hashtb
1327 (or (gnus-group-name-decode
1328 (gnus-gethash gnus-tmp-group gnus-description-hashtb)
1329 group-name-charset) "")
1332 (if (and gnus-moderated-hashtb
1333 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
1335 (gnus-tmp-moderated-string
1336 (if (eq gnus-tmp-moderated ?m) "(m)" ""))
1337 (gnus-tmp-group-icon "==&&==")
1338 (gnus-tmp-news-server (or (cadr gnus-tmp-method) ""))
1339 (gnus-tmp-news-method (or (car gnus-tmp-method) ""))
1340 (gnus-tmp-news-method-string
1342 (format "(%s:%s)" (car gnus-tmp-method)
1343 (cadr gnus-tmp-method)) ""))
1344 (gnus-tmp-marked-mark
1345 (if (and (numberp number)
1347 (cdr (assq 'tick gnus-tmp-marked)))
1349 (gnus-tmp-process-marked
1350 (if (member gnus-tmp-group gnus-group-marked)
1351 gnus-process-mark ? ))
1353 (or (and gnus-use-grouplens
1354 (bbb-grouplens-group-p gnus-tmp-group))
1356 (buffer-read-only nil)
1357 header gnus-tmp-header) ; passed as parameter to user-funcs.
1359 (gnus-add-text-properties
1363 (let ((gnus-tmp-group (gnus-group-name-decode
1364 gnus-tmp-group group-name-charset)))
1365 (eval gnus-group-line-format-spec)))
1366 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
1367 gnus-unread ,(if (numberp number)
1368 (string-to-int gnus-tmp-number-of-unread)
1370 gnus-marked ,gnus-tmp-marked-mark
1371 gnus-indentation ,gnus-group-indentation
1372 gnus-level ,gnus-tmp-level))
1374 (when (inline (gnus-visual-p 'group-highlight 'highlight))
1375 (gnus-run-hooks 'gnus-group-update-hook))
1377 ;; Allow XEmacs to remove front-sticky text properties.
1378 (gnus-group-remove-excess-properties)))
1380 (defun gnus-group-highlight-line ()
1381 "Highlight the current line according to `gnus-group-highlight'."
1382 (let* ((list gnus-group-highlight)
1384 (end (progn (end-of-line) (point)))
1385 ;; now find out where the line starts and leave point there.
1386 (beg (progn (beginning-of-line) (point)))
1387 (group (gnus-group-group-name))
1388 (entry (gnus-group-entry group))
1389 (unread (if (numberp (car entry)) (car entry) 0))
1390 (active (gnus-active group))
1391 (total (if active (1+ (- (cdr active) (car active))) 0))
1392 (info (nth 2 entry))
1393 (method (gnus-server-get-method group (gnus-info-method info)))
1394 (marked (gnus-info-marks info))
1395 (mailp (apply 'append
1398 (memq x (assoc (symbol-name
1399 (car (or method gnus-select-method)))
1400 gnus-valid-select-methods)))
1401 '(mail post-mail))))
1402 (level (or (gnus-info-level info) gnus-level-killed))
1403 (score (or (gnus-info-score info) 0))
1404 (ticked (gnus-range-length (cdr (assq 'tick marked))))
1405 (group-age (gnus-group-timestamp-delta group))
1406 (inhibit-read-only t))
1407 ;; Eval the cars of the lists until we find a match.
1409 (not (eval (caar list))))
1410 (setq list (cdr list)))
1411 (let ((face (cdar list)))
1412 (unless (eq face (get-text-property beg 'face))
1413 (gnus-put-text-property-excluding-characters-with-faces
1415 (setq face (if (boundp face) (symbol-value face) face)))
1416 (gnus-extent-start-open beg)))
1419 (defun gnus-group-update-group (group &optional visible-only)
1420 "Update all lines where GROUP appear.
1421 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1423 ;; Can't use `save-excursion' here, so we do it manually.
1424 (let ((buf (current-buffer))
1426 (set-buffer gnus-group-buffer)
1427 (setq mark (point-marker))
1428 ;; The buffer may be narrowed.
1431 (let ((ident (gnus-intern-safe group gnus-active-hashtb))
1433 found buffer-read-only)
1434 ;; Enter the current status into the dribble buffer.
1435 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)))
1437 (not (gnus-ephemeral-group-p group)))
1439 (concat "(gnus-group-set-info '"
1440 (gnus-prin1-to-string (nth 2 entry))
1442 ;; Find all group instances. If topics are in use, each group
1443 ;; may be listed in more than once.
1444 (while (setq loc (text-property-any
1445 loc (point-max) 'gnus-group ident))
1448 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1450 (gnus-group-insert-group-line-info group)
1453 (gnus-run-hooks 'gnus-group-update-group-hook)))
1454 (setq loc (1+ loc)))
1455 (unless (or found visible-only)
1456 ;; No such line in the buffer, find out where it's supposed to
1457 ;; go, and insert it there (or at the end of the buffer).
1458 (if gnus-goto-missing-group-function
1459 (funcall gnus-goto-missing-group-function group)
1460 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb))))
1461 (while (and entry (car entry)
1465 (point-min) (point-max)
1466 'gnus-group (gnus-intern-safe
1467 (caar entry) gnus-active-hashtb)))))
1468 (setq entry (cdr entry)))
1469 (or entry (goto-char (point-max)))))
1470 ;; Finally insert the line.
1471 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1472 (gnus-group-insert-group-line-info group)
1475 (gnus-run-hooks 'gnus-group-update-group-hook))))
1476 (when gnus-group-update-group-function
1477 (funcall gnus-group-update-group-function group))
1478 (gnus-group-set-mode-line)))
1480 (set-marker mark nil)
1483 (defun gnus-group-set-mode-line ()
1484 "Update the mode line in the group buffer."
1485 (when (memq 'group gnus-updated-mode-lines)
1486 ;; Yes, we want to keep this mode line updated.
1488 (set-buffer gnus-group-buffer)
1489 (let* ((gformat (or gnus-group-mode-line-format-spec
1490 (gnus-set-format 'group-mode)))
1491 (gnus-tmp-news-server (cadr gnus-select-method))
1492 (gnus-tmp-news-method (car gnus-select-method))
1493 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":"))
1495 gnus-tmp-header ;Dummy binding for user-defined formats
1496 ;; Get the resulting string.
1498 (and gnus-dribble-buffer
1499 (buffer-name gnus-dribble-buffer)
1500 (buffer-modified-p gnus-dribble-buffer)
1502 (set-buffer gnus-dribble-buffer)
1503 (not (zerop (buffer-size))))))
1504 (mode-string (eval gformat)))
1505 ;; Say whether the dribble buffer has been modified.
1506 (setq mode-line-modified
1507 (if modified (car gnus-mode-line-modified)
1508 (cdr gnus-mode-line-modified)))
1509 ;; If the line is too long, we chop it off.
1510 (when (> (length mode-string) max-len)
1511 (setq mode-string (substring mode-string 0 (- max-len 4))))
1513 (setq mode-line-buffer-identification
1514 (gnus-mode-line-buffer-identification
1515 (list mode-string)))
1516 (set-buffer-modified-p modified))))))
1518 (defun gnus-group-group-name ()
1519 "Get the name of the newsgroup on the current line."
1520 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group)))
1522 (symbol-name group))))
1524 (defun gnus-group-group-level ()
1525 "Get the level of the newsgroup on the current line."
1526 (get-text-property (gnus-point-at-bol) 'gnus-level))
1528 (defun gnus-group-group-indentation ()
1529 "Get the indentation of the newsgroup on the current line."
1530 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation)
1531 (and gnus-group-indentation-function
1532 (funcall gnus-group-indentation-function))
1535 (defun gnus-group-group-unread ()
1536 "Get the number of unread articles of the newsgroup on the current line."
1537 (get-text-property (gnus-point-at-bol) 'gnus-unread))
1539 (defun gnus-group-new-mail (group)
1540 (if (nnmail-new-mail-p (gnus-group-real-name group))
1544 (defun gnus-group-level (group)
1545 "Return the estimated level of GROUP."
1546 (or (gnus-info-level (gnus-get-info group))
1547 (and (member group gnus-zombie-list) gnus-level-zombie)
1550 (defun gnus-group-search-forward (&optional backward all level first-too)
1551 "Find the next newsgroup with unread articles.
1552 If BACKWARD is non-nil, find the previous newsgroup instead.
1553 If ALL is non-nil, just find any newsgroup.
1554 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1556 If FIRST-TOO, the current line is also eligible as a target."
1557 (let ((way (if backward -1 1))
1558 (low gnus-level-killed)
1561 (if (and backward (progn (beginning-of-line)) (bobp))
1570 (get-text-property (point) 'gnus-group)
1574 (get-text-property (point) 'gnus-unread)))
1575 (and (numberp unread) (> unread 0)))
1576 (setq lev (get-text-property (point)
1578 (<= lev gnus-level-subscribed)))
1580 (and (setq lev (get-text-property (point)
1589 (zerop (forward-line way)))))
1591 (progn (gnus-group-position-point) t)
1592 (goto-char (or pos beg))
1595 ;;; Gnus group mode commands
1599 (defun gnus-group-mark-line-p ()
1602 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1603 (eq (char-after) gnus-process-mark)))
1605 (defun gnus-group-mark-group (n &optional unmark no-advance)
1606 "Mark the current group."
1608 (let ((buffer-read-only nil)
1612 (when (setq group (gnus-group-group-name))
1613 ;; Go to the mark position.
1615 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2))
1616 (subst-char-in-region
1617 (point) (1+ (point)) (char-after)
1620 (setq gnus-group-marked (delete group gnus-group-marked))
1622 (setq gnus-group-marked
1623 (cons group (delete group gnus-group-marked)))
1624 gnus-process-mark)))
1626 (gnus-group-next-group 1))
1628 (gnus-summary-position-point)
1631 (defun gnus-group-unmark-group (n)
1632 "Remove the mark from the current group."
1634 (gnus-group-mark-group n 'unmark)
1635 (gnus-group-position-point))
1637 (defun gnus-group-unmark-all-groups ()
1638 "Unmark all groups."
1640 (let ((groups gnus-group-marked))
1643 (gnus-group-remove-mark (pop groups)))))
1644 (gnus-group-position-point))
1646 (defun gnus-group-mark-region (unmark beg end)
1647 "Mark all groups between point and mark.
1648 If UNMARK, remove the mark instead."
1649 (interactive "P\nr")
1650 (let ((num (count-lines beg end)))
1653 (- num (gnus-group-mark-group num unmark)))))
1655 (defun gnus-group-mark-buffer (&optional unmark)
1656 "Mark all groups in the buffer.
1657 If UNMARK, remove the mark instead."
1659 (gnus-group-mark-region unmark (point-min) (point-max)))
1661 (defun gnus-group-mark-regexp (regexp)
1662 "Mark all groups that match some regexp."
1663 (interactive "sMark (regexp): ")
1664 (let ((alist (cdr gnus-newsrc-alist))
1667 (when (string-match regexp (setq group (gnus-info-group (pop alist))))
1668 (gnus-group-set-mark group))))
1669 (gnus-group-position-point))
1671 (defun gnus-group-remove-mark (group &optional test-marked)
1672 "Remove the process mark from GROUP and move point there.
1673 Return nil if the group isn't displayed."
1674 (if (gnus-group-goto-group group nil test-marked)
1676 (gnus-group-mark-group 1 'unmark t)
1678 (setq gnus-group-marked
1679 (delete group gnus-group-marked))
1682 (defun gnus-group-set-mark (group)
1683 "Set the process mark on GROUP."
1684 (if (gnus-group-goto-group group)
1686 (gnus-group-mark-group 1 nil t))
1687 (setq gnus-group-marked (cons group (delete group gnus-group-marked)))))
1689 (defun gnus-group-universal-argument (arg &optional groups func)
1690 "Perform any command on all groups according to the process/prefix convention."
1692 (if (eq (setq func (or func
1695 (substitute-command-keys
1696 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1698 (gnus-error 1 "Undefined key")
1699 (gnus-group-iterate arg
1701 (command-execute func))))
1702 (gnus-group-position-point))
1704 (defun gnus-group-process-prefix (n)
1705 "Return a list of groups to work on.
1706 Take into consideration N (the prefix) and the list of marked groups."
1709 (setq n (prefix-numeric-value n))
1710 ;; There is a prefix, so we return a list of the N next
1712 (let ((way (if (< n 0) -1 1))
1717 (if (setq group (gnus-group-group-name))
1718 (push group groups))
1720 (gnus-group-next-group way)))
1722 ((gnus-region-active-p)
1723 ;; Work on the region between point and mark.
1724 (let ((max (max (point) (mark)))
1727 (goto-char (min (point) (mark)))
1730 (push (gnus-group-group-name) groups)
1731 (zerop (gnus-group-next-group 1))
1733 (nreverse groups))))
1735 ;; No prefix, but a list of marked articles.
1736 (reverse gnus-group-marked))
1738 ;; Neither marked articles or a prefix, so we return the
1740 (let ((group (gnus-group-group-name)))
1741 (and group (list group))))))
1743 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1744 ;;; imagine why I went through these contortions...
1746 (let ((function (make-symbol "gnus-group-iterate-function"))
1747 (window (make-symbol "gnus-group-iterate-window"))
1748 (groups (make-symbol "gnus-group-iterate-groups"))
1749 (group (make-symbol "gnus-group-iterate-group")))
1751 `(defun gnus-group-iterate (arg ,function)
1752 "Iterate FUNCTION over all process/prefixed groups.
1753 FUNCTION will be called with the group name as the parameter
1754 and with point over the group in question."
1755 (let ((,groups (gnus-group-process-prefix arg))
1756 (,window (selected-window))
1759 (setq ,group (car ,groups)
1760 ,groups (cdr ,groups))
1761 (select-window ,window)
1762 (gnus-group-remove-mark ,group)
1763 (save-selected-window
1765 (funcall ,function ,group)))))))))
1767 (put 'gnus-group-iterate 'lisp-indent-function 1)
1769 ;; Selecting groups.
1771 (defun gnus-group-read-group (&optional all no-article group select-articles)
1772 "Read news in this newsgroup.
1773 If the prefix argument ALL is non-nil, already read articles become
1774 readable. IF ALL is a number, fetch this number of articles. If the
1775 optional argument NO-ARTICLE is non-nil, no article will be
1776 auto-selected upon group entry. If GROUP is non-nil, fetch that
1779 (let ((no-display (eq all 0))
1780 (group (or group (gnus-group-group-name)))
1781 number active marked entry)
1785 (error "No group on current line"))
1786 (setq marked (gnus-info-marks
1787 (nth 2 (setq entry (gnus-gethash
1788 group gnus-newsrc-hashtb)))))
1789 ;; This group might be a dead group. In that case we have to get
1790 ;; the number of unread articles from `gnus-active-hashtb'.
1792 (cond ((numberp all) all)
1794 ((setq active (gnus-active group))
1795 (- (1+ (cdr active)) (car active)))))
1796 (gnus-summary-read-group
1797 group (or all (and (numberp number)
1798 (zerop (+ number (gnus-range-length
1799 (cdr (assq 'tick marked)))
1801 (cdr (assq 'dormant marked)))))))
1802 no-article nil no-display nil select-articles)))
1804 (defun gnus-group-select-group (&optional all)
1805 "Select this newsgroup.
1806 No article is selected automatically.
1807 If the group is opened, just switch the summary buffer.
1808 If ALL is non-nil, already read articles become readable.
1809 If ALL is a number, fetch this number of articles."
1811 (gnus-group-read-group all t))
1813 (defun gnus-group-quick-select-group (&optional all)
1814 "Select the current group \"quickly\".
1815 This means that no highlighting or scoring will be performed.
1816 If ALL (the prefix argument) is 0, don't even generate the summary
1819 This might be useful if you want to toggle threading
1820 before entering the group."
1822 (require 'gnus-score)
1824 gnus-score-find-score-files-function
1825 gnus-home-score-file
1826 gnus-apply-kill-hook
1827 gnus-summary-expunge-below)
1828 (gnus-group-read-group all t)))
1830 (defun gnus-group-visible-select-group (&optional all)
1831 "Select the current group without hiding any articles."
1833 (let ((gnus-inhibit-limiting t))
1834 (gnus-group-read-group all t)))
1836 (defun gnus-group-select-group-ephemerally ()
1837 "Select the current group without doing any processing whatsoever.
1838 You will actually be entered into a group that's a copy of
1839 the current group; no changes you make while in this group will
1842 (require 'gnus-score)
1844 gnus-score-find-score-files-function gnus-apply-kill-hook
1845 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1846 gnus-summary-mode-hook gnus-select-group-hook
1847 (group (gnus-group-group-name))
1848 (method (gnus-find-method-for-group group)))
1849 (gnus-group-read-ephemeral-group
1850 (gnus-group-prefixed-name group method) method)))
1853 (defun gnus-fetch-group (group)
1854 "Start Gnus if necessary and enter GROUP.
1855 Returns whether the fetching was successful or not."
1856 (interactive (list (completing-read "Group name: " gnus-active-hashtb)))
1857 (unless (get-buffer gnus-group-buffer)
1859 (gnus-group-read-group nil nil group))
1862 (defun gnus-fetch-group-other-frame (group)
1863 "Pop up a frame and enter GROUP."
1865 (let ((window (get-buffer-window gnus-group-buffer)))
1867 (select-frame (window-frame window)))
1868 ((= (length (frame-list)) 1)
1869 (select-frame (make-frame)))
1872 (gnus-fetch-group group))
1874 (defvar gnus-ephemeral-group-server 0)
1876 ;; Enter a group that is not in the group buffer. Non-nil is returned
1877 ;; if selection was successful.
1878 (defun gnus-group-read-ephemeral-group (group method &optional activate
1879 quit-config request-only
1881 "Read GROUP from METHOD as an ephemeral group.
1882 If ACTIVATE, request the group first.
1883 If QUIT-CONFIG, use that window configuration when exiting from the
1885 If REQUEST-ONLY, don't actually read the group; just request it.
1886 If SELECT-ARTICLES, only select those articles.
1888 Return the name of the group if selection was successful."
1889 ;; Transform the select method into a unique server.
1890 (when (stringp method)
1891 (setq method (gnus-server-to-method method)))
1893 `(,(car method) ,(concat (cadr method) "-ephemeral")
1894 (,(intern (format "%s-address" (car method))) ,(cadr method))
1896 (let ((group (if (gnus-group-foreign-p group) group
1897 (gnus-group-prefixed-name group method))))
1901 ,gnus-level-default-subscribed nil nil ,method
1903 ,(if quit-config quit-config
1904 (cons gnus-summary-buffer
1905 gnus-current-window-configuration))))))
1907 (push method gnus-ephemeral-servers)
1908 (set-buffer gnus-group-buffer)
1909 (unless (gnus-check-server method)
1910 (error "Unable to contact server: %s" (gnus-status-message method)))
1912 (gnus-activate-group group 'scan)
1913 (unless (gnus-request-group group)
1914 (error "Couldn't request group: %s"
1915 (nnheader-get-report (car method)))))
1919 (when (gnus-group-read-group t t group select-articles)
1923 (message "Quit reading the ephemeral group")
1926 (defun gnus-group-jump-to-group (group)
1927 "Jump to newsgroup GROUP."
1929 (list (completing-read
1930 "Group: " gnus-active-hashtb nil
1931 (gnus-read-active-file-p)
1932 gnus-group-jump-to-group-prompt
1933 'gnus-group-history)))
1935 (when (equal group "")
1936 (error "Empty group name"))
1938 (unless (gnus-ephemeral-group-p group)
1939 ;; Either go to the line in the group buffer...
1940 (unless (gnus-group-goto-group group)
1941 ;; ... or insert the line.
1942 (gnus-group-update-group group)
1943 (gnus-group-goto-group group)))
1944 ;; Adjust cursor point.
1945 (gnus-group-position-point))
1947 (defun gnus-group-goto-group (group &optional far test-marked)
1948 "Goto to newsgroup GROUP.
1949 If FAR, it is likely that the group is not on the current line.
1950 If TEST-MARKED, the line must be marked."
1954 ;; It's quite likely that we are on the right line, so
1955 ;; we check the current line first.
1957 (eq (get-text-property (point) 'gnus-group)
1958 (gnus-intern-safe group gnus-active-hashtb))
1959 (or (not test-marked) (gnus-group-mark-line-p)))
1961 ;; Previous and next line are also likely, so we check them as well.
1965 (and (eq (get-text-property (point) 'gnus-group)
1966 (gnus-intern-safe group gnus-active-hashtb))
1967 (or (not test-marked) (gnus-group-mark-line-p)))))
1973 (and (eq (get-text-property (point) 'gnus-group)
1974 (gnus-intern-safe group gnus-active-hashtb))
1975 (or (not test-marked) (gnus-group-mark-line-p)))))
1979 (goto-char (point-min))
1981 (while (and (not found)
1986 (gnus-intern-safe group gnus-active-hashtb))))
1987 (if (gnus-group-mark-line-p)
1992 ;; Search through the entire buffer.
1995 (point-min) (point-max)
1996 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))))))
1998 (defun gnus-group-next-group (n &optional silent)
1999 "Go to next N'th newsgroup.
2000 If N is negative, search backward instead.
2001 Returns the difference between N and the number of skips actually
2004 (gnus-group-next-unread-group n t nil silent))
2006 (defun gnus-group-next-unread-group (n &optional all level silent)
2007 "Go to next N'th unread newsgroup.
2008 If N is negative, search backward instead.
2009 If ALL is non-nil, choose any newsgroup, unread or not.
2010 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
2011 such group can be found, the next group with a level higher than
2013 Returns the difference between N and the number of skips actually
2016 (let ((backward (< n 0))
2019 (gnus-group-search-forward
2020 backward (or (not gnus-group-goto-unread) all) level))
2024 (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread")
2025 (if level " on this level or higher" "")))
2028 (defun gnus-group-prev-group (n)
2029 "Go to previous N'th newsgroup.
2030 Returns the difference between N and the number of skips actually
2033 (gnus-group-next-unread-group (- n) t))
2035 (defun gnus-group-prev-unread-group (n)
2036 "Go to previous N'th unread newsgroup.
2037 Returns the difference between N and the number of skips actually
2040 (gnus-group-next-unread-group (- n)))
2042 (defun gnus-group-next-unread-group-same-level (n)
2043 "Go to next N'th unread newsgroup on the same level.
2044 If N is negative, search backward instead.
2045 Returns the difference between N and the number of skips actually
2048 (gnus-group-next-unread-group n t (gnus-group-group-level))
2049 (gnus-group-position-point))
2051 (defun gnus-group-prev-unread-group-same-level (n)
2052 "Go to next N'th unread newsgroup on the same level.
2053 Returns the difference between N and the number of skips actually
2056 (gnus-group-next-unread-group (- n) t (gnus-group-group-level))
2057 (gnus-group-position-point))
2059 (defun gnus-group-best-unread-group (&optional exclude-group)
2060 "Go to the group with the highest level.
2061 If EXCLUDE-GROUP, do not go to that group."
2063 (goto-char (point-min))
2067 (setq unread (get-text-property (point) 'gnus-unread))
2068 (when (and (numberp unread) (> unread 0))
2069 (when (and (get-text-property (point) 'gnus-level)
2070 (< (get-text-property (point) 'gnus-level) best)
2071 (or (not exclude-group)
2072 (not (equal exclude-group (gnus-group-group-name)))))
2073 (setq best (get-text-property (point) 'gnus-level))
2074 (setq best-point (point))))
2077 (goto-char best-point))
2078 (gnus-summary-position-point)
2079 (and best-point (gnus-group-group-name))))
2081 (defun gnus-group-first-unread-group ()
2082 "Go to the first group with unread articles."
2085 (let ((opoint (point))
2087 (goto-char (point-min))
2088 (if (or (eq (setq unread (gnus-group-group-unread)) t) ; Not active.
2089 (and (numberp unread) ; Not a topic.
2090 (not (zerop unread))) ; Has unread articles.
2091 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2094 nil)) ; Not success.
2095 (gnus-group-position-point)))
2097 (defun gnus-group-enter-server-mode ()
2098 "Jump to the server buffer."
2100 (gnus-enter-server-buffer))
2102 (defun gnus-group-make-group (name &optional method address args)
2103 "Add a new newsgroup.
2104 The user will be prompted for a NAME, for a select METHOD, and an
2108 (gnus-read-group "Group name: ")
2109 (gnus-read-method "From method: ")))
2111 (when (stringp method)
2112 (setq method (or (gnus-server-to-method method) method)))
2113 (let* ((meth (gnus-method-simplify
2115 (not (gnus-server-equal method gnus-select-method)))
2116 (if address (list (intern method) address)
2118 (nname (if method (gnus-group-prefixed-name name meth) name))
2120 (when (gnus-gethash nname gnus-newsrc-hashtb)
2121 (error "Group %s already exists" nname))
2122 ;; Subscribe to the new group.
2123 (gnus-group-change-level
2124 (setq info (list t nname gnus-level-default-subscribed nil nil meth))
2125 gnus-level-default-subscribed gnus-level-killed
2126 (and (gnus-group-group-name)
2127 (gnus-gethash (gnus-group-group-name)
2128 gnus-newsrc-hashtb))
2131 (gnus-set-active nname (cons 1 0))
2132 (unless (gnus-ephemeral-group-p name)
2134 (concat "(gnus-group-set-info '"
2135 (gnus-prin1-to-string (cdr info)) ")")))
2137 (gnus-group-insert-group-line-info nname)
2139 (gnus-group-position-point)
2141 ;; Load the backend and try to make the backend create
2142 ;; the group as well.
2143 (when (assoc (symbol-name (setq backend (car (gnus-server-get-method
2145 gnus-valid-select-methods)
2147 (gnus-check-server meth)
2148 (when (gnus-check-backend-function 'request-create-group nname)
2149 (gnus-request-create-group nname nil args))
2152 (defun gnus-group-delete-groups (&optional arg)
2153 "Delete the current group. Only meaningful with editable groups."
2155 (let ((n (length (gnus-group-process-prefix arg))))
2156 (when (gnus-yes-or-no-p
2158 "Delete this 1 group? "
2159 (format "Delete these %d groups? " n)))
2160 (gnus-group-iterate arg
2162 (gnus-group-delete-group group nil t))))))
2164 (defun gnus-group-delete-group (group &optional force no-prompt)
2165 "Delete the current group. Only meaningful with editable groups.
2166 If FORCE (the prefix) is non-nil, all the articles in the group will
2167 be deleted. This is \"deleted\" as in \"removed forever from the face
2168 of the Earth\". There is no undo. The user will be prompted before
2169 doing the deletion."
2171 (list (gnus-group-group-name)
2172 current-prefix-arg))
2174 (error "No group to delete"))
2175 (unless (gnus-check-backend-function 'request-delete-group group)
2176 (error "This backend does not support group deletion"))
2178 (if (and (not no-prompt)
2179 (not (gnus-yes-or-no-p
2181 "Do you really want to delete %s%s? "
2182 group (if force " and all its contents" "")))))
2184 (gnus-message 6 "Deleting group %s..." group)
2185 (if (not (gnus-request-delete-group group force))
2186 (gnus-error 3 "Couldn't delete group %s" group)
2187 (gnus-message 6 "Deleting group %s...done" group)
2188 (gnus-group-goto-group group)
2189 (gnus-group-kill-group 1 t)
2190 (gnus-sethash group nil gnus-active-hashtb)
2192 (gnus-group-position-point)))
2194 (defun gnus-group-rename-group (group new-name)
2195 "Rename group from GROUP to NEW-NAME.
2196 When used interactively, GROUP is the group under point
2197 and NEW-NAME will be prompted for."
2200 (gnus-group-group-name)
2202 (unless (gnus-check-backend-function
2203 'request-rename-group (gnus-group-group-name))
2204 (error "This backend does not support renaming groups"))
2205 (gnus-read-group "Rename group to: "
2206 (gnus-group-real-name (gnus-group-group-name))))))
2208 (unless (gnus-check-backend-function 'request-rename-group group)
2209 (error "This backend does not support renaming groups"))
2211 (error "No group to rename"))
2212 (when (equal (gnus-group-real-name group) new-name)
2213 (error "Can't rename to the same name"))
2215 ;; We find the proper prefixed name.
2217 (if (gnus-group-native-p group)
2221 (gnus-group-prefixed-name
2222 (gnus-group-real-name new-name)
2223 (gnus-info-method (gnus-get-info group)))))
2225 (gnus-message 6 "Renaming group %s to %s..." group new-name)
2228 (gnus-group-goto-group group)
2229 (not (when (< (gnus-group-group-level) gnus-level-zombie)
2230 (gnus-request-rename-group group new-name))))
2231 (gnus-error 3 "Couldn't rename group %s to %s" group new-name)
2232 ;; We rename the group internally by killing it...
2233 (gnus-group-kill-group)
2234 ;; ... changing its name ...
2235 (setcar (cdar gnus-list-of-killed-groups) new-name)
2236 ;; ... and then yanking it. Magic!
2237 (gnus-group-yank-group)
2238 (gnus-set-active new-name (gnus-active group))
2239 (gnus-message 6 "Renaming group %s to %s...done" group new-name)
2241 (setq gnus-killed-list (delete group gnus-killed-list))
2242 (gnus-set-active group nil)
2243 (gnus-dribble-touch)
2244 (gnus-group-position-point)))
2246 (defun gnus-group-edit-group (group &optional part)
2247 "Edit the group on the current line."
2248 (interactive (list (gnus-group-group-name)))
2249 (let ((part (or part 'info))
2252 (error "No group on current line"))
2253 (unless (setq info (gnus-get-info group))
2254 (error "Killed group; can't be edited"))
2256 (gnus-close-group group))
2258 ;; Find the proper form to edit.
2259 (cond ((eq part 'method)
2260 (or (gnus-info-method info) "native"))
2262 (gnus-info-params info))
2264 ;; The proper documentation.
2266 "Editing the %s for `%s'."
2268 ((eq part 'method) "select method")
2269 ((eq part 'params) "group parameters")
2271 (gnus-group-decoded-name group))
2273 (gnus-group-edit-group-done ',part ,group form)))
2276 (gnus-create-info-command
2279 "(gnus)Select Methods")
2281 "(gnus)Group Parameters")
2283 "(gnus)Group Info"))))))
2285 (defun gnus-group-edit-group-method (group)
2286 "Edit the select method of GROUP."
2287 (interactive (list (gnus-group-group-name)))
2288 (gnus-group-edit-group group 'method))
2290 (defun gnus-group-edit-group-parameters (group)
2291 "Edit the group parameters of GROUP."
2292 (interactive (list (gnus-group-group-name)))
2293 (gnus-group-edit-group group 'params))
2295 (defun gnus-group-edit-group-done (part group form)
2297 (let* ((method (cond ((eq part 'info) (nth 4 form))
2298 ((eq part 'method) form)
2300 (info (cond ((eq part 'info) form)
2301 ((eq part 'method) (gnus-get-info group))
2304 (if (or (not method)
2306 gnus-select-method method))
2307 (gnus-group-real-name (car info))
2308 (gnus-group-prefixed-name
2309 (gnus-group-real-name (car info)) method))
2311 (when (and new-group
2312 (not (equal new-group group)))
2313 (when (gnus-group-goto-group group)
2314 (gnus-group-kill-group 1))
2315 (gnus-activate-group new-group))
2317 (if (not (and info new-group))
2318 (gnus-group-set-info form (or new-group group) part)
2319 (setq info (gnus-copy-sequence info))
2320 (setcar info new-group)
2321 (unless (gnus-server-equal method "native")
2322 (unless (nthcdr 3 info)
2323 (nconc info (list nil nil)))
2324 (unless (nthcdr 4 info)
2325 (nconc info (list nil)))
2326 (gnus-info-set-method info method))
2327 (gnus-group-set-info info))
2328 (gnus-group-update-group (or new-group group))
2329 (gnus-group-position-point)))
2331 (defun gnus-group-make-useful-group (group method)
2332 "Create one of the groups described in `gnus-useful-groups'."
2334 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2336 gnus-useful-groups)))
2337 (list (cadr entry) (caddr entry))))
2338 (setq method (gnus-copy-sequence method))
2340 (while (setq entry (memq (assq 'eval method) method))
2341 (setcar entry (eval (cadar entry)))))
2342 (gnus-group-make-group group method))
2344 (defun gnus-group-make-help-group ()
2345 "Create the Gnus documentation group."
2347 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2348 (file (nnheader-find-etc-directory "gnus-tut.txt" t)))
2349 (when (gnus-gethash name gnus-newsrc-hashtb)
2350 (error "Documentation group already exists"))
2352 (gnus-message 1 "Couldn't find doc group")
2353 (gnus-group-make-group
2354 (gnus-group-real-name name)
2355 (list 'nndoc "gnus-help"
2356 (list 'nndoc-address file)
2357 (list 'nndoc-article-type 'mbox)))))
2358 (gnus-group-position-point))
2360 (defun gnus-group-make-doc-group (file type)
2361 "Create a group that uses a single file as the source."
2363 (list (read-file-name "File name: ")
2364 (and current-prefix-arg 'ask)))
2365 (when (eq type 'ask)
2370 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: "
2372 (setq found (cond ((= (setq char (read-char)) ?m) 'mbox)
2373 ((= char ?b) 'babyl)
2374 ((= char ?d) 'digest)
2375 ((= char ?f) 'forward)
2377 ((= char ?g) 'guess)
2378 (t (setq err (format "%c unknown. " char))
2381 (let* ((file (expand-file-name file))
2382 (name (gnus-generate-new-group-name
2383 (gnus-group-prefixed-name
2384 (file-name-nondirectory file) '(nndoc "")))))
2385 (gnus-group-make-group
2386 (gnus-group-real-name name)
2388 (list 'nndoc-address file)
2389 (list 'nndoc-article-type (or type 'guess))))))
2391 (defvar nnweb-type-definition)
2392 (defvar gnus-group-web-type-history nil)
2393 (defvar gnus-group-web-search-history nil)
2394 (defun gnus-group-make-web-group (&optional solid)
2395 "Create an ephemeral nnweb group.
2396 If SOLID (the prefix), create a solid group."
2400 (if solid (gnus-read-group "Group name: ")
2401 (message-unique-id)))
2402 (default-type (or (car gnus-group-web-type-history)
2403 (symbol-name (caar nnweb-type-definition))))
2407 (format "Search engine type (default %s): " default-type)
2408 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2409 nnweb-type-definition)
2410 nil t nil 'gnus-group-web-type-history)
2415 (cons (or (car gnus-group-web-search-history) "") 0)
2416 'gnus-group-web-search-history))
2418 `(nnweb ,group (nnweb-search ,search)
2419 (nnweb-type ,(intern type))
2420 (nnweb-ephemeral-p t))))
2422 (gnus-group-make-group group "nnweb" "" `(,(intern type) ,search))
2423 (gnus-group-read-ephemeral-group
2425 (cons (current-buffer)
2426 (if (eq major-mode 'gnus-summary-mode) 'summary 'group))))))
2428 (defvar nnwarchive-type-definition)
2429 (defvar gnus-group-warchive-type-history nil)
2430 (defvar gnus-group-warchive-login-history nil)
2431 (defvar gnus-group-warchive-address-history nil)
2433 (defun gnus-group-make-warchive-group ()
2434 "Create a nnwarchive group."
2436 (require 'nnwarchive)
2437 (let* ((group (gnus-read-group "Group name: "))
2438 (default-type (or (car gnus-group-warchive-type-history)
2439 (symbol-name (caar nnwarchive-type-definition))))
2443 (format "Warchive type (default %s): " default-type)
2444 (mapcar (lambda (elem) (list (symbol-name (car elem))))
2445 nnwarchive-type-definition)
2446 nil t nil 'gnus-group-warchive-type-history)
2448 (address (read-string "Warchive address: "
2449 nil 'gnus-group-warchive-address-history))
2450 (default-login (or (car gnus-group-warchive-login-history)
2455 (format "Warchive login (default %s): " user-mail-address)
2456 default-login 'gnus-group-warchive-login-history)
2459 `(nnwarchive ,address
2460 (nnwarchive-type ,(intern type))
2461 (nnwarchive-login ,login))))
2462 (gnus-group-make-group group method)))
2464 (defun gnus-group-make-archive-group (&optional all)
2465 "Create the (ding) Gnus archive group of the most recent articles.
2466 Given a prefix, create a full group."
2468 (let ((group (gnus-group-prefixed-name
2469 (if all "ding.archives" "ding.recent") '(nndir ""))))
2470 (when (gnus-gethash group gnus-newsrc-hashtb)
2471 (error "Archive group already exists"))
2472 (gnus-group-make-group
2473 (gnus-group-real-name group)
2474 (list 'nndir (if all "hpc" "edu")
2475 (list 'nndir-directory
2476 (if all gnus-group-archive-directory
2477 gnus-group-recent-archive-directory))))
2478 (gnus-group-add-parameter group (cons 'to-address "ding@gnus.org"))))
2480 (defun gnus-group-make-directory-group (dir)
2481 "Create an nndir group.
2482 The user will be prompted for a directory. The contents of this
2483 directory will be used as a newsgroup. The directory should contain
2484 mail messages or news articles in files that have numeric names."
2486 (list (read-file-name "Create group from directory: ")))
2487 (unless (file-exists-p dir)
2488 (error "No such directory"))
2489 (unless (file-directory-p dir)
2490 (error "Not a directory"))
2494 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb))
2496 (gnus-group-prefixed-name
2497 (expand-file-name ext dir)
2499 (setq ext (format "<%d>" (setq i (1+ i)))))
2500 (gnus-group-make-group
2501 (gnus-group-real-name group)
2502 (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir)))))
2504 (eval-when-compile (defvar nnkiboze-score-file))
2505 (defun gnus-group-make-kiboze-group (group address scores)
2506 "Create an nnkiboze group.
2507 The user will be prompted for a name, a regexp to match groups, and
2508 score file entries for articles to include in the group."
2511 (read-string "nnkiboze group name: ")
2512 (read-string "Source groups (regexp): ")
2513 (let ((headers (mapcar (lambda (group) (list group))
2514 '("subject" "from" "number" "date" "message-id"
2515 "references" "chars" "lines" "xref"
2516 "followup" "all" "body" "head")))
2517 scores header regexp regexps)
2518 (while (not (equal "" (setq header (completing-read
2519 "Match on header: " headers nil t))))
2521 (while (not (equal "" (setq regexp (read-string
2522 (format "Match on %s (regexp): "
2524 (push (list regexp nil nil 'r) regexps))
2525 (push (cons header regexps) scores))
2527 (gnus-group-make-group group "nnkiboze" address)
2528 (let* ((nnkiboze-current-group group)
2529 (score-file (car (nnkiboze-score-file "")))
2530 (score-dir (file-name-directory score-file)))
2531 (unless (file-exists-p score-dir)
2532 (make-directory score-dir))
2533 (with-temp-file score-file
2534 (let (emacs-lisp-mode-hook)
2535 (pp scores (current-buffer))))))
2537 (defun gnus-group-add-to-virtual (n vgroup)
2538 "Add the current group to a virtual group."
2540 (list current-prefix-arg
2541 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2543 (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual)
2544 (error "%s is not an nnvirtual group" vgroup))
2545 (gnus-close-group vgroup)
2546 (let* ((groups (gnus-group-process-prefix n))
2547 (method (gnus-info-method (gnus-get-info vgroup))))
2548 (setcar (cdr method)
2550 (nth 1 method) "\\|"
2553 (gnus-group-remove-mark s)
2554 (concat "\\(^" (regexp-quote s) "$\\)"))
2556 (gnus-group-position-point))
2558 (defun gnus-group-make-empty-virtual (group)
2559 "Create a new, fresh, empty virtual group."
2560 (interactive "sCreate new, empty virtual group: ")
2561 (let* ((method (list 'nnvirtual "^$"))
2562 (pgroup (gnus-group-prefixed-name group method)))
2563 ;; Check whether it exists already.
2564 (when (gnus-gethash pgroup gnus-newsrc-hashtb)
2565 (error "Group %s already exists" pgroup))
2566 ;; Subscribe the new group after the group on the current line.
2567 (gnus-subscribe-group pgroup (gnus-group-group-name) method)
2568 (gnus-group-update-group pgroup)
2570 (gnus-group-position-point)))
2572 (defun gnus-group-enter-directory (dir)
2573 "Enter an ephemeral nneething group."
2574 (interactive "DDirectory to read: ")
2575 (let* ((method (list 'nneething dir '(nneething-read-only t)))
2576 (leaf (gnus-group-prefixed-name
2577 (file-name-nondirectory (directory-file-name dir))
2579 (name (gnus-generate-new-group-name leaf)))
2580 (unless (gnus-group-read-ephemeral-group
2582 (cons (current-buffer)
2583 (if (eq major-mode 'gnus-summary-mode)
2585 (error "Couldn't enter %s" dir))))
2588 (autoload 'nnimap-expunge "nnimap")
2589 (autoload 'nnimap-acl-get "nnimap")
2590 (autoload 'nnimap-acl-edit "nnimap"))
2592 (defun gnus-group-nnimap-expunge (group)
2593 "Expunge deleted articles in current nnimap GROUP."
2594 (interactive (list (gnus-group-group-name)))
2595 (let ((mailbox (gnus-group-real-name group)) method)
2597 (error "No group on current line"))
2598 (unless (gnus-get-info group)
2599 (error "Killed group; can't be edited"))
2600 (unless (eq 'nnimap (car (setq method (gnus-find-method-for-group group))))
2601 (error "%s is not an nnimap group" group))
2602 (nnimap-expunge mailbox (cadr method))))
2604 (defun gnus-group-nnimap-edit-acl (group)
2605 "Edit the Access Control List of current nnimap GROUP."
2606 (interactive (list (gnus-group-group-name)))
2607 (let ((mailbox (gnus-group-real-name group)) method acl)
2609 (error "No group on current line"))
2610 (unless (gnus-get-info group)
2611 (error "Killed group; can't be edited"))
2612 (unless (eq (car (setq method (gnus-find-method-for-group group))) 'nnimap)
2613 (error "%s is not an nnimap group" group))
2614 (unless (setq acl (nnimap-acl-get mailbox (cadr method)))
2615 (error "Server does not support ACL's"))
2616 (gnus-edit-form acl (format "Editing the access control list for `%s'.
2618 An access control list is a list of (identifier . rights) elements.
2620 The identifier string specifies the corresponding user. The
2621 identifier \"anyone\" is reserved to refer to the universal identity.
2623 Rights is a string listing a (possibly empty) set of alphanumeric
2624 characters, each character listing a set of operations which is being
2625 controlled. Letters are reserved for ``standard'' rights, listed
2626 below. Digits are reserved for implementation or site defined rights.
2628 l - lookup (mailbox is visible to LIST/LSUB commands)
2629 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2630 SEARCH, COPY from mailbox)
2631 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2632 w - write (STORE flags other than \\SEEN and \\DELETED)
2633 i - insert (perform APPEND, COPY into mailbox)
2634 p - post (send mail to submission address for mailbox,
2635 not enforced by IMAP4 itself)
2636 c - create and delete mailbox (CREATE new sub-mailboxes in any
2637 implementation-defined hierarchy, RENAME or DELETE mailbox)
2638 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2639 a - administer (perform SETACL)" group)
2642 ,mailbox ',method ',acl form)))))
2644 ;; Group sorting commands
2645 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2647 (defun gnus-group-sort-groups (func &optional reverse)
2648 "Sort the group buffer according to FUNC.
2649 When used interactively, the sorting function used will be
2650 determined by the `gnus-group-sort-function' variable.
2651 If REVERSE (the prefix), reverse the sorting order."
2652 (interactive (list gnus-group-sort-function current-prefix-arg))
2653 (funcall gnus-group-sort-alist-function
2654 (gnus-make-sort-function func) reverse)
2655 (gnus-group-unmark-all-groups)
2656 (gnus-group-list-groups)
2657 (gnus-dribble-touch))
2659 (defun gnus-group-sort-flat (func reverse)
2660 ;; We peel off the dummy group from the alist.
2662 (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group")
2663 (pop gnus-newsrc-alist))
2665 (setq gnus-newsrc-alist
2666 (sort gnus-newsrc-alist func))
2668 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist)))
2669 ;; Regenerate the hash table.
2670 (gnus-make-hashtable-from-newsrc-alist)))
2672 (defun gnus-group-sort-groups-by-alphabet (&optional reverse)
2673 "Sort the group buffer alphabetically by group name.
2674 If REVERSE, sort in reverse order."
2676 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse))
2678 (defun gnus-group-sort-groups-by-unread (&optional reverse)
2679 "Sort the group buffer by number of unread articles.
2680 If REVERSE, sort in reverse order."
2682 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse))
2684 (defun gnus-group-sort-groups-by-level (&optional reverse)
2685 "Sort the group buffer by group level.
2686 If REVERSE, sort in reverse order."
2688 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse))
2690 (defun gnus-group-sort-groups-by-score (&optional reverse)
2691 "Sort the group buffer by group score.
2692 If REVERSE, sort in reverse order."
2694 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse))
2696 (defun gnus-group-sort-groups-by-rank (&optional reverse)
2697 "Sort the group buffer by group rank.
2698 If REVERSE, sort in reverse order."
2700 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse))
2702 (defun gnus-group-sort-groups-by-method (&optional reverse)
2703 "Sort the group buffer alphabetically by backend name.
2704 If REVERSE, sort in reverse order."
2706 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse))
2708 (defun gnus-group-sort-groups-by-server (&optional reverse)
2709 "Sort the group buffer alphabetically by server name.
2710 If REVERSE, sort in reverse order."
2712 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse))
2714 ;;; Selected group sorting.
2716 (defun gnus-group-sort-selected-groups (n func &optional reverse)
2717 "Sort the process/prefixed groups."
2718 (interactive (list current-prefix-arg gnus-group-sort-function))
2719 (let ((groups (gnus-group-process-prefix n)))
2720 (funcall gnus-group-sort-selected-function
2721 groups (gnus-make-sort-function func) reverse)
2722 (gnus-group-unmark-all-groups)
2723 (gnus-group-list-groups)
2724 (gnus-dribble-touch)))
2726 (defun gnus-group-sort-selected-flat (groups func reverse)
2727 (let (entries infos)
2728 ;; First find all the group entries for these groups.
2730 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb))
2732 ;; Then sort the infos.
2736 (lambda (entry) (car entry))
2737 (setq entries (nreverse entries)))
2740 (setq infos (nreverse infos)))
2741 ;; Go through all the infos and replace the old entries
2742 ;; with the new infos.
2744 (setcar (car entries) (pop infos))
2746 ;; Update the hashtable.
2747 (gnus-make-hashtable-from-newsrc-alist)))
2749 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse)
2750 "Sort the group buffer alphabetically by group name.
2751 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2752 sort in reverse order."
2753 (interactive (gnus-interactive "P\ny"))
2754 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-alphabet reverse))
2756 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse)
2757 "Sort the group buffer by number of unread articles.
2758 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2759 sort in reverse order."
2760 (interactive (gnus-interactive "P\ny"))
2761 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-unread reverse))
2763 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse)
2764 "Sort the group buffer by group level.
2765 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2766 sort in reverse order."
2767 (interactive (gnus-interactive "P\ny"))
2768 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-level reverse))
2770 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse)
2771 "Sort the group buffer by group score.
2772 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2773 sort in reverse order."
2774 (interactive (gnus-interactive "P\ny"))
2775 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-score reverse))
2777 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse)
2778 "Sort the group buffer by group rank.
2779 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2780 sort in reverse order."
2781 (interactive (gnus-interactive "P\ny"))
2782 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-rank reverse))
2784 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse)
2785 "Sort the group buffer alphabetically by backend name.
2786 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2787 sort in reverse order."
2788 (interactive (gnus-interactive "P\ny"))
2789 (gnus-group-sort-selected-groups n 'gnus-group-sort-by-method reverse))
2791 ;;; Sorting predicates.
2793 (defun gnus-group-sort-by-alphabet (info1 info2)
2794 "Sort alphabetically."
2795 (string< (gnus-info-group info1) (gnus-info-group info2)))
2797 (defun gnus-group-sort-by-real-name (info1 info2)
2798 "Sort alphabetically on real (unprefixed) names."
2799 (string< (gnus-group-real-name (gnus-info-group info1))
2800 (gnus-group-real-name (gnus-info-group info2))))
2802 (defun gnus-group-sort-by-unread (info1 info2)
2803 "Sort by number of unread articles."
2804 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb)))
2805 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb))))
2806 (< (or (and (numberp n1) n1) 0)
2807 (or (and (numberp n2) n2) 0))))
2809 (defun gnus-group-sort-by-level (info1 info2)
2811 (< (gnus-info-level info1) (gnus-info-level info2)))
2813 (defun gnus-group-sort-by-method (info1 info2)
2814 "Sort alphabetically by backend name."
2815 (string< (symbol-name (car (gnus-find-method-for-group
2816 (gnus-info-group info1) info1)))
2817 (symbol-name (car (gnus-find-method-for-group
2818 (gnus-info-group info2) info2)))))
2820 (defun gnus-group-sort-by-server (info1 info2)
2821 "Sort alphabetically by server name."
2822 (string< (gnus-method-to-full-server-name
2823 (gnus-find-method-for-group
2824 (gnus-info-group info1) info1))
2825 (gnus-method-to-full-server-name
2826 (gnus-find-method-for-group
2827 (gnus-info-group info2) info2))))
2829 (defun gnus-group-sort-by-score (info1 info2)
2830 "Sort by group score."
2831 (> (gnus-info-score info1) (gnus-info-score info2)))
2833 (defun gnus-group-sort-by-rank (info1 info2)
2834 "Sort by level and score."
2835 (let ((level1 (gnus-info-level info1))
2836 (level2 (gnus-info-level info2)))
2837 (or (< level1 level2)
2838 (and (= level1 level2)
2839 (> (gnus-info-score info1) (gnus-info-score info2))))))
2843 (defun gnus-group-clear-data (&optional arg)
2844 "Clear all marks and read ranges from the current group."
2846 (gnus-group-iterate arg
2849 (gnus-info-clear-data (setq info (gnus-get-info group)))
2850 (gnus-get-unread-articles-in-group info (gnus-active group) t)
2851 (when (gnus-group-goto-group group)
2852 (gnus-group-update-group-line))))))
2854 (defun gnus-group-clear-data-on-native-groups ()
2855 "Clear all marks and read ranges from all native groups."
2857 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
2858 (let ((alist (cdr gnus-newsrc-alist))
2860 (while (setq info (pop alist))
2861 (when (gnus-group-native-p (gnus-info-group info))
2862 (gnus-info-clear-data info)))
2863 (gnus-get-unread-articles)
2864 (gnus-dribble-touch)
2865 (when (gnus-y-or-n-p
2866 "Move the cache away to avoid problems in the future? ")
2867 (call-interactively 'gnus-cache-move-cache)))))
2869 (defun gnus-info-clear-data (info)
2870 "Clear all marks and read ranges from INFO."
2871 (let ((group (gnus-info-group info))
2873 (dolist (el (gnus-info-marks info))
2874 (push `(,(cdr el) add (,(car el))) action))
2875 (push `(,(gnus-info-read info) add (read)) action)
2878 (gnus-request-set-mark ,group ',action)
2879 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
2880 (gnus-info-set-read ',info ',(gnus-info-read info))
2881 (when (gnus-group-goto-group ,group)
2882 (gnus-get-unread-articles-in-group ',info ',(gnus-active group) t)
2883 (gnus-group-update-group-line))))
2884 (setq action (mapcar (lambda (el) (list (nth 0 el) 'del (nth 2 el)))
2886 (gnus-request-set-mark group action)
2887 (gnus-info-set-read info nil)
2888 (when (gnus-info-marks info)
2889 (gnus-info-set-marks info nil))))
2891 ;; Group catching up.
2893 (defun gnus-group-catchup-current (&optional n all)
2894 "Mark all unread articles in the current newsgroup as read.
2895 If prefix argument N is numeric, the next N newsgroups will be
2896 caught up. If ALL is non-nil, marked articles will also be marked as
2897 read. Cross references (Xref: header) of articles are ignored.
2898 The number of newsgroups that this function was unable to catch
2901 (let ((groups (gnus-group-process-prefix n))
2904 (unless groups (error "No groups selected"))
2906 (or (not gnus-interactive-catchup) ;Without confirmation?
2911 "Do you really want to mark all articles in %s as read? "
2912 "Mark all unread articles in %s as read? ")
2913 (if (= (length groups) 1)
2915 (format "these %d groups" (length groups)))))))
2917 (while (setq group (pop groups))
2918 (gnus-group-remove-mark group)
2919 ;; Virtual groups have to be given special treatment.
2920 (let ((method (gnus-find-method-for-group group)))
2921 (when (eq 'nnvirtual (car method))
2922 (nnvirtual-catchup-group
2923 (gnus-group-real-name group) (nth 1 method) all)))
2924 (if (>= (gnus-group-level group) gnus-level-zombie)
2925 (gnus-message 2 "Dead groups can't be caught up")
2927 (gnus-group-goto-group group)
2928 (gnus-group-catchup group all))
2929 (gnus-group-update-group-line)
2930 (setq ret (1+ ret)))))
2931 (gnus-group-next-unread-group 1)
2934 (defun gnus-group-catchup-current-all (&optional n)
2935 "Mark all articles in current newsgroup as read.
2936 Cross references (Xref: header) of articles are ignored."
2938 (gnus-group-catchup-current n 'all))
2940 (defun gnus-group-catchup (group &optional all)
2941 "Mark all articles in GROUP as read.
2942 If ALL is non-nil, all articles are marked as read.
2943 The return value is the number of articles that were marked as read,
2944 or nil if no action could be taken."
2945 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
2947 (marks (nth 3 (nth 2 entry)))
2948 (unread (gnus-list-of-unread-articles group)))
2949 ;; Remove entries for this group.
2950 (nnmail-purge-split-history (gnus-group-real-name group))
2951 ;; Do the updating only if the newsgroup isn't killed.
2952 (if (not (numberp (car entry)))
2953 (gnus-message 1 "Can't catch up %s; non-active group" group)
2954 (gnus-update-read-articles group nil)
2956 ;; Nix out the lists of marks and dormants.
2957 (gnus-request-set-mark group (list (list (cdr (assq 'tick marks))
2959 (list (cdr (assq 'dormant marks))
2961 (setq unread (gnus-uncompress-range
2962 (gnus-range-add (gnus-range-add
2963 unread (cdr (assq 'dormant marks)))
2964 (cdr (assq 'tick marks)))))
2965 (gnus-add-marked-articles group 'tick nil nil 'force)
2966 (gnus-add-marked-articles group 'dormant nil nil 'force))
2967 ;; Do auto-expirable marks if that's required.
2968 (when (gnus-group-auto-expirable-p group)
2969 (gnus-add-marked-articles group 'expire unread)
2970 (gnus-request-set-mark group (list (list unread 'add '(expire)))))
2971 (let ((gnus-newsgroup-name group))
2972 (gnus-run-hooks 'gnus-group-catchup-group-hook))
2975 (defun gnus-group-expire-articles (&optional n)
2976 "Expire all expirable articles in the current newsgroup."
2978 (let ((groups (gnus-group-process-prefix n))
2981 (error "No groups to expire"))
2982 (while (setq group (pop groups))
2983 (gnus-group-remove-mark group)
2984 (gnus-group-expire-articles-1 group)
2985 (gnus-dribble-touch)
2986 (gnus-group-position-point))))
2988 (defun gnus-group-expire-articles-1 (group)
2989 (when (gnus-check-backend-function 'request-expire-articles group)
2990 (gnus-message 6 "Expiring articles in %s..." group)
2991 (let* ((info (gnus-get-info group))
2992 (expirable (if (gnus-group-total-expirable-p group)
2993 (cons nil (gnus-list-of-read-articles group))
2994 (assq 'expire (gnus-info-marks info))))
2995 (expiry-wait (gnus-group-find-parameter group 'expiry-wait))
2996 (nnmail-expiry-target
2997 (or (gnus-group-find-parameter group 'expiry-target)
2998 nnmail-expiry-target)))
3000 (gnus-check-group group)
3003 (gnus-compress-sequence
3005 ;; We set the expiry variables to the group
3007 (let ((nnmail-expiry-wait-function nil)
3008 (nnmail-expiry-wait expiry-wait))
3009 (gnus-request-expire-articles
3010 (gnus-uncompress-sequence (cdr expirable)) group))
3011 ;; Just expire using the normal expiry values.
3012 (gnus-request-expire-articles
3013 (gnus-uncompress-sequence (cdr expirable)) group))))
3014 (gnus-close-group group))
3015 (gnus-message 6 "Expiring articles in %s...done" group)
3016 ;; Return the list of un-expired articles.
3019 (defun gnus-group-expire-all-groups ()
3020 "Expire all expirable articles in all newsgroups."
3023 (gnus-message 5 "Expiring...")
3024 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info))
3025 (cdr gnus-newsrc-alist))))
3026 (gnus-group-expire-articles nil)))
3027 (gnus-group-position-point)
3028 (gnus-message 5 "Expiring...done"))
3030 (defun gnus-group-set-current-level (n level)
3031 "Set the level of the next N groups to LEVEL."
3036 (let ((s (read-string
3037 (format "Level (default %s): "
3038 (or (gnus-group-group-level)
3039 gnus-level-default-subscribed)))))
3040 (if (string-match "^\\s-*$" s)
3041 (int-to-string (or (gnus-group-group-level)
3042 gnus-level-default-subscribed))
3044 (unless (and (>= level 1) (<= level gnus-level-killed))
3045 (error "Invalid level: %d" level))
3046 (let ((groups (gnus-group-process-prefix n))
3048 (while (setq group (pop groups))
3049 (gnus-group-remove-mark group)
3050 (gnus-message 6 "Changed level of %s from %d to %d"
3051 group (or (gnus-group-group-level) gnus-level-killed)
3053 (gnus-group-change-level
3054 group level (or (gnus-group-group-level) gnus-level-killed))
3055 (gnus-group-update-group-line)))
3056 (gnus-group-position-point))
3058 (defun gnus-group-unsubscribe (&optional n)
3059 "Unsubscribe the current group."
3061 (gnus-group-unsubscribe-current-group n 'unsubscribe))
3063 (defun gnus-group-subscribe (&optional n)
3064 "Subscribe the current group."
3066 (gnus-group-unsubscribe-current-group n 'subscribe))
3068 (defun gnus-group-unsubscribe-current-group (&optional n do-sub)
3069 "Toggle subscription of the current group.
3070 If given numerical prefix, toggle the N next groups."
3072 (let ((groups (gnus-group-process-prefix n))
3075 (setq group (car groups)
3076 groups (cdr groups))
3077 (gnus-group-remove-mark group)
3078 (gnus-group-unsubscribe-group
3081 ((eq do-sub 'unsubscribe)
3082 gnus-level-default-unsubscribed)
3083 ((eq do-sub 'subscribe)
3084 gnus-level-default-subscribed)
3085 ((<= (gnus-group-group-level) gnus-level-subscribed)
3086 gnus-level-default-unsubscribed)
3088 gnus-level-default-subscribed))
3090 (gnus-group-update-group-line))
3091 (gnus-group-next-group 1)))
3093 (defun gnus-group-unsubscribe-group (group &optional level silent)
3094 "Toggle subscription to GROUP.
3095 Killed newsgroups are subscribed. If SILENT, don't try to update the
3098 (list (completing-read
3099 "Group: " gnus-active-hashtb nil
3100 (gnus-read-active-file-p)
3102 'gnus-group-history)))
3103 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb)))
3105 ((string-match "^[ \t]*$" group)
3106 (error "Empty group name"))
3108 ;; Toggle subscription flag.
3109 (gnus-group-change-level
3110 newsrc (if level level (if (<= (gnus-info-level (nth 2 newsrc))
3111 gnus-level-subscribed)
3112 (1+ gnus-level-subscribed)
3113 gnus-level-default-subscribed)))
3115 (gnus-group-update-group group)))
3116 ((and (stringp group)
3117 (or (not (gnus-read-active-file-p))
3118 (gnus-active group)))
3119 ;; Add new newsgroup.
3120 (gnus-group-change-level
3122 (if level level gnus-level-default-subscribed)
3123 (or (and (member group gnus-zombie-list)
3126 (when (gnus-group-group-name)
3127 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb)))
3129 (gnus-group-update-group group)))
3130 (t (error "No such newsgroup: %s" group)))
3131 (gnus-group-position-point)))
3133 (defun gnus-group-transpose-groups (n)
3134 "Move the current newsgroup up N places.
3135 If given a negative prefix, move down instead. The difference between
3136 N and the number of steps taken is returned."
3138 (unless (gnus-group-group-name)
3139 (error "No group on current line"))
3140 (gnus-group-kill-group 1)
3142 (forward-line (- n))
3143 (gnus-group-yank-group)
3144 (gnus-group-position-point)))
3146 (defun gnus-group-kill-all-zombies (&optional dummy)
3147 "Kill all zombie newsgroups.
3148 The optional DUMMY should always be nil."
3149 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3151 (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list))
3152 (setq gnus-zombie-list nil)
3153 (gnus-dribble-touch)
3154 (gnus-group-list-groups)))
3156 (defun gnus-group-kill-region (begin end)
3157 "Kill newsgroups in current region (excluding current point).
3158 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3173 (beginning-of-line) ;Important when LINES < 1
3174 (gnus-group-kill-group lines)))
3176 (defun gnus-group-kill-group (&optional n discard)
3177 "Kill the next N groups.
3178 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3179 However, only groups that were alive can be yanked; already killed
3180 groups or zombie groups can't be yanked.
3181 The return value is the name of the group that was killed, or a list
3184 (let ((buffer-read-only nil)
3185 (groups (gnus-group-process-prefix n))
3186 group entry level out)
3187 (if (< (length groups) 10)
3188 ;; This is faster when there are few groups.
3190 (push (setq group (pop groups)) out)
3191 (gnus-group-remove-mark group)
3192 (setq level (gnus-group-group-level))
3194 (when (and (not discard)
3195 (setq entry (gnus-gethash group gnus-newsrc-hashtb)))
3198 (gnus-group-goto-group ,(gnus-group-group-name))
3199 (gnus-group-yank-group)))
3200 (push (cons (car entry) (nth 2 entry))
3201 gnus-list-of-killed-groups))
3202 (gnus-group-change-level
3203 (if entry entry group) gnus-level-killed (if entry nil level))
3204 (message "Killed group %s" group))
3205 ;; If there are lots and lots of groups to be killed, we use
3206 ;; this thing instead.
3208 (setq groups (nreverse groups))
3210 (gnus-group-remove-mark (setq group (pop groups)))
3212 (push group gnus-killed-list)
3213 (setq gnus-newsrc-alist
3214 (delq (assoc group gnus-newsrc-alist)
3216 (when gnus-group-change-level-function
3217 (funcall gnus-group-change-level-function
3218 group gnus-level-killed 3))
3220 ((setq entry (gnus-gethash group gnus-newsrc-hashtb))
3221 (push (cons (car entry) (nth 2 entry))
3222 gnus-list-of-killed-groups)
3223 (setcdr (cdr entry) (cdddr entry)))
3224 ((member group gnus-zombie-list)
3225 (setq gnus-zombie-list (delete group gnus-zombie-list))))
3226 ;; There may be more than one instance displayed.
3227 (while (gnus-group-goto-group group)
3228 (gnus-delete-line)))
3229 (gnus-make-hashtable-from-newsrc-alist)))
3231 (gnus-group-position-point)
3232 (if (< (length out) 2) (car out) (nreverse out))))
3234 (defun gnus-group-yank-group (&optional arg)
3235 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3236 The numeric ARG specifies how many newsgroups are to be yanked. The
3237 name of the newsgroup yanked is returned, or (if several groups are
3238 yanked) a list of yanked groups is returned."
3240 (setq arg (or arg 1))
3241 (let (info group prev out)
3242 (while (>= (decf arg) 0)
3243 (when (not (setq info (pop gnus-list-of-killed-groups)))
3244 (error "No more newsgroups to yank"))
3245 (push (setq group (nth 1 info)) out)
3246 ;; Find which newsgroup to insert this one before - search
3247 ;; backward until something suitable is found. If there are no
3248 ;; other newsgroups in this buffer, just make this newsgroup the
3250 (setq prev (gnus-group-group-name))
3251 (gnus-group-change-level
3252 info (gnus-info-level (cdr info)) gnus-level-killed
3253 (and prev (gnus-gethash prev gnus-newsrc-hashtb))
3255 (gnus-group-insert-group-line-info group)
3257 `(when (gnus-group-goto-group ,group)
3258 (gnus-group-kill-group 1))))
3260 (gnus-group-position-point)
3261 (if (< (length out) 2) (car out) (nreverse out))))
3263 (defun gnus-group-kill-level (level)
3264 "Kill all groups that is on a certain LEVEL."
3265 (interactive "nKill all groups on level: ")
3267 ((= level gnus-level-zombie)
3268 (setq gnus-killed-list
3269 (nconc gnus-zombie-list gnus-killed-list))
3270 (setq gnus-zombie-list nil))
3271 ((and (< level gnus-level-zombie)
3273 (or gnus-expert-user
3276 "Do you really want to kill all groups on level %d? "
3278 (let* ((prev gnus-newsrc-alist)
3281 (if (= (gnus-info-level (car alist)) level)
3283 (push (gnus-info-group (car alist)) gnus-killed-list)
3284 (setcdr prev (cdr alist)))
3286 (setq alist (cdr alist)))
3287 (gnus-make-hashtable-from-newsrc-alist)
3288 (gnus-group-list-groups)))
3290 (error "Can't kill; invalid level: %d" level))))
3292 (defun gnus-group-list-all-groups (&optional arg)
3293 "List all newsgroups with level ARG or lower.
3294 Default is gnus-level-unsubscribed, which lists all subscribed and most
3295 unsubscribed groups."
3297 (gnus-group-list-groups (or arg gnus-level-unsubscribed) t))
3299 ;; Redefine this to list ALL killed groups if prefix arg used.
3300 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3301 (defun gnus-group-list-killed (&optional arg)
3302 "List all killed newsgroups in the group buffer.
3303 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3304 entail asking the server for the groups."
3306 ;; Find all possible killed newsgroups if arg.
3308 (gnus-get-killed-groups))
3309 (if (not gnus-killed-list)
3310 (gnus-message 6 "No killed groups")
3311 (let (gnus-group-list-mode)
3312 (funcall gnus-group-prepare-function
3313 gnus-level-killed t gnus-level-killed))
3314 (goto-char (point-min)))
3315 (gnus-group-position-point))
3317 (defun gnus-group-list-zombies ()
3318 "List all zombie newsgroups in the group buffer."
3320 (if (not gnus-zombie-list)
3321 (gnus-message 6 "No zombie groups")
3322 (let (gnus-group-list-mode)
3323 (funcall gnus-group-prepare-function
3324 gnus-level-zombie t gnus-level-zombie))
3325 (goto-char (point-min)))
3326 (gnus-group-position-point))
3328 (defun gnus-group-list-active ()
3329 "List all groups that are available from the server(s)."
3331 ;; First we make sure that we have really read the active file.
3332 (unless (gnus-read-active-file-p)
3333 (let ((gnus-read-active-file t)
3334 (gnus-agent nil)) ; Trick the agent into ignoring the active file.
3335 (gnus-read-active-file)))
3336 ;; Find all groups and sort them.
3344 (push (symbol-name sym) list)))
3348 (buffer-read-only nil)
3352 (setq group (pop groups))
3353 (gnus-add-text-properties
3354 (point) (prog1 (1+ (point))
3356 (gnus-group-decoded-name group)
3358 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
3360 'gnus-level (inline (gnus-group-level group)))))
3361 (goto-char (point-min))))
3363 (defun gnus-activate-all-groups (level)
3364 "Activate absolutely all groups."
3365 (interactive (list gnus-level-unsubscribed))
3366 (let ((gnus-activate-level level)
3367 (gnus-activate-foreign-newsgroups level))
3368 (gnus-group-get-new-news)))
3370 (defun gnus-group-get-new-news (&optional arg)
3371 "Get newly arrived articles.
3372 If ARG is a number, it specifies which levels you are interested in
3373 re-scanning. If ARG is non-nil and not a number, this will force
3374 \"hard\" re-reading of the active files from all servers."
3377 (let ((gnus-inhibit-demon t)
3378 ;; Binding this variable will inhibit multiple fetchings
3379 ;; of the same mail source.
3380 (nnmail-fetched-sources (list t)))
3381 (gnus-run-hooks 'gnus-get-new-news-hook)
3383 ;; Read any slave files.
3385 (gnus-master-read-slave-newsrc))
3387 ;; We might read in new NoCeM messages here.
3388 (when (and gnus-use-nocem
3390 (gnus-nocem-scan-groups))
3391 ;; If ARG is not a number, then we read the active file.
3392 (when (and arg (not (numberp arg)))
3393 (let ((gnus-read-active-file t))
3394 (gnus-read-active-file))
3397 ;; If the user wants it, we scan for new groups.
3398 (when (eq gnus-check-new-newsgroups 'always)
3399 (gnus-find-new-newsgroups)))
3401 (setq arg (gnus-group-default-level arg t))
3402 (if (and gnus-read-active-file (not arg))
3404 (gnus-read-active-file)
3405 (gnus-get-unread-articles arg))
3406 (let ((gnus-read-active-file (if arg nil gnus-read-active-file)))
3407 (gnus-get-unread-articles arg)))
3408 (gnus-run-hooks 'gnus-after-getting-new-news-hook)
3409 (gnus-group-list-groups (and (numberp arg)
3410 (max (car gnus-group-list-mode) arg))))
3412 (when (and gnus-agent (not (interactive-p)))
3413 (gnus-agent-toggle-plugged gnus-plugged)))
3415 (defun gnus-group-get-new-news-this-group (&optional n dont-scan)
3416 "Check for newly arrived news in the current group (and the N-1 next groups).
3417 The difference between N and the number of newsgroup checked is returned.
3418 If N is negative, this group and the N-1 previous groups will be checked."
3420 (let* ((groups (gnus-group-process-prefix n))
3421 (ret (if (numberp n) (- n (length groups)) 0))
3425 (gnus-inhibit-demon t)
3426 ;; Binding this variable will inhibit multiple fetchings
3427 ;; of the same mail source.
3428 (nnmail-fetched-sources (list t)))
3429 (gnus-run-hooks 'gnus-get-new-news-hook)
3430 (while (setq group (pop groups))
3431 (gnus-group-remove-mark group)
3432 ;; Bypass any previous denials from the server.
3433 (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
3434 (if (gnus-activate-group group (if dont-scan nil 'scan))
3436 (gnus-get-unread-articles-in-group
3437 (gnus-get-info group) (gnus-active group) t)
3438 (unless (gnus-virtual-group-p group)
3439 (gnus-close-group group))
3441 (gnus-agent-save-group-info
3442 method (gnus-group-real-name group) (gnus-active group)))
3443 (gnus-group-update-group group))
3444 (if (eq (gnus-server-status (gnus-find-method-for-group group))
3446 (gnus-error 3 "Server denied access")
3447 (gnus-error 3 "%s error: %s" group (gnus-status-message group)))))
3450 (when gnus-goto-next-group-when-activating
3451 (gnus-group-next-unread-group 1 t))
3452 (gnus-summary-position-point)
3455 (defun gnus-group-fetch-faq (group &optional faq-dir)
3456 "Fetch the FAQ for the current group.
3457 If given a prefix argument, prompt for the FAQ dir
3461 (gnus-group-group-name)
3462 (when current-prefix-arg
3464 "Faq dir: " (and (listp gnus-group-faq-directory)
3466 gnus-group-faq-directory))))))
3468 (error "No group name given"))
3469 (let ((dirs (or faq-dir gnus-group-faq-directory))
3471 (unless (listp dirs)
3472 (setq dirs (list dirs)))
3473 (while (and (not found)
3474 (setq dir (pop dirs)))
3475 (let ((name (gnus-group-real-name group)))
3476 (setq file (expand-file-name name dir)))
3477 (if (not (file-exists-p file))
3478 (gnus-message 1 "No such file: %s" file)
3479 (let ((enable-local-variables nil))
3483 (defun gnus-group-describe-group (force &optional group)
3484 "Display a description of the current newsgroup."
3485 (interactive (list current-prefix-arg (gnus-group-group-name)))
3486 (let* ((method (gnus-find-method-for-group group))
3487 (mname (gnus-group-prefixed-name "" method))
3490 gnus-description-hashtb)
3491 (gnus-sethash mname nil gnus-description-hashtb))
3493 (error "No group name given"))
3494 (when (or (and gnus-description-hashtb
3495 ;; We check whether this group's method has been
3496 ;; queried for a description file.
3497 (gnus-gethash mname gnus-description-hashtb))
3498 (setq desc (gnus-group-get-description group))
3499 (gnus-read-descriptions-file method))
3501 (or desc (gnus-gethash group gnus-description-hashtb)
3502 "No description available")))))
3504 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3505 (defun gnus-group-describe-all-groups (&optional force)
3506 "Pop up a buffer with descriptions of all newsgroups."
3509 (setq gnus-description-hashtb nil))
3510 (when (not (or gnus-description-hashtb
3511 (gnus-read-all-descriptions-files)))
3512 (error "Couldn't request descriptions file"))
3513 (let ((buffer-read-only nil)
3519 (let ((charset (gnus-group-name-charset nil (symbol-name group))))
3520 (insert (format " *: %-20s %s\n"
3521 (gnus-group-name-decode
3522 (symbol-name group) charset)
3523 (gnus-group-name-decode
3524 (symbol-value group) charset))))
3525 (gnus-add-text-properties
3526 b (1+ b) (list 'gnus-group group
3527 'gnus-unread t 'gnus-marked nil
3528 'gnus-level (1+ gnus-level-subscribed))))
3529 gnus-description-hashtb)
3530 (goto-char (point-min))
3531 (gnus-group-position-point)))
3533 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3534 (defun gnus-group-apropos (regexp &optional search-description)
3535 "List all newsgroups that have names that match a regexp."
3536 (interactive "sGnus apropos (regexp): ")
3538 (obuf (current-buffer))
3540 ;; Go through all newsgroups that are known to Gnus.
3543 (and (symbol-name group)
3544 (string-match regexp (symbol-name group))
3545 (symbol-value group)
3546 (push (symbol-name group) groups)))
3548 ;; Also go through all descriptions that are known to Gnus.
3549 (when search-description
3552 (and (string-match regexp (symbol-value group))
3553 (push (symbol-name group) groups)))
3554 gnus-description-hashtb))
3556 (gnus-message 3 "No groups matched \"%s\"." regexp)
3557 ;; Print out all the groups.
3559 (pop-to-buffer "*Gnus Help*")
3560 (buffer-disable-undo)
3562 (setq groups (sort groups 'string<))
3564 ;; Groups may be entered twice into the list of groups.
3565 (when (not (string= (car groups) prev))
3566 (setq prev (car groups))
3567 (let ((charset (gnus-group-name-charset nil prev)))
3568 (insert (gnus-group-name-decode prev charset) "\n")
3569 (when (and gnus-description-hashtb
3570 (setq des (gnus-gethash (car groups)
3571 gnus-description-hashtb)))
3572 (insert " " (gnus-group-name-decode des charset) "\n"))))
3573 (setq groups (cdr groups)))
3574 (goto-char (point-min))))
3575 (pop-to-buffer obuf)))
3577 (defun gnus-group-description-apropos (regexp)
3578 "List all newsgroups that have names or descriptions that match a regexp."
3579 (interactive "sGnus description apropos (regexp): ")
3580 (when (not (or gnus-description-hashtb
3581 (gnus-read-all-descriptions-files)))
3582 (error "Couldn't request descriptions file"))
3583 (gnus-group-apropos regexp t))
3585 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3586 (defun gnus-group-list-matching (level regexp &optional all lowest)
3587 "List all groups with unread articles that match REGEXP.
3588 If the prefix LEVEL is non-nil, it should be a number that says which
3589 level to cut off listing groups.
3590 If ALL, also list groups with no unread articles.
3591 If LOWEST, don't list groups with level lower than LOWEST.
3593 This command may read the active file."
3594 (interactive "P\nsList newsgroups matching: ")
3595 ;; First make sure active file has been read.
3597 (> (prefix-numeric-value level) gnus-level-killed))
3598 (gnus-get-killed-groups))
3599 (funcall gnus-group-prepare-function
3600 (or level gnus-level-subscribed) (and all t) (or lowest 1) regexp)
3601 (goto-char (point-min))
3602 (gnus-group-position-point))
3604 (defun gnus-group-list-all-matching (level regexp &optional lowest)
3605 "List all groups that match REGEXP.
3606 If the prefix LEVEL is non-nil, it should be a number that says which
3607 level to cut off listing groups.
3608 If LOWEST, don't list groups with level lower than LOWEST."
3609 (interactive "P\nsList newsgroups matching: ")
3611 (setq level (prefix-numeric-value level)))
3612 (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest))
3614 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3615 (defun gnus-group-save-newsrc (&optional force)
3616 "Save the Gnus startup files.
3617 If FORCE, force saving whether it is necessary or not."
3619 (gnus-save-newsrc-file force))
3621 (defun gnus-group-restart (&optional arg)
3622 "Force Gnus to read the .newsrc file."
3624 (when (gnus-yes-or-no-p
3625 (format "Are you sure you want to restart Gnus? "))
3626 (gnus-save-newsrc-file)
3630 (defun gnus-group-read-init-file ()
3631 "Read the Gnus elisp init file."
3633 (gnus-read-init-file)
3634 (gnus-message 5 "Read %s" gnus-init-file))
3636 (defun gnus-group-check-bogus-groups (&optional silent)
3637 "Check bogus newsgroups.
3638 If given a prefix, don't ask for confirmation before removing a bogus
3641 (gnus-check-bogus-newsgroups (and (not silent) (not gnus-expert-user)))
3642 (gnus-group-list-groups))
3644 (defun gnus-group-find-new-groups (&optional arg)
3645 "Search for new groups and add them.
3646 Each new group will be treated with `gnus-subscribe-newsgroup-method.'
3647 With 1 C-u, use the `ask-server' method to query the server for new
3649 With 2 C-u's, use most complete method possible to query the server
3650 for new groups, and subscribe the new groups as zombies."
3652 (gnus-find-new-newsgroups (or arg 1))
3653 (gnus-group-list-groups))
3655 (defun gnus-group-edit-global-kill (&optional article group)
3656 "Edit the global kill file.
3657 If GROUP, edit that local kill file instead."
3659 (setq gnus-current-kill-article article)
3660 (gnus-kill-file-edit-file group)
3663 (substitute-command-keys
3664 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3665 (if group "local" "global")))))
3667 (defun gnus-group-edit-local-kill (article group)
3668 "Edit a local kill file."
3669 (interactive (list nil (gnus-group-group-name)))
3670 (gnus-group-edit-global-kill article group))
3672 (defun gnus-group-force-update ()
3673 "Update `.newsrc' file."
3675 (gnus-save-newsrc-file))
3677 (defun gnus-group-suspend ()
3678 "Suspend the current Gnus session.
3679 In fact, cleanup buffers except for group mode buffer.
3680 The hook gnus-suspend-gnus-hook is called before actually suspending."
3682 (gnus-run-hooks 'gnus-suspend-gnus-hook)
3683 (gnus-offer-save-summaries)
3684 ;; Kill Gnus buffers except for group mode buffer.
3685 (let ((group-buf (get-buffer gnus-group-buffer)))
3686 (mapcar (lambda (buf)
3687 (unless (member buf (list group-buf gnus-dribble-buffer))
3688 (gnus-kill-buffer buf)))
3690 (gnus-kill-gnus-frames)
3692 (bury-buffer group-buf)
3693 (delete-windows-on group-buf t))))
3695 (defun gnus-group-clear-dribble ()
3696 "Clear all information from the dribble buffer."
3698 (gnus-dribble-clear)
3699 (gnus-message 7 "Cleared dribble buffer"))
3701 (defun gnus-group-exit ()
3702 "Quit reading news after updating .newsrc.eld and .newsrc.
3703 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3706 (or noninteractive ;For gnus-batch-kill
3707 (not gnus-interactive-exit) ;Without confirmation
3709 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3710 (gnus-run-hooks 'gnus-exit-gnus-hook)
3711 ;; Offer to save data from non-quitted summary buffers.
3712 (gnus-offer-save-summaries)
3713 ;; Save the newsrc file(s).
3714 (gnus-save-newsrc-file)
3716 (gnus-close-backends)
3717 ;; Reset everything.
3719 ;; Allow the user to do things after cleaning up.
3720 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3722 (defun gnus-group-quit ()
3723 "Quit reading news without updating .newsrc.eld or .newsrc.
3724 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3726 (when (or noninteractive ;For gnus-batch-kill
3727 (zerop (buffer-size))
3728 (not (gnus-server-opened gnus-select-method))
3730 (not gnus-current-startup-file)
3732 (format "Quit reading news without saving %s? "
3733 (file-name-nondirectory gnus-current-startup-file))))
3734 (gnus-run-hooks 'gnus-exit-gnus-hook)
3735 (gnus-configure-windows 'group t)
3736 (when (and (gnus-buffer-live-p gnus-dribble-buffer)
3737 (not (zerop (save-excursion
3738 (set-buffer gnus-dribble-buffer)
3741 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3743 (gnus-close-backends)
3745 (gnus-kill-buffer gnus-group-buffer)
3746 ;; Allow the user to do things after cleaning up.
3747 (gnus-run-hooks 'gnus-after-exiting-gnus-hook)))
3749 (defun gnus-group-describe-briefly ()
3750 "Give a one line description of the group mode commands."
3752 (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")))
3754 (defun gnus-group-browse-foreign-server (method)
3755 "Browse a foreign news server.
3756 If called interactively, this function will ask for a select method
3757 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
3758 If not, METHOD should be a list where the first element is the method
3759 and the second element is the address."
3761 (list (let ((how (completing-read
3763 (append gnus-valid-select-methods gnus-server-alist)
3764 nil t (cons "nntp" 0) 'gnus-method-history)))
3765 ;; We either got a backend name or a virtual server name.
3766 ;; If the first, we also need an address.
3767 (if (assoc how gnus-valid-select-methods)
3769 ;; Suggested by mapjph@bath.ac.uk.
3772 (mapcar (lambda (server) (list server))
3773 gnus-secondary-servers)))
3774 ;; We got a server name.
3776 (gnus-browse-foreign-server method))
3778 (defun gnus-group-set-info (info &optional method-only-group part)
3779 (when (or info part)
3780 (let* ((entry (gnus-gethash
3781 (or method-only-group (gnus-info-group info))
3782 gnus-newsrc-hashtb))
3784 (info (if method-only-group (nth 2 entry) info))
3786 (when method-only-group
3788 (error "Trying to change non-existent group %s" method-only-group))
3789 ;; We have received parts of the actual group info - either the
3790 ;; select method or the group parameters. We first check
3791 ;; whether we have to extend the info, and if so, do that.
3792 (let ((len (length info))
3793 (total (if (eq part 'method) 5 6)))
3795 (setcdr (nthcdr (1- len) info)
3796 (make-list (- total len) nil)))
3797 ;; Then we enter the new info.
3798 (setcar (nthcdr (1- total) info) part-info)))
3800 ;; This is a new group, so we just create it.
3802 (set-buffer gnus-group-buffer)
3803 (setq method (gnus-info-method info))
3804 (when (gnus-server-equal method "native")
3807 (set-buffer gnus-group-buffer)
3809 ;; It's a foreign group...
3810 (gnus-group-make-group
3811 (gnus-group-real-name (gnus-info-group info))
3812 (if (stringp method) method
3813 (prin1-to-string (car method)))
3815 (nth 1 (gnus-info-method info))))
3816 ;; It's a native group.
3817 (gnus-group-make-group (gnus-info-group info))))
3818 (gnus-message 6 "Note: New group created")
3820 (gnus-gethash (gnus-group-prefixed-name
3821 (gnus-group-real-name (gnus-info-group info))
3822 (or (gnus-info-method info) gnus-select-method))
3823 gnus-newsrc-hashtb))))
3824 ;; Whether it was a new group or not, we now have the entry, so we
3825 ;; can do the update.
3828 (setcar (nthcdr 2 entry) info)
3829 (when (and (not (eq (car entry) t))
3830 (gnus-active (gnus-info-group info)))
3831 (setcar entry (length
3832 (gnus-list-of-unread-articles (car info))))))
3833 (error "No such group: %s" (gnus-info-group info))))))
3835 (defun gnus-group-set-method-info (group select-method)
3836 (gnus-group-set-info select-method group 'method))
3838 (defun gnus-group-set-params-info (group params)
3839 (gnus-group-set-info params group 'params))
3841 (defun gnus-add-marked-articles (group type articles &optional info force)
3842 ;; Add ARTICLES of TYPE to the info of GROUP.
3843 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
3844 ;; add, but replace marked articles of TYPE with ARTICLES.
3845 (let ((info (or info (gnus-get-info group)))
3848 (and (not (setq marked (nthcdr 3 info)))
3850 (setcdr (nthcdr 2 info)
3851 (list (list (cons type (gnus-compress-sequence
3853 (and (not (setq m (assq type (car marked))))
3856 (cons (cons type (gnus-compress-sequence articles t) )
3860 (setcar (nthcdr 3 info)
3861 (gnus-delete-alist type (car marked)))
3862 (setcdr m (gnus-compress-sequence articles t)))
3863 (setcdr m (gnus-compress-sequence
3864 (sort (nconc (gnus-uncompress-range (cdr m))
3865 (copy-sequence articles)) '<) t))))))
3867 (defun gnus-add-mark (group mark article)
3868 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
3869 (let ((buffer (gnus-summary-buffer-name group)))
3870 (if (gnus-buffer-live-p buffer)
3872 (set-buffer (get-buffer buffer))
3873 (gnus-summary-add-mark article mark))
3874 (gnus-add-marked-articles group (cdr (assq mark gnus-article-mark-lists))
3878 ;;; Group timestamps
3881 (defun gnus-group-set-timestamp ()
3882 "Change the timestamp of the current group to the current time.
3883 This function can be used in hooks like `gnus-select-group-hook'
3884 or `gnus-group-catchup-group-hook'."
3885 (when gnus-newsgroup-name
3886 (let ((time (current-time)))
3887 (setcdr (cdr time) nil)
3888 (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
3890 (defsubst gnus-group-timestamp (group)
3891 "Return the timestamp for GROUP."
3892 (gnus-group-get-parameter group 'timestamp t))
3894 (defun gnus-group-timestamp-delta (group)
3895 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
3896 (let* ((time (or (gnus-group-timestamp group)
3898 (delta (subtract-time (current-time) time)))
3899 (+ (* (nth 0 delta) 65536.0)
3902 (defun gnus-group-timestamp-string (group)
3903 "Return a string of the timestamp for GROUP."
3904 (let ((time (gnus-group-timestamp group)))
3907 (gnus-time-iso8601 time))))
3909 (defun gnus-group-list-cached (level &optional lowest)
3910 "List all groups with cached articles.
3911 If the prefix LEVEL is non-nil, it should be a number that says which
3912 level to cut off listing groups.
3913 If LOWEST, don't list groups with level lower than LOWEST.
3915 This command may read the active file."
3918 (setq level (prefix-numeric-value level)))
3919 (when (or (not level) (>= level gnus-level-zombie))
3921 (funcall gnus-group-prepare-function
3922 (or level gnus-level-subscribed)
3924 (let ((marks (gnus-info-marks info)))
3925 (assq 'cache marks)))
3928 (or (gnus-gethash group
3929 gnus-cache-active-hashtb)
3930 ;; Cache active file might use "."
3933 (mapconcat 'identity
3934 (split-string group ":")
3936 gnus-cache-active-hashtb))))
3937 (goto-char (point-min))
3938 (gnus-group-position-point))
3940 (defun gnus-group-list-dormant (level &optional lowest)
3941 "List all groups with dormant articles.
3942 If the prefix LEVEL is non-nil, it should be a number that says which
3943 level to cut off listing groups.
3944 If LOWEST, don't list groups with level lower than LOWEST.
3946 This command may read the active file."
3949 (setq level (prefix-numeric-value level)))
3950 (when (or (not level) (>= level gnus-level-zombie))
3952 (funcall gnus-group-prepare-function
3953 (or level gnus-level-subscribed)
3955 (let ((marks (gnus-info-marks info)))
3956 (assq 'dormant marks)))
3959 (goto-char (point-min))
3960 (gnus-group-position-point))
3962 (defun gnus-group-listed-groups ()
3963 "Return a list of listed groups."
3965 (goto-char (point-min))
3966 (while (setq point (text-property-not-all (point) (point-max)
3969 (push (symbol-name (get-text-property point 'gnus-group)) groups)
3973 (defun gnus-group-list-plus (&optional args)
3974 "List groups plus the current selection."
3976 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
3977 (gnus-group-list-mode gnus-group-list-mode) ;; Save it.
3979 (push last-command-event unread-command-events)
3980 (if (featurep 'xemacs)
3981 (push (make-event 'key-press '(key ?A)) unread-command-events)
3982 (push ?A unread-command-events))
3983 (let (gnus-pick-mode keys)
3984 (setq keys (if (featurep 'xemacs)
3985 (events-to-keys (read-key-sequence nil))
3986 (read-key-sequence nil)))
3987 (setq func (lookup-key (current-local-map) keys)))
3991 (call-interactively func))))
3993 (defun gnus-group-list-flush (&optional args)
3994 "Flush groups from the current selection."
3996 (let ((gnus-group-list-option 'flush))
3997 (gnus-group-list-plus args)))
3999 (defun gnus-group-list-limit (&optional args)
4000 "List groups limited within the current selection."
4002 (let ((gnus-group-list-option 'limit))
4003 (gnus-group-list-plus args)))
4005 (defun gnus-group-mark-article-read (group article)
4006 "Mark ARTICLE read."
4007 (gnus-activate-group group)
4008 (let ((buffer (gnus-summary-buffer-name group))
4009 (mark gnus-read-mark))
4013 (with-current-buffer buffer
4014 (when gnus-newsgroup-prepared
4015 (when (and gnus-newsgroup-auto-expire
4016 (memq mark gnus-auto-expirable-marks))
4017 (setq mark gnus-expirable-mark))
4018 (setq mark (gnus-request-update-mark
4019 group article mark))
4020 (gnus-mark-article-as-read article mark)
4021 (setq gnus-newsgroup-active (gnus-active group))
4023 (gnus-group-make-articles-read group
4025 (when (gnus-group-auto-expirable-p group)
4026 (gnus-add-marked-articles
4027 group 'expire (list article))))))
4029 (provide 'gnus-group)
4031 ;;; gnus-group.el ends here