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
1988 "Read GROUP from METHOD as an ephemeral group.
1989 If ACTIVATE, request the group first.
1990 If QUIT-CONFIG, use that window configuration when exiting from the
1992 If REQUEST-ONLY, don't actually read the group; just request it.
1993 If SELECT-ARTICLES, only select those articles.
1994 If PARAMETERS, use those as the group parameters.
1996 Return the name of the group if selection was successful."
1999 ;; (gnus-read-group "Group name: ")
2001 "Group: " gnus-active-hashtb
2003 'gnus-group-history
)
2004 (gnus-read-method "From method: ")))
2005 ;; Transform the select method into a unique server.
2006 (when (stringp method
)
2007 (setq method
(gnus-server-to-method method
)))
2009 `(,(car method
) ,(concat (cadr method
) "-ephemeral")
2010 (,(intern (format "%s-address" (car method
))) ,(cadr method
))
2012 (let ((group (if (gnus-group-foreign-p group
) group
2013 (gnus-group-prefixed-name (gnus-group-real-name group
)
2018 ,gnus-level-default-subscribed nil nil
,method
2021 (cons 'quit-config quit-config
)
2023 (cons gnus-summary-buffer
2024 gnus-current-window-configuration
)))
2027 (push method gnus-ephemeral-servers
)
2028 (set-buffer gnus-group-buffer
)
2029 (unless (gnus-check-server method
)
2030 (error "Unable to contact server: %s" (gnus-status-message method
)))
2032 (gnus-activate-group group
'scan
)
2033 (unless (gnus-request-group group
)
2034 (error "Couldn't request group: %s"
2035 (nnheader-get-report (car method
)))))
2039 (when (let ((gnus-large-newsgroup gnus-large-ephemeral-newsgroup
)
2040 (gnus-fetch-old-headers
2041 gnus-fetch-old-ephemeral-headers
))
2042 (gnus-group-read-group t t group select-articles
))
2046 (message "Quit reading the ephemeral group")
2049 (defun gnus-group-jump-to-group (group)
2050 "Jump to newsgroup GROUP."
2052 (list (mm-string-make-unibyte
2054 "Group: " gnus-active-hashtb nil
2055 (gnus-read-active-file-p)
2056 gnus-group-jump-to-group-prompt
2057 'gnus-group-history
))))
2059 (when (equal group
"")
2060 (error "Empty group name"))
2062 (unless (gnus-ephemeral-group-p group
)
2063 ;; Either go to the line in the group buffer...
2064 (unless (gnus-group-goto-group group
)
2065 ;; ... or insert the line.
2066 (gnus-group-update-group group
)
2067 (gnus-group-goto-group group
)))
2068 ;; Adjust cursor point.
2069 (gnus-group-position-point))
2071 (defun gnus-group-goto-group (group &optional far test-marked
)
2072 "Goto to newsgroup GROUP.
2073 If FAR, it is likely that the group is not on the current line.
2074 If TEST-MARKED, the line must be marked."
2078 ;; It's quite likely that we are on the right line, so
2079 ;; we check the current line first.
2081 (eq (get-text-property (point) 'gnus-group
)
2082 (gnus-intern-safe group gnus-active-hashtb
))
2083 (or (not test-marked
) (gnus-group-mark-line-p)))
2085 ;; Previous and next line are also likely, so we check them as well.
2089 (and (eq (get-text-property (point) 'gnus-group
)
2090 (gnus-intern-safe group gnus-active-hashtb
))
2091 (or (not test-marked
) (gnus-group-mark-line-p)))))
2097 (and (eq (get-text-property (point) 'gnus-group
)
2098 (gnus-intern-safe group gnus-active-hashtb
))
2099 (or (not test-marked
) (gnus-group-mark-line-p)))))
2103 (goto-char (point-min))
2105 (while (and (not found
)
2110 (gnus-intern-safe group gnus-active-hashtb
))))
2111 (if (gnus-group-mark-line-p)
2116 ;; Search through the entire buffer.
2119 (point-min) (point-max)
2120 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)))))))
2122 (defun gnus-group-next-group (n &optional silent
)
2123 "Go to next N'th newsgroup.
2124 If N is negative, search backward instead.
2125 Returns the difference between N and the number of skips actually
2128 (gnus-group-next-unread-group n t nil silent
))
2130 (defun gnus-group-next-unread-group (n &optional all level silent
)
2131 "Go to next N'th unread newsgroup.
2132 If N is negative, search backward instead.
2133 If ALL is non-nil, choose any newsgroup, unread or not.
2134 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
2135 such group can be found, the next group with a level higher than
2137 Returns the difference between N and the number of skips actually
2140 (let ((backward (< n
0))
2143 (gnus-group-search-forward
2144 backward
(or (not gnus-group-goto-unread
) all
) level
))
2148 (gnus-message 7 "No more%s newsgroups%s" (if all
"" " unread")
2149 (if level
" on this level or higher" "")))
2152 (defun gnus-group-prev-group (n)
2153 "Go to previous N'th newsgroup.
2154 Returns the difference between N and the number of skips actually
2157 (gnus-group-next-unread-group (- n
) t
))
2159 (defun gnus-group-prev-unread-group (n)
2160 "Go to previous N'th unread newsgroup.
2161 Returns the difference between N and the number of skips actually
2164 (gnus-group-next-unread-group (- n
)))
2166 (defun gnus-group-next-unread-group-same-level (n)
2167 "Go to next N'th unread newsgroup on the same level.
2168 If N is negative, search backward instead.
2169 Returns the difference between N and the number of skips actually
2172 (gnus-group-next-unread-group n t
(gnus-group-group-level))
2173 (gnus-group-position-point))
2175 (defun gnus-group-prev-unread-group-same-level (n)
2176 "Go to next N'th unread newsgroup on the same level.
2177 Returns the difference between N and the number of skips actually
2180 (gnus-group-next-unread-group (- n
) t
(gnus-group-group-level))
2181 (gnus-group-position-point))
2183 (defun gnus-group-best-unread-group (&optional exclude-group
)
2184 "Go to the group with the highest level.
2185 If EXCLUDE-GROUP, do not go to that group."
2187 (goto-char (point-min))
2191 (setq unread
(get-text-property (point) 'gnus-unread
))
2192 (when (and (numberp unread
) (> unread
0))
2193 (when (and (get-text-property (point) 'gnus-level
)
2194 (< (get-text-property (point) 'gnus-level
) best
)
2195 (or (not exclude-group
)
2196 (not (equal exclude-group
(gnus-group-group-name)))))
2197 (setq best
(get-text-property (point) 'gnus-level
))
2198 (setq best-point
(point))))
2201 (goto-char best-point
))
2202 (gnus-group-position-point)
2203 (and best-point
(gnus-group-group-name))))
2205 (defun gnus-group-first-unread-group ()
2206 "Go to the first group with unread articles."
2209 (let ((opoint (point))
2211 (goto-char (point-min))
2212 (if (or (eq (setq unread
(gnus-group-group-unread)) t
) ; Not active.
2213 (and (numberp unread
) ; Not a topic.
2214 (not (zerop unread
))) ; Has unread articles.
2215 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
2218 nil
)) ; Not success.
2219 (gnus-group-position-point)))
2221 (defun gnus-group-enter-server-mode ()
2222 "Jump to the server buffer."
2224 (gnus-enter-server-buffer))
2226 (defun gnus-group-make-group (name &optional method address args
)
2227 "Add a new newsgroup.
2228 The user will be prompted for a NAME, for a select METHOD, and an
2232 (gnus-read-group "Group name: ")
2233 (gnus-read-method "From method: ")))
2235 (when (stringp method
)
2236 (setq method
(or (gnus-server-to-method method
) method
)))
2237 (let* ((meth (gnus-method-simplify
2239 (not (gnus-server-equal method gnus-select-method
)))
2240 (if address
(list (intern method
) address
)
2242 (nname (if method
(gnus-group-prefixed-name name meth
) name
))
2244 (when (gnus-gethash nname gnus-newsrc-hashtb
)
2245 (error "Group %s already exists" nname
))
2246 ;; Subscribe to the new group.
2247 (gnus-group-change-level
2248 (setq info
(list t nname gnus-level-default-subscribed nil nil meth
))
2249 gnus-level-default-subscribed gnus-level-killed
2250 (and (gnus-group-group-name)
2251 (gnus-gethash (gnus-group-group-name)
2252 gnus-newsrc-hashtb
))
2255 (gnus-set-active nname
(cons 1 0))
2256 (unless (gnus-ephemeral-group-p name
)
2258 (concat "(gnus-group-set-info '"
2259 (gnus-prin1-to-string (cdr info
)) ")")))
2261 (gnus-group-insert-group-line-info nname
)
2263 (gnus-group-position-point)
2265 ;; Load the back end and try to make the back end create
2266 ;; the group as well.
2267 (when (assoc (symbol-name (setq backend
(car (gnus-server-get-method
2269 gnus-valid-select-methods
)
2271 (gnus-check-server meth
)
2272 (when (gnus-check-backend-function 'request-create-group nname
)
2273 (unless (gnus-request-create-group nname nil args
)
2274 (error "Could not create group on server: %s"
2275 (nnheader-get-report backend
))))
2278 (defun gnus-group-delete-groups (&optional arg
)
2279 "Delete the current group. Only meaningful with editable groups."
2281 (let ((n (length (gnus-group-process-prefix arg
))))
2282 (when (gnus-yes-or-no-p
2284 "Delete this 1 group? "
2285 (format "Delete these %d groups? " n
)))
2286 (gnus-group-iterate arg
2288 (gnus-group-delete-group group nil t
))))))
2290 (defun gnus-group-delete-group (group &optional force no-prompt
)
2291 "Delete the current group. Only meaningful with editable groups.
2292 If FORCE (the prefix) is non-nil, all the articles in the group will
2293 be deleted. This is \"deleted\" as in \"removed forever from the face
2294 of the Earth\". There is no undo. The user will be prompted before
2296 Note that you also have to specify FORCE if you want the group to
2297 be removed from the server, even when it's empty."
2299 (list (gnus-group-group-name)
2300 current-prefix-arg
))
2302 (error "No group to delete"))
2303 (unless (gnus-check-backend-function 'request-delete-group group
)
2304 (error "This back end does not support group deletion"))
2306 (if (and (not no-prompt
)
2307 (not (gnus-yes-or-no-p
2309 "Do you really want to delete %s%s? "
2310 group
(if force
" and all its contents" "")))))
2312 (gnus-message 6 "Deleting group %s..." group
)
2313 (if (not (gnus-request-delete-group group force
))
2314 (gnus-error 3 "Couldn't delete group %s" group
)
2315 (gnus-message 6 "Deleting group %s...done" group
)
2316 (gnus-group-goto-group group
)
2317 (gnus-group-kill-group 1 t
)
2318 (gnus-sethash group nil gnus-active-hashtb
)
2320 (gnus-group-position-point)))
2322 (defun gnus-group-rename-group (group new-name
)
2323 "Rename group from GROUP to NEW-NAME.
2324 When used interactively, GROUP is the group under point
2325 and NEW-NAME will be prompted for."
2328 (gnus-group-group-name)
2330 (unless (gnus-check-backend-function
2331 'request-rename-group
(gnus-group-group-name))
2332 (error "This back end does not support renaming groups"))
2333 (gnus-read-group "Rename group to: "
2334 (gnus-group-real-name (gnus-group-group-name))))))
2336 (unless (gnus-check-backend-function 'request-rename-group group
)
2337 (error "This back end does not support renaming groups"))
2339 (error "No group to rename"))
2340 (when (equal (gnus-group-real-name group
) new-name
)
2341 (error "Can't rename to the same name"))
2343 ;; We find the proper prefixed name.
2345 (if (gnus-group-native-p group
)
2349 (gnus-group-prefixed-name
2350 (gnus-group-real-name new-name
)
2351 (gnus-info-method (gnus-get-info group
)))))
2353 (when (gnus-active new-name
)
2354 (error "The group %s already exists" new-name
))
2356 (gnus-message 6 "Renaming group %s to %s..." group new-name
)
2359 (gnus-group-goto-group group
)
2360 (not (when (< (gnus-group-group-level) gnus-level-zombie
)
2361 (gnus-request-rename-group group new-name
))))
2362 (gnus-error 3 "Couldn't rename group %s to %s" group new-name
)
2363 ;; We rename the group internally by killing it...
2364 (gnus-group-kill-group)
2365 ;; ... changing its name ...
2366 (setcar (cdar gnus-list-of-killed-groups
) new-name
)
2367 ;; ... and then yanking it. Magic!
2368 (gnus-group-yank-group)
2369 (gnus-set-active new-name
(gnus-active group
))
2370 (gnus-message 6 "Renaming group %s to %s...done" group new-name
)
2372 (setq gnus-killed-list
(delete group gnus-killed-list
))
2373 (gnus-set-active group nil
)
2374 (gnus-dribble-touch)
2375 (gnus-group-position-point)))
2377 (defun gnus-group-edit-group (group &optional part
)
2378 "Edit the group on the current line."
2379 (interactive (list (gnus-group-group-name)))
2380 (let ((part (or part
'info
))
2383 (error "No group on current line"))
2384 (unless (setq info
(gnus-get-info group
))
2385 (error "Killed group; can't be edited"))
2387 (gnus-close-group group
))
2389 ;; Find the proper form to edit.
2390 (cond ((eq part
'method
)
2391 (or (gnus-info-method info
) "native"))
2393 (gnus-info-params info
))
2395 ;; The proper documentation.
2397 "Editing the %s for `%s'."
2399 ((eq part
'method
) "select method")
2400 ((eq part
'params
) "group parameters")
2402 (gnus-group-decoded-name group
))
2404 (gnus-group-edit-group-done ',part
,group form
)))
2407 (gnus-create-info-command
2410 "(gnus)Select Methods")
2412 "(gnus)Group Parameters")
2414 "(gnus)Group Info"))))))
2416 (defun gnus-group-edit-group-method (group)
2417 "Edit the select method of GROUP."
2418 (interactive (list (gnus-group-group-name)))
2419 (gnus-group-edit-group group
'method
))
2421 (defun gnus-group-edit-group-parameters (group)
2422 "Edit the group parameters of GROUP."
2423 (interactive (list (gnus-group-group-name)))
2424 (gnus-group-edit-group group
'params
))
2426 (defun gnus-group-edit-group-done (part group form
)
2428 (let* ((method (cond ((eq part
'info
) (nth 4 form
))
2429 ((eq part
'method
) form
)
2431 (info (cond ((eq part
'info
) form
)
2432 ((eq part
'method
) (gnus-get-info group
))
2435 (if (or (not method
)
2437 gnus-select-method method
))
2438 (gnus-group-real-name (car info
))
2439 (gnus-group-prefixed-name
2440 (gnus-group-real-name (car info
)) method
))
2442 (when (and new-group
2443 (not (equal new-group group
)))
2444 (when (gnus-group-goto-group group
)
2445 (gnus-group-kill-group 1))
2446 (gnus-activate-group new-group
))
2448 (if (not (and info new-group
))
2449 (gnus-group-set-info form
(or new-group group
) part
)
2450 (setq info
(gnus-copy-sequence info
))
2451 (setcar info new-group
)
2452 (unless (gnus-server-equal method
"native")
2453 (unless (nthcdr 3 info
)
2454 (nconc info
(list nil nil
)))
2455 (unless (nthcdr 4 info
)
2456 (nconc info
(list nil
)))
2457 (gnus-info-set-method info method
))
2458 (gnus-group-set-info info
))
2459 (gnus-group-update-group (or new-group group
))
2460 (gnus-group-position-point)))
2462 (defun gnus-group-make-useful-group (group method
)
2463 "Create one of the groups described in `gnus-useful-groups'."
2465 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
2467 gnus-useful-groups
)))
2468 (list (cadr entry
) (caddr entry
))))
2469 (setq method
(gnus-copy-sequence method
))
2471 (while (setq entry
(memq (assq 'eval method
) method
))
2472 (setcar entry
(eval (cadar entry
)))))
2473 (gnus-group-make-group group method
))
2475 (defun gnus-group-make-help-group (&optional noerror
)
2476 "Create the Gnus documentation group.
2477 Optional argument NOERROR modifies the behavior of this function when the
2478 group already exists:
2479 - if not given, and error is signaled,
2480 - if t, stay silent,
2481 - if anything else, just print a message."
2483 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
2484 (file (nnheader-find-etc-directory "gnus-tut.txt" t
)))
2485 (if (gnus-gethash name gnus-newsrc-hashtb
)
2486 (cond ((eq noerror nil
)
2487 (error "Documentation group already exists"))
2492 (gnus-message 1 "Documentation group already exists")))
2495 (gnus-message 1 "Couldn't find doc group")
2496 (gnus-group-make-group
2497 (gnus-group-real-name name
)
2498 (list 'nndoc
"gnus-help"
2499 (list 'nndoc-address file
)
2500 (list 'nndoc-article-type
'mbox
))))
2502 (gnus-group-position-point))
2504 (defun gnus-group-make-doc-group (file type
)
2505 "Create a group that uses a single file as the source.
2507 If called with a prefix argument, ask for the file type."
2509 (list (read-file-name "File name: ")
2510 (and current-prefix-arg
'ask
)))
2511 (when (eq type
'ask
)
2516 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [m, b, d, f, a, g]: "
2518 (setq found
(cond ((= (setq char
(read-char)) ?m
) 'mbox
)
2519 ((= char ?b
) 'babyl
)
2520 ((= char ?d
) 'digest
)
2521 ((= char ?f
) 'forward
)
2523 ((= char ?g
) 'guess
)
2524 (t (setq err
(format "%c unknown. " char
))
2527 (let* ((file (expand-file-name file
))
2528 (name (gnus-generate-new-group-name
2529 (gnus-group-prefixed-name
2530 (file-name-nondirectory file
) '(nndoc "")))))
2531 (gnus-group-make-group
2532 (gnus-group-real-name name
)
2534 (list 'nndoc-address file
)
2535 (list 'nndoc-article-type
(or type
'guess
))))))
2537 (defvar nnweb-type-definition
)
2538 (defvar gnus-group-web-type-history nil
)
2539 (defvar gnus-group-web-search-history nil
)
2540 (defun gnus-group-make-web-group (&optional solid
)
2541 "Create an ephemeral nnweb group.
2542 If SOLID (the prefix), create a solid group."
2546 (if solid
(gnus-read-group "Group name: ")
2547 (message-unique-id)))
2548 (default-type (or (car gnus-group-web-type-history
)
2549 (symbol-name (caar nnweb-type-definition
))))
2553 (format "Search engine type (default %s): " default-type
)
2554 (mapcar (lambda (elem) (list (symbol-name (car elem
))))
2555 nnweb-type-definition
)
2556 nil t nil
'gnus-group-web-type-history
)
2561 (cons (or (car gnus-group-web-search-history
) "") 0)
2562 'gnus-group-web-search-history
))
2564 `(nnweb ,group
(nnweb-search ,search
)
2565 (nnweb-type ,(intern type
))
2566 (nnweb-ephemeral-p t
))))
2569 (gnus-pull 'nnweb-ephemeral-p method
)
2570 (gnus-group-make-group group method
))
2571 (gnus-group-read-ephemeral-group
2573 (cons (current-buffer)
2574 (if (eq major-mode
'gnus-summary-mode
) 'summary
'group
))))))
2577 (defvar nnrss-group-alist
)
2578 (defun nnrss-discover-feed (arg))
2579 (defun nnrss-save-server-data (arg)))
2580 (defun gnus-group-make-rss-group (&optional url
)
2581 "Given a URL, discover if there is an RSS feed.
2582 If there is, use Gnus to create an nnrss group"
2586 (setq url
(read-from-minibuffer "URL to Search for RSS: ")))
2587 (let ((feedinfo (nnrss-discover-feed url
)))
2589 (let ((title (read-from-minibuffer "Title: "
2592 (desc (read-from-minibuffer "Description: "
2593 (cdr (assoc 'description
2595 (href (cdr (assoc 'href feedinfo
))))
2596 (push (list title href desc
)
2598 (gnus-group-make-group title
'(nnrss ""))
2599 (nnrss-save-server-data nil
))
2600 (error "No feeds found for %s" url
))))
2602 (defvar nnwarchive-type-definition
)
2603 (defvar gnus-group-warchive-type-history nil
)
2604 (defvar gnus-group-warchive-login-history nil
)
2605 (defvar gnus-group-warchive-address-history nil
)
2607 (defun gnus-group-make-warchive-group ()
2608 "Create a nnwarchive group."
2610 (require 'nnwarchive
)
2611 (let* ((group (gnus-read-group "Group name: "))
2612 (default-type (or (car gnus-group-warchive-type-history
)
2613 (symbol-name (caar nnwarchive-type-definition
))))
2617 (format "Warchive type (default %s): " default-type
)
2618 (mapcar (lambda (elem) (list (symbol-name (car elem
))))
2619 nnwarchive-type-definition
)
2620 nil t nil
'gnus-group-warchive-type-history
)
2622 (address (read-string "Warchive address: "
2623 nil
'gnus-group-warchive-address-history
))
2624 (default-login (or (car gnus-group-warchive-login-history
)
2629 (format "Warchive login (default %s): " user-mail-address
)
2630 default-login
'gnus-group-warchive-login-history
)
2633 `(nnwarchive ,address
2634 (nnwarchive-type ,(intern type
))
2635 (nnwarchive-login ,login
))))
2636 (gnus-group-make-group group method
)))
2638 (defun gnus-group-make-archive-group (&optional all
)
2639 "Create the (ding) Gnus archive group of the most recent articles.
2640 Given a prefix, create a full group."
2642 (let ((group (gnus-group-prefixed-name
2643 (if all
"ding.archives" "ding.recent") '(nndir ""))))
2644 (when (gnus-gethash group gnus-newsrc-hashtb
)
2645 (error "Archive group already exists"))
2646 (gnus-group-make-group
2647 (gnus-group-real-name group
)
2648 (list 'nndir
(if all
"hpc" "edu")
2649 (list 'nndir-directory
2650 (if all gnus-group-archive-directory
2651 gnus-group-recent-archive-directory
))))
2652 (gnus-group-add-parameter group
(cons 'to-address
"ding@gnus.org"))))
2654 (defun gnus-group-make-directory-group (dir)
2655 "Create an nndir group.
2656 The user will be prompted for a directory. The contents of this
2657 directory will be used as a newsgroup. The directory should contain
2658 mail messages or news articles in files that have numeric names."
2660 (list (read-file-name "Create group from directory: ")))
2661 (unless (file-exists-p dir
)
2662 (error "No such directory"))
2663 (unless (file-directory-p dir
)
2664 (error "Not a directory"))
2668 (while (or (not group
) (gnus-gethash group gnus-newsrc-hashtb
))
2670 (gnus-group-prefixed-name
2671 (expand-file-name ext dir
)
2673 (setq ext
(format "<%d>" (setq i
(1+ i
)))))
2674 (gnus-group-make-group
2675 (gnus-group-real-name group
)
2676 (list 'nndir
(gnus-group-real-name group
) (list 'nndir-directory dir
)))))
2678 (defvar nnkiboze-score-file
)
2679 (defun gnus-group-make-kiboze-group (group address scores
)
2680 "Create an nnkiboze group.
2681 The user will be prompted for a name, a regexp to match groups, and
2682 score file entries for articles to include in the group."
2685 (read-string "nnkiboze group name: ")
2686 (read-string "Source groups (regexp): ")
2687 (let ((headers (mapcar (lambda (group) (list group
))
2688 '("subject" "from" "number" "date" "message-id"
2689 "references" "chars" "lines" "xref"
2690 "followup" "all" "body" "head")))
2691 scores header regexp regexps
)
2692 (while (not (equal "" (setq header
(completing-read
2693 "Match on header: " headers nil t
))))
2695 (while (not (equal "" (setq regexp
(read-string
2696 (format "Match on %s (regexp): "
2698 (push (list regexp nil nil
'r
) regexps
))
2699 (push (cons header regexps
) scores
))
2701 (gnus-group-make-group group
"nnkiboze" address
)
2702 (let* ((nnkiboze-current-group group
)
2703 (score-file (car (nnkiboze-score-file "")))
2704 (score-dir (file-name-directory score-file
)))
2705 (unless (file-exists-p score-dir
)
2706 (make-directory score-dir
))
2707 (with-temp-file score-file
2708 (let (emacs-lisp-mode-hook)
2709 (gnus-pp scores
)))))
2711 (defun gnus-group-add-to-virtual (n vgroup
)
2712 "Add the current group to a virtual group."
2714 (list current-prefix-arg
2715 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2717 (unless (eq (car (gnus-find-method-for-group vgroup
)) 'nnvirtual
)
2718 (error "%s is not an nnvirtual group" vgroup
))
2719 (gnus-close-group vgroup
)
2720 (let* ((groups (gnus-group-process-prefix n
))
2721 (method (gnus-info-method (gnus-get-info vgroup
))))
2722 (setcar (cdr method
)
2724 (nth 1 method
) "\\|"
2727 (gnus-group-remove-mark s
)
2728 (concat "\\(^" (regexp-quote s
) "$\\)"))
2730 (gnus-group-position-point))
2732 (defun gnus-group-make-empty-virtual (group)
2733 "Create a new, fresh, empty virtual group."
2734 (interactive "sCreate new, empty virtual group: ")
2735 (let* ((method (list 'nnvirtual
"^$"))
2736 (pgroup (gnus-group-prefixed-name group method
)))
2737 ;; Check whether it exists already.
2738 (when (gnus-gethash pgroup gnus-newsrc-hashtb
)
2739 (error "Group %s already exists" pgroup
))
2740 ;; Subscribe the new group after the group on the current line.
2741 (gnus-subscribe-group pgroup
(gnus-group-group-name) method
)
2742 (gnus-group-update-group pgroup
)
2744 (gnus-group-position-point)))
2746 (defun gnus-group-enter-directory (dir)
2747 "Enter an ephemeral nneething group."
2748 (interactive "DDirectory to read: ")
2749 (let* ((method (list 'nneething dir
'(nneething-read-only t
)))
2750 (leaf (gnus-group-prefixed-name
2751 (file-name-nondirectory (directory-file-name dir
))
2753 (name (gnus-generate-new-group-name leaf
)))
2754 (unless (gnus-group-read-ephemeral-group
2756 (cons (current-buffer)
2757 (if (eq major-mode
'gnus-summary-mode
)
2759 (error "Couldn't enter %s" dir
))))
2762 (autoload 'nnimap-expunge
"nnimap")
2763 (autoload 'nnimap-acl-get
"nnimap")
2764 (autoload 'nnimap-acl-edit
"nnimap"))
2766 (defun gnus-group-nnimap-expunge (group)
2767 "Expunge deleted articles in current nnimap GROUP."
2768 (interactive (list (gnus-group-group-name)))
2769 (let ((mailbox (gnus-group-real-name group
)) method
)
2771 (error "No group on current line"))
2772 (unless (gnus-get-info group
)
2773 (error "Killed group; can't be edited"))
2774 (unless (eq 'nnimap
(car (setq method
(gnus-find-method-for-group group
))))
2775 (error "%s is not an nnimap group" group
))
2776 (nnimap-expunge mailbox
(cadr method
))))
2778 (defun gnus-group-nnimap-edit-acl (group)
2779 "Edit the Access Control List of current nnimap GROUP."
2780 (interactive (list (gnus-group-group-name)))
2781 (let ((mailbox (gnus-group-real-name group
)) method acl
)
2783 (error "No group on current line"))
2784 (unless (gnus-get-info group
)
2785 (error "Killed group; can't be edited"))
2786 (unless (eq (car (setq method
(gnus-find-method-for-group group
))) 'nnimap
)
2787 (error "%s is not an nnimap group" group
))
2788 (unless (setq acl
(nnimap-acl-get mailbox
(cadr method
)))
2789 (error "Server does not support ACL's"))
2790 (gnus-edit-form acl
(format "Editing the access control list for `%s'.
2792 An access control list is a list of (identifier . rights) elements.
2794 The identifier string specifies the corresponding user. The
2795 identifier \"anyone\" is reserved to refer to the universal identity.
2797 Rights is a string listing a (possibly empty) set of alphanumeric
2798 characters, each character listing a set of operations which is being
2799 controlled. Letters are reserved for ``standard'' rights, listed
2800 below. Digits are reserved for implementation or site defined rights.
2802 l - lookup (mailbox is visible to LIST/LSUB commands)
2803 r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
2804 SEARCH, COPY from mailbox)
2805 s - keep seen/unseen information across sessions (STORE \\SEEN flag)
2806 w - write (STORE flags other than \\SEEN and \\DELETED)
2807 i - insert (perform APPEND, COPY into mailbox)
2808 p - post (send mail to submission address for mailbox,
2809 not enforced by IMAP4 itself)
2810 c - create and delete mailbox (CREATE new sub-mailboxes in any
2811 implementation-defined hierarchy, RENAME or DELETE mailbox)
2812 d - delete messages (STORE \\DELETED flag, perform EXPUNGE)
2813 a - administer (perform SETACL)" group
)
2816 ,mailbox
',method
',acl form
)))))
2818 ;; Group sorting commands
2819 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2821 (defun gnus-group-sort-groups (func &optional reverse
)
2822 "Sort the group buffer according to FUNC.
2823 When used interactively, the sorting function used will be
2824 determined by the `gnus-group-sort-function' variable.
2825 If REVERSE (the prefix), reverse the sorting order."
2826 (interactive (list gnus-group-sort-function current-prefix-arg
))
2827 (funcall gnus-group-sort-alist-function
2828 (gnus-make-sort-function func
) reverse
)
2829 (gnus-group-unmark-all-groups)
2830 (gnus-group-list-groups)
2831 (gnus-dribble-touch))
2833 (defun gnus-group-sort-flat (func reverse
)
2834 ;; We peel off the dummy group from the alist.
2836 (when (equal (gnus-info-group (car gnus-newsrc-alist
)) "dummy.group")
2837 (pop gnus-newsrc-alist
))
2839 (setq gnus-newsrc-alist
2840 (sort gnus-newsrc-alist func
))
2842 (setq gnus-newsrc-alist
(nreverse gnus-newsrc-alist
)))
2843 ;; Regenerate the hash table.
2844 (gnus-make-hashtable-from-newsrc-alist)))
2846 (defun gnus-group-sort-groups-by-alphabet (&optional reverse
)
2847 "Sort the group buffer alphabetically by group name.
2848 If REVERSE, sort in reverse order."
2850 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse
))
2852 (defun gnus-group-sort-groups-by-real-name (&optional reverse
)
2853 "Sort the group buffer alphabetically by real (unprefixed) group name.
2854 If REVERSE, sort in reverse order."
2856 (gnus-group-sort-groups 'gnus-group-sort-by-real-name reverse
))
2858 (defun gnus-group-sort-groups-by-unread (&optional reverse
)
2859 "Sort the group buffer by number of unread articles.
2860 If REVERSE, sort in reverse order."
2862 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse
))
2864 (defun gnus-group-sort-groups-by-level (&optional reverse
)
2865 "Sort the group buffer by group level.
2866 If REVERSE, sort in reverse order."
2868 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse
))
2870 (defun gnus-group-sort-groups-by-score (&optional reverse
)
2871 "Sort the group buffer by group score.
2872 If REVERSE, sort in reverse order."
2874 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse
))
2876 (defun gnus-group-sort-groups-by-rank (&optional reverse
)
2877 "Sort the group buffer by group rank.
2878 If REVERSE, sort in reverse order."
2880 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse
))
2882 (defun gnus-group-sort-groups-by-method (&optional reverse
)
2883 "Sort the group buffer alphabetically by back end name.
2884 If REVERSE, sort in reverse order."
2886 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse
))
2888 (defun gnus-group-sort-groups-by-server (&optional reverse
)
2889 "Sort the group buffer alphabetically by server name.
2890 If REVERSE, sort in reverse order."
2892 (gnus-group-sort-groups 'gnus-group-sort-by-server reverse
))
2894 ;;; Selected group sorting.
2896 (defun gnus-group-sort-selected-groups (n func
&optional reverse
)
2897 "Sort the process/prefixed groups."
2898 (interactive (list current-prefix-arg gnus-group-sort-function
))
2899 (let ((groups (gnus-group-process-prefix n
)))
2900 (funcall gnus-group-sort-selected-function
2901 groups
(gnus-make-sort-function func
) reverse
)
2902 (gnus-group-unmark-all-groups)
2903 (gnus-group-list-groups)
2904 (gnus-dribble-touch)))
2906 (defun gnus-group-sort-selected-flat (groups func reverse
)
2907 (let (entries infos
)
2908 ;; First find all the group entries for these groups.
2910 (push (nthcdr 2 (gnus-gethash (pop groups
) gnus-newsrc-hashtb
))
2912 ;; Then sort the infos.
2916 (lambda (entry) (car entry
))
2917 (setq entries
(nreverse entries
)))
2920 (setq infos
(nreverse infos
)))
2921 ;; Go through all the infos and replace the old entries
2922 ;; with the new infos.
2924 (setcar (car entries
) (pop infos
))
2926 ;; Update the hashtable.
2927 (gnus-make-hashtable-from-newsrc-alist)))
2929 (defun gnus-group-sort-selected-groups-by-alphabet (&optional n reverse
)
2930 "Sort the group buffer alphabetically by group name.
2931 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2932 sort in reverse order."
2933 (interactive (gnus-interactive "P\ny"))
2934 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-alphabet reverse
))
2936 (defun gnus-group-sort-selected-groups-by-real-name (&optional n reverse
)
2937 "Sort the group buffer alphabetically by real group name.
2938 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2939 sort in reverse order."
2940 (interactive (gnus-interactive "P\ny"))
2941 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-real-name reverse
))
2943 (defun gnus-group-sort-selected-groups-by-unread (&optional n reverse
)
2944 "Sort the group buffer by number of unread articles.
2945 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2946 sort in reverse order."
2947 (interactive (gnus-interactive "P\ny"))
2948 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-unread reverse
))
2950 (defun gnus-group-sort-selected-groups-by-level (&optional n reverse
)
2951 "Sort the group buffer by group level.
2952 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2953 sort in reverse order."
2954 (interactive (gnus-interactive "P\ny"))
2955 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-level reverse
))
2957 (defun gnus-group-sort-selected-groups-by-score (&optional n reverse
)
2958 "Sort the group buffer by group score.
2959 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2960 sort in reverse order."
2961 (interactive (gnus-interactive "P\ny"))
2962 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-score reverse
))
2964 (defun gnus-group-sort-selected-groups-by-rank (&optional n reverse
)
2965 "Sort the group buffer by group rank.
2966 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2967 sort in reverse order."
2968 (interactive (gnus-interactive "P\ny"))
2969 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-rank reverse
))
2971 (defun gnus-group-sort-selected-groups-by-method (&optional n reverse
)
2972 "Sort the group buffer alphabetically by back end name.
2973 Obeys the process/prefix convention. If REVERSE (the symbolic prefix),
2974 sort in reverse order."
2975 (interactive (gnus-interactive "P\ny"))
2976 (gnus-group-sort-selected-groups n
'gnus-group-sort-by-method reverse
))
2978 ;;; Sorting predicates.
2980 (defun gnus-group-sort-by-alphabet (info1 info2
)
2981 "Sort alphabetically."
2982 (string< (gnus-info-group info1
) (gnus-info-group info2
)))
2984 (defun gnus-group-sort-by-real-name (info1 info2
)
2985 "Sort alphabetically on real (unprefixed) names."
2986 (string< (gnus-group-real-name (gnus-info-group info1
))
2987 (gnus-group-real-name (gnus-info-group info2
))))
2989 (defun gnus-group-sort-by-unread (info1 info2
)
2990 "Sort by number of unread articles."
2991 (let ((n1 (car (gnus-gethash (gnus-info-group info1
) gnus-newsrc-hashtb
)))
2992 (n2 (car (gnus-gethash (gnus-info-group info2
) gnus-newsrc-hashtb
))))
2993 (< (or (and (numberp n1
) n1
) 0)
2994 (or (and (numberp n2
) n2
) 0))))
2996 (defun gnus-group-sort-by-level (info1 info2
)
2998 (< (gnus-info-level info1
) (gnus-info-level info2
)))
3000 (defun gnus-group-sort-by-method (info1 info2
)
3001 "Sort alphabetically by back end name."
3002 (string< (car (gnus-find-method-for-group
3003 (gnus-info-group info1
) info1
))
3004 (car (gnus-find-method-for-group
3005 (gnus-info-group info2
) info2
))))
3007 (defun gnus-group-sort-by-server (info1 info2
)
3008 "Sort alphabetically by server name."
3009 (string< (gnus-method-to-full-server-name
3010 (gnus-find-method-for-group
3011 (gnus-info-group info1
) info1
))
3012 (gnus-method-to-full-server-name
3013 (gnus-find-method-for-group
3014 (gnus-info-group info2
) info2
))))
3016 (defun gnus-group-sort-by-score (info1 info2
)
3017 "Sort by group score."
3018 (> (gnus-info-score info1
) (gnus-info-score info2
)))
3020 (defun gnus-group-sort-by-rank (info1 info2
)
3021 "Sort by level and score."
3022 (let ((level1 (gnus-info-level info1
))
3023 (level2 (gnus-info-level info2
)))
3024 (or (< level1 level2
)
3025 (and (= level1 level2
)
3026 (> (gnus-info-score info1
) (gnus-info-score info2
))))))
3030 (defun gnus-group-clear-data (&optional arg
)
3031 "Clear all marks and read ranges from the current group.
3032 Obeys the process/prefix convention."
3034 (gnus-group-iterate arg
3037 (gnus-info-clear-data (setq info
(gnus-get-info group
)))
3038 (gnus-get-unread-articles-in-group info
(gnus-active group
) t
)
3039 (when (gnus-group-goto-group group
)
3040 (gnus-group-update-group-line))))))
3042 (defun gnus-group-clear-data-on-native-groups ()
3043 "Clear all marks and read ranges from all native groups."
3045 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
3046 (let ((alist (cdr gnus-newsrc-alist
))
3048 (while (setq info
(pop alist
))
3049 (when (gnus-group-native-p (gnus-info-group info
))
3050 (gnus-info-clear-data info
)))
3051 (gnus-get-unread-articles)
3052 (gnus-dribble-touch)
3053 (when (gnus-y-or-n-p
3054 "Move the cache away to avoid problems in the future? ")
3055 (call-interactively 'gnus-cache-move-cache
)))))
3057 (defun gnus-info-clear-data (info)
3058 "Clear all marks and read ranges from INFO."
3059 (let ((group (gnus-info-group info
))
3061 (dolist (el (gnus-info-marks info
))
3062 (push `(,(cdr el
) add
(,(car el
))) action
))
3063 (push `(,(gnus-info-read info
) add
(read)) action
)
3066 (gnus-request-set-mark ,group
',action
)
3067 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
3068 (gnus-info-set-read ',info
',(gnus-info-read info
))
3069 (when (gnus-group-goto-group ,group
)
3070 (gnus-get-unread-articles-in-group ',info
',(gnus-active group
) t
)
3071 (gnus-group-update-group-line))))
3072 (setq action
(mapcar (lambda (el) (list (nth 0 el
) 'del
(nth 2 el
)))
3074 (gnus-request-set-mark group action
)
3075 (gnus-info-set-read info nil
)
3076 (when (gnus-info-marks info
)
3077 (gnus-info-set-marks info nil
))))
3079 ;; Group catching up.
3081 (defun gnus-group-catchup-current (&optional n all
)
3082 "Mark all unread articles in the current newsgroup as read.
3083 If prefix argument N is numeric, the next N newsgroups will be
3084 caught up. If ALL is non-nil, marked articles will also be marked as
3085 read. Cross references (Xref: header) of articles are ignored.
3086 The number of newsgroups that this function was unable to catch
3089 (let ((groups (gnus-group-process-prefix n
))
3092 (unless groups
(error "No groups selected"))
3094 (or (not gnus-interactive-catchup
) ;Without confirmation?
3099 "Do you really want to mark all articles in %s as read? "
3100 "Mark all unread articles in %s as read? ")
3101 (if (= (length groups
) 1)
3103 (format "these %d groups" (length groups
)))))))
3105 (while (setq group
(pop groups
))
3106 (gnus-group-remove-mark group
)
3107 ;; Virtual groups have to be given special treatment.
3108 (let ((method (gnus-find-method-for-group group
)))
3109 (when (eq 'nnvirtual
(car method
))
3110 (nnvirtual-catchup-group
3111 (gnus-group-real-name group
) (nth 1 method
) all
)))
3112 (if (>= (gnus-group-level group
) gnus-level-zombie
)
3113 (gnus-message 2 "Dead groups can't be caught up")
3115 (gnus-group-goto-group group
)
3116 (gnus-group-catchup group all
))
3117 (gnus-group-update-group-line)
3118 (setq ret
(1+ ret
)))))
3119 (gnus-group-next-unread-group 1)
3122 (defun gnus-group-catchup-current-all (&optional n
)
3123 "Mark all articles in current newsgroup as read.
3124 Cross references (Xref: header) of articles are ignored."
3126 (gnus-group-catchup-current n
'all
))
3128 (defun gnus-group-catchup (group &optional all
)
3129 "Mark all articles in GROUP as read.
3130 If ALL is non-nil, all articles are marked as read.
3131 The return value is the number of articles that were marked as read,
3132 or nil if no action could be taken."
3133 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb
))
3135 (marks (nth 3 (nth 2 entry
)))
3136 (unread (gnus-sequence-of-unread-articles group
)))
3137 ;; Remove entries for this group.
3138 (nnmail-purge-split-history (gnus-group-real-name group
))
3139 ;; Do the updating only if the newsgroup isn't killed.
3140 (if (not (numberp (car entry
)))
3141 (gnus-message 1 "Can't catch up %s; non-active group" group
)
3142 (gnus-update-read-articles group nil
)
3144 ;; Nix out the lists of marks and dormants.
3145 (gnus-request-set-mark group
(list (list (cdr (assq 'tick marks
))
3147 (list (cdr (assq 'dormant marks
))
3149 (setq unread
(gnus-range-add (gnus-range-add
3150 unread
(cdr (assq 'dormant marks
)))
3151 (cdr (assq 'tick marks
))))
3152 (gnus-add-marked-articles group
'tick nil nil
'force
)
3153 (gnus-add-marked-articles group
'dormant nil nil
'force
))
3154 ;; Do auto-expirable marks if that's required.
3155 (when (gnus-group-auto-expirable-p group
)
3156 (gnus-range-map (lambda (article)
3157 (gnus-add-marked-articles group
'expire
(list article
))
3158 (gnus-request-set-mark group
(list (list (list article
) 'add
'(expire)))))
3160 (let ((gnus-newsgroup-name group
))
3161 (gnus-run-hooks 'gnus-group-catchup-group-hook
))
3164 (defun gnus-group-expire-articles (&optional n
)
3165 "Expire all expirable articles in the current newsgroup.
3166 Uses the process/prefix convention."
3168 (let ((groups (gnus-group-process-prefix n
))
3171 (error "No groups to expire"))
3172 (while (setq group
(pop groups
))
3173 (gnus-group-remove-mark group
)
3174 (gnus-group-expire-articles-1 group
)
3175 (gnus-dribble-touch)
3176 (gnus-group-position-point))))
3178 (defun gnus-group-expire-articles-1 (group)
3179 (when (gnus-check-backend-function 'request-expire-articles group
)
3180 (gnus-message 6 "Expiring articles in %s..." group
)
3181 (let* ((info (gnus-get-info group
))
3182 (expirable (if (gnus-group-total-expirable-p group
)
3183 (cons nil
(gnus-list-of-read-articles group
))
3184 (assq 'expire
(gnus-info-marks info
))))
3185 (expiry-wait (gnus-group-find-parameter group
'expiry-wait
))
3186 (nnmail-expiry-target
3187 (or (gnus-group-find-parameter group
'expiry-target
)
3188 nnmail-expiry-target
)))
3190 (gnus-check-group group
)
3193 (gnus-compress-sequence
3195 ;; We set the expiry variables to the group
3197 (let ((nnmail-expiry-wait-function nil
)
3198 (nnmail-expiry-wait expiry-wait
))
3199 (gnus-request-expire-articles
3200 (gnus-uncompress-sequence (cdr expirable
)) group
))
3201 ;; Just expire using the normal expiry values.
3202 (gnus-request-expire-articles
3203 (gnus-uncompress-sequence (cdr expirable
)) group
))))
3204 (gnus-close-group group
))
3205 (gnus-message 6 "Expiring articles in %s...done" group
)
3206 ;; Return the list of un-expired articles.
3209 (defun gnus-group-expire-all-groups ()
3210 "Expire all expirable articles in all newsgroups."
3213 (gnus-message 5 "Expiring...")
3214 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info
))
3215 (cdr gnus-newsrc-alist
))))
3216 (gnus-group-expire-articles nil
)))
3217 (gnus-group-position-point)
3218 (gnus-message 5 "Expiring...done"))
3220 (defun gnus-group-set-current-level (n level
)
3221 "Set the level of the next N groups to LEVEL."
3226 (unless (gnus-group-process-prefix current-prefix-arg
)
3227 (error "No group on the current line"))
3229 (let ((s (read-string
3230 (format "Level (default %s): "
3231 (or (gnus-group-group-level)
3232 gnus-level-default-subscribed
)))))
3233 (if (string-match "^\\s-*$" s
)
3234 (int-to-string (or (gnus-group-group-level)
3235 gnus-level-default-subscribed
))
3237 (unless (and (>= level
1) (<= level gnus-level-killed
))
3238 (error "Invalid level: %d" level
))
3239 (let ((groups (gnus-group-process-prefix n
))
3241 (while (setq group
(pop groups
))
3242 (gnus-group-remove-mark group
)
3243 (gnus-message 6 "Changed level of %s from %d to %d"
3244 group
(or (gnus-group-group-level) gnus-level-killed
)
3246 (gnus-group-change-level
3247 group level
(or (gnus-group-group-level) gnus-level-killed
))
3248 (gnus-group-update-group-line)))
3249 (gnus-group-position-point))
3251 (defun gnus-group-unsubscribe (&optional n
)
3252 "Unsubscribe the current group."
3254 (gnus-group-unsubscribe-current-group n
'unsubscribe
))
3256 (defun gnus-group-subscribe (&optional n
)
3257 "Subscribe the current group."
3259 (gnus-group-unsubscribe-current-group n
'subscribe
))
3261 (defun gnus-group-unsubscribe-current-group (&optional n do-sub
)
3262 "Toggle subscription of the current group.
3263 If given numerical prefix, toggle the N next groups."
3265 (dolist (group (gnus-group-process-prefix n
))
3266 (gnus-group-remove-mark group
)
3267 (gnus-group-unsubscribe-group
3270 ((eq do-sub
'unsubscribe
)
3271 gnus-level-default-unsubscribed
)
3272 ((eq do-sub
'subscribe
)
3273 gnus-level-default-subscribed
)
3274 ((<= (gnus-group-group-level) gnus-level-subscribed
)
3275 gnus-level-default-unsubscribed
)
3277 gnus-level-default-subscribed
))
3279 (gnus-group-update-group-line))
3280 (gnus-group-next-group 1))
3282 (defun gnus-group-unsubscribe-group (group &optional level silent
)
3283 "Toggle subscription to GROUP.
3284 Killed newsgroups are subscribed. If SILENT, don't try to update the
3287 (list (completing-read
3288 "Group: " gnus-active-hashtb nil
3289 (gnus-read-active-file-p)
3291 'gnus-group-history
)))
3292 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb
)))
3294 ((string-match "^[ \t]*$" group
)
3295 (error "Empty group name"))
3297 ;; Toggle subscription flag.
3298 (gnus-group-change-level
3299 newsrc
(if level level
(if (<= (gnus-info-level (nth 2 newsrc
))
3300 gnus-level-subscribed
)
3301 (1+ gnus-level-subscribed
)
3302 gnus-level-default-subscribed
)))
3304 (gnus-group-update-group group
)))
3305 ((and (stringp group
)
3306 (or (not (gnus-read-active-file-p))
3307 (gnus-active group
)))
3308 ;; Add new newsgroup.
3309 (gnus-group-change-level
3311 (if level level gnus-level-default-subscribed
)
3312 (or (and (member group gnus-zombie-list
)
3315 (when (gnus-group-group-name)
3316 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb
)))
3318 (gnus-group-update-group group
)))
3319 (t (error "No such newsgroup: %s" group
)))
3320 (gnus-group-position-point)))
3322 (defun gnus-group-transpose-groups (n)
3323 "Move the current newsgroup up N places.
3324 If given a negative prefix, move down instead. The difference between
3325 N and the number of steps taken is returned."
3327 (unless (gnus-group-group-name)
3328 (error "No group on current line"))
3329 (gnus-group-kill-group 1)
3331 (forward-line (- n
))
3332 (gnus-group-yank-group)
3333 (gnus-group-position-point)))
3335 (defun gnus-group-kill-all-zombies (&optional dummy
)
3336 "Kill all zombie newsgroups.
3337 The optional DUMMY should always be nil."
3338 (interactive (list (not (gnus-yes-or-no-p "Really kill all zombies? "))))
3340 (setq gnus-killed-list
(nconc gnus-zombie-list gnus-killed-list
))
3341 (setq gnus-zombie-list nil
)
3342 (gnus-dribble-touch)
3343 (gnus-group-list-groups)))
3345 (defun gnus-group-kill-region (begin end
)
3346 "Kill newsgroups in current region (excluding current point).
3347 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
3362 (beginning-of-line) ;Important when LINES < 1
3363 (gnus-group-kill-group lines
)))
3365 (defun gnus-group-kill-group (&optional n discard
)
3366 "Kill the next N groups.
3367 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
3368 However, only groups that were alive can be yanked; already killed
3369 groups or zombie groups can't be yanked.
3370 The return value is the name of the group that was killed, or a list
3373 (let ((buffer-read-only nil
)
3374 (groups (gnus-group-process-prefix n
))
3375 group entry level out
)
3376 (if (< (length groups
) 10)
3377 ;; This is faster when there are few groups.
3379 (push (setq group
(pop groups
)) out
)
3380 (gnus-group-remove-mark group
)
3381 (setq level
(gnus-group-group-level))
3383 (when (and (not discard
)
3384 (setq entry
(gnus-gethash group gnus-newsrc-hashtb
)))
3387 (gnus-group-goto-group ,(gnus-group-group-name))
3388 (gnus-group-yank-group)))
3389 (push (cons (car entry
) (nth 2 entry
))
3390 gnus-list-of-killed-groups
))
3391 (gnus-group-change-level
3392 (if entry entry group
) gnus-level-killed
(if entry nil level
))
3393 (message "Killed group %s" group
))
3394 ;; If there are lots and lots of groups to be killed, we use
3395 ;; this thing instead.
3396 (dolist (group (nreverse groups
))
3397 (gnus-group-remove-mark group
)
3399 (push group gnus-killed-list
)
3400 (setq gnus-newsrc-alist
3401 (delq (assoc group gnus-newsrc-alist
)
3403 (when gnus-group-change-level-function
3404 (funcall gnus-group-change-level-function
3405 group gnus-level-killed
3))
3407 ((setq entry
(gnus-gethash group gnus-newsrc-hashtb
))
3408 (push (cons (car entry
) (nth 2 entry
))
3409 gnus-list-of-killed-groups
)
3410 (setcdr (cdr entry
) (cdddr entry
)))
3411 ((member group gnus-zombie-list
)
3412 (setq gnus-zombie-list
(delete group gnus-zombie-list
))))
3413 ;; There may be more than one instance displayed.
3414 (while (gnus-group-goto-group group
)
3415 (gnus-delete-line)))
3416 (gnus-make-hashtable-from-newsrc-alist))
3418 (gnus-group-position-point)
3419 (if (< (length out
) 2) (car out
) (nreverse out
))))
3421 (defun gnus-group-yank-group (&optional arg
)
3422 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup.
3423 The numeric ARG specifies how many newsgroups are to be yanked. The
3424 name of the newsgroup yanked is returned, or (if several groups are
3425 yanked) a list of yanked groups is returned."
3427 (setq arg
(or arg
1))
3428 (let (info group prev out
)
3429 (while (>= (decf arg
) 0)
3430 (when (not (setq info
(pop gnus-list-of-killed-groups
)))
3431 (error "No more newsgroups to yank"))
3432 (push (setq group
(nth 1 info
)) out
)
3433 ;; Find which newsgroup to insert this one before - search
3434 ;; backward until something suitable is found. If there are no
3435 ;; other newsgroups in this buffer, just make this newsgroup the
3437 (setq prev
(gnus-group-group-name))
3438 (gnus-group-change-level
3439 info
(gnus-info-level (cdr info
)) gnus-level-killed
3440 (and prev
(gnus-gethash prev gnus-newsrc-hashtb
))
3442 (gnus-group-insert-group-line-info group
)
3444 `(when (gnus-group-goto-group ,group
)
3445 (gnus-group-kill-group 1))))
3447 (gnus-group-position-point)
3448 (if (< (length out
) 2) (car out
) (nreverse out
))))
3450 (defun gnus-group-kill-level (level)
3451 "Kill all groups that is on a certain LEVEL."
3452 (interactive "nKill all groups on level: ")
3454 ((= level gnus-level-zombie
)
3455 (setq gnus-killed-list
3456 (nconc gnus-zombie-list gnus-killed-list
))
3457 (setq gnus-zombie-list nil
))
3458 ((and (< level gnus-level-zombie
)
3460 (or gnus-expert-user
3463 "Do you really want to kill all groups on level %d? "
3465 (let* ((prev gnus-newsrc-alist
)
3468 (if (= (gnus-info-level (car alist
)) level
)
3470 (push (gnus-info-group (car alist
)) gnus-killed-list
)
3471 (setcdr prev
(cdr alist
)))
3473 (setq alist
(cdr alist
)))
3474 (gnus-make-hashtable-from-newsrc-alist)
3475 (gnus-group-list-groups)))
3477 (error "Can't kill; invalid level: %d" level
))))
3479 (defun gnus-group-list-all-groups (&optional arg
)
3480 "List all newsgroups with level ARG or lower.
3481 Default is `gnus-level-unsubscribed', which lists all subscribed and most
3482 unsubscribed groups."
3484 (gnus-group-list-groups (or arg gnus-level-unsubscribed
) t
))
3486 ;; Redefine this to list ALL killed groups if prefix arg used.
3487 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
3488 (defun gnus-group-list-killed (&optional arg
)
3489 "List all killed newsgroups in the group buffer.
3490 If ARG is non-nil, list ALL killed groups known to Gnus. This may
3491 entail asking the server for the groups."
3493 ;; Find all possible killed newsgroups if arg.
3495 (gnus-get-killed-groups))
3496 (if (not gnus-killed-list
)
3497 (gnus-message 6 "No killed groups")
3498 (let (gnus-group-list-mode)
3499 (funcall gnus-group-prepare-function
3500 gnus-level-killed t gnus-level-killed
))
3501 (goto-char (point-min)))
3502 (gnus-group-position-point))
3504 (defun gnus-group-list-zombies ()
3505 "List all zombie newsgroups in the group buffer."
3507 (if (not gnus-zombie-list
)
3508 (gnus-message 6 "No zombie groups")
3509 (let (gnus-group-list-mode)
3510 (funcall gnus-group-prepare-function
3511 gnus-level-zombie t gnus-level-zombie
))
3512 (goto-char (point-min)))
3513 (gnus-group-position-point))
3515 (defun gnus-group-list-active ()
3516 "List all groups that are available from the server(s)."
3518 ;; First we make sure that we have really read the active file.
3519 (unless (gnus-read-active-file-p)
3520 (let ((gnus-read-active-file t
)
3521 (gnus-agent gnus-plugged
)); If we're actually plugged, store the active file in the agent.
3522 (gnus-read-active-file)))
3523 ;; Find all groups and sort them.
3531 (push (symbol-name sym
) list
)))
3535 (buffer-read-only nil
)
3539 (setq group
(pop groups
))
3540 (gnus-add-text-properties
3541 (point) (prog1 (1+ (point))
3543 (gnus-group-decoded-name group
)
3545 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
3547 'gnus-level
(inline (gnus-group-level group
)))))
3548 (goto-char (point-min))))
3550 (defun gnus-activate-all-groups (level)
3551 "Activate absolutely all groups."
3552 (interactive (list gnus-level-unsubscribed
))
3553 (let ((gnus-activate-level level
)
3554 (gnus-activate-foreign-newsgroups level
))
3555 (gnus-group-get-new-news)))
3557 (defun gnus-group-get-new-news (&optional arg
)
3558 "Get newly arrived articles.
3559 If ARG is a number, it specifies which levels you are interested in
3560 re-scanning. If ARG is non-nil and not a number, this will force
3561 \"hard\" re-reading of the active files from all servers."
3564 (let ((gnus-inhibit-demon t
)
3565 ;; Binding this variable will inhibit multiple fetchings
3566 ;; of the same mail source.
3567 (nnmail-fetched-sources (list t
)))
3568 (gnus-run-hooks 'gnus-get-top-new-news-hook
)
3569 (gnus-run-hooks 'gnus-get-new-news-hook
)
3571 ;; Read any slave files.
3573 (gnus-master-read-slave-newsrc))
3575 ;; We might read in new NoCeM messages here.
3576 (when (and gnus-use-nocem
3578 (gnus-nocem-scan-groups))
3579 ;; If ARG is not a number, then we read the active file.
3580 (when (and arg
(not (numberp arg
)))
3581 (let ((gnus-read-active-file t
))
3582 (gnus-read-active-file))
3585 ;; If the user wants it, we scan for new groups.
3586 (when (eq gnus-check-new-newsgroups
'always
)
3587 (gnus-find-new-newsgroups)))
3589 (setq arg
(gnus-group-default-level arg t
))
3590 (if (and gnus-read-active-file
(not arg
))
3592 (gnus-read-active-file)
3593 (gnus-get-unread-articles arg
))
3594 (let ((gnus-read-active-file (if arg nil gnus-read-active-file
)))
3595 (gnus-get-unread-articles arg
)))
3596 (gnus-run-hooks 'gnus-after-getting-new-news-hook
)
3597 (gnus-group-list-groups (and (numberp arg
)
3598 (max (car gnus-group-list-mode
) arg
)))))
3600 (defun gnus-group-get-new-news-this-group (&optional n dont-scan
)
3601 "Check for newly arrived news in the current group (and the N-1 next groups).
3602 The difference between N and the number of newsgroup checked is returned.
3603 If N is negative, this group and the N-1 previous groups will be checked.
3604 If DONT-SCAN is non-nil, scan non-activated groups as well."
3606 (let* ((groups (gnus-group-process-prefix n
))
3607 (ret (if (numberp n
) (- n
(length groups
)) 0))
3611 (gnus-inhibit-demon t
)
3612 ;; Binding this variable will inhibit multiple fetchings
3613 ;; of the same mail source.
3614 (nnmail-fetched-sources (list t
)))
3615 (gnus-run-hooks 'gnus-get-new-news-hook
)
3616 (while (setq group
(pop groups
))
3617 (gnus-group-remove-mark group
)
3618 ;; Bypass any previous denials from the server.
3619 (gnus-remove-denial (setq method
(gnus-find-method-for-group group
)))
3620 (if (gnus-activate-group group
(if dont-scan nil
'scan
))
3622 (gnus-get-unread-articles-in-group
3623 (gnus-get-info group
) (gnus-active group
) t
)
3624 (unless (gnus-virtual-group-p group
)
3625 (gnus-close-group group
))
3627 (gnus-agent-save-group-info
3628 method
(gnus-group-real-name group
) (gnus-active group
)))
3629 (gnus-group-update-group group
))
3630 (if (eq (gnus-server-status (gnus-find-method-for-group group
))
3632 (gnus-error 3 "Server denied access")
3633 (gnus-error 3 "%s error: %s" group
(gnus-status-message group
)))))
3636 (when gnus-goto-next-group-when-activating
3637 (gnus-group-next-unread-group 1 t
))
3638 (gnus-summary-position-point)
3641 (defun gnus-group-fetch-faq (group &optional faq-dir
)
3642 "Fetch the FAQ for the current group.
3643 If given a prefix argument, prompt for the FAQ dir
3647 (gnus-group-group-name)
3648 (when current-prefix-arg
3650 "FAQ dir: " (and (listp gnus-group-faq-directory
)
3652 gnus-group-faq-directory
))))))
3654 (error "No group name given"))
3655 (let ((dirs (or faq-dir gnus-group-faq-directory
))
3657 (unless (listp dirs
)
3658 (setq dirs
(list dirs
)))
3659 (while (and (not found
)
3660 (setq dir
(pop dirs
)))
3661 (let ((name (gnus-group-real-name group
)))
3662 (setq file
(expand-file-name name dir
)))
3663 (if (not (file-exists-p file
))
3664 (gnus-message 1 "No such file: %s" file
)
3665 (let ((enable-local-variables nil
))
3669 (defun gnus-group-fetch-charter (group)
3670 "Fetch the charter for the current group.
3671 If given a prefix argument, prompt for a group."
3673 (list (or (when current-prefix-arg
3674 (completing-read "Group: " gnus-active-hashtb
))
3675 (gnus-group-group-name)
3676 gnus-newsgroup-name
)))
3678 (error "No group name given"))
3680 (condition-case nil
(require 'url-http
) (error nil
))
3681 (let ((name (mm-url-form-encode-xwfu (gnus-group-real-name group
)))
3683 (when (string-match "\\(^[^\\.]+\\)\\..*" name
)
3684 (setq hierarchy
(match-string 1 name
))
3685 (if (and (setq url
(cdr (assoc hierarchy gnus-group-charter-alist
)))
3686 (if (fboundp 'url-http-file-exists-p
)
3687 (url-http-file-exists-p (eval url
))
3689 (browse-url (eval url
))
3690 (setq url
(concat "http://" hierarchy
3691 ".news-admin.org/charters/" name
))
3692 (if (and (fboundp 'url-http-file-exists-p
)
3693 (url-http-file-exists-p url
))
3695 (gnus-group-fetch-control group
))))))
3697 (defun gnus-group-fetch-control (group)
3698 "Fetch the archived control messages for the current group.
3699 If given a prefix argument, prompt for a group."
3701 (list (or (when current-prefix-arg
3702 (completing-read "Group: " gnus-active-hashtb
))
3703 (gnus-group-group-name)
3704 gnus-newsgroup-name
)))
3706 (error "No group name given"))
3707 (let ((name (gnus-group-real-name group
))
3709 (when (string-match "\\(^[^\\.]+\\)\\..*" name
)
3710 (setq hierarchy
(match-string 1 name
))
3711 (if gnus-group-fetch-control-use-browse-url
3712 (browse-url (concat "ftp://ftp.isc.org/usenet/control/"
3713 hierarchy
"/" name
".gz"))
3714 (let ((enable-local-variables nil
))
3715 (gnus-group-read-ephemeral-group
3717 `(nndoc ,group
(nndoc-address
3718 ,(find-file-noselect
3719 (concat "/ftp@ftp.isc.org:/usenet/control/"
3720 hierarchy
"/" name
".gz")))
3721 (nndoc-article-type mbox
)) t nil nil
))))))
3723 (defun gnus-group-describe-group (force &optional group
)
3724 "Display a description of the current newsgroup."
3725 (interactive (list current-prefix-arg
(gnus-group-group-name)))
3726 (let* ((method (gnus-find-method-for-group group
))
3727 (mname (gnus-group-prefixed-name "" method
))
3730 gnus-description-hashtb
)
3731 (gnus-sethash mname nil gnus-description-hashtb
))
3733 (error "No group name given"))
3734 (when (or (and gnus-description-hashtb
3735 ;; We check whether this group's method has been
3736 ;; queried for a description file.
3737 (gnus-gethash mname gnus-description-hashtb
))
3738 (setq desc
(gnus-group-get-description group
))
3739 (gnus-read-descriptions-file method
))
3741 (or desc
(gnus-gethash group gnus-description-hashtb
)
3742 "No description available")))))
3744 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3745 (defun gnus-group-describe-all-groups (&optional force
)
3746 "Pop up a buffer with descriptions of all newsgroups."
3749 (setq gnus-description-hashtb nil
))
3750 (when (not (or gnus-description-hashtb
3751 (gnus-read-all-descriptions-files)))
3752 (error "Couldn't request descriptions file"))
3753 (let ((buffer-read-only nil
)
3759 (let ((charset (gnus-group-name-charset nil
(symbol-name group
))))
3760 (insert (format " *: %-20s %s\n"
3761 (gnus-group-name-decode
3762 (symbol-name group
) charset
)
3763 (gnus-group-name-decode
3764 (symbol-value group
) charset
))))
3765 (gnus-add-text-properties
3766 b
(1+ b
) (list 'gnus-group group
3767 'gnus-unread t
'gnus-marked nil
3768 'gnus-level
(1+ gnus-level-subscribed
))))
3769 gnus-description-hashtb
)
3770 (goto-char (point-min))
3771 (gnus-group-position-point)))
3773 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
3774 (defun gnus-group-apropos (regexp &optional search-description
)
3775 "List all newsgroups that have names that match a regexp."
3776 (interactive "sGnus apropos (regexp): ")
3778 (obuf (current-buffer))
3780 ;; Go through all newsgroups that are known to Gnus.
3783 (and (symbol-name group
)
3784 (string-match regexp
(symbol-name group
))
3785 (symbol-value group
)
3786 (push (symbol-name group
) groups
)))
3788 ;; Also go through all descriptions that are known to Gnus.
3789 (when search-description
3792 (and (string-match regexp
(symbol-value group
))
3793 (push (symbol-name group
) groups
)))
3794 gnus-description-hashtb
))
3796 (gnus-message 3 "No groups matched \"%s\"." regexp
)
3797 ;; Print out all the groups.
3799 (pop-to-buffer "*Gnus Help*")
3800 (buffer-disable-undo)
3802 (setq groups
(sort groups
'string
<))
3804 ;; Groups may be entered twice into the list of groups.
3805 (when (not (string= (car groups
) prev
))
3806 (setq prev
(car groups
))
3807 (let ((charset (gnus-group-name-charset nil prev
)))
3808 (insert (gnus-group-name-decode prev charset
) "\n")
3809 (when (and gnus-description-hashtb
3810 (setq des
(gnus-gethash (car groups
)
3811 gnus-description-hashtb
)))
3812 (insert " " (gnus-group-name-decode des charset
) "\n"))))
3813 (setq groups
(cdr groups
)))
3814 (goto-char (point-min))))
3815 (pop-to-buffer obuf
)))
3817 (defun gnus-group-description-apropos (regexp)
3818 "List all newsgroups that have names or descriptions that match REGEXP."
3819 (interactive "sGnus description apropos (regexp): ")
3820 (when (not (or gnus-description-hashtb
3821 (gnus-read-all-descriptions-files)))
3822 (error "Couldn't request descriptions file"))
3823 (gnus-group-apropos regexp t
))
3825 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3826 (defun gnus-group-list-matching (level regexp
&optional all lowest
)
3827 "List all groups with unread articles that match REGEXP.
3828 If the prefix LEVEL is non-nil, it should be a number that says which
3829 level to cut off listing groups.
3830 If ALL, also list groups with no unread articles.
3831 If LOWEST, don't list groups with level lower than LOWEST.
3833 This command may read the active file."
3834 (interactive "P\nsList newsgroups matching: ")
3835 ;; First make sure active file has been read.
3837 (> (prefix-numeric-value level
) gnus-level-killed
))
3838 (gnus-get-killed-groups))
3839 (funcall gnus-group-prepare-function
3840 (or level gnus-level-subscribed
) (and all t
) (or lowest
1) regexp
)
3841 (goto-char (point-min))
3842 (gnus-group-position-point))
3844 (defun gnus-group-list-all-matching (level regexp
&optional lowest
)
3845 "List all groups that match REGEXP.
3846 If the prefix LEVEL is non-nil, it should be a number that says which
3847 level to cut off listing groups.
3848 If LOWEST, don't list groups with level lower than LOWEST."
3849 (interactive "P\nsList newsgroups matching: ")
3851 (setq level
(prefix-numeric-value level
)))
3852 (gnus-group-list-matching (or level gnus-level-killed
) regexp t lowest
))
3854 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3855 (defun gnus-group-save-newsrc (&optional force
)
3856 "Save the Gnus startup files.
3857 If FORCE, force saving whether it is necessary or not."
3859 (gnus-save-newsrc-file force
))
3861 (defun gnus-group-restart (&optional arg
)
3862 "Force Gnus to read the .newsrc file."
3864 (when (gnus-yes-or-no-p
3865 (format "Are you sure you want to restart Gnus? "))
3866 (gnus-save-newsrc-file)
3870 (defun gnus-group-read-init-file ()
3871 "Read the Gnus elisp init file."
3873 (gnus-read-init-file)
3874 (gnus-message 5 "Read %s" gnus-init-file
))
3876 (defun gnus-group-check-bogus-groups (&optional silent
)
3877 "Check bogus newsgroups.
3878 If given a prefix, don't ask for confirmation before removing a bogus
3881 (gnus-check-bogus-newsgroups (and (not silent
) (not gnus-expert-user
)))
3882 (gnus-group-list-groups))
3884 (defun gnus-group-find-new-groups (&optional arg
)
3885 "Search for new groups and add them.
3886 Each new group will be treated with `gnus-subscribe-newsgroup-method'.
3887 With 1 C-u, use the `ask-server' method to query the server for new
3889 With 2 C-u's, use most complete method possible to query the server
3890 for new groups, and subscribe the new groups as zombies."
3892 (gnus-find-new-newsgroups (or arg
1))
3893 (gnus-group-list-groups))
3895 (defun gnus-group-edit-global-kill (&optional article group
)
3896 "Edit the global kill file.
3897 If GROUP, edit that local kill file instead."
3899 (setq gnus-current-kill-article article
)
3900 (gnus-kill-file-edit-file group
)
3903 (substitute-command-keys
3904 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3905 (if group
"local" "global")))))
3907 (defun gnus-group-edit-local-kill (article group
)
3908 "Edit a local kill file."
3909 (interactive (list nil
(gnus-group-group-name)))
3910 (gnus-group-edit-global-kill article group
))
3912 (defun gnus-group-force-update ()
3913 "Update `.newsrc' file."
3915 (gnus-save-newsrc-file))
3917 (defvar gnus-backlog-articles
)
3919 (defun gnus-group-suspend ()
3920 "Suspend the current Gnus session.
3921 In fact, cleanup buffers except for group mode buffer.
3922 The hook `gnus-suspend-gnus-hook' is called before actually suspending."
3924 (gnus-run-hooks 'gnus-suspend-gnus-hook
)
3925 (gnus-offer-save-summaries)
3926 ;; Kill Gnus buffers except for group mode buffer.
3927 (let ((group-buf (get-buffer gnus-group-buffer
)))
3928 (mapcar (lambda (buf)
3929 (unless (or (member buf
(list group-buf gnus-dribble-buffer
))
3933 (eq major-mode
'message-mode
))))
3934 (gnus-kill-buffer buf
)))
3936 (setq gnus-backlog-articles nil
)
3937 (gnus-kill-gnus-frames)
3939 (bury-buffer group-buf
)
3940 (delete-windows-on group-buf t
))))
3942 (defun gnus-group-clear-dribble ()
3943 "Clear all information from the dribble buffer."
3945 (gnus-dribble-clear)
3946 (gnus-message 7 "Cleared dribble buffer"))
3948 (defun gnus-group-exit ()
3949 "Quit reading news after updating .newsrc.eld and .newsrc.
3950 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3953 (or noninteractive
;For gnus-batch-kill
3954 (not gnus-interactive-exit
) ;Without confirmation
3956 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3957 (gnus-run-hooks 'gnus-exit-gnus-hook
)
3958 ;; Offer to save data from non-quitted summary buffers.
3959 (gnus-offer-save-summaries)
3960 ;; Save the newsrc file(s).
3961 (gnus-save-newsrc-file)
3963 (gnus-close-backends)
3964 ;; Reset everything.
3966 ;; Allow the user to do things after cleaning up.
3967 (gnus-run-hooks 'gnus-after-exiting-gnus-hook
)))
3969 (defun gnus-group-quit ()
3970 "Quit reading news without updating .newsrc.eld or .newsrc.
3971 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3973 (when (or noninteractive
;For gnus-batch-kill
3974 (zerop (buffer-size))
3975 (not (gnus-server-opened gnus-select-method
))
3977 (not gnus-current-startup-file
)
3979 (format "Quit reading news without saving %s? "
3980 (file-name-nondirectory gnus-current-startup-file
))))
3981 (gnus-run-hooks 'gnus-exit-gnus-hook
)
3982 (gnus-configure-windows 'group t
)
3983 (when (and (gnus-buffer-live-p gnus-dribble-buffer
)
3984 (not (zerop (save-excursion
3985 (set-buffer gnus-dribble-buffer
)
3988 ";;; Gnus was exited on purpose without saving the .newsrc files."))
3990 (gnus-close-backends)
3992 (gnus-kill-buffer gnus-group-buffer
)
3993 ;; Allow the user to do things after cleaning up.
3994 (gnus-run-hooks 'gnus-after-exiting-gnus-hook
)))
3996 (defun gnus-group-describe-briefly ()
3997 "Give a one line description of the group mode commands."
3999 (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")))
4001 (defun gnus-group-browse-foreign-server (method)
4002 "Browse a foreign news server.
4003 If called interactively, this function will ask for a select method
4004 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
4005 If not, METHOD should be a list where the first element is the method
4006 and the second element is the address."
4008 (list (let ((how (completing-read
4010 (append gnus-valid-select-methods gnus-server-alist
)
4011 nil t
(cons "nntp" 0) 'gnus-method-history
)))
4012 ;; We either got a back end name or a virtual server name.
4013 ;; If the first, we also need an address.
4014 (if (assoc how gnus-valid-select-methods
)
4016 ;; Suggested by mapjph@bath.ac.uk.
4019 (mapcar (lambda (server) (list server
))
4020 gnus-secondary-servers
)))
4021 ;; We got a server name.
4023 (gnus-browse-foreign-server method
))
4025 (defun gnus-group-set-info (info &optional method-only-group part
)
4026 (when (or info part
)
4027 (let* ((entry (gnus-gethash
4028 (or method-only-group
(gnus-info-group info
))
4029 gnus-newsrc-hashtb
))
4031 (info (if method-only-group
(nth 2 entry
) info
))
4033 (when method-only-group
4035 (error "Trying to change non-existent group %s" method-only-group
))
4036 ;; We have received parts of the actual group info - either the
4037 ;; select method or the group parameters. We first check
4038 ;; whether we have to extend the info, and if so, do that.
4039 (let ((len (length info
))
4040 (total (if (eq part
'method
) 5 6)))
4042 (setcdr (nthcdr (1- len
) info
)
4043 (make-list (- total len
) nil
)))
4044 ;; Then we enter the new info.
4045 (setcar (nthcdr (1- total
) info
) part-info
)))
4047 ;; This is a new group, so we just create it.
4049 (set-buffer gnus-group-buffer
)
4050 (setq method
(gnus-info-method info
))
4051 (when (gnus-server-equal method
"native")
4054 (set-buffer gnus-group-buffer
)
4056 ;; It's a foreign group...
4057 (gnus-group-make-group
4058 (gnus-group-real-name (gnus-info-group info
))
4059 (if (stringp method
) method
4060 (prin1-to-string (car method
)))
4062 (nth 1 (gnus-info-method info
))))
4063 ;; It's a native group.
4064 (gnus-group-make-group (gnus-info-group info
))))
4065 (gnus-message 6 "Note: New group created")
4067 (gnus-gethash (gnus-group-prefixed-name
4068 (gnus-group-real-name (gnus-info-group info
))
4069 (or (gnus-info-method info
) gnus-select-method
))
4070 gnus-newsrc-hashtb
))))
4071 ;; Whether it was a new group or not, we now have the entry, so we
4072 ;; can do the update.
4075 (setcar (nthcdr 2 entry
) info
)
4076 (when (and (not (eq (car entry
) t
))
4077 (gnus-active (gnus-info-group info
)))
4078 (setcar entry
(length
4079 (gnus-list-of-unread-articles (car info
))))))
4080 (error "No such group: %s" (gnus-info-group info
))))))
4082 (defun gnus-group-set-method-info (group select-method
)
4083 (gnus-group-set-info select-method group
'method
))
4085 (defun gnus-group-set-params-info (group params
)
4086 (gnus-group-set-info params group
'params
))
4088 (defun gnus-add-marked-articles (group type articles
&optional info force
)
4089 ;; Add ARTICLES of TYPE to the info of GROUP.
4090 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
4091 ;; add, but replace marked articles of TYPE with ARTICLES.
4092 (let ((info (or info
(gnus-get-info group
)))
4095 (and (not (setq marked
(nthcdr 3 info
)))
4097 (setcdr (nthcdr 2 info
)
4098 (list (list (cons type
(gnus-compress-sequence
4100 (and (not (setq m
(assq type
(car marked
))))
4103 (cons (cons type
(gnus-compress-sequence articles t
) )
4107 (setcar (nthcdr 3 info
)
4108 (gnus-delete-alist type
(car marked
)))
4109 (setcdr m
(gnus-compress-sequence articles t
)))
4110 (setcdr m
(gnus-compress-sequence
4111 (sort (nconc (gnus-uncompress-range (cdr m
))
4112 (copy-sequence articles
)) '<) t
))))))
4114 (defun gnus-add-mark (group mark article
)
4115 "Mark ARTICLE in GROUP with MARK, whether the group is displayed or not."
4116 (let ((buffer (gnus-summary-buffer-name group
)))
4117 (if (gnus-buffer-live-p buffer
)
4119 (set-buffer (get-buffer buffer
))
4120 (gnus-summary-add-mark article mark
))
4121 (gnus-add-marked-articles group
(cdr (assq mark gnus-article-mark-lists
))
4125 ;;; Group timestamps
4128 (defun gnus-group-set-timestamp ()
4129 "Change the timestamp of the current group to the current time.
4130 This function can be used in hooks like `gnus-select-group-hook'
4131 or `gnus-group-catchup-group-hook'."
4132 (when gnus-newsgroup-name
4133 (let ((time (current-time)))
4134 (setcdr (cdr time
) nil
)
4135 (gnus-group-set-parameter gnus-newsgroup-name
'timestamp time
))))
4137 (defsubst gnus-group-timestamp
(group)
4138 "Return the timestamp for GROUP."
4139 (gnus-group-get-parameter group
'timestamp t
))
4141 (defun gnus-group-timestamp-delta (group)
4142 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
4143 (let* ((time (or (gnus-group-timestamp group
)
4145 (delta (subtract-time (current-time) time
)))
4146 (+ (* (nth 0 delta
) 65536.0)
4149 (defun gnus-group-timestamp-string (group)
4150 "Return a string of the timestamp for GROUP."
4151 (let ((time (gnus-group-timestamp group
)))
4154 (gnus-time-iso8601 time
))))
4156 (defun gnus-group-list-cached (level &optional lowest
)
4157 "List all groups with cached articles.
4158 If the prefix LEVEL is non-nil, it should be a number that says which
4159 level to cut off listing groups.
4160 If LOWEST, don't list groups with level lower than LOWEST.
4162 This command may read the active file."
4165 (setq level
(prefix-numeric-value level
)))
4166 (when (or (not level
) (>= level gnus-level-zombie
))
4168 (funcall gnus-group-prepare-function
4169 (or level gnus-level-subscribed
)
4171 (let ((marks (gnus-info-marks info
)))
4172 (assq 'cache marks
)))
4175 (or (gnus-gethash group
4176 gnus-cache-active-hashtb
)
4177 ;; Cache active file might use "."
4180 (mapconcat 'identity
4181 (split-string group
":")
4183 gnus-cache-active-hashtb
))))
4184 (goto-char (point-min))
4185 (gnus-group-position-point))
4187 (defun gnus-group-list-dormant (level &optional lowest
)
4188 "List all groups with dormant articles.
4189 If the prefix LEVEL is non-nil, it should be a number that says which
4190 level to cut off listing groups.
4191 If LOWEST, don't list groups with level lower than LOWEST.
4193 This command may read the active file."
4196 (setq level
(prefix-numeric-value level
)))
4197 (when (or (not level
) (>= level gnus-level-zombie
))
4199 (funcall gnus-group-prepare-function
4200 (or level gnus-level-subscribed
)
4202 (let ((marks (gnus-info-marks info
)))
4203 (assq 'dormant marks
)))
4206 (goto-char (point-min))
4207 (gnus-group-position-point))
4209 (defun gnus-group-listed-groups ()
4210 "Return a list of listed groups."
4212 (goto-char (point-min))
4213 (while (setq point
(text-property-not-all (point) (point-max)
4216 (push (symbol-name (get-text-property point
'gnus-group
)) groups
)
4220 (defun gnus-group-list-plus (&optional args
)
4221 "List groups plus the current selection."
4223 (let ((gnus-group-listed-groups (gnus-group-listed-groups))
4224 (gnus-group-list-mode gnus-group-list-mode
) ;; Save it.
4226 (push last-command-event unread-command-events
)
4227 (if (featurep 'xemacs
)
4228 (push (make-event 'key-press
'(key ?A
)) unread-command-events
)
4229 (push ?A unread-command-events
))
4230 (let (gnus-pick-mode keys
)
4231 (setq keys
(if (featurep 'xemacs
)
4232 (events-to-keys (read-key-sequence nil
))
4233 (read-key-sequence nil
)))
4234 (setq func
(lookup-key (current-local-map) keys
)))
4238 (call-interactively func
))))
4240 (defun gnus-group-list-flush (&optional args
)
4241 "Flush groups from the current selection."
4243 (let ((gnus-group-list-option 'flush
))
4244 (gnus-group-list-plus args
)))
4246 (defun gnus-group-list-limit (&optional args
)
4247 "List groups limited within the current selection."
4249 (let ((gnus-group-list-option 'limit
))
4250 (gnus-group-list-plus args
)))
4252 (defun gnus-group-mark-article-read (group article
)
4253 "Mark ARTICLE read."
4254 (let ((buffer (gnus-summary-buffer-name group
))
4255 (mark gnus-read-mark
)
4257 (if (get-buffer buffer
)
4258 (with-current-buffer buffer
4259 (setq active gnus-newsgroup-active
)
4260 (gnus-activate-group group
)
4261 (when gnus-newsgroup-prepared
4262 (when (and gnus-newsgroup-auto-expire
4263 (memq mark gnus-auto-expirable-marks
))
4264 (setq mark gnus-expirable-mark
))
4265 (setq mark
(gnus-request-update-mark
4266 group article mark
))
4267 (gnus-mark-article-as-read article mark
)
4268 (setq gnus-newsgroup-active
(gnus-active group
))
4270 (setq n
(1+ (cdr active
)))
4271 (while (<= n
(cdr gnus-newsgroup-active
))
4272 (unless (eq n article
)
4273 (push n gnus-newsgroup-unselected
))
4275 (setq gnus-newsgroup-unselected
4276 (nreverse gnus-newsgroup-unselected
)))))
4277 (gnus-activate-group group
)
4278 (gnus-group-make-articles-read group
(list article
))
4279 (when (gnus-group-auto-expirable-p group
)
4280 (gnus-add-marked-articles
4281 group
'expire
(list article
))))))
4283 (provide 'gnus-group
)
4285 ;;; arch-tag: 2eb5440f-0bca-4091-814c-e37817536af6
4286 ;;; gnus-group.el ends here