98
|
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
|
|
28 (require 'gnus)
|
|
29 (require 'gnus-group)
|
|
30 (require 'gnus-spec)
|
|
31 (require 'gnus-range)
|
|
32 (require 'gnus-int)
|
|
33 (require 'gnus-undo)
|
|
34
|
|
35 (defcustom gnus-kill-summary-on-exit t
|
|
36 "*If non-nil, kill the summary buffer when you exit from it.
|
|
37 If nil, the summary will become a \"*Dead Summary*\" buffer, and
|
|
38 it will be killed sometime later."
|
|
39 :group 'gnus-summary-exit
|
|
40 :type 'boolean)
|
|
41
|
|
42 (defcustom gnus-fetch-old-headers nil
|
|
43 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
|
|
44 If an unread article in the group refers to an older, already read (or
|
|
45 just marked as read) article, the old article will not normally be
|
|
46 displayed in the Summary buffer. If this variable is non-nil, Gnus
|
|
47 will attempt to grab the headers to the old articles, and thereby
|
|
48 build complete threads. If it has the value `some', only enough
|
|
49 headers to connect otherwise loose threads will be displayed.
|
|
50 This variable can also be a number. In that case, no more than that
|
|
51 number of old headers will be fetched.
|
|
52
|
|
53 The server has to support NOV for any of this to work."
|
|
54 :group 'gnus-thread
|
|
55 :type '(choice (const :tag "off" nil)
|
|
56 (const some)
|
|
57 number
|
|
58 (sexp :menu-tag "other" t)))
|
|
59
|
|
60 (defcustom gnus-summary-make-false-root 'adopt
|
|
61 "*nil means that Gnus won't gather loose threads.
|
|
62 If the root of a thread has expired or been read in a previous
|
|
63 session, the information necessary to build a complete thread has been
|
|
64 lost. Instead of having many small sub-threads from this original thread
|
|
65 scattered all over the summary buffer, Gnus can gather them.
|
|
66
|
|
67 If non-nil, Gnus will try to gather all loose sub-threads from an
|
|
68 original thread into one large thread.
|
|
69
|
|
70 If this variable is non-nil, it should be one of `none', `adopt',
|
|
71 `dummy' or `empty'.
|
|
72
|
|
73 If this variable is `none', Gnus will not make a false root, but just
|
|
74 present the sub-threads after another.
|
|
75 If this variable is `dummy', Gnus will create a dummy root that will
|
|
76 have all the sub-threads as children.
|
|
77 If this variable is `adopt', Gnus will make one of the \"children\"
|
|
78 the parent and mark all the step-children as such.
|
|
79 If this variable is `empty', the \"children\" are printed with empty
|
|
80 subject fields. (Or rather, they will be printed with a string
|
|
81 given by the `gnus-summary-same-subject' variable.)"
|
|
82 :group 'gnus-thread
|
|
83 :type '(choice (const :tag "off" nil)
|
|
84 (const none)
|
|
85 (const dummy)
|
|
86 (const adopt)
|
|
87 (const empty)))
|
|
88
|
|
89 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
|
|
90 "*A regexp to match subjects to be excluded from loose thread gathering.
|
|
91 As loose thread gathering is done on subjects only, that means that
|
|
92 there can be many false gatherings performed. By rooting out certain
|
|
93 common subjects, gathering might become saner."
|
|
94 :group 'gnus-thread
|
|
95 :type 'regexp)
|
|
96
|
|
97 (defcustom gnus-summary-gather-subject-limit nil
|
|
98 "*Maximum length of subject comparisons when gathering loose threads.
|
|
99 Use nil to compare full subjects. Setting this variable to a low
|
|
100 number will help gather threads that have been corrupted by
|
|
101 newsreaders chopping off subject lines, but it might also mean that
|
|
102 unrelated articles that have subject that happen to begin with the
|
|
103 same few characters will be incorrectly gathered.
|
|
104
|
|
105 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
|
|
106 comparing subjects."
|
|
107 :group 'gnus-thread
|
|
108 :type '(choice (const :tag "off" nil)
|
|
109 (const fuzzy)
|
|
110 (sexp :menu-tag "on" t)))
|
|
111
|
|
112 (defcustom gnus-simplify-ignored-prefixes nil
|
|
113 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
|
|
114 :group 'gnus-thread
|
|
115 :type '(choice (const :tag "off" nil)
|
|
116 regexp))
|
|
117
|
|
118 (defcustom gnus-build-sparse-threads nil
|
|
119 "*If non-nil, fill in the gaps in threads.
|
|
120 If `some', only fill in the gaps that are needed to tie loose threads
|
|
121 together. If `more', fill in all leaf nodes that Gnus can find. If
|
|
122 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
|
|
123 :group 'gnus-thread
|
|
124 :type '(choice (const :tag "off" nil)
|
|
125 (const some)
|
|
126 (const more)
|
|
127 (sexp :menu-tag "all" t)))
|
|
128
|
|
129 (defcustom gnus-summary-thread-gathering-function 'gnus-gather-threads-by-subject
|
|
130 "Function used for gathering loose threads.
|
|
131 There are two pre-defined functions: `gnus-gather-threads-by-subject',
|
|
132 which only takes Subjects into consideration; and
|
|
133 `gnus-gather-threads-by-references', which compared the References
|
|
134 headers of the articles to find matches."
|
|
135 :group 'gnus-thread
|
|
136 :type '(set (function-item gnus-gather-threads-by-subject)
|
|
137 (function-item gnus-gather-threads-by-references)
|
|
138 (function :tag "other")))
|
|
139
|
|
140 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
141 (defcustom gnus-summary-same-subject ""
|
|
142 "*String indicating that the current article has the same subject as the previous.
|
|
143 This variable will only be used if the value of
|
|
144 `gnus-summary-make-false-root' is `empty'."
|
|
145 :group 'gnus-summary-format
|
|
146 :type 'string)
|
|
147
|
|
148 (defcustom gnus-summary-goto-unread t
|
|
149 "*If t, marking commands will go to the next unread article.
|
|
150 If `never', commands that usually go to the next unread article, will
|
|
151 go to the next article, whether it is read or not.
|
|
152 If nil, only the marking commands will go to the next (un)read article."
|
|
153 :group 'gnus-summary-marks
|
|
154 :link '(custom-manual "(gnus)Setting Marks")
|
|
155 :type '(choice (const :tag "off" nil)
|
|
156 (const never)
|
|
157 (sexp :menu-tag "on" t)))
|
|
158
|
|
159 (defcustom gnus-summary-default-score 0
|
|
160 "*Default article score level.
|
|
161 If this variable is nil, scoring will be disabled."
|
100
|
162 :group 'gnus-score-default
|
98
|
163 :type '(choice (const :tag "disable")
|
|
164 integer))
|
|
165
|
|
166 (defcustom gnus-summary-zcore-fuzz 0
|
|
167 "*Fuzziness factor for the zcore in the summary buffer.
|
|
168 Articles with scores closer than this to `gnus-summary-default-score'
|
|
169 will not be marked."
|
|
170 :group 'gnus-summary-format
|
|
171 :type 'integer)
|
|
172
|
|
173 (defcustom gnus-simplify-subject-fuzzy-regexp nil
|
|
174 "*Strings to be removed when doing fuzzy matches.
|
|
175 This can either be a regular expression or list of regular expressions
|
|
176 that will be removed from subject strings if fuzzy subject
|
|
177 simplification is selected."
|
|
178 :group 'gnus-thread
|
|
179 :type '(repeat regexp))
|
|
180
|
|
181 (defcustom gnus-show-threads t
|
|
182 "*If non-nil, display threads in summary mode."
|
|
183 :group 'gnus-thread
|
|
184 :type 'boolean)
|
|
185
|
|
186 (defcustom gnus-thread-hide-subtree nil
|
|
187 "*If non-nil, hide all threads initially.
|
|
188 If threads are hidden, you have to run the command
|
|
189 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
|
|
190 to expose hidden threads."
|
|
191 :group 'gnus-thread
|
|
192 :type 'boolean)
|
|
193
|
|
194 (defcustom gnus-thread-hide-killed t
|
|
195 "*If non-nil, hide killed threads automatically."
|
|
196 :group 'gnus-thread
|
|
197 :type 'boolean)
|
|
198
|
|
199 (defcustom gnus-thread-ignore-subject nil
|
|
200 "*If non-nil, ignore subjects and do all threading based on the Reference header.
|
|
201 If nil, which is the default, articles that have different subjects
|
|
202 from their parents will start separate threads."
|
|
203 :group 'gnus-thread
|
|
204 :type 'boolean)
|
|
205
|
|
206 (defcustom gnus-thread-operation-ignore-subject t
|
|
207 "*If non-nil, subjects will be ignored when doing thread commands.
|
|
208 This affects commands like `gnus-summary-kill-thread' and
|
|
209 `gnus-summary-lower-thread'.
|
|
210
|
|
211 If this variable is nil, articles in the same thread with different
|
|
212 subjects will not be included in the operation in question. If this
|
|
213 variable is `fuzzy', only articles that have subjects that are fuzzily
|
|
214 equal will be included."
|
|
215 :group 'gnus-thread
|
|
216 :type '(choice (const :tag "off" nil)
|
|
217 (const fuzzy)
|
|
218 (sexp :tag "on" t)))
|
|
219
|
|
220 (defcustom gnus-thread-indent-level 4
|
|
221 "*Number that says how much each sub-thread should be indented."
|
|
222 :group 'gnus-thread
|
|
223 :type 'integer)
|
|
224
|
|
225 (defcustom gnus-auto-extend-newsgroup t
|
|
226 "*If non-nil, extend newsgroup forward and backward when requested."
|
|
227 :group 'gnus-summary-choose
|
|
228 :type 'boolean)
|
|
229
|
|
230 (defcustom gnus-auto-select-first t
|
|
231 "*If nil, don't select the first unread article when entering a group.
|
|
232 If this variable is `best', select the highest-scored unread article
|
|
233 in the group. If neither nil nor `best', select the first unread
|
|
234 article.
|
|
235
|
|
236 If you want to prevent automatic selection of the first unread article
|
|
237 in some newsgroups, set the variable to nil in
|
|
238 `gnus-select-group-hook'."
|
|
239 :group 'gnus-group-select
|
|
240 :type '(choice (const :tag "none" nil)
|
|
241 (const best)
|
|
242 (sexp :menu-tag "first" t)))
|
|
243
|
|
244 (defcustom gnus-auto-select-next t
|
|
245 "*If non-nil, offer to go to the next group from the end of the previous.
|
|
246 If the value is t and the next newsgroup is empty, Gnus will exit
|
|
247 summary mode and go back to group mode. If the value is neither nil
|
|
248 nor t, Gnus will select the following unread newsgroup. In
|
|
249 particular, if the value is the symbol `quietly', the next unread
|
|
250 newsgroup will be selected without any confirmation, and if it is
|
|
251 `almost-quietly', the next group will be selected without any
|
|
252 confirmation if you are located on the last article in the group.
|
|
253 Finally, if this variable is `slightly-quietly', the `Z n' command
|
|
254 will go to the next group without confirmation."
|
|
255 :group 'gnus-summary-maneuvering
|
|
256 :type '(choice (const :tag "off" nil)
|
|
257 (const quietly)
|
|
258 (const almost-quietly)
|
|
259 (const slightly-quietly)
|
|
260 (sexp :menu-tag "on" t)))
|
|
261
|
|
262 (defcustom gnus-auto-select-same nil
|
|
263 "*If non-nil, select the next article with the same subject."
|
|
264 :group 'gnus-summary-maneuvering
|
|
265 :type 'boolean)
|
|
266
|
|
267 (defcustom gnus-summary-check-current nil
|
|
268 "*If non-nil, consider the current article when moving.
|
|
269 The \"unread\" movement commands will stay on the same line if the
|
|
270 current article is unread."
|
|
271 :group 'gnus-summary-maneuvering
|
|
272 :type 'boolean)
|
|
273
|
|
274 (defcustom gnus-auto-center-summary t
|
|
275 "*If non-nil, always center the current summary buffer.
|
|
276 In particular, if `vertical' do only vertical recentering. If non-nil
|
|
277 and non-`vertical', do both horizontal and vertical recentering."
|
|
278 :group 'gnus-summary-maneuvering
|
|
279 :type '(choice (const :tag "none" nil)
|
|
280 (const vertical)
|
|
281 (sexp :menu-tag "both" t)))
|
|
282
|
|
283 (defcustom gnus-show-all-headers nil
|
|
284 "*If non-nil, don't hide any headers."
|
|
285 :group 'gnus-article-hiding
|
|
286 :group 'gnus-article-headers
|
|
287 :type 'boolean)
|
|
288
|
|
289 (defcustom gnus-single-article-buffer t
|
|
290 "*If non-nil, display all articles in the same buffer.
|
|
291 If nil, each group will get its own article buffer."
|
|
292 :group 'gnus-article-various
|
|
293 :type 'boolean)
|
|
294
|
|
295 (defcustom gnus-break-pages t
|
|
296 "*If non-nil, do page breaking on articles.
|
|
297 The page delimiter is specified by the `gnus-page-delimiter'
|
|
298 variable."
|
|
299 :group 'gnus-article-various
|
|
300 :type 'boolean)
|
|
301
|
|
302 (defcustom gnus-show-mime nil
|
|
303 "*If non-nil, do mime processing of articles.
|
|
304 The articles will simply be fed to the function given by
|
|
305 `gnus-show-mime-method'."
|
|
306 :group 'gnus-article-mime
|
|
307 :type 'boolean)
|
|
308
|
|
309 (defcustom gnus-move-split-methods nil
|
|
310 "*Variable used to suggest where articles are to be moved to.
|
|
311 It uses the same syntax as the `gnus-split-methods' variable."
|
|
312 :group 'gnus-summary-mail
|
|
313 :type '(repeat (choice (list function)
|
|
314 (cons regexp (repeat string))
|
|
315 sexp)))
|
|
316
|
|
317 ;; Mark variables suggested by Thomas Michanek
|
|
318 ;; <Thomas.Michanek@telelogic.se>.
|
|
319
|
|
320 (defcustom gnus-unread-mark ?
|
|
321 "*Mark used for unread articles."
|
|
322 :group 'gnus-summary-marks
|
|
323 :type 'character)
|
|
324
|
|
325 (defcustom gnus-ticked-mark ?!
|
|
326 "*Mark used for ticked articles."
|
|
327 :group 'gnus-summary-marks
|
|
328 :type 'character)
|
|
329
|
|
330 (defcustom gnus-dormant-mark ??
|
|
331 "*Mark used for dormant articles."
|
|
332 :group 'gnus-summary-marks
|
|
333 :type 'character)
|
|
334
|
|
335 (defcustom gnus-del-mark ?r
|
|
336 "*Mark used for del'd articles."
|
|
337 :group 'gnus-summary-marks
|
|
338 :type 'character)
|
|
339
|
|
340 (defcustom gnus-read-mark ?R
|
|
341 "*Mark used for read articles."
|
|
342 :group 'gnus-summary-marks
|
|
343 :type 'character)
|
|
344
|
|
345 (defcustom gnus-expirable-mark ?E
|
|
346 "*Mark used for expirable articles."
|
|
347 :group 'gnus-summary-marks
|
|
348 :type 'character)
|
|
349
|
|
350 (defcustom gnus-killed-mark ?K
|
|
351 "*Mark used for killed articles."
|
|
352 :group 'gnus-summary-marks
|
|
353 :type 'character)
|
|
354
|
|
355 (defcustom gnus-souped-mark ?F
|
|
356 "*Mark used for killed articles."
|
|
357 :group 'gnus-summary-marks
|
|
358 :type 'character)
|
|
359
|
|
360 (defcustom gnus-kill-file-mark ?X
|
|
361 "*Mark used for articles killed by kill files."
|
|
362 :group 'gnus-summary-marks
|
|
363 :type 'character)
|
|
364
|
|
365 (defcustom gnus-low-score-mark ?Y
|
|
366 "*Mark used for articles with a low score."
|
|
367 :group 'gnus-summary-marks
|
|
368 :type 'character)
|
|
369
|
|
370 (defcustom gnus-catchup-mark ?C
|
|
371 "*Mark used for articles that are caught up."
|
|
372 :group 'gnus-summary-marks
|
|
373 :type 'character)
|
|
374
|
|
375 (defcustom gnus-replied-mark ?A
|
|
376 "*Mark used for articles that have been replied to."
|
|
377 :group 'gnus-summary-marks
|
|
378 :type 'character)
|
|
379
|
|
380 (defcustom gnus-cached-mark ?*
|
|
381 "*Mark used for articles that are in the cache."
|
|
382 :group 'gnus-summary-marks
|
|
383 :type 'character)
|
|
384
|
|
385 (defcustom gnus-saved-mark ?S
|
|
386 "*Mark used for articles that have been saved to."
|
|
387 :group 'gnus-summary-marks
|
|
388 :type 'character)
|
|
389
|
|
390 (defcustom gnus-ancient-mark ?O
|
|
391 "*Mark used for ancient articles."
|
|
392 :group 'gnus-summary-marks
|
|
393 :type 'character)
|
|
394
|
|
395 (defcustom gnus-sparse-mark ?Q
|
|
396 "*Mark used for sparsely reffed articles."
|
|
397 :group 'gnus-summary-marks
|
|
398 :type 'character)
|
|
399
|
|
400 (defcustom gnus-canceled-mark ?G
|
|
401 "*Mark used for canceled articles."
|
|
402 :group 'gnus-summary-marks
|
|
403 :type 'character)
|
|
404
|
|
405 (defcustom gnus-duplicate-mark ?M
|
|
406 "*Mark used for duplicate articles."
|
|
407 :group 'gnus-summary-marks
|
|
408 :type 'character)
|
|
409
|
|
410 (defcustom gnus-score-over-mark ?+
|
|
411 "*Score mark used for articles with high scores."
|
|
412 :group 'gnus-summary-marks
|
|
413 :type 'character)
|
|
414
|
|
415 (defcustom gnus-score-below-mark ?-
|
|
416 "*Score mark used for articles with low scores."
|
|
417 :group 'gnus-summary-marks
|
|
418 :type 'character)
|
|
419
|
|
420 (defcustom gnus-empty-thread-mark ?
|
|
421 "*There is no thread under the article."
|
|
422 :group 'gnus-summary-marks
|
|
423 :type 'character)
|
|
424
|
|
425 (defcustom gnus-not-empty-thread-mark ?=
|
|
426 "*There is a thread under the article."
|
|
427 :group 'gnus-summary-marks
|
|
428 :type 'character)
|
|
429
|
|
430 (defcustom gnus-view-pseudo-asynchronously nil
|
|
431 "*If non-nil, Gnus will view pseudo-articles asynchronously."
|
|
432 :group 'gnus-extract-view
|
|
433 :type 'boolean)
|
|
434
|
|
435 (defcustom gnus-view-pseudos nil
|
|
436 "*If `automatic', pseudo-articles will be viewed automatically.
|
|
437 If `not-confirm', pseudos will be viewed automatically, and the user
|
|
438 will not be asked to confirm the command."
|
|
439 :group 'gnus-extract-view
|
|
440 :type '(choice (const :tag "off" nil)
|
|
441 (const automatic)
|
|
442 (const not-confirm)))
|
|
443
|
|
444 (defcustom gnus-view-pseudos-separately t
|
|
445 "*If non-nil, one pseudo-article will be created for each file to be viewed.
|
|
446 If nil, all files that use the same viewing command will be given as a
|
|
447 list of parameters to that command."
|
|
448 :group 'gnus-extract-view
|
|
449 :type 'boolean)
|
|
450
|
|
451 (defcustom gnus-insert-pseudo-articles t
|
|
452 "*If non-nil, insert pseudo-articles when decoding articles."
|
|
453 :group 'gnus-extract-view
|
|
454 :type 'boolean)
|
|
455
|
|
456 (defcustom gnus-summary-dummy-line-format
|
|
457 "* %(: :%) %S\n"
|
|
458 "*The format specification for the dummy roots in the summary buffer.
|
|
459 It works along the same lines as a normal formatting string,
|
|
460 with some simple extensions.
|
|
461
|
|
462 %S The subject"
|
|
463 :group 'gnus-threading
|
|
464 :type 'string)
|
|
465
|
|
466 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
|
|
467 "*The format specification for the summary mode line.
|
|
468 It works along the same lines as a normal formatting string,
|
|
469 with some simple extensions:
|
|
470
|
|
471 %G Group name
|
|
472 %p Unprefixed group name
|
|
473 %A Current article number
|
|
474 %V Gnus version
|
|
475 %U Number of unread articles in the group
|
|
476 %e Number of unselected articles in the group
|
|
477 %Z A string with unread/unselected article counts
|
|
478 %g Shortish group name
|
|
479 %S Subject of the current article
|
|
480 %u User-defined spec
|
|
481 %s Current score file name
|
|
482 %d Number of dormant articles
|
|
483 %r Number of articles that have been marked as read in this session
|
|
484 %E Number of articles expunged by the score files"
|
|
485 :group 'gnus-summary-format
|
|
486 :type 'string)
|
|
487
|
|
488 (defcustom gnus-summary-mark-below 0
|
|
489 "*Mark all articles with a score below this variable as read.
|
|
490 This variable is local to each summary buffer and usually set by the
|
|
491 score file."
|
100
|
492 :group 'gnus-score-default
|
98
|
493 :type 'integer)
|
|
494
|
|
495 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
|
|
496 "*List of functions used for sorting articles in the summary buffer.
|
|
497 This variable is only used when not using a threaded display."
|
|
498 :group 'gnus-summary-sort
|
|
499 :type '(repeat (choice (function-item gnus-article-sort-by-number)
|
|
500 (function-item gnus-article-sort-by-author)
|
|
501 (function-item gnus-article-sort-by-subject)
|
|
502 (function-item gnus-article-sort-by-date)
|
|
503 (function-item gnus-article-sort-by-score)
|
|
504 (function :tag "other"))))
|
|
505
|
|
506 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
|
|
507 "*List of functions used for sorting threads in the summary buffer.
|
|
508 By default, threads are sorted by article number.
|
|
509
|
|
510 Each function takes two threads and return non-nil if the first thread
|
|
511 should be sorted before the other. If you use more than one function,
|
|
512 the primary sort function should be the last. You should probably
|
|
513 always include `gnus-thread-sort-by-number' in the list of sorting
|
|
514 functions -- preferably first.
|
|
515
|
|
516 Ready-made functions include `gnus-thread-sort-by-number',
|
|
517 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
|
|
518 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
|
|
519 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
|
|
520 :group 'gnus-summary-sort
|
|
521 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
|
|
522 (function-item gnus-thread-sort-by-author)
|
|
523 (function-item gnus-thread-sort-by-subject)
|
|
524 (function-item gnus-thread-sort-by-date)
|
|
525 (function-item gnus-thread-sort-by-score)
|
|
526 (function-item gnus-thread-sort-by-total-score)
|
|
527 (function :tag "other"))))
|
|
528
|
|
529 (defcustom gnus-thread-score-function '+
|
|
530 "*Function used for calculating the total score of a thread.
|
|
531
|
|
532 The function is called with the scores of the article and each
|
|
533 subthread and should then return the score of the thread.
|
|
534
|
|
535 Some functions you can use are `+', `max', or `min'."
|
|
536 :group 'gnus-summary-sort
|
|
537 :type 'function)
|
|
538
|
|
539 (defcustom gnus-summary-expunge-below nil
|
|
540 "All articles that have a score less than this variable will be expunged."
|
100
|
541 :group 'gnus-score-default
|
98
|
542 :type '(choice (const :tag "off" nil)
|
|
543 integer))
|
|
544
|
|
545 (defcustom gnus-thread-expunge-below nil
|
|
546 "All threads that have a total score less than this variable will be expunged.
|
|
547 See `gnus-thread-score-function' for en explanation of what a
|
|
548 \"thread score\" is."
|
|
549 :group 'gnus-treading
|
100
|
550 :group 'gnus-score-default
|
98
|
551 :type '(choice (const :tag "off" nil)
|
|
552 integer))
|
|
553
|
|
554 (defcustom gnus-summary-mode-hook nil
|
|
555 "*A hook for Gnus summary mode.
|
|
556 This hook is run before any variables are set in the summary buffer."
|
|
557 :group 'gnus-summary-various
|
|
558 :type 'hook)
|
|
559
|
|
560 (defcustom gnus-summary-menu-hook nil
|
|
561 "*Hook run after the creation of the summary mode menu."
|
|
562 :group 'gnus-summary-visual
|
|
563 :type 'hook)
|
|
564
|
|
565 (defcustom gnus-summary-exit-hook nil
|
|
566 "*A hook called on exit from the summary buffer.
|
|
567 It will be called with point in the group buffer."
|
|
568 :group 'gnus-summary-exit
|
|
569 :type 'hook)
|
|
570
|
|
571 (defcustom gnus-summary-prepare-hook nil
|
|
572 "*A hook called after the summary buffer has been generated.
|
|
573 If you want to modify the summary buffer, you can use this hook."
|
|
574 :group 'gnus-summary-various
|
|
575 :type 'hook)
|
|
576
|
|
577 (defcustom gnus-summary-generate-hook nil
|
|
578 "*A hook run just before generating the summary buffer.
|
|
579 This hook is commonly used to customize threading variables and the
|
|
580 like."
|
|
581 :group 'gnus-summary-various
|
|
582 :type 'hook)
|
|
583
|
|
584 (defcustom gnus-select-group-hook nil
|
|
585 "*A hook called when a newsgroup is selected.
|
|
586
|
|
587 If you'd like to simplify subjects like the
|
|
588 `gnus-summary-next-same-subject' command does, you can use the
|
|
589 following hook:
|
|
590
|
|
591 (setq gnus-select-group-hook
|
|
592 (list
|
|
593 (lambda ()
|
|
594 (mapcar (lambda (header)
|
|
595 (mail-header-set-subject
|
|
596 header
|
|
597 (gnus-simplify-subject
|
|
598 (mail-header-subject header) 're-only)))
|
|
599 gnus-newsgroup-headers))))"
|
|
600 :group 'gnus-group-select
|
|
601 :type 'hook)
|
|
602
|
|
603 (defcustom gnus-select-article-hook nil
|
|
604 "*A hook called when an article is selected."
|
|
605 :group 'gnus-summary-choose
|
|
606 :type 'hook)
|
|
607
|
|
608 (defcustom gnus-visual-mark-article-hook
|
|
609 (list 'gnus-highlight-selected-summary)
|
|
610 "*Hook run after selecting an article in the summary buffer.
|
|
611 It is meant to be used for highlighting the article in some way. It
|
|
612 is not run if `gnus-visual' is nil."
|
|
613 :group 'gnus-summary-visual
|
|
614 :type 'hook)
|
|
615
|
|
616 (defcustom gnus-parse-headers-hook
|
|
617 (list 'gnus-decode-rfc1522)
|
|
618 "*A hook called before parsing the headers."
|
|
619 :group 'gnus-various
|
|
620 :type 'hook)
|
|
621
|
|
622 (defcustom gnus-exit-group-hook nil
|
|
623 "*A hook called when exiting (not quitting) summary mode."
|
|
624 :group 'gnus-various
|
|
625 :type 'hook)
|
|
626
|
|
627 (defcustom gnus-summary-update-hook
|
|
628 (list 'gnus-summary-highlight-line)
|
|
629 "*A hook called when a summary line is changed.
|
|
630 The hook will not be called if `gnus-visual' is nil.
|
|
631
|
|
632 The default function `gnus-summary-highlight-line' will
|
|
633 highlight the line according to the `gnus-summary-highlight'
|
|
634 variable."
|
|
635 :group 'gnus-summary-visual
|
|
636 :type 'hook)
|
|
637
|
|
638 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
|
|
639 "*A hook called when an article is selected for the first time.
|
|
640 The hook is intended to mark an article as read (or unread)
|
|
641 automatically when it is selected."
|
|
642 :group 'gnus-summary-choose
|
|
643 :type 'hook)
|
|
644
|
|
645 (defcustom gnus-group-no-more-groups-hook nil
|
|
646 "*A hook run when returning to group mode having no more (unread) groups."
|
|
647 :group 'gnus-group-select
|
|
648 :type 'hook)
|
|
649
|
|
650 (defcustom gnus-ps-print-hook nil
|
|
651 "*A hook run before ps-printing something from Gnus."
|
|
652 :group 'gnus-summary
|
|
653 :type 'hook)
|
|
654
|
|
655 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
|
|
656 "Face used for highlighting the current article in the summary buffer."
|
|
657 :group 'gnus-summary-visual
|
|
658 :type 'face)
|
|
659
|
|
660 (defcustom gnus-summary-highlight
|
|
661 '(((= mark gnus-canceled-mark)
|
|
662 . gnus-summary-cancelled-face)
|
|
663 ((and (> score default)
|
|
664 (or (= mark gnus-dormant-mark)
|
|
665 (= mark gnus-ticked-mark)))
|
|
666 . gnus-summary-high-ticked-face)
|
|
667 ((and (< score default)
|
|
668 (or (= mark gnus-dormant-mark)
|
|
669 (= mark gnus-ticked-mark)))
|
|
670 . gnus-summary-low-ticked-face)
|
|
671 ((or (= mark gnus-dormant-mark)
|
|
672 (= mark gnus-ticked-mark))
|
|
673 . gnus-summary-normal-ticked-face)
|
|
674 ((and (> score default) (= mark gnus-ancient-mark))
|
|
675 . gnus-summary-high-ancient-face)
|
|
676 ((and (< score default) (= mark gnus-ancient-mark))
|
|
677 . gnus-summary-low-ancient-face)
|
|
678 ((= mark gnus-ancient-mark)
|
|
679 . gnus-summary-normal-ancient-face)
|
|
680 ((and (> score default) (= mark gnus-unread-mark))
|
|
681 . gnus-summary-high-unread-face)
|
|
682 ((and (< score default) (= mark gnus-unread-mark))
|
|
683 . gnus-summary-low-unread-face)
|
|
684 ((and (= mark gnus-unread-mark))
|
|
685 . gnus-summary-normal-unread-face)
|
|
686 ((> score default)
|
|
687 . gnus-summary-high-read-face)
|
|
688 ((< score default)
|
|
689 . gnus-summary-low-read-face)
|
|
690 (t
|
|
691 . gnus-summary-normal-read-face))
|
|
692 "Controls the highlighting of summary buffer lines.
|
|
693
|
|
694 A list of (FORM . FACE) pairs. When deciding how a a particular
|
|
695 summary line should be displayed, each form is evaluated. The content
|
|
696 of the face field after the first true form is used. You can change
|
|
697 how those summary lines are displayed, by editing the face field.
|
|
698
|
|
699 You can use the following variables in the FORM field.
|
|
700
|
|
701 score: The articles score
|
|
702 default: The default article score.
|
|
703 below: The score below which articles are automatically marked as read.
|
|
704 mark: The articles mark."
|
|
705 :group 'gnus-summary-visual
|
|
706 :type '(repeat (cons (sexp :tag "Form" nil)
|
|
707 face)))
|
|
708
|
|
709
|
|
710 ;;; Internal variables
|
|
711
|
|
712 (defvar gnus-scores-exclude-files nil)
|
|
713
|
|
714 (defvar gnus-summary-display-table
|
|
715 ;; Change the display table. Odd characters have a tendency to mess
|
|
716 ;; up nicely formatted displays - we make all possible glyphs
|
|
717 ;; display only a single character.
|
|
718
|
|
719 ;; We start from the standard display table, if any.
|
|
720 (let ((table (or (copy-sequence standard-display-table)
|
|
721 (make-display-table)))
|
|
722 ;; Nix out all the control chars...
|
|
723 (i 32))
|
|
724 (while (>= (setq i (1- i)) 0)
|
|
725 (aset table i [??]))
|
|
726 ;; ... but not newline and cr, of course. (cr is necessary for the
|
|
727 ;; selective display).
|
|
728 (aset table ?\n nil)
|
|
729 (aset table ?\r nil)
|
|
730 ;; We nix out any glyphs over 126 that are not set already.
|
|
731 (let ((i 256))
|
|
732 (while (>= (setq i (1- i)) 127)
|
|
733 ;; Only modify if the entry is nil.
|
|
734 (or (aref table i)
|
|
735 (aset table i [??]))))
|
|
736 table)
|
|
737 "Display table used in summary mode buffers.")
|
|
738
|
|
739 (defvar gnus-original-article nil)
|
|
740 (defvar gnus-article-internal-prepare-hook nil)
|
|
741 (defvar gnus-newsgroup-process-stack nil)
|
|
742
|
|
743 (defvar gnus-thread-indent-array nil)
|
|
744 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
745
|
|
746 ;; Avoid highlighting in kill files.
|
|
747 (defvar gnus-summary-inhibit-highlight nil)
|
|
748 (defvar gnus-newsgroup-selected-overlay nil)
|
|
749 (defvar gnus-inhibit-limiting nil)
|
|
750 (defvar gnus-newsgroup-adaptive-score-file nil)
|
|
751 (defvar gnus-current-score-file nil)
|
|
752 (defvar gnus-current-move-group nil)
|
|
753 (defvar gnus-current-copy-group nil)
|
|
754 (defvar gnus-current-crosspost-group nil)
|
|
755
|
|
756 (defvar gnus-newsgroup-dependencies nil)
|
|
757 (defvar gnus-newsgroup-adaptive nil)
|
|
758 (defvar gnus-summary-display-article-function nil)
|
|
759 (defvar gnus-summary-highlight-line-function nil
|
|
760 "Function called after highlighting a summary line.")
|
|
761
|
|
762 (defvar gnus-summary-line-format-alist
|
|
763 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
|
|
764 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
|
|
765 (?s gnus-tmp-subject-or-nil ?s)
|
|
766 (?n gnus-tmp-name ?s)
|
|
767 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
|
|
768 ?s)
|
|
769 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
|
|
770 gnus-tmp-from) ?s)
|
|
771 (?F gnus-tmp-from ?s)
|
|
772 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
|
|
773 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
|
|
774 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
|
|
775 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
|
|
776 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
|
|
777 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
|
|
778 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
|
|
779 (?L gnus-tmp-lines ?d)
|
|
780 (?I gnus-tmp-indentation ?s)
|
|
781 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
|
|
782 (?R gnus-tmp-replied ?c)
|
|
783 (?\[ gnus-tmp-opening-bracket ?c)
|
|
784 (?\] gnus-tmp-closing-bracket ?c)
|
|
785 (?\> (make-string gnus-tmp-level ? ) ?s)
|
|
786 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
|
|
787 (?i gnus-tmp-score ?d)
|
|
788 (?z gnus-tmp-score-char ?c)
|
|
789 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
|
|
790 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
|
|
791 (?U gnus-tmp-unread ?c)
|
|
792 (?t (gnus-summary-number-of-articles-in-thread
|
|
793 (and (boundp 'thread) (car thread)) gnus-tmp-level)
|
|
794 ?d)
|
|
795 (?e (gnus-summary-number-of-articles-in-thread
|
|
796 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
|
|
797 ?c)
|
|
798 (?u gnus-tmp-user-defined ?s)
|
|
799 (?P (gnus-pick-line-number) ?d))
|
|
800 "An alist of format specifications that can appear in summary lines,
|
|
801 and what variables they correspond with, along with the type of the
|
|
802 variable (string, integer, character, etc).")
|
|
803
|
|
804 (defvar gnus-summary-dummy-line-format-alist
|
|
805 `((?S gnus-tmp-subject ?s)
|
|
806 (?N gnus-tmp-number ?d)
|
|
807 (?u gnus-tmp-user-defined ?s)))
|
|
808
|
|
809 (defvar gnus-summary-mode-line-format-alist
|
|
810 `((?G gnus-tmp-group-name ?s)
|
|
811 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
|
|
812 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
|
|
813 (?A gnus-tmp-article-number ?d)
|
|
814 (?Z gnus-tmp-unread-and-unselected ?s)
|
|
815 (?V gnus-version ?s)
|
|
816 (?U gnus-tmp-unread-and-unticked ?d)
|
|
817 (?S gnus-tmp-subject ?s)
|
|
818 (?e gnus-tmp-unselected ?d)
|
|
819 (?u gnus-tmp-user-defined ?s)
|
|
820 (?d (length gnus-newsgroup-dormant) ?d)
|
|
821 (?t (length gnus-newsgroup-marked) ?d)
|
|
822 (?r (length gnus-newsgroup-reads) ?d)
|
|
823 (?E gnus-newsgroup-expunged-tally ?d)
|
|
824 (?s (gnus-current-score-file-nondirectory) ?s)))
|
|
825
|
|
826 (defvar gnus-last-search-regexp nil
|
|
827 "Default regexp for article search command.")
|
|
828
|
|
829 (defvar gnus-last-shell-command nil
|
|
830 "Default shell command on article.")
|
|
831
|
|
832 (defvar gnus-newsgroup-begin nil)
|
|
833 (defvar gnus-newsgroup-end nil)
|
|
834 (defvar gnus-newsgroup-last-rmail nil)
|
|
835 (defvar gnus-newsgroup-last-mail nil)
|
|
836 (defvar gnus-newsgroup-last-folder nil)
|
|
837 (defvar gnus-newsgroup-last-file nil)
|
|
838 (defvar gnus-newsgroup-auto-expire nil)
|
|
839 (defvar gnus-newsgroup-active nil)
|
|
840
|
|
841 (defvar gnus-newsgroup-data nil)
|
|
842 (defvar gnus-newsgroup-data-reverse nil)
|
|
843 (defvar gnus-newsgroup-limit nil)
|
|
844 (defvar gnus-newsgroup-limits nil)
|
|
845
|
|
846 (defvar gnus-newsgroup-unreads nil
|
|
847 "List of unread articles in the current newsgroup.")
|
|
848
|
|
849 (defvar gnus-newsgroup-unselected nil
|
|
850 "List of unselected unread articles in the current newsgroup.")
|
|
851
|
|
852 (defvar gnus-newsgroup-reads nil
|
|
853 "Alist of read articles and article marks in the current newsgroup.")
|
|
854
|
|
855 (defvar gnus-newsgroup-expunged-tally nil)
|
|
856
|
|
857 (defvar gnus-newsgroup-marked nil
|
|
858 "List of ticked articles in the current newsgroup (a subset of unread art).")
|
|
859
|
|
860 (defvar gnus-newsgroup-killed nil
|
|
861 "List of ranges of articles that have been through the scoring process.")
|
|
862
|
|
863 (defvar gnus-newsgroup-cached nil
|
|
864 "List of articles that come from the article cache.")
|
|
865
|
|
866 (defvar gnus-newsgroup-saved nil
|
|
867 "List of articles that have been saved.")
|
|
868
|
|
869 (defvar gnus-newsgroup-kill-headers nil)
|
|
870
|
|
871 (defvar gnus-newsgroup-replied nil
|
|
872 "List of articles that have been replied to in the current newsgroup.")
|
|
873
|
|
874 (defvar gnus-newsgroup-expirable nil
|
|
875 "List of articles in the current newsgroup that can be expired.")
|
|
876
|
|
877 (defvar gnus-newsgroup-processable nil
|
|
878 "List of articles in the current newsgroup that can be processed.")
|
|
879
|
|
880 (defvar gnus-newsgroup-bookmarks nil
|
|
881 "List of articles in the current newsgroup that have bookmarks.")
|
|
882
|
|
883 (defvar gnus-newsgroup-dormant nil
|
|
884 "List of dormant articles in the current newsgroup.")
|
|
885
|
|
886 (defvar gnus-newsgroup-scored nil
|
|
887 "List of scored articles in the current newsgroup.")
|
|
888
|
|
889 (defvar gnus-newsgroup-headers nil
|
|
890 "List of article headers in the current newsgroup.")
|
|
891
|
|
892 (defvar gnus-newsgroup-threads nil)
|
|
893
|
|
894 (defvar gnus-newsgroup-prepared nil
|
|
895 "Whether the current group has been prepared properly.")
|
|
896
|
|
897 (defvar gnus-newsgroup-ancient nil
|
|
898 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
|
|
899
|
|
900 (defvar gnus-newsgroup-sparse nil)
|
|
901
|
|
902 (defvar gnus-current-article nil)
|
|
903 (defvar gnus-article-current nil)
|
|
904 (defvar gnus-current-headers nil)
|
|
905 (defvar gnus-have-all-headers nil)
|
|
906 (defvar gnus-last-article nil)
|
|
907 (defvar gnus-newsgroup-history nil)
|
|
908
|
|
909 (defconst gnus-summary-local-variables
|
|
910 '(gnus-newsgroup-name
|
|
911 gnus-newsgroup-begin gnus-newsgroup-end
|
|
912 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
|
|
913 gnus-newsgroup-last-folder gnus-newsgroup-last-file
|
|
914 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
|
|
915 gnus-newsgroup-unselected gnus-newsgroup-marked
|
|
916 gnus-newsgroup-reads gnus-newsgroup-saved
|
|
917 gnus-newsgroup-replied gnus-newsgroup-expirable
|
|
918 gnus-newsgroup-processable gnus-newsgroup-killed
|
|
919 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
|
|
920 gnus-newsgroup-headers gnus-newsgroup-threads
|
|
921 gnus-newsgroup-prepared gnus-summary-highlight-line-function
|
|
922 gnus-current-article gnus-current-headers gnus-have-all-headers
|
|
923 gnus-last-article gnus-article-internal-prepare-hook
|
|
924 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
|
|
925 gnus-newsgroup-scored gnus-newsgroup-kill-headers
|
|
926 gnus-thread-expunge-below
|
|
927 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
|
|
928 (gnus-summary-mark-below . global)
|
|
929 gnus-newsgroup-active gnus-scores-exclude-files
|
|
930 gnus-newsgroup-history gnus-newsgroup-ancient
|
|
931 gnus-newsgroup-sparse gnus-newsgroup-process-stack
|
|
932 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
|
|
933 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
|
|
934 (gnus-newsgroup-expunged-tally . 0)
|
|
935 gnus-cache-removable-articles gnus-newsgroup-cached
|
|
936 gnus-newsgroup-data gnus-newsgroup-data-reverse
|
|
937 gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
938 "Variables that are buffer-local to the summary buffers.")
|
|
939
|
|
940 ;; Byte-compiler warning.
|
|
941 (defvar gnus-article-mode-map)
|
|
942
|
|
943 ;; Subject simplification.
|
|
944
|
|
945 (defsubst gnus-simplify-subject-re (subject)
|
|
946 "Remove \"Re:\" from subject lines."
|
|
947 (if (string-match "^[Rr][Ee]: *" subject)
|
|
948 (substring subject (match-end 0))
|
|
949 subject))
|
|
950
|
|
951 (defun gnus-simplify-subject (subject &optional re-only)
|
|
952 "Remove `Re:' and words in parentheses.
|
|
953 If RE-ONLY is non-nil, strip leading `Re:'s only."
|
|
954 (let ((case-fold-search t)) ;Ignore case.
|
|
955 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
|
|
956 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
|
|
957 (setq subject (substring subject (match-end 0))))
|
|
958 ;; Remove uninteresting prefixes.
|
|
959 (when (and (not re-only)
|
|
960 gnus-simplify-ignored-prefixes
|
|
961 (string-match gnus-simplify-ignored-prefixes subject))
|
|
962 (setq subject (substring subject (match-end 0))))
|
|
963 ;; Remove words in parentheses from end.
|
|
964 (unless re-only
|
|
965 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
|
|
966 (setq subject (substring subject 0 (match-beginning 0)))))
|
|
967 ;; Return subject string.
|
|
968 subject))
|
|
969
|
|
970 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
|
|
971 ;; all whitespace.
|
|
972 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
|
|
973 (goto-char (point-min))
|
|
974 (while (re-search-forward regexp nil t)
|
|
975 (replace-match (or newtext ""))))
|
|
976
|
|
977 (defun gnus-simplify-buffer-fuzzy ()
|
|
978 "Simplify string in the buffer fuzzily.
|
|
979 The string in the accessible portion of the current buffer is simplified.
|
|
980 It is assumed to be a single-line subject.
|
|
981 Whitespace is generally cleaned up, and miscellaneous leading/trailing
|
|
982 matter is removed. Additional things can be deleted by setting
|
|
983 gnus-simplify-subject-fuzzy-regexp."
|
|
984 (let ((case-fold-search t)
|
|
985 (modified-tick))
|
|
986 (gnus-simplify-buffer-fuzzy-step "\t" " ")
|
|
987
|
|
988 (while (not (eq modified-tick (buffer-modified-tick)))
|
|
989 (setq modified-tick (buffer-modified-tick))
|
|
990 (cond
|
|
991 ((listp gnus-simplify-subject-fuzzy-regexp)
|
|
992 (mapcar 'gnus-simplify-buffer-fuzzy-step
|
|
993 gnus-simplify-subject-fuzzy-regexp))
|
|
994 (gnus-simplify-subject-fuzzy-regexp
|
|
995 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
|
|
996 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
|
|
997 (gnus-simplify-buffer-fuzzy-step
|
|
998 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
|
|
999 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
|
|
1000
|
|
1001 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
|
|
1002 (gnus-simplify-buffer-fuzzy-step " +" " ")
|
|
1003 (gnus-simplify-buffer-fuzzy-step " $")
|
|
1004 (gnus-simplify-buffer-fuzzy-step "^ +")))
|
|
1005
|
|
1006 (defun gnus-simplify-subject-fuzzy (subject)
|
|
1007 "Simplify a subject string fuzzily.
|
|
1008 See gnus-simplify-buffer-fuzzy for details."
|
|
1009 (save-excursion
|
|
1010 (gnus-set-work-buffer)
|
|
1011 (let ((case-fold-search t))
|
|
1012 (insert subject)
|
|
1013 (inline (gnus-simplify-buffer-fuzzy))
|
|
1014 (buffer-string))))
|
|
1015
|
|
1016 (defsubst gnus-simplify-subject-fully (subject)
|
|
1017 "Simplify a subject string according to gnus-summary-gather-subject-limit."
|
|
1018 (cond
|
|
1019 ((null gnus-summary-gather-subject-limit)
|
|
1020 (gnus-simplify-subject-re subject))
|
|
1021 ((eq gnus-summary-gather-subject-limit 'fuzzy)
|
|
1022 (gnus-simplify-subject-fuzzy subject))
|
|
1023 ((numberp gnus-summary-gather-subject-limit)
|
|
1024 (gnus-limit-string (gnus-simplify-subject-re subject)
|
|
1025 gnus-summary-gather-subject-limit))
|
|
1026 (t
|
|
1027 subject)))
|
|
1028
|
|
1029 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
|
|
1030 "Check whether two subjects are equal. If optional argument
|
|
1031 simple-first is t, first argument is already simplified."
|
|
1032 (cond
|
|
1033 ((null simple-first)
|
|
1034 (equal (gnus-simplify-subject-fully s1)
|
|
1035 (gnus-simplify-subject-fully s2)))
|
|
1036 (t
|
|
1037 (equal s1
|
|
1038 (gnus-simplify-subject-fully s2)))))
|
|
1039
|
|
1040 (defun gnus-summary-bubble-group ()
|
|
1041 "Increase the score of the current group.
|
|
1042 This is a handy function to add to `gnus-summary-exit-hook' to
|
|
1043 increase the score of each group you read."
|
|
1044 (gnus-group-add-score gnus-newsgroup-name))
|
|
1045
|
|
1046
|
|
1047 ;;;
|
|
1048 ;;; Gnus summary mode
|
|
1049 ;;;
|
|
1050
|
|
1051 (put 'gnus-summary-mode 'mode-class 'special)
|
|
1052
|
|
1053 (when t
|
|
1054 ;; Non-orthogonal keys
|
|
1055
|
|
1056 (gnus-define-keys gnus-summary-mode-map
|
|
1057 " " gnus-summary-next-page
|
|
1058 "\177" gnus-summary-prev-page
|
|
1059 [delete] gnus-summary-prev-page
|
|
1060 "\r" gnus-summary-scroll-up
|
|
1061 "n" gnus-summary-next-unread-article
|
|
1062 "p" gnus-summary-prev-unread-article
|
|
1063 "N" gnus-summary-next-article
|
|
1064 "P" gnus-summary-prev-article
|
|
1065 "\M-\C-n" gnus-summary-next-same-subject
|
|
1066 "\M-\C-p" gnus-summary-prev-same-subject
|
|
1067 "\M-n" gnus-summary-next-unread-subject
|
|
1068 "\M-p" gnus-summary-prev-unread-subject
|
|
1069 "." gnus-summary-first-unread-article
|
|
1070 "," gnus-summary-best-unread-article
|
|
1071 "\M-s" gnus-summary-search-article-forward
|
|
1072 "\M-r" gnus-summary-search-article-backward
|
|
1073 "<" gnus-summary-beginning-of-article
|
|
1074 ">" gnus-summary-end-of-article
|
|
1075 "j" gnus-summary-goto-article
|
|
1076 "^" gnus-summary-refer-parent-article
|
|
1077 "\M-^" gnus-summary-refer-article
|
|
1078 "u" gnus-summary-tick-article-forward
|
|
1079 "!" gnus-summary-tick-article-forward
|
|
1080 "U" gnus-summary-tick-article-backward
|
|
1081 "d" gnus-summary-mark-as-read-forward
|
|
1082 "D" gnus-summary-mark-as-read-backward
|
|
1083 "E" gnus-summary-mark-as-expirable
|
|
1084 "\M-u" gnus-summary-clear-mark-forward
|
|
1085 "\M-U" gnus-summary-clear-mark-backward
|
|
1086 "k" gnus-summary-kill-same-subject-and-select
|
|
1087 "\C-k" gnus-summary-kill-same-subject
|
|
1088 "\M-\C-k" gnus-summary-kill-thread
|
|
1089 "\M-\C-l" gnus-summary-lower-thread
|
|
1090 "e" gnus-summary-edit-article
|
|
1091 "#" gnus-summary-mark-as-processable
|
|
1092 "\M-#" gnus-summary-unmark-as-processable
|
|
1093 "\M-\C-t" gnus-summary-toggle-threads
|
|
1094 "\M-\C-s" gnus-summary-show-thread
|
|
1095 "\M-\C-h" gnus-summary-hide-thread
|
|
1096 "\M-\C-f" gnus-summary-next-thread
|
|
1097 "\M-\C-b" gnus-summary-prev-thread
|
|
1098 "\M-\C-u" gnus-summary-up-thread
|
|
1099 "\M-\C-d" gnus-summary-down-thread
|
|
1100 "&" gnus-summary-execute-command
|
|
1101 "c" gnus-summary-catchup-and-exit
|
|
1102 "\C-w" gnus-summary-mark-region-as-read
|
|
1103 "\C-t" gnus-summary-toggle-truncation
|
|
1104 "?" gnus-summary-mark-as-dormant
|
|
1105 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
|
|
1106 "\C-c\C-s\C-n" gnus-summary-sort-by-number
|
|
1107 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
|
|
1108 "\C-c\C-s\C-a" gnus-summary-sort-by-author
|
|
1109 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
|
|
1110 "\C-c\C-s\C-d" gnus-summary-sort-by-date
|
|
1111 "\C-c\C-s\C-i" gnus-summary-sort-by-score
|
|
1112 "=" gnus-summary-expand-window
|
|
1113 "\C-x\C-s" gnus-summary-reselect-current-group
|
|
1114 "\M-g" gnus-summary-rescan-group
|
|
1115 "w" gnus-summary-stop-page-breaking
|
|
1116 "\C-c\C-r" gnus-summary-caesar-message
|
|
1117 "\M-t" gnus-summary-toggle-mime
|
|
1118 "f" gnus-summary-followup
|
|
1119 "F" gnus-summary-followup-with-original
|
|
1120 "C" gnus-summary-cancel-article
|
|
1121 "r" gnus-summary-reply
|
|
1122 "R" gnus-summary-reply-with-original
|
|
1123 "\C-c\C-f" gnus-summary-mail-forward
|
|
1124 "o" gnus-summary-save-article
|
|
1125 "\C-o" gnus-summary-save-article-mail
|
|
1126 "|" gnus-summary-pipe-output
|
|
1127 "\M-k" gnus-summary-edit-local-kill
|
|
1128 "\M-K" gnus-summary-edit-global-kill
|
|
1129 ;; "V" gnus-version
|
|
1130 "\C-c\C-d" gnus-summary-describe-group
|
|
1131 "q" gnus-summary-exit
|
|
1132 "Q" gnus-summary-exit-no-update
|
|
1133 "\C-c\C-i" gnus-info-find-node
|
|
1134 gnus-mouse-2 gnus-mouse-pick-article
|
|
1135 "m" gnus-summary-mail-other-window
|
|
1136 "a" gnus-summary-post-news
|
|
1137 "x" gnus-summary-limit-to-unread
|
|
1138 "s" gnus-summary-isearch-article
|
|
1139 "t" gnus-article-hide-headers
|
|
1140 "g" gnus-summary-show-article
|
|
1141 "l" gnus-summary-goto-last-article
|
|
1142 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
|
|
1143 "\C-d" gnus-summary-enter-digest-group
|
|
1144 "\M-\C-d" gnus-summary-read-document
|
|
1145 "\C-c\C-b" gnus-bug
|
|
1146 "*" gnus-cache-enter-article
|
|
1147 "\M-*" gnus-cache-remove-article
|
|
1148 "\M-&" gnus-summary-universal-argument
|
|
1149 "\C-l" gnus-recenter
|
|
1150 "I" gnus-summary-increase-score
|
|
1151 "L" gnus-summary-lower-score
|
|
1152
|
|
1153 "V" gnus-summary-score-map
|
|
1154 "X" gnus-uu-extract-map
|
|
1155 "S" gnus-summary-send-map)
|
|
1156
|
|
1157 ;; Sort of orthogonal keymap
|
|
1158 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
|
|
1159 "t" gnus-summary-tick-article-forward
|
|
1160 "!" gnus-summary-tick-article-forward
|
|
1161 "d" gnus-summary-mark-as-read-forward
|
|
1162 "r" gnus-summary-mark-as-read-forward
|
|
1163 "c" gnus-summary-clear-mark-forward
|
|
1164 " " gnus-summary-clear-mark-forward
|
|
1165 "e" gnus-summary-mark-as-expirable
|
|
1166 "x" gnus-summary-mark-as-expirable
|
|
1167 "?" gnus-summary-mark-as-dormant
|
|
1168 "b" gnus-summary-set-bookmark
|
|
1169 "B" gnus-summary-remove-bookmark
|
|
1170 "#" gnus-summary-mark-as-processable
|
|
1171 "\M-#" gnus-summary-unmark-as-processable
|
|
1172 "S" gnus-summary-limit-include-expunged
|
|
1173 "C" gnus-summary-catchup
|
|
1174 "H" gnus-summary-catchup-to-here
|
|
1175 "\C-c" gnus-summary-catchup-all
|
|
1176 "k" gnus-summary-kill-same-subject-and-select
|
|
1177 "K" gnus-summary-kill-same-subject
|
|
1178 "P" gnus-uu-mark-map)
|
|
1179
|
|
1180 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
|
|
1181 "c" gnus-summary-clear-above
|
|
1182 "u" gnus-summary-tick-above
|
|
1183 "m" gnus-summary-mark-above
|
|
1184 "k" gnus-summary-kill-below)
|
|
1185
|
|
1186 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
|
|
1187 "/" gnus-summary-limit-to-subject
|
|
1188 "n" gnus-summary-limit-to-articles
|
|
1189 "w" gnus-summary-pop-limit
|
|
1190 "s" gnus-summary-limit-to-subject
|
|
1191 "a" gnus-summary-limit-to-author
|
|
1192 "u" gnus-summary-limit-to-unread
|
|
1193 "m" gnus-summary-limit-to-marks
|
|
1194 "v" gnus-summary-limit-to-score
|
|
1195 "D" gnus-summary-limit-include-dormant
|
|
1196 "d" gnus-summary-limit-exclude-dormant
|
|
1197 "t" gnus-summary-limit-to-age
|
|
1198 "E" gnus-summary-limit-include-expunged
|
|
1199 "c" gnus-summary-limit-exclude-childless-dormant
|
|
1200 "C" gnus-summary-limit-mark-excluded-as-read)
|
|
1201
|
|
1202 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
|
|
1203 "n" gnus-summary-next-unread-article
|
|
1204 "p" gnus-summary-prev-unread-article
|
|
1205 "N" gnus-summary-next-article
|
|
1206 "P" gnus-summary-prev-article
|
|
1207 "\C-n" gnus-summary-next-same-subject
|
|
1208 "\C-p" gnus-summary-prev-same-subject
|
|
1209 "\M-n" gnus-summary-next-unread-subject
|
|
1210 "\M-p" gnus-summary-prev-unread-subject
|
|
1211 "f" gnus-summary-first-unread-article
|
|
1212 "b" gnus-summary-best-unread-article
|
|
1213 "j" gnus-summary-goto-article
|
|
1214 "g" gnus-summary-goto-subject
|
|
1215 "l" gnus-summary-goto-last-article
|
|
1216 "p" gnus-summary-pop-article)
|
|
1217
|
|
1218 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
|
|
1219 "k" gnus-summary-kill-thread
|
|
1220 "l" gnus-summary-lower-thread
|
|
1221 "i" gnus-summary-raise-thread
|
|
1222 "T" gnus-summary-toggle-threads
|
|
1223 "t" gnus-summary-rethread-current
|
|
1224 "^" gnus-summary-reparent-thread
|
|
1225 "s" gnus-summary-show-thread
|
|
1226 "S" gnus-summary-show-all-threads
|
|
1227 "h" gnus-summary-hide-thread
|
|
1228 "H" gnus-summary-hide-all-threads
|
|
1229 "n" gnus-summary-next-thread
|
|
1230 "p" gnus-summary-prev-thread
|
|
1231 "u" gnus-summary-up-thread
|
|
1232 "o" gnus-summary-top-thread
|
|
1233 "d" gnus-summary-down-thread
|
|
1234 "#" gnus-uu-mark-thread
|
|
1235 "\M-#" gnus-uu-unmark-thread)
|
|
1236
|
|
1237 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
|
|
1238 "g" gnus-summary-prepare
|
|
1239 "c" gnus-summary-insert-cached-articles)
|
|
1240
|
|
1241 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
|
|
1242 "c" gnus-summary-catchup-and-exit
|
|
1243 "C" gnus-summary-catchup-all-and-exit
|
|
1244 "E" gnus-summary-exit-no-update
|
|
1245 "Q" gnus-summary-exit
|
|
1246 "Z" gnus-summary-exit
|
|
1247 "n" gnus-summary-catchup-and-goto-next-group
|
|
1248 "R" gnus-summary-reselect-current-group
|
|
1249 "G" gnus-summary-rescan-group
|
|
1250 "N" gnus-summary-next-group
|
|
1251 "s" gnus-summary-save-newsrc
|
|
1252 "P" gnus-summary-prev-group)
|
|
1253
|
|
1254 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
|
|
1255 " " gnus-summary-next-page
|
|
1256 "n" gnus-summary-next-page
|
|
1257 "\177" gnus-summary-prev-page
|
|
1258 [delete] gnus-summary-prev-page
|
|
1259 "p" gnus-summary-prev-page
|
|
1260 "\r" gnus-summary-scroll-up
|
|
1261 "<" gnus-summary-beginning-of-article
|
|
1262 ">" gnus-summary-end-of-article
|
|
1263 "b" gnus-summary-beginning-of-article
|
|
1264 "e" gnus-summary-end-of-article
|
|
1265 "^" gnus-summary-refer-parent-article
|
|
1266 "r" gnus-summary-refer-parent-article
|
|
1267 "R" gnus-summary-refer-references
|
|
1268 "g" gnus-summary-show-article
|
|
1269 "s" gnus-summary-isearch-article
|
|
1270 "P" gnus-summary-print-article)
|
|
1271
|
|
1272 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
|
|
1273 "b" gnus-article-add-buttons
|
|
1274 "B" gnus-article-add-buttons-to-head
|
|
1275 "o" gnus-article-treat-overstrike
|
|
1276 "e" gnus-article-emphasize
|
|
1277 "w" gnus-article-fill-cited-article
|
|
1278 "c" gnus-article-remove-cr
|
|
1279 "q" gnus-article-de-quoted-unreadable
|
|
1280 "f" gnus-article-display-x-face
|
|
1281 "l" gnus-summary-stop-page-breaking
|
|
1282 "r" gnus-summary-caesar-message
|
|
1283 "t" gnus-article-hide-headers
|
|
1284 "v" gnus-summary-verbose-headers
|
104
|
1285 "m" gnus-summary-toggle-mime
|
|
1286 "h" gnus-article-treat-html)
|
98
|
1287
|
|
1288 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
|
|
1289 "a" gnus-article-hide
|
|
1290 "h" gnus-article-hide-headers
|
|
1291 "b" gnus-article-hide-boring-headers
|
|
1292 "s" gnus-article-hide-signature
|
|
1293 "c" gnus-article-hide-citation
|
|
1294 "p" gnus-article-hide-pgp
|
|
1295 "P" gnus-article-hide-pem
|
|
1296 "\C-c" gnus-article-hide-citation-maybe)
|
|
1297
|
|
1298 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
|
|
1299 "a" gnus-article-highlight
|
|
1300 "h" gnus-article-highlight-headers
|
|
1301 "c" gnus-article-highlight-citation
|
|
1302 "s" gnus-article-highlight-signature)
|
|
1303
|
|
1304 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
|
|
1305 "z" gnus-article-date-ut
|
|
1306 "u" gnus-article-date-ut
|
|
1307 "l" gnus-article-date-local
|
|
1308 "e" gnus-article-date-lapsed
|
|
1309 "o" gnus-article-date-original
|
|
1310 "s" gnus-article-date-user)
|
|
1311
|
|
1312 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
|
|
1313 "t" gnus-article-remove-trailing-blank-lines
|
|
1314 "l" gnus-article-strip-leading-blank-lines
|
|
1315 "m" gnus-article-strip-multiple-blank-lines
|
|
1316 "a" gnus-article-strip-blank-lines)
|
|
1317
|
|
1318 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
|
|
1319 "v" gnus-version
|
|
1320 "f" gnus-summary-fetch-faq
|
|
1321 "d" gnus-summary-describe-group
|
|
1322 "h" gnus-summary-describe-briefly
|
|
1323 "i" gnus-info-find-node)
|
|
1324
|
|
1325 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
|
|
1326 "e" gnus-summary-expire-articles
|
|
1327 "\M-\C-e" gnus-summary-expire-articles-now
|
|
1328 "\177" gnus-summary-delete-article
|
|
1329 [delete] gnus-summary-delete-article
|
|
1330 "m" gnus-summary-move-article
|
|
1331 "r" gnus-summary-respool-article
|
|
1332 "w" gnus-summary-edit-article
|
|
1333 "c" gnus-summary-copy-article
|
|
1334 "B" gnus-summary-crosspost-article
|
|
1335 "q" gnus-summary-respool-query
|
|
1336 "i" gnus-summary-import-article
|
|
1337 "p" gnus-summary-article-posted-p)
|
|
1338
|
|
1339 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
|
|
1340 "o" gnus-summary-save-article
|
|
1341 "m" gnus-summary-save-article-mail
|
|
1342 "F" gnus-summary-write-article-file
|
|
1343 "r" gnus-summary-save-article-rmail
|
|
1344 "f" gnus-summary-save-article-file
|
|
1345 "b" gnus-summary-save-article-body-file
|
|
1346 "h" gnus-summary-save-article-folder
|
|
1347 "v" gnus-summary-save-article-vm
|
|
1348 "p" gnus-summary-pipe-output
|
|
1349 "s" gnus-soup-add-article))
|
|
1350
|
|
1351 (defun gnus-summary-make-menu-bar ()
|
|
1352 (gnus-turn-off-edit-menu 'summary)
|
|
1353
|
|
1354 (unless (boundp 'gnus-summary-misc-menu)
|
|
1355
|
|
1356 (easy-menu-define
|
|
1357 gnus-summary-kill-menu gnus-summary-mode-map ""
|
|
1358 (cons
|
|
1359 "Score"
|
|
1360 (nconc
|
|
1361 (list
|
|
1362 ["Enter score..." gnus-summary-score-entry t]
|
|
1363 ["Customize" gnus-score-customize t])
|
|
1364 (gnus-make-score-map 'increase)
|
|
1365 (gnus-make-score-map 'lower)
|
|
1366 '(("Mark"
|
|
1367 ["Kill below" gnus-summary-kill-below t]
|
|
1368 ["Mark above" gnus-summary-mark-above t]
|
|
1369 ["Tick above" gnus-summary-tick-above t]
|
|
1370 ["Clear above" gnus-summary-clear-above t])
|
|
1371 ["Current score" gnus-summary-current-score t]
|
|
1372 ["Set score" gnus-summary-set-score t]
|
|
1373 ["Switch current score file..." gnus-score-change-score-file t]
|
|
1374 ["Set mark below..." gnus-score-set-mark-below t]
|
|
1375 ["Set expunge below..." gnus-score-set-expunge-below t]
|
|
1376 ["Edit current score file" gnus-score-edit-current-scores t]
|
|
1377 ["Edit score file" gnus-score-edit-file t]
|
|
1378 ["Trace score" gnus-score-find-trace t]
|
|
1379 ["Find words" gnus-score-find-favourite-words t]
|
|
1380 ["Rescore buffer" gnus-summary-rescore t]
|
|
1381 ["Increase score..." gnus-summary-increase-score t]
|
|
1382 ["Lower score..." gnus-summary-lower-score t]))))
|
|
1383
|
|
1384 '(("Default header"
|
|
1385 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
|
|
1386 :style radio
|
|
1387 :selected (null gnus-score-default-header)]
|
|
1388 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
|
|
1389 :style radio
|
|
1390 :selected (eq gnus-score-default-header 'a)]
|
|
1391 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
|
|
1392 :style radio
|
|
1393 :selected (eq gnus-score-default-header 's)]
|
|
1394 ["Article body"
|
|
1395 (gnus-score-set-default 'gnus-score-default-header 'b)
|
|
1396 :style radio
|
|
1397 :selected (eq gnus-score-default-header 'b )]
|
|
1398 ["All headers"
|
|
1399 (gnus-score-set-default 'gnus-score-default-header 'h)
|
|
1400 :style radio
|
|
1401 :selected (eq gnus-score-default-header 'h )]
|
|
1402 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
|
|
1403 :style radio
|
|
1404 :selected (eq gnus-score-default-header 'i )]
|
|
1405 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
|
|
1406 :style radio
|
|
1407 :selected (eq gnus-score-default-header 't )]
|
|
1408 ["Crossposting"
|
|
1409 (gnus-score-set-default 'gnus-score-default-header 'x)
|
|
1410 :style radio
|
|
1411 :selected (eq gnus-score-default-header 'x )]
|
|
1412 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
|
|
1413 :style radio
|
|
1414 :selected (eq gnus-score-default-header 'l )]
|
|
1415 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
|
|
1416 :style radio
|
|
1417 :selected (eq gnus-score-default-header 'd )]
|
|
1418 ["Followups to author"
|
|
1419 (gnus-score-set-default 'gnus-score-default-header 'f)
|
|
1420 :style radio
|
|
1421 :selected (eq gnus-score-default-header 'f )])
|
|
1422 ("Default type"
|
|
1423 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
|
|
1424 :style radio
|
|
1425 :selected (null gnus-score-default-type)]
|
|
1426 ;; The `:active' key is commented out in the following,
|
|
1427 ;; because the GNU Emacs hack to support radio buttons use
|
|
1428 ;; active to indicate which button is selected.
|
|
1429 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
|
|
1430 :style radio
|
|
1431 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1432 :selected (eq gnus-score-default-type 's)]
|
|
1433 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
|
|
1434 :style radio
|
|
1435 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1436 :selected (eq gnus-score-default-type 'r)]
|
|
1437 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
|
|
1438 :style radio
|
|
1439 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1440 :selected (eq gnus-score-default-type 'e)]
|
|
1441 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
|
|
1442 :style radio
|
|
1443 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1444 :selected (eq gnus-score-default-type 'f)]
|
|
1445 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
|
|
1446 :style radio
|
|
1447 ;; :active (eq (gnus-score-default-header 'd))
|
|
1448 :selected (eq gnus-score-default-type 'b)]
|
|
1449 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
|
|
1450 :style radio
|
|
1451 ;; :active (eq (gnus-score-default-header 'd))
|
|
1452 :selected (eq gnus-score-default-type 'n)]
|
|
1453 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
|
|
1454 :style radio
|
|
1455 ;; :active (eq (gnus-score-default-header 'd))
|
|
1456 :selected (eq gnus-score-default-type 'a)]
|
|
1457 ["Less than number"
|
|
1458 (gnus-score-set-default 'gnus-score-default-type '<)
|
|
1459 :style radio
|
|
1460 ;; :active (eq (gnus-score-default-header 'l))
|
|
1461 :selected (eq gnus-score-default-type '<)]
|
|
1462 ["Equal to number"
|
|
1463 (gnus-score-set-default 'gnus-score-default-type '=)
|
|
1464 :style radio
|
|
1465 ;; :active (eq (gnus-score-default-header 'l))
|
|
1466 :selected (eq gnus-score-default-type '=)]
|
|
1467 ["Greater than number"
|
|
1468 (gnus-score-set-default 'gnus-score-default-type '>)
|
|
1469 :style radio
|
|
1470 ;; :active (eq (gnus-score-default-header 'l))
|
|
1471 :selected (eq gnus-score-default-type '>)])
|
|
1472 ["Default fold" gnus-score-default-fold-toggle
|
|
1473 :style toggle
|
|
1474 :selected gnus-score-default-fold]
|
|
1475 ("Default duration"
|
|
1476 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
|
|
1477 :style radio
|
|
1478 :selected (null gnus-score-default-duration)]
|
|
1479 ["Permanent"
|
|
1480 (gnus-score-set-default 'gnus-score-default-duration 'p)
|
|
1481 :style radio
|
|
1482 :selected (eq gnus-score-default-duration 'p)]
|
|
1483 ["Temporary"
|
|
1484 (gnus-score-set-default 'gnus-score-default-duration 't)
|
|
1485 :style radio
|
|
1486 :selected (eq gnus-score-default-duration 't)]
|
|
1487 ["Immediate"
|
|
1488 (gnus-score-set-default 'gnus-score-default-duration 'i)
|
|
1489 :style radio
|
|
1490 :selected (eq gnus-score-default-duration 'i)]))
|
|
1491
|
|
1492 (easy-menu-define
|
|
1493 gnus-summary-article-menu gnus-summary-mode-map ""
|
|
1494 '("Article"
|
|
1495 ("Hide"
|
|
1496 ["All" gnus-article-hide t]
|
|
1497 ["Headers" gnus-article-hide-headers t]
|
|
1498 ["Signature" gnus-article-hide-signature t]
|
|
1499 ["Citation" gnus-article-hide-citation t]
|
|
1500 ["PGP" gnus-article-hide-pgp t]
|
|
1501 ["Boring headers" gnus-article-hide-boring-headers t])
|
|
1502 ("Highlight"
|
|
1503 ["All" gnus-article-highlight t]
|
|
1504 ["Headers" gnus-article-highlight-headers t]
|
|
1505 ["Signature" gnus-article-highlight-signature t]
|
|
1506 ["Citation" gnus-article-highlight-citation t])
|
|
1507 ("Date"
|
|
1508 ["Local" gnus-article-date-local t]
|
|
1509 ["UT" gnus-article-date-ut t]
|
|
1510 ["Original" gnus-article-date-original t]
|
|
1511 ["Lapsed" gnus-article-date-lapsed t]
|
|
1512 ["User-defined" gnus-article-date-user t])
|
|
1513 ("Washing"
|
|
1514 ("Remove Blanks"
|
|
1515 ["Leading" gnus-article-strip-leading-blank-lines t]
|
|
1516 ["Multiple" gnus-article-strip-multiple-blank-lines t]
|
|
1517 ["Trailing" gnus-article-remove-trailing-blank-lines t]
|
|
1518 ["All of the above" gnus-article-strip-blank-lines t])
|
|
1519 ["Overstrike" gnus-article-treat-overstrike t]
|
|
1520 ["Emphasis" gnus-article-emphasize t]
|
|
1521 ["Word wrap" gnus-article-fill-cited-article t]
|
|
1522 ["CR" gnus-article-remove-cr t]
|
|
1523 ["Show X-Face" gnus-article-display-x-face t]
|
|
1524 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
|
|
1525 ["Rot 13" gnus-summary-caesar-message t]
|
|
1526 ["Unix pipe" gnus-summary-pipe-message t]
|
|
1527 ["Add buttons" gnus-article-add-buttons t]
|
|
1528 ["Add buttons to head" gnus-article-add-buttons-to-head t]
|
|
1529 ["Stop page breaking" gnus-summary-stop-page-breaking t]
|
|
1530 ["Toggle MIME" gnus-summary-toggle-mime t]
|
|
1531 ["Verbose header" gnus-summary-verbose-headers t]
|
|
1532 ["Toggle header" gnus-summary-toggle-header t])
|
|
1533 ("Output"
|
|
1534 ["Save in default format" gnus-summary-save-article t]
|
|
1535 ["Save in file" gnus-summary-save-article-file t]
|
|
1536 ["Save in Unix mail format" gnus-summary-save-article-mail t]
|
|
1537 ["Write to file" gnus-summary-write-article-mail t]
|
|
1538 ["Save in MH folder" gnus-summary-save-article-folder t]
|
|
1539 ["Save in VM folder" gnus-summary-save-article-vm t]
|
|
1540 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
|
|
1541 ["Save body in file" gnus-summary-save-article-body-file t]
|
|
1542 ["Pipe through a filter" gnus-summary-pipe-output t]
|
|
1543 ["Add to SOUP packet" gnus-soup-add-article t]
|
|
1544 ["Print" gnus-summary-print-article t])
|
|
1545 ("Backend"
|
|
1546 ["Respool article..." gnus-summary-respool-article t]
|
|
1547 ["Move article..." gnus-summary-move-article
|
|
1548 (gnus-check-backend-function
|
|
1549 'request-move-article gnus-newsgroup-name)]
|
|
1550 ["Copy article..." gnus-summary-copy-article t]
|
|
1551 ["Crosspost article..." gnus-summary-crosspost-article
|
|
1552 (gnus-check-backend-function
|
|
1553 'request-replace-article gnus-newsgroup-name)]
|
|
1554 ["Import file..." gnus-summary-import-article t]
|
|
1555 ["Check if posted" gnus-summary-article-posted-p t]
|
|
1556 ["Edit article" gnus-summary-edit-article
|
|
1557 (not (gnus-group-read-only-p))]
|
|
1558 ["Delete article" gnus-summary-delete-article
|
|
1559 (gnus-check-backend-function
|
|
1560 'request-expire-articles gnus-newsgroup-name)]
|
|
1561 ["Query respool" gnus-summary-respool-query t]
|
|
1562 ["Delete expirable articles" gnus-summary-expire-articles-now
|
|
1563 (gnus-check-backend-function
|
|
1564 'request-expire-articles gnus-newsgroup-name)])
|
|
1565 ("Extract"
|
|
1566 ["Uudecode" gnus-uu-decode-uu t]
|
|
1567 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
|
|
1568 ["Unshar" gnus-uu-decode-unshar t]
|
|
1569 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
|
|
1570 ["Save" gnus-uu-decode-save t]
|
|
1571 ["Binhex" gnus-uu-decode-binhex t]
|
|
1572 ["Postscript" gnus-uu-decode-postscript t])
|
|
1573 ("Cache"
|
|
1574 ["Enter article" gnus-cache-enter-article t]
|
|
1575 ["Remove article" gnus-cache-remove-article t])
|
|
1576 ["Enter digest buffer" gnus-summary-enter-digest-group t]
|
|
1577 ["Isearch article..." gnus-summary-isearch-article t]
|
|
1578 ["Beginning of the article" gnus-summary-beginning-of-article t]
|
|
1579 ["End of the article" gnus-summary-end-of-article t]
|
|
1580 ["Fetch parent of article" gnus-summary-refer-parent-article t]
|
|
1581 ["Fetch referenced articles" gnus-summary-refer-references t]
|
|
1582 ["Fetch article with id..." gnus-summary-refer-article t]
|
|
1583 ["Redisplay" gnus-summary-show-article t]))
|
|
1584
|
|
1585 (easy-menu-define
|
|
1586 gnus-summary-thread-menu gnus-summary-mode-map ""
|
|
1587 '("Threads"
|
|
1588 ["Toggle threading" gnus-summary-toggle-threads t]
|
|
1589 ["Hide threads" gnus-summary-hide-all-threads t]
|
|
1590 ["Show threads" gnus-summary-show-all-threads t]
|
|
1591 ["Hide thread" gnus-summary-hide-thread t]
|
|
1592 ["Show thread" gnus-summary-show-thread t]
|
|
1593 ["Go to next thread" gnus-summary-next-thread t]
|
|
1594 ["Go to previous thread" gnus-summary-prev-thread t]
|
|
1595 ["Go down thread" gnus-summary-down-thread t]
|
|
1596 ["Go up thread" gnus-summary-up-thread t]
|
|
1597 ["Top of thread" gnus-summary-top-thread t]
|
|
1598 ["Mark thread as read" gnus-summary-kill-thread t]
|
|
1599 ["Lower thread score" gnus-summary-lower-thread t]
|
|
1600 ["Raise thread score" gnus-summary-raise-thread t]
|
|
1601 ["Rethread current" gnus-summary-rethread-current t]
|
|
1602 ))
|
|
1603
|
|
1604 (easy-menu-define
|
|
1605 gnus-summary-post-menu gnus-summary-mode-map ""
|
|
1606 '("Post"
|
|
1607 ["Post an article" gnus-summary-post-news t]
|
|
1608 ["Followup" gnus-summary-followup t]
|
|
1609 ["Followup and yank" gnus-summary-followup-with-original t]
|
|
1610 ["Supersede article" gnus-summary-supersede-article t]
|
|
1611 ["Cancel article" gnus-summary-cancel-article t]
|
|
1612 ["Reply" gnus-summary-reply t]
|
|
1613 ["Reply and yank" gnus-summary-reply-with-original t]
|
|
1614 ["Wide reply" gnus-summary-wide-reply t]
|
|
1615 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
|
|
1616 ["Mail forward" gnus-summary-mail-forward t]
|
|
1617 ["Post forward" gnus-summary-post-forward t]
|
|
1618 ["Digest and mail" gnus-uu-digest-mail-forward t]
|
|
1619 ["Digest and post" gnus-uu-digest-post-forward t]
|
|
1620 ["Resend message" gnus-summary-resend-message t]
|
|
1621 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
|
|
1622 ["Send a mail" gnus-summary-mail-other-window t]
|
|
1623 ["Uuencode and post" gnus-uu-post-news t]
|
|
1624 ["Followup via news" gnus-summary-followup-to-mail t]
|
|
1625 ["Followup via news and yank"
|
|
1626 gnus-summary-followup-to-mail-with-original t]
|
|
1627 ;;("Draft"
|
|
1628 ;;["Send" gnus-summary-send-draft t]
|
|
1629 ;;["Send bounced" gnus-resend-bounced-mail t])
|
|
1630 ))
|
|
1631
|
|
1632 (easy-menu-define
|
|
1633 gnus-summary-misc-menu gnus-summary-mode-map ""
|
|
1634 '("Misc"
|
|
1635 ("Mark Read"
|
|
1636 ["Mark as read" gnus-summary-mark-as-read-forward t]
|
|
1637 ["Mark same subject and select"
|
|
1638 gnus-summary-kill-same-subject-and-select t]
|
|
1639 ["Mark same subject" gnus-summary-kill-same-subject t]
|
|
1640 ["Catchup" gnus-summary-catchup t]
|
|
1641 ["Catchup all" gnus-summary-catchup-all t]
|
|
1642 ["Catchup to here" gnus-summary-catchup-to-here t]
|
|
1643 ["Catchup region" gnus-summary-mark-region-as-read t]
|
|
1644 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
|
|
1645 ("Mark Various"
|
|
1646 ["Tick" gnus-summary-tick-article-forward t]
|
|
1647 ["Mark as dormant" gnus-summary-mark-as-dormant t]
|
|
1648 ["Remove marks" gnus-summary-clear-mark-forward t]
|
|
1649 ["Set expirable mark" gnus-summary-mark-as-expirable t]
|
|
1650 ["Set bookmark" gnus-summary-set-bookmark t]
|
|
1651 ["Remove bookmark" gnus-summary-remove-bookmark t])
|
|
1652 ("Mark Limit"
|
|
1653 ["Marks..." gnus-summary-limit-to-marks t]
|
|
1654 ["Subject..." gnus-summary-limit-to-subject t]
|
|
1655 ["Author..." gnus-summary-limit-to-author t]
|
|
1656 ["Age..." gnus-summary-limit-to-age t]
|
|
1657 ["Score" gnus-summary-limit-to-score t]
|
|
1658 ["Unread" gnus-summary-limit-to-unread t]
|
|
1659 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
|
|
1660 ["Articles" gnus-summary-limit-to-articles t]
|
|
1661 ["Pop limit" gnus-summary-pop-limit t]
|
|
1662 ["Show dormant" gnus-summary-limit-include-dormant t]
|
|
1663 ["Hide childless dormant"
|
|
1664 gnus-summary-limit-exclude-childless-dormant t]
|
|
1665 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
|
|
1666 ["Show expunged" gnus-summary-show-all-expunged t])
|
|
1667 ("Process Mark"
|
|
1668 ["Set mark" gnus-summary-mark-as-processable t]
|
|
1669 ["Remove mark" gnus-summary-unmark-as-processable t]
|
|
1670 ["Remove all marks" gnus-summary-unmark-all-processable t]
|
|
1671 ["Mark above" gnus-uu-mark-over t]
|
|
1672 ["Mark series" gnus-uu-mark-series t]
|
|
1673 ["Mark region" gnus-uu-mark-region t]
|
|
1674 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
|
|
1675 ["Mark all" gnus-uu-mark-all t]
|
|
1676 ["Mark buffer" gnus-uu-mark-buffer t]
|
|
1677 ["Mark sparse" gnus-uu-mark-sparse t]
|
|
1678 ["Mark thread" gnus-uu-mark-thread t]
|
|
1679 ["Unmark thread" gnus-uu-unmark-thread t]
|
|
1680 ("Process Mark Sets"
|
|
1681 ["Kill" gnus-summary-kill-process-mark t]
|
|
1682 ["Yank" gnus-summary-yank-process-mark
|
|
1683 gnus-newsgroup-process-stack]
|
|
1684 ["Save" gnus-summary-save-process-mark t]))
|
|
1685 ("Scroll article"
|
|
1686 ["Page forward" gnus-summary-next-page t]
|
|
1687 ["Page backward" gnus-summary-prev-page t]
|
|
1688 ["Line forward" gnus-summary-scroll-up t])
|
|
1689 ("Move"
|
|
1690 ["Next unread article" gnus-summary-next-unread-article t]
|
|
1691 ["Previous unread article" gnus-summary-prev-unread-article t]
|
|
1692 ["Next article" gnus-summary-next-article t]
|
|
1693 ["Previous article" gnus-summary-prev-article t]
|
|
1694 ["Next unread subject" gnus-summary-next-unread-subject t]
|
|
1695 ["Previous unread subject" gnus-summary-prev-unread-subject t]
|
|
1696 ["Next article same subject" gnus-summary-next-same-subject t]
|
|
1697 ["Previous article same subject" gnus-summary-prev-same-subject t]
|
|
1698 ["First unread article" gnus-summary-first-unread-article t]
|
|
1699 ["Best unread article" gnus-summary-best-unread-article t]
|
|
1700 ["Go to subject number..." gnus-summary-goto-subject t]
|
|
1701 ["Go to article number..." gnus-summary-goto-article t]
|
|
1702 ["Go to the last article" gnus-summary-goto-last-article t]
|
|
1703 ["Pop article off history" gnus-summary-pop-article t])
|
|
1704 ("Sort"
|
|
1705 ["Sort by number" gnus-summary-sort-by-number t]
|
|
1706 ["Sort by author" gnus-summary-sort-by-author t]
|
|
1707 ["Sort by subject" gnus-summary-sort-by-subject t]
|
|
1708 ["Sort by date" gnus-summary-sort-by-date t]
|
|
1709 ["Sort by score" gnus-summary-sort-by-score t]
|
|
1710 ["Sort by lines" gnus-summary-sort-by-lines t])
|
|
1711 ("Help"
|
|
1712 ["Fetch group FAQ" gnus-summary-fetch-faq t]
|
|
1713 ["Describe group" gnus-summary-describe-group t]
|
|
1714 ["Read manual" gnus-info-find-node t])
|
|
1715 ("Modes"
|
|
1716 ["Pick and read" gnus-pick-mode t]
|
|
1717 ["Binary" gnus-binary-mode t])
|
|
1718 ("Regeneration"
|
|
1719 ["Regenerate" gnus-summary-prepare t]
|
|
1720 ["Insert cached articles" gnus-summary-insert-cached-articles t]
|
|
1721 ["Toggle threading" gnus-summary-toggle-threads t])
|
|
1722 ["Filter articles..." gnus-summary-execute-command t]
|
|
1723 ["Run command on subjects..." gnus-summary-universal-argument t]
|
|
1724 ["Search articles forward..." gnus-summary-search-article-forward t]
|
|
1725 ["Search articles backward..." gnus-summary-search-article-backward t]
|
|
1726 ["Toggle line truncation" gnus-summary-toggle-truncation t]
|
|
1727 ["Expand window" gnus-summary-expand-window t]
|
|
1728 ["Expire expirable articles" gnus-summary-expire-articles
|
|
1729 (gnus-check-backend-function
|
|
1730 'request-expire-articles gnus-newsgroup-name)]
|
|
1731 ["Edit local kill file" gnus-summary-edit-local-kill t]
|
|
1732 ["Edit main kill file" gnus-summary-edit-global-kill t]
|
|
1733 ("Exit"
|
|
1734 ["Catchup and exit" gnus-summary-catchup-and-exit t]
|
|
1735 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
|
|
1736 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
|
|
1737 ["Exit group" gnus-summary-exit t]
|
|
1738 ["Exit group without updating" gnus-summary-exit-no-update t]
|
|
1739 ["Exit and goto next group" gnus-summary-next-group t]
|
|
1740 ["Exit and goto prev group" gnus-summary-prev-group t]
|
|
1741 ["Reselect group" gnus-summary-reselect-current-group t]
|
|
1742 ["Rescan group" gnus-summary-rescan-group t]
|
|
1743 ["Update dribble" gnus-summary-save-newsrc t])))
|
|
1744
|
|
1745 (run-hooks 'gnus-summary-menu-hook)))
|
|
1746
|
|
1747 (defun gnus-score-set-default (var value)
|
|
1748 "A version of set that updates the GNU Emacs menu-bar."
|
|
1749 (set var value)
|
|
1750 ;; It is the message that forces the active status to be updated.
|
|
1751 (message ""))
|
|
1752
|
|
1753 (defun gnus-make-score-map (type)
|
|
1754 "Make a summary score map of type TYPE."
|
|
1755 (if t
|
|
1756 nil
|
|
1757 (let ((headers '(("author" "from" string)
|
|
1758 ("subject" "subject" string)
|
|
1759 ("article body" "body" string)
|
|
1760 ("article head" "head" string)
|
|
1761 ("xref" "xref" string)
|
|
1762 ("lines" "lines" number)
|
|
1763 ("followups to author" "followup" string)))
|
|
1764 (types '((number ("less than" <)
|
|
1765 ("greater than" >)
|
|
1766 ("equal" =))
|
|
1767 (string ("substring" s)
|
|
1768 ("exact string" e)
|
|
1769 ("fuzzy string" f)
|
|
1770 ("regexp" r))))
|
|
1771 (perms '(("temporary" (current-time-string))
|
|
1772 ("permanent" nil)
|
|
1773 ("immediate" now)))
|
|
1774 header)
|
|
1775 (list
|
|
1776 (apply
|
|
1777 'nconc
|
|
1778 (list
|
|
1779 (if (eq type 'lower)
|
|
1780 "Lower score"
|
|
1781 "Increase score"))
|
|
1782 (let (outh)
|
|
1783 (while headers
|
|
1784 (setq header (car headers))
|
|
1785 (setq outh
|
|
1786 (cons
|
|
1787 (apply
|
|
1788 'nconc
|
|
1789 (list (car header))
|
|
1790 (let ((ts (cdr (assoc (nth 2 header) types)))
|
|
1791 outt)
|
|
1792 (while ts
|
|
1793 (setq outt
|
|
1794 (cons
|
|
1795 (apply
|
|
1796 'nconc
|
|
1797 (list (caar ts))
|
|
1798 (let ((ps perms)
|
|
1799 outp)
|
|
1800 (while ps
|
|
1801 (setq outp
|
|
1802 (cons
|
|
1803 (vector
|
|
1804 (caar ps)
|
|
1805 (list
|
|
1806 'gnus-summary-score-entry
|
|
1807 (nth 1 header)
|
|
1808 (if (or (string= (nth 1 header)
|
|
1809 "head")
|
|
1810 (string= (nth 1 header)
|
|
1811 "body"))
|
|
1812 ""
|
|
1813 (list 'gnus-summary-header
|
|
1814 (nth 1 header)))
|
|
1815 (list 'quote (nth 1 (car ts)))
|
|
1816 (list 'gnus-score-default nil)
|
|
1817 (nth 1 (car ps))
|
|
1818 t)
|
|
1819 t)
|
|
1820 outp))
|
|
1821 (setq ps (cdr ps)))
|
|
1822 (list (nreverse outp))))
|
|
1823 outt))
|
|
1824 (setq ts (cdr ts)))
|
|
1825 (list (nreverse outt))))
|
|
1826 outh))
|
|
1827 (setq headers (cdr headers)))
|
|
1828 (list (nreverse outh))))))))
|
|
1829
|
|
1830
|
|
1831
|
|
1832 (defun gnus-summary-mode (&optional group)
|
|
1833 "Major mode for reading articles.
|
|
1834
|
|
1835 All normal editing commands are switched off.
|
|
1836 \\<gnus-summary-mode-map>
|
|
1837 Each line in this buffer represents one article. To read an
|
|
1838 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
|
|
1839 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
|
|
1840 respectively.
|
|
1841
|
|
1842 You can also post articles and send mail from this buffer. To
|
|
1843 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
|
|
1844 of an article, type `\\[gnus-summary-reply]'.
|
|
1845
|
|
1846 There are approx. one gazillion commands you can execute in this
|
|
1847 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
|
|
1848
|
|
1849 The following commands are available:
|
|
1850
|
|
1851 \\{gnus-summary-mode-map}"
|
|
1852 (interactive)
|
|
1853 (when (gnus-visual-p 'summary-menu 'menu)
|
|
1854 (gnus-summary-make-menu-bar))
|
|
1855 (kill-all-local-variables)
|
|
1856 (gnus-summary-make-local-variables)
|
|
1857 (gnus-make-thread-indent-array)
|
|
1858 (gnus-simplify-mode-line)
|
|
1859 (setq major-mode 'gnus-summary-mode)
|
|
1860 (setq mode-name "Summary")
|
|
1861 (make-local-variable 'minor-mode-alist)
|
|
1862 (use-local-map gnus-summary-mode-map)
|
|
1863 (buffer-disable-undo (current-buffer))
|
|
1864 (setq buffer-read-only t) ;Disable modification
|
|
1865 (setq truncate-lines t)
|
|
1866 (setq selective-display t)
|
|
1867 (setq selective-display-ellipses t) ;Display `...'
|
|
1868 (setq buffer-display-table gnus-summary-display-table)
|
|
1869 (gnus-set-default-directory)
|
|
1870 (setq gnus-newsgroup-name group)
|
|
1871 (make-local-variable 'gnus-summary-line-format)
|
|
1872 (make-local-variable 'gnus-summary-line-format-spec)
|
|
1873 (make-local-variable 'gnus-summary-mark-positions)
|
|
1874 (make-local-hook 'post-command-hook)
|
|
1875 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
|
|
1876 (run-hooks 'gnus-summary-mode-hook)
|
|
1877 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
|
|
1878 (gnus-update-summary-mark-positions))
|
|
1879
|
|
1880 (defun gnus-summary-make-local-variables ()
|
|
1881 "Make all the local summary buffer variables."
|
|
1882 (let ((locals gnus-summary-local-variables)
|
|
1883 global local)
|
|
1884 (while (setq local (pop locals))
|
|
1885 (if (consp local)
|
|
1886 (progn
|
|
1887 (if (eq (cdr local) 'global)
|
|
1888 ;; Copy the global value of the variable.
|
|
1889 (setq global (symbol-value (car local)))
|
|
1890 ;; Use the value from the list.
|
|
1891 (setq global (eval (cdr local))))
|
|
1892 (make-local-variable (car local))
|
|
1893 (set (car local) global))
|
|
1894 ;; Simple nil-valued local variable.
|
|
1895 (make-local-variable local)
|
|
1896 (set local nil)))))
|
|
1897
|
|
1898 (defun gnus-summary-clear-local-variables ()
|
|
1899 (let ((locals gnus-summary-local-variables))
|
|
1900 (while locals
|
|
1901 (if (consp (car locals))
|
|
1902 (and (vectorp (caar locals))
|
|
1903 (set (caar locals) nil))
|
|
1904 (and (vectorp (car locals))
|
|
1905 (set (car locals) nil)))
|
|
1906 (setq locals (cdr locals)))))
|
|
1907
|
|
1908 ;; Summary data functions.
|
|
1909
|
|
1910 (defmacro gnus-data-number (data)
|
|
1911 `(car ,data))
|
|
1912
|
|
1913 (defmacro gnus-data-set-number (data number)
|
|
1914 `(setcar ,data ,number))
|
|
1915
|
|
1916 (defmacro gnus-data-mark (data)
|
|
1917 `(nth 1 ,data))
|
|
1918
|
|
1919 (defmacro gnus-data-set-mark (data mark)
|
|
1920 `(setcar (nthcdr 1 ,data) ,mark))
|
|
1921
|
|
1922 (defmacro gnus-data-pos (data)
|
|
1923 `(nth 2 ,data))
|
|
1924
|
|
1925 (defmacro gnus-data-set-pos (data pos)
|
|
1926 `(setcar (nthcdr 2 ,data) ,pos))
|
|
1927
|
|
1928 (defmacro gnus-data-header (data)
|
|
1929 `(nth 3 ,data))
|
|
1930
|
|
1931 (defmacro gnus-data-set-header (data header)
|
|
1932 `(setf (nth 3 ,data) ,header))
|
|
1933
|
|
1934 (defmacro gnus-data-level (data)
|
|
1935 `(nth 4 ,data))
|
|
1936
|
|
1937 (defmacro gnus-data-unread-p (data)
|
|
1938 `(= (nth 1 ,data) gnus-unread-mark))
|
|
1939
|
|
1940 (defmacro gnus-data-read-p (data)
|
|
1941 `(/= (nth 1 ,data) gnus-unread-mark))
|
|
1942
|
|
1943 (defmacro gnus-data-pseudo-p (data)
|
|
1944 `(consp (nth 3 ,data)))
|
|
1945
|
|
1946 (defmacro gnus-data-find (number)
|
|
1947 `(assq ,number gnus-newsgroup-data))
|
|
1948
|
|
1949 (defmacro gnus-data-find-list (number &optional data)
|
|
1950 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
|
|
1951 (memq (assq ,number bdata)
|
|
1952 bdata)))
|
|
1953
|
|
1954 (defmacro gnus-data-make (number mark pos header level)
|
|
1955 `(list ,number ,mark ,pos ,header ,level))
|
|
1956
|
|
1957 (defun gnus-data-enter (after-article number mark pos header level offset)
|
|
1958 (let ((data (gnus-data-find-list after-article)))
|
|
1959 (unless data
|
|
1960 (error "No such article: %d" after-article))
|
|
1961 (setcdr data (cons (gnus-data-make number mark pos header level)
|
|
1962 (cdr data)))
|
|
1963 (setq gnus-newsgroup-data-reverse nil)
|
|
1964 (gnus-data-update-list (cddr data) offset)))
|
|
1965
|
|
1966 (defun gnus-data-enter-list (after-article list &optional offset)
|
|
1967 (when list
|
|
1968 (let ((data (and after-article (gnus-data-find-list after-article)))
|
|
1969 (ilist list))
|
|
1970 (or data (not after-article) (error "No such article: %d" after-article))
|
|
1971 ;; Find the last element in the list to be spliced into the main
|
|
1972 ;; list.
|
|
1973 (while (cdr list)
|
|
1974 (setq list (cdr list)))
|
|
1975 (if (not data)
|
|
1976 (progn
|
|
1977 (setcdr list gnus-newsgroup-data)
|
|
1978 (setq gnus-newsgroup-data ilist)
|
|
1979 (when offset
|
|
1980 (gnus-data-update-list (cdr list) offset)))
|
|
1981 (setcdr list (cdr data))
|
|
1982 (setcdr data ilist)
|
|
1983 (when offset
|
|
1984 (gnus-data-update-list (cdr list) offset)))
|
|
1985 (setq gnus-newsgroup-data-reverse nil))))
|
|
1986
|
|
1987 (defun gnus-data-remove (article &optional offset)
|
|
1988 (let ((data gnus-newsgroup-data))
|
|
1989 (if (= (gnus-data-number (car data)) article)
|
|
1990 (progn
|
|
1991 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
|
|
1992 gnus-newsgroup-data-reverse nil)
|
|
1993 (when offset
|
|
1994 (gnus-data-update-list gnus-newsgroup-data offset)))
|
|
1995 (while (cdr data)
|
|
1996 (when (= (gnus-data-number (cadr data)) article)
|
|
1997 (setcdr data (cddr data))
|
|
1998 (when offset
|
|
1999 (gnus-data-update-list (cdr data) offset))
|
|
2000 (setq data nil
|
|
2001 gnus-newsgroup-data-reverse nil))
|
|
2002 (setq data (cdr data))))))
|
|
2003
|
|
2004 (defmacro gnus-data-list (backward)
|
|
2005 `(if ,backward
|
|
2006 (or gnus-newsgroup-data-reverse
|
|
2007 (setq gnus-newsgroup-data-reverse
|
|
2008 (reverse gnus-newsgroup-data)))
|
|
2009 gnus-newsgroup-data))
|
|
2010
|
|
2011 (defun gnus-data-update-list (data offset)
|
|
2012 "Add OFFSET to the POS of all data entries in DATA."
|
|
2013 (while data
|
|
2014 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
|
|
2015 (setq data (cdr data))))
|
|
2016
|
|
2017 (defun gnus-data-compute-positions ()
|
|
2018 "Compute the positions of all articles."
|
|
2019 (let ((data gnus-newsgroup-data)
|
|
2020 pos)
|
|
2021 (while data
|
|
2022 (when (setq pos (text-property-any
|
|
2023 (point-min) (point-max)
|
|
2024 'gnus-number (gnus-data-number (car data))))
|
|
2025 (gnus-data-set-pos (car data) (+ pos 3)))
|
|
2026 (setq data (cdr data)))))
|
|
2027
|
|
2028 (defun gnus-summary-article-pseudo-p (article)
|
|
2029 "Say whether this article is a pseudo article or not."
|
|
2030 (not (vectorp (gnus-data-header (gnus-data-find article)))))
|
|
2031
|
|
2032 (defmacro gnus-summary-article-sparse-p (article)
|
|
2033 "Say whether this article is a sparse article or not."
|
|
2034 ` (memq ,article gnus-newsgroup-sparse))
|
|
2035
|
|
2036 (defmacro gnus-summary-article-ancient-p (article)
|
|
2037 "Say whether this article is a sparse article or not."
|
|
2038 `(memq ,article gnus-newsgroup-ancient))
|
|
2039
|
|
2040 (defun gnus-article-parent-p (number)
|
|
2041 "Say whether this article is a parent or not."
|
|
2042 (let ((data (gnus-data-find-list number)))
|
|
2043 (and (cdr data) ; There has to be an article after...
|
|
2044 (< (gnus-data-level (car data)) ; And it has to have a higher level.
|
|
2045 (gnus-data-level (nth 1 data))))))
|
|
2046
|
|
2047 (defun gnus-article-children (number)
|
|
2048 "Return a list of all children to NUMBER."
|
|
2049 (let* ((data (gnus-data-find-list number))
|
|
2050 (level (gnus-data-level (car data)))
|
|
2051 children)
|
|
2052 (setq data (cdr data))
|
|
2053 (while (and data
|
|
2054 (= (gnus-data-level (car data)) (1+ level)))
|
|
2055 (push (gnus-data-number (car data)) children)
|
|
2056 (setq data (cdr data)))
|
|
2057 children))
|
|
2058
|
|
2059 (defmacro gnus-summary-skip-intangible ()
|
|
2060 "If the current article is intangible, then jump to a different article."
|
|
2061 '(let ((to (get-text-property (point) 'gnus-intangible)))
|
|
2062 (and to (gnus-summary-goto-subject to))))
|
|
2063
|
|
2064 (defmacro gnus-summary-article-intangible-p ()
|
|
2065 "Say whether this article is intangible or not."
|
|
2066 '(get-text-property (point) 'gnus-intangible))
|
|
2067
|
|
2068 (defun gnus-article-read-p (article)
|
|
2069 "Say whether ARTICLE is read or not."
|
|
2070 (not (or (memq article gnus-newsgroup-marked)
|
|
2071 (memq article gnus-newsgroup-unreads)
|
|
2072 (memq article gnus-newsgroup-unselected)
|
|
2073 (memq article gnus-newsgroup-dormant))))
|
|
2074
|
|
2075 ;; Some summary mode macros.
|
|
2076
|
106
|
2077 (defmacro gnus-summary-article-number ()
|
98
|
2078 "The article number of the article on the current line.
|
|
2079 If there isn's an article number here, then we return the current
|
|
2080 article number."
|
|
2081 '(progn
|
|
2082 (gnus-summary-skip-intangible)
|
|
2083 (or (get-text-property (point) 'gnus-number)
|
|
2084 (gnus-summary-last-subject))))
|
|
2085
|
|
2086 (defmacro gnus-summary-article-header (&optional number)
|
|
2087 `(gnus-data-header (gnus-data-find
|
|
2088 ,(or number '(gnus-summary-article-number)))))
|
|
2089
|
|
2090 (defmacro gnus-summary-thread-level (&optional number)
|
|
2091 `(if (and (eq gnus-summary-make-false-root 'dummy)
|
|
2092 (get-text-property (point) 'gnus-intangible))
|
|
2093 0
|
|
2094 (gnus-data-level (gnus-data-find
|
|
2095 ,(or number '(gnus-summary-article-number))))))
|
|
2096
|
|
2097 (defmacro gnus-summary-article-mark (&optional number)
|
|
2098 `(gnus-data-mark (gnus-data-find
|
|
2099 ,(or number '(gnus-summary-article-number)))))
|
|
2100
|
|
2101 (defmacro gnus-summary-article-pos (&optional number)
|
|
2102 `(gnus-data-pos (gnus-data-find
|
|
2103 ,(or number '(gnus-summary-article-number)))))
|
|
2104
|
|
2105 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
|
|
2106 (defmacro gnus-summary-article-subject (&optional number)
|
|
2107 "Return current subject string or nil if nothing."
|
|
2108 `(let ((headers
|
|
2109 ,(if number
|
|
2110 `(gnus-data-header (assq ,number gnus-newsgroup-data))
|
|
2111 '(gnus-data-header (assq (gnus-summary-article-number)
|
|
2112 gnus-newsgroup-data)))))
|
|
2113 (and headers
|
|
2114 (vectorp headers)
|
|
2115 (mail-header-subject headers))))
|
|
2116
|
|
2117 (defmacro gnus-summary-article-score (&optional number)
|
|
2118 "Return current article score."
|
|
2119 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
|
|
2120 gnus-newsgroup-scored))
|
|
2121 gnus-summary-default-score 0))
|
|
2122
|
|
2123 (defun gnus-summary-article-children (&optional number)
|
|
2124 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
|
|
2125 (level (gnus-data-level (car data)))
|
|
2126 l children)
|
|
2127 (while (and (setq data (cdr data))
|
|
2128 (> (setq l (gnus-data-level (car data))) level))
|
|
2129 (and (= (1+ level) l)
|
|
2130 (push (gnus-data-number (car data))
|
|
2131 children)))
|
|
2132 (nreverse children)))
|
|
2133
|
|
2134 (defun gnus-summary-article-parent (&optional number)
|
|
2135 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
|
|
2136 (gnus-data-list t)))
|
|
2137 (level (gnus-data-level (car data))))
|
|
2138 (if (zerop level)
|
|
2139 () ; This is a root.
|
|
2140 ;; We search until we find an article with a level less than
|
|
2141 ;; this one. That function has to be the parent.
|
|
2142 (while (and (setq data (cdr data))
|
|
2143 (not (< (gnus-data-level (car data)) level))))
|
|
2144 (and data (gnus-data-number (car data))))))
|
|
2145
|
|
2146 (defun gnus-unread-mark-p (mark)
|
|
2147 "Say whether MARK is the unread mark."
|
|
2148 (= mark gnus-unread-mark))
|
|
2149
|
|
2150 (defun gnus-read-mark-p (mark)
|
|
2151 "Say whether MARK is one of the marks that mark as read.
|
|
2152 This is all marks except unread, ticked, dormant, and expirable."
|
|
2153 (not (or (= mark gnus-unread-mark)
|
|
2154 (= mark gnus-ticked-mark)
|
|
2155 (= mark gnus-dormant-mark)
|
|
2156 (= mark gnus-expirable-mark))))
|
|
2157
|
|
2158 (defmacro gnus-article-mark (number)
|
|
2159 `(cond
|
|
2160 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
|
|
2161 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
|
|
2162 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
|
|
2163 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
|
|
2164 (t (or (cdr (assq ,number gnus-newsgroup-reads))
|
|
2165 gnus-ancient-mark))))
|
|
2166
|
|
2167 ;; Saving hidden threads.
|
|
2168
|
|
2169 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
|
|
2170 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
|
|
2171
|
|
2172 (defmacro gnus-save-hidden-threads (&rest forms)
|
|
2173 "Save hidden threads, eval FORMS, and restore the hidden threads."
|
|
2174 (let ((config (make-symbol "config")))
|
|
2175 `(let ((,config (gnus-hidden-threads-configuration)))
|
|
2176 (unwind-protect
|
|
2177 (save-excursion
|
|
2178 ,@forms)
|
|
2179 (gnus-restore-hidden-threads-configuration ,config)))))
|
|
2180
|
|
2181 (defun gnus-hidden-threads-configuration ()
|
|
2182 "Return the current hidden threads configuration."
|
|
2183 (save-excursion
|
|
2184 (let (config)
|
|
2185 (goto-char (point-min))
|
|
2186 (while (search-forward "\r" nil t)
|
|
2187 (push (1- (point)) config))
|
|
2188 config)))
|
|
2189
|
|
2190 (defun gnus-restore-hidden-threads-configuration (config)
|
|
2191 "Restore hidden threads configuration from CONFIG."
|
|
2192 (let (point buffer-read-only)
|
|
2193 (while (setq point (pop config))
|
|
2194 (when (and (< point (point-max))
|
|
2195 (goto-char point)
|
|
2196 (= (following-char) ?\n))
|
|
2197 (subst-char-in-region point (1+ point) ?\n ?\r)))))
|
|
2198
|
|
2199 ;; Various summary mode internalish functions.
|
|
2200
|
|
2201 (defun gnus-mouse-pick-article (e)
|
|
2202 (interactive "e")
|
|
2203 (mouse-set-point e)
|
|
2204 (gnus-summary-next-page nil t))
|
|
2205
|
|
2206 (defun gnus-summary-setup-buffer (group)
|
|
2207 "Initialize summary buffer."
|
|
2208 (let ((buffer (concat "*Summary " group "*")))
|
|
2209 (if (get-buffer buffer)
|
|
2210 (progn
|
|
2211 (set-buffer buffer)
|
|
2212 (setq gnus-summary-buffer (current-buffer))
|
|
2213 (not gnus-newsgroup-prepared))
|
|
2214 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
|
|
2215 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
|
|
2216 (gnus-add-current-to-buffer-list)
|
|
2217 (gnus-summary-mode group)
|
|
2218 (when gnus-carpal
|
|
2219 (gnus-carpal-setup-buffer 'summary))
|
|
2220 (unless gnus-single-article-buffer
|
|
2221 (make-local-variable 'gnus-article-buffer)
|
|
2222 (make-local-variable 'gnus-article-current)
|
|
2223 (make-local-variable 'gnus-original-article-buffer))
|
|
2224 (setq gnus-newsgroup-name group)
|
|
2225 t)))
|
|
2226
|
|
2227 (defun gnus-set-global-variables ()
|
|
2228 ;; Set the global equivalents of the summary buffer-local variables
|
|
2229 ;; to the latest values they had. These reflect the summary buffer
|
|
2230 ;; that was in action when the last article was fetched.
|
|
2231 (when (eq major-mode 'gnus-summary-mode)
|
|
2232 (setq gnus-summary-buffer (current-buffer))
|
|
2233 (let ((name gnus-newsgroup-name)
|
|
2234 (marked gnus-newsgroup-marked)
|
|
2235 (unread gnus-newsgroup-unreads)
|
|
2236 (headers gnus-current-headers)
|
|
2237 (data gnus-newsgroup-data)
|
|
2238 (summary gnus-summary-buffer)
|
|
2239 (article-buffer gnus-article-buffer)
|
|
2240 (original gnus-original-article-buffer)
|
|
2241 (gac gnus-article-current)
|
|
2242 (reffed gnus-reffed-article-number)
|
|
2243 (score-file gnus-current-score-file))
|
|
2244 (save-excursion
|
|
2245 (set-buffer gnus-group-buffer)
|
|
2246 (setq gnus-newsgroup-name name)
|
|
2247 (setq gnus-newsgroup-marked marked)
|
|
2248 (setq gnus-newsgroup-unreads unread)
|
|
2249 (setq gnus-current-headers headers)
|
|
2250 (setq gnus-newsgroup-data data)
|
|
2251 (setq gnus-article-current gac)
|
|
2252 (setq gnus-summary-buffer summary)
|
|
2253 (setq gnus-article-buffer article-buffer)
|
|
2254 (setq gnus-original-article-buffer original)
|
|
2255 (setq gnus-reffed-article-number reffed)
|
|
2256 (setq gnus-current-score-file score-file)
|
|
2257 ;; The article buffer also has local variables.
|
|
2258 (when (gnus-buffer-live-p gnus-article-buffer)
|
|
2259 (set-buffer gnus-article-buffer)
|
|
2260 (setq gnus-summary-buffer summary))))))
|
|
2261
|
|
2262 (defun gnus-summary-article-unread-p (article)
|
|
2263 "Say whether ARTICLE is unread or not."
|
|
2264 (memq article gnus-newsgroup-unreads))
|
|
2265
|
|
2266 (defun gnus-summary-first-article-p (&optional article)
|
|
2267 "Return whether ARTICLE is the first article in the buffer."
|
|
2268 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2269 nil
|
|
2270 (eq article (caar gnus-newsgroup-data))))
|
|
2271
|
|
2272 (defun gnus-summary-last-article-p (&optional article)
|
|
2273 "Return whether ARTICLE is the last article in the buffer."
|
|
2274 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2275 t ; All non-existent numbers are the last article. :-)
|
|
2276 (not (cdr (gnus-data-find-list article)))))
|
|
2277
|
|
2278 (defun gnus-make-thread-indent-array ()
|
|
2279 (let ((n 200))
|
|
2280 (unless (and gnus-thread-indent-array
|
|
2281 (= gnus-thread-indent-level gnus-thread-indent-array-level))
|
|
2282 (setq gnus-thread-indent-array (make-vector 201 "")
|
|
2283 gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
2284 (while (>= n 0)
|
|
2285 (aset gnus-thread-indent-array n
|
|
2286 (make-string (* n gnus-thread-indent-level) ? ))
|
|
2287 (setq n (1- n))))))
|
|
2288
|
|
2289 (defun gnus-update-summary-mark-positions ()
|
|
2290 "Compute where the summary marks are to go."
|
|
2291 (save-excursion
|
|
2292 (when (and gnus-summary-buffer
|
|
2293 (get-buffer gnus-summary-buffer)
|
|
2294 (buffer-name (get-buffer gnus-summary-buffer)))
|
|
2295 (set-buffer gnus-summary-buffer))
|
|
2296 (let ((gnus-replied-mark 129)
|
|
2297 (gnus-score-below-mark 130)
|
|
2298 (gnus-score-over-mark 130)
|
|
2299 (spec gnus-summary-line-format-spec)
|
|
2300 thread gnus-visual pos)
|
|
2301 (save-excursion
|
|
2302 (gnus-set-work-buffer)
|
|
2303 (let ((gnus-summary-line-format-spec spec))
|
|
2304 (gnus-summary-insert-line
|
|
2305 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
|
|
2306 (goto-char (point-min))
|
|
2307 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
|
|
2308 (- (point) 2)))))
|
|
2309 (goto-char (point-min))
|
|
2310 (push (cons 'replied (and (search-forward "\201" nil t)
|
|
2311 (- (point) 2)))
|
|
2312 pos)
|
|
2313 (goto-char (point-min))
|
|
2314 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
|
|
2315 pos)))
|
|
2316 (setq gnus-summary-mark-positions pos))))
|
|
2317
|
|
2318 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
|
|
2319 "Insert a dummy root in the summary buffer."
|
|
2320 (beginning-of-line)
|
|
2321 (gnus-add-text-properties
|
|
2322 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
|
|
2323 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
|
|
2324
|
|
2325 (defun gnus-summary-insert-line (gnus-tmp-header
|
|
2326 gnus-tmp-level gnus-tmp-current
|
|
2327 gnus-tmp-unread gnus-tmp-replied
|
|
2328 gnus-tmp-expirable gnus-tmp-subject-or-nil
|
|
2329 &optional gnus-tmp-dummy gnus-tmp-score
|
|
2330 gnus-tmp-process)
|
|
2331 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
|
|
2332 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
|
|
2333 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
|
|
2334 (gnus-tmp-score-char
|
|
2335 (if (or (null gnus-summary-default-score)
|
|
2336 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
2337 gnus-summary-zcore-fuzz))
|
|
2338 ?
|
|
2339 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
2340 gnus-score-below-mark gnus-score-over-mark)))
|
|
2341 (gnus-tmp-replied
|
|
2342 (cond (gnus-tmp-process gnus-process-mark)
|
|
2343 ((memq gnus-tmp-current gnus-newsgroup-cached)
|
|
2344 gnus-cached-mark)
|
|
2345 (gnus-tmp-replied gnus-replied-mark)
|
|
2346 ((memq gnus-tmp-current gnus-newsgroup-saved)
|
|
2347 gnus-saved-mark)
|
|
2348 (t gnus-unread-mark)))
|
|
2349 (gnus-tmp-from (mail-header-from gnus-tmp-header))
|
|
2350 (gnus-tmp-name
|
|
2351 (cond
|
|
2352 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
2353 (let ((beg (match-beginning 0)))
|
|
2354 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
2355 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
2356 (1- (match-end 0))))
|
|
2357 (substring gnus-tmp-from 0 beg))))
|
|
2358 ((string-match "(.+)" gnus-tmp-from)
|
|
2359 (substring gnus-tmp-from
|
|
2360 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
2361 (t gnus-tmp-from)))
|
|
2362 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
|
|
2363 (gnus-tmp-number (mail-header-number gnus-tmp-header))
|
|
2364 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
|
|
2365 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
|
|
2366 (buffer-read-only nil))
|
|
2367 (when (string= gnus-tmp-name "")
|
|
2368 (setq gnus-tmp-name gnus-tmp-from))
|
|
2369 (unless (numberp gnus-tmp-lines)
|
|
2370 (setq gnus-tmp-lines 0))
|
|
2371 (gnus-put-text-property
|
|
2372 (point)
|
|
2373 (progn (eval gnus-summary-line-format-spec) (point))
|
|
2374 'gnus-number gnus-tmp-number)
|
|
2375 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2376 (forward-line -1)
|
|
2377 (run-hooks 'gnus-summary-update-hook)
|
|
2378 (forward-line 1))))
|
|
2379
|
|
2380 (defun gnus-summary-update-line (&optional dont-update)
|
|
2381 ;; Update summary line after change.
|
|
2382 (when (and gnus-summary-default-score
|
|
2383 (not gnus-summary-inhibit-highlight))
|
|
2384 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
|
|
2385 (article (gnus-summary-article-number))
|
|
2386 (score (gnus-summary-article-score article)))
|
|
2387 (unless dont-update
|
|
2388 (if (and gnus-summary-mark-below
|
|
2389 (< (gnus-summary-article-score)
|
|
2390 gnus-summary-mark-below))
|
|
2391 ;; This article has a low score, so we mark it as read.
|
|
2392 (when (memq article gnus-newsgroup-unreads)
|
|
2393 (gnus-summary-mark-article-as-read gnus-low-score-mark))
|
|
2394 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
|
|
2395 ;; This article was previously marked as read on account
|
|
2396 ;; of a low score, but now it has risen, so we mark it as
|
|
2397 ;; unread.
|
|
2398 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
|
|
2399 (gnus-summary-update-mark
|
|
2400 (if (or (null gnus-summary-default-score)
|
|
2401 (<= (abs (- score gnus-summary-default-score))
|
|
2402 gnus-summary-zcore-fuzz))
|
|
2403 ?
|
|
2404 (if (< score gnus-summary-default-score)
|
|
2405 gnus-score-below-mark gnus-score-over-mark))
|
|
2406 'score))
|
|
2407 ;; Do visual highlighting.
|
|
2408 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2409 (run-hooks 'gnus-summary-update-hook)))))
|
|
2410
|
|
2411 (defvar gnus-tmp-new-adopts nil)
|
|
2412
|
|
2413 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
|
|
2414 "Return the number of articles in THREAD.
|
|
2415 This may be 0 in some cases -- if none of the articles in
|
|
2416 the thread are to be displayed."
|
|
2417 (let* ((number
|
|
2418 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
|
|
2419 (cond
|
|
2420 ((not (listp thread))
|
|
2421 1)
|
|
2422 ((and (consp thread) (cdr thread))
|
|
2423 (apply
|
|
2424 '+ 1 (mapcar
|
|
2425 'gnus-summary-number-of-articles-in-thread (cdr thread))))
|
|
2426 ((null thread)
|
|
2427 1)
|
|
2428 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
|
|
2429 1)
|
|
2430 (t 0))))
|
|
2431 (when (and level (zerop level) gnus-tmp-new-adopts)
|
|
2432 (incf number
|
|
2433 (apply '+ (mapcar
|
|
2434 'gnus-summary-number-of-articles-in-thread
|
|
2435 gnus-tmp-new-adopts))))
|
|
2436 (if char
|
|
2437 (if (> number 1) gnus-not-empty-thread-mark
|
|
2438 gnus-empty-thread-mark)
|
|
2439 number)))
|
|
2440
|
|
2441 (defun gnus-summary-set-local-parameters (group)
|
|
2442 "Go through the local params of GROUP and set all variable specs in that list."
|
|
2443 (let ((params (gnus-group-find-parameter group))
|
|
2444 elem)
|
|
2445 (while params
|
|
2446 (setq elem (car params)
|
|
2447 params (cdr params))
|
|
2448 (and (consp elem) ; Has to be a cons.
|
|
2449 (consp (cdr elem)) ; The cdr has to be a list.
|
|
2450 (symbolp (car elem)) ; Has to be a symbol in there.
|
|
2451 (not (memq (car elem)
|
|
2452 '(quit-config to-address to-list to-group)))
|
|
2453 (progn ; So we set it.
|
|
2454 (make-local-variable (car elem))
|
|
2455 (set (car elem) (eval (nth 1 elem))))))))
|
|
2456
|
|
2457 (defun gnus-summary-read-group (group &optional show-all no-article
|
|
2458 kill-buffer no-display)
|
|
2459 "Start reading news in newsgroup GROUP.
|
|
2460 If SHOW-ALL is non-nil, already read articles are also listed.
|
|
2461 If NO-ARTICLE is non-nil, no article is selected initially.
|
|
2462 If NO-DISPLAY, don't generate a summary buffer."
|
|
2463 ;; Killed foreign groups can't be entered.
|
|
2464 (when (and (not (gnus-group-native-p group))
|
|
2465 (not (gnus-gethash group gnus-newsrc-hashtb)))
|
|
2466 (error "Dead non-native groups can't be entered"))
|
|
2467 (gnus-message 5 "Retrieving newsgroup: %s..." group)
|
|
2468 (let* ((new-group (gnus-summary-setup-buffer group))
|
|
2469 (quit-config (gnus-group-quit-config group))
|
|
2470 (did-select (and new-group (gnus-select-newsgroup group show-all))))
|
|
2471 (cond
|
|
2472 ;; This summary buffer exists already, so we just select it.
|
|
2473 ((not new-group)
|
|
2474 (gnus-set-global-variables)
|
|
2475 (when kill-buffer
|
|
2476 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2477 (gnus-configure-windows 'summary 'force)
|
|
2478 (gnus-set-mode-line 'summary)
|
|
2479 (gnus-summary-position-point)
|
|
2480 (message "")
|
|
2481 t)
|
|
2482 ;; We couldn't select this group.
|
|
2483 ((null did-select)
|
|
2484 (when (and (eq major-mode 'gnus-summary-mode)
|
|
2485 (not (equal (current-buffer) kill-buffer)))
|
|
2486 (kill-buffer (current-buffer))
|
|
2487 (if (not quit-config)
|
|
2488 (progn
|
|
2489 (set-buffer gnus-group-buffer)
|
|
2490 (gnus-group-jump-to-group group)
|
|
2491 (gnus-group-next-unread-group 1))
|
|
2492 (gnus-handle-ephemeral-exit quit-config)))
|
|
2493 (gnus-message 3 "Can't select group")
|
|
2494 nil)
|
|
2495 ;; The user did a `C-g' while prompting for number of articles,
|
|
2496 ;; so we exit this group.
|
|
2497 ((eq did-select 'quit)
|
|
2498 (and (eq major-mode 'gnus-summary-mode)
|
|
2499 (not (equal (current-buffer) kill-buffer))
|
|
2500 (kill-buffer (current-buffer)))
|
|
2501 (when kill-buffer
|
|
2502 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2503 (if (not quit-config)
|
|
2504 (progn
|
|
2505 (set-buffer gnus-group-buffer)
|
|
2506 (gnus-group-jump-to-group group)
|
|
2507 (gnus-group-next-unread-group 1)
|
|
2508 (gnus-configure-windows 'group 'force))
|
|
2509 (gnus-handle-ephemeral-exit quit-config))
|
|
2510 ;; Finally signal the quit.
|
|
2511 (signal 'quit nil))
|
|
2512 ;; The group was successfully selected.
|
|
2513 (t
|
|
2514 (gnus-set-global-variables)
|
|
2515 ;; Save the active value in effect when the group was entered.
|
|
2516 (setq gnus-newsgroup-active
|
|
2517 (gnus-copy-sequence
|
|
2518 (gnus-active gnus-newsgroup-name)))
|
|
2519 ;; You can change the summary buffer in some way with this hook.
|
|
2520 (run-hooks 'gnus-select-group-hook)
|
|
2521 ;; Set any local variables in the group parameters.
|
|
2522 (gnus-summary-set-local-parameters gnus-newsgroup-name)
|
|
2523 (gnus-update-format-specifications
|
|
2524 nil 'summary 'summary-mode 'summary-dummy)
|
|
2525 ;; Do score processing.
|
|
2526 (when gnus-use-scoring
|
|
2527 (gnus-possibly-score-headers))
|
|
2528 ;; Check whether to fill in the gaps in the threads.
|
|
2529 (when gnus-build-sparse-threads
|
|
2530 (gnus-build-sparse-threads))
|
|
2531 ;; Find the initial limit.
|
|
2532 (if gnus-show-threads
|
|
2533 (if show-all
|
|
2534 (let ((gnus-newsgroup-dormant nil))
|
|
2535 (gnus-summary-initial-limit show-all))
|
|
2536 (gnus-summary-initial-limit show-all))
|
|
2537 (setq gnus-newsgroup-limit
|
|
2538 (mapcar
|
|
2539 (lambda (header) (mail-header-number header))
|
|
2540 gnus-newsgroup-headers)))
|
|
2541 ;; Generate the summary buffer.
|
|
2542 (unless no-display
|
|
2543 (gnus-summary-prepare))
|
|
2544 (when gnus-use-trees
|
|
2545 (gnus-tree-open group)
|
|
2546 (setq gnus-summary-highlight-line-function
|
|
2547 'gnus-tree-highlight-article))
|
|
2548 ;; If the summary buffer is empty, but there are some low-scored
|
|
2549 ;; articles or some excluded dormants, we include these in the
|
|
2550 ;; buffer.
|
|
2551 (when (and (zerop (buffer-size))
|
|
2552 (not no-display))
|
|
2553 (cond (gnus-newsgroup-dormant
|
|
2554 (gnus-summary-limit-include-dormant))
|
|
2555 ((and gnus-newsgroup-scored show-all)
|
|
2556 (gnus-summary-limit-include-expunged t))))
|
|
2557 ;; Function `gnus-apply-kill-file' must be called in this hook.
|
|
2558 (run-hooks 'gnus-apply-kill-hook)
|
|
2559 (if (and (zerop (buffer-size))
|
|
2560 (not no-display))
|
|
2561 (progn
|
|
2562 ;; This newsgroup is empty.
|
|
2563 (gnus-summary-catchup-and-exit nil t) ;Without confirmations.
|
|
2564 (gnus-message 6 "No unread news")
|
|
2565 (when kill-buffer
|
|
2566 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2567 ;; Return nil from this function.
|
|
2568 nil)
|
|
2569 ;; Hide conversation thread subtrees. We cannot do this in
|
|
2570 ;; gnus-summary-prepare-hook since kill processing may not
|
|
2571 ;; work with hidden articles.
|
|
2572 (and gnus-show-threads
|
|
2573 gnus-thread-hide-subtree
|
|
2574 (gnus-summary-hide-all-threads))
|
|
2575 ;; Show first unread article if requested.
|
|
2576 (if (and (not no-article)
|
|
2577 (not no-display)
|
|
2578 gnus-newsgroup-unreads
|
|
2579 gnus-auto-select-first)
|
|
2580 (unless (if (eq gnus-auto-select-first 'best)
|
|
2581 (gnus-summary-best-unread-article)
|
|
2582 (gnus-summary-first-unread-article))
|
|
2583 (gnus-configure-windows 'summary))
|
|
2584 ;; Don't select any articles, just move point to the first
|
|
2585 ;; article in the group.
|
|
2586 (goto-char (point-min))
|
|
2587 (gnus-summary-position-point)
|
|
2588 (gnus-set-mode-line 'summary)
|
|
2589 (gnus-configure-windows 'summary 'force))
|
|
2590 (when kill-buffer
|
|
2591 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2592 (when (get-buffer-window gnus-group-buffer t)
|
|
2593 ;; Gotta use windows, because recenter does weird stuff if
|
|
2594 ;; the current buffer ain't the displayed window.
|
|
2595 (let ((owin (selected-window)))
|
|
2596 (select-window (get-buffer-window gnus-group-buffer t))
|
|
2597 (when (gnus-group-goto-group group)
|
|
2598 (recenter))
|
|
2599 (select-window owin))))
|
|
2600 ;; Mark this buffer as "prepared".
|
|
2601 (setq gnus-newsgroup-prepared t)
|
|
2602 t))))
|
|
2603
|
|
2604 (defun gnus-summary-prepare ()
|
|
2605 "Generate the summary buffer."
|
|
2606 (interactive)
|
|
2607 (let ((buffer-read-only nil))
|
|
2608 (erase-buffer)
|
|
2609 (setq gnus-newsgroup-data nil
|
|
2610 gnus-newsgroup-data-reverse nil)
|
|
2611 (run-hooks 'gnus-summary-generate-hook)
|
|
2612 ;; Generate the buffer, either with threads or without.
|
|
2613 (when gnus-newsgroup-headers
|
|
2614 (gnus-summary-prepare-threads
|
|
2615 (if gnus-show-threads
|
|
2616 (gnus-sort-gathered-threads
|
|
2617 (funcall gnus-summary-thread-gathering-function
|
|
2618 (gnus-sort-threads
|
|
2619 (gnus-cut-threads (gnus-make-threads)))))
|
|
2620 ;; Unthreaded display.
|
|
2621 (gnus-sort-articles gnus-newsgroup-headers))))
|
|
2622 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
|
|
2623 ;; Call hooks for modifying summary buffer.
|
|
2624 (goto-char (point-min))
|
|
2625 (run-hooks 'gnus-summary-prepare-hook)))
|
|
2626
|
|
2627 (defsubst gnus-general-simplify-subject (subject)
|
|
2628 "Simply subject by the same rules as gnus-gather-threads-by-subject."
|
|
2629 (setq subject
|
|
2630 (cond
|
|
2631 ;; Truncate the subject.
|
|
2632 ((numberp gnus-summary-gather-subject-limit)
|
|
2633 (setq subject (gnus-simplify-subject-re subject))
|
|
2634 (if (> (length subject) gnus-summary-gather-subject-limit)
|
|
2635 (substring subject 0 gnus-summary-gather-subject-limit)
|
|
2636 subject))
|
|
2637 ;; Fuzzily simplify it.
|
|
2638 ((eq 'fuzzy gnus-summary-gather-subject-limit)
|
|
2639 (gnus-simplify-subject-fuzzy subject))
|
|
2640 ;; Just remove the leading "Re:".
|
|
2641 (t
|
|
2642 (gnus-simplify-subject-re subject))))
|
|
2643
|
|
2644 (if (and gnus-summary-gather-exclude-subject
|
|
2645 (string-match gnus-summary-gather-exclude-subject subject))
|
|
2646 nil ; This article shouldn't be gathered
|
|
2647 subject))
|
|
2648
|
|
2649 (defun gnus-summary-simplify-subject-query ()
|
|
2650 "Query where the respool algorithm would put this article."
|
|
2651 (interactive)
|
|
2652 (gnus-set-global-variables)
|
|
2653 (gnus-summary-select-article)
|
|
2654 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
|
|
2655
|
|
2656 (defun gnus-gather-threads-by-subject (threads)
|
|
2657 "Gather threads by looking at Subject headers."
|
|
2658 (if (not gnus-summary-make-false-root)
|
|
2659 threads
|
|
2660 (let ((hashtb (gnus-make-hashtable 1024))
|
|
2661 (prev threads)
|
|
2662 (result threads)
|
|
2663 subject hthread whole-subject)
|
|
2664 (while threads
|
|
2665 (setq subject (gnus-general-simplify-subject
|
|
2666 (setq whole-subject (mail-header-subject
|
|
2667 (caar threads)))))
|
|
2668 (when subject
|
|
2669 (if (setq hthread (gnus-gethash subject hashtb))
|
|
2670 (progn
|
|
2671 ;; We enter a dummy root into the thread, if we
|
|
2672 ;; haven't done that already.
|
|
2673 (unless (stringp (caar hthread))
|
|
2674 (setcar hthread (list whole-subject (car hthread))))
|
|
2675 ;; We add this new gathered thread to this gathered
|
|
2676 ;; thread.
|
|
2677 (setcdr (car hthread)
|
|
2678 (nconc (cdar hthread) (list (car threads))))
|
|
2679 ;; Remove it from the list of threads.
|
|
2680 (setcdr prev (cdr threads))
|
|
2681 (setq threads prev))
|
|
2682 ;; Enter this thread into the hash table.
|
|
2683 (gnus-sethash subject threads hashtb)))
|
|
2684 (setq prev threads)
|
|
2685 (setq threads (cdr threads)))
|
|
2686 result)))
|
|
2687
|
|
2688 (defun gnus-gather-threads-by-references (threads)
|
|
2689 "Gather threads by looking at References headers."
|
|
2690 (let ((idhashtb (gnus-make-hashtable 1024))
|
|
2691 (thhashtb (gnus-make-hashtable 1024))
|
|
2692 (prev threads)
|
|
2693 (result threads)
|
|
2694 ids references id gthread gid entered ref)
|
|
2695 (while threads
|
|
2696 (when (setq references (mail-header-references (caar threads)))
|
|
2697 (setq id (mail-header-id (caar threads))
|
|
2698 ids (gnus-split-references references)
|
|
2699 entered nil)
|
|
2700 (while (setq ref (pop ids))
|
|
2701 (setq ids (delete ref ids))
|
|
2702 (if (not (setq gid (gnus-gethash ref idhashtb)))
|
|
2703 (progn
|
|
2704 (gnus-sethash ref id idhashtb)
|
|
2705 (gnus-sethash id threads thhashtb))
|
|
2706 (setq gthread (gnus-gethash gid thhashtb))
|
|
2707 (unless entered
|
|
2708 ;; We enter a dummy root into the thread, if we
|
|
2709 ;; haven't done that already.
|
|
2710 (unless (stringp (caar gthread))
|
|
2711 (setcar gthread (list (mail-header-subject (caar gthread))
|
|
2712 (car gthread))))
|
|
2713 ;; We add this new gathered thread to this gathered
|
|
2714 ;; thread.
|
|
2715 (setcdr (car gthread)
|
|
2716 (nconc (cdar gthread) (list (car threads)))))
|
|
2717 ;; Add it into the thread hash table.
|
|
2718 (gnus-sethash id gthread thhashtb)
|
|
2719 (setq entered t)
|
|
2720 ;; Remove it from the list of threads.
|
|
2721 (setcdr prev (cdr threads))
|
|
2722 (setq threads prev))))
|
|
2723 (setq prev threads)
|
|
2724 (setq threads (cdr threads)))
|
|
2725 result))
|
|
2726
|
|
2727 (defun gnus-sort-gathered-threads (threads)
|
|
2728 "Sort subtreads inside each gathered thread by article number."
|
|
2729 (let ((result threads))
|
|
2730 (while threads
|
|
2731 (when (stringp (caar threads))
|
|
2732 (setcdr (car threads)
|
|
2733 (sort (cdar threads) 'gnus-thread-sort-by-number)))
|
|
2734 (setq threads (cdr threads)))
|
|
2735 result))
|
|
2736
|
|
2737 (defun gnus-thread-loop-p (root thread)
|
|
2738 "Say whether ROOT is in THREAD."
|
|
2739 (let ((th (cdr thread)))
|
|
2740 (while (and th
|
|
2741 (not (eq (caar th) root)))
|
|
2742 (pop th))
|
|
2743 (if th
|
|
2744 ;; We have found a loop.
|
|
2745 (let (ref-dep)
|
|
2746 (setcdr thread (delq (car th) (cdr thread)))
|
|
2747 (if (boundp (setq ref-dep (intern "none"
|
|
2748 gnus-newsgroup-dependencies)))
|
|
2749 (setcdr (symbol-value ref-dep)
|
|
2750 (nconc (cdr (symbol-value ref-dep))
|
|
2751 (list (car th))))
|
|
2752 (set ref-dep (list nil (car th))))
|
|
2753 1)
|
|
2754 ;; Recurse down into the sub-threads and look for loops.
|
|
2755 (apply '+
|
|
2756 (mapcar
|
|
2757 (lambda (thread) (gnus-thread-loop-p root thread))
|
|
2758 (cdr thread))))))
|
|
2759
|
|
2760 (defun gnus-make-threads ()
|
|
2761 "Go through the dependency hashtb and find the roots. Return all threads."
|
|
2762 (let (threads)
|
|
2763 (while (catch 'infloop
|
|
2764 (mapatoms
|
|
2765 (lambda (refs)
|
|
2766 ;; Deal with self-referencing References loops.
|
|
2767 (when (and (car (symbol-value refs))
|
|
2768 (not (zerop
|
|
2769 (apply
|
|
2770 '+
|
|
2771 (mapcar
|
|
2772 (lambda (thread)
|
|
2773 (gnus-thread-loop-p
|
|
2774 (car (symbol-value refs)) thread))
|
|
2775 (cdr (symbol-value refs)))))))
|
|
2776 (setq threads nil)
|
|
2777 (throw 'infloop t))
|
|
2778 (unless (car (symbol-value refs))
|
|
2779 ;; These threads do not refer back to any other articles,
|
|
2780 ;; so they're roots.
|
|
2781 (setq threads (append (cdr (symbol-value refs)) threads))))
|
|
2782 gnus-newsgroup-dependencies)))
|
|
2783 threads))
|
|
2784
|
|
2785 (defun gnus-build-sparse-threads ()
|
|
2786 (let ((headers gnus-newsgroup-headers)
|
|
2787 (deps gnus-newsgroup-dependencies)
|
|
2788 header references generation relations
|
|
2789 cthread subject child end pthread relation)
|
|
2790 ;; First we create an alist of generations/relations, where
|
|
2791 ;; generations is how much we trust the relation, and the relation
|
|
2792 ;; is parent/child.
|
|
2793 (gnus-message 7 "Making sparse threads...")
|
|
2794 (save-excursion
|
|
2795 (nnheader-set-temp-buffer " *gnus sparse threads*")
|
|
2796 (while (setq header (pop headers))
|
|
2797 (when (and (setq references (mail-header-references header))
|
|
2798 (not (string= references "")))
|
|
2799 (insert references)
|
|
2800 (setq child (mail-header-id header)
|
|
2801 subject (mail-header-subject header))
|
|
2802 (setq generation 0)
|
|
2803 (while (search-backward ">" nil t)
|
|
2804 (setq end (1+ (point)))
|
|
2805 (when (search-backward "<" nil t)
|
|
2806 (push (list (incf generation)
|
|
2807 child (setq child (buffer-substring (point) end))
|
|
2808 subject)
|
|
2809 relations)))
|
|
2810 (push (list (1+ generation) child nil subject) relations)
|
|
2811 (erase-buffer)))
|
|
2812 (kill-buffer (current-buffer)))
|
|
2813 ;; Sort over trustworthiness.
|
|
2814 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
|
|
2815 (while (setq relation (pop relations))
|
|
2816 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
|
|
2817 (unless (car (symbol-value cthread))
|
|
2818 ;; Make this article the parent of these threads.
|
|
2819 (setcar (symbol-value cthread)
|
|
2820 (vector gnus-reffed-article-number
|
|
2821 (cadddr relation)
|
|
2822 "" ""
|
|
2823 (cadr relation)
|
|
2824 (or (caddr relation) "") 0 0 "")))
|
|
2825 (set cthread (list (vector gnus-reffed-article-number
|
|
2826 (cadddr relation)
|
|
2827 "" "" (cadr relation)
|
|
2828 (or (caddr relation) "") 0 0 ""))))
|
|
2829 (push gnus-reffed-article-number gnus-newsgroup-limit)
|
|
2830 (push gnus-reffed-article-number gnus-newsgroup-sparse)
|
|
2831 (push (cons gnus-reffed-article-number gnus-sparse-mark)
|
|
2832 gnus-newsgroup-reads)
|
|
2833 (decf gnus-reffed-article-number)
|
|
2834 ;; Make this new thread the child of its parent.
|
|
2835 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
|
|
2836 (setcdr (symbol-value pthread)
|
|
2837 (nconc (cdr (symbol-value pthread))
|
|
2838 (list (symbol-value cthread))))
|
|
2839 (set pthread (list nil (symbol-value cthread))))))
|
|
2840 (gnus-message 7 "Making sparse threads...done")))
|
|
2841
|
|
2842 (defun gnus-build-old-threads ()
|
|
2843 ;; Look at all the articles that refer back to old articles, and
|
|
2844 ;; fetch the headers for the articles that aren't there. This will
|
|
2845 ;; build complete threads - if the roots haven't been expired by the
|
|
2846 ;; server, that is.
|
|
2847 (let (id heads)
|
|
2848 (mapatoms
|
|
2849 (lambda (refs)
|
|
2850 (when (not (car (symbol-value refs)))
|
|
2851 (setq heads (cdr (symbol-value refs)))
|
|
2852 (while heads
|
|
2853 (if (memq (mail-header-number (caar heads))
|
|
2854 gnus-newsgroup-dormant)
|
|
2855 (setq heads (cdr heads))
|
|
2856 (setq id (symbol-name refs))
|
|
2857 (while (and (setq id (gnus-build-get-header id))
|
|
2858 (not (car (gnus-gethash
|
|
2859 id gnus-newsgroup-dependencies)))))
|
|
2860 (setq heads nil)))))
|
|
2861 gnus-newsgroup-dependencies)))
|
|
2862
|
|
2863 (defun gnus-build-get-header (id)
|
|
2864 ;; Look through the buffer of NOV lines and find the header to
|
|
2865 ;; ID. Enter this line into the dependencies hash table, and return
|
|
2866 ;; the id of the parent article (if any).
|
|
2867 (let ((deps gnus-newsgroup-dependencies)
|
|
2868 found header)
|
|
2869 (prog1
|
|
2870 (save-excursion
|
|
2871 (set-buffer nntp-server-buffer)
|
|
2872 (goto-char (point-min))
|
|
2873 (while (and (not found) (search-forward id nil t))
|
|
2874 (beginning-of-line)
|
|
2875 (setq found (looking-at
|
|
2876 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
|
|
2877 (regexp-quote id))))
|
|
2878 (or found (beginning-of-line 2)))
|
|
2879 (when found
|
|
2880 (beginning-of-line)
|
|
2881 (and
|
|
2882 (setq header (gnus-nov-parse-line
|
|
2883 (read (current-buffer)) deps))
|
|
2884 (gnus-parent-id (mail-header-references header)))))
|
|
2885 (when header
|
|
2886 (let ((number (mail-header-number header)))
|
|
2887 (push number gnus-newsgroup-limit)
|
|
2888 (push header gnus-newsgroup-headers)
|
|
2889 (if (memq number gnus-newsgroup-unselected)
|
|
2890 (progn
|
|
2891 (push number gnus-newsgroup-unreads)
|
|
2892 (setq gnus-newsgroup-unselected
|
|
2893 (delq number gnus-newsgroup-unselected)))
|
|
2894 (push number gnus-newsgroup-ancient)))))))
|
|
2895
|
|
2896 (defun gnus-summary-update-article-line (article header)
|
|
2897 "Update the line for ARTICLE using HEADERS."
|
|
2898 (let* ((id (mail-header-id header))
|
|
2899 (thread (gnus-id-to-thread id)))
|
|
2900 (unless thread
|
|
2901 (error "Article in no thread"))
|
|
2902 ;; Update the thread.
|
|
2903 (setcar thread header)
|
|
2904 (gnus-summary-goto-subject article)
|
|
2905 (let* ((datal (gnus-data-find-list article))
|
|
2906 (data (car datal))
|
|
2907 (length (when (cdr datal)
|
|
2908 (- (gnus-data-pos data)
|
|
2909 (gnus-data-pos (cadr datal)))))
|
|
2910 (buffer-read-only nil)
|
|
2911 (level (gnus-summary-thread-level)))
|
|
2912 (gnus-delete-line)
|
|
2913 (gnus-summary-insert-line
|
|
2914 header level nil (gnus-article-mark article)
|
|
2915 (memq article gnus-newsgroup-replied)
|
|
2916 (memq article gnus-newsgroup-expirable)
|
104
|
2917 ;; Only insert the Subject string when it's different
|
|
2918 ;; from the previous Subject string.
|
|
2919 (unless (gnus-subject-equal
|
|
2920 (condition-case ()
|
|
2921 (mail-header-subject
|
|
2922 (gnus-data-header
|
|
2923 (cadr
|
|
2924 (gnus-data-find-list
|
|
2925 article
|
|
2926 (gnus-data-list t)))))
|
|
2927 (error ""))
|
|
2928 (mail-header-subject header))
|
|
2929 (mail-header-subject header))
|
98
|
2930 nil (cdr (assq article gnus-newsgroup-scored))
|
|
2931 (memq article gnus-newsgroup-processable))
|
|
2932 (when length
|
|
2933 (gnus-data-update-list
|
|
2934 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
|
|
2935
|
|
2936 (defun gnus-summary-update-article (article &optional iheader)
|
|
2937 "Update ARTICLE in the summary buffer."
|
|
2938 (set-buffer gnus-summary-buffer)
|
|
2939 (let* ((header (or iheader (gnus-summary-article-header article)))
|
|
2940 (id (mail-header-id header))
|
|
2941 (data (gnus-data-find article))
|
|
2942 (thread (gnus-id-to-thread id))
|
|
2943 (references (mail-header-references header))
|
|
2944 (parent
|
|
2945 (gnus-id-to-thread
|
|
2946 (or (gnus-parent-id
|
|
2947 (when (and references
|
|
2948 (not (equal "" references)))
|
|
2949 references))
|
|
2950 "none")))
|
|
2951 (buffer-read-only nil)
|
|
2952 (old (car thread))
|
|
2953 (number (mail-header-number header))
|
|
2954 pos)
|
|
2955 (when thread
|
|
2956 ;; !!! Should this be in or not?
|
|
2957 (unless iheader
|
|
2958 (setcar thread nil))
|
|
2959 (when parent
|
|
2960 (delq thread parent))
|
|
2961 (if (gnus-summary-insert-subject id header iheader)
|
|
2962 ;; Set the (possibly) new article number in the data structure.
|
|
2963 (gnus-data-set-number data (gnus-id-to-article id))
|
|
2964 (setcar thread old)
|
|
2965 nil))))
|
|
2966
|
|
2967 (defun gnus-rebuild-thread (id)
|
|
2968 "Rebuild the thread containing ID."
|
|
2969 (let ((buffer-read-only nil)
|
|
2970 old-pos current thread data)
|
|
2971 (if (not gnus-show-threads)
|
|
2972 (setq thread (list (car (gnus-id-to-thread id))))
|
|
2973 ;; Get the thread this article is part of.
|
|
2974 (setq thread (gnus-remove-thread id)))
|
|
2975 (setq old-pos (gnus-point-at-bol))
|
|
2976 (setq current (save-excursion
|
|
2977 (and (zerop (forward-line -1))
|
|
2978 (gnus-summary-article-number))))
|
|
2979 ;; If this is a gathered thread, we have to go some re-gathering.
|
|
2980 (when (stringp (car thread))
|
|
2981 (let ((subject (car thread))
|
|
2982 roots thr)
|
|
2983 (setq thread (cdr thread))
|
|
2984 (while thread
|
|
2985 (unless (memq (setq thr (gnus-id-to-thread
|
|
2986 (gnus-root-id
|
|
2987 (mail-header-id (caar thread)))))
|
|
2988 roots)
|
|
2989 (push thr roots))
|
|
2990 (setq thread (cdr thread)))
|
|
2991 ;; We now have all (unique) roots.
|
|
2992 (if (= (length roots) 1)
|
|
2993 ;; All the loose roots are now one solid root.
|
|
2994 (setq thread (car roots))
|
|
2995 (setq thread (cons subject (gnus-sort-threads roots))))))
|
|
2996 (let (threads)
|
|
2997 ;; We then insert this thread into the summary buffer.
|
|
2998 (let (gnus-newsgroup-data gnus-newsgroup-threads)
|
|
2999 (if gnus-show-threads
|
|
3000 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
|
|
3001 (gnus-summary-prepare-unthreaded thread))
|
|
3002 (setq data (nreverse gnus-newsgroup-data))
|
|
3003 (setq threads gnus-newsgroup-threads))
|
|
3004 ;; We splice the new data into the data structure.
|
|
3005 (gnus-data-enter-list current data (- (point) old-pos))
|
|
3006 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
|
|
3007
|
|
3008 (defun gnus-number-to-header (number)
|
|
3009 "Return the header for article NUMBER."
|
|
3010 (let ((headers gnus-newsgroup-headers))
|
|
3011 (while (and headers
|
|
3012 (not (= number (mail-header-number (car headers)))))
|
|
3013 (pop headers))
|
|
3014 (when headers
|
|
3015 (car headers))))
|
|
3016
|
|
3017 (defun gnus-parent-headers (headers &optional generation)
|
|
3018 "Return the headers of the GENERATIONeth parent of HEADERS."
|
|
3019 (unless generation
|
|
3020 (setq generation 1))
|
|
3021 (let (references parent)
|
|
3022 (while (and headers (not (zerop generation)))
|
|
3023 (setq references (mail-header-references headers))
|
|
3024 (when (and references
|
|
3025 (setq parent (gnus-parent-id references))
|
|
3026 (setq headers (car (gnus-id-to-thread parent))))
|
|
3027 (decf generation)))
|
|
3028 headers))
|
|
3029
|
|
3030 (defun gnus-id-to-thread (id)
|
|
3031 "Return the (sub-)thread where ID appears."
|
|
3032 (gnus-gethash id gnus-newsgroup-dependencies))
|
|
3033
|
|
3034 (defun gnus-id-to-article (id)
|
|
3035 "Return the article number of ID."
|
|
3036 (let ((thread (gnus-id-to-thread id)))
|
|
3037 (when (and thread
|
|
3038 (car thread))
|
|
3039 (mail-header-number (car thread)))))
|
|
3040
|
|
3041 (defun gnus-id-to-header (id)
|
|
3042 "Return the article headers of ID."
|
|
3043 (car (gnus-id-to-thread id)))
|
|
3044
|
|
3045 (defun gnus-article-displayed-root-p (article)
|
|
3046 "Say whether ARTICLE is a root(ish) article."
|
|
3047 (let ((level (gnus-summary-thread-level article))
|
|
3048 (refs (mail-header-references (gnus-summary-article-header article)))
|
|
3049 particle)
|
|
3050 (cond
|
|
3051 ((null level) nil)
|
|
3052 ((zerop level) t)
|
|
3053 ((null refs) t)
|
|
3054 ((null (gnus-parent-id refs)) t)
|
|
3055 ((and (= 1 level)
|
|
3056 (null (setq particle (gnus-id-to-article
|
|
3057 (gnus-parent-id refs))))
|
|
3058 (null (gnus-summary-thread-level particle)))))))
|
|
3059
|
|
3060 (defun gnus-root-id (id)
|
|
3061 "Return the id of the root of the thread where ID appears."
|
|
3062 (let (last-id prev)
|
|
3063 (while (and id (setq prev (car (gnus-gethash
|
|
3064 id gnus-newsgroup-dependencies))))
|
|
3065 (setq last-id id
|
|
3066 id (gnus-parent-id (mail-header-references prev))))
|
|
3067 last-id))
|
|
3068
|
|
3069 (defun gnus-remove-thread (id &optional dont-remove)
|
|
3070 "Remove the thread that has ID in it."
|
|
3071 (let ((dep gnus-newsgroup-dependencies)
|
|
3072 headers thread last-id)
|
|
3073 ;; First go up in this thread until we find the root.
|
|
3074 (setq last-id (gnus-root-id id))
|
|
3075 (setq headers (list (car (gnus-id-to-thread last-id))
|
|
3076 (caadr (gnus-id-to-thread last-id))))
|
|
3077 ;; We have now found the real root of this thread. It might have
|
|
3078 ;; been gathered into some loose thread, so we have to search
|
|
3079 ;; through the threads to find the thread we wanted.
|
|
3080 (let ((threads gnus-newsgroup-threads)
|
|
3081 sub)
|
|
3082 (while threads
|
|
3083 (setq sub (car threads))
|
|
3084 (if (stringp (car sub))
|
|
3085 ;; This is a gathered thread, so we look at the roots
|
|
3086 ;; below it to find whether this article is in this
|
|
3087 ;; gathered root.
|
|
3088 (progn
|
|
3089 (setq sub (cdr sub))
|
|
3090 (while sub
|
|
3091 (when (member (caar sub) headers)
|
|
3092 (setq thread (car threads)
|
|
3093 threads nil
|
|
3094 sub nil))
|
|
3095 (setq sub (cdr sub))))
|
|
3096 ;; It's an ordinary thread, so we check it.
|
|
3097 (when (eq (car sub) (car headers))
|
|
3098 (setq thread sub
|
|
3099 threads nil)))
|
|
3100 (setq threads (cdr threads)))
|
|
3101 ;; If this article is in no thread, then it's a root.
|
|
3102 (if thread
|
|
3103 (unless dont-remove
|
|
3104 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
|
|
3105 (setq thread (gnus-gethash last-id dep)))
|
|
3106 (when thread
|
|
3107 (prog1
|
|
3108 thread ; We return this thread.
|
|
3109 (unless dont-remove
|
|
3110 (if (stringp (car thread))
|
|
3111 (progn
|
|
3112 ;; If we use dummy roots, then we have to remove the
|
|
3113 ;; dummy root as well.
|
|
3114 (when (eq gnus-summary-make-false-root 'dummy)
|
|
3115 (gnus-delete-line)
|
|
3116 (gnus-data-compute-positions))
|
|
3117 (setq thread (cdr thread))
|
|
3118 (while thread
|
|
3119 (gnus-remove-thread-1 (car thread))
|
|
3120 (setq thread (cdr thread))))
|
|
3121 (gnus-remove-thread-1 thread))))))))
|
|
3122
|
|
3123 (defun gnus-remove-thread-1 (thread)
|
|
3124 "Remove the thread THREAD recursively."
|
|
3125 (let ((number (mail-header-number (pop thread)))
|
|
3126 d)
|
|
3127 (setq thread (reverse thread))
|
|
3128 (while thread
|
|
3129 (gnus-remove-thread-1 (pop thread)))
|
|
3130 (when (setq d (gnus-data-find number))
|
|
3131 (goto-char (gnus-data-pos d))
|
|
3132 (gnus-data-remove
|
|
3133 number
|
|
3134 (- (gnus-point-at-bol)
|
|
3135 (prog1
|
|
3136 (1+ (gnus-point-at-eol))
|
|
3137 (gnus-delete-line)))))))
|
|
3138
|
|
3139 (defun gnus-sort-threads (threads)
|
|
3140 "Sort THREADS."
|
|
3141 (if (not gnus-thread-sort-functions)
|
|
3142 threads
|
|
3143 (gnus-message 7 "Sorting threads...")
|
|
3144 (prog1
|
|
3145 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
|
|
3146 (gnus-message 7 "Sorting threads...done"))))
|
|
3147
|
|
3148 (defun gnus-sort-articles (articles)
|
|
3149 "Sort ARTICLES."
|
|
3150 (when gnus-article-sort-functions
|
|
3151 (gnus-message 7 "Sorting articles...")
|
|
3152 (prog1
|
|
3153 (setq gnus-newsgroup-headers
|
|
3154 (sort articles (gnus-make-sort-function
|
|
3155 gnus-article-sort-functions)))
|
|
3156 (gnus-message 7 "Sorting articles...done"))))
|
|
3157
|
|
3158 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
|
|
3159 (defmacro gnus-thread-header (thread)
|
|
3160 ;; Return header of first article in THREAD.
|
|
3161 ;; Note that THREAD must never, ever be anything else than a variable -
|
|
3162 ;; using some other form will lead to serious barfage.
|
|
3163 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
|
|
3164 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
|
|
3165 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
|
|
3166 (vector thread) 2))
|
|
3167
|
|
3168 (defsubst gnus-article-sort-by-number (h1 h2)
|
|
3169 "Sort articles by article number."
|
|
3170 (< (mail-header-number h1)
|
|
3171 (mail-header-number h2)))
|
|
3172
|
|
3173 (defun gnus-thread-sort-by-number (h1 h2)
|
|
3174 "Sort threads by root article number."
|
|
3175 (gnus-article-sort-by-number
|
|
3176 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3177
|
|
3178 (defsubst gnus-article-sort-by-lines (h1 h2)
|
|
3179 "Sort articles by article Lines header."
|
|
3180 (< (mail-header-lines h1)
|
|
3181 (mail-header-lines h2)))
|
|
3182
|
|
3183 (defun gnus-thread-sort-by-lines (h1 h2)
|
|
3184 "Sort threads by root article Lines header."
|
|
3185 (gnus-article-sort-by-lines
|
|
3186 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3187
|
|
3188 (defsubst gnus-article-sort-by-author (h1 h2)
|
|
3189 "Sort articles by root author."
|
|
3190 (string-lessp
|
|
3191 (let ((extract (funcall
|
|
3192 gnus-extract-address-components
|
|
3193 (mail-header-from h1))))
|
|
3194 (or (car extract) (cdr extract)))
|
|
3195 (let ((extract (funcall
|
|
3196 gnus-extract-address-components
|
|
3197 (mail-header-from h2))))
|
|
3198 (or (car extract) (cdr extract)))))
|
|
3199
|
|
3200 (defun gnus-thread-sort-by-author (h1 h2)
|
|
3201 "Sort threads by root author."
|
|
3202 (gnus-article-sort-by-author
|
|
3203 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3204
|
|
3205 (defsubst gnus-article-sort-by-subject (h1 h2)
|
|
3206 "Sort articles by root subject."
|
|
3207 (string-lessp
|
|
3208 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
|
|
3209 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
|
|
3210
|
|
3211 (defun gnus-thread-sort-by-subject (h1 h2)
|
|
3212 "Sort threads by root subject."
|
|
3213 (gnus-article-sort-by-subject
|
|
3214 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3215
|
|
3216 (defsubst gnus-article-sort-by-date (h1 h2)
|
|
3217 "Sort articles by root article date."
|
|
3218 (gnus-time-less
|
|
3219 (gnus-date-get-time (mail-header-date h1))
|
|
3220 (gnus-date-get-time (mail-header-date h2))))
|
|
3221
|
|
3222 (defun gnus-thread-sort-by-date (h1 h2)
|
|
3223 "Sort threads by root article date."
|
|
3224 (gnus-article-sort-by-date
|
|
3225 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3226
|
|
3227 (defsubst gnus-article-sort-by-score (h1 h2)
|
|
3228 "Sort articles by root article score.
|
|
3229 Unscored articles will be counted as having a score of zero."
|
|
3230 (> (or (cdr (assq (mail-header-number h1)
|
|
3231 gnus-newsgroup-scored))
|
|
3232 gnus-summary-default-score 0)
|
|
3233 (or (cdr (assq (mail-header-number h2)
|
|
3234 gnus-newsgroup-scored))
|
|
3235 gnus-summary-default-score 0)))
|
|
3236
|
|
3237 (defun gnus-thread-sort-by-score (h1 h2)
|
|
3238 "Sort threads by root article score."
|
|
3239 (gnus-article-sort-by-score
|
|
3240 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3241
|
|
3242 (defun gnus-thread-sort-by-total-score (h1 h2)
|
|
3243 "Sort threads by the sum of all scores in the thread.
|
|
3244 Unscored articles will be counted as having a score of zero."
|
|
3245 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
|
|
3246
|
|
3247 (defun gnus-thread-total-score (thread)
|
|
3248 ;; This function find the total score of THREAD.
|
|
3249 (cond ((null thread)
|
|
3250 0)
|
|
3251 ((consp thread)
|
|
3252 (if (stringp (car thread))
|
|
3253 (apply gnus-thread-score-function 0
|
|
3254 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
|
|
3255 (gnus-thread-total-score-1 thread)))
|
|
3256 (t
|
|
3257 (gnus-thread-total-score-1 (list thread)))))
|
|
3258
|
|
3259 (defun gnus-thread-total-score-1 (root)
|
|
3260 ;; This function find the total score of the thread below ROOT.
|
|
3261 (setq root (car root))
|
|
3262 (apply gnus-thread-score-function
|
|
3263 (or (append
|
|
3264 (mapcar 'gnus-thread-total-score
|
|
3265 (cdr (gnus-gethash (mail-header-id root)
|
|
3266 gnus-newsgroup-dependencies)))
|
|
3267 (when (> (mail-header-number root) 0)
|
|
3268 (list (or (cdr (assq (mail-header-number root)
|
|
3269 gnus-newsgroup-scored))
|
|
3270 gnus-summary-default-score 0))))
|
|
3271 (list gnus-summary-default-score)
|
|
3272 '(0))))
|
|
3273
|
|
3274 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
3275 (defvar gnus-tmp-prev-subject nil)
|
|
3276 (defvar gnus-tmp-false-parent nil)
|
|
3277 (defvar gnus-tmp-root-expunged nil)
|
|
3278 (defvar gnus-tmp-dummy-line nil)
|
|
3279
|
|
3280 (defun gnus-summary-prepare-threads (threads)
|
|
3281 "Prepare summary buffer from THREADS and indentation LEVEL.
|
|
3282 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
|
|
3283 or a straight list of headers."
|
|
3284 (gnus-message 7 "Generating summary...")
|
|
3285
|
|
3286 (setq gnus-newsgroup-threads threads)
|
|
3287 (beginning-of-line)
|
|
3288
|
|
3289 (let ((gnus-tmp-level 0)
|
|
3290 (default-score (or gnus-summary-default-score 0))
|
|
3291 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
|
|
3292 thread number subject stack state gnus-tmp-gathered beg-match
|
|
3293 new-roots gnus-tmp-new-adopts thread-end
|
|
3294 gnus-tmp-header gnus-tmp-unread
|
|
3295 gnus-tmp-replied gnus-tmp-subject-or-nil
|
|
3296 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
|
|
3297 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
|
|
3298 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
|
|
3299
|
|
3300 (setq gnus-tmp-prev-subject nil)
|
|
3301
|
|
3302 (if (vectorp (car threads))
|
|
3303 ;; If this is a straight (sic) list of headers, then a
|
|
3304 ;; threaded summary display isn't required, so we just create
|
|
3305 ;; an unthreaded one.
|
|
3306 (gnus-summary-prepare-unthreaded threads)
|
|
3307
|
|
3308 ;; Do the threaded display.
|
|
3309
|
|
3310 (while (or threads stack gnus-tmp-new-adopts new-roots)
|
|
3311
|
|
3312 (if (and (= gnus-tmp-level 0)
|
|
3313 (not (setq gnus-tmp-dummy-line nil))
|
|
3314 (or (not stack)
|
|
3315 (= (caar stack) 0))
|
|
3316 (not gnus-tmp-false-parent)
|
|
3317 (or gnus-tmp-new-adopts new-roots))
|
|
3318 (if gnus-tmp-new-adopts
|
|
3319 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
|
|
3320 thread (list (car gnus-tmp-new-adopts))
|
|
3321 gnus-tmp-header (caar thread)
|
|
3322 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
|
|
3323 (when new-roots
|
|
3324 (setq thread (list (car new-roots))
|
|
3325 gnus-tmp-header (caar thread)
|
|
3326 new-roots (cdr new-roots))))
|
|
3327
|
|
3328 (if threads
|
|
3329 ;; If there are some threads, we do them before the
|
|
3330 ;; threads on the stack.
|
|
3331 (setq thread threads
|
|
3332 gnus-tmp-header (caar thread))
|
|
3333 ;; There were no current threads, so we pop something off
|
|
3334 ;; the stack.
|
|
3335 (setq state (car stack)
|
|
3336 gnus-tmp-level (car state)
|
|
3337 thread (cdr state)
|
|
3338 stack (cdr stack)
|
|
3339 gnus-tmp-header (caar thread))))
|
|
3340
|
|
3341 (setq gnus-tmp-false-parent nil)
|
|
3342 (setq gnus-tmp-root-expunged nil)
|
|
3343 (setq thread-end nil)
|
|
3344
|
|
3345 (if (stringp gnus-tmp-header)
|
|
3346 ;; The header is a dummy root.
|
|
3347 (cond
|
|
3348 ((eq gnus-summary-make-false-root 'adopt)
|
|
3349 ;; We let the first article adopt the rest.
|
|
3350 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
|
|
3351 (cddar thread)))
|
|
3352 (setq gnus-tmp-gathered
|
|
3353 (nconc (mapcar
|
|
3354 (lambda (h) (mail-header-number (car h)))
|
|
3355 (cddar thread))
|
|
3356 gnus-tmp-gathered))
|
|
3357 (setq thread (cons (list (caar thread)
|
|
3358 (cadar thread))
|
|
3359 (cdr thread)))
|
|
3360 (setq gnus-tmp-level -1
|
|
3361 gnus-tmp-false-parent t))
|
|
3362 ((eq gnus-summary-make-false-root 'empty)
|
|
3363 ;; We print adopted articles with empty subject fields.
|
|
3364 (setq gnus-tmp-gathered
|
|
3365 (nconc (mapcar
|
|
3366 (lambda (h) (mail-header-number (car h)))
|
|
3367 (cddar thread))
|
|
3368 gnus-tmp-gathered))
|
|
3369 (setq gnus-tmp-level -1))
|
|
3370 ((eq gnus-summary-make-false-root 'dummy)
|
|
3371 ;; We remember that we probably want to output a dummy
|
|
3372 ;; root.
|
|
3373 (setq gnus-tmp-dummy-line gnus-tmp-header)
|
|
3374 (setq gnus-tmp-prev-subject gnus-tmp-header))
|
|
3375 (t
|
|
3376 ;; We do not make a root for the gathered
|
|
3377 ;; sub-threads at all.
|
|
3378 (setq gnus-tmp-level -1)))
|
|
3379
|
|
3380 (setq number (mail-header-number gnus-tmp-header)
|
|
3381 subject (mail-header-subject gnus-tmp-header))
|
|
3382
|
|
3383 (cond
|
|
3384 ;; If the thread has changed subject, we might want to make
|
|
3385 ;; this subthread into a root.
|
|
3386 ((and (null gnus-thread-ignore-subject)
|
|
3387 (not (zerop gnus-tmp-level))
|
|
3388 gnus-tmp-prev-subject
|
|
3389 (not (inline
|
|
3390 (gnus-subject-equal gnus-tmp-prev-subject subject))))
|
|
3391 (setq new-roots (nconc new-roots (list (car thread)))
|
|
3392 thread-end t
|
|
3393 gnus-tmp-header nil))
|
|
3394 ;; If the article lies outside the current limit,
|
|
3395 ;; then we do not display it.
|
|
3396 ((not (memq number gnus-newsgroup-limit))
|
|
3397 (setq gnus-tmp-gathered
|
|
3398 (nconc (mapcar
|
|
3399 (lambda (h) (mail-header-number (car h)))
|
|
3400 (cdar thread))
|
|
3401 gnus-tmp-gathered))
|
|
3402 (setq gnus-tmp-new-adopts (if (cdar thread)
|
|
3403 (append gnus-tmp-new-adopts
|
|
3404 (cdar thread))
|
|
3405 gnus-tmp-new-adopts)
|
|
3406 thread-end t
|
|
3407 gnus-tmp-header nil)
|
|
3408 (when (zerop gnus-tmp-level)
|
|
3409 (setq gnus-tmp-root-expunged t)))
|
|
3410 ;; Perhaps this article is to be marked as read?
|
|
3411 ((and gnus-summary-mark-below
|
|
3412 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3413 default-score)
|
|
3414 gnus-summary-mark-below)
|
|
3415 ;; Don't touch sparse articles.
|
|
3416 (not (gnus-summary-article-sparse-p number))
|
|
3417 (not (gnus-summary-article-ancient-p number)))
|
|
3418 (setq gnus-newsgroup-unreads
|
|
3419 (delq number gnus-newsgroup-unreads))
|
|
3420 (if gnus-newsgroup-auto-expire
|
|
3421 (push number gnus-newsgroup-expirable)
|
|
3422 (push (cons number gnus-low-score-mark)
|
|
3423 gnus-newsgroup-reads))))
|
|
3424
|
|
3425 (when gnus-tmp-header
|
|
3426 ;; We may have an old dummy line to output before this
|
|
3427 ;; article.
|
|
3428 (when gnus-tmp-dummy-line
|
|
3429 (gnus-summary-insert-dummy-line
|
|
3430 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
|
|
3431 (setq gnus-tmp-dummy-line nil))
|
|
3432
|
|
3433 ;; Compute the mark.
|
|
3434 (setq gnus-tmp-unread (gnus-article-mark number))
|
|
3435
|
|
3436 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
|
|
3437 gnus-tmp-header gnus-tmp-level)
|
|
3438 gnus-newsgroup-data)
|
|
3439
|
|
3440 ;; Actually insert the line.
|
|
3441 (setq
|
|
3442 gnus-tmp-subject-or-nil
|
|
3443 (cond
|
|
3444 ((and gnus-thread-ignore-subject
|
|
3445 gnus-tmp-prev-subject
|
|
3446 (not (inline (gnus-subject-equal
|
|
3447 gnus-tmp-prev-subject subject))))
|
|
3448 subject)
|
|
3449 ((zerop gnus-tmp-level)
|
|
3450 (if (and (eq gnus-summary-make-false-root 'empty)
|
|
3451 (memq number gnus-tmp-gathered)
|
|
3452 gnus-tmp-prev-subject
|
|
3453 (inline (gnus-subject-equal
|
|
3454 gnus-tmp-prev-subject subject)))
|
|
3455 gnus-summary-same-subject
|
|
3456 subject))
|
|
3457 (t gnus-summary-same-subject)))
|
|
3458 (if (and (eq gnus-summary-make-false-root 'adopt)
|
|
3459 (= gnus-tmp-level 1)
|
|
3460 (memq number gnus-tmp-gathered))
|
|
3461 (setq gnus-tmp-opening-bracket ?\<
|
|
3462 gnus-tmp-closing-bracket ?\>)
|
|
3463 (setq gnus-tmp-opening-bracket ?\[
|
|
3464 gnus-tmp-closing-bracket ?\]))
|
|
3465 (setq
|
|
3466 gnus-tmp-indentation
|
|
3467 (aref gnus-thread-indent-array gnus-tmp-level)
|
|
3468 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
|
|
3469 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
|
|
3470 gnus-summary-default-score 0)
|
|
3471 gnus-tmp-score-char
|
|
3472 (if (or (null gnus-summary-default-score)
|
|
3473 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
3474 gnus-summary-zcore-fuzz))
|
|
3475 ?
|
|
3476 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
3477 gnus-score-below-mark gnus-score-over-mark))
|
|
3478 gnus-tmp-replied
|
|
3479 (cond ((memq number gnus-newsgroup-processable)
|
|
3480 gnus-process-mark)
|
|
3481 ((memq number gnus-newsgroup-cached)
|
|
3482 gnus-cached-mark)
|
|
3483 ((memq number gnus-newsgroup-replied)
|
|
3484 gnus-replied-mark)
|
|
3485 ((memq number gnus-newsgroup-saved)
|
|
3486 gnus-saved-mark)
|
|
3487 (t gnus-unread-mark))
|
|
3488 gnus-tmp-from (mail-header-from gnus-tmp-header)
|
|
3489 gnus-tmp-name
|
|
3490 (cond
|
|
3491 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
3492 (setq beg-match (match-beginning 0))
|
|
3493 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
3494 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
3495 (1- (match-end 0))))
|
|
3496 (substring gnus-tmp-from 0 beg-match)))
|
|
3497 ((string-match "(.+)" gnus-tmp-from)
|
|
3498 (substring gnus-tmp-from
|
|
3499 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
3500 (t gnus-tmp-from)))
|
|
3501 (when (string= gnus-tmp-name "")
|
|
3502 (setq gnus-tmp-name gnus-tmp-from))
|
|
3503 (unless (numberp gnus-tmp-lines)
|
|
3504 (setq gnus-tmp-lines 0))
|
|
3505 (gnus-put-text-property
|
|
3506 (point)
|
|
3507 (progn (eval gnus-summary-line-format-spec) (point))
|
|
3508 'gnus-number number)
|
|
3509 (when gnus-visual-p
|
|
3510 (forward-line -1)
|
|
3511 (run-hooks 'gnus-summary-update-hook)
|
|
3512 (forward-line 1))
|
|
3513
|
|
3514 (setq gnus-tmp-prev-subject subject)))
|
|
3515
|
|
3516 (when (nth 1 thread)
|
|
3517 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
|
|
3518 (incf gnus-tmp-level)
|
|
3519 (setq threads (if thread-end nil (cdar thread)))
|
|
3520 (unless threads
|
|
3521 (setq gnus-tmp-level 0)))))
|
|
3522 (gnus-message 7 "Generating summary...done"))
|
|
3523
|
|
3524 (defun gnus-summary-prepare-unthreaded (headers)
|
|
3525 "Generate an unthreaded summary buffer based on HEADERS."
|
|
3526 (let (header number mark)
|
|
3527
|
|
3528 (beginning-of-line)
|
|
3529
|
|
3530 (while headers
|
|
3531 ;; We may have to root out some bad articles...
|
|
3532 (when (memq (setq number (mail-header-number
|
|
3533 (setq header (pop headers))))
|
|
3534 gnus-newsgroup-limit)
|
|
3535 ;; Mark article as read when it has a low score.
|
|
3536 (when (and gnus-summary-mark-below
|
|
3537 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3538 gnus-summary-default-score 0)
|
|
3539 gnus-summary-mark-below)
|
|
3540 (not (gnus-summary-article-ancient-p number)))
|
|
3541 (setq gnus-newsgroup-unreads
|
|
3542 (delq number gnus-newsgroup-unreads))
|
|
3543 (if gnus-newsgroup-auto-expire
|
|
3544 (push number gnus-newsgroup-expirable)
|
|
3545 (push (cons number gnus-low-score-mark)
|
|
3546 gnus-newsgroup-reads)))
|
|
3547
|
|
3548 (setq mark (gnus-article-mark number))
|
|
3549 (push (gnus-data-make number mark (1+ (point)) header 0)
|
|
3550 gnus-newsgroup-data)
|
|
3551 (gnus-summary-insert-line
|
|
3552 header 0 number
|
|
3553 mark (memq number gnus-newsgroup-replied)
|
|
3554 (memq number gnus-newsgroup-expirable)
|
|
3555 (mail-header-subject header) nil
|
|
3556 (cdr (assq number gnus-newsgroup-scored))
|
|
3557 (memq number gnus-newsgroup-processable))))))
|
|
3558
|
|
3559 (defun gnus-select-newsgroup (group &optional read-all)
|
|
3560 "Select newsgroup GROUP.
|
|
3561 If READ-ALL is non-nil, all articles in the group are selected."
|
|
3562 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
3563 (info (nth 2 entry))
|
|
3564 articles fetched-articles cached)
|
|
3565
|
|
3566 (unless (gnus-check-server
|
|
3567 (setq gnus-current-select-method
|
|
3568 (gnus-find-method-for-group group)))
|
|
3569 (error "Couldn't open server"))
|
|
3570
|
|
3571 (or (and entry (not (eq (car entry) t))) ; Either it's active...
|
|
3572 (gnus-activate-group group) ; Or we can activate it...
|
|
3573 (progn ; Or we bug out.
|
|
3574 (when (equal major-mode 'gnus-summary-mode)
|
|
3575 (kill-buffer (current-buffer)))
|
|
3576 (error "Couldn't request group %s: %s"
|
|
3577 group (gnus-status-message group))))
|
|
3578
|
|
3579 (unless (gnus-request-group group t)
|
|
3580 (when (equal major-mode 'gnus-summary-mode)
|
|
3581 (kill-buffer (current-buffer)))
|
|
3582 (error "Couldn't request group %s: %s"
|
|
3583 group (gnus-status-message group)))
|
|
3584
|
|
3585 (setq gnus-newsgroup-name group)
|
|
3586 (setq gnus-newsgroup-unselected nil)
|
|
3587 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
|
|
3588
|
|
3589 ;; Adjust and set lists of article marks.
|
|
3590 (when info
|
|
3591 (gnus-adjust-marked-articles info))
|
|
3592
|
|
3593 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3594 (when (gnus-virtual-group-p group)
|
|
3595 (setq cached gnus-newsgroup-cached))
|
|
3596
|
|
3597 (setq gnus-newsgroup-unreads
|
|
3598 (gnus-set-difference
|
|
3599 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
|
|
3600 gnus-newsgroup-dormant))
|
|
3601
|
|
3602 (setq gnus-newsgroup-processable nil)
|
|
3603
|
|
3604 (gnus-update-read-articles group gnus-newsgroup-unreads)
|
|
3605 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
3606 (gnus-group-update-group group))
|
|
3607
|
|
3608 (setq articles (gnus-articles-to-read group read-all))
|
|
3609
|
|
3610 (cond
|
|
3611 ((null articles)
|
|
3612 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
|
|
3613 'quit)
|
|
3614 ((eq articles 0) nil)
|
|
3615 (t
|
|
3616 ;; Init the dependencies hash table.
|
|
3617 (setq gnus-newsgroup-dependencies
|
|
3618 (gnus-make-hashtable (length articles)))
|
|
3619 ;; Retrieve the headers and read them in.
|
|
3620 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
|
|
3621 (setq gnus-newsgroup-headers
|
|
3622 (if (eq 'nov
|
|
3623 (setq gnus-headers-retrieved-by
|
|
3624 (gnus-retrieve-headers
|
|
3625 articles gnus-newsgroup-name
|
|
3626 ;; We might want to fetch old headers, but
|
|
3627 ;; not if there is only 1 article.
|
|
3628 (and gnus-fetch-old-headers
|
|
3629 (or (and
|
|
3630 (not (eq gnus-fetch-old-headers 'some))
|
|
3631 (not (numberp gnus-fetch-old-headers)))
|
|
3632 (> (length articles) 1))))))
|
|
3633 (gnus-get-newsgroup-headers-xover
|
|
3634 articles nil nil gnus-newsgroup-name t)
|
|
3635 (gnus-get-newsgroup-headers)))
|
|
3636 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
|
|
3637
|
|
3638 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3639 (when cached
|
|
3640 (setq gnus-newsgroup-cached cached))
|
|
3641
|
|
3642 ;; Suppress duplicates?
|
|
3643 (when gnus-suppress-duplicates
|
|
3644 (gnus-dup-suppress-articles))
|
|
3645
|
|
3646 ;; Set the initial limit.
|
|
3647 (setq gnus-newsgroup-limit (copy-sequence articles))
|
|
3648 ;; Remove canceled articles from the list of unread articles.
|
|
3649 (setq gnus-newsgroup-unreads
|
|
3650 (gnus-set-sorted-intersection
|
|
3651 gnus-newsgroup-unreads
|
|
3652 (setq fetched-articles
|
|
3653 (mapcar (lambda (headers) (mail-header-number headers))
|
|
3654 gnus-newsgroup-headers))))
|
|
3655 ;; Removed marked articles that do not exist.
|
|
3656 (gnus-update-missing-marks
|
|
3657 (gnus-sorted-complement fetched-articles articles))
|
|
3658 ;; We might want to build some more threads first.
|
|
3659 (and gnus-fetch-old-headers
|
|
3660 (eq gnus-headers-retrieved-by 'nov)
|
|
3661 (gnus-build-old-threads))
|
|
3662 ;; Check whether auto-expire is to be done in this group.
|
|
3663 (setq gnus-newsgroup-auto-expire
|
|
3664 (gnus-group-auto-expirable-p group))
|
|
3665 ;; Set up the article buffer now, if necessary.
|
|
3666 (unless gnus-single-article-buffer
|
|
3667 (gnus-article-setup-buffer))
|
|
3668 ;; First and last article in this newsgroup.
|
|
3669 (when gnus-newsgroup-headers
|
|
3670 (setq gnus-newsgroup-begin
|
|
3671 (mail-header-number (car gnus-newsgroup-headers))
|
|
3672 gnus-newsgroup-end
|
|
3673 (mail-header-number
|
|
3674 (gnus-last-element gnus-newsgroup-headers))))
|
|
3675 ;; GROUP is successfully selected.
|
|
3676 (or gnus-newsgroup-headers t)))))
|
|
3677
|
|
3678 (defun gnus-articles-to-read (group &optional read-all)
|
|
3679 ;; Find out what articles the user wants to read.
|
|
3680 (let* ((articles
|
|
3681 ;; Select all articles if `read-all' is non-nil, or if there
|
|
3682 ;; are no unread articles.
|
|
3683 (if (or read-all
|
|
3684 (and (zerop (length gnus-newsgroup-marked))
|
|
3685 (zerop (length gnus-newsgroup-unreads)))
|
|
3686 (eq (gnus-group-find-parameter group 'display)
|
|
3687 'all))
|
|
3688 (gnus-uncompress-range (gnus-active group))
|
|
3689 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
|
|
3690 (copy-sequence gnus-newsgroup-unreads))
|
|
3691 '<)))
|
|
3692 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
|
|
3693 (scored (length scored-list))
|
|
3694 (number (length articles))
|
|
3695 (marked (+ (length gnus-newsgroup-marked)
|
|
3696 (length gnus-newsgroup-dormant)))
|
|
3697 (select
|
|
3698 (cond
|
|
3699 ((numberp read-all)
|
|
3700 read-all)
|
|
3701 (t
|
|
3702 (condition-case ()
|
|
3703 (cond
|
|
3704 ((and (or (<= scored marked) (= scored number))
|
|
3705 (numberp gnus-large-newsgroup)
|
|
3706 (> number gnus-large-newsgroup))
|
|
3707 (let ((input
|
|
3708 (read-string
|
|
3709 (format
|
|
3710 "How many articles from %s (default %d): "
|
|
3711 (gnus-limit-string gnus-newsgroup-name 35)
|
|
3712 number))))
|
|
3713 (if (string-match "^[ \t]*$" input) number input)))
|
|
3714 ((and (> scored marked) (< scored number)
|
|
3715 (> (- scored number) 20))
|
|
3716 (let ((input
|
|
3717 (read-string
|
|
3718 (format "%s %s (%d scored, %d total): "
|
|
3719 "How many articles from"
|
|
3720 group scored number))))
|
|
3721 (if (string-match "^[ \t]*$" input)
|
|
3722 number input)))
|
|
3723 (t number))
|
|
3724 (quit nil))))))
|
|
3725 (setq select (if (stringp select) (string-to-number select) select))
|
|
3726 (if (or (null select) (zerop select))
|
|
3727 select
|
|
3728 (if (and (not (zerop scored)) (<= (abs select) scored))
|
|
3729 (progn
|
|
3730 (setq articles (sort scored-list '<))
|
|
3731 (setq number (length articles)))
|
|
3732 (setq articles (copy-sequence articles)))
|
|
3733
|
|
3734 (when (< (abs select) number)
|
|
3735 (if (< select 0)
|
|
3736 ;; Select the N oldest articles.
|
|
3737 (setcdr (nthcdr (1- (abs select)) articles) nil)
|
|
3738 ;; Select the N most recent articles.
|
|
3739 (setq articles (nthcdr (- number select) articles))))
|
|
3740 (setq gnus-newsgroup-unselected
|
|
3741 (gnus-sorted-intersection
|
|
3742 gnus-newsgroup-unreads
|
|
3743 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
|
|
3744 articles)))
|
|
3745
|
|
3746 (defun gnus-killed-articles (killed articles)
|
|
3747 (let (out)
|
|
3748 (while articles
|
|
3749 (when (inline (gnus-member-of-range (car articles) killed))
|
|
3750 (push (car articles) out))
|
|
3751 (setq articles (cdr articles)))
|
|
3752 out))
|
|
3753
|
|
3754 (defun gnus-uncompress-marks (marks)
|
|
3755 "Uncompress the mark ranges in MARKS."
|
|
3756 (let ((uncompressed '(score bookmark))
|
|
3757 out)
|
|
3758 (while marks
|
|
3759 (if (memq (caar marks) uncompressed)
|
|
3760 (push (car marks) out)
|
|
3761 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
|
|
3762 (setq marks (cdr marks)))
|
|
3763 out))
|
|
3764
|
|
3765 (defun gnus-adjust-marked-articles (info)
|
|
3766 "Set all article lists and remove all marks that are no longer legal."
|
|
3767 (let* ((marked-lists (gnus-info-marks info))
|
|
3768 (active (gnus-active (gnus-info-group info)))
|
|
3769 (min (car active))
|
|
3770 (max (cdr active))
|
|
3771 (types gnus-article-mark-lists)
|
|
3772 (uncompressed '(score bookmark killed))
|
|
3773 marks var articles article mark)
|
|
3774
|
|
3775 (while marked-lists
|
|
3776 (setq marks (pop marked-lists))
|
|
3777 (set (setq var (intern (format "gnus-newsgroup-%s"
|
|
3778 (car (rassq (setq mark (car marks))
|
|
3779 types)))))
|
|
3780 (if (memq (car marks) uncompressed) (cdr marks)
|
|
3781 (gnus-uncompress-range (cdr marks))))
|
|
3782
|
|
3783 (setq articles (symbol-value var))
|
|
3784
|
|
3785 ;; All articles have to be subsets of the active articles.
|
|
3786 (cond
|
|
3787 ;; Adjust "simple" lists.
|
|
3788 ((memq mark '(tick dormant expirable reply save))
|
|
3789 (while articles
|
|
3790 (when (or (< (setq article (pop articles)) min) (> article max))
|
|
3791 (set var (delq article (symbol-value var))))))
|
|
3792 ;; Adjust assocs.
|
|
3793 ((memq mark uncompressed)
|
|
3794 (while articles
|
|
3795 (when (or (not (consp (setq article (pop articles))))
|
|
3796 (< (car article) min)
|
|
3797 (> (car article) max))
|
|
3798 (set var (delq article (symbol-value var))))))))))
|
|
3799
|
|
3800 (defun gnus-update-missing-marks (missing)
|
|
3801 "Go through the list of MISSING articles and remove them mark lists."
|
|
3802 (when missing
|
|
3803 (let ((types gnus-article-mark-lists)
|
|
3804 var m)
|
|
3805 ;; Go through all types.
|
|
3806 (while types
|
|
3807 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
|
|
3808 (when (symbol-value var)
|
|
3809 ;; This list has articles. So we delete all missing articles
|
|
3810 ;; from it.
|
|
3811 (setq m missing)
|
|
3812 (while m
|
|
3813 (set var (delq (pop m) (symbol-value var)))))))))
|
|
3814
|
|
3815 (defun gnus-update-marks ()
|
|
3816 "Enter the various lists of marked articles into the newsgroup info list."
|
|
3817 (let ((types gnus-article-mark-lists)
|
|
3818 (info (gnus-get-info gnus-newsgroup-name))
|
|
3819 (uncompressed '(score bookmark killed))
|
|
3820 type list newmarked symbol)
|
|
3821 (when info
|
|
3822 ;; Add all marks lists that are non-nil to the list of marks lists.
|
|
3823 (while types
|
|
3824 (setq type (pop types))
|
|
3825 (when (setq list (symbol-value
|
|
3826 (setq symbol
|
|
3827 (intern (format "gnus-newsgroup-%s"
|
|
3828 (car type))))))
|
|
3829 (push (cons (cdr type)
|
|
3830 (if (memq (cdr type) uncompressed) list
|
|
3831 (gnus-compress-sequence
|
|
3832 (set symbol (sort list '<)) t)))
|
|
3833 newmarked)))
|
|
3834
|
|
3835 ;; Enter these new marks into the info of the group.
|
|
3836 (if (nthcdr 3 info)
|
|
3837 (setcar (nthcdr 3 info) newmarked)
|
|
3838 ;; Add the marks lists to the end of the info.
|
|
3839 (when newmarked
|
|
3840 (setcdr (nthcdr 2 info) (list newmarked))))
|
|
3841
|
|
3842 ;; Cut off the end of the info if there's nothing else there.
|
|
3843 (let ((i 5))
|
|
3844 (while (and (> i 2)
|
|
3845 (not (nth i info)))
|
|
3846 (when (nthcdr (decf i) info)
|
|
3847 (setcdr (nthcdr i info) nil)))))))
|
|
3848
|
|
3849 (defun gnus-set-mode-line (where)
|
|
3850 "This function sets the mode line of the article or summary buffers.
|
|
3851 If WHERE is `summary', the summary mode line format will be used."
|
|
3852 ;; Is this mode line one we keep updated?
|
|
3853 (when (memq where gnus-updated-mode-lines)
|
|
3854 (let (mode-string)
|
|
3855 (save-excursion
|
|
3856 ;; We evaluate this in the summary buffer since these
|
|
3857 ;; variables are buffer-local to that buffer.
|
|
3858 (set-buffer gnus-summary-buffer)
|
|
3859 ;; We bind all these variables that are used in the `eval' form
|
|
3860 ;; below.
|
|
3861 (let* ((mformat (symbol-value
|
|
3862 (intern
|
|
3863 (format "gnus-%s-mode-line-format-spec" where))))
|
|
3864 (gnus-tmp-group-name gnus-newsgroup-name)
|
|
3865 (gnus-tmp-article-number (or gnus-current-article 0))
|
|
3866 (gnus-tmp-unread gnus-newsgroup-unreads)
|
|
3867 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
|
|
3868 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
|
|
3869 (gnus-tmp-unread-and-unselected
|
|
3870 (cond ((and (zerop gnus-tmp-unread-and-unticked)
|
|
3871 (zerop gnus-tmp-unselected))
|
|
3872 "")
|
|
3873 ((zerop gnus-tmp-unselected)
|
|
3874 (format "{%d more}" gnus-tmp-unread-and-unticked))
|
|
3875 (t (format "{%d(+%d) more}"
|
|
3876 gnus-tmp-unread-and-unticked
|
|
3877 gnus-tmp-unselected))))
|
|
3878 (gnus-tmp-subject
|
|
3879 (if (and gnus-current-headers
|
|
3880 (vectorp gnus-current-headers))
|
|
3881 (gnus-mode-string-quote
|
|
3882 (mail-header-subject gnus-current-headers))
|
|
3883 ""))
|
104
|
3884 bufname-length max-len
|
98
|
3885 gnus-tmp-header);; passed as argument to any user-format-funcs
|
|
3886 (setq mode-string (eval mformat))
|
104
|
3887 (setq bufname-length (if (string-match "%b" mode-string)
|
|
3888 (- (length
|
|
3889 (buffer-name
|
|
3890 (if (eq where 'summary)
|
|
3891 nil
|
|
3892 (get-buffer gnus-article-buffer))))
|
|
3893 2)
|
|
3894 0))
|
98
|
3895 (setq max-len (max 4 (if gnus-mode-non-string-length
|
|
3896 (- (window-width)
|
104
|
3897 gnus-mode-non-string-length
|
|
3898 bufname-length)
|
98
|
3899 (length mode-string))))
|
|
3900 ;; We might have to chop a bit of the string off...
|
|
3901 (when (> (length mode-string) max-len)
|
|
3902 (setq mode-string
|
|
3903 (concat (gnus-truncate-string mode-string (- max-len 3))
|
|
3904 "...")))
|
|
3905 ;; Pad the mode string a bit.
|
|
3906 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
|
|
3907 ;; Update the mode line.
|
|
3908 (setq mode-line-buffer-identification
|
100
|
3909 (gnus-mode-line-buffer-identification (list mode-string)))
|
98
|
3910 (set-buffer-modified-p t))))
|
|
3911
|
|
3912 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
|
|
3913 "Go through the HEADERS list and add all Xrefs to a hash table.
|
|
3914 The resulting hash table is returned, or nil if no Xrefs were found."
|
|
3915 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3916 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
|
|
3917 (xref-hashtb (gnus-make-hashtable))
|
|
3918 start group entry number xrefs header)
|
|
3919 (while headers
|
|
3920 (setq header (pop headers))
|
|
3921 (when (and (setq xrefs (mail-header-xref header))
|
|
3922 (not (memq (setq number (mail-header-number header))
|
|
3923 unreads)))
|
|
3924 (setq start 0)
|
|
3925 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
|
|
3926 (setq start (match-end 0))
|
|
3927 (setq group (if prefix
|
|
3928 (concat prefix (substring xrefs (match-beginning 1)
|
|
3929 (match-end 1)))
|
|
3930 (substring xrefs (match-beginning 1) (match-end 1))))
|
|
3931 (setq number
|
|
3932 (string-to-int (substring xrefs (match-beginning 2)
|
|
3933 (match-end 2))))
|
|
3934 (if (setq entry (gnus-gethash group xref-hashtb))
|
|
3935 (setcdr entry (cons number (cdr entry)))
|
|
3936 (gnus-sethash group (cons number nil) xref-hashtb)))))
|
|
3937 (and start xref-hashtb)))
|
|
3938
|
|
3939 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
|
|
3940 "Look through all the headers and mark the Xrefs as read."
|
|
3941 (let ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3942 name entry info xref-hashtb idlist method nth4)
|
|
3943 (save-excursion
|
|
3944 (set-buffer gnus-group-buffer)
|
|
3945 (when (setq xref-hashtb
|
|
3946 (gnus-create-xref-hashtb from-newsgroup headers unreads))
|
|
3947 (mapatoms
|
|
3948 (lambda (group)
|
|
3949 (unless (string= from-newsgroup (setq name (symbol-name group)))
|
|
3950 (setq idlist (symbol-value group))
|
|
3951 ;; Dead groups are not updated.
|
|
3952 (and (prog1
|
|
3953 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
|
|
3954 info (nth 2 entry))
|
|
3955 (when (stringp (setq nth4 (gnus-info-method info)))
|
|
3956 (setq nth4 (gnus-server-to-method nth4))))
|
|
3957 ;; Only do the xrefs if the group has the same
|
|
3958 ;; select method as the group we have just read.
|
|
3959 (or (gnus-methods-equal-p
|
|
3960 nth4 (gnus-find-method-for-group from-newsgroup))
|
|
3961 virtual
|
|
3962 (equal nth4 (setq method (gnus-find-method-for-group
|
|
3963 from-newsgroup)))
|
|
3964 (and (equal (car nth4) (car method))
|
|
3965 (equal (nth 1 nth4) (nth 1 method))))
|
|
3966 gnus-use-cross-reference
|
|
3967 (or (not (eq gnus-use-cross-reference t))
|
|
3968 virtual
|
|
3969 ;; Only do cross-references on subscribed
|
|
3970 ;; groups, if that is what is wanted.
|
|
3971 (<= (gnus-info-level info) gnus-level-subscribed))
|
|
3972 (gnus-group-make-articles-read name idlist))))
|
|
3973 xref-hashtb)))))
|
|
3974
|
|
3975 (defun gnus-group-make-articles-read (group articles)
|
|
3976 "Update the info of GROUP to say that only ARTICLES are unread."
|
|
3977 (let* ((num 0)
|
|
3978 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
3979 (info (nth 2 entry))
|
|
3980 (active (gnus-active group))
|
|
3981 range)
|
|
3982 ;; First peel off all illegal article numbers.
|
|
3983 (when active
|
|
3984 (let ((ids articles)
|
|
3985 id first)
|
|
3986 (while (setq id (pop ids))
|
|
3987 (when (and first (> id (cdr active)))
|
|
3988 ;; We'll end up in this situation in one particular
|
|
3989 ;; obscure situation. If you re-scan a group and get
|
|
3990 ;; a new article that is cross-posted to a different
|
|
3991 ;; group that has not been re-scanned, you might get
|
|
3992 ;; crossposted article that has a higher number than
|
|
3993 ;; Gnus believes possible. So we re-activate this
|
|
3994 ;; group as well. This might mean doing the
|
|
3995 ;; crossposting thingy will *increase* the number
|
|
3996 ;; of articles in some groups. Tsk, tsk.
|
|
3997 (setq active (or (gnus-activate-group group) active)))
|
|
3998 (when (or (> id (cdr active))
|
|
3999 (< id (car active)))
|
|
4000 (setq articles (delq id articles))))))
|
|
4001 (save-excursion
|
|
4002 (set-buffer gnus-group-buffer)
|
|
4003 (gnus-undo-register
|
|
4004 `(progn
|
|
4005 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
4006 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
4007 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
4008 (gnus-group-update-group ,group t))))
|
|
4009 ;; If the read list is nil, we init it.
|
|
4010 (and active
|
|
4011 (null (gnus-info-read info))
|
|
4012 (> (car active) 1)
|
|
4013 (gnus-info-set-read info (cons 1 (1- (car active)))))
|
|
4014 ;; Then we add the read articles to the range.
|
|
4015 (gnus-info-set-read
|
|
4016 info
|
|
4017 (setq range
|
|
4018 (gnus-add-to-range
|
|
4019 (gnus-info-read info) (setq articles (sort articles '<)))))
|
|
4020 ;; Then we have to re-compute how many unread
|
|
4021 ;; articles there are in this group.
|
|
4022 (when active
|
|
4023 (cond
|
|
4024 ((not range)
|
|
4025 (setq num (- (1+ (cdr active)) (car active))))
|
|
4026 ((not (listp (cdr range)))
|
|
4027 (setq num (- (cdr active) (- (1+ (cdr range))
|
|
4028 (car range)))))
|
|
4029 (t
|
|
4030 (while range
|
|
4031 (if (numberp (car range))
|
|
4032 (setq num (1+ num))
|
|
4033 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
|
|
4034 (setq range (cdr range)))
|
|
4035 (setq num (- (cdr active) num))))
|
|
4036 ;; Update the number of unread articles.
|
|
4037 (setcar entry num)
|
|
4038 ;; Update the group buffer.
|
|
4039 (gnus-group-update-group group t))))
|
|
4040
|
|
4041 (defun gnus-methods-equal-p (m1 m2)
|
|
4042 (let ((m1 (or m1 gnus-select-method))
|
|
4043 (m2 (or m2 gnus-select-method)))
|
|
4044 (or (equal m1 m2)
|
|
4045 (and (eq (car m1) (car m2))
|
|
4046 (or (not (memq 'address (assoc (symbol-name (car m1))
|
|
4047 gnus-valid-select-methods)))
|
|
4048 (equal (nth 1 m1) (nth 1 m2)))))))
|
|
4049
|
|
4050 (defvar gnus-newsgroup-none-id 0)
|
|
4051
|
|
4052 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
|
|
4053 (let ((cur nntp-server-buffer)
|
|
4054 (dependencies
|
|
4055 (or dependencies
|
|
4056 (save-excursion (set-buffer gnus-summary-buffer)
|
|
4057 gnus-newsgroup-dependencies)))
|
|
4058 headers id id-dep ref-dep end ref)
|
|
4059 (save-excursion
|
|
4060 (set-buffer nntp-server-buffer)
|
|
4061 ;; Translate all TAB characters into SPACE characters.
|
|
4062 (subst-char-in-region (point-min) (point-max) ?\t ? t)
|
|
4063 (run-hooks 'gnus-parse-headers-hook)
|
|
4064 (let ((case-fold-search t)
|
|
4065 in-reply-to header p lines)
|
|
4066 (goto-char (point-min))
|
|
4067 ;; Search to the beginning of the next header. Error messages
|
|
4068 ;; do not begin with 2 or 3.
|
|
4069 (while (re-search-forward "^[23][0-9]+ " nil t)
|
|
4070 (setq id nil
|
|
4071 ref nil)
|
|
4072 ;; This implementation of this function, with nine
|
|
4073 ;; search-forwards instead of the one re-search-forward and
|
|
4074 ;; a case (which basically was the old function) is actually
|
|
4075 ;; about twice as fast, even though it looks messier. You
|
|
4076 ;; can't have everything, I guess. Speed and elegance
|
|
4077 ;; doesn't always go hand in hand.
|
|
4078 (setq
|
|
4079 header
|
|
4080 (vector
|
|
4081 ;; Number.
|
|
4082 (prog1
|
|
4083 (read cur)
|
|
4084 (end-of-line)
|
|
4085 (setq p (point))
|
|
4086 (narrow-to-region (point)
|
|
4087 (or (and (search-forward "\n.\n" nil t)
|
|
4088 (- (point) 2))
|
|
4089 (point))))
|
|
4090 ;; Subject.
|
|
4091 (progn
|
|
4092 (goto-char p)
|
|
4093 (if (search-forward "\nsubject: " nil t)
|
|
4094 (nnheader-header-value) "(none)"))
|
|
4095 ;; From.
|
|
4096 (progn
|
|
4097 (goto-char p)
|
|
4098 (if (search-forward "\nfrom: " nil t)
|
|
4099 (nnheader-header-value) "(nobody)"))
|
|
4100 ;; Date.
|
|
4101 (progn
|
|
4102 (goto-char p)
|
|
4103 (if (search-forward "\ndate: " nil t)
|
|
4104 (nnheader-header-value) ""))
|
|
4105 ;; Message-ID.
|
|
4106 (progn
|
|
4107 (goto-char p)
|
|
4108 (setq id (if (search-forward "\nmessage-id: " nil t)
|
|
4109 (nnheader-header-value)
|
|
4110 ;; If there was no message-id, we just fake one
|
|
4111 ;; to make subsequent routines simpler.
|
|
4112 (nnheader-generate-fake-message-id))))
|
|
4113 ;; References.
|
|
4114 (progn
|
|
4115 (goto-char p)
|
|
4116 (if (search-forward "\nreferences: " nil t)
|
|
4117 (progn
|
|
4118 (setq end (point))
|
|
4119 (prog1
|
|
4120 (nnheader-header-value)
|
|
4121 (setq ref
|
|
4122 (buffer-substring
|
|
4123 (progn
|
|
4124 (end-of-line)
|
|
4125 (search-backward ">" end t)
|
|
4126 (1+ (point)))
|
|
4127 (progn
|
|
4128 (search-backward "<" end t)
|
|
4129 (point))))))
|
|
4130 ;; Get the references from the in-reply-to header if there
|
|
4131 ;; were no references and the in-reply-to header looks
|
|
4132 ;; promising.
|
|
4133 (if (and (search-forward "\nin-reply-to: " nil t)
|
|
4134 (setq in-reply-to (nnheader-header-value))
|
|
4135 (string-match "<[^>]+>" in-reply-to))
|
|
4136 (setq ref (substring in-reply-to (match-beginning 0)
|
|
4137 (match-end 0)))
|
|
4138 (setq ref nil))))
|
|
4139 ;; Chars.
|
|
4140 0
|
|
4141 ;; Lines.
|
|
4142 (progn
|
|
4143 (goto-char p)
|
|
4144 (if (search-forward "\nlines: " nil t)
|
|
4145 (if (numberp (setq lines (read cur)))
|
|
4146 lines 0)
|
|
4147 0))
|
|
4148 ;; Xref.
|
|
4149 (progn
|
|
4150 (goto-char p)
|
|
4151 (and (search-forward "\nxref: " nil t)
|
|
4152 (nnheader-header-value)))))
|
|
4153 (when (equal id ref)
|
|
4154 (setq ref nil))
|
|
4155 ;; We do the threading while we read the headers. The
|
|
4156 ;; message-id and the last reference are both entered into
|
|
4157 ;; the same hash table. Some tippy-toeing around has to be
|
|
4158 ;; done in case an article has arrived before the article
|
|
4159 ;; which it refers to.
|
|
4160 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4161 (if (and (car (symbol-value id-dep))
|
|
4162 (not force-new))
|
|
4163 ;; An article with this Message-ID has already
|
|
4164 ;; been seen, so we ignore this one, except we add
|
|
4165 ;; any additional Xrefs (in case the two articles
|
|
4166 ;; came from different servers).
|
|
4167 (progn
|
|
4168 (mail-header-set-xref
|
|
4169 (car (symbol-value id-dep))
|
|
4170 (concat (or (mail-header-xref
|
|
4171 (car (symbol-value id-dep)))
|
|
4172 "")
|
|
4173 (or (mail-header-xref header) "")))
|
|
4174 (setq header nil))
|
|
4175 (setcar (symbol-value id-dep) header))
|
|
4176 (set id-dep (list header)))
|
|
4177 (when header
|
|
4178 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4179 (setcdr (symbol-value ref-dep)
|
|
4180 (nconc (cdr (symbol-value ref-dep))
|
|
4181 (list (symbol-value id-dep))))
|
|
4182 (set ref-dep (list nil (symbol-value id-dep))))
|
|
4183 (push header headers))
|
|
4184 (goto-char (point-max))
|
|
4185 (widen))
|
|
4186 (nreverse headers)))))
|
|
4187
|
|
4188 ;; The following macros and functions were written by Felix Lee
|
|
4189 ;; <flee@cse.psu.edu>.
|
|
4190
|
|
4191 (defmacro gnus-nov-read-integer ()
|
|
4192 '(prog1
|
|
4193 (if (= (following-char) ?\t)
|
|
4194 0
|
|
4195 (let ((num (ignore-errors (read buffer))))
|
|
4196 (if (numberp num) num 0)))
|
|
4197 (unless (eobp)
|
|
4198 (forward-char 1))))
|
|
4199
|
|
4200 (defmacro gnus-nov-skip-field ()
|
|
4201 '(search-forward "\t" eol 'move))
|
|
4202
|
|
4203 (defmacro gnus-nov-field ()
|
|
4204 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
|
|
4205
|
|
4206 ;; (defvar gnus-nov-none-counter 0)
|
|
4207
|
|
4208 ;; This function has to be called with point after the article number
|
|
4209 ;; on the beginning of the line.
|
|
4210 (defun gnus-nov-parse-line (number dependencies &optional force-new)
|
|
4211 (let ((eol (gnus-point-at-eol))
|
|
4212 (buffer (current-buffer))
|
|
4213 header ref id id-dep ref-dep)
|
|
4214
|
|
4215 ;; overview: [num subject from date id refs chars lines misc]
|
|
4216 (unwind-protect
|
|
4217 (progn
|
|
4218 (narrow-to-region (point) eol)
|
|
4219 (unless (eobp)
|
|
4220 (forward-char))
|
|
4221
|
|
4222 (setq header
|
|
4223 (vector
|
|
4224 number ; number
|
|
4225 (gnus-nov-field) ; subject
|
|
4226 (gnus-nov-field) ; from
|
|
4227 (gnus-nov-field) ; date
|
|
4228 (setq id (or (gnus-nov-field)
|
|
4229 (nnheader-generate-fake-message-id))) ; id
|
|
4230 (progn
|
|
4231 (let ((beg (point)))
|
|
4232 (search-forward "\t" eol)
|
|
4233 (if (search-backward ">" beg t)
|
|
4234 (setq ref
|
|
4235 (buffer-substring
|
|
4236 (1+ (point))
|
|
4237 (search-backward "<" beg t)))
|
|
4238 (setq ref nil))
|
|
4239 (goto-char beg))
|
|
4240 (gnus-nov-field)) ; refs
|
|
4241 (gnus-nov-read-integer) ; chars
|
|
4242 (gnus-nov-read-integer) ; lines
|
|
4243 (if (= (following-char) ?\n)
|
|
4244 nil
|
|
4245 (gnus-nov-field)) ; misc
|
|
4246 )))
|
|
4247
|
|
4248 (widen))
|
|
4249
|
|
4250 ;; We build the thread tree.
|
|
4251 (when (equal id ref)
|
|
4252 ;; This article refers back to itself. Naughty, naughty.
|
|
4253 (setq ref nil))
|
|
4254 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4255 (if (and (car (symbol-value id-dep))
|
|
4256 (not force-new))
|
|
4257 ;; An article with this Message-ID has already been seen,
|
|
4258 ;; so we ignore this one, except we add any additional
|
|
4259 ;; Xrefs (in case the two articles came from different
|
|
4260 ;; servers.
|
|
4261 (progn
|
|
4262 (mail-header-set-xref
|
|
4263 (car (symbol-value id-dep))
|
|
4264 (concat (or (mail-header-xref
|
|
4265 (car (symbol-value id-dep)))
|
|
4266 "")
|
|
4267 (or (mail-header-xref header) "")))
|
|
4268 (setq header nil))
|
|
4269 (setcar (symbol-value id-dep) header))
|
|
4270 (set id-dep (list header)))
|
|
4271 (when header
|
|
4272 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4273 (setcdr (symbol-value ref-dep)
|
|
4274 (nconc (cdr (symbol-value ref-dep))
|
|
4275 (list (symbol-value id-dep))))
|
|
4276 (set ref-dep (list nil (symbol-value id-dep)))))
|
|
4277 header))
|
|
4278
|
|
4279 ;; Goes through the xover lines and returns a list of vectors
|
|
4280 (defun gnus-get-newsgroup-headers-xover (sequence &optional
|
|
4281 force-new dependencies
|
|
4282 group also-fetch-heads)
|
|
4283 "Parse the news overview data in the server buffer, and return a
|
|
4284 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
|
|
4285 ;; Get the Xref when the users reads the articles since most/some
|
|
4286 ;; NNTP servers do not include Xrefs when using XOVER.
|
|
4287 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
|
|
4288 (let ((cur nntp-server-buffer)
|
|
4289 (dependencies (or dependencies gnus-newsgroup-dependencies))
|
|
4290 number headers header)
|
|
4291 (save-excursion
|
|
4292 (set-buffer nntp-server-buffer)
|
|
4293 ;; Allow the user to mangle the headers before parsing them.
|
|
4294 (run-hooks 'gnus-parse-headers-hook)
|
|
4295 (goto-char (point-min))
|
|
4296 (while (not (eobp))
|
|
4297 (condition-case ()
|
|
4298 (while (and sequence (not (eobp)))
|
|
4299 (setq number (read cur))
|
|
4300 (while (and sequence
|
|
4301 (< (car sequence) number))
|
|
4302 (setq sequence (cdr sequence)))
|
|
4303 (and sequence
|
|
4304 (eq number (car sequence))
|
|
4305 (progn
|
|
4306 (setq sequence (cdr sequence))
|
|
4307 (setq header (inline
|
|
4308 (gnus-nov-parse-line
|
|
4309 number dependencies force-new))))
|
|
4310 (push header headers))
|
|
4311 (forward-line 1))
|
|
4312 (error
|
|
4313 (gnus-error 4 "Strange nov line (%d)"
|
|
4314 (count-lines (point-min) (point)))))
|
|
4315 (forward-line 1))
|
|
4316 ;; A common bug in inn is that if you have posted an article and
|
|
4317 ;; then retrieves the active file, it will answer correctly --
|
|
4318 ;; the new article is included. However, a NOV entry for the
|
|
4319 ;; article may not have been generated yet, so this may fail.
|
|
4320 ;; We work around this problem by retrieving the last few
|
|
4321 ;; headers using HEAD.
|
|
4322 (if (or (not also-fetch-heads)
|
|
4323 (not sequence))
|
104
|
4324 ;; We (probably) got all the headers.
|
98
|
4325 (nreverse headers)
|
104
|
4326 (let ((gnus-nov-is-evil t))
|
98
|
4327 (nconc
|
|
4328 (nreverse headers)
|
|
4329 (when (gnus-retrieve-headers sequence group)
|
|
4330 (gnus-get-newsgroup-headers))))))))
|
|
4331
|
|
4332 (defun gnus-article-get-xrefs ()
|
|
4333 "Fill in the Xref value in `gnus-current-headers', if necessary.
|
|
4334 This is meant to be called in `gnus-article-internal-prepare-hook'."
|
|
4335 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
|
|
4336 gnus-current-headers)))
|
|
4337 (or (not gnus-use-cross-reference)
|
|
4338 (not headers)
|
|
4339 (and (mail-header-xref headers)
|
|
4340 (not (string= (mail-header-xref headers) "")))
|
|
4341 (let ((case-fold-search t)
|
|
4342 xref)
|
|
4343 (save-restriction
|
|
4344 (nnheader-narrow-to-headers)
|
|
4345 (goto-char (point-min))
|
|
4346 (when (or (and (eq (downcase (following-char)) ?x)
|
|
4347 (looking-at "Xref:"))
|
|
4348 (search-forward "\nXref:" nil t))
|
|
4349 (goto-char (1+ (match-end 0)))
|
|
4350 (setq xref (buffer-substring (point)
|
|
4351 (progn (end-of-line) (point))))
|
|
4352 (mail-header-set-xref headers xref)))))))
|
|
4353
|
|
4354 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
|
|
4355 "Find article ID and insert the summary line for that article."
|
|
4356 (let ((header (if (and old-header use-old-header)
|
|
4357 old-header (gnus-read-header id)))
|
|
4358 (number (and (numberp id) id))
|
|
4359 pos d)
|
|
4360 (when header
|
|
4361 ;; Rebuild the thread that this article is part of and go to the
|
|
4362 ;; article we have fetched.
|
|
4363 (when (and (not gnus-show-threads)
|
|
4364 old-header)
|
|
4365 (when (setq d (gnus-data-find (mail-header-number old-header)))
|
|
4366 (goto-char (gnus-data-pos d))
|
|
4367 (gnus-data-remove
|
|
4368 number
|
|
4369 (- (gnus-point-at-bol)
|
|
4370 (prog1
|
|
4371 (1+ (gnus-point-at-eol))
|
|
4372 (gnus-delete-line))))))
|
|
4373 (when old-header
|
|
4374 (mail-header-set-number header (mail-header-number old-header)))
|
|
4375 (setq gnus-newsgroup-sparse
|
|
4376 (delq (setq number (mail-header-number header))
|
|
4377 gnus-newsgroup-sparse))
|
|
4378 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
|
|
4379 (gnus-rebuild-thread (mail-header-id header))
|
|
4380 (gnus-summary-goto-subject number nil t))
|
|
4381 (when (and (numberp number)
|
|
4382 (> number 0))
|
|
4383 ;; We have to update the boundaries even if we can't fetch the
|
|
4384 ;; article if ID is a number -- so that the next `P' or `N'
|
|
4385 ;; command will fetch the previous (or next) article even
|
|
4386 ;; if the one we tried to fetch this time has been canceled.
|
|
4387 (when (> number gnus-newsgroup-end)
|
|
4388 (setq gnus-newsgroup-end number))
|
|
4389 (when (< number gnus-newsgroup-begin)
|
|
4390 (setq gnus-newsgroup-begin number))
|
|
4391 (setq gnus-newsgroup-unselected
|
|
4392 (delq number gnus-newsgroup-unselected)))
|
|
4393 ;; Report back a success?
|
|
4394 (and header (mail-header-number header))))
|
|
4395
|
|
4396 ;;; Process/prefix in the summary buffer
|
|
4397
|
|
4398 (defun gnus-summary-work-articles (n)
|
|
4399 "Return a list of articles to be worked upon. The prefix argument,
|
|
4400 the list of process marked articles, and the current article will be
|
|
4401 taken into consideration."
|
|
4402 (cond
|
|
4403 (n
|
|
4404 ;; A numerical prefix has been given.
|
|
4405 (setq n (prefix-numeric-value n))
|
|
4406 (let ((backward (< n 0))
|
|
4407 (n (abs (prefix-numeric-value n)))
|
|
4408 articles article)
|
|
4409 (save-excursion
|
|
4410 (while
|
|
4411 (and (> n 0)
|
|
4412 (push (setq article (gnus-summary-article-number))
|
|
4413 articles)
|
|
4414 (if backward
|
|
4415 (gnus-summary-find-prev nil article)
|
|
4416 (gnus-summary-find-next nil article)))
|
|
4417 (decf n)))
|
|
4418 (nreverse articles)))
|
|
4419 ((gnus-region-active-p)
|
|
4420 ;; Work on the region between point and mark.
|
|
4421 (let ((max (max (point) (mark)))
|
|
4422 articles article)
|
|
4423 (save-excursion
|
|
4424 (goto-char (min (point) (mark)))
|
|
4425 (while
|
|
4426 (and
|
|
4427 (push (setq article (gnus-summary-article-number)) articles)
|
|
4428 (gnus-summary-find-next nil article)
|
|
4429 (< (point) max)))
|
|
4430 (nreverse articles))))
|
|
4431 (gnus-newsgroup-processable
|
|
4432 ;; There are process-marked articles present.
|
|
4433 ;; Save current state.
|
|
4434 (gnus-summary-save-process-mark)
|
|
4435 ;; Return the list.
|
|
4436 (reverse gnus-newsgroup-processable))
|
|
4437 (t
|
|
4438 ;; Just return the current article.
|
|
4439 (list (gnus-summary-article-number)))))
|
|
4440
|
|
4441 (defun gnus-summary-save-process-mark ()
|
|
4442 "Push the current set of process marked articles on the stack."
|
|
4443 (interactive)
|
|
4444 (push (copy-sequence gnus-newsgroup-processable)
|
|
4445 gnus-newsgroup-process-stack))
|
|
4446
|
|
4447 (defun gnus-summary-kill-process-mark ()
|
|
4448 "Push the current set of process marked articles on the stack and unmark."
|
|
4449 (interactive)
|
|
4450 (gnus-summary-save-process-mark)
|
|
4451 (gnus-summary-unmark-all-processable))
|
|
4452
|
|
4453 (defun gnus-summary-yank-process-mark ()
|
|
4454 "Pop the last process mark state off the stack and restore it."
|
|
4455 (interactive)
|
|
4456 (unless gnus-newsgroup-process-stack
|
|
4457 (error "Empty mark stack"))
|
|
4458 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
|
|
4459
|
|
4460 (defun gnus-summary-process-mark-set (set)
|
|
4461 "Make SET into the current process marked articles."
|
|
4462 (gnus-summary-unmark-all-processable)
|
|
4463 (while set
|
|
4464 (gnus-summary-set-process-mark (pop set))))
|
|
4465
|
|
4466 ;;; Searching and stuff
|
|
4467
|
|
4468 (defun gnus-summary-search-group (&optional backward use-level)
|
|
4469 "Search for next unread newsgroup.
|
|
4470 If optional argument BACKWARD is non-nil, search backward instead."
|
|
4471 (save-excursion
|
|
4472 (set-buffer gnus-group-buffer)
|
|
4473 (when (gnus-group-search-forward
|
|
4474 backward nil (if use-level (gnus-group-group-level) nil))
|
|
4475 (gnus-group-group-name))))
|
|
4476
|
|
4477 (defun gnus-summary-best-group (&optional exclude-group)
|
|
4478 "Find the name of the best unread group.
|
|
4479 If EXCLUDE-GROUP, do not go to this group."
|
|
4480 (save-excursion
|
|
4481 (set-buffer gnus-group-buffer)
|
|
4482 (save-excursion
|
|
4483 (gnus-group-best-unread-group exclude-group))))
|
|
4484
|
|
4485 (defun gnus-summary-find-next (&optional unread article backward)
|
|
4486 (if backward (gnus-summary-find-prev)
|
|
4487 (let* ((dummy (gnus-summary-article-intangible-p))
|
|
4488 (article (or article (gnus-summary-article-number)))
|
|
4489 (arts (gnus-data-find-list article))
|
|
4490 result)
|
|
4491 (when (and (not dummy)
|
|
4492 (or (not gnus-summary-check-current)
|
|
4493 (not unread)
|
|
4494 (not (gnus-data-unread-p (car arts)))))
|
|
4495 (setq arts (cdr arts)))
|
|
4496 (when (setq result
|
|
4497 (if unread
|
|
4498 (progn
|
|
4499 (while arts
|
|
4500 (when (gnus-data-unread-p (car arts))
|
|
4501 (setq result (car arts)
|
|
4502 arts nil))
|
|
4503 (setq arts (cdr arts)))
|
|
4504 result)
|
|
4505 (car arts)))
|
|
4506 (goto-char (gnus-data-pos result))
|
|
4507 (gnus-data-number result)))))
|
|
4508
|
|
4509 (defun gnus-summary-find-prev (&optional unread article)
|
|
4510 (let* ((eobp (eobp))
|
|
4511 (article (or article (gnus-summary-article-number)))
|
|
4512 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
|
|
4513 result)
|
|
4514 (when (and (not eobp)
|
|
4515 (or (not gnus-summary-check-current)
|
|
4516 (not unread)
|
|
4517 (not (gnus-data-unread-p (car arts)))))
|
|
4518 (setq arts (cdr arts)))
|
|
4519 (when (setq result
|
|
4520 (if unread
|
|
4521 (progn
|
|
4522 (while arts
|
|
4523 (when (gnus-data-unread-p (car arts))
|
|
4524 (setq result (car arts)
|
|
4525 arts nil))
|
|
4526 (setq arts (cdr arts)))
|
|
4527 result)
|
|
4528 (car arts)))
|
|
4529 (goto-char (gnus-data-pos result))
|
|
4530 (gnus-data-number result))))
|
|
4531
|
|
4532 (defun gnus-summary-find-subject (subject &optional unread backward article)
|
|
4533 (let* ((simp-subject (gnus-simplify-subject-fully subject))
|
|
4534 (article (or article (gnus-summary-article-number)))
|
|
4535 (articles (gnus-data-list backward))
|
|
4536 (arts (gnus-data-find-list article articles))
|
|
4537 result)
|
|
4538 (when (or (not gnus-summary-check-current)
|
|
4539 (not unread)
|
|
4540 (not (gnus-data-unread-p (car arts))))
|
|
4541 (setq arts (cdr arts)))
|
|
4542 (while arts
|
|
4543 (and (or (not unread)
|
|
4544 (gnus-data-unread-p (car arts)))
|
|
4545 (vectorp (gnus-data-header (car arts)))
|
|
4546 (gnus-subject-equal
|
|
4547 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
|
|
4548 (setq result (car arts)
|
|
4549 arts nil))
|
|
4550 (setq arts (cdr arts)))
|
|
4551 (and result
|
|
4552 (goto-char (gnus-data-pos result))
|
|
4553 (gnus-data-number result))))
|
|
4554
|
|
4555 (defun gnus-summary-search-forward (&optional unread subject backward)
|
|
4556 "Search forward for an article.
|
|
4557 If UNREAD, look for unread articles. If SUBJECT, look for
|
|
4558 articles with that subject. If BACKWARD, search backward instead."
|
|
4559 (cond (subject (gnus-summary-find-subject subject unread backward))
|
|
4560 (backward (gnus-summary-find-prev unread))
|
|
4561 (t (gnus-summary-find-next unread))))
|
|
4562
|
|
4563 (defun gnus-recenter (&optional n)
|
|
4564 "Center point in window and redisplay frame.
|
|
4565 Also do horizontal recentering."
|
|
4566 (interactive "P")
|
|
4567 (when (and gnus-auto-center-summary
|
|
4568 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4569 (gnus-horizontal-recenter))
|
|
4570 (recenter n))
|
|
4571
|
|
4572 (defun gnus-summary-recenter ()
|
|
4573 "Center point in the summary window.
|
|
4574 If `gnus-auto-center-summary' is nil, or the article buffer isn't
|
|
4575 displayed, no centering will be performed."
|
|
4576 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
|
|
4577 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
|
|
4578 (let* ((top (cond ((< (window-height) 4) 0)
|
|
4579 ((< (window-height) 7) 1)
|
|
4580 (t 2)))
|
|
4581 (height (1- (window-height)))
|
|
4582 (bottom (save-excursion (goto-char (point-max))
|
|
4583 (forward-line (- height))
|
|
4584 (point)))
|
|
4585 (window (get-buffer-window (current-buffer))))
|
|
4586 ;; The user has to want it.
|
|
4587 (when gnus-auto-center-summary
|
|
4588 (when (get-buffer-window gnus-article-buffer)
|
|
4589 ;; Only do recentering when the article buffer is displayed,
|
|
4590 ;; Set the window start to either `bottom', which is the biggest
|
|
4591 ;; possible valid number, or the second line from the top,
|
|
4592 ;; whichever is the least.
|
|
4593 (set-window-start
|
|
4594 window (min bottom (save-excursion
|
|
4595 (forward-line (- top)) (point)))))
|
|
4596 ;; Do horizontal recentering while we're at it.
|
|
4597 (when (and (get-buffer-window (current-buffer) t)
|
|
4598 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4599 (let ((selected (selected-window)))
|
|
4600 (select-window (get-buffer-window (current-buffer) t))
|
|
4601 (gnus-summary-position-point)
|
|
4602 (gnus-horizontal-recenter)
|
|
4603 (select-window selected))))))
|
|
4604
|
|
4605 (defun gnus-summary-jump-to-group (newsgroup)
|
|
4606 "Move point to NEWSGROUP in group mode buffer."
|
|
4607 ;; Keep update point of group mode buffer if visible.
|
|
4608 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
|
|
4609 (save-window-excursion
|
|
4610 ;; Take care of tree window mode.
|
|
4611 (when (get-buffer-window gnus-group-buffer)
|
|
4612 (pop-to-buffer gnus-group-buffer))
|
|
4613 (gnus-group-jump-to-group newsgroup))
|
|
4614 (save-excursion
|
|
4615 ;; Take care of tree window mode.
|
|
4616 (if (get-buffer-window gnus-group-buffer)
|
|
4617 (pop-to-buffer gnus-group-buffer)
|
|
4618 (set-buffer gnus-group-buffer))
|
|
4619 (gnus-group-jump-to-group newsgroup))))
|
|
4620
|
|
4621 ;; This function returns a list of article numbers based on the
|
|
4622 ;; difference between the ranges of read articles in this group and
|
|
4623 ;; the range of active articles.
|
|
4624 (defun gnus-list-of-unread-articles (group)
|
|
4625 (let* ((read (gnus-info-read (gnus-get-info group)))
|
|
4626 (active (or (gnus-active group) (gnus-activate-group group)))
|
|
4627 (last (cdr active))
|
|
4628 first nlast unread)
|
|
4629 ;; If none are read, then all are unread.
|
|
4630 (if (not read)
|
|
4631 (setq first (car active))
|
|
4632 ;; If the range of read articles is a single range, then the
|
|
4633 ;; first unread article is the article after the last read
|
|
4634 ;; article. Sounds logical, doesn't it?
|
|
4635 (if (not (listp (cdr read)))
|
|
4636 (setq first (1+ (cdr read)))
|
|
4637 ;; `read' is a list of ranges.
|
|
4638 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
|
|
4639 (caar read)))
|
|
4640 1)
|
|
4641 (setq first 1))
|
|
4642 (while read
|
|
4643 (when first
|
|
4644 (while (< first nlast)
|
|
4645 (push first unread)
|
|
4646 (setq first (1+ first))))
|
|
4647 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
|
|
4648 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
|
|
4649 (setq read (cdr read)))))
|
|
4650 ;; And add the last unread articles.
|
|
4651 (while (<= first last)
|
|
4652 (push first unread)
|
|
4653 (setq first (1+ first)))
|
|
4654 ;; Return the list of unread articles.
|
|
4655 (nreverse unread)))
|
|
4656
|
|
4657 (defun gnus-list-of-read-articles (group)
|
|
4658 "Return a list of unread, unticked and non-dormant articles."
|
|
4659 (let* ((info (gnus-get-info group))
|
|
4660 (marked (gnus-info-marks info))
|
|
4661 (active (gnus-active group)))
|
|
4662 (and info active
|
|
4663 (gnus-set-difference
|
|
4664 (gnus-sorted-complement
|
|
4665 (gnus-uncompress-range active)
|
|
4666 (gnus-list-of-unread-articles group))
|
|
4667 (append
|
|
4668 (gnus-uncompress-range (cdr (assq 'dormant marked)))
|
|
4669 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
|
|
4670
|
|
4671 ;; Various summary commands
|
|
4672
|
|
4673 (defun gnus-summary-universal-argument (arg)
|
|
4674 "Perform any operation on all articles that are process/prefixed."
|
|
4675 (interactive "P")
|
|
4676 (gnus-set-global-variables)
|
|
4677 (let ((articles (gnus-summary-work-articles arg))
|
|
4678 func article)
|
|
4679 (if (eq
|
|
4680 (setq
|
|
4681 func
|
|
4682 (key-binding
|
|
4683 (read-key-sequence
|
|
4684 (substitute-command-keys
|
|
4685 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
|
|
4686 ))))
|
|
4687 'undefined)
|
|
4688 (gnus-error 1 "Undefined key")
|
|
4689 (save-excursion
|
|
4690 (while articles
|
|
4691 (gnus-summary-goto-subject (setq article (pop articles)))
|
|
4692 (let (gnus-newsgroup-processable)
|
|
4693 (command-execute func))
|
|
4694 (gnus-summary-remove-process-mark article)))))
|
|
4695 (gnus-summary-position-point))
|
|
4696
|
|
4697 (defun gnus-summary-toggle-truncation (&optional arg)
|
|
4698 "Toggle truncation of summary lines.
|
|
4699 With arg, turn line truncation on iff arg is positive."
|
|
4700 (interactive "P")
|
|
4701 (setq truncate-lines
|
|
4702 (if (null arg) (not truncate-lines)
|
|
4703 (> (prefix-numeric-value arg) 0)))
|
|
4704 (redraw-display))
|
|
4705
|
|
4706 (defun gnus-summary-reselect-current-group (&optional all rescan)
|
|
4707 "Exit and then reselect the current newsgroup.
|
|
4708 The prefix argument ALL means to select all articles."
|
|
4709 (interactive "P")
|
|
4710 (gnus-set-global-variables)
|
|
4711 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4712 (error "Ephemeral groups can't be reselected"))
|
|
4713 (let ((current-subject (gnus-summary-article-number))
|
|
4714 (group gnus-newsgroup-name))
|
|
4715 (setq gnus-newsgroup-begin nil)
|
|
4716 (gnus-summary-exit)
|
|
4717 ;; We have to adjust the point of group mode buffer because
|
|
4718 ;; point was moved to the next unread newsgroup by exiting.
|
|
4719 (gnus-summary-jump-to-group group)
|
|
4720 (when rescan
|
|
4721 (save-excursion
|
|
4722 (gnus-group-get-new-news-this-group 1)))
|
|
4723 (gnus-group-read-group all t)
|
|
4724 (gnus-summary-goto-subject current-subject nil t)))
|
|
4725
|
|
4726 (defun gnus-summary-rescan-group (&optional all)
|
|
4727 "Exit the newsgroup, ask for new articles, and select the newsgroup."
|
|
4728 (interactive "P")
|
|
4729 (gnus-summary-reselect-current-group all t))
|
|
4730
|
|
4731 (defun gnus-summary-update-info (&optional non-destructive)
|
|
4732 (save-excursion
|
|
4733 (let ((group gnus-newsgroup-name))
|
|
4734 (when gnus-newsgroup-kill-headers
|
|
4735 (setq gnus-newsgroup-killed
|
|
4736 (gnus-compress-sequence
|
|
4737 (nconc
|
|
4738 (gnus-set-sorted-intersection
|
|
4739 (gnus-uncompress-range gnus-newsgroup-killed)
|
|
4740 (setq gnus-newsgroup-unselected
|
|
4741 (sort gnus-newsgroup-unselected '<)))
|
|
4742 (setq gnus-newsgroup-unreads
|
|
4743 (sort gnus-newsgroup-unreads '<)))
|
|
4744 t)))
|
|
4745 (unless (listp (cdr gnus-newsgroup-killed))
|
|
4746 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
|
|
4747 (let ((headers gnus-newsgroup-headers))
|
|
4748 (when (and (not gnus-save-score)
|
|
4749 (not non-destructive))
|
|
4750 (setq gnus-newsgroup-scored nil))
|
|
4751 ;; Set the new ranges of read articles.
|
|
4752 (gnus-update-read-articles
|
|
4753 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
|
|
4754 ;; Set the current article marks.
|
|
4755 (gnus-update-marks)
|
|
4756 ;; Do the cross-ref thing.
|
|
4757 (when gnus-use-cross-reference
|
|
4758 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
|
|
4759 ;; Do adaptive scoring, and possibly save score files.
|
|
4760 (when gnus-newsgroup-adaptive
|
|
4761 (gnus-score-adaptive))
|
|
4762 (when gnus-use-scoring
|
|
4763 (gnus-score-save))
|
|
4764 ;; Do not switch windows but change the buffer to work.
|
|
4765 (set-buffer gnus-group-buffer)
|
|
4766 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4767 (gnus-group-update-group group))))))
|
|
4768
|
|
4769 (defun gnus-summary-save-newsrc (&optional force)
|
|
4770 "Save the current number of read/marked articles in the dribble buffer.
|
|
4771 The dribble buffer will then be saved.
|
|
4772 If FORCE (the prefix), also save the .newsrc file(s)."
|
|
4773 (interactive "P")
|
|
4774 (gnus-summary-update-info t)
|
|
4775 (if force
|
|
4776 (gnus-save-newsrc-file)
|
|
4777 (gnus-dribble-save)))
|
|
4778
|
|
4779 (defun gnus-summary-exit (&optional temporary)
|
|
4780 "Exit reading current newsgroup, and then return to group selection mode.
|
|
4781 gnus-exit-group-hook is called with no arguments if that value is non-nil."
|
|
4782 (interactive)
|
|
4783 (gnus-set-global-variables)
|
|
4784 (gnus-kill-save-kill-buffer)
|
|
4785 (let* ((group gnus-newsgroup-name)
|
|
4786 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
|
|
4787 (mode major-mode)
|
|
4788 (buf (current-buffer)))
|
|
4789 (run-hooks 'gnus-summary-prepare-exit-hook)
|
|
4790 ;; If we have several article buffers, we kill them at exit.
|
|
4791 (unless gnus-single-article-buffer
|
|
4792 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4793 (setq gnus-article-current nil))
|
|
4794 (when gnus-use-cache
|
|
4795 (gnus-cache-possibly-remove-articles)
|
|
4796 (gnus-cache-save-buffers))
|
|
4797 (gnus-async-prefetch-remove-group group)
|
|
4798 (when gnus-suppress-duplicates
|
|
4799 (gnus-dup-enter-articles))
|
|
4800 (when gnus-use-trees
|
|
4801 (gnus-tree-close group))
|
|
4802 ;; Make all changes in this group permanent.
|
|
4803 (unless quit-config
|
|
4804 (run-hooks 'gnus-exit-group-hook)
|
|
4805 (gnus-summary-update-info))
|
|
4806 (gnus-close-group group)
|
|
4807 ;; Make sure where I was, and go to next newsgroup.
|
|
4808 (set-buffer gnus-group-buffer)
|
|
4809 (unless quit-config
|
|
4810 (gnus-group-jump-to-group group))
|
|
4811 (run-hooks 'gnus-summary-exit-hook)
|
|
4812 (unless quit-config
|
|
4813 (gnus-group-next-unread-group 1))
|
|
4814 (if temporary
|
|
4815 nil ;Nothing to do.
|
|
4816 ;; If we have several article buffers, we kill them at exit.
|
|
4817 (unless gnus-single-article-buffer
|
|
4818 (gnus-kill-buffer gnus-article-buffer)
|
|
4819 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4820 (setq gnus-article-current nil))
|
|
4821 (set-buffer buf)
|
|
4822 (if (not gnus-kill-summary-on-exit)
|
|
4823 (gnus-deaden-summary)
|
|
4824 ;; We set all buffer-local variables to nil. It is unclear why
|
|
4825 ;; this is needed, but if we don't, buffer-local variables are
|
|
4826 ;; not garbage-collected, it seems. This would the lead to en
|
|
4827 ;; ever-growing Emacs.
|
|
4828 (gnus-summary-clear-local-variables)
|
|
4829 (when (get-buffer gnus-article-buffer)
|
|
4830 (bury-buffer gnus-article-buffer))
|
|
4831 ;; We clear the global counterparts of the buffer-local
|
|
4832 ;; variables as well, just to be on the safe side.
|
|
4833 (set-buffer gnus-group-buffer)
|
|
4834 (gnus-summary-clear-local-variables)
|
|
4835 ;; Return to group mode buffer.
|
|
4836 (when (eq mode 'gnus-summary-mode)
|
|
4837 (gnus-kill-buffer buf)))
|
|
4838 (setq gnus-current-select-method gnus-select-method)
|
|
4839 (pop-to-buffer gnus-group-buffer)
|
|
4840 ;; Clear the current group name.
|
|
4841 (if (not quit-config)
|
|
4842 (progn
|
|
4843 (gnus-group-jump-to-group group)
|
|
4844 (gnus-group-next-unread-group 1)
|
|
4845 (gnus-configure-windows 'group 'force))
|
|
4846 (gnus-handle-ephemeral-exit quit-config))
|
|
4847 (unless quit-config
|
|
4848 (setq gnus-newsgroup-name nil)))))
|
|
4849
|
|
4850 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
|
|
4851 (defun gnus-summary-exit-no-update (&optional no-questions)
|
|
4852 "Quit reading current newsgroup without updating read article info."
|
|
4853 (interactive)
|
|
4854 (gnus-set-global-variables)
|
|
4855 (let* ((group gnus-newsgroup-name)
|
|
4856 (quit-config (gnus-group-quit-config group)))
|
|
4857 (when (or no-questions
|
|
4858 gnus-expert-user
|
|
4859 (gnus-y-or-n-p "Discard changes to this group and exit? "))
|
|
4860 ;; If we have several article buffers, we kill them at exit.
|
|
4861 (unless gnus-single-article-buffer
|
|
4862 (gnus-kill-buffer gnus-article-buffer)
|
|
4863 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4864 (setq gnus-article-current nil))
|
|
4865 (if (not gnus-kill-summary-on-exit)
|
|
4866 (gnus-deaden-summary)
|
|
4867 (gnus-close-group group)
|
|
4868 (gnus-summary-clear-local-variables)
|
|
4869 (set-buffer gnus-group-buffer)
|
|
4870 (gnus-summary-clear-local-variables)
|
|
4871 (when (get-buffer gnus-summary-buffer)
|
|
4872 (kill-buffer gnus-summary-buffer)))
|
|
4873 (unless gnus-single-article-buffer
|
|
4874 (setq gnus-article-current nil))
|
|
4875 (when gnus-use-trees
|
|
4876 (gnus-tree-close group))
|
|
4877 (gnus-async-prefetch-remove-group group)
|
|
4878 (when (get-buffer gnus-article-buffer)
|
|
4879 (bury-buffer gnus-article-buffer))
|
|
4880 ;; Return to the group buffer.
|
|
4881 (gnus-configure-windows 'group 'force)
|
|
4882 ;; Clear the current group name.
|
|
4883 (setq gnus-newsgroup-name nil)
|
|
4884 (when (equal (gnus-group-group-name) group)
|
|
4885 (gnus-group-next-unread-group 1))
|
|
4886 (when quit-config
|
|
4887 (gnus-handle-ephemeral-exit quit-config)))))
|
|
4888
|
|
4889 (defun gnus-handle-ephemeral-exit (quit-config)
|
|
4890 "Handle movement when leaving an ephemeral group. The state
|
|
4891 which existed when entering the ephemeral is reset."
|
|
4892 (if (not (buffer-name (car quit-config)))
|
|
4893 (gnus-configure-windows 'group 'force)
|
|
4894 (set-buffer (car quit-config))
|
|
4895 (cond ((eq major-mode 'gnus-summary-mode)
|
|
4896 (gnus-set-global-variables))
|
|
4897 ((eq major-mode 'gnus-article-mode)
|
|
4898 (save-excursion
|
|
4899 ;; The `gnus-summary-buffer' variable may point
|
|
4900 ;; to the old summary buffer when using a single
|
|
4901 ;; article buffer.
|
|
4902 (unless (gnus-buffer-live-p gnus-summary-buffer)
|
|
4903 (set-buffer gnus-group-buffer))
|
|
4904 (set-buffer gnus-summary-buffer)
|
|
4905 (gnus-set-global-variables))))
|
|
4906 (if (or (eq (cdr quit-config) 'article)
|
|
4907 (eq (cdr quit-config) 'pick))
|
|
4908 (progn
|
|
4909 ;; The current article may be from the ephemeral group
|
|
4910 ;; thus it is best that we reload this article
|
|
4911 (gnus-summary-show-article)
|
|
4912 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
|
|
4913 (gnus-configure-windows 'pick 'force)
|
|
4914 (gnus-configure-windows (cdr quit-config) 'force)))
|
|
4915 (gnus-configure-windows (cdr quit-config) 'force))
|
|
4916 (when (eq major-mode 'gnus-summary-mode)
|
|
4917 (gnus-summary-next-subject 1 nil t)
|
|
4918 (gnus-summary-recenter)
|
|
4919 (gnus-summary-position-point))))
|
|
4920
|
|
4921 ;;; Dead summaries.
|
|
4922
|
|
4923 (defvar gnus-dead-summary-mode-map nil)
|
|
4924
|
|
4925 (unless gnus-dead-summary-mode-map
|
|
4926 (setq gnus-dead-summary-mode-map (make-keymap))
|
|
4927 (suppress-keymap gnus-dead-summary-mode-map)
|
|
4928 (substitute-key-definition
|
|
4929 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
|
|
4930 (let ((keys '("\C-d" "\r" "\177")))
|
|
4931 (while keys
|
|
4932 (define-key gnus-dead-summary-mode-map
|
|
4933 (pop keys) 'gnus-summary-wake-up-the-dead))))
|
|
4934
|
|
4935 (defvar gnus-dead-summary-mode nil
|
|
4936 "Minor mode for Gnus summary buffers.")
|
|
4937
|
|
4938 (defun gnus-dead-summary-mode (&optional arg)
|
|
4939 "Minor mode for Gnus summary buffers."
|
|
4940 (interactive "P")
|
|
4941 (when (eq major-mode 'gnus-summary-mode)
|
|
4942 (make-local-variable 'gnus-dead-summary-mode)
|
|
4943 (setq gnus-dead-summary-mode
|
|
4944 (if (null arg) (not gnus-dead-summary-mode)
|
|
4945 (> (prefix-numeric-value arg) 0)))
|
|
4946 (when gnus-dead-summary-mode
|
|
4947 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
|
|
4948 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
|
|
4949 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
|
|
4950 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
|
|
4951 minor-mode-map-alist)))))
|
|
4952
|
|
4953 (defun gnus-deaden-summary ()
|
|
4954 "Make the current summary buffer into a dead summary buffer."
|
|
4955 ;; Kill any previous dead summary buffer.
|
|
4956 (when (and gnus-dead-summary
|
|
4957 (buffer-name gnus-dead-summary))
|
|
4958 (save-excursion
|
|
4959 (set-buffer gnus-dead-summary)
|
|
4960 (when gnus-dead-summary-mode
|
|
4961 (kill-buffer (current-buffer)))))
|
|
4962 ;; Make this the current dead summary.
|
|
4963 (setq gnus-dead-summary (current-buffer))
|
|
4964 (gnus-dead-summary-mode 1)
|
|
4965 (let ((name (buffer-name)))
|
|
4966 (when (string-match "Summary" name)
|
|
4967 (rename-buffer
|
|
4968 (concat (substring name 0 (match-beginning 0)) "Dead "
|
|
4969 (substring name (match-beginning 0)))
|
|
4970 t))))
|
|
4971
|
|
4972 (defun gnus-kill-or-deaden-summary (buffer)
|
|
4973 "Kill or deaden the summary BUFFER."
|
|
4974 (when (and (buffer-name buffer)
|
|
4975 (not gnus-single-article-buffer))
|
|
4976 (save-excursion
|
|
4977 (set-buffer buffer)
|
|
4978 (gnus-kill-buffer gnus-article-buffer)
|
|
4979 (gnus-kill-buffer gnus-original-article-buffer)))
|
|
4980 (cond (gnus-kill-summary-on-exit
|
|
4981 (when (and gnus-use-trees
|
|
4982 (and (get-buffer buffer)
|
|
4983 (buffer-name (get-buffer buffer))))
|
|
4984 (save-excursion
|
|
4985 (set-buffer (get-buffer buffer))
|
|
4986 (gnus-tree-close gnus-newsgroup-name)))
|
|
4987 (gnus-kill-buffer buffer))
|
|
4988 ((and (get-buffer buffer)
|
|
4989 (buffer-name (get-buffer buffer)))
|
|
4990 (save-excursion
|
|
4991 (set-buffer buffer)
|
|
4992 (gnus-deaden-summary)))))
|
|
4993
|
|
4994 (defun gnus-summary-wake-up-the-dead (&rest args)
|
|
4995 "Wake up the dead summary buffer."
|
|
4996 (interactive)
|
|
4997 (gnus-dead-summary-mode -1)
|
|
4998 (let ((name (buffer-name)))
|
|
4999 (when (string-match "Dead " name)
|
|
5000 (rename-buffer
|
|
5001 (concat (substring name 0 (match-beginning 0))
|
|
5002 (substring name (match-end 0)))
|
|
5003 t)))
|
|
5004 (gnus-message 3 "This dead summary is now alive again"))
|
|
5005
|
|
5006 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
|
|
5007 (defun gnus-summary-fetch-faq (&optional faq-dir)
|
|
5008 "Fetch the FAQ for the current group.
|
|
5009 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
|
|
5010 in."
|
|
5011 (interactive
|
|
5012 (list
|
|
5013 (when current-prefix-arg
|
|
5014 (completing-read
|
|
5015 "Faq dir: " (and (listp gnus-group-faq-directory)
|
|
5016 gnus-group-faq-directory)))))
|
|
5017 (let (gnus-faq-buffer)
|
|
5018 (when (setq gnus-faq-buffer
|
|
5019 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
|
|
5020 (gnus-configure-windows 'summary-faq))))
|
|
5021
|
|
5022 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
5023 (defun gnus-summary-describe-group (&optional force)
|
|
5024 "Describe the current newsgroup."
|
|
5025 (interactive "P")
|
|
5026 (gnus-group-describe-group force gnus-newsgroup-name))
|
|
5027
|
|
5028 (defun gnus-summary-describe-briefly ()
|
|
5029 "Describe summary mode commands briefly."
|
|
5030 (interactive)
|
|
5031 (gnus-message 6
|
|
5032 (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")))
|
|
5033
|
|
5034 ;; Walking around group mode buffer from summary mode.
|
|
5035
|
|
5036 (defun gnus-summary-next-group (&optional no-article target-group backward)
|
|
5037 "Exit current newsgroup and then select next unread newsgroup.
|
|
5038 If prefix argument NO-ARTICLE is non-nil, no article is selected
|
|
5039 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
|
|
5040 previous group instead."
|
|
5041 (interactive "P")
|
|
5042 (gnus-set-global-variables)
|
|
5043 ;; Stop pre-fetching.
|
|
5044 (gnus-async-halt-prefetch)
|
|
5045 (let ((current-group gnus-newsgroup-name)
|
|
5046 (current-buffer (current-buffer))
|
|
5047 entered)
|
|
5048 ;; First we semi-exit this group to update Xrefs and all variables.
|
|
5049 ;; We can't do a real exit, because the window conf must remain
|
|
5050 ;; the same in case the user is prompted for info, and we don't
|
|
5051 ;; want the window conf to change before that...
|
|
5052 (gnus-summary-exit t)
|
|
5053 (while (not entered)
|
|
5054 ;; Then we find what group we are supposed to enter.
|
|
5055 (set-buffer gnus-group-buffer)
|
|
5056 (gnus-group-jump-to-group current-group)
|
|
5057 (setq target-group
|
|
5058 (or target-group
|
|
5059 (if (eq gnus-keep-same-level 'best)
|
|
5060 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5061 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5062 (if (not target-group)
|
|
5063 ;; There are no further groups, so we return to the group
|
|
5064 ;; buffer.
|
|
5065 (progn
|
|
5066 (gnus-message 5 "Returning to the group buffer")
|
|
5067 (setq entered t)
|
|
5068 (set-buffer current-buffer)
|
|
5069 (gnus-summary-exit)
|
|
5070 (run-hooks 'gnus-group-no-more-groups-hook))
|
|
5071 ;; We try to enter the target group.
|
|
5072 (gnus-group-jump-to-group target-group)
|
|
5073 (let ((unreads (gnus-group-group-unread)))
|
|
5074 (if (and (or (eq t unreads)
|
|
5075 (and unreads (not (zerop unreads))))
|
|
5076 (gnus-summary-read-group
|
|
5077 target-group nil no-article current-buffer))
|
|
5078 (setq entered t)
|
|
5079 (setq current-group target-group
|
|
5080 target-group nil)))))))
|
|
5081
|
|
5082 (defun gnus-summary-prev-group (&optional no-article)
|
|
5083 "Exit current newsgroup and then select previous unread newsgroup.
|
|
5084 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
|
|
5085 (interactive "P")
|
|
5086 (gnus-summary-next-group no-article nil t))
|
|
5087
|
|
5088 ;; Walking around summary lines.
|
|
5089
|
|
5090 (defun gnus-summary-first-subject (&optional unread)
|
|
5091 "Go to the first unread subject.
|
|
5092 If UNREAD is non-nil, go to the first unread article.
|
|
5093 Returns the article selected or nil if there are no unread articles."
|
|
5094 (interactive "P")
|
|
5095 (prog1
|
|
5096 (cond
|
|
5097 ;; Empty summary.
|
|
5098 ((null gnus-newsgroup-data)
|
|
5099 (gnus-message 3 "No articles in the group")
|
|
5100 nil)
|
|
5101 ;; Pick the first article.
|
|
5102 ((not unread)
|
|
5103 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
|
|
5104 (gnus-data-number (car gnus-newsgroup-data)))
|
|
5105 ;; No unread articles.
|
|
5106 ((null gnus-newsgroup-unreads)
|
|
5107 (gnus-message 3 "No more unread articles")
|
|
5108 nil)
|
|
5109 ;; Find the first unread article.
|
|
5110 (t
|
|
5111 (let ((data gnus-newsgroup-data))
|
|
5112 (while (and data
|
|
5113 (not (gnus-data-unread-p (car data))))
|
|
5114 (setq data (cdr data)))
|
|
5115 (when data
|
|
5116 (goto-char (gnus-data-pos (car data)))
|
|
5117 (gnus-data-number (car data))))))
|
|
5118 (gnus-summary-position-point)))
|
|
5119
|
|
5120 (defun gnus-summary-next-subject (n &optional unread dont-display)
|
|
5121 "Go to next N'th summary line.
|
|
5122 If N is negative, go to the previous N'th subject line.
|
|
5123 If UNREAD is non-nil, only unread articles are selected.
|
|
5124 The difference between N and the actual number of steps taken is
|
|
5125 returned."
|
|
5126 (interactive "p")
|
|
5127 (let ((backward (< n 0))
|
|
5128 (n (abs n)))
|
|
5129 (while (and (> n 0)
|
|
5130 (if backward
|
|
5131 (gnus-summary-find-prev unread)
|
|
5132 (gnus-summary-find-next unread)))
|
|
5133 (setq n (1- n)))
|
|
5134 (when (/= 0 n)
|
|
5135 (gnus-message 7 "No more%s articles"
|
|
5136 (if unread " unread" "")))
|
|
5137 (unless dont-display
|
|
5138 (gnus-summary-recenter)
|
|
5139 (gnus-summary-position-point))
|
|
5140 n))
|
|
5141
|
|
5142 (defun gnus-summary-next-unread-subject (n)
|
|
5143 "Go to next N'th unread summary line."
|
|
5144 (interactive "p")
|
|
5145 (gnus-summary-next-subject n t))
|
|
5146
|
|
5147 (defun gnus-summary-prev-subject (n &optional unread)
|
|
5148 "Go to previous N'th summary line.
|
|
5149 If optional argument UNREAD is non-nil, only unread article is selected."
|
|
5150 (interactive "p")
|
|
5151 (gnus-summary-next-subject (- n) unread))
|
|
5152
|
|
5153 (defun gnus-summary-prev-unread-subject (n)
|
|
5154 "Go to previous N'th unread summary line."
|
|
5155 (interactive "p")
|
|
5156 (gnus-summary-next-subject (- n) t))
|
|
5157
|
|
5158 (defun gnus-summary-goto-subject (article &optional force silent)
|
|
5159 "Go the subject line of ARTICLE.
|
|
5160 If FORCE, also allow jumping to articles not currently shown."
|
|
5161 (interactive "nArticle number: ")
|
|
5162 (let ((b (point))
|
|
5163 (data (gnus-data-find article)))
|
|
5164 ;; We read in the article if we have to.
|
|
5165 (and (not data)
|
|
5166 force
|
|
5167 (gnus-summary-insert-subject article (and (vectorp force) force) t)
|
|
5168 (setq data (gnus-data-find article)))
|
|
5169 (goto-char b)
|
|
5170 (if (not data)
|
|
5171 (progn
|
|
5172 (unless silent
|
|
5173 (gnus-message 3 "Can't find article %d" article))
|
|
5174 nil)
|
|
5175 (goto-char (gnus-data-pos data))
|
|
5176 article)))
|
|
5177
|
|
5178 ;; Walking around summary lines with displaying articles.
|
|
5179
|
|
5180 (defun gnus-summary-expand-window (&optional arg)
|
|
5181 "Make the summary buffer take up the entire Emacs frame.
|
|
5182 Given a prefix, will force an `article' buffer configuration."
|
|
5183 (interactive "P")
|
|
5184 (gnus-set-global-variables)
|
|
5185 (if arg
|
|
5186 (gnus-configure-windows 'article 'force)
|
|
5187 (gnus-configure-windows 'summary 'force)))
|
|
5188
|
|
5189 (defun gnus-summary-display-article (article &optional all-header)
|
|
5190 "Display ARTICLE in article buffer."
|
|
5191 (gnus-set-global-variables)
|
|
5192 (if (null article)
|
|
5193 nil
|
|
5194 (prog1
|
|
5195 (if gnus-summary-display-article-function
|
|
5196 (funcall gnus-summary-display-article-function article all-header)
|
|
5197 (gnus-article-prepare article all-header))
|
|
5198 (run-hooks 'gnus-select-article-hook)
|
|
5199 (when (and gnus-current-article
|
|
5200 (not (zerop gnus-current-article)))
|
|
5201 (gnus-summary-goto-subject gnus-current-article))
|
|
5202 (gnus-summary-recenter)
|
|
5203 (when (and gnus-use-trees gnus-show-threads)
|
|
5204 (gnus-possibly-generate-tree article)
|
|
5205 (gnus-highlight-selected-tree article))
|
|
5206 ;; Successfully display article.
|
|
5207 (gnus-article-set-window-start
|
|
5208 (cdr (assq article gnus-newsgroup-bookmarks))))))
|
|
5209
|
|
5210 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
|
|
5211 "Select the current article.
|
|
5212 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
|
|
5213 non-nil, the article will be re-fetched even if it already present in
|
|
5214 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
|
|
5215 be displayed."
|
|
5216 ;; Make sure we are in the summary buffer to work around bbdb bug.
|
|
5217 (unless (eq major-mode 'gnus-summary-mode)
|
|
5218 (set-buffer gnus-summary-buffer))
|
|
5219 (let ((article (or article (gnus-summary-article-number)))
|
|
5220 (all-headers (not (not all-headers))) ;Must be T or NIL.
|
|
5221 gnus-summary-display-article-function
|
|
5222 did)
|
|
5223 (and (not pseudo)
|
|
5224 (gnus-summary-article-pseudo-p article)
|
|
5225 (error "This is a pseudo-article."))
|
|
5226 (prog1
|
|
5227 (save-excursion
|
|
5228 (set-buffer gnus-summary-buffer)
|
|
5229 (if (or (and gnus-single-article-buffer
|
|
5230 (or (null gnus-current-article)
|
|
5231 (null gnus-article-current)
|
|
5232 (null (get-buffer gnus-article-buffer))
|
|
5233 (not (eq article (cdr gnus-article-current)))
|
|
5234 (not (equal (car gnus-article-current)
|
|
5235 gnus-newsgroup-name))))
|
|
5236 (and (not gnus-single-article-buffer)
|
|
5237 (or (null gnus-current-article)
|
|
5238 (not (eq gnus-current-article article))))
|
|
5239 force)
|
|
5240 ;; The requested article is different from the current article.
|
|
5241 (prog1
|
|
5242 (gnus-summary-display-article article all-headers)
|
|
5243 (setq did article))
|
|
5244 (when (or all-headers gnus-show-all-headers)
|
|
5245 (gnus-article-show-all-headers))
|
|
5246 'old))
|
|
5247 (when did
|
|
5248 (gnus-article-set-window-start
|
|
5249 (cdr (assq article gnus-newsgroup-bookmarks)))))))
|
|
5250
|
|
5251 (defun gnus-summary-set-current-mark (&optional current-mark)
|
|
5252 "Obsolete function."
|
|
5253 nil)
|
|
5254
|
|
5255 (defun gnus-summary-next-article (&optional unread subject backward push)
|
|
5256 "Select the next article.
|
|
5257 If UNREAD, only unread articles are selected.
|
|
5258 If SUBJECT, only articles with SUBJECT are selected.
|
|
5259 If BACKWARD, the previous article is selected instead of the next."
|
|
5260 (interactive "P")
|
|
5261 (gnus-set-global-variables)
|
|
5262 (cond
|
|
5263 ;; Is there such an article?
|
|
5264 ((and (gnus-summary-search-forward unread subject backward)
|
|
5265 (or (gnus-summary-display-article (gnus-summary-article-number))
|
|
5266 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
|
|
5267 (gnus-summary-position-point))
|
|
5268 ;; If not, we try the first unread, if that is wanted.
|
|
5269 ((and subject
|
|
5270 gnus-auto-select-same
|
|
5271 (gnus-summary-first-unread-article))
|
|
5272 (gnus-summary-position-point)
|
|
5273 (gnus-message 6 "Wrapped"))
|
|
5274 ;; Try to get next/previous article not displayed in this group.
|
|
5275 ((and gnus-auto-extend-newsgroup
|
|
5276 (not unread) (not subject))
|
|
5277 (gnus-summary-goto-article
|
|
5278 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
|
|
5279 nil t))
|
|
5280 ;; Go to next/previous group.
|
|
5281 (t
|
|
5282 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5283 (gnus-summary-jump-to-group gnus-newsgroup-name))
|
|
5284 (let ((cmd last-command-char)
|
104
|
5285 (point
|
|
5286 (save-excursion
|
|
5287 (set-buffer gnus-group-buffer)
|
|
5288 (point)))
|
98
|
5289 (group
|
|
5290 (if (eq gnus-keep-same-level 'best)
|
|
5291 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5292 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5293 ;; For some reason, the group window gets selected. We change
|
|
5294 ;; it back.
|
|
5295 (select-window (get-buffer-window (current-buffer)))
|
|
5296 ;; Select next unread newsgroup automagically.
|
|
5297 (cond
|
|
5298 ((or (not gnus-auto-select-next)
|
|
5299 (not cmd))
|
|
5300 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
|
|
5301 ((or (eq gnus-auto-select-next 'quietly)
|
|
5302 (and (eq gnus-auto-select-next 'slightly-quietly)
|
|
5303 push)
|
|
5304 (and (eq gnus-auto-select-next 'almost-quietly)
|
|
5305 (gnus-summary-last-article-p)))
|
|
5306 ;; Select quietly.
|
|
5307 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5308 (gnus-summary-exit)
|
|
5309 (gnus-message 7 "No more%s articles (%s)..."
|
|
5310 (if unread " unread" "")
|
|
5311 (if group (concat "selecting " group)
|
|
5312 "exiting"))
|
|
5313 (gnus-summary-next-group nil group backward)))
|
|
5314 (t
|
|
5315 (when (gnus-key-press-event-p last-input-event)
|
|
5316 (gnus-summary-walk-group-buffer
|
104
|
5317 gnus-newsgroup-name cmd unread backward point))))))))
|
|
5318
|
|
5319 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
|
98
|
5320 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
|
|
5321 (?\C-p (gnus-group-prev-unread-group 1))))
|
|
5322 (cursor-in-echo-area t)
|
|
5323 keve key group ended)
|
|
5324 (save-excursion
|
|
5325 (set-buffer gnus-group-buffer)
|
104
|
5326 (goto-char start)
|
98
|
5327 (setq group
|
|
5328 (if (eq gnus-keep-same-level 'best)
|
|
5329 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5330 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5331 (while (not ended)
|
|
5332 (gnus-message
|
|
5333 5 "No more%s articles%s" (if unread " unread" "")
|
|
5334 (if (and group
|
|
5335 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
|
|
5336 (format " (Type %s for %s [%s])"
|
|
5337 (single-key-description cmd) group
|
|
5338 (car (gnus-gethash group gnus-newsrc-hashtb)))
|
|
5339 (format " (Type %s to exit %s)"
|
|
5340 (single-key-description cmd)
|
|
5341 gnus-newsgroup-name)))
|
|
5342 ;; Confirm auto selection.
|
|
5343 (setq key (car (setq keve (gnus-read-event-char))))
|
|
5344 (setq ended t)
|
|
5345 (cond
|
|
5346 ((assq key keystrokes)
|
|
5347 (let ((obuf (current-buffer)))
|
|
5348 (switch-to-buffer gnus-group-buffer)
|
|
5349 (when group
|
|
5350 (gnus-group-jump-to-group group))
|
|
5351 (eval (cadr (assq key keystrokes)))
|
|
5352 (setq group (gnus-group-group-name))
|
|
5353 (switch-to-buffer obuf))
|
|
5354 (setq ended nil))
|
|
5355 ((equal key cmd)
|
|
5356 (if (or (not group)
|
|
5357 (gnus-ephemeral-group-p gnus-newsgroup-name))
|
|
5358 (gnus-summary-exit)
|
|
5359 (gnus-summary-next-group nil group backward)))
|
|
5360 (t
|
|
5361 (push (cdr keve) unread-command-events))))))
|
|
5362
|
|
5363 (defun gnus-summary-next-unread-article ()
|
|
5364 "Select unread article after current one."
|
|
5365 (interactive)
|
|
5366 (gnus-summary-next-article
|
|
5367 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5368 (gnus-summary-last-article-p (gnus-summary-article-number)))
|
|
5369 (and gnus-auto-select-same
|
|
5370 (gnus-summary-article-subject))))
|
|
5371
|
|
5372 (defun gnus-summary-prev-article (&optional unread subject)
|
|
5373 "Select the article after the current one.
|
|
5374 If UNREAD is non-nil, only unread articles are selected."
|
|
5375 (interactive "P")
|
|
5376 (gnus-summary-next-article unread subject t))
|
|
5377
|
|
5378 (defun gnus-summary-prev-unread-article ()
|
|
5379 "Select unread article before current one."
|
|
5380 (interactive)
|
|
5381 (gnus-summary-prev-article
|
|
5382 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5383 (gnus-summary-first-article-p (gnus-summary-article-number)))
|
|
5384 (and gnus-auto-select-same
|
|
5385 (gnus-summary-article-subject))))
|
|
5386
|
|
5387 (defun gnus-summary-next-page (&optional lines circular)
|
|
5388 "Show next page of the selected article.
|
|
5389 If at the end of the current article, select the next article.
|
|
5390 LINES says how many lines should be scrolled up.
|
|
5391
|
|
5392 If CIRCULAR is non-nil, go to the start of the article instead of
|
|
5393 selecting the next article when reaching the end of the current
|
|
5394 article."
|
|
5395 (interactive "P")
|
|
5396 (setq gnus-summary-buffer (current-buffer))
|
|
5397 (gnus-set-global-variables)
|
|
5398 (let ((article (gnus-summary-article-number))
|
100
|
5399 (article-window (get-buffer-window gnus-article-buffer t))
|
98
|
5400 (endp nil))
|
|
5401 (gnus-configure-windows 'article)
|
|
5402 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
|
|
5403 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5404 (not (gnus-summary-last-article-p article)))
|
|
5405 (gnus-summary-next-article)
|
|
5406 (gnus-summary-next-unread-article))
|
|
5407 (if (or (null gnus-current-article)
|
|
5408 (null gnus-article-current)
|
|
5409 (/= article (cdr gnus-article-current))
|
|
5410 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5411 ;; Selected subject is different from current article's.
|
|
5412 (gnus-summary-display-article article)
|
|
5413 (when article-window
|
|
5414 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5415 (setq endp (gnus-article-next-page lines)))
|
|
5416 (when endp
|
|
5417 (cond (circular
|
|
5418 (gnus-summary-beginning-of-article))
|
|
5419 (lines
|
|
5420 (gnus-message 3 "End of message"))
|
|
5421 ((null lines)
|
|
5422 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5423 (not (gnus-summary-last-article-p article)))
|
|
5424 (gnus-summary-next-article)
|
|
5425 (gnus-summary-next-unread-article))))))))
|
|
5426 (gnus-summary-recenter)
|
|
5427 (gnus-summary-position-point)))
|
|
5428
|
|
5429 (defun gnus-summary-prev-page (&optional lines)
|
|
5430 "Show previous page of selected article.
|
|
5431 Argument LINES specifies lines to be scrolled down."
|
|
5432 (interactive "P")
|
|
5433 (gnus-set-global-variables)
|
|
5434 (let ((article (gnus-summary-article-number))
|
100
|
5435 (article-window (get-buffer-window gnus-article-buffer t)))
|
98
|
5436 (gnus-configure-windows 'article)
|
|
5437 (if (or (null gnus-current-article)
|
|
5438 (null gnus-article-current)
|
|
5439 (/= article (cdr gnus-article-current))
|
|
5440 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5441 ;; Selected subject is different from current article's.
|
|
5442 (gnus-summary-display-article article)
|
|
5443 (gnus-summary-recenter)
|
|
5444 (when article-window
|
|
5445 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5446 (gnus-article-prev-page lines)))))
|
|
5447 (gnus-summary-position-point))
|
|
5448
|
|
5449 (defun gnus-summary-scroll-up (lines)
|
|
5450 "Scroll up (or down) one line current article.
|
|
5451 Argument LINES specifies lines to be scrolled up (or down if negative)."
|
|
5452 (interactive "p")
|
|
5453 (gnus-set-global-variables)
|
|
5454 (gnus-configure-windows 'article)
|
|
5455 (gnus-summary-show-thread)
|
|
5456 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
|
|
5457 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5458 (cond ((> lines 0)
|
|
5459 (when (gnus-article-next-page lines)
|
|
5460 (gnus-message 3 "End of message")))
|
|
5461 ((< lines 0)
|
|
5462 (gnus-article-prev-page (- lines))))))
|
|
5463 (gnus-summary-recenter)
|
|
5464 (gnus-summary-position-point))
|
|
5465
|
|
5466 (defun gnus-summary-next-same-subject ()
|
|
5467 "Select next article which has the same subject as current one."
|
|
5468 (interactive)
|
|
5469 (gnus-set-global-variables)
|
|
5470 (gnus-summary-next-article nil (gnus-summary-article-subject)))
|
|
5471
|
|
5472 (defun gnus-summary-prev-same-subject ()
|
|
5473 "Select previous article which has the same subject as current one."
|
|
5474 (interactive)
|
|
5475 (gnus-set-global-variables)
|
|
5476 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
|
|
5477
|
|
5478 (defun gnus-summary-next-unread-same-subject ()
|
|
5479 "Select next unread article which has the same subject as current one."
|
|
5480 (interactive)
|
|
5481 (gnus-set-global-variables)
|
|
5482 (gnus-summary-next-article t (gnus-summary-article-subject)))
|
|
5483
|
|
5484 (defun gnus-summary-prev-unread-same-subject ()
|
|
5485 "Select previous unread article which has the same subject as current one."
|
|
5486 (interactive)
|
|
5487 (gnus-set-global-variables)
|
|
5488 (gnus-summary-prev-article t (gnus-summary-article-subject)))
|
|
5489
|
|
5490 (defun gnus-summary-first-unread-article ()
|
|
5491 "Select the first unread article.
|
|
5492 Return nil if there are no unread articles."
|
|
5493 (interactive)
|
|
5494 (gnus-set-global-variables)
|
|
5495 (prog1
|
|
5496 (when (gnus-summary-first-subject t)
|
|
5497 (gnus-summary-show-thread)
|
|
5498 (gnus-summary-first-subject t)
|
|
5499 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5500 (gnus-summary-position-point)))
|
|
5501
|
|
5502 (defun gnus-summary-first-article ()
|
|
5503 "Select the first article.
|
|
5504 Return nil if there are no articles."
|
|
5505 (interactive)
|
|
5506 (gnus-set-global-variables)
|
|
5507 (prog1
|
|
5508 (when (gnus-summary-first-subject)
|
|
5509 (gnus-summary-show-thread)
|
|
5510 (gnus-summary-first-subject)
|
|
5511 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5512 (gnus-summary-position-point)))
|
|
5513
|
|
5514 (defun gnus-summary-best-unread-article ()
|
|
5515 "Select the unread article with the highest score."
|
|
5516 (interactive)
|
|
5517 (gnus-set-global-variables)
|
|
5518 (let ((best -1000000)
|
|
5519 (data gnus-newsgroup-data)
|
|
5520 article score)
|
|
5521 (while data
|
|
5522 (and (gnus-data-unread-p (car data))
|
|
5523 (> (setq score
|
|
5524 (gnus-summary-article-score (gnus-data-number (car data))))
|
|
5525 best)
|
|
5526 (setq best score
|
|
5527 article (gnus-data-number (car data))))
|
|
5528 (setq data (cdr data)))
|
|
5529 (prog1
|
|
5530 (if article
|
|
5531 (gnus-summary-goto-article article)
|
|
5532 (error "No unread articles"))
|
|
5533 (gnus-summary-position-point))))
|
|
5534
|
|
5535 (defun gnus-summary-last-subject ()
|
|
5536 "Go to the last displayed subject line in the group."
|
|
5537 (let ((article (gnus-data-number (car (gnus-data-list t)))))
|
|
5538 (when article
|
|
5539 (gnus-summary-goto-subject article))))
|
|
5540
|
|
5541 (defun gnus-summary-goto-article (article &optional all-headers force)
|
|
5542 "Fetch ARTICLE and display it if it exists.
|
|
5543 If ALL-HEADERS is non-nil, no header lines are hidden."
|
|
5544 (interactive
|
|
5545 (list
|
|
5546 (string-to-int
|
|
5547 (completing-read
|
|
5548 "Article number: "
|
|
5549 (mapcar (lambda (number) (list (int-to-string number)))
|
|
5550 gnus-newsgroup-limit)))
|
|
5551 current-prefix-arg
|
|
5552 t))
|
|
5553 (prog1
|
|
5554 (if (gnus-summary-goto-subject article force)
|
|
5555 (gnus-summary-display-article article all-headers)
|
|
5556 (gnus-message 4 "Couldn't go to article %s" article) nil)
|
|
5557 (gnus-summary-position-point)))
|
|
5558
|
|
5559 (defun gnus-summary-goto-last-article ()
|
|
5560 "Go to the previously read article."
|
|
5561 (interactive)
|
|
5562 (prog1
|
|
5563 (when gnus-last-article
|
|
5564 (gnus-summary-goto-article gnus-last-article))
|
|
5565 (gnus-summary-position-point)))
|
|
5566
|
|
5567 (defun gnus-summary-pop-article (number)
|
|
5568 "Pop one article off the history and go to the previous.
|
|
5569 NUMBER articles will be popped off."
|
|
5570 (interactive "p")
|
|
5571 (let (to)
|
|
5572 (setq gnus-newsgroup-history
|
|
5573 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
|
|
5574 (if to
|
|
5575 (gnus-summary-goto-article (car to))
|
|
5576 (error "Article history empty")))
|
|
5577 (gnus-summary-position-point))
|
|
5578
|
|
5579 ;; Summary commands and functions for limiting the summary buffer.
|
|
5580
|
|
5581 (defun gnus-summary-limit-to-articles (n)
|
|
5582 "Limit the summary buffer to the next N articles.
|
|
5583 If not given a prefix, use the process marked articles instead."
|
|
5584 (interactive "P")
|
|
5585 (gnus-set-global-variables)
|
|
5586 (prog1
|
|
5587 (let ((articles (gnus-summary-work-articles n)))
|
|
5588 (setq gnus-newsgroup-processable nil)
|
|
5589 (gnus-summary-limit articles))
|
|
5590 (gnus-summary-position-point)))
|
|
5591
|
|
5592 (defun gnus-summary-pop-limit (&optional total)
|
|
5593 "Restore the previous limit.
|
|
5594 If given a prefix, remove all limits."
|
|
5595 (interactive "P")
|
|
5596 (gnus-set-global-variables)
|
|
5597 (when total
|
|
5598 (setq gnus-newsgroup-limits
|
|
5599 (list (mapcar (lambda (h) (mail-header-number h))
|
|
5600 gnus-newsgroup-headers))))
|
|
5601 (unless gnus-newsgroup-limits
|
|
5602 (error "No limit to pop"))
|
|
5603 (prog1
|
|
5604 (gnus-summary-limit nil 'pop)
|
|
5605 (gnus-summary-position-point)))
|
|
5606
|
|
5607 (defun gnus-summary-limit-to-subject (subject &optional header)
|
|
5608 "Limit the summary buffer to articles that have subjects that match a regexp."
|
|
5609 (interactive "sLimit to subject (regexp): ")
|
|
5610 (unless header
|
|
5611 (setq header "subject"))
|
|
5612 (when (not (equal "" subject))
|
|
5613 (prog1
|
|
5614 (let ((articles (gnus-summary-find-matching
|
|
5615 (or header "subject") subject 'all)))
|
|
5616 (unless articles
|
|
5617 (error "Found no matches for \"%s\"" subject))
|
|
5618 (gnus-summary-limit articles))
|
|
5619 (gnus-summary-position-point))))
|
|
5620
|
|
5621 (defun gnus-summary-limit-to-author (from)
|
|
5622 "Limit the summary buffer to articles that have authors that match a regexp."
|
|
5623 (interactive "sLimit to author (regexp): ")
|
|
5624 (gnus-summary-limit-to-subject from "from"))
|
|
5625
|
|
5626 (defun gnus-summary-limit-to-age (age &optional younger-p)
|
|
5627 "Limit the summary buffer to articles that are older than (or equal) AGE days.
|
|
5628 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
|
|
5629 articles that are younger than AGE days."
|
|
5630 (interactive "nTime in days: \nP")
|
|
5631 (prog1
|
|
5632 (let ((data gnus-newsgroup-data)
|
|
5633 (cutoff (nnmail-days-to-time age))
|
|
5634 articles d date is-younger)
|
|
5635 (while (setq d (pop data))
|
|
5636 (when (and (vectorp (gnus-data-header d))
|
|
5637 (setq date (mail-header-date (gnus-data-header d))))
|
|
5638 (setq is-younger (nnmail-time-less
|
|
5639 (nnmail-time-since (nnmail-date-to-time date))
|
|
5640 cutoff))
|
|
5641 (when (if younger-p is-younger (not is-younger))
|
|
5642 (push (gnus-data-number d) articles))))
|
|
5643 (gnus-summary-limit (nreverse articles)))
|
|
5644 (gnus-summary-position-point)))
|
|
5645
|
|
5646 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5647 (make-obsolete
|
|
5648 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5649
|
|
5650 (defun gnus-summary-limit-to-unread (&optional all)
|
|
5651 "Limit the summary buffer to articles that are not marked as read.
|
|
5652 If ALL is non-nil, limit strictly to unread articles."
|
|
5653 (interactive "P")
|
|
5654 (if all
|
|
5655 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
|
|
5656 (gnus-summary-limit-to-marks
|
|
5657 ;; Concat all the marks that say that an article is read and have
|
|
5658 ;; those removed.
|
|
5659 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
|
|
5660 gnus-killed-mark gnus-kill-file-mark
|
|
5661 gnus-low-score-mark gnus-expirable-mark
|
|
5662 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
|
|
5663 gnus-duplicate-mark)
|
|
5664 'reverse)))
|
|
5665
|
|
5666 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
|
|
5667 (make-obsolete 'gnus-summary-delete-marked-with
|
|
5668 'gnus-summary-limit-exlude-marks)
|
|
5669
|
|
5670 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
|
|
5671 "Exclude articles that are marked with MARKS (e.g. \"DK\").
|
|
5672 If REVERSE, limit the summary buffer to articles that are marked
|
|
5673 with MARKS. MARKS can either be a string of marks or a list of marks.
|
|
5674 Returns how many articles were removed."
|
|
5675 (interactive "sMarks: ")
|
|
5676 (gnus-summary-limit-to-marks marks t))
|
|
5677
|
|
5678 (defun gnus-summary-limit-to-marks (marks &optional reverse)
|
|
5679 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
|
|
5680 If REVERSE (the prefix), limit the summary buffer to articles that are
|
|
5681 not marked with MARKS. MARKS can either be a string of marks or a
|
|
5682 list of marks.
|
|
5683 Returns how many articles were removed."
|
|
5684 (interactive (list (read-string "Marks: ") current-prefix-arg))
|
|
5685 (gnus-set-global-variables)
|
|
5686 (prog1
|
|
5687 (let ((data gnus-newsgroup-data)
|
|
5688 (marks (if (listp marks) marks
|
|
5689 (append marks nil))) ; Transform to list.
|
|
5690 articles)
|
|
5691 (while data
|
|
5692 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
|
|
5693 (memq (gnus-data-mark (car data)) marks))
|
|
5694 (push (gnus-data-number (car data)) articles))
|
|
5695 (setq data (cdr data)))
|
|
5696 (gnus-summary-limit articles))
|
|
5697 (gnus-summary-position-point)))
|
|
5698
|
|
5699 (defun gnus-summary-limit-to-score (&optional score)
|
|
5700 "Limit to articles with score at or above SCORE."
|
|
5701 (interactive "P")
|
|
5702 (gnus-set-global-variables)
|
|
5703 (setq score (if score
|
|
5704 (prefix-numeric-value score)
|
|
5705 (or gnus-summary-default-score 0)))
|
|
5706 (let ((data gnus-newsgroup-data)
|
|
5707 articles)
|
|
5708 (while data
|
|
5709 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
|
|
5710 score)
|
|
5711 (push (gnus-data-number (car data)) articles))
|
|
5712 (setq data (cdr data)))
|
|
5713 (prog1
|
|
5714 (gnus-summary-limit articles)
|
|
5715 (gnus-summary-position-point))))
|
|
5716
|
|
5717 (defun gnus-summary-limit-include-dormant ()
|
|
5718 "Display all the hidden articles that are marked as dormant."
|
|
5719 (interactive)
|
|
5720 (gnus-set-global-variables)
|
|
5721 (unless gnus-newsgroup-dormant
|
|
5722 (error "There are no dormant articles in this group"))
|
|
5723 (prog1
|
|
5724 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
|
|
5725 (gnus-summary-position-point)))
|
|
5726
|
|
5727 (defun gnus-summary-limit-exclude-dormant ()
|
|
5728 "Hide all dormant articles."
|
|
5729 (interactive)
|
|
5730 (gnus-set-global-variables)
|
|
5731 (prog1
|
|
5732 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
|
|
5733 (gnus-summary-position-point)))
|
|
5734
|
|
5735 (defun gnus-summary-limit-exclude-childless-dormant ()
|
|
5736 "Hide all dormant articles that have no children."
|
|
5737 (interactive)
|
|
5738 (gnus-set-global-variables)
|
|
5739 (let ((data (gnus-data-list t))
|
|
5740 articles d children)
|
|
5741 ;; Find all articles that are either not dormant or have
|
|
5742 ;; children.
|
|
5743 (while (setq d (pop data))
|
|
5744 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
|
|
5745 (and (setq children
|
|
5746 (gnus-article-children (gnus-data-number d)))
|
|
5747 (let (found)
|
|
5748 (while children
|
|
5749 (when (memq (car children) articles)
|
|
5750 (setq children nil
|
|
5751 found t))
|
|
5752 (pop children))
|
|
5753 found)))
|
|
5754 (push (gnus-data-number d) articles)))
|
|
5755 ;; Do the limiting.
|
|
5756 (prog1
|
|
5757 (gnus-summary-limit articles)
|
|
5758 (gnus-summary-position-point))))
|
|
5759
|
|
5760 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
|
|
5761 "Mark all unread excluded articles as read.
|
|
5762 If ALL, mark even excluded ticked and dormants as read."
|
|
5763 (interactive "P")
|
|
5764 (let ((articles (gnus-sorted-complement
|
|
5765 (sort
|
|
5766 (mapcar (lambda (h) (mail-header-number h))
|
|
5767 gnus-newsgroup-headers)
|
|
5768 '<)
|
|
5769 (sort gnus-newsgroup-limit '<)))
|
|
5770 article)
|
|
5771 (setq gnus-newsgroup-unreads nil)
|
|
5772 (if all
|
|
5773 (setq gnus-newsgroup-dormant nil
|
|
5774 gnus-newsgroup-marked nil
|
|
5775 gnus-newsgroup-reads
|
|
5776 (nconc
|
|
5777 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
|
|
5778 gnus-newsgroup-reads))
|
|
5779 (while (setq article (pop articles))
|
|
5780 (unless (or (memq article gnus-newsgroup-dormant)
|
|
5781 (memq article gnus-newsgroup-marked))
|
|
5782 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
|
|
5783
|
|
5784 (defun gnus-summary-limit (articles &optional pop)
|
|
5785 (if pop
|
|
5786 ;; We pop the previous limit off the stack and use that.
|
|
5787 (setq articles (car gnus-newsgroup-limits)
|
|
5788 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
|
|
5789 ;; We use the new limit, so we push the old limit on the stack.
|
|
5790 (push gnus-newsgroup-limit gnus-newsgroup-limits))
|
|
5791 ;; Set the limit.
|
|
5792 (setq gnus-newsgroup-limit articles)
|
|
5793 (let ((total (length gnus-newsgroup-data))
|
|
5794 (data (gnus-data-find-list (gnus-summary-article-number)))
|
|
5795 (gnus-summary-mark-below nil) ; Inhibit this.
|
|
5796 found)
|
|
5797 ;; This will do all the work of generating the new summary buffer
|
|
5798 ;; according to the new limit.
|
|
5799 (gnus-summary-prepare)
|
|
5800 ;; Hide any threads, possibly.
|
|
5801 (and gnus-show-threads
|
|
5802 gnus-thread-hide-subtree
|
|
5803 (gnus-summary-hide-all-threads))
|
|
5804 ;; Try to return to the article you were at, or one in the
|
|
5805 ;; neighborhood.
|
|
5806 (when data
|
|
5807 ;; We try to find some article after the current one.
|
|
5808 (while data
|
|
5809 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
|
|
5810 (setq data nil
|
|
5811 found t))
|
|
5812 (setq data (cdr data))))
|
|
5813 (unless found
|
|
5814 ;; If there is no data, that means that we were after the last
|
|
5815 ;; article. The same goes when we can't find any articles
|
|
5816 ;; after the current one.
|
|
5817 (goto-char (point-max))
|
|
5818 (gnus-summary-find-prev))
|
|
5819 ;; We return how many articles were removed from the summary
|
|
5820 ;; buffer as a result of the new limit.
|
|
5821 (- total (length gnus-newsgroup-data))))
|
|
5822
|
|
5823 (defsubst gnus-invisible-cut-children (threads)
|
|
5824 (let ((num 0))
|
|
5825 (while threads
|
|
5826 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
|
|
5827 (incf num))
|
|
5828 (pop threads))
|
|
5829 (< num 2)))
|
|
5830
|
|
5831 (defsubst gnus-cut-thread (thread)
|
|
5832 "Go forwards in the thread until we find an article that we want to display."
|
|
5833 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5834 (eq gnus-build-sparse-threads 'some)
|
|
5835 (eq gnus-build-sparse-threads 'more))
|
|
5836 ;; Deal with old-fetched headers and sparse threads.
|
|
5837 (while (and
|
|
5838 thread
|
|
5839 (or
|
|
5840 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
|
|
5841 (gnus-summary-article-ancient-p
|
|
5842 (mail-header-number (car thread))))
|
|
5843 (progn
|
|
5844 (if (<= (length (cdr thread)) 1)
|
|
5845 (setq thread (cadr thread))
|
|
5846 (when (gnus-invisible-cut-children (cdr thread))
|
|
5847 (let ((th (cdr thread)))
|
|
5848 (while th
|
|
5849 (if (memq (mail-header-number (caar th))
|
|
5850 gnus-newsgroup-limit)
|
|
5851 (setq thread (car th)
|
|
5852 th nil)
|
|
5853 (setq th (cdr th)))))))))
|
|
5854 ))
|
|
5855 thread)
|
|
5856
|
|
5857 (defun gnus-cut-threads (threads)
|
|
5858 "Cut off all uninteresting articles from the beginning of threads."
|
|
5859 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5860 (eq gnus-build-sparse-threads 'some)
|
|
5861 (eq gnus-build-sparse-threads 'more))
|
|
5862 (let ((th threads))
|
|
5863 (while th
|
|
5864 (setcar th (gnus-cut-thread (car th)))
|
|
5865 (setq th (cdr th)))))
|
|
5866 ;; Remove nixed out threads.
|
|
5867 (delq nil threads))
|
|
5868
|
|
5869 (defun gnus-summary-initial-limit (&optional show-if-empty)
|
|
5870 "Figure out what the initial limit is supposed to be on group entry.
|
|
5871 This entails weeding out unwanted dormants, low-scored articles,
|
|
5872 fetch-old-headers verbiage, and so on."
|
|
5873 ;; Most groups have nothing to remove.
|
|
5874 (if (or gnus-inhibit-limiting
|
|
5875 (and (null gnus-newsgroup-dormant)
|
|
5876 (not (eq gnus-fetch-old-headers 'some))
|
|
5877 (null gnus-summary-expunge-below)
|
|
5878 (not (eq gnus-build-sparse-threads 'some))
|
|
5879 (not (eq gnus-build-sparse-threads 'more))
|
|
5880 (null gnus-thread-expunge-below)
|
|
5881 (not gnus-use-nocem)))
|
|
5882 () ; Do nothing.
|
|
5883 (push gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
5884 (setq gnus-newsgroup-limit nil)
|
|
5885 (mapatoms
|
|
5886 (lambda (node)
|
|
5887 (unless (car (symbol-value node))
|
|
5888 ;; These threads have no parents -- they are roots.
|
|
5889 (let ((nodes (cdr (symbol-value node)))
|
|
5890 thread)
|
|
5891 (while nodes
|
|
5892 (if (and gnus-thread-expunge-below
|
|
5893 (< (gnus-thread-total-score (car nodes))
|
|
5894 gnus-thread-expunge-below))
|
|
5895 (gnus-expunge-thread (pop nodes))
|
|
5896 (setq thread (pop nodes))
|
|
5897 (gnus-summary-limit-children thread))))))
|
|
5898 gnus-newsgroup-dependencies)
|
|
5899 ;; If this limitation resulted in an empty group, we might
|
|
5900 ;; pop the previous limit and use it instead.
|
|
5901 (when (and (not gnus-newsgroup-limit)
|
|
5902 show-if-empty)
|
|
5903 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
|
|
5904 gnus-newsgroup-limit))
|
|
5905
|
|
5906 (defun gnus-summary-limit-children (thread)
|
|
5907 "Return 1 if this subthread is visible and 0 if it is not."
|
|
5908 ;; First we get the number of visible children to this thread. This
|
|
5909 ;; is done by recursing down the thread using this function, so this
|
|
5910 ;; will really go down to a leaf article first, before slowly
|
|
5911 ;; working its way up towards the root.
|
|
5912 (when thread
|
|
5913 (let ((children
|
|
5914 (if (cdr thread)
|
|
5915 (apply '+ (mapcar 'gnus-summary-limit-children
|
|
5916 (cdr thread)))
|
|
5917 0))
|
|
5918 (number (mail-header-number (car thread)))
|
|
5919 score)
|
|
5920 (if (and
|
|
5921 (not (memq number gnus-newsgroup-marked))
|
|
5922 (or
|
|
5923 ;; If this article is dormant and has absolutely no visible
|
|
5924 ;; children, then this article isn't visible.
|
|
5925 (and (memq number gnus-newsgroup-dormant)
|
|
5926 (zerop children))
|
|
5927 ;; If this is "fetch-old-headered" and there is no
|
|
5928 ;; visible children, then we don't want this article.
|
|
5929 (and (eq gnus-fetch-old-headers 'some)
|
|
5930 (gnus-summary-article-ancient-p number)
|
|
5931 (zerop children))
|
|
5932 ;; If this is a sparsely inserted article with no children,
|
|
5933 ;; we don't want it.
|
|
5934 (and (eq gnus-build-sparse-threads 'some)
|
|
5935 (gnus-summary-article-sparse-p number)
|
|
5936 (zerop children))
|
|
5937 ;; If we use expunging, and this article is really
|
|
5938 ;; low-scored, then we don't want this article.
|
|
5939 (when (and gnus-summary-expunge-below
|
|
5940 (< (setq score
|
|
5941 (or (cdr (assq number gnus-newsgroup-scored))
|
|
5942 gnus-summary-default-score))
|
|
5943 gnus-summary-expunge-below))
|
|
5944 ;; We increase the expunge-tally here, but that has
|
|
5945 ;; nothing to do with the limits, really.
|
|
5946 (incf gnus-newsgroup-expunged-tally)
|
|
5947 ;; We also mark as read here, if that's wanted.
|
|
5948 (when (and gnus-summary-mark-below
|
|
5949 (< score gnus-summary-mark-below))
|
|
5950 (setq gnus-newsgroup-unreads
|
|
5951 (delq number gnus-newsgroup-unreads))
|
|
5952 (if gnus-newsgroup-auto-expire
|
|
5953 (push number gnus-newsgroup-expirable)
|
|
5954 (push (cons number gnus-low-score-mark)
|
|
5955 gnus-newsgroup-reads)))
|
|
5956 t)
|
|
5957 ;; Check NoCeM things.
|
|
5958 (if (and gnus-use-nocem
|
|
5959 (gnus-nocem-unwanted-article-p
|
|
5960 (mail-header-id (car thread))))
|
|
5961 (progn
|
|
5962 (setq gnus-newsgroup-reads
|
|
5963 (delq number gnus-newsgroup-unreads))
|
|
5964 t))))
|
|
5965 ;; Nope, invisible article.
|
|
5966 0
|
|
5967 ;; Ok, this article is to be visible, so we add it to the limit
|
|
5968 ;; and return 1.
|
|
5969 (push number gnus-newsgroup-limit)
|
|
5970 1))))
|
|
5971
|
|
5972 (defun gnus-expunge-thread (thread)
|
|
5973 "Mark all articles in THREAD as read."
|
|
5974 (let* ((number (mail-header-number (car thread))))
|
|
5975 (incf gnus-newsgroup-expunged-tally)
|
|
5976 ;; We also mark as read here, if that's wanted.
|
|
5977 (setq gnus-newsgroup-unreads
|
|
5978 (delq number gnus-newsgroup-unreads))
|
|
5979 (if gnus-newsgroup-auto-expire
|
|
5980 (push number gnus-newsgroup-expirable)
|
|
5981 (push (cons number gnus-low-score-mark)
|
|
5982 gnus-newsgroup-reads)))
|
|
5983 ;; Go recursively through all subthreads.
|
|
5984 (mapcar 'gnus-expunge-thread (cdr thread)))
|
|
5985
|
|
5986 ;; Summary article oriented commands
|
|
5987
|
|
5988 (defun gnus-summary-refer-parent-article (n)
|
|
5989 "Refer parent article N times.
|
|
5990 If N is negative, go to ancestor -N instead.
|
|
5991 The difference between N and the number of articles fetched is returned."
|
|
5992 (interactive "p")
|
|
5993 (gnus-set-global-variables)
|
|
5994 (let ((skip 1)
|
|
5995 error header ref)
|
|
5996 (when (not (natnump n))
|
|
5997 (setq skip (abs n)
|
|
5998 n 1))
|
|
5999 (while (and (> n 0)
|
|
6000 (not error))
|
|
6001 (setq header (gnus-summary-article-header))
|
|
6002 (if (and (eq (mail-header-number header)
|
|
6003 (cdr gnus-article-current))
|
|
6004 (equal gnus-newsgroup-name
|
|
6005 (car gnus-article-current)))
|
|
6006 ;; If we try to find the parent of the currently
|
|
6007 ;; displayed article, then we take a look at the actual
|
|
6008 ;; References header, since this is slightly more
|
|
6009 ;; reliable than the References field we got from the
|
|
6010 ;; server.
|
|
6011 (save-excursion
|
|
6012 (set-buffer gnus-original-article-buffer)
|
|
6013 (nnheader-narrow-to-headers)
|
|
6014 (unless (setq ref (message-fetch-field "references"))
|
|
6015 (setq ref (message-fetch-field "in-reply-to")))
|
|
6016 (widen))
|
|
6017 (setq ref
|
|
6018 ;; It's not the current article, so we take a bet on
|
|
6019 ;; the value we got from the server.
|
|
6020 (mail-header-references header)))
|
|
6021 (if (and ref
|
|
6022 (not (equal ref "")))
|
|
6023 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
|
|
6024 (gnus-message 1 "Couldn't find parent"))
|
|
6025 (gnus-message 1 "No references in article %d"
|
|
6026 (gnus-summary-article-number))
|
|
6027 (setq error t))
|
|
6028 (decf n))
|
|
6029 (gnus-summary-position-point)
|
|
6030 n))
|
|
6031
|
|
6032 (defun gnus-summary-refer-references ()
|
|
6033 "Fetch all articles mentioned in the References header.
|
|
6034 Return how many articles were fetched."
|
|
6035 (interactive)
|
|
6036 (gnus-set-global-variables)
|
|
6037 (let ((ref (mail-header-references (gnus-summary-article-header)))
|
|
6038 (current (gnus-summary-article-number))
|
|
6039 (n 0))
|
|
6040 (if (or (not ref)
|
|
6041 (equal ref ""))
|
|
6042 (error "No References in the current article")
|
|
6043 ;; For each Message-ID in the References header...
|
|
6044 (while (string-match "<[^>]*>" ref)
|
|
6045 (incf n)
|
|
6046 ;; ... fetch that article.
|
|
6047 (gnus-summary-refer-article
|
|
6048 (prog1 (match-string 0 ref)
|
|
6049 (setq ref (substring ref (match-end 0))))))
|
|
6050 (gnus-summary-goto-subject current)
|
|
6051 (gnus-summary-position-point)
|
|
6052 n)))
|
|
6053
|
|
6054 (defun gnus-summary-refer-article (message-id)
|
|
6055 "Fetch an article specified by MESSAGE-ID."
|
|
6056 (interactive "sMessage-ID: ")
|
|
6057 (when (and (stringp message-id)
|
|
6058 (not (zerop (length message-id))))
|
|
6059 ;; Construct the correct Message-ID if necessary.
|
|
6060 ;; Suggested by tale@pawl.rpi.edu.
|
|
6061 (unless (string-match "^<" message-id)
|
|
6062 (setq message-id (concat "<" message-id)))
|
|
6063 (unless (string-match ">$" message-id)
|
|
6064 (setq message-id (concat message-id ">")))
|
|
6065 (let* ((header (gnus-id-to-header message-id))
|
|
6066 (sparse (and header
|
|
6067 (gnus-summary-article-sparse-p
|
|
6068 (mail-header-number header)))))
|
|
6069 (if header
|
|
6070 (prog1
|
|
6071 ;; The article is present in the buffer, to we just go to it.
|
|
6072 (gnus-summary-goto-article
|
|
6073 (mail-header-number header) nil header)
|
|
6074 (when sparse
|
|
6075 (gnus-summary-update-article (mail-header-number header))))
|
|
6076 ;; We fetch the article
|
|
6077 (let ((gnus-override-method
|
|
6078 (and (gnus-news-group-p gnus-newsgroup-name)
|
|
6079 gnus-refer-article-method))
|
|
6080 number)
|
|
6081 ;; Start the special refer-article method, if necessary.
|
|
6082 (when (and gnus-refer-article-method
|
|
6083 (gnus-news-group-p gnus-newsgroup-name))
|
|
6084 (gnus-check-server gnus-refer-article-method))
|
|
6085 ;; Fetch the header, and display the article.
|
|
6086 (if (setq number (gnus-summary-insert-subject message-id))
|
|
6087 (gnus-summary-select-article nil nil nil number)
|
|
6088 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
|
|
6089
|
|
6090 (defun gnus-summary-enter-digest-group (&optional force)
|
|
6091 "Enter an nndoc group based on the current article.
|
|
6092 If FORCE, force a digest interpretation. If not, try
|
|
6093 to guess what the document format is."
|
|
6094 (interactive "P")
|
|
6095 (gnus-set-global-variables)
|
|
6096 (let ((conf gnus-current-window-configuration))
|
|
6097 (save-excursion
|
|
6098 (gnus-summary-select-article))
|
|
6099 (setq gnus-current-window-configuration conf)
|
|
6100 (let* ((name (format "%s-%d"
|
|
6101 (gnus-group-prefixed-name
|
|
6102 gnus-newsgroup-name (list 'nndoc ""))
|
|
6103 (save-excursion
|
|
6104 (set-buffer gnus-summary-buffer)
|
|
6105 gnus-current-article)))
|
|
6106 (ogroup gnus-newsgroup-name)
|
|
6107 (params (append (gnus-info-params (gnus-get-info ogroup))
|
|
6108 (list (cons 'to-group ogroup))))
|
|
6109 (case-fold-search t)
|
|
6110 (buf (current-buffer))
|
|
6111 dig)
|
|
6112 (save-excursion
|
|
6113 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
|
|
6114 (insert-buffer-substring gnus-original-article-buffer)
|
|
6115 ;; Remove lines that may lead nndoc to misinterpret the
|
|
6116 ;; document type.
|
|
6117 (narrow-to-region
|
|
6118 (goto-char (point-min))
|
|
6119 (or (search-forward "\n\n" nil t) (point)))
|
|
6120 (goto-char (point-min))
|
|
6121 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6122 (widen))
|
|
6123 (unwind-protect
|
|
6124 (if (gnus-group-read-ephemeral-group
|
|
6125 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
|
|
6126 (nndoc-article-type
|
|
6127 ,(if force 'digest 'guess))) t)
|
|
6128 ;; Make all postings to this group go to the parent group.
|
|
6129 (nconc (gnus-info-params (gnus-get-info name))
|
|
6130 params)
|
|
6131 ;; Couldn't select this doc group.
|
|
6132 (switch-to-buffer buf)
|
|
6133 (gnus-set-global-variables)
|
|
6134 (gnus-configure-windows 'summary)
|
|
6135 (gnus-message 3 "Article couldn't be entered?"))
|
|
6136 (kill-buffer dig)))))
|
|
6137
|
|
6138 (defun gnus-summary-read-document (n)
|
|
6139 "Open a new group based on the current article(s).
|
|
6140 This will allow you to read digests and other similar
|
|
6141 documents as newsgroups.
|
|
6142 Obeys the standard process/prefix convention."
|
|
6143 (interactive "P")
|
|
6144 (let* ((articles (gnus-summary-work-articles n))
|
|
6145 (ogroup gnus-newsgroup-name)
|
|
6146 (params (append (gnus-info-params (gnus-get-info ogroup))
|
|
6147 (list (cons 'to-group ogroup))))
|
|
6148 article group egroup groups vgroup)
|
|
6149 (while (setq article (pop articles))
|
|
6150 (setq group (format "%s-%d" gnus-newsgroup-name article))
|
|
6151 (gnus-summary-remove-process-mark article)
|
|
6152 (when (gnus-summary-display-article article)
|
|
6153 (save-excursion
|
|
6154 (nnheader-temp-write nil
|
|
6155 (insert-buffer-substring gnus-original-article-buffer)
|
|
6156 ;; Remove some headers that may lead nndoc to make
|
|
6157 ;; the wrong guess.
|
|
6158 (message-narrow-to-head)
|
|
6159 (goto-char (point-min))
|
|
6160 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6161 (widen)
|
|
6162 (if (setq egroup
|
|
6163 (gnus-group-read-ephemeral-group
|
|
6164 group `(nndoc ,group (nndoc-address ,(current-buffer))
|
|
6165 (nndoc-article-type guess))
|
|
6166 t nil t))
|
|
6167 (progn
|
|
6168 ;; Make all postings to this group go to the parent group.
|
|
6169 (nconc (gnus-info-params (gnus-get-info egroup))
|
|
6170 params)
|
|
6171 (push egroup groups))
|
|
6172 ;; Couldn't select this doc group.
|
|
6173 (gnus-error 3 "Article couldn't be entered"))))))
|
|
6174 ;; Now we have selected all the documents.
|
|
6175 (cond
|
|
6176 ((not groups)
|
|
6177 (error "None of the articles could be interpreted as documents"))
|
|
6178 ((gnus-group-read-ephemeral-group
|
|
6179 (setq vgroup (format
|
|
6180 "nnvirtual:%s-%s" gnus-newsgroup-name
|
|
6181 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
|
|
6182 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
|
|
6183 t
|
|
6184 (cons (current-buffer) 'summary)))
|
|
6185 (t
|
|
6186 (error "Couldn't select virtual nndoc group")))))
|
|
6187
|
|
6188 (defun gnus-summary-isearch-article (&optional regexp-p)
|
|
6189 "Do incremental search forward on the current article.
|
|
6190 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
|
|
6191 (interactive "P")
|
|
6192 (gnus-set-global-variables)
|
|
6193 (gnus-summary-select-article)
|
|
6194 (gnus-configure-windows 'article)
|
|
6195 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6196 ;;(goto-char (point-min))
|
|
6197 (isearch-forward regexp-p)))
|
|
6198
|
|
6199 (defun gnus-summary-search-article-forward (regexp &optional backward)
|
|
6200 "Search for an article containing REGEXP forward.
|
|
6201 If BACKWARD, search backward instead."
|
|
6202 (interactive
|
|
6203 (list (read-string
|
|
6204 (format "Search article %s (regexp%s): "
|
|
6205 (if current-prefix-arg "backward" "forward")
|
|
6206 (if gnus-last-search-regexp
|
|
6207 (concat ", default " gnus-last-search-regexp)
|
|
6208 "")))
|
|
6209 current-prefix-arg))
|
|
6210 (gnus-set-global-variables)
|
|
6211 (if (string-equal regexp "")
|
|
6212 (setq regexp (or gnus-last-search-regexp ""))
|
|
6213 (setq gnus-last-search-regexp regexp))
|
|
6214 (if (gnus-summary-search-article regexp backward)
|
|
6215 (gnus-summary-show-thread)
|
|
6216 (error "Search failed: \"%s\"" regexp)))
|
|
6217
|
|
6218 (defun gnus-summary-search-article-backward (regexp)
|
|
6219 "Search for an article containing REGEXP backward."
|
|
6220 (interactive
|
|
6221 (list (read-string
|
|
6222 (format "Search article backward (regexp%s): "
|
|
6223 (if gnus-last-search-regexp
|
|
6224 (concat ", default " gnus-last-search-regexp)
|
|
6225 "")))))
|
|
6226 (gnus-summary-search-article-forward regexp 'backward))
|
|
6227
|
|
6228 (defun gnus-summary-search-article (regexp &optional backward)
|
|
6229 "Search for an article containing REGEXP.
|
|
6230 Optional argument BACKWARD means do search for backward.
|
|
6231 `gnus-select-article-hook' is not called during the search."
|
|
6232 (let ((gnus-select-article-hook nil) ;Disable hook.
|
|
6233 (gnus-article-display-hook nil)
|
|
6234 (gnus-mark-article-hook nil) ;Inhibit marking as read.
|
|
6235 (gnus-use-article-prefetch nil)
|
|
6236 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
|
|
6237 (sum (current-buffer))
|
|
6238 (found nil)
|
|
6239 point)
|
|
6240 (gnus-save-hidden-threads
|
|
6241 (gnus-summary-select-article)
|
|
6242 (set-buffer gnus-article-buffer)
|
|
6243 (when backward
|
|
6244 (forward-line -1))
|
|
6245 (while (not found)
|
|
6246 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
|
|
6247 (if (if backward
|
|
6248 (re-search-backward regexp nil t)
|
|
6249 (re-search-forward regexp nil t))
|
|
6250 ;; We found the regexp.
|
|
6251 (progn
|
|
6252 (setq found 'found)
|
|
6253 (beginning-of-line)
|
|
6254 (set-window-start
|
|
6255 (get-buffer-window (current-buffer))
|
|
6256 (point))
|
|
6257 (forward-line 1)
|
|
6258 (set-buffer sum)
|
|
6259 (setq point (point)))
|
|
6260 ;; We didn't find it, so we go to the next article.
|
|
6261 (set-buffer sum)
|
|
6262 (setq found 'not)
|
|
6263 (while (eq found 'not)
|
|
6264 (if (not (if backward (gnus-summary-find-prev)
|
|
6265 (gnus-summary-find-next)))
|
|
6266 ;; No more articles.
|
|
6267 (setq found t)
|
|
6268 ;; Select the next article and adjust point.
|
|
6269 (unless (gnus-summary-article-sparse-p
|
|
6270 (gnus-summary-article-number))
|
|
6271 (setq found nil)
|
|
6272 (gnus-summary-select-article)
|
|
6273 (set-buffer gnus-article-buffer)
|
|
6274 (widen)
|
|
6275 (goto-char (if backward (point-max) (point-min))))))))
|
|
6276 (gnus-message 7 ""))
|
|
6277 ;; Return whether we found the regexp.
|
|
6278 (when (eq found 'found)
|
|
6279 (goto-char point)
|
|
6280 (gnus-summary-show-thread)
|
|
6281 (gnus-summary-goto-subject gnus-current-article)
|
|
6282 (gnus-summary-position-point)
|
|
6283 t)))
|
|
6284
|
|
6285 (defun gnus-summary-find-matching (header regexp &optional backward unread
|
|
6286 not-case-fold)
|
|
6287 "Return a list of all articles that match REGEXP on HEADER.
|
|
6288 The search stars on the current article and goes forwards unless
|
|
6289 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
|
|
6290 If UNREAD is non-nil, only unread articles will
|
|
6291 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
|
|
6292 in the comparisons."
|
|
6293 (let ((data (if (eq backward 'all) gnus-newsgroup-data
|
|
6294 (gnus-data-find-list
|
|
6295 (gnus-summary-article-number) (gnus-data-list backward))))
|
|
6296 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
|
|
6297 (case-fold-search (not not-case-fold))
|
|
6298 articles d)
|
|
6299 (unless (fboundp (intern (concat "mail-header-" header)))
|
|
6300 (error "%s is not a valid header" header))
|
|
6301 (while data
|
|
6302 (setq d (car data))
|
|
6303 (and (or (not unread) ; We want all articles...
|
|
6304 (gnus-data-unread-p d)) ; Or just unreads.
|
|
6305 (vectorp (gnus-data-header d)) ; It's not a pseudo.
|
|
6306 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
|
|
6307 (push (gnus-data-number d) articles)) ; Success!
|
|
6308 (setq data (cdr data)))
|
|
6309 (nreverse articles)))
|
|
6310
|
|
6311 (defun gnus-summary-execute-command (header regexp command &optional backward)
|
|
6312 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
|
|
6313 If HEADER is an empty string (or nil), the match is done on the entire
|
|
6314 article. If BACKWARD (the prefix) is non-nil, search backward instead."
|
|
6315 (interactive
|
|
6316 (list (let ((completion-ignore-case t))
|
|
6317 (completing-read
|
|
6318 "Header name: "
|
|
6319 (mapcar (lambda (string) (list string))
|
|
6320 '("Number" "Subject" "From" "Lines" "Date"
|
|
6321 "Message-ID" "Xref" "References" "Body"))
|
|
6322 nil 'require-match))
|
|
6323 (read-string "Regexp: ")
|
|
6324 (read-key-sequence "Command: ")
|
|
6325 current-prefix-arg))
|
|
6326 (when (equal header "Body")
|
|
6327 (setq header ""))
|
|
6328 (gnus-set-global-variables)
|
|
6329 ;; Hidden thread subtrees must be searched as well.
|
|
6330 (gnus-summary-show-all-threads)
|
|
6331 ;; We don't want to change current point nor window configuration.
|
|
6332 (save-excursion
|
|
6333 (save-window-excursion
|
|
6334 (gnus-message 6 "Executing %s..." (key-description command))
|
|
6335 ;; We'd like to execute COMMAND interactively so as to give arguments.
|
|
6336 (gnus-execute header regexp
|
|
6337 `(call-interactively ',(key-binding command))
|
|
6338 backward)
|
|
6339 (gnus-message 6 "Executing %s...done" (key-description command)))))
|
|
6340
|
|
6341 (defun gnus-summary-beginning-of-article ()
|
|
6342 "Scroll the article back to the beginning."
|
|
6343 (interactive)
|
|
6344 (gnus-set-global-variables)
|
|
6345 (gnus-summary-select-article)
|
|
6346 (gnus-configure-windows 'article)
|
|
6347 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6348 (widen)
|
|
6349 (goto-char (point-min))
|
|
6350 (when gnus-break-pages
|
|
6351 (gnus-narrow-to-page))))
|
|
6352
|
|
6353 (defun gnus-summary-end-of-article ()
|
|
6354 "Scroll to the end of the article."
|
|
6355 (interactive)
|
|
6356 (gnus-set-global-variables)
|
|
6357 (gnus-summary-select-article)
|
|
6358 (gnus-configure-windows 'article)
|
|
6359 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6360 (widen)
|
|
6361 (goto-char (point-max))
|
|
6362 (recenter -3)
|
|
6363 (when gnus-break-pages
|
|
6364 (gnus-narrow-to-page))))
|
|
6365
|
|
6366 (defun gnus-summary-print-article (&optional filename)
|
|
6367 "Generate and print a PostScript image of the article buffer.
|
|
6368
|
|
6369 If the optional argument FILENAME is nil, send the image to the printer.
|
|
6370 If FILENAME is a string, save the PostScript image in a file with that
|
|
6371 name. If FILENAME is a number, prompt the user for the name of the file
|
|
6372 to save in."
|
|
6373 (interactive (list (ps-print-preprint current-prefix-arg)))
|
|
6374 (gnus-summary-select-article)
|
|
6375 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6376 (let ((buffer (generate-new-buffer " *print*")))
|
|
6377 (unwind-protect
|
|
6378 (progn
|
|
6379 (copy-to-buffer buffer (point-min) (point-max))
|
|
6380 (set-buffer buffer)
|
|
6381 (gnus-article-delete-invisible-text)
|
|
6382 (run-hooks 'gnus-ps-print-hook)
|
|
6383 (ps-print-buffer-with-faces filename))
|
|
6384 (kill-buffer buffer)))))
|
|
6385
|
|
6386 (defun gnus-summary-show-article (&optional arg)
|
|
6387 "Force re-fetching of the current article.
|
|
6388 If ARG (the prefix) is non-nil, show the raw article without any
|
|
6389 article massaging functions being run."
|
|
6390 (interactive "P")
|
|
6391 (gnus-set-global-variables)
|
|
6392 (if (not arg)
|
|
6393 ;; Select the article the normal way.
|
|
6394 (gnus-summary-select-article nil 'force)
|
|
6395 ;; Bind the article treatment functions to nil.
|
|
6396 (let ((gnus-have-all-headers t)
|
|
6397 gnus-article-display-hook
|
|
6398 gnus-article-prepare-hook
|
|
6399 gnus-break-pages
|
|
6400 gnus-visual)
|
|
6401 (gnus-summary-select-article nil 'force)))
|
|
6402 (gnus-summary-goto-subject gnus-current-article)
|
|
6403 ; (gnus-configure-windows 'article)
|
|
6404 (gnus-summary-position-point))
|
|
6405
|
|
6406 (defun gnus-summary-verbose-headers (&optional arg)
|
|
6407 "Toggle permanent full header display.
|
|
6408 If ARG is a positive number, turn header display on.
|
|
6409 If ARG is a negative number, turn header display off."
|
|
6410 (interactive "P")
|
|
6411 (gnus-set-global-variables)
|
|
6412 (setq gnus-show-all-headers
|
|
6413 (cond ((or (not (numberp arg))
|
|
6414 (zerop arg))
|
|
6415 (not gnus-show-all-headers))
|
|
6416 ((natnump arg)
|
|
6417 t)))
|
|
6418 (gnus-summary-show-article))
|
|
6419
|
|
6420 (defun gnus-summary-toggle-header (&optional arg)
|
|
6421 "Show the headers if they are hidden, or hide them if they are shown.
|
|
6422 If ARG is a positive number, show the entire header.
|
|
6423 If ARG is a negative number, hide the unwanted header lines."
|
|
6424 (interactive "P")
|
|
6425 (gnus-set-global-variables)
|
|
6426 (save-excursion
|
|
6427 (set-buffer gnus-article-buffer)
|
|
6428 (let* ((buffer-read-only nil)
|
|
6429 (inhibit-point-motion-hooks t)
|
|
6430 (hidden (text-property-any
|
|
6431 (goto-char (point-min)) (search-forward "\n\n")
|
|
6432 'invisible t))
|
|
6433 e)
|
|
6434 (goto-char (point-min))
|
|
6435 (when (search-forward "\n\n" nil t)
|
|
6436 (delete-region (point-min) (1- (point))))
|
|
6437 (goto-char (point-min))
|
|
6438 (save-excursion
|
|
6439 (set-buffer gnus-original-article-buffer)
|
|
6440 (goto-char (point-min))
|
|
6441 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
|
|
6442 (insert-buffer-substring gnus-original-article-buffer 1 e)
|
|
6443 (let ((article-inhibit-hiding t))
|
|
6444 (run-hooks 'gnus-article-display-hook))
|
|
6445 (when (or (not hidden) (and (numberp arg) (< arg 0)))
|
|
6446 (gnus-article-hide-headers)))))
|
|
6447
|
|
6448 (defun gnus-summary-show-all-headers ()
|
|
6449 "Make all header lines visible."
|
|
6450 (interactive)
|
|
6451 (gnus-set-global-variables)
|
|
6452 (gnus-article-show-all-headers))
|
|
6453
|
|
6454 (defun gnus-summary-toggle-mime (&optional arg)
|
|
6455 "Toggle MIME processing.
|
|
6456 If ARG is a positive number, turn MIME processing on."
|
|
6457 (interactive "P")
|
|
6458 (gnus-set-global-variables)
|
|
6459 (setq gnus-show-mime
|
|
6460 (if (null arg) (not gnus-show-mime)
|
|
6461 (> (prefix-numeric-value arg) 0)))
|
|
6462 (gnus-summary-select-article t 'force))
|
|
6463
|
|
6464 (defun gnus-summary-caesar-message (&optional arg)
|
|
6465 "Caesar rotate the current article by 13.
|
|
6466 The numerical prefix specifies how many places to rotate each letter
|
|
6467 forward."
|
|
6468 (interactive "P")
|
|
6469 (gnus-set-global-variables)
|
|
6470 (gnus-summary-select-article)
|
|
6471 (let ((mail-header-separator ""))
|
|
6472 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6473 (save-restriction
|
|
6474 (widen)
|
|
6475 (let ((start (window-start))
|
|
6476 buffer-read-only)
|
|
6477 (message-caesar-buffer-body arg)
|
|
6478 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
6479
|
|
6480 (defun gnus-summary-stop-page-breaking ()
|
|
6481 "Stop page breaking in the current article."
|
|
6482 (interactive)
|
|
6483 (gnus-set-global-variables)
|
|
6484 (gnus-summary-select-article)
|
|
6485 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6486 (widen)
|
|
6487 (when (gnus-visual-p 'page-marker)
|
|
6488 (let ((buffer-read-only nil))
|
|
6489 (gnus-remove-text-with-property 'gnus-prev)
|
|
6490 (gnus-remove-text-with-property 'gnus-next)))))
|
|
6491
|
|
6492 (defun gnus-summary-move-article (&optional n to-newsgroup
|
|
6493 select-method action)
|
|
6494 "Move the current article to a different newsgroup.
|
|
6495 If N is a positive number, move the N next articles.
|
|
6496 If N is a negative number, move the N previous articles.
|
|
6497 If N is nil and any articles have been marked with the process mark,
|
|
6498 move those articles instead.
|
|
6499 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6500 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6501 re-spool using this method.
|
|
6502
|
|
6503 For this function to work, both the current newsgroup and the
|
|
6504 newsgroup that you want to move to have to support the `request-move'
|
|
6505 and `request-accept' functions."
|
|
6506 (interactive "P")
|
|
6507 (unless action
|
|
6508 (setq action 'move))
|
|
6509 (gnus-set-global-variables)
|
|
6510 ;; Disable marking as read.
|
|
6511 (let (gnus-mark-article-hook)
|
|
6512 (save-window-excursion
|
|
6513 (gnus-summary-select-article)))
|
|
6514 ;; Check whether the source group supports the required functions.
|
|
6515 (cond ((and (eq action 'move)
|
|
6516 (not (gnus-check-backend-function
|
|
6517 'request-move-article gnus-newsgroup-name)))
|
|
6518 (error "The current group does not support article moving"))
|
|
6519 ((and (eq action 'crosspost)
|
|
6520 (not (gnus-check-backend-function
|
|
6521 'request-replace-article gnus-newsgroup-name)))
|
|
6522 (error "The current group does not support article editing")))
|
|
6523 (let ((articles (gnus-summary-work-articles n))
|
|
6524 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
|
|
6525 (names '((move "Move" "Moving")
|
|
6526 (copy "Copy" "Copying")
|
|
6527 (crosspost "Crosspost" "Crossposting")))
|
|
6528 (copy-buf (save-excursion
|
|
6529 (nnheader-set-temp-buffer " *copy article*")))
|
|
6530 art-group to-method new-xref article to-groups)
|
|
6531 (unless (assq action names)
|
|
6532 (error "Unknown action %s" action))
|
|
6533 ;; Read the newsgroup name.
|
|
6534 (when (and (not to-newsgroup)
|
|
6535 (not select-method))
|
|
6536 (setq to-newsgroup
|
|
6537 (gnus-read-move-group-name
|
|
6538 (cadr (assq action names))
|
|
6539 (symbol-value (intern (format "gnus-current-%s-group" action)))
|
|
6540 articles prefix))
|
|
6541 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
|
|
6542 (setq to-method (or select-method
|
|
6543 (gnus-group-name-to-method to-newsgroup)))
|
|
6544 ;; Check the method we are to move this article to...
|
|
6545 (unless (gnus-check-backend-function
|
|
6546 'request-accept-article (car to-method))
|
|
6547 (error "%s does not support article copying" (car to-method)))
|
|
6548 (unless (gnus-check-server to-method)
|
|
6549 (error "Can't open server %s" (car to-method)))
|
|
6550 (gnus-message 6 "%s to %s: %s..."
|
|
6551 (caddr (assq action names))
|
|
6552 (or (car select-method) to-newsgroup) articles)
|
|
6553 (while articles
|
|
6554 (setq article (pop articles))
|
|
6555 (setq
|
|
6556 art-group
|
|
6557 (cond
|
|
6558 ;; Move the article.
|
|
6559 ((eq action 'move)
|
|
6560 (gnus-request-move-article
|
|
6561 article ; Article to move
|
|
6562 gnus-newsgroup-name ; From newsgroup
|
|
6563 (nth 1 (gnus-find-method-for-group
|
|
6564 gnus-newsgroup-name)) ; Server
|
|
6565 (list 'gnus-request-accept-article
|
|
6566 to-newsgroup (list 'quote select-method)
|
|
6567 (not articles)) ; Accept form
|
|
6568 (not articles))) ; Only save nov last time
|
|
6569 ;; Copy the article.
|
|
6570 ((eq action 'copy)
|
|
6571 (save-excursion
|
|
6572 (set-buffer copy-buf)
|
|
6573 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
|
6574 (gnus-request-accept-article
|
|
6575 to-newsgroup select-method (not articles))))
|
|
6576 ;; Crosspost the article.
|
|
6577 ((eq action 'crosspost)
|
|
6578 (let ((xref (message-tokenize-header
|
|
6579 (mail-header-xref (gnus-summary-article-header article))
|
|
6580 " ")))
|
|
6581 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
|
|
6582 ":" article))
|
|
6583 (unless xref
|
|
6584 (setq xref (list (system-name))))
|
|
6585 (setq new-xref
|
|
6586 (concat
|
|
6587 (mapconcat 'identity
|
|
6588 (delete "Xref:" (delete new-xref xref))
|
|
6589 " ")
|
|
6590 new-xref))
|
|
6591 (save-excursion
|
|
6592 (set-buffer copy-buf)
|
|
6593 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
|
6594 (nnheader-replace-header "xref" new-xref)
|
|
6595 (gnus-request-accept-article
|
|
6596 to-newsgroup select-method (not articles)))))))
|
|
6597 (if (not art-group)
|
|
6598 (gnus-message 1 "Couldn't %s article %s"
|
|
6599 (cadr (assq action names)) article)
|
|
6600 (let* ((entry
|
|
6601 (or
|
|
6602 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
|
|
6603 (gnus-gethash
|
|
6604 (gnus-group-prefixed-name
|
|
6605 (car art-group)
|
|
6606 (or select-method
|
|
6607 (gnus-find-method-for-group to-newsgroup)))
|
|
6608 gnus-newsrc-hashtb)))
|
|
6609 (info (nth 2 entry))
|
|
6610 (to-group (gnus-info-group info)))
|
|
6611 ;; Update the group that has been moved to.
|
|
6612 (when (and info
|
|
6613 (memq action '(move copy)))
|
|
6614 (unless (member to-group to-groups)
|
|
6615 (push to-group to-groups))
|
|
6616
|
|
6617 (unless (memq article gnus-newsgroup-unreads)
|
|
6618 (gnus-info-set-read
|
|
6619 info (gnus-add-to-range (gnus-info-read info)
|
|
6620 (list (cdr art-group)))))
|
|
6621
|
|
6622 ;; Copy any marks over to the new group.
|
|
6623 (let ((marks gnus-article-mark-lists)
|
|
6624 (to-article (cdr art-group)))
|
|
6625
|
|
6626 ;; See whether the article is to be put in the cache.
|
|
6627 (when gnus-use-cache
|
|
6628 (gnus-cache-possibly-enter-article
|
|
6629 to-group to-article
|
|
6630 (let ((header (copy-sequence
|
|
6631 (gnus-summary-article-header article))))
|
|
6632 (mail-header-set-number header to-article)
|
|
6633 header)
|
|
6634 (memq article gnus-newsgroup-marked)
|
|
6635 (memq article gnus-newsgroup-dormant)
|
|
6636 (memq article gnus-newsgroup-unreads)))
|
|
6637
|
|
6638 (when (and (equal to-group gnus-newsgroup-name)
|
|
6639 (not (memq article gnus-newsgroup-unreads)))
|
|
6640 ;; Mark this article as read in this group.
|
|
6641 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
|
|
6642 (setcdr (gnus-active to-group) to-article)
|
|
6643 (setcdr gnus-newsgroup-active to-article))
|
|
6644
|
|
6645 (while marks
|
|
6646 (when (memq article (symbol-value
|
|
6647 (intern (format "gnus-newsgroup-%s"
|
|
6648 (caar marks)))))
|
|
6649 ;; If the other group is the same as this group,
|
|
6650 ;; then we have to add the mark to the list.
|
|
6651 (when (equal to-group gnus-newsgroup-name)
|
|
6652 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
|
|
6653 (cons to-article
|
|
6654 (symbol-value
|
|
6655 (intern (format "gnus-newsgroup-%s"
|
|
6656 (caar marks)))))))
|
|
6657 ;; Copy the marks to other group.
|
|
6658 (gnus-add-marked-articles
|
|
6659 to-group (cdar marks) (list to-article) info))
|
|
6660 (setq marks (cdr marks)))))
|
|
6661
|
|
6662 ;; Update the Xref header in this article to point to
|
|
6663 ;; the new crossposted article we have just created.
|
|
6664 (when (eq action 'crosspost)
|
|
6665 (save-excursion
|
|
6666 (set-buffer copy-buf)
|
|
6667 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
|
6668 (nnheader-replace-header
|
|
6669 "xref" (concat new-xref " " (car art-group)
|
|
6670 ":" (cdr art-group)))
|
|
6671 (gnus-request-replace-article
|
|
6672 article gnus-newsgroup-name (current-buffer)))))
|
|
6673
|
|
6674 (gnus-summary-goto-subject article)
|
|
6675 (when (eq action 'move)
|
|
6676 (gnus-summary-mark-article article gnus-canceled-mark)))
|
|
6677 (gnus-summary-remove-process-mark article))
|
|
6678 ;; Re-activate all groups that have been moved to.
|
|
6679 (while to-groups
|
|
6680 (gnus-activate-group (pop to-groups)))
|
|
6681
|
|
6682 (gnus-kill-buffer copy-buf)
|
|
6683 (gnus-summary-position-point)
|
|
6684 (gnus-set-mode-line 'summary)))
|
|
6685
|
|
6686 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
|
|
6687 "Move the current article to a different newsgroup.
|
|
6688 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6689 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6690 re-spool using this method."
|
|
6691 (interactive "P")
|
100
|
6692 (gnus-summary-move-article n to-newsgroup select-method 'copy))
|
98
|
6693
|
|
6694 (defun gnus-summary-crosspost-article (&optional n)
|
|
6695 "Crosspost the current article to some other group."
|
|
6696 (interactive "P")
|
|
6697 (gnus-summary-move-article n nil nil 'crosspost))
|
|
6698
|
|
6699 (defcustom gnus-summary-respool-default-method nil
|
|
6700 "Default method for respooling an article.
|
|
6701 If nil, use to the current newsgroup method."
|
|
6702 :type 'gnus-select-method-name
|
|
6703 :group 'gnus-summary-mail)
|
|
6704
|
|
6705 (defun gnus-summary-respool-article (&optional n method)
|
|
6706 "Respool the current article.
|
|
6707 The article will be squeezed through the mail spooling process again,
|
|
6708 which means that it will be put in some mail newsgroup or other
|
|
6709 depending on `nnmail-split-methods'.
|
|
6710 If N is a positive number, respool the N next articles.
|
|
6711 If N is a negative number, respool the N previous articles.
|
|
6712 If N is nil and any articles have been marked with the process mark,
|
|
6713 respool those articles instead.
|
|
6714
|
|
6715 Respooling can be done both from mail groups and \"real\" newsgroups.
|
|
6716 In the former case, the articles in question will be moved from the
|
|
6717 current group into whatever groups they are destined to. In the
|
|
6718 latter case, they will be copied into the relevant groups."
|
|
6719 (interactive
|
|
6720 (list current-prefix-arg
|
|
6721 (let* ((methods (gnus-methods-using 'respool))
|
|
6722 (methname
|
|
6723 (symbol-name (or gnus-summary-respool-default-method
|
|
6724 (car (gnus-find-method-for-group
|
|
6725 gnus-newsgroup-name)))))
|
|
6726 (method
|
|
6727 (gnus-completing-read
|
|
6728 methname "What backend do you want to use when respooling?"
|
|
6729 methods nil t nil 'gnus-mail-method-history))
|
|
6730 ms)
|
|
6731 (cond
|
|
6732 ((zerop (length (setq ms (gnus-servers-using-backend
|
|
6733 (intern method)))))
|
|
6734 (list (intern method) ""))
|
|
6735 ((= 1 (length ms))
|
|
6736 (car ms))
|
|
6737 (t
|
|
6738 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
|
|
6739 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
|
|
6740 ms-alist))))))))
|
|
6741 (gnus-set-global-variables)
|
|
6742 (unless method
|
|
6743 (error "No method given for respooling"))
|
|
6744 (if (assoc (symbol-name
|
|
6745 (car (gnus-find-method-for-group gnus-newsgroup-name)))
|
|
6746 (gnus-methods-using 'respool))
|
|
6747 (gnus-summary-move-article n nil method)
|
|
6748 (gnus-summary-copy-article n nil method)))
|
|
6749
|
|
6750 (defun gnus-summary-import-article (file)
|
|
6751 "Import a random file into a mail newsgroup."
|
|
6752 (interactive "fImport file: ")
|
|
6753 (gnus-set-global-variables)
|
|
6754 (let ((group gnus-newsgroup-name)
|
|
6755 (now (current-time))
|
|
6756 atts lines)
|
|
6757 (unless (gnus-check-backend-function 'request-accept-article group)
|
|
6758 (error "%s does not support article importing" group))
|
|
6759 (or (file-readable-p file)
|
|
6760 (not (file-regular-p file))
|
|
6761 (error "Can't read %s" file))
|
|
6762 (save-excursion
|
|
6763 (set-buffer (get-buffer-create " *import file*"))
|
|
6764 (buffer-disable-undo (current-buffer))
|
|
6765 (erase-buffer)
|
|
6766 (insert-file-contents file)
|
|
6767 (goto-char (point-min))
|
|
6768 (unless (nnheader-article-p)
|
|
6769 ;; This doesn't look like an article, so we fudge some headers.
|
|
6770 (setq atts (file-attributes file)
|
|
6771 lines (count-lines (point-min) (point-max)))
|
|
6772 (insert "From: " (read-string "From: ") "\n"
|
|
6773 "Subject: " (read-string "Subject: ") "\n"
|
|
6774 "Date: " (timezone-make-date-arpa-standard
|
|
6775 (current-time-string (nth 5 atts))
|
|
6776 (current-time-zone now)
|
|
6777 (current-time-zone now))
|
|
6778 "\n"
|
|
6779 "Message-ID: " (message-make-message-id) "\n"
|
|
6780 "Lines: " (int-to-string lines) "\n"
|
|
6781 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
|
|
6782 (gnus-request-accept-article group nil t)
|
|
6783 (kill-buffer (current-buffer)))))
|
|
6784
|
|
6785 (defun gnus-summary-article-posted-p ()
|
|
6786 "Say whether the current (mail) article is available from `gnus-select-method' as well.
|
|
6787 This will be the case if the article has both been mailed and posted."
|
|
6788 (interactive)
|
|
6789 (let ((id (mail-header-references (gnus-summary-article-header)))
|
|
6790 (gnus-override-method
|
|
6791 (or gnus-refer-article-method gnus-select-method)))
|
|
6792 (if (gnus-request-head id "")
|
|
6793 (gnus-message 2 "The current message was found on %s"
|
|
6794 gnus-override-method)
|
|
6795 (gnus-message 2 "The current message couldn't be found on %s"
|
|
6796 gnus-override-method)
|
|
6797 nil)))
|
|
6798
|
|
6799 (defun gnus-summary-expire-articles (&optional now)
|
|
6800 "Expire all articles that are marked as expirable in the current group."
|
|
6801 (interactive)
|
|
6802 (gnus-set-global-variables)
|
|
6803 (when (gnus-check-backend-function
|
|
6804 'request-expire-articles gnus-newsgroup-name)
|
|
6805 ;; This backend supports expiry.
|
|
6806 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
|
|
6807 (expirable (if total
|
|
6808 (progn
|
|
6809 ;; We need to update the info for
|
|
6810 ;; this group for `gnus-list-of-read-articles'
|
|
6811 ;; to give us the right answer.
|
|
6812 (run-hooks 'gnus-exit-group-hook)
|
|
6813 (gnus-summary-update-info)
|
|
6814 (gnus-list-of-read-articles gnus-newsgroup-name))
|
|
6815 (setq gnus-newsgroup-expirable
|
|
6816 (sort gnus-newsgroup-expirable '<))))
|
|
6817 (expiry-wait (if now 'immediate
|
|
6818 (gnus-group-find-parameter
|
|
6819 gnus-newsgroup-name 'expiry-wait)))
|
|
6820 es)
|
|
6821 (when expirable
|
|
6822 ;; There are expirable articles in this group, so we run them
|
|
6823 ;; through the expiry process.
|
|
6824 (gnus-message 6 "Expiring articles...")
|
|
6825 ;; The list of articles that weren't expired is returned.
|
|
6826 (if expiry-wait
|
|
6827 (let ((nnmail-expiry-wait-function nil)
|
|
6828 (nnmail-expiry-wait expiry-wait))
|
|
6829 (setq es (gnus-request-expire-articles
|
|
6830 expirable gnus-newsgroup-name)))
|
|
6831 (setq es (gnus-request-expire-articles
|
|
6832 expirable gnus-newsgroup-name)))
|
|
6833 (unless total
|
|
6834 (setq gnus-newsgroup-expirable es))
|
|
6835 ;; We go through the old list of expirable, and mark all
|
|
6836 ;; really expired articles as nonexistent.
|
|
6837 (unless (eq es expirable) ;If nothing was expired, we don't mark.
|
|
6838 (let ((gnus-use-cache nil))
|
|
6839 (while expirable
|
|
6840 (unless (memq (car expirable) es)
|
|
6841 (when (gnus-data-find (car expirable))
|
|
6842 (gnus-summary-mark-article
|
|
6843 (car expirable) gnus-canceled-mark)))
|
|
6844 (setq expirable (cdr expirable)))))
|
|
6845 (gnus-message 6 "Expiring articles...done")))))
|
|
6846
|
|
6847 (defun gnus-summary-expire-articles-now ()
|
|
6848 "Expunge all expirable articles in the current group.
|
|
6849 This means that *all* articles that are marked as expirable will be
|
|
6850 deleted forever, right now."
|
|
6851 (interactive)
|
|
6852 (gnus-set-global-variables)
|
|
6853 (or gnus-expert-user
|
|
6854 (gnus-yes-or-no-p
|
|
6855 "Are you really, really, really sure you want to delete all these messages? ")
|
|
6856 (error "Phew!"))
|
|
6857 (gnus-summary-expire-articles t))
|
|
6858
|
|
6859 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
|
|
6860 (defun gnus-summary-delete-article (&optional n)
|
|
6861 "Delete the N next (mail) articles.
|
|
6862 This command actually deletes articles. This is not a marking
|
|
6863 command. The article will disappear forever from your life, never to
|
|
6864 return.
|
|
6865 If N is negative, delete backwards.
|
|
6866 If N is nil and articles have been marked with the process mark,
|
|
6867 delete these instead."
|
|
6868 (interactive "P")
|
|
6869 (gnus-set-global-variables)
|
|
6870 (unless (gnus-check-backend-function 'request-expire-articles
|
|
6871 gnus-newsgroup-name)
|
|
6872 (error "The current newsgroup does not support article deletion."))
|
|
6873 ;; Compute the list of articles to delete.
|
|
6874 (let ((articles (gnus-summary-work-articles n))
|
|
6875 not-deleted)
|
|
6876 (if (and gnus-novice-user
|
|
6877 (not (gnus-yes-or-no-p
|
|
6878 (format "Do you really want to delete %s forever? "
|
|
6879 (if (> (length articles) 1)
|
|
6880 (format "these %s articles" (length articles))
|
|
6881 "this article")))))
|
|
6882 ()
|
|
6883 ;; Delete the articles.
|
|
6884 (setq not-deleted (gnus-request-expire-articles
|
|
6885 articles gnus-newsgroup-name 'force))
|
|
6886 (while articles
|
|
6887 (gnus-summary-remove-process-mark (car articles))
|
|
6888 ;; The backend might not have been able to delete the article
|
|
6889 ;; after all.
|
|
6890 (unless (memq (car articles) not-deleted)
|
|
6891 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
|
|
6892 (setq articles (cdr articles))))
|
|
6893 (gnus-summary-position-point)
|
|
6894 (gnus-set-mode-line 'summary)
|
|
6895 not-deleted))
|
|
6896
|
|
6897 (defun gnus-summary-edit-article (&optional force)
|
|
6898 "Edit the current article.
|
|
6899 This will have permanent effect only in mail groups.
|
|
6900 If FORCE is non-nil, allow editing of articles even in read-only
|
|
6901 groups."
|
|
6902 (interactive "P")
|
|
6903 (save-excursion
|
|
6904 (set-buffer gnus-summary-buffer)
|
|
6905 (gnus-set-global-variables)
|
|
6906 (when (and (not force)
|
|
6907 (gnus-group-read-only-p))
|
|
6908 (error "The current newsgroup does not support article editing."))
|
|
6909 ;; Select article if needed.
|
|
6910 (unless (eq (gnus-summary-article-number)
|
|
6911 gnus-current-article)
|
|
6912 (gnus-summary-select-article t))
|
|
6913 (gnus-article-edit-article
|
|
6914 `(lambda ()
|
|
6915 (gnus-summary-edit-article-done
|
|
6916 ,(or (mail-header-references gnus-current-headers) "")
|
|
6917 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
|
|
6918
|
|
6919 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
|
|
6920
|
|
6921 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
|
|
6922 "Make edits to the current article permanent."
|
|
6923 (interactive)
|
|
6924 ;; Replace the article.
|
|
6925 (if (and (not read-only)
|
|
6926 (not (gnus-request-replace-article
|
|
6927 (cdr gnus-article-current) (car gnus-article-current)
|
|
6928 (current-buffer))))
|
|
6929 (error "Couldn't replace article.")
|
|
6930 ;; Update the summary buffer.
|
|
6931 (if (and references
|
|
6932 (equal (message-tokenize-header references " ")
|
|
6933 (message-tokenize-header
|
|
6934 (or (message-fetch-field "references") "") " ")))
|
|
6935 ;; We only have to update this line.
|
|
6936 (save-excursion
|
|
6937 (save-restriction
|
|
6938 (message-narrow-to-head)
|
|
6939 (let ((head (buffer-string))
|
|
6940 header)
|
|
6941 (nnheader-temp-write nil
|
|
6942 (insert (format "211 %d Article retrieved.\n"
|
|
6943 (cdr gnus-article-current)))
|
|
6944 (insert head)
|
|
6945 (insert ".\n")
|
|
6946 (let ((nntp-server-buffer (current-buffer)))
|
|
6947 (setq header (car (gnus-get-newsgroup-headers
|
|
6948 (save-excursion
|
|
6949 (set-buffer gnus-summary-buffer)
|
|
6950 gnus-newsgroup-dependencies)
|
|
6951 t))))
|
|
6952 (save-excursion
|
|
6953 (set-buffer gnus-summary-buffer)
|
|
6954 (gnus-data-set-header
|
|
6955 (gnus-data-find (cdr gnus-article-current))
|
|
6956 header)
|
|
6957 (gnus-summary-update-article-line
|
|
6958 (cdr gnus-article-current) header))))))
|
|
6959 ;; Update threads.
|
|
6960 (set-buffer (or buffer gnus-summary-buffer))
|
|
6961 (gnus-summary-update-article (cdr gnus-article-current)))
|
|
6962 ;; Prettify the article buffer again.
|
|
6963 (save-excursion
|
|
6964 (set-buffer gnus-article-buffer)
|
|
6965 (run-hooks 'gnus-article-display-hook)
|
|
6966 (set-buffer gnus-original-article-buffer)
|
|
6967 (gnus-request-article
|
|
6968 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
|
|
6969 ;; Prettify the summary buffer line.
|
|
6970 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
6971 (run-hooks 'gnus-visual-mark-article-hook))))
|
|
6972
|
|
6973 (defun gnus-summary-edit-wash (key)
|
|
6974 "Perform editing command in the article buffer."
|
|
6975 (interactive
|
|
6976 (list
|
|
6977 (progn
|
|
6978 (message "%s" (concat (this-command-keys) "- "))
|
|
6979 (read-char))))
|
|
6980 (message "")
|
|
6981 (gnus-summary-edit-article)
|
|
6982 (execute-kbd-macro (concat (this-command-keys) key))
|
|
6983 (gnus-article-edit-done))
|
|
6984
|
|
6985 ;;; Respooling
|
|
6986
|
|
6987 (defun gnus-summary-respool-query ()
|
|
6988 "Query where the respool algorithm would put this article."
|
|
6989 (interactive)
|
|
6990 (gnus-set-global-variables)
|
|
6991 (let (gnus-mark-article-hook)
|
|
6992 (gnus-summary-select-article)
|
|
6993 (save-excursion
|
|
6994 (set-buffer gnus-article-buffer)
|
|
6995 (save-restriction
|
104
|
6996 (gnus-narrow-to-body)
|
98
|
6997 (message "This message would go to %s"
|
|
6998 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
|
|
6999
|
|
7000 ;; Summary marking commands.
|
|
7001
|
|
7002 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
|
|
7003 "Mark articles which has the same subject as read, and then select the next.
|
|
7004 If UNMARK is positive, remove any kind of mark.
|
|
7005 If UNMARK is negative, tick articles."
|
|
7006 (interactive "P")
|
|
7007 (gnus-set-global-variables)
|
|
7008 (when unmark
|
|
7009 (setq unmark (prefix-numeric-value unmark)))
|
|
7010 (let ((count
|
|
7011 (gnus-summary-mark-same-subject
|
|
7012 (gnus-summary-article-subject) unmark)))
|
|
7013 ;; Select next unread article. If auto-select-same mode, should
|
|
7014 ;; select the first unread article.
|
|
7015 (gnus-summary-next-article t (and gnus-auto-select-same
|
|
7016 (gnus-summary-article-subject)))
|
|
7017 (gnus-message 7 "%d article%s marked as %s"
|
|
7018 count (if (= count 1) " is" "s are")
|
|
7019 (if unmark "unread" "read"))))
|
|
7020
|
|
7021 (defun gnus-summary-kill-same-subject (&optional unmark)
|
|
7022 "Mark articles which has the same subject as read.
|
|
7023 If UNMARK is positive, remove any kind of mark.
|
|
7024 If UNMARK is negative, tick articles."
|
|
7025 (interactive "P")
|
|
7026 (gnus-set-global-variables)
|
|
7027 (when unmark
|
|
7028 (setq unmark (prefix-numeric-value unmark)))
|
|
7029 (let ((count
|
|
7030 (gnus-summary-mark-same-subject
|
|
7031 (gnus-summary-article-subject) unmark)))
|
|
7032 ;; If marked as read, go to next unread subject.
|
|
7033 (when (null unmark)
|
|
7034 ;; Go to next unread subject.
|
|
7035 (gnus-summary-next-subject 1 t))
|
|
7036 (gnus-message 7 "%d articles are marked as %s"
|
|
7037 count (if unmark "unread" "read"))))
|
|
7038
|
|
7039 (defun gnus-summary-mark-same-subject (subject &optional unmark)
|
|
7040 "Mark articles with same SUBJECT as read, and return marked number.
|
|
7041 If optional argument UNMARK is positive, remove any kinds of marks.
|
|
7042 If optional argument UNMARK is negative, mark articles as unread instead."
|
|
7043 (let ((count 1))
|
|
7044 (save-excursion
|
|
7045 (cond
|
|
7046 ((null unmark) ; Mark as read.
|
|
7047 (while (and
|
|
7048 (progn
|
|
7049 (gnus-summary-mark-article-as-read gnus-killed-mark)
|
|
7050 (gnus-summary-show-thread) t)
|
|
7051 (gnus-summary-find-subject subject))
|
|
7052 (setq count (1+ count))))
|
|
7053 ((> unmark 0) ; Tick.
|
|
7054 (while (and
|
|
7055 (progn
|
|
7056 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
|
|
7057 (gnus-summary-show-thread) t)
|
|
7058 (gnus-summary-find-subject subject))
|
|
7059 (setq count (1+ count))))
|
|
7060 (t ; Mark as unread.
|
|
7061 (while (and
|
|
7062 (progn
|
|
7063 (gnus-summary-mark-article-as-unread gnus-unread-mark)
|
|
7064 (gnus-summary-show-thread) t)
|
|
7065 (gnus-summary-find-subject subject))
|
|
7066 (setq count (1+ count)))))
|
|
7067 (gnus-set-mode-line 'summary)
|
|
7068 ;; Return the number of marked articles.
|
|
7069 count)))
|
|
7070
|
|
7071 (defun gnus-summary-mark-as-processable (n &optional unmark)
|
|
7072 "Set the process mark on the next N articles.
|
|
7073 If N is negative, mark backward instead. If UNMARK is non-nil, remove
|
|
7074 the process mark instead. The difference between N and the actual
|
|
7075 number of articles marked is returned."
|
|
7076 (interactive "p")
|
|
7077 (gnus-set-global-variables)
|
|
7078 (let ((backward (< n 0))
|
|
7079 (n (abs n)))
|
|
7080 (while (and
|
|
7081 (> n 0)
|
|
7082 (if unmark
|
|
7083 (gnus-summary-remove-process-mark
|
|
7084 (gnus-summary-article-number))
|
|
7085 (gnus-summary-set-process-mark (gnus-summary-article-number)))
|
|
7086 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
|
|
7087 (setq n (1- n)))
|
|
7088 (when (/= 0 n)
|
|
7089 (gnus-message 7 "No more articles"))
|
|
7090 (gnus-summary-recenter)
|
|
7091 (gnus-summary-position-point)
|
|
7092 n))
|
|
7093
|
|
7094 (defun gnus-summary-unmark-as-processable (n)
|
|
7095 "Remove the process mark from the next N articles.
|
|
7096 If N is negative, mark backward instead. The difference between N and
|
|
7097 the actual number of articles marked is returned."
|
|
7098 (interactive "p")
|
|
7099 (gnus-set-global-variables)
|
|
7100 (gnus-summary-mark-as-processable n t))
|
|
7101
|
|
7102 (defun gnus-summary-unmark-all-processable ()
|
|
7103 "Remove the process mark from all articles."
|
|
7104 (interactive)
|
|
7105 (gnus-set-global-variables)
|
|
7106 (save-excursion
|
|
7107 (while gnus-newsgroup-processable
|
|
7108 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
|
|
7109 (gnus-summary-position-point))
|
|
7110
|
|
7111 (defun gnus-summary-mark-as-expirable (n)
|
|
7112 "Mark N articles forward as expirable.
|
|
7113 If N is negative, mark backward instead. The difference between N and
|
|
7114 the actual number of articles marked is returned."
|
|
7115 (interactive "p")
|
|
7116 (gnus-set-global-variables)
|
|
7117 (gnus-summary-mark-forward n gnus-expirable-mark))
|
|
7118
|
|
7119 (defun gnus-summary-mark-article-as-replied (article)
|
|
7120 "Mark ARTICLE replied and update the summary line."
|
|
7121 (push article gnus-newsgroup-replied)
|
|
7122 (let ((buffer-read-only nil))
|
|
7123 (when (gnus-summary-goto-subject article)
|
|
7124 (gnus-summary-update-secondary-mark article))))
|
|
7125
|
|
7126 (defun gnus-summary-set-bookmark (article)
|
|
7127 "Set a bookmark in current article."
|
|
7128 (interactive (list (gnus-summary-article-number)))
|
|
7129 (gnus-set-global-variables)
|
|
7130 (when (or (not (get-buffer gnus-article-buffer))
|
|
7131 (not gnus-current-article)
|
|
7132 (not gnus-article-current)
|
|
7133 (not (equal gnus-newsgroup-name (car gnus-article-current))))
|
|
7134 (error "No current article selected"))
|
|
7135 ;; Remove old bookmark, if one exists.
|
|
7136 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7137 (when old
|
|
7138 (setq gnus-newsgroup-bookmarks
|
|
7139 (delq old gnus-newsgroup-bookmarks))))
|
|
7140 ;; Set the new bookmark, which is on the form
|
|
7141 ;; (article-number . line-number-in-body).
|
|
7142 (push
|
|
7143 (cons article
|
|
7144 (save-excursion
|
|
7145 (set-buffer gnus-article-buffer)
|
|
7146 (count-lines
|
|
7147 (min (point)
|
|
7148 (save-excursion
|
|
7149 (goto-char (point-min))
|
|
7150 (search-forward "\n\n" nil t)
|
|
7151 (point)))
|
|
7152 (point))))
|
|
7153 gnus-newsgroup-bookmarks)
|
|
7154 (gnus-message 6 "A bookmark has been added to the current article."))
|
|
7155
|
|
7156 (defun gnus-summary-remove-bookmark (article)
|
|
7157 "Remove the bookmark from the current article."
|
|
7158 (interactive (list (gnus-summary-article-number)))
|
|
7159 (gnus-set-global-variables)
|
|
7160 ;; Remove old bookmark, if one exists.
|
|
7161 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7162 (if old
|
|
7163 (progn
|
|
7164 (setq gnus-newsgroup-bookmarks
|
|
7165 (delq old gnus-newsgroup-bookmarks))
|
|
7166 (gnus-message 6 "Removed bookmark."))
|
|
7167 (gnus-message 6 "No bookmark in current article."))))
|
|
7168
|
|
7169 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7170 (defun gnus-summary-mark-as-dormant (n)
|
|
7171 "Mark N articles forward as dormant.
|
|
7172 If N is negative, mark backward instead. The difference between N and
|
|
7173 the actual number of articles marked is returned."
|
|
7174 (interactive "p")
|
|
7175 (gnus-set-global-variables)
|
|
7176 (gnus-summary-mark-forward n gnus-dormant-mark))
|
|
7177
|
|
7178 (defun gnus-summary-set-process-mark (article)
|
|
7179 "Set the process mark on ARTICLE and update the summary line."
|
|
7180 (setq gnus-newsgroup-processable
|
|
7181 (cons article
|
|
7182 (delq article gnus-newsgroup-processable)))
|
|
7183 (when (gnus-summary-goto-subject article)
|
|
7184 (gnus-summary-show-thread)
|
|
7185 (gnus-summary-update-secondary-mark article)))
|
|
7186
|
|
7187 (defun gnus-summary-remove-process-mark (article)
|
|
7188 "Remove the process mark from ARTICLE and update the summary line."
|
|
7189 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
|
|
7190 (when (gnus-summary-goto-subject article)
|
|
7191 (gnus-summary-show-thread)
|
|
7192 (gnus-summary-update-secondary-mark article)))
|
|
7193
|
|
7194 (defun gnus-summary-set-saved-mark (article)
|
|
7195 "Set the process mark on ARTICLE and update the summary line."
|
|
7196 (push article gnus-newsgroup-saved)
|
|
7197 (when (gnus-summary-goto-subject article)
|
|
7198 (gnus-summary-update-secondary-mark article)))
|
|
7199
|
|
7200 (defun gnus-summary-mark-forward (n &optional mark no-expire)
|
|
7201 "Mark N articles as read forwards.
|
|
7202 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
|
|
7203 The difference between N and the actual number of articles marked is
|
|
7204 returned."
|
|
7205 (interactive "p")
|
|
7206 (gnus-set-global-variables)
|
|
7207 (let ((backward (< n 0))
|
|
7208 (gnus-summary-goto-unread
|
|
7209 (and gnus-summary-goto-unread
|
|
7210 (not (eq gnus-summary-goto-unread 'never))
|
|
7211 (not (memq mark (list gnus-unread-mark
|
|
7212 gnus-ticked-mark gnus-dormant-mark)))))
|
|
7213 (n (abs n))
|
|
7214 (mark (or mark gnus-del-mark)))
|
|
7215 (while (and (> n 0)
|
|
7216 (gnus-summary-mark-article nil mark no-expire)
|
|
7217 (zerop (gnus-summary-next-subject
|
|
7218 (if backward -1 1)
|
|
7219 (and gnus-summary-goto-unread
|
|
7220 (not (eq gnus-summary-goto-unread 'never)))
|
|
7221 t)))
|
|
7222 (setq n (1- n)))
|
|
7223 (when (/= 0 n)
|
|
7224 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
|
|
7225 (gnus-summary-recenter)
|
|
7226 (gnus-summary-position-point)
|
|
7227 (gnus-set-mode-line 'summary)
|
|
7228 n))
|
|
7229
|
|
7230 (defun gnus-summary-mark-article-as-read (mark)
|
|
7231 "Mark the current article quickly as read with MARK."
|
|
7232 (let ((article (gnus-summary-article-number)))
|
|
7233 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7234 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7235 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7236 (push (cons article mark) gnus-newsgroup-reads)
|
|
7237 ;; Possibly remove from cache, if that is used.
|
|
7238 (when gnus-use-cache
|
|
7239 (gnus-cache-enter-remove-article article))
|
|
7240 ;; Allow the backend to change the mark.
|
|
7241 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
|
|
7242 ;; Check for auto-expiry.
|
|
7243 (when (and gnus-newsgroup-auto-expire
|
|
7244 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7245 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7246 (= mark gnus-ancient-mark)
|
|
7247 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7248 (= mark gnus-duplicate-mark)))
|
|
7249 (setq mark gnus-expirable-mark)
|
|
7250 (push article gnus-newsgroup-expirable))
|
|
7251 ;; Set the mark in the buffer.
|
|
7252 (gnus-summary-update-mark mark 'unread)
|
|
7253 t))
|
|
7254
|
|
7255 (defun gnus-summary-mark-article-as-unread (mark)
|
|
7256 "Mark the current article quickly as unread with MARK."
|
|
7257 (let ((article (gnus-summary-article-number)))
|
|
7258 (if (< article 0)
|
|
7259 (gnus-error 1 "Unmarkable article")
|
|
7260 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7261 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7262 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
|
|
7263 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
|
|
7264 (cond ((= mark gnus-ticked-mark)
|
|
7265 (push article gnus-newsgroup-marked))
|
|
7266 ((= mark gnus-dormant-mark)
|
|
7267 (push article gnus-newsgroup-dormant))
|
|
7268 (t
|
|
7269 (push article gnus-newsgroup-unreads)))
|
|
7270 (setq gnus-newsgroup-reads
|
|
7271 (delq (assq article gnus-newsgroup-reads)
|
|
7272 gnus-newsgroup-reads))
|
|
7273
|
|
7274 ;; See whether the article is to be put in the cache.
|
|
7275 (and gnus-use-cache
|
|
7276 (vectorp (gnus-summary-article-header article))
|
|
7277 (save-excursion
|
|
7278 (gnus-cache-possibly-enter-article
|
|
7279 gnus-newsgroup-name article
|
|
7280 (gnus-summary-article-header article)
|
|
7281 (= mark gnus-ticked-mark)
|
|
7282 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7283
|
|
7284 ;; Fix the mark.
|
|
7285 (gnus-summary-update-mark mark 'unread))
|
|
7286 t))
|
|
7287
|
|
7288 (defun gnus-summary-mark-article (&optional article mark no-expire)
|
|
7289 "Mark ARTICLE with MARK. MARK can be any character.
|
|
7290 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
|
|
7291 `??' (dormant) and `?E' (expirable).
|
|
7292 If MARK is nil, then the default character `?D' is used.
|
|
7293 If ARTICLE is nil, then the article on the current line will be
|
|
7294 marked."
|
|
7295 ;; The mark might be a string.
|
|
7296 (when (stringp mark)
|
|
7297 (setq mark (aref mark 0)))
|
|
7298 ;; If no mark is given, then we check auto-expiring.
|
|
7299 (and (not no-expire)
|
|
7300 gnus-newsgroup-auto-expire
|
|
7301 (or (not mark)
|
|
7302 (and (gnus-characterp mark)
|
|
7303 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7304 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7305 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7306 (= mark gnus-duplicate-mark))))
|
|
7307 (setq mark gnus-expirable-mark))
|
|
7308 (let* ((mark (or mark gnus-del-mark))
|
|
7309 (article (or article (gnus-summary-article-number))))
|
|
7310 (unless article
|
|
7311 (error "No article on current line"))
|
|
7312 (if (or (= mark gnus-unread-mark)
|
|
7313 (= mark gnus-ticked-mark)
|
|
7314 (= mark gnus-dormant-mark))
|
|
7315 (gnus-mark-article-as-unread article mark)
|
|
7316 (gnus-mark-article-as-read article mark))
|
|
7317
|
|
7318 ;; See whether the article is to be put in the cache.
|
|
7319 (and gnus-use-cache
|
|
7320 (not (= mark gnus-canceled-mark))
|
|
7321 (vectorp (gnus-summary-article-header article))
|
|
7322 (save-excursion
|
|
7323 (gnus-cache-possibly-enter-article
|
|
7324 gnus-newsgroup-name article
|
|
7325 (gnus-summary-article-header article)
|
|
7326 (= mark gnus-ticked-mark)
|
|
7327 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7328
|
|
7329 (when (gnus-summary-goto-subject article nil t)
|
|
7330 (let ((buffer-read-only nil))
|
|
7331 (gnus-summary-show-thread)
|
|
7332 ;; Fix the mark.
|
|
7333 (gnus-summary-update-mark mark 'unread)
|
|
7334 t))))
|
|
7335
|
|
7336 (defun gnus-summary-update-secondary-mark (article)
|
|
7337 "Update the secondary (read, process, cache) mark."
|
|
7338 (gnus-summary-update-mark
|
|
7339 (cond ((memq article gnus-newsgroup-processable)
|
|
7340 gnus-process-mark)
|
|
7341 ((memq article gnus-newsgroup-cached)
|
|
7342 gnus-cached-mark)
|
|
7343 ((memq article gnus-newsgroup-replied)
|
|
7344 gnus-replied-mark)
|
|
7345 ((memq article gnus-newsgroup-saved)
|
|
7346 gnus-saved-mark)
|
|
7347 (t gnus-unread-mark))
|
|
7348 'replied)
|
|
7349 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
7350 (run-hooks 'gnus-summary-update-hook))
|
|
7351 t)
|
|
7352
|
|
7353 (defun gnus-summary-update-mark (mark type)
|
|
7354 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
|
|
7355 (buffer-read-only nil))
|
|
7356 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
|
|
7357 (when (looking-at "\r")
|
|
7358 (incf forward))
|
|
7359 (when (and forward
|
|
7360 (<= (+ forward (point)) (point-max)))
|
|
7361 ;; Go to the right position on the line.
|
|
7362 (goto-char (+ forward (point)))
|
|
7363 ;; Replace the old mark with the new mark.
|
|
7364 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
|
|
7365 ;; Optionally update the marks by some user rule.
|
|
7366 (when (eq type 'unread)
|
|
7367 (gnus-data-set-mark
|
|
7368 (gnus-data-find (gnus-summary-article-number)) mark)
|
|
7369 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
|
|
7370
|
|
7371 (defun gnus-mark-article-as-read (article &optional mark)
|
|
7372 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7373 ;; Make the article expirable.
|
|
7374 (let ((mark (or mark gnus-del-mark)))
|
|
7375 (if (= mark gnus-expirable-mark)
|
|
7376 (push article gnus-newsgroup-expirable)
|
|
7377 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
|
|
7378 ;; Remove from unread and marked lists.
|
|
7379 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7380 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7381 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7382 (push (cons article mark) gnus-newsgroup-reads)
|
|
7383 ;; Possibly remove from cache, if that is used.
|
|
7384 (when gnus-use-cache
|
|
7385 (gnus-cache-enter-remove-article article))))
|
|
7386
|
|
7387 (defun gnus-mark-article-as-unread (article &optional mark)
|
|
7388 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7389 (let ((mark (or mark gnus-ticked-mark)))
|
|
7390 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
|
|
7391 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
|
|
7392 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
|
|
7393 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7394
|
|
7395 ;; Unsuppress duplicates?
|
|
7396 (when gnus-suppress-duplicates
|
|
7397 (gnus-dup-unsuppress-article article))
|
|
7398
|
|
7399 (cond ((= mark gnus-ticked-mark)
|
|
7400 (push article gnus-newsgroup-marked))
|
|
7401 ((= mark gnus-dormant-mark)
|
|
7402 (push article gnus-newsgroup-dormant))
|
|
7403 (t
|
|
7404 (push article gnus-newsgroup-unreads)))
|
|
7405 (setq gnus-newsgroup-reads
|
|
7406 (delq (assq article gnus-newsgroup-reads)
|
|
7407 gnus-newsgroup-reads))))
|
|
7408
|
|
7409 (defalias 'gnus-summary-mark-as-unread-forward
|
|
7410 'gnus-summary-tick-article-forward)
|
|
7411 (make-obsolete 'gnus-summary-mark-as-unread-forward
|
|
7412 'gnus-summary-tick-article-forward)
|
|
7413 (defun gnus-summary-tick-article-forward (n)
|
|
7414 "Tick N articles forwards.
|
|
7415 If N is negative, tick backwards instead.
|
|
7416 The difference between N and the number of articles ticked is returned."
|
|
7417 (interactive "p")
|
|
7418 (gnus-summary-mark-forward n gnus-ticked-mark))
|
|
7419
|
|
7420 (defalias 'gnus-summary-mark-as-unread-backward
|
|
7421 'gnus-summary-tick-article-backward)
|
|
7422 (make-obsolete 'gnus-summary-mark-as-unread-backward
|
|
7423 'gnus-summary-tick-article-backward)
|
|
7424 (defun gnus-summary-tick-article-backward (n)
|
|
7425 "Tick N articles backwards.
|
|
7426 The difference between N and the number of articles ticked is returned."
|
|
7427 (interactive "p")
|
|
7428 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
|
|
7429
|
|
7430 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7431 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7432 (defun gnus-summary-tick-article (&optional article clear-mark)
|
|
7433 "Mark current article as unread.
|
|
7434 Optional 1st argument ARTICLE specifies article number to be marked as unread.
|
|
7435 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
|
|
7436 (interactive)
|
|
7437 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
|
|
7438 gnus-ticked-mark)))
|
|
7439
|
|
7440 (defun gnus-summary-mark-as-read-forward (n)
|
|
7441 "Mark N articles as read forwards.
|
|
7442 If N is negative, mark backwards instead.
|
|
7443 The difference between N and the actual number of articles marked is
|
|
7444 returned."
|
|
7445 (interactive "p")
|
|
7446 (gnus-summary-mark-forward n gnus-del-mark t))
|
|
7447
|
|
7448 (defun gnus-summary-mark-as-read-backward (n)
|
|
7449 "Mark the N articles as read backwards.
|
|
7450 The difference between N and the actual number of articles marked is
|
|
7451 returned."
|
|
7452 (interactive "p")
|
|
7453 (gnus-summary-mark-forward (- n) gnus-del-mark t))
|
|
7454
|
|
7455 (defun gnus-summary-mark-as-read (&optional article mark)
|
|
7456 "Mark current article as read.
|
|
7457 ARTICLE specifies the article to be marked as read.
|
|
7458 MARK specifies a string to be inserted at the beginning of the line."
|
|
7459 (gnus-summary-mark-article article mark))
|
|
7460
|
|
7461 (defun gnus-summary-clear-mark-forward (n)
|
|
7462 "Clear marks from N articles forward.
|
|
7463 If N is negative, clear backward instead.
|
|
7464 The difference between N and the number of marks cleared is returned."
|
|
7465 (interactive "p")
|
|
7466 (gnus-summary-mark-forward n gnus-unread-mark))
|
|
7467
|
|
7468 (defun gnus-summary-clear-mark-backward (n)
|
|
7469 "Clear marks from N articles backward.
|
|
7470 The difference between N and the number of marks cleared is returned."
|
|
7471 (interactive "p")
|
|
7472 (gnus-summary-mark-forward (- n) gnus-unread-mark))
|
|
7473
|
|
7474 (defun gnus-summary-mark-unread-as-read ()
|
|
7475 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7476 (when (memq gnus-current-article gnus-newsgroup-unreads)
|
|
7477 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
|
|
7478
|
|
7479 (defun gnus-summary-mark-read-and-unread-as-read ()
|
|
7480 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7481 (let ((mark (gnus-summary-article-mark)))
|
|
7482 (when (or (gnus-unread-mark-p mark)
|
|
7483 (gnus-read-mark-p mark))
|
|
7484 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
|
|
7485
|
|
7486 (defun gnus-summary-mark-region-as-read (point mark all)
|
|
7487 "Mark all unread articles between point and mark as read.
|
|
7488 If given a prefix, mark all articles between point and mark as read,
|
|
7489 even ticked and dormant ones."
|
|
7490 (interactive "r\nP")
|
|
7491 (save-excursion
|
|
7492 (let (article)
|
|
7493 (goto-char point)
|
|
7494 (beginning-of-line)
|
|
7495 (while (and
|
|
7496 (< (point) mark)
|
|
7497 (progn
|
|
7498 (when (or all
|
|
7499 (memq (setq article (gnus-summary-article-number))
|
|
7500 gnus-newsgroup-unreads))
|
|
7501 (gnus-summary-mark-article article gnus-del-mark))
|
|
7502 t)
|
|
7503 (gnus-summary-find-next))))))
|
|
7504
|
|
7505 (defun gnus-summary-mark-below (score mark)
|
|
7506 "Mark articles with score less than SCORE with MARK."
|
|
7507 (interactive "P\ncMark: ")
|
|
7508 (gnus-set-global-variables)
|
|
7509 (setq score (if score
|
|
7510 (prefix-numeric-value score)
|
|
7511 (or gnus-summary-default-score 0)))
|
|
7512 (save-excursion
|
|
7513 (set-buffer gnus-summary-buffer)
|
|
7514 (goto-char (point-min))
|
|
7515 (while
|
|
7516 (progn
|
|
7517 (and (< (gnus-summary-article-score) score)
|
|
7518 (gnus-summary-mark-article nil mark))
|
|
7519 (gnus-summary-find-next)))))
|
|
7520
|
|
7521 (defun gnus-summary-kill-below (&optional score)
|
|
7522 "Mark articles with score below SCORE as read."
|
|
7523 (interactive "P")
|
|
7524 (gnus-set-global-variables)
|
|
7525 (gnus-summary-mark-below score gnus-killed-mark))
|
|
7526
|
|
7527 (defun gnus-summary-clear-above (&optional score)
|
|
7528 "Clear all marks from articles with score above SCORE."
|
|
7529 (interactive "P")
|
|
7530 (gnus-set-global-variables)
|
|
7531 (gnus-summary-mark-above score gnus-unread-mark))
|
|
7532
|
|
7533 (defun gnus-summary-tick-above (&optional score)
|
|
7534 "Tick all articles with score above SCORE."
|
|
7535 (interactive "P")
|
|
7536 (gnus-set-global-variables)
|
|
7537 (gnus-summary-mark-above score gnus-ticked-mark))
|
|
7538
|
|
7539 (defun gnus-summary-mark-above (score mark)
|
|
7540 "Mark articles with score over SCORE with MARK."
|
|
7541 (interactive "P\ncMark: ")
|
|
7542 (gnus-set-global-variables)
|
|
7543 (setq score (if score
|
|
7544 (prefix-numeric-value score)
|
|
7545 (or gnus-summary-default-score 0)))
|
|
7546 (save-excursion
|
|
7547 (set-buffer gnus-summary-buffer)
|
|
7548 (goto-char (point-min))
|
|
7549 (while (and (progn
|
|
7550 (when (> (gnus-summary-article-score) score)
|
|
7551 (gnus-summary-mark-article nil mark))
|
|
7552 t)
|
|
7553 (gnus-summary-find-next)))))
|
|
7554
|
|
7555 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7556 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
|
|
7557 (defun gnus-summary-limit-include-expunged (&optional no-error)
|
|
7558 "Display all the hidden articles that were expunged for low scores."
|
|
7559 (interactive)
|
|
7560 (gnus-set-global-variables)
|
|
7561 (let ((buffer-read-only nil))
|
|
7562 (let ((scored gnus-newsgroup-scored)
|
|
7563 headers h)
|
|
7564 (while scored
|
|
7565 (unless (gnus-summary-goto-subject (caar scored))
|
|
7566 (and (setq h (gnus-summary-article-header (caar scored)))
|
|
7567 (< (cdar scored) gnus-summary-expunge-below)
|
|
7568 (push h headers)))
|
|
7569 (setq scored (cdr scored)))
|
|
7570 (if (not headers)
|
|
7571 (when (not no-error)
|
|
7572 (error "No expunged articles hidden."))
|
|
7573 (goto-char (point-min))
|
|
7574 (gnus-summary-prepare-unthreaded (nreverse headers))
|
|
7575 (goto-char (point-min))
|
|
7576 (gnus-summary-position-point)
|
|
7577 t))))
|
|
7578
|
|
7579 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
|
|
7580 "Mark all unread articles in this newsgroup as read.
|
|
7581 If prefix argument ALL is non-nil, ticked and dormant articles will
|
|
7582 also be marked as read.
|
|
7583 If QUIETLY is non-nil, no questions will be asked.
|
|
7584 If TO-HERE is non-nil, it should be a point in the buffer. All
|
|
7585 articles before this point will be marked as read.
|
|
7586 Note that this function will only catch up the unread article
|
|
7587 in the current summary buffer limitation.
|
|
7588 The number of articles marked as read is returned."
|
|
7589 (interactive "P")
|
|
7590 (gnus-set-global-variables)
|
|
7591 (prog1
|
|
7592 (save-excursion
|
|
7593 (when (or quietly
|
|
7594 (not gnus-interactive-catchup) ;Without confirmation?
|
|
7595 gnus-expert-user
|
|
7596 (gnus-y-or-n-p
|
|
7597 (if all
|
|
7598 "Mark absolutely all articles as read? "
|
|
7599 "Mark all unread articles as read? ")))
|
|
7600 (if (and not-mark
|
|
7601 (not gnus-newsgroup-adaptive)
|
|
7602 (not gnus-newsgroup-auto-expire)
|
|
7603 (not gnus-suppress-duplicates))
|
|
7604 (progn
|
|
7605 (when all
|
|
7606 (setq gnus-newsgroup-marked nil
|
|
7607 gnus-newsgroup-dormant nil))
|
|
7608 (setq gnus-newsgroup-unreads nil))
|
|
7609 ;; We actually mark all articles as canceled, which we
|
|
7610 ;; have to do when using auto-expiry or adaptive scoring.
|
|
7611 (gnus-summary-show-all-threads)
|
|
7612 (when (gnus-summary-first-subject (not all))
|
|
7613 (while (and
|
|
7614 (if to-here (< (point) to-here) t)
|
|
7615 (gnus-summary-mark-article-as-read gnus-catchup-mark)
|
|
7616 (gnus-summary-find-next (not all)))))
|
|
7617 (gnus-set-mode-line 'summary))
|
|
7618 t))
|
|
7619 (gnus-summary-position-point)))
|
|
7620
|
|
7621 (defun gnus-summary-catchup-to-here (&optional all)
|
|
7622 "Mark all unticked articles before the current one as read.
|
|
7623 If ALL is non-nil, also mark ticked and dormant articles as read."
|
|
7624 (interactive "P")
|
|
7625 (gnus-set-global-variables)
|
|
7626 (save-excursion
|
|
7627 (gnus-save-hidden-threads
|
|
7628 (let ((beg (point)))
|
|
7629 ;; We check that there are unread articles.
|
|
7630 (when (or all (gnus-summary-find-prev))
|
|
7631 (gnus-summary-catchup all t beg)))))
|
|
7632 (gnus-summary-position-point))
|
|
7633
|
|
7634 (defun gnus-summary-catchup-all (&optional quietly)
|
|
7635 "Mark all articles in this newsgroup as read."
|
|
7636 (interactive "P")
|
|
7637 (gnus-set-global-variables)
|
|
7638 (gnus-summary-catchup t quietly))
|
|
7639
|
|
7640 (defun gnus-summary-catchup-and-exit (&optional all quietly)
|
|
7641 "Mark all articles not marked as unread in this newsgroup as read, then exit.
|
|
7642 If prefix argument ALL is non-nil, all articles are marked as read."
|
|
7643 (interactive "P")
|
|
7644 (gnus-set-global-variables)
|
|
7645 (when (gnus-summary-catchup all quietly nil 'fast)
|
|
7646 ;; Select next newsgroup or exit.
|
|
7647 (if (eq gnus-auto-select-next 'quietly)
|
|
7648 (gnus-summary-next-group nil)
|
|
7649 (gnus-summary-exit))))
|
|
7650
|
|
7651 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
|
|
7652 "Mark all articles in this newsgroup as read, and then exit."
|
|
7653 (interactive "P")
|
|
7654 (gnus-set-global-variables)
|
|
7655 (gnus-summary-catchup-and-exit t quietly))
|
|
7656
|
|
7657 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
|
|
7658 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
|
|
7659 "Mark all articles in this group as read and select the next group.
|
|
7660 If given a prefix, mark all articles, unread as well as ticked, as
|
|
7661 read."
|
|
7662 (interactive "P")
|
|
7663 (gnus-set-global-variables)
|
|
7664 (save-excursion
|
|
7665 (gnus-summary-catchup all))
|
|
7666 (gnus-summary-next-article t nil nil t))
|
|
7667
|
|
7668 ;; Thread-based commands.
|
|
7669
|
|
7670 (defun gnus-summary-articles-in-thread (&optional article)
|
|
7671 "Return a list of all articles in the current thread.
|
|
7672 If ARTICLE is non-nil, return all articles in the thread that starts
|
|
7673 with that article."
|
|
7674 (let* ((article (or article (gnus-summary-article-number)))
|
|
7675 (data (gnus-data-find-list article))
|
|
7676 (top-level (gnus-data-level (car data)))
|
|
7677 (top-subject
|
|
7678 (cond ((null gnus-thread-operation-ignore-subject)
|
|
7679 (gnus-simplify-subject-re
|
|
7680 (mail-header-subject (gnus-data-header (car data)))))
|
|
7681 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7682 (gnus-simplify-subject-fuzzy
|
|
7683 (mail-header-subject (gnus-data-header (car data)))))
|
|
7684 (t nil)))
|
|
7685 (end-point (save-excursion
|
|
7686 (if (gnus-summary-go-to-next-thread)
|
|
7687 (point) (point-max))))
|
|
7688 articles)
|
|
7689 (while (and data
|
|
7690 (< (gnus-data-pos (car data)) end-point))
|
|
7691 (when (or (not top-subject)
|
|
7692 (string= top-subject
|
|
7693 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7694 (gnus-simplify-subject-fuzzy
|
|
7695 (mail-header-subject
|
|
7696 (gnus-data-header (car data))))
|
|
7697 (gnus-simplify-subject-re
|
|
7698 (mail-header-subject
|
|
7699 (gnus-data-header (car data)))))))
|
|
7700 (push (gnus-data-number (car data)) articles))
|
|
7701 (unless (and (setq data (cdr data))
|
|
7702 (> (gnus-data-level (car data)) top-level))
|
|
7703 (setq data nil)))
|
|
7704 ;; Return the list of articles.
|
|
7705 (nreverse articles)))
|
|
7706
|
|
7707 (defun gnus-summary-rethread-current ()
|
|
7708 "Rethread the thread the current article is part of."
|
|
7709 (interactive)
|
|
7710 (gnus-set-global-variables)
|
|
7711 (let* ((gnus-show-threads t)
|
|
7712 (article (gnus-summary-article-number))
|
|
7713 (id (mail-header-id (gnus-summary-article-header)))
|
|
7714 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
|
|
7715 (unless id
|
|
7716 (error "No article on the current line"))
|
|
7717 (gnus-rebuild-thread id)
|
|
7718 (gnus-summary-goto-subject article)))
|
|
7719
|
|
7720 (defun gnus-summary-reparent-thread ()
|
104
|
7721 "Make the current article child of the marked (or previous) article.
|
98
|
7722
|
|
7723 Note that the re-threading will only work if `gnus-thread-ignore-subject'
|
|
7724 is non-nil or the Subject: of both articles are the same."
|
|
7725 (interactive)
|
|
7726 (unless (not (gnus-group-read-only-p))
|
|
7727 (error "The current newsgroup does not support article editing."))
|
|
7728 (unless (<= (length gnus-newsgroup-processable) 1)
|
|
7729 (error "No more than one article may be marked."))
|
|
7730 (save-window-excursion
|
|
7731 (let ((gnus-article-buffer " *reparent*")
|
|
7732 (current-article (gnus-summary-article-number))
|
104
|
7733 ;; First grab the marked article, otherwise one line up.
|
98
|
7734 (parent-article (if (not (null gnus-newsgroup-processable))
|
|
7735 (car gnus-newsgroup-processable)
|
|
7736 (save-excursion
|
|
7737 (if (eq (forward-line -1) 0)
|
|
7738 (gnus-summary-article-number)
|
|
7739 (error "Beginning of summary buffer."))))))
|
|
7740 (unless (not (eq current-article parent-article))
|
|
7741 (error "An article may not be self-referential."))
|
|
7742 (let ((message-id (mail-header-id
|
|
7743 (gnus-summary-article-header parent-article))))
|
|
7744 (unless (and message-id (not (equal message-id "")))
|
|
7745 (error "No message-id in desired parent."))
|
|
7746 (gnus-summary-select-article t t nil current-article)
|
104
|
7747 (set-buffer gnus-original-article-buffer)
|
98
|
7748 (let ((buf (format "%s" (buffer-string))))
|
104
|
7749 (nnheader-temp-write nil
|
|
7750 (insert buf)
|
|
7751 (goto-char (point-min))
|
|
7752 (if (search-forward-regexp "^References: " nil t)
|
|
7753 (insert message-id " " )
|
|
7754 (insert "References: " message-id "\n"))
|
|
7755 (unless (gnus-request-replace-article
|
|
7756 current-article (car gnus-article-current)
|
|
7757 (current-buffer))
|
|
7758 (error "Couldn't replace article."))))
|
98
|
7759 (set-buffer gnus-summary-buffer)
|
|
7760 (gnus-summary-unmark-all-processable)
|
|
7761 (gnus-summary-rethread-current)
|
|
7762 (gnus-message 3 "Article %d is now the child of article %d."
|
|
7763 current-article parent-article)))))
|
|
7764
|
|
7765 (defun gnus-summary-toggle-threads (&optional arg)
|
|
7766 "Toggle showing conversation threads.
|
|
7767 If ARG is positive number, turn showing conversation threads on."
|
|
7768 (interactive "P")
|
|
7769 (gnus-set-global-variables)
|
|
7770 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
|
|
7771 (setq gnus-show-threads
|
|
7772 (if (null arg) (not gnus-show-threads)
|
|
7773 (> (prefix-numeric-value arg) 0)))
|
|
7774 (gnus-summary-prepare)
|
|
7775 (gnus-summary-goto-subject current)
|
|
7776 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
|
|
7777 (gnus-summary-position-point)))
|
|
7778
|
|
7779 (defun gnus-summary-show-all-threads ()
|
|
7780 "Show all threads."
|
|
7781 (interactive)
|
|
7782 (gnus-set-global-variables)
|
|
7783 (save-excursion
|
|
7784 (let ((buffer-read-only nil))
|
|
7785 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
|
|
7786 (gnus-summary-position-point))
|
|
7787
|
|
7788 (defun gnus-summary-show-thread ()
|
|
7789 "Show thread subtrees.
|
|
7790 Returns nil if no thread was there to be shown."
|
|
7791 (interactive)
|
|
7792 (gnus-set-global-variables)
|
|
7793 (let ((buffer-read-only nil)
|
|
7794 (orig (point))
|
|
7795 ;; first goto end then to beg, to have point at beg after let
|
|
7796 (end (progn (end-of-line) (point)))
|
|
7797 (beg (progn (beginning-of-line) (point))))
|
|
7798 (prog1
|
|
7799 ;; Any hidden lines here?
|
|
7800 (search-forward "\r" end t)
|
|
7801 (subst-char-in-region beg end ?\^M ?\n t)
|
|
7802 (goto-char orig)
|
|
7803 (gnus-summary-position-point))))
|
|
7804
|
|
7805 (defun gnus-summary-hide-all-threads ()
|
|
7806 "Hide all thread subtrees."
|
|
7807 (interactive)
|
|
7808 (gnus-set-global-variables)
|
|
7809 (save-excursion
|
|
7810 (goto-char (point-min))
|
|
7811 (gnus-summary-hide-thread)
|
|
7812 (while (zerop (gnus-summary-next-thread 1 t))
|
|
7813 (gnus-summary-hide-thread)))
|
|
7814 (gnus-summary-position-point))
|
|
7815
|
|
7816 (defun gnus-summary-hide-thread ()
|
|
7817 "Hide thread subtrees.
|
|
7818 Returns nil if no threads were there to be hidden."
|
|
7819 (interactive)
|
|
7820 (gnus-set-global-variables)
|
|
7821 (let ((buffer-read-only nil)
|
|
7822 (start (point))
|
|
7823 (article (gnus-summary-article-number)))
|
|
7824 (goto-char start)
|
|
7825 ;; Go forward until either the buffer ends or the subthread
|
|
7826 ;; ends.
|
|
7827 (when (and (not (eobp))
|
|
7828 (or (zerop (gnus-summary-next-thread 1 t))
|
|
7829 (goto-char (point-max))))
|
|
7830 (prog1
|
|
7831 (if (and (> (point) start)
|
|
7832 (search-backward "\n" start t))
|
|
7833 (progn
|
|
7834 (subst-char-in-region start (point) ?\n ?\^M)
|
|
7835 (gnus-summary-goto-subject article))
|
|
7836 (goto-char start)
|
|
7837 nil)
|
|
7838 ;;(gnus-summary-position-point)
|
|
7839 ))))
|
|
7840
|
|
7841 (defun gnus-summary-go-to-next-thread (&optional previous)
|
|
7842 "Go to the same level (or less) next thread.
|
|
7843 If PREVIOUS is non-nil, go to previous thread instead.
|
|
7844 Return the article number moved to, or nil if moving was impossible."
|
|
7845 (let ((level (gnus-summary-thread-level))
|
|
7846 (way (if previous -1 1))
|
|
7847 (beg (point)))
|
|
7848 (forward-line way)
|
|
7849 (while (and (not (eobp))
|
|
7850 (< level (gnus-summary-thread-level)))
|
|
7851 (forward-line way))
|
|
7852 (if (eobp)
|
|
7853 (progn
|
|
7854 (goto-char beg)
|
|
7855 nil)
|
|
7856 (setq beg (point))
|
|
7857 (prog1
|
|
7858 (gnus-summary-article-number)
|
|
7859 (goto-char beg)))))
|
|
7860
|
|
7861 (defun gnus-summary-next-thread (n &optional silent)
|
|
7862 "Go to the same level next N'th thread.
|
|
7863 If N is negative, search backward instead.
|
|
7864 Returns the difference between N and the number of skips actually
|
|
7865 done.
|
|
7866
|
|
7867 If SILENT, don't output messages."
|
|
7868 (interactive "p")
|
|
7869 (gnus-set-global-variables)
|
|
7870 (let ((backward (< n 0))
|
|
7871 (n (abs n)))
|
|
7872 (while (and (> n 0)
|
|
7873 (gnus-summary-go-to-next-thread backward))
|
|
7874 (decf n))
|
|
7875 (unless silent
|
|
7876 (gnus-summary-position-point))
|
|
7877 (when (and (not silent) (/= 0 n))
|
|
7878 (gnus-message 7 "No more threads"))
|
|
7879 n))
|
|
7880
|
|
7881 (defun gnus-summary-prev-thread (n)
|
|
7882 "Go to the same level previous N'th thread.
|
|
7883 Returns the difference between N and the number of skips actually
|
|
7884 done."
|
|
7885 (interactive "p")
|
|
7886 (gnus-set-global-variables)
|
|
7887 (gnus-summary-next-thread (- n)))
|
|
7888
|
|
7889 (defun gnus-summary-go-down-thread ()
|
|
7890 "Go down one level in the current thread."
|
|
7891 (let ((children (gnus-summary-article-children)))
|
|
7892 (when children
|
|
7893 (gnus-summary-goto-subject (car children)))))
|
|
7894
|
|
7895 (defun gnus-summary-go-up-thread ()
|
|
7896 "Go up one level in the current thread."
|
|
7897 (let ((parent (gnus-summary-article-parent)))
|
|
7898 (when parent
|
|
7899 (gnus-summary-goto-subject parent))))
|
|
7900
|
|
7901 (defun gnus-summary-down-thread (n)
|
|
7902 "Go down thread N steps.
|
|
7903 If N is negative, go up instead.
|
|
7904 Returns the difference between N and how many steps down that were
|
|
7905 taken."
|
|
7906 (interactive "p")
|
|
7907 (gnus-set-global-variables)
|
|
7908 (let ((up (< n 0))
|
|
7909 (n (abs n)))
|
|
7910 (while (and (> n 0)
|
|
7911 (if up (gnus-summary-go-up-thread)
|
|
7912 (gnus-summary-go-down-thread)))
|
|
7913 (setq n (1- n)))
|
|
7914 (gnus-summary-position-point)
|
|
7915 (when (/= 0 n)
|
|
7916 (gnus-message 7 "Can't go further"))
|
|
7917 n))
|
|
7918
|
|
7919 (defun gnus-summary-up-thread (n)
|
|
7920 "Go up thread N steps.
|
|
7921 If N is negative, go up instead.
|
|
7922 Returns the difference between N and how many steps down that were
|
|
7923 taken."
|
|
7924 (interactive "p")
|
|
7925 (gnus-set-global-variables)
|
|
7926 (gnus-summary-down-thread (- n)))
|
|
7927
|
|
7928 (defun gnus-summary-top-thread ()
|
|
7929 "Go to the top of the thread."
|
|
7930 (interactive)
|
|
7931 (gnus-set-global-variables)
|
|
7932 (while (gnus-summary-go-up-thread))
|
|
7933 (gnus-summary-article-number))
|
|
7934
|
|
7935 (defun gnus-summary-kill-thread (&optional unmark)
|
|
7936 "Mark articles under current thread as read.
|
|
7937 If the prefix argument is positive, remove any kinds of marks.
|
|
7938 If the prefix argument is negative, tick articles instead."
|
|
7939 (interactive "P")
|
|
7940 (gnus-set-global-variables)
|
|
7941 (when unmark
|
|
7942 (setq unmark (prefix-numeric-value unmark)))
|
|
7943 (let ((articles (gnus-summary-articles-in-thread)))
|
|
7944 (save-excursion
|
|
7945 ;; Expand the thread.
|
|
7946 (gnus-summary-show-thread)
|
|
7947 ;; Mark all the articles.
|
|
7948 (while articles
|
|
7949 (gnus-summary-goto-subject (car articles))
|
|
7950 (cond ((null unmark)
|
|
7951 (gnus-summary-mark-article-as-read gnus-killed-mark))
|
|
7952 ((> unmark 0)
|
|
7953 (gnus-summary-mark-article-as-unread gnus-unread-mark))
|
|
7954 (t
|
|
7955 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
|
|
7956 (setq articles (cdr articles))))
|
|
7957 ;; Hide killed subtrees.
|
|
7958 (and (null unmark)
|
|
7959 gnus-thread-hide-killed
|
|
7960 (gnus-summary-hide-thread))
|
|
7961 ;; If marked as read, go to next unread subject.
|
|
7962 (when (null unmark)
|
|
7963 ;; Go to next unread subject.
|
|
7964 (gnus-summary-next-subject 1 t)))
|
|
7965 (gnus-set-mode-line 'summary))
|
|
7966
|
|
7967 ;; Summary sorting commands
|
|
7968
|
|
7969 (defun gnus-summary-sort-by-number (&optional reverse)
|
|
7970 "Sort the summary buffer by article number.
|
|
7971 Argument REVERSE means reverse order."
|
|
7972 (interactive "P")
|
|
7973 (gnus-summary-sort 'number reverse))
|
|
7974
|
|
7975 (defun gnus-summary-sort-by-author (&optional reverse)
|
|
7976 "Sort the summary buffer by author name alphabetically.
|
|
7977 If case-fold-search is non-nil, case of letters is ignored.
|
|
7978 Argument REVERSE means reverse order."
|
|
7979 (interactive "P")
|
|
7980 (gnus-summary-sort 'author reverse))
|
|
7981
|
|
7982 (defun gnus-summary-sort-by-subject (&optional reverse)
|
|
7983 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
|
|
7984 If case-fold-search is non-nil, case of letters is ignored.
|
|
7985 Argument REVERSE means reverse order."
|
|
7986 (interactive "P")
|
|
7987 (gnus-summary-sort 'subject reverse))
|
|
7988
|
|
7989 (defun gnus-summary-sort-by-date (&optional reverse)
|
|
7990 "Sort the summary buffer by date.
|
|
7991 Argument REVERSE means reverse order."
|
|
7992 (interactive "P")
|
|
7993 (gnus-summary-sort 'date reverse))
|
|
7994
|
|
7995 (defun gnus-summary-sort-by-score (&optional reverse)
|
|
7996 "Sort the summary buffer by score.
|
|
7997 Argument REVERSE means reverse order."
|
|
7998 (interactive "P")
|
|
7999 (gnus-summary-sort 'score reverse))
|
|
8000
|
|
8001 (defun gnus-summary-sort-by-lines (&optional reverse)
|
|
8002 "Sort the summary buffer by article length.
|
|
8003 Argument REVERSE means reverse order."
|
|
8004 (interactive "P")
|
|
8005 (gnus-summary-sort 'lines reverse))
|
|
8006
|
|
8007 (defun gnus-summary-sort (predicate reverse)
|
|
8008 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
|
|
8009 (gnus-set-global-variables)
|
|
8010 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
|
|
8011 (article (intern (format "gnus-article-sort-by-%s" predicate)))
|
|
8012 (gnus-thread-sort-functions
|
|
8013 (list
|
|
8014 (if (not reverse)
|
|
8015 thread
|
|
8016 `(lambda (t1 t2)
|
|
8017 (,thread t2 t1)))))
|
|
8018 (gnus-article-sort-functions
|
|
8019 (list
|
|
8020 (if (not reverse)
|
|
8021 article
|
|
8022 `(lambda (t1 t2)
|
|
8023 (,article t2 t1)))))
|
|
8024 (buffer-read-only)
|
|
8025 (gnus-summary-prepare-hook nil))
|
|
8026 ;; We do the sorting by regenerating the threads.
|
|
8027 (gnus-summary-prepare)
|
|
8028 ;; Hide subthreads if needed.
|
|
8029 (when (and gnus-show-threads gnus-thread-hide-subtree)
|
|
8030 (gnus-summary-hide-all-threads))))
|
|
8031
|
|
8032 ;; Summary saving commands.
|
|
8033
|
|
8034 (defun gnus-summary-save-article (&optional n not-saved)
|
|
8035 "Save the current article using the default saver function.
|
|
8036 If N is a positive number, save the N next articles.
|
|
8037 If N is a negative number, save the N previous articles.
|
|
8038 If N is nil and any articles have been marked with the process mark,
|
|
8039 save those articles instead.
|
|
8040 The variable `gnus-default-article-saver' specifies the saver function."
|
|
8041 (interactive "P")
|
|
8042 (gnus-set-global-variables)
|
|
8043 (let* ((articles (gnus-summary-work-articles n))
|
|
8044 (save-buffer (save-excursion
|
|
8045 (nnheader-set-temp-buffer " *Gnus Save*")))
|
|
8046 (num (length articles))
|
|
8047 header article file)
|
|
8048 (while articles
|
|
8049 (setq header (gnus-summary-article-header
|
|
8050 (setq article (pop articles))))
|
|
8051 (if (not (vectorp header))
|
|
8052 ;; This is a pseudo-article.
|
|
8053 (if (assq 'name header)
|
|
8054 (gnus-copy-file (cdr (assq 'name header)))
|
|
8055 (gnus-message 1 "Article %d is unsaveable" article))
|
|
8056 ;; This is a real article.
|
|
8057 (save-window-excursion
|
|
8058 (gnus-summary-select-article t nil nil article))
|
|
8059 (save-excursion
|
|
8060 (set-buffer save-buffer)
|
|
8061 (erase-buffer)
|
|
8062 (insert-buffer-substring gnus-original-article-buffer))
|
|
8063 (setq file (gnus-article-save save-buffer file num))
|
|
8064 (gnus-summary-remove-process-mark article)
|
|
8065 (unless not-saved
|
|
8066 (gnus-summary-set-saved-mark article))))
|
|
8067 (gnus-kill-buffer save-buffer)
|
|
8068 (gnus-summary-position-point)
|
|
8069 (gnus-set-mode-line 'summary)
|
|
8070 n))
|
|
8071
|
|
8072 (defun gnus-summary-pipe-output (&optional arg)
|
|
8073 "Pipe the current article to a subprocess.
|
|
8074 If N is a positive number, pipe the N next articles.
|
|
8075 If N is a negative number, pipe the N previous articles.
|
|
8076 If N is nil and any articles have been marked with the process mark,
|
|
8077 pipe those articles instead."
|
|
8078 (interactive "P")
|
|
8079 (gnus-set-global-variables)
|
|
8080 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
|
|
8081 (gnus-summary-save-article arg t))
|
|
8082 (gnus-configure-windows 'pipe))
|
|
8083
|
|
8084 (defun gnus-summary-save-article-mail (&optional arg)
|
|
8085 "Append the current article to an mail file.
|
|
8086 If N is a positive number, save the N next articles.
|
|
8087 If N is a negative number, save the N previous articles.
|
|
8088 If N is nil and any articles have been marked with the process mark,
|
|
8089 save those articles instead."
|
|
8090 (interactive "P")
|
|
8091 (gnus-set-global-variables)
|
|
8092 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
|
|
8093 (gnus-summary-save-article arg)))
|
|
8094
|
|
8095 (defun gnus-summary-save-article-rmail (&optional arg)
|
|
8096 "Append the current article to an rmail file.
|
|
8097 If N is a positive number, save the N next articles.
|
|
8098 If N is a negative number, save the N previous articles.
|
|
8099 If N is nil and any articles have been marked with the process mark,
|
|
8100 save those articles instead."
|
|
8101 (interactive "P")
|
|
8102 (gnus-set-global-variables)
|
|
8103 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
|
|
8104 (gnus-summary-save-article arg)))
|
|
8105
|
|
8106 (defun gnus-summary-save-article-file (&optional arg)
|
|
8107 "Append the current article to a file.
|
|
8108 If N is a positive number, save the N next articles.
|
|
8109 If N is a negative number, save the N previous articles.
|
|
8110 If N is nil and any articles have been marked with the process mark,
|
|
8111 save those articles instead."
|
|
8112 (interactive "P")
|
|
8113 (gnus-set-global-variables)
|
|
8114 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
|
|
8115 (gnus-summary-save-article arg)))
|
|
8116
|
|
8117 (defun gnus-summary-write-article-file (&optional arg)
|
|
8118 "Write the current article to a file, deleting the previous file.
|
|
8119 If N is a positive number, save the N next articles.
|
|
8120 If N is a negative number, save the N previous articles.
|
|
8121 If N is nil and any articles have been marked with the process mark,
|
|
8122 save those articles instead."
|
|
8123 (interactive "P")
|
|
8124 (gnus-set-global-variables)
|
|
8125 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
|
|
8126 (gnus-summary-save-article arg)))
|
|
8127
|
|
8128 (defun gnus-summary-save-article-body-file (&optional arg)
|
|
8129 "Append the current article body to a file.
|
|
8130 If N is a positive number, save the N next articles.
|
|
8131 If N is a negative number, save the N previous articles.
|
|
8132 If N is nil and any articles have been marked with the process mark,
|
|
8133 save those articles instead."
|
|
8134 (interactive "P")
|
|
8135 (gnus-set-global-variables)
|
|
8136 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
|
|
8137 (gnus-summary-save-article arg)))
|
|
8138
|
|
8139 (defun gnus-summary-pipe-message (program)
|
|
8140 "Pipe the current article through PROGRAM."
|
|
8141 (interactive "sProgram: ")
|
|
8142 (gnus-set-global-variables)
|
|
8143 (gnus-summary-select-article)
|
|
8144 (let ((mail-header-separator "")
|
|
8145 (art-buf (get-buffer gnus-article-buffer)))
|
|
8146 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
8147 (save-restriction
|
|
8148 (widen)
|
|
8149 (let ((start (window-start))
|
|
8150 buffer-read-only)
|
|
8151 (message-pipe-buffer-body program)
|
|
8152 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
8153
|
|
8154 (defun gnus-get-split-value (methods)
|
|
8155 "Return a value based on the split METHODS."
|
|
8156 (let (split-name method result match)
|
|
8157 (when methods
|
|
8158 (save-excursion
|
|
8159 (set-buffer gnus-original-article-buffer)
|
|
8160 (save-restriction
|
|
8161 (nnheader-narrow-to-headers)
|
|
8162 (while methods
|
|
8163 (goto-char (point-min))
|
|
8164 (setq method (pop methods))
|
|
8165 (setq match (car method))
|
|
8166 (when (cond
|
|
8167 ((stringp match)
|
|
8168 ;; Regular expression.
|
|
8169 (ignore-errors
|
|
8170 (re-search-forward match nil t)))
|
|
8171 ((gnus-functionp match)
|
|
8172 ;; Function.
|
|
8173 (save-restriction
|
|
8174 (widen)
|
|
8175 (setq result (funcall match gnus-newsgroup-name))))
|
|
8176 ((consp match)
|
|
8177 ;; Form.
|
|
8178 (save-restriction
|
|
8179 (widen)
|
|
8180 (setq result (eval match)))))
|
|
8181 (setq split-name (append (cdr method) split-name))
|
|
8182 (cond ((stringp result)
|
|
8183 (push (expand-file-name
|
|
8184 result gnus-article-save-directory)
|
|
8185 split-name))
|
|
8186 ((consp result)
|
|
8187 (setq split-name (append result split-name)))))))))
|
|
8188 split-name))
|
|
8189
|
|
8190 (defun gnus-valid-move-group-p (group)
|
|
8191 (and (boundp group)
|
|
8192 (symbol-name group)
|
|
8193 (memq 'respool
|
|
8194 (assoc (symbol-name
|
|
8195 (car (gnus-find-method-for-group
|
|
8196 (symbol-name group))))
|
|
8197 gnus-valid-select-methods))))
|
|
8198
|
|
8199 (defun gnus-read-move-group-name (prompt default articles prefix)
|
|
8200 "Read a group name."
|
|
8201 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
|
|
8202 (minibuffer-confirm-incomplete nil) ; XEmacs
|
|
8203 (prom
|
|
8204 (format "%s %s to:"
|
|
8205 prompt
|
|
8206 (if (> (length articles) 1)
|
|
8207 (format "these %d articles" (length articles))
|
|
8208 "this article")))
|
|
8209 (to-newsgroup
|
|
8210 (cond
|
|
8211 ((null split-name)
|
|
8212 (gnus-completing-read default prom
|
|
8213 gnus-active-hashtb
|
|
8214 'gnus-valid-move-group-p
|
|
8215 nil prefix
|
|
8216 'gnus-group-history))
|
|
8217 ((= 1 (length split-name))
|
|
8218 (gnus-completing-read (car split-name) prom
|
|
8219 gnus-active-hashtb
|
|
8220 'gnus-valid-move-group-p
|
|
8221 nil nil
|
|
8222 'gnus-group-history))
|
|
8223 (t
|
|
8224 (gnus-completing-read nil prom
|
|
8225 (mapcar (lambda (el) (list el))
|
|
8226 (nreverse split-name))
|
|
8227 nil nil nil
|
|
8228 'gnus-group-history)))))
|
|
8229 (when to-newsgroup
|
|
8230 (if (or (string= to-newsgroup "")
|
|
8231 (string= to-newsgroup prefix))
|
|
8232 (setq to-newsgroup (or default "")))
|
|
8233 (or (gnus-active to-newsgroup)
|
|
8234 (gnus-activate-group to-newsgroup)
|
|
8235 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
|
|
8236 to-newsgroup))
|
|
8237 (or (and (gnus-request-create-group
|
|
8238 to-newsgroup (gnus-group-name-to-method to-newsgroup))
|
|
8239 (gnus-activate-group to-newsgroup nil nil
|
|
8240 (gnus-group-name-to-method
|
|
8241 to-newsgroup)))
|
|
8242 (error "Couldn't create group %s" to-newsgroup)))
|
|
8243 (error "No such group: %s" to-newsgroup)))
|
|
8244 to-newsgroup))
|
|
8245
|
|
8246 ;; Summary extract commands
|
|
8247
|
|
8248 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
|
|
8249 (let ((buffer-read-only nil)
|
|
8250 (article (gnus-summary-article-number))
|
|
8251 after-article b e)
|
|
8252 (unless (gnus-summary-goto-subject article)
|
|
8253 (error "No such article: %d" article))
|
|
8254 (gnus-summary-position-point)
|
|
8255 ;; If all commands are to be bunched up on one line, we collect
|
|
8256 ;; them here.
|
|
8257 (unless gnus-view-pseudos-separately
|
|
8258 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
|
|
8259 files action)
|
|
8260 (while ps
|
|
8261 (setq action (cdr (assq 'action (car ps))))
|
|
8262 (setq files (list (cdr (assq 'name (car ps)))))
|
|
8263 (while (and ps (cdr ps)
|
|
8264 (string= (or action "1")
|
|
8265 (or (cdr (assq 'action (cadr ps))) "2")))
|
|
8266 (push (cdr (assq 'name (cadr ps))) files)
|
|
8267 (setcdr ps (cddr ps)))
|
|
8268 (when files
|
|
8269 (when (not (string-match "%s" action))
|
|
8270 (push " " files))
|
|
8271 (push " " files)
|
|
8272 (when (assq 'execute (car ps))
|
|
8273 (setcdr (assq 'execute (car ps))
|
|
8274 (funcall (if (string-match "%s" action)
|
|
8275 'format 'concat)
|
|
8276 action
|
100
|
8277 (mapconcat
|
|
8278 (lambda (f)
|
|
8279 (if (equal f " ")
|
|
8280 f
|
|
8281 (gnus-quote-arg-for-sh-or-csh f)))
|
|
8282 files " ")))))
|
98
|
8283 (setq ps (cdr ps)))))
|
|
8284 (if (and gnus-view-pseudos (not not-view))
|
|
8285 (while pslist
|
|
8286 (when (assq 'execute (car pslist))
|
|
8287 (gnus-execute-command (cdr (assq 'execute (car pslist)))
|
|
8288 (eq gnus-view-pseudos 'not-confirm)))
|
|
8289 (setq pslist (cdr pslist)))
|
|
8290 (save-excursion
|
|
8291 (while pslist
|
|
8292 (setq after-article (or (cdr (assq 'article (car pslist)))
|
|
8293 (gnus-summary-article-number)))
|
|
8294 (gnus-summary-goto-subject after-article)
|
|
8295 (forward-line 1)
|
|
8296 (setq b (point))
|
|
8297 (insert " " (file-name-nondirectory
|
|
8298 (cdr (assq 'name (car pslist))))
|
|
8299 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
|
|
8300 (setq e (point))
|
|
8301 (forward-line -1) ; back to `b'
|
|
8302 (gnus-add-text-properties
|
|
8303 b (1- e) (list 'gnus-number gnus-reffed-article-number
|
|
8304 gnus-mouse-face-prop gnus-mouse-face))
|
|
8305 (gnus-data-enter
|
|
8306 after-article gnus-reffed-article-number
|
|
8307 gnus-unread-mark b (car pslist) 0 (- e b))
|
|
8308 (push gnus-reffed-article-number gnus-newsgroup-unreads)
|
|
8309 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
|
|
8310 (setq pslist (cdr pslist)))))))
|
|
8311
|
|
8312 (defun gnus-pseudos< (p1 p2)
|
|
8313 (let ((c1 (cdr (assq 'action p1)))
|
|
8314 (c2 (cdr (assq 'action p2))))
|
|
8315 (and c1 c2 (string< c1 c2))))
|
|
8316
|
|
8317 (defun gnus-request-pseudo-article (props)
|
|
8318 (cond ((assq 'execute props)
|
|
8319 (gnus-execute-command (cdr (assq 'execute props)))))
|
|
8320 (let ((gnus-current-article (gnus-summary-article-number)))
|
|
8321 (run-hooks 'gnus-mark-article-hook)))
|
|
8322
|
|
8323 (defun gnus-execute-command (command &optional automatic)
|
|
8324 (save-excursion
|
|
8325 (gnus-article-setup-buffer)
|
|
8326 (set-buffer gnus-article-buffer)
|
|
8327 (setq buffer-read-only nil)
|
|
8328 (let ((command (if automatic command (read-string "Command: " command)))
|
|
8329 ;; Just binding this here doesn't help, because there might
|
|
8330 ;; be output from the process after exiting the scope of
|
|
8331 ;; this `let'.
|
|
8332 ;; (buffer-read-only nil)
|
|
8333 )
|
|
8334 (erase-buffer)
|
|
8335 (insert "$ " command "\n\n")
|
|
8336 (if gnus-view-pseudo-asynchronously
|
|
8337 (start-process "gnus-execute" nil shell-file-name
|
|
8338 shell-command-switch command)
|
|
8339 (call-process shell-file-name nil t nil
|
|
8340 shell-command-switch command)))))
|
|
8341
|
|
8342 ;; Summary kill commands.
|
|
8343
|
|
8344 (defun gnus-summary-edit-global-kill (article)
|
|
8345 "Edit the \"global\" kill file."
|
|
8346 (interactive (list (gnus-summary-article-number)))
|
|
8347 (gnus-set-global-variables)
|
|
8348 (gnus-group-edit-global-kill article))
|
|
8349
|
|
8350 (defun gnus-summary-edit-local-kill ()
|
|
8351 "Edit a local kill file applied to the current newsgroup."
|
|
8352 (interactive)
|
|
8353 (gnus-set-global-variables)
|
|
8354 (setq gnus-current-headers (gnus-summary-article-header))
|
|
8355 (gnus-set-global-variables)
|
|
8356 (gnus-group-edit-local-kill
|
|
8357 (gnus-summary-article-number) gnus-newsgroup-name))
|
|
8358
|
|
8359 ;;; Header reading.
|
|
8360
|
|
8361 (defun gnus-read-header (id &optional header)
|
|
8362 "Read the headers of article ID and enter them into the Gnus system."
|
|
8363 (let ((group gnus-newsgroup-name)
|
|
8364 (gnus-override-method
|
|
8365 (and (gnus-news-group-p gnus-newsgroup-name)
|
|
8366 gnus-refer-article-method))
|
|
8367 where)
|
|
8368 ;; First we check to see whether the header in question is already
|
|
8369 ;; fetched.
|
|
8370 (if (stringp id)
|
|
8371 ;; This is a Message-ID.
|
|
8372 (setq header (or header (gnus-id-to-header id)))
|
|
8373 ;; This is an article number.
|
|
8374 (setq header (or header (gnus-summary-article-header id))))
|
|
8375 (if (and header
|
|
8376 (not (gnus-summary-article-sparse-p (mail-header-number header))))
|
|
8377 ;; We have found the header.
|
|
8378 header
|
|
8379 ;; We have to really fetch the header to this article.
|
|
8380 (save-excursion
|
|
8381 (set-buffer nntp-server-buffer)
|
|
8382 (when (setq where (gnus-request-head id group))
|
|
8383 (nnheader-fold-continuation-lines)
|
|
8384 (goto-char (point-max))
|
|
8385 (insert ".\n")
|
|
8386 (goto-char (point-min))
|
|
8387 (insert "211 ")
|
|
8388 (princ (cond
|
|
8389 ((numberp id) id)
|
|
8390 ((cdr where) (cdr where))
|
|
8391 (header (mail-header-number header))
|
|
8392 (t gnus-reffed-article-number))
|
|
8393 (current-buffer))
|
|
8394 (insert " Article retrieved.\n"))
|
|
8395 (if (or (not where)
|
|
8396 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
|
|
8397 () ; Malformed head.
|
|
8398 (unless (gnus-summary-article-sparse-p (mail-header-number header))
|
|
8399 (when (and (stringp id)
|
|
8400 (not (string= (gnus-group-real-name group)
|
|
8401 (car where))))
|
|
8402 ;; If we fetched by Message-ID and the article came
|
|
8403 ;; from a different group, we fudge some bogus article
|
|
8404 ;; numbers for this article.
|
|
8405 (mail-header-set-number header gnus-reffed-article-number))
|
|
8406 (save-excursion
|
|
8407 (set-buffer gnus-summary-buffer)
|
|
8408 (decf gnus-reffed-article-number)
|
|
8409 (gnus-remove-header (mail-header-number header))
|
|
8410 (push header gnus-newsgroup-headers)
|
|
8411 (setq gnus-current-headers header)
|
|
8412 (push (mail-header-number header) gnus-newsgroup-limit)))
|
|
8413 header)))))
|
|
8414
|
|
8415 (defun gnus-remove-header (number)
|
|
8416 "Remove header NUMBER from `gnus-newsgroup-headers'."
|
|
8417 (if (and gnus-newsgroup-headers
|
|
8418 (= number (mail-header-number (car gnus-newsgroup-headers))))
|
|
8419 (pop gnus-newsgroup-headers)
|
|
8420 (let ((headers gnus-newsgroup-headers))
|
|
8421 (while (and (cdr headers)
|
|
8422 (not (= number (mail-header-number (cadr headers)))))
|
|
8423 (pop headers))
|
|
8424 (when (cdr headers)
|
|
8425 (setcdr headers (cddr headers))))))
|
|
8426
|
|
8427 ;;;
|
|
8428 ;;; summary highlights
|
|
8429 ;;;
|
|
8430
|
|
8431 (defun gnus-highlight-selected-summary ()
|
|
8432 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
8433 ;; Highlight selected article in summary buffer
|
|
8434 (when gnus-summary-selected-face
|
|
8435 (save-excursion
|
|
8436 (let* ((beg (progn (beginning-of-line) (point)))
|
|
8437 (end (progn (end-of-line) (point)))
|
|
8438 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
|
|
8439 (from (if (get-text-property beg gnus-mouse-face-prop)
|
|
8440 beg
|
|
8441 (or (next-single-property-change
|
|
8442 beg gnus-mouse-face-prop nil end)
|
|
8443 beg)))
|
|
8444 (to
|
|
8445 (if (= from end)
|
|
8446 (- from 2)
|
|
8447 (or (next-single-property-change
|
|
8448 from gnus-mouse-face-prop nil end)
|
|
8449 end))))
|
|
8450 ;; If no mouse-face prop on line we will have to = from = end,
|
|
8451 ;; so we highlight the entire line instead.
|
|
8452 (when (= (+ to 2) from)
|
|
8453 (setq from beg)
|
|
8454 (setq to end))
|
|
8455 (if gnus-newsgroup-selected-overlay
|
|
8456 ;; Move old overlay.
|
|
8457 (gnus-move-overlay
|
|
8458 gnus-newsgroup-selected-overlay from to (current-buffer))
|
|
8459 ;; Create new overlay.
|
|
8460 (gnus-overlay-put
|
|
8461 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
|
|
8462 'face gnus-summary-selected-face))))))
|
|
8463
|
|
8464 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
|
|
8465 (defun gnus-summary-highlight-line ()
|
|
8466 "Highlight current line according to `gnus-summary-highlight'."
|
|
8467 (let* ((list gnus-summary-highlight)
|
|
8468 (p (point))
|
|
8469 (end (progn (end-of-line) (point)))
|
|
8470 ;; now find out where the line starts and leave point there.
|
|
8471 (beg (progn (beginning-of-line) (point)))
|
|
8472 (article (gnus-summary-article-number))
|
|
8473 (score (or (cdr (assq (or article gnus-current-article)
|
|
8474 gnus-newsgroup-scored))
|
|
8475 gnus-summary-default-score 0))
|
|
8476 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
|
|
8477 (inhibit-read-only t))
|
|
8478 ;; Eval the cars of the lists until we find a match.
|
|
8479 (let ((default gnus-summary-default-score))
|
|
8480 (while (and list
|
|
8481 (not (eval (caar list))))
|
|
8482 (setq list (cdr list))))
|
|
8483 (let ((face (cdar list)))
|
|
8484 (unless (eq face (get-text-property beg 'face))
|
|
8485 (gnus-put-text-property
|
|
8486 beg end 'face
|
|
8487 (setq face (if (boundp face) (symbol-value face) face)))
|
|
8488 (when gnus-summary-highlight-line-function
|
|
8489 (funcall gnus-summary-highlight-line-function article face))))
|
|
8490 (goto-char p)))
|
|
8491
|
|
8492 (defun gnus-update-read-articles (group unread)
|
|
8493 "Update the list of read articles in GROUP."
|
|
8494 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
|
|
8495 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
8496 (info (nth 2 entry))
|
|
8497 (prev 1)
|
|
8498 (unread (sort (copy-sequence unread) '<))
|
|
8499 read)
|
|
8500 (if (or (not info) (not active))
|
|
8501 ;; There is no info on this group if it was, in fact,
|
|
8502 ;; killed. Gnus stores no information on killed groups, so
|
|
8503 ;; there's nothing to be done.
|
|
8504 ;; One could store the information somewhere temporarily,
|
|
8505 ;; perhaps... Hmmm...
|
|
8506 ()
|
|
8507 ;; Remove any negative articles numbers.
|
|
8508 (while (and unread (< (car unread) 0))
|
|
8509 (setq unread (cdr unread)))
|
|
8510 ;; Remove any expired article numbers
|
|
8511 (while (and unread (< (car unread) (car active)))
|
|
8512 (setq unread (cdr unread)))
|
|
8513 ;; Compute the ranges of read articles by looking at the list of
|
|
8514 ;; unread articles.
|
|
8515 (while unread
|
|
8516 (when (/= (car unread) prev)
|
|
8517 (push (if (= prev (1- (car unread))) prev
|
|
8518 (cons prev (1- (car unread))))
|
|
8519 read))
|
|
8520 (setq prev (1+ (car unread)))
|
|
8521 (setq unread (cdr unread)))
|
|
8522 (when (<= prev (cdr active))
|
|
8523 (push (cons prev (cdr active)) read))
|
|
8524 (save-excursion
|
|
8525 (set-buffer gnus-group-buffer)
|
|
8526 (gnus-undo-register
|
|
8527 `(progn
|
|
8528 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
8529 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
8530 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
8531 (gnus-group-update-group ,group t))))
|
|
8532 ;; Enter this list into the group info.
|
|
8533 (gnus-info-set-read
|
|
8534 info (if (> (length read) 1) (nreverse read) read))
|
|
8535 ;; Set the number of unread articles in gnus-newsrc-hashtb.
|
|
8536 (gnus-get-unread-articles-in-group info (gnus-active group))
|
|
8537 t)))
|
|
8538
|
100
|
8539 (defun gnus-offer-save-summaries ()
|
|
8540 "Offer to save all active summary buffers."
|
|
8541 (save-excursion
|
|
8542 (let ((buflist (buffer-list))
|
|
8543 buffers bufname)
|
|
8544 ;; Go through all buffers and find all summaries.
|
|
8545 (while buflist
|
|
8546 (and (setq bufname (buffer-name (car buflist)))
|
|
8547 (string-match "Summary" bufname)
|
|
8548 (save-excursion
|
|
8549 (set-buffer bufname)
|
|
8550 ;; We check that this is, indeed, a summary buffer.
|
|
8551 (and (eq major-mode 'gnus-summary-mode)
|
|
8552 ;; Also make sure this isn't bogus.
|
|
8553 gnus-newsgroup-prepared
|
|
8554 ;; Also make sure that this isn't a dead summary buffer.
|
|
8555 (not gnus-dead-summary-mode)))
|
|
8556 (push bufname buffers))
|
|
8557 (setq buflist (cdr buflist)))
|
|
8558 ;; Go through all these summary buffers and offer to save them.
|
|
8559 (when buffers
|
|
8560 (map-y-or-n-p
|
|
8561 "Update summary buffer %s? "
|
|
8562 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
|
|
8563 buffers)))))
|
|
8564
|
98
|
8565 (provide 'gnus-sum)
|
|
8566
|
|
8567 (run-hooks 'gnus-sum-load-hook)
|
|
8568
|
|
8569 ;;; gnus-sum.el ends here
|