Mercurial > emacs
annotate lisp/gnus/gnus-sum.el @ 20030:4e45c8db30cb
(command-line): Don't suppress suffix search.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 11 Oct 1997 03:54:19 +0000 |
parents | 9049c6de031f |
children | b84c6ec5f561 |
rev | line source |
---|---|
17493 | 1 ;;; gnus-sum.el --- summary mode commands for Gnus |
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc. | |
3 | |
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no> | |
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:
17493
diff
changeset
|
28 (eval-when-compile (require 'cl)) |
6f6cf9184e93
Require cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
17493
diff
changeset
|
29 |
17493 | 30 (require 'gnus) |
31 (require 'gnus-group) | |
32 (require 'gnus-spec) | |
33 (require 'gnus-range) | |
34 (require 'gnus-int) | |
35 (require 'gnus-undo) | |
36 | |
37 (defcustom gnus-kill-summary-on-exit t | |
38 "*If non-nil, kill the summary buffer when you exit from it. | |
39 If nil, the summary will become a \"*Dead Summary*\" buffer, and | |
40 it will be killed sometime later." | |
41 :group 'gnus-summary-exit | |
42 :type 'boolean) | |
43 | |
44 (defcustom gnus-fetch-old-headers nil | |
45 "*Non-nil means that Gnus will try to build threads by grabbing old headers. | |
46 If an unread article in the group refers to an older, already read (or | |
47 just marked as read) article, the old article will not normally be | |
48 displayed in the Summary buffer. If this variable is non-nil, Gnus | |
49 will attempt to grab the headers to the old articles, and thereby | |
50 build complete threads. If it has the value `some', only enough | |
51 headers to connect otherwise loose threads will be displayed. | |
52 This variable can also be a number. In that case, no more than that | |
53 number of old headers will be fetched. | |
54 | |
55 The server has to support NOV for any of this to work." | |
56 :group 'gnus-thread | |
57 :type '(choice (const :tag "off" nil) | |
58 (const some) | |
59 number | |
60 (sexp :menu-tag "other" t))) | |
61 | |
62 (defcustom gnus-summary-make-false-root 'adopt | |
63 "*nil means that Gnus won't gather loose threads. | |
64 If the root of a thread has expired or been read in a previous | |
65 session, the information necessary to build a complete thread has been | |
66 lost. Instead of having many small sub-threads from this original thread | |
67 scattered all over the summary buffer, Gnus can gather them. | |
68 | |
69 If non-nil, Gnus will try to gather all loose sub-threads from an | |
70 original thread into one large thread. | |
71 | |
72 If this variable is non-nil, it should be one of `none', `adopt', | |
73 `dummy' or `empty'. | |
74 | |
75 If this variable is `none', Gnus will not make a false root, but just | |
76 present the sub-threads after another. | |
77 If this variable is `dummy', Gnus will create a dummy root that will | |
78 have all the sub-threads as children. | |
79 If this variable is `adopt', Gnus will make one of the \"children\" | |
80 the parent and mark all the step-children as such. | |
81 If this variable is `empty', the \"children\" are printed with empty | |
82 subject fields. (Or rather, they will be printed with a string | |
83 given by the `gnus-summary-same-subject' variable.)" | |
84 :group 'gnus-thread | |
85 :type '(choice (const :tag "off" nil) | |
86 (const none) | |
87 (const dummy) | |
88 (const adopt) | |
89 (const empty))) | |
90 | |
91 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$" | |
92 "*A regexp to match subjects to be excluded from loose thread gathering. | |
93 As loose thread gathering is done on subjects only, that means that | |
94 there can be many false gatherings performed. By rooting out certain | |
95 common subjects, gathering might become saner." | |
96 :group 'gnus-thread | |
97 :type 'regexp) | |
98 | |
99 (defcustom gnus-summary-gather-subject-limit nil | |
100 "*Maximum length of subject comparisons when gathering loose threads. | |
101 Use nil to compare full subjects. Setting this variable to a low | |
102 number will help gather threads that have been corrupted by | |
103 newsreaders chopping off subject lines, but it might also mean that | |
104 unrelated articles that have subject that happen to begin with the | |
105 same few characters will be incorrectly gathered. | |
106 | |
107 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when | |
108 comparing subjects." | |
109 :group 'gnus-thread | |
110 :type '(choice (const :tag "off" nil) | |
111 (const fuzzy) | |
112 (sexp :menu-tag "on" t))) | |
113 | |
114 (defcustom gnus-simplify-ignored-prefixes nil | |
115 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily." | |
116 :group 'gnus-thread | |
117 :type '(choice (const :tag "off" nil) | |
118 regexp)) | |
119 | |
120 (defcustom gnus-build-sparse-threads nil | |
121 "*If non-nil, fill in the gaps in threads. | |
122 If `some', only fill in the gaps that are needed to tie loose threads | |
123 together. If `more', fill in all leaf nodes that Gnus can find. If | |
124 non-nil and non-`some', fill in all gaps that Gnus manages to guess." | |
125 :group 'gnus-thread | |
126 :type '(choice (const :tag "off" nil) | |
127 (const some) | |
128 (const more) | |
129 (sexp :menu-tag "all" t))) | |
130 | |
131 (defcustom gnus-summary-thread-gathering-function | |
132 'gnus-gather-threads-by-subject | |
133 "Function used for gathering loose threads. | |
134 There are two pre-defined functions: `gnus-gather-threads-by-subject', | |
135 which only takes Subjects into consideration; and | |
136 `gnus-gather-threads-by-references', which compared the References | |
137 headers of the articles to find matches." | |
138 :group 'gnus-thread | |
19912
4355457d9749
(gnus-summary-thread-gathering-function): Fix customize type.
Richard M. Stallman <rms@gnu.org>
parents:
19594
diff
changeset
|
139 :type '(radio (function-item gnus-gather-threads-by-subject) |
4355457d9749
(gnus-summary-thread-gathering-function): Fix customize type.
Richard M. Stallman <rms@gnu.org>
parents:
19594
diff
changeset
|
140 (function-item gnus-gather-threads-by-references) |
4355457d9749
(gnus-summary-thread-gathering-function): Fix customize type.
Richard M. Stallman <rms@gnu.org>
parents:
19594
diff
changeset
|
141 (function :tag "other"))) |
17493 | 142 |
143 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>. | |
144 (defcustom gnus-summary-same-subject "" | |
145 "*String indicating that the current article has the same subject as the previous. | |
146 This variable will only be used if the value of | |
147 `gnus-summary-make-false-root' is `empty'." | |
148 :group 'gnus-summary-format | |
149 :type 'string) | |
150 | |
151 (defcustom gnus-summary-goto-unread t | |
152 "*If t, marking commands will go to the next unread article. | |
153 If `never', commands that usually go to the next unread article, will | |
154 go to the next article, whether it is read or not. | |
155 If nil, only the marking commands will go to the next (un)read article." | |
156 :group 'gnus-summary-marks | |
157 :link '(custom-manual "(gnus)Setting Marks") | |
158 :type '(choice (const :tag "off" nil) | |
159 (const never) | |
160 (sexp :menu-tag "on" t))) | |
161 | |
162 (defcustom gnus-summary-default-score 0 | |
163 "*Default article score level. | |
164 All scores generated by the score files will be added to this score. | |
165 If this variable is nil, scoring will be disabled." | |
166 :group 'gnus-score-default | |
167 :type '(choice (const :tag "disable") | |
168 integer)) | |
169 | |
170 (defcustom gnus-summary-zcore-fuzz 0 | |
171 "*Fuzziness factor for the zcore in the summary buffer. | |
172 Articles with scores closer than this to `gnus-summary-default-score' | |
173 will not be marked." | |
174 :group 'gnus-summary-format | |
175 :type 'integer) | |
176 | |
177 (defcustom gnus-simplify-subject-fuzzy-regexp nil | |
178 "*Strings to be removed when doing fuzzy matches. | |
179 This can either be a regular expression or list of regular expressions | |
180 that will be removed from subject strings if fuzzy subject | |
181 simplification is selected." | |
182 :group 'gnus-thread | |
183 :type '(repeat regexp)) | |
184 | |
185 (defcustom gnus-show-threads t | |
186 "*If non-nil, display threads in summary mode." | |
187 :group 'gnus-thread | |
188 :type 'boolean) | |
189 | |
190 (defcustom gnus-thread-hide-subtree nil | |
191 "*If non-nil, hide all threads initially. | |
192 If threads are hidden, you have to run the command | |
193 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook' | |
194 to expose hidden threads." | |
195 :group 'gnus-thread | |
196 :type 'boolean) | |
197 | |
198 (defcustom gnus-thread-hide-killed t | |
199 "*If non-nil, hide killed threads automatically." | |
200 :group 'gnus-thread | |
201 :type 'boolean) | |
202 | |
203 (defcustom gnus-thread-ignore-subject nil | |
204 "*If non-nil, ignore subjects and do all threading based on the Reference header. | |
205 If nil, which is the default, articles that have different subjects | |
206 from their parents will start separate threads." | |
207 :group 'gnus-thread | |
208 :type 'boolean) | |
209 | |
210 (defcustom gnus-thread-operation-ignore-subject t | |
211 "*If non-nil, subjects will be ignored when doing thread commands. | |
212 This affects commands like `gnus-summary-kill-thread' and | |
213 `gnus-summary-lower-thread'. | |
214 | |
215 If this variable is nil, articles in the same thread with different | |
216 subjects will not be included in the operation in question. If this | |
217 variable is `fuzzy', only articles that have subjects that are fuzzily | |
218 equal will be included." | |
219 :group 'gnus-thread | |
220 :type '(choice (const :tag "off" nil) | |
221 (const fuzzy) | |
222 (sexp :tag "on" t))) | |
223 | |
224 (defcustom gnus-thread-indent-level 4 | |
225 "*Number that says how much each sub-thread should be indented." | |
226 :group 'gnus-thread | |
227 :type 'integer) | |
228 | |
229 (defcustom gnus-auto-extend-newsgroup t | |
230 "*If non-nil, extend newsgroup forward and backward when requested." | |
231 :group 'gnus-summary-choose | |
232 :type 'boolean) | |
233 | |
234 (defcustom gnus-auto-select-first t | |
235 "*If nil, don't select the first unread article when entering a group. | |
236 If this variable is `best', select the highest-scored unread article | |
237 in the group. If neither nil nor `best', select the first unread | |
238 article. | |
239 | |
240 If you want to prevent automatic selection of the first unread article | |
241 in some newsgroups, set the variable to nil in | |
242 `gnus-select-group-hook'." | |
243 :group 'gnus-group-select | |
244 :type '(choice (const :tag "none" nil) | |
245 (const best) | |
246 (sexp :menu-tag "first" t))) | |
247 | |
248 (defcustom gnus-auto-select-next t | |
249 "*If non-nil, offer to go to the next group from the end of the previous. | |
250 If the value is t and the next newsgroup is empty, Gnus will exit | |
251 summary mode and go back to group mode. If the value is neither nil | |
252 nor t, Gnus will select the following unread newsgroup. In | |
253 particular, if the value is the symbol `quietly', the next unread | |
254 newsgroup will be selected without any confirmation, and if it is | |
255 `almost-quietly', the next group will be selected without any | |
256 confirmation if you are located on the last article in the group. | |
257 Finally, if this variable is `slightly-quietly', the `Z n' command | |
258 will go to the next group without confirmation." | |
259 :group 'gnus-summary-maneuvering | |
260 :type '(choice (const :tag "off" nil) | |
261 (const quietly) | |
262 (const almost-quietly) | |
263 (const slightly-quietly) | |
264 (sexp :menu-tag "on" t))) | |
265 | |
266 (defcustom gnus-auto-select-same nil | |
267 "*If non-nil, select the next article with the same subject." | |
268 :group 'gnus-summary-maneuvering | |
269 :type 'boolean) | |
270 | |
271 (defcustom gnus-summary-check-current nil | |
272 "*If non-nil, consider the current article when moving. | |
273 The \"unread\" movement commands will stay on the same line if the | |
274 current article is unread." | |
275 :group 'gnus-summary-maneuvering | |
276 :type 'boolean) | |
277 | |
278 (defcustom gnus-auto-center-summary t | |
279 "*If non-nil, always center the current summary buffer. | |
280 In particular, if `vertical' do only vertical recentering. If non-nil | |
281 and non-`vertical', do both horizontal and vertical recentering." | |
282 :group 'gnus-summary-maneuvering | |
283 :type '(choice (const :tag "none" nil) | |
284 (const vertical) | |
285 (sexp :menu-tag "both" t))) | |
286 | |
287 (defcustom gnus-show-all-headers nil | |
288 "*If non-nil, don't hide any headers." | |
289 :group 'gnus-article-hiding | |
290 :group 'gnus-article-headers | |
291 :type 'boolean) | |
292 | |
293 (defcustom gnus-summary-ignore-duplicates nil | |
294 "*If non-nil, ignore articles with identical Message-ID headers." | |
295 :group 'gnus-summary | |
296 :type 'boolean) | |
297 | |
298 (defcustom gnus-single-article-buffer t | |
299 "*If non-nil, display all articles in the same buffer. | |
300 If nil, each group will get its own article buffer." | |
301 :group 'gnus-article-various | |
302 :type 'boolean) | |
303 | |
304 (defcustom gnus-break-pages t | |
305 "*If non-nil, do page breaking on articles. | |
306 The page delimiter is specified by the `gnus-page-delimiter' | |
307 variable." | |
308 :group 'gnus-article-various | |
309 :type 'boolean) | |
310 | |
311 (defcustom gnus-show-mime nil | |
312 "*If non-nil, do mime processing of articles. | |
313 The articles will simply be fed to the function given by | |
314 `gnus-show-mime-method'." | |
315 :group 'gnus-article-mime | |
316 :type 'boolean) | |
317 | |
318 (defcustom gnus-move-split-methods nil | |
319 "*Variable used to suggest where articles are to be moved to. | |
320 It uses the same syntax as the `gnus-split-methods' variable." | |
321 :group 'gnus-summary-mail | |
322 :type '(repeat (choice (list function) | |
323 (cons regexp (repeat string)) | |
324 sexp))) | |
325 | |
326 (defcustom gnus-unread-mark ? | |
327 "*Mark used for unread articles." | |
328 :group 'gnus-summary-marks | |
329 :type 'character) | |
330 | |
331 (defcustom gnus-ticked-mark ?! | |
332 "*Mark used for ticked articles." | |
333 :group 'gnus-summary-marks | |
334 :type 'character) | |
335 | |
336 (defcustom gnus-dormant-mark ?? | |
337 "*Mark used for dormant articles." | |
338 :group 'gnus-summary-marks | |
339 :type 'character) | |
340 | |
341 (defcustom gnus-del-mark ?r | |
342 "*Mark used for del'd articles." | |
343 :group 'gnus-summary-marks | |
344 :type 'character) | |
345 | |
346 (defcustom gnus-read-mark ?R | |
347 "*Mark used for read articles." | |
348 :group 'gnus-summary-marks | |
349 :type 'character) | |
350 | |
351 (defcustom gnus-expirable-mark ?E | |
352 "*Mark used for expirable articles." | |
353 :group 'gnus-summary-marks | |
354 :type 'character) | |
355 | |
356 (defcustom gnus-killed-mark ?K | |
357 "*Mark used for killed articles." | |
358 :group 'gnus-summary-marks | |
359 :type 'character) | |
360 | |
361 (defcustom gnus-souped-mark ?F | |
362 "*Mark used for killed articles." | |
363 :group 'gnus-summary-marks | |
364 :type 'character) | |
365 | |
366 (defcustom gnus-kill-file-mark ?X | |
367 "*Mark used for articles killed by kill files." | |
368 :group 'gnus-summary-marks | |
369 :type 'character) | |
370 | |
371 (defcustom gnus-low-score-mark ?Y | |
372 "*Mark used for articles with a low score." | |
373 :group 'gnus-summary-marks | |
374 :type 'character) | |
375 | |
376 (defcustom gnus-catchup-mark ?C | |
377 "*Mark used for articles that are caught up." | |
378 :group 'gnus-summary-marks | |
379 :type 'character) | |
380 | |
381 (defcustom gnus-replied-mark ?A | |
382 "*Mark used for articles that have been replied to." | |
383 :group 'gnus-summary-marks | |
384 :type 'character) | |
385 | |
386 (defcustom gnus-cached-mark ?* | |
387 "*Mark used for articles that are in the cache." | |
388 :group 'gnus-summary-marks | |
389 :type 'character) | |
390 | |
391 (defcustom gnus-saved-mark ?S | |
392 "*Mark used for articles that have been saved to." | |
393 :group 'gnus-summary-marks | |
394 :type 'character) | |
395 | |
396 (defcustom gnus-ancient-mark ?O | |
397 "*Mark used for ancient articles." | |
398 :group 'gnus-summary-marks | |
399 :type 'character) | |
400 | |
401 (defcustom gnus-sparse-mark ?Q | |
402 "*Mark used for sparsely reffed articles." | |
403 :group 'gnus-summary-marks | |
404 :type 'character) | |
405 | |
406 (defcustom gnus-canceled-mark ?G | |
407 "*Mark used for canceled articles." | |
408 :group 'gnus-summary-marks | |
409 :type 'character) | |
410 | |
411 (defcustom gnus-duplicate-mark ?M | |
412 "*Mark used for duplicate articles." | |
413 :group 'gnus-summary-marks | |
414 :type 'character) | |
415 | |
416 (defcustom gnus-score-over-mark ?+ | |
417 "*Score mark used for articles with high scores." | |
418 :group 'gnus-summary-marks | |
419 :type 'character) | |
420 | |
421 (defcustom gnus-score-below-mark ?- | |
422 "*Score mark used for articles with low scores." | |
423 :group 'gnus-summary-marks | |
424 :type 'character) | |
425 | |
426 (defcustom gnus-empty-thread-mark ? | |
427 "*There is no thread under the article." | |
428 :group 'gnus-summary-marks | |
429 :type 'character) | |
430 | |
431 (defcustom gnus-not-empty-thread-mark ?= | |
432 "*There is a thread under the article." | |
433 :group 'gnus-summary-marks | |
434 :type 'character) | |
435 | |
436 (defcustom gnus-view-pseudo-asynchronously nil | |
437 "*If non-nil, Gnus will view pseudo-articles asynchronously." | |
438 :group 'gnus-extract-view | |
439 :type 'boolean) | |
440 | |
441 (defcustom gnus-view-pseudos nil | |
442 "*If `automatic', pseudo-articles will be viewed automatically. | |
443 If `not-confirm', pseudos will be viewed automatically, and the user | |
444 will not be asked to confirm the command." | |
445 :group 'gnus-extract-view | |
446 :type '(choice (const :tag "off" nil) | |
447 (const automatic) | |
448 (const not-confirm))) | |
449 | |
450 (defcustom gnus-view-pseudos-separately t | |
451 "*If non-nil, one pseudo-article will be created for each file to be viewed. | |
452 If nil, all files that use the same viewing command will be given as a | |
453 list of parameters to that command." | |
454 :group 'gnus-extract-view | |
455 :type 'boolean) | |
456 | |
457 (defcustom gnus-insert-pseudo-articles t | |
458 "*If non-nil, insert pseudo-articles when decoding articles." | |
459 :group 'gnus-extract-view | |
460 :type 'boolean) | |
461 | |
462 (defcustom gnus-summary-dummy-line-format | |
463 "* %(: :%) %S\n" | |
464 "*The format specification for the dummy roots in the summary buffer. | |
465 It works along the same lines as a normal formatting string, | |
466 with some simple extensions. | |
467 | |
468 %S The subject" | |
469 :group 'gnus-threading | |
470 :type 'string) | |
471 | |
472 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z" | |
473 "*The format specification for the summary mode line. | |
474 It works along the same lines as a normal formatting string, | |
475 with some simple extensions: | |
476 | |
477 %G Group name | |
478 %p Unprefixed group name | |
479 %A Current article number | |
480 %V Gnus version | |
481 %U Number of unread articles in the group | |
482 %e Number of unselected articles in the group | |
483 %Z A string with unread/unselected article counts | |
484 %g Shortish group name | |
485 %S Subject of the current article | |
486 %u User-defined spec | |
487 %s Current score file name | |
488 %d Number of dormant articles | |
489 %r Number of articles that have been marked as read in this session | |
490 %E Number of articles expunged by the score files" | |
491 :group 'gnus-summary-format | |
492 :type 'string) | |
493 | |
494 (defcustom gnus-summary-mark-below 0 | |
495 "*Mark all articles with a score below this variable as read. | |
496 This variable is local to each summary buffer and usually set by the | |
497 score file." | |
498 :group 'gnus-score-default | |
499 :type 'integer) | |
500 | |
501 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number) | |
502 "*List of functions used for sorting articles in the summary buffer. | |
503 This variable is only used when not using a threaded display." | |
504 :group 'gnus-summary-sort | |
505 :type '(repeat (choice (function-item gnus-article-sort-by-number) | |
506 (function-item gnus-article-sort-by-author) | |
507 (function-item gnus-article-sort-by-subject) | |
508 (function-item gnus-article-sort-by-date) | |
509 (function-item gnus-article-sort-by-score) | |
510 (function :tag "other")))) | |
511 | |
512 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number) | |
513 "*List of functions used for sorting threads in the summary buffer. | |
514 By default, threads are sorted by article number. | |
515 | |
516 Each function takes two threads and return non-nil if the first thread | |
517 should be sorted before the other. If you use more than one function, | |
518 the primary sort function should be the last. You should probably | |
519 always include `gnus-thread-sort-by-number' in the list of sorting | |
520 functions -- preferably first. | |
521 | |
522 Ready-made functions include `gnus-thread-sort-by-number', | |
523 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject', | |
524 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and | |
525 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')." | |
526 :group 'gnus-summary-sort | |
527 :type '(repeat (choice (function-item gnus-thread-sort-by-number) | |
528 (function-item gnus-thread-sort-by-author) | |
529 (function-item gnus-thread-sort-by-subject) | |
530 (function-item gnus-thread-sort-by-date) | |
531 (function-item gnus-thread-sort-by-score) | |
532 (function-item gnus-thread-sort-by-total-score) | |
533 (function :tag "other")))) | |
534 | |
535 (defcustom gnus-thread-score-function '+ | |
536 "*Function used for calculating the total score of a thread. | |
537 | |
538 The function is called with the scores of the article and each | |
539 subthread and should then return the score of the thread. | |
540 | |
541 Some functions you can use are `+', `max', or `min'." | |
542 :group 'gnus-summary-sort | |
543 :type 'function) | |
544 | |
545 (defcustom gnus-summary-expunge-below nil | |
546 "All articles that have a score less than this variable will be expunged." | |
547 :group 'gnus-score-default | |
548 :type '(choice (const :tag "off" nil) | |
549 integer)) | |
550 | |
551 (defcustom gnus-thread-expunge-below nil | |
552 "All threads that have a total score less than this variable will be expunged. | |
553 See `gnus-thread-score-function' for en explanation of what a | |
554 \"thread score\" is." | |
555 :group 'gnus-treading | |
556 :group 'gnus-score-default | |
557 :type '(choice (const :tag "off" nil) | |
558 integer)) | |
559 | |
560 (defcustom gnus-summary-mode-hook nil | |
561 "*A hook for Gnus summary mode. | |
562 This hook is run before any variables are set in the summary buffer." | |
563 :group 'gnus-summary-various | |
564 :type 'hook) | |
565 | |
566 (defcustom gnus-summary-menu-hook nil | |
567 "*Hook run after the creation of the summary mode menu." | |
568 :group 'gnus-summary-visual | |
569 :type 'hook) | |
570 | |
571 (defcustom gnus-summary-exit-hook nil | |
572 "*A hook called on exit from the summary buffer. | |
573 It will be called with point in the group buffer." | |
574 :group 'gnus-summary-exit | |
575 :type 'hook) | |
576 | |
577 (defcustom gnus-summary-prepare-hook nil | |
578 "*A hook called after the summary buffer has been generated. | |
579 If you want to modify the summary buffer, you can use this hook." | |
580 :group 'gnus-summary-various | |
581 :type 'hook) | |
582 | |
583 (defcustom gnus-summary-generate-hook nil | |
584 "*A hook run just before generating the summary buffer. | |
585 This hook is commonly used to customize threading variables and the | |
586 like." | |
587 :group 'gnus-summary-various | |
588 :type 'hook) | |
589 | |
590 (defcustom gnus-select-group-hook nil | |
591 "*A hook called when a newsgroup is selected. | |
592 | |
593 If you'd like to simplify subjects like the | |
594 `gnus-summary-next-same-subject' command does, you can use the | |
595 following hook: | |
596 | |
597 (setq gnus-select-group-hook | |
598 (list | |
599 (lambda () | |
600 (mapcar (lambda (header) | |
601 (mail-header-set-subject | |
602 header | |
603 (gnus-simplify-subject | |
604 (mail-header-subject header) 're-only))) | |
605 gnus-newsgroup-headers))))" | |
606 :group 'gnus-group-select | |
607 :type 'hook) | |
608 | |
609 (defcustom gnus-select-article-hook nil | |
610 "*A hook called when an article is selected." | |
611 :group 'gnus-summary-choose | |
612 :type 'hook) | |
613 | |
614 (defcustom gnus-visual-mark-article-hook | |
615 (list 'gnus-highlight-selected-summary) | |
616 "*Hook run after selecting an article in the summary buffer. | |
617 It is meant to be used for highlighting the article in some way. It | |
618 is not run if `gnus-visual' is nil." | |
619 :group 'gnus-summary-visual | |
620 :type 'hook) | |
621 | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
622 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
623 (defcustom gnus-structured-field-decoder |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
624 (if (featurep 'mule) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
625 (lambda (string) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
626 (if gnus-mule-coding-system |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
627 (decode-coding-string string gnus-mule-coding-system) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
628 ))) |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
629 "Function to decode non-ASCII characters in structured field for summary." |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
630 :group 'gnus-various |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
631 :type 'function) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
632 |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
633 (defcustom gnus-unstructured-field-decoder |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
634 (if (featurep 'mule) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
635 (lambda (string) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
636 (if gnus-mule-coding-system |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
637 (decode-coding-string string gnus-mule-coding-system) |
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
638 ))) |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
639 "Function to decode non-ASCII characters in unstructured field for summary." |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
640 :group 'gnus-various |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
641 :type 'function) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
642 |
17493 | 643 (defcustom gnus-parse-headers-hook |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
644 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522) |
17493 | 645 "*A hook called before parsing the headers." |
646 :group 'gnus-various | |
647 :type 'hook) | |
648 | |
649 (defcustom gnus-exit-group-hook nil | |
650 "*A hook called when exiting (not quitting) summary mode." | |
651 :group 'gnus-various | |
652 :type 'hook) | |
653 | |
654 (defcustom gnus-summary-update-hook | |
655 (list 'gnus-summary-highlight-line) | |
656 "*A hook called when a summary line is changed. | |
657 The hook will not be called if `gnus-visual' is nil. | |
658 | |
659 The default function `gnus-summary-highlight-line' will | |
660 highlight the line according to the `gnus-summary-highlight' | |
661 variable." | |
662 :group 'gnus-summary-visual | |
663 :type 'hook) | |
664 | |
665 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read) | |
666 "*A hook called when an article is selected for the first time. | |
667 The hook is intended to mark an article as read (or unread) | |
668 automatically when it is selected." | |
669 :group 'gnus-summary-choose | |
670 :type 'hook) | |
671 | |
672 (defcustom gnus-group-no-more-groups-hook nil | |
673 "*A hook run when returning to group mode having no more (unread) groups." | |
674 :group 'gnus-group-select | |
675 :type 'hook) | |
676 | |
677 (defcustom gnus-ps-print-hook nil | |
678 "*A hook run before ps-printing something from Gnus." | |
679 :group 'gnus-summary | |
680 :type 'hook) | |
681 | |
682 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face | |
683 "Face used for highlighting the current article in the summary buffer." | |
684 :group 'gnus-summary-visual | |
685 :type 'face) | |
686 | |
687 (defcustom gnus-summary-highlight | |
688 '(((= mark gnus-canceled-mark) | |
689 . gnus-summary-cancelled-face) | |
690 ((and (> score default) | |
691 (or (= mark gnus-dormant-mark) | |
692 (= mark gnus-ticked-mark))) | |
693 . gnus-summary-high-ticked-face) | |
694 ((and (< score default) | |
695 (or (= mark gnus-dormant-mark) | |
696 (= mark gnus-ticked-mark))) | |
697 . gnus-summary-low-ticked-face) | |
698 ((or (= mark gnus-dormant-mark) | |
699 (= mark gnus-ticked-mark)) | |
700 . gnus-summary-normal-ticked-face) | |
701 ((and (> score default) (= mark gnus-ancient-mark)) | |
702 . gnus-summary-high-ancient-face) | |
703 ((and (< score default) (= mark gnus-ancient-mark)) | |
704 . gnus-summary-low-ancient-face) | |
705 ((= mark gnus-ancient-mark) | |
706 . gnus-summary-normal-ancient-face) | |
707 ((and (> score default) (= mark gnus-unread-mark)) | |
708 . gnus-summary-high-unread-face) | |
709 ((and (< score default) (= mark gnus-unread-mark)) | |
710 . gnus-summary-low-unread-face) | |
711 ((and (= mark gnus-unread-mark)) | |
712 . gnus-summary-normal-unread-face) | |
713 ((> score default) | |
714 . gnus-summary-high-read-face) | |
715 ((< score default) | |
716 . gnus-summary-low-read-face) | |
717 (t | |
718 . gnus-summary-normal-read-face)) | |
719 "Controls the highlighting of summary buffer lines. | |
720 | |
721 A list of (FORM . FACE) pairs. When deciding how a a particular | |
722 summary line should be displayed, each form is evaluated. The content | |
723 of the face field after the first true form is used. You can change | |
724 how those summary lines are displayed, by editing the face field. | |
725 | |
726 You can use the following variables in the FORM field. | |
727 | |
728 score: The articles score | |
729 default: The default article score. | |
730 below: The score below which articles are automatically marked as read. | |
731 mark: The articles mark." | |
732 :group 'gnus-summary-visual | |
733 :type '(repeat (cons (sexp :tag "Form" nil) | |
734 face))) | |
735 | |
736 | |
737 ;;; Internal variables | |
738 | |
739 (defvar gnus-scores-exclude-files nil) | |
740 (defvar gnus-page-broken nil) | |
741 | |
742 (defvar gnus-original-article nil) | |
743 (defvar gnus-article-internal-prepare-hook nil) | |
744 (defvar gnus-newsgroup-process-stack nil) | |
745 | |
746 (defvar gnus-thread-indent-array nil) | |
747 (defvar gnus-thread-indent-array-level gnus-thread-indent-level) | |
748 | |
749 ;; Avoid highlighting in kill files. | |
750 (defvar gnus-summary-inhibit-highlight nil) | |
751 (defvar gnus-newsgroup-selected-overlay nil) | |
752 (defvar gnus-inhibit-limiting nil) | |
753 (defvar gnus-newsgroup-adaptive-score-file nil) | |
754 (defvar gnus-current-score-file nil) | |
755 (defvar gnus-current-move-group nil) | |
756 (defvar gnus-current-copy-group nil) | |
757 (defvar gnus-current-crosspost-group nil) | |
758 | |
759 (defvar gnus-newsgroup-dependencies nil) | |
760 (defvar gnus-newsgroup-adaptive nil) | |
761 (defvar gnus-summary-display-article-function nil) | |
762 (defvar gnus-summary-highlight-line-function nil | |
763 "Function called after highlighting a summary line.") | |
764 | |
765 (defvar gnus-summary-line-format-alist | |
766 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d) | |
767 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s) | |
768 (?s gnus-tmp-subject-or-nil ?s) | |
769 (?n gnus-tmp-name ?s) | |
770 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from))) | |
771 ?s) | |
772 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from)) | |
773 gnus-tmp-from) ?s) | |
774 (?F gnus-tmp-from ?s) | |
775 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s) | |
776 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s) | |
777 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s) | |
778 (?o (gnus-date-iso8601 gnus-tmp-header) ?s) | |
779 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s) | |
780 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s) | |
781 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d) | |
782 (?L gnus-tmp-lines ?d) | |
783 (?I gnus-tmp-indentation ?s) | |
784 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s) | |
785 (?R gnus-tmp-replied ?c) | |
786 (?\[ gnus-tmp-opening-bracket ?c) | |
787 (?\] gnus-tmp-closing-bracket ?c) | |
788 (?\> (make-string gnus-tmp-level ? ) ?s) | |
789 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s) | |
790 (?i gnus-tmp-score ?d) | |
791 (?z gnus-tmp-score-char ?c) | |
792 (?l (bbb-grouplens-score gnus-tmp-header) ?s) | |
793 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d) | |
794 (?U gnus-tmp-unread ?c) | |
795 (?t (gnus-summary-number-of-articles-in-thread | |
796 (and (boundp 'thread) (car thread)) gnus-tmp-level) | |
797 ?d) | |
798 (?e (gnus-summary-number-of-articles-in-thread | |
799 (and (boundp 'thread) (car thread)) gnus-tmp-level t) | |
800 ?c) | |
801 (?u gnus-tmp-user-defined ?s) | |
802 (?P (gnus-pick-line-number) ?d)) | |
803 "An alist of format specifications that can appear in summary lines, | |
804 and what variables they correspond with, along with the type of the | |
805 variable (string, integer, character, etc).") | |
806 | |
807 (defvar gnus-summary-dummy-line-format-alist | |
808 `((?S gnus-tmp-subject ?s) | |
809 (?N gnus-tmp-number ?d) | |
810 (?u gnus-tmp-user-defined ?s))) | |
811 | |
812 (defvar gnus-summary-mode-line-format-alist | |
813 `((?G gnus-tmp-group-name ?s) | |
814 (?g (gnus-short-group-name gnus-tmp-group-name) ?s) | |
815 (?p (gnus-group-real-name gnus-tmp-group-name) ?s) | |
816 (?A gnus-tmp-article-number ?d) | |
817 (?Z gnus-tmp-unread-and-unselected ?s) | |
818 (?V gnus-version ?s) | |
819 (?U gnus-tmp-unread-and-unticked ?d) | |
820 (?S gnus-tmp-subject ?s) | |
821 (?e gnus-tmp-unselected ?d) | |
822 (?u gnus-tmp-user-defined ?s) | |
823 (?d (length gnus-newsgroup-dormant) ?d) | |
824 (?t (length gnus-newsgroup-marked) ?d) | |
825 (?r (length gnus-newsgroup-reads) ?d) | |
826 (?E gnus-newsgroup-expunged-tally ?d) | |
827 (?s (gnus-current-score-file-nondirectory) ?s))) | |
828 | |
829 (defvar gnus-last-search-regexp nil | |
830 "Default regexp for article search command.") | |
831 | |
832 (defvar gnus-last-shell-command nil | |
833 "Default shell command on article.") | |
834 | |
835 (defvar gnus-newsgroup-begin nil) | |
836 (defvar gnus-newsgroup-end nil) | |
837 (defvar gnus-newsgroup-last-rmail nil) | |
838 (defvar gnus-newsgroup-last-mail nil) | |
839 (defvar gnus-newsgroup-last-folder nil) | |
840 (defvar gnus-newsgroup-last-file nil) | |
841 (defvar gnus-newsgroup-auto-expire nil) | |
842 (defvar gnus-newsgroup-active nil) | |
843 | |
844 (defvar gnus-newsgroup-data nil) | |
845 (defvar gnus-newsgroup-data-reverse nil) | |
846 (defvar gnus-newsgroup-limit nil) | |
847 (defvar gnus-newsgroup-limits nil) | |
848 | |
849 (defvar gnus-newsgroup-unreads nil | |
850 "List of unread articles in the current newsgroup.") | |
851 | |
852 (defvar gnus-newsgroup-unselected nil | |
853 "List of unselected unread articles in the current newsgroup.") | |
854 | |
855 (defvar gnus-newsgroup-reads nil | |
856 "Alist of read articles and article marks in the current newsgroup.") | |
857 | |
858 (defvar gnus-newsgroup-expunged-tally nil) | |
859 | |
860 (defvar gnus-newsgroup-marked nil | |
861 "List of ticked articles in the current newsgroup (a subset of unread art).") | |
862 | |
863 (defvar gnus-newsgroup-killed nil | |
864 "List of ranges of articles that have been through the scoring process.") | |
865 | |
866 (defvar gnus-newsgroup-cached nil | |
867 "List of articles that come from the article cache.") | |
868 | |
869 (defvar gnus-newsgroup-saved nil | |
870 "List of articles that have been saved.") | |
871 | |
872 (defvar gnus-newsgroup-kill-headers nil) | |
873 | |
874 (defvar gnus-newsgroup-replied nil | |
875 "List of articles that have been replied to in the current newsgroup.") | |
876 | |
877 (defvar gnus-newsgroup-expirable nil | |
878 "List of articles in the current newsgroup that can be expired.") | |
879 | |
880 (defvar gnus-newsgroup-processable nil | |
881 "List of articles in the current newsgroup that can be processed.") | |
882 | |
883 (defvar gnus-newsgroup-bookmarks nil | |
884 "List of articles in the current newsgroup that have bookmarks.") | |
885 | |
886 (defvar gnus-newsgroup-dormant nil | |
887 "List of dormant articles in the current newsgroup.") | |
888 | |
889 (defvar gnus-newsgroup-scored nil | |
890 "List of scored articles in the current newsgroup.") | |
891 | |
892 (defvar gnus-newsgroup-headers nil | |
893 "List of article headers in the current newsgroup.") | |
894 | |
895 (defvar gnus-newsgroup-threads nil) | |
896 | |
897 (defvar gnus-newsgroup-prepared nil | |
898 "Whether the current group has been prepared properly.") | |
899 | |
900 (defvar gnus-newsgroup-ancient nil | |
901 "List of `gnus-fetch-old-headers' articles in the current newsgroup.") | |
902 | |
903 (defvar gnus-newsgroup-sparse nil) | |
904 | |
905 (defvar gnus-current-article nil) | |
906 (defvar gnus-article-current nil) | |
907 (defvar gnus-current-headers nil) | |
908 (defvar gnus-have-all-headers nil) | |
909 (defvar gnus-last-article nil) | |
910 (defvar gnus-newsgroup-history nil) | |
911 | |
912 (defconst gnus-summary-local-variables | |
913 '(gnus-newsgroup-name | |
914 gnus-newsgroup-begin gnus-newsgroup-end | |
915 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail | |
916 gnus-newsgroup-last-folder gnus-newsgroup-last-file | |
917 gnus-newsgroup-auto-expire gnus-newsgroup-unreads | |
918 gnus-newsgroup-unselected gnus-newsgroup-marked | |
919 gnus-newsgroup-reads gnus-newsgroup-saved | |
920 gnus-newsgroup-replied gnus-newsgroup-expirable | |
921 gnus-newsgroup-processable gnus-newsgroup-killed | |
922 gnus-newsgroup-bookmarks gnus-newsgroup-dormant | |
923 gnus-newsgroup-headers gnus-newsgroup-threads | |
924 gnus-newsgroup-prepared gnus-summary-highlight-line-function | |
925 gnus-current-article gnus-current-headers gnus-have-all-headers | |
926 gnus-last-article gnus-article-internal-prepare-hook | |
927 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay | |
928 gnus-newsgroup-scored gnus-newsgroup-kill-headers | |
929 gnus-thread-expunge-below | |
930 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below | |
931 (gnus-summary-mark-below . global) | |
932 gnus-newsgroup-active gnus-scores-exclude-files | |
933 gnus-newsgroup-history gnus-newsgroup-ancient | |
934 gnus-newsgroup-sparse gnus-newsgroup-process-stack | |
935 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring) | |
936 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1) | |
937 (gnus-newsgroup-expunged-tally . 0) | |
938 gnus-cache-removable-articles gnus-newsgroup-cached | |
939 gnus-newsgroup-data gnus-newsgroup-data-reverse | |
940 gnus-newsgroup-limit gnus-newsgroup-limits) | |
941 "Variables that are buffer-local to the summary buffers.") | |
942 | |
943 ;; Byte-compiler warning. | |
944 (defvar gnus-article-mode-map) | |
945 | |
946 ;; Subject simplification. | |
947 | |
948 (defsubst gnus-simplify-subject-re (subject) | |
949 "Remove \"Re:\" from subject lines." | |
950 (if (string-match "^[Rr][Ee]: *" subject) | |
951 (substring subject (match-end 0)) | |
952 subject)) | |
953 | |
954 (defun gnus-simplify-subject (subject &optional re-only) | |
955 "Remove `Re:' and words in parentheses. | |
956 If RE-ONLY is non-nil, strip leading `Re:'s only." | |
957 (let ((case-fold-search t)) ;Ignore case. | |
958 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'. | |
959 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject) | |
960 (setq subject (substring subject (match-end 0)))) | |
961 ;; Remove uninteresting prefixes. | |
962 (when (and (not re-only) | |
963 gnus-simplify-ignored-prefixes | |
964 (string-match gnus-simplify-ignored-prefixes subject)) | |
965 (setq subject (substring subject (match-end 0)))) | |
966 ;; Remove words in parentheses from end. | |
967 (unless re-only | |
968 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject) | |
969 (setq subject (substring subject 0 (match-beginning 0))))) | |
970 ;; Return subject string. | |
971 subject)) | |
972 | |
973 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify | |
974 ;; all whitespace. | |
975 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext) | |
976 (goto-char (point-min)) | |
977 (while (re-search-forward regexp nil t) | |
978 (replace-match (or newtext "")))) | |
979 | |
980 (defun gnus-simplify-buffer-fuzzy () | |
981 "Simplify string in the buffer fuzzily. | |
982 The string in the accessible portion of the current buffer is simplified. | |
983 It is assumed to be a single-line subject. | |
984 Whitespace is generally cleaned up, and miscellaneous leading/trailing | |
985 matter is removed. Additional things can be deleted by setting | |
986 gnus-simplify-subject-fuzzy-regexp." | |
987 (let ((case-fold-search t) | |
988 (modified-tick)) | |
989 (gnus-simplify-buffer-fuzzy-step "\t" " ") | |
990 | |
991 (while (not (eq modified-tick (buffer-modified-tick))) | |
992 (setq modified-tick (buffer-modified-tick)) | |
993 (cond | |
994 ((listp gnus-simplify-subject-fuzzy-regexp) | |
995 (mapcar 'gnus-simplify-buffer-fuzzy-step | |
996 gnus-simplify-subject-fuzzy-regexp)) | |
997 (gnus-simplify-subject-fuzzy-regexp | |
998 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp))) | |
999 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *") | |
1000 (gnus-simplify-buffer-fuzzy-step | |
1001 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *") | |
1002 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1")) | |
1003 | |
1004 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$") | |
1005 (gnus-simplify-buffer-fuzzy-step " +" " ") | |
1006 (gnus-simplify-buffer-fuzzy-step " $") | |
1007 (gnus-simplify-buffer-fuzzy-step "^ +"))) | |
1008 | |
1009 (defun gnus-simplify-subject-fuzzy (subject) | |
1010 "Simplify a subject string fuzzily. | |
1011 See gnus-simplify-buffer-fuzzy for details." | |
1012 (save-excursion | |
1013 (gnus-set-work-buffer) | |
1014 (let ((case-fold-search t)) | |
1015 (insert subject) | |
1016 (inline (gnus-simplify-buffer-fuzzy)) | |
1017 (buffer-string)))) | |
1018 | |
1019 (defsubst gnus-simplify-subject-fully (subject) | |
1020 "Simplify a subject string according to gnus-summary-gather-subject-limit." | |
1021 (cond | |
1022 ((null gnus-summary-gather-subject-limit) | |
1023 (gnus-simplify-subject-re subject)) | |
1024 ((eq gnus-summary-gather-subject-limit 'fuzzy) | |
1025 (gnus-simplify-subject-fuzzy subject)) | |
1026 ((numberp gnus-summary-gather-subject-limit) | |
1027 (gnus-limit-string (gnus-simplify-subject-re subject) | |
1028 gnus-summary-gather-subject-limit)) | |
1029 (t | |
1030 subject))) | |
1031 | |
1032 (defsubst gnus-subject-equal (s1 s2 &optional simple-first) | |
1033 "Check whether two subjects are equal. If optional argument | |
1034 simple-first is t, first argument is already simplified." | |
1035 (cond | |
1036 ((null simple-first) | |
1037 (equal (gnus-simplify-subject-fully s1) | |
1038 (gnus-simplify-subject-fully s2))) | |
1039 (t | |
1040 (equal s1 | |
1041 (gnus-simplify-subject-fully s2))))) | |
1042 | |
1043 (defun gnus-summary-bubble-group () | |
1044 "Increase the score of the current group. | |
1045 This is a handy function to add to `gnus-summary-exit-hook' to | |
1046 increase the score of each group you read." | |
1047 (gnus-group-add-score gnus-newsgroup-name)) | |
1048 | |
1049 | |
1050 ;;; | |
1051 ;;; Gnus summary mode | |
1052 ;;; | |
1053 | |
1054 (put 'gnus-summary-mode 'mode-class 'special) | |
1055 | |
1056 (when t | |
1057 ;; Non-orthogonal keys | |
1058 | |
1059 (gnus-define-keys gnus-summary-mode-map | |
1060 " " gnus-summary-next-page | |
1061 "\177" gnus-summary-prev-page | |
1062 [delete] gnus-summary-prev-page | |
1063 "\r" gnus-summary-scroll-up | |
1064 "n" gnus-summary-next-unread-article | |
1065 "p" gnus-summary-prev-unread-article | |
1066 "N" gnus-summary-next-article | |
1067 "P" gnus-summary-prev-article | |
1068 "\M-\C-n" gnus-summary-next-same-subject | |
1069 "\M-\C-p" gnus-summary-prev-same-subject | |
1070 "\M-n" gnus-summary-next-unread-subject | |
1071 "\M-p" gnus-summary-prev-unread-subject | |
1072 "." gnus-summary-first-unread-article | |
1073 "," gnus-summary-best-unread-article | |
1074 "\M-s" gnus-summary-search-article-forward | |
1075 "\M-r" gnus-summary-search-article-backward | |
1076 "<" gnus-summary-beginning-of-article | |
1077 ">" gnus-summary-end-of-article | |
1078 "j" gnus-summary-goto-article | |
1079 "^" gnus-summary-refer-parent-article | |
1080 "\M-^" gnus-summary-refer-article | |
1081 "u" gnus-summary-tick-article-forward | |
1082 "!" gnus-summary-tick-article-forward | |
1083 "U" gnus-summary-tick-article-backward | |
1084 "d" gnus-summary-mark-as-read-forward | |
1085 "D" gnus-summary-mark-as-read-backward | |
1086 "E" gnus-summary-mark-as-expirable | |
1087 "\M-u" gnus-summary-clear-mark-forward | |
1088 "\M-U" gnus-summary-clear-mark-backward | |
1089 "k" gnus-summary-kill-same-subject-and-select | |
1090 "\C-k" gnus-summary-kill-same-subject | |
1091 "\M-\C-k" gnus-summary-kill-thread | |
1092 "\M-\C-l" gnus-summary-lower-thread | |
1093 "e" gnus-summary-edit-article | |
1094 "#" gnus-summary-mark-as-processable | |
1095 "\M-#" gnus-summary-unmark-as-processable | |
1096 "\M-\C-t" gnus-summary-toggle-threads | |
1097 "\M-\C-s" gnus-summary-show-thread | |
1098 "\M-\C-h" gnus-summary-hide-thread | |
1099 "\M-\C-f" gnus-summary-next-thread | |
1100 "\M-\C-b" gnus-summary-prev-thread | |
1101 "\M-\C-u" gnus-summary-up-thread | |
1102 "\M-\C-d" gnus-summary-down-thread | |
1103 "&" gnus-summary-execute-command | |
1104 "c" gnus-summary-catchup-and-exit | |
1105 "\C-w" gnus-summary-mark-region-as-read | |
1106 "\C-t" gnus-summary-toggle-truncation | |
1107 "?" gnus-summary-mark-as-dormant | |
1108 "\C-c\M-\C-s" gnus-summary-limit-include-expunged | |
1109 "\C-c\C-s\C-n" gnus-summary-sort-by-number | |
1110 "\C-c\C-s\C-l" gnus-summary-sort-by-lines | |
1111 "\C-c\C-s\C-a" gnus-summary-sort-by-author | |
1112 "\C-c\C-s\C-s" gnus-summary-sort-by-subject | |
1113 "\C-c\C-s\C-d" gnus-summary-sort-by-date | |
1114 "\C-c\C-s\C-i" gnus-summary-sort-by-score | |
1115 "=" gnus-summary-expand-window | |
1116 "\C-x\C-s" gnus-summary-reselect-current-group | |
1117 "\M-g" gnus-summary-rescan-group | |
1118 "w" gnus-summary-stop-page-breaking | |
1119 "\C-c\C-r" gnus-summary-caesar-message | |
1120 "\M-t" gnus-summary-toggle-mime | |
1121 "f" gnus-summary-followup | |
1122 "F" gnus-summary-followup-with-original | |
1123 "C" gnus-summary-cancel-article | |
1124 "r" gnus-summary-reply | |
1125 "R" gnus-summary-reply-with-original | |
1126 "\C-c\C-f" gnus-summary-mail-forward | |
1127 "o" gnus-summary-save-article | |
1128 "\C-o" gnus-summary-save-article-mail | |
1129 "|" gnus-summary-pipe-output | |
1130 "\M-k" gnus-summary-edit-local-kill | |
1131 "\M-K" gnus-summary-edit-global-kill | |
1132 ;; "V" gnus-version | |
1133 "\C-c\C-d" gnus-summary-describe-group | |
1134 "q" gnus-summary-exit | |
1135 "Q" gnus-summary-exit-no-update | |
1136 "\C-c\C-i" gnus-info-find-node | |
1137 gnus-mouse-2 gnus-mouse-pick-article | |
1138 "m" gnus-summary-mail-other-window | |
1139 "a" gnus-summary-post-news | |
1140 "x" gnus-summary-limit-to-unread | |
1141 "s" gnus-summary-isearch-article | |
1142 "t" gnus-article-hide-headers | |
1143 "g" gnus-summary-show-article | |
1144 "l" gnus-summary-goto-last-article | |
1145 "\C-c\C-v\C-v" gnus-uu-decode-uu-view | |
1146 "\C-d" gnus-summary-enter-digest-group | |
1147 "\M-\C-d" gnus-summary-read-document | |
1148 "\C-c\C-b" gnus-bug | |
1149 "*" gnus-cache-enter-article | |
1150 "\M-*" gnus-cache-remove-article | |
1151 "\M-&" gnus-summary-universal-argument | |
1152 "\C-l" gnus-recenter | |
1153 "I" gnus-summary-increase-score | |
1154 "L" gnus-summary-lower-score | |
1155 | |
1156 "V" gnus-summary-score-map | |
1157 "X" gnus-uu-extract-map | |
1158 "S" gnus-summary-send-map) | |
1159 | |
1160 ;; Sort of orthogonal keymap | |
1161 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map) | |
1162 "t" gnus-summary-tick-article-forward | |
1163 "!" gnus-summary-tick-article-forward | |
1164 "d" gnus-summary-mark-as-read-forward | |
1165 "r" gnus-summary-mark-as-read-forward | |
1166 "c" gnus-summary-clear-mark-forward | |
1167 " " gnus-summary-clear-mark-forward | |
1168 "e" gnus-summary-mark-as-expirable | |
1169 "x" gnus-summary-mark-as-expirable | |
1170 "?" gnus-summary-mark-as-dormant | |
1171 "b" gnus-summary-set-bookmark | |
1172 "B" gnus-summary-remove-bookmark | |
1173 "#" gnus-summary-mark-as-processable | |
1174 "\M-#" gnus-summary-unmark-as-processable | |
1175 "S" gnus-summary-limit-include-expunged | |
1176 "C" gnus-summary-catchup | |
1177 "H" gnus-summary-catchup-to-here | |
1178 "\C-c" gnus-summary-catchup-all | |
1179 "k" gnus-summary-kill-same-subject-and-select | |
1180 "K" gnus-summary-kill-same-subject | |
1181 "P" gnus-uu-mark-map) | |
1182 | |
1183 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map) | |
1184 "c" gnus-summary-clear-above | |
1185 "u" gnus-summary-tick-above | |
1186 "m" gnus-summary-mark-above | |
1187 "k" gnus-summary-kill-below) | |
1188 | |
1189 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map) | |
1190 "/" gnus-summary-limit-to-subject | |
1191 "n" gnus-summary-limit-to-articles | |
1192 "w" gnus-summary-pop-limit | |
1193 "s" gnus-summary-limit-to-subject | |
1194 "a" gnus-summary-limit-to-author | |
1195 "u" gnus-summary-limit-to-unread | |
1196 "m" gnus-summary-limit-to-marks | |
1197 "v" gnus-summary-limit-to-score | |
1198 "D" gnus-summary-limit-include-dormant | |
1199 "d" gnus-summary-limit-exclude-dormant | |
1200 "t" gnus-summary-limit-to-age | |
1201 "E" gnus-summary-limit-include-expunged | |
1202 "c" gnus-summary-limit-exclude-childless-dormant | |
1203 "C" gnus-summary-limit-mark-excluded-as-read) | |
1204 | |
1205 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map) | |
1206 "n" gnus-summary-next-unread-article | |
1207 "p" gnus-summary-prev-unread-article | |
1208 "N" gnus-summary-next-article | |
1209 "P" gnus-summary-prev-article | |
1210 "\C-n" gnus-summary-next-same-subject | |
1211 "\C-p" gnus-summary-prev-same-subject | |
1212 "\M-n" gnus-summary-next-unread-subject | |
1213 "\M-p" gnus-summary-prev-unread-subject | |
1214 "f" gnus-summary-first-unread-article | |
1215 "b" gnus-summary-best-unread-article | |
1216 "j" gnus-summary-goto-article | |
1217 "g" gnus-summary-goto-subject | |
1218 "l" gnus-summary-goto-last-article | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
1219 "o" gnus-summary-pop-article) |
17493 | 1220 |
1221 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map) | |
1222 "k" gnus-summary-kill-thread | |
1223 "l" gnus-summary-lower-thread | |
1224 "i" gnus-summary-raise-thread | |
1225 "T" gnus-summary-toggle-threads | |
1226 "t" gnus-summary-rethread-current | |
1227 "^" gnus-summary-reparent-thread | |
1228 "s" gnus-summary-show-thread | |
1229 "S" gnus-summary-show-all-threads | |
1230 "h" gnus-summary-hide-thread | |
1231 "H" gnus-summary-hide-all-threads | |
1232 "n" gnus-summary-next-thread | |
1233 "p" gnus-summary-prev-thread | |
1234 "u" gnus-summary-up-thread | |
1235 "o" gnus-summary-top-thread | |
1236 "d" gnus-summary-down-thread | |
1237 "#" gnus-uu-mark-thread | |
1238 "\M-#" gnus-uu-unmark-thread) | |
1239 | |
1240 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map) | |
1241 "g" gnus-summary-prepare | |
1242 "c" gnus-summary-insert-cached-articles) | |
1243 | |
1244 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map) | |
1245 "c" gnus-summary-catchup-and-exit | |
1246 "C" gnus-summary-catchup-all-and-exit | |
1247 "E" gnus-summary-exit-no-update | |
1248 "Q" gnus-summary-exit | |
1249 "Z" gnus-summary-exit | |
1250 "n" gnus-summary-catchup-and-goto-next-group | |
1251 "R" gnus-summary-reselect-current-group | |
1252 "G" gnus-summary-rescan-group | |
1253 "N" gnus-summary-next-group | |
1254 "s" gnus-summary-save-newsrc | |
1255 "P" gnus-summary-prev-group) | |
1256 | |
1257 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map) | |
1258 " " gnus-summary-next-page | |
1259 "n" gnus-summary-next-page | |
1260 "\177" gnus-summary-prev-page | |
1261 [delete] gnus-summary-prev-page | |
1262 "p" gnus-summary-prev-page | |
1263 "\r" gnus-summary-scroll-up | |
1264 "<" gnus-summary-beginning-of-article | |
1265 ">" gnus-summary-end-of-article | |
1266 "b" gnus-summary-beginning-of-article | |
1267 "e" gnus-summary-end-of-article | |
1268 "^" gnus-summary-refer-parent-article | |
1269 "r" gnus-summary-refer-parent-article | |
1270 "R" gnus-summary-refer-references | |
1271 "g" gnus-summary-show-article | |
1272 "s" gnus-summary-isearch-article | |
1273 "P" gnus-summary-print-article) | |
1274 | |
1275 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map) | |
1276 "b" gnus-article-add-buttons | |
1277 "B" gnus-article-add-buttons-to-head | |
1278 "o" gnus-article-treat-overstrike | |
1279 "e" gnus-article-emphasize | |
1280 "w" gnus-article-fill-cited-article | |
1281 "c" gnus-article-remove-cr | |
1282 "q" gnus-article-de-quoted-unreadable | |
1283 "f" gnus-article-display-x-face | |
1284 "l" gnus-summary-stop-page-breaking | |
1285 "r" gnus-summary-caesar-message | |
1286 "t" gnus-article-hide-headers | |
1287 "v" gnus-summary-verbose-headers | |
1288 "m" gnus-summary-toggle-mime | |
1289 "h" gnus-article-treat-html) | |
1290 | |
1291 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map) | |
1292 "a" gnus-article-hide | |
1293 "h" gnus-article-hide-headers | |
1294 "b" gnus-article-hide-boring-headers | |
1295 "s" gnus-article-hide-signature | |
1296 "c" gnus-article-hide-citation | |
1297 "p" gnus-article-hide-pgp | |
1298 "P" gnus-article-hide-pem | |
1299 "\C-c" gnus-article-hide-citation-maybe) | |
1300 | |
1301 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map) | |
1302 "a" gnus-article-highlight | |
1303 "h" gnus-article-highlight-headers | |
1304 "c" gnus-article-highlight-citation | |
1305 "s" gnus-article-highlight-signature) | |
1306 | |
1307 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map) | |
1308 "z" gnus-article-date-ut | |
1309 "u" gnus-article-date-ut | |
1310 "l" gnus-article-date-local | |
1311 "e" gnus-article-date-lapsed | |
1312 "o" gnus-article-date-original | |
1313 "s" gnus-article-date-user) | |
1314 | |
1315 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map) | |
1316 "t" gnus-article-remove-trailing-blank-lines | |
1317 "l" gnus-article-strip-leading-blank-lines | |
1318 "m" gnus-article-strip-multiple-blank-lines | |
1319 "a" gnus-article-strip-blank-lines | |
1320 "s" gnus-article-strip-leading-space) | |
1321 | |
1322 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map) | |
1323 "v" gnus-version | |
1324 "f" gnus-summary-fetch-faq | |
1325 "d" gnus-summary-describe-group | |
1326 "h" gnus-summary-describe-briefly | |
1327 "i" gnus-info-find-node) | |
1328 | |
1329 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map) | |
1330 "e" gnus-summary-expire-articles | |
1331 "\M-\C-e" gnus-summary-expire-articles-now | |
1332 "\177" gnus-summary-delete-article | |
1333 [delete] gnus-summary-delete-article | |
1334 "m" gnus-summary-move-article | |
1335 "r" gnus-summary-respool-article | |
1336 "w" gnus-summary-edit-article | |
1337 "c" gnus-summary-copy-article | |
1338 "B" gnus-summary-crosspost-article | |
1339 "q" gnus-summary-respool-query | |
1340 "i" gnus-summary-import-article | |
1341 "p" gnus-summary-article-posted-p) | |
1342 | |
1343 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map) | |
1344 "o" gnus-summary-save-article | |
1345 "m" gnus-summary-save-article-mail | |
1346 "F" gnus-summary-write-article-file | |
1347 "r" gnus-summary-save-article-rmail | |
1348 "f" gnus-summary-save-article-file | |
1349 "b" gnus-summary-save-article-body-file | |
1350 "h" gnus-summary-save-article-folder | |
1351 "v" gnus-summary-save-article-vm | |
1352 "p" gnus-summary-pipe-output | |
1353 "s" gnus-soup-add-article)) | |
1354 | |
1355 (defun gnus-summary-make-menu-bar () | |
1356 (gnus-turn-off-edit-menu 'summary) | |
1357 | |
1358 (unless (boundp 'gnus-summary-misc-menu) | |
1359 | |
1360 (easy-menu-define | |
1361 gnus-summary-kill-menu gnus-summary-mode-map "" | |
1362 (cons | |
1363 "Score" | |
1364 (nconc | |
1365 (list | |
1366 ["Enter score..." gnus-summary-score-entry t] | |
1367 ["Customize" gnus-score-customize t]) | |
1368 (gnus-make-score-map 'increase) | |
1369 (gnus-make-score-map 'lower) | |
1370 '(("Mark" | |
1371 ["Kill below" gnus-summary-kill-below t] | |
1372 ["Mark above" gnus-summary-mark-above t] | |
1373 ["Tick above" gnus-summary-tick-above t] | |
1374 ["Clear above" gnus-summary-clear-above t]) | |
1375 ["Current score" gnus-summary-current-score t] | |
1376 ["Set score" gnus-summary-set-score t] | |
1377 ["Switch current score file..." gnus-score-change-score-file t] | |
1378 ["Set mark below..." gnus-score-set-mark-below t] | |
1379 ["Set expunge below..." gnus-score-set-expunge-below t] | |
1380 ["Edit current score file" gnus-score-edit-current-scores t] | |
1381 ["Edit score file" gnus-score-edit-file t] | |
1382 ["Trace score" gnus-score-find-trace t] | |
1383 ["Find words" gnus-score-find-favourite-words t] | |
1384 ["Rescore buffer" gnus-summary-rescore t] | |
1385 ["Increase score..." gnus-summary-increase-score t] | |
1386 ["Lower score..." gnus-summary-lower-score t])))) | |
1387 | |
1388 '(("Default header" | |
1389 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil) | |
1390 :style radio | |
1391 :selected (null gnus-score-default-header)] | |
1392 ["From" (gnus-score-set-default 'gnus-score-default-header 'a) | |
1393 :style radio | |
1394 :selected (eq gnus-score-default-header 'a)] | |
1395 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's) | |
1396 :style radio | |
1397 :selected (eq gnus-score-default-header 's)] | |
1398 ["Article body" | |
1399 (gnus-score-set-default 'gnus-score-default-header 'b) | |
1400 :style radio | |
1401 :selected (eq gnus-score-default-header 'b )] | |
1402 ["All headers" | |
1403 (gnus-score-set-default 'gnus-score-default-header 'h) | |
1404 :style radio | |
1405 :selected (eq gnus-score-default-header 'h )] | |
1406 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i) | |
1407 :style radio | |
1408 :selected (eq gnus-score-default-header 'i )] | |
1409 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't) | |
1410 :style radio | |
1411 :selected (eq gnus-score-default-header 't )] | |
1412 ["Crossposting" | |
1413 (gnus-score-set-default 'gnus-score-default-header 'x) | |
1414 :style radio | |
1415 :selected (eq gnus-score-default-header 'x )] | |
1416 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l) | |
1417 :style radio | |
1418 :selected (eq gnus-score-default-header 'l )] | |
1419 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd) | |
1420 :style radio | |
1421 :selected (eq gnus-score-default-header 'd )] | |
1422 ["Followups to author" | |
1423 (gnus-score-set-default 'gnus-score-default-header 'f) | |
1424 :style radio | |
1425 :selected (eq gnus-score-default-header 'f )]) | |
1426 ("Default type" | |
1427 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil) | |
1428 :style radio | |
1429 :selected (null gnus-score-default-type)] | |
1430 ;; The `:active' key is commented out in the following, | |
1431 ;; because the GNU Emacs hack to support radio buttons use | |
1432 ;; active to indicate which button is selected. | |
1433 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's) | |
1434 :style radio | |
1435 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1436 :selected (eq gnus-score-default-type 's)] | |
1437 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r) | |
1438 :style radio | |
1439 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1440 :selected (eq gnus-score-default-type 'r)] | |
1441 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e) | |
1442 :style radio | |
1443 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1444 :selected (eq gnus-score-default-type 'e)] | |
1445 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f) | |
1446 :style radio | |
1447 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1448 :selected (eq gnus-score-default-type 'f)] | |
1449 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b) | |
1450 :style radio | |
1451 ;; :active (eq (gnus-score-default-header 'd)) | |
1452 :selected (eq gnus-score-default-type 'b)] | |
1453 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n) | |
1454 :style radio | |
1455 ;; :active (eq (gnus-score-default-header 'd)) | |
1456 :selected (eq gnus-score-default-type 'n)] | |
1457 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a) | |
1458 :style radio | |
1459 ;; :active (eq (gnus-score-default-header 'd)) | |
1460 :selected (eq gnus-score-default-type 'a)] | |
1461 ["Less than number" | |
1462 (gnus-score-set-default 'gnus-score-default-type '<) | |
1463 :style radio | |
1464 ;; :active (eq (gnus-score-default-header 'l)) | |
1465 :selected (eq gnus-score-default-type '<)] | |
1466 ["Equal to number" | |
1467 (gnus-score-set-default 'gnus-score-default-type '=) | |
1468 :style radio | |
1469 ;; :active (eq (gnus-score-default-header 'l)) | |
1470 :selected (eq gnus-score-default-type '=)] | |
1471 ["Greater than number" | |
1472 (gnus-score-set-default 'gnus-score-default-type '>) | |
1473 :style radio | |
1474 ;; :active (eq (gnus-score-default-header 'l)) | |
1475 :selected (eq gnus-score-default-type '>)]) | |
1476 ["Default fold" gnus-score-default-fold-toggle | |
1477 :style toggle | |
1478 :selected gnus-score-default-fold] | |
1479 ("Default duration" | |
1480 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil) | |
1481 :style radio | |
1482 :selected (null gnus-score-default-duration)] | |
1483 ["Permanent" | |
1484 (gnus-score-set-default 'gnus-score-default-duration 'p) | |
1485 :style radio | |
1486 :selected (eq gnus-score-default-duration 'p)] | |
1487 ["Temporary" | |
1488 (gnus-score-set-default 'gnus-score-default-duration 't) | |
1489 :style radio | |
1490 :selected (eq gnus-score-default-duration 't)] | |
1491 ["Immediate" | |
1492 (gnus-score-set-default 'gnus-score-default-duration 'i) | |
1493 :style radio | |
1494 :selected (eq gnus-score-default-duration 'i)])) | |
1495 | |
1496 (easy-menu-define | |
1497 gnus-summary-article-menu gnus-summary-mode-map "" | |
1498 '("Article" | |
1499 ("Hide" | |
1500 ["All" gnus-article-hide t] | |
1501 ["Headers" gnus-article-hide-headers t] | |
1502 ["Signature" gnus-article-hide-signature t] | |
1503 ["Citation" gnus-article-hide-citation t] | |
1504 ["PGP" gnus-article-hide-pgp t] | |
1505 ["Boring headers" gnus-article-hide-boring-headers t]) | |
1506 ("Highlight" | |
1507 ["All" gnus-article-highlight t] | |
1508 ["Headers" gnus-article-highlight-headers t] | |
1509 ["Signature" gnus-article-highlight-signature t] | |
1510 ["Citation" gnus-article-highlight-citation t]) | |
1511 ("Date" | |
1512 ["Local" gnus-article-date-local t] | |
1513 ["UT" gnus-article-date-ut t] | |
1514 ["Original" gnus-article-date-original t] | |
1515 ["Lapsed" gnus-article-date-lapsed t] | |
1516 ["User-defined" gnus-article-date-user t]) | |
1517 ("Washing" | |
1518 ("Remove Blanks" | |
1519 ["Leading" gnus-article-strip-leading-blank-lines t] | |
1520 ["Multiple" gnus-article-strip-multiple-blank-lines t] | |
1521 ["Trailing" gnus-article-remove-trailing-blank-lines t] | |
1522 ["All of the above" gnus-article-strip-blank-lines t] | |
1523 ["Leading space" gnus-article-strip-leading-space t]) | |
1524 ["Overstrike" gnus-article-treat-overstrike t] | |
1525 ["Emphasis" gnus-article-emphasize t] | |
1526 ["Word wrap" gnus-article-fill-cited-article t] | |
1527 ["CR" gnus-article-remove-cr t] | |
1528 ["Show X-Face" gnus-article-display-x-face t] | |
1529 ["Quoted-Printable" gnus-article-de-quoted-unreadable t] | |
1530 ["UnHTMLize" gnus-article-treat-html t] | |
1531 ["Rot 13" gnus-summary-caesar-message t] | |
1532 ["Unix pipe" gnus-summary-pipe-message t] | |
1533 ["Add buttons" gnus-article-add-buttons t] | |
1534 ["Add buttons to head" gnus-article-add-buttons-to-head t] | |
1535 ["Stop page breaking" gnus-summary-stop-page-breaking t] | |
1536 ["Toggle MIME" gnus-summary-toggle-mime t] | |
1537 ["Verbose header" gnus-summary-verbose-headers t] | |
1538 ["Toggle header" gnus-summary-toggle-header t]) | |
1539 ("Output" | |
1540 ["Save in default format" gnus-summary-save-article t] | |
1541 ["Save in file" gnus-summary-save-article-file t] | |
1542 ["Save in Unix mail format" gnus-summary-save-article-mail t] | |
1543 ["Write to file" gnus-summary-write-article-mail t] | |
1544 ["Save in MH folder" gnus-summary-save-article-folder t] | |
1545 ["Save in VM folder" gnus-summary-save-article-vm t] | |
1546 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t] | |
1547 ["Save body in file" gnus-summary-save-article-body-file t] | |
1548 ["Pipe through a filter" gnus-summary-pipe-output t] | |
1549 ["Add to SOUP packet" gnus-soup-add-article t] | |
1550 ["Print" gnus-summary-print-article t]) | |
1551 ("Backend" | |
1552 ["Respool article..." gnus-summary-respool-article t] | |
1553 ["Move article..." gnus-summary-move-article | |
1554 (gnus-check-backend-function | |
1555 'request-move-article gnus-newsgroup-name)] | |
1556 ["Copy article..." gnus-summary-copy-article t] | |
1557 ["Crosspost article..." gnus-summary-crosspost-article | |
1558 (gnus-check-backend-function | |
1559 'request-replace-article gnus-newsgroup-name)] | |
1560 ["Import file..." gnus-summary-import-article t] | |
1561 ["Check if posted" gnus-summary-article-posted-p t] | |
1562 ["Edit article" gnus-summary-edit-article | |
1563 (not (gnus-group-read-only-p))] | |
1564 ["Delete article" gnus-summary-delete-article | |
1565 (gnus-check-backend-function | |
1566 'request-expire-articles gnus-newsgroup-name)] | |
1567 ["Query respool" gnus-summary-respool-query t] | |
1568 ["Delete expirable articles" gnus-summary-expire-articles-now | |
1569 (gnus-check-backend-function | |
1570 'request-expire-articles gnus-newsgroup-name)]) | |
1571 ("Extract" | |
1572 ["Uudecode" gnus-uu-decode-uu t] | |
1573 ["Uudecode and save" gnus-uu-decode-uu-and-save t] | |
1574 ["Unshar" gnus-uu-decode-unshar t] | |
1575 ["Unshar and save" gnus-uu-decode-unshar-and-save t] | |
1576 ["Save" gnus-uu-decode-save t] | |
1577 ["Binhex" gnus-uu-decode-binhex t] | |
1578 ["Postscript" gnus-uu-decode-postscript t]) | |
1579 ("Cache" | |
1580 ["Enter article" gnus-cache-enter-article t] | |
1581 ["Remove article" gnus-cache-remove-article t]) | |
1582 ["Enter digest buffer" gnus-summary-enter-digest-group t] | |
1583 ["Isearch article..." gnus-summary-isearch-article t] | |
1584 ["Beginning of the article" gnus-summary-beginning-of-article t] | |
1585 ["End of the article" gnus-summary-end-of-article t] | |
1586 ["Fetch parent of article" gnus-summary-refer-parent-article t] | |
1587 ["Fetch referenced articles" gnus-summary-refer-references t] | |
1588 ["Fetch article with id..." gnus-summary-refer-article t] | |
1589 ["Redisplay" gnus-summary-show-article t])) | |
1590 | |
1591 (easy-menu-define | |
1592 gnus-summary-thread-menu gnus-summary-mode-map "" | |
1593 '("Threads" | |
1594 ["Toggle threading" gnus-summary-toggle-threads t] | |
1595 ["Hide threads" gnus-summary-hide-all-threads t] | |
1596 ["Show threads" gnus-summary-show-all-threads t] | |
1597 ["Hide thread" gnus-summary-hide-thread t] | |
1598 ["Show thread" gnus-summary-show-thread t] | |
1599 ["Go to next thread" gnus-summary-next-thread t] | |
1600 ["Go to previous thread" gnus-summary-prev-thread t] | |
1601 ["Go down thread" gnus-summary-down-thread t] | |
1602 ["Go up thread" gnus-summary-up-thread t] | |
1603 ["Top of thread" gnus-summary-top-thread t] | |
1604 ["Mark thread as read" gnus-summary-kill-thread t] | |
1605 ["Lower thread score" gnus-summary-lower-thread t] | |
1606 ["Raise thread score" gnus-summary-raise-thread t] | |
1607 ["Rethread current" gnus-summary-rethread-current t] | |
1608 )) | |
1609 | |
1610 (easy-menu-define | |
1611 gnus-summary-post-menu gnus-summary-mode-map "" | |
1612 '("Post" | |
1613 ["Post an article" gnus-summary-post-news t] | |
1614 ["Followup" gnus-summary-followup t] | |
1615 ["Followup and yank" gnus-summary-followup-with-original t] | |
1616 ["Supersede article" gnus-summary-supersede-article t] | |
1617 ["Cancel article" gnus-summary-cancel-article t] | |
1618 ["Reply" gnus-summary-reply t] | |
1619 ["Reply and yank" gnus-summary-reply-with-original t] | |
1620 ["Wide reply" gnus-summary-wide-reply t] | |
1621 ["Wide reply and yank" gnus-summary-wide-reply-with-original t] | |
1622 ["Mail forward" gnus-summary-mail-forward t] | |
1623 ["Post forward" gnus-summary-post-forward t] | |
1624 ["Digest and mail" gnus-uu-digest-mail-forward t] | |
1625 ["Digest and post" gnus-uu-digest-post-forward t] | |
1626 ["Resend message" gnus-summary-resend-message t] | |
1627 ["Send bounced mail" gnus-summary-resend-bounced-mail t] | |
1628 ["Send a mail" gnus-summary-mail-other-window t] | |
1629 ["Uuencode and post" gnus-uu-post-news t] | |
1630 ["Followup via news" gnus-summary-followup-to-mail t] | |
1631 ["Followup via news and yank" | |
1632 gnus-summary-followup-to-mail-with-original t] | |
1633 ;;("Draft" | |
1634 ;;["Send" gnus-summary-send-draft t] | |
1635 ;;["Send bounced" gnus-resend-bounced-mail t]) | |
1636 )) | |
1637 | |
1638 (easy-menu-define | |
1639 gnus-summary-misc-menu gnus-summary-mode-map "" | |
1640 '("Misc" | |
1641 ("Mark Read" | |
1642 ["Mark as read" gnus-summary-mark-as-read-forward t] | |
1643 ["Mark same subject and select" | |
1644 gnus-summary-kill-same-subject-and-select t] | |
1645 ["Mark same subject" gnus-summary-kill-same-subject t] | |
1646 ["Catchup" gnus-summary-catchup t] | |
1647 ["Catchup all" gnus-summary-catchup-all t] | |
1648 ["Catchup to here" gnus-summary-catchup-to-here t] | |
1649 ["Catchup region" gnus-summary-mark-region-as-read t] | |
1650 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t]) | |
1651 ("Mark Various" | |
1652 ["Tick" gnus-summary-tick-article-forward t] | |
1653 ["Mark as dormant" gnus-summary-mark-as-dormant t] | |
1654 ["Remove marks" gnus-summary-clear-mark-forward t] | |
1655 ["Set expirable mark" gnus-summary-mark-as-expirable t] | |
1656 ["Set bookmark" gnus-summary-set-bookmark t] | |
1657 ["Remove bookmark" gnus-summary-remove-bookmark t]) | |
1658 ("Mark Limit" | |
1659 ["Marks..." gnus-summary-limit-to-marks t] | |
1660 ["Subject..." gnus-summary-limit-to-subject t] | |
1661 ["Author..." gnus-summary-limit-to-author t] | |
1662 ["Age..." gnus-summary-limit-to-age t] | |
1663 ["Score" gnus-summary-limit-to-score t] | |
1664 ["Unread" gnus-summary-limit-to-unread t] | |
1665 ["Non-dormant" gnus-summary-limit-exclude-dormant t] | |
1666 ["Articles" gnus-summary-limit-to-articles t] | |
1667 ["Pop limit" gnus-summary-pop-limit t] | |
1668 ["Show dormant" gnus-summary-limit-include-dormant t] | |
1669 ["Hide childless dormant" | |
1670 gnus-summary-limit-exclude-childless-dormant t] | |
1671 ;;["Hide thread" gnus-summary-limit-exclude-thread t] | |
1672 ["Show expunged" gnus-summary-show-all-expunged t]) | |
1673 ("Process Mark" | |
1674 ["Set mark" gnus-summary-mark-as-processable t] | |
1675 ["Remove mark" gnus-summary-unmark-as-processable t] | |
1676 ["Remove all marks" gnus-summary-unmark-all-processable t] | |
1677 ["Mark above" gnus-uu-mark-over t] | |
1678 ["Mark series" gnus-uu-mark-series t] | |
1679 ["Mark region" gnus-uu-mark-region t] | |
1680 ["Mark by regexp..." gnus-uu-mark-by-regexp t] | |
1681 ["Mark all" gnus-uu-mark-all t] | |
1682 ["Mark buffer" gnus-uu-mark-buffer t] | |
1683 ["Mark sparse" gnus-uu-mark-sparse t] | |
1684 ["Mark thread" gnus-uu-mark-thread t] | |
1685 ["Unmark thread" gnus-uu-unmark-thread t] | |
1686 ("Process Mark Sets" | |
1687 ["Kill" gnus-summary-kill-process-mark t] | |
1688 ["Yank" gnus-summary-yank-process-mark | |
1689 gnus-newsgroup-process-stack] | |
1690 ["Save" gnus-summary-save-process-mark t])) | |
1691 ("Scroll article" | |
1692 ["Page forward" gnus-summary-next-page t] | |
1693 ["Page backward" gnus-summary-prev-page t] | |
1694 ["Line forward" gnus-summary-scroll-up t]) | |
1695 ("Move" | |
1696 ["Next unread article" gnus-summary-next-unread-article t] | |
1697 ["Previous unread article" gnus-summary-prev-unread-article t] | |
1698 ["Next article" gnus-summary-next-article t] | |
1699 ["Previous article" gnus-summary-prev-article t] | |
1700 ["Next unread subject" gnus-summary-next-unread-subject t] | |
1701 ["Previous unread subject" gnus-summary-prev-unread-subject t] | |
1702 ["Next article same subject" gnus-summary-next-same-subject t] | |
1703 ["Previous article same subject" gnus-summary-prev-same-subject t] | |
1704 ["First unread article" gnus-summary-first-unread-article t] | |
1705 ["Best unread article" gnus-summary-best-unread-article t] | |
1706 ["Go to subject number..." gnus-summary-goto-subject t] | |
1707 ["Go to article number..." gnus-summary-goto-article t] | |
1708 ["Go to the last article" gnus-summary-goto-last-article t] | |
1709 ["Pop article off history" gnus-summary-pop-article t]) | |
1710 ("Sort" | |
1711 ["Sort by number" gnus-summary-sort-by-number t] | |
1712 ["Sort by author" gnus-summary-sort-by-author t] | |
1713 ["Sort by subject" gnus-summary-sort-by-subject t] | |
1714 ["Sort by date" gnus-summary-sort-by-date t] | |
1715 ["Sort by score" gnus-summary-sort-by-score t] | |
1716 ["Sort by lines" gnus-summary-sort-by-lines t]) | |
1717 ("Help" | |
1718 ["Fetch group FAQ" gnus-summary-fetch-faq t] | |
1719 ["Describe group" gnus-summary-describe-group t] | |
1720 ["Read manual" gnus-info-find-node t]) | |
1721 ("Modes" | |
1722 ["Pick and read" gnus-pick-mode t] | |
1723 ["Binary" gnus-binary-mode t]) | |
1724 ("Regeneration" | |
1725 ["Regenerate" gnus-summary-prepare t] | |
1726 ["Insert cached articles" gnus-summary-insert-cached-articles t] | |
1727 ["Toggle threading" gnus-summary-toggle-threads t]) | |
1728 ["Filter articles..." gnus-summary-execute-command t] | |
1729 ["Run command on subjects..." gnus-summary-universal-argument t] | |
1730 ["Search articles forward..." gnus-summary-search-article-forward t] | |
1731 ["Search articles backward..." gnus-summary-search-article-backward t] | |
1732 ["Toggle line truncation" gnus-summary-toggle-truncation t] | |
1733 ["Expand window" gnus-summary-expand-window t] | |
1734 ["Expire expirable articles" gnus-summary-expire-articles | |
1735 (gnus-check-backend-function | |
1736 'request-expire-articles gnus-newsgroup-name)] | |
1737 ["Edit local kill file" gnus-summary-edit-local-kill t] | |
1738 ["Edit main kill file" gnus-summary-edit-global-kill t] | |
1739 ("Exit" | |
1740 ["Catchup and exit" gnus-summary-catchup-and-exit t] | |
1741 ["Catchup all and exit" gnus-summary-catchup-and-exit t] | |
1742 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t] | |
1743 ["Exit group" gnus-summary-exit t] | |
1744 ["Exit group without updating" gnus-summary-exit-no-update t] | |
1745 ["Exit and goto next group" gnus-summary-next-group t] | |
1746 ["Exit and goto prev group" gnus-summary-prev-group t] | |
1747 ["Reselect group" gnus-summary-reselect-current-group t] | |
1748 ["Rescan group" gnus-summary-rescan-group t] | |
1749 ["Update dribble" gnus-summary-save-newsrc t]))) | |
1750 | |
1751 (run-hooks 'gnus-summary-menu-hook))) | |
1752 | |
1753 (defun gnus-score-set-default (var value) | |
1754 "A version of set that updates the GNU Emacs menu-bar." | |
1755 (set var value) | |
1756 ;; It is the message that forces the active status to be updated. | |
1757 (message "")) | |
1758 | |
1759 (defun gnus-make-score-map (type) | |
1760 "Make a summary score map of type TYPE." | |
1761 (if t | |
1762 nil | |
1763 (let ((headers '(("author" "from" string) | |
1764 ("subject" "subject" string) | |
1765 ("article body" "body" string) | |
1766 ("article head" "head" string) | |
1767 ("xref" "xref" string) | |
1768 ("lines" "lines" number) | |
1769 ("followups to author" "followup" string))) | |
1770 (types '((number ("less than" <) | |
1771 ("greater than" >) | |
1772 ("equal" =)) | |
1773 (string ("substring" s) | |
1774 ("exact string" e) | |
1775 ("fuzzy string" f) | |
1776 ("regexp" r)))) | |
1777 (perms '(("temporary" (current-time-string)) | |
1778 ("permanent" nil) | |
1779 ("immediate" now))) | |
1780 header) | |
1781 (list | |
1782 (apply | |
1783 'nconc | |
1784 (list | |
1785 (if (eq type 'lower) | |
1786 "Lower score" | |
1787 "Increase score")) | |
1788 (let (outh) | |
1789 (while headers | |
1790 (setq header (car headers)) | |
1791 (setq outh | |
1792 (cons | |
1793 (apply | |
1794 'nconc | |
1795 (list (car header)) | |
1796 (let ((ts (cdr (assoc (nth 2 header) types))) | |
1797 outt) | |
1798 (while ts | |
1799 (setq outt | |
1800 (cons | |
1801 (apply | |
1802 'nconc | |
1803 (list (caar ts)) | |
1804 (let ((ps perms) | |
1805 outp) | |
1806 (while ps | |
1807 (setq outp | |
1808 (cons | |
1809 (vector | |
1810 (caar ps) | |
1811 (list | |
1812 'gnus-summary-score-entry | |
1813 (nth 1 header) | |
1814 (if (or (string= (nth 1 header) | |
1815 "head") | |
1816 (string= (nth 1 header) | |
1817 "body")) | |
1818 "" | |
1819 (list 'gnus-summary-header | |
1820 (nth 1 header))) | |
1821 (list 'quote (nth 1 (car ts))) | |
1822 (list 'gnus-score-default nil) | |
1823 (nth 1 (car ps)) | |
1824 t) | |
1825 t) | |
1826 outp)) | |
1827 (setq ps (cdr ps))) | |
1828 (list (nreverse outp)))) | |
1829 outt)) | |
1830 (setq ts (cdr ts))) | |
1831 (list (nreverse outt)))) | |
1832 outh)) | |
1833 (setq headers (cdr headers))) | |
1834 (list (nreverse outh)))))))) | |
1835 | |
1836 | |
1837 | |
1838 (defun gnus-summary-mode (&optional group) | |
1839 "Major mode for reading articles. | |
1840 | |
1841 All normal editing commands are switched off. | |
1842 \\<gnus-summary-mode-map> | |
1843 Each line in this buffer represents one article. To read an | |
1844 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards | |
1845 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]', | |
1846 respectively. | |
1847 | |
1848 You can also post articles and send mail from this buffer. To | |
1849 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author | |
1850 of an article, type `\\[gnus-summary-reply]'. | |
1851 | |
1852 There are approx. one gazillion commands you can execute in this | |
1853 buffer; read the info pages for more information (`\\[gnus-info-find-node]'). | |
1854 | |
1855 The following commands are available: | |
1856 | |
1857 \\{gnus-summary-mode-map}" | |
1858 (interactive) | |
1859 (when (gnus-visual-p 'summary-menu 'menu) | |
1860 (gnus-summary-make-menu-bar)) | |
1861 (kill-all-local-variables) | |
1862 (gnus-summary-make-local-variables) | |
1863 (gnus-make-thread-indent-array) | |
1864 (gnus-simplify-mode-line) | |
1865 (setq major-mode 'gnus-summary-mode) | |
1866 (setq mode-name "Summary") | |
1867 (make-local-variable 'minor-mode-alist) | |
1868 (use-local-map gnus-summary-mode-map) | |
1869 (buffer-disable-undo (current-buffer)) | |
1870 (setq buffer-read-only t) ;Disable modification | |
1871 (setq truncate-lines t) | |
1872 (setq selective-display t) | |
1873 (setq selective-display-ellipses t) ;Display `...' | |
1874 (gnus-summary-set-display-table) | |
1875 (gnus-set-default-directory) | |
1876 (setq gnus-newsgroup-name group) | |
1877 (make-local-variable 'gnus-summary-line-format) | |
1878 (make-local-variable 'gnus-summary-line-format-spec) | |
1879 (make-local-variable 'gnus-summary-mark-positions) | |
1880 (make-local-hook 'post-command-hook) | |
1881 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t) | |
1882 (run-hooks 'gnus-summary-mode-hook) | |
1883 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy) | |
1884 (gnus-update-summary-mark-positions)) | |
1885 | |
1886 (defun gnus-summary-make-local-variables () | |
1887 "Make all the local summary buffer variables." | |
1888 (let ((locals gnus-summary-local-variables) | |
1889 global local) | |
1890 (while (setq local (pop locals)) | |
1891 (if (consp local) | |
1892 (progn | |
1893 (if (eq (cdr local) 'global) | |
1894 ;; Copy the global value of the variable. | |
1895 (setq global (symbol-value (car local))) | |
1896 ;; Use the value from the list. | |
1897 (setq global (eval (cdr local)))) | |
1898 (make-local-variable (car local)) | |
1899 (set (car local) global)) | |
1900 ;; Simple nil-valued local variable. | |
1901 (make-local-variable local) | |
1902 (set local nil))))) | |
1903 | |
1904 (defun gnus-summary-clear-local-variables () | |
1905 (let ((locals gnus-summary-local-variables)) | |
1906 (while locals | |
1907 (if (consp (car locals)) | |
1908 (and (vectorp (caar locals)) | |
1909 (set (caar locals) nil)) | |
1910 (and (vectorp (car locals)) | |
1911 (set (car locals) nil))) | |
1912 (setq locals (cdr locals))))) | |
1913 | |
1914 ;; Summary data functions. | |
1915 | |
1916 (defmacro gnus-data-number (data) | |
1917 `(car ,data)) | |
1918 | |
1919 (defmacro gnus-data-set-number (data number) | |
1920 `(setcar ,data ,number)) | |
1921 | |
1922 (defmacro gnus-data-mark (data) | |
1923 `(nth 1 ,data)) | |
1924 | |
1925 (defmacro gnus-data-set-mark (data mark) | |
1926 `(setcar (nthcdr 1 ,data) ,mark)) | |
1927 | |
1928 (defmacro gnus-data-pos (data) | |
1929 `(nth 2 ,data)) | |
1930 | |
1931 (defmacro gnus-data-set-pos (data pos) | |
1932 `(setcar (nthcdr 2 ,data) ,pos)) | |
1933 | |
1934 (defmacro gnus-data-header (data) | |
1935 `(nth 3 ,data)) | |
1936 | |
1937 (defmacro gnus-data-set-header (data header) | |
1938 `(setf (nth 3 ,data) ,header)) | |
1939 | |
1940 (defmacro gnus-data-level (data) | |
1941 `(nth 4 ,data)) | |
1942 | |
1943 (defmacro gnus-data-unread-p (data) | |
1944 `(= (nth 1 ,data) gnus-unread-mark)) | |
1945 | |
1946 (defmacro gnus-data-read-p (data) | |
1947 `(/= (nth 1 ,data) gnus-unread-mark)) | |
1948 | |
1949 (defmacro gnus-data-pseudo-p (data) | |
1950 `(consp (nth 3 ,data))) | |
1951 | |
1952 (defmacro gnus-data-find (number) | |
1953 `(assq ,number gnus-newsgroup-data)) | |
1954 | |
1955 (defmacro gnus-data-find-list (number &optional data) | |
1956 `(let ((bdata ,(or data 'gnus-newsgroup-data))) | |
1957 (memq (assq ,number bdata) | |
1958 bdata))) | |
1959 | |
1960 (defmacro gnus-data-make (number mark pos header level) | |
1961 `(list ,number ,mark ,pos ,header ,level)) | |
1962 | |
1963 (defun gnus-data-enter (after-article number mark pos header level offset) | |
1964 (let ((data (gnus-data-find-list after-article))) | |
1965 (unless data | |
1966 (error "No such article: %d" after-article)) | |
1967 (setcdr data (cons (gnus-data-make number mark pos header level) | |
1968 (cdr data))) | |
1969 (setq gnus-newsgroup-data-reverse nil) | |
1970 (gnus-data-update-list (cddr data) offset))) | |
1971 | |
1972 (defun gnus-data-enter-list (after-article list &optional offset) | |
1973 (when list | |
1974 (let ((data (and after-article (gnus-data-find-list after-article))) | |
1975 (ilist list)) | |
1976 (or data (not after-article) (error "No such article: %d" after-article)) | |
1977 ;; Find the last element in the list to be spliced into the main | |
1978 ;; list. | |
1979 (while (cdr list) | |
1980 (setq list (cdr list))) | |
1981 (if (not data) | |
1982 (progn | |
1983 (setcdr list gnus-newsgroup-data) | |
1984 (setq gnus-newsgroup-data ilist) | |
1985 (when offset | |
1986 (gnus-data-update-list (cdr list) offset))) | |
1987 (setcdr list (cdr data)) | |
1988 (setcdr data ilist) | |
1989 (when offset | |
1990 (gnus-data-update-list (cdr list) offset))) | |
1991 (setq gnus-newsgroup-data-reverse nil)))) | |
1992 | |
1993 (defun gnus-data-remove (article &optional offset) | |
1994 (let ((data gnus-newsgroup-data)) | |
1995 (if (= (gnus-data-number (car data)) article) | |
1996 (progn | |
1997 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data) | |
1998 gnus-newsgroup-data-reverse nil) | |
1999 (when offset | |
2000 (gnus-data-update-list gnus-newsgroup-data offset))) | |
2001 (while (cdr data) | |
2002 (when (= (gnus-data-number (cadr data)) article) | |
2003 (setcdr data (cddr data)) | |
2004 (when offset | |
2005 (gnus-data-update-list (cdr data) offset)) | |
2006 (setq data nil | |
2007 gnus-newsgroup-data-reverse nil)) | |
2008 (setq data (cdr data)))))) | |
2009 | |
2010 (defmacro gnus-data-list (backward) | |
2011 `(if ,backward | |
2012 (or gnus-newsgroup-data-reverse | |
2013 (setq gnus-newsgroup-data-reverse | |
2014 (reverse gnus-newsgroup-data))) | |
2015 gnus-newsgroup-data)) | |
2016 | |
2017 (defun gnus-data-update-list (data offset) | |
2018 "Add OFFSET to the POS of all data entries in DATA." | |
2019 (while data | |
2020 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data)))) | |
2021 (setq data (cdr data)))) | |
2022 | |
2023 (defun gnus-data-compute-positions () | |
2024 "Compute the positions of all articles." | |
2025 (let ((data gnus-newsgroup-data) | |
2026 pos) | |
2027 (while data | |
2028 (when (setq pos (text-property-any | |
2029 (point-min) (point-max) | |
2030 'gnus-number (gnus-data-number (car data)))) | |
2031 (gnus-data-set-pos (car data) (+ pos 3))) | |
2032 (setq data (cdr data))))) | |
2033 | |
2034 (defun gnus-summary-article-pseudo-p (article) | |
2035 "Say whether this article is a pseudo article or not." | |
2036 (not (vectorp (gnus-data-header (gnus-data-find article))))) | |
2037 | |
2038 (defmacro gnus-summary-article-sparse-p (article) | |
2039 "Say whether this article is a sparse article or not." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
2040 `(memq ,article gnus-newsgroup-sparse)) |
17493 | 2041 |
2042 (defmacro gnus-summary-article-ancient-p (article) | |
2043 "Say whether this article is a sparse article or not." | |
2044 `(memq ,article gnus-newsgroup-ancient)) | |
2045 | |
2046 (defun gnus-article-parent-p (number) | |
2047 "Say whether this article is a parent or not." | |
2048 (let ((data (gnus-data-find-list number))) | |
2049 (and (cdr data) ; There has to be an article after... | |
2050 (< (gnus-data-level (car data)) ; And it has to have a higher level. | |
2051 (gnus-data-level (nth 1 data)))))) | |
2052 | |
2053 (defun gnus-article-children (number) | |
2054 "Return a list of all children to NUMBER." | |
2055 (let* ((data (gnus-data-find-list number)) | |
2056 (level (gnus-data-level (car data))) | |
2057 children) | |
2058 (setq data (cdr data)) | |
2059 (while (and data | |
2060 (= (gnus-data-level (car data)) (1+ level))) | |
2061 (push (gnus-data-number (car data)) children) | |
2062 (setq data (cdr data))) | |
2063 children)) | |
2064 | |
2065 (defmacro gnus-summary-skip-intangible () | |
2066 "If the current article is intangible, then jump to a different article." | |
2067 '(let ((to (get-text-property (point) 'gnus-intangible))) | |
2068 (and to (gnus-summary-goto-subject to)))) | |
2069 | |
2070 (defmacro gnus-summary-article-intangible-p () | |
2071 "Say whether this article is intangible or not." | |
2072 '(get-text-property (point) 'gnus-intangible)) | |
2073 | |
2074 (defun gnus-article-read-p (article) | |
2075 "Say whether ARTICLE is read or not." | |
2076 (not (or (memq article gnus-newsgroup-marked) | |
2077 (memq article gnus-newsgroup-unreads) | |
2078 (memq article gnus-newsgroup-unselected) | |
2079 (memq article gnus-newsgroup-dormant)))) | |
2080 | |
2081 ;; Some summary mode macros. | |
2082 | |
2083 (defmacro gnus-summary-article-number () | |
2084 "The article number of the article on the current line. | |
2085 If there isn's an article number here, then we return the current | |
2086 article number." | |
2087 '(progn | |
2088 (gnus-summary-skip-intangible) | |
2089 (or (get-text-property (point) 'gnus-number) | |
2090 (gnus-summary-last-subject)))) | |
2091 | |
2092 (defmacro gnus-summary-article-header (&optional number) | |
2093 `(gnus-data-header (gnus-data-find | |
2094 ,(or number '(gnus-summary-article-number))))) | |
2095 | |
2096 (defmacro gnus-summary-thread-level (&optional number) | |
2097 `(if (and (eq gnus-summary-make-false-root 'dummy) | |
2098 (get-text-property (point) 'gnus-intangible)) | |
2099 0 | |
2100 (gnus-data-level (gnus-data-find | |
2101 ,(or number '(gnus-summary-article-number)))))) | |
2102 | |
2103 (defmacro gnus-summary-article-mark (&optional number) | |
2104 `(gnus-data-mark (gnus-data-find | |
2105 ,(or number '(gnus-summary-article-number))))) | |
2106 | |
2107 (defmacro gnus-summary-article-pos (&optional number) | |
2108 `(gnus-data-pos (gnus-data-find | |
2109 ,(or number '(gnus-summary-article-number))))) | |
2110 | |
2111 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject) | |
2112 (defmacro gnus-summary-article-subject (&optional number) | |
2113 "Return current subject string or nil if nothing." | |
2114 `(let ((headers | |
2115 ,(if number | |
2116 `(gnus-data-header (assq ,number gnus-newsgroup-data)) | |
2117 '(gnus-data-header (assq (gnus-summary-article-number) | |
2118 gnus-newsgroup-data))))) | |
2119 (and headers | |
2120 (vectorp headers) | |
2121 (mail-header-subject headers)))) | |
2122 | |
2123 (defmacro gnus-summary-article-score (&optional number) | |
2124 "Return current article score." | |
2125 `(or (cdr (assq ,(or number '(gnus-summary-article-number)) | |
2126 gnus-newsgroup-scored)) | |
2127 gnus-summary-default-score 0)) | |
2128 | |
2129 (defun gnus-summary-article-children (&optional number) | |
2130 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number)))) | |
2131 (level (gnus-data-level (car data))) | |
2132 l children) | |
2133 (while (and (setq data (cdr data)) | |
2134 (> (setq l (gnus-data-level (car data))) level)) | |
2135 (and (= (1+ level) l) | |
2136 (push (gnus-data-number (car data)) | |
2137 children))) | |
2138 (nreverse children))) | |
2139 | |
2140 (defun gnus-summary-article-parent (&optional number) | |
2141 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number)) | |
2142 (gnus-data-list t))) | |
2143 (level (gnus-data-level (car data)))) | |
2144 (if (zerop level) | |
2145 () ; This is a root. | |
2146 ;; We search until we find an article with a level less than | |
2147 ;; this one. That function has to be the parent. | |
2148 (while (and (setq data (cdr data)) | |
2149 (not (< (gnus-data-level (car data)) level)))) | |
2150 (and data (gnus-data-number (car data)))))) | |
2151 | |
2152 (defun gnus-unread-mark-p (mark) | |
2153 "Say whether MARK is the unread mark." | |
2154 (= mark gnus-unread-mark)) | |
2155 | |
2156 (defun gnus-read-mark-p (mark) | |
2157 "Say whether MARK is one of the marks that mark as read. | |
2158 This is all marks except unread, ticked, dormant, and expirable." | |
2159 (not (or (= mark gnus-unread-mark) | |
2160 (= mark gnus-ticked-mark) | |
2161 (= mark gnus-dormant-mark) | |
2162 (= mark gnus-expirable-mark)))) | |
2163 | |
2164 (defmacro gnus-article-mark (number) | |
2165 `(cond | |
2166 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark) | |
2167 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark) | |
2168 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark) | |
2169 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark) | |
2170 (t (or (cdr (assq ,number gnus-newsgroup-reads)) | |
2171 gnus-ancient-mark)))) | |
2172 | |
2173 ;; Saving hidden threads. | |
2174 | |
2175 (put 'gnus-save-hidden-threads 'lisp-indent-function 0) | |
2176 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body)) | |
2177 | |
2178 (defmacro gnus-save-hidden-threads (&rest forms) | |
2179 "Save hidden threads, eval FORMS, and restore the hidden threads." | |
2180 (let ((config (make-symbol "config"))) | |
2181 `(let ((,config (gnus-hidden-threads-configuration))) | |
2182 (unwind-protect | |
2183 (save-excursion | |
2184 ,@forms) | |
2185 (gnus-restore-hidden-threads-configuration ,config))))) | |
2186 | |
2187 (defun gnus-hidden-threads-configuration () | |
2188 "Return the current hidden threads configuration." | |
2189 (save-excursion | |
2190 (let (config) | |
2191 (goto-char (point-min)) | |
2192 (while (search-forward "\r" nil t) | |
2193 (push (1- (point)) config)) | |
2194 config))) | |
2195 | |
2196 (defun gnus-restore-hidden-threads-configuration (config) | |
2197 "Restore hidden threads configuration from CONFIG." | |
2198 (let (point buffer-read-only) | |
2199 (while (setq point (pop config)) | |
2200 (when (and (< point (point-max)) | |
2201 (goto-char point) | |
2202 (= (following-char) ?\n)) | |
2203 (subst-char-in-region point (1+ point) ?\n ?\r))))) | |
2204 | |
2205 ;; Various summary mode internalish functions. | |
2206 | |
2207 (defun gnus-mouse-pick-article (e) | |
2208 (interactive "e") | |
2209 (mouse-set-point e) | |
2210 (gnus-summary-next-page nil t)) | |
2211 | |
2212 (defun gnus-summary-set-display-table () | |
2213 ;; Change the display table. Odd characters have a tendency to mess | |
2214 ;; up nicely formatted displays - we make all possible glyphs | |
2215 ;; display only a single character. | |
2216 | |
2217 ;; We start from the standard display table, if any. | |
2218 (let ((table (or (copy-sequence standard-display-table) | |
2219 (make-display-table))) | |
2220 (i 32)) | |
2221 ;; Nix out all the control chars... | |
2222 (while (>= (setq i (1- i)) 0) | |
2223 (aset table i [??])) | |
2224 ;; ... but not newline and cr, of course. (cr is necessary for the | |
2225 ;; selective display). | |
2226 (aset table ?\n nil) | |
2227 (aset table ?\r nil) | |
2228 ;; We nix out any glyphs over 126 that are not set already. | |
2229 (let ((i 256)) | |
2230 (while (>= (setq i (1- i)) 127) | |
2231 ;; Only modify if the entry is nil. | |
2232 (unless (aref table i) | |
2233 (aset table i [??])))) | |
2234 (setq buffer-display-table table))) | |
2235 | |
2236 (defun gnus-summary-setup-buffer (group) | |
2237 "Initialize summary buffer." | |
2238 (let ((buffer (concat "*Summary " group "*"))) | |
2239 (if (get-buffer buffer) | |
2240 (progn | |
2241 (set-buffer buffer) | |
2242 (setq gnus-summary-buffer (current-buffer)) | |
2243 (not gnus-newsgroup-prepared)) | |
2244 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu> | |
2245 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer))) | |
2246 (gnus-add-current-to-buffer-list) | |
2247 (gnus-summary-mode group) | |
2248 (when gnus-carpal | |
2249 (gnus-carpal-setup-buffer 'summary)) | |
2250 (unless gnus-single-article-buffer | |
2251 (make-local-variable 'gnus-article-buffer) | |
2252 (make-local-variable 'gnus-article-current) | |
2253 (make-local-variable 'gnus-original-article-buffer)) | |
2254 (setq gnus-newsgroup-name group) | |
2255 t))) | |
2256 | |
2257 (defun gnus-set-global-variables () | |
2258 ;; Set the global equivalents of the summary buffer-local variables | |
2259 ;; to the latest values they had. These reflect the summary buffer | |
2260 ;; that was in action when the last article was fetched. | |
2261 (when (eq major-mode 'gnus-summary-mode) | |
2262 (setq gnus-summary-buffer (current-buffer)) | |
2263 (let ((name gnus-newsgroup-name) | |
2264 (marked gnus-newsgroup-marked) | |
2265 (unread gnus-newsgroup-unreads) | |
2266 (headers gnus-current-headers) | |
2267 (data gnus-newsgroup-data) | |
2268 (summary gnus-summary-buffer) | |
2269 (article-buffer gnus-article-buffer) | |
2270 (original gnus-original-article-buffer) | |
2271 (gac gnus-article-current) | |
2272 (reffed gnus-reffed-article-number) | |
2273 (score-file gnus-current-score-file)) | |
2274 (save-excursion | |
2275 (set-buffer gnus-group-buffer) | |
2276 (setq gnus-newsgroup-name name) | |
2277 (setq gnus-newsgroup-marked marked) | |
2278 (setq gnus-newsgroup-unreads unread) | |
2279 (setq gnus-current-headers headers) | |
2280 (setq gnus-newsgroup-data data) | |
2281 (setq gnus-article-current gac) | |
2282 (setq gnus-summary-buffer summary) | |
2283 (setq gnus-article-buffer article-buffer) | |
2284 (setq gnus-original-article-buffer original) | |
2285 (setq gnus-reffed-article-number reffed) | |
2286 (setq gnus-current-score-file score-file) | |
2287 ;; The article buffer also has local variables. | |
2288 (when (gnus-buffer-live-p gnus-article-buffer) | |
2289 (set-buffer gnus-article-buffer) | |
2290 (setq gnus-summary-buffer summary)))))) | |
2291 | |
2292 (defun gnus-summary-article-unread-p (article) | |
2293 "Say whether ARTICLE is unread or not." | |
2294 (memq article gnus-newsgroup-unreads)) | |
2295 | |
2296 (defun gnus-summary-first-article-p (&optional article) | |
2297 "Return whether ARTICLE is the first article in the buffer." | |
2298 (if (not (setq article (or article (gnus-summary-article-number)))) | |
2299 nil | |
2300 (eq article (caar gnus-newsgroup-data)))) | |
2301 | |
2302 (defun gnus-summary-last-article-p (&optional article) | |
2303 "Return whether ARTICLE is the last article in the buffer." | |
2304 (if (not (setq article (or article (gnus-summary-article-number)))) | |
2305 t ; All non-existent numbers are the last article. :-) | |
2306 (not (cdr (gnus-data-find-list article))))) | |
2307 | |
2308 (defun gnus-make-thread-indent-array () | |
2309 (let ((n 200)) | |
2310 (unless (and gnus-thread-indent-array | |
2311 (= gnus-thread-indent-level gnus-thread-indent-array-level)) | |
2312 (setq gnus-thread-indent-array (make-vector 201 "") | |
2313 gnus-thread-indent-array-level gnus-thread-indent-level) | |
2314 (while (>= n 0) | |
2315 (aset gnus-thread-indent-array n | |
2316 (make-string (* n gnus-thread-indent-level) ? )) | |
2317 (setq n (1- n)))))) | |
2318 | |
2319 (defun gnus-update-summary-mark-positions () | |
2320 "Compute where the summary marks are to go." | |
2321 (save-excursion | |
2322 (when (and gnus-summary-buffer | |
2323 (get-buffer gnus-summary-buffer) | |
2324 (buffer-name (get-buffer gnus-summary-buffer))) | |
2325 (set-buffer gnus-summary-buffer)) | |
2326 (let ((gnus-replied-mark 129) | |
2327 (gnus-score-below-mark 130) | |
2328 (gnus-score-over-mark 130) | |
2329 (spec gnus-summary-line-format-spec) | |
2330 thread gnus-visual pos) | |
2331 (save-excursion | |
2332 (gnus-set-work-buffer) | |
2333 (let ((gnus-summary-line-format-spec spec)) | |
2334 (gnus-summary-insert-line | |
2335 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1) | |
2336 (goto-char (point-min)) | |
2337 (setq pos (list (cons 'unread (and (search-forward "\200" nil t) | |
2338 (- (point) 2))))) | |
2339 (goto-char (point-min)) | |
2340 (push (cons 'replied (and (search-forward "\201" nil t) | |
2341 (- (point) 2))) | |
2342 pos) | |
2343 (goto-char (point-min)) | |
2344 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2))) | |
2345 pos))) | |
2346 (setq gnus-summary-mark-positions pos)))) | |
2347 | |
2348 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number) | |
2349 "Insert a dummy root in the summary buffer." | |
2350 (beginning-of-line) | |
2351 (gnus-add-text-properties | |
2352 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point)) | |
2353 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number))) | |
2354 | |
2355 (defun gnus-summary-insert-line (gnus-tmp-header | |
2356 gnus-tmp-level gnus-tmp-current | |
2357 gnus-tmp-unread gnus-tmp-replied | |
2358 gnus-tmp-expirable gnus-tmp-subject-or-nil | |
2359 &optional gnus-tmp-dummy gnus-tmp-score | |
2360 gnus-tmp-process) | |
2361 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level)) | |
2362 (gnus-tmp-lines (mail-header-lines gnus-tmp-header)) | |
2363 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0)) | |
2364 (gnus-tmp-score-char | |
2365 (if (or (null gnus-summary-default-score) | |
2366 (<= (abs (- gnus-tmp-score gnus-summary-default-score)) | |
2367 gnus-summary-zcore-fuzz)) | |
2368 ? | |
2369 (if (< gnus-tmp-score gnus-summary-default-score) | |
2370 gnus-score-below-mark gnus-score-over-mark))) | |
2371 (gnus-tmp-replied | |
2372 (cond (gnus-tmp-process gnus-process-mark) | |
2373 ((memq gnus-tmp-current gnus-newsgroup-cached) | |
2374 gnus-cached-mark) | |
2375 (gnus-tmp-replied gnus-replied-mark) | |
2376 ((memq gnus-tmp-current gnus-newsgroup-saved) | |
2377 gnus-saved-mark) | |
2378 (t gnus-unread-mark))) | |
2379 (gnus-tmp-from (mail-header-from gnus-tmp-header)) | |
2380 (gnus-tmp-name | |
2381 (cond | |
2382 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
2383 (let ((beg (match-beginning 0))) | |
2384 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
2385 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
2386 (1- (match-end 0)))) | |
2387 (substring gnus-tmp-from 0 beg)))) | |
2388 ((string-match "(.+)" gnus-tmp-from) | |
2389 (substring gnus-tmp-from | |
2390 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
2391 (t gnus-tmp-from))) | |
2392 (gnus-tmp-subject (mail-header-subject gnus-tmp-header)) | |
2393 (gnus-tmp-number (mail-header-number gnus-tmp-header)) | |
2394 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) | |
2395 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) | |
2396 (buffer-read-only nil)) | |
2397 (when (string= gnus-tmp-name "") | |
2398 (setq gnus-tmp-name gnus-tmp-from)) | |
2399 (unless (numberp gnus-tmp-lines) | |
2400 (setq gnus-tmp-lines 0)) | |
2401 (gnus-put-text-property | |
2402 (point) | |
2403 (progn (eval gnus-summary-line-format-spec) (point)) | |
2404 'gnus-number gnus-tmp-number) | |
2405 (when (gnus-visual-p 'summary-highlight 'highlight) | |
2406 (forward-line -1) | |
2407 (run-hooks 'gnus-summary-update-hook) | |
2408 (forward-line 1)))) | |
2409 | |
2410 (defun gnus-summary-update-line (&optional dont-update) | |
2411 ;; Update summary line after change. | |
2412 (when (and gnus-summary-default-score | |
2413 (not gnus-summary-inhibit-highlight)) | |
2414 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion. | |
2415 (article (gnus-summary-article-number)) | |
2416 (score (gnus-summary-article-score article))) | |
2417 (unless dont-update | |
2418 (if (and gnus-summary-mark-below | |
2419 (< (gnus-summary-article-score) | |
2420 gnus-summary-mark-below)) | |
2421 ;; This article has a low score, so we mark it as read. | |
2422 (when (memq article gnus-newsgroup-unreads) | |
2423 (gnus-summary-mark-article-as-read gnus-low-score-mark)) | |
2424 (when (eq (gnus-summary-article-mark) gnus-low-score-mark) | |
2425 ;; This article was previously marked as read on account | |
2426 ;; of a low score, but now it has risen, so we mark it as | |
2427 ;; unread. | |
2428 (gnus-summary-mark-article-as-unread gnus-unread-mark))) | |
2429 (gnus-summary-update-mark | |
2430 (if (or (null gnus-summary-default-score) | |
2431 (<= (abs (- score gnus-summary-default-score)) | |
2432 gnus-summary-zcore-fuzz)) | |
2433 ? | |
2434 (if (< score gnus-summary-default-score) | |
2435 gnus-score-below-mark gnus-score-over-mark)) | |
2436 'score)) | |
2437 ;; Do visual highlighting. | |
2438 (when (gnus-visual-p 'summary-highlight 'highlight) | |
2439 (run-hooks 'gnus-summary-update-hook))))) | |
2440 | |
2441 (defvar gnus-tmp-new-adopts nil) | |
2442 | |
2443 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char) | |
2444 "Return the number of articles in THREAD. | |
2445 This may be 0 in some cases -- if none of the articles in | |
2446 the thread are to be displayed." | |
2447 (let* ((number | |
2448 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>. | |
2449 (cond | |
2450 ((not (listp thread)) | |
2451 1) | |
2452 ((and (consp thread) (cdr thread)) | |
2453 (apply | |
2454 '+ 1 (mapcar | |
2455 'gnus-summary-number-of-articles-in-thread (cdr thread)))) | |
2456 ((null thread) | |
2457 1) | |
2458 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit) | |
2459 1) | |
2460 (t 0)))) | |
2461 (when (and level (zerop level) gnus-tmp-new-adopts) | |
2462 (incf number | |
2463 (apply '+ (mapcar | |
2464 'gnus-summary-number-of-articles-in-thread | |
2465 gnus-tmp-new-adopts)))) | |
2466 (if char | |
2467 (if (> number 1) gnus-not-empty-thread-mark | |
2468 gnus-empty-thread-mark) | |
2469 number))) | |
2470 | |
2471 (defun gnus-summary-set-local-parameters (group) | |
2472 "Go through the local params of GROUP and set all variable specs in that list." | |
2473 (let ((params (gnus-group-find-parameter group)) | |
2474 elem) | |
2475 (while params | |
2476 (setq elem (car params) | |
2477 params (cdr params)) | |
2478 (and (consp elem) ; Has to be a cons. | |
2479 (consp (cdr elem)) ; The cdr has to be a list. | |
2480 (symbolp (car elem)) ; Has to be a symbol in there. | |
2481 (not (memq (car elem) | |
2482 '(quit-config to-address to-list to-group))) | |
2483 (ignore-errors ; So we set it. | |
2484 (make-local-variable (car elem)) | |
2485 (set (car elem) (eval (nth 1 elem)))))))) | |
2486 | |
2487 (defun gnus-summary-read-group (group &optional show-all no-article | |
2488 kill-buffer no-display) | |
2489 "Start reading news in newsgroup GROUP. | |
2490 If SHOW-ALL is non-nil, already read articles are also listed. | |
2491 If NO-ARTICLE is non-nil, no article is selected initially. | |
2492 If NO-DISPLAY, don't generate a summary buffer." | |
2493 (let (result) | |
2494 (while (and group | |
2495 (null (setq result | |
2496 (let ((gnus-auto-select-next nil)) | |
2497 (gnus-summary-read-group-1 | |
2498 group show-all no-article | |
2499 kill-buffer no-display)))) | |
2500 (eq gnus-auto-select-next 'quietly)) | |
2501 (set-buffer gnus-group-buffer) | |
2502 (if (not (equal group (gnus-group-group-name))) | |
2503 (setq group (gnus-group-group-name)) | |
2504 (setq group nil))) | |
2505 result)) | |
2506 | |
2507 (defun gnus-summary-read-group-1 (group show-all no-article | |
2508 kill-buffer no-display) | |
2509 ;; Killed foreign groups can't be entered. | |
2510 (when (and (not (gnus-group-native-p group)) | |
2511 (not (gnus-gethash group gnus-newsrc-hashtb))) | |
2512 (error "Dead non-native groups can't be entered")) | |
2513 (gnus-message 5 "Retrieving newsgroup: %s..." group) | |
2514 (let* ((new-group (gnus-summary-setup-buffer group)) | |
2515 (quit-config (gnus-group-quit-config group)) | |
2516 (did-select (and new-group (gnus-select-newsgroup group show-all)))) | |
2517 (cond | |
2518 ;; This summary buffer exists already, so we just select it. | |
2519 ((not new-group) | |
2520 (gnus-set-global-variables) | |
2521 (when kill-buffer | |
2522 (gnus-kill-or-deaden-summary kill-buffer)) | |
2523 (gnus-configure-windows 'summary 'force) | |
2524 (gnus-set-mode-line 'summary) | |
2525 (gnus-summary-position-point) | |
2526 (message "") | |
2527 t) | |
2528 ;; We couldn't select this group. | |
2529 ((null did-select) | |
2530 (when (and (eq major-mode 'gnus-summary-mode) | |
2531 (not (equal (current-buffer) kill-buffer))) | |
2532 (kill-buffer (current-buffer)) | |
2533 (if (not quit-config) | |
2534 (progn | |
2535 (set-buffer gnus-group-buffer) | |
2536 (gnus-group-jump-to-group group) | |
2537 (gnus-group-next-unread-group 1)) | |
2538 (gnus-handle-ephemeral-exit quit-config))) | |
2539 (gnus-message 3 "Can't select group") | |
2540 nil) | |
2541 ;; The user did a `C-g' while prompting for number of articles, | |
2542 ;; so we exit this group. | |
2543 ((eq did-select 'quit) | |
2544 (and (eq major-mode 'gnus-summary-mode) | |
2545 (not (equal (current-buffer) kill-buffer)) | |
2546 (kill-buffer (current-buffer))) | |
2547 (when kill-buffer | |
2548 (gnus-kill-or-deaden-summary kill-buffer)) | |
2549 (if (not quit-config) | |
2550 (progn | |
2551 (set-buffer gnus-group-buffer) | |
2552 (gnus-group-jump-to-group group) | |
2553 (gnus-group-next-unread-group 1) | |
2554 (gnus-configure-windows 'group 'force)) | |
2555 (gnus-handle-ephemeral-exit quit-config)) | |
2556 ;; Finally signal the quit. | |
2557 (signal 'quit nil)) | |
2558 ;; The group was successfully selected. | |
2559 (t | |
2560 (gnus-set-global-variables) | |
2561 ;; Save the active value in effect when the group was entered. | |
2562 (setq gnus-newsgroup-active | |
2563 (gnus-copy-sequence | |
2564 (gnus-active gnus-newsgroup-name))) | |
2565 ;; You can change the summary buffer in some way with this hook. | |
2566 (run-hooks 'gnus-select-group-hook) | |
2567 ;; Set any local variables in the group parameters. | |
2568 (gnus-summary-set-local-parameters gnus-newsgroup-name) | |
2569 (gnus-update-format-specifications | |
2570 nil 'summary 'summary-mode 'summary-dummy) | |
2571 ;; Do score processing. | |
2572 (when gnus-use-scoring | |
2573 (gnus-possibly-score-headers)) | |
2574 ;; Check whether to fill in the gaps in the threads. | |
2575 (when gnus-build-sparse-threads | |
2576 (gnus-build-sparse-threads)) | |
2577 ;; Find the initial limit. | |
2578 (if gnus-show-threads | |
2579 (if show-all | |
2580 (let ((gnus-newsgroup-dormant nil)) | |
2581 (gnus-summary-initial-limit show-all)) | |
2582 (gnus-summary-initial-limit show-all)) | |
2583 (setq gnus-newsgroup-limit | |
2584 (mapcar | |
2585 (lambda (header) (mail-header-number header)) | |
2586 gnus-newsgroup-headers))) | |
2587 ;; Generate the summary buffer. | |
2588 (unless no-display | |
2589 (gnus-summary-prepare)) | |
2590 (when gnus-use-trees | |
2591 (gnus-tree-open group) | |
2592 (setq gnus-summary-highlight-line-function | |
2593 'gnus-tree-highlight-article)) | |
2594 ;; If the summary buffer is empty, but there are some low-scored | |
2595 ;; articles or some excluded dormants, we include these in the | |
2596 ;; buffer. | |
2597 (when (and (zerop (buffer-size)) | |
2598 (not no-display)) | |
2599 (cond (gnus-newsgroup-dormant | |
2600 (gnus-summary-limit-include-dormant)) | |
2601 ((and gnus-newsgroup-scored show-all) | |
2602 (gnus-summary-limit-include-expunged t)))) | |
2603 ;; Function `gnus-apply-kill-file' must be called in this hook. | |
2604 (run-hooks 'gnus-apply-kill-hook) | |
2605 (if (and (zerop (buffer-size)) | |
2606 (not no-display)) | |
2607 (progn | |
2608 ;; This newsgroup is empty. | |
2609 (gnus-summary-catchup-and-exit nil t) | |
2610 (gnus-message 6 "No unread news") | |
2611 (when kill-buffer | |
2612 (gnus-kill-or-deaden-summary kill-buffer)) | |
2613 ;; Return nil from this function. | |
2614 nil) | |
2615 ;; Hide conversation thread subtrees. We cannot do this in | |
2616 ;; gnus-summary-prepare-hook since kill processing may not | |
2617 ;; work with hidden articles. | |
2618 (and gnus-show-threads | |
2619 gnus-thread-hide-subtree | |
2620 (gnus-summary-hide-all-threads)) | |
2621 ;; Show first unread article if requested. | |
2622 (if (and (not no-article) | |
2623 (not no-display) | |
2624 gnus-newsgroup-unreads | |
2625 gnus-auto-select-first) | |
2626 (unless (if (eq gnus-auto-select-first 'best) | |
2627 (gnus-summary-best-unread-article) | |
2628 (gnus-summary-first-unread-article)) | |
2629 (gnus-configure-windows 'summary)) | |
2630 ;; Don't select any articles, just move point to the first | |
2631 ;; article in the group. | |
2632 (goto-char (point-min)) | |
2633 (gnus-summary-position-point) | |
2634 (gnus-set-mode-line 'summary) | |
2635 (gnus-configure-windows 'summary 'force)) | |
2636 (when kill-buffer | |
2637 (gnus-kill-or-deaden-summary kill-buffer)) | |
2638 (when (get-buffer-window gnus-group-buffer t) | |
2639 ;; Gotta use windows, because recenter does weird stuff if | |
2640 ;; the current buffer ain't the displayed window. | |
2641 (let ((owin (selected-window))) | |
2642 (select-window (get-buffer-window gnus-group-buffer t)) | |
2643 (when (gnus-group-goto-group group) | |
2644 (recenter)) | |
2645 (select-window owin))) | |
2646 ;; Mark this buffer as "prepared". | |
2647 (setq gnus-newsgroup-prepared t) | |
2648 t))))) | |
2649 | |
2650 (defun gnus-summary-prepare () | |
2651 "Generate the summary buffer." | |
2652 (interactive) | |
2653 (let ((buffer-read-only nil)) | |
2654 (erase-buffer) | |
2655 (setq gnus-newsgroup-data nil | |
2656 gnus-newsgroup-data-reverse nil) | |
2657 (run-hooks 'gnus-summary-generate-hook) | |
2658 ;; Generate the buffer, either with threads or without. | |
2659 (when gnus-newsgroup-headers | |
2660 (gnus-summary-prepare-threads | |
2661 (if gnus-show-threads | |
2662 (gnus-sort-gathered-threads | |
2663 (funcall gnus-summary-thread-gathering-function | |
2664 (gnus-sort-threads | |
2665 (gnus-cut-threads (gnus-make-threads))))) | |
2666 ;; Unthreaded display. | |
2667 (gnus-sort-articles gnus-newsgroup-headers)))) | |
2668 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data)) | |
2669 ;; Call hooks for modifying summary buffer. | |
2670 (goto-char (point-min)) | |
2671 (run-hooks 'gnus-summary-prepare-hook))) | |
2672 | |
2673 (defsubst gnus-general-simplify-subject (subject) | |
2674 "Simply subject by the same rules as gnus-gather-threads-by-subject." | |
2675 (setq subject | |
2676 (cond | |
2677 ;; Truncate the subject. | |
2678 ((numberp gnus-summary-gather-subject-limit) | |
2679 (setq subject (gnus-simplify-subject-re subject)) | |
2680 (if (> (length subject) gnus-summary-gather-subject-limit) | |
2681 (substring subject 0 gnus-summary-gather-subject-limit) | |
2682 subject)) | |
2683 ;; Fuzzily simplify it. | |
2684 ((eq 'fuzzy gnus-summary-gather-subject-limit) | |
2685 (gnus-simplify-subject-fuzzy subject)) | |
2686 ;; Just remove the leading "Re:". | |
2687 (t | |
2688 (gnus-simplify-subject-re subject)))) | |
2689 | |
2690 (if (and gnus-summary-gather-exclude-subject | |
2691 (string-match gnus-summary-gather-exclude-subject subject)) | |
2692 nil ; This article shouldn't be gathered | |
2693 subject)) | |
2694 | |
2695 (defun gnus-summary-simplify-subject-query () | |
2696 "Query where the respool algorithm would put this article." | |
2697 (interactive) | |
2698 (gnus-set-global-variables) | |
2699 (gnus-summary-select-article) | |
2700 (message (gnus-general-simplify-subject (gnus-summary-article-subject)))) | |
2701 | |
2702 (defun gnus-gather-threads-by-subject (threads) | |
2703 "Gather threads by looking at Subject headers." | |
2704 (if (not gnus-summary-make-false-root) | |
2705 threads | |
2706 (let ((hashtb (gnus-make-hashtable 1024)) | |
2707 (prev threads) | |
2708 (result threads) | |
2709 subject hthread whole-subject) | |
2710 (while threads | |
2711 (setq subject (gnus-general-simplify-subject | |
2712 (setq whole-subject (mail-header-subject | |
2713 (caar threads))))) | |
2714 (when subject | |
2715 (if (setq hthread (gnus-gethash subject hashtb)) | |
2716 (progn | |
2717 ;; We enter a dummy root into the thread, if we | |
2718 ;; haven't done that already. | |
2719 (unless (stringp (caar hthread)) | |
2720 (setcar hthread (list whole-subject (car hthread)))) | |
2721 ;; We add this new gathered thread to this gathered | |
2722 ;; thread. | |
2723 (setcdr (car hthread) | |
2724 (nconc (cdar hthread) (list (car threads)))) | |
2725 ;; Remove it from the list of threads. | |
2726 (setcdr prev (cdr threads)) | |
2727 (setq threads prev)) | |
2728 ;; Enter this thread into the hash table. | |
2729 (gnus-sethash subject threads hashtb))) | |
2730 (setq prev threads) | |
2731 (setq threads (cdr threads))) | |
2732 result))) | |
2733 | |
2734 (defun gnus-gather-threads-by-references (threads) | |
2735 "Gather threads by looking at References headers." | |
2736 (let ((idhashtb (gnus-make-hashtable 1024)) | |
2737 (thhashtb (gnus-make-hashtable 1024)) | |
2738 (prev threads) | |
2739 (result threads) | |
2740 ids references id gthread gid entered ref) | |
2741 (while threads | |
2742 (when (setq references (mail-header-references (caar threads))) | |
2743 (setq id (mail-header-id (caar threads)) | |
2744 ids (gnus-split-references references) | |
2745 entered nil) | |
2746 (while (setq ref (pop ids)) | |
2747 (setq ids (delete ref ids)) | |
2748 (if (not (setq gid (gnus-gethash ref idhashtb))) | |
2749 (progn | |
2750 (gnus-sethash ref id idhashtb) | |
2751 (gnus-sethash id threads thhashtb)) | |
2752 (setq gthread (gnus-gethash gid thhashtb)) | |
2753 (unless entered | |
2754 ;; We enter a dummy root into the thread, if we | |
2755 ;; haven't done that already. | |
2756 (unless (stringp (caar gthread)) | |
2757 (setcar gthread (list (mail-header-subject (caar gthread)) | |
2758 (car gthread)))) | |
2759 ;; We add this new gathered thread to this gathered | |
2760 ;; thread. | |
2761 (setcdr (car gthread) | |
2762 (nconc (cdar gthread) (list (car threads))))) | |
2763 ;; Add it into the thread hash table. | |
2764 (gnus-sethash id gthread thhashtb) | |
2765 (setq entered t) | |
2766 ;; Remove it from the list of threads. | |
2767 (setcdr prev (cdr threads)) | |
2768 (setq threads prev)))) | |
2769 (setq prev threads) | |
2770 (setq threads (cdr threads))) | |
2771 result)) | |
2772 | |
2773 (defun gnus-sort-gathered-threads (threads) | |
2774 "Sort subtreads inside each gathered thread by article number." | |
2775 (let ((result threads)) | |
2776 (while threads | |
2777 (when (stringp (caar threads)) | |
2778 (setcdr (car threads) | |
2779 (sort (cdar threads) 'gnus-thread-sort-by-number))) | |
2780 (setq threads (cdr threads))) | |
2781 result)) | |
2782 | |
2783 (defun gnus-thread-loop-p (root thread) | |
2784 "Say whether ROOT is in THREAD." | |
2785 (let ((stack (list thread)) | |
2786 (infloop 0) | |
2787 th) | |
2788 (while (setq thread (pop stack)) | |
2789 (setq th (cdr thread)) | |
2790 (while (and th | |
2791 (not (eq (caar th) root))) | |
2792 (pop th)) | |
2793 (if th | |
2794 ;; We have found a loop. | |
2795 (let (ref-dep) | |
2796 (setcdr thread (delq (car th) (cdr thread))) | |
2797 (if (boundp (setq ref-dep (intern "none" | |
2798 gnus-newsgroup-dependencies))) | |
2799 (setcdr (symbol-value ref-dep) | |
2800 (nconc (cdr (symbol-value ref-dep)) | |
2801 (list (car th)))) | |
2802 (set ref-dep (list nil (car th)))) | |
2803 (setq infloop 1 | |
2804 stack nil)) | |
2805 ;; Push all the subthreads onto the stack. | |
2806 (push (cdr thread) stack))) | |
2807 infloop)) | |
2808 | |
2809 (defun gnus-make-threads () | |
2810 "Go through the dependency hashtb and find the roots. Return all threads." | |
2811 (let (threads) | |
2812 (while (catch 'infloop | |
2813 (mapatoms | |
2814 (lambda (refs) | |
2815 ;; Deal with self-referencing References loops. | |
2816 (when (and (car (symbol-value refs)) | |
2817 (not (zerop | |
2818 (apply | |
2819 '+ | |
2820 (mapcar | |
2821 (lambda (thread) | |
2822 (gnus-thread-loop-p | |
2823 (car (symbol-value refs)) thread)) | |
2824 (cdr (symbol-value refs))))))) | |
2825 (setq threads nil) | |
2826 (throw 'infloop t)) | |
2827 (unless (car (symbol-value refs)) | |
2828 ;; These threads do not refer back to any other articles, | |
2829 ;; so they're roots. | |
2830 (setq threads (append (cdr (symbol-value refs)) threads)))) | |
2831 gnus-newsgroup-dependencies))) | |
2832 threads)) | |
2833 | |
2834 (defun gnus-build-sparse-threads () | |
2835 (let ((headers gnus-newsgroup-headers) | |
2836 (deps gnus-newsgroup-dependencies) | |
2837 header references generation relations | |
2838 cthread subject child end pthread relation) | |
2839 ;; First we create an alist of generations/relations, where | |
2840 ;; generations is how much we trust the relation, and the relation | |
2841 ;; is parent/child. | |
2842 (gnus-message 7 "Making sparse threads...") | |
2843 (save-excursion | |
2844 (nnheader-set-temp-buffer " *gnus sparse threads*") | |
2845 (while (setq header (pop headers)) | |
2846 (when (and (setq references (mail-header-references header)) | |
2847 (not (string= references ""))) | |
2848 (insert references) | |
2849 (setq child (mail-header-id header) | |
2850 subject (mail-header-subject header)) | |
2851 (setq generation 0) | |
2852 (while (search-backward ">" nil t) | |
2853 (setq end (1+ (point))) | |
2854 (when (search-backward "<" nil t) | |
2855 (push (list (incf generation) | |
2856 child (setq child (buffer-substring (point) end)) | |
2857 subject) | |
2858 relations))) | |
2859 (push (list (1+ generation) child nil subject) relations) | |
2860 (erase-buffer))) | |
2861 (kill-buffer (current-buffer))) | |
2862 ;; Sort over trustworthiness. | |
2863 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2))))) | |
2864 (while (setq relation (pop relations)) | |
2865 (when (if (boundp (setq cthread (intern (cadr relation) deps))) | |
2866 (unless (car (symbol-value cthread)) | |
2867 ;; Make this article the parent of these threads. | |
2868 (setcar (symbol-value cthread) | |
2869 (vector gnus-reffed-article-number | |
2870 (cadddr relation) | |
2871 "" "" | |
2872 (cadr relation) | |
2873 (or (caddr relation) "") 0 0 ""))) | |
2874 (set cthread (list (vector gnus-reffed-article-number | |
2875 (cadddr relation) | |
2876 "" "" (cadr relation) | |
2877 (or (caddr relation) "") 0 0 "")))) | |
2878 (push gnus-reffed-article-number gnus-newsgroup-limit) | |
2879 (push gnus-reffed-article-number gnus-newsgroup-sparse) | |
2880 (push (cons gnus-reffed-article-number gnus-sparse-mark) | |
2881 gnus-newsgroup-reads) | |
2882 (decf gnus-reffed-article-number) | |
2883 ;; Make this new thread the child of its parent. | |
2884 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps))) | |
2885 (setcdr (symbol-value pthread) | |
2886 (nconc (cdr (symbol-value pthread)) | |
2887 (list (symbol-value cthread)))) | |
2888 (set pthread (list nil (symbol-value cthread)))))) | |
2889 (gnus-message 7 "Making sparse threads...done"))) | |
2890 | |
2891 (defun gnus-build-old-threads () | |
2892 ;; Look at all the articles that refer back to old articles, and | |
2893 ;; fetch the headers for the articles that aren't there. This will | |
2894 ;; build complete threads - if the roots haven't been expired by the | |
2895 ;; server, that is. | |
2896 (let (id heads) | |
2897 (mapatoms | |
2898 (lambda (refs) | |
2899 (when (not (car (symbol-value refs))) | |
2900 (setq heads (cdr (symbol-value refs))) | |
2901 (while heads | |
2902 (if (memq (mail-header-number (caar heads)) | |
2903 gnus-newsgroup-dormant) | |
2904 (setq heads (cdr heads)) | |
2905 (setq id (symbol-name refs)) | |
2906 (while (and (setq id (gnus-build-get-header id)) | |
2907 (not (car (gnus-gethash | |
2908 id gnus-newsgroup-dependencies))))) | |
2909 (setq heads nil))))) | |
2910 gnus-newsgroup-dependencies))) | |
2911 | |
2912 (defun gnus-build-get-header (id) | |
2913 ;; Look through the buffer of NOV lines and find the header to | |
2914 ;; ID. Enter this line into the dependencies hash table, and return | |
2915 ;; the id of the parent article (if any). | |
2916 (let ((deps gnus-newsgroup-dependencies) | |
2917 found header) | |
2918 (prog1 | |
2919 (save-excursion | |
2920 (set-buffer nntp-server-buffer) | |
2921 (let ((case-fold-search nil)) | |
2922 (goto-char (point-min)) | |
2923 (while (and (not found) | |
2924 (search-forward id nil t)) | |
2925 (beginning-of-line) | |
2926 (setq found (looking-at | |
2927 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s" | |
2928 (regexp-quote id)))) | |
2929 (or found (beginning-of-line 2))) | |
2930 (when found | |
2931 (beginning-of-line) | |
2932 (and | |
2933 (setq header (gnus-nov-parse-line | |
2934 (read (current-buffer)) deps)) | |
2935 (gnus-parent-id (mail-header-references header)))))) | |
2936 (when header | |
2937 (let ((number (mail-header-number header))) | |
2938 (push number gnus-newsgroup-limit) | |
2939 (push header gnus-newsgroup-headers) | |
2940 (if (memq number gnus-newsgroup-unselected) | |
2941 (progn | |
2942 (push number gnus-newsgroup-unreads) | |
2943 (setq gnus-newsgroup-unselected | |
2944 (delq number gnus-newsgroup-unselected))) | |
2945 (push number gnus-newsgroup-ancient))))))) | |
2946 | |
2947 (defun gnus-summary-update-article-line (article header) | |
2948 "Update the line for ARTICLE using HEADERS." | |
2949 (let* ((id (mail-header-id header)) | |
2950 (thread (gnus-id-to-thread id))) | |
2951 (unless thread | |
2952 (error "Article in no thread")) | |
2953 ;; Update the thread. | |
2954 (setcar thread header) | |
2955 (gnus-summary-goto-subject article) | |
2956 (let* ((datal (gnus-data-find-list article)) | |
2957 (data (car datal)) | |
2958 (length (when (cdr datal) | |
2959 (- (gnus-data-pos data) | |
2960 (gnus-data-pos (cadr datal))))) | |
2961 (buffer-read-only nil) | |
2962 (level (gnus-summary-thread-level))) | |
2963 (gnus-delete-line) | |
2964 (gnus-summary-insert-line | |
2965 header level nil (gnus-article-mark article) | |
2966 (memq article gnus-newsgroup-replied) | |
2967 (memq article gnus-newsgroup-expirable) | |
2968 ;; Only insert the Subject string when it's different | |
2969 ;; from the previous Subject string. | |
2970 (if (gnus-subject-equal | |
2971 (condition-case () | |
2972 (mail-header-subject | |
2973 (gnus-data-header | |
2974 (cadr | |
2975 (gnus-data-find-list | |
2976 article | |
2977 (gnus-data-list t))))) | |
2978 ;; Error on the side of excessive subjects. | |
2979 (error "")) | |
2980 (mail-header-subject header)) | |
2981 "" | |
2982 (mail-header-subject header)) | |
2983 nil (cdr (assq article gnus-newsgroup-scored)) | |
2984 (memq article gnus-newsgroup-processable)) | |
2985 (when length | |
2986 (gnus-data-update-list | |
2987 (cdr datal) (- length (- (gnus-data-pos data) (point)))))))) | |
2988 | |
2989 (defun gnus-summary-update-article (article &optional iheader) | |
2990 "Update ARTICLE in the summary buffer." | |
2991 (set-buffer gnus-summary-buffer) | |
2992 (let* ((header (or iheader (gnus-summary-article-header article))) | |
2993 (id (mail-header-id header)) | |
2994 (data (gnus-data-find article)) | |
2995 (thread (gnus-id-to-thread id)) | |
2996 (references (mail-header-references header)) | |
2997 (parent | |
2998 (gnus-id-to-thread | |
2999 (or (gnus-parent-id | |
3000 (when (and references | |
3001 (not (equal "" references))) | |
3002 references)) | |
3003 "none"))) | |
3004 (buffer-read-only nil) | |
3005 (old (car thread)) | |
3006 (number (mail-header-number header)) | |
3007 pos) | |
3008 (when thread | |
3009 ;; !!! Should this be in or not? | |
3010 (unless iheader | |
3011 (setcar thread nil)) | |
3012 (when parent | |
3013 (delq thread parent)) | |
3014 (if (gnus-summary-insert-subject id header iheader) | |
3015 ;; Set the (possibly) new article number in the data structure. | |
3016 (gnus-data-set-number data (gnus-id-to-article id)) | |
3017 (setcar thread old) | |
3018 nil)))) | |
3019 | |
3020 (defun gnus-rebuild-thread (id) | |
3021 "Rebuild the thread containing ID." | |
3022 (let ((buffer-read-only nil) | |
3023 old-pos current thread data) | |
3024 (if (not gnus-show-threads) | |
3025 (setq thread (list (car (gnus-id-to-thread id)))) | |
3026 ;; Get the thread this article is part of. | |
3027 (setq thread (gnus-remove-thread id))) | |
3028 (setq old-pos (gnus-point-at-bol)) | |
3029 (setq current (save-excursion | |
3030 (and (zerop (forward-line -1)) | |
3031 (gnus-summary-article-number)))) | |
3032 ;; If this is a gathered thread, we have to go some re-gathering. | |
3033 (when (stringp (car thread)) | |
3034 (let ((subject (car thread)) | |
3035 roots thr) | |
3036 (setq thread (cdr thread)) | |
3037 (while thread | |
3038 (unless (memq (setq thr (gnus-id-to-thread | |
3039 (gnus-root-id | |
3040 (mail-header-id (caar thread))))) | |
3041 roots) | |
3042 (push thr roots)) | |
3043 (setq thread (cdr thread))) | |
3044 ;; We now have all (unique) roots. | |
3045 (if (= (length roots) 1) | |
3046 ;; All the loose roots are now one solid root. | |
3047 (setq thread (car roots)) | |
3048 (setq thread (cons subject (gnus-sort-threads roots)))))) | |
3049 (let (threads) | |
3050 ;; We then insert this thread into the summary buffer. | |
3051 (let (gnus-newsgroup-data gnus-newsgroup-threads) | |
3052 (if gnus-show-threads | |
3053 (gnus-summary-prepare-threads (gnus-cut-threads (list thread))) | |
3054 (gnus-summary-prepare-unthreaded thread)) | |
3055 (setq data (nreverse gnus-newsgroup-data)) | |
3056 (setq threads gnus-newsgroup-threads)) | |
3057 ;; We splice the new data into the data structure. | |
3058 (gnus-data-enter-list current data (- (point) old-pos)) | |
3059 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads))))) | |
3060 | |
3061 (defun gnus-number-to-header (number) | |
3062 "Return the header for article NUMBER." | |
3063 (let ((headers gnus-newsgroup-headers)) | |
3064 (while (and headers | |
3065 (not (= number (mail-header-number (car headers))))) | |
3066 (pop headers)) | |
3067 (when headers | |
3068 (car headers)))) | |
3069 | |
3070 (defun gnus-parent-headers (headers &optional generation) | |
3071 "Return the headers of the GENERATIONeth parent of HEADERS." | |
3072 (unless generation | |
3073 (setq generation 1)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3074 (let ((parent t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3075 references) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3076 (while (and parent headers (not (zerop generation))) |
17493 | 3077 (setq references (mail-header-references headers)) |
3078 (when (and references | |
3079 (setq parent (gnus-parent-id references)) | |
3080 (setq headers (car (gnus-id-to-thread parent)))) | |
3081 (decf generation))) | |
3082 headers)) | |
3083 | |
3084 (defun gnus-id-to-thread (id) | |
3085 "Return the (sub-)thread where ID appears." | |
3086 (gnus-gethash id gnus-newsgroup-dependencies)) | |
3087 | |
3088 (defun gnus-id-to-article (id) | |
3089 "Return the article number of ID." | |
3090 (let ((thread (gnus-id-to-thread id))) | |
3091 (when (and thread | |
3092 (car thread)) | |
3093 (mail-header-number (car thread))))) | |
3094 | |
3095 (defun gnus-id-to-header (id) | |
3096 "Return the article headers of ID." | |
3097 (car (gnus-id-to-thread id))) | |
3098 | |
3099 (defun gnus-article-displayed-root-p (article) | |
3100 "Say whether ARTICLE is a root(ish) article." | |
3101 (let ((level (gnus-summary-thread-level article)) | |
3102 (refs (mail-header-references (gnus-summary-article-header article))) | |
3103 particle) | |
3104 (cond | |
3105 ((null level) nil) | |
3106 ((zerop level) t) | |
3107 ((null refs) t) | |
3108 ((null (gnus-parent-id refs)) t) | |
3109 ((and (= 1 level) | |
3110 (null (setq particle (gnus-id-to-article | |
3111 (gnus-parent-id refs)))) | |
3112 (null (gnus-summary-thread-level particle))))))) | |
3113 | |
3114 (defun gnus-root-id (id) | |
3115 "Return the id of the root of the thread where ID appears." | |
3116 (let (last-id prev) | |
3117 (while (and id (setq prev (car (gnus-gethash | |
3118 id gnus-newsgroup-dependencies)))) | |
3119 (setq last-id id | |
3120 id (gnus-parent-id (mail-header-references prev)))) | |
3121 last-id)) | |
3122 | |
3123 (defun gnus-remove-thread (id &optional dont-remove) | |
3124 "Remove the thread that has ID in it." | |
3125 (let ((dep gnus-newsgroup-dependencies) | |
3126 headers thread last-id) | |
3127 ;; First go up in this thread until we find the root. | |
3128 (setq last-id (gnus-root-id id)) | |
3129 (setq headers (list (car (gnus-id-to-thread last-id)) | |
3130 (caadr (gnus-id-to-thread last-id)))) | |
3131 ;; We have now found the real root of this thread. It might have | |
3132 ;; been gathered into some loose thread, so we have to search | |
3133 ;; through the threads to find the thread we wanted. | |
3134 (let ((threads gnus-newsgroup-threads) | |
3135 sub) | |
3136 (while threads | |
3137 (setq sub (car threads)) | |
3138 (if (stringp (car sub)) | |
3139 ;; This is a gathered thread, so we look at the roots | |
3140 ;; below it to find whether this article is in this | |
3141 ;; gathered root. | |
3142 (progn | |
3143 (setq sub (cdr sub)) | |
3144 (while sub | |
3145 (when (member (caar sub) headers) | |
3146 (setq thread (car threads) | |
3147 threads nil | |
3148 sub nil)) | |
3149 (setq sub (cdr sub)))) | |
3150 ;; It's an ordinary thread, so we check it. | |
3151 (when (eq (car sub) (car headers)) | |
3152 (setq thread sub | |
3153 threads nil))) | |
3154 (setq threads (cdr threads))) | |
3155 ;; If this article is in no thread, then it's a root. | |
3156 (if thread | |
3157 (unless dont-remove | |
3158 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads))) | |
3159 (setq thread (gnus-gethash last-id dep))) | |
3160 (when thread | |
3161 (prog1 | |
3162 thread ; We return this thread. | |
3163 (unless dont-remove | |
3164 (if (stringp (car thread)) | |
3165 (progn | |
3166 ;; If we use dummy roots, then we have to remove the | |
3167 ;; dummy root as well. | |
3168 (when (eq gnus-summary-make-false-root 'dummy) | |
3169 (gnus-delete-line) | |
3170 (gnus-data-compute-positions)) | |
3171 (setq thread (cdr thread)) | |
3172 (while thread | |
3173 (gnus-remove-thread-1 (car thread)) | |
3174 (setq thread (cdr thread)))) | |
3175 (gnus-remove-thread-1 thread)))))))) | |
3176 | |
3177 (defun gnus-remove-thread-1 (thread) | |
3178 "Remove the thread THREAD recursively." | |
3179 (let ((number (mail-header-number (pop thread))) | |
3180 d) | |
3181 (setq thread (reverse thread)) | |
3182 (while thread | |
3183 (gnus-remove-thread-1 (pop thread))) | |
3184 (when (setq d (gnus-data-find number)) | |
3185 (goto-char (gnus-data-pos d)) | |
3186 (gnus-data-remove | |
3187 number | |
3188 (- (gnus-point-at-bol) | |
3189 (prog1 | |
3190 (1+ (gnus-point-at-eol)) | |
3191 (gnus-delete-line))))))) | |
3192 | |
3193 (defun gnus-sort-threads (threads) | |
3194 "Sort THREADS." | |
3195 (if (not gnus-thread-sort-functions) | |
3196 threads | |
3197 (gnus-message 7 "Sorting threads...") | |
3198 (prog1 | |
3199 (sort threads (gnus-make-sort-function gnus-thread-sort-functions)) | |
3200 (gnus-message 7 "Sorting threads...done")))) | |
3201 | |
3202 (defun gnus-sort-articles (articles) | |
3203 "Sort ARTICLES." | |
3204 (when gnus-article-sort-functions | |
3205 (gnus-message 7 "Sorting articles...") | |
3206 (prog1 | |
3207 (setq gnus-newsgroup-headers | |
3208 (sort articles (gnus-make-sort-function | |
3209 gnus-article-sort-functions))) | |
3210 (gnus-message 7 "Sorting articles...done")))) | |
3211 | |
3212 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>. | |
3213 (defmacro gnus-thread-header (thread) | |
3214 ;; Return header of first article in THREAD. | |
3215 ;; Note that THREAD must never, ever be anything else than a variable - | |
3216 ;; using some other form will lead to serious barfage. | |
3217 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread))) | |
3218 ;; (8% speedup to gnus-summary-prepare, just for fun :-) | |
3219 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ; | |
3220 (vector thread) 2)) | |
3221 | |
3222 (defsubst gnus-article-sort-by-number (h1 h2) | |
3223 "Sort articles by article number." | |
3224 (< (mail-header-number h1) | |
3225 (mail-header-number h2))) | |
3226 | |
3227 (defun gnus-thread-sort-by-number (h1 h2) | |
3228 "Sort threads by root article number." | |
3229 (gnus-article-sort-by-number | |
3230 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3231 | |
3232 (defsubst gnus-article-sort-by-lines (h1 h2) | |
3233 "Sort articles by article Lines header." | |
3234 (< (mail-header-lines h1) | |
3235 (mail-header-lines h2))) | |
3236 | |
3237 (defun gnus-thread-sort-by-lines (h1 h2) | |
3238 "Sort threads by root article Lines header." | |
3239 (gnus-article-sort-by-lines | |
3240 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3241 | |
3242 (defsubst gnus-article-sort-by-author (h1 h2) | |
3243 "Sort articles by root author." | |
3244 (string-lessp | |
3245 (let ((extract (funcall | |
3246 gnus-extract-address-components | |
3247 (mail-header-from h1)))) | |
3248 (or (car extract) (cadr extract) "")) | |
3249 (let ((extract (funcall | |
3250 gnus-extract-address-components | |
3251 (mail-header-from h2)))) | |
3252 (or (car extract) (cadr extract) "")))) | |
3253 | |
3254 (defun gnus-thread-sort-by-author (h1 h2) | |
3255 "Sort threads by root author." | |
3256 (gnus-article-sort-by-author | |
3257 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3258 | |
3259 (defsubst gnus-article-sort-by-subject (h1 h2) | |
3260 "Sort articles by root subject." | |
3261 (string-lessp | |
3262 (downcase (gnus-simplify-subject-re (mail-header-subject h1))) | |
3263 (downcase (gnus-simplify-subject-re (mail-header-subject h2))))) | |
3264 | |
3265 (defun gnus-thread-sort-by-subject (h1 h2) | |
3266 "Sort threads by root subject." | |
3267 (gnus-article-sort-by-subject | |
3268 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3269 | |
3270 (defsubst gnus-article-sort-by-date (h1 h2) | |
3271 "Sort articles by root article date." | |
3272 (gnus-time-less | |
3273 (gnus-date-get-time (mail-header-date h1)) | |
3274 (gnus-date-get-time (mail-header-date h2)))) | |
3275 | |
3276 (defun gnus-thread-sort-by-date (h1 h2) | |
3277 "Sort threads by root article date." | |
3278 (gnus-article-sort-by-date | |
3279 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3280 | |
3281 (defsubst gnus-article-sort-by-score (h1 h2) | |
3282 "Sort articles by root article score. | |
3283 Unscored articles will be counted as having a score of zero." | |
3284 (> (or (cdr (assq (mail-header-number h1) | |
3285 gnus-newsgroup-scored)) | |
3286 gnus-summary-default-score 0) | |
3287 (or (cdr (assq (mail-header-number h2) | |
3288 gnus-newsgroup-scored)) | |
3289 gnus-summary-default-score 0))) | |
3290 | |
3291 (defun gnus-thread-sort-by-score (h1 h2) | |
3292 "Sort threads by root article score." | |
3293 (gnus-article-sort-by-score | |
3294 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3295 | |
3296 (defun gnus-thread-sort-by-total-score (h1 h2) | |
3297 "Sort threads by the sum of all scores in the thread. | |
3298 Unscored articles will be counted as having a score of zero." | |
3299 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2))) | |
3300 | |
3301 (defun gnus-thread-total-score (thread) | |
3302 ;; This function find the total score of THREAD. | |
3303 (cond ((null thread) | |
3304 0) | |
3305 ((consp thread) | |
3306 (if (stringp (car thread)) | |
3307 (apply gnus-thread-score-function 0 | |
3308 (mapcar 'gnus-thread-total-score-1 (cdr thread))) | |
3309 (gnus-thread-total-score-1 thread))) | |
3310 (t | |
3311 (gnus-thread-total-score-1 (list thread))))) | |
3312 | |
3313 (defun gnus-thread-total-score-1 (root) | |
3314 ;; This function find the total score of the thread below ROOT. | |
3315 (setq root (car root)) | |
3316 (apply gnus-thread-score-function | |
3317 (or (append | |
3318 (mapcar 'gnus-thread-total-score | |
3319 (cdr (gnus-gethash (mail-header-id root) | |
3320 gnus-newsgroup-dependencies))) | |
3321 (when (> (mail-header-number root) 0) | |
3322 (list (or (cdr (assq (mail-header-number root) | |
3323 gnus-newsgroup-scored)) | |
3324 gnus-summary-default-score 0)))) | |
3325 (list gnus-summary-default-score) | |
3326 '(0)))) | |
3327 | |
3328 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>. | |
3329 (defvar gnus-tmp-prev-subject nil) | |
3330 (defvar gnus-tmp-false-parent nil) | |
3331 (defvar gnus-tmp-root-expunged nil) | |
3332 (defvar gnus-tmp-dummy-line nil) | |
3333 | |
3334 (defun gnus-summary-prepare-threads (threads) | |
3335 "Prepare summary buffer from THREADS and indentation LEVEL. | |
3336 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])' | |
3337 or a straight list of headers." | |
3338 (gnus-message 7 "Generating summary...") | |
3339 | |
3340 (setq gnus-newsgroup-threads threads) | |
3341 (beginning-of-line) | |
3342 | |
3343 (let ((gnus-tmp-level 0) | |
3344 (default-score (or gnus-summary-default-score 0)) | |
3345 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight)) | |
3346 thread number subject stack state gnus-tmp-gathered beg-match | |
3347 new-roots gnus-tmp-new-adopts thread-end | |
3348 gnus-tmp-header gnus-tmp-unread | |
3349 gnus-tmp-replied gnus-tmp-subject-or-nil | |
3350 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score | |
3351 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name | |
3352 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket) | |
3353 | |
3354 (setq gnus-tmp-prev-subject nil) | |
3355 | |
3356 (if (vectorp (car threads)) | |
3357 ;; If this is a straight (sic) list of headers, then a | |
3358 ;; threaded summary display isn't required, so we just create | |
3359 ;; an unthreaded one. | |
3360 (gnus-summary-prepare-unthreaded threads) | |
3361 | |
3362 ;; Do the threaded display. | |
3363 | |
3364 (while (or threads stack gnus-tmp-new-adopts new-roots) | |
3365 | |
3366 (if (and (= gnus-tmp-level 0) | |
3367 (not (setq gnus-tmp-dummy-line nil)) | |
3368 (or (not stack) | |
3369 (= (caar stack) 0)) | |
3370 (not gnus-tmp-false-parent) | |
3371 (or gnus-tmp-new-adopts new-roots)) | |
3372 (if gnus-tmp-new-adopts | |
3373 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1) | |
3374 thread (list (car gnus-tmp-new-adopts)) | |
3375 gnus-tmp-header (caar thread) | |
3376 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts)) | |
3377 (when new-roots | |
3378 (setq thread (list (car new-roots)) | |
3379 gnus-tmp-header (caar thread) | |
3380 new-roots (cdr new-roots)))) | |
3381 | |
3382 (if threads | |
3383 ;; If there are some threads, we do them before the | |
3384 ;; threads on the stack. | |
3385 (setq thread threads | |
3386 gnus-tmp-header (caar thread)) | |
3387 ;; There were no current threads, so we pop something off | |
3388 ;; the stack. | |
3389 (setq state (car stack) | |
3390 gnus-tmp-level (car state) | |
3391 thread (cdr state) | |
3392 stack (cdr stack) | |
3393 gnus-tmp-header (caar thread)))) | |
3394 | |
3395 (setq gnus-tmp-false-parent nil) | |
3396 (setq gnus-tmp-root-expunged nil) | |
3397 (setq thread-end nil) | |
3398 | |
3399 (if (stringp gnus-tmp-header) | |
3400 ;; The header is a dummy root. | |
3401 (cond | |
3402 ((eq gnus-summary-make-false-root 'adopt) | |
3403 ;; We let the first article adopt the rest. | |
3404 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts | |
3405 (cddar thread))) | |
3406 (setq gnus-tmp-gathered | |
3407 (nconc (mapcar | |
3408 (lambda (h) (mail-header-number (car h))) | |
3409 (cddar thread)) | |
3410 gnus-tmp-gathered)) | |
3411 (setq thread (cons (list (caar thread) | |
3412 (cadar thread)) | |
3413 (cdr thread))) | |
3414 (setq gnus-tmp-level -1 | |
3415 gnus-tmp-false-parent t)) | |
3416 ((eq gnus-summary-make-false-root 'empty) | |
3417 ;; We print adopted articles with empty subject fields. | |
3418 (setq gnus-tmp-gathered | |
3419 (nconc (mapcar | |
3420 (lambda (h) (mail-header-number (car h))) | |
3421 (cddar thread)) | |
3422 gnus-tmp-gathered)) | |
3423 (setq gnus-tmp-level -1)) | |
3424 ((eq gnus-summary-make-false-root 'dummy) | |
3425 ;; We remember that we probably want to output a dummy | |
3426 ;; root. | |
3427 (setq gnus-tmp-dummy-line gnus-tmp-header) | |
3428 (setq gnus-tmp-prev-subject gnus-tmp-header)) | |
3429 (t | |
3430 ;; We do not make a root for the gathered | |
3431 ;; sub-threads at all. | |
3432 (setq gnus-tmp-level -1))) | |
3433 | |
3434 (setq number (mail-header-number gnus-tmp-header) | |
3435 subject (mail-header-subject gnus-tmp-header)) | |
3436 | |
3437 (cond | |
3438 ;; If the thread has changed subject, we might want to make | |
3439 ;; this subthread into a root. | |
3440 ((and (null gnus-thread-ignore-subject) | |
3441 (not (zerop gnus-tmp-level)) | |
3442 gnus-tmp-prev-subject | |
3443 (not (inline | |
3444 (gnus-subject-equal gnus-tmp-prev-subject subject)))) | |
3445 (setq new-roots (nconc new-roots (list (car thread))) | |
3446 thread-end t | |
3447 gnus-tmp-header nil)) | |
3448 ;; If the article lies outside the current limit, | |
3449 ;; then we do not display it. | |
3450 ((not (memq number gnus-newsgroup-limit)) | |
3451 (setq gnus-tmp-gathered | |
3452 (nconc (mapcar | |
3453 (lambda (h) (mail-header-number (car h))) | |
3454 (cdar thread)) | |
3455 gnus-tmp-gathered)) | |
3456 (setq gnus-tmp-new-adopts (if (cdar thread) | |
3457 (append gnus-tmp-new-adopts | |
3458 (cdar thread)) | |
3459 gnus-tmp-new-adopts) | |
3460 thread-end t | |
3461 gnus-tmp-header nil) | |
3462 (when (zerop gnus-tmp-level) | |
3463 (setq gnus-tmp-root-expunged t))) | |
3464 ;; Perhaps this article is to be marked as read? | |
3465 ((and gnus-summary-mark-below | |
3466 (< (or (cdr (assq number gnus-newsgroup-scored)) | |
3467 default-score) | |
3468 gnus-summary-mark-below) | |
3469 ;; Don't touch sparse articles. | |
3470 (not (gnus-summary-article-sparse-p number)) | |
3471 (not (gnus-summary-article-ancient-p number))) | |
3472 (setq gnus-newsgroup-unreads | |
3473 (delq number gnus-newsgroup-unreads)) | |
3474 (if gnus-newsgroup-auto-expire | |
3475 (push number gnus-newsgroup-expirable) | |
3476 (push (cons number gnus-low-score-mark) | |
3477 gnus-newsgroup-reads)))) | |
3478 | |
3479 (when gnus-tmp-header | |
3480 ;; We may have an old dummy line to output before this | |
3481 ;; article. | |
3482 (when gnus-tmp-dummy-line | |
3483 (gnus-summary-insert-dummy-line | |
3484 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header)) | |
3485 (setq gnus-tmp-dummy-line nil)) | |
3486 | |
3487 ;; Compute the mark. | |
3488 (setq gnus-tmp-unread (gnus-article-mark number)) | |
3489 | |
3490 (push (gnus-data-make number gnus-tmp-unread (1+ (point)) | |
3491 gnus-tmp-header gnus-tmp-level) | |
3492 gnus-newsgroup-data) | |
3493 | |
3494 ;; Actually insert the line. | |
3495 (setq | |
3496 gnus-tmp-subject-or-nil | |
3497 (cond | |
3498 ((and gnus-thread-ignore-subject | |
3499 gnus-tmp-prev-subject | |
3500 (not (inline (gnus-subject-equal | |
3501 gnus-tmp-prev-subject subject)))) | |
3502 subject) | |
3503 ((zerop gnus-tmp-level) | |
3504 (if (and (eq gnus-summary-make-false-root 'empty) | |
3505 (memq number gnus-tmp-gathered) | |
3506 gnus-tmp-prev-subject | |
3507 (inline (gnus-subject-equal | |
3508 gnus-tmp-prev-subject subject))) | |
3509 gnus-summary-same-subject | |
3510 subject)) | |
3511 (t gnus-summary-same-subject))) | |
3512 (if (and (eq gnus-summary-make-false-root 'adopt) | |
3513 (= gnus-tmp-level 1) | |
3514 (memq number gnus-tmp-gathered)) | |
3515 (setq gnus-tmp-opening-bracket ?\< | |
3516 gnus-tmp-closing-bracket ?\>) | |
3517 (setq gnus-tmp-opening-bracket ?\[ | |
3518 gnus-tmp-closing-bracket ?\])) | |
3519 (setq | |
3520 gnus-tmp-indentation | |
3521 (aref gnus-thread-indent-array gnus-tmp-level) | |
3522 gnus-tmp-lines (mail-header-lines gnus-tmp-header) | |
3523 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored)) | |
3524 gnus-summary-default-score 0) | |
3525 gnus-tmp-score-char | |
3526 (if (or (null gnus-summary-default-score) | |
3527 (<= (abs (- gnus-tmp-score gnus-summary-default-score)) | |
3528 gnus-summary-zcore-fuzz)) | |
3529 ? | |
3530 (if (< gnus-tmp-score gnus-summary-default-score) | |
3531 gnus-score-below-mark gnus-score-over-mark)) | |
3532 gnus-tmp-replied | |
3533 (cond ((memq number gnus-newsgroup-processable) | |
3534 gnus-process-mark) | |
3535 ((memq number gnus-newsgroup-cached) | |
3536 gnus-cached-mark) | |
3537 ((memq number gnus-newsgroup-replied) | |
3538 gnus-replied-mark) | |
3539 ((memq number gnus-newsgroup-saved) | |
3540 gnus-saved-mark) | |
3541 (t gnus-unread-mark)) | |
3542 gnus-tmp-from (mail-header-from gnus-tmp-header) | |
3543 gnus-tmp-name | |
3544 (cond | |
3545 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
3546 (setq beg-match (match-beginning 0)) | |
3547 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
3548 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
3549 (1- (match-end 0)))) | |
3550 (substring gnus-tmp-from 0 beg-match))) | |
3551 ((string-match "(.+)" gnus-tmp-from) | |
3552 (substring gnus-tmp-from | |
3553 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
3554 (t gnus-tmp-from))) | |
3555 (when (string= gnus-tmp-name "") | |
3556 (setq gnus-tmp-name gnus-tmp-from)) | |
3557 (unless (numberp gnus-tmp-lines) | |
3558 (setq gnus-tmp-lines 0)) | |
3559 (gnus-put-text-property | |
3560 (point) | |
3561 (progn (eval gnus-summary-line-format-spec) (point)) | |
3562 'gnus-number number) | |
3563 (when gnus-visual-p | |
3564 (forward-line -1) | |
3565 (run-hooks 'gnus-summary-update-hook) | |
3566 (forward-line 1)) | |
3567 | |
3568 (setq gnus-tmp-prev-subject subject))) | |
3569 | |
3570 (when (nth 1 thread) | |
3571 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack)) | |
3572 (incf gnus-tmp-level) | |
3573 (setq threads (if thread-end nil (cdar thread))) | |
3574 (unless threads | |
3575 (setq gnus-tmp-level 0))))) | |
3576 (gnus-message 7 "Generating summary...done")) | |
3577 | |
3578 (defun gnus-summary-prepare-unthreaded (headers) | |
3579 "Generate an unthreaded summary buffer based on HEADERS." | |
3580 (let (header number mark) | |
3581 | |
3582 (beginning-of-line) | |
3583 | |
3584 (while headers | |
3585 ;; We may have to root out some bad articles... | |
3586 (when (memq (setq number (mail-header-number | |
3587 (setq header (pop headers)))) | |
3588 gnus-newsgroup-limit) | |
3589 ;; Mark article as read when it has a low score. | |
3590 (when (and gnus-summary-mark-below | |
3591 (< (or (cdr (assq number gnus-newsgroup-scored)) | |
3592 gnus-summary-default-score 0) | |
3593 gnus-summary-mark-below) | |
3594 (not (gnus-summary-article-ancient-p number))) | |
3595 (setq gnus-newsgroup-unreads | |
3596 (delq number gnus-newsgroup-unreads)) | |
3597 (if gnus-newsgroup-auto-expire | |
3598 (push number gnus-newsgroup-expirable) | |
3599 (push (cons number gnus-low-score-mark) | |
3600 gnus-newsgroup-reads))) | |
3601 | |
3602 (setq mark (gnus-article-mark number)) | |
3603 (push (gnus-data-make number mark (1+ (point)) header 0) | |
3604 gnus-newsgroup-data) | |
3605 (gnus-summary-insert-line | |
3606 header 0 number | |
3607 mark (memq number gnus-newsgroup-replied) | |
3608 (memq number gnus-newsgroup-expirable) | |
3609 (mail-header-subject header) nil | |
3610 (cdr (assq number gnus-newsgroup-scored)) | |
3611 (memq number gnus-newsgroup-processable)))))) | |
3612 | |
3613 (defun gnus-select-newsgroup (group &optional read-all) | |
3614 "Select newsgroup GROUP. | |
3615 If READ-ALL is non-nil, all articles in the group are selected." | |
3616 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb)) | |
3617 ;;!!! Dirty hack; should be removed. | |
3618 (gnus-summary-ignore-duplicates | |
3619 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual) | |
3620 t | |
3621 gnus-summary-ignore-duplicates)) | |
3622 (info (nth 2 entry)) | |
3623 articles fetched-articles cached) | |
3624 | |
3625 (unless (gnus-check-server | |
3626 (setq gnus-current-select-method | |
3627 (gnus-find-method-for-group group))) | |
3628 (error "Couldn't open server")) | |
3629 | |
3630 (or (and entry (not (eq (car entry) t))) ; Either it's active... | |
3631 (gnus-activate-group group) ; Or we can activate it... | |
3632 (progn ; Or we bug out. | |
3633 (when (equal major-mode 'gnus-summary-mode) | |
3634 (kill-buffer (current-buffer))) | |
3635 (error "Couldn't request group %s: %s" | |
3636 group (gnus-status-message group)))) | |
3637 | |
3638 (unless (gnus-request-group group t) | |
3639 (when (equal major-mode 'gnus-summary-mode) | |
3640 (kill-buffer (current-buffer))) | |
3641 (error "Couldn't request group %s: %s" | |
3642 group (gnus-status-message group))) | |
3643 | |
3644 (setq gnus-newsgroup-name group) | |
3645 (setq gnus-newsgroup-unselected nil) | |
3646 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group)) | |
3647 | |
3648 ;; Adjust and set lists of article marks. | |
3649 (when info | |
3650 (gnus-adjust-marked-articles info)) | |
3651 | |
3652 ;; Kludge to avoid having cached articles nixed out in virtual groups. | |
3653 (when (gnus-virtual-group-p group) | |
3654 (setq cached gnus-newsgroup-cached)) | |
3655 | |
3656 (setq gnus-newsgroup-unreads | |
3657 (gnus-set-difference | |
3658 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked) | |
3659 gnus-newsgroup-dormant)) | |
3660 | |
3661 (setq gnus-newsgroup-processable nil) | |
3662 | |
3663 (gnus-update-read-articles group gnus-newsgroup-unreads) | |
3664 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
3665 (gnus-group-update-group group)) | |
3666 | |
3667 (setq articles (gnus-articles-to-read group read-all)) | |
3668 | |
3669 (cond | |
3670 ((null articles) | |
3671 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display") | |
3672 'quit) | |
3673 ((eq articles 0) nil) | |
3674 (t | |
3675 ;; Init the dependencies hash table. | |
3676 (setq gnus-newsgroup-dependencies | |
3677 (gnus-make-hashtable (length articles))) | |
3678 ;; Retrieve the headers and read them in. | |
3679 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name) | |
3680 (setq gnus-newsgroup-headers | |
3681 (if (eq 'nov | |
3682 (setq gnus-headers-retrieved-by | |
3683 (gnus-retrieve-headers | |
3684 articles gnus-newsgroup-name | |
3685 ;; We might want to fetch old headers, but | |
3686 ;; not if there is only 1 article. | |
3687 (and gnus-fetch-old-headers | |
3688 (or (and | |
3689 (not (eq gnus-fetch-old-headers 'some)) | |
3690 (not (numberp gnus-fetch-old-headers))) | |
3691 (> (length articles) 1)))))) | |
3692 (gnus-get-newsgroup-headers-xover | |
3693 articles nil nil gnus-newsgroup-name t) | |
3694 (gnus-get-newsgroup-headers))) | |
3695 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name) | |
3696 | |
3697 ;; Kludge to avoid having cached articles nixed out in virtual groups. | |
3698 (when cached | |
3699 (setq gnus-newsgroup-cached cached)) | |
3700 | |
3701 ;; Suppress duplicates? | |
3702 (when gnus-suppress-duplicates | |
3703 (gnus-dup-suppress-articles)) | |
3704 | |
3705 ;; Set the initial limit. | |
3706 (setq gnus-newsgroup-limit (copy-sequence articles)) | |
3707 ;; Remove canceled articles from the list of unread articles. | |
3708 (setq gnus-newsgroup-unreads | |
3709 (gnus-set-sorted-intersection | |
3710 gnus-newsgroup-unreads | |
3711 (setq fetched-articles | |
3712 (mapcar (lambda (headers) (mail-header-number headers)) | |
3713 gnus-newsgroup-headers)))) | |
3714 ;; Removed marked articles that do not exist. | |
3715 (gnus-update-missing-marks | |
3716 (gnus-sorted-complement fetched-articles articles)) | |
3717 ;; We might want to build some more threads first. | |
3718 (and gnus-fetch-old-headers | |
3719 (eq gnus-headers-retrieved-by 'nov) | |
3720 (gnus-build-old-threads)) | |
3721 ;; Check whether auto-expire is to be done in this group. | |
3722 (setq gnus-newsgroup-auto-expire | |
3723 (gnus-group-auto-expirable-p group)) | |
3724 ;; Set up the article buffer now, if necessary. | |
3725 (unless gnus-single-article-buffer | |
3726 (gnus-article-setup-buffer)) | |
3727 ;; First and last article in this newsgroup. | |
3728 (when gnus-newsgroup-headers | |
3729 (setq gnus-newsgroup-begin | |
3730 (mail-header-number (car gnus-newsgroup-headers)) | |
3731 gnus-newsgroup-end | |
3732 (mail-header-number | |
3733 (gnus-last-element gnus-newsgroup-headers)))) | |
3734 ;; GROUP is successfully selected. | |
3735 (or gnus-newsgroup-headers t))))) | |
3736 | |
3737 (defun gnus-articles-to-read (group &optional read-all) | |
3738 ;; Find out what articles the user wants to read. | |
3739 (let* ((articles | |
3740 ;; Select all articles if `read-all' is non-nil, or if there | |
3741 ;; are no unread articles. | |
3742 (if (or read-all | |
3743 (and (zerop (length gnus-newsgroup-marked)) | |
3744 (zerop (length gnus-newsgroup-unreads))) | |
3745 (eq (gnus-group-find-parameter group 'display) | |
3746 'all)) | |
3747 (gnus-uncompress-range (gnus-active group)) | |
3748 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked | |
3749 (copy-sequence gnus-newsgroup-unreads)) | |
3750 '<))) | |
3751 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles)) | |
3752 (scored (length scored-list)) | |
3753 (number (length articles)) | |
3754 (marked (+ (length gnus-newsgroup-marked) | |
3755 (length gnus-newsgroup-dormant))) | |
3756 (select | |
3757 (cond | |
3758 ((numberp read-all) | |
3759 read-all) | |
3760 (t | |
3761 (condition-case () | |
3762 (cond | |
3763 ((and (or (<= scored marked) (= scored number)) | |
3764 (numberp gnus-large-newsgroup) | |
3765 (> number gnus-large-newsgroup)) | |
3766 (let ((input | |
3767 (read-string | |
3768 (format | |
3769 "How many articles from %s (default %d): " | |
3770 (gnus-limit-string gnus-newsgroup-name 35) | |
3771 number)))) | |
3772 (if (string-match "^[ \t]*$" input) number input))) | |
3773 ((and (> scored marked) (< scored number) | |
3774 (> (- scored number) 20)) | |
3775 (let ((input | |
3776 (read-string | |
3777 (format "%s %s (%d scored, %d total): " | |
3778 "How many articles from" | |
3779 group scored number)))) | |
3780 (if (string-match "^[ \t]*$" input) | |
3781 number input))) | |
3782 (t number)) | |
3783 (quit nil)))))) | |
3784 (setq select (if (stringp select) (string-to-number select) select)) | |
3785 (if (or (null select) (zerop select)) | |
3786 select | |
3787 (if (and (not (zerop scored)) (<= (abs select) scored)) | |
3788 (progn | |
3789 (setq articles (sort scored-list '<)) | |
3790 (setq number (length articles))) | |
3791 (setq articles (copy-sequence articles))) | |
3792 | |
3793 (when (< (abs select) number) | |
3794 (if (< select 0) | |
3795 ;; Select the N oldest articles. | |
3796 (setcdr (nthcdr (1- (abs select)) articles) nil) | |
3797 ;; Select the N most recent articles. | |
3798 (setq articles (nthcdr (- number select) articles)))) | |
3799 (setq gnus-newsgroup-unselected | |
3800 (gnus-sorted-intersection | |
3801 gnus-newsgroup-unreads | |
3802 (gnus-sorted-complement gnus-newsgroup-unreads articles))) | |
3803 articles))) | |
3804 | |
3805 (defun gnus-killed-articles (killed articles) | |
3806 (let (out) | |
3807 (while articles | |
3808 (when (inline (gnus-member-of-range (car articles) killed)) | |
3809 (push (car articles) out)) | |
3810 (setq articles (cdr articles))) | |
3811 out)) | |
3812 | |
3813 (defun gnus-uncompress-marks (marks) | |
3814 "Uncompress the mark ranges in MARKS." | |
3815 (let ((uncompressed '(score bookmark)) | |
3816 out) | |
3817 (while marks | |
3818 (if (memq (caar marks) uncompressed) | |
3819 (push (car marks) out) | |
3820 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out)) | |
3821 (setq marks (cdr marks))) | |
3822 out)) | |
3823 | |
3824 (defun gnus-adjust-marked-articles (info) | |
3825 "Set all article lists and remove all marks that are no longer legal." | |
3826 (let* ((marked-lists (gnus-info-marks info)) | |
3827 (active (gnus-active (gnus-info-group info))) | |
3828 (min (car active)) | |
3829 (max (cdr active)) | |
3830 (types gnus-article-mark-lists) | |
3831 (uncompressed '(score bookmark killed)) | |
3832 marks var articles article mark) | |
3833 | |
3834 (while marked-lists | |
3835 (setq marks (pop marked-lists)) | |
3836 (set (setq var (intern (format "gnus-newsgroup-%s" | |
3837 (car (rassq (setq mark (car marks)) | |
3838 types))))) | |
3839 (if (memq (car marks) uncompressed) (cdr marks) | |
3840 (gnus-uncompress-range (cdr marks)))) | |
3841 | |
3842 (setq articles (symbol-value var)) | |
3843 | |
3844 ;; All articles have to be subsets of the active articles. | |
3845 (cond | |
3846 ;; Adjust "simple" lists. | |
3847 ((memq mark '(tick dormant expire reply save)) | |
3848 (while articles | |
3849 (when (or (< (setq article (pop articles)) min) (> article max)) | |
3850 (set var (delq article (symbol-value var)))))) | |
3851 ;; Adjust assocs. | |
3852 ((memq mark uncompressed) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3853 (when (not (listp (cdr (symbol-value var)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3854 (set var (list (symbol-value var)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3855 (when (not (listp (cdr articles))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3856 (setq articles (list articles))) |
17493 | 3857 (while articles |
3858 (when (or (not (consp (setq article (pop articles)))) | |
3859 (< (car article) min) | |
3860 (> (car article) max)) | |
3861 (set var (delq article (symbol-value var)))))))))) | |
3862 | |
3863 (defun gnus-update-missing-marks (missing) | |
3864 "Go through the list of MISSING articles and remove them mark lists." | |
3865 (when missing | |
3866 (let ((types gnus-article-mark-lists) | |
3867 var m) | |
3868 ;; Go through all types. | |
3869 (while types | |
3870 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types))))) | |
3871 (when (symbol-value var) | |
3872 ;; This list has articles. So we delete all missing articles | |
3873 ;; from it. | |
3874 (setq m missing) | |
3875 (while m | |
3876 (set var (delq (pop m) (symbol-value var))))))))) | |
3877 | |
3878 (defun gnus-update-marks () | |
3879 "Enter the various lists of marked articles into the newsgroup info list." | |
3880 (let ((types gnus-article-mark-lists) | |
3881 (info (gnus-get-info gnus-newsgroup-name)) | |
3882 (uncompressed '(score bookmark killed)) | |
3883 type list newmarked symbol) | |
3884 (when info | |
3885 ;; Add all marks lists that are non-nil to the list of marks lists. | |
3886 (while (setq type (pop types)) | |
3887 (when (setq list (symbol-value | |
3888 (setq symbol | |
3889 (intern (format "gnus-newsgroup-%s" | |
3890 (car type)))))) | |
3891 | |
3892 ;; Get rid of the entries of the articles that have the | |
3893 ;; default score. | |
3894 (when (and (eq (cdr type) 'score) | |
3895 gnus-save-score | |
3896 list) | |
3897 (let* ((arts list) | |
3898 (prev (cons nil list)) | |
3899 (all prev)) | |
3900 (while arts | |
3901 (if (or (not (consp (car arts))) | |
3902 (= (cdar arts) gnus-summary-default-score)) | |
3903 (setcdr prev (cdr arts)) | |
3904 (setq prev arts)) | |
3905 (setq arts (cdr arts))) | |
3906 (setq list (cdr all)))) | |
3907 | |
3908 (push (cons (cdr type) | |
3909 (if (memq (cdr type) uncompressed) list | |
3910 (gnus-compress-sequence | |
3911 (set symbol (sort list '<)) t))) | |
3912 newmarked))) | |
3913 | |
3914 ;; Enter these new marks into the info of the group. | |
3915 (if (nthcdr 3 info) | |
3916 (setcar (nthcdr 3 info) newmarked) | |
3917 ;; Add the marks lists to the end of the info. | |
3918 (when newmarked | |
3919 (setcdr (nthcdr 2 info) (list newmarked)))) | |
3920 | |
3921 ;; Cut off the end of the info if there's nothing else there. | |
3922 (let ((i 5)) | |
3923 (while (and (> i 2) | |
3924 (not (nth i info))) | |
3925 (when (nthcdr (decf i) info) | |
3926 (setcdr (nthcdr i info) nil))))))) | |
3927 | |
3928 (defun gnus-set-mode-line (where) | |
3929 "This function sets the mode line of the article or summary buffers. | |
3930 If WHERE is `summary', the summary mode line format will be used." | |
3931 ;; Is this mode line one we keep updated? | |
3932 (when (memq where gnus-updated-mode-lines) | |
3933 (let (mode-string) | |
3934 (save-excursion | |
3935 ;; We evaluate this in the summary buffer since these | |
3936 ;; variables are buffer-local to that buffer. | |
3937 (set-buffer gnus-summary-buffer) | |
3938 ;; We bind all these variables that are used in the `eval' form | |
3939 ;; below. | |
3940 (let* ((mformat (symbol-value | |
3941 (intern | |
3942 (format "gnus-%s-mode-line-format-spec" where)))) | |
3943 (gnus-tmp-group-name gnus-newsgroup-name) | |
3944 (gnus-tmp-article-number (or gnus-current-article 0)) | |
3945 (gnus-tmp-unread gnus-newsgroup-unreads) | |
3946 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads)) | |
3947 (gnus-tmp-unselected (length gnus-newsgroup-unselected)) | |
3948 (gnus-tmp-unread-and-unselected | |
3949 (cond ((and (zerop gnus-tmp-unread-and-unticked) | |
3950 (zerop gnus-tmp-unselected)) | |
3951 "") | |
3952 ((zerop gnus-tmp-unselected) | |
3953 (format "{%d more}" gnus-tmp-unread-and-unticked)) | |
3954 (t (format "{%d(+%d) more}" | |
3955 gnus-tmp-unread-and-unticked | |
3956 gnus-tmp-unselected)))) | |
3957 (gnus-tmp-subject | |
3958 (if (and gnus-current-headers | |
3959 (vectorp gnus-current-headers)) | |
3960 (gnus-mode-string-quote | |
3961 (mail-header-subject gnus-current-headers)) | |
3962 "")) | |
3963 bufname-length max-len | |
3964 gnus-tmp-header);; passed as argument to any user-format-funcs | |
3965 (setq mode-string (eval mformat)) | |
3966 (setq bufname-length (if (string-match "%b" mode-string) | |
3967 (- (length | |
3968 (buffer-name | |
3969 (if (eq where 'summary) | |
3970 nil | |
3971 (get-buffer gnus-article-buffer)))) | |
3972 2) | |
3973 0)) | |
3974 (setq max-len (max 4 (if gnus-mode-non-string-length | |
3975 (- (window-width) | |
3976 gnus-mode-non-string-length | |
3977 bufname-length) | |
3978 (length mode-string)))) | |
3979 ;; We might have to chop a bit of the string off... | |
3980 (when (> (length mode-string) max-len) | |
3981 (setq mode-string | |
3982 (concat (gnus-truncate-string mode-string (- max-len 3)) | |
3983 "..."))) | |
3984 ;; Pad the mode string a bit. | |
3985 (setq mode-string (format (format "%%-%ds" max-len) mode-string)))) | |
3986 ;; Update the mode line. | |
3987 (setq mode-line-buffer-identification | |
3988 (gnus-mode-line-buffer-identification (list mode-string))) | |
3989 (set-buffer-modified-p t)))) | |
3990 | |
3991 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads) | |
3992 "Go through the HEADERS list and add all Xrefs to a hash table. | |
3993 The resulting hash table is returned, or nil if no Xrefs were found." | |
3994 (let* ((virtual (gnus-virtual-group-p from-newsgroup)) | |
3995 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup))) | |
3996 (xref-hashtb (gnus-make-hashtable)) | |
3997 start group entry number xrefs header) | |
3998 (while headers | |
3999 (setq header (pop headers)) | |
4000 (when (and (setq xrefs (mail-header-xref header)) | |
4001 (not (memq (setq number (mail-header-number header)) | |
4002 unreads))) | |
4003 (setq start 0) | |
4004 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start) | |
4005 (setq start (match-end 0)) | |
4006 (setq group (if prefix | |
4007 (concat prefix (substring xrefs (match-beginning 1) | |
4008 (match-end 1))) | |
4009 (substring xrefs (match-beginning 1) (match-end 1)))) | |
4010 (setq number | |
4011 (string-to-int (substring xrefs (match-beginning 2) | |
4012 (match-end 2)))) | |
4013 (if (setq entry (gnus-gethash group xref-hashtb)) | |
4014 (setcdr entry (cons number (cdr entry))) | |
4015 (gnus-sethash group (cons number nil) xref-hashtb))))) | |
4016 (and start xref-hashtb))) | |
4017 | |
4018 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads) | |
4019 "Look through all the headers and mark the Xrefs as read." | |
4020 (let ((virtual (gnus-virtual-group-p from-newsgroup)) | |
4021 name entry info xref-hashtb idlist method nth4) | |
4022 (save-excursion | |
4023 (set-buffer gnus-group-buffer) | |
4024 (when (setq xref-hashtb | |
4025 (gnus-create-xref-hashtb from-newsgroup headers unreads)) | |
4026 (mapatoms | |
4027 (lambda (group) | |
4028 (unless (string= from-newsgroup (setq name (symbol-name group))) | |
4029 (setq idlist (symbol-value group)) | |
4030 ;; Dead groups are not updated. | |
4031 (and (prog1 | |
4032 (setq entry (gnus-gethash name gnus-newsrc-hashtb) | |
4033 info (nth 2 entry)) | |
4034 (when (stringp (setq nth4 (gnus-info-method info))) | |
4035 (setq nth4 (gnus-server-to-method nth4)))) | |
4036 ;; Only do the xrefs if the group has the same | |
4037 ;; select method as the group we have just read. | |
4038 (or (gnus-methods-equal-p | |
4039 nth4 (gnus-find-method-for-group from-newsgroup)) | |
4040 virtual | |
4041 (equal nth4 (setq method (gnus-find-method-for-group | |
4042 from-newsgroup))) | |
4043 (and (equal (car nth4) (car method)) | |
4044 (equal (nth 1 nth4) (nth 1 method)))) | |
4045 gnus-use-cross-reference | |
4046 (or (not (eq gnus-use-cross-reference t)) | |
4047 virtual | |
4048 ;; Only do cross-references on subscribed | |
4049 ;; groups, if that is what is wanted. | |
4050 (<= (gnus-info-level info) gnus-level-subscribed)) | |
4051 (gnus-group-make-articles-read name idlist)))) | |
4052 xref-hashtb))))) | |
4053 | |
4054 (defun gnus-group-make-articles-read (group articles) | |
4055 "Update the info of GROUP to say that ARTICLES are read." | |
4056 (let* ((num 0) | |
4057 (entry (gnus-gethash group gnus-newsrc-hashtb)) | |
4058 (info (nth 2 entry)) | |
4059 (active (gnus-active group)) | |
4060 range) | |
4061 ;; First peel off all illegal article numbers. | |
4062 (when active | |
4063 (let ((ids articles) | |
4064 id first) | |
4065 (while (setq id (pop ids)) | |
4066 (when (and first (> id (cdr active))) | |
4067 ;; We'll end up in this situation in one particular | |
4068 ;; obscure situation. If you re-scan a group and get | |
4069 ;; a new article that is cross-posted to a different | |
4070 ;; group that has not been re-scanned, you might get | |
4071 ;; crossposted article that has a higher number than | |
4072 ;; Gnus believes possible. So we re-activate this | |
4073 ;; group as well. This might mean doing the | |
4074 ;; crossposting thingy will *increase* the number | |
4075 ;; of articles in some groups. Tsk, tsk. | |
4076 (setq active (or (gnus-activate-group group) active))) | |
4077 (when (or (> id (cdr active)) | |
4078 (< id (car active))) | |
4079 (setq articles (delq id articles)))))) | |
4080 (save-excursion | |
4081 (set-buffer gnus-group-buffer) | |
4082 (gnus-undo-register | |
4083 `(progn | |
4084 (gnus-info-set-marks ',info ',(gnus-info-marks info) t) | |
4085 (gnus-info-set-read ',info ',(gnus-info-read info)) | |
4086 (gnus-get-unread-articles-in-group ',info (gnus-active ,group)) | |
4087 (gnus-group-update-group ,group t)))) | |
4088 ;; If the read list is nil, we init it. | |
4089 (and active | |
4090 (null (gnus-info-read info)) | |
4091 (> (car active) 1) | |
4092 (gnus-info-set-read info (cons 1 (1- (car active))))) | |
4093 ;; Then we add the read articles to the range. | |
4094 (gnus-info-set-read | |
4095 info | |
4096 (setq range | |
4097 (gnus-add-to-range | |
4098 (gnus-info-read info) (setq articles (sort articles '<))))) | |
4099 ;; Then we have to re-compute how many unread | |
4100 ;; articles there are in this group. | |
4101 (when active | |
4102 (cond | |
4103 ((not range) | |
4104 (setq num (- (1+ (cdr active)) (car active)))) | |
4105 ((not (listp (cdr range))) | |
4106 (setq num (- (cdr active) (- (1+ (cdr range)) | |
4107 (car range))))) | |
4108 (t | |
4109 (while range | |
4110 (if (numberp (car range)) | |
4111 (setq num (1+ num)) | |
4112 (setq num (+ num (- (1+ (cdar range)) (caar range))))) | |
4113 (setq range (cdr range))) | |
4114 (setq num (- (cdr active) num)))) | |
4115 ;; Update the number of unread articles. | |
4116 (setcar entry num) | |
4117 ;; Update the group buffer. | |
4118 (gnus-group-update-group group t)))) | |
4119 | |
4120 (defun gnus-methods-equal-p (m1 m2) | |
4121 (let ((m1 (or m1 gnus-select-method)) | |
4122 (m2 (or m2 gnus-select-method))) | |
4123 (or (equal m1 m2) | |
4124 (and (eq (car m1) (car m2)) | |
4125 (or (not (memq 'address (assoc (symbol-name (car m1)) | |
4126 gnus-valid-select-methods))) | |
4127 (equal (nth 1 m1) (nth 1 m2))))))) | |
4128 | |
4129 (defvar gnus-newsgroup-none-id 0) | |
4130 | |
4131 (defun gnus-get-newsgroup-headers (&optional dependencies force-new) | |
4132 (let ((cur nntp-server-buffer) | |
4133 (dependencies | |
4134 (or dependencies | |
4135 (save-excursion (set-buffer gnus-summary-buffer) | |
4136 gnus-newsgroup-dependencies))) | |
4137 headers id id-dep ref-dep end ref) | |
4138 (save-excursion | |
4139 (set-buffer nntp-server-buffer) | |
4140 ;; Translate all TAB characters into SPACE characters. | |
4141 (subst-char-in-region (point-min) (point-max) ?\t ? t) | |
4142 (run-hooks 'gnus-parse-headers-hook) | |
4143 (let ((case-fold-search t) | |
4144 in-reply-to header p lines) | |
4145 (goto-char (point-min)) | |
4146 ;; Search to the beginning of the next header. Error messages | |
4147 ;; do not begin with 2 or 3. | |
4148 (while (re-search-forward "^[23][0-9]+ " nil t) | |
4149 (setq id nil | |
4150 ref nil) | |
4151 ;; This implementation of this function, with nine | |
4152 ;; search-forwards instead of the one re-search-forward and | |
4153 ;; a case (which basically was the old function) is actually | |
4154 ;; about twice as fast, even though it looks messier. You | |
4155 ;; can't have everything, I guess. Speed and elegance | |
4156 ;; doesn't always go hand in hand. | |
4157 (setq | |
4158 header | |
4159 (vector | |
4160 ;; Number. | |
4161 (prog1 | |
4162 (read cur) | |
4163 (end-of-line) | |
4164 (setq p (point)) | |
4165 (narrow-to-region (point) | |
4166 (or (and (search-forward "\n.\n" nil t) | |
4167 (- (point) 2)) | |
4168 (point)))) | |
4169 ;; Subject. | |
4170 (progn | |
4171 (goto-char p) | |
4172 (if (search-forward "\nsubject: " nil t) | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4173 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4174 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4175 gnus-unstructured-field-decoder (nnheader-header-value)) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4176 "(none)")) |
17493 | 4177 ;; From. |
4178 (progn | |
4179 (goto-char p) | |
4180 (if (search-forward "\nfrom: " nil t) | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4181 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4182 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4183 gnus-structured-field-decoder (nnheader-header-value)) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4184 "(nobody)")) |
17493 | 4185 ;; Date. |
4186 (progn | |
4187 (goto-char p) | |
4188 (if (search-forward "\ndate: " nil t) | |
4189 (nnheader-header-value) "")) | |
4190 ;; Message-ID. | |
4191 (progn | |
4192 (goto-char p) | |
4193 (setq id (if (search-forward "\nmessage-id:" nil t) | |
4194 (buffer-substring | |
4195 (1- (or (search-forward "<" nil t) (point))) | |
4196 (or (search-forward ">" nil t) (point))) | |
4197 ;; If there was no message-id, we just fake one | |
4198 ;; to make subsequent routines simpler. | |
4199 (nnheader-generate-fake-message-id)))) | |
4200 ;; References. | |
4201 (progn | |
4202 (goto-char p) | |
4203 (if (search-forward "\nreferences: " nil t) | |
4204 (progn | |
4205 (setq end (point)) | |
4206 (prog1 | |
4207 (nnheader-header-value) | |
4208 (setq ref | |
4209 (buffer-substring | |
4210 (progn | |
4211 (end-of-line) | |
4212 (search-backward ">" end t) | |
4213 (1+ (point))) | |
4214 (progn | |
4215 (search-backward "<" end t) | |
4216 (point)))))) | |
4217 ;; Get the references from the in-reply-to header if there | |
4218 ;; were no references and the in-reply-to header looks | |
4219 ;; promising. | |
4220 (if (and (search-forward "\nin-reply-to: " nil t) | |
4221 (setq in-reply-to (nnheader-header-value)) | |
4222 (string-match "<[^>]+>" in-reply-to)) | |
4223 (setq ref (substring in-reply-to (match-beginning 0) | |
4224 (match-end 0))) | |
4225 (setq ref nil)))) | |
4226 ;; Chars. | |
4227 0 | |
4228 ;; Lines. | |
4229 (progn | |
4230 (goto-char p) | |
4231 (if (search-forward "\nlines: " nil t) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4232 (if (numberp (setq lines (ignore-errors (read cur)))) |
17493 | 4233 lines 0) |
4234 0)) | |
4235 ;; Xref. | |
4236 (progn | |
4237 (goto-char p) | |
4238 (and (search-forward "\nxref: " nil t) | |
4239 (nnheader-header-value))))) | |
4240 (when (equal id ref) | |
4241 (setq ref nil)) | |
4242 ;; We do the threading while we read the headers. The | |
4243 ;; message-id and the last reference are both entered into | |
4244 ;; the same hash table. Some tippy-toeing around has to be | |
4245 ;; done in case an article has arrived before the article | |
4246 ;; which it refers to. | |
4247 (if (boundp (setq id-dep (intern id dependencies))) | |
4248 (if (and (car (symbol-value id-dep)) | |
4249 (not force-new)) | |
4250 ;; An article with this Message-ID has already been seen. | |
4251 (if gnus-summary-ignore-duplicates | |
4252 ;; We ignore this one, except we add | |
4253 ;; any additional Xrefs (in case the two articles | |
4254 ;; came from different servers). | |
4255 (progn | |
4256 (mail-header-set-xref | |
4257 (car (symbol-value id-dep)) | |
4258 (concat (or (mail-header-xref | |
4259 (car (symbol-value id-dep))) | |
4260 "") | |
4261 (or (mail-header-xref header) ""))) | |
4262 (setq header nil)) | |
4263 ;; We rename the Message-ID. | |
4264 (set | |
4265 (setq id-dep (intern (setq id (nnmail-message-id)) | |
4266 dependencies)) | |
4267 (list header)) | |
4268 (mail-header-set-id header id)) | |
4269 (setcar (symbol-value id-dep) header)) | |
4270 (set id-dep (list header))) | |
4271 (when header | |
4272 (if (boundp (setq ref-dep (intern (or ref "none") dependencies))) | |
4273 (setcdr (symbol-value ref-dep) | |
4274 (nconc (cdr (symbol-value ref-dep)) | |
4275 (list (symbol-value id-dep)))) | |
4276 (set ref-dep (list nil (symbol-value id-dep)))) | |
4277 (push header headers)) | |
4278 (goto-char (point-max)) | |
4279 (widen)) | |
4280 (nreverse headers))))) | |
4281 | |
4282 ;; The following macros and functions were written by Felix Lee | |
4283 ;; <flee@cse.psu.edu>. | |
4284 | |
4285 (defmacro gnus-nov-read-integer () | |
4286 '(prog1 | |
4287 (if (= (following-char) ?\t) | |
4288 0 | |
4289 (let ((num (ignore-errors (read buffer)))) | |
4290 (if (numberp num) num 0))) | |
4291 (unless (eobp) | |
4292 (forward-char 1)))) | |
4293 | |
4294 (defmacro gnus-nov-skip-field () | |
4295 '(search-forward "\t" eol 'move)) | |
4296 | |
4297 (defmacro gnus-nov-field () | |
4298 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol))) | |
4299 | |
4300 ;; (defvar gnus-nov-none-counter 0) | |
4301 | |
4302 ;; This function has to be called with point after the article number | |
4303 ;; on the beginning of the line. | |
4304 (defun gnus-nov-parse-line (number dependencies &optional force-new) | |
4305 (let ((eol (gnus-point-at-eol)) | |
4306 (buffer (current-buffer)) | |
4307 header ref id id-dep ref-dep) | |
4308 | |
4309 ;; overview: [num subject from date id refs chars lines misc] | |
4310 (unwind-protect | |
4311 (progn | |
4312 (narrow-to-region (point) eol) | |
4313 (unless (eobp) | |
4314 (forward-char)) | |
4315 | |
4316 (setq header | |
4317 (vector | |
4318 number ; number | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4319 ;; 1997/5/4 by MORIOKA Tomohiko <morioka@jaist.ac.jp> |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4320 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4321 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4322 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4323 gnus-structured-field-decoder (gnus-nov-field)) ; from |
17493 | 4324 (gnus-nov-field) ; date |
4325 (setq id (or (gnus-nov-field) | |
4326 (nnheader-generate-fake-message-id))) ; id | |
4327 (progn | |
4328 (let ((beg (point))) | |
4329 (search-forward "\t" eol) | |
4330 (if (search-backward ">" beg t) | |
4331 (setq ref | |
4332 (buffer-substring | |
4333 (1+ (point)) | |
4334 (search-backward "<" beg t))) | |
4335 (setq ref nil)) | |
4336 (goto-char beg)) | |
4337 (gnus-nov-field)) ; refs | |
4338 (gnus-nov-read-integer) ; chars | |
4339 (gnus-nov-read-integer) ; lines | |
4340 (if (= (following-char) ?\n) | |
4341 nil | |
4342 (gnus-nov-field))))) ; misc | |
4343 | |
4344 (widen)) | |
4345 | |
4346 ;; We build the thread tree. | |
4347 (when (equal id ref) | |
4348 ;; This article refers back to itself. Naughty, naughty. | |
4349 (setq ref nil)) | |
4350 (if (boundp (setq id-dep (intern id dependencies))) | |
4351 (if (and (car (symbol-value id-dep)) | |
4352 (not force-new)) | |
4353 ;; An article with this Message-ID has already been seen. | |
4354 (if gnus-summary-ignore-duplicates | |
4355 ;; We ignore this one, except we add any additional | |
4356 ;; Xrefs (in case the two articles came from different | |
4357 ;; servers. | |
4358 (progn | |
4359 (mail-header-set-xref | |
4360 (car (symbol-value id-dep)) | |
4361 (concat (or (mail-header-xref | |
4362 (car (symbol-value id-dep))) | |
4363 "") | |
4364 (or (mail-header-xref header) ""))) | |
4365 (setq header nil)) | |
4366 ;; We rename the Message-ID. | |
4367 (set | |
4368 (setq id-dep (intern (setq id (nnmail-message-id)) | |
4369 dependencies)) | |
4370 (list header)) | |
4371 (mail-header-set-id header id)) | |
4372 (setcar (symbol-value id-dep) header)) | |
4373 (set id-dep (list header))) | |
4374 (when header | |
4375 (if (boundp (setq ref-dep (intern (or ref "none") dependencies))) | |
4376 (setcdr (symbol-value ref-dep) | |
4377 (nconc (cdr (symbol-value ref-dep)) | |
4378 (list (symbol-value id-dep)))) | |
4379 (set ref-dep (list nil (symbol-value id-dep))))) | |
4380 header)) | |
4381 | |
4382 ;; Goes through the xover lines and returns a list of vectors | |
4383 (defun gnus-get-newsgroup-headers-xover (sequence &optional | |
4384 force-new dependencies | |
4385 group also-fetch-heads) | |
4386 "Parse the news overview data in the server buffer, and return a | |
4387 list of headers that match SEQUENCE (see `nntp-retrieve-headers')." | |
4388 ;; Get the Xref when the users reads the articles since most/some | |
4389 ;; NNTP servers do not include Xrefs when using XOVER. | |
4390 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs)) | |
4391 (let ((cur nntp-server-buffer) | |
4392 (dependencies (or dependencies gnus-newsgroup-dependencies)) | |
4393 number headers header) | |
4394 (save-excursion | |
4395 (set-buffer nntp-server-buffer) | |
4396 ;; Allow the user to mangle the headers before parsing them. | |
4397 (run-hooks 'gnus-parse-headers-hook) | |
4398 (goto-char (point-min)) | |
4399 (while (not (eobp)) | |
4400 (condition-case () | |
4401 (while (and sequence (not (eobp))) | |
4402 (setq number (read cur)) | |
4403 (while (and sequence | |
4404 (< (car sequence) number)) | |
4405 (setq sequence (cdr sequence))) | |
4406 (and sequence | |
4407 (eq number (car sequence)) | |
4408 (progn | |
4409 (setq sequence (cdr sequence)) | |
4410 (setq header (inline | |
4411 (gnus-nov-parse-line | |
4412 number dependencies force-new)))) | |
4413 (push header headers)) | |
4414 (forward-line 1)) | |
4415 (error | |
4416 (gnus-error 4 "Strange nov line (%d)" | |
4417 (count-lines (point-min) (point))))) | |
4418 (forward-line 1)) | |
4419 ;; A common bug in inn is that if you have posted an article and | |
4420 ;; then retrieves the active file, it will answer correctly -- | |
4421 ;; the new article is included. However, a NOV entry for the | |
4422 ;; article may not have been generated yet, so this may fail. | |
4423 ;; We work around this problem by retrieving the last few | |
4424 ;; headers using HEAD. | |
4425 (if (or (not also-fetch-heads) | |
4426 (not sequence)) | |
4427 ;; We (probably) got all the headers. | |
4428 (nreverse headers) | |
4429 (let ((gnus-nov-is-evil t)) | |
4430 (nconc | |
4431 (nreverse headers) | |
4432 (when (gnus-retrieve-headers sequence group) | |
4433 (gnus-get-newsgroup-headers)))))))) | |
4434 | |
4435 (defun gnus-article-get-xrefs () | |
4436 "Fill in the Xref value in `gnus-current-headers', if necessary. | |
4437 This is meant to be called in `gnus-article-internal-prepare-hook'." | |
4438 (let ((headers (save-excursion (set-buffer gnus-summary-buffer) | |
4439 gnus-current-headers))) | |
4440 (or (not gnus-use-cross-reference) | |
4441 (not headers) | |
4442 (and (mail-header-xref headers) | |
4443 (not (string= (mail-header-xref headers) ""))) | |
4444 (let ((case-fold-search t) | |
4445 xref) | |
4446 (save-restriction | |
4447 (nnheader-narrow-to-headers) | |
4448 (goto-char (point-min)) | |
4449 (when (or (and (eq (downcase (following-char)) ?x) | |
4450 (looking-at "Xref:")) | |
4451 (search-forward "\nXref:" nil t)) | |
4452 (goto-char (1+ (match-end 0))) | |
4453 (setq xref (buffer-substring (point) | |
4454 (progn (end-of-line) (point)))) | |
4455 (mail-header-set-xref headers xref))))))) | |
4456 | |
4457 (defun gnus-summary-insert-subject (id &optional old-header use-old-header) | |
4458 "Find article ID and insert the summary line for that article." | |
4459 (let ((header (if (and old-header use-old-header) | |
4460 old-header (gnus-read-header id))) | |
4461 (number (and (numberp id) id)) | |
4462 pos d) | |
4463 (when header | |
4464 ;; Rebuild the thread that this article is part of and go to the | |
4465 ;; article we have fetched. | |
4466 (when (and (not gnus-show-threads) | |
4467 old-header) | |
4468 (when (setq d (gnus-data-find (mail-header-number old-header))) | |
4469 (goto-char (gnus-data-pos d)) | |
4470 (gnus-data-remove | |
4471 number | |
4472 (- (gnus-point-at-bol) | |
4473 (prog1 | |
4474 (1+ (gnus-point-at-eol)) | |
4475 (gnus-delete-line)))))) | |
4476 (when old-header | |
4477 (mail-header-set-number header (mail-header-number old-header))) | |
4478 (setq gnus-newsgroup-sparse | |
4479 (delq (setq number (mail-header-number header)) | |
4480 gnus-newsgroup-sparse)) | |
4481 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient)) | |
4482 (gnus-rebuild-thread (mail-header-id header)) | |
4483 (gnus-summary-goto-subject number nil t)) | |
4484 (when (and (numberp number) | |
4485 (> number 0)) | |
4486 ;; We have to update the boundaries even if we can't fetch the | |
4487 ;; article if ID is a number -- so that the next `P' or `N' | |
4488 ;; command will fetch the previous (or next) article even | |
4489 ;; if the one we tried to fetch this time has been canceled. | |
4490 (when (> number gnus-newsgroup-end) | |
4491 (setq gnus-newsgroup-end number)) | |
4492 (when (< number gnus-newsgroup-begin) | |
4493 (setq gnus-newsgroup-begin number)) | |
4494 (setq gnus-newsgroup-unselected | |
4495 (delq number gnus-newsgroup-unselected))) | |
4496 ;; Report back a success? | |
4497 (and header (mail-header-number header)))) | |
4498 | |
4499 ;;; Process/prefix in the summary buffer | |
4500 | |
4501 (defun gnus-summary-work-articles (n) | |
4502 "Return a list of articles to be worked upon. The prefix argument, | |
4503 the list of process marked articles, and the current article will be | |
4504 taken into consideration." | |
4505 (cond | |
4506 (n | |
4507 ;; A numerical prefix has been given. | |
4508 (setq n (prefix-numeric-value n)) | |
4509 (let ((backward (< n 0)) | |
4510 (n (abs (prefix-numeric-value n))) | |
4511 articles article) | |
4512 (save-excursion | |
4513 (while | |
4514 (and (> n 0) | |
4515 (push (setq article (gnus-summary-article-number)) | |
4516 articles) | |
4517 (if backward | |
4518 (gnus-summary-find-prev nil article) | |
4519 (gnus-summary-find-next nil article))) | |
4520 (decf n))) | |
4521 (nreverse articles))) | |
4522 ((gnus-region-active-p) | |
4523 ;; Work on the region between point and mark. | |
4524 (let ((max (max (point) (mark))) | |
4525 articles article) | |
4526 (save-excursion | |
4527 (goto-char (min (point) (mark))) | |
4528 (while | |
4529 (and | |
4530 (push (setq article (gnus-summary-article-number)) articles) | |
4531 (gnus-summary-find-next nil article) | |
4532 (< (point) max))) | |
4533 (nreverse articles)))) | |
4534 (gnus-newsgroup-processable | |
4535 ;; There are process-marked articles present. | |
4536 ;; Save current state. | |
4537 (gnus-summary-save-process-mark) | |
4538 ;; Return the list. | |
4539 (reverse gnus-newsgroup-processable)) | |
4540 (t | |
4541 ;; Just return the current article. | |
4542 (list (gnus-summary-article-number))))) | |
4543 | |
4544 (defun gnus-summary-save-process-mark () | |
4545 "Push the current set of process marked articles on the stack." | |
4546 (interactive) | |
4547 (push (copy-sequence gnus-newsgroup-processable) | |
4548 gnus-newsgroup-process-stack)) | |
4549 | |
4550 (defun gnus-summary-kill-process-mark () | |
4551 "Push the current set of process marked articles on the stack and unmark." | |
4552 (interactive) | |
4553 (gnus-summary-save-process-mark) | |
4554 (gnus-summary-unmark-all-processable)) | |
4555 | |
4556 (defun gnus-summary-yank-process-mark () | |
4557 "Pop the last process mark state off the stack and restore it." | |
4558 (interactive) | |
4559 (unless gnus-newsgroup-process-stack | |
4560 (error "Empty mark stack")) | |
4561 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack))) | |
4562 | |
4563 (defun gnus-summary-process-mark-set (set) | |
4564 "Make SET into the current process marked articles." | |
4565 (gnus-summary-unmark-all-processable) | |
4566 (while set | |
4567 (gnus-summary-set-process-mark (pop set)))) | |
4568 | |
4569 ;;; Searching and stuff | |
4570 | |
4571 (defun gnus-summary-search-group (&optional backward use-level) | |
4572 "Search for next unread newsgroup. | |
4573 If optional argument BACKWARD is non-nil, search backward instead." | |
4574 (save-excursion | |
4575 (set-buffer gnus-group-buffer) | |
4576 (when (gnus-group-search-forward | |
4577 backward nil (if use-level (gnus-group-group-level) nil)) | |
4578 (gnus-group-group-name)))) | |
4579 | |
4580 (defun gnus-summary-best-group (&optional exclude-group) | |
4581 "Find the name of the best unread group. | |
4582 If EXCLUDE-GROUP, do not go to this group." | |
4583 (save-excursion | |
4584 (set-buffer gnus-group-buffer) | |
4585 (save-excursion | |
4586 (gnus-group-best-unread-group exclude-group)))) | |
4587 | |
4588 (defun gnus-summary-find-next (&optional unread article backward) | |
4589 (if backward (gnus-summary-find-prev) | |
4590 (let* ((dummy (gnus-summary-article-intangible-p)) | |
4591 (article (or article (gnus-summary-article-number))) | |
4592 (arts (gnus-data-find-list article)) | |
4593 result) | |
4594 (when (and (not dummy) | |
4595 (or (not gnus-summary-check-current) | |
4596 (not unread) | |
4597 (not (gnus-data-unread-p (car arts))))) | |
4598 (setq arts (cdr arts))) | |
4599 (when (setq result | |
4600 (if unread | |
4601 (progn | |
4602 (while arts | |
4603 (when (gnus-data-unread-p (car arts)) | |
4604 (setq result (car arts) | |
4605 arts nil)) | |
4606 (setq arts (cdr arts))) | |
4607 result) | |
4608 (car arts))) | |
4609 (goto-char (gnus-data-pos result)) | |
4610 (gnus-data-number result))))) | |
4611 | |
4612 (defun gnus-summary-find-prev (&optional unread article) | |
4613 (let* ((eobp (eobp)) | |
4614 (article (or article (gnus-summary-article-number))) | |
4615 (arts (gnus-data-find-list article (gnus-data-list 'rev))) | |
4616 result) | |
4617 (when (and (not eobp) | |
4618 (or (not gnus-summary-check-current) | |
4619 (not unread) | |
4620 (not (gnus-data-unread-p (car arts))))) | |
4621 (setq arts (cdr arts))) | |
4622 (when (setq result | |
4623 (if unread | |
4624 (progn | |
4625 (while arts | |
4626 (when (gnus-data-unread-p (car arts)) | |
4627 (setq result (car arts) | |
4628 arts nil)) | |
4629 (setq arts (cdr arts))) | |
4630 result) | |
4631 (car arts))) | |
4632 (goto-char (gnus-data-pos result)) | |
4633 (gnus-data-number result)))) | |
4634 | |
4635 (defun gnus-summary-find-subject (subject &optional unread backward article) | |
4636 (let* ((simp-subject (gnus-simplify-subject-fully subject)) | |
4637 (article (or article (gnus-summary-article-number))) | |
4638 (articles (gnus-data-list backward)) | |
4639 (arts (gnus-data-find-list article articles)) | |
4640 result) | |
4641 (when (or (not gnus-summary-check-current) | |
4642 (not unread) | |
4643 (not (gnus-data-unread-p (car arts)))) | |
4644 (setq arts (cdr arts))) | |
4645 (while arts | |
4646 (and (or (not unread) | |
4647 (gnus-data-unread-p (car arts))) | |
4648 (vectorp (gnus-data-header (car arts))) | |
4649 (gnus-subject-equal | |
4650 simp-subject (mail-header-subject (gnus-data-header (car arts))) t) | |
4651 (setq result (car arts) | |
4652 arts nil)) | |
4653 (setq arts (cdr arts))) | |
4654 (and result | |
4655 (goto-char (gnus-data-pos result)) | |
4656 (gnus-data-number result)))) | |
4657 | |
4658 (defun gnus-summary-search-forward (&optional unread subject backward) | |
4659 "Search forward for an article. | |
4660 If UNREAD, look for unread articles. If SUBJECT, look for | |
4661 articles with that subject. If BACKWARD, search backward instead." | |
4662 (cond (subject (gnus-summary-find-subject subject unread backward)) | |
4663 (backward (gnus-summary-find-prev unread)) | |
4664 (t (gnus-summary-find-next unread)))) | |
4665 | |
4666 (defun gnus-recenter (&optional n) | |
4667 "Center point in window and redisplay frame. | |
4668 Also do horizontal recentering." | |
4669 (interactive "P") | |
4670 (when (and gnus-auto-center-summary | |
4671 (not (eq gnus-auto-center-summary 'vertical))) | |
4672 (gnus-horizontal-recenter)) | |
4673 (recenter n)) | |
4674 | |
4675 (defun gnus-summary-recenter () | |
4676 "Center point in the summary window. | |
4677 If `gnus-auto-center-summary' is nil, or the article buffer isn't | |
4678 displayed, no centering will be performed." | |
4679 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle). | |
4680 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu. | |
4681 (let* ((top (cond ((< (window-height) 4) 0) | |
4682 ((< (window-height) 7) 1) | |
4683 (t 2))) | |
4684 (height (1- (window-height))) | |
4685 (bottom (save-excursion (goto-char (point-max)) | |
4686 (forward-line (- height)) | |
4687 (point))) | |
4688 (window (get-buffer-window (current-buffer)))) | |
4689 ;; The user has to want it. | |
4690 (when gnus-auto-center-summary | |
4691 (when (get-buffer-window gnus-article-buffer) | |
4692 ;; Only do recentering when the article buffer is displayed, | |
4693 ;; Set the window start to either `bottom', which is the biggest | |
4694 ;; possible valid number, or the second line from the top, | |
4695 ;; whichever is the least. | |
4696 (set-window-start | |
4697 window (min bottom (save-excursion | |
4698 (forward-line (- top)) (point))))) | |
4699 ;; Do horizontal recentering while we're at it. | |
4700 (when (and (get-buffer-window (current-buffer) t) | |
4701 (not (eq gnus-auto-center-summary 'vertical))) | |
4702 (let ((selected (selected-window))) | |
4703 (select-window (get-buffer-window (current-buffer) t)) | |
4704 (gnus-summary-position-point) | |
4705 (gnus-horizontal-recenter) | |
4706 (select-window selected)))))) | |
4707 | |
4708 (defun gnus-summary-jump-to-group (newsgroup) | |
4709 "Move point to NEWSGROUP in group mode buffer." | |
4710 ;; Keep update point of group mode buffer if visible. | |
4711 (if (eq (current-buffer) (get-buffer gnus-group-buffer)) | |
4712 (save-window-excursion | |
4713 ;; Take care of tree window mode. | |
4714 (when (get-buffer-window gnus-group-buffer) | |
4715 (pop-to-buffer gnus-group-buffer)) | |
4716 (gnus-group-jump-to-group newsgroup)) | |
4717 (save-excursion | |
4718 ;; Take care of tree window mode. | |
4719 (if (get-buffer-window gnus-group-buffer) | |
4720 (pop-to-buffer gnus-group-buffer) | |
4721 (set-buffer gnus-group-buffer)) | |
4722 (gnus-group-jump-to-group newsgroup)))) | |
4723 | |
4724 ;; This function returns a list of article numbers based on the | |
4725 ;; difference between the ranges of read articles in this group and | |
4726 ;; the range of active articles. | |
4727 (defun gnus-list-of-unread-articles (group) | |
4728 (let* ((read (gnus-info-read (gnus-get-info group))) | |
4729 (active (or (gnus-active group) (gnus-activate-group group))) | |
4730 (last (cdr active)) | |
4731 first nlast unread) | |
4732 ;; If none are read, then all are unread. | |
4733 (if (not read) | |
4734 (setq first (car active)) | |
4735 ;; If the range of read articles is a single range, then the | |
4736 ;; first unread article is the article after the last read | |
4737 ;; article. Sounds logical, doesn't it? | |
4738 (if (not (listp (cdr read))) | |
4739 (setq first (1+ (cdr read))) | |
4740 ;; `read' is a list of ranges. | |
4741 (when (/= (setq nlast (or (and (numberp (car read)) (car read)) | |
4742 (caar read))) | |
4743 1) | |
4744 (setq first 1)) | |
4745 (while read | |
4746 (when first | |
4747 (while (< first nlast) | |
4748 (push first unread) | |
4749 (setq first (1+ first)))) | |
4750 (setq first (1+ (if (atom (car read)) (car read) (cdar read)))) | |
4751 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read))) | |
4752 (setq read (cdr read))))) | |
4753 ;; And add the last unread articles. | |
4754 (while (<= first last) | |
4755 (push first unread) | |
4756 (setq first (1+ first))) | |
4757 ;; Return the list of unread articles. | |
4758 (nreverse unread))) | |
4759 | |
4760 (defun gnus-list-of-read-articles (group) | |
4761 "Return a list of unread, unticked and non-dormant articles." | |
4762 (let* ((info (gnus-get-info group)) | |
4763 (marked (gnus-info-marks info)) | |
4764 (active (gnus-active group))) | |
4765 (and info active | |
4766 (gnus-set-difference | |
4767 (gnus-sorted-complement | |
4768 (gnus-uncompress-range active) | |
4769 (gnus-list-of-unread-articles group)) | |
4770 (append | |
4771 (gnus-uncompress-range (cdr (assq 'dormant marked))) | |
4772 (gnus-uncompress-range (cdr (assq 'tick marked)))))))) | |
4773 | |
4774 ;; Various summary commands | |
4775 | |
4776 (defun gnus-summary-universal-argument (arg) | |
4777 "Perform any operation on all articles that are process/prefixed." | |
4778 (interactive "P") | |
4779 (gnus-set-global-variables) | |
4780 (let ((articles (gnus-summary-work-articles arg)) | |
4781 func article) | |
4782 (if (eq | |
4783 (setq | |
4784 func | |
4785 (key-binding | |
4786 (read-key-sequence | |
4787 (substitute-command-keys | |
4788 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]" | |
4789 )))) | |
4790 'undefined) | |
4791 (gnus-error 1 "Undefined key") | |
4792 (save-excursion | |
4793 (while articles | |
4794 (gnus-summary-goto-subject (setq article (pop articles))) | |
4795 (let (gnus-newsgroup-processable) | |
4796 (command-execute func)) | |
4797 (gnus-summary-remove-process-mark article))))) | |
4798 (gnus-summary-position-point)) | |
4799 | |
4800 (defun gnus-summary-toggle-truncation (&optional arg) | |
4801 "Toggle truncation of summary lines. | |
4802 With arg, turn line truncation on iff arg is positive." | |
4803 (interactive "P") | |
4804 (setq truncate-lines | |
4805 (if (null arg) (not truncate-lines) | |
4806 (> (prefix-numeric-value arg) 0))) | |
4807 (redraw-display)) | |
4808 | |
4809 (defun gnus-summary-reselect-current-group (&optional all rescan) | |
4810 "Exit and then reselect the current newsgroup. | |
4811 The prefix argument ALL means to select all articles." | |
4812 (interactive "P") | |
4813 (gnus-set-global-variables) | |
4814 (when (gnus-ephemeral-group-p gnus-newsgroup-name) | |
4815 (error "Ephemeral groups can't be reselected")) | |
4816 (let ((current-subject (gnus-summary-article-number)) | |
4817 (group gnus-newsgroup-name)) | |
4818 (setq gnus-newsgroup-begin nil) | |
4819 (gnus-summary-exit) | |
4820 ;; We have to adjust the point of group mode buffer because | |
4821 ;; point was moved to the next unread newsgroup by exiting. | |
4822 (gnus-summary-jump-to-group group) | |
4823 (when rescan | |
4824 (save-excursion | |
4825 (gnus-group-get-new-news-this-group 1))) | |
4826 (gnus-group-read-group all t) | |
4827 (gnus-summary-goto-subject current-subject nil t))) | |
4828 | |
4829 (defun gnus-summary-rescan-group (&optional all) | |
4830 "Exit the newsgroup, ask for new articles, and select the newsgroup." | |
4831 (interactive "P") | |
4832 (gnus-summary-reselect-current-group all t)) | |
4833 | |
4834 (defun gnus-summary-update-info (&optional non-destructive) | |
4835 (save-excursion | |
4836 (let ((group gnus-newsgroup-name)) | |
4837 (when gnus-newsgroup-kill-headers | |
4838 (setq gnus-newsgroup-killed | |
4839 (gnus-compress-sequence | |
4840 (nconc | |
4841 (gnus-set-sorted-intersection | |
4842 (gnus-uncompress-range gnus-newsgroup-killed) | |
4843 (setq gnus-newsgroup-unselected | |
4844 (sort gnus-newsgroup-unselected '<))) | |
4845 (setq gnus-newsgroup-unreads | |
4846 (sort gnus-newsgroup-unreads '<))) | |
4847 t))) | |
4848 (unless (listp (cdr gnus-newsgroup-killed)) | |
4849 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed))) | |
4850 (let ((headers gnus-newsgroup-headers)) | |
4851 (when (and (not gnus-save-score) | |
4852 (not non-destructive)) | |
4853 (setq gnus-newsgroup-scored nil)) | |
4854 ;; Set the new ranges of read articles. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4855 (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4856 (set-buffer gnus-group-buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4857 (gnus-undo-force-boundary)) |
17493 | 4858 (gnus-update-read-articles |
4859 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected)) | |
4860 ;; Set the current article marks. | |
4861 (gnus-update-marks) | |
4862 ;; Do the cross-ref thing. | |
4863 (when gnus-use-cross-reference | |
4864 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads)) | |
4865 ;; Do adaptive scoring, and possibly save score files. | |
4866 (when gnus-newsgroup-adaptive | |
4867 (gnus-score-adaptive)) | |
4868 (when gnus-use-scoring | |
4869 (gnus-score-save)) | |
4870 ;; Do not switch windows but change the buffer to work. | |
4871 (set-buffer gnus-group-buffer) | |
4872 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
4873 (gnus-group-update-group group)))))) | |
4874 | |
4875 (defun gnus-summary-save-newsrc (&optional force) | |
4876 "Save the current number of read/marked articles in the dribble buffer. | |
4877 The dribble buffer will then be saved. | |
4878 If FORCE (the prefix), also save the .newsrc file(s)." | |
4879 (interactive "P") | |
4880 (gnus-summary-update-info t) | |
4881 (if force | |
4882 (gnus-save-newsrc-file) | |
4883 (gnus-dribble-save))) | |
4884 | |
4885 (defun gnus-summary-exit (&optional temporary) | |
4886 "Exit reading current newsgroup, and then return to group selection mode. | |
4887 gnus-exit-group-hook is called with no arguments if that value is non-nil." | |
4888 (interactive) | |
4889 (gnus-set-global-variables) | |
4890 (gnus-kill-save-kill-buffer) | |
4891 (let* ((group gnus-newsgroup-name) | |
4892 (quit-config (gnus-group-quit-config gnus-newsgroup-name)) | |
4893 (mode major-mode) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4894 (group-point nil) |
17493 | 4895 (buf (current-buffer))) |
4896 (run-hooks 'gnus-summary-prepare-exit-hook) | |
4897 ;; If we have several article buffers, we kill them at exit. | |
4898 (unless gnus-single-article-buffer | |
4899 (gnus-kill-buffer gnus-original-article-buffer) | |
4900 (setq gnus-article-current nil)) | |
4901 (when gnus-use-cache | |
4902 (gnus-cache-possibly-remove-articles) | |
4903 (gnus-cache-save-buffers)) | |
4904 (gnus-async-prefetch-remove-group group) | |
4905 (when gnus-suppress-duplicates | |
4906 (gnus-dup-enter-articles)) | |
4907 (when gnus-use-trees | |
4908 (gnus-tree-close group)) | |
4909 ;; Make all changes in this group permanent. | |
4910 (unless quit-config | |
4911 (run-hooks 'gnus-exit-group-hook) | |
4912 (gnus-summary-update-info)) | |
4913 (gnus-close-group group) | |
4914 ;; Make sure where we were, and go to next newsgroup. | |
4915 (set-buffer gnus-group-buffer) | |
4916 (unless quit-config | |
4917 (gnus-group-jump-to-group group)) | |
4918 (run-hooks 'gnus-summary-exit-hook) | |
4919 (unless quit-config | |
4920 (gnus-group-next-unread-group 1)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4921 (setq group-point (point)) |
17493 | 4922 (if temporary |
4923 nil ;Nothing to do. | |
4924 ;; If we have several article buffers, we kill them at exit. | |
4925 (unless gnus-single-article-buffer | |
4926 (gnus-kill-buffer gnus-article-buffer) | |
4927 (gnus-kill-buffer gnus-original-article-buffer) | |
4928 (setq gnus-article-current nil)) | |
4929 (set-buffer buf) | |
4930 (if (not gnus-kill-summary-on-exit) | |
4931 (gnus-deaden-summary) | |
4932 ;; We set all buffer-local variables to nil. It is unclear why | |
4933 ;; this is needed, but if we don't, buffer-local variables are | |
4934 ;; not garbage-collected, it seems. This would the lead to en | |
4935 ;; ever-growing Emacs. | |
4936 (gnus-summary-clear-local-variables) | |
4937 (when (get-buffer gnus-article-buffer) | |
4938 (bury-buffer gnus-article-buffer)) | |
4939 ;; We clear the global counterparts of the buffer-local | |
4940 ;; variables as well, just to be on the safe side. | |
4941 (set-buffer gnus-group-buffer) | |
4942 (gnus-summary-clear-local-variables) | |
4943 ;; Return to group mode buffer. | |
4944 (when (eq mode 'gnus-summary-mode) | |
4945 (gnus-kill-buffer buf))) | |
4946 (setq gnus-current-select-method gnus-select-method) | |
4947 (pop-to-buffer gnus-group-buffer) | |
4948 ;; Clear the current group name. | |
4949 (if (not quit-config) | |
4950 (progn | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4951 (goto-char group-point) |
17493 | 4952 (gnus-configure-windows 'group 'force)) |
4953 (gnus-handle-ephemeral-exit quit-config)) | |
4954 (unless quit-config | |
4955 (setq gnus-newsgroup-name nil))))) | |
4956 | |
4957 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update) | |
4958 (defun gnus-summary-exit-no-update (&optional no-questions) | |
4959 "Quit reading current newsgroup without updating read article info." | |
4960 (interactive) | |
4961 (gnus-set-global-variables) | |
4962 (let* ((group gnus-newsgroup-name) | |
4963 (quit-config (gnus-group-quit-config group))) | |
4964 (when (or no-questions | |
4965 gnus-expert-user | |
4966 (gnus-y-or-n-p "Discard changes to this group and exit? ")) | |
4967 ;; If we have several article buffers, we kill them at exit. | |
4968 (unless gnus-single-article-buffer | |
4969 (gnus-kill-buffer gnus-article-buffer) | |
4970 (gnus-kill-buffer gnus-original-article-buffer) | |
4971 (setq gnus-article-current nil)) | |
4972 (if (not gnus-kill-summary-on-exit) | |
4973 (gnus-deaden-summary) | |
4974 (gnus-close-group group) | |
4975 (gnus-summary-clear-local-variables) | |
4976 (set-buffer gnus-group-buffer) | |
4977 (gnus-summary-clear-local-variables) | |
4978 (when (get-buffer gnus-summary-buffer) | |
4979 (kill-buffer gnus-summary-buffer))) | |
4980 (unless gnus-single-article-buffer | |
4981 (setq gnus-article-current nil)) | |
4982 (when gnus-use-trees | |
4983 (gnus-tree-close group)) | |
4984 (gnus-async-prefetch-remove-group group) | |
4985 (when (get-buffer gnus-article-buffer) | |
4986 (bury-buffer gnus-article-buffer)) | |
4987 ;; Return to the group buffer. | |
4988 (gnus-configure-windows 'group 'force) | |
4989 ;; Clear the current group name. | |
4990 (setq gnus-newsgroup-name nil) | |
4991 (when (equal (gnus-group-group-name) group) | |
4992 (gnus-group-next-unread-group 1)) | |
4993 (when quit-config | |
4994 (gnus-handle-ephemeral-exit quit-config))))) | |
4995 | |
4996 (defun gnus-handle-ephemeral-exit (quit-config) | |
4997 "Handle movement when leaving an ephemeral group. The state | |
4998 which existed when entering the ephemeral is reset." | |
4999 (if (not (buffer-name (car quit-config))) | |
5000 (gnus-configure-windows 'group 'force) | |
5001 (set-buffer (car quit-config)) | |
5002 (cond ((eq major-mode 'gnus-summary-mode) | |
5003 (gnus-set-global-variables)) | |
5004 ((eq major-mode 'gnus-article-mode) | |
5005 (save-excursion | |
5006 ;; The `gnus-summary-buffer' variable may point | |
5007 ;; to the old summary buffer when using a single | |
5008 ;; article buffer. | |
5009 (unless (gnus-buffer-live-p gnus-summary-buffer) | |
5010 (set-buffer gnus-group-buffer)) | |
5011 (set-buffer gnus-summary-buffer) | |
5012 (gnus-set-global-variables)))) | |
5013 (if (or (eq (cdr quit-config) 'article) | |
5014 (eq (cdr quit-config) 'pick)) | |
5015 (progn | |
5016 ;; The current article may be from the ephemeral group | |
5017 ;; thus it is best that we reload this article | |
5018 (gnus-summary-show-article) | |
5019 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode)) | |
5020 (gnus-configure-windows 'pick 'force) | |
5021 (gnus-configure-windows (cdr quit-config) 'force))) | |
5022 (gnus-configure-windows (cdr quit-config) 'force)) | |
5023 (when (eq major-mode 'gnus-summary-mode) | |
5024 (gnus-summary-next-subject 1 nil t) | |
5025 (gnus-summary-recenter) | |
5026 (gnus-summary-position-point)))) | |
5027 | |
5028 ;;; Dead summaries. | |
5029 | |
5030 (defvar gnus-dead-summary-mode-map nil) | |
5031 | |
5032 (unless gnus-dead-summary-mode-map | |
5033 (setq gnus-dead-summary-mode-map (make-keymap)) | |
5034 (suppress-keymap gnus-dead-summary-mode-map) | |
5035 (substitute-key-definition | |
5036 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5037 (let ((keys '("\C-d" "\r" "\177" [delete]))) |
17493 | 5038 (while keys |
5039 (define-key gnus-dead-summary-mode-map | |
5040 (pop keys) 'gnus-summary-wake-up-the-dead)))) | |
5041 | |
5042 (defvar gnus-dead-summary-mode nil | |
5043 "Minor mode for Gnus summary buffers.") | |
5044 | |
5045 (defun gnus-dead-summary-mode (&optional arg) | |
5046 "Minor mode for Gnus summary buffers." | |
5047 (interactive "P") | |
5048 (when (eq major-mode 'gnus-summary-mode) | |
5049 (make-local-variable 'gnus-dead-summary-mode) | |
5050 (setq gnus-dead-summary-mode | |
5051 (if (null arg) (not gnus-dead-summary-mode) | |
5052 (> (prefix-numeric-value arg) 0))) | |
5053 (when gnus-dead-summary-mode | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5054 (gnus-add-minor-mode |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5055 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map)))) |
17493 | 5056 |
5057 (defun gnus-deaden-summary () | |
5058 "Make the current summary buffer into a dead summary buffer." | |
5059 ;; Kill any previous dead summary buffer. | |
5060 (when (and gnus-dead-summary | |
5061 (buffer-name gnus-dead-summary)) | |
5062 (save-excursion | |
5063 (set-buffer gnus-dead-summary) | |
5064 (when gnus-dead-summary-mode | |
5065 (kill-buffer (current-buffer))))) | |
5066 ;; Make this the current dead summary. | |
5067 (setq gnus-dead-summary (current-buffer)) | |
5068 (gnus-dead-summary-mode 1) | |
5069 (let ((name (buffer-name))) | |
5070 (when (string-match "Summary" name) | |
5071 (rename-buffer | |
5072 (concat (substring name 0 (match-beginning 0)) "Dead " | |
5073 (substring name (match-beginning 0))) | |
5074 t)))) | |
5075 | |
5076 (defun gnus-kill-or-deaden-summary (buffer) | |
5077 "Kill or deaden the summary BUFFER." | |
5078 (when (and (buffer-name buffer) | |
5079 (not gnus-single-article-buffer)) | |
5080 (save-excursion | |
5081 (set-buffer buffer) | |
5082 (gnus-kill-buffer gnus-article-buffer) | |
5083 (gnus-kill-buffer gnus-original-article-buffer))) | |
5084 (cond (gnus-kill-summary-on-exit | |
5085 (when (and gnus-use-trees | |
5086 (and (get-buffer buffer) | |
5087 (buffer-name (get-buffer buffer)))) | |
5088 (save-excursion | |
5089 (set-buffer (get-buffer buffer)) | |
5090 (gnus-tree-close gnus-newsgroup-name))) | |
5091 (gnus-kill-buffer buffer)) | |
5092 ((and (get-buffer buffer) | |
5093 (buffer-name (get-buffer buffer))) | |
5094 (save-excursion | |
5095 (set-buffer buffer) | |
5096 (gnus-deaden-summary))))) | |
5097 | |
5098 (defun gnus-summary-wake-up-the-dead (&rest args) | |
5099 "Wake up the dead summary buffer." | |
5100 (interactive) | |
5101 (gnus-dead-summary-mode -1) | |
5102 (let ((name (buffer-name))) | |
5103 (when (string-match "Dead " name) | |
5104 (rename-buffer | |
5105 (concat (substring name 0 (match-beginning 0)) | |
5106 (substring name (match-end 0))) | |
5107 t))) | |
5108 (gnus-message 3 "This dead summary is now alive again")) | |
5109 | |
5110 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>. | |
5111 (defun gnus-summary-fetch-faq (&optional faq-dir) | |
5112 "Fetch the FAQ for the current group. | |
5113 If FAQ-DIR (the prefix), prompt for a directory to search for the faq | |
5114 in." | |
5115 (interactive | |
5116 (list | |
5117 (when current-prefix-arg | |
5118 (completing-read | |
5119 "Faq dir: " (and (listp gnus-group-faq-directory) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5120 (mapcar (lambda (file) (list file)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5121 gnus-group-faq-directory)))))) |
17493 | 5122 (let (gnus-faq-buffer) |
5123 (when (setq gnus-faq-buffer | |
5124 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir)) | |
5125 (gnus-configure-windows 'summary-faq)))) | |
5126 | |
5127 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>. | |
5128 (defun gnus-summary-describe-group (&optional force) | |
5129 "Describe the current newsgroup." | |
5130 (interactive "P") | |
5131 (gnus-group-describe-group force gnus-newsgroup-name)) | |
5132 | |
5133 (defun gnus-summary-describe-briefly () | |
5134 "Describe summary mode commands briefly." | |
5135 (interactive) | |
5136 (gnus-message 6 | |
5137 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help"))) | |
5138 | |
5139 ;; Walking around group mode buffer from summary mode. | |
5140 | |
5141 (defun gnus-summary-next-group (&optional no-article target-group backward) | |
5142 "Exit current newsgroup and then select next unread newsgroup. | |
5143 If prefix argument NO-ARTICLE is non-nil, no article is selected | |
5144 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to | |
5145 previous group instead." | |
5146 (interactive "P") | |
5147 (gnus-set-global-variables) | |
5148 ;; Stop pre-fetching. | |
5149 (gnus-async-halt-prefetch) | |
5150 (let ((current-group gnus-newsgroup-name) | |
5151 (current-buffer (current-buffer)) | |
5152 entered) | |
5153 ;; First we semi-exit this group to update Xrefs and all variables. | |
5154 ;; We can't do a real exit, because the window conf must remain | |
5155 ;; the same in case the user is prompted for info, and we don't | |
5156 ;; want the window conf to change before that... | |
5157 (gnus-summary-exit t) | |
5158 (while (not entered) | |
5159 ;; Then we find what group we are supposed to enter. | |
5160 (set-buffer gnus-group-buffer) | |
5161 (gnus-group-jump-to-group current-group) | |
5162 (setq target-group | |
5163 (or target-group | |
5164 (if (eq gnus-keep-same-level 'best) | |
5165 (gnus-summary-best-group gnus-newsgroup-name) | |
5166 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5167 (if (not target-group) | |
5168 ;; There are no further groups, so we return to the group | |
5169 ;; buffer. | |
5170 (progn | |
5171 (gnus-message 5 "Returning to the group buffer") | |
5172 (setq entered t) | |
5173 (when (gnus-buffer-live-p current-buffer) | |
5174 (set-buffer current-buffer) | |
5175 (gnus-summary-exit)) | |
5176 (run-hooks 'gnus-group-no-more-groups-hook)) | |
5177 ;; We try to enter the target group. | |
5178 (gnus-group-jump-to-group target-group) | |
5179 (let ((unreads (gnus-group-group-unread))) | |
5180 (if (and (or (eq t unreads) | |
5181 (and unreads (not (zerop unreads)))) | |
5182 (gnus-summary-read-group | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5183 target-group nil no-article |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5184 (and (buffer-name current-buffer) current-buffer))) |
17493 | 5185 (setq entered t) |
5186 (setq current-group target-group | |
5187 target-group nil))))))) | |
5188 | |
5189 (defun gnus-summary-prev-group (&optional no-article) | |
5190 "Exit current newsgroup and then select previous unread newsgroup. | |
5191 If prefix argument NO-ARTICLE is non-nil, no article is selected initially." | |
5192 (interactive "P") | |
5193 (gnus-summary-next-group no-article nil t)) | |
5194 | |
5195 ;; Walking around summary lines. | |
5196 | |
5197 (defun gnus-summary-first-subject (&optional unread) | |
5198 "Go to the first unread subject. | |
5199 If UNREAD is non-nil, go to the first unread article. | |
5200 Returns the article selected or nil if there are no unread articles." | |
5201 (interactive "P") | |
5202 (prog1 | |
5203 (cond | |
5204 ;; Empty summary. | |
5205 ((null gnus-newsgroup-data) | |
5206 (gnus-message 3 "No articles in the group") | |
5207 nil) | |
5208 ;; Pick the first article. | |
5209 ((not unread) | |
5210 (goto-char (gnus-data-pos (car gnus-newsgroup-data))) | |
5211 (gnus-data-number (car gnus-newsgroup-data))) | |
5212 ;; No unread articles. | |
5213 ((null gnus-newsgroup-unreads) | |
5214 (gnus-message 3 "No more unread articles") | |
5215 nil) | |
5216 ;; Find the first unread article. | |
5217 (t | |
5218 (let ((data gnus-newsgroup-data)) | |
5219 (while (and data | |
5220 (not (gnus-data-unread-p (car data)))) | |
5221 (setq data (cdr data))) | |
5222 (when data | |
5223 (goto-char (gnus-data-pos (car data))) | |
5224 (gnus-data-number (car data)))))) | |
5225 (gnus-summary-position-point))) | |
5226 | |
5227 (defun gnus-summary-next-subject (n &optional unread dont-display) | |
5228 "Go to next N'th summary line. | |
5229 If N is negative, go to the previous N'th subject line. | |
5230 If UNREAD is non-nil, only unread articles are selected. | |
5231 The difference between N and the actual number of steps taken is | |
5232 returned." | |
5233 (interactive "p") | |
5234 (let ((backward (< n 0)) | |
5235 (n (abs n))) | |
5236 (while (and (> n 0) | |
5237 (if backward | |
5238 (gnus-summary-find-prev unread) | |
5239 (gnus-summary-find-next unread))) | |
5240 (setq n (1- n))) | |
5241 (when (/= 0 n) | |
5242 (gnus-message 7 "No more%s articles" | |
5243 (if unread " unread" ""))) | |
5244 (unless dont-display | |
5245 (gnus-summary-recenter) | |
5246 (gnus-summary-position-point)) | |
5247 n)) | |
5248 | |
5249 (defun gnus-summary-next-unread-subject (n) | |
5250 "Go to next N'th unread summary line." | |
5251 (interactive "p") | |
5252 (gnus-summary-next-subject n t)) | |
5253 | |
5254 (defun gnus-summary-prev-subject (n &optional unread) | |
5255 "Go to previous N'th summary line. | |
5256 If optional argument UNREAD is non-nil, only unread article is selected." | |
5257 (interactive "p") | |
5258 (gnus-summary-next-subject (- n) unread)) | |
5259 | |
5260 (defun gnus-summary-prev-unread-subject (n) | |
5261 "Go to previous N'th unread summary line." | |
5262 (interactive "p") | |
5263 (gnus-summary-next-subject (- n) t)) | |
5264 | |
5265 (defun gnus-summary-goto-subject (article &optional force silent) | |
5266 "Go the subject line of ARTICLE. | |
5267 If FORCE, also allow jumping to articles not currently shown." | |
5268 (interactive "nArticle number: ") | |
5269 (let ((b (point)) | |
5270 (data (gnus-data-find article))) | |
5271 ;; We read in the article if we have to. | |
5272 (and (not data) | |
5273 force | |
5274 (gnus-summary-insert-subject article (and (vectorp force) force) t) | |
5275 (setq data (gnus-data-find article))) | |
5276 (goto-char b) | |
5277 (if (not data) | |
5278 (progn | |
5279 (unless silent | |
5280 (gnus-message 3 "Can't find article %d" article)) | |
5281 nil) | |
5282 (goto-char (gnus-data-pos data)) | |
5283 article))) | |
5284 | |
5285 ;; Walking around summary lines with displaying articles. | |
5286 | |
5287 (defun gnus-summary-expand-window (&optional arg) | |
5288 "Make the summary buffer take up the entire Emacs frame. | |
5289 Given a prefix, will force an `article' buffer configuration." | |
5290 (interactive "P") | |
5291 (gnus-set-global-variables) | |
5292 (if arg | |
5293 (gnus-configure-windows 'article 'force) | |
5294 (gnus-configure-windows 'summary 'force))) | |
5295 | |
5296 (defun gnus-summary-display-article (article &optional all-header) | |
5297 "Display ARTICLE in article buffer." | |
5298 (gnus-set-global-variables) | |
5299 (if (null article) | |
5300 nil | |
5301 (prog1 | |
5302 (if gnus-summary-display-article-function | |
5303 (funcall gnus-summary-display-article-function article all-header) | |
5304 (gnus-article-prepare article all-header)) | |
5305 (run-hooks 'gnus-select-article-hook) | |
5306 (when (and gnus-current-article | |
5307 (not (zerop gnus-current-article))) | |
5308 (gnus-summary-goto-subject gnus-current-article)) | |
5309 (gnus-summary-recenter) | |
5310 (when (and gnus-use-trees gnus-show-threads) | |
5311 (gnus-possibly-generate-tree article) | |
5312 (gnus-highlight-selected-tree article)) | |
5313 ;; Successfully display article. | |
5314 (gnus-article-set-window-start | |
5315 (cdr (assq article gnus-newsgroup-bookmarks)))))) | |
5316 | |
5317 (defun gnus-summary-select-article (&optional all-headers force pseudo article) | |
5318 "Select the current article. | |
5319 If ALL-HEADERS is non-nil, show all header fields. If FORCE is | |
5320 non-nil, the article will be re-fetched even if it already present in | |
5321 the article buffer. If PSEUDO is non-nil, pseudo-articles will also | |
5322 be displayed." | |
5323 ;; Make sure we are in the summary buffer to work around bbdb bug. | |
5324 (unless (eq major-mode 'gnus-summary-mode) | |
5325 (set-buffer gnus-summary-buffer)) | |
5326 (let ((article (or article (gnus-summary-article-number))) | |
5327 (all-headers (not (not all-headers))) ;Must be T or NIL. | |
5328 gnus-summary-display-article-function | |
5329 did) | |
5330 (and (not pseudo) | |
5331 (gnus-summary-article-pseudo-p article) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5332 (error "This is a pseudo-article")) |
17493 | 5333 (prog1 |
5334 (save-excursion | |
5335 (set-buffer gnus-summary-buffer) | |
5336 (if (or (and gnus-single-article-buffer | |
5337 (or (null gnus-current-article) | |
5338 (null gnus-article-current) | |
5339 (null (get-buffer gnus-article-buffer)) | |
5340 (not (eq article (cdr gnus-article-current))) | |
5341 (not (equal (car gnus-article-current) | |
5342 gnus-newsgroup-name)))) | |
5343 (and (not gnus-single-article-buffer) | |
5344 (or (null gnus-current-article) | |
5345 (not (eq gnus-current-article article)))) | |
5346 force) | |
5347 ;; The requested article is different from the current article. | |
5348 (prog1 | |
5349 (gnus-summary-display-article article all-headers) | |
5350 (setq did article)) | |
5351 (when (or all-headers gnus-show-all-headers) | |
5352 (gnus-article-show-all-headers)) | |
5353 'old)) | |
5354 (when did | |
5355 (gnus-article-set-window-start | |
5356 (cdr (assq article gnus-newsgroup-bookmarks))))))) | |
5357 | |
5358 (defun gnus-summary-set-current-mark (&optional current-mark) | |
5359 "Obsolete function." | |
5360 nil) | |
5361 | |
5362 (defun gnus-summary-next-article (&optional unread subject backward push) | |
5363 "Select the next article. | |
5364 If UNREAD, only unread articles are selected. | |
5365 If SUBJECT, only articles with SUBJECT are selected. | |
5366 If BACKWARD, the previous article is selected instead of the next." | |
5367 (interactive "P") | |
5368 (gnus-set-global-variables) | |
5369 (cond | |
5370 ;; Is there such an article? | |
5371 ((and (gnus-summary-search-forward unread subject backward) | |
5372 (or (gnus-summary-display-article (gnus-summary-article-number)) | |
5373 (eq (gnus-summary-article-mark) gnus-canceled-mark))) | |
5374 (gnus-summary-position-point)) | |
5375 ;; If not, we try the first unread, if that is wanted. | |
5376 ((and subject | |
5377 gnus-auto-select-same | |
5378 (gnus-summary-first-unread-article)) | |
5379 (gnus-summary-position-point) | |
5380 (gnus-message 6 "Wrapped")) | |
5381 ;; Try to get next/previous article not displayed in this group. | |
5382 ((and gnus-auto-extend-newsgroup | |
5383 (not unread) (not subject)) | |
5384 (gnus-summary-goto-article | |
5385 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end)) | |
5386 nil t)) | |
5387 ;; Go to next/previous group. | |
5388 (t | |
5389 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
5390 (gnus-summary-jump-to-group gnus-newsgroup-name)) | |
5391 (let ((cmd last-command-char) | |
5392 (point | |
5393 (save-excursion | |
5394 (set-buffer gnus-group-buffer) | |
5395 (point))) | |
5396 (group | |
5397 (if (eq gnus-keep-same-level 'best) | |
5398 (gnus-summary-best-group gnus-newsgroup-name) | |
5399 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5400 ;; For some reason, the group window gets selected. We change | |
5401 ;; it back. | |
5402 (select-window (get-buffer-window (current-buffer))) | |
5403 ;; Select next unread newsgroup automagically. | |
5404 (cond | |
5405 ((or (not gnus-auto-select-next) | |
5406 (not cmd)) | |
5407 (gnus-message 7 "No more%s articles" (if unread " unread" ""))) | |
5408 ((or (eq gnus-auto-select-next 'quietly) | |
5409 (and (eq gnus-auto-select-next 'slightly-quietly) | |
5410 push) | |
5411 (and (eq gnus-auto-select-next 'almost-quietly) | |
5412 (gnus-summary-last-article-p))) | |
5413 ;; Select quietly. | |
5414 (if (gnus-ephemeral-group-p gnus-newsgroup-name) | |
5415 (gnus-summary-exit) | |
5416 (gnus-message 7 "No more%s articles (%s)..." | |
5417 (if unread " unread" "") | |
5418 (if group (concat "selecting " group) | |
5419 "exiting")) | |
5420 (gnus-summary-next-group nil group backward))) | |
5421 (t | |
5422 (when (gnus-key-press-event-p last-input-event) | |
5423 (gnus-summary-walk-group-buffer | |
5424 gnus-newsgroup-name cmd unread backward point)))))))) | |
5425 | |
5426 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start) | |
5427 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1)) | |
5428 (?\C-p (gnus-group-prev-unread-group 1)))) | |
5429 (cursor-in-echo-area t) | |
5430 keve key group ended) | |
5431 (save-excursion | |
5432 (set-buffer gnus-group-buffer) | |
5433 (goto-char start) | |
5434 (setq group | |
5435 (if (eq gnus-keep-same-level 'best) | |
5436 (gnus-summary-best-group gnus-newsgroup-name) | |
5437 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5438 (while (not ended) | |
5439 (gnus-message | |
5440 5 "No more%s articles%s" (if unread " unread" "") | |
5441 (if (and group | |
5442 (not (gnus-ephemeral-group-p gnus-newsgroup-name))) | |
5443 (format " (Type %s for %s [%s])" | |
5444 (single-key-description cmd) group | |
5445 (car (gnus-gethash group gnus-newsrc-hashtb))) | |
5446 (format " (Type %s to exit %s)" | |
5447 (single-key-description cmd) | |
5448 gnus-newsgroup-name))) | |
5449 ;; Confirm auto selection. | |
5450 (setq key (car (setq keve (gnus-read-event-char)))) | |
5451 (setq ended t) | |
5452 (cond | |
5453 ((assq key keystrokes) | |
5454 (let ((obuf (current-buffer))) | |
5455 (switch-to-buffer gnus-group-buffer) | |
5456 (when group | |
5457 (gnus-group-jump-to-group group)) | |
5458 (eval (cadr (assq key keystrokes))) | |
5459 (setq group (gnus-group-group-name)) | |
5460 (switch-to-buffer obuf)) | |
5461 (setq ended nil)) | |
5462 ((equal key cmd) | |
5463 (if (or (not group) | |
5464 (gnus-ephemeral-group-p gnus-newsgroup-name)) | |
5465 (gnus-summary-exit) | |
5466 (gnus-summary-next-group nil group backward))) | |
5467 (t | |
5468 (push (cdr keve) unread-command-events)))))) | |
5469 | |
5470 (defun gnus-summary-next-unread-article () | |
5471 "Select unread article after current one." | |
5472 (interactive) | |
5473 (gnus-summary-next-article | |
5474 (or (not (eq gnus-summary-goto-unread 'never)) | |
5475 (gnus-summary-last-article-p (gnus-summary-article-number))) | |
5476 (and gnus-auto-select-same | |
5477 (gnus-summary-article-subject)))) | |
5478 | |
5479 (defun gnus-summary-prev-article (&optional unread subject) | |
5480 "Select the article after the current one. | |
5481 If UNREAD is non-nil, only unread articles are selected." | |
5482 (interactive "P") | |
5483 (gnus-summary-next-article unread subject t)) | |
5484 | |
5485 (defun gnus-summary-prev-unread-article () | |
5486 "Select unread article before current one." | |
5487 (interactive) | |
5488 (gnus-summary-prev-article | |
5489 (or (not (eq gnus-summary-goto-unread 'never)) | |
5490 (gnus-summary-first-article-p (gnus-summary-article-number))) | |
5491 (and gnus-auto-select-same | |
5492 (gnus-summary-article-subject)))) | |
5493 | |
5494 (defun gnus-summary-next-page (&optional lines circular) | |
5495 "Show next page of the selected article. | |
5496 If at the end of the current article, select the next article. | |
5497 LINES says how many lines should be scrolled up. | |
5498 | |
5499 If CIRCULAR is non-nil, go to the start of the article instead of | |
5500 selecting the next article when reaching the end of the current | |
5501 article." | |
5502 (interactive "P") | |
5503 (setq gnus-summary-buffer (current-buffer)) | |
5504 (gnus-set-global-variables) | |
5505 (let ((article (gnus-summary-article-number)) | |
5506 (article-window (get-buffer-window gnus-article-buffer t)) | |
5507 endp) | |
5508 (gnus-configure-windows 'article) | |
5509 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark) | |
5510 (if (and (eq gnus-summary-goto-unread 'never) | |
5511 (not (gnus-summary-last-article-p article))) | |
5512 (gnus-summary-next-article) | |
5513 (gnus-summary-next-unread-article)) | |
5514 (if (or (null gnus-current-article) | |
5515 (null gnus-article-current) | |
5516 (/= article (cdr gnus-article-current)) | |
5517 (not (equal (car gnus-article-current) gnus-newsgroup-name))) | |
5518 ;; Selected subject is different from current article's. | |
5519 (gnus-summary-display-article article) | |
5520 (when article-window | |
5521 (gnus-eval-in-buffer-window gnus-article-buffer | |
5522 (setq endp (gnus-article-next-page lines))) | |
5523 (when endp | |
5524 (cond (circular | |
5525 (gnus-summary-beginning-of-article)) | |
5526 (lines | |
5527 (gnus-message 3 "End of message")) | |
5528 ((null lines) | |
5529 (if (and (eq gnus-summary-goto-unread 'never) | |
5530 (not (gnus-summary-last-article-p article))) | |
5531 (gnus-summary-next-article) | |
5532 (gnus-summary-next-unread-article)))))))) | |
5533 (gnus-summary-recenter) | |
5534 (gnus-summary-position-point))) | |
5535 | |
5536 (defun gnus-summary-prev-page (&optional lines move) | |
5537 "Show previous page of selected article. | |
5538 Argument LINES specifies lines to be scrolled down. | |
5539 If MOVE, move to the previous unread article if point is at | |
5540 the beginning of the buffer." | |
5541 (interactive "P") | |
5542 (gnus-set-global-variables) | |
5543 (let ((article (gnus-summary-article-number)) | |
5544 (article-window (get-buffer-window gnus-article-buffer t)) | |
5545 endp) | |
5546 (gnus-configure-windows 'article) | |
5547 (if (or (null gnus-current-article) | |
5548 (null gnus-article-current) | |
5549 (/= article (cdr gnus-article-current)) | |
5550 (not (equal (car gnus-article-current) gnus-newsgroup-name))) | |
5551 ;; Selected subject is different from current article's. | |
5552 (gnus-summary-display-article article) | |
5553 (gnus-summary-recenter) | |
5554 (when article-window | |
5555 (gnus-eval-in-buffer-window gnus-article-buffer | |
5556 (setq endp (gnus-article-prev-page lines))) | |
5557 (when (and move endp) | |
5558 (cond (lines | |
5559 (gnus-message 3 "Beginning of message")) | |
5560 ((null lines) | |
5561 (if (and (eq gnus-summary-goto-unread 'never) | |
5562 (not (gnus-summary-first-article-p article))) | |
5563 (gnus-summary-prev-article) | |
5564 (gnus-summary-prev-unread-article)))))))) | |
5565 (gnus-summary-position-point)) | |
5566 | |
5567 (defun gnus-summary-prev-page-or-article (&optional lines) | |
5568 "Show previous page of selected article. | |
5569 Argument LINES specifies lines to be scrolled down. | |
5570 If at the beginning of the article, go to the next article." | |
5571 (interactive "P") | |
5572 (gnus-summary-prev-page lines t)) | |
5573 | |
5574 (defun gnus-summary-scroll-up (lines) | |
5575 "Scroll up (or down) one line current article. | |
5576 Argument LINES specifies lines to be scrolled up (or down if negative)." | |
5577 (interactive "p") | |
5578 (gnus-set-global-variables) | |
5579 (gnus-configure-windows 'article) | |
5580 (gnus-summary-show-thread) | |
5581 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old) | |
5582 (gnus-eval-in-buffer-window gnus-article-buffer | |
5583 (cond ((> lines 0) | |
5584 (when (gnus-article-next-page lines) | |
5585 (gnus-message 3 "End of message"))) | |
5586 ((< lines 0) | |
5587 (gnus-article-prev-page (- lines)))))) | |
5588 (gnus-summary-recenter) | |
5589 (gnus-summary-position-point)) | |
5590 | |
5591 (defun gnus-summary-next-same-subject () | |
5592 "Select next article which has the same subject as current one." | |
5593 (interactive) | |
5594 (gnus-set-global-variables) | |
5595 (gnus-summary-next-article nil (gnus-summary-article-subject))) | |
5596 | |
5597 (defun gnus-summary-prev-same-subject () | |
5598 "Select previous article which has the same subject as current one." | |
5599 (interactive) | |
5600 (gnus-set-global-variables) | |
5601 (gnus-summary-prev-article nil (gnus-summary-article-subject))) | |
5602 | |
5603 (defun gnus-summary-next-unread-same-subject () | |
5604 "Select next unread article which has the same subject as current one." | |
5605 (interactive) | |
5606 (gnus-set-global-variables) | |
5607 (gnus-summary-next-article t (gnus-summary-article-subject))) | |
5608 | |
5609 (defun gnus-summary-prev-unread-same-subject () | |
5610 "Select previous unread article which has the same subject as current one." | |
5611 (interactive) | |
5612 (gnus-set-global-variables) | |
5613 (gnus-summary-prev-article t (gnus-summary-article-subject))) | |
5614 | |
5615 (defun gnus-summary-first-unread-article () | |
5616 "Select the first unread article. | |
5617 Return nil if there are no unread articles." | |
5618 (interactive) | |
5619 (gnus-set-global-variables) | |
5620 (prog1 | |
5621 (when (gnus-summary-first-subject t) | |
5622 (gnus-summary-show-thread) | |
5623 (gnus-summary-first-subject t) | |
5624 (gnus-summary-display-article (gnus-summary-article-number))) | |
5625 (gnus-summary-position-point))) | |
5626 | |
5627 (defun gnus-summary-first-article () | |
5628 "Select the first article. | |
5629 Return nil if there are no articles." | |
5630 (interactive) | |
5631 (gnus-set-global-variables) | |
5632 (prog1 | |
5633 (when (gnus-summary-first-subject) | |
5634 (gnus-summary-show-thread) | |
5635 (gnus-summary-first-subject) | |
5636 (gnus-summary-display-article (gnus-summary-article-number))) | |
5637 (gnus-summary-position-point))) | |
5638 | |
5639 (defun gnus-summary-best-unread-article () | |
5640 "Select the unread article with the highest score." | |
5641 (interactive) | |
5642 (gnus-set-global-variables) | |
5643 (let ((best -1000000) | |
5644 (data gnus-newsgroup-data) | |
5645 article score) | |
5646 (while data | |
5647 (and (gnus-data-unread-p (car data)) | |
5648 (> (setq score | |
5649 (gnus-summary-article-score (gnus-data-number (car data)))) | |
5650 best) | |
5651 (setq best score | |
5652 article (gnus-data-number (car data)))) | |
5653 (setq data (cdr data))) | |
5654 (prog1 | |
5655 (if article | |
5656 (gnus-summary-goto-article article) | |
5657 (error "No unread articles")) | |
5658 (gnus-summary-position-point)))) | |
5659 | |
5660 (defun gnus-summary-last-subject () | |
5661 "Go to the last displayed subject line in the group." | |
5662 (let ((article (gnus-data-number (car (gnus-data-list t))))) | |
5663 (when article | |
5664 (gnus-summary-goto-subject article)))) | |
5665 | |
5666 (defun gnus-summary-goto-article (article &optional all-headers force) | |
5667 "Fetch ARTICLE and display it if it exists. | |
5668 If ALL-HEADERS is non-nil, no header lines are hidden." | |
5669 (interactive | |
5670 (list | |
5671 (string-to-int | |
5672 (completing-read | |
5673 "Article number: " | |
5674 (mapcar (lambda (number) (list (int-to-string number))) | |
5675 gnus-newsgroup-limit))) | |
5676 current-prefix-arg | |
5677 t)) | |
5678 (prog1 | |
5679 (if (gnus-summary-goto-subject article force) | |
5680 (gnus-summary-display-article article all-headers) | |
5681 (gnus-message 4 "Couldn't go to article %s" article) nil) | |
5682 (gnus-summary-position-point))) | |
5683 | |
5684 (defun gnus-summary-goto-last-article () | |
5685 "Go to the previously read article." | |
5686 (interactive) | |
5687 (prog1 | |
5688 (when gnus-last-article | |
5689 (gnus-summary-goto-article gnus-last-article)) | |
5690 (gnus-summary-position-point))) | |
5691 | |
5692 (defun gnus-summary-pop-article (number) | |
5693 "Pop one article off the history and go to the previous. | |
5694 NUMBER articles will be popped off." | |
5695 (interactive "p") | |
5696 (let (to) | |
5697 (setq gnus-newsgroup-history | |
5698 (cdr (setq to (nthcdr number gnus-newsgroup-history)))) | |
5699 (if to | |
5700 (gnus-summary-goto-article (car to)) | |
5701 (error "Article history empty"))) | |
5702 (gnus-summary-position-point)) | |
5703 | |
5704 ;; Summary commands and functions for limiting the summary buffer. | |
5705 | |
5706 (defun gnus-summary-limit-to-articles (n) | |
5707 "Limit the summary buffer to the next N articles. | |
5708 If not given a prefix, use the process marked articles instead." | |
5709 (interactive "P") | |
5710 (gnus-set-global-variables) | |
5711 (prog1 | |
5712 (let ((articles (gnus-summary-work-articles n))) | |
5713 (setq gnus-newsgroup-processable nil) | |
5714 (gnus-summary-limit articles)) | |
5715 (gnus-summary-position-point))) | |
5716 | |
5717 (defun gnus-summary-pop-limit (&optional total) | |
5718 "Restore the previous limit. | |
5719 If given a prefix, remove all limits." | |
5720 (interactive "P") | |
5721 (gnus-set-global-variables) | |
5722 (when total | |
5723 (setq gnus-newsgroup-limits | |
5724 (list (mapcar (lambda (h) (mail-header-number h)) | |
5725 gnus-newsgroup-headers)))) | |
5726 (unless gnus-newsgroup-limits | |
5727 (error "No limit to pop")) | |
5728 (prog1 | |
5729 (gnus-summary-limit nil 'pop) | |
5730 (gnus-summary-position-point))) | |
5731 | |
5732 (defun gnus-summary-limit-to-subject (subject &optional header) | |
5733 "Limit the summary buffer to articles that have subjects that match a regexp." | |
5734 (interactive "sLimit to subject (regexp): ") | |
5735 (unless header | |
5736 (setq header "subject")) | |
5737 (when (not (equal "" subject)) | |
5738 (prog1 | |
5739 (let ((articles (gnus-summary-find-matching | |
5740 (or header "subject") subject 'all))) | |
5741 (unless articles | |
5742 (error "Found no matches for \"%s\"" subject)) | |
5743 (gnus-summary-limit articles)) | |
5744 (gnus-summary-position-point)))) | |
5745 | |
5746 (defun gnus-summary-limit-to-author (from) | |
5747 "Limit the summary buffer to articles that have authors that match a regexp." | |
5748 (interactive "sLimit to author (regexp): ") | |
5749 (gnus-summary-limit-to-subject from "from")) | |
5750 | |
5751 (defun gnus-summary-limit-to-age (age &optional younger-p) | |
5752 "Limit the summary buffer to articles that are older than (or equal) AGE days. | |
5753 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to | |
5754 articles that are younger than AGE days." | |
5755 (interactive "nTime in days: \nP") | |
5756 (prog1 | |
5757 (let ((data gnus-newsgroup-data) | |
5758 (cutoff (nnmail-days-to-time age)) | |
5759 articles d date is-younger) | |
5760 (while (setq d (pop data)) | |
5761 (when (and (vectorp (gnus-data-header d)) | |
5762 (setq date (mail-header-date (gnus-data-header d)))) | |
5763 (setq is-younger (nnmail-time-less | |
5764 (nnmail-time-since (nnmail-date-to-time date)) | |
5765 cutoff)) | |
5766 (when (if younger-p is-younger (not is-younger)) | |
5767 (push (gnus-data-number d) articles)))) | |
5768 (gnus-summary-limit (nreverse articles))) | |
5769 (gnus-summary-position-point))) | |
5770 | |
5771 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread) | |
5772 (make-obsolete | |
5773 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread) | |
5774 | |
5775 (defun gnus-summary-limit-to-unread (&optional all) | |
5776 "Limit the summary buffer to articles that are not marked as read. | |
5777 If ALL is non-nil, limit strictly to unread articles." | |
5778 (interactive "P") | |
5779 (if all | |
5780 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark)) | |
5781 (gnus-summary-limit-to-marks | |
5782 ;; Concat all the marks that say that an article is read and have | |
5783 ;; those removed. | |
5784 (list gnus-del-mark gnus-read-mark gnus-ancient-mark | |
5785 gnus-killed-mark gnus-kill-file-mark | |
5786 gnus-low-score-mark gnus-expirable-mark | |
5787 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark | |
5788 gnus-duplicate-mark gnus-souped-mark) | |
5789 'reverse))) | |
5790 | |
5791 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks) | |
5792 (make-obsolete 'gnus-summary-delete-marked-with | |
5793 'gnus-summary-limit-exlude-marks) | |
5794 | |
5795 (defun gnus-summary-limit-exclude-marks (marks &optional reverse) | |
5796 "Exclude articles that are marked with MARKS (e.g. \"DK\"). | |
5797 If REVERSE, limit the summary buffer to articles that are marked | |
5798 with MARKS. MARKS can either be a string of marks or a list of marks. | |
5799 Returns how many articles were removed." | |
5800 (interactive "sMarks: ") | |
5801 (gnus-summary-limit-to-marks marks t)) | |
5802 | |
5803 (defun gnus-summary-limit-to-marks (marks &optional reverse) | |
5804 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\"). | |
5805 If REVERSE (the prefix), limit the summary buffer to articles that are | |
5806 not marked with MARKS. MARKS can either be a string of marks or a | |
5807 list of marks. | |
5808 Returns how many articles were removed." | |
5809 (interactive (list (read-string "Marks: ") current-prefix-arg)) | |
5810 (gnus-set-global-variables) | |
5811 (prog1 | |
5812 (let ((data gnus-newsgroup-data) | |
5813 (marks (if (listp marks) marks | |
5814 (append marks nil))) ; Transform to list. | |
5815 articles) | |
5816 (while data | |
5817 (when (if reverse (not (memq (gnus-data-mark (car data)) marks)) | |
5818 (memq (gnus-data-mark (car data)) marks)) | |
5819 (push (gnus-data-number (car data)) articles)) | |
5820 (setq data (cdr data))) | |
5821 (gnus-summary-limit articles)) | |
5822 (gnus-summary-position-point))) | |
5823 | |
5824 (defun gnus-summary-limit-to-score (&optional score) | |
5825 "Limit to articles with score at or above SCORE." | |
5826 (interactive "P") | |
5827 (gnus-set-global-variables) | |
5828 (setq score (if score | |
5829 (prefix-numeric-value score) | |
5830 (or gnus-summary-default-score 0))) | |
5831 (let ((data gnus-newsgroup-data) | |
5832 articles) | |
5833 (while data | |
5834 (when (>= (gnus-summary-article-score (gnus-data-number (car data))) | |
5835 score) | |
5836 (push (gnus-data-number (car data)) articles)) | |
5837 (setq data (cdr data))) | |
5838 (prog1 | |
5839 (gnus-summary-limit articles) | |
5840 (gnus-summary-position-point)))) | |
5841 | |
5842 (defun gnus-summary-limit-include-dormant () | |
5843 "Display all the hidden articles that are marked as dormant." | |
5844 (interactive) | |
5845 (gnus-set-global-variables) | |
5846 (unless gnus-newsgroup-dormant | |
5847 (error "There are no dormant articles in this group")) | |
5848 (prog1 | |
5849 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit)) | |
5850 (gnus-summary-position-point))) | |
5851 | |
5852 (defun gnus-summary-limit-exclude-dormant () | |
5853 "Hide all dormant articles." | |
5854 (interactive) | |
5855 (gnus-set-global-variables) | |
5856 (prog1 | |
5857 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse) | |
5858 (gnus-summary-position-point))) | |
5859 | |
5860 (defun gnus-summary-limit-exclude-childless-dormant () | |
5861 "Hide all dormant articles that have no children." | |
5862 (interactive) | |
5863 (gnus-set-global-variables) | |
5864 (let ((data (gnus-data-list t)) | |
5865 articles d children) | |
5866 ;; Find all articles that are either not dormant or have | |
5867 ;; children. | |
5868 (while (setq d (pop data)) | |
5869 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark)) | |
5870 (and (setq children | |
5871 (gnus-article-children (gnus-data-number d))) | |
5872 (let (found) | |
5873 (while children | |
5874 (when (memq (car children) articles) | |
5875 (setq children nil | |
5876 found t)) | |
5877 (pop children)) | |
5878 found))) | |
5879 (push (gnus-data-number d) articles))) | |
5880 ;; Do the limiting. | |
5881 (prog1 | |
5882 (gnus-summary-limit articles) | |
5883 (gnus-summary-position-point)))) | |
5884 | |
5885 (defun gnus-summary-limit-mark-excluded-as-read (&optional all) | |
5886 "Mark all unread excluded articles as read. | |
5887 If ALL, mark even excluded ticked and dormants as read." | |
5888 (interactive "P") | |
5889 (let ((articles (gnus-sorted-complement | |
5890 (sort | |
5891 (mapcar (lambda (h) (mail-header-number h)) | |
5892 gnus-newsgroup-headers) | |
5893 '<) | |
5894 (sort gnus-newsgroup-limit '<))) | |
5895 article) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5896 (setq gnus-newsgroup-unreads gnus-newsgroup-limit) |
17493 | 5897 (if all |
5898 (setq gnus-newsgroup-dormant nil | |
5899 gnus-newsgroup-marked nil | |
5900 gnus-newsgroup-reads | |
5901 (nconc | |
5902 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles) | |
5903 gnus-newsgroup-reads)) | |
5904 (while (setq article (pop articles)) | |
5905 (unless (or (memq article gnus-newsgroup-dormant) | |
5906 (memq article gnus-newsgroup-marked)) | |
5907 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads)))))) | |
5908 | |
5909 (defun gnus-summary-limit (articles &optional pop) | |
5910 (if pop | |
5911 ;; We pop the previous limit off the stack and use that. | |
5912 (setq articles (car gnus-newsgroup-limits) | |
5913 gnus-newsgroup-limits (cdr gnus-newsgroup-limits)) | |
5914 ;; We use the new limit, so we push the old limit on the stack. | |
5915 (push gnus-newsgroup-limit gnus-newsgroup-limits)) | |
5916 ;; Set the limit. | |
5917 (setq gnus-newsgroup-limit articles) | |
5918 (let ((total (length gnus-newsgroup-data)) | |
5919 (data (gnus-data-find-list (gnus-summary-article-number))) | |
5920 (gnus-summary-mark-below nil) ; Inhibit this. | |
5921 found) | |
5922 ;; This will do all the work of generating the new summary buffer | |
5923 ;; according to the new limit. | |
5924 (gnus-summary-prepare) | |
5925 ;; Hide any threads, possibly. | |
5926 (and gnus-show-threads | |
5927 gnus-thread-hide-subtree | |
5928 (gnus-summary-hide-all-threads)) | |
5929 ;; Try to return to the article you were at, or one in the | |
5930 ;; neighborhood. | |
5931 (when data | |
5932 ;; We try to find some article after the current one. | |
5933 (while data | |
5934 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t) | |
5935 (setq data nil | |
5936 found t)) | |
5937 (setq data (cdr data)))) | |
5938 (unless found | |
5939 ;; If there is no data, that means that we were after the last | |
5940 ;; article. The same goes when we can't find any articles | |
5941 ;; after the current one. | |
5942 (goto-char (point-max)) | |
5943 (gnus-summary-find-prev)) | |
5944 ;; We return how many articles were removed from the summary | |
5945 ;; buffer as a result of the new limit. | |
5946 (- total (length gnus-newsgroup-data)))) | |
5947 | |
5948 (defsubst gnus-invisible-cut-children (threads) | |
5949 (let ((num 0)) | |
5950 (while threads | |
5951 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit) | |
5952 (incf num)) | |
5953 (pop threads)) | |
5954 (< num 2))) | |
5955 | |
5956 (defsubst gnus-cut-thread (thread) | |
5957 "Go forwards in the thread until we find an article that we want to display." | |
5958 (when (or (eq gnus-fetch-old-headers 'some) | |
5959 (eq gnus-build-sparse-threads 'some) | |
5960 (eq gnus-build-sparse-threads 'more)) | |
5961 ;; Deal with old-fetched headers and sparse threads. | |
5962 (while (and | |
5963 thread | |
5964 (or | |
5965 (gnus-summary-article-sparse-p (mail-header-number (car thread))) | |
5966 (gnus-summary-article-ancient-p | |
5967 (mail-header-number (car thread)))) | |
5968 (progn | |
5969 (if (<= (length (cdr thread)) 1) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5970 (setq gnus-newsgroup-limit |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5971 (delq (mail-header-number (car thread)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5972 gnus-newsgroup-limit) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5973 thread (cadr thread)) |
17493 | 5974 (when (gnus-invisible-cut-children (cdr thread)) |
5975 (let ((th (cdr thread))) | |
5976 (while th | |
5977 (if (memq (mail-header-number (caar th)) | |
5978 gnus-newsgroup-limit) | |
5979 (setq thread (car th) | |
5980 th nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5981 (setq th (cdr th))))))))))) |
17493 | 5982 thread) |
5983 | |
5984 (defun gnus-cut-threads (threads) | |
5985 "Cut off all uninteresting articles from the beginning of threads." | |
5986 (when (or (eq gnus-fetch-old-headers 'some) | |
5987 (eq gnus-build-sparse-threads 'some) | |
5988 (eq gnus-build-sparse-threads 'more)) | |
5989 (let ((th threads)) | |
5990 (while th | |
5991 (setcar th (gnus-cut-thread (car th))) | |
5992 (setq th (cdr th))))) | |
5993 ;; Remove nixed out threads. | |
5994 (delq nil threads)) | |
5995 | |
5996 (defun gnus-summary-initial-limit (&optional show-if-empty) | |
5997 "Figure out what the initial limit is supposed to be on group entry. | |
5998 This entails weeding out unwanted dormants, low-scored articles, | |
5999 fetch-old-headers verbiage, and so on." | |
6000 ;; Most groups have nothing to remove. | |
6001 (if (or gnus-inhibit-limiting | |
6002 (and (null gnus-newsgroup-dormant) | |
6003 (not (eq gnus-fetch-old-headers 'some)) | |
6004 (null gnus-summary-expunge-below) | |
6005 (not (eq gnus-build-sparse-threads 'some)) | |
6006 (not (eq gnus-build-sparse-threads 'more)) | |
6007 (null gnus-thread-expunge-below) | |
6008 (not gnus-use-nocem))) | |
6009 () ; Do nothing. | |
6010 (push gnus-newsgroup-limit gnus-newsgroup-limits) | |
6011 (setq gnus-newsgroup-limit nil) | |
6012 (mapatoms | |
6013 (lambda (node) | |
6014 (unless (car (symbol-value node)) | |
6015 ;; These threads have no parents -- they are roots. | |
6016 (let ((nodes (cdr (symbol-value node))) | |
6017 thread) | |
6018 (while nodes | |
6019 (if (and gnus-thread-expunge-below | |
6020 (< (gnus-thread-total-score (car nodes)) | |
6021 gnus-thread-expunge-below)) | |
6022 (gnus-expunge-thread (pop nodes)) | |
6023 (setq thread (pop nodes)) | |
6024 (gnus-summary-limit-children thread)))))) | |
6025 gnus-newsgroup-dependencies) | |
6026 ;; If this limitation resulted in an empty group, we might | |
6027 ;; pop the previous limit and use it instead. | |
6028 (when (and (not gnus-newsgroup-limit) | |
6029 show-if-empty) | |
6030 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits))) | |
6031 gnus-newsgroup-limit)) | |
6032 | |
6033 (defun gnus-summary-limit-children (thread) | |
6034 "Return 1 if this subthread is visible and 0 if it is not." | |
6035 ;; First we get the number of visible children to this thread. This | |
6036 ;; is done by recursing down the thread using this function, so this | |
6037 ;; will really go down to a leaf article first, before slowly | |
6038 ;; working its way up towards the root. | |
6039 (when thread | |
6040 (let ((children | |
6041 (if (cdr thread) | |
6042 (apply '+ (mapcar 'gnus-summary-limit-children | |
6043 (cdr thread))) | |
6044 0)) | |
6045 (number (mail-header-number (car thread))) | |
6046 score) | |
6047 (if (and | |
6048 (not (memq number gnus-newsgroup-marked)) | |
6049 (or | |
6050 ;; If this article is dormant and has absolutely no visible | |
6051 ;; children, then this article isn't visible. | |
6052 (and (memq number gnus-newsgroup-dormant) | |
6053 (zerop children)) | |
6054 ;; If this is "fetch-old-headered" and there is no | |
6055 ;; visible children, then we don't want this article. | |
6056 (and (eq gnus-fetch-old-headers 'some) | |
6057 (gnus-summary-article-ancient-p number) | |
6058 (zerop children)) | |
6059 ;; If this is a sparsely inserted article with no children, | |
6060 ;; we don't want it. | |
6061 (and (eq gnus-build-sparse-threads 'some) | |
6062 (gnus-summary-article-sparse-p number) | |
6063 (zerop children)) | |
6064 ;; If we use expunging, and this article is really | |
6065 ;; low-scored, then we don't want this article. | |
6066 (when (and gnus-summary-expunge-below | |
6067 (< (setq score | |
6068 (or (cdr (assq number gnus-newsgroup-scored)) | |
6069 gnus-summary-default-score)) | |
6070 gnus-summary-expunge-below)) | |
6071 ;; We increase the expunge-tally here, but that has | |
6072 ;; nothing to do with the limits, really. | |
6073 (incf gnus-newsgroup-expunged-tally) | |
6074 ;; We also mark as read here, if that's wanted. | |
6075 (when (and gnus-summary-mark-below | |
6076 (< score gnus-summary-mark-below)) | |
6077 (setq gnus-newsgroup-unreads | |
6078 (delq number gnus-newsgroup-unreads)) | |
6079 (if gnus-newsgroup-auto-expire | |
6080 (push number gnus-newsgroup-expirable) | |
6081 (push (cons number gnus-low-score-mark) | |
6082 gnus-newsgroup-reads))) | |
6083 t) | |
6084 ;; Check NoCeM things. | |
6085 (if (and gnus-use-nocem | |
6086 (gnus-nocem-unwanted-article-p | |
6087 (mail-header-id (car thread)))) | |
6088 (progn | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6089 (setq gnus-newsgroup-unreads |
17493 | 6090 (delq number gnus-newsgroup-unreads)) |
6091 t)))) | |
6092 ;; Nope, invisible article. | |
6093 0 | |
6094 ;; Ok, this article is to be visible, so we add it to the limit | |
6095 ;; and return 1. | |
6096 (push number gnus-newsgroup-limit) | |
6097 1)))) | |
6098 | |
6099 (defun gnus-expunge-thread (thread) | |
6100 "Mark all articles in THREAD as read." | |
6101 (let* ((number (mail-header-number (car thread)))) | |
6102 (incf gnus-newsgroup-expunged-tally) | |
6103 ;; We also mark as read here, if that's wanted. | |
6104 (setq gnus-newsgroup-unreads | |
6105 (delq number gnus-newsgroup-unreads)) | |
6106 (if gnus-newsgroup-auto-expire | |
6107 (push number gnus-newsgroup-expirable) | |
6108 (push (cons number gnus-low-score-mark) | |
6109 gnus-newsgroup-reads))) | |
6110 ;; Go recursively through all subthreads. | |
6111 (mapcar 'gnus-expunge-thread (cdr thread))) | |
6112 | |
6113 ;; Summary article oriented commands | |
6114 | |
6115 (defun gnus-summary-refer-parent-article (n) | |
6116 "Refer parent article N times. | |
6117 If N is negative, go to ancestor -N instead. | |
6118 The difference between N and the number of articles fetched is returned." | |
6119 (interactive "p") | |
6120 (gnus-set-global-variables) | |
6121 (let ((skip 1) | |
6122 error header ref) | |
6123 (when (not (natnump n)) | |
6124 (setq skip (abs n) | |
6125 n 1)) | |
6126 (while (and (> n 0) | |
6127 (not error)) | |
6128 (setq header (gnus-summary-article-header)) | |
6129 (if (and (eq (mail-header-number header) | |
6130 (cdr gnus-article-current)) | |
6131 (equal gnus-newsgroup-name | |
6132 (car gnus-article-current))) | |
6133 ;; If we try to find the parent of the currently | |
6134 ;; displayed article, then we take a look at the actual | |
6135 ;; References header, since this is slightly more | |
6136 ;; reliable than the References field we got from the | |
6137 ;; server. | |
6138 (save-excursion | |
6139 (set-buffer gnus-original-article-buffer) | |
6140 (nnheader-narrow-to-headers) | |
6141 (unless (setq ref (message-fetch-field "references")) | |
6142 (setq ref (message-fetch-field "in-reply-to"))) | |
6143 (widen)) | |
6144 (setq ref | |
6145 ;; It's not the current article, so we take a bet on | |
6146 ;; the value we got from the server. | |
6147 (mail-header-references header))) | |
6148 (if (and ref | |
6149 (not (equal ref ""))) | |
6150 (unless (gnus-summary-refer-article (gnus-parent-id ref skip)) | |
6151 (gnus-message 1 "Couldn't find parent")) | |
6152 (gnus-message 1 "No references in article %d" | |
6153 (gnus-summary-article-number)) | |
6154 (setq error t)) | |
6155 (decf n)) | |
6156 (gnus-summary-position-point) | |
6157 n)) | |
6158 | |
6159 (defun gnus-summary-refer-references () | |
6160 "Fetch all articles mentioned in the References header. | |
6161 Return how many articles were fetched." | |
6162 (interactive) | |
6163 (gnus-set-global-variables) | |
6164 (let ((ref (mail-header-references (gnus-summary-article-header))) | |
6165 (current (gnus-summary-article-number)) | |
6166 (n 0)) | |
6167 (if (or (not ref) | |
6168 (equal ref "")) | |
6169 (error "No References in the current article") | |
6170 ;; For each Message-ID in the References header... | |
6171 (while (string-match "<[^>]*>" ref) | |
6172 (incf n) | |
6173 ;; ... fetch that article. | |
6174 (gnus-summary-refer-article | |
6175 (prog1 (match-string 0 ref) | |
6176 (setq ref (substring ref (match-end 0)))))) | |
6177 (gnus-summary-goto-subject current) | |
6178 (gnus-summary-position-point) | |
6179 n))) | |
6180 | |
6181 (defun gnus-summary-refer-article (message-id &optional arg) | |
6182 "Fetch an article specified by MESSAGE-ID. | |
6183 If ARG (the prefix), fetch the article using `gnus-refer-article-method' | |
6184 or `gnus-select-method', no matter what backend the article comes from." | |
6185 (interactive "sMessage-ID: \nP") | |
6186 (when (and (stringp message-id) | |
6187 (not (zerop (length message-id)))) | |
6188 ;; Construct the correct Message-ID if necessary. | |
6189 ;; Suggested by tale@pawl.rpi.edu. | |
6190 (unless (string-match "^<" message-id) | |
6191 (setq message-id (concat "<" message-id))) | |
6192 (unless (string-match ">$" message-id) | |
6193 (setq message-id (concat message-id ">"))) | |
6194 (let* ((header (gnus-id-to-header message-id)) | |
6195 (sparse (and header | |
6196 (gnus-summary-article-sparse-p | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6197 (mail-header-number header)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6198 (memq (mail-header-number header) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6199 gnus-newsgroup-limit)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6200 (if (and header |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6201 (or (not (gnus-summary-article-sparse-p |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6202 (mail-header-number header))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6203 sparse)) |
17493 | 6204 (prog1 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6205 ;; The article is present in the buffer, so we just go to it. |
17493 | 6206 (gnus-summary-goto-article |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6207 (mail-header-number header) nil t) |
17493 | 6208 (when sparse |
6209 (gnus-summary-update-article (mail-header-number header)))) | |
6210 ;; We fetch the article | |
6211 (let ((gnus-override-method | |
6212 (cond ((gnus-news-group-p gnus-newsgroup-name) | |
6213 gnus-refer-article-method) | |
6214 (arg | |
6215 (or gnus-refer-article-method gnus-select-method)) | |
6216 (t nil))) | |
6217 number) | |
6218 ;; Start the special refer-article method, if necessary. | |
6219 (when (and gnus-refer-article-method | |
6220 (gnus-news-group-p gnus-newsgroup-name)) | |
6221 (gnus-check-server gnus-refer-article-method)) | |
6222 ;; Fetch the header, and display the article. | |
6223 (if (setq number (gnus-summary-insert-subject message-id)) | |
6224 (gnus-summary-select-article nil nil nil number) | |
6225 (gnus-message 3 "Couldn't fetch article %s" message-id))))))) | |
6226 | |
6227 (defun gnus-summary-enter-digest-group (&optional force) | |
6228 "Enter an nndoc group based on the current article. | |
6229 If FORCE, force a digest interpretation. If not, try | |
6230 to guess what the document format is." | |
6231 (interactive "P") | |
6232 (gnus-set-global-variables) | |
6233 (let ((conf gnus-current-window-configuration)) | |
6234 (save-excursion | |
6235 (gnus-summary-select-article)) | |
6236 (setq gnus-current-window-configuration conf) | |
6237 (let* ((name (format "%s-%d" | |
6238 (gnus-group-prefixed-name | |
6239 gnus-newsgroup-name (list 'nndoc "")) | |
6240 (save-excursion | |
6241 (set-buffer gnus-summary-buffer) | |
6242 gnus-current-article))) | |
6243 (ogroup gnus-newsgroup-name) | |
6244 (params (append (gnus-info-params (gnus-get-info ogroup)) | |
6245 (list (cons 'to-group ogroup)) | |
6246 (list (cons 'save-article-group ogroup)))) | |
6247 (case-fold-search t) | |
6248 (buf (current-buffer)) | |
6249 dig) | |
6250 (save-excursion | |
6251 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*")) | |
6252 (insert-buffer-substring gnus-original-article-buffer) | |
6253 ;; Remove lines that may lead nndoc to misinterpret the | |
6254 ;; document type. | |
6255 (narrow-to-region | |
6256 (goto-char (point-min)) | |
6257 (or (search-forward "\n\n" nil t) (point))) | |
6258 (goto-char (point-min)) | |
6259 (delete-matching-lines "^\\(Path\\):\\|^From ") | |
6260 (widen)) | |
6261 (unwind-protect | |
6262 (if (gnus-group-read-ephemeral-group | |
6263 name `(nndoc ,name (nndoc-address ,(get-buffer dig)) | |
6264 (nndoc-article-type | |
6265 ,(if force 'digest 'guess))) t) | |
6266 ;; Make all postings to this group go to the parent group. | |
6267 (nconc (gnus-info-params (gnus-get-info name)) | |
6268 params) | |
6269 ;; Couldn't select this doc group. | |
6270 (switch-to-buffer buf) | |
6271 (gnus-set-global-variables) | |
6272 (gnus-configure-windows 'summary) | |
6273 (gnus-message 3 "Article couldn't be entered?")) | |
6274 (kill-buffer dig))))) | |
6275 | |
6276 (defun gnus-summary-read-document (n) | |
6277 "Open a new group based on the current article(s). | |
6278 This will allow you to read digests and other similar | |
6279 documents as newsgroups. | |
6280 Obeys the standard process/prefix convention." | |
6281 (interactive "P") | |
6282 (let* ((articles (gnus-summary-work-articles n)) | |
6283 (ogroup gnus-newsgroup-name) | |
6284 (params (append (gnus-info-params (gnus-get-info ogroup)) | |
6285 (list (cons 'to-group ogroup)))) | |
6286 article group egroup groups vgroup) | |
6287 (while (setq article (pop articles)) | |
6288 (setq group (format "%s-%d" gnus-newsgroup-name article)) | |
6289 (gnus-summary-remove-process-mark article) | |
6290 (when (gnus-summary-display-article article) | |
6291 (save-excursion | |
6292 (nnheader-temp-write nil | |
6293 (insert-buffer-substring gnus-original-article-buffer) | |
6294 ;; Remove some headers that may lead nndoc to make | |
6295 ;; the wrong guess. | |
6296 (message-narrow-to-head) | |
6297 (goto-char (point-min)) | |
6298 (delete-matching-lines "^\\(Path\\):\\|^From ") | |
6299 (widen) | |
6300 (if (setq egroup | |
6301 (gnus-group-read-ephemeral-group | |
6302 group `(nndoc ,group (nndoc-address ,(current-buffer)) | |
6303 (nndoc-article-type guess)) | |
6304 t nil t)) | |
6305 (progn | |
6306 ;; Make all postings to this group go to the parent group. | |
6307 (nconc (gnus-info-params (gnus-get-info egroup)) | |
6308 params) | |
6309 (push egroup groups)) | |
6310 ;; Couldn't select this doc group. | |
6311 (gnus-error 3 "Article couldn't be entered")))))) | |
6312 ;; Now we have selected all the documents. | |
6313 (cond | |
6314 ((not groups) | |
6315 (error "None of the articles could be interpreted as documents")) | |
6316 ((gnus-group-read-ephemeral-group | |
6317 (setq vgroup (format | |
6318 "nnvirtual:%s-%s" gnus-newsgroup-name | |
6319 (format-time-string "%Y%m%dT%H%M%S" (current-time)))) | |
6320 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups)) | |
6321 t | |
6322 (cons (current-buffer) 'summary))) | |
6323 (t | |
6324 (error "Couldn't select virtual nndoc group"))))) | |
6325 | |
6326 (defun gnus-summary-isearch-article (&optional regexp-p) | |
6327 "Do incremental search forward on the current article. | |
6328 If REGEXP-P (the prefix) is non-nil, do regexp isearch." | |
6329 (interactive "P") | |
6330 (gnus-set-global-variables) | |
6331 (gnus-summary-select-article) | |
6332 (gnus-configure-windows 'article) | |
6333 (gnus-eval-in-buffer-window gnus-article-buffer | |
6334 ;;(goto-char (point-min)) | |
6335 (isearch-forward regexp-p))) | |
6336 | |
6337 (defun gnus-summary-search-article-forward (regexp &optional backward) | |
6338 "Search for an article containing REGEXP forward. | |
6339 If BACKWARD, search backward instead." | |
6340 (interactive | |
6341 (list (read-string | |
6342 (format "Search article %s (regexp%s): " | |
6343 (if current-prefix-arg "backward" "forward") | |
6344 (if gnus-last-search-regexp | |
6345 (concat ", default " gnus-last-search-regexp) | |
6346 ""))) | |
6347 current-prefix-arg)) | |
6348 (gnus-set-global-variables) | |
6349 (if (string-equal regexp "") | |
6350 (setq regexp (or gnus-last-search-regexp "")) | |
6351 (setq gnus-last-search-regexp regexp)) | |
6352 (if (gnus-summary-search-article regexp backward) | |
6353 (gnus-summary-show-thread) | |
6354 (error "Search failed: \"%s\"" regexp))) | |
6355 | |
6356 (defun gnus-summary-search-article-backward (regexp) | |
6357 "Search for an article containing REGEXP backward." | |
6358 (interactive | |
6359 (list (read-string | |
6360 (format "Search article backward (regexp%s): " | |
6361 (if gnus-last-search-regexp | |
6362 (concat ", default " gnus-last-search-regexp) | |
6363 ""))))) | |
6364 (gnus-summary-search-article-forward regexp 'backward)) | |
6365 | |
6366 (defun gnus-summary-search-article (regexp &optional backward) | |
6367 "Search for an article containing REGEXP. | |
6368 Optional argument BACKWARD means do search for backward. | |
6369 `gnus-select-article-hook' is not called during the search." | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6370 ;; We have to require this here to make sure that the following |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6371 ;; dynamic binding isn't shadowed by autoloading. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6372 (require 'gnus-async) |
17493 | 6373 (let ((gnus-select-article-hook nil) ;Disable hook. |
6374 (gnus-article-display-hook nil) | |
6375 (gnus-mark-article-hook nil) ;Inhibit marking as read. | |
6376 (gnus-use-article-prefetch nil) | |
6377 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6378 (gnus-use-trees nil) ;Inhibit updating tree buffer. |
17493 | 6379 (sum (current-buffer)) |
6380 (found nil) | |
6381 point) | |
6382 (gnus-save-hidden-threads | |
6383 (gnus-summary-select-article) | |
6384 (set-buffer gnus-article-buffer) | |
6385 (when backward | |
6386 (forward-line -1)) | |
6387 (while (not found) | |
6388 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current)) | |
6389 (if (if backward | |
6390 (re-search-backward regexp nil t) | |
6391 (re-search-forward regexp nil t)) | |
6392 ;; We found the regexp. | |
6393 (progn | |
6394 (setq found 'found) | |
6395 (beginning-of-line) | |
6396 (set-window-start | |
6397 (get-buffer-window (current-buffer)) | |
6398 (point)) | |
6399 (forward-line 1) | |
6400 (set-buffer sum) | |
6401 (setq point (point))) | |
6402 ;; We didn't find it, so we go to the next article. | |
6403 (set-buffer sum) | |
6404 (setq found 'not) | |
6405 (while (eq found 'not) | |
6406 (if (not (if backward (gnus-summary-find-prev) | |
6407 (gnus-summary-find-next))) | |
6408 ;; No more articles. | |
6409 (setq found t) | |
6410 ;; Select the next article and adjust point. | |
6411 (unless (gnus-summary-article-sparse-p | |
6412 (gnus-summary-article-number)) | |
6413 (setq found nil) | |
6414 (gnus-summary-select-article) | |
6415 (set-buffer gnus-article-buffer) | |
6416 (widen) | |
6417 (goto-char (if backward (point-max) (point-min)))))))) | |
6418 (gnus-message 7 "")) | |
6419 ;; Return whether we found the regexp. | |
6420 (when (eq found 'found) | |
6421 (goto-char point) | |
6422 (gnus-summary-show-thread) | |
6423 (gnus-summary-goto-subject gnus-current-article) | |
6424 (gnus-summary-position-point) | |
6425 t))) | |
6426 | |
6427 (defun gnus-summary-find-matching (header regexp &optional backward unread | |
6428 not-case-fold) | |
6429 "Return a list of all articles that match REGEXP on HEADER. | |
6430 The search stars on the current article and goes forwards unless | |
6431 BACKWARD is non-nil. If BACKWARD is `all', do all articles. | |
6432 If UNREAD is non-nil, only unread articles will | |
6433 be taken into consideration. If NOT-CASE-FOLD, case won't be folded | |
6434 in the comparisons." | |
6435 (let ((data (if (eq backward 'all) gnus-newsgroup-data | |
6436 (gnus-data-find-list | |
6437 (gnus-summary-article-number) (gnus-data-list backward)))) | |
6438 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h))) | |
6439 (case-fold-search (not not-case-fold)) | |
6440 articles d) | |
6441 (unless (fboundp (intern (concat "mail-header-" header))) | |
6442 (error "%s is not a valid header" header)) | |
6443 (while data | |
6444 (setq d (car data)) | |
6445 (and (or (not unread) ; We want all articles... | |
6446 (gnus-data-unread-p d)) ; Or just unreads. | |
6447 (vectorp (gnus-data-header d)) ; It's not a pseudo. | |
6448 (string-match regexp (funcall func (gnus-data-header d))) ; Match. | |
6449 (push (gnus-data-number d) articles)) ; Success! | |
6450 (setq data (cdr data))) | |
6451 (nreverse articles))) | |
6452 | |
6453 (defun gnus-summary-execute-command (header regexp command &optional backward) | |
6454 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND. | |
6455 If HEADER is an empty string (or nil), the match is done on the entire | |
6456 article. If BACKWARD (the prefix) is non-nil, search backward instead." | |
6457 (interactive | |
6458 (list (let ((completion-ignore-case t)) | |
6459 (completing-read | |
6460 "Header name: " | |
6461 (mapcar (lambda (string) (list string)) | |
6462 '("Number" "Subject" "From" "Lines" "Date" | |
6463 "Message-ID" "Xref" "References" "Body")) | |
6464 nil 'require-match)) | |
6465 (read-string "Regexp: ") | |
6466 (read-key-sequence "Command: ") | |
6467 current-prefix-arg)) | |
6468 (when (equal header "Body") | |
6469 (setq header "")) | |
6470 (gnus-set-global-variables) | |
6471 ;; Hidden thread subtrees must be searched as well. | |
6472 (gnus-summary-show-all-threads) | |
6473 ;; We don't want to change current point nor window configuration. | |
6474 (save-excursion | |
6475 (save-window-excursion | |
6476 (gnus-message 6 "Executing %s..." (key-description command)) | |
6477 ;; We'd like to execute COMMAND interactively so as to give arguments. | |
6478 (gnus-execute header regexp | |
6479 `(call-interactively ',(key-binding command)) | |
6480 backward) | |
6481 (gnus-message 6 "Executing %s...done" (key-description command))))) | |
6482 | |
6483 (defun gnus-summary-beginning-of-article () | |
6484 "Scroll the article back to the beginning." | |
6485 (interactive) | |
6486 (gnus-set-global-variables) | |
6487 (gnus-summary-select-article) | |
6488 (gnus-configure-windows 'article) | |
6489 (gnus-eval-in-buffer-window gnus-article-buffer | |
6490 (widen) | |
6491 (goto-char (point-min)) | |
6492 (when gnus-page-broken | |
6493 (gnus-narrow-to-page)))) | |
6494 | |
6495 (defun gnus-summary-end-of-article () | |
6496 "Scroll to the end of the article." | |
6497 (interactive) | |
6498 (gnus-set-global-variables) | |
6499 (gnus-summary-select-article) | |
6500 (gnus-configure-windows 'article) | |
6501 (gnus-eval-in-buffer-window gnus-article-buffer | |
6502 (widen) | |
6503 (goto-char (point-max)) | |
6504 (recenter -3) | |
6505 (when gnus-page-broken | |
6506 (gnus-narrow-to-page)))) | |
6507 | |
6508 (defun gnus-summary-print-article (&optional filename) | |
6509 "Generate and print a PostScript image of the article buffer. | |
6510 | |
6511 If the optional argument FILENAME is nil, send the image to the printer. | |
6512 If FILENAME is a string, save the PostScript image in a file with that | |
6513 name. If FILENAME is a number, prompt the user for the name of the file | |
6514 to save in." | |
6515 (interactive (list (ps-print-preprint current-prefix-arg))) | |
6516 (gnus-summary-select-article) | |
6517 (gnus-eval-in-buffer-window gnus-article-buffer | |
6518 (let ((buffer (generate-new-buffer " *print*"))) | |
6519 (unwind-protect | |
6520 (progn | |
6521 (copy-to-buffer buffer (point-min) (point-max)) | |
6522 (set-buffer buffer) | |
6523 (gnus-article-delete-invisible-text) | |
6524 (run-hooks 'gnus-ps-print-hook) | |
6525 (ps-print-buffer-with-faces filename)) | |
6526 (kill-buffer buffer))))) | |
6527 | |
6528 (defun gnus-summary-show-article (&optional arg) | |
6529 "Force re-fetching of the current article. | |
6530 If ARG (the prefix) is non-nil, show the raw article without any | |
6531 article massaging functions being run." | |
6532 (interactive "P") | |
6533 (gnus-set-global-variables) | |
6534 (if (not arg) | |
6535 ;; Select the article the normal way. | |
6536 (gnus-summary-select-article nil 'force) | |
6537 ;; Bind the article treatment functions to nil. | |
6538 (let ((gnus-have-all-headers t) | |
6539 gnus-article-display-hook | |
6540 gnus-article-prepare-hook | |
6541 gnus-break-pages | |
6542 gnus-show-mime | |
6543 gnus-visual) | |
6544 (gnus-summary-select-article nil 'force))) | |
6545 (gnus-summary-goto-subject gnus-current-article) | |
6546 (gnus-summary-position-point)) | |
6547 | |
6548 (defun gnus-summary-verbose-headers (&optional arg) | |
6549 "Toggle permanent full header display. | |
6550 If ARG is a positive number, turn header display on. | |
6551 If ARG is a negative number, turn header display off." | |
6552 (interactive "P") | |
6553 (gnus-set-global-variables) | |
6554 (setq gnus-show-all-headers | |
6555 (cond ((or (not (numberp arg)) | |
6556 (zerop arg)) | |
6557 (not gnus-show-all-headers)) | |
6558 ((natnump arg) | |
6559 t))) | |
6560 (gnus-summary-show-article)) | |
6561 | |
6562 (defun gnus-summary-toggle-header (&optional arg) | |
6563 "Show the headers if they are hidden, or hide them if they are shown. | |
6564 If ARG is a positive number, show the entire header. | |
6565 If ARG is a negative number, hide the unwanted header lines." | |
6566 (interactive "P") | |
6567 (gnus-set-global-variables) | |
6568 (save-excursion | |
6569 (set-buffer gnus-article-buffer) | |
6570 (let* ((buffer-read-only nil) | |
6571 (inhibit-point-motion-hooks t) | |
6572 (hidden (text-property-any | |
6573 (goto-char (point-min)) (search-forward "\n\n") | |
6574 'invisible t)) | |
6575 e) | |
6576 (goto-char (point-min)) | |
6577 (when (search-forward "\n\n" nil t) | |
6578 (delete-region (point-min) (1- (point)))) | |
6579 (goto-char (point-min)) | |
6580 (save-excursion | |
6581 (set-buffer gnus-original-article-buffer) | |
6582 (goto-char (point-min)) | |
6583 (setq e (1- (or (search-forward "\n\n" nil t) (point-max))))) | |
6584 (insert-buffer-substring gnus-original-article-buffer 1 e) | |
6585 (let ((article-inhibit-hiding t)) | |
6586 (run-hooks 'gnus-article-display-hook)) | |
6587 (when (or (not hidden) (and (numberp arg) (< arg 0))) | |
6588 (gnus-article-hide-headers))))) | |
6589 | |
6590 (defun gnus-summary-show-all-headers () | |
6591 "Make all header lines visible." | |
6592 (interactive) | |
6593 (gnus-set-global-variables) | |
6594 (gnus-article-show-all-headers)) | |
6595 | |
6596 (defun gnus-summary-toggle-mime (&optional arg) | |
6597 "Toggle MIME processing. | |
6598 If ARG is a positive number, turn MIME processing on." | |
6599 (interactive "P") | |
6600 (gnus-set-global-variables) | |
6601 (setq gnus-show-mime | |
6602 (if (null arg) (not gnus-show-mime) | |
6603 (> (prefix-numeric-value arg) 0))) | |
6604 (gnus-summary-select-article t 'force)) | |
6605 | |
6606 (defun gnus-summary-caesar-message (&optional arg) | |
6607 "Caesar rotate the current article by 13. | |
6608 The numerical prefix specifies how many places to rotate each letter | |
6609 forward." | |
6610 (interactive "P") | |
6611 (gnus-set-global-variables) | |
6612 (gnus-summary-select-article) | |
6613 (let ((mail-header-separator "")) | |
6614 (gnus-eval-in-buffer-window gnus-article-buffer | |
6615 (save-restriction | |
6616 (widen) | |
6617 (let ((start (window-start)) | |
6618 buffer-read-only) | |
6619 (message-caesar-buffer-body arg) | |
6620 (set-window-start (get-buffer-window (current-buffer)) start)))))) | |
6621 | |
6622 (defun gnus-summary-stop-page-breaking () | |
6623 "Stop page breaking in the current article." | |
6624 (interactive) | |
6625 (gnus-set-global-variables) | |
6626 (gnus-summary-select-article) | |
6627 (gnus-eval-in-buffer-window gnus-article-buffer | |
6628 (widen) | |
6629 (when (gnus-visual-p 'page-marker) | |
6630 (let ((buffer-read-only nil)) | |
6631 (gnus-remove-text-with-property 'gnus-prev) | |
6632 (gnus-remove-text-with-property 'gnus-next))))) | |
6633 | |
6634 (defun gnus-summary-move-article (&optional n to-newsgroup | |
6635 select-method action) | |
6636 "Move the current article to a different newsgroup. | |
6637 If N is a positive number, move the N next articles. | |
6638 If N is a negative number, move the N previous articles. | |
6639 If N is nil and any articles have been marked with the process mark, | |
6640 move those articles instead. | |
6641 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to. | |
6642 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but | |
6643 re-spool using this method. | |
6644 | |
6645 For this function to work, both the current newsgroup and the | |
6646 newsgroup that you want to move to have to support the `request-move' | |
6647 and `request-accept' functions." | |
6648 (interactive "P") | |
6649 (unless action | |
6650 (setq action 'move)) | |
6651 (gnus-set-global-variables) | |
6652 ;; Disable marking as read. | |
6653 (let (gnus-mark-article-hook) | |
6654 (save-window-excursion | |
6655 (gnus-summary-select-article))) | |
6656 ;; Check whether the source group supports the required functions. | |
6657 (cond ((and (eq action 'move) | |
6658 (not (gnus-check-backend-function | |
6659 'request-move-article gnus-newsgroup-name))) | |
6660 (error "The current group does not support article moving")) | |
6661 ((and (eq action 'crosspost) | |
6662 (not (gnus-check-backend-function | |
6663 'request-replace-article gnus-newsgroup-name))) | |
6664 (error "The current group does not support article editing"))) | |
6665 (let ((articles (gnus-summary-work-articles n)) | |
6666 (prefix (gnus-group-real-prefix gnus-newsgroup-name)) | |
6667 (names '((move "Move" "Moving") | |
6668 (copy "Copy" "Copying") | |
6669 (crosspost "Crosspost" "Crossposting"))) | |
6670 (copy-buf (save-excursion | |
6671 (nnheader-set-temp-buffer " *copy article*"))) | |
6672 art-group to-method new-xref article to-groups) | |
6673 (unless (assq action names) | |
6674 (error "Unknown action %s" action)) | |
6675 ;; Read the newsgroup name. | |
6676 (when (and (not to-newsgroup) | |
6677 (not select-method)) | |
6678 (setq to-newsgroup | |
6679 (gnus-read-move-group-name | |
6680 (cadr (assq action names)) | |
6681 (symbol-value (intern (format "gnus-current-%s-group" action))) | |
6682 articles prefix)) | |
6683 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup)) | |
6684 (setq to-method (or select-method | |
6685 (gnus-group-name-to-method to-newsgroup))) | |
6686 ;; Check the method we are to move this article to... | |
6687 (unless (gnus-check-backend-function | |
6688 'request-accept-article (car to-method)) | |
6689 (error "%s does not support article copying" (car to-method))) | |
6690 (unless (gnus-check-server to-method) | |
6691 (error "Can't open server %s" (car to-method))) | |
6692 (gnus-message 6 "%s to %s: %s..." | |
6693 (caddr (assq action names)) | |
6694 (or (car select-method) to-newsgroup) articles) | |
6695 (while articles | |
6696 (setq article (pop articles)) | |
6697 (setq | |
6698 art-group | |
6699 (cond | |
6700 ;; Move the article. | |
6701 ((eq action 'move) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6702 ;; Remove this article from future suppression. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6703 (gnus-dup-unsuppress-article article) |
17493 | 6704 (gnus-request-move-article |
6705 article ; Article to move | |
6706 gnus-newsgroup-name ; From newsgroup | |
6707 (nth 1 (gnus-find-method-for-group | |
6708 gnus-newsgroup-name)) ; Server | |
6709 (list 'gnus-request-accept-article | |
6710 to-newsgroup (list 'quote select-method) | |
6711 (not articles)) ; Accept form | |
6712 (not articles))) ; Only save nov last time | |
6713 ;; Copy the article. | |
6714 ((eq action 'copy) | |
6715 (save-excursion | |
6716 (set-buffer copy-buf) | |
6717 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6718 (gnus-request-accept-article | |
6719 to-newsgroup select-method (not articles)))) | |
6720 ;; Crosspost the article. | |
6721 ((eq action 'crosspost) | |
6722 (let ((xref (message-tokenize-header | |
6723 (mail-header-xref (gnus-summary-article-header article)) | |
6724 " "))) | |
6725 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name) | |
6726 ":" article)) | |
6727 (unless xref | |
6728 (setq xref (list (system-name)))) | |
6729 (setq new-xref | |
6730 (concat | |
6731 (mapconcat 'identity | |
6732 (delete "Xref:" (delete new-xref xref)) | |
6733 " ") | |
6734 " " new-xref)) | |
6735 (save-excursion | |
6736 (set-buffer copy-buf) | |
6737 ;; First put the article in the destination group. | |
6738 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6739 (when (consp (setq art-group | |
6740 (gnus-request-accept-article | |
6741 to-newsgroup select-method (not articles)))) | |
6742 (setq new-xref (concat new-xref " " (car art-group) | |
6743 ":" (cdr art-group))) | |
6744 ;; Now we have the new Xrefs header, so we insert | |
6745 ;; it and replace the new article. | |
6746 (nnheader-replace-header "Xref" new-xref) | |
6747 (gnus-request-replace-article | |
6748 (cdr art-group) to-newsgroup (current-buffer)) | |
6749 art-group)))))) | |
6750 (cond | |
6751 ((not art-group) | |
6752 (gnus-message 1 "Couldn't %s article %s" | |
6753 (cadr (assq action names)) article)) | |
6754 ((and (eq art-group 'junk) | |
6755 (eq action 'move)) | |
6756 (gnus-summary-mark-article article gnus-canceled-mark) | |
6757 (gnus-message 4 "Deleted article %s" article)) | |
6758 (t | |
6759 (let* ((entry | |
6760 (or | |
6761 (gnus-gethash (car art-group) gnus-newsrc-hashtb) | |
6762 (gnus-gethash | |
6763 (gnus-group-prefixed-name | |
6764 (car art-group) | |
6765 (or select-method | |
6766 (gnus-find-method-for-group to-newsgroup))) | |
6767 gnus-newsrc-hashtb))) | |
6768 (info (nth 2 entry)) | |
6769 (to-group (gnus-info-group info))) | |
6770 ;; Update the group that has been moved to. | |
6771 (when (and info | |
6772 (memq action '(move copy))) | |
6773 (unless (member to-group to-groups) | |
6774 (push to-group to-groups)) | |
6775 | |
6776 (unless (memq article gnus-newsgroup-unreads) | |
6777 (gnus-info-set-read | |
6778 info (gnus-add-to-range (gnus-info-read info) | |
6779 (list (cdr art-group))))) | |
6780 | |
6781 ;; Copy any marks over to the new group. | |
6782 (let ((marks gnus-article-mark-lists) | |
6783 (to-article (cdr art-group))) | |
6784 | |
6785 ;; See whether the article is to be put in the cache. | |
6786 (when gnus-use-cache | |
6787 (gnus-cache-possibly-enter-article | |
6788 to-group to-article | |
6789 (let ((header (copy-sequence | |
6790 (gnus-summary-article-header article)))) | |
6791 (mail-header-set-number header to-article) | |
6792 header) | |
6793 (memq article gnus-newsgroup-marked) | |
6794 (memq article gnus-newsgroup-dormant) | |
6795 (memq article gnus-newsgroup-unreads))) | |
6796 | |
6797 (when (and (equal to-group gnus-newsgroup-name) | |
6798 (not (memq article gnus-newsgroup-unreads))) | |
6799 ;; Mark this article as read in this group. | |
6800 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads) | |
6801 (setcdr (gnus-active to-group) to-article) | |
6802 (setcdr gnus-newsgroup-active to-article)) | |
6803 | |
6804 (while marks | |
6805 (when (memq article (symbol-value | |
6806 (intern (format "gnus-newsgroup-%s" | |
6807 (caar marks))))) | |
6808 ;; If the other group is the same as this group, | |
6809 ;; then we have to add the mark to the list. | |
6810 (when (equal to-group gnus-newsgroup-name) | |
6811 (set (intern (format "gnus-newsgroup-%s" (caar marks))) | |
6812 (cons to-article | |
6813 (symbol-value | |
6814 (intern (format "gnus-newsgroup-%s" | |
6815 (caar marks))))))) | |
6816 ;; Copy the marks to other group. | |
6817 (gnus-add-marked-articles | |
6818 to-group (cdar marks) (list to-article) info)) | |
6819 (setq marks (cdr marks))) | |
6820 | |
6821 (gnus-dribble-enter | |
6822 (concat "(gnus-group-set-info '" | |
6823 (gnus-prin1-to-string (gnus-get-info to-group)) | |
6824 ")")))) | |
6825 | |
6826 ;; Update the Xref header in this article to point to | |
6827 ;; the new crossposted article we have just created. | |
6828 (when (eq action 'crosspost) | |
6829 (save-excursion | |
6830 (set-buffer copy-buf) | |
6831 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6832 (nnheader-replace-header "Xref" new-xref) | |
6833 (gnus-request-replace-article | |
6834 article gnus-newsgroup-name (current-buffer))))) | |
6835 | |
6836 (gnus-summary-goto-subject article) | |
6837 (when (eq action 'move) | |
6838 (gnus-summary-mark-article article gnus-canceled-mark)))) | |
6839 (gnus-summary-remove-process-mark article)) | |
6840 ;; Re-activate all groups that have been moved to. | |
6841 (while to-groups | |
6842 (save-excursion | |
6843 (set-buffer gnus-group-buffer) | |
6844 (when (gnus-group-goto-group (car to-groups) t) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6845 (gnus-group-get-new-news-this-group 1 t)) |
17493 | 6846 (pop to-groups))) |
6847 | |
6848 (gnus-kill-buffer copy-buf) | |
6849 (gnus-summary-position-point) | |
6850 (gnus-set-mode-line 'summary))) | |
6851 | |
6852 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method) | |
6853 "Move the current article to a different newsgroup. | |
6854 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to. | |
6855 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but | |
6856 re-spool using this method." | |
6857 (interactive "P") | |
6858 (gnus-summary-move-article n to-newsgroup select-method 'copy)) | |
6859 | |
6860 (defun gnus-summary-crosspost-article (&optional n) | |
6861 "Crosspost the current article to some other group." | |
6862 (interactive "P") | |
6863 (gnus-summary-move-article n nil nil 'crosspost)) | |
6864 | |
6865 (defcustom gnus-summary-respool-default-method nil | |
6866 "Default method for respooling an article. | |
6867 If nil, use to the current newsgroup method." | |
6868 :type 'gnus-select-method-name | |
6869 :group 'gnus-summary-mail) | |
6870 | |
6871 (defun gnus-summary-respool-article (&optional n method) | |
6872 "Respool the current article. | |
6873 The article will be squeezed through the mail spooling process again, | |
6874 which means that it will be put in some mail newsgroup or other | |
6875 depending on `nnmail-split-methods'. | |
6876 If N is a positive number, respool the N next articles. | |
6877 If N is a negative number, respool the N previous articles. | |
6878 If N is nil and any articles have been marked with the process mark, | |
6879 respool those articles instead. | |
6880 | |
6881 Respooling can be done both from mail groups and \"real\" newsgroups. | |
6882 In the former case, the articles in question will be moved from the | |
6883 current group into whatever groups they are destined to. In the | |
6884 latter case, they will be copied into the relevant groups." | |
6885 (interactive | |
6886 (list current-prefix-arg | |
6887 (let* ((methods (gnus-methods-using 'respool)) | |
6888 (methname | |
6889 (symbol-name (or gnus-summary-respool-default-method | |
6890 (car (gnus-find-method-for-group | |
6891 gnus-newsgroup-name))))) | |
6892 (method | |
6893 (gnus-completing-read | |
6894 methname "What backend do you want to use when respooling?" | |
6895 methods nil t nil 'gnus-mail-method-history)) | |
6896 ms) | |
6897 (cond | |
6898 ((zerop (length (setq ms (gnus-servers-using-backend | |
6899 (intern method))))) | |
6900 (list (intern method) "")) | |
6901 ((= 1 (length ms)) | |
6902 (car ms)) | |
6903 (t | |
6904 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms))) | |
6905 (cdr (assoc (completing-read "Server name: " ms-alist nil t) | |
6906 ms-alist)))))))) | |
6907 (gnus-set-global-variables) | |
6908 (unless method | |
6909 (error "No method given for respooling")) | |
6910 (if (assoc (symbol-name | |
6911 (car (gnus-find-method-for-group gnus-newsgroup-name))) | |
6912 (gnus-methods-using 'respool)) | |
6913 (gnus-summary-move-article n nil method) | |
6914 (gnus-summary-copy-article n nil method))) | |
6915 | |
6916 (defun gnus-summary-import-article (file) | |
6917 "Import a random file into a mail newsgroup." | |
6918 (interactive "fImport file: ") | |
6919 (gnus-set-global-variables) | |
6920 (let ((group gnus-newsgroup-name) | |
6921 (now (current-time)) | |
6922 atts lines) | |
6923 (unless (gnus-check-backend-function 'request-accept-article group) | |
6924 (error "%s does not support article importing" group)) | |
6925 (or (file-readable-p file) | |
6926 (not (file-regular-p file)) | |
6927 (error "Can't read %s" file)) | |
6928 (save-excursion | |
6929 (set-buffer (get-buffer-create " *import file*")) | |
6930 (buffer-disable-undo (current-buffer)) | |
6931 (erase-buffer) | |
6932 (insert-file-contents file) | |
6933 (goto-char (point-min)) | |
6934 (unless (nnheader-article-p) | |
6935 ;; This doesn't look like an article, so we fudge some headers. | |
6936 (setq atts (file-attributes file) | |
6937 lines (count-lines (point-min) (point-max))) | |
6938 (insert "From: " (read-string "From: ") "\n" | |
6939 "Subject: " (read-string "Subject: ") "\n" | |
6940 "Date: " (timezone-make-date-arpa-standard | |
6941 (current-time-string (nth 5 atts)) | |
6942 (current-time-zone now) | |
6943 (current-time-zone now)) | |
6944 "\n" | |
6945 "Message-ID: " (message-make-message-id) "\n" | |
6946 "Lines: " (int-to-string lines) "\n" | |
6947 "Chars: " (int-to-string (nth 7 atts)) "\n\n")) | |
6948 (gnus-request-accept-article group nil t) | |
6949 (kill-buffer (current-buffer))))) | |
6950 | |
6951 (defun gnus-summary-article-posted-p () | |
6952 "Say whether the current (mail) article is available from `gnus-select-method' as well. | |
6953 This will be the case if the article has both been mailed and posted." | |
6954 (interactive) | |
6955 (let ((id (mail-header-references (gnus-summary-article-header))) | |
6956 (gnus-override-method | |
6957 (or gnus-refer-article-method gnus-select-method))) | |
6958 (if (gnus-request-head id "") | |
6959 (gnus-message 2 "The current message was found on %s" | |
6960 gnus-override-method) | |
6961 (gnus-message 2 "The current message couldn't be found on %s" | |
6962 gnus-override-method) | |
6963 nil))) | |
6964 | |
6965 (defun gnus-summary-expire-articles (&optional now) | |
6966 "Expire all articles that are marked as expirable in the current group." | |
6967 (interactive) | |
6968 (gnus-set-global-variables) | |
6969 (when (gnus-check-backend-function | |
6970 'request-expire-articles gnus-newsgroup-name) | |
6971 ;; This backend supports expiry. | |
6972 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name)) | |
6973 (expirable (if total | |
6974 (progn | |
6975 ;; We need to update the info for | |
6976 ;; this group for `gnus-list-of-read-articles' | |
6977 ;; to give us the right answer. | |
6978 (run-hooks 'gnus-exit-group-hook) | |
6979 (gnus-summary-update-info) | |
6980 (gnus-list-of-read-articles gnus-newsgroup-name)) | |
6981 (setq gnus-newsgroup-expirable | |
6982 (sort gnus-newsgroup-expirable '<)))) | |
6983 (expiry-wait (if now 'immediate | |
6984 (gnus-group-find-parameter | |
6985 gnus-newsgroup-name 'expiry-wait))) | |
6986 es) | |
6987 (when expirable | |
6988 ;; There are expirable articles in this group, so we run them | |
6989 ;; through the expiry process. | |
6990 (gnus-message 6 "Expiring articles...") | |
6991 ;; The list of articles that weren't expired is returned. | |
6992 (if expiry-wait | |
6993 (let ((nnmail-expiry-wait-function nil) | |
6994 (nnmail-expiry-wait expiry-wait)) | |
6995 (setq es (gnus-request-expire-articles | |
6996 expirable gnus-newsgroup-name))) | |
6997 (setq es (gnus-request-expire-articles | |
6998 expirable gnus-newsgroup-name))) | |
6999 (unless total | |
7000 (setq gnus-newsgroup-expirable es)) | |
7001 ;; We go through the old list of expirable, and mark all | |
7002 ;; really expired articles as nonexistent. | |
7003 (unless (eq es expirable) ;If nothing was expired, we don't mark. | |
7004 (let ((gnus-use-cache nil)) | |
7005 (while expirable | |
7006 (unless (memq (car expirable) es) | |
7007 (when (gnus-data-find (car expirable)) | |
7008 (gnus-summary-mark-article | |
7009 (car expirable) gnus-canceled-mark))) | |
7010 (setq expirable (cdr expirable))))) | |
7011 (gnus-message 6 "Expiring articles...done"))))) | |
7012 | |
7013 (defun gnus-summary-expire-articles-now () | |
7014 "Expunge all expirable articles in the current group. | |
7015 This means that *all* articles that are marked as expirable will be | |
7016 deleted forever, right now." | |
7017 (interactive) | |
7018 (gnus-set-global-variables) | |
7019 (or gnus-expert-user | |
7020 (gnus-yes-or-no-p | |
7021 "Are you really, really, really sure you want to delete all these messages? ") | |
7022 (error "Phew!")) | |
7023 (gnus-summary-expire-articles t)) | |
7024 | |
7025 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. | |
7026 (defun gnus-summary-delete-article (&optional n) | |
7027 "Delete the N next (mail) articles. | |
7028 This command actually deletes articles. This is not a marking | |
7029 command. The article will disappear forever from your life, never to | |
7030 return. | |
7031 If N is negative, delete backwards. | |
7032 If N is nil and articles have been marked with the process mark, | |
7033 delete these instead." | |
7034 (interactive "P") | |
7035 (gnus-set-global-variables) | |
7036 (unless (gnus-check-backend-function 'request-expire-articles | |
7037 gnus-newsgroup-name) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7038 (error "The current newsgroup does not support article deletion")) |
17493 | 7039 ;; Compute the list of articles to delete. |
7040 (let ((articles (gnus-summary-work-articles n)) | |
7041 not-deleted) | |
7042 (if (and gnus-novice-user | |
7043 (not (gnus-yes-or-no-p | |
7044 (format "Do you really want to delete %s forever? " | |
7045 (if (> (length articles) 1) | |
7046 (format "these %s articles" (length articles)) | |
7047 "this article"))))) | |
7048 () | |
7049 ;; Delete the articles. | |
7050 (setq not-deleted (gnus-request-expire-articles | |
7051 articles gnus-newsgroup-name 'force)) | |
7052 (while articles | |
7053 (gnus-summary-remove-process-mark (car articles)) | |
7054 ;; The backend might not have been able to delete the article | |
7055 ;; after all. | |
7056 (unless (memq (car articles) not-deleted) | |
7057 (gnus-summary-mark-article (car articles) gnus-canceled-mark)) | |
7058 (setq articles (cdr articles))) | |
7059 (when not-deleted | |
7060 (gnus-message 4 "Couldn't delete articles %s" not-deleted))) | |
7061 (gnus-summary-position-point) | |
7062 (gnus-set-mode-line 'summary) | |
7063 not-deleted)) | |
7064 | |
7065 (defun gnus-summary-edit-article (&optional force) | |
7066 "Edit the current article. | |
7067 This will have permanent effect only in mail groups. | |
7068 If FORCE is non-nil, allow editing of articles even in read-only | |
7069 groups." | |
7070 (interactive "P") | |
7071 (save-excursion | |
7072 (set-buffer gnus-summary-buffer) | |
7073 (gnus-set-global-variables) | |
7074 (when (and (not force) | |
7075 (gnus-group-read-only-p)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7076 (error "The current newsgroup does not support article editing")) |
17493 | 7077 ;; Select article if needed. |
7078 (unless (eq (gnus-summary-article-number) | |
7079 gnus-current-article) | |
7080 (gnus-summary-select-article t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7081 (gnus-article-date-original) |
17493 | 7082 (gnus-article-edit-article |
7083 `(lambda () | |
7084 (gnus-summary-edit-article-done | |
7085 ,(or (mail-header-references gnus-current-headers) "") | |
7086 ,(gnus-group-read-only-p) ,gnus-summary-buffer))))) | |
7087 | |
7088 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit) | |
7089 | |
7090 (defun gnus-summary-edit-article-done (&optional references read-only buffer) | |
7091 "Make edits to the current article permanent." | |
7092 (interactive) | |
7093 ;; Replace the article. | |
7094 (if (and (not read-only) | |
7095 (not (gnus-request-replace-article | |
7096 (cdr gnus-article-current) (car gnus-article-current) | |
7097 (current-buffer)))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7098 (error "Couldn't replace article") |
17493 | 7099 ;; Update the summary buffer. |
7100 (if (and references | |
7101 (equal (message-tokenize-header references " ") | |
7102 (message-tokenize-header | |
7103 (or (message-fetch-field "references") "") " "))) | |
7104 ;; We only have to update this line. | |
7105 (save-excursion | |
7106 (save-restriction | |
7107 (message-narrow-to-head) | |
7108 (let ((head (buffer-string)) | |
7109 header) | |
7110 (nnheader-temp-write nil | |
7111 (insert (format "211 %d Article retrieved.\n" | |
7112 (cdr gnus-article-current))) | |
7113 (insert head) | |
7114 (insert ".\n") | |
7115 (let ((nntp-server-buffer (current-buffer))) | |
7116 (setq header (car (gnus-get-newsgroup-headers | |
7117 (save-excursion | |
7118 (set-buffer gnus-summary-buffer) | |
7119 gnus-newsgroup-dependencies) | |
7120 t)))) | |
7121 (save-excursion | |
7122 (set-buffer gnus-summary-buffer) | |
7123 (gnus-data-set-header | |
7124 (gnus-data-find (cdr gnus-article-current)) | |
7125 header) | |
7126 (gnus-summary-update-article-line | |
7127 (cdr gnus-article-current) header)))))) | |
7128 ;; Update threads. | |
7129 (set-buffer (or buffer gnus-summary-buffer)) | |
7130 (gnus-summary-update-article (cdr gnus-article-current))) | |
7131 ;; Prettify the article buffer again. | |
7132 (save-excursion | |
7133 (set-buffer gnus-article-buffer) | |
7134 (run-hooks 'gnus-article-display-hook) | |
7135 (set-buffer gnus-original-article-buffer) | |
7136 (gnus-request-article | |
7137 (cdr gnus-article-current) (car gnus-article-current) (current-buffer))) | |
7138 ;; Prettify the summary buffer line. | |
7139 (when (gnus-visual-p 'summary-highlight 'highlight) | |
7140 (run-hooks 'gnus-visual-mark-article-hook)))) | |
7141 | |
7142 (defun gnus-summary-edit-wash (key) | |
7143 "Perform editing command in the article buffer." | |
7144 (interactive | |
7145 (list | |
7146 (progn | |
7147 (message "%s" (concat (this-command-keys) "- ")) | |
7148 (read-char)))) | |
7149 (message "") | |
7150 (gnus-summary-edit-article) | |
7151 (execute-kbd-macro (concat (this-command-keys) key)) | |
7152 (gnus-article-edit-done)) | |
7153 | |
7154 ;;; Respooling | |
7155 | |
7156 (defun gnus-summary-respool-query (&optional silent) | |
7157 "Query where the respool algorithm would put this article." | |
7158 (interactive) | |
7159 (gnus-set-global-variables) | |
7160 (let (gnus-mark-article-hook) | |
7161 (gnus-summary-select-article) | |
7162 (save-excursion | |
7163 (set-buffer gnus-original-article-buffer) | |
7164 (save-restriction | |
7165 (message-narrow-to-head) | |
7166 (let ((groups (nnmail-article-group 'identity))) | |
7167 (unless silent | |
7168 (if groups | |
7169 (message "This message would go to %s" | |
7170 (mapconcat 'car groups ", ")) | |
7171 (message "This message would go to no groups")) | |
7172 groups)))))) | |
7173 | |
7174 ;; Summary marking commands. | |
7175 | |
7176 (defun gnus-summary-kill-same-subject-and-select (&optional unmark) | |
7177 "Mark articles which has the same subject as read, and then select the next. | |
7178 If UNMARK is positive, remove any kind of mark. | |
7179 If UNMARK is negative, tick articles." | |
7180 (interactive "P") | |
7181 (gnus-set-global-variables) | |
7182 (when unmark | |
7183 (setq unmark (prefix-numeric-value unmark))) | |
7184 (let ((count | |
7185 (gnus-summary-mark-same-subject | |
7186 (gnus-summary-article-subject) unmark))) | |
7187 ;; Select next unread article. If auto-select-same mode, should | |
7188 ;; select the first unread article. | |
7189 (gnus-summary-next-article t (and gnus-auto-select-same | |
7190 (gnus-summary-article-subject))) | |
7191 (gnus-message 7 "%d article%s marked as %s" | |
7192 count (if (= count 1) " is" "s are") | |
7193 (if unmark "unread" "read")))) | |
7194 | |
7195 (defun gnus-summary-kill-same-subject (&optional unmark) | |
7196 "Mark articles which has the same subject as read. | |
7197 If UNMARK is positive, remove any kind of mark. | |
7198 If UNMARK is negative, tick articles." | |
7199 (interactive "P") | |
7200 (gnus-set-global-variables) | |
7201 (when unmark | |
7202 (setq unmark (prefix-numeric-value unmark))) | |
7203 (let ((count | |
7204 (gnus-summary-mark-same-subject | |
7205 (gnus-summary-article-subject) unmark))) | |
7206 ;; If marked as read, go to next unread subject. | |
7207 (when (null unmark) | |
7208 ;; Go to next unread subject. | |
7209 (gnus-summary-next-subject 1 t)) | |
7210 (gnus-message 7 "%d articles are marked as %s" | |
7211 count (if unmark "unread" "read")))) | |
7212 | |
7213 (defun gnus-summary-mark-same-subject (subject &optional unmark) | |
7214 "Mark articles with same SUBJECT as read, and return marked number. | |
7215 If optional argument UNMARK is positive, remove any kinds of marks. | |
7216 If optional argument UNMARK is negative, mark articles as unread instead." | |
7217 (let ((count 1)) | |
7218 (save-excursion | |
7219 (cond | |
7220 ((null unmark) ; Mark as read. | |
7221 (while (and | |
7222 (progn | |
7223 (gnus-summary-mark-article-as-read gnus-killed-mark) | |
7224 (gnus-summary-show-thread) t) | |
7225 (gnus-summary-find-subject subject)) | |
7226 (setq count (1+ count)))) | |
7227 ((> unmark 0) ; Tick. | |
7228 (while (and | |
7229 (progn | |
7230 (gnus-summary-mark-article-as-unread gnus-ticked-mark) | |
7231 (gnus-summary-show-thread) t) | |
7232 (gnus-summary-find-subject subject)) | |
7233 (setq count (1+ count)))) | |
7234 (t ; Mark as unread. | |
7235 (while (and | |
7236 (progn | |
7237 (gnus-summary-mark-article-as-unread gnus-unread-mark) | |
7238 (gnus-summary-show-thread) t) | |
7239 (gnus-summary-find-subject subject)) | |
7240 (setq count (1+ count))))) | |
7241 (gnus-set-mode-line 'summary) | |
7242 ;; Return the number of marked articles. | |
7243 count))) | |
7244 | |
7245 (defun gnus-summary-mark-as-processable (n &optional unmark) | |
7246 "Set the process mark on the next N articles. | |
7247 If N is negative, mark backward instead. If UNMARK is non-nil, remove | |
7248 the process mark instead. The difference between N and the actual | |
7249 number of articles marked is returned." | |
7250 (interactive "p") | |
7251 (gnus-set-global-variables) | |
7252 (let ((backward (< n 0)) | |
7253 (n (abs n))) | |
7254 (while (and | |
7255 (> n 0) | |
7256 (if unmark | |
7257 (gnus-summary-remove-process-mark | |
7258 (gnus-summary-article-number)) | |
7259 (gnus-summary-set-process-mark (gnus-summary-article-number))) | |
7260 (zerop (gnus-summary-next-subject (if backward -1 1) nil t))) | |
7261 (setq n (1- n))) | |
7262 (when (/= 0 n) | |
7263 (gnus-message 7 "No more articles")) | |
7264 (gnus-summary-recenter) | |
7265 (gnus-summary-position-point) | |
7266 n)) | |
7267 | |
7268 (defun gnus-summary-unmark-as-processable (n) | |
7269 "Remove the process mark from the next N articles. | |
7270 If N is negative, mark backward instead. The difference between N and | |
7271 the actual number of articles marked is returned." | |
7272 (interactive "p") | |
7273 (gnus-set-global-variables) | |
7274 (gnus-summary-mark-as-processable n t)) | |
7275 | |
7276 (defun gnus-summary-unmark-all-processable () | |
7277 "Remove the process mark from all articles." | |
7278 (interactive) | |
7279 (gnus-set-global-variables) | |
7280 (save-excursion | |
7281 (while gnus-newsgroup-processable | |
7282 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable)))) | |
7283 (gnus-summary-position-point)) | |
7284 | |
7285 (defun gnus-summary-mark-as-expirable (n) | |
7286 "Mark N articles forward as expirable. | |
7287 If N is negative, mark backward instead. The difference between N and | |
7288 the actual number of articles marked is returned." | |
7289 (interactive "p") | |
7290 (gnus-set-global-variables) | |
7291 (gnus-summary-mark-forward n gnus-expirable-mark)) | |
7292 | |
7293 (defun gnus-summary-mark-article-as-replied (article) | |
7294 "Mark ARTICLE replied and update the summary line." | |
7295 (push article gnus-newsgroup-replied) | |
7296 (let ((buffer-read-only nil)) | |
7297 (when (gnus-summary-goto-subject article) | |
7298 (gnus-summary-update-secondary-mark article)))) | |
7299 | |
7300 (defun gnus-summary-set-bookmark (article) | |
7301 "Set a bookmark in current article." | |
7302 (interactive (list (gnus-summary-article-number))) | |
7303 (gnus-set-global-variables) | |
7304 (when (or (not (get-buffer gnus-article-buffer)) | |
7305 (not gnus-current-article) | |
7306 (not gnus-article-current) | |
7307 (not (equal gnus-newsgroup-name (car gnus-article-current)))) | |
7308 (error "No current article selected")) | |
7309 ;; Remove old bookmark, if one exists. | |
7310 (let ((old (assq article gnus-newsgroup-bookmarks))) | |
7311 (when old | |
7312 (setq gnus-newsgroup-bookmarks | |
7313 (delq old gnus-newsgroup-bookmarks)))) | |
7314 ;; Set the new bookmark, which is on the form | |
7315 ;; (article-number . line-number-in-body). | |
7316 (push | |
7317 (cons article | |
7318 (save-excursion | |
7319 (set-buffer gnus-article-buffer) | |
7320 (count-lines | |
7321 (min (point) | |
7322 (save-excursion | |
7323 (goto-char (point-min)) | |
7324 (search-forward "\n\n" nil t) | |
7325 (point))) | |
7326 (point)))) | |
7327 gnus-newsgroup-bookmarks) | |
7328 (gnus-message 6 "A bookmark has been added to the current article.")) | |
7329 | |
7330 (defun gnus-summary-remove-bookmark (article) | |
7331 "Remove the bookmark from the current article." | |
7332 (interactive (list (gnus-summary-article-number))) | |
7333 (gnus-set-global-variables) | |
7334 ;; Remove old bookmark, if one exists. | |
7335 (let ((old (assq article gnus-newsgroup-bookmarks))) | |
7336 (if old | |
7337 (progn | |
7338 (setq gnus-newsgroup-bookmarks | |
7339 (delq old gnus-newsgroup-bookmarks)) | |
7340 (gnus-message 6 "Removed bookmark.")) | |
7341 (gnus-message 6 "No bookmark in current article.")))) | |
7342 | |
7343 ;; Suggested by Daniel Quinlan <quinlan@best.com>. | |
7344 (defun gnus-summary-mark-as-dormant (n) | |
7345 "Mark N articles forward as dormant. | |
7346 If N is negative, mark backward instead. The difference between N and | |
7347 the actual number of articles marked is returned." | |
7348 (interactive "p") | |
7349 (gnus-set-global-variables) | |
7350 (gnus-summary-mark-forward n gnus-dormant-mark)) | |
7351 | |
7352 (defun gnus-summary-set-process-mark (article) | |
7353 "Set the process mark on ARTICLE and update the summary line." | |
7354 (setq gnus-newsgroup-processable | |
7355 (cons article | |
7356 (delq article gnus-newsgroup-processable))) | |
7357 (when (gnus-summary-goto-subject article) | |
7358 (gnus-summary-show-thread) | |
7359 (gnus-summary-update-secondary-mark article))) | |
7360 | |
7361 (defun gnus-summary-remove-process-mark (article) | |
7362 "Remove the process mark from ARTICLE and update the summary line." | |
7363 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable)) | |
7364 (when (gnus-summary-goto-subject article) | |
7365 (gnus-summary-show-thread) | |
7366 (gnus-summary-update-secondary-mark article))) | |
7367 | |
7368 (defun gnus-summary-set-saved-mark (article) | |
7369 "Set the process mark on ARTICLE and update the summary line." | |
7370 (push article gnus-newsgroup-saved) | |
7371 (when (gnus-summary-goto-subject article) | |
7372 (gnus-summary-update-secondary-mark article))) | |
7373 | |
7374 (defun gnus-summary-mark-forward (n &optional mark no-expire) | |
7375 "Mark N articles as read forwards. | |
7376 If N is negative, mark backwards instead. Mark with MARK, ?r by default. | |
7377 The difference between N and the actual number of articles marked is | |
7378 returned." | |
7379 (interactive "p") | |
7380 (gnus-set-global-variables) | |
7381 (let ((backward (< n 0)) | |
7382 (gnus-summary-goto-unread | |
7383 (and gnus-summary-goto-unread | |
7384 (not (eq gnus-summary-goto-unread 'never)) | |
7385 (not (memq mark (list gnus-unread-mark | |
7386 gnus-ticked-mark gnus-dormant-mark))))) | |
7387 (n (abs n)) | |
7388 (mark (or mark gnus-del-mark))) | |
7389 (while (and (> n 0) | |
7390 (gnus-summary-mark-article nil mark no-expire) | |
7391 (zerop (gnus-summary-next-subject | |
7392 (if backward -1 1) | |
7393 (and gnus-summary-goto-unread | |
7394 (not (eq gnus-summary-goto-unread 'never))) | |
7395 t))) | |
7396 (setq n (1- n))) | |
7397 (when (/= 0 n) | |
7398 (gnus-message 7 "No more %sarticles" (if mark "" "unread "))) | |
7399 (gnus-summary-recenter) | |
7400 (gnus-summary-position-point) | |
7401 (gnus-set-mode-line 'summary) | |
7402 n)) | |
7403 | |
7404 (defun gnus-summary-mark-article-as-read (mark) | |
7405 "Mark the current article quickly as read with MARK." | |
7406 (let ((article (gnus-summary-article-number))) | |
7407 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7408 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7409 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7410 (push (cons article mark) gnus-newsgroup-reads) | |
7411 ;; Possibly remove from cache, if that is used. | |
7412 (when gnus-use-cache | |
7413 (gnus-cache-enter-remove-article article)) | |
7414 ;; Allow the backend to change the mark. | |
7415 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark)) | |
7416 ;; Check for auto-expiry. | |
7417 (when (and gnus-newsgroup-auto-expire | |
7418 (or (= mark gnus-killed-mark) (= mark gnus-del-mark) | |
7419 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark) | |
7420 (= mark gnus-ancient-mark) | |
7421 (= mark gnus-read-mark) (= mark gnus-souped-mark) | |
7422 (= mark gnus-duplicate-mark))) | |
7423 (setq mark gnus-expirable-mark) | |
7424 (push article gnus-newsgroup-expirable)) | |
7425 ;; Set the mark in the buffer. | |
7426 (gnus-summary-update-mark mark 'unread) | |
7427 t)) | |
7428 | |
7429 (defun gnus-summary-mark-article-as-unread (mark) | |
7430 "Mark the current article quickly as unread with MARK." | |
7431 (let ((article (gnus-summary-article-number))) | |
7432 (if (< article 0) | |
7433 (gnus-error 1 "Unmarkable article") | |
7434 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7435 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7436 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)) | |
7437 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads)) | |
7438 (cond ((= mark gnus-ticked-mark) | |
7439 (push article gnus-newsgroup-marked)) | |
7440 ((= mark gnus-dormant-mark) | |
7441 (push article gnus-newsgroup-dormant)) | |
7442 (t | |
7443 (push article gnus-newsgroup-unreads))) | |
7444 (setq gnus-newsgroup-reads | |
7445 (delq (assq article gnus-newsgroup-reads) | |
7446 gnus-newsgroup-reads)) | |
7447 | |
7448 ;; See whether the article is to be put in the cache. | |
7449 (and gnus-use-cache | |
7450 (vectorp (gnus-summary-article-header article)) | |
7451 (save-excursion | |
7452 (gnus-cache-possibly-enter-article | |
7453 gnus-newsgroup-name article | |
7454 (gnus-summary-article-header article) | |
7455 (= mark gnus-ticked-mark) | |
7456 (= mark gnus-dormant-mark) (= mark gnus-unread-mark)))) | |
7457 | |
7458 ;; Fix the mark. | |
7459 (gnus-summary-update-mark mark 'unread)) | |
7460 t)) | |
7461 | |
7462 (defun gnus-summary-mark-article (&optional article mark no-expire) | |
7463 "Mark ARTICLE with MARK. MARK can be any character. | |
7464 Four MARK strings are reserved: `? ' (unread), `?!' (ticked), | |
7465 `??' (dormant) and `?E' (expirable). | |
7466 If MARK is nil, then the default character `?D' is used. | |
7467 If ARTICLE is nil, then the article on the current line will be | |
7468 marked." | |
7469 ;; The mark might be a string. | |
7470 (when (stringp mark) | |
7471 (setq mark (aref mark 0))) | |
7472 ;; If no mark is given, then we check auto-expiring. | |
7473 (and (not no-expire) | |
7474 gnus-newsgroup-auto-expire | |
7475 (or (not mark) | |
7476 (and (gnus-characterp mark) | |
7477 (or (= mark gnus-killed-mark) (= mark gnus-del-mark) | |
7478 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark) | |
7479 (= mark gnus-read-mark) (= mark gnus-souped-mark) | |
7480 (= mark gnus-duplicate-mark)))) | |
7481 (setq mark gnus-expirable-mark)) | |
7482 (let* ((mark (or mark gnus-del-mark)) | |
7483 (article (or article (gnus-summary-article-number)))) | |
7484 (unless article | |
7485 (error "No article on current line")) | |
7486 (if (or (= mark gnus-unread-mark) | |
7487 (= mark gnus-ticked-mark) | |
7488 (= mark gnus-dormant-mark)) | |
7489 (gnus-mark-article-as-unread article mark) | |
7490 (gnus-mark-article-as-read article mark)) | |
7491 | |
7492 ;; See whether the article is to be put in the cache. | |
7493 (and gnus-use-cache | |
7494 (not (= mark gnus-canceled-mark)) | |
7495 (vectorp (gnus-summary-article-header article)) | |
7496 (save-excursion | |
7497 (gnus-cache-possibly-enter-article | |
7498 gnus-newsgroup-name article | |
7499 (gnus-summary-article-header article) | |
7500 (= mark gnus-ticked-mark) | |
7501 (= mark gnus-dormant-mark) (= mark gnus-unread-mark)))) | |
7502 | |
7503 (when (gnus-summary-goto-subject article nil t) | |
7504 (let ((buffer-read-only nil)) | |
7505 (gnus-summary-show-thread) | |
7506 ;; Fix the mark. | |
7507 (gnus-summary-update-mark mark 'unread) | |
7508 t)))) | |
7509 | |
7510 (defun gnus-summary-update-secondary-mark (article) | |
7511 "Update the secondary (read, process, cache) mark." | |
7512 (gnus-summary-update-mark | |
7513 (cond ((memq article gnus-newsgroup-processable) | |
7514 gnus-process-mark) | |
7515 ((memq article gnus-newsgroup-cached) | |
7516 gnus-cached-mark) | |
7517 ((memq article gnus-newsgroup-replied) | |
7518 gnus-replied-mark) | |
7519 ((memq article gnus-newsgroup-saved) | |
7520 gnus-saved-mark) | |
7521 (t gnus-unread-mark)) | |
7522 'replied) | |
7523 (when (gnus-visual-p 'summary-highlight 'highlight) | |
7524 (run-hooks 'gnus-summary-update-hook)) | |
7525 t) | |
7526 | |
7527 (defun gnus-summary-update-mark (mark type) | |
7528 (let ((forward (cdr (assq type gnus-summary-mark-positions))) | |
7529 (buffer-read-only nil)) | |
7530 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit) | |
7531 (when (looking-at "\r") | |
7532 (incf forward)) | |
7533 (when (and forward | |
7534 (<= (+ forward (point)) (point-max))) | |
7535 ;; Go to the right position on the line. | |
7536 (goto-char (+ forward (point))) | |
7537 ;; Replace the old mark with the new mark. | |
7538 (subst-char-in-region (point) (1+ (point)) (following-char) mark) | |
7539 ;; Optionally update the marks by some user rule. | |
7540 (when (eq type 'unread) | |
7541 (gnus-data-set-mark | |
7542 (gnus-data-find (gnus-summary-article-number)) mark) | |
7543 (gnus-summary-update-line (eq mark gnus-unread-mark)))))) | |
7544 | |
7545 (defun gnus-mark-article-as-read (article &optional mark) | |
7546 "Enter ARTICLE in the pertinent lists and remove it from others." | |
7547 ;; Make the article expirable. | |
7548 (let ((mark (or mark gnus-del-mark))) | |
7549 (if (= mark gnus-expirable-mark) | |
7550 (push article gnus-newsgroup-expirable) | |
7551 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))) | |
7552 ;; Remove from unread and marked lists. | |
7553 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7554 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7555 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7556 (push (cons article mark) gnus-newsgroup-reads) | |
7557 ;; Possibly remove from cache, if that is used. | |
7558 (when gnus-use-cache | |
7559 (gnus-cache-enter-remove-article article)))) | |
7560 | |
7561 (defun gnus-mark-article-as-unread (article &optional mark) | |
7562 "Enter ARTICLE in the pertinent lists and remove it from others." | |
7563 (let ((mark (or mark gnus-ticked-mark))) | |
7564 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked) | |
7565 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant) | |
7566 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable) | |
7567 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7568 | |
7569 ;; Unsuppress duplicates? | |
7570 (when gnus-suppress-duplicates | |
7571 (gnus-dup-unsuppress-article article)) | |
7572 | |
7573 (cond ((= mark gnus-ticked-mark) | |
7574 (push article gnus-newsgroup-marked)) | |
7575 ((= mark gnus-dormant-mark) | |
7576 (push article gnus-newsgroup-dormant)) | |
7577 (t | |
7578 (push article gnus-newsgroup-unreads))) | |
7579 (setq gnus-newsgroup-reads | |
7580 (delq (assq article gnus-newsgroup-reads) | |
7581 gnus-newsgroup-reads)))) | |
7582 | |
7583 (defalias 'gnus-summary-mark-as-unread-forward | |
7584 'gnus-summary-tick-article-forward) | |
7585 (make-obsolete 'gnus-summary-mark-as-unread-forward | |
7586 'gnus-summary-tick-article-forward) | |
7587 (defun gnus-summary-tick-article-forward (n) | |
7588 "Tick N articles forwards. | |
7589 If N is negative, tick backwards instead. | |
7590 The difference between N and the number of articles ticked is returned." | |
7591 (interactive "p") | |
7592 (gnus-summary-mark-forward n gnus-ticked-mark)) | |
7593 | |
7594 (defalias 'gnus-summary-mark-as-unread-backward | |
7595 'gnus-summary-tick-article-backward) | |
7596 (make-obsolete 'gnus-summary-mark-as-unread-backward | |
7597 'gnus-summary-tick-article-backward) | |
7598 (defun gnus-summary-tick-article-backward (n) | |
7599 "Tick N articles backwards. | |
7600 The difference between N and the number of articles ticked is returned." | |
7601 (interactive "p") | |
7602 (gnus-summary-mark-forward (- n) gnus-ticked-mark)) | |
7603 | |
7604 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article) | |
7605 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article) | |
7606 (defun gnus-summary-tick-article (&optional article clear-mark) | |
7607 "Mark current article as unread. | |
7608 Optional 1st argument ARTICLE specifies article number to be marked as unread. | |
7609 Optional 2nd argument CLEAR-MARK remove any kinds of mark." | |
7610 (interactive) | |
7611 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark | |
7612 gnus-ticked-mark))) | |
7613 | |
7614 (defun gnus-summary-mark-as-read-forward (n) | |
7615 "Mark N articles as read forwards. | |
7616 If N is negative, mark backwards instead. | |
7617 The difference between N and the actual number of articles marked is | |
7618 returned." | |
7619 (interactive "p") | |
7620 (gnus-summary-mark-forward n gnus-del-mark t)) | |
7621 | |
7622 (defun gnus-summary-mark-as-read-backward (n) | |
7623 "Mark the N articles as read backwards. | |
7624 The difference between N and the actual number of articles marked is | |
7625 returned." | |
7626 (interactive "p") | |
7627 (gnus-summary-mark-forward (- n) gnus-del-mark t)) | |
7628 | |
7629 (defun gnus-summary-mark-as-read (&optional article mark) | |
7630 "Mark current article as read. | |
7631 ARTICLE specifies the article to be marked as read. | |
7632 MARK specifies a string to be inserted at the beginning of the line." | |
7633 (gnus-summary-mark-article article mark)) | |
7634 | |
7635 (defun gnus-summary-clear-mark-forward (n) | |
7636 "Clear marks from N articles forward. | |
7637 If N is negative, clear backward instead. | |
7638 The difference between N and the number of marks cleared is returned." | |
7639 (interactive "p") | |
7640 (gnus-summary-mark-forward n gnus-unread-mark)) | |
7641 | |
7642 (defun gnus-summary-clear-mark-backward (n) | |
7643 "Clear marks from N articles backward. | |
7644 The difference between N and the number of marks cleared is returned." | |
7645 (interactive "p") | |
7646 (gnus-summary-mark-forward (- n) gnus-unread-mark)) | |
7647 | |
7648 (defun gnus-summary-mark-unread-as-read () | |
7649 "Intended to be used by `gnus-summary-mark-article-hook'." | |
7650 (when (memq gnus-current-article gnus-newsgroup-unreads) | |
7651 (gnus-summary-mark-article gnus-current-article gnus-read-mark))) | |
7652 | |
7653 (defun gnus-summary-mark-read-and-unread-as-read () | |
7654 "Intended to be used by `gnus-summary-mark-article-hook'." | |
7655 (let ((mark (gnus-summary-article-mark))) | |
7656 (when (or (gnus-unread-mark-p mark) | |
7657 (gnus-read-mark-p mark)) | |
7658 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))) | |
7659 | |
7660 (defun gnus-summary-mark-region-as-read (point mark all) | |
7661 "Mark all unread articles between point and mark as read. | |
7662 If given a prefix, mark all articles between point and mark as read, | |
7663 even ticked and dormant ones." | |
7664 (interactive "r\nP") | |
7665 (save-excursion | |
7666 (let (article) | |
7667 (goto-char point) | |
7668 (beginning-of-line) | |
7669 (while (and | |
7670 (< (point) mark) | |
7671 (progn | |
7672 (when (or all | |
7673 (memq (setq article (gnus-summary-article-number)) | |
7674 gnus-newsgroup-unreads)) | |
7675 (gnus-summary-mark-article article gnus-del-mark)) | |
7676 t) | |
7677 (gnus-summary-find-next)))))) | |
7678 | |
7679 (defun gnus-summary-mark-below (score mark) | |
7680 "Mark articles with score less than SCORE with MARK." | |
7681 (interactive "P\ncMark: ") | |
7682 (gnus-set-global-variables) | |
7683 (setq score (if score | |
7684 (prefix-numeric-value score) | |
7685 (or gnus-summary-default-score 0))) | |
7686 (save-excursion | |
7687 (set-buffer gnus-summary-buffer) | |
7688 (goto-char (point-min)) | |
7689 (while | |
7690 (progn | |
7691 (and (< (gnus-summary-article-score) score) | |
7692 (gnus-summary-mark-article nil mark)) | |
7693 (gnus-summary-find-next))))) | |
7694 | |
7695 (defun gnus-summary-kill-below (&optional score) | |
7696 "Mark articles with score below SCORE as read." | |
7697 (interactive "P") | |
7698 (gnus-set-global-variables) | |
7699 (gnus-summary-mark-below score gnus-killed-mark)) | |
7700 | |
7701 (defun gnus-summary-clear-above (&optional score) | |
7702 "Clear all marks from articles with score above SCORE." | |
7703 (interactive "P") | |
7704 (gnus-set-global-variables) | |
7705 (gnus-summary-mark-above score gnus-unread-mark)) | |
7706 | |
7707 (defun gnus-summary-tick-above (&optional score) | |
7708 "Tick all articles with score above SCORE." | |
7709 (interactive "P") | |
7710 (gnus-set-global-variables) | |
7711 (gnus-summary-mark-above score gnus-ticked-mark)) | |
7712 | |
7713 (defun gnus-summary-mark-above (score mark) | |
7714 "Mark articles with score over SCORE with MARK." | |
7715 (interactive "P\ncMark: ") | |
7716 (gnus-set-global-variables) | |
7717 (setq score (if score | |
7718 (prefix-numeric-value score) | |
7719 (or gnus-summary-default-score 0))) | |
7720 (save-excursion | |
7721 (set-buffer gnus-summary-buffer) | |
7722 (goto-char (point-min)) | |
7723 (while (and (progn | |
7724 (when (> (gnus-summary-article-score) score) | |
7725 (gnus-summary-mark-article nil mark)) | |
7726 t) | |
7727 (gnus-summary-find-next))))) | |
7728 | |
7729 ;; Suggested by Daniel Quinlan <quinlan@best.com>. | |
7730 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged) | |
7731 (defun gnus-summary-limit-include-expunged (&optional no-error) | |
7732 "Display all the hidden articles that were expunged for low scores." | |
7733 (interactive) | |
7734 (gnus-set-global-variables) | |
7735 (let ((buffer-read-only nil)) | |
7736 (let ((scored gnus-newsgroup-scored) | |
7737 headers h) | |
7738 (while scored | |
7739 (unless (gnus-summary-goto-subject (caar scored)) | |
7740 (and (setq h (gnus-summary-article-header (caar scored))) | |
7741 (< (cdar scored) gnus-summary-expunge-below) | |
7742 (push h headers))) | |
7743 (setq scored (cdr scored))) | |
7744 (if (not headers) | |
7745 (when (not no-error) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7746 (error "No expunged articles hidden")) |
17493 | 7747 (goto-char (point-min)) |
7748 (gnus-summary-prepare-unthreaded (nreverse headers)) | |
7749 (goto-char (point-min)) | |
7750 (gnus-summary-position-point) | |
7751 t)))) | |
7752 | |
7753 (defun gnus-summary-catchup (&optional all quietly to-here not-mark) | |
7754 "Mark all unread articles in this newsgroup as read. | |
7755 If prefix argument ALL is non-nil, ticked and dormant articles will | |
7756 also be marked as read. | |
7757 If QUIETLY is non-nil, no questions will be asked. | |
7758 If TO-HERE is non-nil, it should be a point in the buffer. All | |
7759 articles before this point will be marked as read. | |
7760 Note that this function will only catch up the unread article | |
7761 in the current summary buffer limitation. | |
7762 The number of articles marked as read is returned." | |
7763 (interactive "P") | |
7764 (gnus-set-global-variables) | |
7765 (prog1 | |
7766 (save-excursion | |
7767 (when (or quietly | |
7768 (not gnus-interactive-catchup) ;Without confirmation? | |
7769 gnus-expert-user | |
7770 (gnus-y-or-n-p | |
7771 (if all | |
7772 "Mark absolutely all articles as read? " | |
7773 "Mark all unread articles as read? "))) | |
7774 (if (and not-mark | |
7775 (not gnus-newsgroup-adaptive) | |
7776 (not gnus-newsgroup-auto-expire) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7777 (not gnus-suppress-duplicates) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7778 (or (not gnus-use-cache) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7779 (not (eq gnus-use-cache 'passive)))) |
17493 | 7780 (progn |
7781 (when all | |
7782 (setq gnus-newsgroup-marked nil | |
7783 gnus-newsgroup-dormant nil)) | |
7784 (setq gnus-newsgroup-unreads nil)) | |
7785 ;; We actually mark all articles as canceled, which we | |
7786 ;; have to do when using auto-expiry or adaptive scoring. | |
7787 (gnus-summary-show-all-threads) | |
7788 (when (gnus-summary-first-subject (not all)) | |
7789 (while (and | |
7790 (if to-here (< (point) to-here) t) | |
7791 (gnus-summary-mark-article-as-read gnus-catchup-mark) | |
7792 (gnus-summary-find-next (not all))))) | |
7793 (gnus-set-mode-line 'summary)) | |
7794 t)) | |
7795 (gnus-summary-position-point))) | |
7796 | |
7797 (defun gnus-summary-catchup-to-here (&optional all) | |
7798 "Mark all unticked articles before the current one as read. | |
7799 If ALL is non-nil, also mark ticked and dormant articles as read." | |
7800 (interactive "P") | |
7801 (gnus-set-global-variables) | |
7802 (save-excursion | |
7803 (gnus-save-hidden-threads | |
7804 (let ((beg (point))) | |
7805 ;; We check that there are unread articles. | |
7806 (when (or all (gnus-summary-find-prev)) | |
7807 (gnus-summary-catchup all t beg))))) | |
7808 (gnus-summary-position-point)) | |
7809 | |
7810 (defun gnus-summary-catchup-all (&optional quietly) | |
7811 "Mark all articles in this newsgroup as read." | |
7812 (interactive "P") | |
7813 (gnus-set-global-variables) | |
7814 (gnus-summary-catchup t quietly)) | |
7815 | |
7816 (defun gnus-summary-catchup-and-exit (&optional all quietly) | |
7817 "Mark all articles not marked as unread in this newsgroup as read, then exit. | |
7818 If prefix argument ALL is non-nil, all articles are marked as read." | |
7819 (interactive "P") | |
7820 (gnus-set-global-variables) | |
7821 (when (gnus-summary-catchup all quietly nil 'fast) | |
7822 ;; Select next newsgroup or exit. | |
7823 (if (eq gnus-auto-select-next 'quietly) | |
7824 (gnus-summary-next-group nil) | |
7825 (gnus-summary-exit)))) | |
7826 | |
7827 (defun gnus-summary-catchup-all-and-exit (&optional quietly) | |
7828 "Mark all articles in this newsgroup as read, and then exit." | |
7829 (interactive "P") | |
7830 (gnus-set-global-variables) | |
7831 (gnus-summary-catchup-and-exit t quietly)) | |
7832 | |
7833 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>. | |
7834 (defun gnus-summary-catchup-and-goto-next-group (&optional all) | |
7835 "Mark all articles in this group as read and select the next group. | |
7836 If given a prefix, mark all articles, unread as well as ticked, as | |
7837 read." | |
7838 (interactive "P") | |
7839 (gnus-set-global-variables) | |
7840 (save-excursion | |
7841 (gnus-summary-catchup all)) | |
7842 (gnus-summary-next-article t nil nil t)) | |
7843 | |
7844 ;; Thread-based commands. | |
7845 | |
7846 (defun gnus-summary-articles-in-thread (&optional article) | |
7847 "Return a list of all articles in the current thread. | |
7848 If ARTICLE is non-nil, return all articles in the thread that starts | |
7849 with that article." | |
7850 (let* ((article (or article (gnus-summary-article-number))) | |
7851 (data (gnus-data-find-list article)) | |
7852 (top-level (gnus-data-level (car data))) | |
7853 (top-subject | |
7854 (cond ((null gnus-thread-operation-ignore-subject) | |
7855 (gnus-simplify-subject-re | |
7856 (mail-header-subject (gnus-data-header (car data))))) | |
7857 ((eq gnus-thread-operation-ignore-subject 'fuzzy) | |
7858 (gnus-simplify-subject-fuzzy | |
7859 (mail-header-subject (gnus-data-header (car data))))) | |
7860 (t nil))) | |
7861 (end-point (save-excursion | |
7862 (if (gnus-summary-go-to-next-thread) | |
7863 (point) (point-max)))) | |
7864 articles) | |
7865 (while (and data | |
7866 (< (gnus-data-pos (car data)) end-point)) | |
7867 (when (or (not top-subject) | |
7868 (string= top-subject | |
7869 (if (eq gnus-thread-operation-ignore-subject 'fuzzy) | |
7870 (gnus-simplify-subject-fuzzy | |
7871 (mail-header-subject | |
7872 (gnus-data-header (car data)))) | |
7873 (gnus-simplify-subject-re | |
7874 (mail-header-subject | |
7875 (gnus-data-header (car data))))))) | |
7876 (push (gnus-data-number (car data)) articles)) | |
7877 (unless (and (setq data (cdr data)) | |
7878 (> (gnus-data-level (car data)) top-level)) | |
7879 (setq data nil))) | |
7880 ;; Return the list of articles. | |
7881 (nreverse articles))) | |
7882 | |
7883 (defun gnus-summary-rethread-current () | |
7884 "Rethread the thread the current article is part of." | |
7885 (interactive) | |
7886 (gnus-set-global-variables) | |
7887 (let* ((gnus-show-threads t) | |
7888 (article (gnus-summary-article-number)) | |
7889 (id (mail-header-id (gnus-summary-article-header))) | |
7890 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id))))) | |
7891 (unless id | |
7892 (error "No article on the current line")) | |
7893 (gnus-rebuild-thread id) | |
7894 (gnus-summary-goto-subject article))) | |
7895 | |
7896 (defun gnus-summary-reparent-thread () | |
7897 "Make the current article child of the marked (or previous) article. | |
7898 | |
7899 Note that the re-threading will only work if `gnus-thread-ignore-subject' | |
7900 is non-nil or the Subject: of both articles are the same." | |
7901 (interactive) | |
7902 (unless (not (gnus-group-read-only-p)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7903 (error "The current newsgroup does not support article editing")) |
17493 | 7904 (unless (<= (length gnus-newsgroup-processable) 1) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7905 (error "No more than one article may be marked")) |
17493 | 7906 (save-window-excursion |
7907 (let ((gnus-article-buffer " *reparent*") | |
7908 (current-article (gnus-summary-article-number)) | |
7909 ;; First grab the marked article, otherwise one line up. | |
7910 (parent-article (if (not (null gnus-newsgroup-processable)) | |
7911 (car gnus-newsgroup-processable) | |
7912 (save-excursion | |
7913 (if (eq (forward-line -1) 0) | |
7914 (gnus-summary-article-number) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7915 (error "Beginning of summary buffer")))))) |
17493 | 7916 (unless (not (eq current-article parent-article)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7917 (error "An article may not be self-referential")) |
17493 | 7918 (let ((message-id (mail-header-id |
7919 (gnus-summary-article-header parent-article)))) | |
7920 (unless (and message-id (not (equal message-id ""))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7921 (error "No message-id in desired parent")) |
17493 | 7922 (gnus-summary-select-article t t nil current-article) |
7923 (set-buffer gnus-original-article-buffer) | |
7924 (let ((buf (format "%s" (buffer-string)))) | |
7925 (nnheader-temp-write nil | |
7926 (insert buf) | |
7927 (goto-char (point-min)) | |
7928 (if (search-forward-regexp "^References: " nil t) | |
7929 (insert message-id " " ) | |
7930 (insert "References: " message-id "\n")) | |
7931 (unless (gnus-request-replace-article | |
7932 current-article (car gnus-article-current) | |
7933 (current-buffer)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7934 (error "Couldn't replace article")))) |
17493 | 7935 (set-buffer gnus-summary-buffer) |
7936 (gnus-summary-unmark-all-processable) | |
7937 (gnus-summary-rethread-current) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7938 (gnus-message 3 "Article %d is now the child of article %d" |
17493 | 7939 current-article parent-article))))) |
7940 | |
7941 (defun gnus-summary-toggle-threads (&optional arg) | |
7942 "Toggle showing conversation threads. | |
7943 If ARG is positive number, turn showing conversation threads on." | |
7944 (interactive "P") | |
7945 (gnus-set-global-variables) | |
7946 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end))) | |
7947 (setq gnus-show-threads | |
7948 (if (null arg) (not gnus-show-threads) | |
7949 (> (prefix-numeric-value arg) 0))) | |
7950 (gnus-summary-prepare) | |
7951 (gnus-summary-goto-subject current) | |
7952 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off")) | |
7953 (gnus-summary-position-point))) | |
7954 | |
7955 (defun gnus-summary-show-all-threads () | |
7956 "Show all threads." | |
7957 (interactive) | |
7958 (gnus-set-global-variables) | |
7959 (save-excursion | |
7960 (let ((buffer-read-only nil)) | |
7961 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t))) | |
7962 (gnus-summary-position-point)) | |
7963 | |
7964 (defun gnus-summary-show-thread () | |
7965 "Show thread subtrees. | |
7966 Returns nil if no thread was there to be shown." | |
7967 (interactive) | |
7968 (gnus-set-global-variables) | |
7969 (let ((buffer-read-only nil) | |
7970 (orig (point)) | |
7971 ;; first goto end then to beg, to have point at beg after let | |
7972 (end (progn (end-of-line) (point))) | |
7973 (beg (progn (beginning-of-line) (point)))) | |
7974 (prog1 | |
7975 ;; Any hidden lines here? | |
7976 (search-forward "\r" end t) | |
7977 (subst-char-in-region beg end ?\^M ?\n t) | |
7978 (goto-char orig) | |
7979 (gnus-summary-position-point)))) | |
7980 | |
7981 (defun gnus-summary-hide-all-threads () | |
7982 "Hide all thread subtrees." | |
7983 (interactive) | |
7984 (gnus-set-global-variables) | |
7985 (save-excursion | |
7986 (goto-char (point-min)) | |
7987 (gnus-summary-hide-thread) | |
7988 (while (zerop (gnus-summary-next-thread 1 t)) | |
7989 (gnus-summary-hide-thread))) | |
7990 (gnus-summary-position-point)) | |
7991 | |
7992 (defun gnus-summary-hide-thread () | |
7993 "Hide thread subtrees. | |
7994 Returns nil if no threads were there to be hidden." | |
7995 (interactive) | |
7996 (gnus-set-global-variables) | |
7997 (let ((buffer-read-only nil) | |
7998 (start (point)) | |
7999 (article (gnus-summary-article-number))) | |
8000 (goto-char start) | |
8001 ;; Go forward until either the buffer ends or the subthread | |
8002 ;; ends. | |
8003 (when (and (not (eobp)) | |
8004 (or (zerop (gnus-summary-next-thread 1 t)) | |
8005 (goto-char (point-max)))) | |
8006 (prog1 | |
8007 (if (and (> (point) start) | |
8008 (search-backward "\n" start t)) | |
8009 (progn | |
8010 (subst-char-in-region start (point) ?\n ?\^M) | |
8011 (gnus-summary-goto-subject article)) | |
8012 (goto-char start) | |
8013 nil) | |
8014 ;;(gnus-summary-position-point) | |
8015 )))) | |
8016 | |
8017 (defun gnus-summary-go-to-next-thread (&optional previous) | |
8018 "Go to the same level (or less) next thread. | |
8019 If PREVIOUS is non-nil, go to previous thread instead. | |
8020 Return the article number moved to, or nil if moving was impossible." | |
8021 (let ((level (gnus-summary-thread-level)) | |
8022 (way (if previous -1 1)) | |
8023 (beg (point))) | |
8024 (forward-line way) | |
8025 (while (and (not (eobp)) | |
8026 (< level (gnus-summary-thread-level))) | |
8027 (forward-line way)) | |
8028 (if (eobp) | |
8029 (progn | |
8030 (goto-char beg) | |
8031 nil) | |
8032 (setq beg (point)) | |
8033 (prog1 | |
8034 (gnus-summary-article-number) | |
8035 (goto-char beg))))) | |
8036 | |
8037 (defun gnus-summary-next-thread (n &optional silent) | |
8038 "Go to the same level next N'th thread. | |
8039 If N is negative, search backward instead. | |
8040 Returns the difference between N and the number of skips actually | |
8041 done. | |
8042 | |
8043 If SILENT, don't output messages." | |
8044 (interactive "p") | |
8045 (gnus-set-global-variables) | |
8046 (let ((backward (< n 0)) | |
8047 (n (abs n))) | |
8048 (while (and (> n 0) | |
8049 (gnus-summary-go-to-next-thread backward)) | |
8050 (decf n)) | |
8051 (unless silent | |
8052 (gnus-summary-position-point)) | |
8053 (when (and (not silent) (/= 0 n)) | |
8054 (gnus-message 7 "No more threads")) | |
8055 n)) | |
8056 | |
8057 (defun gnus-summary-prev-thread (n) | |
8058 "Go to the same level previous N'th thread. | |
8059 Returns the difference between N and the number of skips actually | |
8060 done." | |
8061 (interactive "p") | |
8062 (gnus-set-global-variables) | |
8063 (gnus-summary-next-thread (- n))) | |
8064 | |
8065 (defun gnus-summary-go-down-thread () | |
8066 "Go down one level in the current thread." | |
8067 (let ((children (gnus-summary-article-children))) | |
8068 (when children | |
8069 (gnus-summary-goto-subject (car children))))) | |
8070 | |
8071 (defun gnus-summary-go-up-thread () | |
8072 "Go up one level in the current thread." | |
8073 (let ((parent (gnus-summary-article-parent))) | |
8074 (when parent | |
8075 (gnus-summary-goto-subject parent)))) | |
8076 | |
8077 (defun gnus-summary-down-thread (n) | |
8078 "Go down thread N steps. | |
8079 If N is negative, go up instead. | |
8080 Returns the difference between N and how many steps down that were | |
8081 taken." | |
8082 (interactive "p") | |
8083 (gnus-set-global-variables) | |
8084 (let ((up (< n 0)) | |
8085 (n (abs n))) | |
8086 (while (and (> n 0) | |
8087 (if up (gnus-summary-go-up-thread) | |
8088 (gnus-summary-go-down-thread))) | |
8089 (setq n (1- n))) | |
8090 (gnus-summary-position-point) | |
8091 (when (/= 0 n) | |
8092 (gnus-message 7 "Can't go further")) | |
8093 n)) | |
8094 | |
8095 (defun gnus-summary-up-thread (n) | |
8096 "Go up thread N steps. | |
8097 If N is negative, go up instead. | |
8098 Returns the difference between N and how many steps down that were | |
8099 taken." | |
8100 (interactive "p") | |
8101 (gnus-set-global-variables) | |
8102 (gnus-summary-down-thread (- n))) | |
8103 | |
8104 (defun gnus-summary-top-thread () | |
8105 "Go to the top of the thread." | |
8106 (interactive) | |
8107 (gnus-set-global-variables) | |
8108 (while (gnus-summary-go-up-thread)) | |
8109 (gnus-summary-article-number)) | |
8110 | |
8111 (defun gnus-summary-kill-thread (&optional unmark) | |
8112 "Mark articles under current thread as read. | |
8113 If the prefix argument is positive, remove any kinds of marks. | |
8114 If the prefix argument is negative, tick articles instead." | |
8115 (interactive "P") | |
8116 (gnus-set-global-variables) | |
8117 (when unmark | |
8118 (setq unmark (prefix-numeric-value unmark))) | |
8119 (let ((articles (gnus-summary-articles-in-thread))) | |
8120 (save-excursion | |
8121 ;; Expand the thread. | |
8122 (gnus-summary-show-thread) | |
8123 ;; Mark all the articles. | |
8124 (while articles | |
8125 (gnus-summary-goto-subject (car articles)) | |
8126 (cond ((null unmark) | |
8127 (gnus-summary-mark-article-as-read gnus-killed-mark)) | |
8128 ((> unmark 0) | |
8129 (gnus-summary-mark-article-as-unread gnus-unread-mark)) | |
8130 (t | |
8131 (gnus-summary-mark-article-as-unread gnus-ticked-mark))) | |
8132 (setq articles (cdr articles)))) | |
8133 ;; Hide killed subtrees. | |
8134 (and (null unmark) | |
8135 gnus-thread-hide-killed | |
8136 (gnus-summary-hide-thread)) | |
8137 ;; If marked as read, go to next unread subject. | |
8138 (when (null unmark) | |
8139 ;; Go to next unread subject. | |
8140 (gnus-summary-next-subject 1 t))) | |
8141 (gnus-set-mode-line 'summary)) | |
8142 | |
8143 ;; Summary sorting commands | |
8144 | |
8145 (defun gnus-summary-sort-by-number (&optional reverse) | |
8146 "Sort the summary buffer by article number. | |
8147 Argument REVERSE means reverse order." | |
8148 (interactive "P") | |
8149 (gnus-summary-sort 'number reverse)) | |
8150 | |
8151 (defun gnus-summary-sort-by-author (&optional reverse) | |
8152 "Sort the summary buffer by author name alphabetically. | |
8153 If case-fold-search is non-nil, case of letters is ignored. | |
8154 Argument REVERSE means reverse order." | |
8155 (interactive "P") | |
8156 (gnus-summary-sort 'author reverse)) | |
8157 | |
8158 (defun gnus-summary-sort-by-subject (&optional reverse) | |
8159 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored. | |
8160 If case-fold-search is non-nil, case of letters is ignored. | |
8161 Argument REVERSE means reverse order." | |
8162 (interactive "P") | |
8163 (gnus-summary-sort 'subject reverse)) | |
8164 | |
8165 (defun gnus-summary-sort-by-date (&optional reverse) | |
8166 "Sort the summary buffer by date. | |
8167 Argument REVERSE means reverse order." | |
8168 (interactive "P") | |
8169 (gnus-summary-sort 'date reverse)) | |
8170 | |
8171 (defun gnus-summary-sort-by-score (&optional reverse) | |
8172 "Sort the summary buffer by score. | |
8173 Argument REVERSE means reverse order." | |
8174 (interactive "P") | |
8175 (gnus-summary-sort 'score reverse)) | |
8176 | |
8177 (defun gnus-summary-sort-by-lines (&optional reverse) | |
8178 "Sort the summary buffer by article length. | |
8179 Argument REVERSE means reverse order." | |
8180 (interactive "P") | |
8181 (gnus-summary-sort 'lines reverse)) | |
8182 | |
8183 (defun gnus-summary-sort (predicate reverse) | |
8184 "Sort summary buffer by PREDICATE. REVERSE means reverse order." | |
8185 (gnus-set-global-variables) | |
8186 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate))) | |
8187 (article (intern (format "gnus-article-sort-by-%s" predicate))) | |
8188 (gnus-thread-sort-functions | |
8189 (list | |
8190 (if (not reverse) | |
8191 thread | |
8192 `(lambda (t1 t2) | |
8193 (,thread t2 t1))))) | |
8194 (gnus-article-sort-functions | |
8195 (list | |
8196 (if (not reverse) | |
8197 article | |
8198 `(lambda (t1 t2) | |
8199 (,article t2 t1))))) | |
8200 (buffer-read-only) | |
8201 (gnus-summary-prepare-hook nil)) | |
8202 ;; We do the sorting by regenerating the threads. | |
8203 (gnus-summary-prepare) | |
8204 ;; Hide subthreads if needed. | |
8205 (when (and gnus-show-threads gnus-thread-hide-subtree) | |
8206 (gnus-summary-hide-all-threads)))) | |
8207 | |
8208 ;; Summary saving commands. | |
8209 | |
8210 (defun gnus-summary-save-article (&optional n not-saved) | |
8211 "Save the current article using the default saver function. | |
8212 If N is a positive number, save the N next articles. | |
8213 If N is a negative number, save the N previous articles. | |
8214 If N is nil and any articles have been marked with the process mark, | |
8215 save those articles instead. | |
8216 The variable `gnus-default-article-saver' specifies the saver function." | |
8217 (interactive "P") | |
8218 (gnus-set-global-variables) | |
8219 (let* ((articles (gnus-summary-work-articles n)) | |
8220 (save-buffer (save-excursion | |
8221 (nnheader-set-temp-buffer " *Gnus Save*"))) | |
8222 (num (length articles)) | |
8223 header article file) | |
8224 (while articles | |
8225 (setq header (gnus-summary-article-header | |
8226 (setq article (pop articles)))) | |
8227 (if (not (vectorp header)) | |
8228 ;; This is a pseudo-article. | |
8229 (if (assq 'name header) | |
8230 (gnus-copy-file (cdr (assq 'name header))) | |
8231 (gnus-message 1 "Article %d is unsaveable" article)) | |
8232 ;; This is a real article. | |
8233 (save-window-excursion | |
8234 (gnus-summary-select-article t nil nil article)) | |
8235 (save-excursion | |
8236 (set-buffer save-buffer) | |
8237 (erase-buffer) | |
8238 (insert-buffer-substring gnus-original-article-buffer)) | |
8239 (setq file (gnus-article-save save-buffer file num)) | |
8240 (gnus-summary-remove-process-mark article) | |
8241 (unless not-saved | |
8242 (gnus-summary-set-saved-mark article)))) | |
8243 (gnus-kill-buffer save-buffer) | |
8244 (gnus-summary-position-point) | |
8245 (gnus-set-mode-line 'summary) | |
8246 n)) | |
8247 | |
8248 (defun gnus-summary-pipe-output (&optional arg) | |
8249 "Pipe the current article to a subprocess. | |
8250 If N is a positive number, pipe the N next articles. | |
8251 If N is a negative number, pipe the N previous articles. | |
8252 If N is nil and any articles have been marked with the process mark, | |
8253 pipe those articles instead." | |
8254 (interactive "P") | |
8255 (gnus-set-global-variables) | |
8256 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)) | |
8257 (gnus-summary-save-article arg t)) | |
8258 (gnus-configure-windows 'pipe)) | |
8259 | |
8260 (defun gnus-summary-save-article-mail (&optional arg) | |
8261 "Append the current article to an mail file. | |
8262 If N is a positive number, save the N next articles. | |
8263 If N is a negative number, save the N previous articles. | |
8264 If N is nil and any articles have been marked with the process mark, | |
8265 save those articles instead." | |
8266 (interactive "P") | |
8267 (gnus-set-global-variables) | |
8268 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail)) | |
8269 (gnus-summary-save-article arg))) | |
8270 | |
8271 (defun gnus-summary-save-article-rmail (&optional arg) | |
8272 "Append the current article to an rmail file. | |
8273 If N is a positive number, save the N next articles. | |
8274 If N is a negative number, save the N previous articles. | |
8275 If N is nil and any articles have been marked with the process mark, | |
8276 save those articles instead." | |
8277 (interactive "P") | |
8278 (gnus-set-global-variables) | |
8279 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail)) | |
8280 (gnus-summary-save-article arg))) | |
8281 | |
8282 (defun gnus-summary-save-article-file (&optional arg) | |
8283 "Append the current article to a file. | |
8284 If N is a positive number, save the N next articles. | |
8285 If N is a negative number, save the N previous articles. | |
8286 If N is nil and any articles have been marked with the process mark, | |
8287 save those articles instead." | |
8288 (interactive "P") | |
8289 (gnus-set-global-variables) | |
8290 (let ((gnus-default-article-saver 'gnus-summary-save-in-file)) | |
8291 (gnus-summary-save-article arg))) | |
8292 | |
8293 (defun gnus-summary-write-article-file (&optional arg) | |
8294 "Write the current article to a file, deleting the previous file. | |
8295 If N is a positive number, save the N next articles. | |
8296 If N is a negative number, save the N previous articles. | |
8297 If N is nil and any articles have been marked with the process mark, | |
8298 save those articles instead." | |
8299 (interactive "P") | |
8300 (gnus-set-global-variables) | |
8301 (let ((gnus-default-article-saver 'gnus-summary-write-to-file)) | |
8302 (gnus-summary-save-article arg))) | |
8303 | |
8304 (defun gnus-summary-save-article-body-file (&optional arg) | |
8305 "Append the current article body to a file. | |
8306 If N is a positive number, save the N next articles. | |
8307 If N is a negative number, save the N previous articles. | |
8308 If N is nil and any articles have been marked with the process mark, | |
8309 save those articles instead." | |
8310 (interactive "P") | |
8311 (gnus-set-global-variables) | |
8312 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file)) | |
8313 (gnus-summary-save-article arg))) | |
8314 | |
8315 (defun gnus-summary-pipe-message (program) | |
8316 "Pipe the current article through PROGRAM." | |
8317 (interactive "sProgram: ") | |
8318 (gnus-set-global-variables) | |
8319 (gnus-summary-select-article) | |
8320 (let ((mail-header-separator "") | |
8321 (art-buf (get-buffer gnus-article-buffer))) | |
8322 (gnus-eval-in-buffer-window gnus-article-buffer | |
8323 (save-restriction | |
8324 (widen) | |
8325 (let ((start (window-start)) | |
8326 buffer-read-only) | |
8327 (message-pipe-buffer-body program) | |
8328 (set-window-start (get-buffer-window (current-buffer)) start)))))) | |
8329 | |
8330 (defun gnus-get-split-value (methods) | |
8331 "Return a value based on the split METHODS." | |
8332 (let (split-name method result match) | |
8333 (when methods | |
8334 (save-excursion | |
8335 (set-buffer gnus-original-article-buffer) | |
8336 (save-restriction | |
8337 (nnheader-narrow-to-headers) | |
8338 (while methods | |
8339 (goto-char (point-min)) | |
8340 (setq method (pop methods)) | |
8341 (setq match (car method)) | |
8342 (when (cond | |
8343 ((stringp match) | |
8344 ;; Regular expression. | |
8345 (ignore-errors | |
8346 (re-search-forward match nil t))) | |
8347 ((gnus-functionp match) | |
8348 ;; Function. | |
8349 (save-restriction | |
8350 (widen) | |
8351 (setq result (funcall match gnus-newsgroup-name)))) | |
8352 ((consp match) | |
8353 ;; Form. | |
8354 (save-restriction | |
8355 (widen) | |
8356 (setq result (eval match))))) | |
8357 (setq split-name (append (cdr method) split-name)) | |
8358 (cond ((stringp result) | |
8359 (push (expand-file-name | |
8360 result gnus-article-save-directory) | |
8361 split-name)) | |
8362 ((consp result) | |
8363 (setq split-name (append result split-name))))))))) | |
8364 split-name)) | |
8365 | |
8366 (defun gnus-valid-move-group-p (group) | |
8367 (and (boundp group) | |
8368 (symbol-name group) | |
8369 (memq 'respool | |
8370 (assoc (symbol-name | |
8371 (car (gnus-find-method-for-group | |
8372 (symbol-name group)))) | |
8373 gnus-valid-select-methods)))) | |
8374 | |
8375 (defun gnus-read-move-group-name (prompt default articles prefix) | |
8376 "Read a group name." | |
8377 (let* ((split-name (gnus-get-split-value gnus-move-split-methods)) | |
8378 (minibuffer-confirm-incomplete nil) ; XEmacs | |
8379 (prom | |
8380 (format "%s %s to:" | |
8381 prompt | |
8382 (if (> (length articles) 1) | |
8383 (format "these %d articles" (length articles)) | |
8384 "this article"))) | |
8385 (to-newsgroup | |
8386 (cond | |
8387 ((null split-name) | |
8388 (gnus-completing-read default prom | |
8389 gnus-active-hashtb | |
8390 'gnus-valid-move-group-p | |
8391 nil prefix | |
8392 'gnus-group-history)) | |
8393 ((= 1 (length split-name)) | |
8394 (gnus-completing-read (car split-name) prom | |
8395 gnus-active-hashtb | |
8396 'gnus-valid-move-group-p | |
8397 nil nil | |
8398 'gnus-group-history)) | |
8399 (t | |
8400 (gnus-completing-read nil prom | |
8401 (mapcar (lambda (el) (list el)) | |
8402 (nreverse split-name)) | |
8403 nil nil nil | |
8404 'gnus-group-history))))) | |
8405 (when to-newsgroup | |
8406 (if (or (string= to-newsgroup "") | |
8407 (string= to-newsgroup prefix)) | |
8408 (setq to-newsgroup default)) | |
8409 (unless to-newsgroup | |
8410 (error "No group name entered")) | |
8411 (or (gnus-active to-newsgroup) | |
8412 (gnus-activate-group to-newsgroup) | |
8413 (if (gnus-y-or-n-p (format "No such group: %s. Create it? " | |
8414 to-newsgroup)) | |
8415 (or (and (gnus-request-create-group | |
8416 to-newsgroup (gnus-group-name-to-method to-newsgroup)) | |
8417 (gnus-activate-group to-newsgroup nil nil | |
8418 (gnus-group-name-to-method | |
8419 to-newsgroup))) | |
8420 (error "Couldn't create group %s" to-newsgroup))) | |
8421 (error "No such group: %s" to-newsgroup))) | |
8422 to-newsgroup)) | |
8423 | |
8424 ;; Summary extract commands | |
8425 | |
8426 (defun gnus-summary-insert-pseudos (pslist &optional not-view) | |
8427 (let ((buffer-read-only nil) | |
8428 (article (gnus-summary-article-number)) | |
8429 after-article b e) | |
8430 (unless (gnus-summary-goto-subject article) | |
8431 (error "No such article: %d" article)) | |
8432 (gnus-summary-position-point) | |
8433 ;; If all commands are to be bunched up on one line, we collect | |
8434 ;; them here. | |
8435 (unless gnus-view-pseudos-separately | |
8436 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<))) | |
8437 files action) | |
8438 (while ps | |
8439 (setq action (cdr (assq 'action (car ps)))) | |
8440 (setq files (list (cdr (assq 'name (car ps))))) | |
8441 (while (and ps (cdr ps) | |
8442 (string= (or action "1") | |
8443 (or (cdr (assq 'action (cadr ps))) "2"))) | |
8444 (push (cdr (assq 'name (cadr ps))) files) | |
8445 (setcdr ps (cddr ps))) | |
8446 (when files | |
8447 (when (not (string-match "%s" action)) | |
8448 (push " " files)) | |
8449 (push " " files) | |
8450 (when (assq 'execute (car ps)) | |
8451 (setcdr (assq 'execute (car ps)) | |
8452 (funcall (if (string-match "%s" action) | |
8453 'format 'concat) | |
8454 action | |
8455 (mapconcat | |
8456 (lambda (f) | |
8457 (if (equal f " ") | |
8458 f | |
8459 (gnus-quote-arg-for-sh-or-csh f))) | |
8460 files " "))))) | |
8461 (setq ps (cdr ps))))) | |
8462 (if (and gnus-view-pseudos (not not-view)) | |
8463 (while pslist | |
8464 (when (assq 'execute (car pslist)) | |
8465 (gnus-execute-command (cdr (assq 'execute (car pslist))) | |
8466 (eq gnus-view-pseudos 'not-confirm))) | |
8467 (setq pslist (cdr pslist))) | |
8468 (save-excursion | |
8469 (while pslist | |
8470 (setq after-article (or (cdr (assq 'article (car pslist))) | |
8471 (gnus-summary-article-number))) | |
8472 (gnus-summary-goto-subject after-article) | |
8473 (forward-line 1) | |
8474 (setq b (point)) | |
8475 (insert " " (file-name-nondirectory | |
8476 (cdr (assq 'name (car pslist)))) | |
8477 ": " (or (cdr (assq 'execute (car pslist))) "") "\n") | |
8478 (setq e (point)) | |
8479 (forward-line -1) ; back to `b' | |
8480 (gnus-add-text-properties | |
8481 b (1- e) (list 'gnus-number gnus-reffed-article-number | |
8482 gnus-mouse-face-prop gnus-mouse-face)) | |
8483 (gnus-data-enter | |
8484 after-article gnus-reffed-article-number | |
8485 gnus-unread-mark b (car pslist) 0 (- e b)) | |
8486 (push gnus-reffed-article-number gnus-newsgroup-unreads) | |
8487 (setq gnus-reffed-article-number (1- gnus-reffed-article-number)) | |
8488 (setq pslist (cdr pslist))))))) | |
8489 | |
8490 (defun gnus-pseudos< (p1 p2) | |
8491 (let ((c1 (cdr (assq 'action p1))) | |
8492 (c2 (cdr (assq 'action p2)))) | |
8493 (and c1 c2 (string< c1 c2)))) | |
8494 | |
8495 (defun gnus-request-pseudo-article (props) | |
8496 (cond ((assq 'execute props) | |
8497 (gnus-execute-command (cdr (assq 'execute props))))) | |
8498 (let ((gnus-current-article (gnus-summary-article-number))) | |
8499 (run-hooks 'gnus-mark-article-hook))) | |
8500 | |
8501 (defun gnus-execute-command (command &optional automatic) | |
8502 (save-excursion | |
8503 (gnus-article-setup-buffer) | |
8504 (set-buffer gnus-article-buffer) | |
8505 (setq buffer-read-only nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8506 (let ((command (if automatic command |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8507 (read-string "Command: " (cons command 0))))) |
17493 | 8508 (erase-buffer) |
8509 (insert "$ " command "\n\n") | |
8510 (if gnus-view-pseudo-asynchronously | |
8511 (start-process "gnus-execute" (current-buffer) shell-file-name | |
8512 shell-command-switch command) | |
8513 (call-process shell-file-name nil t nil | |
8514 shell-command-switch command))))) | |
8515 | |
8516 ;; Summary kill commands. | |
8517 | |
8518 (defun gnus-summary-edit-global-kill (article) | |
8519 "Edit the \"global\" kill file." | |
8520 (interactive (list (gnus-summary-article-number))) | |
8521 (gnus-set-global-variables) | |
8522 (gnus-group-edit-global-kill article)) | |
8523 | |
8524 (defun gnus-summary-edit-local-kill () | |
8525 "Edit a local kill file applied to the current newsgroup." | |
8526 (interactive) | |
8527 (gnus-set-global-variables) | |
8528 (setq gnus-current-headers (gnus-summary-article-header)) | |
8529 (gnus-set-global-variables) | |
8530 (gnus-group-edit-local-kill | |
8531 (gnus-summary-article-number) gnus-newsgroup-name)) | |
8532 | |
8533 ;;; Header reading. | |
8534 | |
8535 (defun gnus-read-header (id &optional header) | |
8536 "Read the headers of article ID and enter them into the Gnus system." | |
8537 (let ((group gnus-newsgroup-name) | |
8538 (gnus-override-method | |
8539 (and (gnus-news-group-p gnus-newsgroup-name) | |
8540 gnus-refer-article-method)) | |
8541 where) | |
8542 ;; First we check to see whether the header in question is already | |
8543 ;; fetched. | |
8544 (if (stringp id) | |
8545 ;; This is a Message-ID. | |
8546 (setq header (or header (gnus-id-to-header id))) | |
8547 ;; This is an article number. | |
8548 (setq header (or header (gnus-summary-article-header id)))) | |
8549 (if (and header | |
8550 (not (gnus-summary-article-sparse-p (mail-header-number header)))) | |
8551 ;; We have found the header. | |
8552 header | |
8553 ;; We have to really fetch the header to this article. | |
8554 (save-excursion | |
8555 (set-buffer nntp-server-buffer) | |
8556 (when (setq where (gnus-request-head id group)) | |
8557 (nnheader-fold-continuation-lines) | |
8558 (goto-char (point-max)) | |
8559 (insert ".\n") | |
8560 (goto-char (point-min)) | |
8561 (insert "211 ") | |
8562 (princ (cond | |
8563 ((numberp id) id) | |
8564 ((cdr where) (cdr where)) | |
8565 (header (mail-header-number header)) | |
8566 (t gnus-reffed-article-number)) | |
8567 (current-buffer)) | |
8568 (insert " Article retrieved.\n")) | |
8569 (if (or (not where) | |
8570 (not (setq header (car (gnus-get-newsgroup-headers nil t))))) | |
8571 () ; Malformed head. | |
8572 (unless (gnus-summary-article-sparse-p (mail-header-number header)) | |
8573 (when (and (stringp id) | |
8574 (not (string= (gnus-group-real-name group) | |
8575 (car where)))) | |
8576 ;; If we fetched by Message-ID and the article came | |
8577 ;; from a different group, we fudge some bogus article | |
8578 ;; numbers for this article. | |
8579 (mail-header-set-number header gnus-reffed-article-number)) | |
8580 (save-excursion | |
8581 (set-buffer gnus-summary-buffer) | |
8582 (decf gnus-reffed-article-number) | |
8583 (gnus-remove-header (mail-header-number header)) | |
8584 (push header gnus-newsgroup-headers) | |
8585 (setq gnus-current-headers header) | |
8586 (push (mail-header-number header) gnus-newsgroup-limit))) | |
8587 header))))) | |
8588 | |
8589 (defun gnus-remove-header (number) | |
8590 "Remove header NUMBER from `gnus-newsgroup-headers'." | |
8591 (if (and gnus-newsgroup-headers | |
8592 (= number (mail-header-number (car gnus-newsgroup-headers)))) | |
8593 (pop gnus-newsgroup-headers) | |
8594 (let ((headers gnus-newsgroup-headers)) | |
8595 (while (and (cdr headers) | |
8596 (not (= number (mail-header-number (cadr headers))))) | |
8597 (pop headers)) | |
8598 (when (cdr headers) | |
8599 (setcdr headers (cddr headers)))))) | |
8600 | |
8601 ;;; | |
8602 ;;; summary highlights | |
8603 ;;; | |
8604 | |
8605 (defun gnus-highlight-selected-summary () | |
8606 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>. | |
8607 ;; Highlight selected article in summary buffer | |
8608 (when gnus-summary-selected-face | |
8609 (save-excursion | |
8610 (let* ((beg (progn (beginning-of-line) (point))) | |
8611 (end (progn (end-of-line) (point))) | |
8612 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>. | |
8613 (from (if (get-text-property beg gnus-mouse-face-prop) | |
8614 beg | |
8615 (or (next-single-property-change | |
8616 beg gnus-mouse-face-prop nil end) | |
8617 beg))) | |
8618 (to | |
8619 (if (= from end) | |
8620 (- from 2) | |
8621 (or (next-single-property-change | |
8622 from gnus-mouse-face-prop nil end) | |
8623 end)))) | |
8624 ;; If no mouse-face prop on line we will have to = from = end, | |
8625 ;; so we highlight the entire line instead. | |
8626 (when (= (+ to 2) from) | |
8627 (setq from beg) | |
8628 (setq to end)) | |
8629 (if gnus-newsgroup-selected-overlay | |
8630 ;; Move old overlay. | |
8631 (gnus-move-overlay | |
8632 gnus-newsgroup-selected-overlay from to (current-buffer)) | |
8633 ;; Create new overlay. | |
8634 (gnus-overlay-put | |
8635 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to)) | |
8636 'face gnus-summary-selected-face)))))) | |
8637 | |
8638 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>. | |
8639 (defun gnus-summary-highlight-line () | |
8640 "Highlight current line according to `gnus-summary-highlight'." | |
8641 (let* ((list gnus-summary-highlight) | |
8642 (p (point)) | |
8643 (end (progn (end-of-line) (point))) | |
8644 ;; now find out where the line starts and leave point there. | |
8645 (beg (progn (beginning-of-line) (point))) | |
8646 (article (gnus-summary-article-number)) | |
8647 (score (or (cdr (assq (or article gnus-current-article) | |
8648 gnus-newsgroup-scored)) | |
8649 gnus-summary-default-score 0)) | |
8650 (mark (or (gnus-summary-article-mark) gnus-unread-mark)) | |
8651 (inhibit-read-only t)) | |
8652 ;; Eval the cars of the lists until we find a match. | |
8653 (let ((default gnus-summary-default-score)) | |
8654 (while (and list | |
8655 (not (eval (caar list)))) | |
8656 (setq list (cdr list)))) | |
8657 (let ((face (cdar list))) | |
8658 (unless (eq face (get-text-property beg 'face)) | |
8659 (gnus-put-text-property | |
8660 beg end 'face | |
8661 (setq face (if (boundp face) (symbol-value face) face))) | |
8662 (when gnus-summary-highlight-line-function | |
8663 (funcall gnus-summary-highlight-line-function article face)))) | |
8664 (goto-char p))) | |
8665 | |
8666 (defun gnus-update-read-articles (group unread) | |
8667 "Update the list of read articles in GROUP." | |
8668 (let* ((active (or gnus-newsgroup-active (gnus-active group))) | |
8669 (entry (gnus-gethash group gnus-newsrc-hashtb)) | |
8670 (info (nth 2 entry)) | |
8671 (prev 1) | |
8672 (unread (sort (copy-sequence unread) '<)) | |
8673 read) | |
8674 (if (or (not info) (not active)) | |
8675 ;; There is no info on this group if it was, in fact, | |
8676 ;; killed. Gnus stores no information on killed groups, so | |
8677 ;; there's nothing to be done. | |
8678 ;; One could store the information somewhere temporarily, | |
8679 ;; perhaps... Hmmm... | |
8680 () | |
8681 ;; Remove any negative articles numbers. | |
8682 (while (and unread (< (car unread) 0)) | |
8683 (setq unread (cdr unread))) | |
8684 ;; Remove any expired article numbers | |
8685 (while (and unread (< (car unread) (car active))) | |
8686 (setq unread (cdr unread))) | |
8687 ;; Compute the ranges of read articles by looking at the list of | |
8688 ;; unread articles. | |
8689 (while unread | |
8690 (when (/= (car unread) prev) | |
8691 (push (if (= prev (1- (car unread))) prev | |
8692 (cons prev (1- (car unread)))) | |
8693 read)) | |
8694 (setq prev (1+ (car unread))) | |
8695 (setq unread (cdr unread))) | |
8696 (when (<= prev (cdr active)) | |
8697 (push (cons prev (cdr active)) read)) | |
8698 (save-excursion | |
8699 (set-buffer gnus-group-buffer) | |
8700 (gnus-undo-register | |
8701 `(progn | |
8702 (gnus-info-set-marks ',info ',(gnus-info-marks info) t) | |
8703 (gnus-info-set-read ',info ',(gnus-info-read info)) | |
8704 (gnus-get-unread-articles-in-group ',info (gnus-active ,group)) | |
8705 (gnus-group-update-group ,group t)))) | |
8706 ;; Enter this list into the group info. | |
8707 (gnus-info-set-read | |
8708 info (if (> (length read) 1) (nreverse read) read)) | |
8709 ;; Set the number of unread articles in gnus-newsrc-hashtb. | |
8710 (gnus-get-unread-articles-in-group info (gnus-active group)) | |
8711 t))) | |
8712 | |
8713 (defun gnus-offer-save-summaries () | |
8714 "Offer to save all active summary buffers." | |
8715 (save-excursion | |
8716 (let ((buflist (buffer-list)) | |
8717 buffers bufname) | |
8718 ;; Go through all buffers and find all summaries. | |
8719 (while buflist | |
8720 (and (setq bufname (buffer-name (car buflist))) | |
8721 (string-match "Summary" bufname) | |
8722 (save-excursion | |
8723 (set-buffer bufname) | |
8724 ;; We check that this is, indeed, a summary buffer. | |
8725 (and (eq major-mode 'gnus-summary-mode) | |
8726 ;; Also make sure this isn't bogus. | |
8727 gnus-newsgroup-prepared | |
8728 ;; Also make sure that this isn't a dead summary buffer. | |
8729 (not gnus-dead-summary-mode))) | |
8730 (push bufname buffers)) | |
8731 (setq buflist (cdr buflist))) | |
8732 ;; Go through all these summary buffers and offer to save them. | |
8733 (when buffers | |
8734 (map-y-or-n-p | |
8735 "Update summary buffer %s? " | |
8736 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit)) | |
8737 buffers))))) | |
8738 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8739 (gnus-ems-redefine) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8740 |
17493 | 8741 (provide 'gnus-sum) |
8742 | |
8743 (run-hooks 'gnus-sum-load-hook) | |
8744 | |
8745 ;;; gnus-sum.el ends here |