Mercurial > emacs
annotate lisp/gnus/gnus-group.el @ 26657:b5c0d55411ad
(set-face-documentation): Purecopy STRING.
author | Dave Love <fx@gnu.org> |
---|---|
date | Tue, 30 Nov 1999 13:55:34 +0000 |
parents | d0ccf995f1ae |
children | 9968f55ad26e |
rev | line source |
---|---|
17493 | 1 ;;; gnus-group.el --- group mode commands for Gnus |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc. |
17493 | 3 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
17493 | 5 ;; Keywords: news |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
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) | |
12 ;; any later version. | |
13 | |
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. | |
18 | |
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. | |
23 | |
24 ;;; Commentary: | |
25 | |
26 ;;; Code: | |
27 | |
19521
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
18575
diff
changeset
|
28 (eval-when-compile (require 'cl)) |
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
18575
diff
changeset
|
29 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
30 (eval-when-compile (require 'cl)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
31 |
17493 | 32 (require 'gnus) |
33 (require 'gnus-start) | |
34 (require 'nnmail) | |
35 (require 'gnus-spec) | |
36 (require 'gnus-int) | |
37 (require 'gnus-range) | |
38 (require 'gnus-win) | |
39 (require 'gnus-undo) | |
40 | |
41 (defcustom gnus-group-archive-directory | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
42 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list/" |
17493 | 43 "*The address of the (ding) archives." |
44 :group 'gnus-group-foreign | |
45 :type 'directory) | |
46 | |
47 (defcustom gnus-group-recent-archive-directory | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
48 "*ftp@ftp.hpc.uh.edu:/pub/emacs/ding-list-recent/" |
17493 | 49 "*The address of the most recent (ding) articles." |
50 :group 'gnus-group-foreign | |
51 :type 'directory) | |
52 | |
53 (defcustom gnus-no-groups-message "No news is no news" | |
54 "*Message displayed by Gnus when no groups are available." | |
55 :group 'gnus-start | |
56 :type 'string) | |
57 | |
58 (defcustom gnus-keep-same-level nil | |
59 "*Non-nil means that the next newsgroup after the current will be on the same level. | |
60 When you type, for instance, `n' after reading the last article in the | |
61 current newsgroup, you will go to the next newsgroup. If this variable | |
62 is nil, the next newsgroup will be the next from the group | |
63 buffer. | |
64 If this variable is non-nil, Gnus will either put you in the | |
65 next newsgroup with the same level, or, if no such newsgroup is | |
66 available, the next newsgroup with the lowest possible level higher | |
67 than the current level. | |
68 If this variable is `best', Gnus will make the next newsgroup the one | |
69 with the best level." | |
70 :group 'gnus-group-levels | |
71 :type '(choice (const nil) | |
72 (const best) | |
73 (sexp :tag "other" t))) | |
74 | |
75 (defcustom gnus-group-goto-unread t | |
76 "*If non-nil, movement commands will go to the next unread and subscribed group." | |
77 :link '(custom-manual "(gnus)Group Maneuvering") | |
78 :group 'gnus-group-various | |
79 :type 'boolean) | |
80 | |
81 (defcustom gnus-goto-next-group-when-activating t | |
82 "*If non-nil, the \\<gnus-group-mode-map>\\[gnus-group-get-new-news-this-group] command will advance point to the next group." | |
83 :link '(custom-manual "(gnus)Scanning New Messages") | |
84 :group 'gnus-group-various | |
85 :type 'boolean) | |
86 | |
87 (defcustom gnus-permanently-visible-groups nil | |
88 "*Regexp to match groups that should always be listed in the group buffer. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
89 This means that they will still be listed even when there are no |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
90 unread articles in the groups. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
91 |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
92 If nil, no groups are permanently visible." |
17493 | 93 :group 'gnus-group-listing |
24834
d0ccf995f1ae
(gnus-permanently-visible-groups): Fix custom type.
Karl Heuer <kwzh@gnu.org>
parents:
24357
diff
changeset
|
94 :type '(choice regexp (const nil))) |
17493 | 95 |
96 (defcustom gnus-list-groups-with-ticked-articles t | |
97 "*If non-nil, list groups that have only ticked articles. | |
98 If nil, only list groups that have unread articles." | |
99 :group 'gnus-group-listing | |
100 :type 'boolean) | |
101 | |
102 (defcustom gnus-group-default-list-level gnus-level-subscribed | |
103 "*Default listing level. | |
104 Ignored if `gnus-group-use-permanent-levels' is non-nil." | |
105 :group 'gnus-group-listing | |
106 :type 'integer) | |
107 | |
108 (defcustom gnus-group-list-inactive-groups t | |
109 "*If non-nil, inactive groups will be listed." | |
110 :group 'gnus-group-listing | |
111 :group 'gnus-group-levels | |
112 :type 'boolean) | |
113 | |
114 (defcustom gnus-group-sort-function 'gnus-group-sort-by-alphabet | |
115 "*Function used for sorting the group buffer. | |
116 This function will be called with group info entries as the arguments | |
117 for the groups to be sorted. Pre-made functions include | |
118 `gnus-group-sort-by-alphabet', `gnus-group-sort-by-real-name', | |
119 `gnus-group-sort-by-unread', `gnus-group-sort-by-level', | |
120 `gnus-group-sort-by-score', `gnus-group-sort-by-method', and | |
121 `gnus-group-sort-by-rank'. | |
122 | |
123 This variable can also be a list of sorting functions. In that case, | |
124 the most significant sort function should be the last function in the | |
125 list." | |
126 :group 'gnus-group-listing | |
127 :link '(custom-manual "(gnus)Sorting Groups") | |
128 :type '(radio (function-item gnus-group-sort-by-alphabet) | |
129 (function-item gnus-group-sort-by-real-name) | |
130 (function-item gnus-group-sort-by-unread) | |
131 (function-item gnus-group-sort-by-level) | |
132 (function-item gnus-group-sort-by-score) | |
133 (function-item gnus-group-sort-by-method) | |
134 (function-item gnus-group-sort-by-rank) | |
135 (function :tag "other" nil))) | |
136 | |
137 (defcustom gnus-group-line-format "%M\%S\%p\%P\%5y: %(%g%)%l\n" | |
138 "*Format of group lines. | |
139 It works along the same lines as a normal formatting string, | |
140 with some simple extensions. | |
141 | |
142 %M Only marked articles (character, \"*\" or \" \") | |
143 %S Whether the group is subscribed (character, \"U\", \"K\", \"Z\" or \" \") | |
144 %L Level of subscribedness (integer) | |
145 %N Number of unread articles (integer) | |
146 %I Number of dormant articles (integer) | |
147 %i Number of ticked and dormant (integer) | |
148 %T Number of ticked articles (integer) | |
149 %R Number of read articles (integer) | |
150 %t Estimated total number of articles (integer) | |
151 %y Number of unread, unticked articles (integer) | |
152 %G Group name (string) | |
153 %g Qualified group name (string) | |
154 %D Group description (string) | |
155 %s Select method (string) | |
156 %o Moderated group (char, \"m\") | |
157 %p Process mark (char) | |
158 %O Moderated group (string, \"(m)\" or \"\") | |
159 %P Topic indentation (string) | |
160 %m Whether there is new(ish) mail in the group (char, \"%\") | |
161 %l Whether there are GroupLens predictions for this group (string) | |
162 %n Select from where (string) | |
163 %z A string that look like `<%s:%n>' if a foreign select method is used | |
164 %d The date the group was last entered. | |
165 %u User defined specifier. The next character in the format string should | |
166 be a letter. Gnus will call the function gnus-user-format-function-X, | |
167 where X is the letter following %u. The function will be passed the | |
168 current header as argument. The function should return a string, which | |
169 will be inserted into the buffer just like information from any other | |
170 group specifier. | |
171 | |
172 Text between %( and %) will be highlighted with `gnus-mouse-face' when | |
173 the mouse point move inside the area. There can only be one such area. | |
174 | |
175 Note that this format specification is not always respected. For | |
176 reasons of efficiency, when listing killed groups, this specification | |
177 is ignored altogether. If the spec is changed considerably, your | |
178 output may end up looking strange when listing both alive and killed | |
179 groups. | |
180 | |
181 If you use %o or %O, reading the active file will be slower and quite | |
182 a bit of extra memory will be used. %D will also worsen performance. | |
183 Also note that if you change the format specification to include any | |
184 of these specs, you must probably re-start Gnus to see them go into | |
185 effect." | |
186 :group 'gnus-group-visual | |
187 :type 'string) | |
188 | |
189 (defcustom gnus-group-mode-line-format "Gnus: %%b {%M\%:%S}" | |
190 "*The format specification for the group mode line. | |
191 It works along the same lines as a normal formatting string, | |
192 with some simple extensions: | |
193 | |
194 %S The native news server. | |
195 %M The native select method. | |
196 %: \":\" if %S isn't \"\"." | |
197 :group 'gnus-group-visual | |
198 :type 'string) | |
199 | |
200 (defcustom gnus-group-mode-hook nil | |
201 "Hook for Gnus group mode." | |
202 :group 'gnus-group-various | |
203 :options '(gnus-topic-mode) | |
204 :type 'hook) | |
205 | |
206 (defcustom gnus-group-menu-hook nil | |
207 "Hook run after the creation of the group mode menu." | |
208 :group 'gnus-group-various | |
209 :type 'hook) | |
210 | |
211 (defcustom gnus-group-catchup-group-hook nil | |
212 "Hook run when catching up a group from the group buffer." | |
213 :group 'gnus-group-various | |
214 :link '(custom-manual "(gnus)Group Data") | |
215 :type 'hook) | |
216 | |
217 (defcustom gnus-group-update-group-hook nil | |
218 "Hook called when updating group lines." | |
219 :group 'gnus-group-visual | |
220 :type 'hook) | |
221 | |
222 (defcustom gnus-group-prepare-function 'gnus-group-prepare-flat | |
223 "*A function that is called to generate the group buffer. | |
224 The function is called with three arguments: The first is a number; | |
225 all group with a level less or equal to that number should be listed, | |
226 if the second is non-nil, empty groups should also be displayed. If | |
227 the third is non-nil, it is a number. No groups with a level lower | |
228 than this number should be displayed. | |
229 | |
230 The only current function implemented is `gnus-group-prepare-flat'." | |
231 :group 'gnus-group-listing | |
232 :type 'function) | |
233 | |
234 (defcustom gnus-group-prepare-hook nil | |
235 "Hook called after the group buffer has been generated. | |
236 If you want to modify the group buffer, you can use this hook." | |
237 :group 'gnus-group-listing | |
238 :type 'hook) | |
239 | |
240 (defcustom gnus-suspend-gnus-hook nil | |
241 "Hook called when suspending (not exiting) Gnus." | |
242 :group 'gnus-exit | |
243 :type 'hook) | |
244 | |
245 (defcustom gnus-exit-gnus-hook nil | |
246 "Hook called when exiting Gnus." | |
247 :group 'gnus-exit | |
248 :type 'hook) | |
249 | |
250 (defcustom gnus-after-exiting-gnus-hook nil | |
251 "Hook called after exiting Gnus." | |
252 :group 'gnus-exit | |
253 :type 'hook) | |
254 | |
255 (defcustom gnus-group-update-hook '(gnus-group-highlight-line) | |
256 "Hook called when a group line is changed. | |
257 The hook will not be called if `gnus-visual' is nil. | |
258 | |
259 The default function `gnus-group-highlight-line' will | |
260 highlight the line according to the `gnus-group-highlight' | |
261 variable." | |
262 :group 'gnus-group-visual | |
263 :type 'hook) | |
264 | |
265 (defcustom gnus-useful-groups | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
266 '(("(ding) mailing list mirrored at sunsite.auc.dk" |
17493 | 267 "emacs.ding" |
268 (nntp "sunsite.auc.dk" | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
269 (nntp-address "sunsite.auc.dk"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
270 ("gnus-bug archive" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
271 "gnus-bug" |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
272 (nndir "/ftp@ftp.ifi.uio.no:/pub/emacs/gnus/gnus-bug/")) |
17493 | 273 ("Gnus help group" |
274 "gnus-help" | |
275 (nndoc "gnus-help" | |
276 (nndoc-article-type mbox) | |
277 (eval `(nndoc-address | |
278 ,(let ((file (nnheader-find-etc-directory | |
279 "gnus-tut.txt" t))) | |
280 (unless file | |
281 (error "Couldn't find doc group")) | |
282 file)))))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
283 "*Alist of useful group-server pairs." |
17493 | 284 :group 'gnus-group-listing |
285 :type '(repeat (list (string :tag "Description") | |
286 (string :tag "Name") | |
287 (sexp :tag "Method")))) | |
288 | |
289 (defcustom gnus-group-highlight | |
290 '(;; News. | |
291 ((and (= unread 0) (not mailp) (eq level 1)) . | |
292 gnus-group-news-1-empty-face) | |
293 ((and (not mailp) (eq level 1)) . | |
294 gnus-group-news-1-face) | |
295 ((and (= unread 0) (not mailp) (eq level 2)) . | |
296 gnus-group-news-2-empty-face) | |
297 ((and (not mailp) (eq level 2)) . | |
298 gnus-group-news-2-face) | |
299 ((and (= unread 0) (not mailp) (eq level 3)) . | |
300 gnus-group-news-3-empty-face) | |
301 ((and (not mailp) (eq level 3)) . | |
302 gnus-group-news-3-face) | |
303 ((and (= unread 0) (not mailp)) . | |
304 gnus-group-news-low-empty-face) | |
305 ((and (not mailp)) . | |
306 gnus-group-news-low-face) | |
307 ;; Mail. | |
308 ((and (= unread 0) (eq level 1)) . | |
309 gnus-group-mail-1-empty-face) | |
310 ((eq level 1) . | |
311 gnus-group-mail-1-face) | |
312 ((and (= unread 0) (eq level 2)) . | |
313 gnus-group-mail-2-empty-face) | |
314 ((eq level 2) . | |
315 gnus-group-mail-2-face) | |
316 ((and (= unread 0) (eq level 3)) . | |
317 gnus-group-mail-3-empty-face) | |
318 ((eq level 3) . | |
319 gnus-group-mail-3-face) | |
320 ((= unread 0) . | |
321 gnus-group-mail-low-empty-face) | |
322 (t . | |
323 gnus-group-mail-low-face)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
324 "*Controls the highlighting of group buffer lines. |
17493 | 325 |
326 Below is a list of `Form'/`Face' pairs. When deciding how a a | |
327 particular group line should be displayed, each form is | |
328 evaluated. The content of the face field after the first true form is | |
329 used. You can change how those group lines are displayed by | |
330 editing the face field. | |
331 | |
332 It is also possible to change and add form fields, but currently that | |
333 requires an understanding of Lisp expressions. Hopefully this will | |
334 change in a future release. For now, you can use the following | |
335 variables in the Lisp expression: | |
336 | |
337 group: The name of the group. | |
338 unread: The number of unread articles in the group. | |
339 method: The select method used. | |
340 mailp: Whether it's a mail group or not. | |
341 level: The level of the group. | |
342 score: The score of the group. | |
343 ticked: The number of ticked articles." | |
344 :group 'gnus-group-visual | |
345 :type '(repeat (cons (sexp :tag "Form") face))) | |
346 | |
347 (defcustom gnus-new-mail-mark ?% | |
348 "Mark used for groups with new mail." | |
349 :group 'gnus-group-visual | |
350 :type 'character) | |
351 | |
352 ;;; Internal variables | |
353 | |
354 (defvar gnus-group-sort-alist-function 'gnus-group-sort-flat | |
355 "Function for sorting the group buffer.") | |
356 | |
357 (defvar gnus-group-sort-selected-function 'gnus-group-sort-selected-flat | |
358 "Function for sorting the selected groups in the group buffer.") | |
359 | |
360 (defvar gnus-group-indentation-function nil) | |
361 (defvar gnus-goto-missing-group-function nil) | |
362 (defvar gnus-group-update-group-function nil) | |
363 (defvar gnus-group-goto-next-group-function nil | |
364 "Function to override finding the next group after listing groups.") | |
365 | |
366 (defvar gnus-group-edit-buffer nil) | |
367 | |
368 (defvar gnus-group-line-format-alist | |
369 `((?M gnus-tmp-marked-mark ?c) | |
370 (?S gnus-tmp-subscribed ?c) | |
371 (?L gnus-tmp-level ?d) | |
372 (?N (cond ((eq number t) "*" ) | |
373 ((numberp number) | |
374 (int-to-string | |
375 (+ number | |
376 (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) | |
377 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))))) | |
378 (t number)) ?s) | |
379 (?R gnus-tmp-number-of-read ?s) | |
380 (?t gnus-tmp-number-total ?d) | |
381 (?y gnus-tmp-number-of-unread ?s) | |
382 (?I (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) ?d) | |
383 (?T (gnus-range-length (cdr (assq 'tick gnus-tmp-marked))) ?d) | |
384 (?i (+ (gnus-range-length (cdr (assq 'dormant gnus-tmp-marked))) | |
385 (gnus-range-length (cdr (assq 'tick gnus-tmp-marked)))) ?d) | |
386 (?g gnus-tmp-group ?s) | |
387 (?G gnus-tmp-qualified-group ?s) | |
388 (?c (gnus-short-group-name gnus-tmp-group) ?s) | |
389 (?D gnus-tmp-newsgroup-description ?s) | |
390 (?o gnus-tmp-moderated ?c) | |
391 (?O gnus-tmp-moderated-string ?s) | |
392 (?p gnus-tmp-process-marked ?c) | |
393 (?s gnus-tmp-news-server ?s) | |
394 (?n gnus-tmp-news-method ?s) | |
395 (?P gnus-group-indentation ?s) | |
396 (?l gnus-tmp-grouplens ?s) | |
397 (?z gnus-tmp-news-method-string ?s) | |
398 (?m (gnus-group-new-mail gnus-tmp-group) ?c) | |
399 (?d (gnus-group-timestamp-string gnus-tmp-group) ?s) | |
400 (?u gnus-tmp-user-defined ?s))) | |
401 | |
402 (defvar gnus-group-mode-line-format-alist | |
403 `((?S gnus-tmp-news-server ?s) | |
404 (?M gnus-tmp-news-method ?s) | |
405 (?u gnus-tmp-user-defined ?s) | |
406 (?: gnus-tmp-colon ?s))) | |
407 | |
408 (defvar gnus-topic-topology nil | |
409 "The complete topic hierarchy.") | |
410 | |
411 (defvar gnus-topic-alist nil | |
412 "The complete topic-group alist.") | |
413 | |
414 (defvar gnus-group-marked nil) | |
415 | |
416 (defvar gnus-group-list-mode nil) | |
417 | |
418 ;;; | |
419 ;;; Gnus group mode | |
420 ;;; | |
421 | |
422 (put 'gnus-group-mode 'mode-class 'special) | |
423 | |
424 (when t | |
425 (gnus-define-keys gnus-group-mode-map | |
426 " " gnus-group-read-group | |
427 "=" gnus-group-select-group | |
428 "\r" gnus-group-select-group | |
429 "\M-\r" gnus-group-quick-select-group | |
430 [(meta control return)] gnus-group-select-group-ephemerally | |
431 "j" gnus-group-jump-to-group | |
432 "n" gnus-group-next-unread-group | |
433 "p" gnus-group-prev-unread-group | |
434 "\177" gnus-group-prev-unread-group | |
435 [delete] gnus-group-prev-unread-group | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
436 [backspace] gnus-group-prev-unread-group |
17493 | 437 "N" gnus-group-next-group |
438 "P" gnus-group-prev-group | |
439 "\M-n" gnus-group-next-unread-group-same-level | |
440 "\M-p" gnus-group-prev-unread-group-same-level | |
441 "," gnus-group-best-unread-group | |
442 "." gnus-group-first-unread-group | |
443 "u" gnus-group-unsubscribe-current-group | |
444 "U" gnus-group-unsubscribe-group | |
445 "c" gnus-group-catchup-current | |
446 "C" gnus-group-catchup-current-all | |
447 "\M-c" gnus-group-clear-data | |
448 "l" gnus-group-list-groups | |
449 "L" gnus-group-list-all-groups | |
450 "m" gnus-group-mail | |
451 "g" gnus-group-get-new-news | |
452 "\M-g" gnus-group-get-new-news-this-group | |
453 "R" gnus-group-restart | |
454 "r" gnus-group-read-init-file | |
455 "B" gnus-group-browse-foreign-server | |
456 "b" gnus-group-check-bogus-groups | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
457 "F" gnus-group-find-new-groups |
17493 | 458 "\C-c\C-d" gnus-group-describe-group |
459 "\M-d" gnus-group-describe-all-groups | |
460 "\C-c\C-a" gnus-group-apropos | |
461 "\C-c\M-\C-a" gnus-group-description-apropos | |
462 "a" gnus-group-post-news | |
463 "\ek" gnus-group-edit-local-kill | |
464 "\eK" gnus-group-edit-global-kill | |
465 "\C-k" gnus-group-kill-group | |
466 "\C-y" gnus-group-yank-group | |
467 "\C-w" gnus-group-kill-region | |
468 "\C-x\C-t" gnus-group-transpose-groups | |
469 "\C-c\C-l" gnus-group-list-killed | |
470 "\C-c\C-x" gnus-group-expire-articles | |
471 "\C-c\M-\C-x" gnus-group-expire-all-groups | |
472 "V" gnus-version | |
473 "s" gnus-group-save-newsrc | |
474 "z" gnus-group-suspend | |
475 "q" gnus-group-exit | |
476 "Q" gnus-group-quit | |
477 "?" gnus-group-describe-briefly | |
478 "\C-c\C-i" gnus-info-find-node | |
479 "\M-e" gnus-group-edit-group-method | |
480 "^" gnus-group-enter-server-mode | |
481 gnus-mouse-2 gnus-mouse-pick-group | |
482 "<" beginning-of-buffer | |
483 ">" end-of-buffer | |
484 "\C-c\C-b" gnus-bug | |
485 "\C-c\C-s" gnus-group-sort-groups | |
486 "t" gnus-topic-mode | |
487 "\C-c\M-g" gnus-activate-all-groups | |
488 "\M-&" gnus-group-universal-argument | |
489 "#" gnus-group-mark-group | |
490 "\M-#" gnus-group-unmark-group) | |
491 | |
492 (gnus-define-keys (gnus-group-mark-map "M" gnus-group-mode-map) | |
493 "m" gnus-group-mark-group | |
494 "u" gnus-group-unmark-group | |
495 "w" gnus-group-mark-region | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
496 "b" gnus-group-mark-buffer |
17493 | 497 "r" gnus-group-mark-regexp |
498 "U" gnus-group-unmark-all-groups) | |
499 | |
500 (gnus-define-keys (gnus-group-group-map "G" gnus-group-mode-map) | |
501 "d" gnus-group-make-directory-group | |
502 "h" gnus-group-make-help-group | |
503 "u" gnus-group-make-useful-group | |
504 "a" gnus-group-make-archive-group | |
505 "k" gnus-group-make-kiboze-group | |
506 "m" gnus-group-make-group | |
507 "E" gnus-group-edit-group | |
508 "e" gnus-group-edit-group-method | |
509 "p" gnus-group-edit-group-parameters | |
510 "v" gnus-group-add-to-virtual | |
511 "V" gnus-group-make-empty-virtual | |
512 "D" gnus-group-enter-directory | |
513 "f" gnus-group-make-doc-group | |
514 "w" gnus-group-make-web-group | |
515 "r" gnus-group-rename-group | |
516 "c" gnus-group-customize | |
517 "\177" gnus-group-delete-group | |
518 [delete] gnus-group-delete-group) | |
519 | |
520 (gnus-define-keys (gnus-group-soup-map "s" gnus-group-group-map) | |
521 "b" gnus-group-brew-soup | |
522 "w" gnus-soup-save-areas | |
523 "s" gnus-soup-send-replies | |
524 "p" gnus-soup-pack-packet | |
525 "r" nnsoup-pack-replies) | |
526 | |
527 (gnus-define-keys (gnus-group-sort-map "S" gnus-group-group-map) | |
528 "s" gnus-group-sort-groups | |
529 "a" gnus-group-sort-groups-by-alphabet | |
530 "u" gnus-group-sort-groups-by-unread | |
531 "l" gnus-group-sort-groups-by-level | |
532 "v" gnus-group-sort-groups-by-score | |
533 "r" gnus-group-sort-groups-by-rank | |
534 "m" gnus-group-sort-groups-by-method) | |
535 | |
536 (gnus-define-keys (gnus-group-sort-selected-map "P" gnus-group-group-map) | |
537 "s" gnus-group-sort-selected-groups | |
538 "a" gnus-group-sort-selected-groups-by-alphabet | |
539 "u" gnus-group-sort-selected-groups-by-unread | |
540 "l" gnus-group-sort-selected-groups-by-level | |
541 "v" gnus-group-sort-selected-groups-by-score | |
542 "r" gnus-group-sort-selected-groups-by-rank | |
543 "m" gnus-group-sort-selected-groups-by-method) | |
544 | |
545 (gnus-define-keys (gnus-group-list-map "A" gnus-group-mode-map) | |
546 "k" gnus-group-list-killed | |
547 "z" gnus-group-list-zombies | |
548 "s" gnus-group-list-groups | |
549 "u" gnus-group-list-all-groups | |
550 "A" gnus-group-list-active | |
551 "a" gnus-group-apropos | |
552 "d" gnus-group-description-apropos | |
553 "m" gnus-group-list-matching | |
554 "M" gnus-group-list-all-matching | |
555 "l" gnus-group-list-level) | |
556 | |
557 (gnus-define-keys (gnus-group-score-map "W" gnus-group-mode-map) | |
558 "f" gnus-score-flush-cache) | |
559 | |
560 (gnus-define-keys (gnus-group-help-map "H" gnus-group-mode-map) | |
561 "d" gnus-group-describe-group | |
562 "f" gnus-group-fetch-faq | |
563 "v" gnus-version) | |
564 | |
565 (gnus-define-keys (gnus-group-sub-map "S" gnus-group-mode-map) | |
566 "l" gnus-group-set-current-level | |
567 "t" gnus-group-unsubscribe-current-group | |
568 "s" gnus-group-unsubscribe-group | |
569 "k" gnus-group-kill-group | |
570 "y" gnus-group-yank-group | |
571 "w" gnus-group-kill-region | |
572 "\C-k" gnus-group-kill-level | |
573 "z" gnus-group-kill-all-zombies)) | |
574 | |
575 (defun gnus-group-make-menu-bar () | |
576 (gnus-turn-off-edit-menu 'group) | |
577 (unless (boundp 'gnus-group-reading-menu) | |
578 | |
579 (easy-menu-define | |
580 gnus-group-reading-menu gnus-group-mode-map "" | |
581 '("Group" | |
582 ["Read" gnus-group-read-group (gnus-group-group-name)] | |
583 ["Select" gnus-group-select-group (gnus-group-group-name)] | |
584 ["See old articles" (gnus-group-select-group 'all) | |
585 :keys "C-u SPC" :active (gnus-group-group-name)] | |
586 ["Catch up" gnus-group-catchup-current (gnus-group-group-name)] | |
587 ["Catch up all articles" gnus-group-catchup-current-all | |
588 (gnus-group-group-name)] | |
589 ["Check for new articles" gnus-group-get-new-news-this-group | |
590 (gnus-group-group-name)] | |
591 ["Toggle subscription" gnus-group-unsubscribe-current-group | |
592 (gnus-group-group-name)] | |
593 ["Kill" gnus-group-kill-group (gnus-group-group-name)] | |
594 ["Yank" gnus-group-yank-group gnus-list-of-killed-groups] | |
595 ["Describe" gnus-group-describe-group (gnus-group-group-name)] | |
596 ["Fetch FAQ" gnus-group-fetch-faq (gnus-group-group-name)] | |
597 ;; Actually one should check, if any of the marked groups gives t for | |
598 ;; (gnus-check-backend-function 'request-expire-articles ...) | |
599 ["Expire articles" gnus-group-expire-articles | |
600 (or (and (gnus-group-group-name) | |
601 (gnus-check-backend-function | |
602 'request-expire-articles | |
603 (gnus-group-group-name))) gnus-group-marked)] | |
604 ["Set group level" gnus-group-set-current-level | |
605 (gnus-group-group-name)] | |
606 ["Select quick" gnus-group-quick-select-group (gnus-group-group-name)] | |
607 ["Customize" gnus-group-customize (gnus-group-group-name)] | |
608 ("Edit" | |
609 ["Parameters" gnus-group-edit-group-parameters | |
610 (gnus-group-group-name)] | |
611 ["Select method" gnus-group-edit-group-method | |
612 (gnus-group-group-name)] | |
613 ["Info" gnus-group-edit-group (gnus-group-group-name)] | |
614 ["Local kill file" gnus-group-edit-local-kill (gnus-group-group-name)] | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
615 ["Global kill file" gnus-group-edit-global-kill t]))) |
17493 | 616 |
617 (easy-menu-define | |
618 gnus-group-group-menu gnus-group-mode-map "" | |
619 '("Groups" | |
620 ("Listing" | |
621 ["List unread subscribed groups" gnus-group-list-groups t] | |
622 ["List (un)subscribed groups" gnus-group-list-all-groups t] | |
623 ["List killed groups" gnus-group-list-killed gnus-killed-list] | |
624 ["List zombie groups" gnus-group-list-zombies gnus-zombie-list] | |
625 ["List level..." gnus-group-list-level t] | |
626 ["Describe all groups" gnus-group-describe-all-groups t] | |
627 ["Group apropos..." gnus-group-apropos t] | |
628 ["Group and description apropos..." gnus-group-description-apropos t] | |
629 ["List groups matching..." gnus-group-list-matching t] | |
630 ["List all groups matching..." gnus-group-list-all-matching t] | |
631 ["List active file" gnus-group-list-active t]) | |
632 ("Sort" | |
633 ["Default sort" gnus-group-sort-groups t] | |
634 ["Sort by method" gnus-group-sort-groups-by-method t] | |
635 ["Sort by rank" gnus-group-sort-groups-by-rank t] | |
636 ["Sort by score" gnus-group-sort-groups-by-score t] | |
637 ["Sort by level" gnus-group-sort-groups-by-level t] | |
638 ["Sort by unread" gnus-group-sort-groups-by-unread t] | |
639 ["Sort by name" gnus-group-sort-groups-by-alphabet t]) | |
640 ("Sort process/prefixed" | |
641 ["Default sort" gnus-group-sort-selected-groups | |
642 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
643 ["Sort by method" gnus-group-sort-selected-groups-by-method | |
644 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
645 ["Sort by rank" gnus-group-sort-selected-groups-by-rank | |
646 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
647 ["Sort by score" gnus-group-sort-selected-groups-by-score | |
648 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
649 ["Sort by level" gnus-group-sort-selected-groups-by-level | |
650 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
651 ["Sort by unread" gnus-group-sort-selected-groups-by-unread | |
652 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))] | |
653 ["Sort by name" gnus-group-sort-selected-groups-by-alphabet | |
654 (or (not (boundp 'gnus-topic-mode)) (not gnus-topic-mode))]) | |
655 ("Mark" | |
656 ["Mark group" gnus-group-mark-group | |
657 (and (gnus-group-group-name) | |
658 (not (memq (gnus-group-group-name) gnus-group-marked)))] | |
659 ["Unmark group" gnus-group-unmark-group | |
660 (and (gnus-group-group-name) | |
661 (memq (gnus-group-group-name) gnus-group-marked))] | |
662 ["Unmark all" gnus-group-unmark-all-groups gnus-group-marked] | |
663 ["Mark regexp..." gnus-group-mark-regexp t] | |
664 ["Mark region" gnus-group-mark-region t] | |
665 ["Mark buffer" gnus-group-mark-buffer t] | |
666 ["Execute command" gnus-group-universal-argument | |
667 (or gnus-group-marked (gnus-group-group-name))]) | |
668 ("Subscribe" | |
669 ["Subscribe to a group" gnus-group-unsubscribe-group t] | |
670 ["Kill all newsgroups in region" gnus-group-kill-region t] | |
671 ["Kill all zombie groups" gnus-group-kill-all-zombies | |
672 gnus-zombie-list] | |
673 ["Kill all groups on level..." gnus-group-kill-level t]) | |
674 ("Foreign groups" | |
675 ["Make a foreign group" gnus-group-make-group t] | |
676 ["Add a directory group" gnus-group-make-directory-group t] | |
677 ["Add the help group" gnus-group-make-help-group t] | |
678 ["Add the archive group" gnus-group-make-archive-group t] | |
679 ["Make a doc group" gnus-group-make-doc-group t] | |
680 ["Make a web group" gnus-group-make-web-group t] | |
681 ["Make a kiboze group" gnus-group-make-kiboze-group t] | |
682 ["Make a virtual group" gnus-group-make-empty-virtual t] | |
683 ["Add a group to a virtual" gnus-group-add-to-virtual t] | |
684 ["Rename group" gnus-group-rename-group | |
685 (gnus-check-backend-function | |
686 'request-rename-group (gnus-group-group-name))] | |
687 ["Delete group" gnus-group-delete-group | |
688 (gnus-check-backend-function | |
689 'request-delete-group (gnus-group-group-name))]) | |
690 ("Move" | |
691 ["Next" gnus-group-next-group t] | |
692 ["Previous" gnus-group-prev-group t] | |
693 ["Next unread" gnus-group-next-unread-group t] | |
694 ["Previous unread" gnus-group-prev-unread-group t] | |
695 ["Next unread same level" gnus-group-next-unread-group-same-level t] | |
696 ["Previous unread same level" | |
697 gnus-group-prev-unread-group-same-level t] | |
698 ["Jump to group" gnus-group-jump-to-group t] | |
699 ["First unread group" gnus-group-first-unread-group t] | |
700 ["Best unread group" gnus-group-best-unread-group t]) | |
701 ["Delete bogus groups" gnus-group-check-bogus-groups t] | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
702 ["Find new newsgroups" gnus-group-find-new-groups t] |
17493 | 703 ["Transpose" gnus-group-transpose-groups |
704 (gnus-group-group-name)] | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
705 ["Read a directory as a group..." gnus-group-enter-directory t])) |
17493 | 706 |
707 (easy-menu-define | |
708 gnus-group-misc-menu gnus-group-mode-map "" | |
709 '("Misc" | |
710 ("SOUP" | |
711 ["Pack replies" nnsoup-pack-replies (fboundp 'nnsoup-request-group)] | |
712 ["Send replies" gnus-soup-send-replies | |
713 (fboundp 'gnus-soup-pack-packet)] | |
714 ["Pack packet" gnus-soup-pack-packet (fboundp 'gnus-soup-pack-packet)] | |
715 ["Save areas" gnus-soup-save-areas (fboundp 'gnus-soup-pack-packet)] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
716 ["Brew SOUP" gnus-group-brew-soup (fboundp 'gnus-soup-pack-packet)]) |
17493 | 717 ["Send a bug report" gnus-bug t] |
718 ["Send a mail" gnus-group-mail t] | |
719 ["Post an article..." gnus-group-post-news t] | |
720 ["Check for new news" gnus-group-get-new-news t] | |
721 ["Activate all groups" gnus-activate-all-groups t] | |
722 ["Restart Gnus" gnus-group-restart t] | |
723 ["Read init file" gnus-group-read-init-file t] | |
724 ["Browse foreign server" gnus-group-browse-foreign-server t] | |
725 ["Enter server buffer" gnus-group-enter-server-mode t] | |
726 ["Expire all expirable articles" gnus-group-expire-all-groups t] | |
727 ["Generate any kiboze groups" nnkiboze-generate-groups t] | |
728 ["Gnus version" gnus-version t] | |
729 ["Save .newsrc files" gnus-group-save-newsrc t] | |
730 ["Suspend Gnus" gnus-group-suspend t] | |
731 ["Clear dribble buffer" gnus-group-clear-dribble t] | |
732 ["Read manual" gnus-info-find-node t] | |
733 ["Flush score cache" gnus-score-flush-cache t] | |
734 ["Toggle topics" gnus-topic-mode t] | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
735 ["Send a bug report" gnus-bug t] |
17493 | 736 ["Exit from Gnus" gnus-group-exit t] |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
737 ["Exit without saving" gnus-group-quit t])) |
17493 | 738 |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
739 (gnus-run-hooks 'gnus-group-menu-hook))) |
17493 | 740 |
741 (defun gnus-group-mode () | |
742 "Major mode for reading news. | |
743 | |
744 All normal editing commands are switched off. | |
745 \\<gnus-group-mode-map> | |
746 The group buffer lists (some of) the groups available. For instance, | |
747 `\\[gnus-group-list-groups]' will list all subscribed groups with unread articles, while `\\[gnus-group-list-zombies]' | |
748 lists all zombie groups. | |
749 | |
750 Groups that are displayed can be entered with `\\[gnus-group-read-group]'. To subscribe | |
751 to a group not displayed, type `\\[gnus-group-unsubscribe-group]'. | |
752 | |
753 For more in-depth information on this mode, read the manual (`\\[gnus-info-find-node]'). | |
754 | |
755 The following commands are available: | |
756 | |
757 \\{gnus-group-mode-map}" | |
758 (interactive) | |
759 (when (gnus-visual-p 'group-menu 'menu) | |
760 (gnus-group-make-menu-bar)) | |
761 (kill-all-local-variables) | |
762 (gnus-simplify-mode-line) | |
763 (setq major-mode 'gnus-group-mode) | |
764 (setq mode-name "Group") | |
765 (gnus-group-set-mode-line) | |
766 (setq mode-line-process nil) | |
767 (use-local-map gnus-group-mode-map) | |
768 (buffer-disable-undo (current-buffer)) | |
769 (setq truncate-lines t) | |
770 (setq buffer-read-only t) | |
771 (gnus-set-default-directory) | |
772 (gnus-update-format-specifications nil 'group 'group-mode) | |
773 (gnus-update-group-mark-positions) | |
774 (make-local-hook 'post-command-hook) | |
775 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t) | |
776 (when gnus-use-undo | |
777 (gnus-undo-mode 1)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
778 (when gnus-slave |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
779 (gnus-slave-mode)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
780 (gnus-run-hooks 'gnus-group-mode-hook)) |
17493 | 781 |
782 (defun gnus-update-group-mark-positions () | |
783 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
784 (let ((gnus-process-mark ?\200) |
17493 | 785 (gnus-group-marked '("dummy.group")) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
786 (gnus-active-hashtb (make-vector 10 0)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
787 (topic "")) |
17493 | 788 (gnus-set-active "dummy.group" '(0 . 0)) |
789 (gnus-set-work-buffer) | |
790 (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil) | |
791 (goto-char (point-min)) | |
792 (setq gnus-group-mark-positions | |
793 (list (cons 'process (and (search-forward "\200" nil t) | |
794 (- (point) 2)))))))) | |
795 | |
796 (defun gnus-clear-inboxes-moved () | |
797 (setq nnmail-moved-inboxes nil)) | |
798 | |
799 (defun gnus-mouse-pick-group (e) | |
800 "Enter the group under the mouse pointer." | |
801 (interactive "e") | |
802 (mouse-set-point e) | |
803 (gnus-group-read-group nil)) | |
804 | |
805 ;; Look at LEVEL and find out what the level is really supposed to be. | |
806 ;; If LEVEL is non-nil, LEVEL will be returned, if not, what happens | |
807 ;; will depend on whether `gnus-group-use-permanent-levels' is used. | |
808 (defun gnus-group-default-level (&optional level number-or-nil) | |
809 (cond | |
810 (gnus-group-use-permanent-levels | |
811 (or (setq gnus-group-use-permanent-levels | |
812 (or level (if (numberp gnus-group-use-permanent-levels) | |
813 gnus-group-use-permanent-levels | |
814 (or gnus-group-default-list-level | |
815 gnus-level-subscribed)))) | |
816 gnus-group-default-list-level gnus-level-subscribed)) | |
817 (number-or-nil | |
818 level) | |
819 (t | |
820 (or level gnus-group-default-list-level gnus-level-subscribed)))) | |
821 | |
822 (defun gnus-group-setup-buffer () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
823 (set-buffer (gnus-get-buffer-create gnus-group-buffer)) |
17493 | 824 (unless (eq major-mode 'gnus-group-mode) |
825 (gnus-group-mode) | |
826 (when gnus-carpal | |
827 (gnus-carpal-setup-buffer 'group)))) | |
828 | |
829 (defun gnus-group-list-groups (&optional level unread lowest) | |
830 "List newsgroups with level LEVEL or lower that have unread articles. | |
831 Default is all subscribed groups. | |
832 If argument UNREAD is non-nil, groups with no unread articles are also | |
833 listed. | |
834 | |
835 Also see the `gnus-group-use-permanent-levels' variable." | |
836 (interactive | |
837 (list (if current-prefix-arg | |
838 (prefix-numeric-value current-prefix-arg) | |
839 (or | |
840 (gnus-group-default-level nil t) | |
841 gnus-group-default-list-level | |
842 gnus-level-subscribed)))) | |
843 ;; Just do this here, for no particular good reason. | |
844 (gnus-clear-inboxes-moved) | |
845 (unless level | |
846 (setq level (car gnus-group-list-mode) | |
847 unread (cdr gnus-group-list-mode))) | |
848 (setq level (gnus-group-default-level level)) | |
849 (gnus-group-setup-buffer) | |
850 (gnus-update-format-specifications nil 'group 'group-mode) | |
851 (let ((case-fold-search nil) | |
852 (props (text-properties-at (gnus-point-at-bol))) | |
853 (empty (= (point-min) (point-max))) | |
854 (group (gnus-group-group-name)) | |
855 number) | |
856 (set-buffer gnus-group-buffer) | |
857 (setq number (funcall gnus-group-prepare-function level unread lowest)) | |
858 (when (or (and (numberp number) | |
859 (zerop number)) | |
860 (zerop (buffer-size))) | |
861 ;; No groups in the buffer. | |
862 (gnus-message 5 gnus-no-groups-message)) | |
863 ;; We have some groups displayed. | |
864 (goto-char (point-max)) | |
865 (when (or (not gnus-group-goto-next-group-function) | |
866 (not (funcall gnus-group-goto-next-group-function | |
867 group props))) | |
868 (cond | |
869 (empty | |
870 (goto-char (point-min))) | |
871 ((not group) | |
872 ;; Go to the first group with unread articles. | |
873 (gnus-group-search-forward t)) | |
874 (t | |
875 ;; Find the right group to put point on. If the current group | |
876 ;; has disappeared in the new listing, try to find the next | |
877 ;; one. If no next one can be found, just leave point at the | |
878 ;; first newsgroup in the buffer. | |
879 (when (not (gnus-goto-char | |
880 (text-property-any | |
881 (point-min) (point-max) | |
882 'gnus-group (gnus-intern-safe | |
883 group gnus-active-hashtb)))) | |
884 (let ((newsrc (cdddr (gnus-gethash group gnus-newsrc-hashtb)))) | |
885 (while (and newsrc | |
886 (not (gnus-goto-char | |
887 (text-property-any | |
888 (point-min) (point-max) 'gnus-group | |
889 (gnus-intern-safe | |
890 (caar newsrc) gnus-active-hashtb))))) | |
891 (setq newsrc (cdr newsrc))) | |
892 (unless newsrc | |
893 (goto-char (point-max)) | |
894 (forward-line -1))))))) | |
895 ;; Adjust cursor point. | |
896 (gnus-group-position-point))) | |
897 | |
898 (defun gnus-group-list-level (level &optional all) | |
899 "List groups on LEVEL. | |
900 If ALL (the prefix), also list groups that have no unread articles." | |
901 (interactive "nList groups on level: \nP") | |
902 (gnus-group-list-groups level all level)) | |
903 | |
904 (defun gnus-group-prepare-flat (level &optional all lowest regexp) | |
905 "List all newsgroups with unread articles of level LEVEL or lower. | |
906 If ALL is non-nil, list groups that have no unread articles. | |
907 If LOWEST is non-nil, list all newsgroups of level LOWEST or higher. | |
908 If REGEXP, only list groups matching REGEXP." | |
909 (set-buffer gnus-group-buffer) | |
910 (let ((buffer-read-only nil) | |
911 (newsrc (cdr gnus-newsrc-alist)) | |
912 (lowest (or lowest 1)) | |
913 info clevel unread group params) | |
914 (erase-buffer) | |
915 (when (< lowest gnus-level-zombie) | |
916 ;; List living groups. | |
917 (while newsrc | |
918 (setq info (car newsrc) | |
919 group (gnus-info-group info) | |
920 params (gnus-info-params info) | |
921 newsrc (cdr newsrc) | |
922 unread (car (gnus-gethash group gnus-newsrc-hashtb))) | |
923 (and unread ; This group might be bogus | |
924 (or (not regexp) | |
925 (string-match regexp group)) | |
926 (<= (setq clevel (gnus-info-level info)) level) | |
927 (>= clevel lowest) | |
928 (or all ; We list all groups? | |
929 (if (eq unread t) ; Unactivated? | |
930 gnus-group-list-inactive-groups ; We list unactivated | |
931 (> unread 0)) ; We list groups with unread articles | |
932 (and gnus-list-groups-with-ticked-articles | |
933 (cdr (assq 'tick (gnus-info-marks info)))) | |
934 ; And groups with tickeds | |
935 ;; Check for permanent visibility. | |
936 (and gnus-permanently-visible-groups | |
937 (string-match gnus-permanently-visible-groups | |
938 group)) | |
939 (memq 'visible params) | |
940 (cdr (assq 'visible params))) | |
941 (gnus-group-insert-group-line | |
942 group (gnus-info-level info) | |
943 (gnus-info-marks info) unread (gnus-info-method info))))) | |
944 | |
945 ;; List dead groups. | |
946 (and (>= level gnus-level-zombie) (<= lowest gnus-level-zombie) | |
947 (gnus-group-prepare-flat-list-dead | |
948 (setq gnus-zombie-list (sort gnus-zombie-list 'string<)) | |
949 gnus-level-zombie ?Z | |
950 regexp)) | |
951 (and (>= level gnus-level-killed) (<= lowest gnus-level-killed) | |
952 (gnus-group-prepare-flat-list-dead | |
953 (setq gnus-killed-list (sort gnus-killed-list 'string<)) | |
954 gnus-level-killed ?K regexp)) | |
955 | |
956 (gnus-group-set-mode-line) | |
957 (setq gnus-group-list-mode (cons level all)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
958 (gnus-run-hooks 'gnus-group-prepare-hook) |
17493 | 959 t)) |
960 | |
961 (defun gnus-group-prepare-flat-list-dead (groups level mark regexp) | |
962 ;; List zombies and killed lists somewhat faster, which was | |
963 ;; suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. It does | |
964 ;; this by ignoring the group format specification altogether. | |
965 (let (group) | |
966 (if regexp | |
967 ;; This loop is used when listing groups that match some | |
968 ;; regexp. | |
969 (while groups | |
970 (setq group (pop groups)) | |
971 (when (string-match regexp group) | |
972 (gnus-add-text-properties | |
973 (point) (prog1 (1+ (point)) | |
974 (insert " " mark " *: " group "\n")) | |
975 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb) | |
976 'gnus-unread t | |
977 'gnus-level level)))) | |
978 ;; This loop is used when listing all groups. | |
979 (while groups | |
980 (gnus-add-text-properties | |
981 (point) (prog1 (1+ (point)) | |
982 (insert " " mark " *: " | |
983 (setq group (pop groups)) "\n")) | |
984 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb) | |
985 'gnus-unread t | |
986 'gnus-level level)))))) | |
987 | |
988 (defun gnus-group-update-group-line () | |
989 "Update the current line in the group buffer." | |
990 (let* ((buffer-read-only nil) | |
991 (group (gnus-group-group-name)) | |
992 (entry (and group (gnus-gethash group gnus-newsrc-hashtb))) | |
993 gnus-group-indentation) | |
994 (when group | |
995 (and entry | |
996 (not (gnus-ephemeral-group-p group)) | |
997 (gnus-dribble-enter | |
998 (concat "(gnus-group-set-info '" | |
999 (gnus-prin1-to-string (nth 2 entry)) | |
1000 ")"))) | |
1001 (setq gnus-group-indentation (gnus-group-group-indentation)) | |
1002 (gnus-delete-line) | |
1003 (gnus-group-insert-group-line-info group) | |
1004 (forward-line -1) | |
1005 (gnus-group-position-point)))) | |
1006 | |
1007 (defun gnus-group-insert-group-line-info (group) | |
1008 "Insert GROUP on the current line." | |
1009 (let ((entry (gnus-gethash group gnus-newsrc-hashtb)) | |
1010 (gnus-group-indentation (gnus-group-group-indentation)) | |
1011 active info) | |
1012 (if entry | |
1013 (progn | |
1014 ;; (Un)subscribed group. | |
1015 (setq info (nth 2 entry)) | |
1016 (gnus-group-insert-group-line | |
1017 group (gnus-info-level info) (gnus-info-marks info) | |
1018 (or (car entry) t) (gnus-info-method info))) | |
1019 ;; This group is dead. | |
1020 (gnus-group-insert-group-line | |
1021 group | |
1022 (if (member group gnus-zombie-list) gnus-level-zombie gnus-level-killed) | |
1023 nil | |
1024 (if (setq active (gnus-active group)) | |
1025 (if (zerop (cdr active)) | |
1026 0 | |
1027 (- (1+ (cdr active)) (car active))) | |
1028 nil) | |
1029 nil)))) | |
1030 | |
1031 (defun gnus-group-insert-group-line (gnus-tmp-group gnus-tmp-level | |
1032 gnus-tmp-marked number | |
1033 gnus-tmp-method) | |
1034 "Insert a group line in the group buffer." | |
1035 (let* ((gnus-tmp-active (gnus-active gnus-tmp-group)) | |
1036 (gnus-tmp-number-total | |
1037 (if gnus-tmp-active | |
1038 (1+ (- (cdr gnus-tmp-active) (car gnus-tmp-active))) | |
1039 0)) | |
1040 (gnus-tmp-number-of-unread | |
1041 (if (numberp number) (int-to-string (max 0 number)) | |
1042 "*")) | |
1043 (gnus-tmp-number-of-read | |
1044 (if (numberp number) | |
1045 (int-to-string (max 0 (- gnus-tmp-number-total number))) | |
1046 "*")) | |
1047 (gnus-tmp-subscribed | |
1048 (cond ((<= gnus-tmp-level gnus-level-subscribed) ? ) | |
1049 ((<= gnus-tmp-level gnus-level-unsubscribed) ?U) | |
1050 ((= gnus-tmp-level gnus-level-zombie) ?Z) | |
1051 (t ?K))) | |
1052 (gnus-tmp-qualified-group (gnus-group-real-name gnus-tmp-group)) | |
1053 (gnus-tmp-newsgroup-description | |
1054 (if gnus-description-hashtb | |
1055 (or (gnus-gethash gnus-tmp-group gnus-description-hashtb) "") | |
1056 "")) | |
1057 (gnus-tmp-moderated | |
1058 (if (and gnus-moderated-hashtb | |
1059 (gnus-gethash gnus-tmp-group gnus-moderated-hashtb)) | |
1060 ?m ? )) | |
1061 (gnus-tmp-moderated-string | |
1062 (if (eq gnus-tmp-moderated ?m) "(m)" "")) | |
1063 (gnus-tmp-method | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1064 (gnus-server-get-method gnus-tmp-group gnus-tmp-method)) ; |
17493 | 1065 (gnus-tmp-news-server (or (cadr gnus-tmp-method) "")) |
1066 (gnus-tmp-news-method (or (car gnus-tmp-method) "")) | |
1067 (gnus-tmp-news-method-string | |
1068 (if gnus-tmp-method | |
1069 (format "(%s:%s)" (car gnus-tmp-method) | |
1070 (cadr gnus-tmp-method)) "")) | |
1071 (gnus-tmp-marked-mark | |
1072 (if (and (numberp number) | |
1073 (zerop number) | |
1074 (cdr (assq 'tick gnus-tmp-marked))) | |
1075 ?* ? )) | |
1076 (gnus-tmp-process-marked | |
1077 (if (member gnus-tmp-group gnus-group-marked) | |
1078 gnus-process-mark ? )) | |
1079 (gnus-tmp-grouplens | |
1080 (or (and gnus-use-grouplens | |
1081 (bbb-grouplens-group-p gnus-tmp-group)) | |
1082 "")) | |
1083 (buffer-read-only nil) | |
1084 header gnus-tmp-header) ; passed as parameter to user-funcs. | |
1085 (beginning-of-line) | |
1086 (gnus-add-text-properties | |
1087 (point) | |
1088 (prog1 (1+ (point)) | |
1089 ;; Insert the text. | |
1090 (eval gnus-group-line-format-spec)) | |
1091 `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb) | |
1092 gnus-unread ,(if (numberp number) | |
1093 (string-to-int gnus-tmp-number-of-unread) | |
1094 t) | |
1095 gnus-marked ,gnus-tmp-marked-mark | |
1096 gnus-indentation ,gnus-group-indentation | |
1097 gnus-level ,gnus-tmp-level)) | |
1098 (when (inline (gnus-visual-p 'group-highlight 'highlight)) | |
1099 (forward-line -1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1100 (gnus-run-hooks 'gnus-group-update-hook) |
17493 | 1101 (forward-line)) |
1102 ;; Allow XEmacs to remove front-sticky text properties. | |
1103 (gnus-group-remove-excess-properties))) | |
1104 | |
1105 (defun gnus-group-highlight-line () | |
1106 "Highlight the current line according to `gnus-group-highlight'." | |
1107 (let* ((list gnus-group-highlight) | |
1108 (p (point)) | |
1109 (end (progn (end-of-line) (point))) | |
1110 ;; now find out where the line starts and leave point there. | |
1111 (beg (progn (beginning-of-line) (point))) | |
1112 (group (gnus-group-group-name)) | |
1113 (entry (gnus-group-entry group)) | |
1114 (unread (if (numberp (car entry)) (car entry) 0)) | |
1115 (active (gnus-active group)) | |
1116 (total (if active (1+ (- (cdr active) (car active))) 0)) | |
1117 (info (nth 2 entry)) | |
1118 (method (gnus-server-get-method group (gnus-info-method info))) | |
1119 (marked (gnus-info-marks info)) | |
1120 (mailp (memq 'mail (assoc (symbol-name | |
1121 (car (or method gnus-select-method))) | |
1122 gnus-valid-select-methods))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1123 (level (or (gnus-info-level info) gnus-level-killed)) |
17493 | 1124 (score (or (gnus-info-score info) 0)) |
1125 (ticked (gnus-range-length (cdr (assq 'tick marked)))) | |
1126 (group-age (gnus-group-timestamp-delta group)) | |
1127 (inhibit-read-only t)) | |
1128 ;; Eval the cars of the lists until we find a match. | |
1129 (while (and list | |
1130 (not (eval (caar list)))) | |
1131 (setq list (cdr list))) | |
1132 (let ((face (cdar list))) | |
1133 (unless (eq face (get-text-property beg 'face)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1134 (gnus-put-text-property-excluding-characters-with-faces |
17493 | 1135 beg end 'face |
1136 (setq face (if (boundp face) (symbol-value face) face))) | |
1137 (gnus-extent-start-open beg))) | |
1138 (goto-char p))) | |
1139 | |
1140 (defun gnus-group-update-group (group &optional visible-only) | |
1141 "Update all lines where GROUP appear. | |
1142 If VISIBLE-ONLY is non-nil, the group won't be displayed if it isn't | |
1143 already." | |
1144 ;; Can't use `save-excursion' here, so we do it manually. | |
1145 (let ((buf (current-buffer)) | |
1146 mark) | |
1147 (set-buffer gnus-group-buffer) | |
1148 (setq mark (point-marker)) | |
1149 ;; The buffer may be narrowed. | |
1150 (save-restriction | |
1151 (widen) | |
1152 (let ((ident (gnus-intern-safe group gnus-active-hashtb)) | |
1153 (loc (point-min)) | |
1154 found buffer-read-only) | |
1155 ;; Enter the current status into the dribble buffer. | |
1156 (let ((entry (gnus-gethash group gnus-newsrc-hashtb))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1157 (when (and entry |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1158 (not (gnus-ephemeral-group-p group))) |
17493 | 1159 (gnus-dribble-enter |
1160 (concat "(gnus-group-set-info '" | |
1161 (gnus-prin1-to-string (nth 2 entry)) | |
1162 ")")))) | |
1163 ;; Find all group instances. If topics are in use, each group | |
1164 ;; may be listed in more than once. | |
1165 (while (setq loc (text-property-any | |
1166 loc (point-max) 'gnus-group ident)) | |
1167 (setq found t) | |
1168 (goto-char loc) | |
1169 (let ((gnus-group-indentation (gnus-group-group-indentation))) | |
1170 (gnus-delete-line) | |
1171 (gnus-group-insert-group-line-info group) | |
1172 (save-excursion | |
1173 (forward-line -1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1174 (gnus-run-hooks 'gnus-group-update-group-hook))) |
17493 | 1175 (setq loc (1+ loc))) |
1176 (unless (or found visible-only) | |
1177 ;; No such line in the buffer, find out where it's supposed to | |
1178 ;; go, and insert it there (or at the end of the buffer). | |
1179 (if gnus-goto-missing-group-function | |
1180 (funcall gnus-goto-missing-group-function group) | |
1181 (let ((entry (cddr (gnus-gethash group gnus-newsrc-hashtb)))) | |
1182 (while (and entry (car entry) | |
1183 (not | |
1184 (gnus-goto-char | |
1185 (text-property-any | |
1186 (point-min) (point-max) | |
1187 'gnus-group (gnus-intern-safe | |
1188 (caar entry) gnus-active-hashtb))))) | |
1189 (setq entry (cdr entry))) | |
1190 (or entry (goto-char (point-max))))) | |
1191 ;; Finally insert the line. | |
1192 (let ((gnus-group-indentation (gnus-group-group-indentation))) | |
1193 (gnus-group-insert-group-line-info group) | |
1194 (save-excursion | |
1195 (forward-line -1) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1196 (gnus-run-hooks 'gnus-group-update-group-hook)))) |
17493 | 1197 (when gnus-group-update-group-function |
1198 (funcall gnus-group-update-group-function group)) | |
1199 (gnus-group-set-mode-line))) | |
1200 (goto-char mark) | |
1201 (set-marker mark nil) | |
1202 (set-buffer buf))) | |
1203 | |
1204 (defun gnus-group-set-mode-line () | |
1205 "Update the mode line in the group buffer." | |
1206 (when (memq 'group gnus-updated-mode-lines) | |
1207 ;; Yes, we want to keep this mode line updated. | |
1208 (save-excursion | |
1209 (set-buffer gnus-group-buffer) | |
1210 (let* ((gformat (or gnus-group-mode-line-format-spec | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1211 (gnus-set-format 'group-mode))) |
17493 | 1212 (gnus-tmp-news-server (cadr gnus-select-method)) |
1213 (gnus-tmp-news-method (car gnus-select-method)) | |
1214 (gnus-tmp-colon (if (equal gnus-tmp-news-server "") "" ":")) | |
1215 (max-len 60) | |
1216 gnus-tmp-header ;Dummy binding for user-defined formats | |
1217 ;; Get the resulting string. | |
1218 (modified | |
1219 (and gnus-dribble-buffer | |
1220 (buffer-name gnus-dribble-buffer) | |
1221 (buffer-modified-p gnus-dribble-buffer) | |
1222 (save-excursion | |
1223 (set-buffer gnus-dribble-buffer) | |
1224 (not (zerop (buffer-size)))))) | |
1225 (mode-string (eval gformat))) | |
1226 ;; Say whether the dribble buffer has been modified. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1227 (setq mode-line-modified |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1228 (if modified (car gnus-mode-line-modified) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1229 (cdr gnus-mode-line-modified))) |
17493 | 1230 ;; If the line is too long, we chop it off. |
1231 (when (> (length mode-string) max-len) | |
1232 (setq mode-string (substring mode-string 0 (- max-len 4)))) | |
1233 (prog1 | |
1234 (setq mode-line-buffer-identification | |
1235 (gnus-mode-line-buffer-identification | |
1236 (list mode-string))) | |
1237 (set-buffer-modified-p modified)))))) | |
1238 | |
1239 (defun gnus-group-group-name () | |
1240 "Get the name of the newsgroup on the current line." | |
1241 (let ((group (get-text-property (gnus-point-at-bol) 'gnus-group))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1242 (when group |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1243 (symbol-name group)))) |
17493 | 1244 |
1245 (defun gnus-group-group-level () | |
1246 "Get the level of the newsgroup on the current line." | |
1247 (get-text-property (gnus-point-at-bol) 'gnus-level)) | |
1248 | |
1249 (defun gnus-group-group-indentation () | |
1250 "Get the indentation of the newsgroup on the current line." | |
1251 (or (get-text-property (gnus-point-at-bol) 'gnus-indentation) | |
1252 (and gnus-group-indentation-function | |
1253 (funcall gnus-group-indentation-function)) | |
1254 "")) | |
1255 | |
1256 (defun gnus-group-group-unread () | |
1257 "Get the number of unread articles of the newsgroup on the current line." | |
1258 (get-text-property (gnus-point-at-bol) 'gnus-unread)) | |
1259 | |
1260 (defun gnus-group-new-mail (group) | |
1261 (if (nnmail-new-mail-p (gnus-group-real-name group)) | |
1262 gnus-new-mail-mark | |
1263 ? )) | |
1264 | |
1265 (defun gnus-group-level (group) | |
1266 "Return the estimated level of GROUP." | |
1267 (or (gnus-info-level (gnus-get-info group)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1268 (and (member group gnus-zombie-list) gnus-level-zombie) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1269 gnus-level-killed)) |
17493 | 1270 |
1271 (defun gnus-group-search-forward (&optional backward all level first-too) | |
1272 "Find the next newsgroup with unread articles. | |
1273 If BACKWARD is non-nil, find the previous newsgroup instead. | |
1274 If ALL is non-nil, just find any newsgroup. | |
1275 If LEVEL is non-nil, find group with level LEVEL, or higher if no such | |
1276 group exists. | |
1277 If FIRST-TOO, the current line is also eligible as a target." | |
1278 (let ((way (if backward -1 1)) | |
1279 (low gnus-level-killed) | |
1280 (beg (point)) | |
1281 pos found lev) | |
1282 (if (and backward (progn (beginning-of-line)) (bobp)) | |
1283 nil | |
1284 (unless first-too | |
1285 (forward-line way)) | |
1286 (while (and | |
1287 (not (eobp)) | |
1288 (not (setq | |
1289 found | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1290 (and |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1291 (get-text-property (point) 'gnus-group) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1292 (or all |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1293 (and |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1294 (let ((unread |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1295 (get-text-property (point) 'gnus-unread))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1296 (and (numberp unread) (> unread 0))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1297 (setq lev (get-text-property (point) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1298 'gnus-level)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1299 (<= lev gnus-level-subscribed))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1300 (or (not level) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1301 (and (setq lev (get-text-property (point) |
17493 | 1302 'gnus-level)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1303 (or (= lev level) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1304 (and (< lev low) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1305 (< level lev) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1306 (progn |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1307 (setq low lev) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1308 (setq pos (point)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
1309 nil)))))))) |
17493 | 1310 (zerop (forward-line way))))) |
1311 (if found | |
1312 (progn (gnus-group-position-point) t) | |
1313 (goto-char (or pos beg)) | |
1314 (and pos t)))) | |
1315 | |
1316 ;;; Gnus group mode commands | |
1317 | |
1318 ;; Group marking. | |
1319 | |
1320 (defun gnus-group-mark-group (n &optional unmark no-advance) | |
1321 "Mark the current group." | |
1322 (interactive "p") | |
1323 (let ((buffer-read-only nil) | |
1324 group) | |
1325 (while (and (> n 0) | |
1326 (not (eobp))) | |
1327 (when (setq group (gnus-group-group-name)) | |
1328 ;; Go to the mark position. | |
1329 (beginning-of-line) | |
1330 (forward-char (or (cdr (assq 'process gnus-group-mark-positions)) 2)) | |
1331 (subst-char-in-region | |
1332 (point) (1+ (point)) (following-char) | |
1333 (if unmark | |
1334 (progn | |
1335 (setq gnus-group-marked (delete group gnus-group-marked)) | |
1336 ? ) | |
1337 (setq gnus-group-marked | |
1338 (cons group (delete group gnus-group-marked))) | |
1339 gnus-process-mark))) | |
1340 (unless no-advance | |
1341 (gnus-group-next-group 1)) | |
1342 (decf n)) | |
1343 (gnus-summary-position-point) | |
1344 n)) | |
1345 | |
1346 (defun gnus-group-unmark-group (n) | |
1347 "Remove the mark from the current group." | |
1348 (interactive "p") | |
1349 (gnus-group-mark-group n 'unmark) | |
1350 (gnus-group-position-point)) | |
1351 | |
1352 (defun gnus-group-unmark-all-groups () | |
1353 "Unmark all groups." | |
1354 (interactive) | |
1355 (let ((groups gnus-group-marked)) | |
1356 (save-excursion | |
1357 (while groups | |
1358 (gnus-group-remove-mark (pop groups))))) | |
1359 (gnus-group-position-point)) | |
1360 | |
1361 (defun gnus-group-mark-region (unmark beg end) | |
1362 "Mark all groups between point and mark. | |
1363 If UNMARK, remove the mark instead." | |
1364 (interactive "P\nr") | |
1365 (let ((num (count-lines beg end))) | |
1366 (save-excursion | |
1367 (goto-char beg) | |
1368 (- num (gnus-group-mark-group num unmark))))) | |
1369 | |
1370 (defun gnus-group-mark-buffer (&optional unmark) | |
1371 "Mark all groups in the buffer. | |
1372 If UNMARK, remove the mark instead." | |
1373 (interactive "P") | |
1374 (gnus-group-mark-region unmark (point-min) (point-max))) | |
1375 | |
1376 (defun gnus-group-mark-regexp (regexp) | |
1377 "Mark all groups that match some regexp." | |
1378 (interactive "sMark (regexp): ") | |
1379 (let ((alist (cdr gnus-newsrc-alist)) | |
1380 group) | |
1381 (while alist | |
1382 (when (string-match regexp (setq group (gnus-info-group (pop alist)))) | |
1383 (gnus-group-set-mark group)))) | |
1384 (gnus-group-position-point)) | |
1385 | |
1386 (defun gnus-group-remove-mark (group) | |
1387 "Remove the process mark from GROUP and move point there. | |
1388 Return nil if the group isn't displayed." | |
1389 (if (gnus-group-goto-group group) | |
1390 (save-excursion | |
1391 (gnus-group-mark-group 1 'unmark t) | |
1392 t) | |
1393 (setq gnus-group-marked | |
1394 (delete group gnus-group-marked)) | |
1395 nil)) | |
1396 | |
1397 (defun gnus-group-set-mark (group) | |
1398 "Set the process mark on GROUP." | |
1399 (if (gnus-group-goto-group group) | |
1400 (save-excursion | |
1401 (gnus-group-mark-group 1 nil t)) | |
1402 (setq gnus-group-marked (cons group (delete group gnus-group-marked))))) | |
1403 | |
1404 (defun gnus-group-universal-argument (arg &optional groups func) | |
1405 "Perform any command on all groups according to the process/prefix convention." | |
1406 (interactive "P") | |
1407 (if (eq (setq func (or func | |
1408 (key-binding | |
1409 (read-key-sequence | |
1410 (substitute-command-keys | |
1411 "\\<gnus-group-mode-map>\\[gnus-group-universal-argument]"))))) | |
1412 'undefined) | |
1413 (gnus-error 1 "Undefined key") | |
1414 (gnus-group-iterate arg | |
1415 (lambda (group) | |
1416 (command-execute func)))) | |
1417 (gnus-group-position-point)) | |
1418 | |
1419 (defun gnus-group-process-prefix (n) | |
1420 "Return a list of groups to work on. | |
1421 Take into consideration N (the prefix) and the list of marked groups." | |
1422 (cond | |
1423 (n | |
1424 (setq n (prefix-numeric-value n)) | |
1425 ;; There is a prefix, so we return a list of the N next | |
1426 ;; groups. | |
1427 (let ((way (if (< n 0) -1 1)) | |
1428 (n (abs n)) | |
1429 group groups) | |
1430 (save-excursion | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1431 (while (> n 0) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1432 (if (setq group (gnus-group-group-name)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1433 (push group groups)) |
17493 | 1434 (setq n (1- n)) |
1435 (gnus-group-next-group way))) | |
1436 (nreverse groups))) | |
1437 ((gnus-region-active-p) | |
1438 ;; Work on the region between point and mark. | |
1439 (let ((max (max (point) (mark))) | |
1440 groups) | |
1441 (save-excursion | |
1442 (goto-char (min (point) (mark))) | |
1443 (while | |
1444 (and | |
1445 (push (gnus-group-group-name) groups) | |
1446 (zerop (gnus-group-next-group 1)) | |
1447 (< (point) max))) | |
1448 (nreverse groups)))) | |
1449 (gnus-group-marked | |
1450 ;; No prefix, but a list of marked articles. | |
1451 (reverse gnus-group-marked)) | |
1452 (t | |
1453 ;; Neither marked articles or a prefix, so we return the | |
1454 ;; current group. | |
1455 (let ((group (gnus-group-group-name))) | |
1456 (and group (list group)))))) | |
1457 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1458 ;;; !!!Surely gnus-group-iterate should be a macro instead? I can't |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1459 ;;; imagine why I went through these contortions... |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1460 (eval-and-compile |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1461 (let ((function (make-symbol "gnus-group-iterate-function")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1462 (window (make-symbol "gnus-group-iterate-window")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1463 (groups (make-symbol "gnus-group-iterate-groups")) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1464 (group (make-symbol "gnus-group-iterate-group"))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1465 (eval |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1466 `(defun gnus-group-iterate (arg ,function) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1467 "Iterate FUNCTION over all process/prefixed groups. |
17493 | 1468 FUNCTION will be called with the group name as the paremeter |
1469 and with point over the group in question." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1470 (let ((,groups (gnus-group-process-prefix arg)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1471 (,window (selected-window)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1472 ,group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1473 (while (setq ,group (pop ,groups)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1474 (select-window ,window) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1475 (gnus-group-remove-mark ,group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1476 (save-selected-window |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1477 (save-excursion |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1478 (funcall ,function ,group))))))))) |
17493 | 1479 |
1480 (put 'gnus-group-iterate 'lisp-indent-function 1) | |
1481 | |
1482 ;; Selecting groups. | |
1483 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1484 (defun gnus-group-read-group (&optional all no-article group select-articles) |
17493 | 1485 "Read news in this newsgroup. |
1486 If the prefix argument ALL is non-nil, already read articles become | |
1487 readable. IF ALL is a number, fetch this number of articles. If the | |
1488 optional argument NO-ARTICLE is non-nil, no article will be | |
1489 auto-selected upon group entry. If GROUP is non-nil, fetch that | |
1490 group." | |
1491 (interactive "P") | |
1492 (let ((no-display (eq all 0)) | |
1493 (group (or group (gnus-group-group-name))) | |
1494 number active marked entry) | |
1495 (when (eq all 0) | |
1496 (setq all nil)) | |
1497 (unless group | |
1498 (error "No group on current line")) | |
1499 (setq marked (gnus-info-marks | |
1500 (nth 2 (setq entry (gnus-gethash | |
1501 group gnus-newsrc-hashtb))))) | |
1502 ;; This group might be a dead group. In that case we have to get | |
1503 ;; the number of unread articles from `gnus-active-hashtb'. | |
1504 (setq number | |
1505 (cond ((numberp all) all) | |
1506 (entry (car entry)) | |
1507 ((setq active (gnus-active group)) | |
1508 (- (1+ (cdr active)) (car active))))) | |
1509 (gnus-summary-read-group | |
1510 group (or all (and (numberp number) | |
1511 (zerop (+ number (gnus-range-length | |
1512 (cdr (assq 'tick marked))) | |
1513 (gnus-range-length | |
1514 (cdr (assq 'dormant marked))))))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1515 no-article nil no-display nil select-articles))) |
17493 | 1516 |
1517 (defun gnus-group-select-group (&optional all) | |
1518 "Select this newsgroup. | |
1519 No article is selected automatically. | |
1520 If ALL is non-nil, already read articles become readable. | |
1521 If ALL is a number, fetch this number of articles." | |
1522 (interactive "P") | |
1523 (gnus-group-read-group all t)) | |
1524 | |
1525 (defun gnus-group-quick-select-group (&optional all) | |
1526 "Select the current group \"quickly\". | |
1527 This means that no highlighting or scoring will be performed. | |
1528 If ALL (the prefix argument) is 0, don't even generate the summary | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1529 buffer. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1530 |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1531 This might be useful if you want to toggle threading |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1532 before entering the group." |
17493 | 1533 (interactive "P") |
1534 (require 'gnus-score) | |
1535 (let (gnus-visual | |
1536 gnus-score-find-score-files-function | |
1537 gnus-home-score-file | |
1538 gnus-apply-kill-hook | |
1539 gnus-summary-expunge-below) | |
1540 (gnus-group-read-group all t))) | |
1541 | |
1542 (defun gnus-group-visible-select-group (&optional all) | |
1543 "Select the current group without hiding any articles." | |
1544 (interactive "P") | |
1545 (let ((gnus-inhibit-limiting t)) | |
1546 (gnus-group-read-group all t))) | |
1547 | |
1548 (defun gnus-group-select-group-ephemerally () | |
1549 "Select the current group without doing any processing whatsoever. | |
1550 You will actually be entered into a group that's a copy of | |
1551 the current group; no changes you make while in this group will | |
1552 be permanent." | |
1553 (interactive) | |
1554 (require 'gnus-score) | |
1555 (let* (gnus-visual | |
1556 gnus-score-find-score-files-function gnus-apply-kill-hook | |
1557 gnus-summary-expunge-below gnus-show-threads gnus-suppress-duplicates | |
1558 gnus-summary-mode-hook gnus-select-group-hook | |
1559 (group (gnus-group-group-name)) | |
1560 (method (gnus-find-method-for-group group))) | |
1561 (gnus-group-read-ephemeral-group | |
1562 (gnus-group-prefixed-name group method) method))) | |
1563 | |
1564 ;;;###autoload | |
1565 (defun gnus-fetch-group (group) | |
1566 "Start Gnus if necessary and enter GROUP. | |
1567 Returns whether the fetching was successful or not." | |
1568 (interactive "sGroup name: ") | |
1569 (unless (get-buffer gnus-group-buffer) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1570 (gnus-no-server)) |
17493 | 1571 (gnus-group-read-group nil nil group)) |
1572 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1573 ;;;###autoload |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1574 (defun gnus-fetch-group-other-frame (group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1575 "Pop up a frame and enter GROUP." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1576 (interactive "P") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1577 (let ((window (get-buffer-window gnus-group-buffer))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1578 (cond (window |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1579 (select-frame (window-frame window))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1580 ((= (length (frame-list)) 1) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1581 (select-frame (make-frame))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1582 (t |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1583 (other-frame 1)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1584 (gnus-fetch-group group)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1585 |
17493 | 1586 (defvar gnus-ephemeral-group-server 0) |
1587 | |
1588 ;; Enter a group that is not in the group buffer. Non-nil is returned | |
1589 ;; if selection was successful. | |
1590 (defun gnus-group-read-ephemeral-group (group method &optional activate | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1591 quit-config request-only |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1592 select-articles) |
17493 | 1593 "Read GROUP from METHOD as an ephemeral group. |
1594 If ACTIVATE, request the group first. | |
1595 If QUIT-CONFIG, use that window configuration when exiting from the | |
1596 ephemeral group. | |
1597 If REQUEST-ONLY, don't actually read the group; just request it. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1598 If SELECT-ARTICLES, only select those articles. |
17493 | 1599 |
1600 Return the name of the group is selection was successful." | |
1601 ;; Transform the select method into a unique server. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1602 (when (stringp method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1603 (setq method (gnus-server-to-method method))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1604 (setq method |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1605 `(,(car method) ,(concat (cadr method) "-ephemeral") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1606 (,(intern (format "%s-address" (car method))) ,(cadr method)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1607 ,@(cddr method))) |
17493 | 1608 (let ((group (if (gnus-group-foreign-p group) group |
1609 (gnus-group-prefixed-name group method)))) | |
1610 (gnus-sethash | |
1611 group | |
1612 `(-1 nil (,group | |
1613 ,gnus-level-default-subscribed nil nil ,method | |
1614 ((quit-config . | |
1615 ,(if quit-config quit-config | |
1616 (cons gnus-summary-buffer | |
1617 gnus-current-window-configuration)))))) | |
1618 gnus-newsrc-hashtb) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1619 (push method gnus-ephemeral-servers) |
17493 | 1620 (set-buffer gnus-group-buffer) |
1621 (unless (gnus-check-server method) | |
1622 (error "Unable to contact server: %s" (gnus-status-message method))) | |
1623 (when activate | |
1624 (gnus-activate-group group 'scan) | |
1625 (unless (gnus-request-group group) | |
1626 (error "Couldn't request group: %s" | |
1627 (nnheader-get-report (car method))))) | |
1628 (if request-only | |
1629 group | |
1630 (condition-case () | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1631 (when (gnus-group-read-group t t group select-articles) |
17493 | 1632 group) |
1633 ;;(error nil) | |
1634 (quit nil))))) | |
1635 | |
1636 (defun gnus-group-jump-to-group (group) | |
1637 "Jump to newsgroup GROUP." | |
1638 (interactive | |
1639 (list (completing-read | |
1640 "Group: " gnus-active-hashtb nil | |
1641 (gnus-read-active-file-p) | |
1642 nil | |
1643 'gnus-group-history))) | |
1644 | |
1645 (when (equal group "") | |
1646 (error "Empty group name")) | |
1647 | |
1648 (unless (gnus-ephemeral-group-p group) | |
1649 ;; Either go to the line in the group buffer... | |
1650 (unless (gnus-group-goto-group group) | |
1651 ;; ... or insert the line. | |
1652 (gnus-group-update-group group) | |
1653 (gnus-group-goto-group group))) | |
1654 ;; Adjust cursor point. | |
1655 (gnus-group-position-point)) | |
1656 | |
1657 (defun gnus-group-goto-group (group &optional far) | |
1658 "Goto to newsgroup GROUP. | |
1659 If FAR, it is likely that the group is not on the current line." | |
1660 (when group | |
1661 (if far | |
1662 (gnus-goto-char | |
1663 (text-property-any | |
1664 (point-min) (point-max) | |
1665 'gnus-group (gnus-intern-safe group gnus-active-hashtb))) | |
1666 (beginning-of-line) | |
1667 (cond | |
1668 ;; It's quite likely that we are on the right line, so | |
1669 ;; we check the current line first. | |
1670 ((eq (get-text-property (point) 'gnus-group) | |
1671 (gnus-intern-safe group gnus-active-hashtb)) | |
1672 (point)) | |
1673 ;; Previous and next line are also likely, so we check them as well. | |
1674 ((save-excursion | |
1675 (forward-line -1) | |
1676 (eq (get-text-property (point) 'gnus-group) | |
1677 (gnus-intern-safe group gnus-active-hashtb))) | |
1678 (forward-line -1) | |
1679 (point)) | |
1680 ((save-excursion | |
1681 (forward-line 1) | |
1682 (eq (get-text-property (point) 'gnus-group) | |
1683 (gnus-intern-safe group gnus-active-hashtb))) | |
1684 (forward-line 1) | |
1685 (point)) | |
1686 (t | |
1687 ;; Search through the entire buffer. | |
1688 (gnus-goto-char | |
1689 (text-property-any | |
1690 (point-min) (point-max) | |
1691 'gnus-group (gnus-intern-safe group gnus-active-hashtb)))))))) | |
1692 | |
1693 (defun gnus-group-next-group (n &optional silent) | |
1694 "Go to next N'th newsgroup. | |
1695 If N is negative, search backward instead. | |
1696 Returns the difference between N and the number of skips actually | |
1697 done." | |
1698 (interactive "p") | |
1699 (gnus-group-next-unread-group n t nil silent)) | |
1700 | |
1701 (defun gnus-group-next-unread-group (n &optional all level silent) | |
1702 "Go to next N'th unread newsgroup. | |
1703 If N is negative, search backward instead. | |
1704 If ALL is non-nil, choose any newsgroup, unread or not. | |
1705 If LEVEL is non-nil, choose the next group with level LEVEL, or, if no | |
1706 such group can be found, the next group with a level higher than | |
1707 LEVEL. | |
1708 Returns the difference between N and the number of skips actually | |
1709 made." | |
1710 (interactive "p") | |
1711 (let ((backward (< n 0)) | |
1712 (n (abs n))) | |
1713 (while (and (> n 0) | |
1714 (gnus-group-search-forward | |
1715 backward (or (not gnus-group-goto-unread) all) level)) | |
1716 (setq n (1- n))) | |
1717 (when (and (/= 0 n) | |
1718 (not silent)) | |
1719 (gnus-message 7 "No more%s newsgroups%s" (if all "" " unread") | |
1720 (if level " on this level or higher" ""))) | |
1721 n)) | |
1722 | |
1723 (defun gnus-group-prev-group (n) | |
1724 "Go to previous N'th newsgroup. | |
1725 Returns the difference between N and the number of skips actually | |
1726 done." | |
1727 (interactive "p") | |
1728 (gnus-group-next-unread-group (- n) t)) | |
1729 | |
1730 (defun gnus-group-prev-unread-group (n) | |
1731 "Go to previous N'th unread newsgroup. | |
1732 Returns the difference between N and the number of skips actually | |
1733 done." | |
1734 (interactive "p") | |
1735 (gnus-group-next-unread-group (- n))) | |
1736 | |
1737 (defun gnus-group-next-unread-group-same-level (n) | |
1738 "Go to next N'th unread newsgroup on the same level. | |
1739 If N is negative, search backward instead. | |
1740 Returns the difference between N and the number of skips actually | |
1741 done." | |
1742 (interactive "p") | |
1743 (gnus-group-next-unread-group n t (gnus-group-group-level)) | |
1744 (gnus-group-position-point)) | |
1745 | |
1746 (defun gnus-group-prev-unread-group-same-level (n) | |
1747 "Go to next N'th unread newsgroup on the same level. | |
1748 Returns the difference between N and the number of skips actually | |
1749 done." | |
1750 (interactive "p") | |
1751 (gnus-group-next-unread-group (- n) t (gnus-group-group-level)) | |
1752 (gnus-group-position-point)) | |
1753 | |
1754 (defun gnus-group-best-unread-group (&optional exclude-group) | |
1755 "Go to the group with the highest level. | |
1756 If EXCLUDE-GROUP, do not go to that group." | |
1757 (interactive) | |
1758 (goto-char (point-min)) | |
1759 (let ((best 100000) | |
1760 unread best-point) | |
1761 (while (not (eobp)) | |
1762 (setq unread (get-text-property (point) 'gnus-unread)) | |
1763 (when (and (numberp unread) (> unread 0)) | |
1764 (when (and (get-text-property (point) 'gnus-level) | |
1765 (< (get-text-property (point) 'gnus-level) best) | |
1766 (or (not exclude-group) | |
1767 (not (equal exclude-group (gnus-group-group-name))))) | |
1768 (setq best (get-text-property (point) 'gnus-level)) | |
1769 (setq best-point (point)))) | |
1770 (forward-line 1)) | |
1771 (when best-point | |
1772 (goto-char best-point)) | |
1773 (gnus-summary-position-point) | |
1774 (and best-point (gnus-group-group-name)))) | |
1775 | |
1776 (defun gnus-group-first-unread-group () | |
1777 "Go to the first group with unread articles." | |
1778 (interactive) | |
1779 (prog1 | |
1780 (let ((opoint (point)) | |
1781 unread) | |
1782 (goto-char (point-min)) | |
1783 (if (or (eq (setq unread (gnus-group-group-unread)) t) ; Not active. | |
1784 (and (numberp unread) ; Not a topic. | |
1785 (not (zerop unread))) ; Has unread articles. | |
1786 (zerop (gnus-group-next-unread-group 1))) ; Next unread group. | |
1787 (point) ; Success. | |
1788 (goto-char opoint) | |
1789 nil)) ; Not success. | |
1790 (gnus-group-position-point))) | |
1791 | |
1792 (defun gnus-group-enter-server-mode () | |
1793 "Jump to the server buffer." | |
1794 (interactive) | |
1795 (gnus-enter-server-buffer)) | |
1796 | |
1797 (defun gnus-group-make-group (name &optional method address args) | |
1798 "Add a new newsgroup. | |
1799 The user will be prompted for a NAME, for a select METHOD, and an | |
1800 ADDRESS." | |
1801 (interactive | |
1802 (list | |
1803 (gnus-read-group "Group name: ") | |
1804 (gnus-read-method "From method: "))) | |
1805 | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1806 (when (stringp method) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1807 (setq method (gnus-server-to-method method))) |
17493 | 1808 (let* ((meth (when (and method |
1809 (not (gnus-server-equal method gnus-select-method))) | |
1810 (if address (list (intern method) address) | |
1811 method))) | |
1812 (nname (if method (gnus-group-prefixed-name name meth) name)) | |
1813 backend info) | |
1814 (when (gnus-gethash nname gnus-newsrc-hashtb) | |
1815 (error "Group %s already exists" nname)) | |
1816 ;; Subscribe to the new group. | |
1817 (gnus-group-change-level | |
1818 (setq info (list t nname gnus-level-default-subscribed nil nil meth)) | |
1819 gnus-level-default-subscribed gnus-level-killed | |
1820 (and (gnus-group-group-name) | |
1821 (gnus-gethash (gnus-group-group-name) | |
1822 gnus-newsrc-hashtb)) | |
1823 t) | |
1824 ;; Make it active. | |
1825 (gnus-set-active nname (cons 1 0)) | |
1826 (unless (gnus-ephemeral-group-p name) | |
1827 (gnus-dribble-enter | |
1828 (concat "(gnus-group-set-info '" | |
1829 (gnus-prin1-to-string (cdr info)) ")"))) | |
1830 ;; Insert the line. | |
1831 (gnus-group-insert-group-line-info nname) | |
1832 (forward-line -1) | |
1833 (gnus-group-position-point) | |
1834 | |
1835 ;; Load the backend and try to make the backend create | |
1836 ;; the group as well. | |
1837 (when (assoc (symbol-name (setq backend (car (gnus-server-get-method | |
1838 nil meth)))) | |
1839 gnus-valid-select-methods) | |
1840 (require backend)) | |
1841 (gnus-check-server meth) | |
1842 (when (gnus-check-backend-function 'request-create-group nname) | |
1843 (gnus-request-create-group nname nil args)) | |
1844 t)) | |
1845 | |
1846 (defun gnus-group-delete-group (group &optional force) | |
1847 "Delete the current group. Only meaningful with mail groups. | |
1848 If FORCE (the prefix) is non-nil, all the articles in the group will | |
1849 be deleted. This is \"deleted\" as in \"removed forever from the face | |
1850 of the Earth\". There is no undo. The user will be prompted before | |
1851 doing the deletion." | |
1852 (interactive | |
1853 (list (gnus-group-group-name) | |
1854 current-prefix-arg)) | |
1855 (unless group | |
1856 (error "No group to rename")) | |
1857 (unless (gnus-check-backend-function 'request-delete-group group) | |
1858 (error "This backend does not support group deletion")) | |
1859 (prog1 | |
1860 (if (not (gnus-yes-or-no-p | |
1861 (format | |
1862 "Do you really want to delete %s%s? " | |
1863 group (if force " and all its contents" "")))) | |
1864 () ; Whew! | |
1865 (gnus-message 6 "Deleting group %s..." group) | |
1866 (if (not (gnus-request-delete-group group force)) | |
1867 (gnus-error 3 "Couldn't delete group %s" group) | |
1868 (gnus-message 6 "Deleting group %s...done" group) | |
1869 (gnus-group-goto-group group) | |
1870 (gnus-group-kill-group 1 t) | |
1871 (gnus-sethash group nil gnus-active-hashtb) | |
1872 t)) | |
1873 (gnus-group-position-point))) | |
1874 | |
1875 (defun gnus-group-rename-group (group new-name) | |
1876 "Rename group from GROUP to NEW-NAME. | |
1877 When used interactively, GROUP is the group under point | |
1878 and NEW-NAME will be prompted for." | |
1879 (interactive | |
1880 (list | |
1881 (gnus-group-group-name) | |
1882 (progn | |
1883 (unless (gnus-check-backend-function | |
1884 'request-rename-group (gnus-group-group-name)) | |
1885 (error "This backend does not support renaming groups")) | |
1886 (gnus-read-group "Rename group to: " | |
1887 (gnus-group-real-name (gnus-group-group-name)))))) | |
1888 | |
1889 (unless (gnus-check-backend-function 'request-rename-group group) | |
1890 (error "This backend does not support renaming groups")) | |
1891 (unless group | |
1892 (error "No group to rename")) | |
1893 (when (equal (gnus-group-real-name group) new-name) | |
1894 (error "Can't rename to the same name")) | |
1895 | |
1896 ;; We find the proper prefixed name. | |
1897 (setq new-name | |
1898 (if (gnus-group-native-p group) | |
1899 ;; Native group. | |
1900 new-name | |
1901 ;; Foreign group. | |
1902 (gnus-group-prefixed-name | |
1903 (gnus-group-real-name new-name) | |
1904 (gnus-info-method (gnus-get-info group))))) | |
1905 | |
1906 (gnus-message 6 "Renaming group %s to %s..." group new-name) | |
1907 (prog1 | |
1908 (if (not (gnus-request-rename-group group new-name)) | |
1909 (gnus-error 3 "Couldn't rename group %s to %s" group new-name) | |
1910 ;; We rename the group internally by killing it... | |
1911 (gnus-group-goto-group group) | |
1912 (gnus-group-kill-group) | |
1913 ;; ... changing its name ... | |
1914 (setcar (cdar gnus-list-of-killed-groups) new-name) | |
1915 ;; ... and then yanking it. Magic! | |
1916 (gnus-group-yank-group) | |
1917 (gnus-set-active new-name (gnus-active group)) | |
1918 (gnus-message 6 "Renaming group %s to %s...done" group new-name) | |
1919 new-name) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1920 (setq gnus-killed-list (delete group gnus-killed-list)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1921 (gnus-set-active group nil) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
1922 (gnus-dribble-touch) |
17493 | 1923 (gnus-group-position-point))) |
1924 | |
1925 (defun gnus-group-edit-group (group &optional part) | |
1926 "Edit the group on the current line." | |
1927 (interactive (list (gnus-group-group-name))) | |
1928 (let ((part (or part 'info)) | |
1929 info) | |
1930 (unless group | |
1931 (error "No group on current line")) | |
1932 (unless (setq info (gnus-get-info group)) | |
1933 (error "Killed group; can't be edited")) | |
1934 (ignore-errors | |
1935 (gnus-close-group group)) | |
1936 (gnus-edit-form | |
1937 ;; Find the proper form to edit. | |
1938 (cond ((eq part 'method) | |
1939 (or (gnus-info-method info) "native")) | |
1940 ((eq part 'params) | |
1941 (gnus-info-params info)) | |
1942 (t info)) | |
1943 ;; The proper documentation. | |
1944 (format | |
1945 "Editing the %s for `%s'." | |
1946 (cond | |
1947 ((eq part 'method) "select method") | |
1948 ((eq part 'params) "group parameters") | |
1949 (t "group info")) | |
1950 group) | |
1951 `(lambda (form) | |
1952 (gnus-group-edit-group-done ',part ,group form))))) | |
1953 | |
1954 (defun gnus-group-edit-group-method (group) | |
1955 "Edit the select method of GROUP." | |
1956 (interactive (list (gnus-group-group-name))) | |
1957 (gnus-group-edit-group group 'method)) | |
1958 | |
1959 (defun gnus-group-edit-group-parameters (group) | |
1960 "Edit the group parameters of GROUP." | |
1961 (interactive (list (gnus-group-group-name))) | |
1962 (gnus-group-edit-group group 'params)) | |
1963 | |
1964 (defun gnus-group-edit-group-done (part group form) | |
1965 "Update variables." | |
1966 (let* ((method (cond ((eq part 'info) (nth 4 form)) | |
1967 ((eq part 'method) form) | |
1968 (t nil))) | |
1969 (info (cond ((eq part 'info) form) | |
1970 ((eq part 'method) (gnus-get-info group)) | |
1971 (t nil))) | |
1972 (new-group (if info | |
1973 (if (or (not method) | |
1974 (gnus-server-equal | |
1975 gnus-select-method method)) | |
1976 (gnus-group-real-name (car info)) | |
1977 (gnus-group-prefixed-name | |
1978 (gnus-group-real-name (car info)) method)) | |
1979 nil))) | |
1980 (when (and new-group | |
1981 (not (equal new-group group))) | |
1982 (when (gnus-group-goto-group group) | |
1983 (gnus-group-kill-group 1)) | |
1984 (gnus-activate-group new-group)) | |
1985 ;; Set the info. | |
1986 (if (not (and info new-group)) | |
1987 (gnus-group-set-info form (or new-group group) part) | |
1988 (setq info (gnus-copy-sequence info)) | |
1989 (setcar info new-group) | |
1990 (unless (gnus-server-equal method "native") | |
1991 (unless (nthcdr 3 info) | |
1992 (nconc info (list nil nil))) | |
1993 (unless (nthcdr 4 info) | |
1994 (nconc info (list nil))) | |
1995 (gnus-info-set-method info method)) | |
1996 (gnus-group-set-info info)) | |
1997 (gnus-group-update-group (or new-group group)) | |
1998 (gnus-group-position-point))) | |
1999 | |
2000 (defun gnus-group-make-useful-group (group method) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2001 "Create one of the groups described in `gnus-useful-groups'." |
17493 | 2002 (interactive |
2003 (let ((entry (assoc (completing-read "Create group: " gnus-useful-groups | |
2004 nil t) | |
2005 gnus-useful-groups))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2006 (list (cadr entry) (caddr entry)))) |
17493 | 2007 (setq method (gnus-copy-sequence method)) |
2008 (let (entry) | |
2009 (while (setq entry (memq (assq 'eval method) method)) | |
2010 (setcar entry (eval (cadar entry))))) | |
2011 (gnus-group-make-group group method)) | |
2012 | |
2013 (defun gnus-group-make-help-group () | |
2014 "Create the Gnus documentation group." | |
2015 (interactive) | |
2016 (let ((name (gnus-group-prefixed-name "gnus-help" '(nndoc "gnus-help"))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2017 (file (nnheader-find-etc-directory "gnus-tut.txt" t))) |
17493 | 2018 (when (gnus-gethash name gnus-newsrc-hashtb) |
2019 (error "Documentation group already exists")) | |
2020 (if (not file) | |
2021 (gnus-message 1 "Couldn't find doc group") | |
2022 (gnus-group-make-group | |
2023 (gnus-group-real-name name) | |
2024 (list 'nndoc "gnus-help" | |
2025 (list 'nndoc-address file) | |
2026 (list 'nndoc-article-type 'mbox))))) | |
2027 (gnus-group-position-point)) | |
2028 | |
2029 (defun gnus-group-make-doc-group (file type) | |
2030 "Create a group that uses a single file as the source." | |
2031 (interactive | |
2032 (list (read-file-name "File name: ") | |
2033 (and current-prefix-arg 'ask))) | |
2034 (when (eq type 'ask) | |
2035 (let ((err "") | |
2036 char found) | |
2037 (while (not found) | |
2038 (message | |
2039 "%sFile type (mbox, babyl, digest, forward, mmdf, guess) [mbdfag]: " | |
2040 err) | |
2041 (setq found (cond ((= (setq char (read-char)) ?m) 'mbox) | |
2042 ((= char ?b) 'babyl) | |
2043 ((= char ?d) 'digest) | |
2044 ((= char ?f) 'forward) | |
2045 ((= char ?a) 'mmfd) | |
2046 (t (setq err (format "%c unknown. " char)) | |
2047 nil)))) | |
2048 (setq type found))) | |
2049 (let* ((file (expand-file-name file)) | |
2050 (name (gnus-generate-new-group-name | |
2051 (gnus-group-prefixed-name | |
2052 (file-name-nondirectory file) '(nndoc ""))))) | |
2053 (gnus-group-make-group | |
2054 (gnus-group-real-name name) | |
2055 (list 'nndoc file | |
2056 (list 'nndoc-address file) | |
2057 (list 'nndoc-article-type (or type 'guess)))))) | |
2058 | |
2059 (defvar nnweb-type-definition) | |
2060 (defvar gnus-group-web-type-history nil) | |
2061 (defvar gnus-group-web-search-history nil) | |
2062 (defun gnus-group-make-web-group (&optional solid) | |
2063 "Create an ephemeral nnweb group. | |
2064 If SOLID (the prefix), create a solid group." | |
2065 (interactive "P") | |
2066 (require 'nnweb) | |
2067 (let* ((group | |
2068 (if solid (gnus-read-group "Group name: ") | |
2069 (message-unique-id))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2070 (default-type (or (car gnus-group-web-type-history) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2071 (symbol-name (caar nnweb-type-definition)))) |
17493 | 2072 (type |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2073 (gnus-string-or |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2074 (completing-read |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2075 (format "Search engine type (default %s): " default-type) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2076 (mapcar (lambda (elem) (list (symbol-name (car elem)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2077 nnweb-type-definition) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2078 nil t nil 'gnus-group-web-type-history) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2079 default-type)) |
17493 | 2080 (search |
2081 (read-string | |
2082 "Search string: " | |
2083 (cons (or (car gnus-group-web-search-history) "") 0) | |
2084 'gnus-group-web-search-history)) | |
2085 (method | |
2086 `(nnweb ,group (nnweb-search ,search) | |
2087 (nnweb-type ,(intern type)) | |
2088 (nnweb-ephemeral-p t)))) | |
2089 (if solid | |
2090 (gnus-group-make-group group "nnweb" "" `(,(intern type) ,search)) | |
2091 (gnus-group-read-ephemeral-group | |
2092 group method t | |
2093 (cons (current-buffer) | |
2094 (if (eq major-mode 'gnus-summary-mode) 'summary 'group)))))) | |
2095 | |
2096 (defun gnus-group-make-archive-group (&optional all) | |
2097 "Create the (ding) Gnus archive group of the most recent articles. | |
2098 Given a prefix, create a full group." | |
2099 (interactive "P") | |
2100 (let ((group (gnus-group-prefixed-name | |
2101 (if all "ding.archives" "ding.recent") '(nndir "")))) | |
2102 (when (gnus-gethash group gnus-newsrc-hashtb) | |
2103 (error "Archive group already exists")) | |
2104 (gnus-group-make-group | |
2105 (gnus-group-real-name group) | |
2106 (list 'nndir (if all "hpc" "edu") | |
2107 (list 'nndir-directory | |
2108 (if all gnus-group-archive-directory | |
2109 gnus-group-recent-archive-directory)))) | |
2110 (gnus-group-add-parameter group (cons 'to-address "ding@gnus.org")))) | |
2111 | |
2112 (defun gnus-group-make-directory-group (dir) | |
2113 "Create an nndir group. | |
2114 The user will be prompted for a directory. The contents of this | |
2115 directory will be used as a newsgroup. The directory should contain | |
2116 mail messages or news articles in files that have numeric names." | |
2117 (interactive | |
2118 (list (read-file-name "Create group from directory: "))) | |
2119 (unless (file-exists-p dir) | |
2120 (error "No such directory")) | |
2121 (unless (file-directory-p dir) | |
2122 (error "Not a directory")) | |
2123 (let ((ext "") | |
2124 (i 0) | |
2125 group) | |
2126 (while (or (not group) (gnus-gethash group gnus-newsrc-hashtb)) | |
2127 (setq group | |
2128 (gnus-group-prefixed-name | |
2129 (concat (file-name-as-directory (directory-file-name dir)) | |
2130 ext) | |
2131 '(nndir ""))) | |
2132 (setq ext (format "<%d>" (setq i (1+ i))))) | |
2133 (gnus-group-make-group | |
2134 (gnus-group-real-name group) | |
2135 (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir))))) | |
2136 | |
2137 (defun gnus-group-make-kiboze-group (group address scores) | |
2138 "Create an nnkiboze group. | |
2139 The user will be prompted for a name, a regexp to match groups, and | |
2140 score file entries for articles to include in the group." | |
2141 (interactive | |
2142 (list | |
2143 (read-string "nnkiboze group name: ") | |
2144 (read-string "Source groups (regexp): ") | |
2145 (let ((headers (mapcar (lambda (group) (list group)) | |
2146 '("subject" "from" "number" "date" "message-id" | |
2147 "references" "chars" "lines" "xref" | |
2148 "followup" "all" "body" "head"))) | |
2149 scores header regexp regexps) | |
2150 (while (not (equal "" (setq header (completing-read | |
2151 "Match on header: " headers nil t)))) | |
2152 (setq regexps nil) | |
2153 (while (not (equal "" (setq regexp (read-string | |
2154 (format "Match on %s (string): " | |
2155 header))))) | |
2156 (push (list regexp nil nil 'r) regexps)) | |
2157 (push (cons header regexps) scores)) | |
2158 scores))) | |
2159 (gnus-group-make-group group "nnkiboze" address) | |
2160 (nnheader-temp-write (gnus-score-file-name (concat "nnkiboze:" group)) | |
2161 (let (emacs-lisp-mode-hook) | |
2162 (pp scores (current-buffer))))) | |
2163 | |
2164 (defun gnus-group-add-to-virtual (n vgroup) | |
2165 "Add the current group to a virtual group." | |
2166 (interactive | |
2167 (list current-prefix-arg | |
2168 (completing-read "Add to virtual group: " gnus-newsrc-hashtb nil t | |
2169 "nnvirtual:"))) | |
2170 (unless (eq (car (gnus-find-method-for-group vgroup)) 'nnvirtual) | |
2171 (error "%s is not an nnvirtual group" vgroup)) | |
2172 (gnus-close-group vgroup) | |
2173 (let* ((groups (gnus-group-process-prefix n)) | |
2174 (method (gnus-info-method (gnus-get-info vgroup)))) | |
2175 (setcar (cdr method) | |
2176 (concat | |
2177 (nth 1 method) "\\|" | |
2178 (mapconcat | |
2179 (lambda (s) | |
2180 (gnus-group-remove-mark s) | |
2181 (concat "\\(^" (regexp-quote s) "$\\)")) | |
2182 groups "\\|")))) | |
2183 (gnus-group-position-point)) | |
2184 | |
2185 (defun gnus-group-make-empty-virtual (group) | |
2186 "Create a new, fresh, empty virtual group." | |
2187 (interactive "sCreate new, empty virtual group: ") | |
2188 (let* ((method (list 'nnvirtual "^$")) | |
2189 (pgroup (gnus-group-prefixed-name group method))) | |
2190 ;; Check whether it exists already. | |
2191 (when (gnus-gethash pgroup gnus-newsrc-hashtb) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2192 (error "Group %s already exists" pgroup)) |
17493 | 2193 ;; Subscribe the new group after the group on the current line. |
2194 (gnus-subscribe-group pgroup (gnus-group-group-name) method) | |
2195 (gnus-group-update-group pgroup) | |
2196 (forward-line -1) | |
2197 (gnus-group-position-point))) | |
2198 | |
2199 (defun gnus-group-enter-directory (dir) | |
2200 "Enter an ephemeral nneething group." | |
2201 (interactive "DDirectory to read: ") | |
2202 (let* ((method (list 'nneething dir '(nneething-read-only t))) | |
2203 (leaf (gnus-group-prefixed-name | |
2204 (file-name-nondirectory (directory-file-name dir)) | |
2205 method)) | |
2206 (name (gnus-generate-new-group-name leaf))) | |
2207 (unless (gnus-group-read-ephemeral-group | |
2208 name method t | |
2209 (cons (current-buffer) | |
2210 (if (eq major-mode 'gnus-summary-mode) | |
2211 'summary 'group))) | |
2212 (error "Couldn't enter %s" dir)))) | |
2213 | |
2214 ;; Group sorting commands | |
2215 ;; Suggested by Joe Hildebrand <hildjj@idaho.fuentez.com>. | |
2216 | |
2217 (defun gnus-group-sort-groups (func &optional reverse) | |
2218 "Sort the group buffer according to FUNC. | |
2219 When used interactively, the sorting function used will be | |
2220 determined by the `gnus-group-sort-function' variable. | |
2221 If REVERSE (the prefix), reverse the sorting order." | |
2222 (interactive (list gnus-group-sort-function current-prefix-arg)) | |
2223 (funcall gnus-group-sort-alist-function | |
2224 (gnus-make-sort-function func) reverse) | |
2225 (gnus-group-list-groups) | |
2226 (gnus-dribble-touch)) | |
2227 | |
2228 (defun gnus-group-sort-flat (func reverse) | |
2229 ;; We peel off the dummy group from the alist. | |
2230 (when func | |
2231 (when (equal (gnus-info-group (car gnus-newsrc-alist)) "dummy.group") | |
2232 (pop gnus-newsrc-alist)) | |
2233 ;; Do the sorting. | |
2234 (setq gnus-newsrc-alist | |
2235 (sort gnus-newsrc-alist func)) | |
2236 (when reverse | |
2237 (setq gnus-newsrc-alist (nreverse gnus-newsrc-alist))) | |
2238 ;; Regenerate the hash table. | |
2239 (gnus-make-hashtable-from-newsrc-alist))) | |
2240 | |
2241 (defun gnus-group-sort-groups-by-alphabet (&optional reverse) | |
2242 "Sort the group buffer alphabetically by group name. | |
2243 If REVERSE, sort in reverse order." | |
2244 (interactive "P") | |
2245 (gnus-group-sort-groups 'gnus-group-sort-by-alphabet reverse)) | |
2246 | |
2247 (defun gnus-group-sort-groups-by-unread (&optional reverse) | |
2248 "Sort the group buffer by number of unread articles. | |
2249 If REVERSE, sort in reverse order." | |
2250 (interactive "P") | |
2251 (gnus-group-sort-groups 'gnus-group-sort-by-unread reverse)) | |
2252 | |
2253 (defun gnus-group-sort-groups-by-level (&optional reverse) | |
2254 "Sort the group buffer by group level. | |
2255 If REVERSE, sort in reverse order." | |
2256 (interactive "P") | |
2257 (gnus-group-sort-groups 'gnus-group-sort-by-level reverse)) | |
2258 | |
2259 (defun gnus-group-sort-groups-by-score (&optional reverse) | |
2260 "Sort the group buffer by group score. | |
2261 If REVERSE, sort in reverse order." | |
2262 (interactive "P") | |
2263 (gnus-group-sort-groups 'gnus-group-sort-by-score reverse)) | |
2264 | |
2265 (defun gnus-group-sort-groups-by-rank (&optional reverse) | |
2266 "Sort the group buffer by group rank. | |
2267 If REVERSE, sort in reverse order." | |
2268 (interactive "P") | |
2269 (gnus-group-sort-groups 'gnus-group-sort-by-rank reverse)) | |
2270 | |
2271 (defun gnus-group-sort-groups-by-method (&optional reverse) | |
2272 "Sort the group buffer alphabetically by backend name. | |
2273 If REVERSE, sort in reverse order." | |
2274 (interactive "P") | |
2275 (gnus-group-sort-groups 'gnus-group-sort-by-method reverse)) | |
2276 | |
2277 ;;; Selected group sorting. | |
2278 | |
2279 (defun gnus-group-sort-selected-groups (n func &optional reverse) | |
2280 "Sort the process/prefixed groups." | |
2281 (interactive (list current-prefix-arg gnus-group-sort-function)) | |
2282 (let ((groups (gnus-group-process-prefix n))) | |
2283 (funcall gnus-group-sort-selected-function | |
2284 groups (gnus-make-sort-function func) reverse) | |
2285 (gnus-group-list-groups))) | |
2286 | |
2287 (defun gnus-group-sort-selected-flat (groups func reverse) | |
2288 (let (entries infos) | |
2289 ;; First find all the group entries for these groups. | |
2290 (while groups | |
2291 (push (nthcdr 2 (gnus-gethash (pop groups) gnus-newsrc-hashtb)) | |
2292 entries)) | |
2293 ;; Then sort the infos. | |
2294 (setq infos | |
2295 (sort | |
2296 (mapcar | |
2297 (lambda (entry) (car entry)) | |
2298 (setq entries (nreverse entries))) | |
2299 func)) | |
2300 (when reverse | |
2301 (setq infos (nreverse infos))) | |
2302 ;; Go through all the infos and replace the old entries | |
2303 ;; with the new infos. | |
2304 (while infos | |
2305 (setcar entries (pop infos)) | |
2306 (pop entries)) | |
2307 ;; Update the hashtable. | |
2308 (gnus-make-hashtable-from-newsrc-alist))) | |
2309 | |
2310 (defun gnus-group-sort-selected-groups-by-alphabet (&optional reverse) | |
2311 "Sort the group buffer alphabetically by group name. | |
2312 If REVERSE, sort in reverse order." | |
2313 (interactive "P") | |
2314 (gnus-group-sort-selected-groups 'gnus-group-sort-by-alphabet reverse)) | |
2315 | |
2316 (defun gnus-group-sort-selected-groups-by-unread (&optional reverse) | |
2317 "Sort the group buffer by number of unread articles. | |
2318 If REVERSE, sort in reverse order." | |
2319 (interactive "P") | |
2320 (gnus-group-sort-selected-groups 'gnus-group-sort-by-unread reverse)) | |
2321 | |
2322 (defun gnus-group-sort-selected-groups-by-level (&optional reverse) | |
2323 "Sort the group buffer by group level. | |
2324 If REVERSE, sort in reverse order." | |
2325 (interactive "P") | |
2326 (gnus-group-sort-selected-groups 'gnus-group-sort-by-level reverse)) | |
2327 | |
2328 (defun gnus-group-sort-selected-groups-by-score (&optional reverse) | |
2329 "Sort the group buffer by group score. | |
2330 If REVERSE, sort in reverse order." | |
2331 (interactive "P") | |
2332 (gnus-group-sort-selected-groups 'gnus-group-sort-by-score reverse)) | |
2333 | |
2334 (defun gnus-group-sort-selected-groups-by-rank (&optional reverse) | |
2335 "Sort the group buffer by group rank. | |
2336 If REVERSE, sort in reverse order." | |
2337 (interactive "P") | |
2338 (gnus-group-sort-selected-groups 'gnus-group-sort-by-rank reverse)) | |
2339 | |
2340 (defun gnus-group-sort-selected-groups-by-method (&optional reverse) | |
2341 "Sort the group buffer alphabetically by backend name. | |
2342 If REVERSE, sort in reverse order." | |
2343 (interactive "P") | |
2344 (gnus-group-sort-selected-groups 'gnus-group-sort-by-method reverse)) | |
2345 | |
2346 ;;; Sorting predicates. | |
2347 | |
2348 (defun gnus-group-sort-by-alphabet (info1 info2) | |
2349 "Sort alphabetically." | |
2350 (string< (gnus-info-group info1) (gnus-info-group info2))) | |
2351 | |
2352 (defun gnus-group-sort-by-real-name (info1 info2) | |
2353 "Sort alphabetically on real (unprefixed) names." | |
2354 (string< (gnus-group-real-name (gnus-info-group info1)) | |
2355 (gnus-group-real-name (gnus-info-group info2)))) | |
2356 | |
2357 (defun gnus-group-sort-by-unread (info1 info2) | |
2358 "Sort by number of unread articles." | |
2359 (let ((n1 (car (gnus-gethash (gnus-info-group info1) gnus-newsrc-hashtb))) | |
2360 (n2 (car (gnus-gethash (gnus-info-group info2) gnus-newsrc-hashtb)))) | |
2361 (< (or (and (numberp n1) n1) 0) | |
2362 (or (and (numberp n2) n2) 0)))) | |
2363 | |
2364 (defun gnus-group-sort-by-level (info1 info2) | |
2365 "Sort by level." | |
2366 (< (gnus-info-level info1) (gnus-info-level info2))) | |
2367 | |
2368 (defun gnus-group-sort-by-method (info1 info2) | |
2369 "Sort alphabetically by backend name." | |
2370 (string< (symbol-name (car (gnus-find-method-for-group | |
2371 (gnus-info-group info1) info1))) | |
2372 (symbol-name (car (gnus-find-method-for-group | |
2373 (gnus-info-group info2) info2))))) | |
2374 | |
2375 (defun gnus-group-sort-by-score (info1 info2) | |
2376 "Sort by group score." | |
2377 (< (gnus-info-score info1) (gnus-info-score info2))) | |
2378 | |
2379 (defun gnus-group-sort-by-rank (info1 info2) | |
2380 "Sort by level and score." | |
2381 (let ((level1 (gnus-info-level info1)) | |
2382 (level2 (gnus-info-level info2))) | |
2383 (or (< level1 level2) | |
2384 (and (= level1 level2) | |
2385 (> (gnus-info-score info1) (gnus-info-score info2)))))) | |
2386 | |
2387 ;;; Clearing data | |
2388 | |
2389 (defun gnus-group-clear-data (&optional arg) | |
2390 "Clear all marks and read ranges from the current group." | |
2391 (interactive "P") | |
2392 (gnus-group-iterate arg | |
2393 (lambda (group) | |
2394 (let (info) | |
2395 (gnus-info-clear-data (setq info (gnus-get-info group))) | |
2396 (gnus-get-unread-articles-in-group info (gnus-active group) t) | |
2397 (when (gnus-group-goto-group group) | |
2398 (gnus-group-update-group-line)))))) | |
2399 | |
2400 (defun gnus-group-clear-data-on-native-groups () | |
2401 "Clear all marks and read ranges from all native groups." | |
2402 (interactive) | |
2403 (when (gnus-yes-or-no-p "Really clear all data from almost all groups? ") | |
2404 (let ((alist (cdr gnus-newsrc-alist)) | |
2405 info) | |
2406 (while (setq info (pop alist)) | |
2407 (when (gnus-group-native-p (gnus-info-group info)) | |
2408 (gnus-info-clear-data info))) | |
2409 (gnus-get-unread-articles) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2410 (gnus-dribble-touch) |
17493 | 2411 (when (gnus-y-or-n-p |
2412 "Move the cache away to avoid problems in the future? ") | |
2413 (call-interactively 'gnus-cache-move-cache))))) | |
2414 | |
2415 (defun gnus-info-clear-data (info) | |
2416 "Clear all marks and read ranges from INFO." | |
2417 (let ((group (gnus-info-group info))) | |
2418 (gnus-undo-register | |
2419 `(progn | |
2420 (gnus-info-set-marks ',info ',(gnus-info-marks info) t) | |
2421 (gnus-info-set-read ',info ',(gnus-info-read info)) | |
2422 (when (gnus-group-goto-group ,group) | |
2423 (gnus-group-update-group-line)))) | |
2424 (gnus-info-set-read info nil) | |
2425 (when (gnus-info-marks info) | |
2426 (gnus-info-set-marks info nil)))) | |
2427 | |
2428 ;; Group catching up. | |
2429 | |
2430 (defun gnus-group-catchup-current (&optional n all) | |
2431 "Mark all articles not marked as unread in current newsgroup as read. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2432 If prefix argument N is numeric, the next N newsgroups will be |
17493 | 2433 caught up. If ALL is non-nil, marked articles will also be marked as |
2434 read. Cross references (Xref: header) of articles are ignored. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2435 The number of newsgroups that this function was unable to catch |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2436 up is returned." |
17493 | 2437 (interactive "P") |
2438 (let ((groups (gnus-group-process-prefix n)) | |
2439 (ret 0)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2440 (unless groups (error "No groups selected")) |
17493 | 2441 (if (not |
2442 (or (not gnus-interactive-catchup) ;Without confirmation? | |
2443 gnus-expert-user | |
2444 (gnus-y-or-n-p | |
2445 (format | |
2446 (if all | |
2447 "Do you really want to mark all articles in %s as read? " | |
2448 "Mark all unread articles in %s as read? ") | |
2449 (if (= (length groups) 1) | |
2450 (car groups) | |
2451 (format "these %d groups" (length groups))))))) | |
2452 n | |
2453 (while groups | |
2454 ;; Virtual groups have to be given special treatment. | |
2455 (let ((method (gnus-find-method-for-group (car groups)))) | |
2456 (when (eq 'nnvirtual (car method)) | |
2457 (nnvirtual-catchup-group | |
2458 (gnus-group-real-name (car groups)) (nth 1 method) all))) | |
2459 (gnus-group-remove-mark (car groups)) | |
2460 (if (>= (gnus-group-group-level) gnus-level-zombie) | |
2461 (gnus-message 2 "Dead groups can't be caught up") | |
2462 (if (prog1 | |
2463 (gnus-group-goto-group (car groups)) | |
2464 (gnus-group-catchup (car groups) all)) | |
2465 (gnus-group-update-group-line) | |
2466 (setq ret (1+ ret)))) | |
2467 (setq groups (cdr groups))) | |
2468 (gnus-group-next-unread-group 1) | |
2469 ret))) | |
2470 | |
2471 (defun gnus-group-catchup-current-all (&optional n) | |
2472 "Mark all articles in current newsgroup as read. | |
2473 Cross references (Xref: header) of articles are ignored." | |
2474 (interactive "P") | |
2475 (gnus-group-catchup-current n 'all)) | |
2476 | |
2477 (defun gnus-group-catchup (group &optional all) | |
2478 "Mark all articles in GROUP as read. | |
2479 If ALL is non-nil, all articles are marked as read. | |
2480 The return value is the number of articles that were marked as read, | |
2481 or nil if no action could be taken." | |
2482 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb)) | |
2483 (num (car entry))) | |
2484 ;; Do the updating only if the newsgroup isn't killed. | |
2485 (if (not (numberp (car entry))) | |
2486 (gnus-message 1 "Can't catch up %s; non-active group" group) | |
2487 ;; Do auto-expirable marks if that's required. | |
2488 (when (gnus-group-auto-expirable-p group) | |
2489 (gnus-add-marked-articles | |
2490 group 'expire (gnus-list-of-unread-articles group)) | |
2491 (when all | |
2492 (let ((marks (nth 3 (nth 2 entry)))) | |
2493 (gnus-add-marked-articles | |
2494 group 'expire (gnus-uncompress-range (cdr (assq 'tick marks)))) | |
2495 (gnus-add-marked-articles | |
2496 group 'expire (gnus-uncompress-range (cdr (assq 'tick marks))))))) | |
2497 (when entry | |
2498 (gnus-update-read-articles group nil) | |
2499 ;; Also nix out the lists of marks and dormants. | |
2500 (when all | |
2501 (gnus-add-marked-articles group 'tick nil nil 'force) | |
2502 (gnus-add-marked-articles group 'dormant nil nil 'force)) | |
2503 (let ((gnus-newsgroup-name group)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2504 (gnus-run-hooks 'gnus-group-catchup-group-hook)) |
17493 | 2505 num)))) |
2506 | |
2507 (defun gnus-group-expire-articles (&optional n) | |
2508 "Expire all expirable articles in the current newsgroup." | |
2509 (interactive "P") | |
2510 (let ((groups (gnus-group-process-prefix n)) | |
2511 group) | |
2512 (unless groups | |
2513 (error "No groups to expire")) | |
2514 (while (setq group (pop groups)) | |
2515 (gnus-group-remove-mark group) | |
2516 (when (gnus-check-backend-function 'request-expire-articles group) | |
2517 (gnus-message 6 "Expiring articles in %s..." group) | |
2518 (let* ((info (gnus-get-info group)) | |
2519 (expirable (if (gnus-group-total-expirable-p group) | |
2520 (cons nil (gnus-list-of-read-articles group)) | |
2521 (assq 'expire (gnus-info-marks info)))) | |
2522 (expiry-wait (gnus-group-find-parameter group 'expiry-wait))) | |
2523 (when expirable | |
2524 (setcdr | |
2525 expirable | |
2526 (gnus-compress-sequence | |
2527 (if expiry-wait | |
2528 ;; We set the expiry variables to the group | |
2529 ;; parameter. | |
2530 (let ((nnmail-expiry-wait-function nil) | |
2531 (nnmail-expiry-wait expiry-wait)) | |
2532 (gnus-request-expire-articles | |
2533 (gnus-uncompress-sequence (cdr expirable)) group)) | |
2534 ;; Just expire using the normal expiry values. | |
2535 (gnus-request-expire-articles | |
2536 (gnus-uncompress-sequence (cdr expirable)) group)))) | |
2537 (gnus-close-group group)) | |
2538 (gnus-message 6 "Expiring articles in %s...done" group))) | |
2539 (gnus-dribble-touch) | |
2540 (gnus-group-position-point)))) | |
2541 | |
2542 (defun gnus-group-expire-all-groups () | |
2543 "Expire all expirable articles in all newsgroups." | |
2544 (interactive) | |
2545 (save-excursion | |
2546 (gnus-message 5 "Expiring...") | |
2547 (let ((gnus-group-marked (mapcar (lambda (info) (gnus-info-group info)) | |
2548 (cdr gnus-newsrc-alist)))) | |
2549 (gnus-group-expire-articles nil))) | |
2550 (gnus-group-position-point) | |
2551 (gnus-message 5 "Expiring...done")) | |
2552 | |
2553 (defun gnus-group-set-current-level (n level) | |
2554 "Set the level of the next N groups to LEVEL." | |
2555 (interactive | |
2556 (list | |
2557 current-prefix-arg | |
2558 (string-to-int | |
2559 (let ((s (read-string | |
2560 (format "Level (default %s): " | |
2561 (or (gnus-group-group-level) | |
2562 gnus-level-default-subscribed))))) | |
2563 (if (string-match "^\\s-*$" s) | |
2564 (int-to-string (or (gnus-group-group-level) | |
2565 gnus-level-default-subscribed)) | |
2566 s))))) | |
2567 (unless (and (>= level 1) (<= level gnus-level-killed)) | |
2568 (error "Illegal level: %d" level)) | |
2569 (let ((groups (gnus-group-process-prefix n)) | |
2570 group) | |
2571 (while (setq group (pop groups)) | |
2572 (gnus-group-remove-mark group) | |
2573 (gnus-message 6 "Changed level of %s from %d to %d" | |
2574 group (or (gnus-group-group-level) gnus-level-killed) | |
2575 level) | |
2576 (gnus-group-change-level | |
2577 group level (or (gnus-group-group-level) gnus-level-killed)) | |
2578 (gnus-group-update-group-line))) | |
2579 (gnus-group-position-point)) | |
2580 | |
2581 (defun gnus-group-unsubscribe (&optional n) | |
2582 "Unsubscribe the current group." | |
2583 (interactive "P") | |
2584 (gnus-group-unsubscribe-current-group n 'unsubscribe)) | |
2585 | |
2586 (defun gnus-group-subscribe (&optional n) | |
2587 "Subscribe the current group." | |
2588 (interactive "P") | |
2589 (gnus-group-unsubscribe-current-group n 'subscribe)) | |
2590 | |
2591 (defun gnus-group-unsubscribe-current-group (&optional n do-sub) | |
2592 "Toggle subscription of the current group. | |
2593 If given numerical prefix, toggle the N next groups." | |
2594 (interactive "P") | |
2595 (let ((groups (gnus-group-process-prefix n)) | |
2596 group) | |
2597 (while groups | |
2598 (setq group (car groups) | |
2599 groups (cdr groups)) | |
2600 (gnus-group-remove-mark group) | |
2601 (gnus-group-unsubscribe-group | |
2602 group | |
2603 (cond | |
2604 ((eq do-sub 'unsubscribe) | |
2605 gnus-level-default-unsubscribed) | |
2606 ((eq do-sub 'subscribe) | |
2607 gnus-level-default-subscribed) | |
2608 ((<= (gnus-group-group-level) gnus-level-subscribed) | |
2609 gnus-level-default-unsubscribed) | |
2610 (t | |
2611 gnus-level-default-subscribed)) | |
2612 t) | |
2613 (gnus-group-update-group-line)) | |
2614 (gnus-group-next-group 1))) | |
2615 | |
2616 (defun gnus-group-unsubscribe-group (group &optional level silent) | |
2617 "Toggle subscription to GROUP. | |
2618 Killed newsgroups are subscribed. If SILENT, don't try to update the | |
2619 group line." | |
2620 (interactive | |
2621 (list (completing-read | |
2622 "Group: " gnus-active-hashtb nil | |
2623 (gnus-read-active-file-p) | |
2624 nil | |
2625 'gnus-group-history))) | |
2626 (let ((newsrc (gnus-gethash group gnus-newsrc-hashtb))) | |
2627 (cond | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2628 ((string-match "^[ \t]*$" group) |
17493 | 2629 (error "Empty group name")) |
2630 (newsrc | |
2631 ;; Toggle subscription flag. | |
2632 (gnus-group-change-level | |
2633 newsrc (if level level (if (<= (gnus-info-level (nth 2 newsrc)) | |
2634 gnus-level-subscribed) | |
2635 (1+ gnus-level-subscribed) | |
2636 gnus-level-default-subscribed))) | |
2637 (unless silent | |
2638 (gnus-group-update-group group))) | |
2639 ((and (stringp group) | |
2640 (or (not (gnus-read-active-file-p)) | |
2641 (gnus-active group))) | |
2642 ;; Add new newsgroup. | |
2643 (gnus-group-change-level | |
2644 group | |
2645 (if level level gnus-level-default-subscribed) | |
2646 (or (and (member group gnus-zombie-list) | |
2647 gnus-level-zombie) | |
2648 gnus-level-killed) | |
2649 (when (gnus-group-group-name) | |
2650 (gnus-gethash (gnus-group-group-name) gnus-newsrc-hashtb))) | |
2651 (unless silent | |
2652 (gnus-group-update-group group))) | |
2653 (t (error "No such newsgroup: %s" group))) | |
2654 (gnus-group-position-point))) | |
2655 | |
2656 (defun gnus-group-transpose-groups (n) | |
2657 "Move the current newsgroup up N places. | |
2658 If given a negative prefix, move down instead. The difference between | |
2659 N and the number of steps taken is returned." | |
2660 (interactive "p") | |
2661 (unless (gnus-group-group-name) | |
2662 (error "No group on current line")) | |
2663 (gnus-group-kill-group 1) | |
2664 (prog1 | |
2665 (forward-line (- n)) | |
2666 (gnus-group-yank-group) | |
2667 (gnus-group-position-point))) | |
2668 | |
2669 (defun gnus-group-kill-all-zombies () | |
2670 "Kill all zombie newsgroups." | |
2671 (interactive) | |
2672 (setq gnus-killed-list (nconc gnus-zombie-list gnus-killed-list)) | |
2673 (setq gnus-zombie-list nil) | |
2674 (gnus-dribble-touch) | |
2675 (gnus-group-list-groups)) | |
2676 | |
2677 (defun gnus-group-kill-region (begin end) | |
2678 "Kill newsgroups in current region (excluding current point). | |
2679 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]." | |
2680 (interactive "r") | |
2681 (let ((lines | |
2682 ;; Count lines. | |
2683 (save-excursion | |
2684 (count-lines | |
2685 (progn | |
2686 (goto-char begin) | |
2687 (beginning-of-line) | |
2688 (point)) | |
2689 (progn | |
2690 (goto-char end) | |
2691 (beginning-of-line) | |
2692 (point)))))) | |
2693 (goto-char begin) | |
2694 (beginning-of-line) ;Important when LINES < 1 | |
2695 (gnus-group-kill-group lines))) | |
2696 | |
2697 (defun gnus-group-kill-group (&optional n discard) | |
2698 "Kill the next N groups. | |
2699 The killed newsgroups can be yanked by using \\[gnus-group-yank-group]. | |
2700 However, only groups that were alive can be yanked; already killed | |
2701 groups or zombie groups can't be yanked. | |
2702 The return value is the name of the group that was killed, or a list | |
2703 of groups killed." | |
2704 (interactive "P") | |
2705 (let ((buffer-read-only nil) | |
2706 (groups (gnus-group-process-prefix n)) | |
2707 group entry level out) | |
2708 (if (< (length groups) 10) | |
2709 ;; This is faster when there are few groups. | |
2710 (while groups | |
2711 (push (setq group (pop groups)) out) | |
2712 (gnus-group-remove-mark group) | |
2713 (setq level (gnus-group-group-level)) | |
2714 (gnus-delete-line) | |
2715 (when (and (not discard) | |
2716 (setq entry (gnus-gethash group gnus-newsrc-hashtb))) | |
2717 (gnus-undo-register | |
2718 `(progn | |
2719 (gnus-group-goto-group ,(gnus-group-group-name)) | |
2720 (gnus-group-yank-group))) | |
2721 (push (cons (car entry) (nth 2 entry)) | |
2722 gnus-list-of-killed-groups)) | |
2723 (gnus-group-change-level | |
2724 (if entry entry group) gnus-level-killed (if entry nil level))) | |
2725 ;; If there are lots and lots of groups to be killed, we use | |
2726 ;; this thing instead. | |
2727 (let (entry) | |
2728 (setq groups (nreverse groups)) | |
2729 (while groups | |
2730 (gnus-group-remove-mark (setq group (pop groups))) | |
2731 (gnus-delete-line) | |
2732 (push group gnus-killed-list) | |
2733 (setq gnus-newsrc-alist | |
2734 (delq (assoc group gnus-newsrc-alist) | |
2735 gnus-newsrc-alist)) | |
2736 (when gnus-group-change-level-function | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2737 (funcall gnus-group-change-level-function |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2738 group gnus-level-killed 3)) |
17493 | 2739 (cond |
2740 ((setq entry (gnus-gethash group gnus-newsrc-hashtb)) | |
2741 (push (cons (car entry) (nth 2 entry)) | |
2742 gnus-list-of-killed-groups) | |
2743 (setcdr (cdr entry) (cdddr entry))) | |
2744 ((member group gnus-zombie-list) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2745 (setq gnus-zombie-list (delete group gnus-zombie-list)))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2746 ;; There may be more than one instance displayed. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2747 (while (gnus-group-goto-group group) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2748 (gnus-delete-line))) |
17493 | 2749 (gnus-make-hashtable-from-newsrc-alist))) |
2750 | |
2751 (gnus-group-position-point) | |
2752 (if (< (length out) 2) (car out) (nreverse out)))) | |
2753 | |
2754 (defun gnus-group-yank-group (&optional arg) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2755 "Yank the last newsgroups killed with \\[gnus-group-kill-group], inserting it before the current newsgroup. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2756 The numeric ARG specifies how many newsgroups are to be yanked. The |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2757 name of the newsgroup yanked is returned, or (if several groups are |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2758 yanked) a list of yanked groups is returned." |
17493 | 2759 (interactive "p") |
2760 (setq arg (or arg 1)) | |
2761 (let (info group prev out) | |
2762 (while (>= (decf arg) 0) | |
2763 (when (not (setq info (pop gnus-list-of-killed-groups))) | |
2764 (error "No more newsgroups to yank")) | |
2765 (push (setq group (nth 1 info)) out) | |
2766 ;; Find which newsgroup to insert this one before - search | |
2767 ;; backward until something suitable is found. If there are no | |
2768 ;; other newsgroups in this buffer, just make this newsgroup the | |
2769 ;; first newsgroup. | |
2770 (setq prev (gnus-group-group-name)) | |
2771 (gnus-group-change-level | |
2772 info (gnus-info-level (cdr info)) gnus-level-killed | |
2773 (and prev (gnus-gethash prev gnus-newsrc-hashtb)) | |
2774 t) | |
2775 (gnus-group-insert-group-line-info group) | |
2776 (gnus-undo-register | |
2777 `(when (gnus-group-goto-group ,group) | |
2778 (gnus-group-kill-group 1)))) | |
2779 (forward-line -1) | |
2780 (gnus-group-position-point) | |
2781 (if (< (length out) 2) (car out) (nreverse out)))) | |
2782 | |
2783 (defun gnus-group-kill-level (level) | |
2784 "Kill all groups that is on a certain LEVEL." | |
2785 (interactive "nKill all groups on level: ") | |
2786 (cond | |
2787 ((= level gnus-level-zombie) | |
2788 (setq gnus-killed-list | |
2789 (nconc gnus-zombie-list gnus-killed-list)) | |
2790 (setq gnus-zombie-list nil)) | |
2791 ((and (< level gnus-level-zombie) | |
2792 (> level 0) | |
2793 (or gnus-expert-user | |
2794 (gnus-yes-or-no-p | |
2795 (format | |
2796 "Do you really want to kill all groups on level %d? " | |
2797 level)))) | |
2798 (let* ((prev gnus-newsrc-alist) | |
2799 (alist (cdr prev))) | |
2800 (while alist | |
2801 (if (= (gnus-info-level (car alist)) level) | |
2802 (progn | |
2803 (push (gnus-info-group (car alist)) gnus-killed-list) | |
2804 (setcdr prev (cdr alist))) | |
2805 (setq prev alist)) | |
2806 (setq alist (cdr alist))) | |
2807 (gnus-make-hashtable-from-newsrc-alist) | |
2808 (gnus-group-list-groups))) | |
2809 (t | |
2810 (error "Can't kill; illegal level: %d" level)))) | |
2811 | |
2812 (defun gnus-group-list-all-groups (&optional arg) | |
2813 "List all newsgroups with level ARG or lower. | |
2814 Default is gnus-level-unsubscribed, which lists all subscribed and most | |
2815 unsubscribed groups." | |
2816 (interactive "P") | |
2817 (gnus-group-list-groups (or arg gnus-level-unsubscribed) t)) | |
2818 | |
2819 ;; Redefine this to list ALL killed groups if prefix arg used. | |
2820 ;; Rewritten by engstrom@src.honeywell.com (Eric Engstrom). | |
2821 (defun gnus-group-list-killed (&optional arg) | |
2822 "List all killed newsgroups in the group buffer. | |
2823 If ARG is non-nil, list ALL killed groups known to Gnus. This may | |
2824 entail asking the server for the groups." | |
2825 (interactive "P") | |
2826 ;; Find all possible killed newsgroups if arg. | |
2827 (when arg | |
2828 (gnus-get-killed-groups)) | |
2829 (if (not gnus-killed-list) | |
2830 (gnus-message 6 "No killed groups") | |
2831 (let (gnus-group-list-mode) | |
2832 (funcall gnus-group-prepare-function | |
2833 gnus-level-killed t gnus-level-killed)) | |
2834 (goto-char (point-min))) | |
2835 (gnus-group-position-point)) | |
2836 | |
2837 (defun gnus-group-list-zombies () | |
2838 "List all zombie newsgroups in the group buffer." | |
2839 (interactive) | |
2840 (if (not gnus-zombie-list) | |
2841 (gnus-message 6 "No zombie groups") | |
2842 (let (gnus-group-list-mode) | |
2843 (funcall gnus-group-prepare-function | |
2844 gnus-level-zombie t gnus-level-zombie)) | |
2845 (goto-char (point-min))) | |
2846 (gnus-group-position-point)) | |
2847 | |
2848 (defun gnus-group-list-active () | |
2849 "List all groups that are available from the server(s)." | |
2850 (interactive) | |
2851 ;; First we make sure that we have really read the active file. | |
2852 (unless (gnus-read-active-file-p) | |
2853 (let ((gnus-read-active-file t)) | |
2854 (gnus-read-active-file))) | |
2855 ;; Find all groups and sort them. | |
2856 (let ((groups | |
2857 (sort | |
2858 (let (list) | |
2859 (mapatoms | |
2860 (lambda (sym) | |
2861 (and (boundp sym) | |
2862 (symbol-value sym) | |
2863 (push (symbol-name sym) list))) | |
2864 gnus-active-hashtb) | |
2865 list) | |
2866 'string<)) | |
2867 (buffer-read-only nil) | |
2868 group) | |
2869 (erase-buffer) | |
2870 (while groups | |
2871 (gnus-add-text-properties | |
2872 (point) (prog1 (1+ (point)) | |
2873 (insert " *: " | |
2874 (setq group (pop groups)) "\n")) | |
2875 (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb) | |
2876 'gnus-unread t | |
2877 'gnus-level (inline (gnus-group-level group))))) | |
2878 (goto-char (point-min)))) | |
2879 | |
2880 (defun gnus-activate-all-groups (level) | |
2881 "Activate absolutely all groups." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2882 (interactive (list gnus-level-unsubscribed)) |
17493 | 2883 (let ((gnus-activate-level level) |
2884 (gnus-activate-foreign-newsgroups level)) | |
2885 (gnus-group-get-new-news))) | |
2886 | |
2887 (defun gnus-group-get-new-news (&optional arg) | |
2888 "Get newly arrived articles. | |
2889 If ARG is a number, it specifies which levels you are interested in | |
2890 re-scanning. If ARG is non-nil and not a number, this will force | |
2891 \"hard\" re-reading of the active files from all servers." | |
2892 (interactive "P") | |
2893 (let ((gnus-inhibit-demon t)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2894 (gnus-run-hooks 'gnus-get-new-news-hook) |
17493 | 2895 |
2896 ;; Read any slave files. | |
2897 (unless gnus-slave | |
2898 (gnus-master-read-slave-newsrc)) | |
2899 | |
2900 ;; We might read in new NoCeM messages here. | |
2901 (when (and gnus-use-nocem | |
2902 (null arg)) | |
2903 (gnus-nocem-scan-groups)) | |
2904 ;; If ARG is not a number, then we read the active file. | |
2905 (when (and arg (not (numberp arg))) | |
2906 (let ((gnus-read-active-file t)) | |
2907 (gnus-read-active-file)) | |
2908 (setq arg nil) | |
2909 | |
2910 ;; If the user wants it, we scan for new groups. | |
2911 (when (eq gnus-check-new-newsgroups 'always) | |
2912 (gnus-find-new-newsgroups))) | |
2913 | |
2914 (setq arg (gnus-group-default-level arg t)) | |
2915 (if (and gnus-read-active-file (not arg)) | |
2916 (progn | |
2917 (gnus-read-active-file) | |
2918 (gnus-get-unread-articles arg)) | |
2919 (let ((gnus-read-active-file (if arg nil gnus-read-active-file))) | |
2920 (gnus-get-unread-articles arg))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2921 (gnus-run-hooks 'gnus-after-getting-new-news-hook) |
17493 | 2922 (gnus-group-list-groups (and (numberp arg) |
2923 (max (car gnus-group-list-mode) arg))))) | |
2924 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2925 (defun gnus-group-get-new-news-this-group (&optional n dont-scan) |
17493 | 2926 "Check for newly arrived news in the current group (and the N-1 next groups). |
2927 The difference between N and the number of newsgroup checked is returned. | |
2928 If N is negative, this group and the N-1 previous groups will be checked." | |
2929 (interactive "P") | |
2930 (let* ((groups (gnus-group-process-prefix n)) | |
2931 (ret (if (numberp n) (- n (length groups)) 0)) | |
2932 (beg (unless n | |
2933 (point))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2934 group method) |
17493 | 2935 (while (setq group (pop groups)) |
2936 (gnus-group-remove-mark group) | |
2937 ;; Bypass any previous denials from the server. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2938 (gnus-remove-denial (setq method (gnus-find-method-for-group group))) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2939 (if (gnus-activate-group group (if dont-scan nil 'scan)) |
17493 | 2940 (progn |
2941 (gnus-get-unread-articles-in-group | |
2942 (gnus-get-info group) (gnus-active group) t) | |
2943 (unless (gnus-virtual-group-p group) | |
2944 (gnus-close-group group)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2945 (gnus-agent-save-group-info |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2946 method (gnus-group-real-name group) (gnus-active group)) |
17493 | 2947 (gnus-group-update-group group)) |
2948 (if (eq (gnus-server-status (gnus-find-method-for-group group)) | |
2949 'denied) | |
2950 (gnus-error 3 "Server denied access") | |
2951 (gnus-error 3 "%s error: %s" group (gnus-status-message group))))) | |
2952 (when beg | |
2953 (goto-char beg)) | |
2954 (when gnus-goto-next-group-when-activating | |
2955 (gnus-group-next-unread-group 1 t)) | |
2956 (gnus-summary-position-point) | |
2957 ret)) | |
2958 | |
2959 (defun gnus-group-fetch-faq (group &optional faq-dir) | |
2960 "Fetch the FAQ for the current group. | |
2961 If given a prefix argument, prompt for the FAQ dir | |
2962 to use." | |
2963 (interactive | |
2964 (list | |
2965 (gnus-group-group-name) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2966 (when current-prefix-arg |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2967 (completing-read |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2968 "Faq dir: " (and (listp gnus-group-faq-directory) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2969 (mapcar (lambda (file) (list file)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
2970 gnus-group-faq-directory)))))) |
17493 | 2971 (unless group |
2972 (error "No group name given")) | |
2973 (let ((dirs (or faq-dir gnus-group-faq-directory)) | |
2974 dir found file) | |
2975 (unless (listp dirs) | |
2976 (setq dirs (list dirs))) | |
2977 (while (and (not found) | |
2978 (setq dir (pop dirs))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2979 (let ((name (gnus-group-real-name group))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
2980 (setq file (concat (file-name-as-directory dir) name))) |
17493 | 2981 (if (not (file-exists-p file)) |
2982 (gnus-message 1 "No such file: %s" file) | |
2983 (let ((enable-local-variables nil)) | |
2984 (find-file file) | |
2985 (setq found t)))))) | |
2986 | |
2987 (defun gnus-group-describe-group (force &optional group) | |
2988 "Display a description of the current newsgroup." | |
2989 (interactive (list current-prefix-arg (gnus-group-group-name))) | |
2990 (let* ((method (gnus-find-method-for-group group)) | |
2991 (mname (gnus-group-prefixed-name "" method)) | |
2992 desc) | |
2993 (when (and force | |
2994 gnus-description-hashtb) | |
2995 (gnus-sethash mname nil gnus-description-hashtb)) | |
2996 (unless group | |
2997 (error "No group name given")) | |
2998 (when (or (and gnus-description-hashtb | |
2999 ;; We check whether this group's method has been | |
3000 ;; queried for a description file. | |
3001 (gnus-gethash mname gnus-description-hashtb)) | |
3002 (setq desc (gnus-group-get-description group)) | |
3003 (gnus-read-descriptions-file method)) | |
3004 (gnus-message 1 | |
3005 (or desc (gnus-gethash group gnus-description-hashtb) | |
3006 "No description available"))))) | |
3007 | |
3008 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>. | |
3009 (defun gnus-group-describe-all-groups (&optional force) | |
3010 "Pop up a buffer with descriptions of all newsgroups." | |
3011 (interactive "P") | |
3012 (when force | |
3013 (setq gnus-description-hashtb nil)) | |
3014 (when (not (or gnus-description-hashtb | |
3015 (gnus-read-all-descriptions-files))) | |
3016 (error "Couldn't request descriptions file")) | |
3017 (let ((buffer-read-only nil) | |
3018 b) | |
3019 (erase-buffer) | |
3020 (mapatoms | |
3021 (lambda (group) | |
3022 (setq b (point)) | |
3023 (insert (format " *: %-20s %s\n" (symbol-name group) | |
3024 (symbol-value group))) | |
3025 (gnus-add-text-properties | |
3026 b (1+ b) (list 'gnus-group group | |
3027 'gnus-unread t 'gnus-marked nil | |
3028 'gnus-level (1+ gnus-level-subscribed)))) | |
3029 gnus-description-hashtb) | |
3030 (goto-char (point-min)) | |
3031 (gnus-group-position-point))) | |
3032 | |
3033 ;; Suggested by Daniel Quinlan <quinlan@best.com>. | |
3034 (defun gnus-group-apropos (regexp &optional search-description) | |
3035 "List all newsgroups that have names that match a regexp." | |
3036 (interactive "sGnus apropos (regexp): ") | |
3037 (let ((prev "") | |
3038 (obuf (current-buffer)) | |
3039 groups des) | |
3040 ;; Go through all newsgroups that are known to Gnus. | |
3041 (mapatoms | |
3042 (lambda (group) | |
3043 (and (symbol-name group) | |
3044 (string-match regexp (symbol-name group)) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3045 (symbol-value group) |
17493 | 3046 (push (symbol-name group) groups))) |
3047 gnus-active-hashtb) | |
3048 ;; Also go through all descriptions that are known to Gnus. | |
3049 (when search-description | |
3050 (mapatoms | |
3051 (lambda (group) | |
3052 (and (string-match regexp (symbol-value group)) | |
3053 (push (symbol-name group) groups))) | |
3054 gnus-description-hashtb)) | |
3055 (if (not groups) | |
3056 (gnus-message 3 "No groups matched \"%s\"." regexp) | |
3057 ;; Print out all the groups. | |
3058 (save-excursion | |
3059 (pop-to-buffer "*Gnus Help*") | |
3060 (buffer-disable-undo (current-buffer)) | |
3061 (erase-buffer) | |
3062 (setq groups (sort groups 'string<)) | |
3063 (while groups | |
3064 ;; Groups may be entered twice into the list of groups. | |
3065 (when (not (string= (car groups) prev)) | |
3066 (insert (setq prev (car groups)) "\n") | |
3067 (when (and gnus-description-hashtb | |
3068 (setq des (gnus-gethash (car groups) | |
3069 gnus-description-hashtb))) | |
3070 (insert " " des "\n"))) | |
3071 (setq groups (cdr groups))) | |
3072 (goto-char (point-min)))) | |
3073 (pop-to-buffer obuf))) | |
3074 | |
3075 (defun gnus-group-description-apropos (regexp) | |
3076 "List all newsgroups that have names or descriptions that match a regexp." | |
3077 (interactive "sGnus description apropos (regexp): ") | |
3078 (when (not (or gnus-description-hashtb | |
3079 (gnus-read-all-descriptions-files))) | |
3080 (error "Couldn't request descriptions file")) | |
3081 (gnus-group-apropos regexp t)) | |
3082 | |
3083 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>. | |
3084 (defun gnus-group-list-matching (level regexp &optional all lowest) | |
3085 "List all groups with unread articles that match REGEXP. | |
3086 If the prefix LEVEL is non-nil, it should be a number that says which | |
3087 level to cut off listing groups. | |
3088 If ALL, also list groups with no unread articles. | |
3089 If LOWEST, don't list groups with level lower than LOWEST. | |
3090 | |
3091 This command may read the active file." | |
3092 (interactive "P\nsList newsgroups matching: ") | |
3093 ;; First make sure active file has been read. | |
3094 (when (and level | |
3095 (> (prefix-numeric-value level) gnus-level-killed)) | |
3096 (gnus-get-killed-groups)) | |
3097 (gnus-group-prepare-flat | |
3098 (or level gnus-level-subscribed) all (or lowest 1) regexp) | |
3099 (goto-char (point-min)) | |
3100 (gnus-group-position-point)) | |
3101 | |
3102 (defun gnus-group-list-all-matching (level regexp &optional lowest) | |
3103 "List all groups that match REGEXP. | |
3104 If the prefix LEVEL is non-nil, it should be a number that says which | |
3105 level to cut off listing groups. | |
3106 If LOWEST, don't list groups with level lower than LOWEST." | |
3107 (interactive "P\nsList newsgroups matching: ") | |
3108 (when level | |
3109 (setq level (prefix-numeric-value level))) | |
3110 (gnus-group-list-matching (or level gnus-level-killed) regexp t lowest)) | |
3111 | |
3112 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. | |
3113 (defun gnus-group-save-newsrc (&optional force) | |
3114 "Save the Gnus startup files. | |
3115 If FORCE, force saving whether it is necessary or not." | |
3116 (interactive "P") | |
3117 (gnus-save-newsrc-file force)) | |
3118 | |
3119 (defun gnus-group-restart (&optional arg) | |
3120 "Force Gnus to read the .newsrc file." | |
3121 (interactive "P") | |
3122 (when (gnus-yes-or-no-p | |
3123 (format "Are you sure you want to restart Gnus? ")) | |
3124 (gnus-save-newsrc-file) | |
3125 (gnus-clear-system) | |
3126 (gnus))) | |
3127 | |
3128 (defun gnus-group-read-init-file () | |
3129 "Read the Gnus elisp init file." | |
3130 (interactive) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3131 (gnus-read-init-file) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3132 (gnus-message 5 "Read %s" gnus-init-file)) |
17493 | 3133 |
3134 (defun gnus-group-check-bogus-groups (&optional silent) | |
3135 "Check bogus newsgroups. | |
3136 If given a prefix, don't ask for confirmation before removing a bogus | |
3137 group." | |
3138 (interactive "P") | |
3139 (gnus-check-bogus-newsgroups (and (not silent) (not gnus-expert-user))) | |
3140 (gnus-group-list-groups)) | |
3141 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3142 (defun gnus-group-find-new-groups (&optional arg) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3143 "Search for new groups and add them. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3144 Each new group will be treated with `gnus-subscribe-newsgroup-method.' |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3145 With 1 C-u, use the `ask-server' method to query the server for new |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3146 groups. |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3147 With 2 C-u's, use most complete method possible to query the server |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3148 for new groups, and subscribe the new groups as zombies." |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3149 (interactive "p") |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3150 (gnus-find-new-newsgroups (or arg 1)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19911
diff
changeset
|
3151 (gnus-group-list-groups)) |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3152 |
17493 | 3153 (defun gnus-group-edit-global-kill (&optional article group) |
3154 "Edit the global kill file. | |
3155 If GROUP, edit that local kill file instead." | |
3156 (interactive "P") | |
3157 (setq gnus-current-kill-article article) | |
3158 (gnus-kill-file-edit-file group) | |
3159 (gnus-message | |
3160 6 | |
3161 (substitute-command-keys | |
3162 (format "Editing a %s kill file (Type \\[gnus-kill-file-exit] to exit)" | |
3163 (if group "local" "global"))))) | |
3164 | |
3165 (defun gnus-group-edit-local-kill (article group) | |
3166 "Edit a local kill file." | |
3167 (interactive (list nil (gnus-group-group-name))) | |
3168 (gnus-group-edit-global-kill article group)) | |
3169 | |
3170 (defun gnus-group-force-update () | |
3171 "Update `.newsrc' file." | |
3172 (interactive) | |
3173 (gnus-save-newsrc-file)) | |
3174 | |
3175 (defun gnus-group-suspend () | |
3176 "Suspend the current Gnus session. | |
3177 In fact, cleanup buffers except for group mode buffer. | |
3178 The hook gnus-suspend-gnus-hook is called before actually suspending." | |
3179 (interactive) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3180 (gnus-run-hooks 'gnus-suspend-gnus-hook) |
17493 | 3181 ;; Kill Gnus buffers except for group mode buffer. |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3182 (let ((group-buf (get-buffer gnus-group-buffer))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3183 (mapcar (lambda (buf) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3184 (unless (member buf (list group-buf gnus-dribble-buffer)) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3185 (kill-buffer buf))) |
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3186 (gnus-buffers)) |
17493 | 3187 (gnus-kill-gnus-frames) |
3188 (when group-buf | |
3189 (bury-buffer group-buf) | |
3190 (delete-windows-on group-buf t)))) | |
3191 | |
3192 (defun gnus-group-clear-dribble () | |
3193 "Clear all information from the dribble buffer." | |
3194 (interactive) | |
3195 (gnus-dribble-clear) | |
3196 (gnus-message 7 "Cleared dribble buffer")) | |
3197 | |
3198 (defun gnus-group-exit () | |
3199 "Quit reading news after updating .newsrc.eld and .newsrc. | |
3200 The hook `gnus-exit-gnus-hook' is called before actually exiting." | |
3201 (interactive) | |
3202 (when | |
3203 (or noninteractive ;For gnus-batch-kill | |
3204 (not gnus-interactive-exit) ;Without confirmation | |
3205 gnus-expert-user | |
3206 (gnus-y-or-n-p "Are you sure you want to quit reading news? ")) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3207 (gnus-run-hooks 'gnus-exit-gnus-hook) |
17493 | 3208 ;; Offer to save data from non-quitted summary buffers. |
3209 (gnus-offer-save-summaries) | |
3210 ;; Save the newsrc file(s). | |
3211 (gnus-save-newsrc-file) | |
3212 ;; Kill-em-all. | |
3213 (gnus-close-backends) | |
3214 ;; Reset everything. | |
3215 (gnus-clear-system) | |
3216 ;; Allow the user to do things after cleaning up. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3217 (gnus-run-hooks 'gnus-after-exiting-gnus-hook))) |
17493 | 3218 |
3219 (defun gnus-group-quit () | |
3220 "Quit reading news without updating .newsrc.eld or .newsrc. | |
3221 The hook `gnus-exit-gnus-hook' is called before actually exiting." | |
3222 (interactive) | |
3223 (when (or noninteractive ;For gnus-batch-kill | |
3224 (zerop (buffer-size)) | |
3225 (not (gnus-server-opened gnus-select-method)) | |
3226 gnus-expert-user | |
3227 (not gnus-current-startup-file) | |
3228 (gnus-yes-or-no-p | |
3229 (format "Quit reading news without saving %s? " | |
3230 (file-name-nondirectory gnus-current-startup-file)))) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3231 (gnus-run-hooks 'gnus-exit-gnus-hook) |
17493 | 3232 (gnus-configure-windows 'group t) |
3233 (gnus-dribble-save) | |
3234 (gnus-close-backends) | |
3235 (gnus-clear-system) | |
3236 (gnus-kill-buffer gnus-group-buffer) | |
3237 ;; Allow the user to do things after cleaning up. | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3238 (gnus-run-hooks 'gnus-after-exiting-gnus-hook))) |
17493 | 3239 |
3240 (defun gnus-group-describe-briefly () | |
3241 "Give a one line description of the group mode commands." | |
3242 (interactive) | |
3243 (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"))) | |
3244 | |
3245 (defun gnus-group-browse-foreign-server (method) | |
3246 "Browse a foreign news server. | |
3247 If called interactively, this function will ask for a select method | |
3248 (nntp, nnspool, etc.) and a server address (eg. nntp.some.where). | |
3249 If not, METHOD should be a list where the first element is the method | |
3250 and the second element is the address." | |
3251 (interactive | |
3252 (list (let ((how (completing-read | |
3253 "Which backend: " | |
3254 (append gnus-valid-select-methods gnus-server-alist) | |
3255 nil t (cons "nntp" 0) 'gnus-method-history))) | |
3256 ;; We either got a backend name or a virtual server name. | |
3257 ;; If the first, we also need an address. | |
3258 (if (assoc how gnus-valid-select-methods) | |
3259 (list (intern how) | |
3260 ;; Suggested by mapjph@bath.ac.uk. | |
3261 (completing-read | |
3262 "Address: " | |
3263 (mapcar (lambda (server) (list server)) | |
3264 gnus-secondary-servers))) | |
3265 ;; We got a server name. | |
3266 how)))) | |
3267 (gnus-browse-foreign-server method)) | |
3268 | |
3269 (defun gnus-group-set-info (info &optional method-only-group part) | |
3270 (let* ((entry (gnus-gethash | |
3271 (or method-only-group (gnus-info-group info)) | |
3272 gnus-newsrc-hashtb)) | |
3273 (part-info info) | |
3274 (info (if method-only-group (nth 2 entry) info)) | |
3275 method) | |
3276 (when method-only-group | |
3277 (unless entry | |
3278 (error "Trying to change non-existent group %s" method-only-group)) | |
3279 ;; We have received parts of the actual group info - either the | |
3280 ;; select method or the group parameters. We first check | |
3281 ;; whether we have to extend the info, and if so, do that. | |
3282 (let ((len (length info)) | |
3283 (total (if (eq part 'method) 5 6))) | |
3284 (when (< len total) | |
3285 (setcdr (nthcdr (1- len) info) | |
3286 (make-list (- total len) nil))) | |
3287 ;; Then we enter the new info. | |
3288 (setcar (nthcdr (1- total) info) part-info))) | |
3289 (unless entry | |
3290 ;; This is a new group, so we just create it. | |
3291 (save-excursion | |
3292 (set-buffer gnus-group-buffer) | |
3293 (setq method (gnus-info-method info)) | |
3294 (when (gnus-server-equal method "native") | |
3295 (setq method nil)) | |
3296 (save-excursion | |
3297 (set-buffer gnus-group-buffer) | |
3298 (if method | |
3299 ;; It's a foreign group... | |
3300 (gnus-group-make-group | |
3301 (gnus-group-real-name (gnus-info-group info)) | |
3302 (if (stringp method) method | |
3303 (prin1-to-string (car method))) | |
3304 (and (consp method) | |
3305 (nth 1 (gnus-info-method info)))) | |
3306 ;; It's a native group. | |
3307 (gnus-group-make-group (gnus-info-group info)))) | |
3308 (gnus-message 6 "Note: New group created") | |
3309 (setq entry | |
3310 (gnus-gethash (gnus-group-prefixed-name | |
3311 (gnus-group-real-name (gnus-info-group info)) | |
3312 (or (gnus-info-method info) gnus-select-method)) | |
3313 gnus-newsrc-hashtb)))) | |
3314 ;; Whether it was a new group or not, we now have the entry, so we | |
3315 ;; can do the update. | |
3316 (if entry | |
3317 (progn | |
3318 (setcar (nthcdr 2 entry) info) | |
3319 (when (and (not (eq (car entry) t)) | |
3320 (gnus-active (gnus-info-group info))) | |
3321 (setcar entry (length (gnus-list-of-unread-articles (car info)))))) | |
3322 (error "No such group: %s" (gnus-info-group info))))) | |
3323 | |
3324 (defun gnus-group-set-method-info (group select-method) | |
3325 (gnus-group-set-info select-method group 'method)) | |
3326 | |
3327 (defun gnus-group-set-params-info (group params) | |
3328 (gnus-group-set-info params group 'params)) | |
3329 | |
3330 (defun gnus-add-marked-articles (group type articles &optional info force) | |
3331 ;; Add ARTICLES of TYPE to the info of GROUP. | |
3332 ;; If INFO is non-nil, use that info. If FORCE is non-nil, don't | |
3333 ;; add, but replace marked articles of TYPE with ARTICLES. | |
3334 (let ((info (or info (gnus-get-info group))) | |
3335 marked m) | |
3336 (or (not info) | |
3337 (and (not (setq marked (nthcdr 3 info))) | |
3338 (or (null articles) | |
3339 (setcdr (nthcdr 2 info) | |
3340 (list (list (cons type (gnus-compress-sequence | |
3341 articles t))))))) | |
3342 (and (not (setq m (assq type (car marked)))) | |
3343 (or (null articles) | |
3344 (setcar marked | |
3345 (cons (cons type (gnus-compress-sequence articles t) ) | |
3346 (car marked))))) | |
3347 (if force | |
3348 (if (null articles) | |
3349 (setcar (nthcdr 3 info) | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3350 (gnus-delete-alist type (car marked))) |
17493 | 3351 (setcdr m (gnus-compress-sequence articles t))) |
3352 (setcdr m (gnus-compress-sequence | |
3353 (sort (nconc (gnus-uncompress-range (cdr m)) | |
3354 (copy-sequence articles)) '<) t)))))) | |
3355 | |
3356 ;;; | |
3357 ;;; Group timestamps | |
3358 ;;; | |
3359 | |
3360 (defun gnus-group-set-timestamp () | |
3361 "Change the timestamp of the current group to the current time. | |
3362 This function can be used in hooks like `gnus-select-group-hook' | |
3363 or `gnus-group-catchup-group-hook'." | |
3364 (when gnus-newsgroup-name | |
3365 (let ((time (current-time))) | |
3366 (setcdr (cdr time) nil) | |
3367 (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time)))) | |
3368 | |
3369 (defsubst gnus-group-timestamp (group) | |
3370 "Return the timestamp for GROUP." | |
24357
15fc6acbae7a
Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19969
diff
changeset
|
3371 (gnus-group-get-parameter group 'timestamp t)) |
17493 | 3372 |
3373 (defun gnus-group-timestamp-delta (group) | |
3374 "Return the offset in seconds from the timestamp for GROUP to the current time, as a floating point number." | |
3375 (let* ((time (or (gnus-group-timestamp group) | |
3376 (list 0 0))) | |
3377 (delta (gnus-time-minus (current-time) time))) | |
3378 (+ (* (nth 0 delta) 65536.0) | |
3379 (nth 1 delta)))) | |
3380 | |
3381 (defun gnus-group-timestamp-string (group) | |
3382 "Return a string of the timestamp for GROUP." | |
3383 (let ((time (gnus-group-timestamp group))) | |
3384 (if (not time) | |
3385 "" | |
3386 (gnus-time-iso8601 time)))) | |
3387 | |
3388 (provide 'gnus-group) | |
3389 | |
3390 ;;; gnus-group.el ends here |