Mercurial > emacs
annotate lisp/gnus/gnus-sum.el @ 24174:4cd52e40cf31
(list-faces-display): Multiline case of previous fix.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 25 Jan 1999 16:41:04 +0000 |
parents | 41843e16f6ac |
children | 15fc6acbae7a |
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 |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
624 (if (and (featurep 'mule) |
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
625 (boundp 'enable-multibyte-characters)) |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
626 (lambda (string) |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
627 (if (and enable-multibyte-characters gnus-mule-coding-system) |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
628 (decode-coding-string string gnus-mule-coding-system) |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
629 string)) |
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
630 'identity) |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
631 "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
|
632 :group 'gnus-various |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
633 :type 'function) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
634 |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
635 (defcustom gnus-unstructured-field-decoder |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
636 (if (and (featurep 'mule) |
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
637 (boundp 'enable-multibyte-characters)) |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
638 (lambda (string) |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
639 (if (and enable-multibyte-characters gnus-mule-coding-system) |
19989
9049c6de031f
(gnus-structured-field-decoder): If the
Kenichi Handa <handa@m17n.org>
parents:
19969
diff
changeset
|
640 (decode-coding-string string gnus-mule-coding-system) |
20117
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
641 string)) |
b84c6ec5f561
(gnus-structured-field-decoder): Pay attention
Kenichi Handa <handa@m17n.org>
parents:
19989
diff
changeset
|
642 'identity) |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
643 "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
|
644 :group 'gnus-various |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
645 :type 'function) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
646 |
17493 | 647 (defcustom gnus-parse-headers-hook |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
648 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522) |
17493 | 649 "*A hook called before parsing the headers." |
650 :group 'gnus-various | |
651 :type 'hook) | |
652 | |
653 (defcustom gnus-exit-group-hook nil | |
654 "*A hook called when exiting (not quitting) summary mode." | |
655 :group 'gnus-various | |
656 :type 'hook) | |
657 | |
658 (defcustom gnus-summary-update-hook | |
659 (list 'gnus-summary-highlight-line) | |
660 "*A hook called when a summary line is changed. | |
661 The hook will not be called if `gnus-visual' is nil. | |
662 | |
663 The default function `gnus-summary-highlight-line' will | |
664 highlight the line according to the `gnus-summary-highlight' | |
665 variable." | |
666 :group 'gnus-summary-visual | |
667 :type 'hook) | |
668 | |
669 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read) | |
670 "*A hook called when an article is selected for the first time. | |
671 The hook is intended to mark an article as read (or unread) | |
672 automatically when it is selected." | |
673 :group 'gnus-summary-choose | |
674 :type 'hook) | |
675 | |
676 (defcustom gnus-group-no-more-groups-hook nil | |
677 "*A hook run when returning to group mode having no more (unread) groups." | |
678 :group 'gnus-group-select | |
679 :type 'hook) | |
680 | |
681 (defcustom gnus-ps-print-hook nil | |
682 "*A hook run before ps-printing something from Gnus." | |
683 :group 'gnus-summary | |
684 :type 'hook) | |
685 | |
686 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face | |
687 "Face used for highlighting the current article in the summary buffer." | |
688 :group 'gnus-summary-visual | |
689 :type 'face) | |
690 | |
691 (defcustom gnus-summary-highlight | |
692 '(((= mark gnus-canceled-mark) | |
693 . gnus-summary-cancelled-face) | |
694 ((and (> score default) | |
695 (or (= mark gnus-dormant-mark) | |
696 (= mark gnus-ticked-mark))) | |
697 . gnus-summary-high-ticked-face) | |
698 ((and (< score default) | |
699 (or (= mark gnus-dormant-mark) | |
700 (= mark gnus-ticked-mark))) | |
701 . gnus-summary-low-ticked-face) | |
702 ((or (= mark gnus-dormant-mark) | |
703 (= mark gnus-ticked-mark)) | |
704 . gnus-summary-normal-ticked-face) | |
705 ((and (> score default) (= mark gnus-ancient-mark)) | |
706 . gnus-summary-high-ancient-face) | |
707 ((and (< score default) (= mark gnus-ancient-mark)) | |
708 . gnus-summary-low-ancient-face) | |
709 ((= mark gnus-ancient-mark) | |
710 . gnus-summary-normal-ancient-face) | |
711 ((and (> score default) (= mark gnus-unread-mark)) | |
712 . gnus-summary-high-unread-face) | |
713 ((and (< score default) (= mark gnus-unread-mark)) | |
714 . gnus-summary-low-unread-face) | |
715 ((and (= mark gnus-unread-mark)) | |
716 . gnus-summary-normal-unread-face) | |
717 ((> score default) | |
718 . gnus-summary-high-read-face) | |
719 ((< score default) | |
720 . gnus-summary-low-read-face) | |
721 (t | |
722 . gnus-summary-normal-read-face)) | |
723 "Controls the highlighting of summary buffer lines. | |
724 | |
725 A list of (FORM . FACE) pairs. When deciding how a a particular | |
726 summary line should be displayed, each form is evaluated. The content | |
727 of the face field after the first true form is used. You can change | |
728 how those summary lines are displayed, by editing the face field. | |
729 | |
730 You can use the following variables in the FORM field. | |
731 | |
732 score: The articles score | |
733 default: The default article score. | |
734 below: The score below which articles are automatically marked as read. | |
735 mark: The articles mark." | |
736 :group 'gnus-summary-visual | |
737 :type '(repeat (cons (sexp :tag "Form" nil) | |
738 face))) | |
739 | |
740 | |
741 ;;; Internal variables | |
742 | |
743 (defvar gnus-scores-exclude-files nil) | |
744 (defvar gnus-page-broken nil) | |
745 | |
746 (defvar gnus-original-article nil) | |
747 (defvar gnus-article-internal-prepare-hook nil) | |
748 (defvar gnus-newsgroup-process-stack nil) | |
749 | |
750 (defvar gnus-thread-indent-array nil) | |
751 (defvar gnus-thread-indent-array-level gnus-thread-indent-level) | |
752 | |
753 ;; Avoid highlighting in kill files. | |
754 (defvar gnus-summary-inhibit-highlight nil) | |
755 (defvar gnus-newsgroup-selected-overlay nil) | |
756 (defvar gnus-inhibit-limiting nil) | |
757 (defvar gnus-newsgroup-adaptive-score-file nil) | |
758 (defvar gnus-current-score-file nil) | |
759 (defvar gnus-current-move-group nil) | |
760 (defvar gnus-current-copy-group nil) | |
761 (defvar gnus-current-crosspost-group nil) | |
762 | |
763 (defvar gnus-newsgroup-dependencies nil) | |
764 (defvar gnus-newsgroup-adaptive nil) | |
765 (defvar gnus-summary-display-article-function nil) | |
766 (defvar gnus-summary-highlight-line-function nil | |
767 "Function called after highlighting a summary line.") | |
768 | |
769 (defvar gnus-summary-line-format-alist | |
770 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d) | |
771 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s) | |
772 (?s gnus-tmp-subject-or-nil ?s) | |
773 (?n gnus-tmp-name ?s) | |
774 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from))) | |
775 ?s) | |
776 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from)) | |
777 gnus-tmp-from) ?s) | |
778 (?F gnus-tmp-from ?s) | |
779 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s) | |
780 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s) | |
781 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s) | |
782 (?o (gnus-date-iso8601 gnus-tmp-header) ?s) | |
783 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s) | |
784 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s) | |
785 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d) | |
786 (?L gnus-tmp-lines ?d) | |
787 (?I gnus-tmp-indentation ?s) | |
788 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s) | |
789 (?R gnus-tmp-replied ?c) | |
790 (?\[ gnus-tmp-opening-bracket ?c) | |
791 (?\] gnus-tmp-closing-bracket ?c) | |
792 (?\> (make-string gnus-tmp-level ? ) ?s) | |
793 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s) | |
794 (?i gnus-tmp-score ?d) | |
795 (?z gnus-tmp-score-char ?c) | |
796 (?l (bbb-grouplens-score gnus-tmp-header) ?s) | |
797 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d) | |
798 (?U gnus-tmp-unread ?c) | |
799 (?t (gnus-summary-number-of-articles-in-thread | |
800 (and (boundp 'thread) (car thread)) gnus-tmp-level) | |
801 ?d) | |
802 (?e (gnus-summary-number-of-articles-in-thread | |
803 (and (boundp 'thread) (car thread)) gnus-tmp-level t) | |
804 ?c) | |
805 (?u gnus-tmp-user-defined ?s) | |
806 (?P (gnus-pick-line-number) ?d)) | |
807 "An alist of format specifications that can appear in summary lines, | |
808 and what variables they correspond with, along with the type of the | |
809 variable (string, integer, character, etc).") | |
810 | |
811 (defvar gnus-summary-dummy-line-format-alist | |
812 `((?S gnus-tmp-subject ?s) | |
813 (?N gnus-tmp-number ?d) | |
814 (?u gnus-tmp-user-defined ?s))) | |
815 | |
816 (defvar gnus-summary-mode-line-format-alist | |
817 `((?G gnus-tmp-group-name ?s) | |
818 (?g (gnus-short-group-name gnus-tmp-group-name) ?s) | |
819 (?p (gnus-group-real-name gnus-tmp-group-name) ?s) | |
820 (?A gnus-tmp-article-number ?d) | |
821 (?Z gnus-tmp-unread-and-unselected ?s) | |
822 (?V gnus-version ?s) | |
823 (?U gnus-tmp-unread-and-unticked ?d) | |
824 (?S gnus-tmp-subject ?s) | |
825 (?e gnus-tmp-unselected ?d) | |
826 (?u gnus-tmp-user-defined ?s) | |
827 (?d (length gnus-newsgroup-dormant) ?d) | |
828 (?t (length gnus-newsgroup-marked) ?d) | |
829 (?r (length gnus-newsgroup-reads) ?d) | |
830 (?E gnus-newsgroup-expunged-tally ?d) | |
831 (?s (gnus-current-score-file-nondirectory) ?s))) | |
832 | |
833 (defvar gnus-last-search-regexp nil | |
834 "Default regexp for article search command.") | |
835 | |
836 (defvar gnus-last-shell-command nil | |
837 "Default shell command on article.") | |
838 | |
839 (defvar gnus-newsgroup-begin nil) | |
840 (defvar gnus-newsgroup-end nil) | |
841 (defvar gnus-newsgroup-last-rmail nil) | |
842 (defvar gnus-newsgroup-last-mail nil) | |
843 (defvar gnus-newsgroup-last-folder nil) | |
844 (defvar gnus-newsgroup-last-file nil) | |
845 (defvar gnus-newsgroup-auto-expire nil) | |
846 (defvar gnus-newsgroup-active nil) | |
847 | |
848 (defvar gnus-newsgroup-data nil) | |
849 (defvar gnus-newsgroup-data-reverse nil) | |
850 (defvar gnus-newsgroup-limit nil) | |
851 (defvar gnus-newsgroup-limits nil) | |
852 | |
853 (defvar gnus-newsgroup-unreads nil | |
854 "List of unread articles in the current newsgroup.") | |
855 | |
856 (defvar gnus-newsgroup-unselected nil | |
857 "List of unselected unread articles in the current newsgroup.") | |
858 | |
859 (defvar gnus-newsgroup-reads nil | |
860 "Alist of read articles and article marks in the current newsgroup.") | |
861 | |
862 (defvar gnus-newsgroup-expunged-tally nil) | |
863 | |
864 (defvar gnus-newsgroup-marked nil | |
865 "List of ticked articles in the current newsgroup (a subset of unread art).") | |
866 | |
867 (defvar gnus-newsgroup-killed nil | |
868 "List of ranges of articles that have been through the scoring process.") | |
869 | |
870 (defvar gnus-newsgroup-cached nil | |
871 "List of articles that come from the article cache.") | |
872 | |
873 (defvar gnus-newsgroup-saved nil | |
874 "List of articles that have been saved.") | |
875 | |
876 (defvar gnus-newsgroup-kill-headers nil) | |
877 | |
878 (defvar gnus-newsgroup-replied nil | |
879 "List of articles that have been replied to in the current newsgroup.") | |
880 | |
881 (defvar gnus-newsgroup-expirable nil | |
882 "List of articles in the current newsgroup that can be expired.") | |
883 | |
884 (defvar gnus-newsgroup-processable nil | |
885 "List of articles in the current newsgroup that can be processed.") | |
886 | |
887 (defvar gnus-newsgroup-bookmarks nil | |
888 "List of articles in the current newsgroup that have bookmarks.") | |
889 | |
890 (defvar gnus-newsgroup-dormant nil | |
891 "List of dormant articles in the current newsgroup.") | |
892 | |
893 (defvar gnus-newsgroup-scored nil | |
894 "List of scored articles in the current newsgroup.") | |
895 | |
896 (defvar gnus-newsgroup-headers nil | |
897 "List of article headers in the current newsgroup.") | |
898 | |
899 (defvar gnus-newsgroup-threads nil) | |
900 | |
901 (defvar gnus-newsgroup-prepared nil | |
902 "Whether the current group has been prepared properly.") | |
903 | |
904 (defvar gnus-newsgroup-ancient nil | |
905 "List of `gnus-fetch-old-headers' articles in the current newsgroup.") | |
906 | |
907 (defvar gnus-newsgroup-sparse nil) | |
908 | |
909 (defvar gnus-current-article nil) | |
910 (defvar gnus-article-current nil) | |
911 (defvar gnus-current-headers nil) | |
912 (defvar gnus-have-all-headers nil) | |
913 (defvar gnus-last-article nil) | |
914 (defvar gnus-newsgroup-history nil) | |
915 | |
916 (defconst gnus-summary-local-variables | |
917 '(gnus-newsgroup-name | |
918 gnus-newsgroup-begin gnus-newsgroup-end | |
919 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail | |
920 gnus-newsgroup-last-folder gnus-newsgroup-last-file | |
921 gnus-newsgroup-auto-expire gnus-newsgroup-unreads | |
922 gnus-newsgroup-unselected gnus-newsgroup-marked | |
923 gnus-newsgroup-reads gnus-newsgroup-saved | |
924 gnus-newsgroup-replied gnus-newsgroup-expirable | |
925 gnus-newsgroup-processable gnus-newsgroup-killed | |
926 gnus-newsgroup-bookmarks gnus-newsgroup-dormant | |
927 gnus-newsgroup-headers gnus-newsgroup-threads | |
928 gnus-newsgroup-prepared gnus-summary-highlight-line-function | |
929 gnus-current-article gnus-current-headers gnus-have-all-headers | |
930 gnus-last-article gnus-article-internal-prepare-hook | |
931 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay | |
932 gnus-newsgroup-scored gnus-newsgroup-kill-headers | |
933 gnus-thread-expunge-below | |
934 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below | |
935 (gnus-summary-mark-below . global) | |
936 gnus-newsgroup-active gnus-scores-exclude-files | |
937 gnus-newsgroup-history gnus-newsgroup-ancient | |
938 gnus-newsgroup-sparse gnus-newsgroup-process-stack | |
939 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring) | |
940 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1) | |
941 (gnus-newsgroup-expunged-tally . 0) | |
942 gnus-cache-removable-articles gnus-newsgroup-cached | |
943 gnus-newsgroup-data gnus-newsgroup-data-reverse | |
944 gnus-newsgroup-limit gnus-newsgroup-limits) | |
945 "Variables that are buffer-local to the summary buffers.") | |
946 | |
947 ;; Byte-compiler warning. | |
948 (defvar gnus-article-mode-map) | |
949 | |
950 ;; Subject simplification. | |
951 | |
952 (defsubst gnus-simplify-subject-re (subject) | |
953 "Remove \"Re:\" from subject lines." | |
954 (if (string-match "^[Rr][Ee]: *" subject) | |
955 (substring subject (match-end 0)) | |
956 subject)) | |
957 | |
958 (defun gnus-simplify-subject (subject &optional re-only) | |
959 "Remove `Re:' and words in parentheses. | |
960 If RE-ONLY is non-nil, strip leading `Re:'s only." | |
961 (let ((case-fold-search t)) ;Ignore case. | |
962 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'. | |
963 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject) | |
964 (setq subject (substring subject (match-end 0)))) | |
965 ;; Remove uninteresting prefixes. | |
966 (when (and (not re-only) | |
967 gnus-simplify-ignored-prefixes | |
968 (string-match gnus-simplify-ignored-prefixes subject)) | |
969 (setq subject (substring subject (match-end 0)))) | |
970 ;; Remove words in parentheses from end. | |
971 (unless re-only | |
972 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject) | |
973 (setq subject (substring subject 0 (match-beginning 0))))) | |
974 ;; Return subject string. | |
975 subject)) | |
976 | |
977 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify | |
978 ;; all whitespace. | |
979 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext) | |
980 (goto-char (point-min)) | |
981 (while (re-search-forward regexp nil t) | |
982 (replace-match (or newtext "")))) | |
983 | |
984 (defun gnus-simplify-buffer-fuzzy () | |
985 "Simplify string in the buffer fuzzily. | |
986 The string in the accessible portion of the current buffer is simplified. | |
987 It is assumed to be a single-line subject. | |
988 Whitespace is generally cleaned up, and miscellaneous leading/trailing | |
989 matter is removed. Additional things can be deleted by setting | |
990 gnus-simplify-subject-fuzzy-regexp." | |
991 (let ((case-fold-search t) | |
992 (modified-tick)) | |
993 (gnus-simplify-buffer-fuzzy-step "\t" " ") | |
994 | |
995 (while (not (eq modified-tick (buffer-modified-tick))) | |
996 (setq modified-tick (buffer-modified-tick)) | |
997 (cond | |
998 ((listp gnus-simplify-subject-fuzzy-regexp) | |
999 (mapcar 'gnus-simplify-buffer-fuzzy-step | |
1000 gnus-simplify-subject-fuzzy-regexp)) | |
1001 (gnus-simplify-subject-fuzzy-regexp | |
1002 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp))) | |
1003 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *") | |
1004 (gnus-simplify-buffer-fuzzy-step | |
1005 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *") | |
1006 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1")) | |
1007 | |
1008 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$") | |
1009 (gnus-simplify-buffer-fuzzy-step " +" " ") | |
1010 (gnus-simplify-buffer-fuzzy-step " $") | |
1011 (gnus-simplify-buffer-fuzzy-step "^ +"))) | |
1012 | |
1013 (defun gnus-simplify-subject-fuzzy (subject) | |
1014 "Simplify a subject string fuzzily. | |
1015 See gnus-simplify-buffer-fuzzy for details." | |
1016 (save-excursion | |
1017 (gnus-set-work-buffer) | |
1018 (let ((case-fold-search t)) | |
1019 (insert subject) | |
1020 (inline (gnus-simplify-buffer-fuzzy)) | |
1021 (buffer-string)))) | |
1022 | |
1023 (defsubst gnus-simplify-subject-fully (subject) | |
1024 "Simplify a subject string according to gnus-summary-gather-subject-limit." | |
1025 (cond | |
1026 ((null gnus-summary-gather-subject-limit) | |
1027 (gnus-simplify-subject-re subject)) | |
1028 ((eq gnus-summary-gather-subject-limit 'fuzzy) | |
1029 (gnus-simplify-subject-fuzzy subject)) | |
1030 ((numberp gnus-summary-gather-subject-limit) | |
1031 (gnus-limit-string (gnus-simplify-subject-re subject) | |
1032 gnus-summary-gather-subject-limit)) | |
1033 (t | |
1034 subject))) | |
1035 | |
1036 (defsubst gnus-subject-equal (s1 s2 &optional simple-first) | |
1037 "Check whether two subjects are equal. If optional argument | |
1038 simple-first is t, first argument is already simplified." | |
1039 (cond | |
1040 ((null simple-first) | |
1041 (equal (gnus-simplify-subject-fully s1) | |
1042 (gnus-simplify-subject-fully s2))) | |
1043 (t | |
1044 (equal s1 | |
1045 (gnus-simplify-subject-fully s2))))) | |
1046 | |
1047 (defun gnus-summary-bubble-group () | |
1048 "Increase the score of the current group. | |
1049 This is a handy function to add to `gnus-summary-exit-hook' to | |
1050 increase the score of each group you read." | |
1051 (gnus-group-add-score gnus-newsgroup-name)) | |
1052 | |
1053 | |
1054 ;;; | |
1055 ;;; Gnus summary mode | |
1056 ;;; | |
1057 | |
1058 (put 'gnus-summary-mode 'mode-class 'special) | |
1059 | |
1060 (when t | |
1061 ;; Non-orthogonal keys | |
1062 | |
1063 (gnus-define-keys gnus-summary-mode-map | |
1064 " " gnus-summary-next-page | |
1065 "\177" gnus-summary-prev-page | |
1066 [delete] gnus-summary-prev-page | |
1067 "\r" gnus-summary-scroll-up | |
1068 "n" gnus-summary-next-unread-article | |
1069 "p" gnus-summary-prev-unread-article | |
1070 "N" gnus-summary-next-article | |
1071 "P" gnus-summary-prev-article | |
1072 "\M-\C-n" gnus-summary-next-same-subject | |
1073 "\M-\C-p" gnus-summary-prev-same-subject | |
1074 "\M-n" gnus-summary-next-unread-subject | |
1075 "\M-p" gnus-summary-prev-unread-subject | |
1076 "." gnus-summary-first-unread-article | |
1077 "," gnus-summary-best-unread-article | |
1078 "\M-s" gnus-summary-search-article-forward | |
1079 "\M-r" gnus-summary-search-article-backward | |
1080 "<" gnus-summary-beginning-of-article | |
1081 ">" gnus-summary-end-of-article | |
1082 "j" gnus-summary-goto-article | |
1083 "^" gnus-summary-refer-parent-article | |
1084 "\M-^" gnus-summary-refer-article | |
1085 "u" gnus-summary-tick-article-forward | |
1086 "!" gnus-summary-tick-article-forward | |
1087 "U" gnus-summary-tick-article-backward | |
1088 "d" gnus-summary-mark-as-read-forward | |
1089 "D" gnus-summary-mark-as-read-backward | |
1090 "E" gnus-summary-mark-as-expirable | |
1091 "\M-u" gnus-summary-clear-mark-forward | |
1092 "\M-U" gnus-summary-clear-mark-backward | |
1093 "k" gnus-summary-kill-same-subject-and-select | |
1094 "\C-k" gnus-summary-kill-same-subject | |
1095 "\M-\C-k" gnus-summary-kill-thread | |
1096 "\M-\C-l" gnus-summary-lower-thread | |
1097 "e" gnus-summary-edit-article | |
1098 "#" gnus-summary-mark-as-processable | |
1099 "\M-#" gnus-summary-unmark-as-processable | |
1100 "\M-\C-t" gnus-summary-toggle-threads | |
1101 "\M-\C-s" gnus-summary-show-thread | |
1102 "\M-\C-h" gnus-summary-hide-thread | |
1103 "\M-\C-f" gnus-summary-next-thread | |
1104 "\M-\C-b" gnus-summary-prev-thread | |
1105 "\M-\C-u" gnus-summary-up-thread | |
1106 "\M-\C-d" gnus-summary-down-thread | |
1107 "&" gnus-summary-execute-command | |
1108 "c" gnus-summary-catchup-and-exit | |
1109 "\C-w" gnus-summary-mark-region-as-read | |
1110 "\C-t" gnus-summary-toggle-truncation | |
1111 "?" gnus-summary-mark-as-dormant | |
1112 "\C-c\M-\C-s" gnus-summary-limit-include-expunged | |
1113 "\C-c\C-s\C-n" gnus-summary-sort-by-number | |
1114 "\C-c\C-s\C-l" gnus-summary-sort-by-lines | |
1115 "\C-c\C-s\C-a" gnus-summary-sort-by-author | |
1116 "\C-c\C-s\C-s" gnus-summary-sort-by-subject | |
1117 "\C-c\C-s\C-d" gnus-summary-sort-by-date | |
1118 "\C-c\C-s\C-i" gnus-summary-sort-by-score | |
1119 "=" gnus-summary-expand-window | |
1120 "\C-x\C-s" gnus-summary-reselect-current-group | |
1121 "\M-g" gnus-summary-rescan-group | |
1122 "w" gnus-summary-stop-page-breaking | |
1123 "\C-c\C-r" gnus-summary-caesar-message | |
1124 "\M-t" gnus-summary-toggle-mime | |
1125 "f" gnus-summary-followup | |
1126 "F" gnus-summary-followup-with-original | |
1127 "C" gnus-summary-cancel-article | |
1128 "r" gnus-summary-reply | |
1129 "R" gnus-summary-reply-with-original | |
1130 "\C-c\C-f" gnus-summary-mail-forward | |
1131 "o" gnus-summary-save-article | |
1132 "\C-o" gnus-summary-save-article-mail | |
1133 "|" gnus-summary-pipe-output | |
1134 "\M-k" gnus-summary-edit-local-kill | |
1135 "\M-K" gnus-summary-edit-global-kill | |
1136 ;; "V" gnus-version | |
1137 "\C-c\C-d" gnus-summary-describe-group | |
1138 "q" gnus-summary-exit | |
1139 "Q" gnus-summary-exit-no-update | |
1140 "\C-c\C-i" gnus-info-find-node | |
1141 gnus-mouse-2 gnus-mouse-pick-article | |
1142 "m" gnus-summary-mail-other-window | |
1143 "a" gnus-summary-post-news | |
1144 "x" gnus-summary-limit-to-unread | |
1145 "s" gnus-summary-isearch-article | |
1146 "t" gnus-article-hide-headers | |
1147 "g" gnus-summary-show-article | |
1148 "l" gnus-summary-goto-last-article | |
1149 "\C-c\C-v\C-v" gnus-uu-decode-uu-view | |
1150 "\C-d" gnus-summary-enter-digest-group | |
1151 "\M-\C-d" gnus-summary-read-document | |
1152 "\C-c\C-b" gnus-bug | |
1153 "*" gnus-cache-enter-article | |
1154 "\M-*" gnus-cache-remove-article | |
1155 "\M-&" gnus-summary-universal-argument | |
1156 "\C-l" gnus-recenter | |
1157 "I" gnus-summary-increase-score | |
1158 "L" gnus-summary-lower-score | |
1159 | |
1160 "V" gnus-summary-score-map | |
1161 "X" gnus-uu-extract-map | |
1162 "S" gnus-summary-send-map) | |
1163 | |
1164 ;; Sort of orthogonal keymap | |
1165 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map) | |
1166 "t" gnus-summary-tick-article-forward | |
1167 "!" gnus-summary-tick-article-forward | |
1168 "d" gnus-summary-mark-as-read-forward | |
1169 "r" gnus-summary-mark-as-read-forward | |
1170 "c" gnus-summary-clear-mark-forward | |
1171 " " gnus-summary-clear-mark-forward | |
1172 "e" gnus-summary-mark-as-expirable | |
1173 "x" gnus-summary-mark-as-expirable | |
1174 "?" gnus-summary-mark-as-dormant | |
1175 "b" gnus-summary-set-bookmark | |
1176 "B" gnus-summary-remove-bookmark | |
1177 "#" gnus-summary-mark-as-processable | |
1178 "\M-#" gnus-summary-unmark-as-processable | |
1179 "S" gnus-summary-limit-include-expunged | |
1180 "C" gnus-summary-catchup | |
1181 "H" gnus-summary-catchup-to-here | |
1182 "\C-c" gnus-summary-catchup-all | |
1183 "k" gnus-summary-kill-same-subject-and-select | |
1184 "K" gnus-summary-kill-same-subject | |
1185 "P" gnus-uu-mark-map) | |
1186 | |
1187 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map) | |
1188 "c" gnus-summary-clear-above | |
1189 "u" gnus-summary-tick-above | |
1190 "m" gnus-summary-mark-above | |
1191 "k" gnus-summary-kill-below) | |
1192 | |
1193 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map) | |
1194 "/" gnus-summary-limit-to-subject | |
1195 "n" gnus-summary-limit-to-articles | |
1196 "w" gnus-summary-pop-limit | |
1197 "s" gnus-summary-limit-to-subject | |
1198 "a" gnus-summary-limit-to-author | |
1199 "u" gnus-summary-limit-to-unread | |
1200 "m" gnus-summary-limit-to-marks | |
1201 "v" gnus-summary-limit-to-score | |
1202 "D" gnus-summary-limit-include-dormant | |
1203 "d" gnus-summary-limit-exclude-dormant | |
1204 "t" gnus-summary-limit-to-age | |
1205 "E" gnus-summary-limit-include-expunged | |
1206 "c" gnus-summary-limit-exclude-childless-dormant | |
1207 "C" gnus-summary-limit-mark-excluded-as-read) | |
1208 | |
1209 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map) | |
1210 "n" gnus-summary-next-unread-article | |
1211 "p" gnus-summary-prev-unread-article | |
1212 "N" gnus-summary-next-article | |
1213 "P" gnus-summary-prev-article | |
1214 "\C-n" gnus-summary-next-same-subject | |
1215 "\C-p" gnus-summary-prev-same-subject | |
1216 "\M-n" gnus-summary-next-unread-subject | |
1217 "\M-p" gnus-summary-prev-unread-subject | |
1218 "f" gnus-summary-first-unread-article | |
1219 "b" gnus-summary-best-unread-article | |
1220 "j" gnus-summary-goto-article | |
1221 "g" gnus-summary-goto-subject | |
1222 "l" gnus-summary-goto-last-article | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
1223 "o" gnus-summary-pop-article) |
17493 | 1224 |
1225 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map) | |
1226 "k" gnus-summary-kill-thread | |
1227 "l" gnus-summary-lower-thread | |
1228 "i" gnus-summary-raise-thread | |
1229 "T" gnus-summary-toggle-threads | |
1230 "t" gnus-summary-rethread-current | |
1231 "^" gnus-summary-reparent-thread | |
1232 "s" gnus-summary-show-thread | |
1233 "S" gnus-summary-show-all-threads | |
1234 "h" gnus-summary-hide-thread | |
1235 "H" gnus-summary-hide-all-threads | |
1236 "n" gnus-summary-next-thread | |
1237 "p" gnus-summary-prev-thread | |
1238 "u" gnus-summary-up-thread | |
1239 "o" gnus-summary-top-thread | |
1240 "d" gnus-summary-down-thread | |
1241 "#" gnus-uu-mark-thread | |
1242 "\M-#" gnus-uu-unmark-thread) | |
1243 | |
1244 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map) | |
1245 "g" gnus-summary-prepare | |
1246 "c" gnus-summary-insert-cached-articles) | |
1247 | |
1248 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map) | |
1249 "c" gnus-summary-catchup-and-exit | |
1250 "C" gnus-summary-catchup-all-and-exit | |
1251 "E" gnus-summary-exit-no-update | |
1252 "Q" gnus-summary-exit | |
1253 "Z" gnus-summary-exit | |
1254 "n" gnus-summary-catchup-and-goto-next-group | |
1255 "R" gnus-summary-reselect-current-group | |
1256 "G" gnus-summary-rescan-group | |
1257 "N" gnus-summary-next-group | |
1258 "s" gnus-summary-save-newsrc | |
1259 "P" gnus-summary-prev-group) | |
1260 | |
1261 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map) | |
1262 " " gnus-summary-next-page | |
1263 "n" gnus-summary-next-page | |
1264 "\177" gnus-summary-prev-page | |
1265 [delete] gnus-summary-prev-page | |
1266 "p" gnus-summary-prev-page | |
1267 "\r" gnus-summary-scroll-up | |
1268 "<" gnus-summary-beginning-of-article | |
1269 ">" gnus-summary-end-of-article | |
1270 "b" gnus-summary-beginning-of-article | |
1271 "e" gnus-summary-end-of-article | |
1272 "^" gnus-summary-refer-parent-article | |
1273 "r" gnus-summary-refer-parent-article | |
1274 "R" gnus-summary-refer-references | |
1275 "g" gnus-summary-show-article | |
1276 "s" gnus-summary-isearch-article | |
1277 "P" gnus-summary-print-article) | |
1278 | |
1279 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map) | |
1280 "b" gnus-article-add-buttons | |
1281 "B" gnus-article-add-buttons-to-head | |
1282 "o" gnus-article-treat-overstrike | |
1283 "e" gnus-article-emphasize | |
1284 "w" gnus-article-fill-cited-article | |
1285 "c" gnus-article-remove-cr | |
1286 "q" gnus-article-de-quoted-unreadable | |
1287 "f" gnus-article-display-x-face | |
1288 "l" gnus-summary-stop-page-breaking | |
1289 "r" gnus-summary-caesar-message | |
1290 "t" gnus-article-hide-headers | |
1291 "v" gnus-summary-verbose-headers | |
1292 "m" gnus-summary-toggle-mime | |
1293 "h" gnus-article-treat-html) | |
1294 | |
1295 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map) | |
1296 "a" gnus-article-hide | |
1297 "h" gnus-article-hide-headers | |
1298 "b" gnus-article-hide-boring-headers | |
1299 "s" gnus-article-hide-signature | |
1300 "c" gnus-article-hide-citation | |
1301 "p" gnus-article-hide-pgp | |
1302 "P" gnus-article-hide-pem | |
1303 "\C-c" gnus-article-hide-citation-maybe) | |
1304 | |
1305 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map) | |
1306 "a" gnus-article-highlight | |
1307 "h" gnus-article-highlight-headers | |
1308 "c" gnus-article-highlight-citation | |
1309 "s" gnus-article-highlight-signature) | |
1310 | |
1311 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map) | |
1312 "z" gnus-article-date-ut | |
1313 "u" gnus-article-date-ut | |
1314 "l" gnus-article-date-local | |
1315 "e" gnus-article-date-lapsed | |
1316 "o" gnus-article-date-original | |
1317 "s" gnus-article-date-user) | |
1318 | |
1319 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map) | |
1320 "t" gnus-article-remove-trailing-blank-lines | |
1321 "l" gnus-article-strip-leading-blank-lines | |
1322 "m" gnus-article-strip-multiple-blank-lines | |
1323 "a" gnus-article-strip-blank-lines | |
1324 "s" gnus-article-strip-leading-space) | |
1325 | |
1326 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map) | |
1327 "v" gnus-version | |
1328 "f" gnus-summary-fetch-faq | |
1329 "d" gnus-summary-describe-group | |
1330 "h" gnus-summary-describe-briefly | |
1331 "i" gnus-info-find-node) | |
1332 | |
1333 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map) | |
1334 "e" gnus-summary-expire-articles | |
1335 "\M-\C-e" gnus-summary-expire-articles-now | |
1336 "\177" gnus-summary-delete-article | |
1337 [delete] gnus-summary-delete-article | |
1338 "m" gnus-summary-move-article | |
1339 "r" gnus-summary-respool-article | |
1340 "w" gnus-summary-edit-article | |
1341 "c" gnus-summary-copy-article | |
1342 "B" gnus-summary-crosspost-article | |
1343 "q" gnus-summary-respool-query | |
1344 "i" gnus-summary-import-article | |
1345 "p" gnus-summary-article-posted-p) | |
1346 | |
1347 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map) | |
1348 "o" gnus-summary-save-article | |
1349 "m" gnus-summary-save-article-mail | |
1350 "F" gnus-summary-write-article-file | |
1351 "r" gnus-summary-save-article-rmail | |
1352 "f" gnus-summary-save-article-file | |
1353 "b" gnus-summary-save-article-body-file | |
1354 "h" gnus-summary-save-article-folder | |
1355 "v" gnus-summary-save-article-vm | |
1356 "p" gnus-summary-pipe-output | |
1357 "s" gnus-soup-add-article)) | |
1358 | |
1359 (defun gnus-summary-make-menu-bar () | |
1360 (gnus-turn-off-edit-menu 'summary) | |
1361 | |
1362 (unless (boundp 'gnus-summary-misc-menu) | |
1363 | |
1364 (easy-menu-define | |
1365 gnus-summary-kill-menu gnus-summary-mode-map "" | |
1366 (cons | |
1367 "Score" | |
1368 (nconc | |
1369 (list | |
1370 ["Enter score..." gnus-summary-score-entry t] | |
1371 ["Customize" gnus-score-customize t]) | |
1372 (gnus-make-score-map 'increase) | |
1373 (gnus-make-score-map 'lower) | |
1374 '(("Mark" | |
1375 ["Kill below" gnus-summary-kill-below t] | |
1376 ["Mark above" gnus-summary-mark-above t] | |
1377 ["Tick above" gnus-summary-tick-above t] | |
1378 ["Clear above" gnus-summary-clear-above t]) | |
1379 ["Current score" gnus-summary-current-score t] | |
1380 ["Set score" gnus-summary-set-score t] | |
1381 ["Switch current score file..." gnus-score-change-score-file t] | |
1382 ["Set mark below..." gnus-score-set-mark-below t] | |
1383 ["Set expunge below..." gnus-score-set-expunge-below t] | |
1384 ["Edit current score file" gnus-score-edit-current-scores t] | |
1385 ["Edit score file" gnus-score-edit-file t] | |
1386 ["Trace score" gnus-score-find-trace t] | |
1387 ["Find words" gnus-score-find-favourite-words t] | |
1388 ["Rescore buffer" gnus-summary-rescore t] | |
1389 ["Increase score..." gnus-summary-increase-score t] | |
1390 ["Lower score..." gnus-summary-lower-score t])))) | |
1391 | |
1392 '(("Default header" | |
1393 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil) | |
1394 :style radio | |
1395 :selected (null gnus-score-default-header)] | |
1396 ["From" (gnus-score-set-default 'gnus-score-default-header 'a) | |
1397 :style radio | |
1398 :selected (eq gnus-score-default-header 'a)] | |
1399 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's) | |
1400 :style radio | |
1401 :selected (eq gnus-score-default-header 's)] | |
1402 ["Article body" | |
1403 (gnus-score-set-default 'gnus-score-default-header 'b) | |
1404 :style radio | |
1405 :selected (eq gnus-score-default-header 'b )] | |
1406 ["All headers" | |
1407 (gnus-score-set-default 'gnus-score-default-header 'h) | |
1408 :style radio | |
1409 :selected (eq gnus-score-default-header 'h )] | |
1410 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i) | |
1411 :style radio | |
1412 :selected (eq gnus-score-default-header 'i )] | |
1413 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't) | |
1414 :style radio | |
1415 :selected (eq gnus-score-default-header 't )] | |
1416 ["Crossposting" | |
1417 (gnus-score-set-default 'gnus-score-default-header 'x) | |
1418 :style radio | |
1419 :selected (eq gnus-score-default-header 'x )] | |
1420 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l) | |
1421 :style radio | |
1422 :selected (eq gnus-score-default-header 'l )] | |
1423 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd) | |
1424 :style radio | |
1425 :selected (eq gnus-score-default-header 'd )] | |
1426 ["Followups to author" | |
1427 (gnus-score-set-default 'gnus-score-default-header 'f) | |
1428 :style radio | |
1429 :selected (eq gnus-score-default-header 'f )]) | |
1430 ("Default type" | |
1431 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil) | |
1432 :style radio | |
1433 :selected (null gnus-score-default-type)] | |
1434 ;; The `:active' key is commented out in the following, | |
1435 ;; because the GNU Emacs hack to support radio buttons use | |
1436 ;; active to indicate which button is selected. | |
1437 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's) | |
1438 :style radio | |
1439 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1440 :selected (eq gnus-score-default-type 's)] | |
1441 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r) | |
1442 :style radio | |
1443 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1444 :selected (eq gnus-score-default-type 'r)] | |
1445 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e) | |
1446 :style radio | |
1447 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1448 :selected (eq gnus-score-default-type 'e)] | |
1449 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f) | |
1450 :style radio | |
1451 ;; :active (not (memq gnus-score-default-header '(l d))) | |
1452 :selected (eq gnus-score-default-type 'f)] | |
1453 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b) | |
1454 :style radio | |
1455 ;; :active (eq (gnus-score-default-header 'd)) | |
1456 :selected (eq gnus-score-default-type 'b)] | |
1457 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n) | |
1458 :style radio | |
1459 ;; :active (eq (gnus-score-default-header 'd)) | |
1460 :selected (eq gnus-score-default-type 'n)] | |
1461 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a) | |
1462 :style radio | |
1463 ;; :active (eq (gnus-score-default-header 'd)) | |
1464 :selected (eq gnus-score-default-type 'a)] | |
1465 ["Less than number" | |
1466 (gnus-score-set-default 'gnus-score-default-type '<) | |
1467 :style radio | |
1468 ;; :active (eq (gnus-score-default-header 'l)) | |
1469 :selected (eq gnus-score-default-type '<)] | |
1470 ["Equal to number" | |
1471 (gnus-score-set-default 'gnus-score-default-type '=) | |
1472 :style radio | |
1473 ;; :active (eq (gnus-score-default-header 'l)) | |
1474 :selected (eq gnus-score-default-type '=)] | |
1475 ["Greater than number" | |
1476 (gnus-score-set-default 'gnus-score-default-type '>) | |
1477 :style radio | |
1478 ;; :active (eq (gnus-score-default-header 'l)) | |
1479 :selected (eq gnus-score-default-type '>)]) | |
1480 ["Default fold" gnus-score-default-fold-toggle | |
1481 :style toggle | |
1482 :selected gnus-score-default-fold] | |
1483 ("Default duration" | |
1484 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil) | |
1485 :style radio | |
1486 :selected (null gnus-score-default-duration)] | |
1487 ["Permanent" | |
1488 (gnus-score-set-default 'gnus-score-default-duration 'p) | |
1489 :style radio | |
1490 :selected (eq gnus-score-default-duration 'p)] | |
1491 ["Temporary" | |
1492 (gnus-score-set-default 'gnus-score-default-duration 't) | |
1493 :style radio | |
1494 :selected (eq gnus-score-default-duration 't)] | |
1495 ["Immediate" | |
1496 (gnus-score-set-default 'gnus-score-default-duration 'i) | |
1497 :style radio | |
1498 :selected (eq gnus-score-default-duration 'i)])) | |
1499 | |
1500 (easy-menu-define | |
1501 gnus-summary-article-menu gnus-summary-mode-map "" | |
1502 '("Article" | |
1503 ("Hide" | |
1504 ["All" gnus-article-hide t] | |
1505 ["Headers" gnus-article-hide-headers t] | |
1506 ["Signature" gnus-article-hide-signature t] | |
1507 ["Citation" gnus-article-hide-citation t] | |
1508 ["PGP" gnus-article-hide-pgp t] | |
1509 ["Boring headers" gnus-article-hide-boring-headers t]) | |
1510 ("Highlight" | |
1511 ["All" gnus-article-highlight t] | |
1512 ["Headers" gnus-article-highlight-headers t] | |
1513 ["Signature" gnus-article-highlight-signature t] | |
1514 ["Citation" gnus-article-highlight-citation t]) | |
1515 ("Date" | |
1516 ["Local" gnus-article-date-local t] | |
1517 ["UT" gnus-article-date-ut t] | |
1518 ["Original" gnus-article-date-original t] | |
1519 ["Lapsed" gnus-article-date-lapsed t] | |
1520 ["User-defined" gnus-article-date-user t]) | |
1521 ("Washing" | |
1522 ("Remove Blanks" | |
1523 ["Leading" gnus-article-strip-leading-blank-lines t] | |
1524 ["Multiple" gnus-article-strip-multiple-blank-lines t] | |
1525 ["Trailing" gnus-article-remove-trailing-blank-lines t] | |
1526 ["All of the above" gnus-article-strip-blank-lines t] | |
1527 ["Leading space" gnus-article-strip-leading-space t]) | |
1528 ["Overstrike" gnus-article-treat-overstrike t] | |
1529 ["Emphasis" gnus-article-emphasize t] | |
1530 ["Word wrap" gnus-article-fill-cited-article t] | |
1531 ["CR" gnus-article-remove-cr t] | |
1532 ["Show X-Face" gnus-article-display-x-face t] | |
1533 ["Quoted-Printable" gnus-article-de-quoted-unreadable t] | |
1534 ["UnHTMLize" gnus-article-treat-html t] | |
1535 ["Rot 13" gnus-summary-caesar-message t] | |
1536 ["Unix pipe" gnus-summary-pipe-message t] | |
1537 ["Add buttons" gnus-article-add-buttons t] | |
1538 ["Add buttons to head" gnus-article-add-buttons-to-head t] | |
1539 ["Stop page breaking" gnus-summary-stop-page-breaking t] | |
1540 ["Toggle MIME" gnus-summary-toggle-mime t] | |
1541 ["Verbose header" gnus-summary-verbose-headers t] | |
1542 ["Toggle header" gnus-summary-toggle-header t]) | |
1543 ("Output" | |
1544 ["Save in default format" gnus-summary-save-article t] | |
1545 ["Save in file" gnus-summary-save-article-file t] | |
1546 ["Save in Unix mail format" gnus-summary-save-article-mail t] | |
1547 ["Write to file" gnus-summary-write-article-mail t] | |
1548 ["Save in MH folder" gnus-summary-save-article-folder t] | |
1549 ["Save in VM folder" gnus-summary-save-article-vm t] | |
1550 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t] | |
1551 ["Save body in file" gnus-summary-save-article-body-file t] | |
1552 ["Pipe through a filter" gnus-summary-pipe-output t] | |
1553 ["Add to SOUP packet" gnus-soup-add-article t] | |
1554 ["Print" gnus-summary-print-article t]) | |
1555 ("Backend" | |
1556 ["Respool article..." gnus-summary-respool-article t] | |
1557 ["Move article..." gnus-summary-move-article | |
1558 (gnus-check-backend-function | |
1559 'request-move-article gnus-newsgroup-name)] | |
1560 ["Copy article..." gnus-summary-copy-article t] | |
1561 ["Crosspost article..." gnus-summary-crosspost-article | |
1562 (gnus-check-backend-function | |
1563 'request-replace-article gnus-newsgroup-name)] | |
1564 ["Import file..." gnus-summary-import-article t] | |
1565 ["Check if posted" gnus-summary-article-posted-p t] | |
1566 ["Edit article" gnus-summary-edit-article | |
1567 (not (gnus-group-read-only-p))] | |
1568 ["Delete article" gnus-summary-delete-article | |
1569 (gnus-check-backend-function | |
1570 'request-expire-articles gnus-newsgroup-name)] | |
1571 ["Query respool" gnus-summary-respool-query t] | |
1572 ["Delete expirable articles" gnus-summary-expire-articles-now | |
1573 (gnus-check-backend-function | |
1574 'request-expire-articles gnus-newsgroup-name)]) | |
1575 ("Extract" | |
1576 ["Uudecode" gnus-uu-decode-uu t] | |
1577 ["Uudecode and save" gnus-uu-decode-uu-and-save t] | |
1578 ["Unshar" gnus-uu-decode-unshar t] | |
1579 ["Unshar and save" gnus-uu-decode-unshar-and-save t] | |
1580 ["Save" gnus-uu-decode-save t] | |
1581 ["Binhex" gnus-uu-decode-binhex t] | |
1582 ["Postscript" gnus-uu-decode-postscript t]) | |
1583 ("Cache" | |
1584 ["Enter article" gnus-cache-enter-article t] | |
1585 ["Remove article" gnus-cache-remove-article t]) | |
1586 ["Enter digest buffer" gnus-summary-enter-digest-group t] | |
1587 ["Isearch article..." gnus-summary-isearch-article t] | |
1588 ["Beginning of the article" gnus-summary-beginning-of-article t] | |
1589 ["End of the article" gnus-summary-end-of-article t] | |
1590 ["Fetch parent of article" gnus-summary-refer-parent-article t] | |
1591 ["Fetch referenced articles" gnus-summary-refer-references t] | |
1592 ["Fetch article with id..." gnus-summary-refer-article t] | |
1593 ["Redisplay" gnus-summary-show-article t])) | |
1594 | |
1595 (easy-menu-define | |
1596 gnus-summary-thread-menu gnus-summary-mode-map "" | |
1597 '("Threads" | |
1598 ["Toggle threading" gnus-summary-toggle-threads t] | |
1599 ["Hide threads" gnus-summary-hide-all-threads t] | |
1600 ["Show threads" gnus-summary-show-all-threads t] | |
1601 ["Hide thread" gnus-summary-hide-thread t] | |
1602 ["Show thread" gnus-summary-show-thread t] | |
1603 ["Go to next thread" gnus-summary-next-thread t] | |
1604 ["Go to previous thread" gnus-summary-prev-thread t] | |
1605 ["Go down thread" gnus-summary-down-thread t] | |
1606 ["Go up thread" gnus-summary-up-thread t] | |
1607 ["Top of thread" gnus-summary-top-thread t] | |
1608 ["Mark thread as read" gnus-summary-kill-thread t] | |
1609 ["Lower thread score" gnus-summary-lower-thread t] | |
1610 ["Raise thread score" gnus-summary-raise-thread t] | |
1611 ["Rethread current" gnus-summary-rethread-current t] | |
1612 )) | |
1613 | |
1614 (easy-menu-define | |
1615 gnus-summary-post-menu gnus-summary-mode-map "" | |
1616 '("Post" | |
1617 ["Post an article" gnus-summary-post-news t] | |
1618 ["Followup" gnus-summary-followup t] | |
1619 ["Followup and yank" gnus-summary-followup-with-original t] | |
1620 ["Supersede article" gnus-summary-supersede-article t] | |
1621 ["Cancel article" gnus-summary-cancel-article t] | |
1622 ["Reply" gnus-summary-reply t] | |
1623 ["Reply and yank" gnus-summary-reply-with-original t] | |
1624 ["Wide reply" gnus-summary-wide-reply t] | |
1625 ["Wide reply and yank" gnus-summary-wide-reply-with-original t] | |
1626 ["Mail forward" gnus-summary-mail-forward t] | |
1627 ["Post forward" gnus-summary-post-forward t] | |
1628 ["Digest and mail" gnus-uu-digest-mail-forward t] | |
1629 ["Digest and post" gnus-uu-digest-post-forward t] | |
1630 ["Resend message" gnus-summary-resend-message t] | |
1631 ["Send bounced mail" gnus-summary-resend-bounced-mail t] | |
1632 ["Send a mail" gnus-summary-mail-other-window t] | |
1633 ["Uuencode and post" gnus-uu-post-news t] | |
1634 ["Followup via news" gnus-summary-followup-to-mail t] | |
1635 ["Followup via news and yank" | |
1636 gnus-summary-followup-to-mail-with-original t] | |
1637 ;;("Draft" | |
1638 ;;["Send" gnus-summary-send-draft t] | |
1639 ;;["Send bounced" gnus-resend-bounced-mail t]) | |
1640 )) | |
1641 | |
1642 (easy-menu-define | |
1643 gnus-summary-misc-menu gnus-summary-mode-map "" | |
1644 '("Misc" | |
1645 ("Mark Read" | |
1646 ["Mark as read" gnus-summary-mark-as-read-forward t] | |
1647 ["Mark same subject and select" | |
1648 gnus-summary-kill-same-subject-and-select t] | |
1649 ["Mark same subject" gnus-summary-kill-same-subject t] | |
1650 ["Catchup" gnus-summary-catchup t] | |
1651 ["Catchup all" gnus-summary-catchup-all t] | |
1652 ["Catchup to here" gnus-summary-catchup-to-here t] | |
1653 ["Catchup region" gnus-summary-mark-region-as-read t] | |
1654 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t]) | |
1655 ("Mark Various" | |
1656 ["Tick" gnus-summary-tick-article-forward t] | |
1657 ["Mark as dormant" gnus-summary-mark-as-dormant t] | |
1658 ["Remove marks" gnus-summary-clear-mark-forward t] | |
1659 ["Set expirable mark" gnus-summary-mark-as-expirable t] | |
1660 ["Set bookmark" gnus-summary-set-bookmark t] | |
1661 ["Remove bookmark" gnus-summary-remove-bookmark t]) | |
1662 ("Mark Limit" | |
1663 ["Marks..." gnus-summary-limit-to-marks t] | |
1664 ["Subject..." gnus-summary-limit-to-subject t] | |
1665 ["Author..." gnus-summary-limit-to-author t] | |
1666 ["Age..." gnus-summary-limit-to-age t] | |
1667 ["Score" gnus-summary-limit-to-score t] | |
1668 ["Unread" gnus-summary-limit-to-unread t] | |
1669 ["Non-dormant" gnus-summary-limit-exclude-dormant t] | |
1670 ["Articles" gnus-summary-limit-to-articles t] | |
1671 ["Pop limit" gnus-summary-pop-limit t] | |
1672 ["Show dormant" gnus-summary-limit-include-dormant t] | |
1673 ["Hide childless dormant" | |
1674 gnus-summary-limit-exclude-childless-dormant t] | |
1675 ;;["Hide thread" gnus-summary-limit-exclude-thread t] | |
1676 ["Show expunged" gnus-summary-show-all-expunged t]) | |
1677 ("Process Mark" | |
1678 ["Set mark" gnus-summary-mark-as-processable t] | |
1679 ["Remove mark" gnus-summary-unmark-as-processable t] | |
1680 ["Remove all marks" gnus-summary-unmark-all-processable t] | |
1681 ["Mark above" gnus-uu-mark-over t] | |
1682 ["Mark series" gnus-uu-mark-series t] | |
1683 ["Mark region" gnus-uu-mark-region t] | |
1684 ["Mark by regexp..." gnus-uu-mark-by-regexp t] | |
1685 ["Mark all" gnus-uu-mark-all t] | |
1686 ["Mark buffer" gnus-uu-mark-buffer t] | |
1687 ["Mark sparse" gnus-uu-mark-sparse t] | |
1688 ["Mark thread" gnus-uu-mark-thread t] | |
1689 ["Unmark thread" gnus-uu-unmark-thread t] | |
1690 ("Process Mark Sets" | |
1691 ["Kill" gnus-summary-kill-process-mark t] | |
1692 ["Yank" gnus-summary-yank-process-mark | |
1693 gnus-newsgroup-process-stack] | |
1694 ["Save" gnus-summary-save-process-mark t])) | |
1695 ("Scroll article" | |
1696 ["Page forward" gnus-summary-next-page t] | |
1697 ["Page backward" gnus-summary-prev-page t] | |
1698 ["Line forward" gnus-summary-scroll-up t]) | |
1699 ("Move" | |
1700 ["Next unread article" gnus-summary-next-unread-article t] | |
1701 ["Previous unread article" gnus-summary-prev-unread-article t] | |
1702 ["Next article" gnus-summary-next-article t] | |
1703 ["Previous article" gnus-summary-prev-article t] | |
1704 ["Next unread subject" gnus-summary-next-unread-subject t] | |
1705 ["Previous unread subject" gnus-summary-prev-unread-subject t] | |
1706 ["Next article same subject" gnus-summary-next-same-subject t] | |
1707 ["Previous article same subject" gnus-summary-prev-same-subject t] | |
1708 ["First unread article" gnus-summary-first-unread-article t] | |
1709 ["Best unread article" gnus-summary-best-unread-article t] | |
1710 ["Go to subject number..." gnus-summary-goto-subject t] | |
1711 ["Go to article number..." gnus-summary-goto-article t] | |
1712 ["Go to the last article" gnus-summary-goto-last-article t] | |
1713 ["Pop article off history" gnus-summary-pop-article t]) | |
1714 ("Sort" | |
1715 ["Sort by number" gnus-summary-sort-by-number t] | |
1716 ["Sort by author" gnus-summary-sort-by-author t] | |
1717 ["Sort by subject" gnus-summary-sort-by-subject t] | |
1718 ["Sort by date" gnus-summary-sort-by-date t] | |
1719 ["Sort by score" gnus-summary-sort-by-score t] | |
1720 ["Sort by lines" gnus-summary-sort-by-lines t]) | |
1721 ("Help" | |
1722 ["Fetch group FAQ" gnus-summary-fetch-faq t] | |
1723 ["Describe group" gnus-summary-describe-group t] | |
1724 ["Read manual" gnus-info-find-node t]) | |
1725 ("Modes" | |
1726 ["Pick and read" gnus-pick-mode t] | |
1727 ["Binary" gnus-binary-mode t]) | |
1728 ("Regeneration" | |
1729 ["Regenerate" gnus-summary-prepare t] | |
1730 ["Insert cached articles" gnus-summary-insert-cached-articles t] | |
1731 ["Toggle threading" gnus-summary-toggle-threads t]) | |
1732 ["Filter articles..." gnus-summary-execute-command t] | |
1733 ["Run command on subjects..." gnus-summary-universal-argument t] | |
1734 ["Search articles forward..." gnus-summary-search-article-forward t] | |
1735 ["Search articles backward..." gnus-summary-search-article-backward t] | |
1736 ["Toggle line truncation" gnus-summary-toggle-truncation t] | |
1737 ["Expand window" gnus-summary-expand-window t] | |
1738 ["Expire expirable articles" gnus-summary-expire-articles | |
1739 (gnus-check-backend-function | |
1740 'request-expire-articles gnus-newsgroup-name)] | |
1741 ["Edit local kill file" gnus-summary-edit-local-kill t] | |
1742 ["Edit main kill file" gnus-summary-edit-global-kill t] | |
1743 ("Exit" | |
1744 ["Catchup and exit" gnus-summary-catchup-and-exit t] | |
1745 ["Catchup all and exit" gnus-summary-catchup-and-exit t] | |
1746 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t] | |
1747 ["Exit group" gnus-summary-exit t] | |
1748 ["Exit group without updating" gnus-summary-exit-no-update t] | |
1749 ["Exit and goto next group" gnus-summary-next-group t] | |
1750 ["Exit and goto prev group" gnus-summary-prev-group t] | |
1751 ["Reselect group" gnus-summary-reselect-current-group t] | |
1752 ["Rescan group" gnus-summary-rescan-group t] | |
1753 ["Update dribble" gnus-summary-save-newsrc t]))) | |
1754 | |
1755 (run-hooks 'gnus-summary-menu-hook))) | |
1756 | |
1757 (defun gnus-score-set-default (var value) | |
1758 "A version of set that updates the GNU Emacs menu-bar." | |
1759 (set var value) | |
1760 ;; It is the message that forces the active status to be updated. | |
1761 (message "")) | |
1762 | |
1763 (defun gnus-make-score-map (type) | |
1764 "Make a summary score map of type TYPE." | |
1765 (if t | |
1766 nil | |
1767 (let ((headers '(("author" "from" string) | |
1768 ("subject" "subject" string) | |
1769 ("article body" "body" string) | |
1770 ("article head" "head" string) | |
1771 ("xref" "xref" string) | |
1772 ("lines" "lines" number) | |
1773 ("followups to author" "followup" string))) | |
1774 (types '((number ("less than" <) | |
1775 ("greater than" >) | |
1776 ("equal" =)) | |
1777 (string ("substring" s) | |
1778 ("exact string" e) | |
1779 ("fuzzy string" f) | |
1780 ("regexp" r)))) | |
1781 (perms '(("temporary" (current-time-string)) | |
1782 ("permanent" nil) | |
1783 ("immediate" now))) | |
1784 header) | |
1785 (list | |
1786 (apply | |
1787 'nconc | |
1788 (list | |
1789 (if (eq type 'lower) | |
1790 "Lower score" | |
1791 "Increase score")) | |
1792 (let (outh) | |
1793 (while headers | |
1794 (setq header (car headers)) | |
1795 (setq outh | |
1796 (cons | |
1797 (apply | |
1798 'nconc | |
1799 (list (car header)) | |
1800 (let ((ts (cdr (assoc (nth 2 header) types))) | |
1801 outt) | |
1802 (while ts | |
1803 (setq outt | |
1804 (cons | |
1805 (apply | |
1806 'nconc | |
1807 (list (caar ts)) | |
1808 (let ((ps perms) | |
1809 outp) | |
1810 (while ps | |
1811 (setq outp | |
1812 (cons | |
1813 (vector | |
1814 (caar ps) | |
1815 (list | |
1816 'gnus-summary-score-entry | |
1817 (nth 1 header) | |
1818 (if (or (string= (nth 1 header) | |
1819 "head") | |
1820 (string= (nth 1 header) | |
1821 "body")) | |
1822 "" | |
1823 (list 'gnus-summary-header | |
1824 (nth 1 header))) | |
1825 (list 'quote (nth 1 (car ts))) | |
1826 (list 'gnus-score-default nil) | |
1827 (nth 1 (car ps)) | |
1828 t) | |
1829 t) | |
1830 outp)) | |
1831 (setq ps (cdr ps))) | |
1832 (list (nreverse outp)))) | |
1833 outt)) | |
1834 (setq ts (cdr ts))) | |
1835 (list (nreverse outt)))) | |
1836 outh)) | |
1837 (setq headers (cdr headers))) | |
1838 (list (nreverse outh)))))))) | |
1839 | |
1840 | |
1841 | |
1842 (defun gnus-summary-mode (&optional group) | |
1843 "Major mode for reading articles. | |
1844 | |
1845 All normal editing commands are switched off. | |
1846 \\<gnus-summary-mode-map> | |
1847 Each line in this buffer represents one article. To read an | |
1848 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards | |
1849 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]', | |
1850 respectively. | |
1851 | |
1852 You can also post articles and send mail from this buffer. To | |
1853 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author | |
1854 of an article, type `\\[gnus-summary-reply]'. | |
1855 | |
1856 There are approx. one gazillion commands you can execute in this | |
1857 buffer; read the info pages for more information (`\\[gnus-info-find-node]'). | |
1858 | |
1859 The following commands are available: | |
1860 | |
1861 \\{gnus-summary-mode-map}" | |
1862 (interactive) | |
1863 (when (gnus-visual-p 'summary-menu 'menu) | |
1864 (gnus-summary-make-menu-bar)) | |
1865 (kill-all-local-variables) | |
1866 (gnus-summary-make-local-variables) | |
1867 (gnus-make-thread-indent-array) | |
1868 (gnus-simplify-mode-line) | |
1869 (setq major-mode 'gnus-summary-mode) | |
1870 (setq mode-name "Summary") | |
1871 (make-local-variable 'minor-mode-alist) | |
1872 (use-local-map gnus-summary-mode-map) | |
1873 (buffer-disable-undo (current-buffer)) | |
1874 (setq buffer-read-only t) ;Disable modification | |
1875 (setq truncate-lines t) | |
1876 (setq selective-display t) | |
1877 (setq selective-display-ellipses t) ;Display `...' | |
1878 (gnus-summary-set-display-table) | |
1879 (gnus-set-default-directory) | |
1880 (setq gnus-newsgroup-name group) | |
1881 (make-local-variable 'gnus-summary-line-format) | |
1882 (make-local-variable 'gnus-summary-line-format-spec) | |
1883 (make-local-variable 'gnus-summary-mark-positions) | |
1884 (make-local-hook 'post-command-hook) | |
1885 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t) | |
1886 (run-hooks 'gnus-summary-mode-hook) | |
1887 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy) | |
1888 (gnus-update-summary-mark-positions)) | |
1889 | |
1890 (defun gnus-summary-make-local-variables () | |
1891 "Make all the local summary buffer variables." | |
1892 (let ((locals gnus-summary-local-variables) | |
1893 global local) | |
1894 (while (setq local (pop locals)) | |
1895 (if (consp local) | |
1896 (progn | |
1897 (if (eq (cdr local) 'global) | |
1898 ;; Copy the global value of the variable. | |
1899 (setq global (symbol-value (car local))) | |
1900 ;; Use the value from the list. | |
1901 (setq global (eval (cdr local)))) | |
1902 (make-local-variable (car local)) | |
1903 (set (car local) global)) | |
1904 ;; Simple nil-valued local variable. | |
1905 (make-local-variable local) | |
1906 (set local nil))))) | |
1907 | |
1908 (defun gnus-summary-clear-local-variables () | |
1909 (let ((locals gnus-summary-local-variables)) | |
1910 (while locals | |
1911 (if (consp (car locals)) | |
1912 (and (vectorp (caar locals)) | |
1913 (set (caar locals) nil)) | |
1914 (and (vectorp (car locals)) | |
1915 (set (car locals) nil))) | |
1916 (setq locals (cdr locals))))) | |
1917 | |
1918 ;; Summary data functions. | |
1919 | |
1920 (defmacro gnus-data-number (data) | |
1921 `(car ,data)) | |
1922 | |
1923 (defmacro gnus-data-set-number (data number) | |
1924 `(setcar ,data ,number)) | |
1925 | |
1926 (defmacro gnus-data-mark (data) | |
1927 `(nth 1 ,data)) | |
1928 | |
1929 (defmacro gnus-data-set-mark (data mark) | |
1930 `(setcar (nthcdr 1 ,data) ,mark)) | |
1931 | |
1932 (defmacro gnus-data-pos (data) | |
1933 `(nth 2 ,data)) | |
1934 | |
1935 (defmacro gnus-data-set-pos (data pos) | |
1936 `(setcar (nthcdr 2 ,data) ,pos)) | |
1937 | |
1938 (defmacro gnus-data-header (data) | |
1939 `(nth 3 ,data)) | |
1940 | |
1941 (defmacro gnus-data-set-header (data header) | |
1942 `(setf (nth 3 ,data) ,header)) | |
1943 | |
1944 (defmacro gnus-data-level (data) | |
1945 `(nth 4 ,data)) | |
1946 | |
1947 (defmacro gnus-data-unread-p (data) | |
1948 `(= (nth 1 ,data) gnus-unread-mark)) | |
1949 | |
1950 (defmacro gnus-data-read-p (data) | |
1951 `(/= (nth 1 ,data) gnus-unread-mark)) | |
1952 | |
1953 (defmacro gnus-data-pseudo-p (data) | |
1954 `(consp (nth 3 ,data))) | |
1955 | |
1956 (defmacro gnus-data-find (number) | |
1957 `(assq ,number gnus-newsgroup-data)) | |
1958 | |
1959 (defmacro gnus-data-find-list (number &optional data) | |
1960 `(let ((bdata ,(or data 'gnus-newsgroup-data))) | |
1961 (memq (assq ,number bdata) | |
1962 bdata))) | |
1963 | |
1964 (defmacro gnus-data-make (number mark pos header level) | |
1965 `(list ,number ,mark ,pos ,header ,level)) | |
1966 | |
1967 (defun gnus-data-enter (after-article number mark pos header level offset) | |
1968 (let ((data (gnus-data-find-list after-article))) | |
1969 (unless data | |
1970 (error "No such article: %d" after-article)) | |
1971 (setcdr data (cons (gnus-data-make number mark pos header level) | |
1972 (cdr data))) | |
1973 (setq gnus-newsgroup-data-reverse nil) | |
1974 (gnus-data-update-list (cddr data) offset))) | |
1975 | |
1976 (defun gnus-data-enter-list (after-article list &optional offset) | |
1977 (when list | |
1978 (let ((data (and after-article (gnus-data-find-list after-article))) | |
1979 (ilist list)) | |
1980 (or data (not after-article) (error "No such article: %d" after-article)) | |
1981 ;; Find the last element in the list to be spliced into the main | |
1982 ;; list. | |
1983 (while (cdr list) | |
1984 (setq list (cdr list))) | |
1985 (if (not data) | |
1986 (progn | |
1987 (setcdr list gnus-newsgroup-data) | |
1988 (setq gnus-newsgroup-data ilist) | |
1989 (when offset | |
1990 (gnus-data-update-list (cdr list) offset))) | |
1991 (setcdr list (cdr data)) | |
1992 (setcdr data ilist) | |
1993 (when offset | |
1994 (gnus-data-update-list (cdr list) offset))) | |
1995 (setq gnus-newsgroup-data-reverse nil)))) | |
1996 | |
1997 (defun gnus-data-remove (article &optional offset) | |
1998 (let ((data gnus-newsgroup-data)) | |
1999 (if (= (gnus-data-number (car data)) article) | |
2000 (progn | |
2001 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data) | |
2002 gnus-newsgroup-data-reverse nil) | |
2003 (when offset | |
2004 (gnus-data-update-list gnus-newsgroup-data offset))) | |
2005 (while (cdr data) | |
2006 (when (= (gnus-data-number (cadr data)) article) | |
2007 (setcdr data (cddr data)) | |
2008 (when offset | |
2009 (gnus-data-update-list (cdr data) offset)) | |
2010 (setq data nil | |
2011 gnus-newsgroup-data-reverse nil)) | |
2012 (setq data (cdr data)))))) | |
2013 | |
2014 (defmacro gnus-data-list (backward) | |
2015 `(if ,backward | |
2016 (or gnus-newsgroup-data-reverse | |
2017 (setq gnus-newsgroup-data-reverse | |
2018 (reverse gnus-newsgroup-data))) | |
2019 gnus-newsgroup-data)) | |
2020 | |
2021 (defun gnus-data-update-list (data offset) | |
2022 "Add OFFSET to the POS of all data entries in DATA." | |
2023 (while data | |
2024 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data)))) | |
2025 (setq data (cdr data)))) | |
2026 | |
2027 (defun gnus-data-compute-positions () | |
2028 "Compute the positions of all articles." | |
2029 (let ((data gnus-newsgroup-data) | |
2030 pos) | |
2031 (while data | |
2032 (when (setq pos (text-property-any | |
2033 (point-min) (point-max) | |
2034 'gnus-number (gnus-data-number (car data)))) | |
2035 (gnus-data-set-pos (car data) (+ pos 3))) | |
2036 (setq data (cdr data))))) | |
2037 | |
2038 (defun gnus-summary-article-pseudo-p (article) | |
2039 "Say whether this article is a pseudo article or not." | |
2040 (not (vectorp (gnus-data-header (gnus-data-find article))))) | |
2041 | |
2042 (defmacro gnus-summary-article-sparse-p (article) | |
2043 "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
|
2044 `(memq ,article gnus-newsgroup-sparse)) |
17493 | 2045 |
2046 (defmacro gnus-summary-article-ancient-p (article) | |
2047 "Say whether this article is a sparse article or not." | |
2048 `(memq ,article gnus-newsgroup-ancient)) | |
2049 | |
2050 (defun gnus-article-parent-p (number) | |
2051 "Say whether this article is a parent or not." | |
2052 (let ((data (gnus-data-find-list number))) | |
2053 (and (cdr data) ; There has to be an article after... | |
2054 (< (gnus-data-level (car data)) ; And it has to have a higher level. | |
2055 (gnus-data-level (nth 1 data)))))) | |
2056 | |
2057 (defun gnus-article-children (number) | |
2058 "Return a list of all children to NUMBER." | |
2059 (let* ((data (gnus-data-find-list number)) | |
2060 (level (gnus-data-level (car data))) | |
2061 children) | |
2062 (setq data (cdr data)) | |
2063 (while (and data | |
2064 (= (gnus-data-level (car data)) (1+ level))) | |
2065 (push (gnus-data-number (car data)) children) | |
2066 (setq data (cdr data))) | |
2067 children)) | |
2068 | |
2069 (defmacro gnus-summary-skip-intangible () | |
2070 "If the current article is intangible, then jump to a different article." | |
2071 '(let ((to (get-text-property (point) 'gnus-intangible))) | |
2072 (and to (gnus-summary-goto-subject to)))) | |
2073 | |
2074 (defmacro gnus-summary-article-intangible-p () | |
2075 "Say whether this article is intangible or not." | |
2076 '(get-text-property (point) 'gnus-intangible)) | |
2077 | |
2078 (defun gnus-article-read-p (article) | |
2079 "Say whether ARTICLE is read or not." | |
2080 (not (or (memq article gnus-newsgroup-marked) | |
2081 (memq article gnus-newsgroup-unreads) | |
2082 (memq article gnus-newsgroup-unselected) | |
2083 (memq article gnus-newsgroup-dormant)))) | |
2084 | |
2085 ;; Some summary mode macros. | |
2086 | |
2087 (defmacro gnus-summary-article-number () | |
2088 "The article number of the article on the current line. | |
2089 If there isn's an article number here, then we return the current | |
2090 article number." | |
2091 '(progn | |
2092 (gnus-summary-skip-intangible) | |
2093 (or (get-text-property (point) 'gnus-number) | |
2094 (gnus-summary-last-subject)))) | |
2095 | |
2096 (defmacro gnus-summary-article-header (&optional number) | |
2097 `(gnus-data-header (gnus-data-find | |
2098 ,(or number '(gnus-summary-article-number))))) | |
2099 | |
2100 (defmacro gnus-summary-thread-level (&optional number) | |
2101 `(if (and (eq gnus-summary-make-false-root 'dummy) | |
2102 (get-text-property (point) 'gnus-intangible)) | |
2103 0 | |
2104 (gnus-data-level (gnus-data-find | |
2105 ,(or number '(gnus-summary-article-number)))))) | |
2106 | |
2107 (defmacro gnus-summary-article-mark (&optional number) | |
2108 `(gnus-data-mark (gnus-data-find | |
2109 ,(or number '(gnus-summary-article-number))))) | |
2110 | |
2111 (defmacro gnus-summary-article-pos (&optional number) | |
2112 `(gnus-data-pos (gnus-data-find | |
2113 ,(or number '(gnus-summary-article-number))))) | |
2114 | |
2115 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject) | |
2116 (defmacro gnus-summary-article-subject (&optional number) | |
2117 "Return current subject string or nil if nothing." | |
2118 `(let ((headers | |
2119 ,(if number | |
2120 `(gnus-data-header (assq ,number gnus-newsgroup-data)) | |
2121 '(gnus-data-header (assq (gnus-summary-article-number) | |
2122 gnus-newsgroup-data))))) | |
2123 (and headers | |
2124 (vectorp headers) | |
2125 (mail-header-subject headers)))) | |
2126 | |
2127 (defmacro gnus-summary-article-score (&optional number) | |
2128 "Return current article score." | |
2129 `(or (cdr (assq ,(or number '(gnus-summary-article-number)) | |
2130 gnus-newsgroup-scored)) | |
2131 gnus-summary-default-score 0)) | |
2132 | |
2133 (defun gnus-summary-article-children (&optional number) | |
2134 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number)))) | |
2135 (level (gnus-data-level (car data))) | |
2136 l children) | |
2137 (while (and (setq data (cdr data)) | |
2138 (> (setq l (gnus-data-level (car data))) level)) | |
2139 (and (= (1+ level) l) | |
2140 (push (gnus-data-number (car data)) | |
2141 children))) | |
2142 (nreverse children))) | |
2143 | |
2144 (defun gnus-summary-article-parent (&optional number) | |
2145 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number)) | |
2146 (gnus-data-list t))) | |
2147 (level (gnus-data-level (car data)))) | |
2148 (if (zerop level) | |
2149 () ; This is a root. | |
2150 ;; We search until we find an article with a level less than | |
2151 ;; this one. That function has to be the parent. | |
2152 (while (and (setq data (cdr data)) | |
2153 (not (< (gnus-data-level (car data)) level)))) | |
2154 (and data (gnus-data-number (car data)))))) | |
2155 | |
2156 (defun gnus-unread-mark-p (mark) | |
2157 "Say whether MARK is the unread mark." | |
2158 (= mark gnus-unread-mark)) | |
2159 | |
2160 (defun gnus-read-mark-p (mark) | |
2161 "Say whether MARK is one of the marks that mark as read. | |
2162 This is all marks except unread, ticked, dormant, and expirable." | |
2163 (not (or (= mark gnus-unread-mark) | |
2164 (= mark gnus-ticked-mark) | |
2165 (= mark gnus-dormant-mark) | |
2166 (= mark gnus-expirable-mark)))) | |
2167 | |
2168 (defmacro gnus-article-mark (number) | |
2169 `(cond | |
2170 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark) | |
2171 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark) | |
2172 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark) | |
2173 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark) | |
2174 (t (or (cdr (assq ,number gnus-newsgroup-reads)) | |
2175 gnus-ancient-mark)))) | |
2176 | |
2177 ;; Saving hidden threads. | |
2178 | |
2179 (put 'gnus-save-hidden-threads 'lisp-indent-function 0) | |
2180 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body)) | |
2181 | |
2182 (defmacro gnus-save-hidden-threads (&rest forms) | |
2183 "Save hidden threads, eval FORMS, and restore the hidden threads." | |
2184 (let ((config (make-symbol "config"))) | |
2185 `(let ((,config (gnus-hidden-threads-configuration))) | |
2186 (unwind-protect | |
2187 (save-excursion | |
2188 ,@forms) | |
2189 (gnus-restore-hidden-threads-configuration ,config))))) | |
2190 | |
2191 (defun gnus-hidden-threads-configuration () | |
2192 "Return the current hidden threads configuration." | |
2193 (save-excursion | |
2194 (let (config) | |
2195 (goto-char (point-min)) | |
2196 (while (search-forward "\r" nil t) | |
2197 (push (1- (point)) config)) | |
2198 config))) | |
2199 | |
2200 (defun gnus-restore-hidden-threads-configuration (config) | |
2201 "Restore hidden threads configuration from CONFIG." | |
2202 (let (point buffer-read-only) | |
2203 (while (setq point (pop config)) | |
2204 (when (and (< point (point-max)) | |
2205 (goto-char point) | |
2206 (= (following-char) ?\n)) | |
2207 (subst-char-in-region point (1+ point) ?\n ?\r))))) | |
2208 | |
2209 ;; Various summary mode internalish functions. | |
2210 | |
2211 (defun gnus-mouse-pick-article (e) | |
2212 (interactive "e") | |
2213 (mouse-set-point e) | |
2214 (gnus-summary-next-page nil t)) | |
2215 | |
2216 (defun gnus-summary-set-display-table () | |
2217 ;; Change the display table. Odd characters have a tendency to mess | |
2218 ;; up nicely formatted displays - we make all possible glyphs | |
2219 ;; display only a single character. | |
2220 | |
2221 ;; We start from the standard display table, if any. | |
2222 (let ((table (or (copy-sequence standard-display-table) | |
2223 (make-display-table))) | |
2224 (i 32)) | |
2225 ;; Nix out all the control chars... | |
2226 (while (>= (setq i (1- i)) 0) | |
2227 (aset table i [??])) | |
2228 ;; ... but not newline and cr, of course. (cr is necessary for the | |
2229 ;; selective display). | |
2230 (aset table ?\n nil) | |
2231 (aset table ?\r nil) | |
2232 ;; We nix out any glyphs over 126 that are not set already. | |
2233 (let ((i 256)) | |
2234 (while (>= (setq i (1- i)) 127) | |
2235 ;; Only modify if the entry is nil. | |
2236 (unless (aref table i) | |
2237 (aset table i [??])))) | |
2238 (setq buffer-display-table table))) | |
2239 | |
2240 (defun gnus-summary-setup-buffer (group) | |
2241 "Initialize summary buffer." | |
2242 (let ((buffer (concat "*Summary " group "*"))) | |
2243 (if (get-buffer buffer) | |
2244 (progn | |
2245 (set-buffer buffer) | |
2246 (setq gnus-summary-buffer (current-buffer)) | |
2247 (not gnus-newsgroup-prepared)) | |
2248 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu> | |
2249 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer))) | |
2250 (gnus-add-current-to-buffer-list) | |
2251 (gnus-summary-mode group) | |
2252 (when gnus-carpal | |
2253 (gnus-carpal-setup-buffer 'summary)) | |
2254 (unless gnus-single-article-buffer | |
2255 (make-local-variable 'gnus-article-buffer) | |
2256 (make-local-variable 'gnus-article-current) | |
2257 (make-local-variable 'gnus-original-article-buffer)) | |
2258 (setq gnus-newsgroup-name group) | |
2259 t))) | |
2260 | |
2261 (defun gnus-set-global-variables () | |
2262 ;; Set the global equivalents of the summary buffer-local variables | |
2263 ;; to the latest values they had. These reflect the summary buffer | |
2264 ;; that was in action when the last article was fetched. | |
2265 (when (eq major-mode 'gnus-summary-mode) | |
2266 (setq gnus-summary-buffer (current-buffer)) | |
2267 (let ((name gnus-newsgroup-name) | |
2268 (marked gnus-newsgroup-marked) | |
2269 (unread gnus-newsgroup-unreads) | |
2270 (headers gnus-current-headers) | |
2271 (data gnus-newsgroup-data) | |
2272 (summary gnus-summary-buffer) | |
2273 (article-buffer gnus-article-buffer) | |
2274 (original gnus-original-article-buffer) | |
2275 (gac gnus-article-current) | |
2276 (reffed gnus-reffed-article-number) | |
2277 (score-file gnus-current-score-file)) | |
2278 (save-excursion | |
2279 (set-buffer gnus-group-buffer) | |
2280 (setq gnus-newsgroup-name name) | |
2281 (setq gnus-newsgroup-marked marked) | |
2282 (setq gnus-newsgroup-unreads unread) | |
2283 (setq gnus-current-headers headers) | |
2284 (setq gnus-newsgroup-data data) | |
2285 (setq gnus-article-current gac) | |
2286 (setq gnus-summary-buffer summary) | |
2287 (setq gnus-article-buffer article-buffer) | |
2288 (setq gnus-original-article-buffer original) | |
2289 (setq gnus-reffed-article-number reffed) | |
2290 (setq gnus-current-score-file score-file) | |
2291 ;; The article buffer also has local variables. | |
2292 (when (gnus-buffer-live-p gnus-article-buffer) | |
2293 (set-buffer gnus-article-buffer) | |
2294 (setq gnus-summary-buffer summary)))))) | |
2295 | |
2296 (defun gnus-summary-article-unread-p (article) | |
2297 "Say whether ARTICLE is unread or not." | |
2298 (memq article gnus-newsgroup-unreads)) | |
2299 | |
2300 (defun gnus-summary-first-article-p (&optional article) | |
2301 "Return whether ARTICLE is the first article in the buffer." | |
2302 (if (not (setq article (or article (gnus-summary-article-number)))) | |
2303 nil | |
2304 (eq article (caar gnus-newsgroup-data)))) | |
2305 | |
2306 (defun gnus-summary-last-article-p (&optional article) | |
2307 "Return whether ARTICLE is the last article in the buffer." | |
2308 (if (not (setq article (or article (gnus-summary-article-number)))) | |
2309 t ; All non-existent numbers are the last article. :-) | |
2310 (not (cdr (gnus-data-find-list article))))) | |
2311 | |
2312 (defun gnus-make-thread-indent-array () | |
2313 (let ((n 200)) | |
2314 (unless (and gnus-thread-indent-array | |
2315 (= gnus-thread-indent-level gnus-thread-indent-array-level)) | |
2316 (setq gnus-thread-indent-array (make-vector 201 "") | |
2317 gnus-thread-indent-array-level gnus-thread-indent-level) | |
2318 (while (>= n 0) | |
2319 (aset gnus-thread-indent-array n | |
2320 (make-string (* n gnus-thread-indent-level) ? )) | |
2321 (setq n (1- n)))))) | |
2322 | |
2323 (defun gnus-update-summary-mark-positions () | |
2324 "Compute where the summary marks are to go." | |
2325 (save-excursion | |
2326 (when (and gnus-summary-buffer | |
2327 (get-buffer gnus-summary-buffer) | |
2328 (buffer-name (get-buffer gnus-summary-buffer))) | |
2329 (set-buffer gnus-summary-buffer)) | |
2330 (let ((gnus-replied-mark 129) | |
2331 (gnus-score-below-mark 130) | |
2332 (gnus-score-over-mark 130) | |
2333 (spec gnus-summary-line-format-spec) | |
2334 thread gnus-visual pos) | |
2335 (save-excursion | |
2336 (gnus-set-work-buffer) | |
2337 (let ((gnus-summary-line-format-spec spec)) | |
2338 (gnus-summary-insert-line | |
2339 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1) | |
2340 (goto-char (point-min)) | |
2341 (setq pos (list (cons 'unread (and (search-forward "\200" nil t) | |
2342 (- (point) 2))))) | |
2343 (goto-char (point-min)) | |
2344 (push (cons 'replied (and (search-forward "\201" nil t) | |
2345 (- (point) 2))) | |
2346 pos) | |
2347 (goto-char (point-min)) | |
2348 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2))) | |
2349 pos))) | |
2350 (setq gnus-summary-mark-positions pos)))) | |
2351 | |
2352 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number) | |
2353 "Insert a dummy root in the summary buffer." | |
2354 (beginning-of-line) | |
2355 (gnus-add-text-properties | |
2356 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point)) | |
2357 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number))) | |
2358 | |
2359 (defun gnus-summary-insert-line (gnus-tmp-header | |
2360 gnus-tmp-level gnus-tmp-current | |
2361 gnus-tmp-unread gnus-tmp-replied | |
2362 gnus-tmp-expirable gnus-tmp-subject-or-nil | |
2363 &optional gnus-tmp-dummy gnus-tmp-score | |
2364 gnus-tmp-process) | |
2365 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level)) | |
2366 (gnus-tmp-lines (mail-header-lines gnus-tmp-header)) | |
2367 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0)) | |
2368 (gnus-tmp-score-char | |
2369 (if (or (null gnus-summary-default-score) | |
2370 (<= (abs (- gnus-tmp-score gnus-summary-default-score)) | |
2371 gnus-summary-zcore-fuzz)) | |
2372 ? | |
2373 (if (< gnus-tmp-score gnus-summary-default-score) | |
2374 gnus-score-below-mark gnus-score-over-mark))) | |
2375 (gnus-tmp-replied | |
2376 (cond (gnus-tmp-process gnus-process-mark) | |
2377 ((memq gnus-tmp-current gnus-newsgroup-cached) | |
2378 gnus-cached-mark) | |
2379 (gnus-tmp-replied gnus-replied-mark) | |
2380 ((memq gnus-tmp-current gnus-newsgroup-saved) | |
2381 gnus-saved-mark) | |
2382 (t gnus-unread-mark))) | |
2383 (gnus-tmp-from (mail-header-from gnus-tmp-header)) | |
2384 (gnus-tmp-name | |
2385 (cond | |
2386 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
2387 (let ((beg (match-beginning 0))) | |
2388 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
2389 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
2390 (1- (match-end 0)))) | |
2391 (substring gnus-tmp-from 0 beg)))) | |
2392 ((string-match "(.+)" gnus-tmp-from) | |
2393 (substring gnus-tmp-from | |
2394 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
2395 (t gnus-tmp-from))) | |
2396 (gnus-tmp-subject (mail-header-subject gnus-tmp-header)) | |
2397 (gnus-tmp-number (mail-header-number gnus-tmp-header)) | |
2398 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[)) | |
2399 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\])) | |
2400 (buffer-read-only nil)) | |
2401 (when (string= gnus-tmp-name "") | |
2402 (setq gnus-tmp-name gnus-tmp-from)) | |
2403 (unless (numberp gnus-tmp-lines) | |
2404 (setq gnus-tmp-lines 0)) | |
2405 (gnus-put-text-property | |
2406 (point) | |
2407 (progn (eval gnus-summary-line-format-spec) (point)) | |
2408 'gnus-number gnus-tmp-number) | |
2409 (when (gnus-visual-p 'summary-highlight 'highlight) | |
2410 (forward-line -1) | |
2411 (run-hooks 'gnus-summary-update-hook) | |
2412 (forward-line 1)))) | |
2413 | |
2414 (defun gnus-summary-update-line (&optional dont-update) | |
2415 ;; Update summary line after change. | |
2416 (when (and gnus-summary-default-score | |
2417 (not gnus-summary-inhibit-highlight)) | |
2418 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion. | |
2419 (article (gnus-summary-article-number)) | |
2420 (score (gnus-summary-article-score article))) | |
2421 (unless dont-update | |
2422 (if (and gnus-summary-mark-below | |
2423 (< (gnus-summary-article-score) | |
2424 gnus-summary-mark-below)) | |
2425 ;; This article has a low score, so we mark it as read. | |
2426 (when (memq article gnus-newsgroup-unreads) | |
2427 (gnus-summary-mark-article-as-read gnus-low-score-mark)) | |
2428 (when (eq (gnus-summary-article-mark) gnus-low-score-mark) | |
2429 ;; This article was previously marked as read on account | |
2430 ;; of a low score, but now it has risen, so we mark it as | |
2431 ;; unread. | |
2432 (gnus-summary-mark-article-as-unread gnus-unread-mark))) | |
2433 (gnus-summary-update-mark | |
2434 (if (or (null gnus-summary-default-score) | |
2435 (<= (abs (- score gnus-summary-default-score)) | |
2436 gnus-summary-zcore-fuzz)) | |
2437 ? | |
2438 (if (< score gnus-summary-default-score) | |
2439 gnus-score-below-mark gnus-score-over-mark)) | |
2440 'score)) | |
2441 ;; Do visual highlighting. | |
2442 (when (gnus-visual-p 'summary-highlight 'highlight) | |
2443 (run-hooks 'gnus-summary-update-hook))))) | |
2444 | |
2445 (defvar gnus-tmp-new-adopts nil) | |
2446 | |
2447 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char) | |
2448 "Return the number of articles in THREAD. | |
2449 This may be 0 in some cases -- if none of the articles in | |
2450 the thread are to be displayed." | |
2451 (let* ((number | |
2452 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>. | |
2453 (cond | |
2454 ((not (listp thread)) | |
2455 1) | |
2456 ((and (consp thread) (cdr thread)) | |
2457 (apply | |
2458 '+ 1 (mapcar | |
2459 'gnus-summary-number-of-articles-in-thread (cdr thread)))) | |
2460 ((null thread) | |
2461 1) | |
2462 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit) | |
2463 1) | |
2464 (t 0)))) | |
2465 (when (and level (zerop level) gnus-tmp-new-adopts) | |
2466 (incf number | |
2467 (apply '+ (mapcar | |
2468 'gnus-summary-number-of-articles-in-thread | |
2469 gnus-tmp-new-adopts)))) | |
2470 (if char | |
2471 (if (> number 1) gnus-not-empty-thread-mark | |
2472 gnus-empty-thread-mark) | |
2473 number))) | |
2474 | |
2475 (defun gnus-summary-set-local-parameters (group) | |
2476 "Go through the local params of GROUP and set all variable specs in that list." | |
2477 (let ((params (gnus-group-find-parameter group)) | |
2478 elem) | |
2479 (while params | |
2480 (setq elem (car params) | |
2481 params (cdr params)) | |
2482 (and (consp elem) ; Has to be a cons. | |
2483 (consp (cdr elem)) ; The cdr has to be a list. | |
2484 (symbolp (car elem)) ; Has to be a symbol in there. | |
2485 (not (memq (car elem) | |
2486 '(quit-config to-address to-list to-group))) | |
2487 (ignore-errors ; So we set it. | |
2488 (make-local-variable (car elem)) | |
2489 (set (car elem) (eval (nth 1 elem)))))))) | |
2490 | |
2491 (defun gnus-summary-read-group (group &optional show-all no-article | |
2492 kill-buffer no-display) | |
2493 "Start reading news in newsgroup GROUP. | |
2494 If SHOW-ALL is non-nil, already read articles are also listed. | |
2495 If NO-ARTICLE is non-nil, no article is selected initially. | |
2496 If NO-DISPLAY, don't generate a summary buffer." | |
2497 (let (result) | |
2498 (while (and group | |
2499 (null (setq result | |
2500 (let ((gnus-auto-select-next nil)) | |
2501 (gnus-summary-read-group-1 | |
2502 group show-all no-article | |
2503 kill-buffer no-display)))) | |
2504 (eq gnus-auto-select-next 'quietly)) | |
2505 (set-buffer gnus-group-buffer) | |
2506 (if (not (equal group (gnus-group-group-name))) | |
2507 (setq group (gnus-group-group-name)) | |
2508 (setq group nil))) | |
2509 result)) | |
2510 | |
2511 (defun gnus-summary-read-group-1 (group show-all no-article | |
2512 kill-buffer no-display) | |
2513 ;; Killed foreign groups can't be entered. | |
2514 (when (and (not (gnus-group-native-p group)) | |
2515 (not (gnus-gethash group gnus-newsrc-hashtb))) | |
2516 (error "Dead non-native groups can't be entered")) | |
2517 (gnus-message 5 "Retrieving newsgroup: %s..." group) | |
2518 (let* ((new-group (gnus-summary-setup-buffer group)) | |
2519 (quit-config (gnus-group-quit-config group)) | |
2520 (did-select (and new-group (gnus-select-newsgroup group show-all)))) | |
2521 (cond | |
2522 ;; This summary buffer exists already, so we just select it. | |
2523 ((not new-group) | |
2524 (gnus-set-global-variables) | |
2525 (when kill-buffer | |
2526 (gnus-kill-or-deaden-summary kill-buffer)) | |
2527 (gnus-configure-windows 'summary 'force) | |
2528 (gnus-set-mode-line 'summary) | |
2529 (gnus-summary-position-point) | |
2530 (message "") | |
2531 t) | |
2532 ;; We couldn't select this group. | |
2533 ((null did-select) | |
2534 (when (and (eq major-mode 'gnus-summary-mode) | |
2535 (not (equal (current-buffer) kill-buffer))) | |
2536 (kill-buffer (current-buffer)) | |
2537 (if (not quit-config) | |
2538 (progn | |
2539 (set-buffer gnus-group-buffer) | |
2540 (gnus-group-jump-to-group group) | |
2541 (gnus-group-next-unread-group 1)) | |
2542 (gnus-handle-ephemeral-exit quit-config))) | |
2543 (gnus-message 3 "Can't select group") | |
2544 nil) | |
2545 ;; The user did a `C-g' while prompting for number of articles, | |
2546 ;; so we exit this group. | |
2547 ((eq did-select 'quit) | |
2548 (and (eq major-mode 'gnus-summary-mode) | |
2549 (not (equal (current-buffer) kill-buffer)) | |
2550 (kill-buffer (current-buffer))) | |
2551 (when kill-buffer | |
2552 (gnus-kill-or-deaden-summary kill-buffer)) | |
2553 (if (not quit-config) | |
2554 (progn | |
2555 (set-buffer gnus-group-buffer) | |
2556 (gnus-group-jump-to-group group) | |
2557 (gnus-group-next-unread-group 1) | |
2558 (gnus-configure-windows 'group 'force)) | |
2559 (gnus-handle-ephemeral-exit quit-config)) | |
2560 ;; Finally signal the quit. | |
2561 (signal 'quit nil)) | |
2562 ;; The group was successfully selected. | |
2563 (t | |
2564 (gnus-set-global-variables) | |
2565 ;; Save the active value in effect when the group was entered. | |
2566 (setq gnus-newsgroup-active | |
2567 (gnus-copy-sequence | |
2568 (gnus-active gnus-newsgroup-name))) | |
2569 ;; You can change the summary buffer in some way with this hook. | |
2570 (run-hooks 'gnus-select-group-hook) | |
2571 ;; Set any local variables in the group parameters. | |
2572 (gnus-summary-set-local-parameters gnus-newsgroup-name) | |
2573 (gnus-update-format-specifications | |
2574 nil 'summary 'summary-mode 'summary-dummy) | |
2575 ;; Do score processing. | |
2576 (when gnus-use-scoring | |
2577 (gnus-possibly-score-headers)) | |
2578 ;; Check whether to fill in the gaps in the threads. | |
2579 (when gnus-build-sparse-threads | |
2580 (gnus-build-sparse-threads)) | |
2581 ;; Find the initial limit. | |
2582 (if gnus-show-threads | |
2583 (if show-all | |
2584 (let ((gnus-newsgroup-dormant nil)) | |
2585 (gnus-summary-initial-limit show-all)) | |
2586 (gnus-summary-initial-limit show-all)) | |
2587 (setq gnus-newsgroup-limit | |
2588 (mapcar | |
2589 (lambda (header) (mail-header-number header)) | |
2590 gnus-newsgroup-headers))) | |
2591 ;; Generate the summary buffer. | |
2592 (unless no-display | |
2593 (gnus-summary-prepare)) | |
2594 (when gnus-use-trees | |
2595 (gnus-tree-open group) | |
2596 (setq gnus-summary-highlight-line-function | |
2597 'gnus-tree-highlight-article)) | |
2598 ;; If the summary buffer is empty, but there are some low-scored | |
2599 ;; articles or some excluded dormants, we include these in the | |
2600 ;; buffer. | |
2601 (when (and (zerop (buffer-size)) | |
2602 (not no-display)) | |
2603 (cond (gnus-newsgroup-dormant | |
2604 (gnus-summary-limit-include-dormant)) | |
2605 ((and gnus-newsgroup-scored show-all) | |
2606 (gnus-summary-limit-include-expunged t)))) | |
2607 ;; Function `gnus-apply-kill-file' must be called in this hook. | |
2608 (run-hooks 'gnus-apply-kill-hook) | |
2609 (if (and (zerop (buffer-size)) | |
2610 (not no-display)) | |
2611 (progn | |
2612 ;; This newsgroup is empty. | |
2613 (gnus-summary-catchup-and-exit nil t) | |
2614 (gnus-message 6 "No unread news") | |
2615 (when kill-buffer | |
2616 (gnus-kill-or-deaden-summary kill-buffer)) | |
2617 ;; Return nil from this function. | |
2618 nil) | |
2619 ;; Hide conversation thread subtrees. We cannot do this in | |
2620 ;; gnus-summary-prepare-hook since kill processing may not | |
2621 ;; work with hidden articles. | |
2622 (and gnus-show-threads | |
2623 gnus-thread-hide-subtree | |
2624 (gnus-summary-hide-all-threads)) | |
2625 ;; Show first unread article if requested. | |
2626 (if (and (not no-article) | |
2627 (not no-display) | |
2628 gnus-newsgroup-unreads | |
2629 gnus-auto-select-first) | |
2630 (unless (if (eq gnus-auto-select-first 'best) | |
2631 (gnus-summary-best-unread-article) | |
2632 (gnus-summary-first-unread-article)) | |
2633 (gnus-configure-windows 'summary)) | |
2634 ;; Don't select any articles, just move point to the first | |
2635 ;; article in the group. | |
2636 (goto-char (point-min)) | |
2637 (gnus-summary-position-point) | |
2638 (gnus-set-mode-line 'summary) | |
2639 (gnus-configure-windows 'summary 'force)) | |
2640 (when kill-buffer | |
2641 (gnus-kill-or-deaden-summary kill-buffer)) | |
2642 (when (get-buffer-window gnus-group-buffer t) | |
2643 ;; Gotta use windows, because recenter does weird stuff if | |
2644 ;; the current buffer ain't the displayed window. | |
2645 (let ((owin (selected-window))) | |
2646 (select-window (get-buffer-window gnus-group-buffer t)) | |
2647 (when (gnus-group-goto-group group) | |
2648 (recenter)) | |
2649 (select-window owin))) | |
2650 ;; Mark this buffer as "prepared". | |
2651 (setq gnus-newsgroup-prepared t) | |
2652 t))))) | |
2653 | |
2654 (defun gnus-summary-prepare () | |
2655 "Generate the summary buffer." | |
2656 (interactive) | |
2657 (let ((buffer-read-only nil)) | |
2658 (erase-buffer) | |
2659 (setq gnus-newsgroup-data nil | |
2660 gnus-newsgroup-data-reverse nil) | |
2661 (run-hooks 'gnus-summary-generate-hook) | |
2662 ;; Generate the buffer, either with threads or without. | |
2663 (when gnus-newsgroup-headers | |
2664 (gnus-summary-prepare-threads | |
2665 (if gnus-show-threads | |
2666 (gnus-sort-gathered-threads | |
2667 (funcall gnus-summary-thread-gathering-function | |
2668 (gnus-sort-threads | |
2669 (gnus-cut-threads (gnus-make-threads))))) | |
2670 ;; Unthreaded display. | |
2671 (gnus-sort-articles gnus-newsgroup-headers)))) | |
2672 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data)) | |
2673 ;; Call hooks for modifying summary buffer. | |
2674 (goto-char (point-min)) | |
2675 (run-hooks 'gnus-summary-prepare-hook))) | |
2676 | |
2677 (defsubst gnus-general-simplify-subject (subject) | |
2678 "Simply subject by the same rules as gnus-gather-threads-by-subject." | |
2679 (setq subject | |
2680 (cond | |
2681 ;; Truncate the subject. | |
2682 ((numberp gnus-summary-gather-subject-limit) | |
2683 (setq subject (gnus-simplify-subject-re subject)) | |
2684 (if (> (length subject) gnus-summary-gather-subject-limit) | |
2685 (substring subject 0 gnus-summary-gather-subject-limit) | |
2686 subject)) | |
2687 ;; Fuzzily simplify it. | |
2688 ((eq 'fuzzy gnus-summary-gather-subject-limit) | |
2689 (gnus-simplify-subject-fuzzy subject)) | |
2690 ;; Just remove the leading "Re:". | |
2691 (t | |
2692 (gnus-simplify-subject-re subject)))) | |
2693 | |
2694 (if (and gnus-summary-gather-exclude-subject | |
2695 (string-match gnus-summary-gather-exclude-subject subject)) | |
2696 nil ; This article shouldn't be gathered | |
2697 subject)) | |
2698 | |
2699 (defun gnus-summary-simplify-subject-query () | |
2700 "Query where the respool algorithm would put this article." | |
2701 (interactive) | |
2702 (gnus-set-global-variables) | |
2703 (gnus-summary-select-article) | |
2704 (message (gnus-general-simplify-subject (gnus-summary-article-subject)))) | |
2705 | |
2706 (defun gnus-gather-threads-by-subject (threads) | |
2707 "Gather threads by looking at Subject headers." | |
2708 (if (not gnus-summary-make-false-root) | |
2709 threads | |
2710 (let ((hashtb (gnus-make-hashtable 1024)) | |
2711 (prev threads) | |
2712 (result threads) | |
2713 subject hthread whole-subject) | |
2714 (while threads | |
2715 (setq subject (gnus-general-simplify-subject | |
2716 (setq whole-subject (mail-header-subject | |
2717 (caar threads))))) | |
2718 (when subject | |
2719 (if (setq hthread (gnus-gethash subject hashtb)) | |
2720 (progn | |
2721 ;; We enter a dummy root into the thread, if we | |
2722 ;; haven't done that already. | |
2723 (unless (stringp (caar hthread)) | |
2724 (setcar hthread (list whole-subject (car hthread)))) | |
2725 ;; We add this new gathered thread to this gathered | |
2726 ;; thread. | |
2727 (setcdr (car hthread) | |
2728 (nconc (cdar hthread) (list (car threads)))) | |
2729 ;; Remove it from the list of threads. | |
2730 (setcdr prev (cdr threads)) | |
2731 (setq threads prev)) | |
2732 ;; Enter this thread into the hash table. | |
2733 (gnus-sethash subject threads hashtb))) | |
2734 (setq prev threads) | |
2735 (setq threads (cdr threads))) | |
2736 result))) | |
2737 | |
2738 (defun gnus-gather-threads-by-references (threads) | |
2739 "Gather threads by looking at References headers." | |
2740 (let ((idhashtb (gnus-make-hashtable 1024)) | |
2741 (thhashtb (gnus-make-hashtable 1024)) | |
2742 (prev threads) | |
2743 (result threads) | |
2744 ids references id gthread gid entered ref) | |
2745 (while threads | |
2746 (when (setq references (mail-header-references (caar threads))) | |
2747 (setq id (mail-header-id (caar threads)) | |
2748 ids (gnus-split-references references) | |
2749 entered nil) | |
2750 (while (setq ref (pop ids)) | |
2751 (setq ids (delete ref ids)) | |
2752 (if (not (setq gid (gnus-gethash ref idhashtb))) | |
2753 (progn | |
2754 (gnus-sethash ref id idhashtb) | |
2755 (gnus-sethash id threads thhashtb)) | |
2756 (setq gthread (gnus-gethash gid thhashtb)) | |
2757 (unless entered | |
2758 ;; We enter a dummy root into the thread, if we | |
2759 ;; haven't done that already. | |
2760 (unless (stringp (caar gthread)) | |
2761 (setcar gthread (list (mail-header-subject (caar gthread)) | |
2762 (car gthread)))) | |
2763 ;; We add this new gathered thread to this gathered | |
2764 ;; thread. | |
2765 (setcdr (car gthread) | |
2766 (nconc (cdar gthread) (list (car threads))))) | |
2767 ;; Add it into the thread hash table. | |
2768 (gnus-sethash id gthread thhashtb) | |
2769 (setq entered t) | |
2770 ;; Remove it from the list of threads. | |
2771 (setcdr prev (cdr threads)) | |
2772 (setq threads prev)))) | |
2773 (setq prev threads) | |
2774 (setq threads (cdr threads))) | |
2775 result)) | |
2776 | |
2777 (defun gnus-sort-gathered-threads (threads) | |
2778 "Sort subtreads inside each gathered thread by article number." | |
2779 (let ((result threads)) | |
2780 (while threads | |
2781 (when (stringp (caar threads)) | |
2782 (setcdr (car threads) | |
2783 (sort (cdar threads) 'gnus-thread-sort-by-number))) | |
2784 (setq threads (cdr threads))) | |
2785 result)) | |
2786 | |
2787 (defun gnus-thread-loop-p (root thread) | |
2788 "Say whether ROOT is in THREAD." | |
2789 (let ((stack (list thread)) | |
2790 (infloop 0) | |
2791 th) | |
2792 (while (setq thread (pop stack)) | |
2793 (setq th (cdr thread)) | |
2794 (while (and th | |
2795 (not (eq (caar th) root))) | |
2796 (pop th)) | |
2797 (if th | |
2798 ;; We have found a loop. | |
2799 (let (ref-dep) | |
2800 (setcdr thread (delq (car th) (cdr thread))) | |
2801 (if (boundp (setq ref-dep (intern "none" | |
2802 gnus-newsgroup-dependencies))) | |
2803 (setcdr (symbol-value ref-dep) | |
2804 (nconc (cdr (symbol-value ref-dep)) | |
2805 (list (car th)))) | |
2806 (set ref-dep (list nil (car th)))) | |
2807 (setq infloop 1 | |
2808 stack nil)) | |
2809 ;; Push all the subthreads onto the stack. | |
2810 (push (cdr thread) stack))) | |
2811 infloop)) | |
2812 | |
2813 (defun gnus-make-threads () | |
2814 "Go through the dependency hashtb and find the roots. Return all threads." | |
2815 (let (threads) | |
2816 (while (catch 'infloop | |
2817 (mapatoms | |
2818 (lambda (refs) | |
2819 ;; Deal with self-referencing References loops. | |
2820 (when (and (car (symbol-value refs)) | |
2821 (not (zerop | |
2822 (apply | |
2823 '+ | |
2824 (mapcar | |
2825 (lambda (thread) | |
2826 (gnus-thread-loop-p | |
2827 (car (symbol-value refs)) thread)) | |
2828 (cdr (symbol-value refs))))))) | |
2829 (setq threads nil) | |
2830 (throw 'infloop t)) | |
2831 (unless (car (symbol-value refs)) | |
2832 ;; These threads do not refer back to any other articles, | |
2833 ;; so they're roots. | |
2834 (setq threads (append (cdr (symbol-value refs)) threads)))) | |
2835 gnus-newsgroup-dependencies))) | |
2836 threads)) | |
2837 | |
2838 (defun gnus-build-sparse-threads () | |
2839 (let ((headers gnus-newsgroup-headers) | |
2840 (deps gnus-newsgroup-dependencies) | |
2841 header references generation relations | |
2842 cthread subject child end pthread relation) | |
2843 ;; First we create an alist of generations/relations, where | |
2844 ;; generations is how much we trust the relation, and the relation | |
2845 ;; is parent/child. | |
2846 (gnus-message 7 "Making sparse threads...") | |
2847 (save-excursion | |
2848 (nnheader-set-temp-buffer " *gnus sparse threads*") | |
2849 (while (setq header (pop headers)) | |
2850 (when (and (setq references (mail-header-references header)) | |
2851 (not (string= references ""))) | |
2852 (insert references) | |
2853 (setq child (mail-header-id header) | |
2854 subject (mail-header-subject header)) | |
2855 (setq generation 0) | |
2856 (while (search-backward ">" nil t) | |
2857 (setq end (1+ (point))) | |
2858 (when (search-backward "<" nil t) | |
2859 (push (list (incf generation) | |
2860 child (setq child (buffer-substring (point) end)) | |
2861 subject) | |
2862 relations))) | |
2863 (push (list (1+ generation) child nil subject) relations) | |
2864 (erase-buffer))) | |
2865 (kill-buffer (current-buffer))) | |
2866 ;; Sort over trustworthiness. | |
2867 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2))))) | |
2868 (while (setq relation (pop relations)) | |
2869 (when (if (boundp (setq cthread (intern (cadr relation) deps))) | |
2870 (unless (car (symbol-value cthread)) | |
2871 ;; Make this article the parent of these threads. | |
2872 (setcar (symbol-value cthread) | |
2873 (vector gnus-reffed-article-number | |
2874 (cadddr relation) | |
2875 "" "" | |
2876 (cadr relation) | |
2877 (or (caddr relation) "") 0 0 ""))) | |
2878 (set cthread (list (vector gnus-reffed-article-number | |
2879 (cadddr relation) | |
2880 "" "" (cadr relation) | |
2881 (or (caddr relation) "") 0 0 "")))) | |
2882 (push gnus-reffed-article-number gnus-newsgroup-limit) | |
2883 (push gnus-reffed-article-number gnus-newsgroup-sparse) | |
2884 (push (cons gnus-reffed-article-number gnus-sparse-mark) | |
2885 gnus-newsgroup-reads) | |
2886 (decf gnus-reffed-article-number) | |
2887 ;; Make this new thread the child of its parent. | |
2888 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps))) | |
2889 (setcdr (symbol-value pthread) | |
2890 (nconc (cdr (symbol-value pthread)) | |
2891 (list (symbol-value cthread)))) | |
2892 (set pthread (list nil (symbol-value cthread)))))) | |
2893 (gnus-message 7 "Making sparse threads...done"))) | |
2894 | |
2895 (defun gnus-build-old-threads () | |
2896 ;; Look at all the articles that refer back to old articles, and | |
2897 ;; fetch the headers for the articles that aren't there. This will | |
2898 ;; build complete threads - if the roots haven't been expired by the | |
2899 ;; server, that is. | |
2900 (let (id heads) | |
2901 (mapatoms | |
2902 (lambda (refs) | |
2903 (when (not (car (symbol-value refs))) | |
2904 (setq heads (cdr (symbol-value refs))) | |
2905 (while heads | |
2906 (if (memq (mail-header-number (caar heads)) | |
2907 gnus-newsgroup-dormant) | |
2908 (setq heads (cdr heads)) | |
2909 (setq id (symbol-name refs)) | |
2910 (while (and (setq id (gnus-build-get-header id)) | |
2911 (not (car (gnus-gethash | |
2912 id gnus-newsgroup-dependencies))))) | |
2913 (setq heads nil))))) | |
2914 gnus-newsgroup-dependencies))) | |
2915 | |
2916 (defun gnus-build-get-header (id) | |
2917 ;; Look through the buffer of NOV lines and find the header to | |
2918 ;; ID. Enter this line into the dependencies hash table, and return | |
2919 ;; the id of the parent article (if any). | |
2920 (let ((deps gnus-newsgroup-dependencies) | |
2921 found header) | |
2922 (prog1 | |
2923 (save-excursion | |
2924 (set-buffer nntp-server-buffer) | |
2925 (let ((case-fold-search nil)) | |
2926 (goto-char (point-min)) | |
2927 (while (and (not found) | |
2928 (search-forward id nil t)) | |
2929 (beginning-of-line) | |
2930 (setq found (looking-at | |
2931 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s" | |
2932 (regexp-quote id)))) | |
2933 (or found (beginning-of-line 2))) | |
2934 (when found | |
2935 (beginning-of-line) | |
2936 (and | |
2937 (setq header (gnus-nov-parse-line | |
2938 (read (current-buffer)) deps)) | |
2939 (gnus-parent-id (mail-header-references header)))))) | |
2940 (when header | |
2941 (let ((number (mail-header-number header))) | |
2942 (push number gnus-newsgroup-limit) | |
2943 (push header gnus-newsgroup-headers) | |
2944 (if (memq number gnus-newsgroup-unselected) | |
2945 (progn | |
2946 (push number gnus-newsgroup-unreads) | |
2947 (setq gnus-newsgroup-unselected | |
2948 (delq number gnus-newsgroup-unselected))) | |
2949 (push number gnus-newsgroup-ancient))))))) | |
2950 | |
2951 (defun gnus-summary-update-article-line (article header) | |
2952 "Update the line for ARTICLE using HEADERS." | |
2953 (let* ((id (mail-header-id header)) | |
2954 (thread (gnus-id-to-thread id))) | |
2955 (unless thread | |
2956 (error "Article in no thread")) | |
2957 ;; Update the thread. | |
2958 (setcar thread header) | |
2959 (gnus-summary-goto-subject article) | |
2960 (let* ((datal (gnus-data-find-list article)) | |
2961 (data (car datal)) | |
2962 (length (when (cdr datal) | |
2963 (- (gnus-data-pos data) | |
2964 (gnus-data-pos (cadr datal))))) | |
2965 (buffer-read-only nil) | |
2966 (level (gnus-summary-thread-level))) | |
2967 (gnus-delete-line) | |
2968 (gnus-summary-insert-line | |
2969 header level nil (gnus-article-mark article) | |
2970 (memq article gnus-newsgroup-replied) | |
2971 (memq article gnus-newsgroup-expirable) | |
2972 ;; Only insert the Subject string when it's different | |
2973 ;; from the previous Subject string. | |
2974 (if (gnus-subject-equal | |
2975 (condition-case () | |
2976 (mail-header-subject | |
2977 (gnus-data-header | |
2978 (cadr | |
2979 (gnus-data-find-list | |
2980 article | |
2981 (gnus-data-list t))))) | |
2982 ;; Error on the side of excessive subjects. | |
2983 (error "")) | |
2984 (mail-header-subject header)) | |
2985 "" | |
2986 (mail-header-subject header)) | |
2987 nil (cdr (assq article gnus-newsgroup-scored)) | |
2988 (memq article gnus-newsgroup-processable)) | |
2989 (when length | |
2990 (gnus-data-update-list | |
2991 (cdr datal) (- length (- (gnus-data-pos data) (point)))))))) | |
2992 | |
2993 (defun gnus-summary-update-article (article &optional iheader) | |
2994 "Update ARTICLE in the summary buffer." | |
2995 (set-buffer gnus-summary-buffer) | |
2996 (let* ((header (or iheader (gnus-summary-article-header article))) | |
2997 (id (mail-header-id header)) | |
2998 (data (gnus-data-find article)) | |
2999 (thread (gnus-id-to-thread id)) | |
3000 (references (mail-header-references header)) | |
3001 (parent | |
3002 (gnus-id-to-thread | |
3003 (or (gnus-parent-id | |
3004 (when (and references | |
3005 (not (equal "" references))) | |
3006 references)) | |
3007 "none"))) | |
3008 (buffer-read-only nil) | |
3009 (old (car thread)) | |
3010 (number (mail-header-number header)) | |
3011 pos) | |
3012 (when thread | |
3013 ;; !!! Should this be in or not? | |
3014 (unless iheader | |
3015 (setcar thread nil)) | |
3016 (when parent | |
3017 (delq thread parent)) | |
3018 (if (gnus-summary-insert-subject id header iheader) | |
3019 ;; Set the (possibly) new article number in the data structure. | |
3020 (gnus-data-set-number data (gnus-id-to-article id)) | |
3021 (setcar thread old) | |
3022 nil)))) | |
3023 | |
3024 (defun gnus-rebuild-thread (id) | |
3025 "Rebuild the thread containing ID." | |
3026 (let ((buffer-read-only nil) | |
3027 old-pos current thread data) | |
3028 (if (not gnus-show-threads) | |
3029 (setq thread (list (car (gnus-id-to-thread id)))) | |
3030 ;; Get the thread this article is part of. | |
3031 (setq thread (gnus-remove-thread id))) | |
3032 (setq old-pos (gnus-point-at-bol)) | |
3033 (setq current (save-excursion | |
3034 (and (zerop (forward-line -1)) | |
3035 (gnus-summary-article-number)))) | |
3036 ;; If this is a gathered thread, we have to go some re-gathering. | |
3037 (when (stringp (car thread)) | |
3038 (let ((subject (car thread)) | |
3039 roots thr) | |
3040 (setq thread (cdr thread)) | |
3041 (while thread | |
3042 (unless (memq (setq thr (gnus-id-to-thread | |
3043 (gnus-root-id | |
3044 (mail-header-id (caar thread))))) | |
3045 roots) | |
3046 (push thr roots)) | |
3047 (setq thread (cdr thread))) | |
3048 ;; We now have all (unique) roots. | |
3049 (if (= (length roots) 1) | |
3050 ;; All the loose roots are now one solid root. | |
3051 (setq thread (car roots)) | |
3052 (setq thread (cons subject (gnus-sort-threads roots)))))) | |
3053 (let (threads) | |
3054 ;; We then insert this thread into the summary buffer. | |
3055 (let (gnus-newsgroup-data gnus-newsgroup-threads) | |
3056 (if gnus-show-threads | |
3057 (gnus-summary-prepare-threads (gnus-cut-threads (list thread))) | |
3058 (gnus-summary-prepare-unthreaded thread)) | |
3059 (setq data (nreverse gnus-newsgroup-data)) | |
3060 (setq threads gnus-newsgroup-threads)) | |
3061 ;; We splice the new data into the data structure. | |
3062 (gnus-data-enter-list current data (- (point) old-pos)) | |
3063 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads))))) | |
3064 | |
3065 (defun gnus-number-to-header (number) | |
3066 "Return the header for article NUMBER." | |
3067 (let ((headers gnus-newsgroup-headers)) | |
3068 (while (and headers | |
3069 (not (= number (mail-header-number (car headers))))) | |
3070 (pop headers)) | |
3071 (when headers | |
3072 (car headers)))) | |
3073 | |
3074 (defun gnus-parent-headers (headers &optional generation) | |
3075 "Return the headers of the GENERATIONeth parent of HEADERS." | |
3076 (unless generation | |
3077 (setq generation 1)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3078 (let ((parent t) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3079 references) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3080 (while (and parent headers (not (zerop generation))) |
17493 | 3081 (setq references (mail-header-references headers)) |
3082 (when (and references | |
3083 (setq parent (gnus-parent-id references)) | |
3084 (setq headers (car (gnus-id-to-thread parent)))) | |
3085 (decf generation))) | |
3086 headers)) | |
3087 | |
3088 (defun gnus-id-to-thread (id) | |
3089 "Return the (sub-)thread where ID appears." | |
3090 (gnus-gethash id gnus-newsgroup-dependencies)) | |
3091 | |
3092 (defun gnus-id-to-article (id) | |
3093 "Return the article number of ID." | |
3094 (let ((thread (gnus-id-to-thread id))) | |
3095 (when (and thread | |
3096 (car thread)) | |
3097 (mail-header-number (car thread))))) | |
3098 | |
3099 (defun gnus-id-to-header (id) | |
3100 "Return the article headers of ID." | |
3101 (car (gnus-id-to-thread id))) | |
3102 | |
3103 (defun gnus-article-displayed-root-p (article) | |
3104 "Say whether ARTICLE is a root(ish) article." | |
3105 (let ((level (gnus-summary-thread-level article)) | |
3106 (refs (mail-header-references (gnus-summary-article-header article))) | |
3107 particle) | |
3108 (cond | |
3109 ((null level) nil) | |
3110 ((zerop level) t) | |
3111 ((null refs) t) | |
3112 ((null (gnus-parent-id refs)) t) | |
3113 ((and (= 1 level) | |
3114 (null (setq particle (gnus-id-to-article | |
3115 (gnus-parent-id refs)))) | |
3116 (null (gnus-summary-thread-level particle))))))) | |
3117 | |
3118 (defun gnus-root-id (id) | |
3119 "Return the id of the root of the thread where ID appears." | |
3120 (let (last-id prev) | |
3121 (while (and id (setq prev (car (gnus-gethash | |
3122 id gnus-newsgroup-dependencies)))) | |
3123 (setq last-id id | |
3124 id (gnus-parent-id (mail-header-references prev)))) | |
3125 last-id)) | |
3126 | |
3127 (defun gnus-remove-thread (id &optional dont-remove) | |
3128 "Remove the thread that has ID in it." | |
3129 (let ((dep gnus-newsgroup-dependencies) | |
3130 headers thread last-id) | |
3131 ;; First go up in this thread until we find the root. | |
3132 (setq last-id (gnus-root-id id)) | |
3133 (setq headers (list (car (gnus-id-to-thread last-id)) | |
3134 (caadr (gnus-id-to-thread last-id)))) | |
3135 ;; We have now found the real root of this thread. It might have | |
3136 ;; been gathered into some loose thread, so we have to search | |
3137 ;; through the threads to find the thread we wanted. | |
3138 (let ((threads gnus-newsgroup-threads) | |
3139 sub) | |
3140 (while threads | |
3141 (setq sub (car threads)) | |
3142 (if (stringp (car sub)) | |
3143 ;; This is a gathered thread, so we look at the roots | |
3144 ;; below it to find whether this article is in this | |
3145 ;; gathered root. | |
3146 (progn | |
3147 (setq sub (cdr sub)) | |
3148 (while sub | |
3149 (when (member (caar sub) headers) | |
3150 (setq thread (car threads) | |
3151 threads nil | |
3152 sub nil)) | |
3153 (setq sub (cdr sub)))) | |
3154 ;; It's an ordinary thread, so we check it. | |
3155 (when (eq (car sub) (car headers)) | |
3156 (setq thread sub | |
3157 threads nil))) | |
3158 (setq threads (cdr threads))) | |
3159 ;; If this article is in no thread, then it's a root. | |
3160 (if thread | |
3161 (unless dont-remove | |
3162 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads))) | |
3163 (setq thread (gnus-gethash last-id dep))) | |
3164 (when thread | |
3165 (prog1 | |
3166 thread ; We return this thread. | |
3167 (unless dont-remove | |
3168 (if (stringp (car thread)) | |
3169 (progn | |
3170 ;; If we use dummy roots, then we have to remove the | |
3171 ;; dummy root as well. | |
3172 (when (eq gnus-summary-make-false-root 'dummy) | |
3173 (gnus-delete-line) | |
3174 (gnus-data-compute-positions)) | |
3175 (setq thread (cdr thread)) | |
3176 (while thread | |
3177 (gnus-remove-thread-1 (car thread)) | |
3178 (setq thread (cdr thread)))) | |
3179 (gnus-remove-thread-1 thread)))))))) | |
3180 | |
3181 (defun gnus-remove-thread-1 (thread) | |
3182 "Remove the thread THREAD recursively." | |
3183 (let ((number (mail-header-number (pop thread))) | |
3184 d) | |
3185 (setq thread (reverse thread)) | |
3186 (while thread | |
3187 (gnus-remove-thread-1 (pop thread))) | |
3188 (when (setq d (gnus-data-find number)) | |
3189 (goto-char (gnus-data-pos d)) | |
3190 (gnus-data-remove | |
3191 number | |
3192 (- (gnus-point-at-bol) | |
3193 (prog1 | |
3194 (1+ (gnus-point-at-eol)) | |
3195 (gnus-delete-line))))))) | |
3196 | |
3197 (defun gnus-sort-threads (threads) | |
3198 "Sort THREADS." | |
3199 (if (not gnus-thread-sort-functions) | |
3200 threads | |
3201 (gnus-message 7 "Sorting threads...") | |
3202 (prog1 | |
3203 (sort threads (gnus-make-sort-function gnus-thread-sort-functions)) | |
3204 (gnus-message 7 "Sorting threads...done")))) | |
3205 | |
3206 (defun gnus-sort-articles (articles) | |
3207 "Sort ARTICLES." | |
3208 (when gnus-article-sort-functions | |
3209 (gnus-message 7 "Sorting articles...") | |
3210 (prog1 | |
3211 (setq gnus-newsgroup-headers | |
3212 (sort articles (gnus-make-sort-function | |
3213 gnus-article-sort-functions))) | |
3214 (gnus-message 7 "Sorting articles...done")))) | |
3215 | |
3216 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>. | |
3217 (defmacro gnus-thread-header (thread) | |
3218 ;; Return header of first article in THREAD. | |
3219 ;; Note that THREAD must never, ever be anything else than a variable - | |
3220 ;; using some other form will lead to serious barfage. | |
3221 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread))) | |
3222 ;; (8% speedup to gnus-summary-prepare, just for fun :-) | |
3223 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ; | |
3224 (vector thread) 2)) | |
3225 | |
3226 (defsubst gnus-article-sort-by-number (h1 h2) | |
3227 "Sort articles by article number." | |
3228 (< (mail-header-number h1) | |
3229 (mail-header-number h2))) | |
3230 | |
3231 (defun gnus-thread-sort-by-number (h1 h2) | |
3232 "Sort threads by root article number." | |
3233 (gnus-article-sort-by-number | |
3234 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3235 | |
3236 (defsubst gnus-article-sort-by-lines (h1 h2) | |
3237 "Sort articles by article Lines header." | |
3238 (< (mail-header-lines h1) | |
3239 (mail-header-lines h2))) | |
3240 | |
3241 (defun gnus-thread-sort-by-lines (h1 h2) | |
3242 "Sort threads by root article Lines header." | |
3243 (gnus-article-sort-by-lines | |
3244 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3245 | |
3246 (defsubst gnus-article-sort-by-author (h1 h2) | |
3247 "Sort articles by root author." | |
3248 (string-lessp | |
3249 (let ((extract (funcall | |
3250 gnus-extract-address-components | |
3251 (mail-header-from h1)))) | |
3252 (or (car extract) (cadr extract) "")) | |
3253 (let ((extract (funcall | |
3254 gnus-extract-address-components | |
3255 (mail-header-from h2)))) | |
3256 (or (car extract) (cadr extract) "")))) | |
3257 | |
3258 (defun gnus-thread-sort-by-author (h1 h2) | |
3259 "Sort threads by root author." | |
3260 (gnus-article-sort-by-author | |
3261 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3262 | |
3263 (defsubst gnus-article-sort-by-subject (h1 h2) | |
3264 "Sort articles by root subject." | |
3265 (string-lessp | |
3266 (downcase (gnus-simplify-subject-re (mail-header-subject h1))) | |
3267 (downcase (gnus-simplify-subject-re (mail-header-subject h2))))) | |
3268 | |
3269 (defun gnus-thread-sort-by-subject (h1 h2) | |
3270 "Sort threads by root subject." | |
3271 (gnus-article-sort-by-subject | |
3272 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3273 | |
3274 (defsubst gnus-article-sort-by-date (h1 h2) | |
3275 "Sort articles by root article date." | |
3276 (gnus-time-less | |
3277 (gnus-date-get-time (mail-header-date h1)) | |
3278 (gnus-date-get-time (mail-header-date h2)))) | |
3279 | |
3280 (defun gnus-thread-sort-by-date (h1 h2) | |
3281 "Sort threads by root article date." | |
3282 (gnus-article-sort-by-date | |
3283 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3284 | |
3285 (defsubst gnus-article-sort-by-score (h1 h2) | |
3286 "Sort articles by root article score. | |
3287 Unscored articles will be counted as having a score of zero." | |
3288 (> (or (cdr (assq (mail-header-number h1) | |
3289 gnus-newsgroup-scored)) | |
3290 gnus-summary-default-score 0) | |
3291 (or (cdr (assq (mail-header-number h2) | |
3292 gnus-newsgroup-scored)) | |
3293 gnus-summary-default-score 0))) | |
3294 | |
3295 (defun gnus-thread-sort-by-score (h1 h2) | |
3296 "Sort threads by root article score." | |
3297 (gnus-article-sort-by-score | |
3298 (gnus-thread-header h1) (gnus-thread-header h2))) | |
3299 | |
3300 (defun gnus-thread-sort-by-total-score (h1 h2) | |
3301 "Sort threads by the sum of all scores in the thread. | |
3302 Unscored articles will be counted as having a score of zero." | |
3303 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2))) | |
3304 | |
3305 (defun gnus-thread-total-score (thread) | |
3306 ;; This function find the total score of THREAD. | |
3307 (cond ((null thread) | |
3308 0) | |
3309 ((consp thread) | |
3310 (if (stringp (car thread)) | |
3311 (apply gnus-thread-score-function 0 | |
3312 (mapcar 'gnus-thread-total-score-1 (cdr thread))) | |
3313 (gnus-thread-total-score-1 thread))) | |
3314 (t | |
3315 (gnus-thread-total-score-1 (list thread))))) | |
3316 | |
3317 (defun gnus-thread-total-score-1 (root) | |
3318 ;; This function find the total score of the thread below ROOT. | |
3319 (setq root (car root)) | |
3320 (apply gnus-thread-score-function | |
3321 (or (append | |
3322 (mapcar 'gnus-thread-total-score | |
3323 (cdr (gnus-gethash (mail-header-id root) | |
3324 gnus-newsgroup-dependencies))) | |
3325 (when (> (mail-header-number root) 0) | |
3326 (list (or (cdr (assq (mail-header-number root) | |
3327 gnus-newsgroup-scored)) | |
3328 gnus-summary-default-score 0)))) | |
3329 (list gnus-summary-default-score) | |
3330 '(0)))) | |
3331 | |
3332 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>. | |
3333 (defvar gnus-tmp-prev-subject nil) | |
3334 (defvar gnus-tmp-false-parent nil) | |
3335 (defvar gnus-tmp-root-expunged nil) | |
3336 (defvar gnus-tmp-dummy-line nil) | |
3337 | |
3338 (defun gnus-summary-prepare-threads (threads) | |
3339 "Prepare summary buffer from THREADS and indentation LEVEL. | |
3340 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])' | |
3341 or a straight list of headers." | |
3342 (gnus-message 7 "Generating summary...") | |
3343 | |
3344 (setq gnus-newsgroup-threads threads) | |
3345 (beginning-of-line) | |
3346 | |
3347 (let ((gnus-tmp-level 0) | |
3348 (default-score (or gnus-summary-default-score 0)) | |
3349 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight)) | |
3350 thread number subject stack state gnus-tmp-gathered beg-match | |
3351 new-roots gnus-tmp-new-adopts thread-end | |
3352 gnus-tmp-header gnus-tmp-unread | |
3353 gnus-tmp-replied gnus-tmp-subject-or-nil | |
3354 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score | |
3355 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name | |
3356 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket) | |
3357 | |
3358 (setq gnus-tmp-prev-subject nil) | |
3359 | |
3360 (if (vectorp (car threads)) | |
3361 ;; If this is a straight (sic) list of headers, then a | |
3362 ;; threaded summary display isn't required, so we just create | |
3363 ;; an unthreaded one. | |
3364 (gnus-summary-prepare-unthreaded threads) | |
3365 | |
3366 ;; Do the threaded display. | |
3367 | |
3368 (while (or threads stack gnus-tmp-new-adopts new-roots) | |
3369 | |
3370 (if (and (= gnus-tmp-level 0) | |
3371 (not (setq gnus-tmp-dummy-line nil)) | |
3372 (or (not stack) | |
3373 (= (caar stack) 0)) | |
3374 (not gnus-tmp-false-parent) | |
3375 (or gnus-tmp-new-adopts new-roots)) | |
3376 (if gnus-tmp-new-adopts | |
3377 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1) | |
3378 thread (list (car gnus-tmp-new-adopts)) | |
3379 gnus-tmp-header (caar thread) | |
3380 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts)) | |
3381 (when new-roots | |
3382 (setq thread (list (car new-roots)) | |
3383 gnus-tmp-header (caar thread) | |
3384 new-roots (cdr new-roots)))) | |
3385 | |
3386 (if threads | |
3387 ;; If there are some threads, we do them before the | |
3388 ;; threads on the stack. | |
3389 (setq thread threads | |
3390 gnus-tmp-header (caar thread)) | |
3391 ;; There were no current threads, so we pop something off | |
3392 ;; the stack. | |
3393 (setq state (car stack) | |
3394 gnus-tmp-level (car state) | |
3395 thread (cdr state) | |
3396 stack (cdr stack) | |
3397 gnus-tmp-header (caar thread)))) | |
3398 | |
3399 (setq gnus-tmp-false-parent nil) | |
3400 (setq gnus-tmp-root-expunged nil) | |
3401 (setq thread-end nil) | |
3402 | |
3403 (if (stringp gnus-tmp-header) | |
3404 ;; The header is a dummy root. | |
3405 (cond | |
3406 ((eq gnus-summary-make-false-root 'adopt) | |
3407 ;; We let the first article adopt the rest. | |
3408 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts | |
3409 (cddar thread))) | |
3410 (setq gnus-tmp-gathered | |
3411 (nconc (mapcar | |
3412 (lambda (h) (mail-header-number (car h))) | |
3413 (cddar thread)) | |
3414 gnus-tmp-gathered)) | |
3415 (setq thread (cons (list (caar thread) | |
3416 (cadar thread)) | |
3417 (cdr thread))) | |
3418 (setq gnus-tmp-level -1 | |
3419 gnus-tmp-false-parent t)) | |
3420 ((eq gnus-summary-make-false-root 'empty) | |
3421 ;; We print adopted articles with empty subject fields. | |
3422 (setq gnus-tmp-gathered | |
3423 (nconc (mapcar | |
3424 (lambda (h) (mail-header-number (car h))) | |
3425 (cddar thread)) | |
3426 gnus-tmp-gathered)) | |
3427 (setq gnus-tmp-level -1)) | |
3428 ((eq gnus-summary-make-false-root 'dummy) | |
3429 ;; We remember that we probably want to output a dummy | |
3430 ;; root. | |
3431 (setq gnus-tmp-dummy-line gnus-tmp-header) | |
3432 (setq gnus-tmp-prev-subject gnus-tmp-header)) | |
3433 (t | |
3434 ;; We do not make a root for the gathered | |
3435 ;; sub-threads at all. | |
3436 (setq gnus-tmp-level -1))) | |
3437 | |
3438 (setq number (mail-header-number gnus-tmp-header) | |
3439 subject (mail-header-subject gnus-tmp-header)) | |
3440 | |
3441 (cond | |
3442 ;; If the thread has changed subject, we might want to make | |
3443 ;; this subthread into a root. | |
3444 ((and (null gnus-thread-ignore-subject) | |
3445 (not (zerop gnus-tmp-level)) | |
3446 gnus-tmp-prev-subject | |
3447 (not (inline | |
3448 (gnus-subject-equal gnus-tmp-prev-subject subject)))) | |
3449 (setq new-roots (nconc new-roots (list (car thread))) | |
3450 thread-end t | |
3451 gnus-tmp-header nil)) | |
3452 ;; If the article lies outside the current limit, | |
3453 ;; then we do not display it. | |
3454 ((not (memq number gnus-newsgroup-limit)) | |
3455 (setq gnus-tmp-gathered | |
3456 (nconc (mapcar | |
3457 (lambda (h) (mail-header-number (car h))) | |
3458 (cdar thread)) | |
3459 gnus-tmp-gathered)) | |
3460 (setq gnus-tmp-new-adopts (if (cdar thread) | |
3461 (append gnus-tmp-new-adopts | |
3462 (cdar thread)) | |
3463 gnus-tmp-new-adopts) | |
3464 thread-end t | |
3465 gnus-tmp-header nil) | |
3466 (when (zerop gnus-tmp-level) | |
3467 (setq gnus-tmp-root-expunged t))) | |
3468 ;; Perhaps this article is to be marked as read? | |
3469 ((and gnus-summary-mark-below | |
3470 (< (or (cdr (assq number gnus-newsgroup-scored)) | |
3471 default-score) | |
3472 gnus-summary-mark-below) | |
3473 ;; Don't touch sparse articles. | |
3474 (not (gnus-summary-article-sparse-p number)) | |
3475 (not (gnus-summary-article-ancient-p number))) | |
3476 (setq gnus-newsgroup-unreads | |
3477 (delq number gnus-newsgroup-unreads)) | |
3478 (if gnus-newsgroup-auto-expire | |
3479 (push number gnus-newsgroup-expirable) | |
3480 (push (cons number gnus-low-score-mark) | |
3481 gnus-newsgroup-reads)))) | |
3482 | |
3483 (when gnus-tmp-header | |
3484 ;; We may have an old dummy line to output before this | |
3485 ;; article. | |
3486 (when gnus-tmp-dummy-line | |
3487 (gnus-summary-insert-dummy-line | |
3488 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header)) | |
3489 (setq gnus-tmp-dummy-line nil)) | |
3490 | |
3491 ;; Compute the mark. | |
3492 (setq gnus-tmp-unread (gnus-article-mark number)) | |
3493 | |
3494 (push (gnus-data-make number gnus-tmp-unread (1+ (point)) | |
3495 gnus-tmp-header gnus-tmp-level) | |
3496 gnus-newsgroup-data) | |
3497 | |
3498 ;; Actually insert the line. | |
3499 (setq | |
3500 gnus-tmp-subject-or-nil | |
3501 (cond | |
3502 ((and gnus-thread-ignore-subject | |
3503 gnus-tmp-prev-subject | |
3504 (not (inline (gnus-subject-equal | |
3505 gnus-tmp-prev-subject subject)))) | |
3506 subject) | |
3507 ((zerop gnus-tmp-level) | |
3508 (if (and (eq gnus-summary-make-false-root 'empty) | |
3509 (memq number gnus-tmp-gathered) | |
3510 gnus-tmp-prev-subject | |
3511 (inline (gnus-subject-equal | |
3512 gnus-tmp-prev-subject subject))) | |
3513 gnus-summary-same-subject | |
3514 subject)) | |
3515 (t gnus-summary-same-subject))) | |
3516 (if (and (eq gnus-summary-make-false-root 'adopt) | |
3517 (= gnus-tmp-level 1) | |
3518 (memq number gnus-tmp-gathered)) | |
3519 (setq gnus-tmp-opening-bracket ?\< | |
3520 gnus-tmp-closing-bracket ?\>) | |
3521 (setq gnus-tmp-opening-bracket ?\[ | |
3522 gnus-tmp-closing-bracket ?\])) | |
3523 (setq | |
3524 gnus-tmp-indentation | |
3525 (aref gnus-thread-indent-array gnus-tmp-level) | |
3526 gnus-tmp-lines (mail-header-lines gnus-tmp-header) | |
3527 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored)) | |
3528 gnus-summary-default-score 0) | |
3529 gnus-tmp-score-char | |
3530 (if (or (null gnus-summary-default-score) | |
3531 (<= (abs (- gnus-tmp-score gnus-summary-default-score)) | |
3532 gnus-summary-zcore-fuzz)) | |
3533 ? | |
3534 (if (< gnus-tmp-score gnus-summary-default-score) | |
3535 gnus-score-below-mark gnus-score-over-mark)) | |
3536 gnus-tmp-replied | |
3537 (cond ((memq number gnus-newsgroup-processable) | |
3538 gnus-process-mark) | |
3539 ((memq number gnus-newsgroup-cached) | |
3540 gnus-cached-mark) | |
3541 ((memq number gnus-newsgroup-replied) | |
3542 gnus-replied-mark) | |
3543 ((memq number gnus-newsgroup-saved) | |
3544 gnus-saved-mark) | |
3545 (t gnus-unread-mark)) | |
3546 gnus-tmp-from (mail-header-from gnus-tmp-header) | |
3547 gnus-tmp-name | |
3548 (cond | |
3549 ((string-match "<[^>]+> *$" gnus-tmp-from) | |
3550 (setq beg-match (match-beginning 0)) | |
3551 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from) | |
3552 (substring gnus-tmp-from (1+ (match-beginning 0)) | |
3553 (1- (match-end 0)))) | |
3554 (substring gnus-tmp-from 0 beg-match))) | |
3555 ((string-match "(.+)" gnus-tmp-from) | |
3556 (substring gnus-tmp-from | |
3557 (1+ (match-beginning 0)) (1- (match-end 0)))) | |
3558 (t gnus-tmp-from))) | |
3559 (when (string= gnus-tmp-name "") | |
3560 (setq gnus-tmp-name gnus-tmp-from)) | |
3561 (unless (numberp gnus-tmp-lines) | |
3562 (setq gnus-tmp-lines 0)) | |
3563 (gnus-put-text-property | |
3564 (point) | |
3565 (progn (eval gnus-summary-line-format-spec) (point)) | |
3566 'gnus-number number) | |
3567 (when gnus-visual-p | |
3568 (forward-line -1) | |
3569 (run-hooks 'gnus-summary-update-hook) | |
3570 (forward-line 1)) | |
3571 | |
3572 (setq gnus-tmp-prev-subject subject))) | |
3573 | |
3574 (when (nth 1 thread) | |
3575 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack)) | |
3576 (incf gnus-tmp-level) | |
3577 (setq threads (if thread-end nil (cdar thread))) | |
3578 (unless threads | |
3579 (setq gnus-tmp-level 0))))) | |
3580 (gnus-message 7 "Generating summary...done")) | |
3581 | |
3582 (defun gnus-summary-prepare-unthreaded (headers) | |
3583 "Generate an unthreaded summary buffer based on HEADERS." | |
3584 (let (header number mark) | |
3585 | |
3586 (beginning-of-line) | |
3587 | |
3588 (while headers | |
3589 ;; We may have to root out some bad articles... | |
3590 (when (memq (setq number (mail-header-number | |
3591 (setq header (pop headers)))) | |
3592 gnus-newsgroup-limit) | |
3593 ;; Mark article as read when it has a low score. | |
3594 (when (and gnus-summary-mark-below | |
3595 (< (or (cdr (assq number gnus-newsgroup-scored)) | |
3596 gnus-summary-default-score 0) | |
3597 gnus-summary-mark-below) | |
3598 (not (gnus-summary-article-ancient-p number))) | |
3599 (setq gnus-newsgroup-unreads | |
3600 (delq number gnus-newsgroup-unreads)) | |
3601 (if gnus-newsgroup-auto-expire | |
3602 (push number gnus-newsgroup-expirable) | |
3603 (push (cons number gnus-low-score-mark) | |
3604 gnus-newsgroup-reads))) | |
3605 | |
3606 (setq mark (gnus-article-mark number)) | |
3607 (push (gnus-data-make number mark (1+ (point)) header 0) | |
3608 gnus-newsgroup-data) | |
3609 (gnus-summary-insert-line | |
3610 header 0 number | |
3611 mark (memq number gnus-newsgroup-replied) | |
3612 (memq number gnus-newsgroup-expirable) | |
3613 (mail-header-subject header) nil | |
3614 (cdr (assq number gnus-newsgroup-scored)) | |
3615 (memq number gnus-newsgroup-processable)))))) | |
3616 | |
3617 (defun gnus-select-newsgroup (group &optional read-all) | |
3618 "Select newsgroup GROUP. | |
3619 If READ-ALL is non-nil, all articles in the group are selected." | |
3620 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb)) | |
3621 ;;!!! Dirty hack; should be removed. | |
3622 (gnus-summary-ignore-duplicates | |
3623 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual) | |
3624 t | |
3625 gnus-summary-ignore-duplicates)) | |
3626 (info (nth 2 entry)) | |
3627 articles fetched-articles cached) | |
3628 | |
3629 (unless (gnus-check-server | |
3630 (setq gnus-current-select-method | |
3631 (gnus-find-method-for-group group))) | |
3632 (error "Couldn't open server")) | |
3633 | |
3634 (or (and entry (not (eq (car entry) t))) ; Either it's active... | |
3635 (gnus-activate-group group) ; Or we can activate it... | |
3636 (progn ; Or we bug out. | |
3637 (when (equal major-mode 'gnus-summary-mode) | |
3638 (kill-buffer (current-buffer))) | |
3639 (error "Couldn't request group %s: %s" | |
3640 group (gnus-status-message group)))) | |
3641 | |
3642 (unless (gnus-request-group group t) | |
3643 (when (equal major-mode 'gnus-summary-mode) | |
3644 (kill-buffer (current-buffer))) | |
3645 (error "Couldn't request group %s: %s" | |
3646 group (gnus-status-message group))) | |
3647 | |
3648 (setq gnus-newsgroup-name group) | |
3649 (setq gnus-newsgroup-unselected nil) | |
3650 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group)) | |
3651 | |
3652 ;; Adjust and set lists of article marks. | |
3653 (when info | |
3654 (gnus-adjust-marked-articles info)) | |
3655 | |
3656 ;; Kludge to avoid having cached articles nixed out in virtual groups. | |
3657 (when (gnus-virtual-group-p group) | |
3658 (setq cached gnus-newsgroup-cached)) | |
3659 | |
3660 (setq gnus-newsgroup-unreads | |
3661 (gnus-set-difference | |
3662 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked) | |
3663 gnus-newsgroup-dormant)) | |
3664 | |
3665 (setq gnus-newsgroup-processable nil) | |
3666 | |
3667 (gnus-update-read-articles group gnus-newsgroup-unreads) | |
3668 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
3669 (gnus-group-update-group group)) | |
3670 | |
3671 (setq articles (gnus-articles-to-read group read-all)) | |
3672 | |
3673 (cond | |
3674 ((null articles) | |
3675 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display") | |
3676 'quit) | |
3677 ((eq articles 0) nil) | |
3678 (t | |
3679 ;; Init the dependencies hash table. | |
3680 (setq gnus-newsgroup-dependencies | |
3681 (gnus-make-hashtable (length articles))) | |
3682 ;; Retrieve the headers and read them in. | |
3683 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name) | |
3684 (setq gnus-newsgroup-headers | |
3685 (if (eq 'nov | |
3686 (setq gnus-headers-retrieved-by | |
3687 (gnus-retrieve-headers | |
3688 articles gnus-newsgroup-name | |
3689 ;; We might want to fetch old headers, but | |
3690 ;; not if there is only 1 article. | |
3691 (and gnus-fetch-old-headers | |
3692 (or (and | |
3693 (not (eq gnus-fetch-old-headers 'some)) | |
3694 (not (numberp gnus-fetch-old-headers))) | |
3695 (> (length articles) 1)))))) | |
3696 (gnus-get-newsgroup-headers-xover | |
3697 articles nil nil gnus-newsgroup-name t) | |
3698 (gnus-get-newsgroup-headers))) | |
3699 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name) | |
3700 | |
3701 ;; Kludge to avoid having cached articles nixed out in virtual groups. | |
3702 (when cached | |
3703 (setq gnus-newsgroup-cached cached)) | |
3704 | |
3705 ;; Suppress duplicates? | |
3706 (when gnus-suppress-duplicates | |
3707 (gnus-dup-suppress-articles)) | |
3708 | |
3709 ;; Set the initial limit. | |
3710 (setq gnus-newsgroup-limit (copy-sequence articles)) | |
3711 ;; Remove canceled articles from the list of unread articles. | |
3712 (setq gnus-newsgroup-unreads | |
3713 (gnus-set-sorted-intersection | |
3714 gnus-newsgroup-unreads | |
3715 (setq fetched-articles | |
3716 (mapcar (lambda (headers) (mail-header-number headers)) | |
3717 gnus-newsgroup-headers)))) | |
3718 ;; Removed marked articles that do not exist. | |
3719 (gnus-update-missing-marks | |
3720 (gnus-sorted-complement fetched-articles articles)) | |
3721 ;; We might want to build some more threads first. | |
3722 (and gnus-fetch-old-headers | |
3723 (eq gnus-headers-retrieved-by 'nov) | |
3724 (gnus-build-old-threads)) | |
3725 ;; Check whether auto-expire is to be done in this group. | |
3726 (setq gnus-newsgroup-auto-expire | |
3727 (gnus-group-auto-expirable-p group)) | |
3728 ;; Set up the article buffer now, if necessary. | |
3729 (unless gnus-single-article-buffer | |
3730 (gnus-article-setup-buffer)) | |
3731 ;; First and last article in this newsgroup. | |
3732 (when gnus-newsgroup-headers | |
3733 (setq gnus-newsgroup-begin | |
3734 (mail-header-number (car gnus-newsgroup-headers)) | |
3735 gnus-newsgroup-end | |
3736 (mail-header-number | |
3737 (gnus-last-element gnus-newsgroup-headers)))) | |
3738 ;; GROUP is successfully selected. | |
3739 (or gnus-newsgroup-headers t))))) | |
3740 | |
3741 (defun gnus-articles-to-read (group &optional read-all) | |
3742 ;; Find out what articles the user wants to read. | |
3743 (let* ((articles | |
3744 ;; Select all articles if `read-all' is non-nil, or if there | |
3745 ;; are no unread articles. | |
3746 (if (or read-all | |
3747 (and (zerop (length gnus-newsgroup-marked)) | |
3748 (zerop (length gnus-newsgroup-unreads))) | |
3749 (eq (gnus-group-find-parameter group 'display) | |
3750 'all)) | |
3751 (gnus-uncompress-range (gnus-active group)) | |
3752 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked | |
3753 (copy-sequence gnus-newsgroup-unreads)) | |
3754 '<))) | |
3755 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles)) | |
3756 (scored (length scored-list)) | |
3757 (number (length articles)) | |
3758 (marked (+ (length gnus-newsgroup-marked) | |
3759 (length gnus-newsgroup-dormant))) | |
3760 (select | |
3761 (cond | |
3762 ((numberp read-all) | |
3763 read-all) | |
3764 (t | |
3765 (condition-case () | |
3766 (cond | |
3767 ((and (or (<= scored marked) (= scored number)) | |
3768 (numberp gnus-large-newsgroup) | |
3769 (> number gnus-large-newsgroup)) | |
3770 (let ((input | |
3771 (read-string | |
3772 (format | |
3773 "How many articles from %s (default %d): " | |
3774 (gnus-limit-string gnus-newsgroup-name 35) | |
3775 number)))) | |
3776 (if (string-match "^[ \t]*$" input) number input))) | |
3777 ((and (> scored marked) (< scored number) | |
3778 (> (- scored number) 20)) | |
3779 (let ((input | |
3780 (read-string | |
3781 (format "%s %s (%d scored, %d total): " | |
3782 "How many articles from" | |
3783 group scored number)))) | |
3784 (if (string-match "^[ \t]*$" input) | |
3785 number input))) | |
3786 (t number)) | |
3787 (quit nil)))))) | |
3788 (setq select (if (stringp select) (string-to-number select) select)) | |
3789 (if (or (null select) (zerop select)) | |
3790 select | |
3791 (if (and (not (zerop scored)) (<= (abs select) scored)) | |
3792 (progn | |
3793 (setq articles (sort scored-list '<)) | |
3794 (setq number (length articles))) | |
3795 (setq articles (copy-sequence articles))) | |
3796 | |
3797 (when (< (abs select) number) | |
3798 (if (< select 0) | |
3799 ;; Select the N oldest articles. | |
3800 (setcdr (nthcdr (1- (abs select)) articles) nil) | |
3801 ;; Select the N most recent articles. | |
3802 (setq articles (nthcdr (- number select) articles)))) | |
3803 (setq gnus-newsgroup-unselected | |
3804 (gnus-sorted-intersection | |
3805 gnus-newsgroup-unreads | |
3806 (gnus-sorted-complement gnus-newsgroup-unreads articles))) | |
3807 articles))) | |
3808 | |
3809 (defun gnus-killed-articles (killed articles) | |
3810 (let (out) | |
3811 (while articles | |
3812 (when (inline (gnus-member-of-range (car articles) killed)) | |
3813 (push (car articles) out)) | |
3814 (setq articles (cdr articles))) | |
3815 out)) | |
3816 | |
3817 (defun gnus-uncompress-marks (marks) | |
3818 "Uncompress the mark ranges in MARKS." | |
3819 (let ((uncompressed '(score bookmark)) | |
3820 out) | |
3821 (while marks | |
3822 (if (memq (caar marks) uncompressed) | |
3823 (push (car marks) out) | |
3824 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out)) | |
3825 (setq marks (cdr marks))) | |
3826 out)) | |
3827 | |
3828 (defun gnus-adjust-marked-articles (info) | |
3829 "Set all article lists and remove all marks that are no longer legal." | |
3830 (let* ((marked-lists (gnus-info-marks info)) | |
3831 (active (gnus-active (gnus-info-group info))) | |
3832 (min (car active)) | |
3833 (max (cdr active)) | |
3834 (types gnus-article-mark-lists) | |
3835 (uncompressed '(score bookmark killed)) | |
3836 marks var articles article mark) | |
3837 | |
3838 (while marked-lists | |
3839 (setq marks (pop marked-lists)) | |
3840 (set (setq var (intern (format "gnus-newsgroup-%s" | |
3841 (car (rassq (setq mark (car marks)) | |
3842 types))))) | |
3843 (if (memq (car marks) uncompressed) (cdr marks) | |
3844 (gnus-uncompress-range (cdr marks)))) | |
3845 | |
3846 (setq articles (symbol-value var)) | |
3847 | |
3848 ;; All articles have to be subsets of the active articles. | |
3849 (cond | |
3850 ;; Adjust "simple" lists. | |
3851 ((memq mark '(tick dormant expire reply save)) | |
3852 (while articles | |
3853 (when (or (< (setq article (pop articles)) min) (> article max)) | |
3854 (set var (delq article (symbol-value var)))))) | |
3855 ;; Adjust assocs. | |
3856 ((memq mark uncompressed) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3857 (when (not (listp (cdr (symbol-value var)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3858 (set var (list (symbol-value var)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3859 (when (not (listp (cdr articles))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
3860 (setq articles (list articles))) |
17493 | 3861 (while articles |
3862 (when (or (not (consp (setq article (pop articles)))) | |
3863 (< (car article) min) | |
3864 (> (car article) max)) | |
3865 (set var (delq article (symbol-value var)))))))))) | |
3866 | |
3867 (defun gnus-update-missing-marks (missing) | |
3868 "Go through the list of MISSING articles and remove them mark lists." | |
3869 (when missing | |
3870 (let ((types gnus-article-mark-lists) | |
3871 var m) | |
3872 ;; Go through all types. | |
3873 (while types | |
3874 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types))))) | |
3875 (when (symbol-value var) | |
3876 ;; This list has articles. So we delete all missing articles | |
3877 ;; from it. | |
3878 (setq m missing) | |
3879 (while m | |
3880 (set var (delq (pop m) (symbol-value var))))))))) | |
3881 | |
3882 (defun gnus-update-marks () | |
3883 "Enter the various lists of marked articles into the newsgroup info list." | |
3884 (let ((types gnus-article-mark-lists) | |
3885 (info (gnus-get-info gnus-newsgroup-name)) | |
3886 (uncompressed '(score bookmark killed)) | |
3887 type list newmarked symbol) | |
3888 (when info | |
3889 ;; Add all marks lists that are non-nil to the list of marks lists. | |
3890 (while (setq type (pop types)) | |
3891 (when (setq list (symbol-value | |
3892 (setq symbol | |
3893 (intern (format "gnus-newsgroup-%s" | |
3894 (car type)))))) | |
3895 | |
3896 ;; Get rid of the entries of the articles that have the | |
3897 ;; default score. | |
3898 (when (and (eq (cdr type) 'score) | |
3899 gnus-save-score | |
3900 list) | |
3901 (let* ((arts list) | |
3902 (prev (cons nil list)) | |
3903 (all prev)) | |
3904 (while arts | |
3905 (if (or (not (consp (car arts))) | |
3906 (= (cdar arts) gnus-summary-default-score)) | |
3907 (setcdr prev (cdr arts)) | |
3908 (setq prev arts)) | |
3909 (setq arts (cdr arts))) | |
3910 (setq list (cdr all)))) | |
3911 | |
3912 (push (cons (cdr type) | |
3913 (if (memq (cdr type) uncompressed) list | |
3914 (gnus-compress-sequence | |
3915 (set symbol (sort list '<)) t))) | |
3916 newmarked))) | |
3917 | |
3918 ;; Enter these new marks into the info of the group. | |
3919 (if (nthcdr 3 info) | |
3920 (setcar (nthcdr 3 info) newmarked) | |
3921 ;; Add the marks lists to the end of the info. | |
3922 (when newmarked | |
3923 (setcdr (nthcdr 2 info) (list newmarked)))) | |
3924 | |
3925 ;; Cut off the end of the info if there's nothing else there. | |
3926 (let ((i 5)) | |
3927 (while (and (> i 2) | |
3928 (not (nth i info))) | |
3929 (when (nthcdr (decf i) info) | |
3930 (setcdr (nthcdr i info) nil))))))) | |
3931 | |
3932 (defun gnus-set-mode-line (where) | |
3933 "This function sets the mode line of the article or summary buffers. | |
3934 If WHERE is `summary', the summary mode line format will be used." | |
3935 ;; Is this mode line one we keep updated? | |
3936 (when (memq where gnus-updated-mode-lines) | |
3937 (let (mode-string) | |
3938 (save-excursion | |
3939 ;; We evaluate this in the summary buffer since these | |
3940 ;; variables are buffer-local to that buffer. | |
3941 (set-buffer gnus-summary-buffer) | |
3942 ;; We bind all these variables that are used in the `eval' form | |
3943 ;; below. | |
3944 (let* ((mformat (symbol-value | |
3945 (intern | |
3946 (format "gnus-%s-mode-line-format-spec" where)))) | |
3947 (gnus-tmp-group-name gnus-newsgroup-name) | |
3948 (gnus-tmp-article-number (or gnus-current-article 0)) | |
3949 (gnus-tmp-unread gnus-newsgroup-unreads) | |
3950 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads)) | |
3951 (gnus-tmp-unselected (length gnus-newsgroup-unselected)) | |
3952 (gnus-tmp-unread-and-unselected | |
3953 (cond ((and (zerop gnus-tmp-unread-and-unticked) | |
3954 (zerop gnus-tmp-unselected)) | |
3955 "") | |
3956 ((zerop gnus-tmp-unselected) | |
3957 (format "{%d more}" gnus-tmp-unread-and-unticked)) | |
3958 (t (format "{%d(+%d) more}" | |
3959 gnus-tmp-unread-and-unticked | |
3960 gnus-tmp-unselected)))) | |
3961 (gnus-tmp-subject | |
3962 (if (and gnus-current-headers | |
3963 (vectorp gnus-current-headers)) | |
3964 (gnus-mode-string-quote | |
3965 (mail-header-subject gnus-current-headers)) | |
3966 "")) | |
3967 bufname-length max-len | |
3968 gnus-tmp-header);; passed as argument to any user-format-funcs | |
3969 (setq mode-string (eval mformat)) | |
3970 (setq bufname-length (if (string-match "%b" mode-string) | |
3971 (- (length | |
3972 (buffer-name | |
3973 (if (eq where 'summary) | |
3974 nil | |
3975 (get-buffer gnus-article-buffer)))) | |
3976 2) | |
3977 0)) | |
3978 (setq max-len (max 4 (if gnus-mode-non-string-length | |
3979 (- (window-width) | |
3980 gnus-mode-non-string-length | |
3981 bufname-length) | |
3982 (length mode-string)))) | |
3983 ;; We might have to chop a bit of the string off... | |
3984 (when (> (length mode-string) max-len) | |
3985 (setq mode-string | |
3986 (concat (gnus-truncate-string mode-string (- max-len 3)) | |
3987 "..."))) | |
3988 ;; Pad the mode string a bit. | |
3989 (setq mode-string (format (format "%%-%ds" max-len) mode-string)))) | |
3990 ;; Update the mode line. | |
3991 (setq mode-line-buffer-identification | |
3992 (gnus-mode-line-buffer-identification (list mode-string))) | |
3993 (set-buffer-modified-p t)))) | |
3994 | |
3995 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads) | |
3996 "Go through the HEADERS list and add all Xrefs to a hash table. | |
3997 The resulting hash table is returned, or nil if no Xrefs were found." | |
3998 (let* ((virtual (gnus-virtual-group-p from-newsgroup)) | |
3999 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup))) | |
4000 (xref-hashtb (gnus-make-hashtable)) | |
4001 start group entry number xrefs header) | |
4002 (while headers | |
4003 (setq header (pop headers)) | |
4004 (when (and (setq xrefs (mail-header-xref header)) | |
4005 (not (memq (setq number (mail-header-number header)) | |
4006 unreads))) | |
4007 (setq start 0) | |
4008 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start) | |
4009 (setq start (match-end 0)) | |
4010 (setq group (if prefix | |
4011 (concat prefix (substring xrefs (match-beginning 1) | |
4012 (match-end 1))) | |
4013 (substring xrefs (match-beginning 1) (match-end 1)))) | |
4014 (setq number | |
4015 (string-to-int (substring xrefs (match-beginning 2) | |
4016 (match-end 2)))) | |
4017 (if (setq entry (gnus-gethash group xref-hashtb)) | |
4018 (setcdr entry (cons number (cdr entry))) | |
4019 (gnus-sethash group (cons number nil) xref-hashtb))))) | |
4020 (and start xref-hashtb))) | |
4021 | |
4022 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads) | |
4023 "Look through all the headers and mark the Xrefs as read." | |
4024 (let ((virtual (gnus-virtual-group-p from-newsgroup)) | |
4025 name entry info xref-hashtb idlist method nth4) | |
4026 (save-excursion | |
4027 (set-buffer gnus-group-buffer) | |
4028 (when (setq xref-hashtb | |
4029 (gnus-create-xref-hashtb from-newsgroup headers unreads)) | |
4030 (mapatoms | |
4031 (lambda (group) | |
4032 (unless (string= from-newsgroup (setq name (symbol-name group))) | |
4033 (setq idlist (symbol-value group)) | |
4034 ;; Dead groups are not updated. | |
4035 (and (prog1 | |
4036 (setq entry (gnus-gethash name gnus-newsrc-hashtb) | |
4037 info (nth 2 entry)) | |
4038 (when (stringp (setq nth4 (gnus-info-method info))) | |
4039 (setq nth4 (gnus-server-to-method nth4)))) | |
4040 ;; Only do the xrefs if the group has the same | |
4041 ;; select method as the group we have just read. | |
4042 (or (gnus-methods-equal-p | |
4043 nth4 (gnus-find-method-for-group from-newsgroup)) | |
4044 virtual | |
4045 (equal nth4 (setq method (gnus-find-method-for-group | |
4046 from-newsgroup))) | |
4047 (and (equal (car nth4) (car method)) | |
4048 (equal (nth 1 nth4) (nth 1 method)))) | |
4049 gnus-use-cross-reference | |
4050 (or (not (eq gnus-use-cross-reference t)) | |
4051 virtual | |
4052 ;; Only do cross-references on subscribed | |
4053 ;; groups, if that is what is wanted. | |
4054 (<= (gnus-info-level info) gnus-level-subscribed)) | |
4055 (gnus-group-make-articles-read name idlist)))) | |
4056 xref-hashtb))))) | |
4057 | |
4058 (defun gnus-group-make-articles-read (group articles) | |
4059 "Update the info of GROUP to say that ARTICLES are read." | |
4060 (let* ((num 0) | |
4061 (entry (gnus-gethash group gnus-newsrc-hashtb)) | |
4062 (info (nth 2 entry)) | |
4063 (active (gnus-active group)) | |
4064 range) | |
4065 ;; First peel off all illegal article numbers. | |
4066 (when active | |
4067 (let ((ids articles) | |
4068 id first) | |
4069 (while (setq id (pop ids)) | |
4070 (when (and first (> id (cdr active))) | |
4071 ;; We'll end up in this situation in one particular | |
4072 ;; obscure situation. If you re-scan a group and get | |
4073 ;; a new article that is cross-posted to a different | |
4074 ;; group that has not been re-scanned, you might get | |
4075 ;; crossposted article that has a higher number than | |
4076 ;; Gnus believes possible. So we re-activate this | |
4077 ;; group as well. This might mean doing the | |
4078 ;; crossposting thingy will *increase* the number | |
4079 ;; of articles in some groups. Tsk, tsk. | |
4080 (setq active (or (gnus-activate-group group) active))) | |
4081 (when (or (> id (cdr active)) | |
4082 (< id (car active))) | |
4083 (setq articles (delq id articles)))))) | |
4084 (save-excursion | |
4085 (set-buffer gnus-group-buffer) | |
4086 (gnus-undo-register | |
4087 `(progn | |
4088 (gnus-info-set-marks ',info ',(gnus-info-marks info) t) | |
4089 (gnus-info-set-read ',info ',(gnus-info-read info)) | |
4090 (gnus-get-unread-articles-in-group ',info (gnus-active ,group)) | |
4091 (gnus-group-update-group ,group t)))) | |
4092 ;; If the read list is nil, we init it. | |
4093 (and active | |
4094 (null (gnus-info-read info)) | |
4095 (> (car active) 1) | |
4096 (gnus-info-set-read info (cons 1 (1- (car active))))) | |
4097 ;; Then we add the read articles to the range. | |
4098 (gnus-info-set-read | |
4099 info | |
4100 (setq range | |
4101 (gnus-add-to-range | |
4102 (gnus-info-read info) (setq articles (sort articles '<))))) | |
4103 ;; Then we have to re-compute how many unread | |
4104 ;; articles there are in this group. | |
4105 (when active | |
4106 (cond | |
4107 ((not range) | |
4108 (setq num (- (1+ (cdr active)) (car active)))) | |
4109 ((not (listp (cdr range))) | |
4110 (setq num (- (cdr active) (- (1+ (cdr range)) | |
4111 (car range))))) | |
4112 (t | |
4113 (while range | |
4114 (if (numberp (car range)) | |
4115 (setq num (1+ num)) | |
4116 (setq num (+ num (- (1+ (cdar range)) (caar range))))) | |
4117 (setq range (cdr range))) | |
4118 (setq num (- (cdr active) num)))) | |
4119 ;; Update the number of unread articles. | |
4120 (setcar entry num) | |
4121 ;; Update the group buffer. | |
4122 (gnus-group-update-group group t)))) | |
4123 | |
4124 (defun gnus-methods-equal-p (m1 m2) | |
4125 (let ((m1 (or m1 gnus-select-method)) | |
4126 (m2 (or m2 gnus-select-method))) | |
4127 (or (equal m1 m2) | |
4128 (and (eq (car m1) (car m2)) | |
4129 (or (not (memq 'address (assoc (symbol-name (car m1)) | |
4130 gnus-valid-select-methods))) | |
4131 (equal (nth 1 m1) (nth 1 m2))))))) | |
4132 | |
4133 (defvar gnus-newsgroup-none-id 0) | |
4134 | |
4135 (defun gnus-get-newsgroup-headers (&optional dependencies force-new) | |
4136 (let ((cur nntp-server-buffer) | |
4137 (dependencies | |
4138 (or dependencies | |
4139 (save-excursion (set-buffer gnus-summary-buffer) | |
4140 gnus-newsgroup-dependencies))) | |
4141 headers id id-dep ref-dep end ref) | |
4142 (save-excursion | |
4143 (set-buffer nntp-server-buffer) | |
4144 ;; Translate all TAB characters into SPACE characters. | |
4145 (subst-char-in-region (point-min) (point-max) ?\t ? t) | |
4146 (run-hooks 'gnus-parse-headers-hook) | |
4147 (let ((case-fold-search t) | |
4148 in-reply-to header p lines) | |
4149 (goto-char (point-min)) | |
4150 ;; Search to the beginning of the next header. Error messages | |
4151 ;; do not begin with 2 or 3. | |
4152 (while (re-search-forward "^[23][0-9]+ " nil t) | |
4153 (setq id nil | |
4154 ref nil) | |
4155 ;; This implementation of this function, with nine | |
4156 ;; search-forwards instead of the one re-search-forward and | |
4157 ;; a case (which basically was the old function) is actually | |
4158 ;; about twice as fast, even though it looks messier. You | |
4159 ;; can't have everything, I guess. Speed and elegance | |
4160 ;; doesn't always go hand in hand. | |
4161 (setq | |
4162 header | |
4163 (vector | |
4164 ;; Number. | |
4165 (prog1 | |
4166 (read cur) | |
4167 (end-of-line) | |
4168 (setq p (point)) | |
4169 (narrow-to-region (point) | |
4170 (or (and (search-forward "\n.\n" nil t) | |
4171 (- (point) 2)) | |
4172 (point)))) | |
4173 ;; Subject. | |
4174 (progn | |
4175 (goto-char p) | |
4176 (if (search-forward "\nsubject: " nil t) | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4177 ;; 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
|
4178 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4179 gnus-unstructured-field-decoder (nnheader-header-value)) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4180 "(none)")) |
17493 | 4181 ;; From. |
4182 (progn | |
4183 (goto-char p) | |
4184 (if (search-forward "\nfrom: " nil t) | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4185 ;; 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
|
4186 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4187 gnus-structured-field-decoder (nnheader-header-value)) |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4188 "(nobody)")) |
17493 | 4189 ;; Date. |
4190 (progn | |
4191 (goto-char p) | |
4192 (if (search-forward "\ndate: " nil t) | |
4193 (nnheader-header-value) "")) | |
4194 ;; Message-ID. | |
4195 (progn | |
4196 (goto-char p) | |
4197 (setq id (if (search-forward "\nmessage-id:" nil t) | |
4198 (buffer-substring | |
4199 (1- (or (search-forward "<" nil t) (point))) | |
4200 (or (search-forward ">" nil t) (point))) | |
4201 ;; If there was no message-id, we just fake one | |
4202 ;; to make subsequent routines simpler. | |
4203 (nnheader-generate-fake-message-id)))) | |
4204 ;; References. | |
4205 (progn | |
4206 (goto-char p) | |
4207 (if (search-forward "\nreferences: " nil t) | |
4208 (progn | |
4209 (setq end (point)) | |
4210 (prog1 | |
4211 (nnheader-header-value) | |
4212 (setq ref | |
4213 (buffer-substring | |
4214 (progn | |
4215 (end-of-line) | |
4216 (search-backward ">" end t) | |
4217 (1+ (point))) | |
4218 (progn | |
4219 (search-backward "<" end t) | |
4220 (point)))))) | |
4221 ;; Get the references from the in-reply-to header if there | |
4222 ;; were no references and the in-reply-to header looks | |
4223 ;; promising. | |
4224 (if (and (search-forward "\nin-reply-to: " nil t) | |
4225 (setq in-reply-to (nnheader-header-value)) | |
4226 (string-match "<[^>]+>" in-reply-to)) | |
4227 (setq ref (substring in-reply-to (match-beginning 0) | |
4228 (match-end 0))) | |
4229 (setq ref nil)))) | |
4230 ;; Chars. | |
4231 0 | |
4232 ;; Lines. | |
4233 (progn | |
4234 (goto-char p) | |
4235 (if (search-forward "\nlines: " nil t) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4236 (if (numberp (setq lines (ignore-errors (read cur)))) |
17493 | 4237 lines 0) |
4238 0)) | |
4239 ;; Xref. | |
4240 (progn | |
4241 (goto-char p) | |
4242 (and (search-forward "\nxref: " nil t) | |
4243 (nnheader-header-value))))) | |
4244 (when (equal id ref) | |
4245 (setq ref nil)) | |
4246 ;; We do the threading while we read the headers. The | |
4247 ;; message-id and the last reference are both entered into | |
4248 ;; the same hash table. Some tippy-toeing around has to be | |
4249 ;; done in case an article has arrived before the article | |
4250 ;; which it refers to. | |
4251 (if (boundp (setq id-dep (intern id dependencies))) | |
4252 (if (and (car (symbol-value id-dep)) | |
4253 (not force-new)) | |
4254 ;; An article with this Message-ID has already been seen. | |
4255 (if gnus-summary-ignore-duplicates | |
4256 ;; We ignore this one, except we add | |
4257 ;; any additional Xrefs (in case the two articles | |
4258 ;; came from different servers). | |
4259 (progn | |
4260 (mail-header-set-xref | |
4261 (car (symbol-value id-dep)) | |
4262 (concat (or (mail-header-xref | |
4263 (car (symbol-value id-dep))) | |
4264 "") | |
4265 (or (mail-header-xref header) ""))) | |
4266 (setq header nil)) | |
4267 ;; We rename the Message-ID. | |
4268 (set | |
4269 (setq id-dep (intern (setq id (nnmail-message-id)) | |
4270 dependencies)) | |
4271 (list header)) | |
4272 (mail-header-set-id header id)) | |
4273 (setcar (symbol-value id-dep) header)) | |
4274 (set id-dep (list header))) | |
4275 (when header | |
4276 (if (boundp (setq ref-dep (intern (or ref "none") dependencies))) | |
4277 (setcdr (symbol-value ref-dep) | |
4278 (nconc (cdr (symbol-value ref-dep)) | |
4279 (list (symbol-value id-dep)))) | |
4280 (set ref-dep (list nil (symbol-value id-dep)))) | |
4281 (push header headers)) | |
4282 (goto-char (point-max)) | |
4283 (widen)) | |
4284 (nreverse headers))))) | |
4285 | |
4286 ;; The following macros and functions were written by Felix Lee | |
4287 ;; <flee@cse.psu.edu>. | |
4288 | |
4289 (defmacro gnus-nov-read-integer () | |
4290 '(prog1 | |
4291 (if (= (following-char) ?\t) | |
4292 0 | |
4293 (let ((num (ignore-errors (read buffer)))) | |
4294 (if (numberp num) num 0))) | |
4295 (unless (eobp) | |
4296 (forward-char 1)))) | |
4297 | |
4298 (defmacro gnus-nov-skip-field () | |
4299 '(search-forward "\t" eol 'move)) | |
4300 | |
4301 (defmacro gnus-nov-field () | |
4302 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol))) | |
4303 | |
4304 ;; (defvar gnus-nov-none-counter 0) | |
4305 | |
4306 ;; This function has to be called with point after the article number | |
4307 ;; on the beginning of the line. | |
4308 (defun gnus-nov-parse-line (number dependencies &optional force-new) | |
4309 (let ((eol (gnus-point-at-eol)) | |
4310 (buffer (current-buffer)) | |
4311 header ref id id-dep ref-dep) | |
4312 | |
4313 ;; overview: [num subject from date id refs chars lines misc] | |
4314 (unwind-protect | |
4315 (progn | |
4316 (narrow-to-region (point) eol) | |
4317 (unless (eobp) | |
4318 (forward-char)) | |
4319 | |
4320 (setq header | |
4321 (vector | |
4322 number ; number | |
19594
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4323 ;; 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
|
4324 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4325 gnus-unstructured-field-decoder (gnus-nov-field)) ; subject |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4326 (funcall |
abfa7b46c7bd
(gnus-structured-field-decoder): New variable.
Kenichi Handa <handa@m17n.org>
parents:
19521
diff
changeset
|
4327 gnus-structured-field-decoder (gnus-nov-field)) ; from |
17493 | 4328 (gnus-nov-field) ; date |
4329 (setq id (or (gnus-nov-field) | |
4330 (nnheader-generate-fake-message-id))) ; id | |
4331 (progn | |
4332 (let ((beg (point))) | |
4333 (search-forward "\t" eol) | |
4334 (if (search-backward ">" beg t) | |
4335 (setq ref | |
4336 (buffer-substring | |
4337 (1+ (point)) | |
4338 (search-backward "<" beg t))) | |
4339 (setq ref nil)) | |
4340 (goto-char beg)) | |
4341 (gnus-nov-field)) ; refs | |
4342 (gnus-nov-read-integer) ; chars | |
4343 (gnus-nov-read-integer) ; lines | |
4344 (if (= (following-char) ?\n) | |
4345 nil | |
4346 (gnus-nov-field))))) ; misc | |
4347 | |
4348 (widen)) | |
4349 | |
4350 ;; We build the thread tree. | |
4351 (when (equal id ref) | |
4352 ;; This article refers back to itself. Naughty, naughty. | |
4353 (setq ref nil)) | |
4354 (if (boundp (setq id-dep (intern id dependencies))) | |
4355 (if (and (car (symbol-value id-dep)) | |
4356 (not force-new)) | |
4357 ;; An article with this Message-ID has already been seen. | |
4358 (if gnus-summary-ignore-duplicates | |
4359 ;; We ignore this one, except we add any additional | |
4360 ;; Xrefs (in case the two articles came from different | |
4361 ;; servers. | |
4362 (progn | |
4363 (mail-header-set-xref | |
4364 (car (symbol-value id-dep)) | |
4365 (concat (or (mail-header-xref | |
4366 (car (symbol-value id-dep))) | |
4367 "") | |
4368 (or (mail-header-xref header) ""))) | |
4369 (setq header nil)) | |
4370 ;; We rename the Message-ID. | |
4371 (set | |
4372 (setq id-dep (intern (setq id (nnmail-message-id)) | |
4373 dependencies)) | |
4374 (list header)) | |
4375 (mail-header-set-id header id)) | |
4376 (setcar (symbol-value id-dep) header)) | |
4377 (set id-dep (list header))) | |
4378 (when header | |
4379 (if (boundp (setq ref-dep (intern (or ref "none") dependencies))) | |
4380 (setcdr (symbol-value ref-dep) | |
4381 (nconc (cdr (symbol-value ref-dep)) | |
4382 (list (symbol-value id-dep)))) | |
4383 (set ref-dep (list nil (symbol-value id-dep))))) | |
4384 header)) | |
4385 | |
4386 ;; Goes through the xover lines and returns a list of vectors | |
4387 (defun gnus-get-newsgroup-headers-xover (sequence &optional | |
4388 force-new dependencies | |
4389 group also-fetch-heads) | |
4390 "Parse the news overview data in the server buffer, and return a | |
4391 list of headers that match SEQUENCE (see `nntp-retrieve-headers')." | |
4392 ;; Get the Xref when the users reads the articles since most/some | |
4393 ;; NNTP servers do not include Xrefs when using XOVER. | |
4394 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs)) | |
4395 (let ((cur nntp-server-buffer) | |
4396 (dependencies (or dependencies gnus-newsgroup-dependencies)) | |
4397 number headers header) | |
4398 (save-excursion | |
4399 (set-buffer nntp-server-buffer) | |
4400 ;; Allow the user to mangle the headers before parsing them. | |
4401 (run-hooks 'gnus-parse-headers-hook) | |
4402 (goto-char (point-min)) | |
4403 (while (not (eobp)) | |
4404 (condition-case () | |
4405 (while (and sequence (not (eobp))) | |
4406 (setq number (read cur)) | |
4407 (while (and sequence | |
4408 (< (car sequence) number)) | |
4409 (setq sequence (cdr sequence))) | |
4410 (and sequence | |
4411 (eq number (car sequence)) | |
4412 (progn | |
4413 (setq sequence (cdr sequence)) | |
4414 (setq header (inline | |
4415 (gnus-nov-parse-line | |
4416 number dependencies force-new)))) | |
4417 (push header headers)) | |
4418 (forward-line 1)) | |
4419 (error | |
4420 (gnus-error 4 "Strange nov line (%d)" | |
4421 (count-lines (point-min) (point))))) | |
4422 (forward-line 1)) | |
4423 ;; A common bug in inn is that if you have posted an article and | |
4424 ;; then retrieves the active file, it will answer correctly -- | |
4425 ;; the new article is included. However, a NOV entry for the | |
4426 ;; article may not have been generated yet, so this may fail. | |
4427 ;; We work around this problem by retrieving the last few | |
4428 ;; headers using HEAD. | |
4429 (if (or (not also-fetch-heads) | |
4430 (not sequence)) | |
4431 ;; We (probably) got all the headers. | |
4432 (nreverse headers) | |
4433 (let ((gnus-nov-is-evil t)) | |
4434 (nconc | |
4435 (nreverse headers) | |
4436 (when (gnus-retrieve-headers sequence group) | |
4437 (gnus-get-newsgroup-headers)))))))) | |
4438 | |
4439 (defun gnus-article-get-xrefs () | |
4440 "Fill in the Xref value in `gnus-current-headers', if necessary. | |
4441 This is meant to be called in `gnus-article-internal-prepare-hook'." | |
4442 (let ((headers (save-excursion (set-buffer gnus-summary-buffer) | |
4443 gnus-current-headers))) | |
4444 (or (not gnus-use-cross-reference) | |
4445 (not headers) | |
4446 (and (mail-header-xref headers) | |
4447 (not (string= (mail-header-xref headers) ""))) | |
4448 (let ((case-fold-search t) | |
4449 xref) | |
4450 (save-restriction | |
4451 (nnheader-narrow-to-headers) | |
4452 (goto-char (point-min)) | |
4453 (when (or (and (eq (downcase (following-char)) ?x) | |
4454 (looking-at "Xref:")) | |
4455 (search-forward "\nXref:" nil t)) | |
4456 (goto-char (1+ (match-end 0))) | |
4457 (setq xref (buffer-substring (point) | |
4458 (progn (end-of-line) (point)))) | |
4459 (mail-header-set-xref headers xref))))))) | |
4460 | |
4461 (defun gnus-summary-insert-subject (id &optional old-header use-old-header) | |
4462 "Find article ID and insert the summary line for that article." | |
4463 (let ((header (if (and old-header use-old-header) | |
4464 old-header (gnus-read-header id))) | |
4465 (number (and (numberp id) id)) | |
4466 pos d) | |
4467 (when header | |
4468 ;; Rebuild the thread that this article is part of and go to the | |
4469 ;; article we have fetched. | |
4470 (when (and (not gnus-show-threads) | |
4471 old-header) | |
4472 (when (setq d (gnus-data-find (mail-header-number old-header))) | |
4473 (goto-char (gnus-data-pos d)) | |
4474 (gnus-data-remove | |
4475 number | |
4476 (- (gnus-point-at-bol) | |
4477 (prog1 | |
4478 (1+ (gnus-point-at-eol)) | |
4479 (gnus-delete-line)))))) | |
4480 (when old-header | |
4481 (mail-header-set-number header (mail-header-number old-header))) | |
4482 (setq gnus-newsgroup-sparse | |
4483 (delq (setq number (mail-header-number header)) | |
4484 gnus-newsgroup-sparse)) | |
4485 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient)) | |
4486 (gnus-rebuild-thread (mail-header-id header)) | |
4487 (gnus-summary-goto-subject number nil t)) | |
4488 (when (and (numberp number) | |
4489 (> number 0)) | |
4490 ;; We have to update the boundaries even if we can't fetch the | |
4491 ;; article if ID is a number -- so that the next `P' or `N' | |
4492 ;; command will fetch the previous (or next) article even | |
4493 ;; if the one we tried to fetch this time has been canceled. | |
4494 (when (> number gnus-newsgroup-end) | |
4495 (setq gnus-newsgroup-end number)) | |
4496 (when (< number gnus-newsgroup-begin) | |
4497 (setq gnus-newsgroup-begin number)) | |
4498 (setq gnus-newsgroup-unselected | |
4499 (delq number gnus-newsgroup-unselected))) | |
4500 ;; Report back a success? | |
4501 (and header (mail-header-number header)))) | |
4502 | |
4503 ;;; Process/prefix in the summary buffer | |
4504 | |
4505 (defun gnus-summary-work-articles (n) | |
4506 "Return a list of articles to be worked upon. The prefix argument, | |
4507 the list of process marked articles, and the current article will be | |
4508 taken into consideration." | |
4509 (cond | |
4510 (n | |
4511 ;; A numerical prefix has been given. | |
4512 (setq n (prefix-numeric-value n)) | |
4513 (let ((backward (< n 0)) | |
4514 (n (abs (prefix-numeric-value n))) | |
4515 articles article) | |
4516 (save-excursion | |
4517 (while | |
4518 (and (> n 0) | |
4519 (push (setq article (gnus-summary-article-number)) | |
4520 articles) | |
4521 (if backward | |
4522 (gnus-summary-find-prev nil article) | |
4523 (gnus-summary-find-next nil article))) | |
4524 (decf n))) | |
4525 (nreverse articles))) | |
4526 ((gnus-region-active-p) | |
4527 ;; Work on the region between point and mark. | |
4528 (let ((max (max (point) (mark))) | |
4529 articles article) | |
4530 (save-excursion | |
4531 (goto-char (min (point) (mark))) | |
4532 (while | |
4533 (and | |
4534 (push (setq article (gnus-summary-article-number)) articles) | |
4535 (gnus-summary-find-next nil article) | |
4536 (< (point) max))) | |
4537 (nreverse articles)))) | |
4538 (gnus-newsgroup-processable | |
4539 ;; There are process-marked articles present. | |
4540 ;; Save current state. | |
4541 (gnus-summary-save-process-mark) | |
4542 ;; Return the list. | |
4543 (reverse gnus-newsgroup-processable)) | |
4544 (t | |
4545 ;; Just return the current article. | |
4546 (list (gnus-summary-article-number))))) | |
4547 | |
4548 (defun gnus-summary-save-process-mark () | |
4549 "Push the current set of process marked articles on the stack." | |
4550 (interactive) | |
4551 (push (copy-sequence gnus-newsgroup-processable) | |
4552 gnus-newsgroup-process-stack)) | |
4553 | |
4554 (defun gnus-summary-kill-process-mark () | |
4555 "Push the current set of process marked articles on the stack and unmark." | |
4556 (interactive) | |
4557 (gnus-summary-save-process-mark) | |
4558 (gnus-summary-unmark-all-processable)) | |
4559 | |
4560 (defun gnus-summary-yank-process-mark () | |
4561 "Pop the last process mark state off the stack and restore it." | |
4562 (interactive) | |
4563 (unless gnus-newsgroup-process-stack | |
4564 (error "Empty mark stack")) | |
4565 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack))) | |
4566 | |
4567 (defun gnus-summary-process-mark-set (set) | |
4568 "Make SET into the current process marked articles." | |
4569 (gnus-summary-unmark-all-processable) | |
4570 (while set | |
4571 (gnus-summary-set-process-mark (pop set)))) | |
4572 | |
4573 ;;; Searching and stuff | |
4574 | |
4575 (defun gnus-summary-search-group (&optional backward use-level) | |
4576 "Search for next unread newsgroup. | |
4577 If optional argument BACKWARD is non-nil, search backward instead." | |
4578 (save-excursion | |
4579 (set-buffer gnus-group-buffer) | |
4580 (when (gnus-group-search-forward | |
4581 backward nil (if use-level (gnus-group-group-level) nil)) | |
4582 (gnus-group-group-name)))) | |
4583 | |
4584 (defun gnus-summary-best-group (&optional exclude-group) | |
4585 "Find the name of the best unread group. | |
4586 If EXCLUDE-GROUP, do not go to this group." | |
4587 (save-excursion | |
4588 (set-buffer gnus-group-buffer) | |
4589 (save-excursion | |
4590 (gnus-group-best-unread-group exclude-group)))) | |
4591 | |
4592 (defun gnus-summary-find-next (&optional unread article backward) | |
4593 (if backward (gnus-summary-find-prev) | |
4594 (let* ((dummy (gnus-summary-article-intangible-p)) | |
4595 (article (or article (gnus-summary-article-number))) | |
4596 (arts (gnus-data-find-list article)) | |
4597 result) | |
4598 (when (and (not dummy) | |
4599 (or (not gnus-summary-check-current) | |
4600 (not unread) | |
4601 (not (gnus-data-unread-p (car arts))))) | |
4602 (setq arts (cdr arts))) | |
4603 (when (setq result | |
4604 (if unread | |
4605 (progn | |
4606 (while arts | |
4607 (when (gnus-data-unread-p (car arts)) | |
4608 (setq result (car arts) | |
4609 arts nil)) | |
4610 (setq arts (cdr arts))) | |
4611 result) | |
4612 (car arts))) | |
4613 (goto-char (gnus-data-pos result)) | |
4614 (gnus-data-number result))))) | |
4615 | |
4616 (defun gnus-summary-find-prev (&optional unread article) | |
4617 (let* ((eobp (eobp)) | |
4618 (article (or article (gnus-summary-article-number))) | |
4619 (arts (gnus-data-find-list article (gnus-data-list 'rev))) | |
4620 result) | |
4621 (when (and (not eobp) | |
4622 (or (not gnus-summary-check-current) | |
4623 (not unread) | |
4624 (not (gnus-data-unread-p (car arts))))) | |
4625 (setq arts (cdr arts))) | |
4626 (when (setq result | |
4627 (if unread | |
4628 (progn | |
4629 (while arts | |
4630 (when (gnus-data-unread-p (car arts)) | |
4631 (setq result (car arts) | |
4632 arts nil)) | |
4633 (setq arts (cdr arts))) | |
4634 result) | |
4635 (car arts))) | |
4636 (goto-char (gnus-data-pos result)) | |
4637 (gnus-data-number result)))) | |
4638 | |
4639 (defun gnus-summary-find-subject (subject &optional unread backward article) | |
4640 (let* ((simp-subject (gnus-simplify-subject-fully subject)) | |
4641 (article (or article (gnus-summary-article-number))) | |
4642 (articles (gnus-data-list backward)) | |
4643 (arts (gnus-data-find-list article articles)) | |
4644 result) | |
4645 (when (or (not gnus-summary-check-current) | |
4646 (not unread) | |
4647 (not (gnus-data-unread-p (car arts)))) | |
4648 (setq arts (cdr arts))) | |
4649 (while arts | |
4650 (and (or (not unread) | |
4651 (gnus-data-unread-p (car arts))) | |
4652 (vectorp (gnus-data-header (car arts))) | |
4653 (gnus-subject-equal | |
4654 simp-subject (mail-header-subject (gnus-data-header (car arts))) t) | |
4655 (setq result (car arts) | |
4656 arts nil)) | |
4657 (setq arts (cdr arts))) | |
4658 (and result | |
4659 (goto-char (gnus-data-pos result)) | |
4660 (gnus-data-number result)))) | |
4661 | |
4662 (defun gnus-summary-search-forward (&optional unread subject backward) | |
4663 "Search forward for an article. | |
4664 If UNREAD, look for unread articles. If SUBJECT, look for | |
4665 articles with that subject. If BACKWARD, search backward instead." | |
4666 (cond (subject (gnus-summary-find-subject subject unread backward)) | |
4667 (backward (gnus-summary-find-prev unread)) | |
4668 (t (gnus-summary-find-next unread)))) | |
4669 | |
4670 (defun gnus-recenter (&optional n) | |
4671 "Center point in window and redisplay frame. | |
4672 Also do horizontal recentering." | |
4673 (interactive "P") | |
4674 (when (and gnus-auto-center-summary | |
4675 (not (eq gnus-auto-center-summary 'vertical))) | |
4676 (gnus-horizontal-recenter)) | |
4677 (recenter n)) | |
4678 | |
4679 (defun gnus-summary-recenter () | |
4680 "Center point in the summary window. | |
4681 If `gnus-auto-center-summary' is nil, or the article buffer isn't | |
4682 displayed, no centering will be performed." | |
4683 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle). | |
4684 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu. | |
4685 (let* ((top (cond ((< (window-height) 4) 0) | |
4686 ((< (window-height) 7) 1) | |
4687 (t 2))) | |
4688 (height (1- (window-height))) | |
4689 (bottom (save-excursion (goto-char (point-max)) | |
4690 (forward-line (- height)) | |
4691 (point))) | |
4692 (window (get-buffer-window (current-buffer)))) | |
4693 ;; The user has to want it. | |
4694 (when gnus-auto-center-summary | |
4695 (when (get-buffer-window gnus-article-buffer) | |
4696 ;; Only do recentering when the article buffer is displayed, | |
4697 ;; Set the window start to either `bottom', which is the biggest | |
4698 ;; possible valid number, or the second line from the top, | |
4699 ;; whichever is the least. | |
4700 (set-window-start | |
4701 window (min bottom (save-excursion | |
4702 (forward-line (- top)) (point))))) | |
4703 ;; Do horizontal recentering while we're at it. | |
4704 (when (and (get-buffer-window (current-buffer) t) | |
4705 (not (eq gnus-auto-center-summary 'vertical))) | |
4706 (let ((selected (selected-window))) | |
4707 (select-window (get-buffer-window (current-buffer) t)) | |
4708 (gnus-summary-position-point) | |
4709 (gnus-horizontal-recenter) | |
4710 (select-window selected)))))) | |
4711 | |
4712 (defun gnus-summary-jump-to-group (newsgroup) | |
4713 "Move point to NEWSGROUP in group mode buffer." | |
4714 ;; Keep update point of group mode buffer if visible. | |
4715 (if (eq (current-buffer) (get-buffer gnus-group-buffer)) | |
4716 (save-window-excursion | |
4717 ;; Take care of tree window mode. | |
4718 (when (get-buffer-window gnus-group-buffer) | |
4719 (pop-to-buffer gnus-group-buffer)) | |
4720 (gnus-group-jump-to-group newsgroup)) | |
4721 (save-excursion | |
4722 ;; Take care of tree window mode. | |
4723 (if (get-buffer-window gnus-group-buffer) | |
4724 (pop-to-buffer gnus-group-buffer) | |
4725 (set-buffer gnus-group-buffer)) | |
4726 (gnus-group-jump-to-group newsgroup)))) | |
4727 | |
4728 ;; This function returns a list of article numbers based on the | |
4729 ;; difference between the ranges of read articles in this group and | |
4730 ;; the range of active articles. | |
4731 (defun gnus-list-of-unread-articles (group) | |
4732 (let* ((read (gnus-info-read (gnus-get-info group))) | |
4733 (active (or (gnus-active group) (gnus-activate-group group))) | |
4734 (last (cdr active)) | |
4735 first nlast unread) | |
4736 ;; If none are read, then all are unread. | |
4737 (if (not read) | |
4738 (setq first (car active)) | |
4739 ;; If the range of read articles is a single range, then the | |
4740 ;; first unread article is the article after the last read | |
4741 ;; article. Sounds logical, doesn't it? | |
4742 (if (not (listp (cdr read))) | |
4743 (setq first (1+ (cdr read))) | |
4744 ;; `read' is a list of ranges. | |
4745 (when (/= (setq nlast (or (and (numberp (car read)) (car read)) | |
4746 (caar read))) | |
4747 1) | |
4748 (setq first 1)) | |
4749 (while read | |
4750 (when first | |
4751 (while (< first nlast) | |
4752 (push first unread) | |
4753 (setq first (1+ first)))) | |
4754 (setq first (1+ (if (atom (car read)) (car read) (cdar read)))) | |
4755 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read))) | |
4756 (setq read (cdr read))))) | |
4757 ;; And add the last unread articles. | |
4758 (while (<= first last) | |
4759 (push first unread) | |
4760 (setq first (1+ first))) | |
4761 ;; Return the list of unread articles. | |
4762 (nreverse unread))) | |
4763 | |
4764 (defun gnus-list-of-read-articles (group) | |
4765 "Return a list of unread, unticked and non-dormant articles." | |
4766 (let* ((info (gnus-get-info group)) | |
4767 (marked (gnus-info-marks info)) | |
4768 (active (gnus-active group))) | |
4769 (and info active | |
4770 (gnus-set-difference | |
4771 (gnus-sorted-complement | |
4772 (gnus-uncompress-range active) | |
4773 (gnus-list-of-unread-articles group)) | |
4774 (append | |
4775 (gnus-uncompress-range (cdr (assq 'dormant marked))) | |
4776 (gnus-uncompress-range (cdr (assq 'tick marked)))))))) | |
4777 | |
4778 ;; Various summary commands | |
4779 | |
4780 (defun gnus-summary-universal-argument (arg) | |
4781 "Perform any operation on all articles that are process/prefixed." | |
4782 (interactive "P") | |
4783 (gnus-set-global-variables) | |
4784 (let ((articles (gnus-summary-work-articles arg)) | |
4785 func article) | |
4786 (if (eq | |
4787 (setq | |
4788 func | |
4789 (key-binding | |
4790 (read-key-sequence | |
4791 (substitute-command-keys | |
4792 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]" | |
4793 )))) | |
4794 'undefined) | |
4795 (gnus-error 1 "Undefined key") | |
4796 (save-excursion | |
4797 (while articles | |
4798 (gnus-summary-goto-subject (setq article (pop articles))) | |
4799 (let (gnus-newsgroup-processable) | |
4800 (command-execute func)) | |
4801 (gnus-summary-remove-process-mark article))))) | |
4802 (gnus-summary-position-point)) | |
4803 | |
4804 (defun gnus-summary-toggle-truncation (&optional arg) | |
4805 "Toggle truncation of summary lines. | |
4806 With arg, turn line truncation on iff arg is positive." | |
4807 (interactive "P") | |
4808 (setq truncate-lines | |
4809 (if (null arg) (not truncate-lines) | |
4810 (> (prefix-numeric-value arg) 0))) | |
4811 (redraw-display)) | |
4812 | |
4813 (defun gnus-summary-reselect-current-group (&optional all rescan) | |
4814 "Exit and then reselect the current newsgroup. | |
4815 The prefix argument ALL means to select all articles." | |
4816 (interactive "P") | |
4817 (gnus-set-global-variables) | |
4818 (when (gnus-ephemeral-group-p gnus-newsgroup-name) | |
4819 (error "Ephemeral groups can't be reselected")) | |
4820 (let ((current-subject (gnus-summary-article-number)) | |
4821 (group gnus-newsgroup-name)) | |
4822 (setq gnus-newsgroup-begin nil) | |
4823 (gnus-summary-exit) | |
4824 ;; We have to adjust the point of group mode buffer because | |
4825 ;; point was moved to the next unread newsgroup by exiting. | |
4826 (gnus-summary-jump-to-group group) | |
4827 (when rescan | |
4828 (save-excursion | |
4829 (gnus-group-get-new-news-this-group 1))) | |
4830 (gnus-group-read-group all t) | |
4831 (gnus-summary-goto-subject current-subject nil t))) | |
4832 | |
4833 (defun gnus-summary-rescan-group (&optional all) | |
4834 "Exit the newsgroup, ask for new articles, and select the newsgroup." | |
4835 (interactive "P") | |
4836 (gnus-summary-reselect-current-group all t)) | |
4837 | |
4838 (defun gnus-summary-update-info (&optional non-destructive) | |
4839 (save-excursion | |
4840 (let ((group gnus-newsgroup-name)) | |
4841 (when gnus-newsgroup-kill-headers | |
4842 (setq gnus-newsgroup-killed | |
4843 (gnus-compress-sequence | |
4844 (nconc | |
4845 (gnus-set-sorted-intersection | |
4846 (gnus-uncompress-range gnus-newsgroup-killed) | |
4847 (setq gnus-newsgroup-unselected | |
4848 (sort gnus-newsgroup-unselected '<))) | |
4849 (setq gnus-newsgroup-unreads | |
4850 (sort gnus-newsgroup-unreads '<))) | |
4851 t))) | |
4852 (unless (listp (cdr gnus-newsgroup-killed)) | |
4853 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed))) | |
4854 (let ((headers gnus-newsgroup-headers)) | |
4855 (when (and (not gnus-save-score) | |
4856 (not non-destructive)) | |
4857 (setq gnus-newsgroup-scored nil)) | |
4858 ;; Set the new ranges of read articles. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4859 (save-excursion |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4860 (set-buffer gnus-group-buffer) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4861 (gnus-undo-force-boundary)) |
17493 | 4862 (gnus-update-read-articles |
4863 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected)) | |
4864 ;; Set the current article marks. | |
4865 (gnus-update-marks) | |
4866 ;; Do the cross-ref thing. | |
4867 (when gnus-use-cross-reference | |
4868 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads)) | |
4869 ;; Do adaptive scoring, and possibly save score files. | |
4870 (when gnus-newsgroup-adaptive | |
4871 (gnus-score-adaptive)) | |
4872 (when gnus-use-scoring | |
4873 (gnus-score-save)) | |
4874 ;; Do not switch windows but change the buffer to work. | |
4875 (set-buffer gnus-group-buffer) | |
4876 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
4877 (gnus-group-update-group group)))))) | |
4878 | |
4879 (defun gnus-summary-save-newsrc (&optional force) | |
4880 "Save the current number of read/marked articles in the dribble buffer. | |
4881 The dribble buffer will then be saved. | |
4882 If FORCE (the prefix), also save the .newsrc file(s)." | |
4883 (interactive "P") | |
4884 (gnus-summary-update-info t) | |
4885 (if force | |
4886 (gnus-save-newsrc-file) | |
4887 (gnus-dribble-save))) | |
4888 | |
4889 (defun gnus-summary-exit (&optional temporary) | |
4890 "Exit reading current newsgroup, and then return to group selection mode. | |
4891 gnus-exit-group-hook is called with no arguments if that value is non-nil." | |
4892 (interactive) | |
4893 (gnus-set-global-variables) | |
4894 (gnus-kill-save-kill-buffer) | |
4895 (let* ((group gnus-newsgroup-name) | |
4896 (quit-config (gnus-group-quit-config gnus-newsgroup-name)) | |
4897 (mode major-mode) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4898 (group-point nil) |
17493 | 4899 (buf (current-buffer))) |
4900 (run-hooks 'gnus-summary-prepare-exit-hook) | |
4901 ;; If we have several article buffers, we kill them at exit. | |
4902 (unless gnus-single-article-buffer | |
4903 (gnus-kill-buffer gnus-original-article-buffer) | |
4904 (setq gnus-article-current nil)) | |
4905 (when gnus-use-cache | |
4906 (gnus-cache-possibly-remove-articles) | |
4907 (gnus-cache-save-buffers)) | |
4908 (gnus-async-prefetch-remove-group group) | |
4909 (when gnus-suppress-duplicates | |
4910 (gnus-dup-enter-articles)) | |
4911 (when gnus-use-trees | |
4912 (gnus-tree-close group)) | |
4913 ;; Make all changes in this group permanent. | |
4914 (unless quit-config | |
4915 (run-hooks 'gnus-exit-group-hook) | |
4916 (gnus-summary-update-info)) | |
4917 (gnus-close-group group) | |
4918 ;; Make sure where we were, and go to next newsgroup. | |
4919 (set-buffer gnus-group-buffer) | |
4920 (unless quit-config | |
4921 (gnus-group-jump-to-group group)) | |
4922 (run-hooks 'gnus-summary-exit-hook) | |
4923 (unless quit-config | |
4924 (gnus-group-next-unread-group 1)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4925 (setq group-point (point)) |
17493 | 4926 (if temporary |
4927 nil ;Nothing to do. | |
4928 ;; If we have several article buffers, we kill them at exit. | |
4929 (unless gnus-single-article-buffer | |
4930 (gnus-kill-buffer gnus-article-buffer) | |
4931 (gnus-kill-buffer gnus-original-article-buffer) | |
4932 (setq gnus-article-current nil)) | |
4933 (set-buffer buf) | |
4934 (if (not gnus-kill-summary-on-exit) | |
4935 (gnus-deaden-summary) | |
4936 ;; We set all buffer-local variables to nil. It is unclear why | |
4937 ;; this is needed, but if we don't, buffer-local variables are | |
4938 ;; not garbage-collected, it seems. This would the lead to en | |
4939 ;; ever-growing Emacs. | |
4940 (gnus-summary-clear-local-variables) | |
4941 (when (get-buffer gnus-article-buffer) | |
4942 (bury-buffer gnus-article-buffer)) | |
4943 ;; We clear the global counterparts of the buffer-local | |
4944 ;; variables as well, just to be on the safe side. | |
4945 (set-buffer gnus-group-buffer) | |
4946 (gnus-summary-clear-local-variables) | |
4947 ;; Return to group mode buffer. | |
4948 (when (eq mode 'gnus-summary-mode) | |
4949 (gnus-kill-buffer buf))) | |
4950 (setq gnus-current-select-method gnus-select-method) | |
4951 (pop-to-buffer gnus-group-buffer) | |
4952 ;; Clear the current group name. | |
4953 (if (not quit-config) | |
4954 (progn | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
4955 (goto-char group-point) |
17493 | 4956 (gnus-configure-windows 'group 'force)) |
4957 (gnus-handle-ephemeral-exit quit-config)) | |
4958 (unless quit-config | |
4959 (setq gnus-newsgroup-name nil))))) | |
4960 | |
4961 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update) | |
4962 (defun gnus-summary-exit-no-update (&optional no-questions) | |
4963 "Quit reading current newsgroup without updating read article info." | |
4964 (interactive) | |
4965 (gnus-set-global-variables) | |
4966 (let* ((group gnus-newsgroup-name) | |
4967 (quit-config (gnus-group-quit-config group))) | |
4968 (when (or no-questions | |
4969 gnus-expert-user | |
4970 (gnus-y-or-n-p "Discard changes to this group and exit? ")) | |
4971 ;; If we have several article buffers, we kill them at exit. | |
4972 (unless gnus-single-article-buffer | |
4973 (gnus-kill-buffer gnus-article-buffer) | |
4974 (gnus-kill-buffer gnus-original-article-buffer) | |
4975 (setq gnus-article-current nil)) | |
4976 (if (not gnus-kill-summary-on-exit) | |
4977 (gnus-deaden-summary) | |
4978 (gnus-close-group group) | |
4979 (gnus-summary-clear-local-variables) | |
4980 (set-buffer gnus-group-buffer) | |
4981 (gnus-summary-clear-local-variables) | |
4982 (when (get-buffer gnus-summary-buffer) | |
4983 (kill-buffer gnus-summary-buffer))) | |
4984 (unless gnus-single-article-buffer | |
4985 (setq gnus-article-current nil)) | |
4986 (when gnus-use-trees | |
4987 (gnus-tree-close group)) | |
4988 (gnus-async-prefetch-remove-group group) | |
4989 (when (get-buffer gnus-article-buffer) | |
4990 (bury-buffer gnus-article-buffer)) | |
4991 ;; Return to the group buffer. | |
4992 (gnus-configure-windows 'group 'force) | |
4993 ;; Clear the current group name. | |
4994 (setq gnus-newsgroup-name nil) | |
4995 (when (equal (gnus-group-group-name) group) | |
4996 (gnus-group-next-unread-group 1)) | |
4997 (when quit-config | |
4998 (gnus-handle-ephemeral-exit quit-config))))) | |
4999 | |
5000 (defun gnus-handle-ephemeral-exit (quit-config) | |
5001 "Handle movement when leaving an ephemeral group. The state | |
5002 which existed when entering the ephemeral is reset." | |
5003 (if (not (buffer-name (car quit-config))) | |
5004 (gnus-configure-windows 'group 'force) | |
5005 (set-buffer (car quit-config)) | |
5006 (cond ((eq major-mode 'gnus-summary-mode) | |
5007 (gnus-set-global-variables)) | |
5008 ((eq major-mode 'gnus-article-mode) | |
5009 (save-excursion | |
5010 ;; The `gnus-summary-buffer' variable may point | |
5011 ;; to the old summary buffer when using a single | |
5012 ;; article buffer. | |
5013 (unless (gnus-buffer-live-p gnus-summary-buffer) | |
5014 (set-buffer gnus-group-buffer)) | |
5015 (set-buffer gnus-summary-buffer) | |
5016 (gnus-set-global-variables)))) | |
5017 (if (or (eq (cdr quit-config) 'article) | |
5018 (eq (cdr quit-config) 'pick)) | |
5019 (progn | |
5020 ;; The current article may be from the ephemeral group | |
5021 ;; thus it is best that we reload this article | |
5022 (gnus-summary-show-article) | |
5023 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode)) | |
5024 (gnus-configure-windows 'pick 'force) | |
5025 (gnus-configure-windows (cdr quit-config) 'force))) | |
5026 (gnus-configure-windows (cdr quit-config) 'force)) | |
5027 (when (eq major-mode 'gnus-summary-mode) | |
5028 (gnus-summary-next-subject 1 nil t) | |
5029 (gnus-summary-recenter) | |
5030 (gnus-summary-position-point)))) | |
5031 | |
5032 ;;; Dead summaries. | |
5033 | |
5034 (defvar gnus-dead-summary-mode-map nil) | |
5035 | |
5036 (unless gnus-dead-summary-mode-map | |
5037 (setq gnus-dead-summary-mode-map (make-keymap)) | |
5038 (suppress-keymap gnus-dead-summary-mode-map) | |
5039 (substitute-key-definition | |
5040 '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
|
5041 (let ((keys '("\C-d" "\r" "\177" [delete]))) |
17493 | 5042 (while keys |
5043 (define-key gnus-dead-summary-mode-map | |
5044 (pop keys) 'gnus-summary-wake-up-the-dead)))) | |
5045 | |
5046 (defvar gnus-dead-summary-mode nil | |
5047 "Minor mode for Gnus summary buffers.") | |
5048 | |
5049 (defun gnus-dead-summary-mode (&optional arg) | |
5050 "Minor mode for Gnus summary buffers." | |
5051 (interactive "P") | |
5052 (when (eq major-mode 'gnus-summary-mode) | |
5053 (make-local-variable 'gnus-dead-summary-mode) | |
5054 (setq gnus-dead-summary-mode | |
5055 (if (null arg) (not gnus-dead-summary-mode) | |
5056 (> (prefix-numeric-value arg) 0))) | |
5057 (when gnus-dead-summary-mode | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5058 (gnus-add-minor-mode |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5059 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map)))) |
17493 | 5060 |
5061 (defun gnus-deaden-summary () | |
5062 "Make the current summary buffer into a dead summary buffer." | |
5063 ;; Kill any previous dead summary buffer. | |
5064 (when (and gnus-dead-summary | |
5065 (buffer-name gnus-dead-summary)) | |
5066 (save-excursion | |
5067 (set-buffer gnus-dead-summary) | |
5068 (when gnus-dead-summary-mode | |
5069 (kill-buffer (current-buffer))))) | |
5070 ;; Make this the current dead summary. | |
5071 (setq gnus-dead-summary (current-buffer)) | |
5072 (gnus-dead-summary-mode 1) | |
5073 (let ((name (buffer-name))) | |
5074 (when (string-match "Summary" name) | |
5075 (rename-buffer | |
5076 (concat (substring name 0 (match-beginning 0)) "Dead " | |
5077 (substring name (match-beginning 0))) | |
5078 t)))) | |
5079 | |
5080 (defun gnus-kill-or-deaden-summary (buffer) | |
5081 "Kill or deaden the summary BUFFER." | |
5082 (when (and (buffer-name buffer) | |
5083 (not gnus-single-article-buffer)) | |
5084 (save-excursion | |
5085 (set-buffer buffer) | |
5086 (gnus-kill-buffer gnus-article-buffer) | |
5087 (gnus-kill-buffer gnus-original-article-buffer))) | |
5088 (cond (gnus-kill-summary-on-exit | |
5089 (when (and gnus-use-trees | |
5090 (and (get-buffer buffer) | |
5091 (buffer-name (get-buffer buffer)))) | |
5092 (save-excursion | |
5093 (set-buffer (get-buffer buffer)) | |
5094 (gnus-tree-close gnus-newsgroup-name))) | |
5095 (gnus-kill-buffer buffer)) | |
5096 ((and (get-buffer buffer) | |
5097 (buffer-name (get-buffer buffer))) | |
5098 (save-excursion | |
5099 (set-buffer buffer) | |
5100 (gnus-deaden-summary))))) | |
5101 | |
5102 (defun gnus-summary-wake-up-the-dead (&rest args) | |
5103 "Wake up the dead summary buffer." | |
5104 (interactive) | |
5105 (gnus-dead-summary-mode -1) | |
5106 (let ((name (buffer-name))) | |
5107 (when (string-match "Dead " name) | |
5108 (rename-buffer | |
5109 (concat (substring name 0 (match-beginning 0)) | |
5110 (substring name (match-end 0))) | |
5111 t))) | |
5112 (gnus-message 3 "This dead summary is now alive again")) | |
5113 | |
5114 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>. | |
5115 (defun gnus-summary-fetch-faq (&optional faq-dir) | |
5116 "Fetch the FAQ for the current group. | |
5117 If FAQ-DIR (the prefix), prompt for a directory to search for the faq | |
5118 in." | |
5119 (interactive | |
5120 (list | |
5121 (when current-prefix-arg | |
5122 (completing-read | |
5123 "Faq dir: " (and (listp gnus-group-faq-directory) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5124 (mapcar (lambda (file) (list file)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5125 gnus-group-faq-directory)))))) |
17493 | 5126 (let (gnus-faq-buffer) |
5127 (when (setq gnus-faq-buffer | |
5128 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir)) | |
5129 (gnus-configure-windows 'summary-faq)))) | |
5130 | |
5131 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>. | |
5132 (defun gnus-summary-describe-group (&optional force) | |
5133 "Describe the current newsgroup." | |
5134 (interactive "P") | |
5135 (gnus-group-describe-group force gnus-newsgroup-name)) | |
5136 | |
5137 (defun gnus-summary-describe-briefly () | |
5138 "Describe summary mode commands briefly." | |
5139 (interactive) | |
5140 (gnus-message 6 | |
5141 (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"))) | |
5142 | |
5143 ;; Walking around group mode buffer from summary mode. | |
5144 | |
5145 (defun gnus-summary-next-group (&optional no-article target-group backward) | |
5146 "Exit current newsgroup and then select next unread newsgroup. | |
5147 If prefix argument NO-ARTICLE is non-nil, no article is selected | |
5148 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to | |
5149 previous group instead." | |
5150 (interactive "P") | |
5151 (gnus-set-global-variables) | |
5152 ;; Stop pre-fetching. | |
5153 (gnus-async-halt-prefetch) | |
5154 (let ((current-group gnus-newsgroup-name) | |
5155 (current-buffer (current-buffer)) | |
5156 entered) | |
5157 ;; First we semi-exit this group to update Xrefs and all variables. | |
5158 ;; We can't do a real exit, because the window conf must remain | |
5159 ;; the same in case the user is prompted for info, and we don't | |
5160 ;; want the window conf to change before that... | |
5161 (gnus-summary-exit t) | |
5162 (while (not entered) | |
5163 ;; Then we find what group we are supposed to enter. | |
5164 (set-buffer gnus-group-buffer) | |
5165 (gnus-group-jump-to-group current-group) | |
5166 (setq target-group | |
5167 (or target-group | |
5168 (if (eq gnus-keep-same-level 'best) | |
5169 (gnus-summary-best-group gnus-newsgroup-name) | |
5170 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5171 (if (not target-group) | |
5172 ;; There are no further groups, so we return to the group | |
5173 ;; buffer. | |
5174 (progn | |
5175 (gnus-message 5 "Returning to the group buffer") | |
5176 (setq entered t) | |
5177 (when (gnus-buffer-live-p current-buffer) | |
5178 (set-buffer current-buffer) | |
5179 (gnus-summary-exit)) | |
5180 (run-hooks 'gnus-group-no-more-groups-hook)) | |
5181 ;; We try to enter the target group. | |
5182 (gnus-group-jump-to-group target-group) | |
5183 (let ((unreads (gnus-group-group-unread))) | |
5184 (if (and (or (eq t unreads) | |
5185 (and unreads (not (zerop unreads)))) | |
5186 (gnus-summary-read-group | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5187 target-group nil no-article |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5188 (and (buffer-name current-buffer) current-buffer))) |
17493 | 5189 (setq entered t) |
5190 (setq current-group target-group | |
5191 target-group nil))))))) | |
5192 | |
5193 (defun gnus-summary-prev-group (&optional no-article) | |
5194 "Exit current newsgroup and then select previous unread newsgroup. | |
5195 If prefix argument NO-ARTICLE is non-nil, no article is selected initially." | |
5196 (interactive "P") | |
5197 (gnus-summary-next-group no-article nil t)) | |
5198 | |
5199 ;; Walking around summary lines. | |
5200 | |
5201 (defun gnus-summary-first-subject (&optional unread) | |
5202 "Go to the first unread subject. | |
5203 If UNREAD is non-nil, go to the first unread article. | |
5204 Returns the article selected or nil if there are no unread articles." | |
5205 (interactive "P") | |
5206 (prog1 | |
5207 (cond | |
5208 ;; Empty summary. | |
5209 ((null gnus-newsgroup-data) | |
5210 (gnus-message 3 "No articles in the group") | |
5211 nil) | |
5212 ;; Pick the first article. | |
5213 ((not unread) | |
5214 (goto-char (gnus-data-pos (car gnus-newsgroup-data))) | |
5215 (gnus-data-number (car gnus-newsgroup-data))) | |
5216 ;; No unread articles. | |
5217 ((null gnus-newsgroup-unreads) | |
5218 (gnus-message 3 "No more unread articles") | |
5219 nil) | |
5220 ;; Find the first unread article. | |
5221 (t | |
5222 (let ((data gnus-newsgroup-data)) | |
5223 (while (and data | |
5224 (not (gnus-data-unread-p (car data)))) | |
5225 (setq data (cdr data))) | |
5226 (when data | |
5227 (goto-char (gnus-data-pos (car data))) | |
5228 (gnus-data-number (car data)))))) | |
5229 (gnus-summary-position-point))) | |
5230 | |
5231 (defun gnus-summary-next-subject (n &optional unread dont-display) | |
5232 "Go to next N'th summary line. | |
5233 If N is negative, go to the previous N'th subject line. | |
5234 If UNREAD is non-nil, only unread articles are selected. | |
5235 The difference between N and the actual number of steps taken is | |
5236 returned." | |
5237 (interactive "p") | |
5238 (let ((backward (< n 0)) | |
5239 (n (abs n))) | |
5240 (while (and (> n 0) | |
5241 (if backward | |
5242 (gnus-summary-find-prev unread) | |
5243 (gnus-summary-find-next unread))) | |
5244 (setq n (1- n))) | |
5245 (when (/= 0 n) | |
5246 (gnus-message 7 "No more%s articles" | |
5247 (if unread " unread" ""))) | |
5248 (unless dont-display | |
5249 (gnus-summary-recenter) | |
5250 (gnus-summary-position-point)) | |
5251 n)) | |
5252 | |
5253 (defun gnus-summary-next-unread-subject (n) | |
5254 "Go to next N'th unread summary line." | |
5255 (interactive "p") | |
5256 (gnus-summary-next-subject n t)) | |
5257 | |
5258 (defun gnus-summary-prev-subject (n &optional unread) | |
5259 "Go to previous N'th summary line. | |
5260 If optional argument UNREAD is non-nil, only unread article is selected." | |
5261 (interactive "p") | |
5262 (gnus-summary-next-subject (- n) unread)) | |
5263 | |
5264 (defun gnus-summary-prev-unread-subject (n) | |
5265 "Go to previous N'th unread summary line." | |
5266 (interactive "p") | |
5267 (gnus-summary-next-subject (- n) t)) | |
5268 | |
5269 (defun gnus-summary-goto-subject (article &optional force silent) | |
5270 "Go the subject line of ARTICLE. | |
5271 If FORCE, also allow jumping to articles not currently shown." | |
5272 (interactive "nArticle number: ") | |
5273 (let ((b (point)) | |
5274 (data (gnus-data-find article))) | |
5275 ;; We read in the article if we have to. | |
5276 (and (not data) | |
5277 force | |
5278 (gnus-summary-insert-subject article (and (vectorp force) force) t) | |
5279 (setq data (gnus-data-find article))) | |
5280 (goto-char b) | |
5281 (if (not data) | |
5282 (progn | |
5283 (unless silent | |
5284 (gnus-message 3 "Can't find article %d" article)) | |
5285 nil) | |
5286 (goto-char (gnus-data-pos data)) | |
5287 article))) | |
5288 | |
5289 ;; Walking around summary lines with displaying articles. | |
5290 | |
5291 (defun gnus-summary-expand-window (&optional arg) | |
5292 "Make the summary buffer take up the entire Emacs frame. | |
5293 Given a prefix, will force an `article' buffer configuration." | |
5294 (interactive "P") | |
5295 (gnus-set-global-variables) | |
5296 (if arg | |
5297 (gnus-configure-windows 'article 'force) | |
5298 (gnus-configure-windows 'summary 'force))) | |
5299 | |
5300 (defun gnus-summary-display-article (article &optional all-header) | |
5301 "Display ARTICLE in article buffer." | |
5302 (gnus-set-global-variables) | |
5303 (if (null article) | |
5304 nil | |
5305 (prog1 | |
5306 (if gnus-summary-display-article-function | |
5307 (funcall gnus-summary-display-article-function article all-header) | |
5308 (gnus-article-prepare article all-header)) | |
5309 (run-hooks 'gnus-select-article-hook) | |
5310 (when (and gnus-current-article | |
5311 (not (zerop gnus-current-article))) | |
5312 (gnus-summary-goto-subject gnus-current-article)) | |
5313 (gnus-summary-recenter) | |
5314 (when (and gnus-use-trees gnus-show-threads) | |
5315 (gnus-possibly-generate-tree article) | |
5316 (gnus-highlight-selected-tree article)) | |
5317 ;; Successfully display article. | |
5318 (gnus-article-set-window-start | |
5319 (cdr (assq article gnus-newsgroup-bookmarks)))))) | |
5320 | |
5321 (defun gnus-summary-select-article (&optional all-headers force pseudo article) | |
5322 "Select the current article. | |
5323 If ALL-HEADERS is non-nil, show all header fields. If FORCE is | |
5324 non-nil, the article will be re-fetched even if it already present in | |
5325 the article buffer. If PSEUDO is non-nil, pseudo-articles will also | |
5326 be displayed." | |
5327 ;; Make sure we are in the summary buffer to work around bbdb bug. | |
5328 (unless (eq major-mode 'gnus-summary-mode) | |
5329 (set-buffer gnus-summary-buffer)) | |
5330 (let ((article (or article (gnus-summary-article-number))) | |
5331 (all-headers (not (not all-headers))) ;Must be T or NIL. | |
5332 gnus-summary-display-article-function | |
5333 did) | |
5334 (and (not pseudo) | |
5335 (gnus-summary-article-pseudo-p article) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5336 (error "This is a pseudo-article")) |
17493 | 5337 (prog1 |
5338 (save-excursion | |
5339 (set-buffer gnus-summary-buffer) | |
5340 (if (or (and gnus-single-article-buffer | |
5341 (or (null gnus-current-article) | |
5342 (null gnus-article-current) | |
5343 (null (get-buffer gnus-article-buffer)) | |
5344 (not (eq article (cdr gnus-article-current))) | |
5345 (not (equal (car gnus-article-current) | |
5346 gnus-newsgroup-name)))) | |
5347 (and (not gnus-single-article-buffer) | |
5348 (or (null gnus-current-article) | |
5349 (not (eq gnus-current-article article)))) | |
5350 force) | |
5351 ;; The requested article is different from the current article. | |
5352 (prog1 | |
5353 (gnus-summary-display-article article all-headers) | |
5354 (setq did article)) | |
5355 (when (or all-headers gnus-show-all-headers) | |
5356 (gnus-article-show-all-headers)) | |
5357 'old)) | |
5358 (when did | |
5359 (gnus-article-set-window-start | |
5360 (cdr (assq article gnus-newsgroup-bookmarks))))))) | |
5361 | |
5362 (defun gnus-summary-set-current-mark (&optional current-mark) | |
5363 "Obsolete function." | |
5364 nil) | |
5365 | |
5366 (defun gnus-summary-next-article (&optional unread subject backward push) | |
5367 "Select the next article. | |
5368 If UNREAD, only unread articles are selected. | |
5369 If SUBJECT, only articles with SUBJECT are selected. | |
5370 If BACKWARD, the previous article is selected instead of the next." | |
5371 (interactive "P") | |
5372 (gnus-set-global-variables) | |
5373 (cond | |
5374 ;; Is there such an article? | |
5375 ((and (gnus-summary-search-forward unread subject backward) | |
5376 (or (gnus-summary-display-article (gnus-summary-article-number)) | |
5377 (eq (gnus-summary-article-mark) gnus-canceled-mark))) | |
5378 (gnus-summary-position-point)) | |
5379 ;; If not, we try the first unread, if that is wanted. | |
5380 ((and subject | |
5381 gnus-auto-select-same | |
5382 (gnus-summary-first-unread-article)) | |
5383 (gnus-summary-position-point) | |
5384 (gnus-message 6 "Wrapped")) | |
5385 ;; Try to get next/previous article not displayed in this group. | |
5386 ((and gnus-auto-extend-newsgroup | |
5387 (not unread) (not subject)) | |
5388 (gnus-summary-goto-article | |
5389 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end)) | |
5390 nil t)) | |
5391 ;; Go to next/previous group. | |
5392 (t | |
5393 (unless (gnus-ephemeral-group-p gnus-newsgroup-name) | |
5394 (gnus-summary-jump-to-group gnus-newsgroup-name)) | |
5395 (let ((cmd last-command-char) | |
5396 (point | |
5397 (save-excursion | |
5398 (set-buffer gnus-group-buffer) | |
5399 (point))) | |
5400 (group | |
5401 (if (eq gnus-keep-same-level 'best) | |
5402 (gnus-summary-best-group gnus-newsgroup-name) | |
5403 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5404 ;; For some reason, the group window gets selected. We change | |
5405 ;; it back. | |
5406 (select-window (get-buffer-window (current-buffer))) | |
5407 ;; Select next unread newsgroup automagically. | |
5408 (cond | |
5409 ((or (not gnus-auto-select-next) | |
5410 (not cmd)) | |
5411 (gnus-message 7 "No more%s articles" (if unread " unread" ""))) | |
5412 ((or (eq gnus-auto-select-next 'quietly) | |
5413 (and (eq gnus-auto-select-next 'slightly-quietly) | |
5414 push) | |
5415 (and (eq gnus-auto-select-next 'almost-quietly) | |
5416 (gnus-summary-last-article-p))) | |
5417 ;; Select quietly. | |
5418 (if (gnus-ephemeral-group-p gnus-newsgroup-name) | |
5419 (gnus-summary-exit) | |
5420 (gnus-message 7 "No more%s articles (%s)..." | |
5421 (if unread " unread" "") | |
5422 (if group (concat "selecting " group) | |
5423 "exiting")) | |
5424 (gnus-summary-next-group nil group backward))) | |
5425 (t | |
5426 (when (gnus-key-press-event-p last-input-event) | |
5427 (gnus-summary-walk-group-buffer | |
5428 gnus-newsgroup-name cmd unread backward point)))))))) | |
5429 | |
5430 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start) | |
5431 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1)) | |
5432 (?\C-p (gnus-group-prev-unread-group 1)))) | |
5433 (cursor-in-echo-area t) | |
5434 keve key group ended) | |
5435 (save-excursion | |
5436 (set-buffer gnus-group-buffer) | |
5437 (goto-char start) | |
5438 (setq group | |
5439 (if (eq gnus-keep-same-level 'best) | |
5440 (gnus-summary-best-group gnus-newsgroup-name) | |
5441 (gnus-summary-search-group backward gnus-keep-same-level)))) | |
5442 (while (not ended) | |
5443 (gnus-message | |
5444 5 "No more%s articles%s" (if unread " unread" "") | |
5445 (if (and group | |
5446 (not (gnus-ephemeral-group-p gnus-newsgroup-name))) | |
5447 (format " (Type %s for %s [%s])" | |
5448 (single-key-description cmd) group | |
5449 (car (gnus-gethash group gnus-newsrc-hashtb))) | |
5450 (format " (Type %s to exit %s)" | |
5451 (single-key-description cmd) | |
5452 gnus-newsgroup-name))) | |
5453 ;; Confirm auto selection. | |
5454 (setq key (car (setq keve (gnus-read-event-char)))) | |
5455 (setq ended t) | |
5456 (cond | |
5457 ((assq key keystrokes) | |
5458 (let ((obuf (current-buffer))) | |
5459 (switch-to-buffer gnus-group-buffer) | |
5460 (when group | |
5461 (gnus-group-jump-to-group group)) | |
5462 (eval (cadr (assq key keystrokes))) | |
5463 (setq group (gnus-group-group-name)) | |
5464 (switch-to-buffer obuf)) | |
5465 (setq ended nil)) | |
5466 ((equal key cmd) | |
5467 (if (or (not group) | |
5468 (gnus-ephemeral-group-p gnus-newsgroup-name)) | |
5469 (gnus-summary-exit) | |
5470 (gnus-summary-next-group nil group backward))) | |
5471 (t | |
5472 (push (cdr keve) unread-command-events)))))) | |
5473 | |
5474 (defun gnus-summary-next-unread-article () | |
5475 "Select unread article after current one." | |
5476 (interactive) | |
5477 (gnus-summary-next-article | |
5478 (or (not (eq gnus-summary-goto-unread 'never)) | |
5479 (gnus-summary-last-article-p (gnus-summary-article-number))) | |
5480 (and gnus-auto-select-same | |
5481 (gnus-summary-article-subject)))) | |
5482 | |
5483 (defun gnus-summary-prev-article (&optional unread subject) | |
5484 "Select the article after the current one. | |
5485 If UNREAD is non-nil, only unread articles are selected." | |
5486 (interactive "P") | |
5487 (gnus-summary-next-article unread subject t)) | |
5488 | |
5489 (defun gnus-summary-prev-unread-article () | |
5490 "Select unread article before current one." | |
5491 (interactive) | |
5492 (gnus-summary-prev-article | |
5493 (or (not (eq gnus-summary-goto-unread 'never)) | |
5494 (gnus-summary-first-article-p (gnus-summary-article-number))) | |
5495 (and gnus-auto-select-same | |
5496 (gnus-summary-article-subject)))) | |
5497 | |
5498 (defun gnus-summary-next-page (&optional lines circular) | |
5499 "Show next page of the selected article. | |
5500 If at the end of the current article, select the next article. | |
5501 LINES says how many lines should be scrolled up. | |
5502 | |
5503 If CIRCULAR is non-nil, go to the start of the article instead of | |
5504 selecting the next article when reaching the end of the current | |
5505 article." | |
5506 (interactive "P") | |
5507 (setq gnus-summary-buffer (current-buffer)) | |
5508 (gnus-set-global-variables) | |
5509 (let ((article (gnus-summary-article-number)) | |
5510 (article-window (get-buffer-window gnus-article-buffer t)) | |
5511 endp) | |
5512 (gnus-configure-windows 'article) | |
5513 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark) | |
5514 (if (and (eq gnus-summary-goto-unread 'never) | |
5515 (not (gnus-summary-last-article-p article))) | |
5516 (gnus-summary-next-article) | |
5517 (gnus-summary-next-unread-article)) | |
5518 (if (or (null gnus-current-article) | |
5519 (null gnus-article-current) | |
5520 (/= article (cdr gnus-article-current)) | |
5521 (not (equal (car gnus-article-current) gnus-newsgroup-name))) | |
5522 ;; Selected subject is different from current article's. | |
5523 (gnus-summary-display-article article) | |
5524 (when article-window | |
5525 (gnus-eval-in-buffer-window gnus-article-buffer | |
5526 (setq endp (gnus-article-next-page lines))) | |
5527 (when endp | |
5528 (cond (circular | |
5529 (gnus-summary-beginning-of-article)) | |
5530 (lines | |
5531 (gnus-message 3 "End of message")) | |
5532 ((null lines) | |
5533 (if (and (eq gnus-summary-goto-unread 'never) | |
5534 (not (gnus-summary-last-article-p article))) | |
5535 (gnus-summary-next-article) | |
5536 (gnus-summary-next-unread-article)))))))) | |
5537 (gnus-summary-recenter) | |
5538 (gnus-summary-position-point))) | |
5539 | |
5540 (defun gnus-summary-prev-page (&optional lines move) | |
5541 "Show previous page of selected article. | |
5542 Argument LINES specifies lines to be scrolled down. | |
5543 If MOVE, move to the previous unread article if point is at | |
5544 the beginning of the buffer." | |
5545 (interactive "P") | |
5546 (gnus-set-global-variables) | |
5547 (let ((article (gnus-summary-article-number)) | |
5548 (article-window (get-buffer-window gnus-article-buffer t)) | |
5549 endp) | |
5550 (gnus-configure-windows 'article) | |
5551 (if (or (null gnus-current-article) | |
5552 (null gnus-article-current) | |
5553 (/= article (cdr gnus-article-current)) | |
5554 (not (equal (car gnus-article-current) gnus-newsgroup-name))) | |
5555 ;; Selected subject is different from current article's. | |
5556 (gnus-summary-display-article article) | |
5557 (gnus-summary-recenter) | |
5558 (when article-window | |
5559 (gnus-eval-in-buffer-window gnus-article-buffer | |
5560 (setq endp (gnus-article-prev-page lines))) | |
5561 (when (and move endp) | |
5562 (cond (lines | |
5563 (gnus-message 3 "Beginning of message")) | |
5564 ((null lines) | |
5565 (if (and (eq gnus-summary-goto-unread 'never) | |
5566 (not (gnus-summary-first-article-p article))) | |
5567 (gnus-summary-prev-article) | |
5568 (gnus-summary-prev-unread-article)))))))) | |
5569 (gnus-summary-position-point)) | |
5570 | |
5571 (defun gnus-summary-prev-page-or-article (&optional lines) | |
5572 "Show previous page of selected article. | |
5573 Argument LINES specifies lines to be scrolled down. | |
5574 If at the beginning of the article, go to the next article." | |
5575 (interactive "P") | |
5576 (gnus-summary-prev-page lines t)) | |
5577 | |
5578 (defun gnus-summary-scroll-up (lines) | |
5579 "Scroll up (or down) one line current article. | |
5580 Argument LINES specifies lines to be scrolled up (or down if negative)." | |
5581 (interactive "p") | |
5582 (gnus-set-global-variables) | |
5583 (gnus-configure-windows 'article) | |
5584 (gnus-summary-show-thread) | |
5585 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old) | |
5586 (gnus-eval-in-buffer-window gnus-article-buffer | |
5587 (cond ((> lines 0) | |
5588 (when (gnus-article-next-page lines) | |
5589 (gnus-message 3 "End of message"))) | |
5590 ((< lines 0) | |
5591 (gnus-article-prev-page (- lines)))))) | |
5592 (gnus-summary-recenter) | |
5593 (gnus-summary-position-point)) | |
5594 | |
5595 (defun gnus-summary-next-same-subject () | |
5596 "Select next article which has the same subject as current one." | |
5597 (interactive) | |
5598 (gnus-set-global-variables) | |
5599 (gnus-summary-next-article nil (gnus-summary-article-subject))) | |
5600 | |
5601 (defun gnus-summary-prev-same-subject () | |
5602 "Select previous article which has the same subject as current one." | |
5603 (interactive) | |
5604 (gnus-set-global-variables) | |
5605 (gnus-summary-prev-article nil (gnus-summary-article-subject))) | |
5606 | |
5607 (defun gnus-summary-next-unread-same-subject () | |
5608 "Select next unread article which has the same subject as current one." | |
5609 (interactive) | |
5610 (gnus-set-global-variables) | |
5611 (gnus-summary-next-article t (gnus-summary-article-subject))) | |
5612 | |
5613 (defun gnus-summary-prev-unread-same-subject () | |
5614 "Select previous unread article which has the same subject as current one." | |
5615 (interactive) | |
5616 (gnus-set-global-variables) | |
5617 (gnus-summary-prev-article t (gnus-summary-article-subject))) | |
5618 | |
5619 (defun gnus-summary-first-unread-article () | |
5620 "Select the first unread article. | |
5621 Return nil if there are no unread articles." | |
5622 (interactive) | |
5623 (gnus-set-global-variables) | |
5624 (prog1 | |
5625 (when (gnus-summary-first-subject t) | |
5626 (gnus-summary-show-thread) | |
5627 (gnus-summary-first-subject t) | |
5628 (gnus-summary-display-article (gnus-summary-article-number))) | |
5629 (gnus-summary-position-point))) | |
5630 | |
5631 (defun gnus-summary-first-article () | |
5632 "Select the first article. | |
5633 Return nil if there are no articles." | |
5634 (interactive) | |
5635 (gnus-set-global-variables) | |
5636 (prog1 | |
5637 (when (gnus-summary-first-subject) | |
5638 (gnus-summary-show-thread) | |
5639 (gnus-summary-first-subject) | |
5640 (gnus-summary-display-article (gnus-summary-article-number))) | |
5641 (gnus-summary-position-point))) | |
5642 | |
5643 (defun gnus-summary-best-unread-article () | |
5644 "Select the unread article with the highest score." | |
5645 (interactive) | |
5646 (gnus-set-global-variables) | |
5647 (let ((best -1000000) | |
5648 (data gnus-newsgroup-data) | |
5649 article score) | |
5650 (while data | |
5651 (and (gnus-data-unread-p (car data)) | |
5652 (> (setq score | |
5653 (gnus-summary-article-score (gnus-data-number (car data)))) | |
5654 best) | |
5655 (setq best score | |
5656 article (gnus-data-number (car data)))) | |
5657 (setq data (cdr data))) | |
5658 (prog1 | |
5659 (if article | |
5660 (gnus-summary-goto-article article) | |
5661 (error "No unread articles")) | |
5662 (gnus-summary-position-point)))) | |
5663 | |
5664 (defun gnus-summary-last-subject () | |
5665 "Go to the last displayed subject line in the group." | |
5666 (let ((article (gnus-data-number (car (gnus-data-list t))))) | |
5667 (when article | |
5668 (gnus-summary-goto-subject article)))) | |
5669 | |
5670 (defun gnus-summary-goto-article (article &optional all-headers force) | |
5671 "Fetch ARTICLE and display it if it exists. | |
5672 If ALL-HEADERS is non-nil, no header lines are hidden." | |
5673 (interactive | |
5674 (list | |
5675 (string-to-int | |
5676 (completing-read | |
5677 "Article number: " | |
5678 (mapcar (lambda (number) (list (int-to-string number))) | |
5679 gnus-newsgroup-limit))) | |
5680 current-prefix-arg | |
5681 t)) | |
5682 (prog1 | |
5683 (if (gnus-summary-goto-subject article force) | |
5684 (gnus-summary-display-article article all-headers) | |
5685 (gnus-message 4 "Couldn't go to article %s" article) nil) | |
5686 (gnus-summary-position-point))) | |
5687 | |
5688 (defun gnus-summary-goto-last-article () | |
5689 "Go to the previously read article." | |
5690 (interactive) | |
5691 (prog1 | |
5692 (when gnus-last-article | |
5693 (gnus-summary-goto-article gnus-last-article)) | |
5694 (gnus-summary-position-point))) | |
5695 | |
5696 (defun gnus-summary-pop-article (number) | |
5697 "Pop one article off the history and go to the previous. | |
5698 NUMBER articles will be popped off." | |
5699 (interactive "p") | |
5700 (let (to) | |
5701 (setq gnus-newsgroup-history | |
5702 (cdr (setq to (nthcdr number gnus-newsgroup-history)))) | |
5703 (if to | |
5704 (gnus-summary-goto-article (car to)) | |
5705 (error "Article history empty"))) | |
5706 (gnus-summary-position-point)) | |
5707 | |
5708 ;; Summary commands and functions for limiting the summary buffer. | |
5709 | |
5710 (defun gnus-summary-limit-to-articles (n) | |
5711 "Limit the summary buffer to the next N articles. | |
5712 If not given a prefix, use the process marked articles instead." | |
5713 (interactive "P") | |
5714 (gnus-set-global-variables) | |
5715 (prog1 | |
5716 (let ((articles (gnus-summary-work-articles n))) | |
5717 (setq gnus-newsgroup-processable nil) | |
5718 (gnus-summary-limit articles)) | |
5719 (gnus-summary-position-point))) | |
5720 | |
5721 (defun gnus-summary-pop-limit (&optional total) | |
5722 "Restore the previous limit. | |
5723 If given a prefix, remove all limits." | |
5724 (interactive "P") | |
5725 (gnus-set-global-variables) | |
5726 (when total | |
5727 (setq gnus-newsgroup-limits | |
5728 (list (mapcar (lambda (h) (mail-header-number h)) | |
5729 gnus-newsgroup-headers)))) | |
5730 (unless gnus-newsgroup-limits | |
5731 (error "No limit to pop")) | |
5732 (prog1 | |
5733 (gnus-summary-limit nil 'pop) | |
5734 (gnus-summary-position-point))) | |
5735 | |
5736 (defun gnus-summary-limit-to-subject (subject &optional header) | |
5737 "Limit the summary buffer to articles that have subjects that match a regexp." | |
5738 (interactive "sLimit to subject (regexp): ") | |
5739 (unless header | |
5740 (setq header "subject")) | |
5741 (when (not (equal "" subject)) | |
5742 (prog1 | |
5743 (let ((articles (gnus-summary-find-matching | |
5744 (or header "subject") subject 'all))) | |
5745 (unless articles | |
5746 (error "Found no matches for \"%s\"" subject)) | |
5747 (gnus-summary-limit articles)) | |
5748 (gnus-summary-position-point)))) | |
5749 | |
5750 (defun gnus-summary-limit-to-author (from) | |
5751 "Limit the summary buffer to articles that have authors that match a regexp." | |
5752 (interactive "sLimit to author (regexp): ") | |
5753 (gnus-summary-limit-to-subject from "from")) | |
5754 | |
5755 (defun gnus-summary-limit-to-age (age &optional younger-p) | |
5756 "Limit the summary buffer to articles that are older than (or equal) AGE days. | |
5757 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to | |
5758 articles that are younger than AGE days." | |
5759 (interactive "nTime in days: \nP") | |
5760 (prog1 | |
5761 (let ((data gnus-newsgroup-data) | |
5762 (cutoff (nnmail-days-to-time age)) | |
5763 articles d date is-younger) | |
5764 (while (setq d (pop data)) | |
5765 (when (and (vectorp (gnus-data-header d)) | |
5766 (setq date (mail-header-date (gnus-data-header d)))) | |
5767 (setq is-younger (nnmail-time-less | |
5768 (nnmail-time-since (nnmail-date-to-time date)) | |
5769 cutoff)) | |
5770 (when (if younger-p is-younger (not is-younger)) | |
5771 (push (gnus-data-number d) articles)))) | |
5772 (gnus-summary-limit (nreverse articles))) | |
5773 (gnus-summary-position-point))) | |
5774 | |
5775 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread) | |
5776 (make-obsolete | |
5777 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread) | |
5778 | |
5779 (defun gnus-summary-limit-to-unread (&optional all) | |
5780 "Limit the summary buffer to articles that are not marked as read. | |
5781 If ALL is non-nil, limit strictly to unread articles." | |
5782 (interactive "P") | |
5783 (if all | |
5784 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark)) | |
5785 (gnus-summary-limit-to-marks | |
5786 ;; Concat all the marks that say that an article is read and have | |
5787 ;; those removed. | |
5788 (list gnus-del-mark gnus-read-mark gnus-ancient-mark | |
5789 gnus-killed-mark gnus-kill-file-mark | |
5790 gnus-low-score-mark gnus-expirable-mark | |
5791 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark | |
5792 gnus-duplicate-mark gnus-souped-mark) | |
5793 'reverse))) | |
5794 | |
5795 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks) | |
5796 (make-obsolete 'gnus-summary-delete-marked-with | |
5797 'gnus-summary-limit-exlude-marks) | |
5798 | |
5799 (defun gnus-summary-limit-exclude-marks (marks &optional reverse) | |
5800 "Exclude articles that are marked with MARKS (e.g. \"DK\"). | |
5801 If REVERSE, limit the summary buffer to articles that are marked | |
5802 with MARKS. MARKS can either be a string of marks or a list of marks. | |
5803 Returns how many articles were removed." | |
5804 (interactive "sMarks: ") | |
5805 (gnus-summary-limit-to-marks marks t)) | |
5806 | |
5807 (defun gnus-summary-limit-to-marks (marks &optional reverse) | |
5808 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\"). | |
5809 If REVERSE (the prefix), limit the summary buffer to articles that are | |
5810 not marked with MARKS. MARKS can either be a string of marks or a | |
5811 list of marks. | |
5812 Returns how many articles were removed." | |
5813 (interactive (list (read-string "Marks: ") current-prefix-arg)) | |
5814 (gnus-set-global-variables) | |
5815 (prog1 | |
5816 (let ((data gnus-newsgroup-data) | |
5817 (marks (if (listp marks) marks | |
5818 (append marks nil))) ; Transform to list. | |
5819 articles) | |
5820 (while data | |
5821 (when (if reverse (not (memq (gnus-data-mark (car data)) marks)) | |
5822 (memq (gnus-data-mark (car data)) marks)) | |
5823 (push (gnus-data-number (car data)) articles)) | |
5824 (setq data (cdr data))) | |
5825 (gnus-summary-limit articles)) | |
5826 (gnus-summary-position-point))) | |
5827 | |
5828 (defun gnus-summary-limit-to-score (&optional score) | |
5829 "Limit to articles with score at or above SCORE." | |
5830 (interactive "P") | |
5831 (gnus-set-global-variables) | |
5832 (setq score (if score | |
5833 (prefix-numeric-value score) | |
5834 (or gnus-summary-default-score 0))) | |
5835 (let ((data gnus-newsgroup-data) | |
5836 articles) | |
5837 (while data | |
5838 (when (>= (gnus-summary-article-score (gnus-data-number (car data))) | |
5839 score) | |
5840 (push (gnus-data-number (car data)) articles)) | |
5841 (setq data (cdr data))) | |
5842 (prog1 | |
5843 (gnus-summary-limit articles) | |
5844 (gnus-summary-position-point)))) | |
5845 | |
5846 (defun gnus-summary-limit-include-dormant () | |
5847 "Display all the hidden articles that are marked as dormant." | |
5848 (interactive) | |
5849 (gnus-set-global-variables) | |
5850 (unless gnus-newsgroup-dormant | |
5851 (error "There are no dormant articles in this group")) | |
5852 (prog1 | |
5853 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit)) | |
5854 (gnus-summary-position-point))) | |
5855 | |
5856 (defun gnus-summary-limit-exclude-dormant () | |
5857 "Hide all dormant articles." | |
5858 (interactive) | |
5859 (gnus-set-global-variables) | |
5860 (prog1 | |
5861 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse) | |
5862 (gnus-summary-position-point))) | |
5863 | |
5864 (defun gnus-summary-limit-exclude-childless-dormant () | |
5865 "Hide all dormant articles that have no children." | |
5866 (interactive) | |
5867 (gnus-set-global-variables) | |
5868 (let ((data (gnus-data-list t)) | |
5869 articles d children) | |
5870 ;; Find all articles that are either not dormant or have | |
5871 ;; children. | |
5872 (while (setq d (pop data)) | |
5873 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark)) | |
5874 (and (setq children | |
5875 (gnus-article-children (gnus-data-number d))) | |
5876 (let (found) | |
5877 (while children | |
5878 (when (memq (car children) articles) | |
5879 (setq children nil | |
5880 found t)) | |
5881 (pop children)) | |
5882 found))) | |
5883 (push (gnus-data-number d) articles))) | |
5884 ;; Do the limiting. | |
5885 (prog1 | |
5886 (gnus-summary-limit articles) | |
5887 (gnus-summary-position-point)))) | |
5888 | |
5889 (defun gnus-summary-limit-mark-excluded-as-read (&optional all) | |
5890 "Mark all unread excluded articles as read. | |
5891 If ALL, mark even excluded ticked and dormants as read." | |
5892 (interactive "P") | |
5893 (let ((articles (gnus-sorted-complement | |
5894 (sort | |
5895 (mapcar (lambda (h) (mail-header-number h)) | |
5896 gnus-newsgroup-headers) | |
5897 '<) | |
5898 (sort gnus-newsgroup-limit '<))) | |
5899 article) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5900 (setq gnus-newsgroup-unreads gnus-newsgroup-limit) |
17493 | 5901 (if all |
5902 (setq gnus-newsgroup-dormant nil | |
5903 gnus-newsgroup-marked nil | |
5904 gnus-newsgroup-reads | |
5905 (nconc | |
5906 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles) | |
5907 gnus-newsgroup-reads)) | |
5908 (while (setq article (pop articles)) | |
5909 (unless (or (memq article gnus-newsgroup-dormant) | |
5910 (memq article gnus-newsgroup-marked)) | |
5911 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads)))))) | |
5912 | |
5913 (defun gnus-summary-limit (articles &optional pop) | |
5914 (if pop | |
5915 ;; We pop the previous limit off the stack and use that. | |
5916 (setq articles (car gnus-newsgroup-limits) | |
5917 gnus-newsgroup-limits (cdr gnus-newsgroup-limits)) | |
5918 ;; We use the new limit, so we push the old limit on the stack. | |
5919 (push gnus-newsgroup-limit gnus-newsgroup-limits)) | |
5920 ;; Set the limit. | |
5921 (setq gnus-newsgroup-limit articles) | |
5922 (let ((total (length gnus-newsgroup-data)) | |
5923 (data (gnus-data-find-list (gnus-summary-article-number))) | |
5924 (gnus-summary-mark-below nil) ; Inhibit this. | |
5925 found) | |
5926 ;; This will do all the work of generating the new summary buffer | |
5927 ;; according to the new limit. | |
5928 (gnus-summary-prepare) | |
5929 ;; Hide any threads, possibly. | |
5930 (and gnus-show-threads | |
5931 gnus-thread-hide-subtree | |
5932 (gnus-summary-hide-all-threads)) | |
5933 ;; Try to return to the article you were at, or one in the | |
5934 ;; neighborhood. | |
5935 (when data | |
5936 ;; We try to find some article after the current one. | |
5937 (while data | |
5938 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t) | |
5939 (setq data nil | |
5940 found t)) | |
5941 (setq data (cdr data)))) | |
5942 (unless found | |
5943 ;; If there is no data, that means that we were after the last | |
5944 ;; article. The same goes when we can't find any articles | |
5945 ;; after the current one. | |
5946 (goto-char (point-max)) | |
5947 (gnus-summary-find-prev)) | |
5948 ;; We return how many articles were removed from the summary | |
5949 ;; buffer as a result of the new limit. | |
5950 (- total (length gnus-newsgroup-data)))) | |
5951 | |
5952 (defsubst gnus-invisible-cut-children (threads) | |
5953 (let ((num 0)) | |
5954 (while threads | |
5955 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit) | |
5956 (incf num)) | |
5957 (pop threads)) | |
5958 (< num 2))) | |
5959 | |
5960 (defsubst gnus-cut-thread (thread) | |
5961 "Go forwards in the thread until we find an article that we want to display." | |
5962 (when (or (eq gnus-fetch-old-headers 'some) | |
5963 (eq gnus-build-sparse-threads 'some) | |
5964 (eq gnus-build-sparse-threads 'more)) | |
5965 ;; Deal with old-fetched headers and sparse threads. | |
5966 (while (and | |
5967 thread | |
5968 (or | |
5969 (gnus-summary-article-sparse-p (mail-header-number (car thread))) | |
5970 (gnus-summary-article-ancient-p | |
5971 (mail-header-number (car thread)))) | |
5972 (progn | |
5973 (if (<= (length (cdr thread)) 1) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5974 (setq gnus-newsgroup-limit |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5975 (delq (mail-header-number (car thread)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5976 gnus-newsgroup-limit) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5977 thread (cadr thread)) |
17493 | 5978 (when (gnus-invisible-cut-children (cdr thread)) |
5979 (let ((th (cdr thread))) | |
5980 (while th | |
5981 (if (memq (mail-header-number (caar th)) | |
5982 gnus-newsgroup-limit) | |
5983 (setq thread (car th) | |
5984 th nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
5985 (setq th (cdr th))))))))))) |
17493 | 5986 thread) |
5987 | |
5988 (defun gnus-cut-threads (threads) | |
5989 "Cut off all uninteresting articles from the beginning of threads." | |
5990 (when (or (eq gnus-fetch-old-headers 'some) | |
5991 (eq gnus-build-sparse-threads 'some) | |
5992 (eq gnus-build-sparse-threads 'more)) | |
5993 (let ((th threads)) | |
5994 (while th | |
5995 (setcar th (gnus-cut-thread (car th))) | |
5996 (setq th (cdr th))))) | |
5997 ;; Remove nixed out threads. | |
5998 (delq nil threads)) | |
5999 | |
6000 (defun gnus-summary-initial-limit (&optional show-if-empty) | |
6001 "Figure out what the initial limit is supposed to be on group entry. | |
6002 This entails weeding out unwanted dormants, low-scored articles, | |
6003 fetch-old-headers verbiage, and so on." | |
6004 ;; Most groups have nothing to remove. | |
6005 (if (or gnus-inhibit-limiting | |
6006 (and (null gnus-newsgroup-dormant) | |
6007 (not (eq gnus-fetch-old-headers 'some)) | |
6008 (null gnus-summary-expunge-below) | |
6009 (not (eq gnus-build-sparse-threads 'some)) | |
6010 (not (eq gnus-build-sparse-threads 'more)) | |
6011 (null gnus-thread-expunge-below) | |
6012 (not gnus-use-nocem))) | |
6013 () ; Do nothing. | |
6014 (push gnus-newsgroup-limit gnus-newsgroup-limits) | |
6015 (setq gnus-newsgroup-limit nil) | |
6016 (mapatoms | |
6017 (lambda (node) | |
6018 (unless (car (symbol-value node)) | |
6019 ;; These threads have no parents -- they are roots. | |
6020 (let ((nodes (cdr (symbol-value node))) | |
6021 thread) | |
6022 (while nodes | |
6023 (if (and gnus-thread-expunge-below | |
6024 (< (gnus-thread-total-score (car nodes)) | |
6025 gnus-thread-expunge-below)) | |
6026 (gnus-expunge-thread (pop nodes)) | |
6027 (setq thread (pop nodes)) | |
6028 (gnus-summary-limit-children thread)))))) | |
6029 gnus-newsgroup-dependencies) | |
6030 ;; If this limitation resulted in an empty group, we might | |
6031 ;; pop the previous limit and use it instead. | |
6032 (when (and (not gnus-newsgroup-limit) | |
6033 show-if-empty) | |
6034 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits))) | |
6035 gnus-newsgroup-limit)) | |
6036 | |
6037 (defun gnus-summary-limit-children (thread) | |
6038 "Return 1 if this subthread is visible and 0 if it is not." | |
6039 ;; First we get the number of visible children to this thread. This | |
6040 ;; is done by recursing down the thread using this function, so this | |
6041 ;; will really go down to a leaf article first, before slowly | |
6042 ;; working its way up towards the root. | |
6043 (when thread | |
6044 (let ((children | |
6045 (if (cdr thread) | |
6046 (apply '+ (mapcar 'gnus-summary-limit-children | |
6047 (cdr thread))) | |
6048 0)) | |
6049 (number (mail-header-number (car thread))) | |
6050 score) | |
6051 (if (and | |
6052 (not (memq number gnus-newsgroup-marked)) | |
6053 (or | |
6054 ;; If this article is dormant and has absolutely no visible | |
6055 ;; children, then this article isn't visible. | |
6056 (and (memq number gnus-newsgroup-dormant) | |
6057 (zerop children)) | |
6058 ;; If this is "fetch-old-headered" and there is no | |
6059 ;; visible children, then we don't want this article. | |
6060 (and (eq gnus-fetch-old-headers 'some) | |
6061 (gnus-summary-article-ancient-p number) | |
6062 (zerop children)) | |
6063 ;; If this is a sparsely inserted article with no children, | |
6064 ;; we don't want it. | |
6065 (and (eq gnus-build-sparse-threads 'some) | |
6066 (gnus-summary-article-sparse-p number) | |
6067 (zerop children)) | |
6068 ;; If we use expunging, and this article is really | |
6069 ;; low-scored, then we don't want this article. | |
6070 (when (and gnus-summary-expunge-below | |
6071 (< (setq score | |
6072 (or (cdr (assq number gnus-newsgroup-scored)) | |
6073 gnus-summary-default-score)) | |
6074 gnus-summary-expunge-below)) | |
6075 ;; We increase the expunge-tally here, but that has | |
6076 ;; nothing to do with the limits, really. | |
6077 (incf gnus-newsgroup-expunged-tally) | |
6078 ;; We also mark as read here, if that's wanted. | |
6079 (when (and gnus-summary-mark-below | |
6080 (< score gnus-summary-mark-below)) | |
6081 (setq gnus-newsgroup-unreads | |
6082 (delq number gnus-newsgroup-unreads)) | |
6083 (if gnus-newsgroup-auto-expire | |
6084 (push number gnus-newsgroup-expirable) | |
6085 (push (cons number gnus-low-score-mark) | |
6086 gnus-newsgroup-reads))) | |
6087 t) | |
6088 ;; Check NoCeM things. | |
6089 (if (and gnus-use-nocem | |
6090 (gnus-nocem-unwanted-article-p | |
6091 (mail-header-id (car thread)))) | |
6092 (progn | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6093 (setq gnus-newsgroup-unreads |
17493 | 6094 (delq number gnus-newsgroup-unreads)) |
6095 t)))) | |
6096 ;; Nope, invisible article. | |
6097 0 | |
6098 ;; Ok, this article is to be visible, so we add it to the limit | |
6099 ;; and return 1. | |
6100 (push number gnus-newsgroup-limit) | |
6101 1)))) | |
6102 | |
6103 (defun gnus-expunge-thread (thread) | |
6104 "Mark all articles in THREAD as read." | |
6105 (let* ((number (mail-header-number (car thread)))) | |
6106 (incf gnus-newsgroup-expunged-tally) | |
6107 ;; We also mark as read here, if that's wanted. | |
6108 (setq gnus-newsgroup-unreads | |
6109 (delq number gnus-newsgroup-unreads)) | |
6110 (if gnus-newsgroup-auto-expire | |
6111 (push number gnus-newsgroup-expirable) | |
6112 (push (cons number gnus-low-score-mark) | |
6113 gnus-newsgroup-reads))) | |
6114 ;; Go recursively through all subthreads. | |
6115 (mapcar 'gnus-expunge-thread (cdr thread))) | |
6116 | |
6117 ;; Summary article oriented commands | |
6118 | |
6119 (defun gnus-summary-refer-parent-article (n) | |
6120 "Refer parent article N times. | |
6121 If N is negative, go to ancestor -N instead. | |
6122 The difference between N and the number of articles fetched is returned." | |
6123 (interactive "p") | |
6124 (gnus-set-global-variables) | |
6125 (let ((skip 1) | |
6126 error header ref) | |
6127 (when (not (natnump n)) | |
6128 (setq skip (abs n) | |
6129 n 1)) | |
6130 (while (and (> n 0) | |
6131 (not error)) | |
6132 (setq header (gnus-summary-article-header)) | |
6133 (if (and (eq (mail-header-number header) | |
6134 (cdr gnus-article-current)) | |
6135 (equal gnus-newsgroup-name | |
6136 (car gnus-article-current))) | |
6137 ;; If we try to find the parent of the currently | |
6138 ;; displayed article, then we take a look at the actual | |
6139 ;; References header, since this is slightly more | |
6140 ;; reliable than the References field we got from the | |
6141 ;; server. | |
6142 (save-excursion | |
6143 (set-buffer gnus-original-article-buffer) | |
6144 (nnheader-narrow-to-headers) | |
6145 (unless (setq ref (message-fetch-field "references")) | |
6146 (setq ref (message-fetch-field "in-reply-to"))) | |
6147 (widen)) | |
6148 (setq ref | |
6149 ;; It's not the current article, so we take a bet on | |
6150 ;; the value we got from the server. | |
6151 (mail-header-references header))) | |
6152 (if (and ref | |
6153 (not (equal ref ""))) | |
6154 (unless (gnus-summary-refer-article (gnus-parent-id ref skip)) | |
6155 (gnus-message 1 "Couldn't find parent")) | |
6156 (gnus-message 1 "No references in article %d" | |
6157 (gnus-summary-article-number)) | |
6158 (setq error t)) | |
6159 (decf n)) | |
6160 (gnus-summary-position-point) | |
6161 n)) | |
6162 | |
6163 (defun gnus-summary-refer-references () | |
6164 "Fetch all articles mentioned in the References header. | |
6165 Return how many articles were fetched." | |
6166 (interactive) | |
6167 (gnus-set-global-variables) | |
6168 (let ((ref (mail-header-references (gnus-summary-article-header))) | |
6169 (current (gnus-summary-article-number)) | |
6170 (n 0)) | |
6171 (if (or (not ref) | |
6172 (equal ref "")) | |
6173 (error "No References in the current article") | |
6174 ;; For each Message-ID in the References header... | |
6175 (while (string-match "<[^>]*>" ref) | |
6176 (incf n) | |
6177 ;; ... fetch that article. | |
6178 (gnus-summary-refer-article | |
6179 (prog1 (match-string 0 ref) | |
6180 (setq ref (substring ref (match-end 0)))))) | |
6181 (gnus-summary-goto-subject current) | |
6182 (gnus-summary-position-point) | |
6183 n))) | |
6184 | |
6185 (defun gnus-summary-refer-article (message-id &optional arg) | |
6186 "Fetch an article specified by MESSAGE-ID. | |
6187 If ARG (the prefix), fetch the article using `gnus-refer-article-method' | |
6188 or `gnus-select-method', no matter what backend the article comes from." | |
6189 (interactive "sMessage-ID: \nP") | |
6190 (when (and (stringp message-id) | |
6191 (not (zerop (length message-id)))) | |
6192 ;; Construct the correct Message-ID if necessary. | |
6193 ;; Suggested by tale@pawl.rpi.edu. | |
6194 (unless (string-match "^<" message-id) | |
6195 (setq message-id (concat "<" message-id))) | |
6196 (unless (string-match ">$" message-id) | |
6197 (setq message-id (concat message-id ">"))) | |
6198 (let* ((header (gnus-id-to-header message-id)) | |
6199 (sparse (and header | |
6200 (gnus-summary-article-sparse-p | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6201 (mail-header-number header)) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6202 (memq (mail-header-number header) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6203 gnus-newsgroup-limit)))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6204 (if (and header |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6205 (or (not (gnus-summary-article-sparse-p |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6206 (mail-header-number header))) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6207 sparse)) |
17493 | 6208 (prog1 |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6209 ;; The article is present in the buffer, so we just go to it. |
17493 | 6210 (gnus-summary-goto-article |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6211 (mail-header-number header) nil t) |
17493 | 6212 (when sparse |
6213 (gnus-summary-update-article (mail-header-number header)))) | |
6214 ;; We fetch the article | |
6215 (let ((gnus-override-method | |
6216 (cond ((gnus-news-group-p gnus-newsgroup-name) | |
6217 gnus-refer-article-method) | |
6218 (arg | |
6219 (or gnus-refer-article-method gnus-select-method)) | |
6220 (t nil))) | |
6221 number) | |
6222 ;; Start the special refer-article method, if necessary. | |
6223 (when (and gnus-refer-article-method | |
6224 (gnus-news-group-p gnus-newsgroup-name)) | |
6225 (gnus-check-server gnus-refer-article-method)) | |
6226 ;; Fetch the header, and display the article. | |
6227 (if (setq number (gnus-summary-insert-subject message-id)) | |
6228 (gnus-summary-select-article nil nil nil number) | |
6229 (gnus-message 3 "Couldn't fetch article %s" message-id))))))) | |
6230 | |
6231 (defun gnus-summary-enter-digest-group (&optional force) | |
6232 "Enter an nndoc group based on the current article. | |
6233 If FORCE, force a digest interpretation. If not, try | |
6234 to guess what the document format is." | |
6235 (interactive "P") | |
6236 (gnus-set-global-variables) | |
6237 (let ((conf gnus-current-window-configuration)) | |
6238 (save-excursion | |
6239 (gnus-summary-select-article)) | |
6240 (setq gnus-current-window-configuration conf) | |
6241 (let* ((name (format "%s-%d" | |
6242 (gnus-group-prefixed-name | |
6243 gnus-newsgroup-name (list 'nndoc "")) | |
6244 (save-excursion | |
6245 (set-buffer gnus-summary-buffer) | |
6246 gnus-current-article))) | |
6247 (ogroup gnus-newsgroup-name) | |
6248 (params (append (gnus-info-params (gnus-get-info ogroup)) | |
6249 (list (cons 'to-group ogroup)) | |
6250 (list (cons 'save-article-group ogroup)))) | |
6251 (case-fold-search t) | |
6252 (buf (current-buffer)) | |
6253 dig) | |
6254 (save-excursion | |
6255 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*")) | |
6256 (insert-buffer-substring gnus-original-article-buffer) | |
6257 ;; Remove lines that may lead nndoc to misinterpret the | |
6258 ;; document type. | |
6259 (narrow-to-region | |
6260 (goto-char (point-min)) | |
6261 (or (search-forward "\n\n" nil t) (point))) | |
6262 (goto-char (point-min)) | |
6263 (delete-matching-lines "^\\(Path\\):\\|^From ") | |
6264 (widen)) | |
6265 (unwind-protect | |
6266 (if (gnus-group-read-ephemeral-group | |
6267 name `(nndoc ,name (nndoc-address ,(get-buffer dig)) | |
6268 (nndoc-article-type | |
6269 ,(if force 'digest 'guess))) t) | |
6270 ;; Make all postings to this group go to the parent group. | |
6271 (nconc (gnus-info-params (gnus-get-info name)) | |
6272 params) | |
6273 ;; Couldn't select this doc group. | |
6274 (switch-to-buffer buf) | |
6275 (gnus-set-global-variables) | |
6276 (gnus-configure-windows 'summary) | |
6277 (gnus-message 3 "Article couldn't be entered?")) | |
6278 (kill-buffer dig))))) | |
6279 | |
6280 (defun gnus-summary-read-document (n) | |
6281 "Open a new group based on the current article(s). | |
6282 This will allow you to read digests and other similar | |
6283 documents as newsgroups. | |
6284 Obeys the standard process/prefix convention." | |
6285 (interactive "P") | |
6286 (let* ((articles (gnus-summary-work-articles n)) | |
6287 (ogroup gnus-newsgroup-name) | |
6288 (params (append (gnus-info-params (gnus-get-info ogroup)) | |
6289 (list (cons 'to-group ogroup)))) | |
6290 article group egroup groups vgroup) | |
6291 (while (setq article (pop articles)) | |
6292 (setq group (format "%s-%d" gnus-newsgroup-name article)) | |
6293 (gnus-summary-remove-process-mark article) | |
6294 (when (gnus-summary-display-article article) | |
6295 (save-excursion | |
6296 (nnheader-temp-write nil | |
6297 (insert-buffer-substring gnus-original-article-buffer) | |
6298 ;; Remove some headers that may lead nndoc to make | |
6299 ;; the wrong guess. | |
6300 (message-narrow-to-head) | |
6301 (goto-char (point-min)) | |
6302 (delete-matching-lines "^\\(Path\\):\\|^From ") | |
6303 (widen) | |
6304 (if (setq egroup | |
6305 (gnus-group-read-ephemeral-group | |
6306 group `(nndoc ,group (nndoc-address ,(current-buffer)) | |
6307 (nndoc-article-type guess)) | |
6308 t nil t)) | |
6309 (progn | |
6310 ;; Make all postings to this group go to the parent group. | |
6311 (nconc (gnus-info-params (gnus-get-info egroup)) | |
6312 params) | |
6313 (push egroup groups)) | |
6314 ;; Couldn't select this doc group. | |
6315 (gnus-error 3 "Article couldn't be entered")))))) | |
6316 ;; Now we have selected all the documents. | |
6317 (cond | |
6318 ((not groups) | |
6319 (error "None of the articles could be interpreted as documents")) | |
6320 ((gnus-group-read-ephemeral-group | |
6321 (setq vgroup (format | |
6322 "nnvirtual:%s-%s" gnus-newsgroup-name | |
6323 (format-time-string "%Y%m%dT%H%M%S" (current-time)))) | |
6324 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups)) | |
6325 t | |
6326 (cons (current-buffer) 'summary))) | |
6327 (t | |
6328 (error "Couldn't select virtual nndoc group"))))) | |
6329 | |
6330 (defun gnus-summary-isearch-article (&optional regexp-p) | |
6331 "Do incremental search forward on the current article. | |
6332 If REGEXP-P (the prefix) is non-nil, do regexp isearch." | |
6333 (interactive "P") | |
6334 (gnus-set-global-variables) | |
6335 (gnus-summary-select-article) | |
6336 (gnus-configure-windows 'article) | |
6337 (gnus-eval-in-buffer-window gnus-article-buffer | |
6338 ;;(goto-char (point-min)) | |
6339 (isearch-forward regexp-p))) | |
6340 | |
6341 (defun gnus-summary-search-article-forward (regexp &optional backward) | |
6342 "Search for an article containing REGEXP forward. | |
6343 If BACKWARD, search backward instead." | |
6344 (interactive | |
6345 (list (read-string | |
6346 (format "Search article %s (regexp%s): " | |
6347 (if current-prefix-arg "backward" "forward") | |
6348 (if gnus-last-search-regexp | |
6349 (concat ", default " gnus-last-search-regexp) | |
6350 ""))) | |
6351 current-prefix-arg)) | |
6352 (gnus-set-global-variables) | |
6353 (if (string-equal regexp "") | |
6354 (setq regexp (or gnus-last-search-regexp "")) | |
6355 (setq gnus-last-search-regexp regexp)) | |
6356 (if (gnus-summary-search-article regexp backward) | |
6357 (gnus-summary-show-thread) | |
6358 (error "Search failed: \"%s\"" regexp))) | |
6359 | |
6360 (defun gnus-summary-search-article-backward (regexp) | |
6361 "Search for an article containing REGEXP backward." | |
6362 (interactive | |
6363 (list (read-string | |
6364 (format "Search article backward (regexp%s): " | |
6365 (if gnus-last-search-regexp | |
6366 (concat ", default " gnus-last-search-regexp) | |
6367 ""))))) | |
6368 (gnus-summary-search-article-forward regexp 'backward)) | |
6369 | |
6370 (defun gnus-summary-search-article (regexp &optional backward) | |
6371 "Search for an article containing REGEXP. | |
6372 Optional argument BACKWARD means do search for backward. | |
6373 `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
|
6374 ;; 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
|
6375 ;; dynamic binding isn't shadowed by autoloading. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6376 (require 'gnus-async) |
17493 | 6377 (let ((gnus-select-article-hook nil) ;Disable hook. |
6378 (gnus-article-display-hook nil) | |
6379 (gnus-mark-article-hook nil) ;Inhibit marking as read. | |
6380 (gnus-use-article-prefetch nil) | |
6381 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay. | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6382 (gnus-use-trees nil) ;Inhibit updating tree buffer. |
17493 | 6383 (sum (current-buffer)) |
6384 (found nil) | |
6385 point) | |
6386 (gnus-save-hidden-threads | |
6387 (gnus-summary-select-article) | |
6388 (set-buffer gnus-article-buffer) | |
6389 (when backward | |
6390 (forward-line -1)) | |
6391 (while (not found) | |
6392 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current)) | |
6393 (if (if backward | |
6394 (re-search-backward regexp nil t) | |
6395 (re-search-forward regexp nil t)) | |
6396 ;; We found the regexp. | |
6397 (progn | |
6398 (setq found 'found) | |
6399 (beginning-of-line) | |
6400 (set-window-start | |
6401 (get-buffer-window (current-buffer)) | |
6402 (point)) | |
6403 (forward-line 1) | |
6404 (set-buffer sum) | |
6405 (setq point (point))) | |
6406 ;; We didn't find it, so we go to the next article. | |
6407 (set-buffer sum) | |
6408 (setq found 'not) | |
6409 (while (eq found 'not) | |
6410 (if (not (if backward (gnus-summary-find-prev) | |
6411 (gnus-summary-find-next))) | |
6412 ;; No more articles. | |
6413 (setq found t) | |
6414 ;; Select the next article and adjust point. | |
6415 (unless (gnus-summary-article-sparse-p | |
6416 (gnus-summary-article-number)) | |
6417 (setq found nil) | |
6418 (gnus-summary-select-article) | |
6419 (set-buffer gnus-article-buffer) | |
6420 (widen) | |
6421 (goto-char (if backward (point-max) (point-min)))))))) | |
6422 (gnus-message 7 "")) | |
6423 ;; Return whether we found the regexp. | |
6424 (when (eq found 'found) | |
6425 (goto-char point) | |
6426 (gnus-summary-show-thread) | |
6427 (gnus-summary-goto-subject gnus-current-article) | |
6428 (gnus-summary-position-point) | |
6429 t))) | |
6430 | |
6431 (defun gnus-summary-find-matching (header regexp &optional backward unread | |
6432 not-case-fold) | |
6433 "Return a list of all articles that match REGEXP on HEADER. | |
6434 The search stars on the current article and goes forwards unless | |
6435 BACKWARD is non-nil. If BACKWARD is `all', do all articles. | |
6436 If UNREAD is non-nil, only unread articles will | |
6437 be taken into consideration. If NOT-CASE-FOLD, case won't be folded | |
6438 in the comparisons." | |
6439 (let ((data (if (eq backward 'all) gnus-newsgroup-data | |
6440 (gnus-data-find-list | |
6441 (gnus-summary-article-number) (gnus-data-list backward)))) | |
6442 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h))) | |
6443 (case-fold-search (not not-case-fold)) | |
6444 articles d) | |
6445 (unless (fboundp (intern (concat "mail-header-" header))) | |
6446 (error "%s is not a valid header" header)) | |
6447 (while data | |
6448 (setq d (car data)) | |
6449 (and (or (not unread) ; We want all articles... | |
6450 (gnus-data-unread-p d)) ; Or just unreads. | |
6451 (vectorp (gnus-data-header d)) ; It's not a pseudo. | |
6452 (string-match regexp (funcall func (gnus-data-header d))) ; Match. | |
6453 (push (gnus-data-number d) articles)) ; Success! | |
6454 (setq data (cdr data))) | |
6455 (nreverse articles))) | |
6456 | |
6457 (defun gnus-summary-execute-command (header regexp command &optional backward) | |
6458 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND. | |
6459 If HEADER is an empty string (or nil), the match is done on the entire | |
6460 article. If BACKWARD (the prefix) is non-nil, search backward instead." | |
6461 (interactive | |
6462 (list (let ((completion-ignore-case t)) | |
6463 (completing-read | |
6464 "Header name: " | |
6465 (mapcar (lambda (string) (list string)) | |
6466 '("Number" "Subject" "From" "Lines" "Date" | |
6467 "Message-ID" "Xref" "References" "Body")) | |
6468 nil 'require-match)) | |
6469 (read-string "Regexp: ") | |
6470 (read-key-sequence "Command: ") | |
6471 current-prefix-arg)) | |
6472 (when (equal header "Body") | |
6473 (setq header "")) | |
6474 (gnus-set-global-variables) | |
6475 ;; Hidden thread subtrees must be searched as well. | |
6476 (gnus-summary-show-all-threads) | |
6477 ;; We don't want to change current point nor window configuration. | |
6478 (save-excursion | |
6479 (save-window-excursion | |
6480 (gnus-message 6 "Executing %s..." (key-description command)) | |
6481 ;; We'd like to execute COMMAND interactively so as to give arguments. | |
6482 (gnus-execute header regexp | |
6483 `(call-interactively ',(key-binding command)) | |
6484 backward) | |
6485 (gnus-message 6 "Executing %s...done" (key-description command))))) | |
6486 | |
6487 (defun gnus-summary-beginning-of-article () | |
6488 "Scroll the article back to the beginning." | |
6489 (interactive) | |
6490 (gnus-set-global-variables) | |
6491 (gnus-summary-select-article) | |
6492 (gnus-configure-windows 'article) | |
6493 (gnus-eval-in-buffer-window gnus-article-buffer | |
6494 (widen) | |
6495 (goto-char (point-min)) | |
6496 (when gnus-page-broken | |
6497 (gnus-narrow-to-page)))) | |
6498 | |
6499 (defun gnus-summary-end-of-article () | |
6500 "Scroll to the end of the article." | |
6501 (interactive) | |
6502 (gnus-set-global-variables) | |
6503 (gnus-summary-select-article) | |
6504 (gnus-configure-windows 'article) | |
6505 (gnus-eval-in-buffer-window gnus-article-buffer | |
6506 (widen) | |
6507 (goto-char (point-max)) | |
6508 (recenter -3) | |
6509 (when gnus-page-broken | |
6510 (gnus-narrow-to-page)))) | |
6511 | |
6512 (defun gnus-summary-print-article (&optional filename) | |
6513 "Generate and print a PostScript image of the article buffer. | |
6514 | |
6515 If the optional argument FILENAME is nil, send the image to the printer. | |
6516 If FILENAME is a string, save the PostScript image in a file with that | |
6517 name. If FILENAME is a number, prompt the user for the name of the file | |
6518 to save in." | |
6519 (interactive (list (ps-print-preprint current-prefix-arg))) | |
6520 (gnus-summary-select-article) | |
6521 (gnus-eval-in-buffer-window gnus-article-buffer | |
6522 (let ((buffer (generate-new-buffer " *print*"))) | |
6523 (unwind-protect | |
6524 (progn | |
6525 (copy-to-buffer buffer (point-min) (point-max)) | |
6526 (set-buffer buffer) | |
6527 (gnus-article-delete-invisible-text) | |
6528 (run-hooks 'gnus-ps-print-hook) | |
6529 (ps-print-buffer-with-faces filename)) | |
6530 (kill-buffer buffer))))) | |
6531 | |
6532 (defun gnus-summary-show-article (&optional arg) | |
6533 "Force re-fetching of the current article. | |
6534 If ARG (the prefix) is non-nil, show the raw article without any | |
6535 article massaging functions being run." | |
6536 (interactive "P") | |
6537 (gnus-set-global-variables) | |
6538 (if (not arg) | |
6539 ;; Select the article the normal way. | |
6540 (gnus-summary-select-article nil 'force) | |
6541 ;; Bind the article treatment functions to nil. | |
6542 (let ((gnus-have-all-headers t) | |
6543 gnus-article-display-hook | |
6544 gnus-article-prepare-hook | |
6545 gnus-break-pages | |
6546 gnus-show-mime | |
6547 gnus-visual) | |
6548 (gnus-summary-select-article nil 'force))) | |
6549 (gnus-summary-goto-subject gnus-current-article) | |
6550 (gnus-summary-position-point)) | |
6551 | |
6552 (defun gnus-summary-verbose-headers (&optional arg) | |
6553 "Toggle permanent full header display. | |
6554 If ARG is a positive number, turn header display on. | |
6555 If ARG is a negative number, turn header display off." | |
6556 (interactive "P") | |
6557 (gnus-set-global-variables) | |
6558 (setq gnus-show-all-headers | |
6559 (cond ((or (not (numberp arg)) | |
6560 (zerop arg)) | |
6561 (not gnus-show-all-headers)) | |
6562 ((natnump arg) | |
6563 t))) | |
6564 (gnus-summary-show-article)) | |
6565 | |
6566 (defun gnus-summary-toggle-header (&optional arg) | |
6567 "Show the headers if they are hidden, or hide them if they are shown. | |
6568 If ARG is a positive number, show the entire header. | |
6569 If ARG is a negative number, hide the unwanted header lines." | |
6570 (interactive "P") | |
6571 (gnus-set-global-variables) | |
6572 (save-excursion | |
6573 (set-buffer gnus-article-buffer) | |
6574 (let* ((buffer-read-only nil) | |
6575 (inhibit-point-motion-hooks t) | |
6576 (hidden (text-property-any | |
6577 (goto-char (point-min)) (search-forward "\n\n") | |
6578 'invisible t)) | |
6579 e) | |
6580 (goto-char (point-min)) | |
6581 (when (search-forward "\n\n" nil t) | |
6582 (delete-region (point-min) (1- (point)))) | |
6583 (goto-char (point-min)) | |
6584 (save-excursion | |
6585 (set-buffer gnus-original-article-buffer) | |
6586 (goto-char (point-min)) | |
6587 (setq e (1- (or (search-forward "\n\n" nil t) (point-max))))) | |
6588 (insert-buffer-substring gnus-original-article-buffer 1 e) | |
6589 (let ((article-inhibit-hiding t)) | |
6590 (run-hooks 'gnus-article-display-hook)) | |
6591 (when (or (not hidden) (and (numberp arg) (< arg 0))) | |
6592 (gnus-article-hide-headers))))) | |
6593 | |
6594 (defun gnus-summary-show-all-headers () | |
6595 "Make all header lines visible." | |
6596 (interactive) | |
6597 (gnus-set-global-variables) | |
6598 (gnus-article-show-all-headers)) | |
6599 | |
6600 (defun gnus-summary-toggle-mime (&optional arg) | |
6601 "Toggle MIME processing. | |
6602 If ARG is a positive number, turn MIME processing on." | |
6603 (interactive "P") | |
6604 (gnus-set-global-variables) | |
6605 (setq gnus-show-mime | |
6606 (if (null arg) (not gnus-show-mime) | |
6607 (> (prefix-numeric-value arg) 0))) | |
6608 (gnus-summary-select-article t 'force)) | |
6609 | |
6610 (defun gnus-summary-caesar-message (&optional arg) | |
6611 "Caesar rotate the current article by 13. | |
6612 The numerical prefix specifies how many places to rotate each letter | |
6613 forward." | |
6614 (interactive "P") | |
6615 (gnus-set-global-variables) | |
6616 (gnus-summary-select-article) | |
6617 (let ((mail-header-separator "")) | |
6618 (gnus-eval-in-buffer-window gnus-article-buffer | |
6619 (save-restriction | |
6620 (widen) | |
6621 (let ((start (window-start)) | |
6622 buffer-read-only) | |
6623 (message-caesar-buffer-body arg) | |
6624 (set-window-start (get-buffer-window (current-buffer)) start)))))) | |
6625 | |
6626 (defun gnus-summary-stop-page-breaking () | |
6627 "Stop page breaking in the current article." | |
6628 (interactive) | |
6629 (gnus-set-global-variables) | |
6630 (gnus-summary-select-article) | |
6631 (gnus-eval-in-buffer-window gnus-article-buffer | |
6632 (widen) | |
6633 (when (gnus-visual-p 'page-marker) | |
6634 (let ((buffer-read-only nil)) | |
6635 (gnus-remove-text-with-property 'gnus-prev) | |
6636 (gnus-remove-text-with-property 'gnus-next))))) | |
6637 | |
6638 (defun gnus-summary-move-article (&optional n to-newsgroup | |
6639 select-method action) | |
6640 "Move the current article to a different newsgroup. | |
6641 If N is a positive number, move the N next articles. | |
6642 If N is a negative number, move the N previous articles. | |
6643 If N is nil and any articles have been marked with the process mark, | |
6644 move those articles instead. | |
6645 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to. | |
6646 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but | |
6647 re-spool using this method. | |
6648 | |
6649 For this function to work, both the current newsgroup and the | |
6650 newsgroup that you want to move to have to support the `request-move' | |
6651 and `request-accept' functions." | |
6652 (interactive "P") | |
6653 (unless action | |
6654 (setq action 'move)) | |
6655 (gnus-set-global-variables) | |
6656 ;; Disable marking as read. | |
6657 (let (gnus-mark-article-hook) | |
6658 (save-window-excursion | |
6659 (gnus-summary-select-article))) | |
6660 ;; Check whether the source group supports the required functions. | |
6661 (cond ((and (eq action 'move) | |
6662 (not (gnus-check-backend-function | |
6663 'request-move-article gnus-newsgroup-name))) | |
6664 (error "The current group does not support article moving")) | |
6665 ((and (eq action 'crosspost) | |
6666 (not (gnus-check-backend-function | |
6667 'request-replace-article gnus-newsgroup-name))) | |
6668 (error "The current group does not support article editing"))) | |
6669 (let ((articles (gnus-summary-work-articles n)) | |
6670 (prefix (gnus-group-real-prefix gnus-newsgroup-name)) | |
6671 (names '((move "Move" "Moving") | |
6672 (copy "Copy" "Copying") | |
6673 (crosspost "Crosspost" "Crossposting"))) | |
6674 (copy-buf (save-excursion | |
6675 (nnheader-set-temp-buffer " *copy article*"))) | |
6676 art-group to-method new-xref article to-groups) | |
6677 (unless (assq action names) | |
6678 (error "Unknown action %s" action)) | |
6679 ;; Read the newsgroup name. | |
6680 (when (and (not to-newsgroup) | |
6681 (not select-method)) | |
6682 (setq to-newsgroup | |
6683 (gnus-read-move-group-name | |
6684 (cadr (assq action names)) | |
6685 (symbol-value (intern (format "gnus-current-%s-group" action))) | |
6686 articles prefix)) | |
6687 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup)) | |
6688 (setq to-method (or select-method | |
6689 (gnus-group-name-to-method to-newsgroup))) | |
6690 ;; Check the method we are to move this article to... | |
6691 (unless (gnus-check-backend-function | |
6692 'request-accept-article (car to-method)) | |
6693 (error "%s does not support article copying" (car to-method))) | |
6694 (unless (gnus-check-server to-method) | |
6695 (error "Can't open server %s" (car to-method))) | |
6696 (gnus-message 6 "%s to %s: %s..." | |
6697 (caddr (assq action names)) | |
6698 (or (car select-method) to-newsgroup) articles) | |
6699 (while articles | |
6700 (setq article (pop articles)) | |
6701 (setq | |
6702 art-group | |
6703 (cond | |
6704 ;; Move the article. | |
6705 ((eq action 'move) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6706 ;; Remove this article from future suppression. |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6707 (gnus-dup-unsuppress-article article) |
17493 | 6708 (gnus-request-move-article |
6709 article ; Article to move | |
6710 gnus-newsgroup-name ; From newsgroup | |
6711 (nth 1 (gnus-find-method-for-group | |
6712 gnus-newsgroup-name)) ; Server | |
6713 (list 'gnus-request-accept-article | |
6714 to-newsgroup (list 'quote select-method) | |
6715 (not articles)) ; Accept form | |
6716 (not articles))) ; Only save nov last time | |
6717 ;; Copy the article. | |
6718 ((eq action 'copy) | |
6719 (save-excursion | |
6720 (set-buffer copy-buf) | |
6721 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6722 (gnus-request-accept-article | |
6723 to-newsgroup select-method (not articles)))) | |
6724 ;; Crosspost the article. | |
6725 ((eq action 'crosspost) | |
6726 (let ((xref (message-tokenize-header | |
6727 (mail-header-xref (gnus-summary-article-header article)) | |
6728 " "))) | |
6729 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name) | |
6730 ":" article)) | |
6731 (unless xref | |
6732 (setq xref (list (system-name)))) | |
6733 (setq new-xref | |
6734 (concat | |
6735 (mapconcat 'identity | |
6736 (delete "Xref:" (delete new-xref xref)) | |
6737 " ") | |
6738 " " new-xref)) | |
6739 (save-excursion | |
6740 (set-buffer copy-buf) | |
6741 ;; First put the article in the destination group. | |
6742 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6743 (when (consp (setq art-group | |
6744 (gnus-request-accept-article | |
6745 to-newsgroup select-method (not articles)))) | |
6746 (setq new-xref (concat new-xref " " (car art-group) | |
6747 ":" (cdr art-group))) | |
6748 ;; Now we have the new Xrefs header, so we insert | |
6749 ;; it and replace the new article. | |
6750 (nnheader-replace-header "Xref" new-xref) | |
6751 (gnus-request-replace-article | |
6752 (cdr art-group) to-newsgroup (current-buffer)) | |
6753 art-group)))))) | |
6754 (cond | |
6755 ((not art-group) | |
6756 (gnus-message 1 "Couldn't %s article %s" | |
6757 (cadr (assq action names)) article)) | |
6758 ((and (eq art-group 'junk) | |
6759 (eq action 'move)) | |
6760 (gnus-summary-mark-article article gnus-canceled-mark) | |
6761 (gnus-message 4 "Deleted article %s" article)) | |
6762 (t | |
6763 (let* ((entry | |
6764 (or | |
6765 (gnus-gethash (car art-group) gnus-newsrc-hashtb) | |
6766 (gnus-gethash | |
6767 (gnus-group-prefixed-name | |
6768 (car art-group) | |
6769 (or select-method | |
6770 (gnus-find-method-for-group to-newsgroup))) | |
6771 gnus-newsrc-hashtb))) | |
6772 (info (nth 2 entry)) | |
6773 (to-group (gnus-info-group info))) | |
6774 ;; Update the group that has been moved to. | |
6775 (when (and info | |
6776 (memq action '(move copy))) | |
6777 (unless (member to-group to-groups) | |
6778 (push to-group to-groups)) | |
6779 | |
6780 (unless (memq article gnus-newsgroup-unreads) | |
6781 (gnus-info-set-read | |
6782 info (gnus-add-to-range (gnus-info-read info) | |
6783 (list (cdr art-group))))) | |
6784 | |
6785 ;; Copy any marks over to the new group. | |
6786 (let ((marks gnus-article-mark-lists) | |
6787 (to-article (cdr art-group))) | |
6788 | |
6789 ;; See whether the article is to be put in the cache. | |
6790 (when gnus-use-cache | |
6791 (gnus-cache-possibly-enter-article | |
6792 to-group to-article | |
6793 (let ((header (copy-sequence | |
6794 (gnus-summary-article-header article)))) | |
6795 (mail-header-set-number header to-article) | |
6796 header) | |
6797 (memq article gnus-newsgroup-marked) | |
6798 (memq article gnus-newsgroup-dormant) | |
6799 (memq article gnus-newsgroup-unreads))) | |
6800 | |
6801 (when (and (equal to-group gnus-newsgroup-name) | |
6802 (not (memq article gnus-newsgroup-unreads))) | |
6803 ;; Mark this article as read in this group. | |
6804 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads) | |
6805 (setcdr (gnus-active to-group) to-article) | |
6806 (setcdr gnus-newsgroup-active to-article)) | |
6807 | |
6808 (while marks | |
6809 (when (memq article (symbol-value | |
6810 (intern (format "gnus-newsgroup-%s" | |
6811 (caar marks))))) | |
6812 ;; If the other group is the same as this group, | |
6813 ;; then we have to add the mark to the list. | |
6814 (when (equal to-group gnus-newsgroup-name) | |
6815 (set (intern (format "gnus-newsgroup-%s" (caar marks))) | |
6816 (cons to-article | |
6817 (symbol-value | |
6818 (intern (format "gnus-newsgroup-%s" | |
6819 (caar marks))))))) | |
6820 ;; Copy the marks to other group. | |
6821 (gnus-add-marked-articles | |
6822 to-group (cdar marks) (list to-article) info)) | |
6823 (setq marks (cdr marks))) | |
6824 | |
6825 (gnus-dribble-enter | |
6826 (concat "(gnus-group-set-info '" | |
6827 (gnus-prin1-to-string (gnus-get-info to-group)) | |
6828 ")")))) | |
6829 | |
6830 ;; Update the Xref header in this article to point to | |
6831 ;; the new crossposted article we have just created. | |
6832 (when (eq action 'crosspost) | |
6833 (save-excursion | |
6834 (set-buffer copy-buf) | |
6835 (gnus-request-article-this-buffer article gnus-newsgroup-name) | |
6836 (nnheader-replace-header "Xref" new-xref) | |
6837 (gnus-request-replace-article | |
6838 article gnus-newsgroup-name (current-buffer))))) | |
6839 | |
6840 (gnus-summary-goto-subject article) | |
6841 (when (eq action 'move) | |
6842 (gnus-summary-mark-article article gnus-canceled-mark)))) | |
6843 (gnus-summary-remove-process-mark article)) | |
6844 ;; Re-activate all groups that have been moved to. | |
6845 (while to-groups | |
6846 (save-excursion | |
6847 (set-buffer gnus-group-buffer) | |
6848 (when (gnus-group-goto-group (car to-groups) t) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
6849 (gnus-group-get-new-news-this-group 1 t)) |
17493 | 6850 (pop to-groups))) |
6851 | |
6852 (gnus-kill-buffer copy-buf) | |
6853 (gnus-summary-position-point) | |
6854 (gnus-set-mode-line 'summary))) | |
6855 | |
6856 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method) | |
6857 "Move the current article to a different newsgroup. | |
6858 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to. | |
6859 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but | |
6860 re-spool using this method." | |
6861 (interactive "P") | |
6862 (gnus-summary-move-article n to-newsgroup select-method 'copy)) | |
6863 | |
6864 (defun gnus-summary-crosspost-article (&optional n) | |
6865 "Crosspost the current article to some other group." | |
6866 (interactive "P") | |
6867 (gnus-summary-move-article n nil nil 'crosspost)) | |
6868 | |
6869 (defcustom gnus-summary-respool-default-method nil | |
6870 "Default method for respooling an article. | |
6871 If nil, use to the current newsgroup method." | |
23363
41843e16f6ac
(gnus-summary-respool-default-method): Fix type.
Karl Heuer <kwzh@gnu.org>
parents:
20117
diff
changeset
|
6872 :type '(choice (gnus-select-method :value (nnml "")) |
41843e16f6ac
(gnus-summary-respool-default-method): Fix type.
Karl Heuer <kwzh@gnu.org>
parents:
20117
diff
changeset
|
6873 (const nil)) |
17493 | 6874 :group 'gnus-summary-mail) |
6875 | |
6876 (defun gnus-summary-respool-article (&optional n method) | |
6877 "Respool the current article. | |
6878 The article will be squeezed through the mail spooling process again, | |
6879 which means that it will be put in some mail newsgroup or other | |
6880 depending on `nnmail-split-methods'. | |
6881 If N is a positive number, respool the N next articles. | |
6882 If N is a negative number, respool the N previous articles. | |
6883 If N is nil and any articles have been marked with the process mark, | |
6884 respool those articles instead. | |
6885 | |
6886 Respooling can be done both from mail groups and \"real\" newsgroups. | |
6887 In the former case, the articles in question will be moved from the | |
6888 current group into whatever groups they are destined to. In the | |
6889 latter case, they will be copied into the relevant groups." | |
6890 (interactive | |
6891 (list current-prefix-arg | |
6892 (let* ((methods (gnus-methods-using 'respool)) | |
6893 (methname | |
6894 (symbol-name (or gnus-summary-respool-default-method | |
6895 (car (gnus-find-method-for-group | |
6896 gnus-newsgroup-name))))) | |
6897 (method | |
6898 (gnus-completing-read | |
6899 methname "What backend do you want to use when respooling?" | |
6900 methods nil t nil 'gnus-mail-method-history)) | |
6901 ms) | |
6902 (cond | |
6903 ((zerop (length (setq ms (gnus-servers-using-backend | |
6904 (intern method))))) | |
6905 (list (intern method) "")) | |
6906 ((= 1 (length ms)) | |
6907 (car ms)) | |
6908 (t | |
6909 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms))) | |
6910 (cdr (assoc (completing-read "Server name: " ms-alist nil t) | |
6911 ms-alist)))))))) | |
6912 (gnus-set-global-variables) | |
6913 (unless method | |
6914 (error "No method given for respooling")) | |
6915 (if (assoc (symbol-name | |
6916 (car (gnus-find-method-for-group gnus-newsgroup-name))) | |
6917 (gnus-methods-using 'respool)) | |
6918 (gnus-summary-move-article n nil method) | |
6919 (gnus-summary-copy-article n nil method))) | |
6920 | |
6921 (defun gnus-summary-import-article (file) | |
6922 "Import a random file into a mail newsgroup." | |
6923 (interactive "fImport file: ") | |
6924 (gnus-set-global-variables) | |
6925 (let ((group gnus-newsgroup-name) | |
6926 (now (current-time)) | |
6927 atts lines) | |
6928 (unless (gnus-check-backend-function 'request-accept-article group) | |
6929 (error "%s does not support article importing" group)) | |
6930 (or (file-readable-p file) | |
6931 (not (file-regular-p file)) | |
6932 (error "Can't read %s" file)) | |
6933 (save-excursion | |
6934 (set-buffer (get-buffer-create " *import file*")) | |
6935 (buffer-disable-undo (current-buffer)) | |
6936 (erase-buffer) | |
6937 (insert-file-contents file) | |
6938 (goto-char (point-min)) | |
6939 (unless (nnheader-article-p) | |
6940 ;; This doesn't look like an article, so we fudge some headers. | |
6941 (setq atts (file-attributes file) | |
6942 lines (count-lines (point-min) (point-max))) | |
6943 (insert "From: " (read-string "From: ") "\n" | |
6944 "Subject: " (read-string "Subject: ") "\n" | |
6945 "Date: " (timezone-make-date-arpa-standard | |
6946 (current-time-string (nth 5 atts)) | |
6947 (current-time-zone now) | |
6948 (current-time-zone now)) | |
6949 "\n" | |
6950 "Message-ID: " (message-make-message-id) "\n" | |
6951 "Lines: " (int-to-string lines) "\n" | |
6952 "Chars: " (int-to-string (nth 7 atts)) "\n\n")) | |
6953 (gnus-request-accept-article group nil t) | |
6954 (kill-buffer (current-buffer))))) | |
6955 | |
6956 (defun gnus-summary-article-posted-p () | |
6957 "Say whether the current (mail) article is available from `gnus-select-method' as well. | |
6958 This will be the case if the article has both been mailed and posted." | |
6959 (interactive) | |
6960 (let ((id (mail-header-references (gnus-summary-article-header))) | |
6961 (gnus-override-method | |
6962 (or gnus-refer-article-method gnus-select-method))) | |
6963 (if (gnus-request-head id "") | |
6964 (gnus-message 2 "The current message was found on %s" | |
6965 gnus-override-method) | |
6966 (gnus-message 2 "The current message couldn't be found on %s" | |
6967 gnus-override-method) | |
6968 nil))) | |
6969 | |
6970 (defun gnus-summary-expire-articles (&optional now) | |
6971 "Expire all articles that are marked as expirable in the current group." | |
6972 (interactive) | |
6973 (gnus-set-global-variables) | |
6974 (when (gnus-check-backend-function | |
6975 'request-expire-articles gnus-newsgroup-name) | |
6976 ;; This backend supports expiry. | |
6977 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name)) | |
6978 (expirable (if total | |
6979 (progn | |
6980 ;; We need to update the info for | |
6981 ;; this group for `gnus-list-of-read-articles' | |
6982 ;; to give us the right answer. | |
6983 (run-hooks 'gnus-exit-group-hook) | |
6984 (gnus-summary-update-info) | |
6985 (gnus-list-of-read-articles gnus-newsgroup-name)) | |
6986 (setq gnus-newsgroup-expirable | |
6987 (sort gnus-newsgroup-expirable '<)))) | |
6988 (expiry-wait (if now 'immediate | |
6989 (gnus-group-find-parameter | |
6990 gnus-newsgroup-name 'expiry-wait))) | |
6991 es) | |
6992 (when expirable | |
6993 ;; There are expirable articles in this group, so we run them | |
6994 ;; through the expiry process. | |
6995 (gnus-message 6 "Expiring articles...") | |
6996 ;; The list of articles that weren't expired is returned. | |
6997 (if expiry-wait | |
6998 (let ((nnmail-expiry-wait-function nil) | |
6999 (nnmail-expiry-wait expiry-wait)) | |
7000 (setq es (gnus-request-expire-articles | |
7001 expirable gnus-newsgroup-name))) | |
7002 (setq es (gnus-request-expire-articles | |
7003 expirable gnus-newsgroup-name))) | |
7004 (unless total | |
7005 (setq gnus-newsgroup-expirable es)) | |
7006 ;; We go through the old list of expirable, and mark all | |
7007 ;; really expired articles as nonexistent. | |
7008 (unless (eq es expirable) ;If nothing was expired, we don't mark. | |
7009 (let ((gnus-use-cache nil)) | |
7010 (while expirable | |
7011 (unless (memq (car expirable) es) | |
7012 (when (gnus-data-find (car expirable)) | |
7013 (gnus-summary-mark-article | |
7014 (car expirable) gnus-canceled-mark))) | |
7015 (setq expirable (cdr expirable))))) | |
7016 (gnus-message 6 "Expiring articles...done"))))) | |
7017 | |
7018 (defun gnus-summary-expire-articles-now () | |
7019 "Expunge all expirable articles in the current group. | |
7020 This means that *all* articles that are marked as expirable will be | |
7021 deleted forever, right now." | |
7022 (interactive) | |
7023 (gnus-set-global-variables) | |
7024 (or gnus-expert-user | |
7025 (gnus-yes-or-no-p | |
7026 "Are you really, really, really sure you want to delete all these messages? ") | |
7027 (error "Phew!")) | |
7028 (gnus-summary-expire-articles t)) | |
7029 | |
7030 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>. | |
7031 (defun gnus-summary-delete-article (&optional n) | |
7032 "Delete the N next (mail) articles. | |
7033 This command actually deletes articles. This is not a marking | |
7034 command. The article will disappear forever from your life, never to | |
7035 return. | |
7036 If N is negative, delete backwards. | |
7037 If N is nil and articles have been marked with the process mark, | |
7038 delete these instead." | |
7039 (interactive "P") | |
7040 (gnus-set-global-variables) | |
7041 (unless (gnus-check-backend-function 'request-expire-articles | |
7042 gnus-newsgroup-name) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7043 (error "The current newsgroup does not support article deletion")) |
17493 | 7044 ;; Compute the list of articles to delete. |
7045 (let ((articles (gnus-summary-work-articles n)) | |
7046 not-deleted) | |
7047 (if (and gnus-novice-user | |
7048 (not (gnus-yes-or-no-p | |
7049 (format "Do you really want to delete %s forever? " | |
7050 (if (> (length articles) 1) | |
7051 (format "these %s articles" (length articles)) | |
7052 "this article"))))) | |
7053 () | |
7054 ;; Delete the articles. | |
7055 (setq not-deleted (gnus-request-expire-articles | |
7056 articles gnus-newsgroup-name 'force)) | |
7057 (while articles | |
7058 (gnus-summary-remove-process-mark (car articles)) | |
7059 ;; The backend might not have been able to delete the article | |
7060 ;; after all. | |
7061 (unless (memq (car articles) not-deleted) | |
7062 (gnus-summary-mark-article (car articles) gnus-canceled-mark)) | |
7063 (setq articles (cdr articles))) | |
7064 (when not-deleted | |
7065 (gnus-message 4 "Couldn't delete articles %s" not-deleted))) | |
7066 (gnus-summary-position-point) | |
7067 (gnus-set-mode-line 'summary) | |
7068 not-deleted)) | |
7069 | |
7070 (defun gnus-summary-edit-article (&optional force) | |
7071 "Edit the current article. | |
7072 This will have permanent effect only in mail groups. | |
7073 If FORCE is non-nil, allow editing of articles even in read-only | |
7074 groups." | |
7075 (interactive "P") | |
7076 (save-excursion | |
7077 (set-buffer gnus-summary-buffer) | |
7078 (gnus-set-global-variables) | |
7079 (when (and (not force) | |
7080 (gnus-group-read-only-p)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7081 (error "The current newsgroup does not support article editing")) |
17493 | 7082 ;; Select article if needed. |
7083 (unless (eq (gnus-summary-article-number) | |
7084 gnus-current-article) | |
7085 (gnus-summary-select-article t)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7086 (gnus-article-date-original) |
17493 | 7087 (gnus-article-edit-article |
7088 `(lambda () | |
7089 (gnus-summary-edit-article-done | |
7090 ,(or (mail-header-references gnus-current-headers) "") | |
7091 ,(gnus-group-read-only-p) ,gnus-summary-buffer))))) | |
7092 | |
7093 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit) | |
7094 | |
7095 (defun gnus-summary-edit-article-done (&optional references read-only buffer) | |
7096 "Make edits to the current article permanent." | |
7097 (interactive) | |
7098 ;; Replace the article. | |
7099 (if (and (not read-only) | |
7100 (not (gnus-request-replace-article | |
7101 (cdr gnus-article-current) (car gnus-article-current) | |
7102 (current-buffer)))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7103 (error "Couldn't replace article") |
17493 | 7104 ;; Update the summary buffer. |
7105 (if (and references | |
7106 (equal (message-tokenize-header references " ") | |
7107 (message-tokenize-header | |
7108 (or (message-fetch-field "references") "") " "))) | |
7109 ;; We only have to update this line. | |
7110 (save-excursion | |
7111 (save-restriction | |
7112 (message-narrow-to-head) | |
7113 (let ((head (buffer-string)) | |
7114 header) | |
7115 (nnheader-temp-write nil | |
7116 (insert (format "211 %d Article retrieved.\n" | |
7117 (cdr gnus-article-current))) | |
7118 (insert head) | |
7119 (insert ".\n") | |
7120 (let ((nntp-server-buffer (current-buffer))) | |
7121 (setq header (car (gnus-get-newsgroup-headers | |
7122 (save-excursion | |
7123 (set-buffer gnus-summary-buffer) | |
7124 gnus-newsgroup-dependencies) | |
7125 t)))) | |
7126 (save-excursion | |
7127 (set-buffer gnus-summary-buffer) | |
7128 (gnus-data-set-header | |
7129 (gnus-data-find (cdr gnus-article-current)) | |
7130 header) | |
7131 (gnus-summary-update-article-line | |
7132 (cdr gnus-article-current) header)))))) | |
7133 ;; Update threads. | |
7134 (set-buffer (or buffer gnus-summary-buffer)) | |
7135 (gnus-summary-update-article (cdr gnus-article-current))) | |
7136 ;; Prettify the article buffer again. | |
7137 (save-excursion | |
7138 (set-buffer gnus-article-buffer) | |
7139 (run-hooks 'gnus-article-display-hook) | |
7140 (set-buffer gnus-original-article-buffer) | |
7141 (gnus-request-article | |
7142 (cdr gnus-article-current) (car gnus-article-current) (current-buffer))) | |
7143 ;; Prettify the summary buffer line. | |
7144 (when (gnus-visual-p 'summary-highlight 'highlight) | |
7145 (run-hooks 'gnus-visual-mark-article-hook)))) | |
7146 | |
7147 (defun gnus-summary-edit-wash (key) | |
7148 "Perform editing command in the article buffer." | |
7149 (interactive | |
7150 (list | |
7151 (progn | |
7152 (message "%s" (concat (this-command-keys) "- ")) | |
7153 (read-char)))) | |
7154 (message "") | |
7155 (gnus-summary-edit-article) | |
7156 (execute-kbd-macro (concat (this-command-keys) key)) | |
7157 (gnus-article-edit-done)) | |
7158 | |
7159 ;;; Respooling | |
7160 | |
7161 (defun gnus-summary-respool-query (&optional silent) | |
7162 "Query where the respool algorithm would put this article." | |
7163 (interactive) | |
7164 (gnus-set-global-variables) | |
7165 (let (gnus-mark-article-hook) | |
7166 (gnus-summary-select-article) | |
7167 (save-excursion | |
7168 (set-buffer gnus-original-article-buffer) | |
7169 (save-restriction | |
7170 (message-narrow-to-head) | |
7171 (let ((groups (nnmail-article-group 'identity))) | |
7172 (unless silent | |
7173 (if groups | |
7174 (message "This message would go to %s" | |
7175 (mapconcat 'car groups ", ")) | |
7176 (message "This message would go to no groups")) | |
7177 groups)))))) | |
7178 | |
7179 ;; Summary marking commands. | |
7180 | |
7181 (defun gnus-summary-kill-same-subject-and-select (&optional unmark) | |
7182 "Mark articles which has the same subject as read, and then select the next. | |
7183 If UNMARK is positive, remove any kind of mark. | |
7184 If UNMARK is negative, tick articles." | |
7185 (interactive "P") | |
7186 (gnus-set-global-variables) | |
7187 (when unmark | |
7188 (setq unmark (prefix-numeric-value unmark))) | |
7189 (let ((count | |
7190 (gnus-summary-mark-same-subject | |
7191 (gnus-summary-article-subject) unmark))) | |
7192 ;; Select next unread article. If auto-select-same mode, should | |
7193 ;; select the first unread article. | |
7194 (gnus-summary-next-article t (and gnus-auto-select-same | |
7195 (gnus-summary-article-subject))) | |
7196 (gnus-message 7 "%d article%s marked as %s" | |
7197 count (if (= count 1) " is" "s are") | |
7198 (if unmark "unread" "read")))) | |
7199 | |
7200 (defun gnus-summary-kill-same-subject (&optional unmark) | |
7201 "Mark articles which has the same subject as read. | |
7202 If UNMARK is positive, remove any kind of mark. | |
7203 If UNMARK is negative, tick articles." | |
7204 (interactive "P") | |
7205 (gnus-set-global-variables) | |
7206 (when unmark | |
7207 (setq unmark (prefix-numeric-value unmark))) | |
7208 (let ((count | |
7209 (gnus-summary-mark-same-subject | |
7210 (gnus-summary-article-subject) unmark))) | |
7211 ;; If marked as read, go to next unread subject. | |
7212 (when (null unmark) | |
7213 ;; Go to next unread subject. | |
7214 (gnus-summary-next-subject 1 t)) | |
7215 (gnus-message 7 "%d articles are marked as %s" | |
7216 count (if unmark "unread" "read")))) | |
7217 | |
7218 (defun gnus-summary-mark-same-subject (subject &optional unmark) | |
7219 "Mark articles with same SUBJECT as read, and return marked number. | |
7220 If optional argument UNMARK is positive, remove any kinds of marks. | |
7221 If optional argument UNMARK is negative, mark articles as unread instead." | |
7222 (let ((count 1)) | |
7223 (save-excursion | |
7224 (cond | |
7225 ((null unmark) ; Mark as read. | |
7226 (while (and | |
7227 (progn | |
7228 (gnus-summary-mark-article-as-read gnus-killed-mark) | |
7229 (gnus-summary-show-thread) t) | |
7230 (gnus-summary-find-subject subject)) | |
7231 (setq count (1+ count)))) | |
7232 ((> unmark 0) ; Tick. | |
7233 (while (and | |
7234 (progn | |
7235 (gnus-summary-mark-article-as-unread gnus-ticked-mark) | |
7236 (gnus-summary-show-thread) t) | |
7237 (gnus-summary-find-subject subject)) | |
7238 (setq count (1+ count)))) | |
7239 (t ; Mark as unread. | |
7240 (while (and | |
7241 (progn | |
7242 (gnus-summary-mark-article-as-unread gnus-unread-mark) | |
7243 (gnus-summary-show-thread) t) | |
7244 (gnus-summary-find-subject subject)) | |
7245 (setq count (1+ count))))) | |
7246 (gnus-set-mode-line 'summary) | |
7247 ;; Return the number of marked articles. | |
7248 count))) | |
7249 | |
7250 (defun gnus-summary-mark-as-processable (n &optional unmark) | |
7251 "Set the process mark on the next N articles. | |
7252 If N is negative, mark backward instead. If UNMARK is non-nil, remove | |
7253 the process mark instead. The difference between N and the actual | |
7254 number of articles marked is returned." | |
7255 (interactive "p") | |
7256 (gnus-set-global-variables) | |
7257 (let ((backward (< n 0)) | |
7258 (n (abs n))) | |
7259 (while (and | |
7260 (> n 0) | |
7261 (if unmark | |
7262 (gnus-summary-remove-process-mark | |
7263 (gnus-summary-article-number)) | |
7264 (gnus-summary-set-process-mark (gnus-summary-article-number))) | |
7265 (zerop (gnus-summary-next-subject (if backward -1 1) nil t))) | |
7266 (setq n (1- n))) | |
7267 (when (/= 0 n) | |
7268 (gnus-message 7 "No more articles")) | |
7269 (gnus-summary-recenter) | |
7270 (gnus-summary-position-point) | |
7271 n)) | |
7272 | |
7273 (defun gnus-summary-unmark-as-processable (n) | |
7274 "Remove the process mark from the next N articles. | |
7275 If N is negative, mark backward instead. The difference between N and | |
7276 the actual number of articles marked is returned." | |
7277 (interactive "p") | |
7278 (gnus-set-global-variables) | |
7279 (gnus-summary-mark-as-processable n t)) | |
7280 | |
7281 (defun gnus-summary-unmark-all-processable () | |
7282 "Remove the process mark from all articles." | |
7283 (interactive) | |
7284 (gnus-set-global-variables) | |
7285 (save-excursion | |
7286 (while gnus-newsgroup-processable | |
7287 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable)))) | |
7288 (gnus-summary-position-point)) | |
7289 | |
7290 (defun gnus-summary-mark-as-expirable (n) | |
7291 "Mark N articles forward as expirable. | |
7292 If N is negative, mark backward instead. The difference between N and | |
7293 the actual number of articles marked is returned." | |
7294 (interactive "p") | |
7295 (gnus-set-global-variables) | |
7296 (gnus-summary-mark-forward n gnus-expirable-mark)) | |
7297 | |
7298 (defun gnus-summary-mark-article-as-replied (article) | |
7299 "Mark ARTICLE replied and update the summary line." | |
7300 (push article gnus-newsgroup-replied) | |
7301 (let ((buffer-read-only nil)) | |
7302 (when (gnus-summary-goto-subject article) | |
7303 (gnus-summary-update-secondary-mark article)))) | |
7304 | |
7305 (defun gnus-summary-set-bookmark (article) | |
7306 "Set a bookmark in current article." | |
7307 (interactive (list (gnus-summary-article-number))) | |
7308 (gnus-set-global-variables) | |
7309 (when (or (not (get-buffer gnus-article-buffer)) | |
7310 (not gnus-current-article) | |
7311 (not gnus-article-current) | |
7312 (not (equal gnus-newsgroup-name (car gnus-article-current)))) | |
7313 (error "No current article selected")) | |
7314 ;; Remove old bookmark, if one exists. | |
7315 (let ((old (assq article gnus-newsgroup-bookmarks))) | |
7316 (when old | |
7317 (setq gnus-newsgroup-bookmarks | |
7318 (delq old gnus-newsgroup-bookmarks)))) | |
7319 ;; Set the new bookmark, which is on the form | |
7320 ;; (article-number . line-number-in-body). | |
7321 (push | |
7322 (cons article | |
7323 (save-excursion | |
7324 (set-buffer gnus-article-buffer) | |
7325 (count-lines | |
7326 (min (point) | |
7327 (save-excursion | |
7328 (goto-char (point-min)) | |
7329 (search-forward "\n\n" nil t) | |
7330 (point))) | |
7331 (point)))) | |
7332 gnus-newsgroup-bookmarks) | |
7333 (gnus-message 6 "A bookmark has been added to the current article.")) | |
7334 | |
7335 (defun gnus-summary-remove-bookmark (article) | |
7336 "Remove the bookmark from the current article." | |
7337 (interactive (list (gnus-summary-article-number))) | |
7338 (gnus-set-global-variables) | |
7339 ;; Remove old bookmark, if one exists. | |
7340 (let ((old (assq article gnus-newsgroup-bookmarks))) | |
7341 (if old | |
7342 (progn | |
7343 (setq gnus-newsgroup-bookmarks | |
7344 (delq old gnus-newsgroup-bookmarks)) | |
7345 (gnus-message 6 "Removed bookmark.")) | |
7346 (gnus-message 6 "No bookmark in current article.")))) | |
7347 | |
7348 ;; Suggested by Daniel Quinlan <quinlan@best.com>. | |
7349 (defun gnus-summary-mark-as-dormant (n) | |
7350 "Mark N articles forward as dormant. | |
7351 If N is negative, mark backward instead. The difference between N and | |
7352 the actual number of articles marked is returned." | |
7353 (interactive "p") | |
7354 (gnus-set-global-variables) | |
7355 (gnus-summary-mark-forward n gnus-dormant-mark)) | |
7356 | |
7357 (defun gnus-summary-set-process-mark (article) | |
7358 "Set the process mark on ARTICLE and update the summary line." | |
7359 (setq gnus-newsgroup-processable | |
7360 (cons article | |
7361 (delq article gnus-newsgroup-processable))) | |
7362 (when (gnus-summary-goto-subject article) | |
7363 (gnus-summary-show-thread) | |
7364 (gnus-summary-update-secondary-mark article))) | |
7365 | |
7366 (defun gnus-summary-remove-process-mark (article) | |
7367 "Remove the process mark from ARTICLE and update the summary line." | |
7368 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable)) | |
7369 (when (gnus-summary-goto-subject article) | |
7370 (gnus-summary-show-thread) | |
7371 (gnus-summary-update-secondary-mark article))) | |
7372 | |
7373 (defun gnus-summary-set-saved-mark (article) | |
7374 "Set the process mark on ARTICLE and update the summary line." | |
7375 (push article gnus-newsgroup-saved) | |
7376 (when (gnus-summary-goto-subject article) | |
7377 (gnus-summary-update-secondary-mark article))) | |
7378 | |
7379 (defun gnus-summary-mark-forward (n &optional mark no-expire) | |
7380 "Mark N articles as read forwards. | |
7381 If N is negative, mark backwards instead. Mark with MARK, ?r by default. | |
7382 The difference between N and the actual number of articles marked is | |
7383 returned." | |
7384 (interactive "p") | |
7385 (gnus-set-global-variables) | |
7386 (let ((backward (< n 0)) | |
7387 (gnus-summary-goto-unread | |
7388 (and gnus-summary-goto-unread | |
7389 (not (eq gnus-summary-goto-unread 'never)) | |
7390 (not (memq mark (list gnus-unread-mark | |
7391 gnus-ticked-mark gnus-dormant-mark))))) | |
7392 (n (abs n)) | |
7393 (mark (or mark gnus-del-mark))) | |
7394 (while (and (> n 0) | |
7395 (gnus-summary-mark-article nil mark no-expire) | |
7396 (zerop (gnus-summary-next-subject | |
7397 (if backward -1 1) | |
7398 (and gnus-summary-goto-unread | |
7399 (not (eq gnus-summary-goto-unread 'never))) | |
7400 t))) | |
7401 (setq n (1- n))) | |
7402 (when (/= 0 n) | |
7403 (gnus-message 7 "No more %sarticles" (if mark "" "unread "))) | |
7404 (gnus-summary-recenter) | |
7405 (gnus-summary-position-point) | |
7406 (gnus-set-mode-line 'summary) | |
7407 n)) | |
7408 | |
7409 (defun gnus-summary-mark-article-as-read (mark) | |
7410 "Mark the current article quickly as read with MARK." | |
7411 (let ((article (gnus-summary-article-number))) | |
7412 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7413 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7414 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7415 (push (cons article mark) gnus-newsgroup-reads) | |
7416 ;; Possibly remove from cache, if that is used. | |
7417 (when gnus-use-cache | |
7418 (gnus-cache-enter-remove-article article)) | |
7419 ;; Allow the backend to change the mark. | |
7420 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark)) | |
7421 ;; Check for auto-expiry. | |
7422 (when (and gnus-newsgroup-auto-expire | |
7423 (or (= mark gnus-killed-mark) (= mark gnus-del-mark) | |
7424 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark) | |
7425 (= mark gnus-ancient-mark) | |
7426 (= mark gnus-read-mark) (= mark gnus-souped-mark) | |
7427 (= mark gnus-duplicate-mark))) | |
7428 (setq mark gnus-expirable-mark) | |
7429 (push article gnus-newsgroup-expirable)) | |
7430 ;; Set the mark in the buffer. | |
7431 (gnus-summary-update-mark mark 'unread) | |
7432 t)) | |
7433 | |
7434 (defun gnus-summary-mark-article-as-unread (mark) | |
7435 "Mark the current article quickly as unread with MARK." | |
7436 (let ((article (gnus-summary-article-number))) | |
7437 (if (< article 0) | |
7438 (gnus-error 1 "Unmarkable article") | |
7439 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7440 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7441 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)) | |
7442 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads)) | |
7443 (cond ((= mark gnus-ticked-mark) | |
7444 (push article gnus-newsgroup-marked)) | |
7445 ((= mark gnus-dormant-mark) | |
7446 (push article gnus-newsgroup-dormant)) | |
7447 (t | |
7448 (push article gnus-newsgroup-unreads))) | |
7449 (setq gnus-newsgroup-reads | |
7450 (delq (assq article gnus-newsgroup-reads) | |
7451 gnus-newsgroup-reads)) | |
7452 | |
7453 ;; See whether the article is to be put in the cache. | |
7454 (and gnus-use-cache | |
7455 (vectorp (gnus-summary-article-header article)) | |
7456 (save-excursion | |
7457 (gnus-cache-possibly-enter-article | |
7458 gnus-newsgroup-name article | |
7459 (gnus-summary-article-header article) | |
7460 (= mark gnus-ticked-mark) | |
7461 (= mark gnus-dormant-mark) (= mark gnus-unread-mark)))) | |
7462 | |
7463 ;; Fix the mark. | |
7464 (gnus-summary-update-mark mark 'unread)) | |
7465 t)) | |
7466 | |
7467 (defun gnus-summary-mark-article (&optional article mark no-expire) | |
7468 "Mark ARTICLE with MARK. MARK can be any character. | |
7469 Four MARK strings are reserved: `? ' (unread), `?!' (ticked), | |
7470 `??' (dormant) and `?E' (expirable). | |
7471 If MARK is nil, then the default character `?D' is used. | |
7472 If ARTICLE is nil, then the article on the current line will be | |
7473 marked." | |
7474 ;; The mark might be a string. | |
7475 (when (stringp mark) | |
7476 (setq mark (aref mark 0))) | |
7477 ;; If no mark is given, then we check auto-expiring. | |
7478 (and (not no-expire) | |
7479 gnus-newsgroup-auto-expire | |
7480 (or (not mark) | |
7481 (and (gnus-characterp mark) | |
7482 (or (= mark gnus-killed-mark) (= mark gnus-del-mark) | |
7483 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark) | |
7484 (= mark gnus-read-mark) (= mark gnus-souped-mark) | |
7485 (= mark gnus-duplicate-mark)))) | |
7486 (setq mark gnus-expirable-mark)) | |
7487 (let* ((mark (or mark gnus-del-mark)) | |
7488 (article (or article (gnus-summary-article-number)))) | |
7489 (unless article | |
7490 (error "No article on current line")) | |
7491 (if (or (= mark gnus-unread-mark) | |
7492 (= mark gnus-ticked-mark) | |
7493 (= mark gnus-dormant-mark)) | |
7494 (gnus-mark-article-as-unread article mark) | |
7495 (gnus-mark-article-as-read article mark)) | |
7496 | |
7497 ;; See whether the article is to be put in the cache. | |
7498 (and gnus-use-cache | |
7499 (not (= mark gnus-canceled-mark)) | |
7500 (vectorp (gnus-summary-article-header article)) | |
7501 (save-excursion | |
7502 (gnus-cache-possibly-enter-article | |
7503 gnus-newsgroup-name article | |
7504 (gnus-summary-article-header article) | |
7505 (= mark gnus-ticked-mark) | |
7506 (= mark gnus-dormant-mark) (= mark gnus-unread-mark)))) | |
7507 | |
7508 (when (gnus-summary-goto-subject article nil t) | |
7509 (let ((buffer-read-only nil)) | |
7510 (gnus-summary-show-thread) | |
7511 ;; Fix the mark. | |
7512 (gnus-summary-update-mark mark 'unread) | |
7513 t)))) | |
7514 | |
7515 (defun gnus-summary-update-secondary-mark (article) | |
7516 "Update the secondary (read, process, cache) mark." | |
7517 (gnus-summary-update-mark | |
7518 (cond ((memq article gnus-newsgroup-processable) | |
7519 gnus-process-mark) | |
7520 ((memq article gnus-newsgroup-cached) | |
7521 gnus-cached-mark) | |
7522 ((memq article gnus-newsgroup-replied) | |
7523 gnus-replied-mark) | |
7524 ((memq article gnus-newsgroup-saved) | |
7525 gnus-saved-mark) | |
7526 (t gnus-unread-mark)) | |
7527 'replied) | |
7528 (when (gnus-visual-p 'summary-highlight 'highlight) | |
7529 (run-hooks 'gnus-summary-update-hook)) | |
7530 t) | |
7531 | |
7532 (defun gnus-summary-update-mark (mark type) | |
7533 (let ((forward (cdr (assq type gnus-summary-mark-positions))) | |
7534 (buffer-read-only nil)) | |
7535 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit) | |
7536 (when (looking-at "\r") | |
7537 (incf forward)) | |
7538 (when (and forward | |
7539 (<= (+ forward (point)) (point-max))) | |
7540 ;; Go to the right position on the line. | |
7541 (goto-char (+ forward (point))) | |
7542 ;; Replace the old mark with the new mark. | |
7543 (subst-char-in-region (point) (1+ (point)) (following-char) mark) | |
7544 ;; Optionally update the marks by some user rule. | |
7545 (when (eq type 'unread) | |
7546 (gnus-data-set-mark | |
7547 (gnus-data-find (gnus-summary-article-number)) mark) | |
7548 (gnus-summary-update-line (eq mark gnus-unread-mark)))))) | |
7549 | |
7550 (defun gnus-mark-article-as-read (article &optional mark) | |
7551 "Enter ARTICLE in the pertinent lists and remove it from others." | |
7552 ;; Make the article expirable. | |
7553 (let ((mark (or mark gnus-del-mark))) | |
7554 (if (= mark gnus-expirable-mark) | |
7555 (push article gnus-newsgroup-expirable) | |
7556 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))) | |
7557 ;; Remove from unread and marked lists. | |
7558 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7559 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)) | |
7560 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)) | |
7561 (push (cons article mark) gnus-newsgroup-reads) | |
7562 ;; Possibly remove from cache, if that is used. | |
7563 (when gnus-use-cache | |
7564 (gnus-cache-enter-remove-article article)))) | |
7565 | |
7566 (defun gnus-mark-article-as-unread (article &optional mark) | |
7567 "Enter ARTICLE in the pertinent lists and remove it from others." | |
7568 (let ((mark (or mark gnus-ticked-mark))) | |
7569 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked) | |
7570 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant) | |
7571 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable) | |
7572 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads)) | |
7573 | |
7574 ;; Unsuppress duplicates? | |
7575 (when gnus-suppress-duplicates | |
7576 (gnus-dup-unsuppress-article article)) | |
7577 | |
7578 (cond ((= mark gnus-ticked-mark) | |
7579 (push article gnus-newsgroup-marked)) | |
7580 ((= mark gnus-dormant-mark) | |
7581 (push article gnus-newsgroup-dormant)) | |
7582 (t | |
7583 (push article gnus-newsgroup-unreads))) | |
7584 (setq gnus-newsgroup-reads | |
7585 (delq (assq article gnus-newsgroup-reads) | |
7586 gnus-newsgroup-reads)))) | |
7587 | |
7588 (defalias 'gnus-summary-mark-as-unread-forward | |
7589 'gnus-summary-tick-article-forward) | |
7590 (make-obsolete 'gnus-summary-mark-as-unread-forward | |
7591 'gnus-summary-tick-article-forward) | |
7592 (defun gnus-summary-tick-article-forward (n) | |
7593 "Tick N articles forwards. | |
7594 If N is negative, tick backwards instead. | |
7595 The difference between N and the number of articles ticked is returned." | |
7596 (interactive "p") | |
7597 (gnus-summary-mark-forward n gnus-ticked-mark)) | |
7598 | |
7599 (defalias 'gnus-summary-mark-as-unread-backward | |
7600 'gnus-summary-tick-article-backward) | |
7601 (make-obsolete 'gnus-summary-mark-as-unread-backward | |
7602 'gnus-summary-tick-article-backward) | |
7603 (defun gnus-summary-tick-article-backward (n) | |
7604 "Tick N articles backwards. | |
7605 The difference between N and the number of articles ticked is returned." | |
7606 (interactive "p") | |
7607 (gnus-summary-mark-forward (- n) gnus-ticked-mark)) | |
7608 | |
7609 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article) | |
7610 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article) | |
7611 (defun gnus-summary-tick-article (&optional article clear-mark) | |
7612 "Mark current article as unread. | |
7613 Optional 1st argument ARTICLE specifies article number to be marked as unread. | |
7614 Optional 2nd argument CLEAR-MARK remove any kinds of mark." | |
7615 (interactive) | |
7616 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark | |
7617 gnus-ticked-mark))) | |
7618 | |
7619 (defun gnus-summary-mark-as-read-forward (n) | |
7620 "Mark N articles as read forwards. | |
7621 If N is negative, mark backwards instead. | |
7622 The difference between N and the actual number of articles marked is | |
7623 returned." | |
7624 (interactive "p") | |
7625 (gnus-summary-mark-forward n gnus-del-mark t)) | |
7626 | |
7627 (defun gnus-summary-mark-as-read-backward (n) | |
7628 "Mark the N articles as read backwards. | |
7629 The difference between N and the actual number of articles marked is | |
7630 returned." | |
7631 (interactive "p") | |
7632 (gnus-summary-mark-forward (- n) gnus-del-mark t)) | |
7633 | |
7634 (defun gnus-summary-mark-as-read (&optional article mark) | |
7635 "Mark current article as read. | |
7636 ARTICLE specifies the article to be marked as read. | |
7637 MARK specifies a string to be inserted at the beginning of the line." | |
7638 (gnus-summary-mark-article article mark)) | |
7639 | |
7640 (defun gnus-summary-clear-mark-forward (n) | |
7641 "Clear marks from N articles forward. | |
7642 If N is negative, clear backward instead. | |
7643 The difference between N and the number of marks cleared is returned." | |
7644 (interactive "p") | |
7645 (gnus-summary-mark-forward n gnus-unread-mark)) | |
7646 | |
7647 (defun gnus-summary-clear-mark-backward (n) | |
7648 "Clear marks from N articles backward. | |
7649 The difference between N and the number of marks cleared is returned." | |
7650 (interactive "p") | |
7651 (gnus-summary-mark-forward (- n) gnus-unread-mark)) | |
7652 | |
7653 (defun gnus-summary-mark-unread-as-read () | |
7654 "Intended to be used by `gnus-summary-mark-article-hook'." | |
7655 (when (memq gnus-current-article gnus-newsgroup-unreads) | |
7656 (gnus-summary-mark-article gnus-current-article gnus-read-mark))) | |
7657 | |
7658 (defun gnus-summary-mark-read-and-unread-as-read () | |
7659 "Intended to be used by `gnus-summary-mark-article-hook'." | |
7660 (let ((mark (gnus-summary-article-mark))) | |
7661 (when (or (gnus-unread-mark-p mark) | |
7662 (gnus-read-mark-p mark)) | |
7663 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))) | |
7664 | |
7665 (defun gnus-summary-mark-region-as-read (point mark all) | |
7666 "Mark all unread articles between point and mark as read. | |
7667 If given a prefix, mark all articles between point and mark as read, | |
7668 even ticked and dormant ones." | |
7669 (interactive "r\nP") | |
7670 (save-excursion | |
7671 (let (article) | |
7672 (goto-char point) | |
7673 (beginning-of-line) | |
7674 (while (and | |
7675 (< (point) mark) | |
7676 (progn | |
7677 (when (or all | |
7678 (memq (setq article (gnus-summary-article-number)) | |
7679 gnus-newsgroup-unreads)) | |
7680 (gnus-summary-mark-article article gnus-del-mark)) | |
7681 t) | |
7682 (gnus-summary-find-next)))))) | |
7683 | |
7684 (defun gnus-summary-mark-below (score mark) | |
7685 "Mark articles with score less than SCORE with MARK." | |
7686 (interactive "P\ncMark: ") | |
7687 (gnus-set-global-variables) | |
7688 (setq score (if score | |
7689 (prefix-numeric-value score) | |
7690 (or gnus-summary-default-score 0))) | |
7691 (save-excursion | |
7692 (set-buffer gnus-summary-buffer) | |
7693 (goto-char (point-min)) | |
7694 (while | |
7695 (progn | |
7696 (and (< (gnus-summary-article-score) score) | |
7697 (gnus-summary-mark-article nil mark)) | |
7698 (gnus-summary-find-next))))) | |
7699 | |
7700 (defun gnus-summary-kill-below (&optional score) | |
7701 "Mark articles with score below SCORE as read." | |
7702 (interactive "P") | |
7703 (gnus-set-global-variables) | |
7704 (gnus-summary-mark-below score gnus-killed-mark)) | |
7705 | |
7706 (defun gnus-summary-clear-above (&optional score) | |
7707 "Clear all marks from articles with score above SCORE." | |
7708 (interactive "P") | |
7709 (gnus-set-global-variables) | |
7710 (gnus-summary-mark-above score gnus-unread-mark)) | |
7711 | |
7712 (defun gnus-summary-tick-above (&optional score) | |
7713 "Tick all articles with score above SCORE." | |
7714 (interactive "P") | |
7715 (gnus-set-global-variables) | |
7716 (gnus-summary-mark-above score gnus-ticked-mark)) | |
7717 | |
7718 (defun gnus-summary-mark-above (score mark) | |
7719 "Mark articles with score over SCORE with MARK." | |
7720 (interactive "P\ncMark: ") | |
7721 (gnus-set-global-variables) | |
7722 (setq score (if score | |
7723 (prefix-numeric-value score) | |
7724 (or gnus-summary-default-score 0))) | |
7725 (save-excursion | |
7726 (set-buffer gnus-summary-buffer) | |
7727 (goto-char (point-min)) | |
7728 (while (and (progn | |
7729 (when (> (gnus-summary-article-score) score) | |
7730 (gnus-summary-mark-article nil mark)) | |
7731 t) | |
7732 (gnus-summary-find-next))))) | |
7733 | |
7734 ;; Suggested by Daniel Quinlan <quinlan@best.com>. | |
7735 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged) | |
7736 (defun gnus-summary-limit-include-expunged (&optional no-error) | |
7737 "Display all the hidden articles that were expunged for low scores." | |
7738 (interactive) | |
7739 (gnus-set-global-variables) | |
7740 (let ((buffer-read-only nil)) | |
7741 (let ((scored gnus-newsgroup-scored) | |
7742 headers h) | |
7743 (while scored | |
7744 (unless (gnus-summary-goto-subject (caar scored)) | |
7745 (and (setq h (gnus-summary-article-header (caar scored))) | |
7746 (< (cdar scored) gnus-summary-expunge-below) | |
7747 (push h headers))) | |
7748 (setq scored (cdr scored))) | |
7749 (if (not headers) | |
7750 (when (not no-error) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7751 (error "No expunged articles hidden")) |
17493 | 7752 (goto-char (point-min)) |
7753 (gnus-summary-prepare-unthreaded (nreverse headers)) | |
7754 (goto-char (point-min)) | |
7755 (gnus-summary-position-point) | |
7756 t)))) | |
7757 | |
7758 (defun gnus-summary-catchup (&optional all quietly to-here not-mark) | |
7759 "Mark all unread articles in this newsgroup as read. | |
7760 If prefix argument ALL is non-nil, ticked and dormant articles will | |
7761 also be marked as read. | |
7762 If QUIETLY is non-nil, no questions will be asked. | |
7763 If TO-HERE is non-nil, it should be a point in the buffer. All | |
7764 articles before this point will be marked as read. | |
7765 Note that this function will only catch up the unread article | |
7766 in the current summary buffer limitation. | |
7767 The number of articles marked as read is returned." | |
7768 (interactive "P") | |
7769 (gnus-set-global-variables) | |
7770 (prog1 | |
7771 (save-excursion | |
7772 (when (or quietly | |
7773 (not gnus-interactive-catchup) ;Without confirmation? | |
7774 gnus-expert-user | |
7775 (gnus-y-or-n-p | |
7776 (if all | |
7777 "Mark absolutely all articles as read? " | |
7778 "Mark all unread articles as read? "))) | |
7779 (if (and not-mark | |
7780 (not gnus-newsgroup-adaptive) | |
7781 (not gnus-newsgroup-auto-expire) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7782 (not gnus-suppress-duplicates) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7783 (or (not gnus-use-cache) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7784 (not (eq gnus-use-cache 'passive)))) |
17493 | 7785 (progn |
7786 (when all | |
7787 (setq gnus-newsgroup-marked nil | |
7788 gnus-newsgroup-dormant nil)) | |
7789 (setq gnus-newsgroup-unreads nil)) | |
7790 ;; We actually mark all articles as canceled, which we | |
7791 ;; have to do when using auto-expiry or adaptive scoring. | |
7792 (gnus-summary-show-all-threads) | |
7793 (when (gnus-summary-first-subject (not all)) | |
7794 (while (and | |
7795 (if to-here (< (point) to-here) t) | |
7796 (gnus-summary-mark-article-as-read gnus-catchup-mark) | |
7797 (gnus-summary-find-next (not all))))) | |
7798 (gnus-set-mode-line 'summary)) | |
7799 t)) | |
7800 (gnus-summary-position-point))) | |
7801 | |
7802 (defun gnus-summary-catchup-to-here (&optional all) | |
7803 "Mark all unticked articles before the current one as read. | |
7804 If ALL is non-nil, also mark ticked and dormant articles as read." | |
7805 (interactive "P") | |
7806 (gnus-set-global-variables) | |
7807 (save-excursion | |
7808 (gnus-save-hidden-threads | |
7809 (let ((beg (point))) | |
7810 ;; We check that there are unread articles. | |
7811 (when (or all (gnus-summary-find-prev)) | |
7812 (gnus-summary-catchup all t beg))))) | |
7813 (gnus-summary-position-point)) | |
7814 | |
7815 (defun gnus-summary-catchup-all (&optional quietly) | |
7816 "Mark all articles in this newsgroup as read." | |
7817 (interactive "P") | |
7818 (gnus-set-global-variables) | |
7819 (gnus-summary-catchup t quietly)) | |
7820 | |
7821 (defun gnus-summary-catchup-and-exit (&optional all quietly) | |
7822 "Mark all articles not marked as unread in this newsgroup as read, then exit. | |
7823 If prefix argument ALL is non-nil, all articles are marked as read." | |
7824 (interactive "P") | |
7825 (gnus-set-global-variables) | |
7826 (when (gnus-summary-catchup all quietly nil 'fast) | |
7827 ;; Select next newsgroup or exit. | |
7828 (if (eq gnus-auto-select-next 'quietly) | |
7829 (gnus-summary-next-group nil) | |
7830 (gnus-summary-exit)))) | |
7831 | |
7832 (defun gnus-summary-catchup-all-and-exit (&optional quietly) | |
7833 "Mark all articles in this newsgroup as read, and then exit." | |
7834 (interactive "P") | |
7835 (gnus-set-global-variables) | |
7836 (gnus-summary-catchup-and-exit t quietly)) | |
7837 | |
7838 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>. | |
7839 (defun gnus-summary-catchup-and-goto-next-group (&optional all) | |
7840 "Mark all articles in this group as read and select the next group. | |
7841 If given a prefix, mark all articles, unread as well as ticked, as | |
7842 read." | |
7843 (interactive "P") | |
7844 (gnus-set-global-variables) | |
7845 (save-excursion | |
7846 (gnus-summary-catchup all)) | |
7847 (gnus-summary-next-article t nil nil t)) | |
7848 | |
7849 ;; Thread-based commands. | |
7850 | |
7851 (defun gnus-summary-articles-in-thread (&optional article) | |
7852 "Return a list of all articles in the current thread. | |
7853 If ARTICLE is non-nil, return all articles in the thread that starts | |
7854 with that article." | |
7855 (let* ((article (or article (gnus-summary-article-number))) | |
7856 (data (gnus-data-find-list article)) | |
7857 (top-level (gnus-data-level (car data))) | |
7858 (top-subject | |
7859 (cond ((null gnus-thread-operation-ignore-subject) | |
7860 (gnus-simplify-subject-re | |
7861 (mail-header-subject (gnus-data-header (car data))))) | |
7862 ((eq gnus-thread-operation-ignore-subject 'fuzzy) | |
7863 (gnus-simplify-subject-fuzzy | |
7864 (mail-header-subject (gnus-data-header (car data))))) | |
7865 (t nil))) | |
7866 (end-point (save-excursion | |
7867 (if (gnus-summary-go-to-next-thread) | |
7868 (point) (point-max)))) | |
7869 articles) | |
7870 (while (and data | |
7871 (< (gnus-data-pos (car data)) end-point)) | |
7872 (when (or (not top-subject) | |
7873 (string= top-subject | |
7874 (if (eq gnus-thread-operation-ignore-subject 'fuzzy) | |
7875 (gnus-simplify-subject-fuzzy | |
7876 (mail-header-subject | |
7877 (gnus-data-header (car data)))) | |
7878 (gnus-simplify-subject-re | |
7879 (mail-header-subject | |
7880 (gnus-data-header (car data))))))) | |
7881 (push (gnus-data-number (car data)) articles)) | |
7882 (unless (and (setq data (cdr data)) | |
7883 (> (gnus-data-level (car data)) top-level)) | |
7884 (setq data nil))) | |
7885 ;; Return the list of articles. | |
7886 (nreverse articles))) | |
7887 | |
7888 (defun gnus-summary-rethread-current () | |
7889 "Rethread the thread the current article is part of." | |
7890 (interactive) | |
7891 (gnus-set-global-variables) | |
7892 (let* ((gnus-show-threads t) | |
7893 (article (gnus-summary-article-number)) | |
7894 (id (mail-header-id (gnus-summary-article-header))) | |
7895 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id))))) | |
7896 (unless id | |
7897 (error "No article on the current line")) | |
7898 (gnus-rebuild-thread id) | |
7899 (gnus-summary-goto-subject article))) | |
7900 | |
7901 (defun gnus-summary-reparent-thread () | |
7902 "Make the current article child of the marked (or previous) article. | |
7903 | |
7904 Note that the re-threading will only work if `gnus-thread-ignore-subject' | |
7905 is non-nil or the Subject: of both articles are the same." | |
7906 (interactive) | |
7907 (unless (not (gnus-group-read-only-p)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7908 (error "The current newsgroup does not support article editing")) |
17493 | 7909 (unless (<= (length gnus-newsgroup-processable) 1) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7910 (error "No more than one article may be marked")) |
17493 | 7911 (save-window-excursion |
7912 (let ((gnus-article-buffer " *reparent*") | |
7913 (current-article (gnus-summary-article-number)) | |
7914 ;; First grab the marked article, otherwise one line up. | |
7915 (parent-article (if (not (null gnus-newsgroup-processable)) | |
7916 (car gnus-newsgroup-processable) | |
7917 (save-excursion | |
7918 (if (eq (forward-line -1) 0) | |
7919 (gnus-summary-article-number) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7920 (error "Beginning of summary buffer")))))) |
17493 | 7921 (unless (not (eq current-article parent-article)) |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7922 (error "An article may not be self-referential")) |
17493 | 7923 (let ((message-id (mail-header-id |
7924 (gnus-summary-article-header parent-article)))) | |
7925 (unless (and message-id (not (equal message-id ""))) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7926 (error "No message-id in desired parent")) |
17493 | 7927 (gnus-summary-select-article t t nil current-article) |
7928 (set-buffer gnus-original-article-buffer) | |
7929 (let ((buf (format "%s" (buffer-string)))) | |
7930 (nnheader-temp-write nil | |
7931 (insert buf) | |
7932 (goto-char (point-min)) | |
7933 (if (search-forward-regexp "^References: " nil t) | |
7934 (insert message-id " " ) | |
7935 (insert "References: " message-id "\n")) | |
7936 (unless (gnus-request-replace-article | |
7937 current-article (car gnus-article-current) | |
7938 (current-buffer)) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7939 (error "Couldn't replace article")))) |
17493 | 7940 (set-buffer gnus-summary-buffer) |
7941 (gnus-summary-unmark-all-processable) | |
7942 (gnus-summary-rethread-current) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
7943 (gnus-message 3 "Article %d is now the child of article %d" |
17493 | 7944 current-article parent-article))))) |
7945 | |
7946 (defun gnus-summary-toggle-threads (&optional arg) | |
7947 "Toggle showing conversation threads. | |
7948 If ARG is positive number, turn showing conversation threads on." | |
7949 (interactive "P") | |
7950 (gnus-set-global-variables) | |
7951 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end))) | |
7952 (setq gnus-show-threads | |
7953 (if (null arg) (not gnus-show-threads) | |
7954 (> (prefix-numeric-value arg) 0))) | |
7955 (gnus-summary-prepare) | |
7956 (gnus-summary-goto-subject current) | |
7957 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off")) | |
7958 (gnus-summary-position-point))) | |
7959 | |
7960 (defun gnus-summary-show-all-threads () | |
7961 "Show all threads." | |
7962 (interactive) | |
7963 (gnus-set-global-variables) | |
7964 (save-excursion | |
7965 (let ((buffer-read-only nil)) | |
7966 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t))) | |
7967 (gnus-summary-position-point)) | |
7968 | |
7969 (defun gnus-summary-show-thread () | |
7970 "Show thread subtrees. | |
7971 Returns nil if no thread was there to be shown." | |
7972 (interactive) | |
7973 (gnus-set-global-variables) | |
7974 (let ((buffer-read-only nil) | |
7975 (orig (point)) | |
7976 ;; first goto end then to beg, to have point at beg after let | |
7977 (end (progn (end-of-line) (point))) | |
7978 (beg (progn (beginning-of-line) (point)))) | |
7979 (prog1 | |
7980 ;; Any hidden lines here? | |
7981 (search-forward "\r" end t) | |
7982 (subst-char-in-region beg end ?\^M ?\n t) | |
7983 (goto-char orig) | |
7984 (gnus-summary-position-point)))) | |
7985 | |
7986 (defun gnus-summary-hide-all-threads () | |
7987 "Hide all thread subtrees." | |
7988 (interactive) | |
7989 (gnus-set-global-variables) | |
7990 (save-excursion | |
7991 (goto-char (point-min)) | |
7992 (gnus-summary-hide-thread) | |
7993 (while (zerop (gnus-summary-next-thread 1 t)) | |
7994 (gnus-summary-hide-thread))) | |
7995 (gnus-summary-position-point)) | |
7996 | |
7997 (defun gnus-summary-hide-thread () | |
7998 "Hide thread subtrees. | |
7999 Returns nil if no threads were there to be hidden." | |
8000 (interactive) | |
8001 (gnus-set-global-variables) | |
8002 (let ((buffer-read-only nil) | |
8003 (start (point)) | |
8004 (article (gnus-summary-article-number))) | |
8005 (goto-char start) | |
8006 ;; Go forward until either the buffer ends or the subthread | |
8007 ;; ends. | |
8008 (when (and (not (eobp)) | |
8009 (or (zerop (gnus-summary-next-thread 1 t)) | |
8010 (goto-char (point-max)))) | |
8011 (prog1 | |
8012 (if (and (> (point) start) | |
8013 (search-backward "\n" start t)) | |
8014 (progn | |
8015 (subst-char-in-region start (point) ?\n ?\^M) | |
8016 (gnus-summary-goto-subject article)) | |
8017 (goto-char start) | |
8018 nil) | |
8019 ;;(gnus-summary-position-point) | |
8020 )))) | |
8021 | |
8022 (defun gnus-summary-go-to-next-thread (&optional previous) | |
8023 "Go to the same level (or less) next thread. | |
8024 If PREVIOUS is non-nil, go to previous thread instead. | |
8025 Return the article number moved to, or nil if moving was impossible." | |
8026 (let ((level (gnus-summary-thread-level)) | |
8027 (way (if previous -1 1)) | |
8028 (beg (point))) | |
8029 (forward-line way) | |
8030 (while (and (not (eobp)) | |
8031 (< level (gnus-summary-thread-level))) | |
8032 (forward-line way)) | |
8033 (if (eobp) | |
8034 (progn | |
8035 (goto-char beg) | |
8036 nil) | |
8037 (setq beg (point)) | |
8038 (prog1 | |
8039 (gnus-summary-article-number) | |
8040 (goto-char beg))))) | |
8041 | |
8042 (defun gnus-summary-next-thread (n &optional silent) | |
8043 "Go to the same level next N'th thread. | |
8044 If N is negative, search backward instead. | |
8045 Returns the difference between N and the number of skips actually | |
8046 done. | |
8047 | |
8048 If SILENT, don't output messages." | |
8049 (interactive "p") | |
8050 (gnus-set-global-variables) | |
8051 (let ((backward (< n 0)) | |
8052 (n (abs n))) | |
8053 (while (and (> n 0) | |
8054 (gnus-summary-go-to-next-thread backward)) | |
8055 (decf n)) | |
8056 (unless silent | |
8057 (gnus-summary-position-point)) | |
8058 (when (and (not silent) (/= 0 n)) | |
8059 (gnus-message 7 "No more threads")) | |
8060 n)) | |
8061 | |
8062 (defun gnus-summary-prev-thread (n) | |
8063 "Go to the same level previous N'th thread. | |
8064 Returns the difference between N and the number of skips actually | |
8065 done." | |
8066 (interactive "p") | |
8067 (gnus-set-global-variables) | |
8068 (gnus-summary-next-thread (- n))) | |
8069 | |
8070 (defun gnus-summary-go-down-thread () | |
8071 "Go down one level in the current thread." | |
8072 (let ((children (gnus-summary-article-children))) | |
8073 (when children | |
8074 (gnus-summary-goto-subject (car children))))) | |
8075 | |
8076 (defun gnus-summary-go-up-thread () | |
8077 "Go up one level in the current thread." | |
8078 (let ((parent (gnus-summary-article-parent))) | |
8079 (when parent | |
8080 (gnus-summary-goto-subject parent)))) | |
8081 | |
8082 (defun gnus-summary-down-thread (n) | |
8083 "Go down thread N steps. | |
8084 If N is negative, go up instead. | |
8085 Returns the difference between N and how many steps down that were | |
8086 taken." | |
8087 (interactive "p") | |
8088 (gnus-set-global-variables) | |
8089 (let ((up (< n 0)) | |
8090 (n (abs n))) | |
8091 (while (and (> n 0) | |
8092 (if up (gnus-summary-go-up-thread) | |
8093 (gnus-summary-go-down-thread))) | |
8094 (setq n (1- n))) | |
8095 (gnus-summary-position-point) | |
8096 (when (/= 0 n) | |
8097 (gnus-message 7 "Can't go further")) | |
8098 n)) | |
8099 | |
8100 (defun gnus-summary-up-thread (n) | |
8101 "Go up thread N steps. | |
8102 If N is negative, go up instead. | |
8103 Returns the difference between N and how many steps down that were | |
8104 taken." | |
8105 (interactive "p") | |
8106 (gnus-set-global-variables) | |
8107 (gnus-summary-down-thread (- n))) | |
8108 | |
8109 (defun gnus-summary-top-thread () | |
8110 "Go to the top of the thread." | |
8111 (interactive) | |
8112 (gnus-set-global-variables) | |
8113 (while (gnus-summary-go-up-thread)) | |
8114 (gnus-summary-article-number)) | |
8115 | |
8116 (defun gnus-summary-kill-thread (&optional unmark) | |
8117 "Mark articles under current thread as read. | |
8118 If the prefix argument is positive, remove any kinds of marks. | |
8119 If the prefix argument is negative, tick articles instead." | |
8120 (interactive "P") | |
8121 (gnus-set-global-variables) | |
8122 (when unmark | |
8123 (setq unmark (prefix-numeric-value unmark))) | |
8124 (let ((articles (gnus-summary-articles-in-thread))) | |
8125 (save-excursion | |
8126 ;; Expand the thread. | |
8127 (gnus-summary-show-thread) | |
8128 ;; Mark all the articles. | |
8129 (while articles | |
8130 (gnus-summary-goto-subject (car articles)) | |
8131 (cond ((null unmark) | |
8132 (gnus-summary-mark-article-as-read gnus-killed-mark)) | |
8133 ((> unmark 0) | |
8134 (gnus-summary-mark-article-as-unread gnus-unread-mark)) | |
8135 (t | |
8136 (gnus-summary-mark-article-as-unread gnus-ticked-mark))) | |
8137 (setq articles (cdr articles)))) | |
8138 ;; Hide killed subtrees. | |
8139 (and (null unmark) | |
8140 gnus-thread-hide-killed | |
8141 (gnus-summary-hide-thread)) | |
8142 ;; If marked as read, go to next unread subject. | |
8143 (when (null unmark) | |
8144 ;; Go to next unread subject. | |
8145 (gnus-summary-next-subject 1 t))) | |
8146 (gnus-set-mode-line 'summary)) | |
8147 | |
8148 ;; Summary sorting commands | |
8149 | |
8150 (defun gnus-summary-sort-by-number (&optional reverse) | |
8151 "Sort the summary buffer by article number. | |
8152 Argument REVERSE means reverse order." | |
8153 (interactive "P") | |
8154 (gnus-summary-sort 'number reverse)) | |
8155 | |
8156 (defun gnus-summary-sort-by-author (&optional reverse) | |
8157 "Sort the summary buffer by author name alphabetically. | |
8158 If case-fold-search is non-nil, case of letters is ignored. | |
8159 Argument REVERSE means reverse order." | |
8160 (interactive "P") | |
8161 (gnus-summary-sort 'author reverse)) | |
8162 | |
8163 (defun gnus-summary-sort-by-subject (&optional reverse) | |
8164 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored. | |
8165 If case-fold-search is non-nil, case of letters is ignored. | |
8166 Argument REVERSE means reverse order." | |
8167 (interactive "P") | |
8168 (gnus-summary-sort 'subject reverse)) | |
8169 | |
8170 (defun gnus-summary-sort-by-date (&optional reverse) | |
8171 "Sort the summary buffer by date. | |
8172 Argument REVERSE means reverse order." | |
8173 (interactive "P") | |
8174 (gnus-summary-sort 'date reverse)) | |
8175 | |
8176 (defun gnus-summary-sort-by-score (&optional reverse) | |
8177 "Sort the summary buffer by score. | |
8178 Argument REVERSE means reverse order." | |
8179 (interactive "P") | |
8180 (gnus-summary-sort 'score reverse)) | |
8181 | |
8182 (defun gnus-summary-sort-by-lines (&optional reverse) | |
8183 "Sort the summary buffer by article length. | |
8184 Argument REVERSE means reverse order." | |
8185 (interactive "P") | |
8186 (gnus-summary-sort 'lines reverse)) | |
8187 | |
8188 (defun gnus-summary-sort (predicate reverse) | |
8189 "Sort summary buffer by PREDICATE. REVERSE means reverse order." | |
8190 (gnus-set-global-variables) | |
8191 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate))) | |
8192 (article (intern (format "gnus-article-sort-by-%s" predicate))) | |
8193 (gnus-thread-sort-functions | |
8194 (list | |
8195 (if (not reverse) | |
8196 thread | |
8197 `(lambda (t1 t2) | |
8198 (,thread t2 t1))))) | |
8199 (gnus-article-sort-functions | |
8200 (list | |
8201 (if (not reverse) | |
8202 article | |
8203 `(lambda (t1 t2) | |
8204 (,article t2 t1))))) | |
8205 (buffer-read-only) | |
8206 (gnus-summary-prepare-hook nil)) | |
8207 ;; We do the sorting by regenerating the threads. | |
8208 (gnus-summary-prepare) | |
8209 ;; Hide subthreads if needed. | |
8210 (when (and gnus-show-threads gnus-thread-hide-subtree) | |
8211 (gnus-summary-hide-all-threads)))) | |
8212 | |
8213 ;; Summary saving commands. | |
8214 | |
8215 (defun gnus-summary-save-article (&optional n not-saved) | |
8216 "Save the current article using the default saver function. | |
8217 If N is a positive number, save the N next articles. | |
8218 If N is a negative number, save the N previous articles. | |
8219 If N is nil and any articles have been marked with the process mark, | |
8220 save those articles instead. | |
8221 The variable `gnus-default-article-saver' specifies the saver function." | |
8222 (interactive "P") | |
8223 (gnus-set-global-variables) | |
8224 (let* ((articles (gnus-summary-work-articles n)) | |
8225 (save-buffer (save-excursion | |
8226 (nnheader-set-temp-buffer " *Gnus Save*"))) | |
8227 (num (length articles)) | |
8228 header article file) | |
8229 (while articles | |
8230 (setq header (gnus-summary-article-header | |
8231 (setq article (pop articles)))) | |
8232 (if (not (vectorp header)) | |
8233 ;; This is a pseudo-article. | |
8234 (if (assq 'name header) | |
8235 (gnus-copy-file (cdr (assq 'name header))) | |
8236 (gnus-message 1 "Article %d is unsaveable" article)) | |
8237 ;; This is a real article. | |
8238 (save-window-excursion | |
8239 (gnus-summary-select-article t nil nil article)) | |
8240 (save-excursion | |
8241 (set-buffer save-buffer) | |
8242 (erase-buffer) | |
8243 (insert-buffer-substring gnus-original-article-buffer)) | |
8244 (setq file (gnus-article-save save-buffer file num)) | |
8245 (gnus-summary-remove-process-mark article) | |
8246 (unless not-saved | |
8247 (gnus-summary-set-saved-mark article)))) | |
8248 (gnus-kill-buffer save-buffer) | |
8249 (gnus-summary-position-point) | |
8250 (gnus-set-mode-line 'summary) | |
8251 n)) | |
8252 | |
8253 (defun gnus-summary-pipe-output (&optional arg) | |
8254 "Pipe the current article to a subprocess. | |
8255 If N is a positive number, pipe the N next articles. | |
8256 If N is a negative number, pipe the N previous articles. | |
8257 If N is nil and any articles have been marked with the process mark, | |
8258 pipe those articles instead." | |
8259 (interactive "P") | |
8260 (gnus-set-global-variables) | |
8261 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)) | |
8262 (gnus-summary-save-article arg t)) | |
8263 (gnus-configure-windows 'pipe)) | |
8264 | |
8265 (defun gnus-summary-save-article-mail (&optional arg) | |
8266 "Append the current article to an mail file. | |
8267 If N is a positive number, save the N next articles. | |
8268 If N is a negative number, save the N previous articles. | |
8269 If N is nil and any articles have been marked with the process mark, | |
8270 save those articles instead." | |
8271 (interactive "P") | |
8272 (gnus-set-global-variables) | |
8273 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail)) | |
8274 (gnus-summary-save-article arg))) | |
8275 | |
8276 (defun gnus-summary-save-article-rmail (&optional arg) | |
8277 "Append the current article to an rmail file. | |
8278 If N is a positive number, save the N next articles. | |
8279 If N is a negative number, save the N previous articles. | |
8280 If N is nil and any articles have been marked with the process mark, | |
8281 save those articles instead." | |
8282 (interactive "P") | |
8283 (gnus-set-global-variables) | |
8284 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail)) | |
8285 (gnus-summary-save-article arg))) | |
8286 | |
8287 (defun gnus-summary-save-article-file (&optional arg) | |
8288 "Append the current article to a file. | |
8289 If N is a positive number, save the N next articles. | |
8290 If N is a negative number, save the N previous articles. | |
8291 If N is nil and any articles have been marked with the process mark, | |
8292 save those articles instead." | |
8293 (interactive "P") | |
8294 (gnus-set-global-variables) | |
8295 (let ((gnus-default-article-saver 'gnus-summary-save-in-file)) | |
8296 (gnus-summary-save-article arg))) | |
8297 | |
8298 (defun gnus-summary-write-article-file (&optional arg) | |
8299 "Write the current article to a file, deleting the previous file. | |
8300 If N is a positive number, save the N next articles. | |
8301 If N is a negative number, save the N previous articles. | |
8302 If N is nil and any articles have been marked with the process mark, | |
8303 save those articles instead." | |
8304 (interactive "P") | |
8305 (gnus-set-global-variables) | |
8306 (let ((gnus-default-article-saver 'gnus-summary-write-to-file)) | |
8307 (gnus-summary-save-article arg))) | |
8308 | |
8309 (defun gnus-summary-save-article-body-file (&optional arg) | |
8310 "Append the current article body to a file. | |
8311 If N is a positive number, save the N next articles. | |
8312 If N is a negative number, save the N previous articles. | |
8313 If N is nil and any articles have been marked with the process mark, | |
8314 save those articles instead." | |
8315 (interactive "P") | |
8316 (gnus-set-global-variables) | |
8317 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file)) | |
8318 (gnus-summary-save-article arg))) | |
8319 | |
8320 (defun gnus-summary-pipe-message (program) | |
8321 "Pipe the current article through PROGRAM." | |
8322 (interactive "sProgram: ") | |
8323 (gnus-set-global-variables) | |
8324 (gnus-summary-select-article) | |
8325 (let ((mail-header-separator "") | |
8326 (art-buf (get-buffer gnus-article-buffer))) | |
8327 (gnus-eval-in-buffer-window gnus-article-buffer | |
8328 (save-restriction | |
8329 (widen) | |
8330 (let ((start (window-start)) | |
8331 buffer-read-only) | |
8332 (message-pipe-buffer-body program) | |
8333 (set-window-start (get-buffer-window (current-buffer)) start)))))) | |
8334 | |
8335 (defun gnus-get-split-value (methods) | |
8336 "Return a value based on the split METHODS." | |
8337 (let (split-name method result match) | |
8338 (when methods | |
8339 (save-excursion | |
8340 (set-buffer gnus-original-article-buffer) | |
8341 (save-restriction | |
8342 (nnheader-narrow-to-headers) | |
8343 (while methods | |
8344 (goto-char (point-min)) | |
8345 (setq method (pop methods)) | |
8346 (setq match (car method)) | |
8347 (when (cond | |
8348 ((stringp match) | |
8349 ;; Regular expression. | |
8350 (ignore-errors | |
8351 (re-search-forward match nil t))) | |
8352 ((gnus-functionp match) | |
8353 ;; Function. | |
8354 (save-restriction | |
8355 (widen) | |
8356 (setq result (funcall match gnus-newsgroup-name)))) | |
8357 ((consp match) | |
8358 ;; Form. | |
8359 (save-restriction | |
8360 (widen) | |
8361 (setq result (eval match))))) | |
8362 (setq split-name (append (cdr method) split-name)) | |
8363 (cond ((stringp result) | |
8364 (push (expand-file-name | |
8365 result gnus-article-save-directory) | |
8366 split-name)) | |
8367 ((consp result) | |
8368 (setq split-name (append result split-name))))))))) | |
8369 split-name)) | |
8370 | |
8371 (defun gnus-valid-move-group-p (group) | |
8372 (and (boundp group) | |
8373 (symbol-name group) | |
8374 (memq 'respool | |
8375 (assoc (symbol-name | |
8376 (car (gnus-find-method-for-group | |
8377 (symbol-name group)))) | |
8378 gnus-valid-select-methods)))) | |
8379 | |
8380 (defun gnus-read-move-group-name (prompt default articles prefix) | |
8381 "Read a group name." | |
8382 (let* ((split-name (gnus-get-split-value gnus-move-split-methods)) | |
8383 (minibuffer-confirm-incomplete nil) ; XEmacs | |
8384 (prom | |
8385 (format "%s %s to:" | |
8386 prompt | |
8387 (if (> (length articles) 1) | |
8388 (format "these %d articles" (length articles)) | |
8389 "this article"))) | |
8390 (to-newsgroup | |
8391 (cond | |
8392 ((null split-name) | |
8393 (gnus-completing-read default prom | |
8394 gnus-active-hashtb | |
8395 'gnus-valid-move-group-p | |
8396 nil prefix | |
8397 'gnus-group-history)) | |
8398 ((= 1 (length split-name)) | |
8399 (gnus-completing-read (car split-name) prom | |
8400 gnus-active-hashtb | |
8401 'gnus-valid-move-group-p | |
8402 nil nil | |
8403 'gnus-group-history)) | |
8404 (t | |
8405 (gnus-completing-read nil prom | |
8406 (mapcar (lambda (el) (list el)) | |
8407 (nreverse split-name)) | |
8408 nil nil nil | |
8409 'gnus-group-history))))) | |
8410 (when to-newsgroup | |
8411 (if (or (string= to-newsgroup "") | |
8412 (string= to-newsgroup prefix)) | |
8413 (setq to-newsgroup default)) | |
8414 (unless to-newsgroup | |
8415 (error "No group name entered")) | |
8416 (or (gnus-active to-newsgroup) | |
8417 (gnus-activate-group to-newsgroup) | |
8418 (if (gnus-y-or-n-p (format "No such group: %s. Create it? " | |
8419 to-newsgroup)) | |
8420 (or (and (gnus-request-create-group | |
8421 to-newsgroup (gnus-group-name-to-method to-newsgroup)) | |
8422 (gnus-activate-group to-newsgroup nil nil | |
8423 (gnus-group-name-to-method | |
8424 to-newsgroup))) | |
8425 (error "Couldn't create group %s" to-newsgroup))) | |
8426 (error "No such group: %s" to-newsgroup))) | |
8427 to-newsgroup)) | |
8428 | |
8429 ;; Summary extract commands | |
8430 | |
8431 (defun gnus-summary-insert-pseudos (pslist &optional not-view) | |
8432 (let ((buffer-read-only nil) | |
8433 (article (gnus-summary-article-number)) | |
8434 after-article b e) | |
8435 (unless (gnus-summary-goto-subject article) | |
8436 (error "No such article: %d" article)) | |
8437 (gnus-summary-position-point) | |
8438 ;; If all commands are to be bunched up on one line, we collect | |
8439 ;; them here. | |
8440 (unless gnus-view-pseudos-separately | |
8441 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<))) | |
8442 files action) | |
8443 (while ps | |
8444 (setq action (cdr (assq 'action (car ps)))) | |
8445 (setq files (list (cdr (assq 'name (car ps))))) | |
8446 (while (and ps (cdr ps) | |
8447 (string= (or action "1") | |
8448 (or (cdr (assq 'action (cadr ps))) "2"))) | |
8449 (push (cdr (assq 'name (cadr ps))) files) | |
8450 (setcdr ps (cddr ps))) | |
8451 (when files | |
8452 (when (not (string-match "%s" action)) | |
8453 (push " " files)) | |
8454 (push " " files) | |
8455 (when (assq 'execute (car ps)) | |
8456 (setcdr (assq 'execute (car ps)) | |
8457 (funcall (if (string-match "%s" action) | |
8458 'format 'concat) | |
8459 action | |
8460 (mapconcat | |
8461 (lambda (f) | |
8462 (if (equal f " ") | |
8463 f | |
8464 (gnus-quote-arg-for-sh-or-csh f))) | |
8465 files " "))))) | |
8466 (setq ps (cdr ps))))) | |
8467 (if (and gnus-view-pseudos (not not-view)) | |
8468 (while pslist | |
8469 (when (assq 'execute (car pslist)) | |
8470 (gnus-execute-command (cdr (assq 'execute (car pslist))) | |
8471 (eq gnus-view-pseudos 'not-confirm))) | |
8472 (setq pslist (cdr pslist))) | |
8473 (save-excursion | |
8474 (while pslist | |
8475 (setq after-article (or (cdr (assq 'article (car pslist))) | |
8476 (gnus-summary-article-number))) | |
8477 (gnus-summary-goto-subject after-article) | |
8478 (forward-line 1) | |
8479 (setq b (point)) | |
8480 (insert " " (file-name-nondirectory | |
8481 (cdr (assq 'name (car pslist)))) | |
8482 ": " (or (cdr (assq 'execute (car pslist))) "") "\n") | |
8483 (setq e (point)) | |
8484 (forward-line -1) ; back to `b' | |
8485 (gnus-add-text-properties | |
8486 b (1- e) (list 'gnus-number gnus-reffed-article-number | |
8487 gnus-mouse-face-prop gnus-mouse-face)) | |
8488 (gnus-data-enter | |
8489 after-article gnus-reffed-article-number | |
8490 gnus-unread-mark b (car pslist) 0 (- e b)) | |
8491 (push gnus-reffed-article-number gnus-newsgroup-unreads) | |
8492 (setq gnus-reffed-article-number (1- gnus-reffed-article-number)) | |
8493 (setq pslist (cdr pslist))))))) | |
8494 | |
8495 (defun gnus-pseudos< (p1 p2) | |
8496 (let ((c1 (cdr (assq 'action p1))) | |
8497 (c2 (cdr (assq 'action p2)))) | |
8498 (and c1 c2 (string< c1 c2)))) | |
8499 | |
8500 (defun gnus-request-pseudo-article (props) | |
8501 (cond ((assq 'execute props) | |
8502 (gnus-execute-command (cdr (assq 'execute props))))) | |
8503 (let ((gnus-current-article (gnus-summary-article-number))) | |
8504 (run-hooks 'gnus-mark-article-hook))) | |
8505 | |
8506 (defun gnus-execute-command (command &optional automatic) | |
8507 (save-excursion | |
8508 (gnus-article-setup-buffer) | |
8509 (set-buffer gnus-article-buffer) | |
8510 (setq buffer-read-only nil) | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8511 (let ((command (if automatic command |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8512 (read-string "Command: " (cons command 0))))) |
17493 | 8513 (erase-buffer) |
8514 (insert "$ " command "\n\n") | |
8515 (if gnus-view-pseudo-asynchronously | |
8516 (start-process "gnus-execute" (current-buffer) shell-file-name | |
8517 shell-command-switch command) | |
8518 (call-process shell-file-name nil t nil | |
8519 shell-command-switch command))))) | |
8520 | |
8521 ;; Summary kill commands. | |
8522 | |
8523 (defun gnus-summary-edit-global-kill (article) | |
8524 "Edit the \"global\" kill file." | |
8525 (interactive (list (gnus-summary-article-number))) | |
8526 (gnus-set-global-variables) | |
8527 (gnus-group-edit-global-kill article)) | |
8528 | |
8529 (defun gnus-summary-edit-local-kill () | |
8530 "Edit a local kill file applied to the current newsgroup." | |
8531 (interactive) | |
8532 (gnus-set-global-variables) | |
8533 (setq gnus-current-headers (gnus-summary-article-header)) | |
8534 (gnus-set-global-variables) | |
8535 (gnus-group-edit-local-kill | |
8536 (gnus-summary-article-number) gnus-newsgroup-name)) | |
8537 | |
8538 ;;; Header reading. | |
8539 | |
8540 (defun gnus-read-header (id &optional header) | |
8541 "Read the headers of article ID and enter them into the Gnus system." | |
8542 (let ((group gnus-newsgroup-name) | |
8543 (gnus-override-method | |
8544 (and (gnus-news-group-p gnus-newsgroup-name) | |
8545 gnus-refer-article-method)) | |
8546 where) | |
8547 ;; First we check to see whether the header in question is already | |
8548 ;; fetched. | |
8549 (if (stringp id) | |
8550 ;; This is a Message-ID. | |
8551 (setq header (or header (gnus-id-to-header id))) | |
8552 ;; This is an article number. | |
8553 (setq header (or header (gnus-summary-article-header id)))) | |
8554 (if (and header | |
8555 (not (gnus-summary-article-sparse-p (mail-header-number header)))) | |
8556 ;; We have found the header. | |
8557 header | |
8558 ;; We have to really fetch the header to this article. | |
8559 (save-excursion | |
8560 (set-buffer nntp-server-buffer) | |
8561 (when (setq where (gnus-request-head id group)) | |
8562 (nnheader-fold-continuation-lines) | |
8563 (goto-char (point-max)) | |
8564 (insert ".\n") | |
8565 (goto-char (point-min)) | |
8566 (insert "211 ") | |
8567 (princ (cond | |
8568 ((numberp id) id) | |
8569 ((cdr where) (cdr where)) | |
8570 (header (mail-header-number header)) | |
8571 (t gnus-reffed-article-number)) | |
8572 (current-buffer)) | |
8573 (insert " Article retrieved.\n")) | |
8574 (if (or (not where) | |
8575 (not (setq header (car (gnus-get-newsgroup-headers nil t))))) | |
8576 () ; Malformed head. | |
8577 (unless (gnus-summary-article-sparse-p (mail-header-number header)) | |
8578 (when (and (stringp id) | |
8579 (not (string= (gnus-group-real-name group) | |
8580 (car where)))) | |
8581 ;; If we fetched by Message-ID and the article came | |
8582 ;; from a different group, we fudge some bogus article | |
8583 ;; numbers for this article. | |
8584 (mail-header-set-number header gnus-reffed-article-number)) | |
8585 (save-excursion | |
8586 (set-buffer gnus-summary-buffer) | |
8587 (decf gnus-reffed-article-number) | |
8588 (gnus-remove-header (mail-header-number header)) | |
8589 (push header gnus-newsgroup-headers) | |
8590 (setq gnus-current-headers header) | |
8591 (push (mail-header-number header) gnus-newsgroup-limit))) | |
8592 header))))) | |
8593 | |
8594 (defun gnus-remove-header (number) | |
8595 "Remove header NUMBER from `gnus-newsgroup-headers'." | |
8596 (if (and gnus-newsgroup-headers | |
8597 (= number (mail-header-number (car gnus-newsgroup-headers)))) | |
8598 (pop gnus-newsgroup-headers) | |
8599 (let ((headers gnus-newsgroup-headers)) | |
8600 (while (and (cdr headers) | |
8601 (not (= number (mail-header-number (cadr headers))))) | |
8602 (pop headers)) | |
8603 (when (cdr headers) | |
8604 (setcdr headers (cddr headers)))))) | |
8605 | |
8606 ;;; | |
8607 ;;; summary highlights | |
8608 ;;; | |
8609 | |
8610 (defun gnus-highlight-selected-summary () | |
8611 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>. | |
8612 ;; Highlight selected article in summary buffer | |
8613 (when gnus-summary-selected-face | |
8614 (save-excursion | |
8615 (let* ((beg (progn (beginning-of-line) (point))) | |
8616 (end (progn (end-of-line) (point))) | |
8617 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>. | |
8618 (from (if (get-text-property beg gnus-mouse-face-prop) | |
8619 beg | |
8620 (or (next-single-property-change | |
8621 beg gnus-mouse-face-prop nil end) | |
8622 beg))) | |
8623 (to | |
8624 (if (= from end) | |
8625 (- from 2) | |
8626 (or (next-single-property-change | |
8627 from gnus-mouse-face-prop nil end) | |
8628 end)))) | |
8629 ;; If no mouse-face prop on line we will have to = from = end, | |
8630 ;; so we highlight the entire line instead. | |
8631 (when (= (+ to 2) from) | |
8632 (setq from beg) | |
8633 (setq to end)) | |
8634 (if gnus-newsgroup-selected-overlay | |
8635 ;; Move old overlay. | |
8636 (gnus-move-overlay | |
8637 gnus-newsgroup-selected-overlay from to (current-buffer)) | |
8638 ;; Create new overlay. | |
8639 (gnus-overlay-put | |
8640 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to)) | |
8641 'face gnus-summary-selected-face)))))) | |
8642 | |
8643 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>. | |
8644 (defun gnus-summary-highlight-line () | |
8645 "Highlight current line according to `gnus-summary-highlight'." | |
8646 (let* ((list gnus-summary-highlight) | |
8647 (p (point)) | |
8648 (end (progn (end-of-line) (point))) | |
8649 ;; now find out where the line starts and leave point there. | |
8650 (beg (progn (beginning-of-line) (point))) | |
8651 (article (gnus-summary-article-number)) | |
8652 (score (or (cdr (assq (or article gnus-current-article) | |
8653 gnus-newsgroup-scored)) | |
8654 gnus-summary-default-score 0)) | |
8655 (mark (or (gnus-summary-article-mark) gnus-unread-mark)) | |
8656 (inhibit-read-only t)) | |
8657 ;; Eval the cars of the lists until we find a match. | |
8658 (let ((default gnus-summary-default-score)) | |
8659 (while (and list | |
8660 (not (eval (caar list)))) | |
8661 (setq list (cdr list)))) | |
8662 (let ((face (cdar list))) | |
8663 (unless (eq face (get-text-property beg 'face)) | |
8664 (gnus-put-text-property | |
8665 beg end 'face | |
8666 (setq face (if (boundp face) (symbol-value face) face))) | |
8667 (when gnus-summary-highlight-line-function | |
8668 (funcall gnus-summary-highlight-line-function article face)))) | |
8669 (goto-char p))) | |
8670 | |
8671 (defun gnus-update-read-articles (group unread) | |
8672 "Update the list of read articles in GROUP." | |
8673 (let* ((active (or gnus-newsgroup-active (gnus-active group))) | |
8674 (entry (gnus-gethash group gnus-newsrc-hashtb)) | |
8675 (info (nth 2 entry)) | |
8676 (prev 1) | |
8677 (unread (sort (copy-sequence unread) '<)) | |
8678 read) | |
8679 (if (or (not info) (not active)) | |
8680 ;; There is no info on this group if it was, in fact, | |
8681 ;; killed. Gnus stores no information on killed groups, so | |
8682 ;; there's nothing to be done. | |
8683 ;; One could store the information somewhere temporarily, | |
8684 ;; perhaps... Hmmm... | |
8685 () | |
8686 ;; Remove any negative articles numbers. | |
8687 (while (and unread (< (car unread) 0)) | |
8688 (setq unread (cdr unread))) | |
8689 ;; Remove any expired article numbers | |
8690 (while (and unread (< (car unread) (car active))) | |
8691 (setq unread (cdr unread))) | |
8692 ;; Compute the ranges of read articles by looking at the list of | |
8693 ;; unread articles. | |
8694 (while unread | |
8695 (when (/= (car unread) prev) | |
8696 (push (if (= prev (1- (car unread))) prev | |
8697 (cons prev (1- (car unread)))) | |
8698 read)) | |
8699 (setq prev (1+ (car unread))) | |
8700 (setq unread (cdr unread))) | |
8701 (when (<= prev (cdr active)) | |
8702 (push (cons prev (cdr active)) read)) | |
8703 (save-excursion | |
8704 (set-buffer gnus-group-buffer) | |
8705 (gnus-undo-register | |
8706 `(progn | |
8707 (gnus-info-set-marks ',info ',(gnus-info-marks info) t) | |
8708 (gnus-info-set-read ',info ',(gnus-info-read info)) | |
8709 (gnus-get-unread-articles-in-group ',info (gnus-active ,group)) | |
8710 (gnus-group-update-group ,group t)))) | |
8711 ;; Enter this list into the group info. | |
8712 (gnus-info-set-read | |
8713 info (if (> (length read) 1) (nreverse read) read)) | |
8714 ;; Set the number of unread articles in gnus-newsrc-hashtb. | |
8715 (gnus-get-unread-articles-in-group info (gnus-active group)) | |
8716 t))) | |
8717 | |
8718 (defun gnus-offer-save-summaries () | |
8719 "Offer to save all active summary buffers." | |
8720 (save-excursion | |
8721 (let ((buflist (buffer-list)) | |
8722 buffers bufname) | |
8723 ;; Go through all buffers and find all summaries. | |
8724 (while buflist | |
8725 (and (setq bufname (buffer-name (car buflist))) | |
8726 (string-match "Summary" bufname) | |
8727 (save-excursion | |
8728 (set-buffer bufname) | |
8729 ;; We check that this is, indeed, a summary buffer. | |
8730 (and (eq major-mode 'gnus-summary-mode) | |
8731 ;; Also make sure this isn't bogus. | |
8732 gnus-newsgroup-prepared | |
8733 ;; Also make sure that this isn't a dead summary buffer. | |
8734 (not gnus-dead-summary-mode))) | |
8735 (push bufname buffers)) | |
8736 (setq buflist (cdr buflist))) | |
8737 ;; Go through all these summary buffers and offer to save them. | |
8738 (when buffers | |
8739 (map-y-or-n-p | |
8740 "Update summary buffer %s? " | |
8741 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit)) | |
8742 buffers))))) | |
8743 | |
19969
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8744 (gnus-ems-redefine) |
5f1ab3dd344d
*** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
19912
diff
changeset
|
8745 |
17493 | 8746 (provide 'gnus-sum) |
8747 | |
8748 (run-hooks 'gnus-sum-load-hook) | |
8749 | |
8750 ;;; gnus-sum.el ends here |