1 ;;; gnus-group.el --- group mode commands for Gnus
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
37 (defcustom gnus-group-archive-directory
38 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/"
39 "*The address of the (ding) archives."
40 :group
'gnus-group-foreign
43 (defcustom gnus-group-recent-archive-directory
44 "/ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/"
45 "*The address of the most recent (ding) articles."
46 :group
'gnus-group-foreign
49 (defcustom gnus-no-groups-message
"No news is no news"
50 "*Message displayed by Gnus when no groups are available."
54 (defcustom gnus-keep-same-level nil
55 "*Non-nil means that the next newsgroup after the current will be on the same level.
56 When you type, for instance, `n' after reading the last article in the
57 current newsgroup, you will go to the next newsgroup. If this variable
58 is nil, the next newsgroup will be the next from the group
60 If this variable is non-nil, Gnus will either put you in the
61 next newsgroup with the same level, or, if no such newsgroup is
62 available, the next newsgroup with the lowest possible level higher
63 than the current level.
64 If this variable is `best', Gnus will make the next newsgroup the one
66 :group
'gnus-group-levels
67 :type
'(choice (const nil
)
69 (sexp :tag
"other" t
)))
71 (defcustom gnus-group-goto-unread t
72 "*If non-nil, movement commands will go to the next unread and subscribed group."
73 :link
'(custom-manual "(gnus)Group Maneuvering")
74 :group
'gnus-group-various
77 (defcustom gnus-goto-next-group-when-activating t
78 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group."
79 :link
'(custom-manual "(gnus)Scanning New Messages")
80 :group
'gnus-group-various
83 (defcustom gnus-permanently-visible-groups nil
84 "*Regexp to match groups that should always be listed in the group buffer.
85 This means that they will still be listed when there are no unread
86 articles in the groups."
87 :group
'gnus-group-listing
90 (defcustom gnus-list-groups-with-ticked-articles t
91 "*If non-nil, list groups that have only ticked articles.
92 If nil, only list groups that have unread articles."
93 :group
'gnus-group-listing
96 (defcustom gnus-group-default-list-level gnus-level-subscribed
97 "*Default listing level.
98 Ignored if `gnus-group-use-permanent-levels' is non-nil."
99 :group
'gnus-group-listing
102 (defcustom gnus-group-list-inactive-groups t
103 "*If non-nil, inactive groups will be listed."
104 :group
'gnus-group-listing
105 :group
'gnus-group-levels
108 (defcustom gnus-group-sort-function
'gnus-group-sort-by-alphabet
109 "*Function used for sorting the group buffer.
110 This function will be called with group info entries as the arguments
111 for the groups to be sorted. Pre-made functions include
112 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name',
113 `gnus-group-sort-by-unread', `gnus-group-sort-by-level',
114 `gnus-group-sort-by-score', `gnus-group-sort-by-method', and
115 `gnus-group-sort-by-rank'.
117 This variable can also be a list of sorting functions. In that case,
118 the most significant sort function should be the last function in the
120 :group
'gnus-group-listing
121 :link
'(custom-manual "(gnus)Sorting Groups")
122 :type
'(radio (function-item gnus-group-sort-by-alphabet
)
123 (function-item gnus-group-sort-by-real-name
)
124 (function-item gnus-group-sort-by-unread
)
125 (function-item gnus-group-sort-by-level
)
126 (function-item gnus-group-sort-by-score
)
127 (function-item gnus-group-sort-by-method
)
128 (function-item gnus-group-sort-by-rank
)
129 (function :tag
"other" nil
)))
131 (defcustom gnus-group-line-format
"%M\%S\%p\%P\%5y: %(%g%)%l\n"
132 "*Format of group lines.
133 It works along the same lines as a normal formatting string,
134 with some simple extensions.
136 %M Only marked articles (character, \"*\" or \" \")
137 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \")
138 %L Level of subscribedness (integer)
139 %N Number of unread articles (integer)
140 %I Number of dormant articles (integer)
141 %i Number of ticked and dormant (integer)
142 %T Number of ticked articles (integer)
143 %R Number of read articles (integer)
144 %t Estimated total number of articles (integer)
145 %y Number of unread, unticked articles (integer)
146 %G Group name (string)
147 %g Qualified group name (string)
148 %D Group description (string)
149 %s Select method (string)
150 %o Moderated group (char, \"m\")
151 %p Process mark (char)
152 %O Moderated group (string, \"(m)\" or \"\")
153 %P Topic indentation (string)
154 %m Whether there is new(ish) mail in the group (char, \"%\")
155 %l Whether there are GroupLens predictions for this group (string)
156 %n Select from where (string)
157 %z A string that look like `<%s:%n>' if a foreign select method is used
158 %d The date the group was last entered.
159 %u User defined specifier. The next character in the format string should
160 be a letter. Gnus will call the function gnus-user-format-function-X,
161 where X is the letter following %u. The function will be passed the
162 current header as argument. The function should return a string, which
163 will be inserted into the buffer just like information from any other
166 Text between %( and %) will be highlighted with `gnus-mouse-face' when
167 the mouse point move inside the area. There can only be one such area.
169 Note that this format specification is not always respected. For
170 reasons of efficiency, when listing killed groups, this specification
171 is ignored altogether. If the spec is changed considerably, your
172 output may end up looking strange when listing both alive and killed
175 If you use %o or %O, reading the active file will be slower and quite
176 a bit of extra memory will be used. %D will also worsen performance.
177 Also note that if you change the format specification to include any
178 of these specs, you must probably re-start Gnus to see them go into
180 :group
'gnus-group-visual
183 (defcustom gnus-group-mode-line-format
"Gnus: %%b {%M\%:%S}"
184 "*The format specification for the group mode line.
185 It works along the same lines as a normal formatting string,
186 with some simple extensions:
188 %S The native news server.
189 %M The native select method.
190 %: \":\" if %S isn't \"\"."
191 :group
'gnus-group-visual
194 (defcustom gnus-group-mode-hook nil
195 "Hook for Gnus group mode."
196 :group
'gnus-group-various
197 :options
'(gnus-topic-mode)
200 (defcustom gnus-group-menu-hook nil
201 "Hook run after the creation of the group mode menu."
202 :group
'gnus-group-various
205 (defcustom gnus-group-catchup-group-hook nil
206 "Hook run when catching up a group from the group buffer."
207 :group
'gnus-group-various
208 :link
'(custom-manual "(gnus)Group Data")
211 (defcustom gnus-group-update-group-hook nil
212 "Hook called when updating group lines."
213 :group
'gnus-group-visual
216 (defcustom gnus-group-prepare-function
'gnus-group-prepare-flat
217 "*A function that is called to generate the group buffer.
218 The function is called with three arguments: The first is a number;
219 all group with a level less or equal to that number should be listed,
220 if the second is non-nil, empty groups should also be displayed. If
221 the third is non-nil, it is a number. No groups with a level lower
222 than this number should be displayed.
224 The only current function implemented is `gnus-group-prepare-flat'."
225 :group
'gnus-group-listing
228 (defcustom gnus-group-prepare-hook nil
229 "Hook called after the group buffer has been generated.
230 If you want to modify the group buffer, you can use this hook."
231 :group
'gnus-group-listing
234 (defcustom gnus-suspend-gnus-hook nil
235 "Hook called when suspending (not exiting) Gnus."
239 (defcustom gnus-exit-gnus-hook nil
240 "Hook called when exiting Gnus."
244 (defcustom gnus-after-exiting-gnus-hook nil
245 "Hook called after exiting Gnus."
249 (defcustom gnus-group-update-hook
'(gnus-group-highlight-line)
250 "Hook called when a group line is changed.
251 The hook will not be called if `gnus-visual' is nil.
253 The default function `gnus-group-highlight-line' will
254 highlight the line according to the `gnus-group-highlight'
256 :group
'gnus-group-visual
259 (defcustom gnus-useful-groups
260 `(("(ding) mailing list mirrored at sunsite.auc.dk"
262 (nntp "sunsite.auc.dk"
263 (nntp-address "sunsite.auc.dk")))
267 (nndoc-article-type mbox
)
268 (eval `(nndoc-address
269 ,(let ((file (nnheader-find-etc-directory
272 (error "Couldn't find doc group"))
274 "Alist of useful group-server pairs."
275 :group
'gnus-group-listing
276 :type
'(repeat (list (string :tag
"Description")
278 (sexp :tag
"Method"))))
280 (defcustom gnus-group-highlight
282 ((and (= unread
0) (not mailp
) (eq level
1)) .
283 gnus-group-news-1-empty-face
)
284 ((and (not mailp
) (eq level
1)) .
285 gnus-group-news-1-face
)
286 ((and (= unread
0) (not mailp
) (eq level
2)) .
287 gnus-group-news-2-empty-face
)
288 ((and (not mailp
) (eq level
2)) .
289 gnus-group-news-2-face
)
290 ((and (= unread
0) (not mailp
) (eq level
3)) .
291 gnus-group-news-3-empty-face
)
292 ((and (not mailp
) (eq level
3)) .
293 gnus-group-news-3-face
)
294 ((and (= unread
0) (not mailp
)) .
295 gnus-group-news-low-empty-face
)
297 gnus-group-news-low-face
)
299 ((and (= unread
0) (eq level
1)) .
300 gnus-group-mail-1-empty-face
)
302 gnus-group-mail-1-face
)
303 ((and (= unread
0) (eq level
2)) .
304 gnus-group-mail-2-empty-face
)
306 gnus-group-mail-2-face
)
307 ((and (= unread
0) (eq level
3)) .
308 gnus-group-mail-3-empty-face
)
310 gnus-group-mail-3-face
)
312 gnus-group-mail-low-empty-face
)
314 gnus-group-mail-low-face
))
315 "Controls the highlighting of group buffer lines.
317 Below is a list of `Form'/`Face' pairs. When deciding how a a
318 particular group line should be displayed, each form is
319 evaluated. The content of the face field after the first true form is
320 used. You can change how those group lines are displayed by
321 editing the face field.
323 It is also possible to change and add form fields, but currently that
324 requires an understanding of Lisp expressions. Hopefully this will
325 change in a future release. For now, you can use the following
326 variables in the Lisp expression:
328 group: The name of the group.
329 unread: The number of unread articles in the group.
330 method: The select method used.
331 mailp: Whether it's a mail group or not.
332 level: The level of the group.
333 score: The score of the group.
334 ticked: The number of ticked articles."
335 :group
'gnus-group-visual
336 :type
'(repeat (cons (sexp :tag
"Form") face
)))
338 (defcustom gnus-new-mail-mark ?%
339 "Mark used for groups with new mail."
340 :group
'gnus-group-visual
343 ;;; Internal variables
345 (defvar gnus-group-sort-alist-function
'gnus-group-sort-flat
346 "Function for sorting the group buffer.")
348 (defvar gnus-group-sort-selected-function
'gnus-group-sort-selected-flat
349 "Function for sorting the selected groups in the group buffer.")
351 (defvar gnus-group-indentation-function nil
)
352 (defvar gnus-goto-missing-group-function nil
)
353 (defvar gnus-group-update-group-function nil
)
354 (defvar gnus-group-goto-next-group-function nil
355 "Function to override finding the next group after listing groups.")
357 (defvar gnus-group-edit-buffer nil
)
359 (defvar gnus-group-line-format-alist
360 `((?M gnus-tmp-marked-mark ?c
)
361 (?S gnus-tmp-subscribed ?c
)
362 (?L gnus-tmp-level ?d
)
363 (?N
(cond ((eq number t
) "*" )
367 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
)))
368 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked
))))))
370 (?R gnus-tmp-number-of-read ?s
)
371 (?t gnus-tmp-number-total ?d
)
372 (?y gnus-tmp-number-of-unread ?s
)
373 (?I
(gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
))) ?d
)
374 (?T
(gnus-range-length (cdr (assq 'tick gnus-tmp-marked
))) ?d
)
375 (?i
(+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked
)))
376 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked
)))) ?d
)
377 (?g gnus-tmp-group ?s
)
378 (?G gnus-tmp-qualified-group ?s
)
379 (?c
(gnus-short-group-name gnus-tmp-group
) ?s
)
380 (?D gnus-tmp-newsgroup-description ?s
)
381 (?o gnus-tmp-moderated ?c
)
382 (?O gnus-tmp-moderated-string ?s
)
383 (?p gnus-tmp-process-marked ?c
)
384 (?s gnus-tmp-news-server ?s
)
385 (?n gnus-tmp-news-method ?s
)
386 (?P gnus-group-indentation ?s
)
387 (?l gnus-tmp-grouplens ?s
)
388 (?z gnus-tmp-news-method-string ?s
)
389 (?m
(gnus-group-new-mail gnus-tmp-group
) ?c
)
390 (?d
(gnus-group-timestamp-string gnus-tmp-group
) ?s
)
391 (?u gnus-tmp-user-defined ?s
)))
393 (defvar gnus-group-mode-line-format-alist
394 `((?S gnus-tmp-news-server ?s
)
395 (?M gnus-tmp-news-method ?s
)
396 (?u gnus-tmp-user-defined ?s
)
397 (?
: gnus-tmp-colon ?s
)))
399 (defvar gnus-topic-topology nil
400 "The complete topic hierarchy.")
402 (defvar gnus-topic-alist nil
403 "The complete topic-group alist.")
405 (defvar gnus-group-marked nil
)
407 (defvar gnus-group-list-mode nil
)
413 (put 'gnus-group-mode
'mode-class
'special
)
416 (gnus-define-keys gnus-group-mode-map
417 " " gnus-group-read-group
418 "=" gnus-group-select-group
419 "\r" gnus-group-select-group
420 "\M-\r" gnus-group-quick-select-group
421 [(meta control return
)] gnus-group-select-group-ephemerally
422 "j" gnus-group-jump-to-group
423 "n" gnus-group-next-unread-group
424 "p" gnus-group-prev-unread-group
425 "\177" gnus-group-prev-unread-group
426 [delete] gnus-group-prev-unread-group
427 "N" gnus-group-next-group
428 "P" gnus-group-prev-group
429 "\M-n" gnus-group-next-unread-group-same-level
430 "\M-p" gnus-group-prev-unread-group-same-level
431 "," gnus-group-best-unread-group
432 "." gnus-group-first-unread-group
433 "u" gnus-group-unsubscribe-current-group
434 "U" gnus-group-unsubscribe-group
435 "c" gnus-group-catchup-current
436 "C" gnus-group-catchup-current-all
437 "\M-c" gnus-group-clear-data
438 "l" gnus-group-list-groups
439 "L" gnus-group-list-all-groups
441 "g" gnus-group-get-new-news
442 "\M-g" gnus-group-get-new-news-this-group
443 "R" gnus-group-restart
444 "r" gnus-group-read-init-file
445 "B" gnus-group-browse-foreign-server
446 "b" gnus-group-check-bogus-groups
447 "F" gnus-find-new-newsgroups
448 "\C-c\C-d" gnus-group-describe-group
449 "\M-d" gnus-group-describe-all-groups
450 "\C-c\C-a" gnus-group-apropos
451 "\C-c\M-\C-a" gnus-group-description-apropos
452 "a" gnus-group-post-news
453 "\ek" gnus-group-edit-local-kill
454 "\eK" gnus-group-edit-global-kill
455 "\C-k" gnus-group-kill-group
456 "\C-y" gnus-group-yank-group
457 "\C-w" gnus-group-kill-region
458 "\C-x\C-t" gnus-group-transpose-groups
459 "\C-c\C-l" gnus-group-list-killed
460 "\C-c\C-x" gnus-group-expire-articles
461 "\C-c\M-\C-x" gnus-group-expire-all-groups
463 "s" gnus-group-save-newsrc
464 "z" gnus-group-suspend
467 "?" gnus-group-describe-briefly
468 "\C-c\C-i" gnus-info-find-node
469 "\M-e" gnus-group-edit-group-method
470 "^" gnus-group-enter-server-mode
471 gnus-mouse-2 gnus-mouse-pick-group
472 "<" beginning-of-buffer
475 "\C-c\C-s" gnus-group-sort-groups
477 "\C-c\M-g" gnus-activate-all-groups
478 "\M-&" gnus-group-universal-argument
479 "#" gnus-group-mark-group
480 "\M-#" gnus-group-unmark-group)
482 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map)
483 "m" gnus-group-mark-group
484 "u" gnus-group-unmark-group
485 "w" gnus-group-mark-region
486 "m" gnus-group-mark-buffer
487 "r" gnus-group-mark-regexp
488 "U" gnus-group-unmark-all-groups)
490 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map)
491 "d" gnus-group-make-directory-group
492 "h" gnus-group-make-help-group
493 "u" gnus-group-make-useful-group
494 "a" gnus-group-make-archive-group
495 "k" gnus-group-make-kiboze-group
496 "m" gnus-group-make-group
497 "E" gnus-group-edit-group
498 "e" gnus-group-edit-group-method
499 "p" gnus-group-edit-group-parameters
500 "v" gnus-group-add-to-virtual
501 "V" gnus-group-make-empty-virtual
502 "D" gnus-group-enter-directory
503 "f" gnus-group-make-doc-group
504 "w" gnus-group-make-web-group
505 "r" gnus-group-rename-group
506 "c" gnus-group-customize
507 "\177" gnus-group-delete-group
508 [delete] gnus-group-delete-group
)
510 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map
)
511 "b" gnus-group-brew-soup
512 "w" gnus-soup-save-areas
513 "s" gnus-soup-send-replies
514 "p" gnus-soup-pack-packet
515 "r" nnsoup-pack-replies
)
517 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map
)
518 "s" gnus-group-sort-groups
519 "a" gnus-group-sort-groups-by-alphabet
520 "u" gnus-group-sort-groups-by-unread
521 "l" gnus-group-sort-groups-by-level
522 "v" gnus-group-sort-groups-by-score
523 "r" gnus-group-sort-groups-by-rank
524 "m" gnus-group-sort-groups-by-method
)
526 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map
)
527 "s" gnus-group-sort-selected-groups
528 "a" gnus-group-sort-selected-groups-by-alphabet
529 "u" gnus-group-sort-selected-groups-by-unread
530 "l" gnus-group-sort-selected-groups-by-level
531 "v" gnus-group-sort-selected-groups-by-score
532 "r" gnus-group-sort-selected-groups-by-rank
533 "m" gnus-group-sort-selected-groups-by-method
)
535 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map
)
536 "k" gnus-group-list-killed
537 "z" gnus-group-list-zombies
538 "s" gnus-group-list-groups
539 "u" gnus-group-list-all-groups
540 "A" gnus-group-list-active
541 "a" gnus-group-apropos
542 "d" gnus-group-description-apropos
543 "m" gnus-group-list-matching
544 "M" gnus-group-list-all-matching
545 "l" gnus-group-list-level
)
547 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map
)
548 "f" gnus-score-flush-cache
)
550 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map
)
551 "d" gnus-group-describe-group
552 "f" gnus-group-fetch-faq
555 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map
)
556 "l" gnus-group-set-current-level
557 "t" gnus-group-unsubscribe-current-group
558 "s" gnus-group-unsubscribe-group
559 "k" gnus-group-kill-group
560 "y" gnus-group-yank-group
561 "w" gnus-group-kill-region
562 "\C-k" gnus-group-kill-level
563 "z" gnus-group-kill-all-zombies
))
565 (defun gnus-group-make-menu-bar ()
566 (gnus-turn-off-edit-menu 'group
)
567 (unless (boundp 'gnus-group-reading-menu
)
570 gnus-group-reading-menu gnus-group-mode-map
""
572 ["Read" gnus-group-read-group
(gnus-group-group-name)]
573 ["Select" gnus-group-select-group
(gnus-group-group-name)]
574 ["See old articles" (gnus-group-select-group 'all
)
575 :keys
"C-u SPC" :active
(gnus-group-group-name)]
576 ["Catch up" gnus-group-catchup-current
(gnus-group-group-name)]
577 ["Catch up all articles" gnus-group-catchup-current-all
578 (gnus-group-group-name)]
579 ["Check for new articles" gnus-group-get-new-news-this-group
580 (gnus-group-group-name)]
581 ["Toggle subscription" gnus-group-unsubscribe-current-group
582 (gnus-group-group-name)]
583 ["Kill" gnus-group-kill-group
(gnus-group-group-name)]
584 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups
]
585 ["Describe" gnus-group-describe-group
(gnus-group-group-name)]
586 ["Fetch FAQ" gnus-group-fetch-faq
(gnus-group-group-name)]
587 ;; Actually one should check, if any of the marked groups gives t for
588 ;; (gnus-check-backend-function 'request-expire-articles ...)
589 ["Expire articles" gnus-group-expire-articles
590 (or (and (gnus-group-group-name)
591 (gnus-check-backend-function
592 'request-expire-articles
593 (gnus-group-group-name))) gnus-group-marked
)]
594 ["Set group level" gnus-group-set-current-level
595 (gnus-group-group-name)]
596 ["Select quick" gnus-group-quick-select-group
(gnus-group-group-name)]
597 ["Customize" gnus-group-customize
(gnus-group-group-name)]
599 ["Parameters" gnus-group-edit-group-parameters
600 (gnus-group-group-name)]
601 ["Select method" gnus-group-edit-group-method
602 (gnus-group-group-name)]
603 ["Info" gnus-group-edit-group
(gnus-group-group-name)]
604 ["Local kill file" gnus-group-edit-local-kill
(gnus-group-group-name)]
605 ["Global kill file" gnus-group-edit-global-kill t
])
609 gnus-group-group-menu gnus-group-mode-map
""
612 ["List unread subscribed groups" gnus-group-list-groups t
]
613 ["List (un)subscribed groups" gnus-group-list-all-groups t
]
614 ["List killed groups" gnus-group-list-killed gnus-killed-list
]
615 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list
]
616 ["List level..." gnus-group-list-level t
]
617 ["Describe all groups" gnus-group-describe-all-groups t
]
618 ["Group apropos..." gnus-group-apropos t
]
619 ["Group and description apropos..." gnus-group-description-apropos t
]
620 ["List groups matching..." gnus-group-list-matching t
]
621 ["List all groups matching..." gnus-group-list-all-matching t
]
622 ["List active file" gnus-group-list-active t
])
624 ["Default sort" gnus-group-sort-groups t
]
625 ["Sort by method" gnus-group-sort-groups-by-method t
]
626 ["Sort by rank" gnus-group-sort-groups-by-rank t
]
627 ["Sort by score" gnus-group-sort-groups-by-score t
]
628 ["Sort by level" gnus-group-sort-groups-by-level t
]
629 ["Sort by unread" gnus-group-sort-groups-by-unread t
]
630 ["Sort by name" gnus-group-sort-groups-by-alphabet t
])
631 ("Sort process/prefixed"
632 ["Default sort" gnus-group-sort-selected-groups
633 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
634 ["Sort by method" gnus-group-sort-selected-groups-by-method
635 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
636 ["Sort by rank" gnus-group-sort-selected-groups-by-rank
637 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
638 ["Sort by score" gnus-group-sort-selected-groups-by-score
639 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
640 ["Sort by level" gnus-group-sort-selected-groups-by-level
641 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
642 ["Sort by unread" gnus-group-sort-selected-groups-by-unread
643 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))]
644 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet
645 (or (not (boundp 'gnus-topic-mode
)) (not gnus-topic-mode
))])
647 ["Mark group" gnus-group-mark-group
648 (and (gnus-group-group-name)
649 (not (memq (gnus-group-group-name) gnus-group-marked
)))]
650 ["Unmark group" gnus-group-unmark-group
651 (and (gnus-group-group-name)
652 (memq (gnus-group-group-name) gnus-group-marked
))]
653 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked
]
654 ["Mark regexp..." gnus-group-mark-regexp t
]
655 ["Mark region" gnus-group-mark-region t
]
656 ["Mark buffer" gnus-group-mark-buffer t
]
657 ["Execute command" gnus-group-universal-argument
658 (or gnus-group-marked
(gnus-group-group-name))])
660 ["Subscribe to a group" gnus-group-unsubscribe-group t
]
661 ["Kill all newsgroups in region" gnus-group-kill-region t
]
662 ["Kill all zombie groups" gnus-group-kill-all-zombies
664 ["Kill all groups on level..." gnus-group-kill-level t
])
666 ["Make a foreign group" gnus-group-make-group t
]
667 ["Add a directory group" gnus-group-make-directory-group t
]
668 ["Add the help group" gnus-group-make-help-group t
]
669 ["Add the archive group" gnus-group-make-archive-group t
]
670 ["Make a doc group" gnus-group-make-doc-group t
]
671 ["Make a web group" gnus-group-make-web-group t
]
672 ["Make a kiboze group" gnus-group-make-kiboze-group t
]
673 ["Make a virtual group" gnus-group-make-empty-virtual t
]
674 ["Add a group to a virtual" gnus-group-add-to-virtual t
]
675 ["Rename group" gnus-group-rename-group
676 (gnus-check-backend-function
677 'request-rename-group
(gnus-group-group-name))]
678 ["Delete group" gnus-group-delete-group
679 (gnus-check-backend-function
680 'request-delete-group
(gnus-group-group-name))])
682 ["Next" gnus-group-next-group t
]
683 ["Previous" gnus-group-prev-group t
]
684 ["Next unread" gnus-group-next-unread-group t
]
685 ["Previous unread" gnus-group-prev-unread-group t
]
686 ["Next unread same level" gnus-group-next-unread-group-same-level t
]
687 ["Previous unread same level"
688 gnus-group-prev-unread-group-same-level t
]
689 ["Jump to group" gnus-group-jump-to-group t
]
690 ["First unread group" gnus-group-first-unread-group t
]
691 ["Best unread group" gnus-group-best-unread-group t
])
692 ["Delete bogus groups" gnus-group-check-bogus-groups t
]
693 ["Find new newsgroups" gnus-find-new-newsgroups t
]
694 ["Transpose" gnus-group-transpose-groups
695 (gnus-group-group-name)]
696 ["Read a directory as a group..." gnus-group-enter-directory t
]
700 gnus-group-misc-menu gnus-group-mode-map
""
703 ["Pack replies" nnsoup-pack-replies
(fboundp 'nnsoup-request-group
)]
704 ["Send replies" gnus-soup-send-replies
705 (fboundp 'gnus-soup-pack-packet
)]
706 ["Pack packet" gnus-soup-pack-packet
(fboundp 'gnus-soup-pack-packet
)]
707 ["Save areas" gnus-soup-save-areas
(fboundp 'gnus-soup-pack-packet
)]
708 ["Brew SOUP" gnus-soup-brew-soup
(fboundp 'gnus-soup-pack-packet
)])
709 ["Send a bug report" gnus-bug t
]
710 ["Send a mail" gnus-group-mail t
]
711 ["Post an article..." gnus-group-post-news t
]
712 ["Check for new news" gnus-group-get-new-news t
]
713 ["Activate all groups" gnus-activate-all-groups t
]
714 ["Restart Gnus" gnus-group-restart t
]
715 ["Read init file" gnus-group-read-init-file t
]
716 ["Browse foreign server" gnus-group-browse-foreign-server t
]
717 ["Enter server buffer" gnus-group-enter-server-mode t
]
718 ["Expire all expirable articles" gnus-group-expire-all-groups t
]
719 ["Generate any kiboze groups" nnkiboze-generate-groups t
]
720 ["Gnus version" gnus-version t
]
721 ["Save .newsrc files" gnus-group-save-newsrc t
]
722 ["Suspend Gnus" gnus-group-suspend t
]
723 ["Clear dribble buffer" gnus-group-clear-dribble t
]
724 ["Read manual" gnus-info-find-node t
]
725 ["Flush score cache" gnus-score-flush-cache t
]
726 ["Toggle topics" gnus-topic-mode t
]
727 ["Exit from Gnus" gnus-group-exit t
]
728 ["Exit without saving" gnus-group-quit t
]
731 (run-hooks 'gnus-group-menu-hook
)))
733 (defun gnus-group-mode ()
734 "Major mode for reading news.
736 All normal editing commands are switched off.
737 \\<gnus-group-mode-map>
738 The group buffer lists (some of) the groups available. For instance,
739 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]'
740 lists all zombie groups.
742 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe
743 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'.
745 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]').
747 The following commands are available:
749 \\{gnus-group-mode-map}"
751 (when (gnus-visual-p 'group-menu
'menu
)
752 (gnus-group-make-menu-bar))
753 (kill-all-local-variables)
754 (gnus-simplify-mode-line)
755 (setq major-mode
'gnus-group-mode
)
756 (setq mode-name
"Group")
757 (gnus-group-set-mode-line)
758 (setq mode-line-process nil
)
759 (use-local-map gnus-group-mode-map
)
760 (buffer-disable-undo (current-buffer))
761 (setq truncate-lines t
)
762 (setq buffer-read-only t
)
763 (gnus-set-default-directory)
764 (gnus-update-format-specifications nil
'group
'group-mode
)
765 (gnus-update-group-mark-positions)
766 (make-local-hook 'post-command-hook
)
767 (add-hook 'post-command-hook
'gnus-clear-inboxes-moved nil t
)
770 (run-hooks 'gnus-group-mode-hook
))
772 (defun gnus-update-group-mark-positions ()
774 (let ((gnus-process-mark 128)
775 (gnus-group-marked '("dummy.group"))
776 (gnus-active-hashtb (make-vector 10 0)))
777 (gnus-set-active "dummy.group" '(0 .
0))
778 (gnus-set-work-buffer)
779 (gnus-group-insert-group-line "dummy.group" 0 nil
0 nil
)
780 (goto-char (point-min))
781 (setq gnus-group-mark-positions
782 (list (cons 'process
(and (search-forward "\200" nil t
)
785 (defun gnus-clear-inboxes-moved ()
786 (setq nnmail-moved-inboxes nil
))
788 (defun gnus-mouse-pick-group (e)
789 "Enter the group under the mouse pointer."
792 (gnus-group-read-group nil
))
794 ;; Look at LEVEL and find out what the level is really supposed to be.
795 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens
796 ;; will depend on whether `gnus-group-use-permanent-levels' is used.
797 (defun gnus-group-default-level (&optional level number-or-nil
)
799 (gnus-group-use-permanent-levels
800 (or (setq gnus-group-use-permanent-levels
801 (or level
(if (numberp gnus-group-use-permanent-levels
)
802 gnus-group-use-permanent-levels
803 (or gnus-group-default-list-level
804 gnus-level-subscribed
))))
805 gnus-group-default-list-level gnus-level-subscribed
))
809 (or level gnus-group-default-list-level gnus-level-subscribed
))))
811 (defun gnus-group-setup-buffer ()
812 (switch-to-buffer gnus-group-buffer
)
813 (unless (eq major-mode
'gnus-group-mode
)
814 (gnus-add-current-to-buffer-list)
817 (gnus-carpal-setup-buffer 'group
))))
819 (defun gnus-group-list-groups (&optional level unread lowest
)
820 "List newsgroups with level LEVEL or lower that have unread articles.
821 Default is all subscribed groups.
822 If argument UNREAD is non-nil, groups with no unread articles are also
825 Also see the `gnus-group-use-permanent-levels' variable."
827 (list (if current-prefix-arg
828 (prefix-numeric-value current-prefix-arg
)
830 (gnus-group-default-level nil t
)
831 gnus-group-default-list-level
832 gnus-level-subscribed
))))
833 ;; Just do this here, for no particular good reason.
834 (gnus-clear-inboxes-moved)
836 (setq level
(car gnus-group-list-mode
)
837 unread
(cdr gnus-group-list-mode
)))
838 (setq level
(gnus-group-default-level level
))
839 (gnus-group-setup-buffer)
840 (gnus-update-format-specifications nil
'group
'group-mode
)
841 (let ((case-fold-search nil
)
842 (props (text-properties-at (gnus-point-at-bol)))
843 (empty (= (point-min) (point-max)))
844 (group (gnus-group-group-name))
846 (set-buffer gnus-group-buffer
)
847 (setq number
(funcall gnus-group-prepare-function level unread lowest
))
848 (when (or (and (numberp number
)
850 (zerop (buffer-size)))
851 ;; No groups in the buffer.
852 (gnus-message 5 gnus-no-groups-message
))
853 ;; We have some groups displayed.
854 (goto-char (point-max))
855 (when (or (not gnus-group-goto-next-group-function
)
856 (not (funcall gnus-group-goto-next-group-function
860 (goto-char (point-min)))
862 ;; Go to the first group with unread articles.
863 (gnus-group-search-forward t
))
865 ;; Find the right group to put point on. If the current group
866 ;; has disappeared in the new listing, try to find the next
867 ;; one. If no next one can be found, just leave point at the
868 ;; first newsgroup in the buffer.
869 (when (not (gnus-goto-char
871 (point-min) (point-max)
872 'gnus-group
(gnus-intern-safe
873 group gnus-active-hashtb
))))
874 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb
))))
878 (point-min) (point-max) 'gnus-group
880 (caar newsrc
) gnus-active-hashtb
)))))
881 (setq newsrc
(cdr newsrc
)))
883 (goto-char (point-max))
884 (forward-line -
1)))))))
885 ;; Adjust cursor point.
886 (gnus-group-position-point)))
888 (defun gnus-group-list-level (level &optional all
)
889 "List groups on LEVEL.
890 If ALL (the prefix), also list groups that have no unread articles."
891 (interactive "nList groups on level: \nP")
892 (gnus-group-list-groups level all level
))
894 (defun gnus-group-prepare-flat (level &optional all lowest regexp
)
895 "List all newsgroups with unread articles of level LEVEL or lower.
896 If ALL is non-nil, list groups that have no unread articles.
897 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher.
898 If REGEXP, only list groups matching REGEXP."
899 (set-buffer gnus-group-buffer
)
900 (let ((buffer-read-only nil
)
901 (newsrc (cdr gnus-newsrc-alist
))
902 (lowest (or lowest
1))
903 info clevel unread group params
)
905 (when (< lowest gnus-level-zombie
)
906 ;; List living groups.
908 (setq info
(car newsrc
)
909 group
(gnus-info-group info
)
910 params
(gnus-info-params info
)
912 unread
(car (gnus-gethash group gnus-newsrc-hashtb
)))
913 (and unread
; This group might be bogus
915 (string-match regexp group
))
916 (<= (setq clevel
(gnus-info-level info
)) level
)
918 (or all
; We list all groups?
919 (if (eq unread t
) ; Unactivated?
920 gnus-group-list-inactive-groups
; We list unactivated
921 (> unread
0)) ; We list groups with unread articles
922 (and gnus-list-groups-with-ticked-articles
923 (cdr (assq 'tick
(gnus-info-marks info
))))
924 ; And groups with tickeds
925 ;; Check for permanent visibility.
926 (and gnus-permanently-visible-groups
927 (string-match gnus-permanently-visible-groups
929 (memq 'visible params
)
930 (cdr (assq 'visible params
)))
931 (gnus-group-insert-group-line
932 group
(gnus-info-level info
)
933 (gnus-info-marks info
) unread
(gnus-info-method info
)))))
936 (and (>= level gnus-level-zombie
) (<= lowest gnus-level-zombie
)
937 (gnus-group-prepare-flat-list-dead
938 (setq gnus-zombie-list
(sort gnus-zombie-list
'string
<))
941 (and (>= level gnus-level-killed
) (<= lowest gnus-level-killed
)
942 (gnus-group-prepare-flat-list-dead
943 (setq gnus-killed-list
(sort gnus-killed-list
'string
<))
944 gnus-level-killed ?K regexp
))
946 (gnus-group-set-mode-line)
947 (setq gnus-group-list-mode
(cons level all
))
948 (run-hooks 'gnus-group-prepare-hook
)
951 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp
)
952 ;; List zombies and killed lists somewhat faster, which was
953 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does
954 ;; this by ignoring the group format specification altogether.
957 ;; This loop is used when listing groups that match some
960 (setq group
(pop groups
))
961 (when (string-match regexp group
)
962 (gnus-add-text-properties
963 (point) (prog1 (1+ (point))
964 (insert " " mark
" *: " group
"\n"))
965 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
967 'gnus-level level
))))
968 ;; This loop is used when listing all groups.
970 (gnus-add-text-properties
971 (point) (prog1 (1+ (point))
972 (insert " " mark
" *: "
973 (setq group
(pop groups
)) "\n"))
974 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
976 'gnus-level level
))))))
978 (defun gnus-group-update-group-line ()
979 "Update the current line in the group buffer."
980 (let* ((buffer-read-only nil
)
981 (group (gnus-group-group-name))
982 (entry (and group
(gnus-gethash group gnus-newsrc-hashtb
)))
983 gnus-group-indentation
)
986 (not (gnus-ephemeral-group-p group
))
988 (concat "(gnus-group-set-info '"
989 (gnus-prin1-to-string (nth 2 entry
))
991 (setq gnus-group-indentation
(gnus-group-group-indentation))
993 (gnus-group-insert-group-line-info group
)
995 (gnus-group-position-point))))
997 (defun gnus-group-insert-group-line-info (group)
998 "Insert GROUP on the current line."
999 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
))
1000 (gnus-group-indentation (gnus-group-group-indentation))
1004 ;; (Un)subscribed group.
1005 (setq info
(nth 2 entry
))
1006 (gnus-group-insert-group-line
1007 group
(gnus-info-level info
) (gnus-info-marks info
)
1008 (or (car entry
) t
) (gnus-info-method info
)))
1009 ;; This group is dead.
1010 (gnus-group-insert-group-line
1012 (if (member group gnus-zombie-list
) gnus-level-zombie gnus-level-killed
)
1014 (if (setq active
(gnus-active group
))
1015 (if (zerop (cdr active
))
1017 (- (1+ (cdr active
)) (car active
)))
1021 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level
1022 gnus-tmp-marked number
1024 "Insert a group line in the group buffer."
1025 (let* ((gnus-tmp-active (gnus-active gnus-tmp-group
))
1026 (gnus-tmp-number-total
1028 (1+ (- (cdr gnus-tmp-active
) (car gnus-tmp-active
)))
1030 (gnus-tmp-number-of-unread
1031 (if (numberp number
) (int-to-string (max 0 number
))
1033 (gnus-tmp-number-of-read
1034 (if (numberp number
)
1035 (int-to-string (max 0 (- gnus-tmp-number-total number
)))
1037 (gnus-tmp-subscribed
1038 (cond ((<= gnus-tmp-level gnus-level-subscribed
) ?
)
1039 ((<= gnus-tmp-level gnus-level-unsubscribed
) ?U
)
1040 ((= gnus-tmp-level gnus-level-zombie
) ?Z
)
1042 (gnus-tmp-qualified-group (gnus-group-real-name gnus-tmp-group
))
1043 (gnus-tmp-newsgroup-description
1044 (if gnus-description-hashtb
1045 (or (gnus-gethash gnus-tmp-group gnus-description-hashtb
) "")
1048 (if (and gnus-moderated-hashtb
1049 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb
))
1051 (gnus-tmp-moderated-string
1052 (if (eq gnus-tmp-moderated ?m
) "(m)" ""))
1054 (gnus-server-get-method gnus-tmp-group gnus-tmp-method
))
1055 (gnus-tmp-news-server (or (cadr gnus-tmp-method
) ""))
1056 (gnus-tmp-news-method (or (car gnus-tmp-method
) ""))
1057 (gnus-tmp-news-method-string
1059 (format "(%s:%s)" (car gnus-tmp-method
)
1060 (cadr gnus-tmp-method
)) ""))
1061 (gnus-tmp-marked-mark
1062 (if (and (numberp number
)
1064 (cdr (assq 'tick gnus-tmp-marked
)))
1066 (gnus-tmp-process-marked
1067 (if (member gnus-tmp-group gnus-group-marked
)
1068 gnus-process-mark ?
))
1070 (or (and gnus-use-grouplens
1071 (bbb-grouplens-group-p gnus-tmp-group
))
1073 (buffer-read-only nil
)
1074 header gnus-tmp-header
) ; passed as parameter to user-funcs.
1076 (gnus-add-text-properties
1080 (eval gnus-group-line-format-spec
))
1081 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb
)
1082 gnus-unread
,(if (numberp number
)
1083 (string-to-int gnus-tmp-number-of-unread
)
1085 gnus-marked
,gnus-tmp-marked-mark
1086 gnus-indentation
,gnus-group-indentation
1087 gnus-level
,gnus-tmp-level
))
1088 (when (inline (gnus-visual-p 'group-highlight
'highlight
))
1090 (run-hooks 'gnus-group-update-hook
)
1092 ;; Allow XEmacs to remove front-sticky text properties.
1093 (gnus-group-remove-excess-properties)))
1095 (defun gnus-group-highlight-line ()
1096 "Highlight the current line according to `gnus-group-highlight'."
1097 (let* ((list gnus-group-highlight
)
1099 (end (progn (end-of-line) (point)))
1100 ;; now find out where the line starts and leave point there.
1101 (beg (progn (beginning-of-line) (point)))
1102 (group (gnus-group-group-name))
1103 (entry (gnus-group-entry group
))
1104 (unread (if (numberp (car entry
)) (car entry
) 0))
1105 (active (gnus-active group
))
1106 (total (if active
(1+ (- (cdr active
) (car active
))) 0))
1107 (info (nth 2 entry
))
1108 (method (gnus-server-get-method group
(gnus-info-method info
)))
1109 (marked (gnus-info-marks info
))
1110 (mailp (memq 'mail
(assoc (symbol-name
1111 (car (or method gnus-select-method
)))
1112 gnus-valid-select-methods
)))
1113 (level (or (gnus-info-level info
) 9))
1114 (score (or (gnus-info-score info
) 0))
1115 (ticked (gnus-range-length (cdr (assq 'tick marked
))))
1116 (group-age (gnus-group-timestamp-delta group
))
1117 (inhibit-read-only t
))
1118 ;; Eval the cars of the lists until we find a match.
1120 (not (eval (caar list
))))
1121 (setq list
(cdr list
)))
1122 (let ((face (cdar list
)))
1123 (unless (eq face
(get-text-property beg
'face
))
1124 (gnus-put-text-property
1126 (setq face
(if (boundp face
) (symbol-value face
) face
)))
1127 (gnus-extent-start-open beg
)))
1130 (defun gnus-group-update-group (group &optional visible-only
)
1131 "Update all lines where GROUP appear.
1132 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't
1134 ;; Can't use `save-excursion' here, so we do it manually.
1135 (let ((buf (current-buffer))
1137 (set-buffer gnus-group-buffer
)
1138 (setq mark
(point-marker))
1139 ;; The buffer may be narrowed.
1142 (let ((ident (gnus-intern-safe group gnus-active-hashtb
))
1144 found buffer-read-only
)
1145 ;; Enter the current status into the dribble buffer.
1146 (let ((entry (gnus-gethash group gnus-newsrc-hashtb
)))
1147 (when (and entry
(not (gnus-ephemeral-group-p group
)))
1149 (concat "(gnus-group-set-info '"
1150 (gnus-prin1-to-string (nth 2 entry
))
1152 ;; Find all group instances. If topics are in use, each group
1153 ;; may be listed in more than once.
1154 (while (setq loc
(text-property-any
1155 loc
(point-max) 'gnus-group ident
))
1158 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1160 (gnus-group-insert-group-line-info group
)
1163 (run-hooks 'gnus-group-update-group-hook
)))
1164 (setq loc
(1+ loc
)))
1165 (unless (or found visible-only
)
1166 ;; No such line in the buffer, find out where it's supposed to
1167 ;; go, and insert it there (or at the end of the buffer).
1168 (if gnus-goto-missing-group-function
1169 (funcall gnus-goto-missing-group-function group
)
1170 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb
))))
1171 (while (and entry
(car entry
)
1175 (point-min) (point-max)
1176 'gnus-group
(gnus-intern-safe
1177 (caar entry
) gnus-active-hashtb
)))))
1178 (setq entry
(cdr entry
)))
1179 (or entry
(goto-char (point-max)))))
1180 ;; Finally insert the line.
1181 (let ((gnus-group-indentation (gnus-group-group-indentation)))
1182 (gnus-group-insert-group-line-info group
)
1185 (run-hooks 'gnus-group-update-group-hook
))))
1186 (when gnus-group-update-group-function
1187 (funcall gnus-group-update-group-function group
))
1188 (gnus-group-set-mode-line)))
1190 (set-marker mark nil
)
1193 (defun gnus-group-set-mode-line ()
1194 "Update the mode line in the group buffer."
1195 (when (memq 'group gnus-updated-mode-lines
)
1196 ;; Yes, we want to keep this mode line updated.
1198 (set-buffer gnus-group-buffer
)
1199 (let* ((gformat (or gnus-group-mode-line-format-spec
1200 (setq gnus-group-mode-line-format-spec
1202 gnus-group-mode-line-format
1203 gnus-group-mode-line-format-alist
))))
1204 (gnus-tmp-news-server (cadr gnus-select-method
))
1205 (gnus-tmp-news-method (car gnus-select-method
))
1206 (gnus-tmp-colon (if (equal gnus-tmp-news-server
"") "" ":"))
1208 gnus-tmp-header
;Dummy binding for user-defined formats
1209 ;; Get the resulting string.
1211 (and gnus-dribble-buffer
1212 (buffer-name gnus-dribble-buffer
)
1213 (buffer-modified-p gnus-dribble-buffer
)
1215 (set-buffer gnus-dribble-buffer
)
1216 (not (zerop (buffer-size))))))
1217 (mode-string (eval gformat
)))
1218 ;; Say whether the dribble buffer has been modified.
1219 (setq mode-line-modified
1220 (if modified
"--**- " "----- "))
1221 ;; If the line is too long, we chop it off.
1222 (when (> (length mode-string
) max-len
)
1223 (setq mode-string
(substring mode-string
0 (- max-len
4))))
1225 (setq mode-line-buffer-identification
1226 (gnus-mode-line-buffer-identification
1227 (list mode-string
)))
1228 (set-buffer-modified-p modified
))))))
1230 (defun gnus-group-group-name ()
1231 "Get the name of the newsgroup on the current line."
1232 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group
)))
1233 (and group
(symbol-name group
))))
1235 (defun gnus-group-group-level ()
1236 "Get the level of the newsgroup on the current line."
1237 (get-text-property (gnus-point-at-bol) 'gnus-level
))
1239 (defun gnus-group-group-indentation ()
1240 "Get the indentation of the newsgroup on the current line."
1241 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation
)
1242 (and gnus-group-indentation-function
1243 (funcall gnus-group-indentation-function
))
1246 (defun gnus-group-group-unread ()
1247 "Get the number of unread articles of the newsgroup on the current line."
1248 (get-text-property (gnus-point-at-bol) 'gnus-unread
))
1250 (defun gnus-group-new-mail (group)
1251 (if (nnmail-new-mail-p (gnus-group-real-name group
))
1255 (defun gnus-group-level (group)
1256 "Return the estimated level of GROUP."
1257 (or (gnus-info-level (gnus-get-info group
))
1258 (and (member group gnus-zombie-list
) 8)
1261 (defun gnus-group-search-forward (&optional backward all level first-too
)
1262 "Find the next newsgroup with unread articles.
1263 If BACKWARD is non-nil, find the previous newsgroup instead.
1264 If ALL is non-nil, just find any newsgroup.
1265 If LEVEL is non-nil, find group with level LEVEL, or higher if no such
1267 If FIRST-TOO, the current line is also eligible as a target."
1268 (let ((way (if backward -
1 1))
1269 (low gnus-level-killed
)
1272 (if (and backward
(progn (beginning-of-line)) (bobp))
1283 (get-text-property (point) 'gnus-unread
)))
1284 (and (numberp unread
) (> unread
0)))
1285 (setq lev
(get-text-property (point)
1287 (<= lev gnus-level-subscribed
)))
1289 (and (setq lev
(get-text-property (point)
1298 (zerop (forward-line way
)))))
1300 (progn (gnus-group-position-point) t
)
1301 (goto-char (or pos beg
))
1304 ;;; Gnus group mode commands
1308 (defun gnus-group-mark-group (n &optional unmark no-advance
)
1309 "Mark the current group."
1311 (let ((buffer-read-only nil
)
1315 (when (setq group
(gnus-group-group-name))
1316 ;; Go to the mark position.
1318 (forward-char (or (cdr (assq 'process gnus-group-mark-positions
)) 2))
1319 (subst-char-in-region
1320 (point) (1+ (point)) (following-char)
1323 (setq gnus-group-marked
(delete group gnus-group-marked
))
1325 (setq gnus-group-marked
1326 (cons group
(delete group gnus-group-marked
)))
1327 gnus-process-mark
)))
1329 (gnus-group-next-group 1))
1331 (gnus-summary-position-point)
1334 (defun gnus-group-unmark-group (n)
1335 "Remove the mark from the current group."
1337 (gnus-group-mark-group n
'unmark
)
1338 (gnus-group-position-point))
1340 (defun gnus-group-unmark-all-groups ()
1341 "Unmark all groups."
1343 (let ((groups gnus-group-marked
))
1346 (gnus-group-remove-mark (pop groups
)))))
1347 (gnus-group-position-point))
1349 (defun gnus-group-mark-region (unmark beg end
)
1350 "Mark all groups between point and mark.
1351 If UNMARK, remove the mark instead."
1352 (interactive "P\nr")
1353 (let ((num (count-lines beg end
)))
1356 (- num
(gnus-group-mark-group num unmark
)))))
1358 (defun gnus-group-mark-buffer (&optional unmark
)
1359 "Mark all groups in the buffer.
1360 If UNMARK, remove the mark instead."
1362 (gnus-group-mark-region unmark
(point-min) (point-max)))
1364 (defun gnus-group-mark-regexp (regexp)
1365 "Mark all groups that match some regexp."
1366 (interactive "sMark (regexp): ")
1367 (let ((alist (cdr gnus-newsrc-alist
))
1370 (when (string-match regexp
(setq group
(gnus-info-group (pop alist
))))
1371 (gnus-group-set-mark group
))))
1372 (gnus-group-position-point))
1374 (defun gnus-group-remove-mark (group)
1375 "Remove the process mark from GROUP and move point there.
1376 Return nil if the group isn't displayed."
1377 (if (gnus-group-goto-group group
)
1379 (gnus-group-mark-group 1 'unmark t
)
1381 (setq gnus-group-marked
1382 (delete group gnus-group-marked
))
1385 (defun gnus-group-set-mark (group)
1386 "Set the process mark on GROUP."
1387 (if (gnus-group-goto-group group
)
1389 (gnus-group-mark-group 1 nil t
))
1390 (setq gnus-group-marked
(cons group
(delete group gnus-group-marked
)))))
1392 (defun gnus-group-universal-argument (arg &optional groups func
)
1393 "Perform any command on all groups according to the process/prefix convention."
1395 (if (eq (setq func
(or func
1398 (substitute-command-keys
1399 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]")))))
1401 (gnus-error 1 "Undefined key")
1402 (gnus-group-iterate arg
1404 (command-execute func
))))
1405 (gnus-group-position-point))
1407 (defun gnus-group-process-prefix (n)
1408 "Return a list of groups to work on.
1409 Take into consideration N (the prefix) and the list of marked groups."
1412 (setq n
(prefix-numeric-value n
))
1413 ;; There is a prefix, so we return a list of the N next
1415 (let ((way (if (< n
0) -
1 1))
1420 (setq group
(gnus-group-group-name)))
1423 (gnus-group-next-group way
)))
1425 ((gnus-region-active-p)
1426 ;; Work on the region between point and mark.
1427 (let ((max (max (point) (mark)))
1430 (goto-char (min (point) (mark)))
1433 (push (gnus-group-group-name) groups
)
1434 (zerop (gnus-group-next-group 1))
1436 (nreverse groups
))))
1438 ;; No prefix, but a list of marked articles.
1439 (reverse gnus-group-marked
))
1441 ;; Neither marked articles or a prefix, so we return the
1443 (let ((group (gnus-group-group-name)))
1444 (and group
(list group
))))))
1446 (defun gnus-group-iterate (arg function
)
1447 "Iterate FUNCTION over all process/prefixed groups.
1448 FUNCTION will be called with the group name as the paremeter
1449 and with point over the group in question."
1450 (let ((groups (gnus-group-process-prefix arg
))
1452 (while (setq group
(pop groups
))
1453 (gnus-group-remove-mark group
)
1454 (funcall function group
))))
1456 (put 'gnus-group-iterate
'lisp-indent-function
1)
1458 ;; Selecting groups.
1460 (defun gnus-group-read-group (&optional all no-article group
)
1461 "Read news in this newsgroup.
1462 If the prefix argument ALL is non-nil, already read articles become
1463 readable. IF ALL is a number, fetch this number of articles. If the
1464 optional argument NO-ARTICLE is non-nil, no article will be
1465 auto-selected upon group entry. If GROUP is non-nil, fetch that
1468 (let ((no-display (eq all
0))
1469 (group (or group
(gnus-group-group-name)))
1470 number active marked entry
)
1474 (error "No group on current line"))
1475 (setq marked
(gnus-info-marks
1476 (nth 2 (setq entry
(gnus-gethash
1477 group gnus-newsrc-hashtb
)))))
1478 ;; This group might be a dead group. In that case we have to get
1479 ;; the number of unread articles from `gnus-active-hashtb'.
1481 (cond ((numberp all
) all
)
1483 ((setq active
(gnus-active group
))
1484 (- (1+ (cdr active
)) (car active
)))))
1485 (gnus-summary-read-group
1486 group
(or all
(and (numberp number
)
1487 (zerop (+ number
(gnus-range-length
1488 (cdr (assq 'tick marked
)))
1490 (cdr (assq 'dormant marked
)))))))
1491 no-article nil no-display
)))
1493 (defun gnus-group-select-group (&optional all
)
1494 "Select this newsgroup.
1495 No article is selected automatically.
1496 If ALL is non-nil, already read articles become readable.
1497 If ALL is a number, fetch this number of articles."
1499 (gnus-group-read-group all t
))
1501 (defun gnus-group-quick-select-group (&optional all
)
1502 "Select the current group \"quickly\".
1503 This means that no highlighting or scoring will be performed.
1504 If ALL (the prefix argument) is 0, don't even generate the summary
1507 (require 'gnus-score
)
1509 gnus-score-find-score-files-function
1510 gnus-home-score-file
1511 gnus-apply-kill-hook
1512 gnus-summary-expunge-below
)
1513 (gnus-group-read-group all t
)))
1515 (defun gnus-group-visible-select-group (&optional all
)
1516 "Select the current group without hiding any articles."
1518 (let ((gnus-inhibit-limiting t
))
1519 (gnus-group-read-group all t
)))
1521 (defun gnus-group-select-group-ephemerally ()
1522 "Select the current group without doing any processing whatsoever.
1523 You will actually be entered into a group that's a copy of
1524 the current group; no changes you make while in this group will
1527 (require 'gnus-score
)
1529 gnus-score-find-score-files-function gnus-apply-kill-hook
1530 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates
1531 gnus-summary-mode-hook gnus-select-group-hook
1532 (group (gnus-group-group-name))
1533 (method (gnus-find-method-for-group group
)))
1535 `(,(car method
) ,(concat (cadr method
) "-ephemeral")
1536 (,(intern (format "%s-address" (car method
))) ,(cadr method
))
1538 (gnus-group-read-ephemeral-group
1539 (gnus-group-prefixed-name group method
) method
)))
1542 (defun gnus-fetch-group (group)
1543 "Start Gnus if necessary and enter GROUP.
1544 Returns whether the fetching was successful or not."
1545 (interactive "sGroup name: ")
1546 (unless (get-buffer gnus-group-buffer
)
1548 (gnus-group-read-group nil nil group
))
1550 (defvar gnus-ephemeral-group-server
0)
1552 ;; Enter a group that is not in the group buffer. Non-nil is returned
1553 ;; if selection was successful.
1554 (defun gnus-group-read-ephemeral-group (group method
&optional activate
1555 quit-config request-only
)
1556 "Read GROUP from METHOD as an ephemeral group.
1557 If ACTIVATE, request the group first.
1558 If QUIT-CONFIG, use that window configuration when exiting from the
1560 If REQUEST-ONLY, don't actually read the group; just request it.
1562 Return the name of the group is selection was successful."
1563 ;; Transform the select method into a unique server.
1564 (let ((saddr (intern (format "%s-address" (car method
)))))
1565 (setq method
(gnus-copy-sequence method
))
1566 (require (car method
))
1567 (when (boundp saddr
)
1568 (unless (assq saddr method
)
1569 (nconc method
`((,saddr
,(cadr method
))))
1570 (setf (cadr method
) (format "%s-%d" (cadr method
)
1571 (incf gnus-ephemeral-group-server
))))))
1572 (let ((group (if (gnus-group-foreign-p group
) group
1573 (gnus-group-prefixed-name group method
))))
1577 ,gnus-level-default-subscribed nil nil
,method
1579 ,(if quit-config quit-config
1580 (cons gnus-summary-buffer
1581 gnus-current-window-configuration
))))))
1583 (set-buffer gnus-group-buffer
)
1584 (unless (gnus-check-server method
)
1585 (error "Unable to contact server: %s" (gnus-status-message method
)))
1587 (gnus-activate-group group
'scan
)
1588 (unless (gnus-request-group group
)
1589 (error "Couldn't request group: %s"
1590 (nnheader-get-report (car method
)))))
1594 (when (gnus-group-read-group t t group
)
1599 (defun gnus-group-jump-to-group (group)
1600 "Jump to newsgroup GROUP."
1602 (list (completing-read
1603 "Group: " gnus-active-hashtb nil
1604 (gnus-read-active-file-p)
1606 'gnus-group-history
)))
1608 (when (equal group
"")
1609 (error "Empty group name"))
1611 (unless (gnus-ephemeral-group-p group
)
1612 ;; Either go to the line in the group buffer...
1613 (unless (gnus-group-goto-group group
)
1614 ;; ... or insert the line.
1615 (gnus-group-update-group group
)
1616 (gnus-group-goto-group group
)))
1617 ;; Adjust cursor point.
1618 (gnus-group-position-point))
1620 (defun gnus-group-goto-group (group &optional far
)
1621 "Goto to newsgroup GROUP.
1622 If FAR, it is likely that the group is not on the current line."
1627 (point-min) (point-max)
1628 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)))
1631 ;; It's quite likely that we are on the right line, so
1632 ;; we check the current line first.
1633 ((eq (get-text-property (point) 'gnus-group
)
1634 (gnus-intern-safe group gnus-active-hashtb
))
1636 ;; Previous and next line are also likely, so we check them as well.
1639 (eq (get-text-property (point) 'gnus-group
)
1640 (gnus-intern-safe group gnus-active-hashtb
)))
1645 (eq (get-text-property (point) 'gnus-group
)
1646 (gnus-intern-safe group gnus-active-hashtb
)))
1650 ;; Search through the entire buffer.
1653 (point-min) (point-max)
1654 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
))))))))
1656 (defun gnus-group-next-group (n &optional silent
)
1657 "Go to next N'th newsgroup.
1658 If N is negative, search backward instead.
1659 Returns the difference between N and the number of skips actually
1662 (gnus-group-next-unread-group n t nil silent
))
1664 (defun gnus-group-next-unread-group (n &optional all level silent
)
1665 "Go to next N'th unread newsgroup.
1666 If N is negative, search backward instead.
1667 If ALL is non-nil, choose any newsgroup, unread or not.
1668 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no
1669 such group can be found, the next group with a level higher than
1671 Returns the difference between N and the number of skips actually
1674 (let ((backward (< n
0))
1677 (gnus-group-search-forward
1678 backward
(or (not gnus-group-goto-unread
) all
) level
))
1682 (gnus-message 7 "No more%s newsgroups%s" (if all
"" " unread")
1683 (if level
" on this level or higher" "")))
1686 (defun gnus-group-prev-group (n)
1687 "Go to previous N'th newsgroup.
1688 Returns the difference between N and the number of skips actually
1691 (gnus-group-next-unread-group (- n
) t
))
1693 (defun gnus-group-prev-unread-group (n)
1694 "Go to previous N'th unread newsgroup.
1695 Returns the difference between N and the number of skips actually
1698 (gnus-group-next-unread-group (- n
)))
1700 (defun gnus-group-next-unread-group-same-level (n)
1701 "Go to next N'th unread newsgroup on the same level.
1702 If N is negative, search backward instead.
1703 Returns the difference between N and the number of skips actually
1706 (gnus-group-next-unread-group n t
(gnus-group-group-level))
1707 (gnus-group-position-point))
1709 (defun gnus-group-prev-unread-group-same-level (n)
1710 "Go to next N'th unread newsgroup on the same level.
1711 Returns the difference between N and the number of skips actually
1714 (gnus-group-next-unread-group (- n
) t
(gnus-group-group-level))
1715 (gnus-group-position-point))
1717 (defun gnus-group-best-unread-group (&optional exclude-group
)
1718 "Go to the group with the highest level.
1719 If EXCLUDE-GROUP, do not go to that group."
1721 (goto-char (point-min))
1725 (setq unread
(get-text-property (point) 'gnus-unread
))
1726 (when (and (numberp unread
) (> unread
0))
1727 (when (and (get-text-property (point) 'gnus-level
)
1728 (< (get-text-property (point) 'gnus-level
) best
)
1729 (or (not exclude-group
)
1730 (not (equal exclude-group
(gnus-group-group-name)))))
1731 (setq best
(get-text-property (point) 'gnus-level
))
1732 (setq best-point
(point))))
1735 (goto-char best-point
))
1736 (gnus-summary-position-point)
1737 (and best-point
(gnus-group-group-name))))
1739 (defun gnus-group-first-unread-group ()
1740 "Go to the first group with unread articles."
1743 (let ((opoint (point))
1745 (goto-char (point-min))
1746 (if (or (eq (setq unread
(gnus-group-group-unread)) t
) ; Not active.
1747 (and (numberp unread
) ; Not a topic.
1748 (not (zerop unread
))) ; Has unread articles.
1749 (zerop (gnus-group-next-unread-group 1))) ; Next unread group.
1752 nil
)) ; Not success.
1753 (gnus-group-position-point)))
1755 (defun gnus-group-enter-server-mode ()
1756 "Jump to the server buffer."
1758 (gnus-enter-server-buffer))
1760 (defun gnus-group-make-group (name &optional method address args
)
1761 "Add a new newsgroup.
1762 The user will be prompted for a NAME, for a select METHOD, and an
1766 (gnus-read-group "Group name: ")
1767 (gnus-read-method "From method: ")))
1769 (let* ((meth (when (and method
1770 (not (gnus-server-equal method gnus-select-method
)))
1771 (if address
(list (intern method
) address
)
1773 (nname (if method
(gnus-group-prefixed-name name meth
) name
))
1775 (when (gnus-gethash nname gnus-newsrc-hashtb
)
1776 (error "Group %s already exists" nname
))
1777 ;; Subscribe to the new group.
1778 (gnus-group-change-level
1779 (setq info
(list t nname gnus-level-default-subscribed nil nil meth
))
1780 gnus-level-default-subscribed gnus-level-killed
1781 (and (gnus-group-group-name)
1782 (gnus-gethash (gnus-group-group-name)
1783 gnus-newsrc-hashtb
))
1786 (gnus-set-active nname
(cons 1 0))
1787 (unless (gnus-ephemeral-group-p name
)
1789 (concat "(gnus-group-set-info '"
1790 (gnus-prin1-to-string (cdr info
)) ")")))
1792 (gnus-group-insert-group-line-info nname
)
1794 (gnus-group-position-point)
1796 ;; Load the backend and try to make the backend create
1797 ;; the group as well.
1798 (when (assoc (symbol-name (setq backend
(car (gnus-server-get-method
1800 gnus-valid-select-methods
)
1802 (gnus-check-server meth
)
1803 (when (gnus-check-backend-function 'request-create-group nname
)
1804 (gnus-request-create-group nname nil args
))
1807 (defun gnus-group-delete-group (group &optional force
)
1808 "Delete the current group. Only meaningful with mail groups.
1809 If FORCE (the prefix) is non-nil, all the articles in the group will
1810 be deleted. This is \"deleted\" as in \"removed forever from the face
1811 of the Earth\". There is no undo. The user will be prompted before
1812 doing the deletion."
1814 (list (gnus-group-group-name)
1815 current-prefix-arg
))
1817 (error "No group to rename"))
1818 (unless (gnus-check-backend-function 'request-delete-group group
)
1819 (error "This backend does not support group deletion"))
1821 (if (not (gnus-yes-or-no-p
1823 "Do you really want to delete %s%s? "
1824 group
(if force
" and all its contents" ""))))
1826 (gnus-message 6 "Deleting group %s..." group
)
1827 (if (not (gnus-request-delete-group group force
))
1828 (gnus-error 3 "Couldn't delete group %s" group
)
1829 (gnus-message 6 "Deleting group %s...done" group
)
1830 (gnus-group-goto-group group
)
1831 (gnus-group-kill-group 1 t
)
1832 (gnus-sethash group nil gnus-active-hashtb
)
1834 (gnus-group-position-point)))
1836 (defun gnus-group-rename-group (group new-name
)
1837 "Rename group from GROUP to NEW-NAME.
1838 When used interactively, GROUP is the group under point
1839 and NEW-NAME will be prompted for."
1842 (gnus-group-group-name)
1844 (unless (gnus-check-backend-function
1845 'request-rename-group
(gnus-group-group-name))
1846 (error "This backend does not support renaming groups"))
1847 (gnus-read-group "Rename group to: "
1848 (gnus-group-real-name (gnus-group-group-name))))))
1850 (unless (gnus-check-backend-function 'request-rename-group group
)
1851 (error "This backend does not support renaming groups"))
1853 (error "No group to rename"))
1854 (when (equal (gnus-group-real-name group
) new-name
)
1855 (error "Can't rename to the same name"))
1857 ;; We find the proper prefixed name.
1859 (if (gnus-group-native-p group
)
1863 (gnus-group-prefixed-name
1864 (gnus-group-real-name new-name
)
1865 (gnus-info-method (gnus-get-info group
)))))
1867 (gnus-message 6 "Renaming group %s to %s..." group new-name
)
1869 (if (not (gnus-request-rename-group group new-name
))
1870 (gnus-error 3 "Couldn't rename group %s to %s" group new-name
)
1871 ;; We rename the group internally by killing it...
1872 (gnus-group-goto-group group
)
1873 (gnus-group-kill-group)
1874 ;; ... changing its name ...
1875 (setcar (cdar gnus-list-of-killed-groups
) new-name
)
1876 ;; ... and then yanking it. Magic!
1877 (gnus-group-yank-group)
1878 (gnus-set-active new-name
(gnus-active group
))
1879 (gnus-message 6 "Renaming group %s to %s...done" group new-name
)
1881 (gnus-group-position-point)))
1883 (defun gnus-group-edit-group (group &optional part
)
1884 "Edit the group on the current line."
1885 (interactive (list (gnus-group-group-name)))
1886 (let ((part (or part
'info
))
1889 (error "No group on current line"))
1890 (unless (setq info
(gnus-get-info group
))
1891 (error "Killed group; can't be edited"))
1893 (gnus-close-group group
))
1895 ;; Find the proper form to edit.
1896 (cond ((eq part
'method
)
1897 (or (gnus-info-method info
) "native"))
1899 (gnus-info-params info
))
1901 ;; The proper documentation.
1903 "Editing the %s for `%s'."
1905 ((eq part
'method
) "select method")
1906 ((eq part
'params
) "group parameters")
1910 (gnus-group-edit-group-done ',part
,group form
)))))
1912 (defun gnus-group-edit-group-method (group)
1913 "Edit the select method of GROUP."
1914 (interactive (list (gnus-group-group-name)))
1915 (gnus-group-edit-group group
'method
))
1917 (defun gnus-group-edit-group-parameters (group)
1918 "Edit the group parameters of GROUP."
1919 (interactive (list (gnus-group-group-name)))
1920 (gnus-group-edit-group group
'params
))
1922 (defun gnus-group-edit-group-done (part group form
)
1924 (let* ((method (cond ((eq part
'info
) (nth 4 form
))
1925 ((eq part
'method
) form
)
1927 (info (cond ((eq part
'info
) form
)
1928 ((eq part
'method
) (gnus-get-info group
))
1931 (if (or (not method
)
1933 gnus-select-method method
))
1934 (gnus-group-real-name (car info
))
1935 (gnus-group-prefixed-name
1936 (gnus-group-real-name (car info
)) method
))
1938 (when (and new-group
1939 (not (equal new-group group
)))
1940 (when (gnus-group-goto-group group
)
1941 (gnus-group-kill-group 1))
1942 (gnus-activate-group new-group
))
1944 (if (not (and info new-group
))
1945 (gnus-group-set-info form
(or new-group group
) part
)
1946 (setq info
(gnus-copy-sequence info
))
1947 (setcar info new-group
)
1948 (unless (gnus-server-equal method
"native")
1949 (unless (nthcdr 3 info
)
1950 (nconc info
(list nil nil
)))
1951 (unless (nthcdr 4 info
)
1952 (nconc info
(list nil
)))
1953 (gnus-info-set-method info method
))
1954 (gnus-group-set-info info
))
1955 (gnus-group-update-group (or new-group group
))
1956 (gnus-group-position-point)))
1958 (defun gnus-group-make-useful-group (group method
)
1960 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups
1962 gnus-useful-groups
)))
1963 (list (cadr entry
) (caddr entry
))))
1964 (setq method
(gnus-copy-sequence method
))
1966 (while (setq entry
(memq (assq 'eval method
) method
))
1967 (setcar entry
(eval (cadar entry
)))))
1968 (gnus-group-make-group group method
))
1970 (defun gnus-group-make-help-group ()
1971 "Create the Gnus documentation group."
1973 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help")))
1974 (file (nnheader-find-etc-directory "gnus-tut.txt" t
))
1976 (when (gnus-gethash name gnus-newsrc-hashtb
)
1977 (error "Documentation group already exists"))
1979 (gnus-message 1 "Couldn't find doc group")
1980 (gnus-group-make-group
1981 (gnus-group-real-name name
)
1982 (list 'nndoc
"gnus-help"
1983 (list 'nndoc-address file
)
1984 (list 'nndoc-article-type
'mbox
)))))
1985 (gnus-group-position-point))
1987 (defun gnus-group-make-doc-group (file type
)
1988 "Create a group that uses a single file as the source."
1990 (list (read-file-name "File name: ")
1991 (and current-prefix-arg
'ask
)))
1992 (when (eq type
'ask
)
1997 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: "
1999 (setq found
(cond ((= (setq char
(read-char)) ?m
) 'mbox
)
2000 ((= char ?b
) 'babyl
)
2001 ((= char ?d
) 'digest
)
2002 ((= char ?f
) 'forward
)
2004 (t (setq err
(format "%c unknown. " char
))
2007 (let* ((file (expand-file-name file
))
2008 (name (gnus-generate-new-group-name
2009 (gnus-group-prefixed-name
2010 (file-name-nondirectory file
) '(nndoc "")))))
2011 (gnus-group-make-group
2012 (gnus-group-real-name name
)
2014 (list 'nndoc-address file
)
2015 (list 'nndoc-article-type
(or type
'guess
))))))
2017 (defvar nnweb-type-definition
)
2018 (defvar gnus-group-web-type-history nil
)
2019 (defvar gnus-group-web-search-history nil
)
2020 (defun gnus-group-make-web-group (&optional solid
)
2021 "Create an ephemeral nnweb group.
2022 If SOLID (the prefix), create a solid group."
2026 (if solid
(gnus-read-group "Group name: ")
2027 (message-unique-id)))
2030 "Search engine type: "
2031 (mapcar (lambda (elem) (list (symbol-name (car elem
))))
2032 nnweb-type-definition
)
2033 nil t
(cons (or (car gnus-group-web-type-history
)
2034 (symbol-name (caar nnweb-type-definition
)))
2036 'gnus-group-web-type-history
))
2040 (cons (or (car gnus-group-web-search-history
) "") 0)
2041 'gnus-group-web-search-history
))
2043 `(nnweb ,group
(nnweb-search ,search
)
2044 (nnweb-type ,(intern type
))
2045 (nnweb-ephemeral-p t
))))
2047 (gnus-group-make-group group
"nnweb" "" `(,(intern type
) ,search
))
2048 (gnus-group-read-ephemeral-group
2050 (cons (current-buffer)
2051 (if (eq major-mode
'gnus-summary-mode
) 'summary
'group
))))))
2053 (defun gnus-group-make-archive-group (&optional all
)
2054 "Create the (ding) Gnus archive group of the most recent articles.
2055 Given a prefix, create a full group."
2057 (let ((group (gnus-group-prefixed-name
2058 (if all
"ding.archives" "ding.recent") '(nndir ""))))
2059 (when (gnus-gethash group gnus-newsrc-hashtb
)
2060 (error "Archive group already exists"))
2061 (gnus-group-make-group
2062 (gnus-group-real-name group
)
2063 (list 'nndir
(if all
"hpc" "edu")
2064 (list 'nndir-directory
2065 (if all gnus-group-archive-directory
2066 gnus-group-recent-archive-directory
))))
2067 (gnus-group-add-parameter group
(cons 'to-address
"ding@gnus.org"))))
2069 (defun gnus-group-make-directory-group (dir)
2070 "Create an nndir group.
2071 The user will be prompted for a directory. The contents of this
2072 directory will be used as a newsgroup. The directory should contain
2073 mail messages or news articles in files that have numeric names."
2075 (list (read-file-name "Create group from directory: ")))
2076 (unless (file-exists-p dir
)
2077 (error "No such directory"))
2078 (unless (file-directory-p dir
)
2079 (error "Not a directory"))
2083 (while (or (not group
) (gnus-gethash group gnus-newsrc-hashtb
))
2085 (gnus-group-prefixed-name
2086 (concat (file-name-as-directory (directory-file-name dir
))
2089 (setq ext
(format "<%d>" (setq i
(1+ i
)))))
2090 (gnus-group-make-group
2091 (gnus-group-real-name group
)
2092 (list 'nndir
(gnus-group-real-name group
) (list 'nndir-directory dir
)))))
2094 (defun gnus-group-make-kiboze-group (group address scores
)
2095 "Create an nnkiboze group.
2096 The user will be prompted for a name, a regexp to match groups, and
2097 score file entries for articles to include in the group."
2100 (read-string "nnkiboze group name: ")
2101 (read-string "Source groups (regexp): ")
2102 (let ((headers (mapcar (lambda (group) (list group
))
2103 '("subject" "from" "number" "date" "message-id"
2104 "references" "chars" "lines" "xref"
2105 "followup" "all" "body" "head")))
2106 scores header regexp regexps
)
2107 (while (not (equal "" (setq header
(completing-read
2108 "Match on header: " headers nil t
))))
2110 (while (not (equal "" (setq regexp
(read-string
2111 (format "Match on %s (string): "
2113 (push (list regexp nil nil
'r
) regexps
))
2114 (push (cons header regexps
) scores
))
2116 (gnus-group-make-group group
"nnkiboze" address
)
2117 (nnheader-temp-write (gnus-score-file-name (concat "nnkiboze:" group
))
2118 (let (emacs-lisp-mode-hook)
2119 (pp scores
(current-buffer)))))
2121 (defun gnus-group-add-to-virtual (n vgroup
)
2122 "Add the current group to a virtual group."
2124 (list current-prefix-arg
2125 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t
2127 (unless (eq (car (gnus-find-method-for-group vgroup
)) 'nnvirtual
)
2128 (error "%s is not an nnvirtual group" vgroup
))
2129 (gnus-close-group vgroup
)
2130 (let* ((groups (gnus-group-process-prefix n
))
2131 (method (gnus-info-method (gnus-get-info vgroup
))))
2132 (setcar (cdr method
)
2134 (nth 1 method
) "\\|"
2137 (gnus-group-remove-mark s
)
2138 (concat "\\(^" (regexp-quote s
) "$\\)"))
2140 (gnus-group-position-point))
2142 (defun gnus-group-make-empty-virtual (group)
2143 "Create a new, fresh, empty virtual group."
2144 (interactive "sCreate new, empty virtual group: ")
2145 (let* ((method (list 'nnvirtual
"^$"))
2146 (pgroup (gnus-group-prefixed-name group method
)))
2147 ;; Check whether it exists already.
2148 (when (gnus-gethash pgroup gnus-newsrc-hashtb
)
2149 (error "Group %s already exists." pgroup
))
2150 ;; Subscribe the new group after the group on the current line.
2151 (gnus-subscribe-group pgroup
(gnus-group-group-name) method
)
2152 (gnus-group-update-group pgroup
)
2154 (gnus-group-position-point)))
2156 (defun gnus-group-enter-directory (dir)
2157 "Enter an ephemeral nneething group."
2158 (interactive "DDirectory to read: ")
2159 (let* ((method (list 'nneething dir
'(nneething-read-only t
)))
2160 (leaf (gnus-group-prefixed-name
2161 (file-name-nondirectory (directory-file-name dir
))
2163 (name (gnus-generate-new-group-name leaf
)))
2164 (unless (gnus-group-read-ephemeral-group
2166 (cons (current-buffer)
2167 (if (eq major-mode
'gnus-summary-mode
)
2169 (error "Couldn't enter %s" dir
))))
2171 ;; Group sorting commands
2172 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>.
2174 (defun gnus-group-sort-groups (func &optional reverse
)
2175 "Sort the group buffer according to FUNC.
2176 When used interactively, the sorting function used will be
2177 determined by the `gnus-group-sort-function' variable.
2178 If REVERSE (the prefix), reverse the sorting order."
2179 (interactive (list gnus-group-sort-function current-prefix-arg
))
2180 (funcall gnus-group-sort-alist-function
2181 (gnus-make-sort-function func
) reverse
)
2182 (gnus-group-list-groups)
2183 (gnus-dribble-touch))
2185 (defun gnus-group-sort-flat (func reverse
)
2186 ;; We peel off the dummy group from the alist.
2188 (when (equal (gnus-info-group (car gnus-newsrc-alist
)) "dummy.group")
2189 (pop gnus-newsrc-alist
))
2191 (setq gnus-newsrc-alist
2192 (sort gnus-newsrc-alist func
))
2194 (setq gnus-newsrc-alist
(nreverse gnus-newsrc-alist
)))
2195 ;; Regenerate the hash table.
2196 (gnus-make-hashtable-from-newsrc-alist)))
2198 (defun gnus-group-sort-groups-by-alphabet (&optional reverse
)
2199 "Sort the group buffer alphabetically by group name.
2200 If REVERSE, sort in reverse order."
2202 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse
))
2204 (defun gnus-group-sort-groups-by-unread (&optional reverse
)
2205 "Sort the group buffer by number of unread articles.
2206 If REVERSE, sort in reverse order."
2208 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse
))
2210 (defun gnus-group-sort-groups-by-level (&optional reverse
)
2211 "Sort the group buffer by group level.
2212 If REVERSE, sort in reverse order."
2214 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse
))
2216 (defun gnus-group-sort-groups-by-score (&optional reverse
)
2217 "Sort the group buffer by group score.
2218 If REVERSE, sort in reverse order."
2220 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse
))
2222 (defun gnus-group-sort-groups-by-rank (&optional reverse
)
2223 "Sort the group buffer by group rank.
2224 If REVERSE, sort in reverse order."
2226 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse
))
2228 (defun gnus-group-sort-groups-by-method (&optional reverse
)
2229 "Sort the group buffer alphabetically by backend name.
2230 If REVERSE, sort in reverse order."
2232 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse
))
2234 ;;; Selected group sorting.
2236 (defun gnus-group-sort-selected-groups (n func
&optional reverse
)
2237 "Sort the process/prefixed groups."
2238 (interactive (list current-prefix-arg gnus-group-sort-function
))
2239 (let ((groups (gnus-group-process-prefix n
)))
2240 (funcall gnus-group-sort-selected-function
2241 groups
(gnus-make-sort-function func
) reverse
)
2242 (gnus-group-list-groups)))
2244 (defun gnus-group-sort-selected-flat (groups func reverse
)
2245 (let (entries infos
)
2246 ;; First find all the group entries for these groups.
2248 (push (nthcdr 2 (gnus-gethash (pop groups
) gnus-newsrc-hashtb
))
2250 ;; Then sort the infos.
2254 (lambda (entry) (car entry
))
2255 (setq entries
(nreverse entries
)))
2258 (setq infos
(nreverse infos
)))
2259 ;; Go through all the infos and replace the old entries
2260 ;; with the new infos.
2262 (setcar entries
(pop infos
))
2264 ;; Update the hashtable.
2265 (gnus-make-hashtable-from-newsrc-alist)))
2267 (defun gnus-group-sort-selected-groups-by-alphabet (&optional reverse
)
2268 "Sort the group buffer alphabetically by group name.
2269 If REVERSE, sort in reverse order."
2271 (gnus-group-sort-selected-groups 'gnus-group-sort-by-alphabet reverse
))
2273 (defun gnus-group-sort-selected-groups-by-unread (&optional reverse
)
2274 "Sort the group buffer by number of unread articles.
2275 If REVERSE, sort in reverse order."
2277 (gnus-group-sort-selected-groups 'gnus-group-sort-by-unread reverse
))
2279 (defun gnus-group-sort-selected-groups-by-level (&optional reverse
)
2280 "Sort the group buffer by group level.
2281 If REVERSE, sort in reverse order."
2283 (gnus-group-sort-selected-groups 'gnus-group-sort-by-level reverse
))
2285 (defun gnus-group-sort-selected-groups-by-score (&optional reverse
)
2286 "Sort the group buffer by group score.
2287 If REVERSE, sort in reverse order."
2289 (gnus-group-sort-selected-groups 'gnus-group-sort-by-score reverse
))
2291 (defun gnus-group-sort-selected-groups-by-rank (&optional reverse
)
2292 "Sort the group buffer by group rank.
2293 If REVERSE, sort in reverse order."
2295 (gnus-group-sort-selected-groups 'gnus-group-sort-by-rank reverse
))
2297 (defun gnus-group-sort-selected-groups-by-method (&optional reverse
)
2298 "Sort the group buffer alphabetically by backend name.
2299 If REVERSE, sort in reverse order."
2301 (gnus-group-sort-selected-groups 'gnus-group-sort-by-method reverse
))
2303 ;;; Sorting predicates.
2305 (defun gnus-group-sort-by-alphabet (info1 info2
)
2306 "Sort alphabetically."
2307 (string< (gnus-info-group info1
) (gnus-info-group info2
)))
2309 (defun gnus-group-sort-by-real-name (info1 info2
)
2310 "Sort alphabetically on real (unprefixed) names."
2311 (string< (gnus-group-real-name (gnus-info-group info1
))
2312 (gnus-group-real-name (gnus-info-group info2
))))
2314 (defun gnus-group-sort-by-unread (info1 info2
)
2315 "Sort by number of unread articles."
2316 (let ((n1 (car (gnus-gethash (gnus-info-group info1
) gnus-newsrc-hashtb
)))
2317 (n2 (car (gnus-gethash (gnus-info-group info2
) gnus-newsrc-hashtb
))))
2318 (< (or (and (numberp n1
) n1
) 0)
2319 (or (and (numberp n2
) n2
) 0))))
2321 (defun gnus-group-sort-by-level (info1 info2
)
2323 (< (gnus-info-level info1
) (gnus-info-level info2
)))
2325 (defun gnus-group-sort-by-method (info1 info2
)
2326 "Sort alphabetically by backend name."
2327 (string< (symbol-name (car (gnus-find-method-for-group
2328 (gnus-info-group info1
) info1
)))
2329 (symbol-name (car (gnus-find-method-for-group
2330 (gnus-info-group info2
) info2
)))))
2332 (defun gnus-group-sort-by-score (info1 info2
)
2333 "Sort by group score."
2334 (< (gnus-info-score info1
) (gnus-info-score info2
)))
2336 (defun gnus-group-sort-by-rank (info1 info2
)
2337 "Sort by level and score."
2338 (let ((level1 (gnus-info-level info1
))
2339 (level2 (gnus-info-level info2
)))
2340 (or (< level1 level2
)
2341 (and (= level1 level2
)
2342 (> (gnus-info-score info1
) (gnus-info-score info2
))))))
2346 (defun gnus-group-clear-data (&optional arg
)
2347 "Clear all marks and read ranges from the current group."
2349 (gnus-group-iterate arg
2352 (gnus-info-clear-data (setq info
(gnus-get-info group
)))
2353 (gnus-get-unread-articles-in-group info
(gnus-active group
) t
)
2354 (when (gnus-group-goto-group group
)
2355 (gnus-group-update-group-line))))))
2357 (defun gnus-group-clear-data-on-native-groups ()
2358 "Clear all marks and read ranges from all native groups."
2360 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ")
2361 (let ((alist (cdr gnus-newsrc-alist
))
2363 (while (setq info
(pop alist
))
2364 (when (gnus-group-native-p (gnus-info-group info
))
2365 (gnus-info-clear-data info
)))
2366 (gnus-get-unread-articles)
2367 (gnus-dribble-enter "")
2368 (when (gnus-y-or-n-p
2369 "Move the cache away to avoid problems in the future? ")
2370 (call-interactively 'gnus-cache-move-cache
)))))
2372 (defun gnus-info-clear-data (info)
2373 "Clear all marks and read ranges from INFO."
2374 (let ((group (gnus-info-group info
)))
2377 (gnus-info-set-marks ',info
',(gnus-info-marks info
) t
)
2378 (gnus-info-set-read ',info
',(gnus-info-read info
))
2379 (when (gnus-group-goto-group ,group
)
2380 (gnus-group-update-group-line))))
2381 (gnus-info-set-read info nil
)
2382 (when (gnus-info-marks info
)
2383 (gnus-info-set-marks info nil
))))
2385 ;; Group catching up.
2387 (defun gnus-group-catchup-current (&optional n all
)
2388 "Mark all articles not marked as unread in current newsgroup as read.
2389 If prefix argument N is numeric, the ARG next newsgroups will be
2390 caught up. If ALL is non-nil, marked articles will also be marked as
2391 read. Cross references (Xref: header) of articles are ignored.
2392 The difference between N and actual number of newsgroups that were
2393 caught up is returned."
2395 (unless (gnus-group-group-name)
2396 (error "No group on the current line"))
2397 (let ((groups (gnus-group-process-prefix n
))
2400 (or (not gnus-interactive-catchup
) ;Without confirmation?
2405 "Do you really want to mark all articles in %s as read? "
2406 "Mark all unread articles in %s as read? ")
2407 (if (= (length groups
) 1)
2409 (format "these %d groups" (length groups
)))))))
2412 ;; Virtual groups have to be given special treatment.
2413 (let ((method (gnus-find-method-for-group (car groups
))))
2414 (when (eq 'nnvirtual
(car method
))
2415 (nnvirtual-catchup-group
2416 (gnus-group-real-name (car groups
)) (nth 1 method
) all
)))
2417 (gnus-group-remove-mark (car groups
))
2418 (if (>= (gnus-group-group-level) gnus-level-zombie
)
2419 (gnus-message 2 "Dead groups can't be caught up")
2421 (gnus-group-goto-group (car groups
))
2422 (gnus-group-catchup (car groups
) all
))
2423 (gnus-group-update-group-line)
2424 (setq ret
(1+ ret
))))
2425 (setq groups
(cdr groups
)))
2426 (gnus-group-next-unread-group 1)
2429 (defun gnus-group-catchup-current-all (&optional n
)
2430 "Mark all articles in current newsgroup as read.
2431 Cross references (Xref: header) of articles are ignored."
2433 (gnus-group-catchup-current n
'all
))
2435 (defun gnus-group-catchup (group &optional all
)
2436 "Mark all articles in GROUP as read.
2437 If ALL is non-nil, all articles are marked as read.
2438 The return value is the number of articles that were marked as read,
2439 or nil if no action could be taken."
2440 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb
))
2442 ;; Do the updating only if the newsgroup isn't killed.
2443 (if (not (numberp (car entry
)))
2444 (gnus-message 1 "Can't catch up %s; non-active group" group
)
2445 ;; Do auto-expirable marks if that's required.
2446 (when (gnus-group-auto-expirable-p group
)
2447 (gnus-add-marked-articles
2448 group
'expire
(gnus-list-of-unread-articles group
))
2450 (let ((marks (nth 3 (nth 2 entry
))))
2451 (gnus-add-marked-articles
2452 group
'expire
(gnus-uncompress-range (cdr (assq 'tick marks
))))
2453 (gnus-add-marked-articles
2454 group
'expire
(gnus-uncompress-range (cdr (assq 'tick marks
)))))))
2456 (gnus-update-read-articles group nil
)
2457 ;; Also nix out the lists of marks and dormants.
2459 (gnus-add-marked-articles group
'tick nil nil
'force
)
2460 (gnus-add-marked-articles group
'dormant nil nil
'force
))
2461 (let ((gnus-newsgroup-name group
))
2462 (run-hooks 'gnus-group-catchup-group-hook
))
2465 (defun gnus-group-expire-articles (&optional n
)
2466 "Expire all expirable articles in the current newsgroup."
2468 (let ((groups (gnus-group-process-prefix n
))
2471 (error "No groups to expire"))
2472 (while (setq group
(pop groups
))
2473 (gnus-group-remove-mark group
)
2474 (when (gnus-check-backend-function 'request-expire-articles group
)
2475 (gnus-message 6 "Expiring articles in %s..." group
)
2476 (let* ((info (gnus-get-info group
))
2477 (expirable (if (gnus-group-total-expirable-p group
)
2478 (cons nil
(gnus-list-of-read-articles group
))
2479 (assq 'expire
(gnus-info-marks info
))))
2480 (expiry-wait (gnus-group-find-parameter group
'expiry-wait
)))
2484 (gnus-compress-sequence
2486 ;; We set the expiry variables to the group
2488 (let ((nnmail-expiry-wait-function nil
)
2489 (nnmail-expiry-wait expiry-wait
))
2490 (gnus-request-expire-articles
2491 (gnus-uncompress-sequence (cdr expirable
)) group
))
2492 ;; Just expire using the normal expiry values.
2493 (gnus-request-expire-articles
2494 (gnus-uncompress-sequence (cdr expirable
)) group
))))
2495 (gnus-close-group group
))
2496 (gnus-message 6 "Expiring articles in %s...done" group
)))
2497 (gnus-dribble-touch)
2498 (gnus-group-position-point))))
2500 (defun gnus-group-expire-all-groups ()
2501 "Expire all expirable articles in all newsgroups."
2504 (gnus-message 5 "Expiring...")
2505 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info
))
2506 (cdr gnus-newsrc-alist
))))
2507 (gnus-group-expire-articles nil
)))
2508 (gnus-group-position-point)
2509 (gnus-message 5 "Expiring...done"))
2511 (defun gnus-group-set-current-level (n level
)
2512 "Set the level of the next N groups to LEVEL."
2517 (let ((s (read-string
2518 (format "Level (default %s): "
2519 (or (gnus-group-group-level)
2520 gnus-level-default-subscribed
)))))
2521 (if (string-match "^\\s-*$" s
)
2522 (int-to-string (or (gnus-group-group-level)
2523 gnus-level-default-subscribed
))
2525 (unless (and (>= level
1) (<= level gnus-level-killed
))
2526 (error "Illegal level: %d" level
))
2527 (let ((groups (gnus-group-process-prefix n
))
2529 (while (setq group
(pop groups
))
2530 (gnus-group-remove-mark group
)
2531 (gnus-message 6 "Changed level of %s from %d to %d"
2532 group
(or (gnus-group-group-level) gnus-level-killed
)
2534 (gnus-group-change-level
2535 group level
(or (gnus-group-group-level) gnus-level-killed
))
2536 (gnus-group-update-group-line)))
2537 (gnus-group-position-point))
2539 (defun gnus-group-unsubscribe (&optional n
)
2540 "Unsubscribe the current group."
2542 (gnus-group-unsubscribe-current-group n
'unsubscribe
))
2544 (defun gnus-group-subscribe (&optional n
)
2545 "Subscribe the current group."
2547 (gnus-group-unsubscribe-current-group n
'subscribe
))
2549 (defun gnus-group-unsubscribe-current-group (&optional n do-sub
)
2550 "Toggle subscription of the current group.
2551 If given numerical prefix, toggle the N next groups."
2553 (let ((groups (gnus-group-process-prefix n
))
2556 (setq group
(car groups
)
2557 groups
(cdr groups
))
2558 (gnus-group-remove-mark group
)
2559 (gnus-group-unsubscribe-group
2562 ((eq do-sub
'unsubscribe
)
2563 gnus-level-default-unsubscribed
)
2564 ((eq do-sub
'subscribe
)
2565 gnus-level-default-subscribed
)
2566 ((<= (gnus-group-group-level) gnus-level-subscribed
)
2567 gnus-level-default-unsubscribed
)
2569 gnus-level-default-subscribed
))
2571 (gnus-group-update-group-line))
2572 (gnus-group-next-group 1)))
2574 (defun gnus-group-unsubscribe-group (group &optional level silent
)
2575 "Toggle subscription to GROUP.
2576 Killed newsgroups are subscribed. If SILENT, don't try to update the
2579 (list (completing-read
2580 "Group: " gnus-active-hashtb nil
2581 (gnus-read-active-file-p)
2583 'gnus-group-history
)))
2584 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb
)))
2586 ((string-match "^[ \t]$" group
)
2587 (error "Empty group name"))
2589 ;; Toggle subscription flag.
2590 (gnus-group-change-level
2591 newsrc
(if level level
(if (<= (gnus-info-level (nth 2 newsrc
))
2592 gnus-level-subscribed
)
2593 (1+ gnus-level-subscribed
)
2594 gnus-level-default-subscribed
)))
2596 (gnus-group-update-group group
)))
2597 ((and (stringp group
)
2598 (or (not (gnus-read-active-file-p))
2599 (gnus-active group
)))
2600 ;; Add new newsgroup.
2601 (gnus-group-change-level
2603 (if level level gnus-level-default-subscribed
)
2604 (or (and (member group gnus-zombie-list
)
2607 (when (gnus-group-group-name)
2608 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb
)))
2610 (gnus-group-update-group group
)))
2611 (t (error "No such newsgroup: %s" group
)))
2612 (gnus-group-position-point)))
2614 (defun gnus-group-transpose-groups (n)
2615 "Move the current newsgroup up N places.
2616 If given a negative prefix, move down instead. The difference between
2617 N and the number of steps taken is returned."
2619 (unless (gnus-group-group-name)
2620 (error "No group on current line"))
2621 (gnus-group-kill-group 1)
2623 (forward-line (- n
))
2624 (gnus-group-yank-group)
2625 (gnus-group-position-point)))
2627 (defun gnus-group-kill-all-zombies ()
2628 "Kill all zombie newsgroups."
2630 (setq gnus-killed-list
(nconc gnus-zombie-list gnus-killed-list
))
2631 (setq gnus-zombie-list nil
)
2632 (gnus-dribble-touch)
2633 (gnus-group-list-groups))
2635 (defun gnus-group-kill-region (begin end
)
2636 "Kill newsgroups in current region (excluding current point).
2637 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]."
2652 (beginning-of-line) ;Important when LINES < 1
2653 (gnus-group-kill-group lines
)))
2655 (defun gnus-group-kill-group (&optional n discard
)
2656 "Kill the next N groups.
2657 The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
2658 However, only groups that were alive can be yanked; already killed
2659 groups or zombie groups can't be yanked.
2660 The return value is the name of the group that was killed, or a list
2663 (let ((buffer-read-only nil
)
2664 (groups (gnus-group-process-prefix n
))
2665 group entry level out
)
2666 (if (< (length groups
) 10)
2667 ;; This is faster when there are few groups.
2669 (push (setq group
(pop groups
)) out
)
2670 (gnus-group-remove-mark group
)
2671 (setq level
(gnus-group-group-level))
2673 (when (and (not discard
)
2674 (setq entry
(gnus-gethash group gnus-newsrc-hashtb
)))
2677 (gnus-group-goto-group ,(gnus-group-group-name))
2678 (gnus-group-yank-group)))
2679 (push (cons (car entry
) (nth 2 entry
))
2680 gnus-list-of-killed-groups
))
2681 (gnus-group-change-level
2682 (if entry entry group
) gnus-level-killed
(if entry nil level
)))
2683 ;; If there are lots and lots of groups to be killed, we use
2684 ;; this thing instead.
2686 (setq groups
(nreverse groups
))
2688 (gnus-group-remove-mark (setq group
(pop groups
)))
2690 (push group gnus-killed-list
)
2691 (setq gnus-newsrc-alist
2692 (delq (assoc group gnus-newsrc-alist
)
2694 (when gnus-group-change-level-function
2695 (funcall gnus-group-change-level-function group
9 3))
2697 ((setq entry
(gnus-gethash group gnus-newsrc-hashtb
))
2698 (push (cons (car entry
) (nth 2 entry
))
2699 gnus-list-of-killed-groups
)
2700 (setcdr (cdr entry
) (cdddr entry
)))
2701 ((member group gnus-zombie-list
)
2702 (setq gnus-zombie-list
(delete group gnus-zombie-list
)))))
2703 (gnus-make-hashtable-from-newsrc-alist)))
2705 (gnus-group-position-point)
2706 (if (< (length out
) 2) (car out
) (nreverse out
))))
2708 (defun gnus-group-yank-group (&optional arg
)
2709 "Yank the last newsgroups killed with \\[gnus-group-kill-group],
2710 inserting it before the current newsgroup. The numeric ARG specifies
2711 how many newsgroups are to be yanked. The name of the newsgroup yanked
2712 is returned, or (if several groups are yanked) a list of yanked groups
2715 (setq arg
(or arg
1))
2716 (let (info group prev out
)
2717 (while (>= (decf arg
) 0)
2718 (when (not (setq info
(pop gnus-list-of-killed-groups
)))
2719 (error "No more newsgroups to yank"))
2720 (push (setq group
(nth 1 info
)) out
)
2721 ;; Find which newsgroup to insert this one before - search
2722 ;; backward until something suitable is found. If there are no
2723 ;; other newsgroups in this buffer, just make this newsgroup the
2725 (setq prev
(gnus-group-group-name))
2726 (gnus-group-change-level
2727 info
(gnus-info-level (cdr info
)) gnus-level-killed
2728 (and prev
(gnus-gethash prev gnus-newsrc-hashtb
))
2730 (gnus-group-insert-group-line-info group
)
2732 `(when (gnus-group-goto-group ,group
)
2733 (gnus-group-kill-group 1))))
2735 (gnus-group-position-point)
2736 (if (< (length out
) 2) (car out
) (nreverse out
))))
2738 (defun gnus-group-kill-level (level)
2739 "Kill all groups that is on a certain LEVEL."
2740 (interactive "nKill all groups on level: ")
2742 ((= level gnus-level-zombie
)
2743 (setq gnus-killed-list
2744 (nconc gnus-zombie-list gnus-killed-list
))
2745 (setq gnus-zombie-list nil
))
2746 ((and (< level gnus-level-zombie
)
2748 (or gnus-expert-user
2751 "Do you really want to kill all groups on level %d? "
2753 (let* ((prev gnus-newsrc-alist
)
2756 (if (= (gnus-info-level (car alist
)) level
)
2758 (push (gnus-info-group (car alist
)) gnus-killed-list
)
2759 (setcdr prev
(cdr alist
)))
2761 (setq alist
(cdr alist
)))
2762 (gnus-make-hashtable-from-newsrc-alist)
2763 (gnus-group-list-groups)))
2765 (error "Can't kill; illegal level: %d" level
))))
2767 (defun gnus-group-list-all-groups (&optional arg
)
2768 "List all newsgroups with level ARG or lower.
2769 Default is gnus-level-unsubscribed, which lists all subscribed and most
2770 unsubscribed groups."
2772 (gnus-group-list-groups (or arg gnus-level-unsubscribed
) t
))
2774 ;; Redefine this to list ALL killed groups if prefix arg used.
2775 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom).
2776 (defun gnus-group-list-killed (&optional arg
)
2777 "List all killed newsgroups in the group buffer.
2778 If ARG is non-nil, list ALL killed groups known to Gnus. This may
2779 entail asking the server for the groups."
2781 ;; Find all possible killed newsgroups if arg.
2783 (gnus-get-killed-groups))
2784 (if (not gnus-killed-list
)
2785 (gnus-message 6 "No killed groups")
2786 (let (gnus-group-list-mode)
2787 (funcall gnus-group-prepare-function
2788 gnus-level-killed t gnus-level-killed
))
2789 (goto-char (point-min)))
2790 (gnus-group-position-point))
2792 (defun gnus-group-list-zombies ()
2793 "List all zombie newsgroups in the group buffer."
2795 (if (not gnus-zombie-list
)
2796 (gnus-message 6 "No zombie groups")
2797 (let (gnus-group-list-mode)
2798 (funcall gnus-group-prepare-function
2799 gnus-level-zombie t gnus-level-zombie
))
2800 (goto-char (point-min)))
2801 (gnus-group-position-point))
2803 (defun gnus-group-list-active ()
2804 "List all groups that are available from the server(s)."
2806 ;; First we make sure that we have really read the active file.
2807 (unless (gnus-read-active-file-p)
2808 (let ((gnus-read-active-file t
))
2809 (gnus-read-active-file)))
2810 ;; Find all groups and sort them.
2818 (push (symbol-name sym
) list
)))
2822 (buffer-read-only nil
)
2826 (gnus-add-text-properties
2827 (point) (prog1 (1+ (point))
2829 (setq group
(pop groups
)) "\n"))
2830 (list 'gnus-group
(gnus-intern-safe group gnus-active-hashtb
)
2832 'gnus-level
(inline (gnus-group-level group
)))))
2833 (goto-char (point-min))))
2835 (defun gnus-activate-all-groups (level)
2836 "Activate absolutely all groups."
2837 (interactive (list 7))
2838 (let ((gnus-activate-level level
)
2839 (gnus-activate-foreign-newsgroups level
))
2840 (gnus-group-get-new-news)))
2842 (defun gnus-group-get-new-news (&optional arg
)
2843 "Get newly arrived articles.
2844 If ARG is a number, it specifies which levels you are interested in
2845 re-scanning. If ARG is non-nil and not a number, this will force
2846 \"hard\" re-reading of the active files from all servers."
2848 (let ((gnus-inhibit-demon t
))
2849 (run-hooks 'gnus-get-new-news-hook
)
2851 ;; Read any slave files.
2853 (gnus-master-read-slave-newsrc))
2855 ;; We might read in new NoCeM messages here.
2856 (when (and gnus-use-nocem
2858 (gnus-nocem-scan-groups))
2859 ;; If ARG is not a number, then we read the active file.
2860 (when (and arg
(not (numberp arg
)))
2861 (let ((gnus-read-active-file t
))
2862 (gnus-read-active-file))
2865 ;; If the user wants it, we scan for new groups.
2866 (when (eq gnus-check-new-newsgroups
'always
)
2867 (gnus-find-new-newsgroups)))
2869 (setq arg
(gnus-group-default-level arg t
))
2870 (if (and gnus-read-active-file
(not arg
))
2872 (gnus-read-active-file)
2873 (gnus-get-unread-articles arg
))
2874 (let ((gnus-read-active-file (if arg nil gnus-read-active-file
)))
2875 (gnus-get-unread-articles arg
)))
2876 (run-hooks 'gnus-after-getting-new-news-hook
)
2877 (gnus-group-list-groups (and (numberp arg
)
2878 (max (car gnus-group-list-mode
) arg
)))))
2880 (defun gnus-group-get-new-news-this-group (&optional n
)
2881 "Check for newly arrived news in the current group (and the N-1 next groups).
2882 The difference between N and the number of newsgroup checked is returned.
2883 If N is negative, this group and the N-1 previous groups will be checked."
2885 (let* ((groups (gnus-group-process-prefix n
))
2886 (ret (if (numberp n
) (- n
(length groups
)) 0))
2890 (while (setq group
(pop groups
))
2891 (gnus-group-remove-mark group
)
2892 ;; Bypass any previous denials from the server.
2893 (gnus-remove-denial (gnus-find-method-for-group group
))
2894 (if (gnus-activate-group group
'scan
)
2896 (gnus-get-unread-articles-in-group
2897 (gnus-get-info group
) (gnus-active group
) t
)
2898 (unless (gnus-virtual-group-p group
)
2899 (gnus-close-group group
))
2900 (gnus-group-update-group group
))
2901 (if (eq (gnus-server-status (gnus-find-method-for-group group
))
2903 (gnus-error 3 "Server denied access")
2904 (gnus-error 3 "%s error: %s" group
(gnus-status-message group
)))))
2907 (when gnus-goto-next-group-when-activating
2908 (gnus-group-next-unread-group 1 t
))
2909 (gnus-summary-position-point)
2912 (defun gnus-group-fetch-faq (group &optional faq-dir
)
2913 "Fetch the FAQ for the current group.
2914 If given a prefix argument, prompt for the FAQ dir
2918 (gnus-group-group-name)
2919 (cond (current-prefix-arg
2921 "Faq dir: " (and (listp gnus-group-faq-directory
)
2922 (mapcar (lambda (file) (list file
))
2923 gnus-group-faq-directory
)))))))
2925 (error "No group name given"))
2926 (let ((dirs (or faq-dir gnus-group-faq-directory
))
2928 (unless (listp dirs
)
2929 (setq dirs
(list dirs
)))
2930 (while (and (not found
)
2931 (setq dir
(pop dirs
)))
2932 (setq file
(concat (file-name-as-directory dir
)
2933 (gnus-group-real-name group
)))
2934 (if (not (file-exists-p file
))
2935 (gnus-message 1 "No such file: %s" file
)
2936 (let ((enable-local-variables nil
))
2940 (defun gnus-group-describe-group (force &optional group
)
2941 "Display a description of the current newsgroup."
2942 (interactive (list current-prefix-arg
(gnus-group-group-name)))
2943 (let* ((method (gnus-find-method-for-group group
))
2944 (mname (gnus-group-prefixed-name "" method
))
2947 gnus-description-hashtb
)
2948 (gnus-sethash mname nil gnus-description-hashtb
))
2950 (error "No group name given"))
2951 (when (or (and gnus-description-hashtb
2952 ;; We check whether this group's method has been
2953 ;; queried for a description file.
2954 (gnus-gethash mname gnus-description-hashtb
))
2955 (setq desc
(gnus-group-get-description group
))
2956 (gnus-read-descriptions-file method
))
2958 (or desc
(gnus-gethash group gnus-description-hashtb
)
2959 "No description available")))))
2961 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
2962 (defun gnus-group-describe-all-groups (&optional force
)
2963 "Pop up a buffer with descriptions of all newsgroups."
2966 (setq gnus-description-hashtb nil
))
2967 (when (not (or gnus-description-hashtb
2968 (gnus-read-all-descriptions-files)))
2969 (error "Couldn't request descriptions file"))
2970 (let ((buffer-read-only nil
)
2976 (insert (format " *: %-20s %s\n" (symbol-name group
)
2977 (symbol-value group
)))
2978 (gnus-add-text-properties
2979 b
(1+ b
) (list 'gnus-group group
2980 'gnus-unread t
'gnus-marked nil
2981 'gnus-level
(1+ gnus-level-subscribed
))))
2982 gnus-description-hashtb
)
2983 (goto-char (point-min))
2984 (gnus-group-position-point)))
2986 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
2987 (defun gnus-group-apropos (regexp &optional search-description
)
2988 "List all newsgroups that have names that match a regexp."
2989 (interactive "sGnus apropos (regexp): ")
2991 (obuf (current-buffer))
2993 ;; Go through all newsgroups that are known to Gnus.
2996 (and (symbol-name group
)
2997 (string-match regexp
(symbol-name group
))
2998 (push (symbol-name group
) groups
)))
3000 ;; Also go through all descriptions that are known to Gnus.
3001 (when search-description
3004 (and (string-match regexp
(symbol-value group
))
3005 (gnus-active (symbol-name group
))
3006 (push (symbol-name group
) groups
)))
3007 gnus-description-hashtb
))
3009 (gnus-message 3 "No groups matched \"%s\"." regexp
)
3010 ;; Print out all the groups.
3012 (pop-to-buffer "*Gnus Help*")
3013 (buffer-disable-undo (current-buffer))
3015 (setq groups
(sort groups
'string
<))
3017 ;; Groups may be entered twice into the list of groups.
3018 (when (not (string= (car groups
) prev
))
3019 (insert (setq prev
(car groups
)) "\n")
3020 (when (and gnus-description-hashtb
3021 (setq des
(gnus-gethash (car groups
)
3022 gnus-description-hashtb
)))
3023 (insert " " des
"\n")))
3024 (setq groups
(cdr groups
)))
3025 (goto-char (point-min))))
3026 (pop-to-buffer obuf
)))
3028 (defun gnus-group-description-apropos (regexp)
3029 "List all newsgroups that have names or descriptions that match a regexp."
3030 (interactive "sGnus description apropos (regexp): ")
3031 (when (not (or gnus-description-hashtb
3032 (gnus-read-all-descriptions-files)))
3033 (error "Couldn't request descriptions file"))
3034 (gnus-group-apropos regexp t
))
3036 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
3037 (defun gnus-group-list-matching (level regexp
&optional all lowest
)
3038 "List all groups with unread articles that match REGEXP.
3039 If the prefix LEVEL is non-nil, it should be a number that says which
3040 level to cut off listing groups.
3041 If ALL, also list groups with no unread articles.
3042 If LOWEST, don't list groups with level lower than LOWEST.
3044 This command may read the active file."
3045 (interactive "P\nsList newsgroups matching: ")
3046 ;; First make sure active file has been read.
3048 (> (prefix-numeric-value level
) gnus-level-killed
))
3049 (gnus-get-killed-groups))
3050 (gnus-group-prepare-flat
3051 (or level gnus-level-subscribed
) all
(or lowest
1) regexp
)
3052 (goto-char (point-min))
3053 (gnus-group-position-point))
3055 (defun gnus-group-list-all-matching (level regexp
&optional lowest
)
3056 "List all groups that match REGEXP.
3057 If the prefix LEVEL is non-nil, it should be a number that says which
3058 level to cut off listing groups.
3059 If LOWEST, don't list groups with level lower than LOWEST."
3060 (interactive "P\nsList newsgroups matching: ")
3062 (setq level
(prefix-numeric-value level
)))
3063 (gnus-group-list-matching (or level gnus-level-killed
) regexp t lowest
))
3065 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
3066 (defun gnus-group-save-newsrc (&optional force
)
3067 "Save the Gnus startup files.
3068 If FORCE, force saving whether it is necessary or not."
3070 (gnus-save-newsrc-file force
))
3072 (defun gnus-group-restart (&optional arg
)
3073 "Force Gnus to read the .newsrc file."
3075 (when (gnus-yes-or-no-p
3076 (format "Are you sure you want to restart Gnus? "))
3077 (gnus-save-newsrc-file)
3081 (defun gnus-group-read-init-file ()
3082 "Read the Gnus elisp init file."
3084 (gnus-read-init-file))
3086 (defun gnus-group-check-bogus-groups (&optional silent
)
3087 "Check bogus newsgroups.
3088 If given a prefix, don't ask for confirmation before removing a bogus
3091 (gnus-check-bogus-newsgroups (and (not silent
) (not gnus-expert-user
)))
3092 (gnus-group-list-groups))
3094 (defun gnus-group-edit-global-kill (&optional article group
)
3095 "Edit the global kill file.
3096 If GROUP, edit that local kill file instead."
3098 (setq gnus-current-kill-article article
)
3099 (gnus-kill-file-edit-file group
)
3102 (substitute-command-keys
3103 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)"
3104 (if group
"local" "global")))))
3106 (defun gnus-group-edit-local-kill (article group
)
3107 "Edit a local kill file."
3108 (interactive (list nil
(gnus-group-group-name)))
3109 (gnus-group-edit-global-kill article group
))
3111 (defun gnus-group-force-update ()
3112 "Update `.newsrc' file."
3114 (gnus-save-newsrc-file))
3116 (defun gnus-group-suspend ()
3117 "Suspend the current Gnus session.
3118 In fact, cleanup buffers except for group mode buffer.
3119 The hook gnus-suspend-gnus-hook is called before actually suspending."
3121 (run-hooks 'gnus-suspend-gnus-hook
)
3122 ;; Kill Gnus buffers except for group mode buffer.
3123 (let* ((group-buf (get-buffer gnus-group-buffer
))
3124 ;; Do this on a separate list in case the user does a ^G before we finish
3126 (delete group-buf
(delete gnus-dribble-buffer
3127 (append gnus-buffer-list nil
)))))
3128 (while gnus-buffer-list
3129 (gnus-kill-buffer (pop gnus-buffer-list
)))
3130 (gnus-kill-gnus-frames)
3132 (setq gnus-buffer-list
(list group-buf
))
3133 (bury-buffer group-buf
)
3134 (delete-windows-on group-buf t
))))
3136 (defun gnus-group-clear-dribble ()
3137 "Clear all information from the dribble buffer."
3139 (gnus-dribble-clear)
3140 (gnus-message 7 "Cleared dribble buffer"))
3142 (defun gnus-group-exit ()
3143 "Quit reading news after updating .newsrc.eld and .newsrc.
3144 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3147 (or noninteractive
;For gnus-batch-kill
3148 (not gnus-interactive-exit
) ;Without confirmation
3150 (gnus-y-or-n-p "Are you sure you want to quit reading news? "))
3151 (run-hooks 'gnus-exit-gnus-hook
)
3152 ;; Offer to save data from non-quitted summary buffers.
3153 (gnus-offer-save-summaries)
3154 ;; Save the newsrc file(s).
3155 (gnus-save-newsrc-file)
3157 (gnus-close-backends)
3158 ;; Reset everything.
3160 ;; Allow the user to do things after cleaning up.
3161 (run-hooks 'gnus-after-exiting-gnus-hook
)))
3163 (defun gnus-group-quit ()
3164 "Quit reading news without updating .newsrc.eld or .newsrc.
3165 The hook `gnus-exit-gnus-hook' is called before actually exiting."
3167 (when (or noninteractive
;For gnus-batch-kill
3168 (zerop (buffer-size))
3169 (not (gnus-server-opened gnus-select-method
))
3171 (not gnus-current-startup-file
)
3173 (format "Quit reading news without saving %s? "
3174 (file-name-nondirectory gnus-current-startup-file
))))
3175 (run-hooks 'gnus-exit-gnus-hook
)
3176 (gnus-configure-windows 'group t
)
3178 (gnus-close-backends)
3180 (gnus-kill-buffer gnus-group-buffer
)
3181 ;; Allow the user to do things after cleaning up.
3182 (run-hooks 'gnus-after-exiting-gnus-hook
)))
3184 (defun gnus-group-describe-briefly ()
3185 "Give a one line description of the group mode commands."
3187 (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")))
3189 (defun gnus-group-browse-foreign-server (method)
3190 "Browse a foreign news server.
3191 If called interactively, this function will ask for a select method
3192 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where).
3193 If not, METHOD should be a list where the first element is the method
3194 and the second element is the address."
3196 (list (let ((how (completing-read
3198 (append gnus-valid-select-methods gnus-server-alist
)
3199 nil t
(cons "nntp" 0) 'gnus-method-history
)))
3200 ;; We either got a backend name or a virtual server name.
3201 ;; If the first, we also need an address.
3202 (if (assoc how gnus-valid-select-methods
)
3204 ;; Suggested by mapjph@bath.ac.uk.
3207 (mapcar (lambda (server) (list server
))
3208 gnus-secondary-servers
)))
3209 ;; We got a server name.
3211 (gnus-browse-foreign-server method
))
3213 (defun gnus-group-set-info (info &optional method-only-group part
)
3214 (let* ((entry (gnus-gethash
3215 (or method-only-group
(gnus-info-group info
))
3216 gnus-newsrc-hashtb
))
3218 (info (if method-only-group
(nth 2 entry
) info
))
3220 (when method-only-group
3222 (error "Trying to change non-existent group %s" method-only-group
))
3223 ;; We have received parts of the actual group info - either the
3224 ;; select method or the group parameters. We first check
3225 ;; whether we have to extend the info, and if so, do that.
3226 (let ((len (length info
))
3227 (total (if (eq part
'method
) 5 6)))
3229 (setcdr (nthcdr (1- len
) info
)
3230 (make-list (- total len
) nil
)))
3231 ;; Then we enter the new info.
3232 (setcar (nthcdr (1- total
) info
) part-info
)))
3234 ;; This is a new group, so we just create it.
3236 (set-buffer gnus-group-buffer
)
3237 (setq method
(gnus-info-method info
))
3238 (when (gnus-server-equal method
"native")
3241 (set-buffer gnus-group-buffer
)
3243 ;; It's a foreign group...
3244 (gnus-group-make-group
3245 (gnus-group-real-name (gnus-info-group info
))
3246 (if (stringp method
) method
3247 (prin1-to-string (car method
)))
3249 (nth 1 (gnus-info-method info
))))
3250 ;; It's a native group.
3251 (gnus-group-make-group (gnus-info-group info
))))
3252 (gnus-message 6 "Note: New group created")
3254 (gnus-gethash (gnus-group-prefixed-name
3255 (gnus-group-real-name (gnus-info-group info
))
3256 (or (gnus-info-method info
) gnus-select-method
))
3257 gnus-newsrc-hashtb
))))
3258 ;; Whether it was a new group or not, we now have the entry, so we
3259 ;; can do the update.
3262 (setcar (nthcdr 2 entry
) info
)
3263 (when (and (not (eq (car entry
) t
))
3264 (gnus-active (gnus-info-group info
)))
3265 (setcar entry
(length (gnus-list-of-unread-articles (car info
))))))
3266 (error "No such group: %s" (gnus-info-group info
)))))
3268 (defun gnus-group-set-method-info (group select-method
)
3269 (gnus-group-set-info select-method group
'method
))
3271 (defun gnus-group-set-params-info (group params
)
3272 (gnus-group-set-info params group
'params
))
3274 (defun gnus-add-marked-articles (group type articles
&optional info force
)
3275 ;; Add ARTICLES of TYPE to the info of GROUP.
3276 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't
3277 ;; add, but replace marked articles of TYPE with ARTICLES.
3278 (let ((info (or info
(gnus-get-info group
)))
3279 (uncompressed '(score bookmark killed
))
3282 (and (not (setq marked
(nthcdr 3 info
)))
3284 (setcdr (nthcdr 2 info
)
3285 (list (list (cons type
(gnus-compress-sequence
3287 (and (not (setq m
(assq type
(car marked
))))
3290 (cons (cons type
(gnus-compress-sequence articles t
) )
3294 (setcar (nthcdr 3 info
)
3295 (delq (assq type
(car marked
)) (car marked
)))
3296 (setcdr m
(gnus-compress-sequence articles t
)))
3297 (setcdr m
(gnus-compress-sequence
3298 (sort (nconc (gnus-uncompress-range (cdr m
))
3299 (copy-sequence articles
)) '<) t
))))))
3302 ;;; Group timestamps
3305 (defun gnus-group-set-timestamp ()
3306 "Change the timestamp of the current group to the current time.
3307 This function can be used in hooks like `gnus-select-group-hook'
3308 or `gnus-group-catchup-group-hook'."
3309 (when gnus-newsgroup-name
3310 (let ((time (current-time)))
3311 (setcdr (cdr time
) nil
)
3312 (gnus-group-set-parameter gnus-newsgroup-name
'timestamp time
))))
3314 (defsubst gnus-group-timestamp
(group)
3315 "Return the timestamp for GROUP."
3316 (gnus-group-get-parameter group
'timestamp
))
3318 (defun gnus-group-timestamp-delta (group)
3319 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number."
3320 (let* ((time (or (gnus-group-timestamp group
)
3322 (delta (gnus-time-minus (current-time) time
)))
3323 (+ (* (nth 0 delta
) 65536.0)
3326 (defun gnus-group-timestamp-string (group)
3327 "Return a string of the timestamp for GROUP."
3328 (let ((time (gnus-group-timestamp group
)))
3331 (gnus-time-iso8601 time
))))
3333 (provide 'gnus-group
)
3335 ;;; gnus-group.el ends here