1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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.
31 (defvar tool-bar-map
))
44 (eval-when-compile (require 'mm-url
))
46 (defcustom gnus-group-archive-directory
47 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
48 "*The address of the (ding) archives."
49 :group
'gnus-group-foreign
52 (defcustom gnus-group-recent-archive-directory
53 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
54 "*The address of the most recent (ding) articles."
55 :group
'gnus-group-foreign
58 (defcustom gnus-no-groups-message
"No gnus is bad news"
59 "*Message displayed by Gnus when no groups are available."
63 (defcustom gnus-keep-same-level nil
64 "*Non-nil means that the next newsgroup after the current will be on the same level.
65 When you type, for instance, `n' after reading the last article in the
66 current newsgroup, you will go to the next newsgroup. If this variable
67 is nil, the next newsgroup will be the next from the group
69 If this variable is non-nil, Gnus will either put you in the
70 next newsgroup with the same level, or, if no such newsgroup is
71 available, the next newsgroup with the lowest possible level higher
72 than the current level.
73 If this variable is `best', Gnus will make the next newsgroup the one
75 :group
'gnus-group-levels
76 :type
'(choice (const nil
)
78 (sexp :tag
"other" t
)))
80 (defcustom gnus-group-goto-unread t
81 "*If non-nil, movement commands will go to the next unread and subscribed group."
82 :link
'(custom-manual "(gnus)Group Maneuvering")
83 :group
'gnus-group-various
86 (defcustom gnus-goto-next-group-when-activating t
87 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
88 :link
'(custom-manual "(gnus)Scanning New Messages")
89 :group
'gnus-group-various
92 (defcustom gnus-permanently-visible-groups nil
93 "*Regexp to match groups that should always be listed in the group buffer.
94 This means that they will still be listed even when there are no
95 unread articles in the groups.
97 If nil, no groups are permanently visible."
98 :group
'gnus-group-listing
99 :type
'(choice regexp
(const nil
)))
101 (defcustom gnus-list-groups-with-ticked-articles t
102 "*If non-nil, list groups that have only ticked articles.
103 If nil, only list groups that have unread articles."
104 :group
'gnus-group-listing
107 (defcustom gnus-group-default-list-level gnus-level-subscribed
108 "*Default listing level.
109 Ignored if `gnus-group-use-permanent-levels' is non-nil."
110 :group
'gnus-group-listing
113 (defcustom gnus-group-list-inactive-groups t
114 "*If non-nil, inactive groups will be listed."
115 :group
'gnus-group-listing
116 :group
'gnus-group-levels
119 (defcustom gnus-group-sort-function
'gnus-group-sort-by-alphabet
120 "*Function used for sorting the group buffer.
121 This function will be called with group info entries as the arguments
122 for the groups to be sorted. Pre-made functions include
123 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
124 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
125 `gnus-group-sort-by-score', `gnus-group-sort-by-method',
126 `gnus-group-sort-by-server', and `gnus-group-sort-by-rank'.
128 This variable can also be a list of sorting functions. In that case,
129 the most significant sort function should be the last function in the
131 :group
'gnus-group-listing
132 :link
'(custom-manual "(gnus)Sorting Groups")
133 :type
'(repeat :value-to-internal
(lambda (widget value
)
134 (if (listp value
) value
(list value
)))
135 :match
(lambda (widget value
)
137 (widget-editable-list-match widget value
)))
138 (choice (function-item gnus-group-sort-by-alphabet
)
139 (function-item gnus-group-sort-by-real-name
)
140 (function-item gnus-group-sort-by-unread
)
141 (function-item gnus-group-sort-by-level
)
142 (function-item gnus-group-sort-by-score
)
143 (function-item gnus-group-sort-by-method
)
144 (function-item gnus-group-sort-by-server
)
145 (function-item gnus-group-sort-by-rank
)
146 (function :tag
"other" nil
))))
148 (defcustom gnus-group-line-format
"%M\%S\%p\%P\%5y:%B%(%g%)%l %O\n"
149 "*Format of group lines.
150 It works along the same lines as a normal formatting string,
151 with some simple extensions.
153 %M Only marked articles (character, \"*\" or \" \")
154 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
155 %L Level of subscribedness (integer)
156 %N Number of unread articles (integer)
157 %I Number of dormant articles (integer)
158 %i Number of ticked and dormant (integer)
159 %T Number of ticked articles (integer)
160 %R Number of read articles (integer)
161 %U Number of unseen articles (integer)
162 %t Estimated total number of articles (integer)
163 %y Number of unread, unticked articles (integer)
164 %G Group name (string)
165 %g Qualified group name (string)
166 %c Short (collapsed) group name. See `gnus-group-uncollapsed-levels'.
167 %C Group comment (string)
168 %D Group description (string)
169 %s Select method (string)
170 %o Moderated group (char, \"m\")
171 %p Process mark (char)
172 %B Whether a summary buffer for the group is open (char, \"*\")
173 %O Moderated group (string, \"(m)\" or \"\")
174 %P Topic indentation (string)
175 %m Whether there is new(ish) mail in the group (char, \"%\")
176 %l Whether there are GroupLens predictions for this group (string)
177 %n Select from where (string)
178 %z A string that look like `<%s:%n>' if a foreign select method is used
179 %d The date the group was last entered.
180 %E Icon as defined by `gnus-group-icon-list'.
181 %u User defined specifier. The next character in the format string should
182 be a letter. Gnus will call the function gnus-user-format-function-X,
183 where X is the letter following %u. The function will be passed a
184 single dummy parameter as argument. The function should return a
185 string, which will be inserted into the buffer just like information
186 from any other group specifier.
188 Note that this format specification is not always respected. For
189 reasons of efficiency, when listing killed groups, this specification
190 is ignored altogether. If the spec is changed considerably, your
191 output may end up looking strange when listing both alive and killed
194 If you use %o or %O, reading the active file will be slower and quite
195 a bit of extra memory will be used. %D will also worsen performance.
196 Also note that if you change the format specification to include any
197 of these specs, you must probably re-start Gnus to see them go into
200 General format specifiers can also be used.
201 See Info node `(gnus)Formatting Variables'."
202 :link
'(custom-manual "(gnus)Formatting Variables")
203 :group
'gnus-group-visual
206 (defcustom gnus-group-mode-line-format
"Gnus: %%b {%M\%:%S}"
207 "*The format specification for the group mode line.
208 It works along the same lines as a normal formatting string,
209 with some simple extensions:
211 %S The native news server.
212 %M The native select method.
213 %: \":\" if %S isn't \"\"."
214 :group
'gnus-group-visual
217 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
218 (when (featurep 'xemacs
)
219 (add-hook 'gnus-group-mode-hook
'gnus-xmas-group-menu-add
)
220 (add-hook 'gnus-group-mode-hook
'gnus-xmas-setup-group-toolbar
))
222 (defcustom gnus-group-menu-hook nil
223 "Hook run after the creation of the group mode menu."
224 :group
'gnus-group-various
227 (defcustom gnus-group-catchup-group-hook nil
228 "Hook run when catching up a group from the group buffer."
229 :group
'gnus-group-various
230 :link
'(custom-manual "(gnus)Group Data")
233 (defcustom gnus-group-update-group-hook nil
234 "Hook called when updating group lines."
235 :group
'gnus-group-visual
238 (defcustom gnus-group-prepare-function
'gnus-group-prepare-flat
239 "*A function that is called to generate the group buffer.
240 The function is called with three arguments: The first is a number;
241 all group with a level less or equal to that number should be listed,
242 if the second is non-nil, empty groups should also be displayed. If
243 the third is non-nil, it is a number. No groups with a level lower
244 than this number should be displayed.
246 The only current function implemented is `gnus-group-prepare-flat'."
247 :group
'gnus-group-listing
250 (defcustom gnus-group-prepare-hook nil
251 "Hook called after the group buffer has been generated.
252 If you want to modify the group buffer, you can use this hook."
253 :group
'gnus-group-listing
256 (defcustom gnus-suspend-gnus-hook nil
257 "Hook called when suspending (not exiting) Gnus."
261 (defcustom gnus-exit-gnus-hook nil
262 "Hook called when exiting Gnus."
266 (defcustom gnus-after-exiting-gnus-hook nil
267 "Hook called after exiting Gnus."
271 (defcustom gnus-group-update-hook
'(gnus-group-highlight-line)
272 "Hook called when a group line is changed.
273 The hook will not be called if `gnus-visual' is nil.
275 The default function `gnus-group-highlight-line' will
276 highlight the line according to the `gnus-group-highlight'
278 :group
'gnus-group-visual
281 (defcustom gnus-useful-groups
282 '(("(ding) mailing list mirrored at sunsite.auc.dk"
284 (nntp "sunsite.auc.dk"
285 (nntp-address "sunsite.auc.dk")))
288 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/"))
292 (nndoc-article-type mbox
)
293 (eval `(nndoc-address
294 ,(let ((file (nnheader-find-etc-directory
297 (error "Couldn't find doc group"))
299 "*Alist of useful group-server pairs."
300 :group
'gnus-group-listing
301 :type
'(repeat (list (string :tag
"Description")
303 (sexp :tag
"Method"))))
305 (defcustom gnus-group-highlight
307 ((and mailp
(= unread
0) (eq level
1)) .
308 gnus-group-mail-1-empty-face
)
309 ((and mailp
(eq level
1)) .
310 gnus-group-mail-1-face
)
311 ((and mailp
(= unread
0) (eq level
2)) .
312 gnus-group-mail-2-empty-face
)
313 ((and mailp
(eq level
2)) .
314 gnus-group-mail-2-face
)
315 ((and mailp
(= unread
0) (eq level
3)) .
316 gnus-group-mail-3-empty-face
)
317 ((and mailp
(eq level
3)) .
318 gnus-group-mail-3-face
)
319 ((and mailp
(= unread
0)) .
320 gnus-group-mail-low-empty-face
)
322 gnus-group-mail-low-face
)
324 ((and (= unread
0) (eq level
1)) .
325 gnus-group-news-1-empty-face
)
326 ((and (eq level
1)) .
327 gnus-group-news-1-face
)
328 ((and (= unread
0) (eq level
2)) .
329 gnus-group-news-2-empty-face
)
330 ((and (eq level
2)) .
331 gnus-group-news-2-face
)
332 ((and (= unread
0) (eq level
3)) .
333 gnus-group-news-3-empty-face
)
334 ((and (eq level
3)) .
335 gnus-group-news-3-face
)
336 ((and (= unread
0) (eq level
4)) .
337 gnus-group-news-4-empty-face
)
338 ((and (eq level
4)) .
339 gnus-group-news-4-face
)
340 ((and (= unread
0) (eq level
5)) .
341 gnus-group-news-5-empty-face
)
342 ((and (eq level
5)) .
343 gnus-group-news-5-face
)
344 ((and (= unread
0) (eq level
6)) .
345 gnus-group-news-6-empty-face
)
346 ((and (eq level
6)) .
347 gnus-group-news-6-face
)
348 ((and (= unread
0)) .
349 gnus-group-news-low-empty-face
)
351 gnus-group-news-low-face
))
352 "*Controls the highlighting of group buffer lines.
354 Below is a list of `Form'/`Face' pairs. When deciding how a a
355 particular group line should be displayed, each form is
356 evaluated. The content of the face field after the first true form is
357 used. You can change how those group lines are displayed by
358 editing the face field.
360 It is also possible to change and add form fields, but currently that
361 requires an understanding of Lisp expressions. Hopefully this will
362 change in a future release. For now, you can use the following
363 variables in the Lisp expression:
365 group: The name of the group.
366 unread: The number of unread articles in the group.
367 method: The select method used.
368 mailp: Whether it's a mail group or not.
369 level: The level of the group.
370 score: The score of the group.
371 ticked: The number of ticked articles."
372 :group
'gnus-group-visual
373 :type
'(repeat (cons (sexp :tag
"Form") face
)))
375 (defcustom gnus-new-mail-mark ?%
376 "Mark used for groups with new mail."
377 :group
'gnus-group-visual
380 (defgroup gnus-group-icons nil
381 "Add Icons to your group buffer. "
382 :group
'gnus-group-visual
)
384 (defcustom gnus-group-icon-list
386 "*Controls the insertion of icons into group buffer lines.
388 Below is a list of `Form'/`File' pairs. When deciding how a
389 particular group line should be displayed, each form is evaluated.
390 The icon from the file field after the first true form is used. You
391 can change how those group lines are displayed by editing the file
392 field. The File will either be found in the
393 `gnus-group-glyph-directory' or by designating absolute name of the
396 It is also possible to change and add form fields, but currently that
397 requires an understanding of Lisp expressions. Hopefully this will
398 change in a future release. For now, you can use the following
399 variables in the Lisp expression:
401 group: The name of the group.
402 unread: The number of unread articles in the group.
403 method: The select method used.
404 mailp: Whether it's a mail group or not.
405 newsp: Whether it's a news group or not
406 level: The level of the group.
407 score: The score of the group.
408 ticked: The number of ticked articles."
409 :group
'gnus-group-icons
410 :type
'(repeat (cons (sexp :tag
"Form") file
)))
412 (defcustom gnus-group-name-charset-method-alist nil
413 "Alist of method and the charset for group names.
416 (((nntp \"news.com.cn\") . cn-gb-2312))"
419 :type
'(repeat (cons (sexp :tag
"Method") (symbol :tag
"Charset"))))
421 (defcustom gnus-group-name-charset-group-alist
422 (if (or (and (fboundp 'find-coding-system
) (find-coding-system 'utf-8
))
423 (mm-coding-system-p 'utf-8
))
426 "Alist of group regexp and the charset for group names.
429 ((\"\\.com\\.cn:\" . cn-gb-2312))"
431 :type
'(repeat (cons (regexp :tag
"Group") (symbol :tag
"Charset"))))
433 (defcustom gnus-group-jump-to-group-prompt nil
434 "Default prompt for `gnus-group-jump-to-group'.
435 If non-nil, the value should be a string, e.g. \"nnml:\",
436 in which case `gnus-group-jump-to-group' offers \"Group: nnml:\"
437 in the minibuffer prompt."
439 :group
'gnus-group-various
440 :type
'(choice (string :tag
"Prompt string")
441 (const :tag
"Empty" nil
)))
443 (defvar gnus-group-listing-limit
1000
444 "*A limit of the number of groups when listing.
445 If the number of groups is larger than the limit, list them in a
448 ;;; Internal variables
450 (defvar gnus-group-is-exiting-p nil
)
451 (defvar gnus-group-is-exiting-without-update-p nil
)
452 (defvar gnus-group-sort-alist-function
'gnus-group-sort-flat
453 "Function for sorting the group buffer.")
455 (defvar gnus-group-sort-selected-function
'gnus-group-sort-selected-flat
456 "Function for sorting the selected groups in the group buffer.")
458 (defvar gnus-group-indentation-function nil
)
459 (defvar gnus-goto-missing-group-function nil
)
460 (defvar gnus-group-update-group-function nil
)
461 (defvar gnus-group-goto-next-group-function nil
462 "Function to override finding the next group after listing groups.")
464 (defvar gnus-group-edit-buffer nil
)
466 (defvar gnus-group-line-format-alist
467 `((?M gnus-tmp-marked-mark ?c
)
468 (?S gnus-tmp-subscribed ?c
)
469 (?L gnus-tmp-level ?d
)
470 (?N
(cond ((eq number t
) "*" )
474 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
)))
475 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked
))))))
477 (?R gnus-tmp-number-of-read ?s
)
478 (?U
(gnus-number-of-unseen-articles-in-group gnus-tmp-group
) ?d
)
479 (?t gnus-tmp-number-total ?d
)
480 (?y gnus-tmp-number-of-unread ?s
)
481 (?I
(gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
))) ?d
)
482 (?T
(gnus-range-length (cdr (assq 'tick gnus-tmp-marked
))) ?d
)
483 (?i
(+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
)))
484 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked
)))) ?d
)
485 (?g gnus-tmp-group ?s
)
486 (?G gnus-tmp-qualified-group ?s
)
487 (?c
(gnus-short-group-name gnus-tmp-group
) ?s
)
488 (?C gnus-tmp-comment ?s
)
489 (?D gnus-tmp-newsgroup-description ?s
)
490 (?o gnus-tmp-moderated ?c
)
491 (?O gnus-tmp-moderated-string ?s
)
492 (?p gnus-tmp-process-marked ?c
)
493 (?s gnus-tmp-news-server ?s
)
494 (?n
,(if (featurep 'xemacs
)
495 '(symbol-name gnus-tmp-news-method
)
496 'gnus-tmp-news-method
)
498 (?P gnus-group-indentation ?s
)
499 (?E gnus-tmp-group-icon ?s
)
500 (?B gnus-tmp-summary-live ?c
)
501 (?l gnus-tmp-grouplens ?s
)
502 (?z gnus-tmp-news-method-string ?s
)
503 (?m
(gnus-group-new-mail gnus-tmp-group
) ?c
)
504 (?d
(gnus-group-timestamp-string gnus-tmp-group
) ?s
)
505 (?u gnus-tmp-user-defined ?s
)))
507 (defvar gnus-group-mode-line-format-alist
508 `((?S gnus-tmp-news-server ?s
)
509 (?M gnus-tmp-news-method ?s
)
510 (?u gnus-tmp-user-defined ?s
)
511 (?
: gnus-tmp-colon ?s
)))
513 (defvar gnus-topic-topology nil
514 "The complete topic hierarchy.")
516 (defvar gnus-topic-alist nil
517 "The complete topic-group alist.")
519 (defvar gnus-group-marked nil
)
521 (defvar gnus-group-list-mode nil
)
524 (defvar gnus-group-icon-cache nil
)
526 (defvar gnus-group-listed-groups nil
)
527 (defvar gnus-group-list-option nil
)
533 (put 'gnus-group-mode
'mode-class
'special
)
535 (gnus-define-keys gnus-group-mode-map
536 " " gnus-group-read-group
537 "=" gnus-group-select-group
538 "\r" gnus-group-select-group
539 "\M-\r" gnus-group-quick-select-group
540 "\M- " gnus-group-visible-select-group
541 [(meta control return
)] gnus-group-select-group-ephemerally
542 "j" gnus-group-jump-to-group
543 "n" gnus-group-next-unread-group
544 "p" gnus-group-prev-unread-group
545 "\177" gnus-group-prev-unread-group
546 [delete] gnus-group-prev-unread-group
547 [backspace] gnus-group-prev-unread-group
548 "N" gnus-group-next-group
549 "P" gnus-group-prev-group
550 "\M-n" gnus-group-next-unread-group-same-level
551 "\M-p" gnus-group-prev-unread-group-same-level
552 "," gnus-group-best-unread-group
553 "." gnus-group-first-unread-group
554 "u" gnus-group-unsubscribe-current-group
555 "U" gnus-group-unsubscribe-group
556 "c" gnus-group-catchup-current
557 "C" gnus-group-catchup-current-all
558 "\M-c" gnus-group-clear-data
559 "l" gnus-group-list-groups
560 "L" gnus-group-list-all-groups
563 "g" gnus-group-get-new-news
564 "\M-g" gnus-group-get-new-news-this-group
565 "R" gnus-group-restart
566 "r" gnus-group-read-init-file
567 "B" gnus-group-browse-foreign-server
568 "b" gnus-group-check-bogus-groups
569 "F" gnus-group-find-new-groups
570 "\C-c\C-d" gnus-group-describe-group
571 "\M-d" gnus-group-describe-all-groups
572 "\C-c\C-a" gnus-group-apropos
573 "\C-c\M-\C-a" gnus-group-description-apropos
574 "a" gnus-group-post-news
575 "\ek" gnus-group-edit-local-kill
576 "\eK" gnus-group-edit-global-kill
577 "\C-k" gnus-group-kill-group
578 "\C-y" gnus-group-yank-group
579 "\C-w" gnus-group-kill-region
580 "\C-x\C-t" gnus-group-transpose-groups
581 "\C-c\C-l" gnus-group-list-killed
582 "\C-c\C-x" gnus-group-expire-articles
583 "\C-c\M-\C-x" gnus-group-expire-all-groups
585 "s" gnus-group-save-newsrc
586 "z" gnus-group-suspend
589 "?" gnus-group-describe-briefly
590 "\C-c\C-i" gnus-info-find-node
591 "\M-e" gnus-group-edit-group-method
592 "^" gnus-group-enter-server-mode
593 gnus-mouse-2 gnus-mouse-pick-group
594 [follow-link] mouse-face
595 "<" beginning-of-buffer
598 "\C-c\C-s" gnus-group-sort-groups
600 "\C-c\M-g" gnus-activate-all-groups
601 "\M-&" gnus-group-universal-argument
602 "#" gnus-group-mark-group
603 "\M-#" gnus-group-unmark-group)
605 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
606 "m" gnus-group-mark-group
607 "u" gnus-group-unmark-group
608 "w" gnus-group-mark-region
609 "b" gnus-group-mark-buffer
610 "r" gnus-group-mark-regexp
611 "U" gnus-group-unmark-all-groups)
613 (gnus-define-keys (gnus-group-sieve-map "D" gnus-group-mode-map)
614 "u" gnus-sieve-update
615 "g" gnus-sieve-generate)
617 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
618 "d" gnus-group-make-directory-group
619 "h" gnus-group-make-help-group
620 "u" gnus-group-make-useful-group
621 "a" gnus-group-make-archive-group
622 "k" gnus-group-make-kiboze-group
623 "l" gnus-group-nnimap-edit-acl
624 "m" gnus-group-make-group
625 "E" gnus-group-edit-group
626 "e" gnus-group-edit-group-method
627 "p" gnus-group-edit-group-parameters
628 "v" gnus-group-add-to-virtual
629 "V" gnus-group-make-empty-virtual
630 "D" gnus-group-enter-directory
631 "f" gnus-group-make-doc-group
632 "w" gnus-group-make-web-group
633 "M" gnus-group-read-ephemeral-group
634 "r" gnus-group-rename-group
635 "R" gnus-group-make-rss-group
636 "c" gnus-group-customize
637 "x" gnus-group-nnimap-expunge
638 "\177" gnus-group-delete-group
639 [delete] gnus-group-delete-group
)
641 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map
)
642 "b" gnus-group-brew-soup
643 "w" gnus-soup-save-areas
644 "s" gnus-soup-send-replies
645 "p" gnus-soup-pack-packet
646 "r" nnsoup-pack-replies
)
648 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map
)
649 "s" gnus-group-sort-groups
650 "a" gnus-group-sort-groups-by-alphabet
651 "u" gnus-group-sort-groups-by-unread
652 "l" gnus-group-sort-groups-by-level
653 "v" gnus-group-sort-groups-by-score
654 "r" gnus-group-sort-groups-by-rank
655 "m" gnus-group-sort-groups-by-method
656 "n" gnus-group-sort-groups-by-real-name
)
658 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map
)
659 "s" gnus-group-sort-selected-groups
660 "a" gnus-group-sort-selected-groups-by-alphabet
661 "u" gnus-group-sort-selected-groups-by-unread
662 "l" gnus-group-sort-selected-groups-by-level
663 "v" gnus-group-sort-selected-groups-by-score
664 "r" gnus-group-sort-selected-groups-by-rank
665 "m" gnus-group-sort-selected-groups-by-method
666 "n" gnus-group-sort-selected-groups-by-real-name
)
668 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map
)
669 "k" gnus-group-list-killed
670 "z" gnus-group-list-zombies
671 "s" gnus-group-list-groups
672 "u" gnus-group-list-all-groups
673 "A" gnus-group-list-active
674 "a" gnus-group-apropos
675 "d" gnus-group-description-apropos
676 "m" gnus-group-list-matching
677 "M" gnus-group-list-all-matching
678 "l" gnus-group-list-level
679 "c" gnus-group-list-cached
680 "?" gnus-group-list-dormant
)
682 (gnus-define-keys (gnus-group-list-limit-map "/" gnus-group-list-map
)
683 "k" gnus-group-list-limit
684 "z" gnus-group-list-limit
685 "s" gnus-group-list-limit
686 "u" gnus-group-list-limit
687 "A" gnus-group-list-limit
688 "m" gnus-group-list-limit
689 "M" gnus-group-list-limit
690 "l" gnus-group-list-limit
691 "c" gnus-group-list-limit
692 "?" gnus-group-list-limit
)
694 (gnus-define-keys (gnus-group-list-flush-map "f" gnus-group-list-map
)
695 "k" gnus-group-list-flush
696 "z" gnus-group-list-flush
697 "s" gnus-group-list-flush
698 "u" gnus-group-list-flush
699 "A" gnus-group-list-flush
700 "m" gnus-group-list-flush
701 "M" gnus-group-list-flush
702 "l" gnus-group-list-flush
703 "c" gnus-group-list-flush
704 "?" gnus-group-list-flush
)
706 (gnus-define-keys (gnus-group-list-plus-map "p" gnus-group-list-map
)
707 "k" gnus-group-list-plus
708 "z" gnus-group-list-plus
709 "s" gnus-group-list-plus
710 "u" gnus-group-list-plus
711 "A" gnus-group-list-plus
712 "m" gnus-group-list-plus
713 "M" gnus-group-list-plus
714 "l" gnus-group-list-plus
715 "c" gnus-group-list-plus
716 "?" gnus-group-list-plus
)
718 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map
)
719 "f" gnus-score-flush-cache
)
721 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map
)
722 "c" gnus-group-fetch-charter
723 "C" gnus-group-fetch-control
724 "d" gnus-group-describe-group
725 "f" gnus-group-fetch-faq
728 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map
)
729 "l" gnus-group-set-current-level
730 "t" gnus-group-unsubscribe-current-group
731 "s" gnus-group-unsubscribe-group
732 "k" gnus-group-kill-group
733 "y" gnus-group-yank-group
734 "w" gnus-group-kill-region
735 "\C-k" gnus-group-kill-level
736 "z" gnus-group-kill-all-zombies
)
738 (defun gnus-topic-mode-p ()
739 "Return non-nil in `gnus-topic-mode'."
740 (and (boundp 'gnus-topic-mode
)
741 (symbol-value 'gnus-topic-mode
)))
743 (defun gnus-group-make-menu-bar ()
744 (gnus-turn-off-edit-menu 'group
)
745 (unless (boundp 'gnus-group-reading-menu
)
748 gnus-group-reading-menu gnus-group-mode-map
""
750 ["Read" gnus-group-read-group
751 :included
(not (gnus-topic-mode-p))
752 :active
(gnus-group-group-name)]
753 ["Read " gnus-topic-read-group
754 :included
(gnus-topic-mode-p)]
755 ["Select" gnus-group-select-group
756 :included
(not (gnus-topic-mode-p))
757 :active
(gnus-group-group-name)]
758 ["Select " gnus-topic-select-group
759 :included
(gnus-topic-mode-p)]
760 ["See old articles" (gnus-group-select-group 'all
)
761 :keys
"C-u SPC" :active
(gnus-group-group-name)]
762 ["Catch up" gnus-group-catchup-current
763 :included
(not (gnus-topic-mode-p))
764 :active
(gnus-group-group-name)
765 ,@(if (featurep 'xemacs
) nil
766 '(:help
"Mark unread articles in the current group as read"))]
767 ["Catch up " gnus-topic-catchup-articles
768 :included
(gnus-topic-mode-p)
769 ,@(if (featurep 'xemacs
) nil
770 '(:help
"Mark unread articles in the current group or topic as read"))]
771 ["Catch up all articles" gnus-group-catchup-current-all
772 (gnus-group-group-name)]
773 ["Check for new articles" gnus-group-get-new-news-this-group
774 :included
(not (gnus-topic-mode-p))
775 :active
(gnus-group-group-name)
776 ,@(if (featurep 'xemacs
) nil
777 '(:help
"Check for new messages in current group"))]
778 ["Check for new articles " gnus-topic-get-new-news-this-topic
779 :included
(gnus-topic-mode-p)
780 ,@(if (featurep 'xemacs
) nil
781 '(:help
"Check for new messages in current group or topic"))]
782 ["Toggle subscription" gnus-group-unsubscribe-current-group
783 (gnus-group-group-name)]
784 ["Kill" gnus-group-kill-group
:active
(gnus-group-group-name)
785 ,@(if (featurep 'xemacs
) nil
786 '(:help
"Kill (remove) current group"))]
787 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups
]
788 ["Describe" gnus-group-describe-group
:active
(gnus-group-group-name)
789 ,@(if (featurep 'xemacs
) nil
790 '(:help
"Display description of the current group"))]
791 ["Fetch FAQ" gnus-group-fetch-faq
(gnus-group-group-name)]
792 ["Fetch charter" gnus-group-fetch-charter
793 :active
(gnus-group-group-name)
794 ,@(if (featurep 'xemacs
) nil
795 '(:help
"Display the charter of the current group"))]
796 ["Fetch control message" gnus-group-fetch-control
797 :active
(gnus-group-group-name)
798 ,@(if (featurep 'xemacs
) nil
799 '(:help
"Display the archived control message for the current group"))]
800 ;; Actually one should check, if any of the marked groups gives t for
801 ;; (gnus-check-backend-function 'request-expire-articles ...)
802 ["Expire articles" gnus-group-expire-articles
803 :included
(not (gnus-topic-mode-p))
804 :active
(or (and (gnus-group-group-name)
805 (gnus-check-backend-function
806 'request-expire-articles
807 (gnus-group-group-name))) gnus-group-marked
)]
808 ["Expire articles " gnus-topic-expire-articles
809 :included
(gnus-topic-mode-p)]
810 ["Set group level..." gnus-group-set-current-level
811 (gnus-group-group-name)]
812 ["Select quick" gnus-group-quick-select-group
(gnus-group-group-name)]
813 ["Customize" gnus-group-customize
(gnus-group-group-name)]
815 ["Parameters" gnus-group-edit-group-parameters
816 :included
(not (gnus-topic-mode-p))
817 :active
(gnus-group-group-name)]
818 ["Parameters " gnus-topic-edit-parameters
819 :included
(gnus-topic-mode-p)]
820 ["Select method" gnus-group-edit-group-method
821 (gnus-group-group-name)]
822 ["Info" gnus-group-edit-group
(gnus-group-group-name)]
823 ["Local kill file" gnus-group-edit-local-kill
(gnus-group-group-name)]
824 ["Global kill file" gnus-group-edit-global-kill t
])))
827 gnus-group-group-menu gnus-group-mode-map
""
830 ["List unread subscribed groups" gnus-group-list-groups t
]
831 ["List (un)subscribed groups" gnus-group-list-all-groups t
]
832 ["List killed groups" gnus-group-list-killed gnus-killed-list
]
833 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list
]
834 ["List level..." gnus-group-list-level t
]
835 ["Describe all groups" gnus-group-describe-all-groups t
]
836 ["Group apropos..." gnus-group-apropos t
]
837 ["Group and description apropos..." gnus-group-description-apropos t
]
838 ["List groups matching..." gnus-group-list-matching t
]
839 ["List all groups matching..." gnus-group-list-all-matching t
]
840 ["List active file" gnus-group-list-active t
]
841 ["List groups with cached" gnus-group-list-cached t
]
842 ["List groups with dormant" gnus-group-list-dormant t
])
844 ["Default sort" gnus-group-sort-groups t
]
845 ["Sort by method" gnus-group-sort-groups-by-method t
]
846 ["Sort by rank" gnus-group-sort-groups-by-rank t
]
847 ["Sort by score" gnus-group-sort-groups-by-score t
]
848 ["Sort by level" gnus-group-sort-groups-by-level t
]
849 ["Sort by unread" gnus-group-sort-groups-by-unread t
]
850 ["Sort by name" gnus-group-sort-groups-by-alphabet t
]
851 ["Sort by real name" gnus-group-sort-groups-by-real-name t
])
852 ("Sort process/prefixed"
853 ["Default sort" gnus-group-sort-selected-groups
854 (not (gnus-topic-mode-p))]
855 ["Sort by method" gnus-group-sort-selected-groups-by-method
856 (not (gnus-topic-mode-p))]
857 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
858 (not (gnus-topic-mode-p))]
859 ["Sort by score" gnus-group-sort-selected-groups-by-score
860 (not (gnus-topic-mode-p))]
861 ["Sort by level" gnus-group-sort-selected-groups-by-level
862 (not (gnus-topic-mode-p))]
863 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
864 (not (gnus-topic-mode-p))]
865 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
866 (not (gnus-topic-mode-p))]
867 ["Sort by real name" gnus-group-sort-selected-groups-by-real-name
868 (not (gnus-topic-mode-p))])
870 ["Mark group" gnus-group-mark-group
871 (and (gnus-group-group-name)
872 (not (memq (gnus-group-group-name) gnus-group-marked
)))]
873 ["Unmark group" gnus-group-unmark-group
874 (and (gnus-group-group-name)
875 (memq (gnus-group-group-name) gnus-group-marked
))]
876 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked
]
877 ["Mark regexp..." gnus-group-mark-regexp t
]
878 ["Mark region" gnus-group-mark-region
:active
(gnus-mark-active-p)]
879 ["Mark buffer" gnus-group-mark-buffer t
]
880 ["Execute command" gnus-group-universal-argument
881 (or gnus-group-marked
(gnus-group-group-name))])
883 ["Subscribe to a group..." gnus-group-unsubscribe-group t
]
884 ["Kill all newsgroups in region" gnus-group-kill-region
885 :active
(gnus-mark-active-p)]
886 ["Kill all zombie groups" gnus-group-kill-all-zombies
888 ["Kill all groups on level..." gnus-group-kill-level t
])
890 ["Make a foreign group..." gnus-group-make-group t
]
891 ["Add a directory group..." gnus-group-make-directory-group t
]
892 ["Add the help group" gnus-group-make-help-group t
]
893 ["Add the archive group" gnus-group-make-archive-group t
]
894 ["Make a doc group..." gnus-group-make-doc-group t
]
895 ["Make a web group..." gnus-group-make-web-group t
]
896 ["Make a kiboze group..." gnus-group-make-kiboze-group t
]
897 ["Make a virtual group..." gnus-group-make-empty-virtual t
]
898 ["Add a group to a virtual..." gnus-group-add-to-virtual t
]
899 ["Make an ephemeral group..." gnus-group-read-ephemeral-group t
]
900 ["Make an RSS group..." gnus-group-make-rss-group t
]
901 ["Rename group..." gnus-group-rename-group
902 (gnus-check-backend-function
903 'request-rename-group
(gnus-group-group-name))]
904 ["Delete group" gnus-group-delete-group
905 (gnus-check-backend-function
906 'request-delete-group
(gnus-group-group-name))])
908 ["Next" gnus-group-next-group t
]
909 ["Previous" gnus-group-prev-group t
]
910 ["Next unread" gnus-group-next-unread-group t
]
911 ["Previous unread" gnus-group-prev-unread-group t
]
912 ["Next unread same level" gnus-group-next-unread-group-same-level t
]
913 ["Previous unread same level"
914 gnus-group-prev-unread-group-same-level t
]
915 ["Jump to group..." gnus-group-jump-to-group t
]
916 ["First unread group" gnus-group-first-unread-group t
]
917 ["Best unread group" gnus-group-best-unread-group t
])
919 ["Generate" gnus-sieve-generate t
]
920 ["Generate and update" gnus-sieve-update t
])
921 ["Delete bogus groups" gnus-group-check-bogus-groups t
]
922 ["Find new newsgroups" gnus-group-find-new-groups t
]
923 ["Transpose" gnus-group-transpose-groups
924 (gnus-group-group-name)]
925 ["Read a directory as a group..." gnus-group-enter-directory t
]))
928 gnus-group-misc-menu gnus-group-mode-map
""
931 ["Pack replies" nnsoup-pack-replies
(fboundp 'nnsoup-request-group
)]
932 ["Send replies" gnus-soup-send-replies
933 (fboundp 'gnus-soup-pack-packet
)]
934 ["Pack packet" gnus-soup-pack-packet
(fboundp 'gnus-soup-pack-packet
)]
935 ["Save areas" gnus-soup-save-areas
(fboundp 'gnus-soup-pack-packet
)]
936 ["Brew SOUP" gnus-group-brew-soup
(fboundp 'gnus-soup-pack-packet
)])
937 ["Send a mail" gnus-group-mail t
]
938 ["Send a message (mail or news)" gnus-group-post-news t
]
939 ["Create a local message" gnus-group-news t
]
940 ["Check for new news" gnus-group-get-new-news
941 ,@(if (featurep 'xemacs
) '(t)
942 '(:help
"Get newly arrived articles"))
944 ["Send queued messages" gnus-delay-send-queue
945 ,@(if (featurep 'xemacs
) '(t)
946 '(:help
"Send all messages that are scheduled to be sent now"))
948 ["Activate all groups" gnus-activate-all-groups t
]
949 ["Restart Gnus" gnus-group-restart t
]
950 ["Read init file" gnus-group-read-init-file t
]
951 ["Browse foreign server..." gnus-group-browse-foreign-server t
]
952 ["Enter server buffer" gnus-group-enter-server-mode t
]
953 ["Expire all expirable articles" gnus-group-expire-all-groups t
]
954 ["Generate any kiboze groups" nnkiboze-generate-groups t
]
955 ["Gnus version" gnus-version t
]
956 ["Save .newsrc files" gnus-group-save-newsrc t
]
957 ["Suspend Gnus" gnus-group-suspend t
]
958 ["Clear dribble buffer" gnus-group-clear-dribble t
]
959 ["Read manual" gnus-info-find-node t
]
960 ["Flush score cache" gnus-score-flush-cache t
]
961 ["Toggle topics" gnus-topic-mode t
]
962 ["Send a bug report" gnus-bug t
]
963 ["Exit from Gnus" gnus-group-exit
964 ,@(if (featurep 'xemacs
) '(t)
965 '(:help
"Quit reading news"))]
966 ["Exit without saving" gnus-group-quit t
]))
968 (gnus-run-hooks 'gnus-group-menu-hook
)))
970 (defvar gnus-group-toolbar-map nil
)
972 ;; Emacs 21 tool bar. Should be no-op otherwise.
973 (defun gnus-group-make-tool-bar ()
975 (condition-case nil
(require 'tool-bar
) (error nil
))
976 (fboundp 'tool-bar-add-item-from-menu
)
977 (default-value 'tool-bar-mode
)
978 (not gnus-group-toolbar-map
))
979 (setq gnus-group-toolbar-map
980 (let ((tool-bar-map (make-sparse-keymap))
981 (load-path (mm-image-load-path)))
982 (tool-bar-add-item-from-menu
983 'gnus-group-get-new-news
"get-news" gnus-group-mode-map
)
984 (tool-bar-add-item-from-menu
985 'gnus-group-get-new-news-this-group
"gnntg" gnus-group-mode-map
)
986 (tool-bar-add-item-from-menu
987 'gnus-group-catchup-current
"catchup" gnus-group-mode-map
)
988 (tool-bar-add-item-from-menu
989 'gnus-group-describe-group
"describe-group" gnus-group-mode-map
)
990 (tool-bar-add-item "subscribe" 'gnus-group-subscribe
'subscribe
991 :help
"Subscribe to the current group")
992 (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe
994 :help
"Unsubscribe from the current group")
995 (tool-bar-add-item-from-menu
996 'gnus-group-exit
"exit-gnus" gnus-group-mode-map
)
998 (if gnus-group-toolbar-map
999 (set (make-local-variable 'tool-bar-map
) gnus-group-toolbar-map
)))
1001 (defun gnus-group-mode ()
1002 "Major mode for reading news.
1004 All normal editing commands are switched off.
1005 \\<gnus-group-mode-map>
1006 The group buffer lists (some of) the groups available. For instance,
1007 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
1008 lists all zombie groups.
1010 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
1011 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
1013 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
1015 The following commands are available:
1017 \\{gnus-group-mode-map}"
1019 (kill-all-local-variables)
1020 (when (gnus-visual-p 'group-menu
'menu
)
1021 (gnus-group-make-menu-bar)
1022 (gnus-group-make-tool-bar))
1023 (gnus-simplify-mode-line)
1024 (setq major-mode
'gnus-group-mode
)
1025 (setq mode-name
"Group")
1026 (gnus-group-set-mode-line)
1027 (setq mode-line-process nil
)
1028 (use-local-map gnus-group-mode-map
)
1029 (buffer-disable-undo)
1030 (setq truncate-lines t
)
1031 (setq buffer-read-only t
)
1032 (gnus-set-default-directory)
1033 (gnus-update-format-specifications nil
'group
'group-mode
)
1034 (gnus-update-group-mark-positions)
1039 (gnus-run-hooks 'gnus-group-mode-hook
))
1041 (defun gnus-update-group-mark-positions ()
1043 (let ((gnus-process-mark ?
\200)
1044 (gnus-group-update-hook nil
)
1045 (gnus-group-marked '("dummy.group"))
1046 (gnus-active-hashtb (make-vector 10 0))
1048 (gnus-set-active "dummy.group" '(0 .
0))
1049 (gnus-set-work-buffer)
1050 (gnus-group-insert-group-line "dummy.group" 0 nil
0 nil
)
1051 (goto-char (point-min))
1052 (setq gnus-group-mark-positions
1053 (list (cons 'process
(and (search-forward
1054 (mm-string-as-multibyte "\200") nil t
)
1055 (- (point) 2))))))))
1057 (defun gnus-mouse-pick-group (e)
1058 "Enter the group under the mouse pointer."
1061 (gnus-group-read-group nil
))
1063 ;; Look at LEVEL and find out what the level is really supposed to be.
1064 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
1065 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
1066 (defun gnus-group-default-level (&optional level number-or-nil
)
1068 (gnus-group-use-permanent-levels
1069 (or (setq gnus-group-use-permanent-levels
1070 (or level
(if (numberp gnus-group-use-permanent-levels
)
1071 gnus-group-use-permanent-levels
1072 (or gnus-group-default-list-level
1073 gnus-level-subscribed
))))
1074 gnus-group-default-list-level gnus-level-subscribed
))
1078 (or level gnus-group-default-list-level gnus-level-subscribed
))))
1080 (defun gnus-group-setup-buffer ()
1081 (set-buffer (gnus-get-buffer-create gnus-group-buffer
))
1082 (unless (eq major-mode
'gnus-group-mode
)
1085 (gnus-carpal-setup-buffer 'group
))))
1087 (defun gnus-group-name-charset (method group
)
1089 (setq method
(gnus-find-method-for-group group
)))
1090 (let ((item (assoc method gnus-group-name-charset-method-alist
))
1091 (alist gnus-group-name-charset-group-alist
)
1095 (while (setq item
(pop alist
))
1096 (if (string-match (car item
) group
)
1098 result
(cdr item
))))
1101 (defun gnus-group-name-decode (string charset
)
1102 ;; Fixme: Don't decode in unibyte mode.
1103 (if (and string charset
(featurep 'mule
))
1104 (mm-decode-coding-string string charset
)
1107 (defun gnus-group-decoded-name (string)
1108 (let ((charset (gnus-group-name-charset nil string
)))
1109 (gnus-group-name-decode string charset
)))
1111 (defun gnus-group-list-groups (&optional level unread lowest
)
1112 "List newsgroups with level LEVEL or lower that have unread articles.
1113 Default is all subscribed groups.
1114 If argument UNREAD is non-nil, groups with no unread articles are also
1117 Also see the `gnus-group-use-permanent-levels' variable."
1119 (list (if current-prefix-arg
1120 (prefix-numeric-value current-prefix-arg
)
1122 (gnus-group-default-level nil t
)
1123 gnus-group-default-list-level
1124 gnus-level-subscribed
))))
1126 (setq level
(car gnus-group-list-mode
)
1127 unread
(cdr gnus-group-list-mode
)))
1128 (setq level
(gnus-group-default-level level
))
1129 (gnus-group-setup-buffer)
1130 (gnus-update-format-specifications nil
'group
'group-mode
)
1131 (let ((case-fold-search nil
)
1132 (props (text-properties-at (gnus-point-at-bol)))
1133 (empty (= (point-min) (point-max)))
1134 (group (gnus-group-group-name))
1136 (set-buffer gnus-group-buffer
)
1137 (setq number
(funcall gnus-group-prepare-function level unread lowest
))
1138 (when (or (and (numberp number
)
1140 (zerop (buffer-size)))
1141 ;; No groups in the buffer.
1142 (gnus-message 5 gnus-no-groups-message
))
1143 ;; We have some groups displayed.
1144 (goto-char (point-max))
1145 (when (or (not gnus-group-goto-next-group-function
)
1146 (not (funcall gnus-group-goto-next-group-function
1150 (goto-char (point-min)))
1152 ;; Go to the first group with unread articles.
1153 (gnus-group-search-forward t
))
1155 ;; Find the right group to put point on. If the current group
1156 ;; has disappeared in the new listing, try to find the next
1157 ;; one. If no next one can be found, just leave point at the
1158 ;; first newsgroup in the buffer.
1159 (when (not (gnus-goto-char
1161 (point-min) (point-max)
1162 'gnus-group
(gnus-intern-safe
1163 group gnus-active-hashtb
))))
1164 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb
))))
1166 (not (gnus-goto-char
1168 (point-min) (point-max) 'gnus-group
1170 (caar newsrc
) gnus-active-hashtb
)))))
1171 (setq newsrc
(cdr newsrc
)))
1173 (goto-char (point-max))
1174 (forward-line -
1)))))))
1175 ;; Adjust cursor point.
1176 (gnus-group-position-point)))
1178 (defun gnus-group-list-level (level &optional all
)
1179 "List groups on LEVEL.
1180 If ALL (the prefix), also list groups that have no unread articles."
1181 (interactive "nList groups on level: \nP")
1182 (gnus-group-list-groups level all level
))
1184 (defun gnus-group-prepare-logic (group test
)
1185 (or (and gnus-group-listed-groups
1186 (null gnus-group-list-option
)
1187 (member group gnus-group-listed-groups
))
1189 ((null gnus-group-listed-groups
) test
)
1190 ((null gnus-group-list-option
) test
)
1191 (t (and (member group gnus-group-listed-groups
)
1192 (if (eq gnus-group-list-option
'flush
)
1196 (defun gnus-group-prepare-flat (level &optional predicate lowest regexp
)
1197 "List all newsgroups with unread articles of level LEVEL or lower.
1198 If PREDICATE is a function, list groups that the function returns non-nil;
1199 if it is t, list groups that have no unread articles.
1200 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
1201 If REGEXP is a function, list dead groups that the function returns non-nil;
1202 if it is a string, only list groups matching REGEXP."
1203 (set-buffer gnus-group-buffer
)
1204 (let ((buffer-read-only nil
)
1205 (newsrc (cdr gnus-newsrc-alist
))
1206 (lowest (or lowest
1))
1207 (not-in-list (and gnus-group-listed-groups
1208 (copy-sequence gnus-group-listed-groups
)))
1209 info clevel unread group params
)
1211 (when (or (< lowest gnus-level-zombie
)
1212 gnus-group-listed-groups
)
1213 ;; List living groups.
1215 (setq info
(car newsrc
)
1216 group
(gnus-info-group info
)
1217 params
(gnus-info-params info
)
1219 unread
(car (gnus-gethash group gnus-newsrc-hashtb
)))
1221 (setq not-in-list
(delete group not-in-list
)))
1222 (when (gnus-group-prepare-logic
1224 (and unread
; This group might be unchecked
1225 (or (not (stringp regexp
))
1226 (string-match regexp group
))
1227 (<= (setq clevel
(gnus-info-level info
)) level
)
1230 ((functionp predicate
)
1231 (funcall predicate info
))
1232 (predicate t
) ; We list all groups?
1235 (if (eq unread t
) ; Unactivated?
1236 gnus-group-list-inactive-groups
1237 ; We list unactivated
1239 ; We list groups with unread articles
1240 (and gnus-list-groups-with-ticked-articles
1241 (cdr (assq 'tick
(gnus-info-marks info
))))
1242 ; And groups with tickeds
1243 ;; Check for permanent visibility.
1244 (and gnus-permanently-visible-groups
1245 (string-match gnus-permanently-visible-groups
1247 (memq 'visible params
)
1248 (cdr (assq 'visible params
)))))))
1249 (gnus-group-insert-group-line
1250 group
(gnus-info-level info
)
1251 (gnus-info-marks info
) unread
(gnus-info-method info
)))))
1253 ;; List dead groups.
1254 (when (or gnus-group-listed-groups
1255 (and (>= level gnus-level-zombie
)
1256 (<= lowest gnus-level-zombie
)))
1257 (gnus-group-prepare-flat-list-dead
1258 (setq gnus-zombie-list
(sort gnus-zombie-list
'string
<))
1259 gnus-level-zombie ?Z
1262 (dolist (group gnus-zombie-list
)
1263 (setq not-in-list
(delete group not-in-list
))))
1264 (when (or gnus-group-listed-groups
1265 (and (>= level gnus-level-killed
) (<= lowest gnus-level-killed
)))
1266 (gnus-group-prepare-flat-list-dead
1269 (setq gnus-killed-list
(sort gnus-killed-list
'string
<)))
1270 gnus-level-killed ?K regexp
))
1272 (gnus-group-set-mode-line)
1273 (setq gnus-group-list-mode
(cons level predicate
))
1274 (gnus-run-hooks 'gnus-group-prepare-hook
)
1277 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp
)
1278 ;; List zombies and killed lists somewhat faster, which was
1279 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
1280 ;; this by ignoring the group format specification altogether.
1282 (if (> (length groups
) gnus-group-listing-limit
)
1284 (setq group
(pop groups
))
1285 (when (gnus-group-prepare-logic
1288 (and (stringp regexp
) (string-match regexp group
))
1289 (and (functionp regexp
) (funcall regexp group
))))
1290 (gnus-add-text-properties
1291 (point) (prog1 (1+ (point))
1292 (insert " " mark
" *: "
1293 (gnus-group-decoded-name group
)
1295 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
1297 'gnus-level level
))))
1299 (setq group
(pop groups
))
1300 (when (gnus-group-prepare-logic
1303 (and (stringp regexp
) (string-match regexp group
))
1304 (and (functionp regexp
) (funcall regexp group
))))
1305 (gnus-group-insert-group-line
1307 (let ((active (gnus-active group
)))
1309 (if (zerop (cdr active
))
1311 (- (1+ (cdr active
)) (car active
)))
1313 (gnus-method-simplify (gnus-find-method-for-group group
))))))))
1315 (defun gnus-group-update-group-line ()
1316 "Update the current line in the group buffer."
1317 (let* ((buffer-read-only nil
)
1318 (group (gnus-group-group-name))
1319 (entry (and group
(gnus-gethash group gnus-newsrc-hashtb
)))
1320 gnus-group-indentation
)
1323 (not (gnus-ephemeral-group-p group
))
1325 (concat "(gnus-group-set-info '"
1326 (gnus-prin1-to-string (nth 2 entry
))
1328 (setq gnus-group-indentation
(gnus-group-group-indentation))
1330 (gnus-group-insert-group-line-info group
)
1332 (gnus-group-position-point))))
1334 (defun gnus-group-insert-group-line-info (group)
1335 "Insert GROUP on the current line."
1336 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
))
1337 (gnus-group-indentation (gnus-group-group-indentation))
1341 ;; (Un)subscribed group.
1342 (setq info
(nth 2 entry
))
1343 (gnus-group-insert-group-line
1344 group
(gnus-info-level info
) (gnus-info-marks info
)
1345 (or (car entry
) t
) (gnus-info-method info
)))
1346 ;; This group is dead.
1347 (gnus-group-insert-group-line
1349 (if (member group gnus-zombie-list
) gnus-level-zombie gnus-level-killed
)
1351 (if (setq active
(gnus-active group
))
1352 (if (zerop (cdr active
))
1354 (- (1+ (cdr active
)) (car active
)))
1356 (gnus-method-simplify (gnus-find-method-for-group group
))))))
1358 (defun gnus-number-of-unseen-articles-in-group (group)
1359 (let* ((info (nth 2 (gnus-group-entry group
)))
1360 (marked (gnus-info-marks info
))
1361 (seen (cdr (assq 'seen marked
)))
1362 (active (gnus-active group
)))
1365 (length (gnus-uncompress-range
1366 (gnus-range-difference
1367 (gnus-range-difference (list active
) (gnus-info-read info
))
1370 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1371 gnus-tmp-marked number
1373 "Insert a group line in the group buffer."
1374 (let* ((gnus-tmp-method
1375 (gnus-server-get-method gnus-tmp-group gnus-tmp-method
))
1376 (group-name-charset (gnus-group-name-charset gnus-tmp-method
1378 (gnus-tmp-active (gnus-active gnus-tmp-group
))
1379 (gnus-tmp-number-total
1381 (1+ (- (cdr gnus-tmp-active
) (car gnus-tmp-active
)))
1383 (gnus-tmp-number-of-unread
1384 (if (numberp number
) (int-to-string (max 0 number
))
1386 (gnus-tmp-number-of-read
1387 (if (numberp number
)
1388 (int-to-string (max 0 (- gnus-tmp-number-total number
)))
1390 (gnus-tmp-subscribed
1391 (cond ((<= gnus-tmp-level gnus-level-subscribed
) ?
)
1392 ((<= gnus-tmp-level gnus-level-unsubscribed
) ?U
)
1393 ((= gnus-tmp-level gnus-level-zombie
) ?Z
)
1395 (gnus-tmp-qualified-group
1396 (gnus-group-name-decode (gnus-group-real-name gnus-tmp-group
)
1397 group-name-charset
))
1399 (or (gnus-group-get-parameter gnus-tmp-group
'comment t
)
1401 (gnus-tmp-newsgroup-description
1402 (if gnus-description-hashtb
1403 (or (gnus-group-name-decode
1404 (gnus-gethash gnus-tmp-group gnus-description-hashtb
)
1405 group-name-charset
) "")
1408 (if (and gnus-moderated-hashtb
1409 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb
))
1411 (gnus-tmp-moderated-string
1412 (if (eq gnus-tmp-moderated ?m
) "(m)" ""))
1413 (gnus-tmp-group-icon "==&&==")
1414 (gnus-tmp-news-server (or (cadr gnus-tmp-method
) ""))
1415 (gnus-tmp-news-method (or (car gnus-tmp-method
) ""))
1416 (gnus-tmp-news-method-string
1418 (format "(%s:%s)" (car gnus-tmp-method
)
1419 (cadr gnus-tmp-method
)) ""))
1420 (gnus-tmp-marked-mark
1421 (if (and (numberp number
)
1423 (cdr (assq 'tick gnus-tmp-marked
)))
1425 (gnus-tmp-summary-live
1426 (if (and (not gnus-group-is-exiting-p
)
1427 (gnus-buffer-live-p (gnus-summary-buffer-name
1430 (gnus-tmp-process-marked
1431 (if (member gnus-tmp-group gnus-group-marked
)
1432 gnus-process-mark ?
))
1434 (or (and gnus-use-grouplens
1435 (bbb-grouplens-group-p gnus-tmp-group
))
1437 (buffer-read-only nil
)
1438 header gnus-tmp-header
) ; passed as parameter to user-funcs.
1440 (gnus-add-text-properties
1444 (let ((gnus-tmp-group (gnus-group-name-decode
1445 gnus-tmp-group group-name-charset
)))
1446 (eval gnus-group-line-format-spec
)))
1447 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb
)
1448 gnus-unread
,(if (numberp number
)
1449 (string-to-int gnus-tmp-number-of-unread
)
1451 gnus-marked
,gnus-tmp-marked-mark
1452 gnus-indentation
,gnus-group-indentation
1453 gnus-level
,gnus-tmp-level
))
1455 (when (inline (gnus-visual-p 'group-highlight
'highlight
))
1456 (gnus-run-hooks 'gnus-group-update-hook
))
1458 ;; Allow XEmacs to remove front-sticky text properties.
1459 (gnus-group-remove-excess-properties)))
1461 (defun gnus-group-highlight-line ()
1462 "Highlight the current line according to `gnus-group-highlight'."
1463 (let* ((list gnus-group-highlight
)
1465 (end (gnus-point-at-eol))
1466 ;; now find out where the line starts and leave point there.
1467 (beg (progn (beginning-of-line) (point)))
1468 (group (gnus-group-group-name))
1469 (entry (gnus-group-entry group
))
1470 (unread (if (numberp (car entry
)) (car entry
) 0))
1471 (active (gnus-active group
))
1472 (total (if active
(1+ (- (cdr active
) (car active
))) 0))
1473 (info (nth 2 entry
))
1474 (method (inline (gnus-server-get-method group
(gnus-info-method info
))))
1475 (marked (gnus-info-marks info
))
1476 (mailp (apply 'append
1479 (memq x
(assoc (symbol-name
1480 (car (or method gnus-select-method
)))
1481 gnus-valid-select-methods
)))
1482 '(mail post-mail
))))
1483 (level (or (gnus-info-level info
) gnus-level-killed
))
1484 (score (or (gnus-info-score info
) 0))
1485 (ticked (gnus-range-length (cdr (assq 'tick marked
))))
1486 (group-age (gnus-group-timestamp-delta group
))
1487 (inhibit-read-only t
))
1488 ;; Eval the cars of the lists until we find a match.
1490 (not (eval (caar list
))))
1491 (setq list
(cdr list
)))
1492 (let ((face (cdar list
)))
1493 (unless (eq face
(get-text-property beg
'face
))
1494 (gnus-put-text-property-excluding-characters-with-faces
1496 (setq face
(if (boundp face
) (symbol-value face
) face
)))
1497 (gnus-extent-start-open beg
)))
1500 (defun gnus-group-update-group (group &optional visible-only
)
1501 "Update all lines where GROUP appear.
1502 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1504 ;; Can't use `save-excursion' here, so we do it manually.
1505 (let ((buf (current-buffer))
1507 (set-buffer gnus-group-buffer
)
1508 (setq mark
(point-marker))
1509 ;; The buffer may be narrowed.
1512 (let ((ident (gnus-intern-safe group gnus-active-hashtb
))
1514 found buffer-read-only
)
1515 ;; Enter the current status into the dribble buffer.
1516 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
)))
1518 (not (gnus-ephemeral-group-p group
)))
1520 (concat "(gnus-group-set-info '"
1521 (gnus-prin1-to-string (nth 2 entry
))
1523 ;; Find all group instances. If topics are in use, each group
1524 ;; may be listed in more than once.
1525 (while (setq loc
(text-property-any
1526 loc
(point-max) 'gnus-group ident
))
1529 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1531 (gnus-group-insert-group-line-info group
)
1534 (gnus-run-hooks 'gnus-group-update-group-hook
)))
1535 (setq loc
(1+ loc
)))
1536 (unless (or found visible-only
)
1537 ;; No such line in the buffer, find out where it's supposed to
1538 ;; go, and insert it there (or at the end of the buffer).
1539 (if gnus-goto-missing-group-function
1540 (funcall gnus-goto-missing-group-function group
)
1541 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb
))))
1542 (while (and entry
(car entry
)
1546 (point-min) (point-max)
1547 'gnus-group
(gnus-intern-safe
1548 (caar entry
) gnus-active-hashtb
)))))
1549 (setq entry
(cdr entry
)))
1550 (or entry
(goto-char (point-max)))))
1551 ;; Finally insert the line.
1552 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1553 (gnus-group-insert-group-line-info group
)
1556 (gnus-run-hooks 'gnus-group-update-group-hook
))))
1557 (when gnus-group-update-group-function
1558 (funcall gnus-group-update-group-function group
))
1559 (gnus-group-set-mode-line)))
1561 (set-marker mark nil
)
1564 (defun gnus-group-set-mode-line ()
1565 "Update the mode line in the group buffer."
1566 (when (memq 'group gnus-updated-mode-lines
)
1567 ;; Yes, we want to keep this mode line updated.
1569 (set-buffer gnus-group-buffer
)
1570 (let* ((gformat (or gnus-group-mode-line-format-spec
1571 (gnus-set-format 'group-mode
)))
1572 (gnus-tmp-news-server (cadr gnus-select-method
))
1573 (gnus-tmp-news-method (car gnus-select-method
))
1574 (gnus-tmp-colon (if (equal gnus-tmp-news-server
"") "" ":"))
1576 gnus-tmp-header
;Dummy binding for user-defined formats
1577 ;; Get the resulting string.
1579 (and gnus-dribble-buffer
1580 (buffer-name gnus-dribble-buffer
)
1581 (buffer-modified-p gnus-dribble-buffer
)
1583 (set-buffer gnus-dribble-buffer
)
1584 (not (zerop (buffer-size))))))
1585 (mode-string (eval gformat
)))
1586 ;; Say whether the dribble buffer has been modified.
1587 (setq mode-line-modified
1588 (if modified
(car gnus-mode-line-modified
)
1589 (cdr gnus-mode-line-modified
)))
1590 ;; If the line is too long, we chop it off.
1591 (when (> (length mode-string
) max-len
)
1592 (setq mode-string
(substring mode-string
0 (- max-len
4))))
1594 (setq mode-line-buffer-identification
1595 (gnus-mode-line-buffer-identification
1596 (list mode-string
)))
1597 (set-buffer-modified-p modified
))))))
1599 (defun gnus-group-group-name ()
1600 "Get the name of the newsgroup on the current line."
1601 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group
)))
1603 (symbol-name group
))))
1605 (defun gnus-group-group-level ()
1606 "Get the level of the newsgroup on the current line."
1607 (get-text-property (gnus-point-at-bol) 'gnus-level
))
1609 (defun gnus-group-group-indentation ()
1610 "Get the indentation of the newsgroup on the current line."
1611 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation
)
1612 (and gnus-group-indentation-function
1613 (funcall gnus-group-indentation-function
))
1616 (defun gnus-group-group-unread ()
1617 "Get the number of unread articles of the newsgroup on the current line."
1618 (get-text-property (gnus-point-at-bol) 'gnus-unread
))
1620 (defun gnus-group-new-mail (group)
1621 (if (nnmail-new-mail-p (gnus-group-real-name group
))
1625 (defun gnus-group-level (group)
1626 "Return the estimated level of GROUP."
1627 (or (gnus-info-level (gnus-get-info group
))
1628 (and (member group gnus-zombie-list
) gnus-level-zombie
)
1631 (defun gnus-group-search-forward (&optional backward all level first-too
)
1632 "Find the next newsgroup with unread articles.
1633 If BACKWARD is non-nil, find the previous newsgroup instead.
1634 If ALL is non-nil, just find any newsgroup.
1635 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1637 If FIRST-TOO, the current line is also eligible as a target."
1638 (let ((way (if backward -
1 1))
1639 (low gnus-level-killed
)
1642 (if (and backward
(progn (beginning-of-line)) (bobp))
1651 (get-text-property (point) 'gnus-group
)
1655 (get-text-property (point) 'gnus-unread
)))
1656 (and (numberp unread
) (> unread
0)))
1657 (setq lev
(get-text-property (point)
1659 (<= lev gnus-level-subscribed
)))
1661 (and (setq lev
(get-text-property (point)
1670 (zerop (forward-line way
)))))
1672 (progn (gnus-group-position-point) t
)
1673 (goto-char (or pos beg
))
1676 ;;; Gnus group mode commands
1680 (defun gnus-group-mark-line-p ()
1683 (forward-char (or (cdr (assq 'process gnus-group-mark-positions
)) 2))
1684 (eq (char-after) gnus-process-mark
)))
1686 (defun gnus-group-mark-group (n &optional unmark no-advance
)
1687 "Mark the current group."
1689 (let ((buffer-read-only nil
)
1693 (when (setq group
(gnus-group-group-name))
1694 ;; Go to the mark position.
1696 (forward-char (or (cdr (assq 'process gnus-group-mark-positions
)) 2))
1697 (subst-char-in-region
1698 (point) (1+ (point)) (char-after)
1701 (setq gnus-group-marked
(delete group gnus-group-marked
))
1703 (setq gnus-group-marked
1704 (cons group
(delete group gnus-group-marked
)))
1705 gnus-process-mark
)))
1707 (gnus-group-next-group 1))
1709 (gnus-summary-position-point)
1712 (defun gnus-group-unmark-group (n)
1713 "Remove the mark from the current group."
1715 (gnus-group-mark-group n
'unmark
)
1716 (gnus-group-position-point))
1718 (defun gnus-group-unmark-all-groups ()
1719 "Unmark all groups."
1721 (let ((groups gnus-group-marked
))
1724 (gnus-group-remove-mark (pop groups
)))))
1725 (gnus-group-position-point))
1727 (defun gnus-group-mark-region (unmark beg end
)
1728 "Mark all groups between point and mark.
1729 If UNMARK, remove the mark instead."
1730 (interactive "P\nr")
1731 (let ((num (count-lines beg end
)))
1734 (- num
(gnus-group-mark-group num unmark
)))))
1736 (defun gnus-group-mark-buffer (&optional unmark
)
1737 "Mark all groups in the buffer.
1738 If UNMARK, remove the mark instead."
1740 (gnus-group-mark-region unmark
(point-min) (point-max)))
1742 (defun gnus-group-mark-regexp (regexp)
1743 "Mark all groups that match some regexp."
1744 (interactive "sMark (regexp): ")
1745 (let ((alist (cdr gnus-newsrc-alist
))
1749 (when (string-match regexp
(setq group
(gnus-info-group (pop alist
))))
1750 (gnus-group-jump-to-group group
)
1751 (gnus-group-set-mark group
)))))
1752 (gnus-group-position-point))
1754 (defun gnus-group-remove-mark (group &optional test-marked
)
1755 "Remove the process mark from GROUP and move point there.
1756 Return nil if the group isn't displayed."
1757 (if (gnus-group-goto-group group nil test-marked
)
1759 (gnus-group-mark-group 1 'unmark t
)
1761 (setq gnus-group-marked
1762 (delete group gnus-group-marked
))
1765 (defun gnus-group-set-mark (group)
1766 "Set the process mark on GROUP."
1767 (if (gnus-group-goto-group group
)
1769 (gnus-group-mark-group 1 nil t
))
1770 (setq gnus-group-marked
(cons group
(delete group gnus-group-marked
)))))
1772 (defun gnus-group-universal-argument (arg &optional groups func
)
1773 "Perform any command on all groups according to the process/prefix convention."
1775 (if (eq (setq func
(or func
1778 (substitute-command-keys
1779 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1781 (gnus-error 1 "Undefined key")
1782 (gnus-group-iterate arg
1784 (command-execute func
))))
1785 (gnus-group-position-point))
1787 (defun gnus-group-process-prefix (n)
1788 "Return a list of groups to work on.
1789 Take into consideration N (the prefix) and the list of marked groups."
1792 (setq n
(prefix-numeric-value n
))
1793 ;; There is a prefix, so we return a list of the N next
1795 (let ((way (if (< n
0) -
1 1))
1800 (if (setq group
(gnus-group-group-name))
1801 (push group groups
))
1803 (gnus-group-next-group way
)))
1805 ((and (gnus-region-active-p) (mark))
1806 ;; Work on the region between point and mark.
1807 (let ((max (max (point) (mark)))
1810 (goto-char (min (point) (mark)))
1813 (push (gnus-group-group-name) groups
)
1814 (zerop (gnus-group-next-group 1))
1816 (nreverse groups
))))
1818 ;; No prefix, but a list of marked articles.
1819 (reverse gnus-group-marked
))
1821 ;; Neither marked articles or a prefix, so we return the
1823 (let ((group (gnus-group-group-name)))
1824 (and group
(list group
))))))
1826 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't
1827 ;;; imagine why I went through these contortions...
1829 (let ((function (make-symbol "gnus-group-iterate-function"))
1830 (window (make-symbol "gnus-group-iterate-window"))
1831 (groups (make-symbol "gnus-group-iterate-groups"))
1832 (group (make-symbol "gnus-group-iterate-group")))
1834 `(defun gnus-group-iterate (arg ,function
)
1835 "Iterate FUNCTION over all process/prefixed groups.
1836 FUNCTION will be called with the group name as the parameter
1837 and with point over the group in question."
1838 (let ((,groups
(gnus-group-process-prefix arg
))
1839 (,window
(selected-window))
1842 (setq ,group
(car ,groups
)
1843 ,groups
(cdr ,groups
))
1844 (select-window ,window
)
1845 (gnus-group-remove-mark ,group
)
1846 (save-selected-window
1848 (funcall ,function
,group
)))))))))
1850 (put 'gnus-group-iterate
'lisp-indent-function
1)
1852 ;; Selecting groups.
1854 (defun gnus-group-read-group (&optional all no-article group select-articles
)
1855 "Read news in this newsgroup.
1856 If the prefix argument ALL is non-nil, already read articles become
1857 readable. IF ALL is a number, fetch this number of articles. If the
1858 optional argument NO-ARTICLE is non-nil, no article will be
1859 auto-selected upon group entry. If GROUP is non-nil, fetch that
1862 (let ((no-display (eq all
0))
1863 (group (or group
(gnus-group-group-name)))
1864 number active marked entry
)
1868 (error "No group on current line"))
1869 (setq marked
(gnus-info-marks
1870 (nth 2 (setq entry
(gnus-gethash
1871 group gnus-newsrc-hashtb
)))))
1872 ;; This group might be a dead group. In that case we have to get
1873 ;; the number of unread articles from `gnus-active-hashtb'.
1875 (cond ((numberp all
) all
)
1877 ((setq active
(gnus-active group
))
1878 (- (1+ (cdr active
)) (car active
)))))
1879 (gnus-summary-read-group
1880 group
(or all
(and (numberp number
)
1881 (zerop (+ number
(gnus-range-length
1882 (cdr (assq 'tick marked
)))
1884 (cdr (assq 'dormant marked
)))))))
1885 no-article nil no-display nil select-articles
)))
1887 (defun gnus-group-select-group (&optional all
)
1888 "Select this newsgroup.
1889 No article is selected automatically.
1890 If the group is opened, just switch the summary buffer.
1891 If ALL is non-nil, already read articles become readable.
1892 If ALL is a number, fetch this number of articles."
1894 (when (and (eobp) (not (gnus-group-group-name)))
1896 (gnus-group-read-group all t
))
1898 (defun gnus-group-quick-select-group (&optional all
)
1899 "Select the current group \"quickly\".
1900 This means that no highlighting or scoring will be performed.
1901 If ALL (the prefix argument) is 0, don't even generate the summary
1904 This might be useful if you want to toggle threading
1905 before entering the group."
1907 (require 'gnus-score
)
1909 gnus-score-find-score-files-function
1910 gnus-home-score-file
1911 gnus-apply-kill-hook
1912 gnus-summary-expunge-below
)
1913 (gnus-group-read-group all t
)))
1915 (defun gnus-group-visible-select-group (&optional all
)
1916 "Select the current group without hiding any articles."
1918 (let ((gnus-inhibit-limiting t
))
1919 (gnus-group-read-group all t
)))
1921 (defun gnus-group-select-group-ephemerally ()
1922 "Select the current group without doing any processing whatsoever.
1923 You will actually be entered into a group that's a copy of
1924 the current group; no changes you make while in this group will
1927 (require 'gnus-score
)
1929 gnus-score-find-score-files-function gnus-apply-kill-hook
1930 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1931 gnus-summary-mode-hook gnus-select-group-hook
1932 (group (gnus-group-group-name))
1933 (method (gnus-find-method-for-group group
)))
1934 (gnus-group-read-ephemeral-group
1935 (gnus-group-prefixed-name group method
) method
)))
1938 (defun gnus-fetch-group (group &optional articles
)
1939 "Start Gnus if necessary and enter GROUP.
1940 Returns whether the fetching was successful or not."
1941 (interactive (list (completing-read "Group name: " gnus-active-hashtb
)))
1942 (unless (get-buffer gnus-group-buffer
)
1944 (gnus-group-read-group articles nil group
))
1947 (defun gnus-fetch-group-other-frame (group)
1948 "Pop up a frame and enter GROUP."
1950 (let ((window (get-buffer-window gnus-group-buffer
)))
1952 (select-frame (window-frame window
)))
1953 ((= (length (frame-list)) 1)
1954 (select-frame (make-frame)))
1957 (gnus-fetch-group group
))
1959 (defvar gnus-ephemeral-group-server
0)
1961 (defcustom gnus-large-ephemeral-newsgroup
200
1962 "The number of articles which indicates a large ephemeral newsgroup.
1963 Same as `gnus-large-newsgroup', but only used for ephemeral newsgroups.
1965 If the number of articles in a newsgroup is greater than this value,
1966 confirmation is required for selecting the newsgroup. If it is nil, no
1967 confirmation is required."
1969 :group
'gnus-group-select
1970 :type
'(choice (const :tag
"No limit" nil
)
1973 (defcustom gnus-fetch-old-ephemeral-headers nil
1974 "Same as `gnus-fetch-old-headers', but only used for ephemeral newsgroups."
1977 :type
'(choice (const :tag
"off" nil
)
1980 (sexp :menu-tag
"other" t
)))
1982 ;; Enter a group that is not in the group buffer. Non-nil is returned
1983 ;; if selection was successful.
1984 (defun gnus-group-read-ephemeral-group (group method
&optional activate
1985 quit-config request-only
1989 "Read GROUP from METHOD as an ephemeral group.
1990 If ACTIVATE, request the group first.
1991 If QUIT-CONFIG, use that window configuration when exiting from the
1993 If REQUEST-ONLY, don't actually read the group; just request it.
1994 If SELECT-ARTICLES, only select those articles.
1995 If PARAMETERS, use those as the group parameters.
1996 If NUMBER, fetch this number of articles.
1998 Return the name of the group if selection was successful."
2001 ;; (gnus-read-group "Group name: ")
2003 "Group: " gnus-active-hashtb
2005 'gnus-group-history
)
2006 (gnus-read-method "From method: ")))
2007 ;; Transform the select method into a unique server.
2008 (when (stringp method
)
2009 (setq method
(gnus-server-to-method method
)))
2011 `(,(car method
) ,(concat (cadr method
) "-ephemeral")
2012 (,(intern (format "%s-address" (car method
))) ,(cadr method
))
2014 (let ((group (if (gnus-group-foreign-p group
) group
2015 (gnus-group-prefixed-name (gnus-group-real-name group
)
2020 ,gnus-level-default-subscribed nil nil
,method
2023 (cons 'quit-config quit-config
)
2025 (cons gnus-summary-buffer
2026 gnus-current-window-configuration
)))
2029 (push method gnus-ephemeral-servers
)
2030 (set-buffer gnus-group-buffer
)
2031 (unless (gnus-check-server method
)
2032 (error "Unable to contact server: %s" (gnus-status-message method
)))
2034 (gnus-activate-group group
'scan
)
2035 (unless (gnus-request-group group
)
2036 (error "Couldn't request group: %s"
2037 (nnheader-get-report (car method
)))))
2041 (when (let ((gnus-large-newsgroup gnus-large-ephemeral-newsgroup
)
2042 (gnus-fetch-old-headers
2043 gnus-fetch-old-ephemeral-headers
))
2044 (gnus-group-read-group (or number t
) t group select-articles
))
2048 (message "Quit reading the ephemeral group")
2051 (defun gnus-group-jump-to-group (group)
2052 "Jump to newsgroup GROUP."
2054 (list (mm-string-make-unibyte
2056 "Group: " gnus-active-hashtb nil
2057 (gnus-read-active-file-p)
2058 gnus-group-jump-to-group-prompt
2059 'gnus-group-history
))))
2061 (when (equal group
"")
2062 (error "Empty group name"))
2064 (unless (gnus-ephemeral-group-p group
)
2065 ;; Either go to the line in the group buffer...
2066 (unless (gnus-group-goto-group group
)
2067 ;; ... or insert the line.
2068 (gnus-group-update-group group
)
2069 (gnus-group-goto-group group
)))
2070 ;; Adjust cursor point.
2071 (gnus-group-position-point))
2073 (defun gnus-group-goto-group (group &optional far test-marked
)
2074 "Goto to newsgroup GROUP.
2075 If FAR, it is likely that the group is not on the current line.
2076 If TEST-MARKED, the line must be marked."
2080 ;; It's quite likely that we are on the right line, so
2081 ;; we check the current line first.
2083 (eq (get-text-property (point) 'gnus-group
)
2084 (gnus-intern-safe group gnus-active-hashtb
))
2085 (or (not test-marked
) (gnus-group-mark-line-p)))
2087 ;; Previous and next line are also likely, so we check them as well.
2091 (and (eq (get-text-property (point) 'gnus-group
)
2092 (gnus-intern-safe group gnus-active-hashtb
))
2093 (or (not test-marked
) (gnus-group-mark-line-p)))))
2099 (and (eq (get-text-property (point) 'gnus-group
)
2100 (gnus-intern-safe group gnus-active-hashtb
))
2101 (or (not test-marked
) (gnus-group-mark-line-p)))))
2105 (goto-char (point-min))
2107 (while (and (not found
)
2112 (gnus-intern-safe group gnus-active-hashtb
))))
2113 (if (gnus-group-mark-line-p)
2118 ;; Search through the entire buffer.
2121 (point-min) (point-max)
2122 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)))))))
2124 (defun gnus-group-next-group (n &optional silent
)
2125 "Go to next N'th newsgroup.
2126 If N is negative, search backward instead.
2127 Returns the difference between N and the number of skips actually
2130 (gnus-group-next-unread-group n t nil silent
))
2132 (defun gnus-group-next-unread-group (n &optional all level silent
)
2133 "Go to next N'th unread newsgroup.
2134 If N is negative, search backward instead.
2135 If ALL is non-nil, choose any newsgroup, unread or not.
2136 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
2137 such group can be found, the next group with a level higher than
2139 Returns the difference between N and the number of skips actually
2142 (let ((backward (< n
0))
2145 (gnus-group-search-forward
2146 backward
(or (not gnus-group-goto-unread
) all
) level
))
2150 (gnus-message 7 "No more%s newsgroups%s" (if all
"" " unread")
2151 (if level
" on this level or higher" "")))
2154 (defun gnus-group-prev-group (n)
2155 "Go to previous N'th newsgroup.
2156 Returns the difference between N and the number of skips actually
2159 (gnus-group-next-unread-group (- n
) t
))
2161 (defun gnus-group-prev-unread-group (n)
2162 "Go to previous N'th unread newsgroup.
2163 Returns the difference between N and the number of skips actually
2166 (gnus-group-next-unread-group (- n
)))
2168 (defun gnus-group-next-unread-group-same-level (n)
2169 "Go to next N'th unread newsgroup on the same level.
2170 If N is negative, search backward instead.
2171 Returns the difference between N and the number of skips actually
2174 (gnus-group-next-unread-group n t
(gnus-group-group-level))
2175 (gnus-group-position-point))
2177 (defun gnus-group-prev-unread-group-same-level (n)
2178 "Go to next N'th unread newsgroup on the same level.
2179 Returns the difference between N and the number of skips actually
2182 (gnus-group-next-unread-group (- n
) t
(gnus-group-group-level))
2183 (gnus-group-position-point))
2185 (defun gnus-group-best-unread-group (&optional exclude-group
)
2186 "Go to the group with the highest level.
2187 If EXCLUDE-GROUP, do not go to that group."
2189 (goto-char (point-min))
2193 (setq unread
(get-text-property (point) 'gnus-unread
))
2194 (when (and (numberp unread
) (> unread
0))
2195 (when (and (get-text-property (point) 'gnus-level
)
2196 (< (get-text-property (point) 'gnus-level
) best
)
2197 (or (not exclude-group
)
2198 (not (equal exclude-group
(gnus-group-group-name)))))
2199 (setq best
(get-text-property (point) 'gnus-level
))
2200 (setq best-point
(point))))
2203 (goto-char best-point
))
2204 (gnus-group-position-point)
2205 (and best-point
(gnus-group-group-name))))
2207 (defun gnus-group-first-unread-group ()
2208 "Go to the first group with unread articles."
2211 (let ((opoint (point))
2213 (goto-char (point-min))
2214 (if (or (eq (setq unread
(gnus-group-group-unread)) t
) ; Not active.
2215 (and (numberp unread
) ; Not a topic.
2216 (not (zerop unread
))) ; Has unread articles.
2217 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2220 nil
)) ; Not success.
2221 (gnus-group-position-point)))
2223 (defun gnus-group-enter-server-mode ()
2224 "Jump to the server buffer."
2226 (gnus-enter-server-buffer))
2228 (defun gnus-group-make-group (name &optional method address args
)
2229 "Add a new newsgroup.
2230 The user will be prompted for a NAME, for a select METHOD, and an
2234 (gnus-read-group "Group name: ")
2235 (gnus-read-method "From method: ")))
2237 (when (stringp method
)
2238 (setq method
(or (gnus-server-to-method method
) method
)))
2239 (let* ((meth (gnus-method-simplify
2241 (not (gnus-server-equal method gnus-select-method
)))
2242 (if address
(list (intern method
) address
)
2244 (nname (if method
(gnus-group-prefixed-name name meth
) name
))
2246 (when (gnus-gethash nname gnus-newsrc-hashtb
)
2247 (error "Group %s already exists" nname
))
2248 ;; Subscribe to the new group.
2249 (gnus-group-change-level
2250 (setq info
(list t nname gnus-level-default-subscribed nil nil meth
))
2251 gnus-level-default-subscribed gnus-level-killed
2252 (and (gnus-group-group-name)
2253 (gnus-gethash (gnus-group-group-name)
2254 gnus-newsrc-hashtb
))
2257 (gnus-set-active nname
(cons 1 0))
2258 (unless (gnus-ephemeral-group-p name
)
2260 (concat "(gnus-group-set-info '"
2261 (gnus-prin1-to-string (cdr info
)) ")")))
2263 (gnus-group-insert-group-line-info nname
)
2265 (gnus-group-position-point)
2267 ;; Load the back end and try to make the back end create
2268 ;; the group as well.
2269 (when (assoc (symbol-name (setq backend
(car (gnus-server-get-method
2271 gnus-valid-select-methods
)
2273 (gnus-check-server meth
)
2274 (when (gnus-check-backend-function 'request-create-group nname
)
2275 (unless (gnus-request-create-group nname nil args
)
2276 (error "Could not create group on server: %s"
2277 (nnheader-get-report backend
))))
2280 (defun gnus-group-delete-groups (&optional arg
)
2281 "Delete the current group. Only meaningful with editable groups."
2283 (let ((n (length (gnus-group-process-prefix arg
))))
2284 (when (gnus-yes-or-no-p
2286 "Delete this 1 group? "
2287 (format "Delete these %d groups? " n
)))
2288 (gnus-group-iterate arg
2290 (gnus-group-delete-group group nil t
))))))
2292 (defun gnus-group-delete-group (group &optional force no-prompt
)
2293 "Delete the current group. Only meaningful with editable groups.
2294 If FORCE (the prefix) is non-nil, all the articles in the group will
2295 be deleted. This is \"deleted\" as in \"removed forever from the face
2296 of the Earth\". There is no undo. The user will be prompted before
2298 Note that you also have to specify FORCE if you want the group to
2299 be removed from the server, even when it's empty."
2301 (list (gnus-group-group-name)
2302 current-prefix-arg
))
2304 (error "No group to delete"))
2305 (unless (gnus-check-backend-function 'request-delete-group group
)
2306 (error "This back end does not support group deletion"))
2308 (if (and (not no-prompt
)
2309 (not (gnus-yes-or-no-p
2311 "Do you really want to delete %s%s? "
2312 group
(if force
" and all its contents" "")))))
2314 (gnus-message 6 "Deleting group %s..." group
)
2315 (if (not (gnus-request-delete-group group force
))
2316 (gnus-error 3 "Couldn't delete group %s" group
)
2317 (gnus-message 6 "Deleting group %s...done" group
)
2318 (gnus-group-goto-group group
)
2319 (gnus-group-kill-group 1 t
)
2320 (gnus-sethash group nil gnus-active-hashtb
)
2322 (gnus-group-position-point)))
2324 (defun gnus-group-rename-group (group new-name
)
2325 "Rename group from GROUP to NEW-NAME.
2326 When used interactively, GROUP is the group under point
2327 and NEW-NAME will be prompted for."
2330 (gnus-group-group-name)
2332 (unless (gnus-check-backend-function
2333 'request-rename-group
(gnus-group-group-name))
2334 (error "This back end does not support renaming groups"))
2335 (gnus-read-group "Rename group to: "
2336 (gnus-group-real-name (gnus-group-group-name))))))
2338 (unless (gnus-check-backend-function 'request-rename-group group
)
2339 (error "This back end does not support renaming groups"))
2341 (error "No group to rename"))
2342 (when (equal (gnus-group-real-name group
) new-name
)
2343 (error "Can't rename to the same name"))
2345 ;; We find the proper prefixed name.
2347 (if (gnus-group-native-p group
)
2351 (gnus-group-prefixed-name
2352 (gnus-group-real-name new-name
)
2353 (gnus-info-method (gnus-get-info group
)))))
2355 (when (gnus-active new-name
)
2356 (error "The group %s already exists" new-name
))
2358 (gnus-message 6 "Renaming group %s to %s..." group new-name
)
2361 (gnus-group-goto-group group
)
2362 (not (when (< (gnus-group-group-level) gnus-level-zombie
)
2363 (gnus-request-rename-group group new-name
))))
2364 (gnus-error 3 "Couldn't rename group %s to %s" group new-name
)
2365 ;; We rename the group internally by killing it...
2366 (gnus-group-kill-group)
2367 ;; ... changing its name ...
2368 (setcar (cdar gnus-list-of-killed-groups
) new-name
)
2369 ;; ... and then yanking it. Magic!
2370 (gnus-group-yank-group)
2371 (gnus-set-active new-name
(gnus-active group
))
2372 (gnus-message 6 "Renaming group %s to %s...done" group new-name
)
2374 (setq gnus-killed-list
(delete group gnus-killed-list
))
2375 (gnus-set-active group nil
)
2376 (gnus-dribble-touch)
2377 (gnus-group-position-point)))
2379 (defun gnus-group-edit-group (group &optional part
)
2380 "Edit the group on the current line."
2381 (interactive (list (gnus-group-group-name)))
2382 (let ((part (or part
'info
))
2385 (error "No group on current line"))
2386 (unless (setq info
(gnus-get-info group
))
2387 (error "Killed group; can't be edited"))
2389 (gnus-close-group group
))
2391 ;; Find the proper form to edit.
2392 (cond ((eq part
'method
)
2393 (or (gnus-info-method info
) "native"))
2395 (gnus-info-params info
))
2397 ;; The proper documentation.
2399 "Editing the %s for `%s'."
2401 ((eq part
'method
) "select method")
2402 ((eq part
'params
) "group parameters")
2404 (gnus-group-decoded-name group
))
2406 (gnus-group-edit-group-done ',part
,group form
)))
2409 (gnus-create-info-command
2412 "(gnus)Select Methods")
2414 "(gnus)Group Parameters")
2416 "(gnus)Group Info"))))))
2418 (defun gnus-group-edit-group-method (group)
2419 "Edit the select method of GROUP."
2420 (interactive (list (gnus-group-group-name)))
2421 (gnus-group-edit-group group
'method
))
2423 (defun gnus-group-edit-group-parameters (group)
2424 "Edit the group parameters of GROUP."
2425 (interactive (list (gnus-group-group-name)))
2426 (gnus-group-edit-group group
'params
))
2428 (defun gnus-group-edit-group-done (part group form
)
2430 (let* ((method (cond ((eq part
'info
) (nth 4 form
))
2431 ((eq part
'method
) form
)
2433 (info (cond ((eq part
'info
) form
)
2434 ((eq part
'method
) (gnus-get-info group
))
2437 (if (or (not method
)
2439 gnus-select-method method
))
2440 (gnus-group-real-name (car info
))
2441 (gnus-group-prefixed-name
2442 (gnus-group-real-name (car info
)) method
))
2444 (when (and new-group
2445 (not (equal new-group group
)))
2446 (when (gnus-group-goto-group group
)
2447 (gnus-group-kill-group 1))
2448 (gnus-activate-group new-group
))
2450 (if (not (and info new-group
))
2451 (gnus-group-set-info form
(or new-group group
) part
)
2452 (setq info
(gnus-copy-sequence info
))
2453 (setcar info new-group
)
2454 (unless (gnus-server-equal method
"native")
2455 (unless (nthcdr 3 info
)
2456 (nconc info
(list nil nil
)))
2457 (unless (nthcdr 4 info
)
2458 (nconc info
(list nil
)))
2459 (gnus-info-set-method info method
))
2460 (gnus-group-set-info info
))
2461 (gnus-group-update-group (or new-group group
))
2462 (gnus-group-position-point)))
2464 (defun gnus-group-make-useful-group (group method
)
2465 "Create one of the groups described in `gnus-useful-groups'."
2467 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2469 gnus-useful-groups
)))
2470 (list (cadr entry
) (caddr entry
))))
2471 (setq method
(gnus-copy-sequence method
))
2473 (while (setq entry
(memq (assq 'eval method
) method
))
2474 (setcar entry
(eval (cadar entry
)))))
2475 (gnus-group-make-group group method
))
2477 (defun gnus-group-make-help-group (&optional noerror
)
2478 "Create the Gnus documentation group.
2479 Optional argument NOERROR modifies the behavior of this function when the
2480 group already exists:
2481 - if not given, and error is signaled,
2482 - if t, stay silent,
2483 - if anything else, just print a message."
2485 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2486 (file (nnheader-find-etc-directory "gnus-tut.txt" t
)))
2487 (if (gnus-gethash name gnus-newsrc-hashtb
)
2488 (cond ((eq noerror nil
)
2489 (error "Documentation group already exists"))
2494 (gnus-message 1 "Documentation group already exists")))
2497 (gnus-message 1 "Couldn't find doc group")
2498 (gnus-group-make-group
2499 (gnus-group-real-name name
)
2500 (list 'nndoc
"gnus-help"
2501 (list 'nndoc-address file
)
2502 (list 'nndoc-article-type
'mbox
))))
2504 (gnus-group-position-point))
2506 (defun gnus-group-make-doc-group (file type
)
2507 "Create a group that uses a single file as the source.
2509 If called with a prefix argument, ask for the file type."
2511 (list (read-file-name "File name: ")
2512 (and current-prefix-arg
'ask
)))
2513 (when (eq type
'ask
)
2518 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [m, b, d, f, a, g]: "
2520 (setq found
(cond ((= (setq char
(read-char)) ?m
) 'mbox
)
2521 ((= char ?b
) 'babyl
)
2522 ((= char ?d
) 'digest
)
2523 ((= char ?f
) 'forward
)
2525 ((= char ?g
) 'guess
)
2526 (t (setq err
(format "%c unknown. " char
))
2529 (let* ((file (expand-file-name file
))
2530 (name (gnus-generate-new-group-name
2531 (gnus-group-prefixed-name
2532 (file-name-nondirectory file
) '(nndoc "")))))
2533 (gnus-group-make-group
2534 (gnus-group-real-name name
)
2536 (list 'nndoc-address file
)
2537 (list 'nndoc-article-type
(or type
'guess
))))))
2539 (defvar nnweb-type-definition
)
2540 (defvar gnus-group-web-type-history nil
)
2541 (defvar gnus-group-web-search-history nil
)
2542 (defun gnus-group-make-web-group (&optional solid
)
2543 "Create an ephemeral nnweb group.
2544 If SOLID (the prefix), create a solid group."
2548 (if solid
(gnus-read-group "Group name: ")
2549 (message-unique-id)))
2550 (default-type (or (car gnus-group-web-type-history
)
2551 (symbol-name (caar nnweb-type-definition
))))
2555 (format "Search engine type (default %s): " default-type
)
2556 (mapcar (lambda (elem) (list (symbol-name (car elem
))))
2557 nnweb-type-definition
)
2558 nil t nil
'gnus-group-web-type-history
)
2563 (cons (or (car gnus-group-web-search-history
) "") 0)
2564 'gnus-group-web-search-history
))
2566 `(nnweb ,group
(nnweb-search ,search
)
2567 (nnweb-type ,(intern type
))
2568 (nnweb-ephemeral-p t
))))
2571 (gnus-pull 'nnweb-ephemeral-p method
)
2572 (gnus-group-make-group group method
))
2573 (gnus-group-read-ephemeral-group
2575 (cons (current-buffer)
2576 (if (eq major-mode
'gnus-summary-mode
) 'summary
'group
))))))
2579 (defvar nnrss-group-alist
)
2580 (defun nnrss-discover-feed (arg))
2581 (defun nnrss-save-server-data (arg)))
2582 (defun gnus-group-make-rss-group (&optional url
)
2583 "Given a URL, discover if there is an RSS feed.
2584 If there is, use Gnus to create an nnrss group"
2588 (setq url
(read-from-minibuffer "URL to Search for RSS: ")))
2589 (let ((feedinfo (nnrss-discover-feed url
)))
2591 (let ((title (read-from-minibuffer "Title: "
2594 (desc (read-from-minibuffer "Description: "
2595 (cdr (assoc 'description
2597 (href (cdr (assoc 'href feedinfo
))))
2598 (push (list title href desc
)
2600 (gnus-group-make-group title
'(nnrss ""))
2601 (nnrss-save-server-data nil
))
2602 (error "No feeds found for %s" url
))))
2604 (defvar nnwarchive-type-definition
)
2605 (defvar gnus-group-warchive-type-history nil
)
2606 (defvar gnus-group-warchive-login-history nil
)
2607 (defvar gnus-group-warchive-address-history nil
)
2609 (defun gnus-group-make-warchive-group ()
2610 "Create a nnwarchive group."
2612 (require 'nnwarchive
)
2613 (let* ((group (gnus-read-group "Group name: "))
2614 (default-type (or (car gnus-group-warchive-type-history
)
2615 (symbol-name (caar nnwarchive-type-definition
))))
2619 (format "Warchive type (default %s): " default-type
)
2620 (mapcar (lambda (elem) (list (symbol-name (car elem
))))
2621 nnwarchive-type-definition
)
2622 nil t nil
'gnus-group-warchive-type-history
)
2624 (address (read-string "Warchive address: "
2625 nil
'gnus-group-warchive-address-history
))
2626 (default-login (or (car gnus-group-warchive-login-history
)
2631 (format "Warchive login (default %s): " user-mail-address
)
2632 default-login
'gnus-group-warchive-login-history
)
2635 `(nnwarchive ,address
2636 (nnwarchive-type ,(intern type
))
2637 (nnwarchive-login ,login
))))
2638 (gnus-group-make-group group method
)))
2640 (defun gnus-group-make-archive-group (&optional all
)
2641 "Create the (ding) Gnus archive group of the most recent articles.
2642 Given a prefix, create a full group."
2644 (let ((group (gnus-group-prefixed-name
2645 (if all
"ding.archives" "ding.recent") '(nndir ""))))
2646 (when (gnus-gethash group gnus-newsrc-hashtb
)
2647 (error "Archive group already exists"))
2648 (gnus-group-make-group
2649 (gnus-group-real-name group
)
2650 (list 'nndir
(if all
"hpc" "edu")
2651 (list 'nndir-directory
2652 (if all gnus-group-archive-directory
2653 gnus-group-recent-archive-directory
))))
2654 (gnus-group-add-parameter group
(cons 'to-address
"ding@gnus.org"))))
2656 (defun gnus-group-make-directory-group (dir)
2657 "Create an nndir group.
2658 The user will be prompted for a directory. The contents of this
2659 directory will be used as a newsgroup. The directory should contain
2660 mail messages or news articles in files that have numeric names."
2662 (list (read-file-name "Create group from directory: ")))
2663 (unless (file-exists-p dir
)
2664 (error "No such directory"))
2665 (unless (file-directory-p dir
)
2666 (error "Not a directory"))
2670 (while (or (not group
) (gnus-gethash group gnus-newsrc-hashtb
))
2672 (gnus-group-prefixed-name
2673 (expand-file-name ext dir
)
2675 (setq ext
(format "<%d>" (setq i
(1+ i
)))))
2676 (gnus-group-make-group
2677 (gnus-group-real-name group
)
2678 (list 'nndir
(gnus-group-real-name group
) (list 'nndir-directory dir
)))))
2680 (defvar nnkiboze-score-file
)
2681 (defun gnus-group-make-kiboze-group (group address scores
)
2682 "Create an nnkiboze group.
2683 The user will be prompted for a name, a regexp to match groups, and
2684 score file entries for articles to include in the group."
2687 (read-string "nnkiboze group name: ")
2688 (read-string "Source groups (regexp): ")
2689 (let ((headers (mapcar (lambda (group) (list group
))
2690 '("subject" "from" "number" "date" "message-id"
2691 "references" "chars" "lines" "xref"
2692 "followup" "all" "body" "head")))
2693 scores header regexp regexps
)
2694 (while (not (equal "" (setq header
(completing-read
2695 "Match on header: " headers nil t
))))
2697 (while (not (equal "" (setq regexp
(read-string
2698 (format "Match on %s (regexp): "
2700 (push (list regexp nil nil
'r
) regexps
))
2701 (push (cons header regexps
) scores
))
2703 (gnus-group-make-group group
"nnkiboze" address
)
2704 (let* ((nnkiboze-current-group group
)
2705 (score-file (car (nnkiboze-score-file "")))
2706 (score-dir (file-name-directory score-file
)))
2707 (unless (file-exists-p score-dir
)
2708 (make-directory score-dir
))
2709 (with-temp-file score-file
2710 (let (emacs-lisp-mode-hook)
2711 (gnus-pp scores
)))))
2713 (defun gnus-group-add-to-virtual (n vgroup
)
2714 "Add the current group to a virtual group."
2716 (list current-prefix-arg
2717 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2719 (unless (eq (car (gnus-find-method-for-group vgroup
)) 'nnvirtual
)
2720 (error "%s is not an nnvirtual group" vgroup
))
2721 (gnus-close-group vgroup
)
2722 (let* ((groups (gnus-group-process-prefix n
))
2723 (method (gnus-info-method (gnus-get-info vgroup
))))
2724 (setcar (cdr method
)
2726 (nth 1 method
) "\\|"
2729 (gnus-group-remove-mark s
)
2730 (concat "\\(^" (regexp-quote s
) "$\\)"))
2732 (gnus-group-position-point))
2734 (defun gnus-group-make-empty-virtual (group)
2735 "Create a new, fresh, empty virtual group."
2736 (interactive "sCreate new, empty virtual group: ")
2737 (let* ((method (list 'nnvirtual
"^$"))
2738 (pgroup (gnus-group-prefixed-name group method
)))
2739 ;; Check whether it exists already.
2740 (when (gnus-gethash pgroup gnus-newsrc-hashtb
)
2741 (error "Group %s already exists" pgroup
))
2742 ;; Subscribe the new group after the group on the current line.
2743 (gnus-subscribe-group pgroup
(gnus-group-group-name) method
)
2744 (gnus-group-update-group pgroup
)
2746 (gnus-group-position-point)))
2748 (defun gnus-group-enter-directory (dir)
2749 "Enter an ephemeral nneething group."
2750 (interactive "DDirectory to read: ")
2751 (let* ((method (list 'nneething dir
'(nneething-read-only t
)))
2752 (leaf (gnus-group-prefixed-name
2753 (file-name-nondirectory (directory-file-name dir
))
2755 (name (gnus-generate-new-group-name leaf
)))
2756 (unless (gnus-group-read-ephemeral-group
2758 (cons (current-buffer)
2759 (if (eq major-mode
'gnus-summary-mode
)
2761 (error "Couldn't enter %s" dir
))))
2764 (autoload 'nnimap-expunge
"nnimap")
2765 (autoload 'nnimap-acl-get
"nnimap")
2766 (autoload 'nnimap-acl-edit
"nnimap"))
2768 (defun gnus-group-nnimap-expunge (group)
2769 "Expunge deleted articles in current nnimap GROUP."
2770 (interactive (list (gnus-group-group-name)))
2771 (let ((mailbox (gnus-group-real-name group
)) method
)
2773 (error "No group on current line"))
2774 (unless (gnus-get-info group
)
2775 (error "Killed group; can't be edited"))
2776 (unless (eq 'nnimap
(car (setq method
(gnus-find-method-for-group group
))))
2777 (error "%s is not an nnimap group" group
))
2778 (nnimap-expunge mailbox
(cadr method
))))
2780 (defun gnus-group-nnimap-edit-acl (group)
2781 "Edit the Access Control List of current nnimap GROUP."
2782 (interactive (list (gnus-group-group-name)))
2783 (let ((mailbox (gnus-group-real-name group
)) method acl
)
2785 (error "No group on current line"))
2786 (unless (gnus-get-info group
)
2787 (error "Killed group; can't be edited"))
2788 (unless (eq (car (setq method
(gnus-find-method-for-group group
))) 'nnimap
)
2789 (error "%s is not an nnimap group" group
))
2790 (unless (setq acl
(nnimap-acl-get mailbox
(cadr method
)))
2791 (error "Server does not support ACL's"))
2792 (gnus-edit-form acl
(format "Editing the access control list for `%s'.
2794 An access control list is a list of (identifier . rights) elements.
2796 The identifier string specifies the corresponding user. The
2797 identifier \"anyone\" is reserved to refer to the universal identity.
2799 Rights is a string listing a (possibly empty) set of alphanumeric
2800 characters, each character listing a set of operations which is being
2801 controlled. Letters are reserved for ``standard'' rights, listed
2802 below. Digits are reserved for implementation or site defined rights.
2804 l - lookup (mailbox is visible to LIST/LSUB commands)
2805 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2806 SEARCH, COPY from mailbox)
2807 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2808 w - write (STORE flags other than \\SEEN and \\DELETED)
2809 i - insert (perform APPEND, COPY into mailbox)
2810 p - post (send mail to submission address for mailbox,
2811 not enforced by IMAP4 itself)
2812 c - create and delete mailbox (CREATE new sub-mailboxes in any
2813 implementation-defined hierarchy, RENAME or DELETE mailbox)
2814 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2815 a - administer (perform SETACL)" group
)
2818 ,mailbox
',method
',acl form
)))))
2820 ;; Group sorting commands
2821 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2823 (defun gnus-group-sort-groups (func &optional reverse
)
2824 "Sort the group buffer according to FUNC.
2825 When used interactively, the sorting function used will be
2826 determined by the `gnus-group-sort-function' variable.
2827 If REVERSE (the prefix), reverse the sorting order."
2828 (interactive (list gnus-group-sort-function current-prefix-arg
))
2829 (funcall gnus-group-sort-alist-function
2830 (gnus-make-sort-function func
) reverse
)
2831 (gnus-group-unmark-all-groups)
2832 (gnus-group-list-groups)
2833 (gnus-dribble-touch))
2835 (defun gnus-group-sort-flat (func reverse
)
2836 ;; We peel off the dummy group from the alist.
2838 (when (equal (gnus-info-group (car gnus-newsrc-alist
)) "dummy.group")
2839 (pop gnus-newsrc-alist
))
2841 (setq gnus-newsrc-alist
2842 (sort gnus-newsrc-alist func
))
2844 (setq gnus-newsrc-alist
(nreverse gnus-newsrc-alist
)))
2845 ;; Regenerate the hash table.
2846 (gnus-make-hashtable-from-newsrc-alist)))
2848 (defun gnus-group-sort-groups-by-alphabet (&optional reverse
)
2849 "Sort the group buffer alphabetically by group name.
2850 If REVERSE, sort in reverse order."
2852 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse
))
2854 (defun gnus-group-sort-groups-by-real-name (&optional reverse
)
2855 "Sort the group buffer alphabetically by real (unprefixed) group name.
2856 If REVERSE, sort in reverse order."
2858 (gnus-group-sort-groups 'gnus-group-sort-by-real-name reverse
))
2860 (defun gnus-group-sort-groups-by-unread (&optional reverse
)
2861 "Sort the group buffer by number of unread articles.
2862 If REVERSE, sort in reverse order."
2864 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse
))
2866 (defun gnus-group-sort-groups-by-level (&optional reverse
)
2867 "Sort the group buffer by group level.
2868 If REVERSE, sort in reverse order."
2870 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse
))
2872 (defun gnus-group-sort-groups-by-score (&optional reverse
)
2873 "Sort the group buffer by group score.
2874 If REVERSE, sort in reverse order."
2876 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse
))
2878 (defun gnus-group-sort-groups-by-rank (&optional reverse
)
2879 "Sort the group buffer by group rank.
2880 If REVERSE, sort in reverse order."
2882 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse
))
2884 (defun gnus-group-sort-groups-by-method (&optional reverse
)
2885 "Sort the group buffer alphabetically by back end name.
2886 If REVERSE, sort in reverse order."
2888 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse
))
2890 (defun gnus-group-sort-groups-by-server (&optional reverse
)
2891 "Sort the group buffer alphabetically by server name.
2892 If REVERSE, sort in reverse order."
2894 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse
))
2896 ;;; Selected group sorting.
2898 (defun gnus-group-sort-selected-groups (n func
&optional reverse
)
2899 "Sort the process/prefixed groups."
2900 (interactive (list current-prefix-arg gnus-group-sort-function
))
2901 (let ((groups (gnus-group-process-prefix n
)))
2902 (funcall gnus-group-sort-selected-function
2903 groups
(gnus-make-sort-function func
) reverse
)
2904 (gnus-group-unmark-all-groups)
2905 (gnus-group-list-groups)
2906 (gnus-dribble-touch)))
2908 (defun gnus-group-sort-selected-flat (groups func reverse
)
2909 (let (entries infos
)
2910 ;; First find all the group entries for these groups.
2912 (push (nthcdr 2 (gnus-gethash (pop groups
) gnus-newsrc-hashtb
))
2914 ;; Then sort the infos.
2918 (lambda (entry) (car entry
))
2919 (setq entries
(nreverse entries
)))
2922 (setq infos
(nreverse infos
)))
2923 ;; Go through all the infos and replace the old entries
2924 ;; with the new infos.
2926 (setcar (car entries
) (pop infos
))
2928 ;; Update the hashtable.
2929 (gnus-make-hashtable-from-newsrc-alist)))
2931 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse
)
2932 "Sort the group buffer alphabetically by group name.
2933 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2934 sort in reverse order."
2935 (interactive (gnus-interactive "P\ny"))
2936 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-alphabet reverse
))
2938 (defun gnus-group-sort-selected-groups-by-real-name (&optional n reverse
)
2939 "Sort the group buffer alphabetically by real group name.
2940 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2941 sort in reverse order."
2942 (interactive (gnus-interactive "P\ny"))
2943 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-real-name reverse
))
2945 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse
)
2946 "Sort the group buffer by number of unread articles.
2947 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2948 sort in reverse order."
2949 (interactive (gnus-interactive "P\ny"))
2950 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-unread reverse
))
2952 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse
)
2953 "Sort the group buffer by group level.
2954 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2955 sort in reverse order."
2956 (interactive (gnus-interactive "P\ny"))
2957 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-level reverse
))
2959 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse
)
2960 "Sort the group buffer by group score.
2961 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2962 sort in reverse order."
2963 (interactive (gnus-interactive "P\ny"))
2964 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-score reverse
))
2966 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse
)
2967 "Sort the group buffer by group rank.
2968 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2969 sort in reverse order."
2970 (interactive (gnus-interactive "P\ny"))
2971 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-rank reverse
))
2973 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse
)
2974 "Sort the group buffer alphabetically by back end name.
2975 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2976 sort in reverse order."
2977 (interactive (gnus-interactive "P\ny"))
2978 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-method reverse
))
2980 ;;; Sorting predicates.
2982 (defun gnus-group-sort-by-alphabet (info1 info2
)
2983 "Sort alphabetically."
2984 (string< (gnus-info-group info1
) (gnus-info-group info2
)))
2986 (defun gnus-group-sort-by-real-name (info1 info2
)
2987 "Sort alphabetically on real (unprefixed) names."
2988 (string< (gnus-group-real-name (gnus-info-group info1
))
2989 (gnus-group-real-name (gnus-info-group info2
))))
2991 (defun gnus-group-sort-by-unread (info1 info2
)
2992 "Sort by number of unread articles."
2993 (let ((n1 (car (gnus-gethash (gnus-info-group info1
) gnus-newsrc-hashtb
)))
2994 (n2 (car (gnus-gethash (gnus-info-group info2
) gnus-newsrc-hashtb
))))
2995 (< (or (and (numberp n1
) n1
) 0)
2996 (or (and (numberp n2
) n2
) 0))))
2998 (defun gnus-group-sort-by-level (info1 info2
)
3000 (< (gnus-info-level info1
) (gnus-info-level info2
)))
3002 (defun gnus-group-sort-by-method (info1 info2
)
3003 "Sort alphabetically by back end name."
3004 (string< (car (gnus-find-method-for-group
3005 (gnus-info-group info1
) info1
))
3006 (car (gnus-find-method-for-group
3007 (gnus-info-group info2
) info2
))))
3009 (defun gnus-group-sort-by-server (info1 info2
)
3010 "Sort alphabetically by server name."
3011 (string< (gnus-method-to-full-server-name
3012 (gnus-find-method-for-group
3013 (gnus-info-group info1
) info1
))
3014 (gnus-method-to-full-server-name
3015 (gnus-find-method-for-group
3016 (gnus-info-group info2
) info2
))))
3018 (defun gnus-group-sort-by-score (info1 info2
)
3019 "Sort by group score."
3020 (> (gnus-info-score info1
) (gnus-info-score info2
)))
3022 (defun gnus-group-sort-by-rank (info1 info2
)
3023 "Sort by level and score."
3024 (let ((level1 (gnus-info-level info1
))
3025 (level2 (gnus-info-level info2
)))
3026 (or (< level1 level2
)
3027 (and (= level1 level2
)
3028 (> (gnus-info-score info1
) (gnus-info-score info2
))))))
3032 (defun gnus-group-clear-data (&optional arg
)
3033 "Clear all marks and read ranges from the current group.
3034 Obeys the process/prefix convention."
3036 (gnus-group-iterate arg
3039 (gnus-info-clear-data (setq info
(gnus-get-info group
)))
3040 (gnus-get-unread-articles-in-group info
(gnus-active group
) t
)
3041 (when (gnus-group-goto-group group
)
3042 (gnus-group-update-group-line))))))
3044 (defun gnus-group-clear-data-on-native-groups ()
3045 "Clear all marks and read ranges from all native groups."
3047 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
3048 (let ((alist (cdr gnus-newsrc-alist
))
3050 (while (setq info
(pop alist
))
3051 (when (gnus-group-native-p (gnus-info-group info
))
3052 (gnus-info-clear-data info
)))
3053 (gnus-get-unread-articles)
3054 (gnus-dribble-touch)
3055 (when (gnus-y-or-n-p
3056 "Move the cache away to avoid problems in the future? ")
3057 (call-interactively 'gnus-cache-move-cache
)))))
3059 (defun gnus-info-clear-data (info)
3060 "Clear all marks and read ranges from INFO."
3061 (let ((group (gnus-info-group info
))
3063 (dolist (el (gnus-info-marks info
))
3064 (push `(,(cdr el
) add
(,(car el
))) action
))
3065 (push `(,(gnus-info-read info
) add
(read)) action
)
3068 (gnus-request-set-mark ,group
',action
)
3069 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
3070 (gnus-info-set-read ',info
',(gnus-info-read info
))
3071 (when (gnus-group-goto-group ,group
)
3072 (gnus-get-unread-articles-in-group ',info
',(gnus-active group
) t
)
3073 (gnus-group-update-group-line))))
3074 (setq action
(mapcar (lambda (el) (list (nth 0 el
) 'del
(nth 2 el
)))
3076 (gnus-request-set-mark group action
)
3077 (gnus-info-set-read info nil
)
3078 (when (gnus-info-marks info
)
3079 (gnus-info-set-marks info nil
))))
3081 ;; Group catching up.
3083 (defun gnus-group-catchup-current (&optional n all
)
3084 "Mark all unread articles in the current newsgroup as read.
3085 If prefix argument N is numeric, the next N newsgroups will be
3086 caught up. If ALL is non-nil, marked articles will also be marked as
3087 read. Cross references (Xref: header) of articles are ignored.
3088 The number of newsgroups that this function was unable to catch
3091 (let ((groups (gnus-group-process-prefix n
))
3094 (unless groups
(error "No groups selected"))
3096 (or (not gnus-interactive-catchup
) ;Without confirmation?
3101 "Do you really want to mark all articles in %s as read? "
3102 "Mark all unread articles in %s as read? ")
3103 (if (= (length groups
) 1)
3105 (format "these %d groups" (length groups
)))))))
3107 (while (setq group
(pop groups
))
3108 (gnus-group-remove-mark group
)
3109 ;; Virtual groups have to be given special treatment.
3110 (let ((method (gnus-find-method-for-group group
)))
3111 (when (eq 'nnvirtual
(car method
))
3112 (nnvirtual-catchup-group
3113 (gnus-group-real-name group
) (nth 1 method
) all
)))
3114 (if (>= (gnus-group-level group
) gnus-level-zombie
)
3115 (gnus-message 2 "Dead groups can't be caught up")
3117 (gnus-group-goto-group group
)
3118 (gnus-group-catchup group all
))
3119 (gnus-group-update-group-line)
3120 (setq ret
(1+ ret
)))))
3121 (gnus-group-next-unread-group 1)
3124 (defun gnus-group-catchup-current-all (&optional n
)
3125 "Mark all articles in current newsgroup as read.
3126 Cross references (Xref: header) of articles are ignored."
3128 (gnus-group-catchup-current n
'all
))
3130 (defun gnus-group-catchup (group &optional all
)
3131 "Mark all articles in GROUP as read.
3132 If ALL is non-nil, all articles are marked as read.
3133 The return value is the number of articles that were marked as read,
3134 or nil if no action could be taken."
3135 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb
))
3137 (marks (nth 3 (nth 2 entry
)))
3138 (unread (gnus-sequence-of-unread-articles group
)))
3139 ;; Remove entries for this group.
3140 (nnmail-purge-split-history (gnus-group-real-name group
))
3141 ;; Do the updating only if the newsgroup isn't killed.
3142 (if (not (numberp (car entry
)))
3143 (gnus-message 1 "Can't catch up %s; non-active group" group
)
3144 (gnus-update-read-articles group nil
)
3146 ;; Nix out the lists of marks and dormants.
3147 (gnus-request-set-mark group
(list (list (cdr (assq 'tick marks
))
3149 (list (cdr (assq 'dormant marks
))
3151 (setq unread
(gnus-range-add (gnus-range-add
3152 unread
(cdr (assq 'dormant marks
)))
3153 (cdr (assq 'tick marks
))))
3154 (gnus-add-marked-articles group
'tick nil nil
'force
)
3155 (gnus-add-marked-articles group
'dormant nil nil
'force
))
3156 ;; Do auto-expirable marks if that's required.
3157 (when (gnus-group-auto-expirable-p group
)
3158 (gnus-range-map (lambda (article)
3159 (gnus-add-marked-articles group
'expire
(list article
))
3160 (gnus-request-set-mark group
(list (list (list article
) 'add
'(expire)))))
3162 (let ((gnus-newsgroup-name group
))
3163 (gnus-run-hooks 'gnus-group-catchup-group-hook
))
3166 (defun gnus-group-expire-articles (&optional n
)
3167 "Expire all expirable articles in the current newsgroup.
3168 Uses the process/prefix convention."
3170 (let ((groups (gnus-group-process-prefix n
))
3173 (error "No groups to expire"))
3174 (while (setq group
(pop groups
))
3175 (gnus-group-remove-mark group
)
3176 (gnus-group-expire-articles-1 group
)
3177 (gnus-dribble-touch)
3178 (gnus-group-position-point))))
3180 (defun gnus-group-expire-articles-1 (group)
3181 (when (gnus-check-backend-function 'request-expire-articles group
)
3182 (gnus-message 6 "Expiring articles in %s..." group
)
3183 (let* ((info (gnus-get-info group
))
3184 (expirable (if (gnus-group-total-expirable-p group
)
3185 (cons nil
(gnus-list-of-read-articles group
))
3186 (assq 'expire
(gnus-info-marks info
))))
3187 (expiry-wait (gnus-group-find-parameter group
'expiry-wait
))
3188 (nnmail-expiry-target
3189 (or (gnus-group-find-parameter group
'expiry-target
)
3190 nnmail-expiry-target
)))
3192 (gnus-check-group group
)
3195 (gnus-compress-sequence
3197 ;; We set the expiry variables to the group
3199 (let ((nnmail-expiry-wait-function nil
)
3200 (nnmail-expiry-wait expiry-wait
))
3201 (gnus-request-expire-articles
3202 (gnus-uncompress-sequence (cdr expirable
)) group
))
3203 ;; Just expire using the normal expiry values.
3204 (gnus-request-expire-articles
3205 (gnus-uncompress-sequence (cdr expirable
)) group
))))
3206 (gnus-close-group group
))
3207 (gnus-message 6 "Expiring articles in %s...done" group
)
3208 ;; Return the list of un-expired articles.
3211 (defun gnus-group-expire-all-groups ()
3212 "Expire all expirable articles in all newsgroups."
3215 (gnus-message 5 "Expiring...")
3216 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info
))
3217 (cdr gnus-newsrc-alist
))))
3218 (gnus-group-expire-articles nil
)))
3219 (gnus-group-position-point)
3220 (gnus-message 5 "Expiring...done"))
3222 (defun gnus-group-set-current-level (n level
)
3223 "Set the level of the next N groups to LEVEL."
3228 (unless (gnus-group-process-prefix current-prefix-arg
)
3229 (error "No group on the current line"))
3231 (let ((s (read-string
3232 (format "Level (default %s): "
3233 (or (gnus-group-group-level)
3234 gnus-level-default-subscribed
)))))
3235 (if (string-match "^\\s-*$" s
)
3236 (int-to-string (or (gnus-group-group-level)
3237 gnus-level-default-subscribed
))
3239 (unless (and (>= level
1) (<= level gnus-level-killed
))
3240 (error "Invalid level: %d" level
))
3241 (let ((groups (gnus-group-process-prefix n
))
3243 (while (setq group
(pop groups
))
3244 (gnus-group-remove-mark group
)
3245 (gnus-message 6 "Changed level of %s from %d to %d"
3246 group
(or (gnus-group-group-level) gnus-level-killed
)
3248 (gnus-group-change-level
3249 group level
(or (gnus-group-group-level) gnus-level-killed
))
3250 (gnus-group-update-group-line)))
3251 (gnus-group-position-point))
3253 (defun gnus-group-unsubscribe (&optional n
)
3254 "Unsubscribe the current group."
3256 (gnus-group-unsubscribe-current-group n
'unsubscribe
))
3258 (defun gnus-group-subscribe (&optional n
)
3259 "Subscribe the current group."
3261 (gnus-group-unsubscribe-current-group n
'subscribe
))
3263 (defun gnus-group-unsubscribe-current-group (&optional n do-sub
)
3264 "Toggle subscription of the current group.
3265 If given numerical prefix, toggle the N next groups."
3267 (dolist (group (gnus-group-process-prefix n
))
3268 (gnus-group-remove-mark group
)
3269 (gnus-group-unsubscribe-group
3272 ((eq do-sub
'unsubscribe
)
3273 gnus-level-default-unsubscribed
)
3274 ((eq do-sub
'subscribe
)
3275 gnus-level-default-subscribed
)
3276 ((<= (gnus-group-group-level) gnus-level-subscribed
)
3277 gnus-level-default-unsubscribed
)
3279 gnus-level-default-subscribed
))
3281 (gnus-group-update-group-line))
3282 (gnus-group-next-group 1))
3284 (defun gnus-group-unsubscribe-group (group &optional level silent
)
3285 "Toggle subscription to GROUP.
3286 Killed newsgroups are subscribed. If SILENT, don't try to update the
3289 (list (completing-read
3290 "Group: " gnus-active-hashtb nil
3291 (gnus-read-active-file-p)
3293 'gnus-group-history
)))
3294 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb
)))
3296 ((string-match "^[ \t]*$" group
)
3297 (error "Empty group name"))
3299 ;; Toggle subscription flag.
3300 (gnus-group-change-level
3301 newsrc
(if level level
(if (<= (gnus-info-level (nth 2 newsrc
))
3302 gnus-level-subscribed
)
3303 (1+ gnus-level-subscribed
)
3304 gnus-level-default-subscribed
)))
3306 (gnus-group-update-group group
)))
3307 ((and (stringp group
)
3308 (or (not (gnus-read-active-file-p))
3309 (gnus-active group
)))
3310 ;; Add new newsgroup.
3311 (gnus-group-change-level
3313 (if level level gnus-level-default-subscribed
)
3314 (or (and (member group gnus-zombie-list
)
3317 (when (gnus-group-group-name)
3318 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb
)))
3320 (gnus-group-update-group group
)))
3321 (t (error "No such newsgroup: %s" group
)))
3322 (gnus-group-position-point)))
3324 (defun gnus-group-transpose-groups (n)
3325 "Move the current newsgroup up N places.
3326 If given a negative prefix, move down instead. The difference between
3327 N and the number of steps taken is returned."
3329 (unless (gnus-group-group-name)
3330 (error "No group on current line"))
3331 (gnus-group-kill-group 1)
3333 (forward-line (- n
))
3334 (gnus-group-yank-group)
3335 (gnus-group-position-point)))
3337 (defun gnus-group-kill-all-zombies (&optional dummy
)
3338 "Kill all zombie newsgroups.
3339 The optional DUMMY should always be nil."
3340 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3342 (setq gnus-killed-list
(nconc gnus-zombie-list gnus-killed-list
))
3343 (setq gnus-zombie-list nil
)
3344 (gnus-dribble-touch)
3345 (gnus-group-list-groups)))
3347 (defun gnus-group-kill-region (begin end
)
3348 "Kill newsgroups in current region (excluding current point).
3349 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3364 (beginning-of-line) ;Important when LINES < 1
3365 (gnus-group-kill-group lines
)))
3367 (defun gnus-group-kill-group (&optional n discard
)
3368 "Kill the next N groups.
3369 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3370 However, only groups that were alive can be yanked; already killed
3371 groups or zombie groups can't be yanked.
3372 The return value is the name of the group that was killed, or a list
3375 (let ((buffer-read-only nil
)
3376 (groups (gnus-group-process-prefix n
))
3377 group entry level out
)
3378 (if (< (length groups
) 10)
3379 ;; This is faster when there are few groups.
3381 (push (setq group
(pop groups
)) out
)
3382 (gnus-group-remove-mark group
)
3383 (setq level
(gnus-group-group-level))
3385 (when (and (not discard
)
3386 (setq entry
(gnus-gethash group gnus-newsrc-hashtb
)))
3389 (gnus-group-goto-group ,(gnus-group-group-name))
3390 (gnus-group-yank-group)))
3391 (push (cons (car entry
) (nth 2 entry
))
3392 gnus-list-of-killed-groups
))
3393 (gnus-group-change-level
3394 (if entry entry group
) gnus-level-killed
(if entry nil level
))
3395 (message "Killed group %s" group
))
3396 ;; If there are lots and lots of groups to be killed, we use
3397 ;; this thing instead.
3398 (dolist (group (nreverse groups
))
3399 (gnus-group-remove-mark group
)
3401 (push group gnus-killed-list
)
3402 (setq gnus-newsrc-alist
3403 (delq (assoc group gnus-newsrc-alist
)
3405 (when gnus-group-change-level-function
3406 (funcall gnus-group-change-level-function
3407 group gnus-level-killed
3))
3409 ((setq entry
(gnus-gethash group gnus-newsrc-hashtb
))
3410 (push (cons (car entry
) (nth 2 entry
))
3411 gnus-list-of-killed-groups
)
3412 (setcdr (cdr entry
) (cdddr entry
)))
3413 ((member group gnus-zombie-list
)
3414 (setq gnus-zombie-list
(delete group gnus-zombie-list
))))
3415 ;; There may be more than one instance displayed.
3416 (while (gnus-group-goto-group group
)
3417 (gnus-delete-line)))
3418 (gnus-make-hashtable-from-newsrc-alist))
3420 (gnus-group-position-point)
3421 (if (< (length out
) 2) (car out
) (nreverse out
))))
3423 (defun gnus-group-yank-group (&optional arg
)
3424 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3425 The numeric ARG specifies how many newsgroups are to be yanked. The
3426 name of the newsgroup yanked is returned, or (if several groups are
3427 yanked) a list of yanked groups is returned."
3429 (setq arg
(or arg
1))
3430 (let (info group prev out
)
3431 (while (>= (decf arg
) 0)
3432 (when (not (setq info
(pop gnus-list-of-killed-groups
)))
3433 (error "No more newsgroups to yank"))
3434 (push (setq group
(nth 1 info
)) out
)
3435 ;; Find which newsgroup to insert this one before - search
3436 ;; backward until something suitable is found. If there are no
3437 ;; other newsgroups in this buffer, just make this newsgroup the
3439 (setq prev
(gnus-group-group-name))
3440 (gnus-group-change-level
3441 info
(gnus-info-level (cdr info
)) gnus-level-killed
3442 (and prev
(gnus-gethash prev gnus-newsrc-hashtb
))
3444 (gnus-group-insert-group-line-info group
)
3446 `(when (gnus-group-goto-group ,group
)
3447 (gnus-group-kill-group 1))))
3449 (gnus-group-position-point)
3450 (if (< (length out
) 2) (car out
) (nreverse out
))))
3452 (defun gnus-group-kill-level (level)
3453 "Kill all groups that is on a certain LEVEL."
3454 (interactive "nKill all groups on level: ")
3456 ((= level gnus-level-zombie
)
3457 (setq gnus-killed-list
3458 (nconc gnus-zombie-list gnus-killed-list
))
3459 (setq gnus-zombie-list nil
))
3460 ((and (< level gnus-level-zombie
)
3462 (or gnus-expert-user
3465 "Do you really want to kill all groups on level %d? "
3467 (let* ((prev gnus-newsrc-alist
)
3470 (if (= (gnus-info-level (car alist
)) level
)
3472 (push (gnus-info-group (car alist
)) gnus-killed-list
)
3473 (setcdr prev
(cdr alist
)))
3475 (setq alist
(cdr alist
)))
3476 (gnus-make-hashtable-from-newsrc-alist)
3477 (gnus-group-list-groups)))
3479 (error "Can't kill; invalid level: %d" level
))))
3481 (defun gnus-group-list-all-groups (&optional arg
)
3482 "List all newsgroups with level ARG or lower.
3483 Default is `gnus-level-unsubscribed', which lists all subscribed and most
3484 unsubscribed groups."
3486 (gnus-group-list-groups (or arg gnus-level-unsubscribed
) t
))
3488 ;; Redefine this to list ALL killed groups if prefix arg used.
3489 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3490 (defun gnus-group-list-killed (&optional arg
)
3491 "List all killed newsgroups in the group buffer.
3492 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3493 entail asking the server for the groups."
3495 ;; Find all possible killed newsgroups if arg.
3497 (gnus-get-killed-groups))
3498 (if (not gnus-killed-list
)
3499 (gnus-message 6 "No killed groups")
3500 (let (gnus-group-list-mode)
3501 (funcall gnus-group-prepare-function
3502 gnus-level-killed t gnus-level-killed
))
3503 (goto-char (point-min)))
3504 (gnus-group-position-point))
3506 (defun gnus-group-list-zombies ()
3507 "List all zombie newsgroups in the group buffer."
3509 (if (not gnus-zombie-list
)
3510 (gnus-message 6 "No zombie groups")
3511 (let (gnus-group-list-mode)
3512 (funcall gnus-group-prepare-function
3513 gnus-level-zombie t gnus-level-zombie
))
3514 (goto-char (point-min)))
3515 (gnus-group-position-point))
3517 (defun gnus-group-list-active ()
3518 "List all groups that are available from the server(s)."
3520 ;; First we make sure that we have really read the active file.
3521 (unless (gnus-read-active-file-p)
3522 (let ((gnus-read-active-file t
)
3523 (gnus-agent gnus-plugged
)); If we're actually plugged, store the active file in the agent.
3524 (gnus-read-active-file)))
3525 ;; Find all groups and sort them.
3533 (push (symbol-name sym
) list
)))
3537 (buffer-read-only nil
)
3541 (setq group
(pop groups
))
3542 (gnus-add-text-properties
3543 (point) (prog1 (1+ (point))
3545 (gnus-group-decoded-name group
)
3547 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
3549 'gnus-level
(inline (gnus-group-level group
)))))
3550 (goto-char (point-min))))
3552 (defun gnus-activate-all-groups (level)
3553 "Activate absolutely all groups."
3554 (interactive (list gnus-level-unsubscribed
))
3555 (let ((gnus-activate-level level
)
3556 (gnus-activate-foreign-newsgroups level
))
3557 (gnus-group-get-new-news)))
3559 (defun gnus-group-get-new-news (&optional arg
)
3560 "Get newly arrived articles.
3561 If ARG is a number, it specifies which levels you are interested in
3562 re-scanning. If ARG is non-nil and not a number, this will force
3563 \"hard\" re-reading of the active files from all servers."
3566 (let ((gnus-inhibit-demon t
)
3567 ;; Binding this variable will inhibit multiple fetchings
3568 ;; of the same mail source.
3569 (nnmail-fetched-sources (list t
)))
3570 (gnus-run-hooks 'gnus-get-top-new-news-hook
)
3571 (gnus-run-hooks 'gnus-get-new-news-hook
)
3573 ;; Read any slave files.
3575 (gnus-master-read-slave-newsrc))
3577 ;; We might read in new NoCeM messages here.
3578 (when (and gnus-use-nocem
3580 (gnus-nocem-scan-groups))
3581 ;; If ARG is not a number, then we read the active file.
3582 (when (and arg
(not (numberp arg
)))
3583 (let ((gnus-read-active-file t
))
3584 (gnus-read-active-file))
3587 ;; If the user wants it, we scan for new groups.
3588 (when (eq gnus-check-new-newsgroups
'always
)
3589 (gnus-find-new-newsgroups)))
3591 (setq arg
(gnus-group-default-level arg t
))
3592 (if (and gnus-read-active-file
(not arg
))
3594 (gnus-read-active-file)
3595 (gnus-get-unread-articles arg
))
3596 (let ((gnus-read-active-file (if arg nil gnus-read-active-file
)))
3597 (gnus-get-unread-articles arg
)))
3598 (gnus-run-hooks 'gnus-after-getting-new-news-hook
)
3599 (gnus-group-list-groups (and (numberp arg
)
3600 (max (car gnus-group-list-mode
) arg
)))))
3602 (defun gnus-group-get-new-news-this-group (&optional n dont-scan
)
3603 "Check for newly arrived news in the current group (and the N-1 next groups).
3604 The difference between N and the number of newsgroup checked is returned.
3605 If N is negative, this group and the N-1 previous groups will be checked.
3606 If DONT-SCAN is non-nil, scan non-activated groups as well."
3608 (let* ((groups (gnus-group-process-prefix n
))
3609 (ret (if (numberp n
) (- n
(length groups
)) 0))
3613 (gnus-inhibit-demon t
)
3614 ;; Binding this variable will inhibit multiple fetchings
3615 ;; of the same mail source.
3616 (nnmail-fetched-sources (list t
)))
3617 (gnus-run-hooks 'gnus-get-new-news-hook
)
3618 (while (setq group
(pop groups
))
3619 (gnus-group-remove-mark group
)
3620 ;; Bypass any previous denials from the server.
3621 (gnus-remove-denial (setq method
(gnus-find-method-for-group group
)))
3622 (if (gnus-activate-group group
(if dont-scan nil
'scan
))
3624 (gnus-get-unread-articles-in-group
3625 (gnus-get-info group
) (gnus-active group
) t
)
3626 (unless (gnus-virtual-group-p group
)
3627 (gnus-close-group group
))
3629 (gnus-agent-save-group-info
3630 method
(gnus-group-real-name group
) (gnus-active group
)))
3631 (gnus-group-update-group group
))
3632 (if (eq (gnus-server-status (gnus-find-method-for-group group
))
3634 (gnus-error 3 "Server denied access")
3635 (gnus-error 3 "%s error: %s" group
(gnus-status-message group
)))))
3638 (when gnus-goto-next-group-when-activating
3639 (gnus-group-next-unread-group 1 t
))
3640 (gnus-summary-position-point)
3643 (defun gnus-group-fetch-faq (group &optional faq-dir
)
3644 "Fetch the FAQ for the current group.
3645 If given a prefix argument, prompt for the FAQ dir
3649 (gnus-group-group-name)
3650 (when current-prefix-arg
3652 "FAQ dir: " (and (listp gnus-group-faq-directory
)
3654 gnus-group-faq-directory
))))))
3656 (error "No group name given"))
3657 (let ((dirs (or faq-dir gnus-group-faq-directory
))
3659 (unless (listp dirs
)
3660 (setq dirs
(list dirs
)))
3661 (while (and (not found
)
3662 (setq dir
(pop dirs
)))
3663 (let ((name (gnus-group-real-name group
)))
3664 (setq file
(expand-file-name name dir
)))
3665 (if (not (file-exists-p file
))
3666 (gnus-message 1 "No such file: %s" file
)
3667 (let ((enable-local-variables nil
))
3671 (defun gnus-group-fetch-charter (group)
3672 "Fetch the charter for the current group.
3673 If given a prefix argument, prompt for a group."
3675 (list (or (when current-prefix-arg
3676 (completing-read "Group: " gnus-active-hashtb
))
3677 (gnus-group-group-name)
3678 gnus-newsgroup-name
)))
3680 (error "No group name given"))
3682 (condition-case nil
(require 'url-http
) (error nil
))
3683 (let ((name (mm-url-form-encode-xwfu (gnus-group-real-name group
)))
3685 (when (string-match "\\(^[^\\.]+\\)\\..*" name
)
3686 (setq hierarchy
(match-string 1 name
))
3687 (if (and (setq url
(cdr (assoc hierarchy gnus-group-charter-alist
)))
3688 (if (fboundp 'url-http-file-exists-p
)
3689 (url-http-file-exists-p (eval url
))
3691 (browse-url (eval url
))
3692 (setq url
(concat "http://" hierarchy
3693 ".news-admin.org/charters/" name
))
3694 (if (and (fboundp 'url-http-file-exists-p
)
3695 (url-http-file-exists-p url
))
3697 (gnus-group-fetch-control group
))))))
3699 (defun gnus-group-fetch-control (group)
3700 "Fetch the archived control messages for the current group.
3701 If given a prefix argument, prompt for a group."
3703 (list (or (when current-prefix-arg
3704 (completing-read "Group: " gnus-active-hashtb
))
3705 (gnus-group-group-name)
3706 gnus-newsgroup-name
)))
3708 (error "No group name given"))
3709 (let ((name (gnus-group-real-name group
))
3711 (when (string-match "\\(^[^\\.]+\\)\\..*" name
)
3712 (setq hierarchy
(match-string 1 name
))
3713 (if gnus-group-fetch-control-use-browse-url
3714 (browse-url (concat "ftp://ftp.isc.org/usenet/control/"
3715 hierarchy
"/" name
".gz"))
3716 (let ((enable-local-variables nil
))
3717 (gnus-group-read-ephemeral-group
3719 `(nndoc ,group
(nndoc-address
3720 ,(find-file-noselect
3721 (concat "/ftp@ftp.isc.org:/usenet/control/"
3722 hierarchy
"/" name
".gz")))
3723 (nndoc-article-type mbox
)) t nil nil
))))))
3725 (defun gnus-group-describe-group (force &optional group
)
3726 "Display a description of the current newsgroup."
3727 (interactive (list current-prefix-arg
(gnus-group-group-name)))
3728 (let* ((method (gnus-find-method-for-group group
))
3729 (mname (gnus-group-prefixed-name "" method
))
3732 gnus-description-hashtb
)
3733 (gnus-sethash mname nil gnus-description-hashtb
))
3735 (error "No group name given"))
3736 (when (or (and gnus-description-hashtb
3737 ;; We check whether this group's method has been
3738 ;; queried for a description file.
3739 (gnus-gethash mname gnus-description-hashtb
))
3740 (setq desc
(gnus-group-get-description group
))
3741 (gnus-read-descriptions-file method
))
3743 (or desc
(gnus-gethash group gnus-description-hashtb
)
3744 "No description available")))))
3746 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3747 (defun gnus-group-describe-all-groups (&optional force
)
3748 "Pop up a buffer with descriptions of all newsgroups."
3751 (setq gnus-description-hashtb nil
))
3752 (when (not (or gnus-description-hashtb
3753 (gnus-read-all-descriptions-files)))
3754 (error "Couldn't request descriptions file"))
3755 (let ((buffer-read-only nil
)
3761 (let ((charset (gnus-group-name-charset nil
(symbol-name group
))))
3762 (insert (format " *: %-20s %s\n"
3763 (gnus-group-name-decode
3764 (symbol-name group
) charset
)
3765 (gnus-group-name-decode
3766 (symbol-value group
) charset
))))
3767 (gnus-add-text-properties
3768 b
(1+ b
) (list 'gnus-group group
3769 'gnus-unread t
'gnus-marked nil
3770 'gnus-level
(1+ gnus-level-subscribed
))))
3771 gnus-description-hashtb
)
3772 (goto-char (point-min))
3773 (gnus-group-position-point)))
3775 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3776 (defun gnus-group-apropos (regexp &optional search-description
)
3777 "List all newsgroups that have names that match a regexp."
3778 (interactive "sGnus apropos (regexp): ")
3780 (obuf (current-buffer))
3782 ;; Go through all newsgroups that are known to Gnus.
3785 (and (symbol-name group
)
3786 (string-match regexp
(symbol-name group
))
3787 (symbol-value group
)
3788 (push (symbol-name group
) groups
)))
3790 ;; Also go through all descriptions that are known to Gnus.
3791 (when search-description
3794 (and (string-match regexp
(symbol-value group
))
3795 (push (symbol-name group
) groups
)))
3796 gnus-description-hashtb
))
3798 (gnus-message 3 "No groups matched \"%s\"." regexp
)
3799 ;; Print out all the groups.
3801 (pop-to-buffer "*Gnus Help*")
3802 (buffer-disable-undo)
3804 (setq groups
(sort groups
'string
<))
3806 ;; Groups may be entered twice into the list of groups.
3807 (when (not (string= (car groups
) prev
))
3808 (setq prev
(car groups
))
3809 (let ((charset (gnus-group-name-charset nil prev
)))
3810 (insert (gnus-group-name-decode prev charset
) "\n")
3811 (when (and gnus-description-hashtb
3812 (setq des
(gnus-gethash (car groups
)
3813 gnus-description-hashtb
)))
3814 (insert " " (gnus-group-name-decode des charset
) "\n"))))
3815 (setq groups
(cdr groups
)))
3816 (goto-char (point-min))))
3817 (pop-to-buffer obuf
)))
3819 (defun gnus-group-description-apropos (regexp)
3820 "List all newsgroups that have names or descriptions that match REGEXP."
3821 (interactive "sGnus description apropos (regexp): ")
3822 (when (not (or gnus-description-hashtb
3823 (gnus-read-all-descriptions-files)))
3824 (error "Couldn't request descriptions file"))
3825 (gnus-group-apropos regexp t
))
3827 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3828 (defun gnus-group-list-matching (level regexp
&optional all lowest
)
3829 "List all groups with unread articles that match REGEXP.
3830 If the prefix LEVEL is non-nil, it should be a number that says which
3831 level to cut off listing groups.
3832 If ALL, also list groups with no unread articles.
3833 If LOWEST, don't list groups with level lower than LOWEST.
3835 This command may read the active file."
3836 (interactive "P\nsList newsgroups matching: ")
3837 ;; First make sure active file has been read.
3839 (> (prefix-numeric-value level
) gnus-level-killed
))
3840 (gnus-get-killed-groups))
3841 (funcall gnus-group-prepare-function
3842 (or level gnus-level-subscribed
) (and all t
) (or lowest
1) regexp
)
3843 (goto-char (point-min))
3844 (gnus-group-position-point))
3846 (defun gnus-group-list-all-matching (level regexp
&optional lowest
)
3847 "List all groups that match REGEXP.
3848 If the prefix LEVEL is non-nil, it should be a number that says which
3849 level to cut off listing groups.
3850 If LOWEST, don't list groups with level lower than LOWEST."
3851 (interactive "P\nsList newsgroups matching: ")
3853 (setq level
(prefix-numeric-value level
)))
3854 (gnus-group-list-matching (or level gnus-level-killed
) regexp t lowest
))
3856 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3857 (defun gnus-group-save-newsrc (&optional force
)
3858 "Save the Gnus startup files.
3859 If FORCE, force saving whether it is necessary or not."
3861 (gnus-save-newsrc-file force
))
3863 (defun gnus-group-restart (&optional arg
)
3864 "Force Gnus to read the .newsrc file."
3866 (when (gnus-yes-or-no-p
3867 (format "Are you sure you want to restart Gnus? "))
3868 (gnus-save-newsrc-file)
3872 (defun gnus-group-read-init-file ()
3873 "Read the Gnus elisp init file."
3875 (gnus-read-init-file)
3876 (gnus-message 5 "Read %s" gnus-init-file
))
3878 (defun gnus-group-check-bogus-groups (&optional silent
)
3879 "Check bogus newsgroups.
3880 If given a prefix, don't ask for confirmation before removing a bogus
3883 (gnus-check-bogus-newsgroups (and (not silent
) (not gnus-expert-user
)))
3884 (gnus-group-list-groups))
3886 (defun gnus-group-find-new-groups (&optional arg
)
3887 "Search for new groups and add them.
3888 Each new group will be treated with `gnus-subscribe-newsgroup-method'.
3889 With 1 C-u, use the `ask-server' method to query the server for new
3891 With 2 C-u's, use most complete method possible to query the server
3892 for new groups, and subscribe the new groups as zombies."
3894 (gnus-find-new-newsgroups (or arg
1))
3895 (gnus-group-list-groups))
3897 (defun gnus-group-edit-global-kill (&optional article group
)
3898 "Edit the global kill file.
3899 If GROUP, edit that local kill file instead."
3901 (setq gnus-current-kill-article article
)
3902 (gnus-kill-file-edit-file group
)
3905 (substitute-command-keys
3906 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3907 (if group
"local" "global")))))
3909 (defun gnus-group-edit-local-kill (article group
)
3910 "Edit a local kill file."
3911 (interactive (list nil
(gnus-group-group-name)))
3912 (gnus-group-edit-global-kill article group
))
3914 (defun gnus-group-force-update ()
3915 "Update `.newsrc' file."
3917 (gnus-save-newsrc-file))
3919 (defvar gnus-backlog-articles
)
3921 (defun gnus-group-suspend ()
3922 "Suspend the current Gnus session.
3923 In fact, cleanup buffers except for group mode buffer.
3924 The hook `gnus-suspend-gnus-hook' is called before actually suspending."
3926 (gnus-run-hooks 'gnus-suspend-gnus-hook
)
3927 (gnus-offer-save-summaries)
3928 ;; Kill Gnus buffers except for group mode buffer.
3929 (let ((group-buf (get-buffer gnus-group-buffer
)))
3930 (mapcar (lambda (buf)
3931 (unless (or (member buf
(list group-buf gnus-dribble-buffer
))
3935 (eq major-mode
'message-mode
))))
3936 (gnus-kill-buffer buf
)))
3938 (setq gnus-backlog-articles nil
)
3939 (gnus-kill-gnus-frames)
3941 (bury-buffer group-buf
)
3942 (delete-windows-on group-buf t
))))
3944 (defun gnus-group-clear-dribble ()
3945 "Clear all information from the dribble buffer."
3947 (gnus-dribble-clear)
3948 (gnus-message 7 "Cleared dribble buffer"))
3950 (defun gnus-group-exit ()
3951 "Quit reading news after updating .newsrc.eld and .newsrc.
3952 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3955 (or noninteractive
;For gnus-batch-kill
3956 (not gnus-interactive-exit
) ;Without confirmation
3958 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3959 (gnus-run-hooks 'gnus-exit-gnus-hook
)
3960 ;; Offer to save data from non-quitted summary buffers.
3961 (gnus-offer-save-summaries)
3962 ;; Save the newsrc file(s).
3963 (gnus-save-newsrc-file)
3965 (gnus-close-backends)
3966 ;; Reset everything.
3968 ;; Allow the user to do things after cleaning up.
3969 (gnus-run-hooks 'gnus-after-exiting-gnus-hook
)))
3971 (defun gnus-group-quit ()
3972 "Quit reading news without updating .newsrc.eld or .newsrc.
3973 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3975 (when (or noninteractive
;For gnus-batch-kill
3976 (zerop (buffer-size))
3977 (not (gnus-server-opened gnus-select-method
))
3979 (not gnus-current-startup-file
)
3981 (format "Quit reading news without saving %s? "
3982 (file-name-nondirectory gnus-current-startup-file
))))
3983 (gnus-run-hooks 'gnus-exit-gnus-hook
)
3984 (gnus-configure-windows 'group t
)
3985 (when (and (gnus-buffer-live-p gnus-dribble-buffer
)
3986 (not (zerop (save-excursion
3987 (set-buffer gnus-dribble-buffer
)
3990 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3992 (gnus-close-backends)
3994 (gnus-kill-buffer gnus-group-buffer
)
3995 ;; Allow the user to do things after cleaning up.
3996 (gnus-run-hooks 'gnus-after-exiting-gnus-hook
)))
3998 (defun gnus-group-describe-briefly ()
3999 "Give a one line description of the group mode commands."
4001 (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")))
4003 (defun gnus-group-browse-foreign-server (method)
4004 "Browse a foreign news server.
4005 If called interactively, this function will ask for a select method
4006 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
4007 If not, METHOD should be a list where the first element is the method
4008 and the second element is the address."
4010 (list (let ((how (completing-read
4012 (append gnus-valid-select-methods gnus-server-alist
)
4013 nil t
(cons "nntp" 0) 'gnus-method-history
)))
4014 ;; We either got a back end name or a virtual server name.
4015 ;; If the first, we also need an address.
4016 (if (assoc how gnus-valid-select-methods
)
4018 ;; Suggested by mapjph@bath.ac.uk.
4021 (mapcar (lambda (server) (list server
))
4022 gnus-secondary-servers
)))
4023 ;; We got a server name.
4025 (gnus-browse-foreign-server method
))
4027 (defun gnus-group-set-info (info &optional method-only-group part
)
4028 (when (or info part
)
4029 (let* ((entry (gnus-gethash
4030 (or method-only-group
(gnus-info-group info
))
4031 gnus-newsrc-hashtb
))
4033 (info (if method-only-group
(nth 2 entry
) info
))
4035 (when method-only-group
4037 (error "Trying to change non-existent group %s" method-only-group
))
4038 ;; We have received parts of the actual group info - either the
4039 ;; select method or the group parameters. We first check
4040 ;; whether we have to extend the info, and if so, do that.
4041 (let ((len (length info
))
4042 (total (if (eq part
'method
) 5 6)))
4044 (setcdr (nthcdr (1- len
) info
)
4045 (make-list (- total len
) nil
)))
4046 ;; Then we enter the new info.
4047 (setcar (nthcdr (1- total
) info
) part-info
)))
4049 ;; This is a new group, so we just create it.
4051 (set-buffer gnus-group-buffer
)
4052 (setq method
(gnus-info-method info
))
4053 (when (gnus-server-equal method
"native")
4056 (set-buffer gnus-group-buffer
)
4058 ;; It's a foreign group...
4059 (gnus-group-make-group
4060 (gnus-group-real-name (gnus-info-group info
))
4061 (if (stringp method
) method
4062 (prin1-to-string (car method
)))
4064 (nth 1 (gnus-info-method info
))))
4065 ;; It's a native group.
4066 (gnus-group-make-group (gnus-info-group info
))))
4067 (gnus-message 6 "Note: New group created")
4069 (gnus-gethash (gnus-group-prefixed-name
4070 (gnus-group-real-name (gnus-info-group info
))
4071 (or (gnus-info-method info
) gnus-select-method
))
4072 gnus-newsrc-hashtb
))))
4073 ;; Whether it was a new group or not, we now have the entry, so we
4074 ;; can do the update.
4077 (setcar (nthcdr 2 entry
) info
)
4078 (when (and (not (eq (car entry
) t
))
4079 (gnus-active (gnus-info-group info
)))
4080 (setcar entry
(length
4081 (gnus-list-of-unread-articles (car info
))))))
4082 (error "No such group: %s" (gnus-info-group info
))))))
4084 (defun gnus-group-set-method-info (group select-method
)
4085 (gnus-group-set-info select-method group
'method
))
4087 (defun gnus-group-set-params-info (group params
)
4088 (gnus-group-set-info params group
'params
))
4090 (defun gnus-add-marked-articles (group type articles
&optional info force
)
4091 ;; Add ARTICLES of TYPE to the info of GROUP.
4092 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
4093 ;; add, but replace marked articles of TYPE with ARTICLES.
4094 (let ((info (or info
(gnus-get-info group
)))
4097 (and (not (setq marked
(nthcdr 3 info
)))
4099 (setcdr (nthcdr 2 info
)
4100 (list (list (cons type
(gnus-compress-sequence
4102 (and (not (setq m
(assq type
(car marked
))))
4105 (cons (cons type
(gnus-compress-sequence articles t
) )
4109 (setcar (nthcdr 3 info
)
4110 (gnus-delete-alist type
(car marked
)))
4111 (setcdr m
(gnus-compress-sequence articles t
)))
4112 (setcdr m
(gnus-compress-sequence
4113 (sort (nconc (gnus-uncompress-range (cdr m
))
4114 (copy-sequence articles
)) '<) t
))))))
4116 (defun gnus-add-mark (group mark article
)
4117 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
4118 (let ((buffer (gnus-summary-buffer-name group
)))
4119 (if (gnus-buffer-live-p buffer
)
4121 (set-buffer (get-buffer buffer
))
4122 (gnus-summary-add-mark article mark
))
4123 (gnus-add-marked-articles group
(cdr (assq mark gnus-article-mark-lists
))
4127 ;;; Group timestamps
4130 (defun gnus-group-set-timestamp ()
4131 "Change the timestamp of the current group to the current time.
4132 This function can be used in hooks like `gnus-select-group-hook'
4133 or `gnus-group-catchup-group-hook'."
4134 (when gnus-newsgroup-name
4135 (let ((time (current-time)))
4136 (setcdr (cdr time
) nil
)
4137 (gnus-group-set-parameter gnus-newsgroup-name
'timestamp time
))))
4139 (defsubst gnus-group-timestamp
(group)
4140 "Return the timestamp for GROUP."
4141 (gnus-group-get-parameter group
'timestamp t
))
4143 (defun gnus-group-timestamp-delta (group)
4144 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
4145 (let* ((time (or (gnus-group-timestamp group
)
4147 (delta (subtract-time (current-time) time
)))
4148 (+ (* (nth 0 delta
) 65536.0)
4151 (defun gnus-group-timestamp-string (group)
4152 "Return a string of the timestamp for GROUP."
4153 (let ((time (gnus-group-timestamp group
)))
4156 (gnus-time-iso8601 time
))))
4158 (defun gnus-group-list-cached (level &optional lowest
)
4159 "List all groups with cached articles.
4160 If the prefix LEVEL is non-nil, it should be a number that says which
4161 level to cut off listing groups.
4162 If LOWEST, don't list groups with level lower than LOWEST.
4164 This command may read the active file."
4167 (setq level
(prefix-numeric-value level
)))
4168 (when (or (not level
) (>= level gnus-level-zombie
))
4170 (funcall gnus-group-prepare-function
4171 (or level gnus-level-subscribed
)
4173 (let ((marks (gnus-info-marks info
)))
4174 (assq 'cache marks
)))
4177 (or (gnus-gethash group
4178 gnus-cache-active-hashtb
)
4179 ;; Cache active file might use "."
4182 (mapconcat 'identity
4183 (split-string group
":")
4185 gnus-cache-active-hashtb
))))
4186 (goto-char (point-min))
4187 (gnus-group-position-point))
4189 (defun gnus-group-list-dormant (level &optional lowest
)
4190 "List all groups with dormant articles.
4191 If the prefix LEVEL is non-nil, it should be a number that says which
4192 level to cut off listing groups.
4193 If LOWEST, don't list groups with level lower than LOWEST.
4195 This command may read the active file."
4198 (setq level
(prefix-numeric-value level
)))
4199 (when (or (not level
) (>= level gnus-level-zombie
))
4201 (funcall gnus-group-prepare-function
4202 (or level gnus-level-subscribed
)
4204 (let ((marks (gnus-info-marks info
)))
4205 (assq 'dormant marks
)))
4208 (goto-char (point-min))
4209 (gnus-group-position-point))
4211 (defun gnus-group-listed-groups ()
4212 "Return a list of listed groups."
4214 (goto-char (point-min))
4215 (while (setq point
(text-property-not-all (point) (point-max)
4218 (push (symbol-name (get-text-property point
'gnus-group
)) groups
)
4222 (defun gnus-group-list-plus (&optional args
)
4223 "List groups plus the current selection."
4225 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
4226 (gnus-group-list-mode gnus-group-list-mode
) ;; Save it.
4228 (push last-command-event unread-command-events
)
4229 (if (featurep 'xemacs
)
4230 (push (make-event 'key-press
'(key ?A
)) unread-command-events
)
4231 (push ?A unread-command-events
))
4232 (let (gnus-pick-mode keys
)
4233 (setq keys
(if (featurep 'xemacs
)
4234 (events-to-keys (read-key-sequence nil
))
4235 (read-key-sequence nil
)))
4236 (setq func
(lookup-key (current-local-map) keys
)))
4240 (call-interactively func
))))
4242 (defun gnus-group-list-flush (&optional args
)
4243 "Flush groups from the current selection."
4245 (let ((gnus-group-list-option 'flush
))
4246 (gnus-group-list-plus args
)))
4248 (defun gnus-group-list-limit (&optional args
)
4249 "List groups limited within the current selection."
4251 (let ((gnus-group-list-option 'limit
))
4252 (gnus-group-list-plus args
)))
4254 (defun gnus-group-mark-article-read (group article
)
4255 "Mark ARTICLE read."
4256 (let ((buffer (gnus-summary-buffer-name group
))
4257 (mark gnus-read-mark
)
4259 (if (get-buffer buffer
)
4260 (with-current-buffer buffer
4261 (setq active gnus-newsgroup-active
)
4262 (gnus-activate-group group
)
4263 (when gnus-newsgroup-prepared
4264 (when (and gnus-newsgroup-auto-expire
4265 (memq mark gnus-auto-expirable-marks
))
4266 (setq mark gnus-expirable-mark
))
4267 (setq mark
(gnus-request-update-mark
4268 group article mark
))
4269 (gnus-mark-article-as-read article mark
)
4270 (setq gnus-newsgroup-active
(gnus-active group
))
4272 (setq n
(1+ (cdr active
)))
4273 (while (<= n
(cdr gnus-newsgroup-active
))
4274 (unless (eq n article
)
4275 (push n gnus-newsgroup-unselected
))
4277 (setq gnus-newsgroup-unselected
4278 (nreverse gnus-newsgroup-unselected
)))))
4279 (gnus-activate-group group
)
4280 (gnus-group-make-articles-read group
(list article
))
4281 (when (gnus-group-auto-expirable-p group
)
4282 (gnus-add-marked-articles
4283 group
'expire
(list article
))))))
4285 (provide 'gnus-group
)
4287 ;;; arch-tag: 2eb5440f-0bca-4091-814c-e37817536af6
4288 ;;; gnus-group.el ends here