16
|
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
|
34
|
129 (defcustom gnus-summary-thread-gathering-function
|
|
130 'gnus-gather-threads-by-subject
|
16
|
131 "Function used for gathering loose threads.
|
|
132 There are two pre-defined functions: `gnus-gather-threads-by-subject',
|
|
133 which only takes Subjects into consideration; and
|
|
134 `gnus-gather-threads-by-references', which compared the References
|
|
135 headers of the articles to find matches."
|
|
136 :group 'gnus-thread
|
|
137 :type '(set (function-item gnus-gather-threads-by-subject)
|
|
138 (function-item gnus-gather-threads-by-references)
|
|
139 (function :tag "other")))
|
|
140
|
|
141 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
142 (defcustom gnus-summary-same-subject ""
|
|
143 "*String indicating that the current article has the same subject as the previous.
|
|
144 This variable will only be used if the value of
|
|
145 `gnus-summary-make-false-root' is `empty'."
|
|
146 :group 'gnus-summary-format
|
|
147 :type 'string)
|
|
148
|
|
149 (defcustom gnus-summary-goto-unread t
|
|
150 "*If t, marking commands will go to the next unread article.
|
|
151 If `never', commands that usually go to the next unread article, will
|
|
152 go to the next article, whether it is read or not.
|
|
153 If nil, only the marking commands will go to the next (un)read article."
|
|
154 :group 'gnus-summary-marks
|
|
155 :link '(custom-manual "(gnus)Setting Marks")
|
|
156 :type '(choice (const :tag "off" nil)
|
|
157 (const never)
|
|
158 (sexp :menu-tag "on" t)))
|
|
159
|
|
160 (defcustom gnus-summary-default-score 0
|
|
161 "*Default article score level.
|
30
|
162 All scores generated by the score files will be added to this score.
|
16
|
163 If this variable is nil, scoring will be disabled."
|
24
|
164 :group 'gnus-score-default
|
16
|
165 :type '(choice (const :tag "disable")
|
|
166 integer))
|
|
167
|
|
168 (defcustom gnus-summary-zcore-fuzz 0
|
|
169 "*Fuzziness factor for the zcore in the summary buffer.
|
|
170 Articles with scores closer than this to `gnus-summary-default-score'
|
|
171 will not be marked."
|
|
172 :group 'gnus-summary-format
|
|
173 :type 'integer)
|
|
174
|
|
175 (defcustom gnus-simplify-subject-fuzzy-regexp nil
|
|
176 "*Strings to be removed when doing fuzzy matches.
|
|
177 This can either be a regular expression or list of regular expressions
|
|
178 that will be removed from subject strings if fuzzy subject
|
|
179 simplification is selected."
|
|
180 :group 'gnus-thread
|
|
181 :type '(repeat regexp))
|
|
182
|
|
183 (defcustom gnus-show-threads t
|
|
184 "*If non-nil, display threads in summary mode."
|
|
185 :group 'gnus-thread
|
|
186 :type 'boolean)
|
|
187
|
|
188 (defcustom gnus-thread-hide-subtree nil
|
|
189 "*If non-nil, hide all threads initially.
|
|
190 If threads are hidden, you have to run the command
|
|
191 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
|
|
192 to expose hidden threads."
|
|
193 :group 'gnus-thread
|
|
194 :type 'boolean)
|
|
195
|
|
196 (defcustom gnus-thread-hide-killed t
|
|
197 "*If non-nil, hide killed threads automatically."
|
|
198 :group 'gnus-thread
|
|
199 :type 'boolean)
|
|
200
|
|
201 (defcustom gnus-thread-ignore-subject nil
|
|
202 "*If non-nil, ignore subjects and do all threading based on the Reference header.
|
|
203 If nil, which is the default, articles that have different subjects
|
|
204 from their parents will start separate threads."
|
|
205 :group 'gnus-thread
|
|
206 :type 'boolean)
|
|
207
|
|
208 (defcustom gnus-thread-operation-ignore-subject t
|
|
209 "*If non-nil, subjects will be ignored when doing thread commands.
|
|
210 This affects commands like `gnus-summary-kill-thread' and
|
|
211 `gnus-summary-lower-thread'.
|
|
212
|
|
213 If this variable is nil, articles in the same thread with different
|
|
214 subjects will not be included in the operation in question. If this
|
|
215 variable is `fuzzy', only articles that have subjects that are fuzzily
|
|
216 equal will be included."
|
|
217 :group 'gnus-thread
|
|
218 :type '(choice (const :tag "off" nil)
|
|
219 (const fuzzy)
|
|
220 (sexp :tag "on" t)))
|
|
221
|
|
222 (defcustom gnus-thread-indent-level 4
|
|
223 "*Number that says how much each sub-thread should be indented."
|
|
224 :group 'gnus-thread
|
|
225 :type 'integer)
|
|
226
|
|
227 (defcustom gnus-auto-extend-newsgroup t
|
|
228 "*If non-nil, extend newsgroup forward and backward when requested."
|
|
229 :group 'gnus-summary-choose
|
|
230 :type 'boolean)
|
|
231
|
|
232 (defcustom gnus-auto-select-first t
|
|
233 "*If nil, don't select the first unread article when entering a group.
|
|
234 If this variable is `best', select the highest-scored unread article
|
|
235 in the group. If neither nil nor `best', select the first unread
|
|
236 article.
|
|
237
|
|
238 If you want to prevent automatic selection of the first unread article
|
|
239 in some newsgroups, set the variable to nil in
|
|
240 `gnus-select-group-hook'."
|
|
241 :group 'gnus-group-select
|
|
242 :type '(choice (const :tag "none" nil)
|
|
243 (const best)
|
|
244 (sexp :menu-tag "first" t)))
|
|
245
|
|
246 (defcustom gnus-auto-select-next t
|
|
247 "*If non-nil, offer to go to the next group from the end of the previous.
|
|
248 If the value is t and the next newsgroup is empty, Gnus will exit
|
|
249 summary mode and go back to group mode. If the value is neither nil
|
|
250 nor t, Gnus will select the following unread newsgroup. In
|
|
251 particular, if the value is the symbol `quietly', the next unread
|
|
252 newsgroup will be selected without any confirmation, and if it is
|
|
253 `almost-quietly', the next group will be selected without any
|
|
254 confirmation if you are located on the last article in the group.
|
|
255 Finally, if this variable is `slightly-quietly', the `Z n' command
|
|
256 will go to the next group without confirmation."
|
|
257 :group 'gnus-summary-maneuvering
|
|
258 :type '(choice (const :tag "off" nil)
|
|
259 (const quietly)
|
|
260 (const almost-quietly)
|
|
261 (const slightly-quietly)
|
|
262 (sexp :menu-tag "on" t)))
|
|
263
|
|
264 (defcustom gnus-auto-select-same nil
|
|
265 "*If non-nil, select the next article with the same subject."
|
|
266 :group 'gnus-summary-maneuvering
|
|
267 :type 'boolean)
|
|
268
|
|
269 (defcustom gnus-summary-check-current nil
|
|
270 "*If non-nil, consider the current article when moving.
|
|
271 The \"unread\" movement commands will stay on the same line if the
|
|
272 current article is unread."
|
|
273 :group 'gnus-summary-maneuvering
|
|
274 :type 'boolean)
|
|
275
|
|
276 (defcustom gnus-auto-center-summary t
|
|
277 "*If non-nil, always center the current summary buffer.
|
|
278 In particular, if `vertical' do only vertical recentering. If non-nil
|
|
279 and non-`vertical', do both horizontal and vertical recentering."
|
|
280 :group 'gnus-summary-maneuvering
|
|
281 :type '(choice (const :tag "none" nil)
|
|
282 (const vertical)
|
|
283 (sexp :menu-tag "both" t)))
|
|
284
|
|
285 (defcustom gnus-show-all-headers nil
|
|
286 "*If non-nil, don't hide any headers."
|
|
287 :group 'gnus-article-hiding
|
|
288 :group 'gnus-article-headers
|
|
289 :type 'boolean)
|
|
290
|
38
|
291 (defcustom gnus-summary-ignore-duplicates nil
|
|
292 "*If non-nil, ignore articles with identical Message-ID headers."
|
|
293 :group 'gnus-summary
|
|
294 :type 'boolean)
|
|
295
|
16
|
296 (defcustom gnus-single-article-buffer t
|
|
297 "*If non-nil, display all articles in the same buffer.
|
|
298 If nil, each group will get its own article buffer."
|
|
299 :group 'gnus-article-various
|
|
300 :type 'boolean)
|
|
301
|
|
302 (defcustom gnus-break-pages t
|
|
303 "*If non-nil, do page breaking on articles.
|
|
304 The page delimiter is specified by the `gnus-page-delimiter'
|
|
305 variable."
|
|
306 :group 'gnus-article-various
|
|
307 :type 'boolean)
|
|
308
|
|
309 (defcustom gnus-show-mime nil
|
|
310 "*If non-nil, do mime processing of articles.
|
|
311 The articles will simply be fed to the function given by
|
|
312 `gnus-show-mime-method'."
|
|
313 :group 'gnus-article-mime
|
|
314 :type 'boolean)
|
|
315
|
|
316 (defcustom gnus-move-split-methods nil
|
|
317 "*Variable used to suggest where articles are to be moved to.
|
|
318 It uses the same syntax as the `gnus-split-methods' variable."
|
|
319 :group 'gnus-summary-mail
|
|
320 :type '(repeat (choice (list function)
|
|
321 (cons regexp (repeat string))
|
|
322 sexp)))
|
|
323
|
|
324 (defcustom gnus-unread-mark ?
|
|
325 "*Mark used for unread articles."
|
|
326 :group 'gnus-summary-marks
|
|
327 :type 'character)
|
|
328
|
|
329 (defcustom gnus-ticked-mark ?!
|
|
330 "*Mark used for ticked articles."
|
|
331 :group 'gnus-summary-marks
|
|
332 :type 'character)
|
|
333
|
|
334 (defcustom gnus-dormant-mark ??
|
|
335 "*Mark used for dormant articles."
|
|
336 :group 'gnus-summary-marks
|
|
337 :type 'character)
|
|
338
|
|
339 (defcustom gnus-del-mark ?r
|
|
340 "*Mark used for del'd articles."
|
|
341 :group 'gnus-summary-marks
|
|
342 :type 'character)
|
|
343
|
|
344 (defcustom gnus-read-mark ?R
|
|
345 "*Mark used for read articles."
|
|
346 :group 'gnus-summary-marks
|
|
347 :type 'character)
|
|
348
|
|
349 (defcustom gnus-expirable-mark ?E
|
|
350 "*Mark used for expirable articles."
|
|
351 :group 'gnus-summary-marks
|
|
352 :type 'character)
|
|
353
|
|
354 (defcustom gnus-killed-mark ?K
|
|
355 "*Mark used for killed articles."
|
|
356 :group 'gnus-summary-marks
|
|
357 :type 'character)
|
|
358
|
|
359 (defcustom gnus-souped-mark ?F
|
|
360 "*Mark used for killed articles."
|
|
361 :group 'gnus-summary-marks
|
|
362 :type 'character)
|
|
363
|
|
364 (defcustom gnus-kill-file-mark ?X
|
|
365 "*Mark used for articles killed by kill files."
|
|
366 :group 'gnus-summary-marks
|
|
367 :type 'character)
|
|
368
|
|
369 (defcustom gnus-low-score-mark ?Y
|
|
370 "*Mark used for articles with a low score."
|
|
371 :group 'gnus-summary-marks
|
|
372 :type 'character)
|
|
373
|
|
374 (defcustom gnus-catchup-mark ?C
|
|
375 "*Mark used for articles that are caught up."
|
|
376 :group 'gnus-summary-marks
|
|
377 :type 'character)
|
|
378
|
|
379 (defcustom gnus-replied-mark ?A
|
|
380 "*Mark used for articles that have been replied to."
|
|
381 :group 'gnus-summary-marks
|
|
382 :type 'character)
|
|
383
|
|
384 (defcustom gnus-cached-mark ?*
|
|
385 "*Mark used for articles that are in the cache."
|
|
386 :group 'gnus-summary-marks
|
|
387 :type 'character)
|
|
388
|
|
389 (defcustom gnus-saved-mark ?S
|
|
390 "*Mark used for articles that have been saved to."
|
|
391 :group 'gnus-summary-marks
|
|
392 :type 'character)
|
|
393
|
|
394 (defcustom gnus-ancient-mark ?O
|
|
395 "*Mark used for ancient articles."
|
|
396 :group 'gnus-summary-marks
|
|
397 :type 'character)
|
|
398
|
|
399 (defcustom gnus-sparse-mark ?Q
|
|
400 "*Mark used for sparsely reffed articles."
|
|
401 :group 'gnus-summary-marks
|
|
402 :type 'character)
|
|
403
|
|
404 (defcustom gnus-canceled-mark ?G
|
|
405 "*Mark used for canceled articles."
|
|
406 :group 'gnus-summary-marks
|
|
407 :type 'character)
|
|
408
|
|
409 (defcustom gnus-duplicate-mark ?M
|
|
410 "*Mark used for duplicate articles."
|
|
411 :group 'gnus-summary-marks
|
|
412 :type 'character)
|
|
413
|
|
414 (defcustom gnus-score-over-mark ?+
|
|
415 "*Score mark used for articles with high scores."
|
|
416 :group 'gnus-summary-marks
|
|
417 :type 'character)
|
|
418
|
|
419 (defcustom gnus-score-below-mark ?-
|
|
420 "*Score mark used for articles with low scores."
|
|
421 :group 'gnus-summary-marks
|
|
422 :type 'character)
|
|
423
|
|
424 (defcustom gnus-empty-thread-mark ?
|
|
425 "*There is no thread under the article."
|
|
426 :group 'gnus-summary-marks
|
|
427 :type 'character)
|
|
428
|
|
429 (defcustom gnus-not-empty-thread-mark ?=
|
|
430 "*There is a thread under the article."
|
|
431 :group 'gnus-summary-marks
|
|
432 :type 'character)
|
|
433
|
|
434 (defcustom gnus-view-pseudo-asynchronously nil
|
|
435 "*If non-nil, Gnus will view pseudo-articles asynchronously."
|
|
436 :group 'gnus-extract-view
|
|
437 :type 'boolean)
|
|
438
|
|
439 (defcustom gnus-view-pseudos nil
|
|
440 "*If `automatic', pseudo-articles will be viewed automatically.
|
|
441 If `not-confirm', pseudos will be viewed automatically, and the user
|
|
442 will not be asked to confirm the command."
|
|
443 :group 'gnus-extract-view
|
|
444 :type '(choice (const :tag "off" nil)
|
|
445 (const automatic)
|
|
446 (const not-confirm)))
|
|
447
|
|
448 (defcustom gnus-view-pseudos-separately t
|
|
449 "*If non-nil, one pseudo-article will be created for each file to be viewed.
|
|
450 If nil, all files that use the same viewing command will be given as a
|
|
451 list of parameters to that command."
|
|
452 :group 'gnus-extract-view
|
|
453 :type 'boolean)
|
|
454
|
|
455 (defcustom gnus-insert-pseudo-articles t
|
|
456 "*If non-nil, insert pseudo-articles when decoding articles."
|
|
457 :group 'gnus-extract-view
|
|
458 :type 'boolean)
|
|
459
|
|
460 (defcustom gnus-summary-dummy-line-format
|
|
461 "* %(: :%) %S\n"
|
|
462 "*The format specification for the dummy roots in the summary buffer.
|
|
463 It works along the same lines as a normal formatting string,
|
|
464 with some simple extensions.
|
|
465
|
|
466 %S The subject"
|
|
467 :group 'gnus-threading
|
|
468 :type 'string)
|
|
469
|
|
470 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
|
|
471 "*The format specification for the summary mode line.
|
|
472 It works along the same lines as a normal formatting string,
|
|
473 with some simple extensions:
|
|
474
|
|
475 %G Group name
|
|
476 %p Unprefixed group name
|
|
477 %A Current article number
|
|
478 %V Gnus version
|
|
479 %U Number of unread articles in the group
|
|
480 %e Number of unselected articles in the group
|
|
481 %Z A string with unread/unselected article counts
|
|
482 %g Shortish group name
|
|
483 %S Subject of the current article
|
|
484 %u User-defined spec
|
|
485 %s Current score file name
|
|
486 %d Number of dormant articles
|
|
487 %r Number of articles that have been marked as read in this session
|
|
488 %E Number of articles expunged by the score files"
|
|
489 :group 'gnus-summary-format
|
|
490 :type 'string)
|
|
491
|
|
492 (defcustom gnus-summary-mark-below 0
|
|
493 "*Mark all articles with a score below this variable as read.
|
|
494 This variable is local to each summary buffer and usually set by the
|
|
495 score file."
|
24
|
496 :group 'gnus-score-default
|
16
|
497 :type 'integer)
|
|
498
|
|
499 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
|
|
500 "*List of functions used for sorting articles in the summary buffer.
|
|
501 This variable is only used when not using a threaded display."
|
|
502 :group 'gnus-summary-sort
|
|
503 :type '(repeat (choice (function-item gnus-article-sort-by-number)
|
|
504 (function-item gnus-article-sort-by-author)
|
|
505 (function-item gnus-article-sort-by-subject)
|
|
506 (function-item gnus-article-sort-by-date)
|
|
507 (function-item gnus-article-sort-by-score)
|
|
508 (function :tag "other"))))
|
|
509
|
|
510 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
|
|
511 "*List of functions used for sorting threads in the summary buffer.
|
|
512 By default, threads are sorted by article number.
|
|
513
|
|
514 Each function takes two threads and return non-nil if the first thread
|
|
515 should be sorted before the other. If you use more than one function,
|
|
516 the primary sort function should be the last. You should probably
|
|
517 always include `gnus-thread-sort-by-number' in the list of sorting
|
|
518 functions -- preferably first.
|
|
519
|
|
520 Ready-made functions include `gnus-thread-sort-by-number',
|
|
521 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
|
|
522 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
|
|
523 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
|
|
524 :group 'gnus-summary-sort
|
|
525 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
|
|
526 (function-item gnus-thread-sort-by-author)
|
|
527 (function-item gnus-thread-sort-by-subject)
|
|
528 (function-item gnus-thread-sort-by-date)
|
|
529 (function-item gnus-thread-sort-by-score)
|
|
530 (function-item gnus-thread-sort-by-total-score)
|
|
531 (function :tag "other"))))
|
|
532
|
|
533 (defcustom gnus-thread-score-function '+
|
|
534 "*Function used for calculating the total score of a thread.
|
|
535
|
|
536 The function is called with the scores of the article and each
|
|
537 subthread and should then return the score of the thread.
|
|
538
|
|
539 Some functions you can use are `+', `max', or `min'."
|
|
540 :group 'gnus-summary-sort
|
|
541 :type 'function)
|
|
542
|
|
543 (defcustom gnus-summary-expunge-below nil
|
|
544 "All articles that have a score less than this variable will be expunged."
|
24
|
545 :group 'gnus-score-default
|
16
|
546 :type '(choice (const :tag "off" nil)
|
|
547 integer))
|
|
548
|
|
549 (defcustom gnus-thread-expunge-below nil
|
|
550 "All threads that have a total score less than this variable will be expunged.
|
|
551 See `gnus-thread-score-function' for en explanation of what a
|
|
552 \"thread score\" is."
|
|
553 :group 'gnus-treading
|
24
|
554 :group 'gnus-score-default
|
16
|
555 :type '(choice (const :tag "off" nil)
|
|
556 integer))
|
|
557
|
|
558 (defcustom gnus-summary-mode-hook nil
|
|
559 "*A hook for Gnus summary mode.
|
|
560 This hook is run before any variables are set in the summary buffer."
|
|
561 :group 'gnus-summary-various
|
|
562 :type 'hook)
|
|
563
|
|
564 (defcustom gnus-summary-menu-hook nil
|
|
565 "*Hook run after the creation of the summary mode menu."
|
|
566 :group 'gnus-summary-visual
|
|
567 :type 'hook)
|
|
568
|
|
569 (defcustom gnus-summary-exit-hook nil
|
|
570 "*A hook called on exit from the summary buffer.
|
|
571 It will be called with point in the group buffer."
|
|
572 :group 'gnus-summary-exit
|
|
573 :type 'hook)
|
|
574
|
|
575 (defcustom gnus-summary-prepare-hook nil
|
|
576 "*A hook called after the summary buffer has been generated.
|
|
577 If you want to modify the summary buffer, you can use this hook."
|
|
578 :group 'gnus-summary-various
|
|
579 :type 'hook)
|
|
580
|
|
581 (defcustom gnus-summary-generate-hook nil
|
|
582 "*A hook run just before generating the summary buffer.
|
|
583 This hook is commonly used to customize threading variables and the
|
|
584 like."
|
|
585 :group 'gnus-summary-various
|
|
586 :type 'hook)
|
|
587
|
|
588 (defcustom gnus-select-group-hook nil
|
|
589 "*A hook called when a newsgroup is selected.
|
|
590
|
|
591 If you'd like to simplify subjects like the
|
|
592 `gnus-summary-next-same-subject' command does, you can use the
|
|
593 following hook:
|
|
594
|
|
595 (setq gnus-select-group-hook
|
|
596 (list
|
|
597 (lambda ()
|
|
598 (mapcar (lambda (header)
|
|
599 (mail-header-set-subject
|
|
600 header
|
|
601 (gnus-simplify-subject
|
|
602 (mail-header-subject header) 're-only)))
|
|
603 gnus-newsgroup-headers))))"
|
|
604 :group 'gnus-group-select
|
|
605 :type 'hook)
|
|
606
|
|
607 (defcustom gnus-select-article-hook nil
|
|
608 "*A hook called when an article is selected."
|
|
609 :group 'gnus-summary-choose
|
|
610 :type 'hook)
|
|
611
|
|
612 (defcustom gnus-visual-mark-article-hook
|
|
613 (list 'gnus-highlight-selected-summary)
|
|
614 "*Hook run after selecting an article in the summary buffer.
|
|
615 It is meant to be used for highlighting the article in some way. It
|
|
616 is not run if `gnus-visual' is nil."
|
|
617 :group 'gnus-summary-visual
|
|
618 :type 'hook)
|
|
619
|
30
|
620 (defcustom gnus-parse-headers-hook
|
16
|
621 (list 'gnus-decode-rfc1522)
|
|
622 "*A hook called before parsing the headers."
|
|
623 :group 'gnus-various
|
|
624 :type 'hook)
|
|
625
|
|
626 (defcustom gnus-exit-group-hook nil
|
|
627 "*A hook called when exiting (not quitting) summary mode."
|
|
628 :group 'gnus-various
|
|
629 :type 'hook)
|
|
630
|
|
631 (defcustom gnus-summary-update-hook
|
|
632 (list 'gnus-summary-highlight-line)
|
|
633 "*A hook called when a summary line is changed.
|
|
634 The hook will not be called if `gnus-visual' is nil.
|
|
635
|
|
636 The default function `gnus-summary-highlight-line' will
|
|
637 highlight the line according to the `gnus-summary-highlight'
|
|
638 variable."
|
|
639 :group 'gnus-summary-visual
|
|
640 :type 'hook)
|
|
641
|
|
642 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
|
|
643 "*A hook called when an article is selected for the first time.
|
|
644 The hook is intended to mark an article as read (or unread)
|
|
645 automatically when it is selected."
|
|
646 :group 'gnus-summary-choose
|
|
647 :type 'hook)
|
|
648
|
|
649 (defcustom gnus-group-no-more-groups-hook nil
|
|
650 "*A hook run when returning to group mode having no more (unread) groups."
|
|
651 :group 'gnus-group-select
|
|
652 :type 'hook)
|
|
653
|
22
|
654 (defcustom gnus-ps-print-hook nil
|
|
655 "*A hook run before ps-printing something from Gnus."
|
|
656 :group 'gnus-summary
|
|
657 :type 'hook)
|
|
658
|
16
|
659 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
|
|
660 "Face used for highlighting the current article in the summary buffer."
|
|
661 :group 'gnus-summary-visual
|
|
662 :type 'face)
|
|
663
|
30
|
664 (defcustom gnus-summary-highlight
|
16
|
665 '(((= mark gnus-canceled-mark)
|
|
666 . gnus-summary-cancelled-face)
|
|
667 ((and (> score default)
|
|
668 (or (= mark gnus-dormant-mark)
|
|
669 (= mark gnus-ticked-mark)))
|
|
670 . gnus-summary-high-ticked-face)
|
|
671 ((and (< score default)
|
|
672 (or (= mark gnus-dormant-mark)
|
|
673 (= mark gnus-ticked-mark)))
|
|
674 . gnus-summary-low-ticked-face)
|
|
675 ((or (= mark gnus-dormant-mark)
|
|
676 (= mark gnus-ticked-mark))
|
|
677 . gnus-summary-normal-ticked-face)
|
|
678 ((and (> score default) (= mark gnus-ancient-mark))
|
|
679 . gnus-summary-high-ancient-face)
|
|
680 ((and (< score default) (= mark gnus-ancient-mark))
|
|
681 . gnus-summary-low-ancient-face)
|
|
682 ((= mark gnus-ancient-mark)
|
|
683 . gnus-summary-normal-ancient-face)
|
|
684 ((and (> score default) (= mark gnus-unread-mark))
|
|
685 . gnus-summary-high-unread-face)
|
|
686 ((and (< score default) (= mark gnus-unread-mark))
|
|
687 . gnus-summary-low-unread-face)
|
|
688 ((and (= mark gnus-unread-mark))
|
|
689 . gnus-summary-normal-unread-face)
|
30
|
690 ((> score default)
|
16
|
691 . gnus-summary-high-read-face)
|
30
|
692 ((< score default)
|
16
|
693 . gnus-summary-low-read-face)
|
30
|
694 (t
|
16
|
695 . gnus-summary-normal-read-face))
|
30
|
696 "Controls the highlighting of summary buffer lines.
|
16
|
697
|
|
698 A list of (FORM . FACE) pairs. When deciding how a a particular
|
|
699 summary line should be displayed, each form is evaluated. The content
|
|
700 of the face field after the first true form is used. You can change
|
|
701 how those summary lines are displayed, by editing the face field.
|
|
702
|
|
703 You can use the following variables in the FORM field.
|
|
704
|
|
705 score: The articles score
|
|
706 default: The default article score.
|
30
|
707 below: The score below which articles are automatically marked as read.
|
16
|
708 mark: The articles mark."
|
|
709 :group 'gnus-summary-visual
|
|
710 :type '(repeat (cons (sexp :tag "Form" nil)
|
|
711 face)))
|
|
712
|
22
|
713
|
16
|
714 ;;; Internal variables
|
|
715
|
|
716 (defvar gnus-scores-exclude-files nil)
|
|
717
|
30
|
718 (defvar gnus-summary-display-table
|
16
|
719 ;; Change the display table. Odd characters have a tendency to mess
|
|
720 ;; up nicely formatted displays - we make all possible glyphs
|
|
721 ;; display only a single character.
|
|
722
|
|
723 ;; We start from the standard display table, if any.
|
|
724 (let ((table (or (copy-sequence standard-display-table)
|
|
725 (make-display-table)))
|
|
726 ;; Nix out all the control chars...
|
|
727 (i 32))
|
|
728 (while (>= (setq i (1- i)) 0)
|
|
729 (aset table i [??]))
|
|
730 ;; ... but not newline and cr, of course. (cr is necessary for the
|
|
731 ;; selective display).
|
|
732 (aset table ?\n nil)
|
|
733 (aset table ?\r nil)
|
|
734 ;; We nix out any glyphs over 126 that are not set already.
|
|
735 (let ((i 256))
|
|
736 (while (>= (setq i (1- i)) 127)
|
|
737 ;; Only modify if the entry is nil.
|
|
738 (or (aref table i)
|
|
739 (aset table i [??]))))
|
|
740 table)
|
|
741 "Display table used in summary mode buffers.")
|
|
742
|
|
743 (defvar gnus-original-article nil)
|
|
744 (defvar gnus-article-internal-prepare-hook nil)
|
|
745 (defvar gnus-newsgroup-process-stack nil)
|
|
746
|
|
747 (defvar gnus-thread-indent-array nil)
|
|
748 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
749
|
|
750 ;; Avoid highlighting in kill files.
|
|
751 (defvar gnus-summary-inhibit-highlight nil)
|
|
752 (defvar gnus-newsgroup-selected-overlay nil)
|
|
753 (defvar gnus-inhibit-limiting nil)
|
|
754 (defvar gnus-newsgroup-adaptive-score-file nil)
|
|
755 (defvar gnus-current-score-file nil)
|
|
756 (defvar gnus-current-move-group nil)
|
|
757 (defvar gnus-current-copy-group nil)
|
|
758 (defvar gnus-current-crosspost-group nil)
|
|
759
|
|
760 (defvar gnus-newsgroup-dependencies nil)
|
|
761 (defvar gnus-newsgroup-adaptive nil)
|
|
762 (defvar gnus-summary-display-article-function nil)
|
|
763 (defvar gnus-summary-highlight-line-function nil
|
|
764 "Function called after highlighting a summary line.")
|
|
765
|
|
766 (defvar gnus-summary-line-format-alist
|
|
767 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
|
|
768 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
|
|
769 (?s gnus-tmp-subject-or-nil ?s)
|
|
770 (?n gnus-tmp-name ?s)
|
|
771 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
|
|
772 ?s)
|
|
773 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
|
|
774 gnus-tmp-from) ?s)
|
|
775 (?F gnus-tmp-from ?s)
|
|
776 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
|
|
777 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
|
|
778 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
|
|
779 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
|
|
780 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
|
|
781 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
|
|
782 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
|
|
783 (?L gnus-tmp-lines ?d)
|
|
784 (?I gnus-tmp-indentation ?s)
|
|
785 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
|
|
786 (?R gnus-tmp-replied ?c)
|
|
787 (?\[ gnus-tmp-opening-bracket ?c)
|
|
788 (?\] gnus-tmp-closing-bracket ?c)
|
|
789 (?\> (make-string gnus-tmp-level ? ) ?s)
|
|
790 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
|
|
791 (?i gnus-tmp-score ?d)
|
|
792 (?z gnus-tmp-score-char ?c)
|
|
793 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
|
|
794 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
|
|
795 (?U gnus-tmp-unread ?c)
|
|
796 (?t (gnus-summary-number-of-articles-in-thread
|
|
797 (and (boundp 'thread) (car thread)) gnus-tmp-level)
|
|
798 ?d)
|
|
799 (?e (gnus-summary-number-of-articles-in-thread
|
|
800 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
|
|
801 ?c)
|
|
802 (?u gnus-tmp-user-defined ?s)
|
|
803 (?P (gnus-pick-line-number) ?d))
|
|
804 "An alist of format specifications that can appear in summary lines,
|
|
805 and what variables they correspond with, along with the type of the
|
|
806 variable (string, integer, character, etc).")
|
|
807
|
|
808 (defvar gnus-summary-dummy-line-format-alist
|
|
809 `((?S gnus-tmp-subject ?s)
|
|
810 (?N gnus-tmp-number ?d)
|
|
811 (?u gnus-tmp-user-defined ?s)))
|
|
812
|
|
813 (defvar gnus-summary-mode-line-format-alist
|
|
814 `((?G gnus-tmp-group-name ?s)
|
|
815 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
|
|
816 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
|
|
817 (?A gnus-tmp-article-number ?d)
|
|
818 (?Z gnus-tmp-unread-and-unselected ?s)
|
|
819 (?V gnus-version ?s)
|
|
820 (?U gnus-tmp-unread-and-unticked ?d)
|
|
821 (?S gnus-tmp-subject ?s)
|
|
822 (?e gnus-tmp-unselected ?d)
|
|
823 (?u gnus-tmp-user-defined ?s)
|
|
824 (?d (length gnus-newsgroup-dormant) ?d)
|
|
825 (?t (length gnus-newsgroup-marked) ?d)
|
|
826 (?r (length gnus-newsgroup-reads) ?d)
|
|
827 (?E gnus-newsgroup-expunged-tally ?d)
|
|
828 (?s (gnus-current-score-file-nondirectory) ?s)))
|
|
829
|
|
830 (defvar gnus-last-search-regexp nil
|
|
831 "Default regexp for article search command.")
|
|
832
|
|
833 (defvar gnus-last-shell-command nil
|
|
834 "Default shell command on article.")
|
|
835
|
|
836 (defvar gnus-newsgroup-begin nil)
|
|
837 (defvar gnus-newsgroup-end nil)
|
|
838 (defvar gnus-newsgroup-last-rmail nil)
|
|
839 (defvar gnus-newsgroup-last-mail nil)
|
|
840 (defvar gnus-newsgroup-last-folder nil)
|
|
841 (defvar gnus-newsgroup-last-file nil)
|
|
842 (defvar gnus-newsgroup-auto-expire nil)
|
|
843 (defvar gnus-newsgroup-active nil)
|
|
844
|
|
845 (defvar gnus-newsgroup-data nil)
|
|
846 (defvar gnus-newsgroup-data-reverse nil)
|
|
847 (defvar gnus-newsgroup-limit nil)
|
|
848 (defvar gnus-newsgroup-limits nil)
|
|
849
|
|
850 (defvar gnus-newsgroup-unreads nil
|
|
851 "List of unread articles in the current newsgroup.")
|
|
852
|
|
853 (defvar gnus-newsgroup-unselected nil
|
|
854 "List of unselected unread articles in the current newsgroup.")
|
|
855
|
|
856 (defvar gnus-newsgroup-reads nil
|
|
857 "Alist of read articles and article marks in the current newsgroup.")
|
|
858
|
|
859 (defvar gnus-newsgroup-expunged-tally nil)
|
|
860
|
|
861 (defvar gnus-newsgroup-marked nil
|
|
862 "List of ticked articles in the current newsgroup (a subset of unread art).")
|
|
863
|
|
864 (defvar gnus-newsgroup-killed nil
|
|
865 "List of ranges of articles that have been through the scoring process.")
|
|
866
|
|
867 (defvar gnus-newsgroup-cached nil
|
|
868 "List of articles that come from the article cache.")
|
|
869
|
|
870 (defvar gnus-newsgroup-saved nil
|
|
871 "List of articles that have been saved.")
|
|
872
|
|
873 (defvar gnus-newsgroup-kill-headers nil)
|
|
874
|
|
875 (defvar gnus-newsgroup-replied nil
|
|
876 "List of articles that have been replied to in the current newsgroup.")
|
|
877
|
|
878 (defvar gnus-newsgroup-expirable nil
|
|
879 "List of articles in the current newsgroup that can be expired.")
|
|
880
|
|
881 (defvar gnus-newsgroup-processable nil
|
|
882 "List of articles in the current newsgroup that can be processed.")
|
|
883
|
|
884 (defvar gnus-newsgroup-bookmarks nil
|
|
885 "List of articles in the current newsgroup that have bookmarks.")
|
|
886
|
|
887 (defvar gnus-newsgroup-dormant nil
|
|
888 "List of dormant articles in the current newsgroup.")
|
|
889
|
|
890 (defvar gnus-newsgroup-scored nil
|
|
891 "List of scored articles in the current newsgroup.")
|
|
892
|
|
893 (defvar gnus-newsgroup-headers nil
|
|
894 "List of article headers in the current newsgroup.")
|
|
895
|
|
896 (defvar gnus-newsgroup-threads nil)
|
|
897
|
|
898 (defvar gnus-newsgroup-prepared nil
|
|
899 "Whether the current group has been prepared properly.")
|
|
900
|
|
901 (defvar gnus-newsgroup-ancient nil
|
|
902 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
|
|
903
|
|
904 (defvar gnus-newsgroup-sparse nil)
|
|
905
|
|
906 (defvar gnus-current-article nil)
|
|
907 (defvar gnus-article-current nil)
|
|
908 (defvar gnus-current-headers nil)
|
|
909 (defvar gnus-have-all-headers nil)
|
|
910 (defvar gnus-last-article nil)
|
|
911 (defvar gnus-newsgroup-history nil)
|
|
912
|
|
913 (defconst gnus-summary-local-variables
|
|
914 '(gnus-newsgroup-name
|
|
915 gnus-newsgroup-begin gnus-newsgroup-end
|
|
916 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
|
|
917 gnus-newsgroup-last-folder gnus-newsgroup-last-file
|
|
918 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
|
|
919 gnus-newsgroup-unselected gnus-newsgroup-marked
|
|
920 gnus-newsgroup-reads gnus-newsgroup-saved
|
|
921 gnus-newsgroup-replied gnus-newsgroup-expirable
|
|
922 gnus-newsgroup-processable gnus-newsgroup-killed
|
|
923 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
|
|
924 gnus-newsgroup-headers gnus-newsgroup-threads
|
|
925 gnus-newsgroup-prepared gnus-summary-highlight-line-function
|
|
926 gnus-current-article gnus-current-headers gnus-have-all-headers
|
|
927 gnus-last-article gnus-article-internal-prepare-hook
|
|
928 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
|
|
929 gnus-newsgroup-scored gnus-newsgroup-kill-headers
|
|
930 gnus-thread-expunge-below
|
|
931 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
|
|
932 (gnus-summary-mark-below . global)
|
|
933 gnus-newsgroup-active gnus-scores-exclude-files
|
|
934 gnus-newsgroup-history gnus-newsgroup-ancient
|
|
935 gnus-newsgroup-sparse gnus-newsgroup-process-stack
|
|
936 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
|
|
937 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
|
|
938 (gnus-newsgroup-expunged-tally . 0)
|
|
939 gnus-cache-removable-articles gnus-newsgroup-cached
|
|
940 gnus-newsgroup-data gnus-newsgroup-data-reverse
|
|
941 gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
942 "Variables that are buffer-local to the summary buffers.")
|
|
943
|
|
944 ;; Byte-compiler warning.
|
|
945 (defvar gnus-article-mode-map)
|
|
946
|
|
947 ;; Subject simplification.
|
|
948
|
|
949 (defsubst gnus-simplify-subject-re (subject)
|
|
950 "Remove \"Re:\" from subject lines."
|
|
951 (if (string-match "^[Rr][Ee]: *" subject)
|
|
952 (substring subject (match-end 0))
|
|
953 subject))
|
|
954
|
|
955 (defun gnus-simplify-subject (subject &optional re-only)
|
|
956 "Remove `Re:' and words in parentheses.
|
|
957 If RE-ONLY is non-nil, strip leading `Re:'s only."
|
|
958 (let ((case-fold-search t)) ;Ignore case.
|
|
959 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
|
|
960 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
|
|
961 (setq subject (substring subject (match-end 0))))
|
|
962 ;; Remove uninteresting prefixes.
|
|
963 (when (and (not re-only)
|
|
964 gnus-simplify-ignored-prefixes
|
|
965 (string-match gnus-simplify-ignored-prefixes subject))
|
|
966 (setq subject (substring subject (match-end 0))))
|
|
967 ;; Remove words in parentheses from end.
|
|
968 (unless re-only
|
|
969 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
|
|
970 (setq subject (substring subject 0 (match-beginning 0)))))
|
|
971 ;; Return subject string.
|
|
972 subject))
|
|
973
|
|
974 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
|
|
975 ;; all whitespace.
|
|
976 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
|
|
977 (goto-char (point-min))
|
|
978 (while (re-search-forward regexp nil t)
|
|
979 (replace-match (or newtext ""))))
|
|
980
|
|
981 (defun gnus-simplify-buffer-fuzzy ()
|
|
982 "Simplify string in the buffer fuzzily.
|
|
983 The string in the accessible portion of the current buffer is simplified.
|
|
984 It is assumed to be a single-line subject.
|
|
985 Whitespace is generally cleaned up, and miscellaneous leading/trailing
|
|
986 matter is removed. Additional things can be deleted by setting
|
|
987 gnus-simplify-subject-fuzzy-regexp."
|
|
988 (let ((case-fold-search t)
|
|
989 (modified-tick))
|
|
990 (gnus-simplify-buffer-fuzzy-step "\t" " ")
|
|
991
|
|
992 (while (not (eq modified-tick (buffer-modified-tick)))
|
|
993 (setq modified-tick (buffer-modified-tick))
|
|
994 (cond
|
|
995 ((listp gnus-simplify-subject-fuzzy-regexp)
|
|
996 (mapcar 'gnus-simplify-buffer-fuzzy-step
|
|
997 gnus-simplify-subject-fuzzy-regexp))
|
|
998 (gnus-simplify-subject-fuzzy-regexp
|
|
999 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
|
|
1000 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
|
|
1001 (gnus-simplify-buffer-fuzzy-step
|
|
1002 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
|
|
1003 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
|
|
1004
|
|
1005 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
|
|
1006 (gnus-simplify-buffer-fuzzy-step " +" " ")
|
|
1007 (gnus-simplify-buffer-fuzzy-step " $")
|
|
1008 (gnus-simplify-buffer-fuzzy-step "^ +")))
|
|
1009
|
|
1010 (defun gnus-simplify-subject-fuzzy (subject)
|
|
1011 "Simplify a subject string fuzzily.
|
|
1012 See gnus-simplify-buffer-fuzzy for details."
|
|
1013 (save-excursion
|
|
1014 (gnus-set-work-buffer)
|
|
1015 (let ((case-fold-search t))
|
|
1016 (insert subject)
|
|
1017 (inline (gnus-simplify-buffer-fuzzy))
|
|
1018 (buffer-string))))
|
|
1019
|
|
1020 (defsubst gnus-simplify-subject-fully (subject)
|
|
1021 "Simplify a subject string according to gnus-summary-gather-subject-limit."
|
|
1022 (cond
|
|
1023 ((null gnus-summary-gather-subject-limit)
|
|
1024 (gnus-simplify-subject-re subject))
|
|
1025 ((eq gnus-summary-gather-subject-limit 'fuzzy)
|
|
1026 (gnus-simplify-subject-fuzzy subject))
|
|
1027 ((numberp gnus-summary-gather-subject-limit)
|
|
1028 (gnus-limit-string (gnus-simplify-subject-re subject)
|
|
1029 gnus-summary-gather-subject-limit))
|
|
1030 (t
|
|
1031 subject)))
|
|
1032
|
|
1033 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
|
|
1034 "Check whether two subjects are equal. If optional argument
|
|
1035 simple-first is t, first argument is already simplified."
|
|
1036 (cond
|
|
1037 ((null simple-first)
|
|
1038 (equal (gnus-simplify-subject-fully s1)
|
|
1039 (gnus-simplify-subject-fully s2)))
|
|
1040 (t
|
|
1041 (equal s1
|
|
1042 (gnus-simplify-subject-fully s2)))))
|
|
1043
|
|
1044 (defun gnus-summary-bubble-group ()
|
|
1045 "Increase the score of the current group.
|
|
1046 This is a handy function to add to `gnus-summary-exit-hook' to
|
|
1047 increase the score of each group you read."
|
|
1048 (gnus-group-add-score gnus-newsgroup-name))
|
|
1049
|
|
1050
|
|
1051 ;;;
|
|
1052 ;;; Gnus summary mode
|
|
1053 ;;;
|
|
1054
|
|
1055 (put 'gnus-summary-mode 'mode-class 'special)
|
|
1056
|
|
1057 (when t
|
|
1058 ;; Non-orthogonal keys
|
|
1059
|
|
1060 (gnus-define-keys gnus-summary-mode-map
|
|
1061 " " gnus-summary-next-page
|
|
1062 "\177" gnus-summary-prev-page
|
|
1063 [delete] gnus-summary-prev-page
|
|
1064 "\r" gnus-summary-scroll-up
|
|
1065 "n" gnus-summary-next-unread-article
|
|
1066 "p" gnus-summary-prev-unread-article
|
|
1067 "N" gnus-summary-next-article
|
|
1068 "P" gnus-summary-prev-article
|
|
1069 "\M-\C-n" gnus-summary-next-same-subject
|
|
1070 "\M-\C-p" gnus-summary-prev-same-subject
|
|
1071 "\M-n" gnus-summary-next-unread-subject
|
|
1072 "\M-p" gnus-summary-prev-unread-subject
|
|
1073 "." gnus-summary-first-unread-article
|
|
1074 "," gnus-summary-best-unread-article
|
|
1075 "\M-s" gnus-summary-search-article-forward
|
|
1076 "\M-r" gnus-summary-search-article-backward
|
|
1077 "<" gnus-summary-beginning-of-article
|
|
1078 ">" gnus-summary-end-of-article
|
|
1079 "j" gnus-summary-goto-article
|
|
1080 "^" gnus-summary-refer-parent-article
|
|
1081 "\M-^" gnus-summary-refer-article
|
|
1082 "u" gnus-summary-tick-article-forward
|
|
1083 "!" gnus-summary-tick-article-forward
|
|
1084 "U" gnus-summary-tick-article-backward
|
|
1085 "d" gnus-summary-mark-as-read-forward
|
|
1086 "D" gnus-summary-mark-as-read-backward
|
|
1087 "E" gnus-summary-mark-as-expirable
|
|
1088 "\M-u" gnus-summary-clear-mark-forward
|
|
1089 "\M-U" gnus-summary-clear-mark-backward
|
|
1090 "k" gnus-summary-kill-same-subject-and-select
|
|
1091 "\C-k" gnus-summary-kill-same-subject
|
|
1092 "\M-\C-k" gnus-summary-kill-thread
|
|
1093 "\M-\C-l" gnus-summary-lower-thread
|
|
1094 "e" gnus-summary-edit-article
|
|
1095 "#" gnus-summary-mark-as-processable
|
|
1096 "\M-#" gnus-summary-unmark-as-processable
|
|
1097 "\M-\C-t" gnus-summary-toggle-threads
|
|
1098 "\M-\C-s" gnus-summary-show-thread
|
|
1099 "\M-\C-h" gnus-summary-hide-thread
|
|
1100 "\M-\C-f" gnus-summary-next-thread
|
|
1101 "\M-\C-b" gnus-summary-prev-thread
|
|
1102 "\M-\C-u" gnus-summary-up-thread
|
|
1103 "\M-\C-d" gnus-summary-down-thread
|
|
1104 "&" gnus-summary-execute-command
|
|
1105 "c" gnus-summary-catchup-and-exit
|
|
1106 "\C-w" gnus-summary-mark-region-as-read
|
|
1107 "\C-t" gnus-summary-toggle-truncation
|
|
1108 "?" gnus-summary-mark-as-dormant
|
|
1109 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
|
|
1110 "\C-c\C-s\C-n" gnus-summary-sort-by-number
|
|
1111 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
|
|
1112 "\C-c\C-s\C-a" gnus-summary-sort-by-author
|
|
1113 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
|
|
1114 "\C-c\C-s\C-d" gnus-summary-sort-by-date
|
|
1115 "\C-c\C-s\C-i" gnus-summary-sort-by-score
|
|
1116 "=" gnus-summary-expand-window
|
|
1117 "\C-x\C-s" gnus-summary-reselect-current-group
|
|
1118 "\M-g" gnus-summary-rescan-group
|
|
1119 "w" gnus-summary-stop-page-breaking
|
|
1120 "\C-c\C-r" gnus-summary-caesar-message
|
|
1121 "\M-t" gnus-summary-toggle-mime
|
|
1122 "f" gnus-summary-followup
|
|
1123 "F" gnus-summary-followup-with-original
|
|
1124 "C" gnus-summary-cancel-article
|
|
1125 "r" gnus-summary-reply
|
|
1126 "R" gnus-summary-reply-with-original
|
|
1127 "\C-c\C-f" gnus-summary-mail-forward
|
|
1128 "o" gnus-summary-save-article
|
|
1129 "\C-o" gnus-summary-save-article-mail
|
|
1130 "|" gnus-summary-pipe-output
|
|
1131 "\M-k" gnus-summary-edit-local-kill
|
|
1132 "\M-K" gnus-summary-edit-global-kill
|
|
1133 ;; "V" gnus-version
|
|
1134 "\C-c\C-d" gnus-summary-describe-group
|
|
1135 "q" gnus-summary-exit
|
|
1136 "Q" gnus-summary-exit-no-update
|
|
1137 "\C-c\C-i" gnus-info-find-node
|
|
1138 gnus-mouse-2 gnus-mouse-pick-article
|
|
1139 "m" gnus-summary-mail-other-window
|
|
1140 "a" gnus-summary-post-news
|
|
1141 "x" gnus-summary-limit-to-unread
|
|
1142 "s" gnus-summary-isearch-article
|
|
1143 "t" gnus-article-hide-headers
|
|
1144 "g" gnus-summary-show-article
|
|
1145 "l" gnus-summary-goto-last-article
|
|
1146 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
|
|
1147 "\C-d" gnus-summary-enter-digest-group
|
|
1148 "\M-\C-d" gnus-summary-read-document
|
|
1149 "\C-c\C-b" gnus-bug
|
|
1150 "*" gnus-cache-enter-article
|
|
1151 "\M-*" gnus-cache-remove-article
|
|
1152 "\M-&" gnus-summary-universal-argument
|
|
1153 "\C-l" gnus-recenter
|
|
1154 "I" gnus-summary-increase-score
|
|
1155 "L" gnus-summary-lower-score
|
|
1156
|
|
1157 "V" gnus-summary-score-map
|
|
1158 "X" gnus-uu-extract-map
|
|
1159 "S" gnus-summary-send-map)
|
|
1160
|
|
1161 ;; Sort of orthogonal keymap
|
|
1162 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
|
|
1163 "t" gnus-summary-tick-article-forward
|
|
1164 "!" gnus-summary-tick-article-forward
|
|
1165 "d" gnus-summary-mark-as-read-forward
|
|
1166 "r" gnus-summary-mark-as-read-forward
|
|
1167 "c" gnus-summary-clear-mark-forward
|
|
1168 " " gnus-summary-clear-mark-forward
|
|
1169 "e" gnus-summary-mark-as-expirable
|
|
1170 "x" gnus-summary-mark-as-expirable
|
|
1171 "?" gnus-summary-mark-as-dormant
|
|
1172 "b" gnus-summary-set-bookmark
|
|
1173 "B" gnus-summary-remove-bookmark
|
|
1174 "#" gnus-summary-mark-as-processable
|
|
1175 "\M-#" gnus-summary-unmark-as-processable
|
|
1176 "S" gnus-summary-limit-include-expunged
|
|
1177 "C" gnus-summary-catchup
|
|
1178 "H" gnus-summary-catchup-to-here
|
|
1179 "\C-c" gnus-summary-catchup-all
|
|
1180 "k" gnus-summary-kill-same-subject-and-select
|
|
1181 "K" gnus-summary-kill-same-subject
|
|
1182 "P" gnus-uu-mark-map)
|
|
1183
|
|
1184 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
|
|
1185 "c" gnus-summary-clear-above
|
|
1186 "u" gnus-summary-tick-above
|
|
1187 "m" gnus-summary-mark-above
|
|
1188 "k" gnus-summary-kill-below)
|
|
1189
|
|
1190 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
|
|
1191 "/" gnus-summary-limit-to-subject
|
|
1192 "n" gnus-summary-limit-to-articles
|
|
1193 "w" gnus-summary-pop-limit
|
|
1194 "s" gnus-summary-limit-to-subject
|
|
1195 "a" gnus-summary-limit-to-author
|
|
1196 "u" gnus-summary-limit-to-unread
|
|
1197 "m" gnus-summary-limit-to-marks
|
|
1198 "v" gnus-summary-limit-to-score
|
|
1199 "D" gnus-summary-limit-include-dormant
|
|
1200 "d" gnus-summary-limit-exclude-dormant
|
|
1201 "t" gnus-summary-limit-to-age
|
|
1202 "E" gnus-summary-limit-include-expunged
|
|
1203 "c" gnus-summary-limit-exclude-childless-dormant
|
|
1204 "C" gnus-summary-limit-mark-excluded-as-read)
|
|
1205
|
|
1206 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
|
|
1207 "n" gnus-summary-next-unread-article
|
|
1208 "p" gnus-summary-prev-unread-article
|
|
1209 "N" gnus-summary-next-article
|
|
1210 "P" gnus-summary-prev-article
|
|
1211 "\C-n" gnus-summary-next-same-subject
|
|
1212 "\C-p" gnus-summary-prev-same-subject
|
|
1213 "\M-n" gnus-summary-next-unread-subject
|
|
1214 "\M-p" gnus-summary-prev-unread-subject
|
|
1215 "f" gnus-summary-first-unread-article
|
|
1216 "b" gnus-summary-best-unread-article
|
|
1217 "j" gnus-summary-goto-article
|
|
1218 "g" gnus-summary-goto-subject
|
|
1219 "l" gnus-summary-goto-last-article
|
|
1220 "p" gnus-summary-pop-article)
|
|
1221
|
|
1222 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
|
|
1223 "k" gnus-summary-kill-thread
|
|
1224 "l" gnus-summary-lower-thread
|
|
1225 "i" gnus-summary-raise-thread
|
|
1226 "T" gnus-summary-toggle-threads
|
|
1227 "t" gnus-summary-rethread-current
|
|
1228 "^" gnus-summary-reparent-thread
|
|
1229 "s" gnus-summary-show-thread
|
|
1230 "S" gnus-summary-show-all-threads
|
|
1231 "h" gnus-summary-hide-thread
|
|
1232 "H" gnus-summary-hide-all-threads
|
|
1233 "n" gnus-summary-next-thread
|
|
1234 "p" gnus-summary-prev-thread
|
|
1235 "u" gnus-summary-up-thread
|
|
1236 "o" gnus-summary-top-thread
|
|
1237 "d" gnus-summary-down-thread
|
|
1238 "#" gnus-uu-mark-thread
|
|
1239 "\M-#" gnus-uu-unmark-thread)
|
|
1240
|
|
1241 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
|
30
|
1242 "g" gnus-summary-prepare
|
16
|
1243 "c" gnus-summary-insert-cached-articles)
|
|
1244
|
|
1245 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
|
|
1246 "c" gnus-summary-catchup-and-exit
|
|
1247 "C" gnus-summary-catchup-all-and-exit
|
|
1248 "E" gnus-summary-exit-no-update
|
|
1249 "Q" gnus-summary-exit
|
|
1250 "Z" gnus-summary-exit
|
|
1251 "n" gnus-summary-catchup-and-goto-next-group
|
|
1252 "R" gnus-summary-reselect-current-group
|
|
1253 "G" gnus-summary-rescan-group
|
|
1254 "N" gnus-summary-next-group
|
|
1255 "s" gnus-summary-save-newsrc
|
|
1256 "P" gnus-summary-prev-group)
|
|
1257
|
|
1258 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
|
|
1259 " " gnus-summary-next-page
|
|
1260 "n" gnus-summary-next-page
|
|
1261 "\177" gnus-summary-prev-page
|
|
1262 [delete] gnus-summary-prev-page
|
|
1263 "p" gnus-summary-prev-page
|
|
1264 "\r" gnus-summary-scroll-up
|
|
1265 "<" gnus-summary-beginning-of-article
|
|
1266 ">" gnus-summary-end-of-article
|
|
1267 "b" gnus-summary-beginning-of-article
|
|
1268 "e" gnus-summary-end-of-article
|
|
1269 "^" gnus-summary-refer-parent-article
|
|
1270 "r" gnus-summary-refer-parent-article
|
|
1271 "R" gnus-summary-refer-references
|
|
1272 "g" gnus-summary-show-article
|
|
1273 "s" gnus-summary-isearch-article
|
|
1274 "P" gnus-summary-print-article)
|
|
1275
|
|
1276 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
|
|
1277 "b" gnus-article-add-buttons
|
|
1278 "B" gnus-article-add-buttons-to-head
|
|
1279 "o" gnus-article-treat-overstrike
|
|
1280 "e" gnus-article-emphasize
|
|
1281 "w" gnus-article-fill-cited-article
|
|
1282 "c" gnus-article-remove-cr
|
|
1283 "q" gnus-article-de-quoted-unreadable
|
|
1284 "f" gnus-article-display-x-face
|
|
1285 "l" gnus-summary-stop-page-breaking
|
|
1286 "r" gnus-summary-caesar-message
|
|
1287 "t" gnus-article-hide-headers
|
|
1288 "v" gnus-summary-verbose-headers
|
28
|
1289 "m" gnus-summary-toggle-mime
|
|
1290 "h" gnus-article-treat-html)
|
16
|
1291
|
|
1292 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
|
|
1293 "a" gnus-article-hide
|
|
1294 "h" gnus-article-hide-headers
|
|
1295 "b" gnus-article-hide-boring-headers
|
|
1296 "s" gnus-article-hide-signature
|
|
1297 "c" gnus-article-hide-citation
|
|
1298 "p" gnus-article-hide-pgp
|
|
1299 "P" gnus-article-hide-pem
|
|
1300 "\C-c" gnus-article-hide-citation-maybe)
|
|
1301
|
|
1302 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
|
|
1303 "a" gnus-article-highlight
|
|
1304 "h" gnus-article-highlight-headers
|
|
1305 "c" gnus-article-highlight-citation
|
|
1306 "s" gnus-article-highlight-signature)
|
|
1307
|
|
1308 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
|
|
1309 "z" gnus-article-date-ut
|
|
1310 "u" gnus-article-date-ut
|
|
1311 "l" gnus-article-date-local
|
|
1312 "e" gnus-article-date-lapsed
|
|
1313 "o" gnus-article-date-original
|
|
1314 "s" gnus-article-date-user)
|
|
1315
|
|
1316 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
|
|
1317 "t" gnus-article-remove-trailing-blank-lines
|
|
1318 "l" gnus-article-strip-leading-blank-lines
|
|
1319 "m" gnus-article-strip-multiple-blank-lines
|
36
|
1320 "a" gnus-article-strip-blank-lines
|
|
1321 "s" gnus-article-strip-leading-space)
|
16
|
1322
|
|
1323 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
|
|
1324 "v" gnus-version
|
|
1325 "f" gnus-summary-fetch-faq
|
|
1326 "d" gnus-summary-describe-group
|
|
1327 "h" gnus-summary-describe-briefly
|
|
1328 "i" gnus-info-find-node)
|
|
1329
|
|
1330 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
|
|
1331 "e" gnus-summary-expire-articles
|
|
1332 "\M-\C-e" gnus-summary-expire-articles-now
|
|
1333 "\177" gnus-summary-delete-article
|
|
1334 [delete] gnus-summary-delete-article
|
|
1335 "m" gnus-summary-move-article
|
|
1336 "r" gnus-summary-respool-article
|
|
1337 "w" gnus-summary-edit-article
|
|
1338 "c" gnus-summary-copy-article
|
|
1339 "B" gnus-summary-crosspost-article
|
|
1340 "q" gnus-summary-respool-query
|
|
1341 "i" gnus-summary-import-article
|
|
1342 "p" gnus-summary-article-posted-p)
|
|
1343
|
|
1344 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
|
|
1345 "o" gnus-summary-save-article
|
|
1346 "m" gnus-summary-save-article-mail
|
|
1347 "F" gnus-summary-write-article-file
|
|
1348 "r" gnus-summary-save-article-rmail
|
|
1349 "f" gnus-summary-save-article-file
|
|
1350 "b" gnus-summary-save-article-body-file
|
|
1351 "h" gnus-summary-save-article-folder
|
|
1352 "v" gnus-summary-save-article-vm
|
|
1353 "p" gnus-summary-pipe-output
|
|
1354 "s" gnus-soup-add-article))
|
|
1355
|
|
1356 (defun gnus-summary-make-menu-bar ()
|
|
1357 (gnus-turn-off-edit-menu 'summary)
|
|
1358
|
|
1359 (unless (boundp 'gnus-summary-misc-menu)
|
|
1360
|
|
1361 (easy-menu-define
|
|
1362 gnus-summary-kill-menu gnus-summary-mode-map ""
|
|
1363 (cons
|
|
1364 "Score"
|
|
1365 (nconc
|
|
1366 (list
|
|
1367 ["Enter score..." gnus-summary-score-entry t]
|
|
1368 ["Customize" gnus-score-customize t])
|
|
1369 (gnus-make-score-map 'increase)
|
|
1370 (gnus-make-score-map 'lower)
|
|
1371 '(("Mark"
|
|
1372 ["Kill below" gnus-summary-kill-below t]
|
|
1373 ["Mark above" gnus-summary-mark-above t]
|
|
1374 ["Tick above" gnus-summary-tick-above t]
|
|
1375 ["Clear above" gnus-summary-clear-above t])
|
|
1376 ["Current score" gnus-summary-current-score t]
|
|
1377 ["Set score" gnus-summary-set-score t]
|
|
1378 ["Switch current score file..." gnus-score-change-score-file t]
|
|
1379 ["Set mark below..." gnus-score-set-mark-below t]
|
|
1380 ["Set expunge below..." gnus-score-set-expunge-below t]
|
|
1381 ["Edit current score file" gnus-score-edit-current-scores t]
|
|
1382 ["Edit score file" gnus-score-edit-file t]
|
|
1383 ["Trace score" gnus-score-find-trace t]
|
|
1384 ["Find words" gnus-score-find-favourite-words t]
|
|
1385 ["Rescore buffer" gnus-summary-rescore t]
|
|
1386 ["Increase score..." gnus-summary-increase-score t]
|
|
1387 ["Lower score..." gnus-summary-lower-score t]))))
|
|
1388
|
|
1389 '(("Default header"
|
|
1390 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
|
30
|
1391 :style radio
|
16
|
1392 :selected (null gnus-score-default-header)]
|
|
1393 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
|
30
|
1394 :style radio
|
16
|
1395 :selected (eq gnus-score-default-header 'a)]
|
|
1396 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
|
30
|
1397 :style radio
|
16
|
1398 :selected (eq gnus-score-default-header 's)]
|
|
1399 ["Article body"
|
|
1400 (gnus-score-set-default 'gnus-score-default-header 'b)
|
30
|
1401 :style radio
|
16
|
1402 :selected (eq gnus-score-default-header 'b )]
|
|
1403 ["All headers"
|
|
1404 (gnus-score-set-default 'gnus-score-default-header 'h)
|
30
|
1405 :style radio
|
16
|
1406 :selected (eq gnus-score-default-header 'h )]
|
|
1407 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
|
30
|
1408 :style radio
|
16
|
1409 :selected (eq gnus-score-default-header 'i )]
|
|
1410 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
|
30
|
1411 :style radio
|
16
|
1412 :selected (eq gnus-score-default-header 't )]
|
|
1413 ["Crossposting"
|
|
1414 (gnus-score-set-default 'gnus-score-default-header 'x)
|
30
|
1415 :style radio
|
16
|
1416 :selected (eq gnus-score-default-header 'x )]
|
|
1417 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
|
30
|
1418 :style radio
|
16
|
1419 :selected (eq gnus-score-default-header 'l )]
|
|
1420 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
|
30
|
1421 :style radio
|
16
|
1422 :selected (eq gnus-score-default-header 'd )]
|
|
1423 ["Followups to author"
|
|
1424 (gnus-score-set-default 'gnus-score-default-header 'f)
|
30
|
1425 :style radio
|
16
|
1426 :selected (eq gnus-score-default-header 'f )])
|
|
1427 ("Default type"
|
|
1428 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
|
30
|
1429 :style radio
|
16
|
1430 :selected (null gnus-score-default-type)]
|
|
1431 ;; The `:active' key is commented out in the following,
|
|
1432 ;; because the GNU Emacs hack to support radio buttons use
|
30
|
1433 ;; active to indicate which button is selected.
|
16
|
1434 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
|
30
|
1435 :style radio
|
16
|
1436 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1437 :selected (eq gnus-score-default-type 's)]
|
|
1438 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
|
|
1439 :style radio
|
|
1440 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1441 :selected (eq gnus-score-default-type 'r)]
|
|
1442 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
|
|
1443 :style radio
|
|
1444 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1445 :selected (eq gnus-score-default-type 'e)]
|
|
1446 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
|
30
|
1447 :style radio
|
16
|
1448 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1449 :selected (eq gnus-score-default-type 'f)]
|
|
1450 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
|
30
|
1451 :style radio
|
16
|
1452 ;; :active (eq (gnus-score-default-header 'd))
|
|
1453 :selected (eq gnus-score-default-type 'b)]
|
|
1454 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
|
30
|
1455 :style radio
|
16
|
1456 ;; :active (eq (gnus-score-default-header 'd))
|
|
1457 :selected (eq gnus-score-default-type 'n)]
|
|
1458 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
|
30
|
1459 :style radio
|
16
|
1460 ;; :active (eq (gnus-score-default-header 'd))
|
|
1461 :selected (eq gnus-score-default-type 'a)]
|
|
1462 ["Less than number"
|
|
1463 (gnus-score-set-default 'gnus-score-default-type '<)
|
30
|
1464 :style radio
|
16
|
1465 ;; :active (eq (gnus-score-default-header 'l))
|
|
1466 :selected (eq gnus-score-default-type '<)]
|
|
1467 ["Equal to number"
|
|
1468 (gnus-score-set-default 'gnus-score-default-type '=)
|
30
|
1469 :style radio
|
16
|
1470 ;; :active (eq (gnus-score-default-header 'l))
|
|
1471 :selected (eq gnus-score-default-type '=)]
|
30
|
1472 ["Greater than number"
|
16
|
1473 (gnus-score-set-default 'gnus-score-default-type '>)
|
30
|
1474 :style radio
|
16
|
1475 ;; :active (eq (gnus-score-default-header 'l))
|
|
1476 :selected (eq gnus-score-default-type '>)])
|
|
1477 ["Default fold" gnus-score-default-fold-toggle
|
|
1478 :style toggle
|
|
1479 :selected gnus-score-default-fold]
|
|
1480 ("Default duration"
|
|
1481 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
|
|
1482 :style radio
|
|
1483 :selected (null gnus-score-default-duration)]
|
|
1484 ["Permanent"
|
|
1485 (gnus-score-set-default 'gnus-score-default-duration 'p)
|
|
1486 :style radio
|
|
1487 :selected (eq gnus-score-default-duration 'p)]
|
|
1488 ["Temporary"
|
|
1489 (gnus-score-set-default 'gnus-score-default-duration 't)
|
|
1490 :style radio
|
|
1491 :selected (eq gnus-score-default-duration 't)]
|
30
|
1492 ["Immediate"
|
16
|
1493 (gnus-score-set-default 'gnus-score-default-duration 'i)
|
|
1494 :style radio
|
|
1495 :selected (eq gnus-score-default-duration 'i)]))
|
|
1496
|
|
1497 (easy-menu-define
|
|
1498 gnus-summary-article-menu gnus-summary-mode-map ""
|
|
1499 '("Article"
|
|
1500 ("Hide"
|
|
1501 ["All" gnus-article-hide t]
|
|
1502 ["Headers" gnus-article-hide-headers t]
|
|
1503 ["Signature" gnus-article-hide-signature t]
|
|
1504 ["Citation" gnus-article-hide-citation t]
|
|
1505 ["PGP" gnus-article-hide-pgp t]
|
|
1506 ["Boring headers" gnus-article-hide-boring-headers t])
|
|
1507 ("Highlight"
|
|
1508 ["All" gnus-article-highlight t]
|
|
1509 ["Headers" gnus-article-highlight-headers t]
|
|
1510 ["Signature" gnus-article-highlight-signature t]
|
|
1511 ["Citation" gnus-article-highlight-citation t])
|
|
1512 ("Date"
|
|
1513 ["Local" gnus-article-date-local t]
|
|
1514 ["UT" gnus-article-date-ut t]
|
|
1515 ["Original" gnus-article-date-original t]
|
|
1516 ["Lapsed" gnus-article-date-lapsed t]
|
|
1517 ["User-defined" gnus-article-date-user t])
|
|
1518 ("Washing"
|
|
1519 ("Remove Blanks"
|
|
1520 ["Leading" gnus-article-strip-leading-blank-lines t]
|
|
1521 ["Multiple" gnus-article-strip-multiple-blank-lines t]
|
|
1522 ["Trailing" gnus-article-remove-trailing-blank-lines t]
|
36
|
1523 ["All of the above" gnus-article-strip-blank-lines t]
|
|
1524 ["Leading space" gnus-article-strip-leading-space t])
|
16
|
1525 ["Overstrike" gnus-article-treat-overstrike t]
|
|
1526 ["Emphasis" gnus-article-emphasize t]
|
|
1527 ["Word wrap" gnus-article-fill-cited-article t]
|
|
1528 ["CR" gnus-article-remove-cr t]
|
|
1529 ["Show X-Face" gnus-article-display-x-face t]
|
|
1530 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
|
30
|
1531 ["UnHTMLize" gnus-article-treat-html t]
|
16
|
1532 ["Rot 13" gnus-summary-caesar-message t]
|
|
1533 ["Unix pipe" gnus-summary-pipe-message t]
|
|
1534 ["Add buttons" gnus-article-add-buttons t]
|
|
1535 ["Add buttons to head" gnus-article-add-buttons-to-head t]
|
|
1536 ["Stop page breaking" gnus-summary-stop-page-breaking t]
|
|
1537 ["Toggle MIME" gnus-summary-toggle-mime t]
|
|
1538 ["Verbose header" gnus-summary-verbose-headers t]
|
|
1539 ["Toggle header" gnus-summary-toggle-header t])
|
|
1540 ("Output"
|
|
1541 ["Save in default format" gnus-summary-save-article t]
|
|
1542 ["Save in file" gnus-summary-save-article-file t]
|
|
1543 ["Save in Unix mail format" gnus-summary-save-article-mail t]
|
|
1544 ["Write to file" gnus-summary-write-article-mail t]
|
|
1545 ["Save in MH folder" gnus-summary-save-article-folder t]
|
|
1546 ["Save in VM folder" gnus-summary-save-article-vm t]
|
|
1547 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
|
|
1548 ["Save body in file" gnus-summary-save-article-body-file t]
|
|
1549 ["Pipe through a filter" gnus-summary-pipe-output t]
|
|
1550 ["Add to SOUP packet" gnus-soup-add-article t]
|
|
1551 ["Print" gnus-summary-print-article t])
|
|
1552 ("Backend"
|
|
1553 ["Respool article..." gnus-summary-respool-article t]
|
|
1554 ["Move article..." gnus-summary-move-article
|
|
1555 (gnus-check-backend-function
|
|
1556 'request-move-article gnus-newsgroup-name)]
|
|
1557 ["Copy article..." gnus-summary-copy-article t]
|
|
1558 ["Crosspost article..." gnus-summary-crosspost-article
|
|
1559 (gnus-check-backend-function
|
|
1560 'request-replace-article gnus-newsgroup-name)]
|
|
1561 ["Import file..." gnus-summary-import-article t]
|
|
1562 ["Check if posted" gnus-summary-article-posted-p t]
|
|
1563 ["Edit article" gnus-summary-edit-article
|
|
1564 (not (gnus-group-read-only-p))]
|
|
1565 ["Delete article" gnus-summary-delete-article
|
|
1566 (gnus-check-backend-function
|
|
1567 'request-expire-articles gnus-newsgroup-name)]
|
|
1568 ["Query respool" gnus-summary-respool-query t]
|
|
1569 ["Delete expirable articles" gnus-summary-expire-articles-now
|
|
1570 (gnus-check-backend-function
|
|
1571 'request-expire-articles gnus-newsgroup-name)])
|
|
1572 ("Extract"
|
|
1573 ["Uudecode" gnus-uu-decode-uu t]
|
|
1574 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
|
|
1575 ["Unshar" gnus-uu-decode-unshar t]
|
|
1576 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
|
|
1577 ["Save" gnus-uu-decode-save t]
|
|
1578 ["Binhex" gnus-uu-decode-binhex t]
|
|
1579 ["Postscript" gnus-uu-decode-postscript t])
|
|
1580 ("Cache"
|
|
1581 ["Enter article" gnus-cache-enter-article t]
|
|
1582 ["Remove article" gnus-cache-remove-article t])
|
|
1583 ["Enter digest buffer" gnus-summary-enter-digest-group t]
|
|
1584 ["Isearch article..." gnus-summary-isearch-article t]
|
|
1585 ["Beginning of the article" gnus-summary-beginning-of-article t]
|
|
1586 ["End of the article" gnus-summary-end-of-article t]
|
|
1587 ["Fetch parent of article" gnus-summary-refer-parent-article t]
|
|
1588 ["Fetch referenced articles" gnus-summary-refer-references t]
|
|
1589 ["Fetch article with id..." gnus-summary-refer-article t]
|
|
1590 ["Redisplay" gnus-summary-show-article t]))
|
|
1591
|
|
1592 (easy-menu-define
|
|
1593 gnus-summary-thread-menu gnus-summary-mode-map ""
|
|
1594 '("Threads"
|
|
1595 ["Toggle threading" gnus-summary-toggle-threads t]
|
|
1596 ["Hide threads" gnus-summary-hide-all-threads t]
|
|
1597 ["Show threads" gnus-summary-show-all-threads t]
|
|
1598 ["Hide thread" gnus-summary-hide-thread t]
|
|
1599 ["Show thread" gnus-summary-show-thread t]
|
|
1600 ["Go to next thread" gnus-summary-next-thread t]
|
|
1601 ["Go to previous thread" gnus-summary-prev-thread t]
|
|
1602 ["Go down thread" gnus-summary-down-thread t]
|
|
1603 ["Go up thread" gnus-summary-up-thread t]
|
|
1604 ["Top of thread" gnus-summary-top-thread t]
|
|
1605 ["Mark thread as read" gnus-summary-kill-thread t]
|
|
1606 ["Lower thread score" gnus-summary-lower-thread t]
|
|
1607 ["Raise thread score" gnus-summary-raise-thread t]
|
|
1608 ["Rethread current" gnus-summary-rethread-current t]
|
|
1609 ))
|
|
1610
|
|
1611 (easy-menu-define
|
|
1612 gnus-summary-post-menu gnus-summary-mode-map ""
|
|
1613 '("Post"
|
|
1614 ["Post an article" gnus-summary-post-news t]
|
|
1615 ["Followup" gnus-summary-followup t]
|
|
1616 ["Followup and yank" gnus-summary-followup-with-original t]
|
|
1617 ["Supersede article" gnus-summary-supersede-article t]
|
|
1618 ["Cancel article" gnus-summary-cancel-article t]
|
|
1619 ["Reply" gnus-summary-reply t]
|
|
1620 ["Reply and yank" gnus-summary-reply-with-original t]
|
|
1621 ["Wide reply" gnus-summary-wide-reply t]
|
|
1622 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
|
|
1623 ["Mail forward" gnus-summary-mail-forward t]
|
|
1624 ["Post forward" gnus-summary-post-forward t]
|
|
1625 ["Digest and mail" gnus-uu-digest-mail-forward t]
|
|
1626 ["Digest and post" gnus-uu-digest-post-forward t]
|
|
1627 ["Resend message" gnus-summary-resend-message t]
|
|
1628 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
|
|
1629 ["Send a mail" gnus-summary-mail-other-window t]
|
|
1630 ["Uuencode and post" gnus-uu-post-news t]
|
|
1631 ["Followup via news" gnus-summary-followup-to-mail t]
|
|
1632 ["Followup via news and yank"
|
|
1633 gnus-summary-followup-to-mail-with-original t]
|
|
1634 ;;("Draft"
|
|
1635 ;;["Send" gnus-summary-send-draft t]
|
|
1636 ;;["Send bounced" gnus-resend-bounced-mail t])
|
|
1637 ))
|
|
1638
|
|
1639 (easy-menu-define
|
|
1640 gnus-summary-misc-menu gnus-summary-mode-map ""
|
|
1641 '("Misc"
|
|
1642 ("Mark Read"
|
|
1643 ["Mark as read" gnus-summary-mark-as-read-forward t]
|
|
1644 ["Mark same subject and select"
|
|
1645 gnus-summary-kill-same-subject-and-select t]
|
|
1646 ["Mark same subject" gnus-summary-kill-same-subject t]
|
|
1647 ["Catchup" gnus-summary-catchup t]
|
|
1648 ["Catchup all" gnus-summary-catchup-all t]
|
|
1649 ["Catchup to here" gnus-summary-catchup-to-here t]
|
|
1650 ["Catchup region" gnus-summary-mark-region-as-read t]
|
|
1651 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
|
|
1652 ("Mark Various"
|
|
1653 ["Tick" gnus-summary-tick-article-forward t]
|
|
1654 ["Mark as dormant" gnus-summary-mark-as-dormant t]
|
|
1655 ["Remove marks" gnus-summary-clear-mark-forward t]
|
|
1656 ["Set expirable mark" gnus-summary-mark-as-expirable t]
|
|
1657 ["Set bookmark" gnus-summary-set-bookmark t]
|
|
1658 ["Remove bookmark" gnus-summary-remove-bookmark t])
|
|
1659 ("Mark Limit"
|
|
1660 ["Marks..." gnus-summary-limit-to-marks t]
|
|
1661 ["Subject..." gnus-summary-limit-to-subject t]
|
|
1662 ["Author..." gnus-summary-limit-to-author t]
|
|
1663 ["Age..." gnus-summary-limit-to-age t]
|
|
1664 ["Score" gnus-summary-limit-to-score t]
|
|
1665 ["Unread" gnus-summary-limit-to-unread t]
|
|
1666 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
|
|
1667 ["Articles" gnus-summary-limit-to-articles t]
|
|
1668 ["Pop limit" gnus-summary-pop-limit t]
|
|
1669 ["Show dormant" gnus-summary-limit-include-dormant t]
|
30
|
1670 ["Hide childless dormant"
|
16
|
1671 gnus-summary-limit-exclude-childless-dormant t]
|
|
1672 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
|
|
1673 ["Show expunged" gnus-summary-show-all-expunged t])
|
|
1674 ("Process Mark"
|
|
1675 ["Set mark" gnus-summary-mark-as-processable t]
|
|
1676 ["Remove mark" gnus-summary-unmark-as-processable t]
|
|
1677 ["Remove all marks" gnus-summary-unmark-all-processable t]
|
|
1678 ["Mark above" gnus-uu-mark-over t]
|
|
1679 ["Mark series" gnus-uu-mark-series t]
|
|
1680 ["Mark region" gnus-uu-mark-region t]
|
|
1681 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
|
|
1682 ["Mark all" gnus-uu-mark-all t]
|
|
1683 ["Mark buffer" gnus-uu-mark-buffer t]
|
|
1684 ["Mark sparse" gnus-uu-mark-sparse t]
|
|
1685 ["Mark thread" gnus-uu-mark-thread t]
|
|
1686 ["Unmark thread" gnus-uu-unmark-thread t]
|
|
1687 ("Process Mark Sets"
|
|
1688 ["Kill" gnus-summary-kill-process-mark t]
|
|
1689 ["Yank" gnus-summary-yank-process-mark
|
|
1690 gnus-newsgroup-process-stack]
|
|
1691 ["Save" gnus-summary-save-process-mark t]))
|
|
1692 ("Scroll article"
|
|
1693 ["Page forward" gnus-summary-next-page t]
|
|
1694 ["Page backward" gnus-summary-prev-page t]
|
|
1695 ["Line forward" gnus-summary-scroll-up t])
|
|
1696 ("Move"
|
|
1697 ["Next unread article" gnus-summary-next-unread-article t]
|
|
1698 ["Previous unread article" gnus-summary-prev-unread-article t]
|
|
1699 ["Next article" gnus-summary-next-article t]
|
|
1700 ["Previous article" gnus-summary-prev-article t]
|
|
1701 ["Next unread subject" gnus-summary-next-unread-subject t]
|
|
1702 ["Previous unread subject" gnus-summary-prev-unread-subject t]
|
|
1703 ["Next article same subject" gnus-summary-next-same-subject t]
|
|
1704 ["Previous article same subject" gnus-summary-prev-same-subject t]
|
|
1705 ["First unread article" gnus-summary-first-unread-article t]
|
|
1706 ["Best unread article" gnus-summary-best-unread-article t]
|
|
1707 ["Go to subject number..." gnus-summary-goto-subject t]
|
|
1708 ["Go to article number..." gnus-summary-goto-article t]
|
|
1709 ["Go to the last article" gnus-summary-goto-last-article t]
|
|
1710 ["Pop article off history" gnus-summary-pop-article t])
|
|
1711 ("Sort"
|
|
1712 ["Sort by number" gnus-summary-sort-by-number t]
|
|
1713 ["Sort by author" gnus-summary-sort-by-author t]
|
|
1714 ["Sort by subject" gnus-summary-sort-by-subject t]
|
|
1715 ["Sort by date" gnus-summary-sort-by-date t]
|
|
1716 ["Sort by score" gnus-summary-sort-by-score t]
|
|
1717 ["Sort by lines" gnus-summary-sort-by-lines t])
|
|
1718 ("Help"
|
|
1719 ["Fetch group FAQ" gnus-summary-fetch-faq t]
|
|
1720 ["Describe group" gnus-summary-describe-group t]
|
|
1721 ["Read manual" gnus-info-find-node t])
|
|
1722 ("Modes"
|
|
1723 ["Pick and read" gnus-pick-mode t]
|
|
1724 ["Binary" gnus-binary-mode t])
|
|
1725 ("Regeneration"
|
|
1726 ["Regenerate" gnus-summary-prepare t]
|
|
1727 ["Insert cached articles" gnus-summary-insert-cached-articles t]
|
|
1728 ["Toggle threading" gnus-summary-toggle-threads t])
|
|
1729 ["Filter articles..." gnus-summary-execute-command t]
|
|
1730 ["Run command on subjects..." gnus-summary-universal-argument t]
|
18
|
1731 ["Search articles forward..." gnus-summary-search-article-forward t]
|
|
1732 ["Search articles backward..." gnus-summary-search-article-backward t]
|
16
|
1733 ["Toggle line truncation" gnus-summary-toggle-truncation t]
|
|
1734 ["Expand window" gnus-summary-expand-window t]
|
|
1735 ["Expire expirable articles" gnus-summary-expire-articles
|
|
1736 (gnus-check-backend-function
|
|
1737 'request-expire-articles gnus-newsgroup-name)]
|
|
1738 ["Edit local kill file" gnus-summary-edit-local-kill t]
|
|
1739 ["Edit main kill file" gnus-summary-edit-global-kill t]
|
|
1740 ("Exit"
|
|
1741 ["Catchup and exit" gnus-summary-catchup-and-exit t]
|
|
1742 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
|
|
1743 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
|
|
1744 ["Exit group" gnus-summary-exit t]
|
|
1745 ["Exit group without updating" gnus-summary-exit-no-update t]
|
|
1746 ["Exit and goto next group" gnus-summary-next-group t]
|
|
1747 ["Exit and goto prev group" gnus-summary-prev-group t]
|
|
1748 ["Reselect group" gnus-summary-reselect-current-group t]
|
|
1749 ["Rescan group" gnus-summary-rescan-group t]
|
|
1750 ["Update dribble" gnus-summary-save-newsrc t])))
|
|
1751
|
|
1752 (run-hooks 'gnus-summary-menu-hook)))
|
|
1753
|
|
1754 (defun gnus-score-set-default (var value)
|
|
1755 "A version of set that updates the GNU Emacs menu-bar."
|
|
1756 (set var value)
|
|
1757 ;; It is the message that forces the active status to be updated.
|
|
1758 (message ""))
|
|
1759
|
|
1760 (defun gnus-make-score-map (type)
|
|
1761 "Make a summary score map of type TYPE."
|
|
1762 (if t
|
|
1763 nil
|
|
1764 (let ((headers '(("author" "from" string)
|
|
1765 ("subject" "subject" string)
|
|
1766 ("article body" "body" string)
|
|
1767 ("article head" "head" string)
|
|
1768 ("xref" "xref" string)
|
|
1769 ("lines" "lines" number)
|
|
1770 ("followups to author" "followup" string)))
|
|
1771 (types '((number ("less than" <)
|
|
1772 ("greater than" >)
|
|
1773 ("equal" =))
|
|
1774 (string ("substring" s)
|
|
1775 ("exact string" e)
|
|
1776 ("fuzzy string" f)
|
|
1777 ("regexp" r))))
|
|
1778 (perms '(("temporary" (current-time-string))
|
|
1779 ("permanent" nil)
|
|
1780 ("immediate" now)))
|
|
1781 header)
|
30
|
1782 (list
|
|
1783 (apply
|
16
|
1784 'nconc
|
|
1785 (list
|
|
1786 (if (eq type 'lower)
|
|
1787 "Lower score"
|
|
1788 "Increase score"))
|
|
1789 (let (outh)
|
|
1790 (while headers
|
|
1791 (setq header (car headers))
|
30
|
1792 (setq outh
|
|
1793 (cons
|
|
1794 (apply
|
16
|
1795 'nconc
|
|
1796 (list (car header))
|
|
1797 (let ((ts (cdr (assoc (nth 2 header) types)))
|
|
1798 outt)
|
|
1799 (while ts
|
|
1800 (setq outt
|
30
|
1801 (cons
|
|
1802 (apply
|
16
|
1803 'nconc
|
|
1804 (list (caar ts))
|
|
1805 (let ((ps perms)
|
|
1806 outp)
|
|
1807 (while ps
|
|
1808 (setq outp
|
|
1809 (cons
|
|
1810 (vector
|
|
1811 (caar ps)
|
|
1812 (list
|
|
1813 'gnus-summary-score-entry
|
|
1814 (nth 1 header)
|
|
1815 (if (or (string= (nth 1 header)
|
|
1816 "head")
|
|
1817 (string= (nth 1 header)
|
|
1818 "body"))
|
|
1819 ""
|
30
|
1820 (list 'gnus-summary-header
|
16
|
1821 (nth 1 header)))
|
|
1822 (list 'quote (nth 1 (car ts)))
|
|
1823 (list 'gnus-score-default nil)
|
|
1824 (nth 1 (car ps))
|
|
1825 t)
|
|
1826 t)
|
|
1827 outp))
|
|
1828 (setq ps (cdr ps)))
|
|
1829 (list (nreverse outp))))
|
|
1830 outt))
|
|
1831 (setq ts (cdr ts)))
|
|
1832 (list (nreverse outt))))
|
|
1833 outh))
|
|
1834 (setq headers (cdr headers)))
|
|
1835 (list (nreverse outh))))))))
|
|
1836
|
|
1837
|
|
1838
|
|
1839 (defun gnus-summary-mode (&optional group)
|
|
1840 "Major mode for reading articles.
|
|
1841
|
|
1842 All normal editing commands are switched off.
|
|
1843 \\<gnus-summary-mode-map>
|
|
1844 Each line in this buffer represents one article. To read an
|
|
1845 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
|
|
1846 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
|
|
1847 respectively.
|
|
1848
|
|
1849 You can also post articles and send mail from this buffer. To
|
|
1850 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
|
|
1851 of an article, type `\\[gnus-summary-reply]'.
|
|
1852
|
|
1853 There are approx. one gazillion commands you can execute in this
|
|
1854 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
|
|
1855
|
|
1856 The following commands are available:
|
|
1857
|
|
1858 \\{gnus-summary-mode-map}"
|
|
1859 (interactive)
|
|
1860 (when (gnus-visual-p 'summary-menu 'menu)
|
|
1861 (gnus-summary-make-menu-bar))
|
|
1862 (kill-all-local-variables)
|
|
1863 (gnus-summary-make-local-variables)
|
|
1864 (gnus-make-thread-indent-array)
|
|
1865 (gnus-simplify-mode-line)
|
|
1866 (setq major-mode 'gnus-summary-mode)
|
|
1867 (setq mode-name "Summary")
|
|
1868 (make-local-variable 'minor-mode-alist)
|
|
1869 (use-local-map gnus-summary-mode-map)
|
|
1870 (buffer-disable-undo (current-buffer))
|
|
1871 (setq buffer-read-only t) ;Disable modification
|
|
1872 (setq truncate-lines t)
|
|
1873 (setq selective-display t)
|
|
1874 (setq selective-display-ellipses t) ;Display `...'
|
|
1875 (setq buffer-display-table gnus-summary-display-table)
|
|
1876 (gnus-set-default-directory)
|
|
1877 (setq gnus-newsgroup-name group)
|
|
1878 (make-local-variable 'gnus-summary-line-format)
|
|
1879 (make-local-variable 'gnus-summary-line-format-spec)
|
|
1880 (make-local-variable 'gnus-summary-mark-positions)
|
22
|
1881 (make-local-hook 'post-command-hook)
|
16
|
1882 (gnus-add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
|
|
1883 (run-hooks 'gnus-summary-mode-hook)
|
|
1884 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
|
|
1885 (gnus-update-summary-mark-positions))
|
|
1886
|
|
1887 (defun gnus-summary-make-local-variables ()
|
|
1888 "Make all the local summary buffer variables."
|
|
1889 (let ((locals gnus-summary-local-variables)
|
|
1890 global local)
|
|
1891 (while (setq local (pop locals))
|
|
1892 (if (consp local)
|
|
1893 (progn
|
|
1894 (if (eq (cdr local) 'global)
|
|
1895 ;; Copy the global value of the variable.
|
|
1896 (setq global (symbol-value (car local)))
|
|
1897 ;; Use the value from the list.
|
|
1898 (setq global (eval (cdr local))))
|
|
1899 (make-local-variable (car local))
|
|
1900 (set (car local) global))
|
|
1901 ;; Simple nil-valued local variable.
|
|
1902 (make-local-variable local)
|
|
1903 (set local nil)))))
|
|
1904
|
|
1905 (defun gnus-summary-clear-local-variables ()
|
|
1906 (let ((locals gnus-summary-local-variables))
|
|
1907 (while locals
|
|
1908 (if (consp (car locals))
|
|
1909 (and (vectorp (caar locals))
|
|
1910 (set (caar locals) nil))
|
|
1911 (and (vectorp (car locals))
|
|
1912 (set (car locals) nil)))
|
|
1913 (setq locals (cdr locals)))))
|
|
1914
|
|
1915 ;; Summary data functions.
|
|
1916
|
|
1917 (defmacro gnus-data-number (data)
|
|
1918 `(car ,data))
|
|
1919
|
|
1920 (defmacro gnus-data-set-number (data number)
|
|
1921 `(setcar ,data ,number))
|
|
1922
|
|
1923 (defmacro gnus-data-mark (data)
|
|
1924 `(nth 1 ,data))
|
|
1925
|
|
1926 (defmacro gnus-data-set-mark (data mark)
|
|
1927 `(setcar (nthcdr 1 ,data) ,mark))
|
|
1928
|
|
1929 (defmacro gnus-data-pos (data)
|
|
1930 `(nth 2 ,data))
|
|
1931
|
|
1932 (defmacro gnus-data-set-pos (data pos)
|
|
1933 `(setcar (nthcdr 2 ,data) ,pos))
|
|
1934
|
|
1935 (defmacro gnus-data-header (data)
|
|
1936 `(nth 3 ,data))
|
|
1937
|
18
|
1938 (defmacro gnus-data-set-header (data header)
|
|
1939 `(setf (nth 3 ,data) ,header))
|
|
1940
|
16
|
1941 (defmacro gnus-data-level (data)
|
|
1942 `(nth 4 ,data))
|
|
1943
|
|
1944 (defmacro gnus-data-unread-p (data)
|
|
1945 `(= (nth 1 ,data) gnus-unread-mark))
|
|
1946
|
|
1947 (defmacro gnus-data-read-p (data)
|
|
1948 `(/= (nth 1 ,data) gnus-unread-mark))
|
|
1949
|
|
1950 (defmacro gnus-data-pseudo-p (data)
|
|
1951 `(consp (nth 3 ,data)))
|
|
1952
|
|
1953 (defmacro gnus-data-find (number)
|
|
1954 `(assq ,number gnus-newsgroup-data))
|
|
1955
|
|
1956 (defmacro gnus-data-find-list (number &optional data)
|
|
1957 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
|
|
1958 (memq (assq ,number bdata)
|
|
1959 bdata)))
|
|
1960
|
|
1961 (defmacro gnus-data-make (number mark pos header level)
|
|
1962 `(list ,number ,mark ,pos ,header ,level))
|
|
1963
|
|
1964 (defun gnus-data-enter (after-article number mark pos header level offset)
|
|
1965 (let ((data (gnus-data-find-list after-article)))
|
|
1966 (unless data
|
|
1967 (error "No such article: %d" after-article))
|
|
1968 (setcdr data (cons (gnus-data-make number mark pos header level)
|
|
1969 (cdr data)))
|
|
1970 (setq gnus-newsgroup-data-reverse nil)
|
|
1971 (gnus-data-update-list (cddr data) offset)))
|
|
1972
|
|
1973 (defun gnus-data-enter-list (after-article list &optional offset)
|
|
1974 (when list
|
|
1975 (let ((data (and after-article (gnus-data-find-list after-article)))
|
|
1976 (ilist list))
|
|
1977 (or data (not after-article) (error "No such article: %d" after-article))
|
|
1978 ;; Find the last element in the list to be spliced into the main
|
|
1979 ;; list.
|
|
1980 (while (cdr list)
|
|
1981 (setq list (cdr list)))
|
|
1982 (if (not data)
|
|
1983 (progn
|
|
1984 (setcdr list gnus-newsgroup-data)
|
|
1985 (setq gnus-newsgroup-data ilist)
|
|
1986 (when offset
|
|
1987 (gnus-data-update-list (cdr list) offset)))
|
|
1988 (setcdr list (cdr data))
|
|
1989 (setcdr data ilist)
|
|
1990 (when offset
|
|
1991 (gnus-data-update-list (cdr list) offset)))
|
|
1992 (setq gnus-newsgroup-data-reverse nil))))
|
|
1993
|
|
1994 (defun gnus-data-remove (article &optional offset)
|
|
1995 (let ((data gnus-newsgroup-data))
|
|
1996 (if (= (gnus-data-number (car data)) article)
|
|
1997 (progn
|
|
1998 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
|
|
1999 gnus-newsgroup-data-reverse nil)
|
|
2000 (when offset
|
|
2001 (gnus-data-update-list gnus-newsgroup-data offset)))
|
|
2002 (while (cdr data)
|
|
2003 (when (= (gnus-data-number (cadr data)) article)
|
|
2004 (setcdr data (cddr data))
|
|
2005 (when offset
|
|
2006 (gnus-data-update-list (cdr data) offset))
|
|
2007 (setq data nil
|
|
2008 gnus-newsgroup-data-reverse nil))
|
|
2009 (setq data (cdr data))))))
|
|
2010
|
|
2011 (defmacro gnus-data-list (backward)
|
|
2012 `(if ,backward
|
|
2013 (or gnus-newsgroup-data-reverse
|
|
2014 (setq gnus-newsgroup-data-reverse
|
|
2015 (reverse gnus-newsgroup-data)))
|
|
2016 gnus-newsgroup-data))
|
|
2017
|
|
2018 (defun gnus-data-update-list (data offset)
|
|
2019 "Add OFFSET to the POS of all data entries in DATA."
|
|
2020 (while data
|
|
2021 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
|
|
2022 (setq data (cdr data))))
|
|
2023
|
|
2024 (defun gnus-data-compute-positions ()
|
|
2025 "Compute the positions of all articles."
|
|
2026 (let ((data gnus-newsgroup-data)
|
|
2027 pos)
|
|
2028 (while data
|
|
2029 (when (setq pos (text-property-any
|
|
2030 (point-min) (point-max)
|
|
2031 'gnus-number (gnus-data-number (car data))))
|
|
2032 (gnus-data-set-pos (car data) (+ pos 3)))
|
|
2033 (setq data (cdr data)))))
|
|
2034
|
|
2035 (defun gnus-summary-article-pseudo-p (article)
|
|
2036 "Say whether this article is a pseudo article or not."
|
|
2037 (not (vectorp (gnus-data-header (gnus-data-find article)))))
|
|
2038
|
|
2039 (defmacro gnus-summary-article-sparse-p (article)
|
|
2040 "Say whether this article is a sparse article or not."
|
|
2041 ` (memq ,article gnus-newsgroup-sparse))
|
|
2042
|
|
2043 (defmacro gnus-summary-article-ancient-p (article)
|
|
2044 "Say whether this article is a sparse article or not."
|
|
2045 `(memq ,article gnus-newsgroup-ancient))
|
|
2046
|
|
2047 (defun gnus-article-parent-p (number)
|
|
2048 "Say whether this article is a parent or not."
|
|
2049 (let ((data (gnus-data-find-list number)))
|
|
2050 (and (cdr data) ; There has to be an article after...
|
|
2051 (< (gnus-data-level (car data)) ; And it has to have a higher level.
|
|
2052 (gnus-data-level (nth 1 data))))))
|
|
2053
|
|
2054 (defun gnus-article-children (number)
|
|
2055 "Return a list of all children to NUMBER."
|
|
2056 (let* ((data (gnus-data-find-list number))
|
|
2057 (level (gnus-data-level (car data)))
|
|
2058 children)
|
|
2059 (setq data (cdr data))
|
30
|
2060 (while (and data
|
16
|
2061 (= (gnus-data-level (car data)) (1+ level)))
|
|
2062 (push (gnus-data-number (car data)) children)
|
|
2063 (setq data (cdr data)))
|
|
2064 children))
|
|
2065
|
|
2066 (defmacro gnus-summary-skip-intangible ()
|
|
2067 "If the current article is intangible, then jump to a different article."
|
|
2068 '(let ((to (get-text-property (point) 'gnus-intangible)))
|
|
2069 (and to (gnus-summary-goto-subject to))))
|
|
2070
|
|
2071 (defmacro gnus-summary-article-intangible-p ()
|
|
2072 "Say whether this article is intangible or not."
|
|
2073 '(get-text-property (point) 'gnus-intangible))
|
|
2074
|
|
2075 (defun gnus-article-read-p (article)
|
|
2076 "Say whether ARTICLE is read or not."
|
|
2077 (not (or (memq article gnus-newsgroup-marked)
|
|
2078 (memq article gnus-newsgroup-unreads)
|
|
2079 (memq article gnus-newsgroup-unselected)
|
|
2080 (memq article gnus-newsgroup-dormant))))
|
|
2081
|
|
2082 ;; Some summary mode macros.
|
|
2083
|
|
2084 (defmacro gnus-summary-article-number ()
|
|
2085 "The article number of the article on the current line.
|
|
2086 If there isn's an article number here, then we return the current
|
|
2087 article number."
|
|
2088 '(progn
|
|
2089 (gnus-summary-skip-intangible)
|
|
2090 (or (get-text-property (point) 'gnus-number)
|
|
2091 (gnus-summary-last-subject))))
|
|
2092
|
|
2093 (defmacro gnus-summary-article-header (&optional number)
|
|
2094 `(gnus-data-header (gnus-data-find
|
|
2095 ,(or number '(gnus-summary-article-number)))))
|
|
2096
|
|
2097 (defmacro gnus-summary-thread-level (&optional number)
|
|
2098 `(if (and (eq gnus-summary-make-false-root 'dummy)
|
|
2099 (get-text-property (point) 'gnus-intangible))
|
|
2100 0
|
|
2101 (gnus-data-level (gnus-data-find
|
|
2102 ,(or number '(gnus-summary-article-number))))))
|
|
2103
|
|
2104 (defmacro gnus-summary-article-mark (&optional number)
|
|
2105 `(gnus-data-mark (gnus-data-find
|
|
2106 ,(or number '(gnus-summary-article-number)))))
|
|
2107
|
|
2108 (defmacro gnus-summary-article-pos (&optional number)
|
|
2109 `(gnus-data-pos (gnus-data-find
|
|
2110 ,(or number '(gnus-summary-article-number)))))
|
|
2111
|
|
2112 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
|
|
2113 (defmacro gnus-summary-article-subject (&optional number)
|
|
2114 "Return current subject string or nil if nothing."
|
|
2115 `(let ((headers
|
|
2116 ,(if number
|
|
2117 `(gnus-data-header (assq ,number gnus-newsgroup-data))
|
|
2118 '(gnus-data-header (assq (gnus-summary-article-number)
|
|
2119 gnus-newsgroup-data)))))
|
|
2120 (and headers
|
|
2121 (vectorp headers)
|
|
2122 (mail-header-subject headers))))
|
|
2123
|
|
2124 (defmacro gnus-summary-article-score (&optional number)
|
|
2125 "Return current article score."
|
|
2126 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
|
|
2127 gnus-newsgroup-scored))
|
|
2128 gnus-summary-default-score 0))
|
|
2129
|
|
2130 (defun gnus-summary-article-children (&optional number)
|
|
2131 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
|
|
2132 (level (gnus-data-level (car data)))
|
|
2133 l children)
|
|
2134 (while (and (setq data (cdr data))
|
|
2135 (> (setq l (gnus-data-level (car data))) level))
|
|
2136 (and (= (1+ level) l)
|
|
2137 (push (gnus-data-number (car data))
|
|
2138 children)))
|
|
2139 (nreverse children)))
|
|
2140
|
|
2141 (defun gnus-summary-article-parent (&optional number)
|
|
2142 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
|
|
2143 (gnus-data-list t)))
|
|
2144 (level (gnus-data-level (car data))))
|
|
2145 (if (zerop level)
|
|
2146 () ; This is a root.
|
|
2147 ;; We search until we find an article with a level less than
|
|
2148 ;; this one. That function has to be the parent.
|
|
2149 (while (and (setq data (cdr data))
|
|
2150 (not (< (gnus-data-level (car data)) level))))
|
|
2151 (and data (gnus-data-number (car data))))))
|
|
2152
|
|
2153 (defun gnus-unread-mark-p (mark)
|
|
2154 "Say whether MARK is the unread mark."
|
|
2155 (= mark gnus-unread-mark))
|
|
2156
|
|
2157 (defun gnus-read-mark-p (mark)
|
|
2158 "Say whether MARK is one of the marks that mark as read.
|
|
2159 This is all marks except unread, ticked, dormant, and expirable."
|
|
2160 (not (or (= mark gnus-unread-mark)
|
|
2161 (= mark gnus-ticked-mark)
|
|
2162 (= mark gnus-dormant-mark)
|
|
2163 (= mark gnus-expirable-mark))))
|
|
2164
|
|
2165 (defmacro gnus-article-mark (number)
|
|
2166 `(cond
|
|
2167 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
|
|
2168 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
|
|
2169 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
|
|
2170 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
|
|
2171 (t (or (cdr (assq ,number gnus-newsgroup-reads))
|
|
2172 gnus-ancient-mark))))
|
|
2173
|
|
2174 ;; Saving hidden threads.
|
|
2175
|
|
2176 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
|
|
2177 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
|
|
2178
|
|
2179 (defmacro gnus-save-hidden-threads (&rest forms)
|
|
2180 "Save hidden threads, eval FORMS, and restore the hidden threads."
|
|
2181 (let ((config (make-symbol "config")))
|
|
2182 `(let ((,config (gnus-hidden-threads-configuration)))
|
|
2183 (unwind-protect
|
|
2184 (save-excursion
|
|
2185 ,@forms)
|
|
2186 (gnus-restore-hidden-threads-configuration ,config)))))
|
|
2187
|
|
2188 (defun gnus-hidden-threads-configuration ()
|
|
2189 "Return the current hidden threads configuration."
|
|
2190 (save-excursion
|
|
2191 (let (config)
|
|
2192 (goto-char (point-min))
|
|
2193 (while (search-forward "\r" nil t)
|
|
2194 (push (1- (point)) config))
|
|
2195 config)))
|
|
2196
|
|
2197 (defun gnus-restore-hidden-threads-configuration (config)
|
|
2198 "Restore hidden threads configuration from CONFIG."
|
|
2199 (let (point buffer-read-only)
|
|
2200 (while (setq point (pop config))
|
|
2201 (when (and (< point (point-max))
|
|
2202 (goto-char point)
|
|
2203 (= (following-char) ?\n))
|
|
2204 (subst-char-in-region point (1+ point) ?\n ?\r)))))
|
|
2205
|
|
2206 ;; Various summary mode internalish functions.
|
|
2207
|
|
2208 (defun gnus-mouse-pick-article (e)
|
|
2209 (interactive "e")
|
|
2210 (mouse-set-point e)
|
|
2211 (gnus-summary-next-page nil t))
|
|
2212
|
|
2213 (defun gnus-summary-setup-buffer (group)
|
|
2214 "Initialize summary buffer."
|
|
2215 (let ((buffer (concat "*Summary " group "*")))
|
|
2216 (if (get-buffer buffer)
|
|
2217 (progn
|
|
2218 (set-buffer buffer)
|
|
2219 (setq gnus-summary-buffer (current-buffer))
|
|
2220 (not gnus-newsgroup-prepared))
|
|
2221 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
|
|
2222 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
|
|
2223 (gnus-add-current-to-buffer-list)
|
|
2224 (gnus-summary-mode group)
|
|
2225 (when gnus-carpal
|
|
2226 (gnus-carpal-setup-buffer 'summary))
|
|
2227 (unless gnus-single-article-buffer
|
|
2228 (make-local-variable 'gnus-article-buffer)
|
|
2229 (make-local-variable 'gnus-article-current)
|
|
2230 (make-local-variable 'gnus-original-article-buffer))
|
|
2231 (setq gnus-newsgroup-name group)
|
|
2232 t)))
|
|
2233
|
|
2234 (defun gnus-set-global-variables ()
|
|
2235 ;; Set the global equivalents of the summary buffer-local variables
|
|
2236 ;; to the latest values they had. These reflect the summary buffer
|
|
2237 ;; that was in action when the last article was fetched.
|
|
2238 (when (eq major-mode 'gnus-summary-mode)
|
|
2239 (setq gnus-summary-buffer (current-buffer))
|
|
2240 (let ((name gnus-newsgroup-name)
|
|
2241 (marked gnus-newsgroup-marked)
|
|
2242 (unread gnus-newsgroup-unreads)
|
|
2243 (headers gnus-current-headers)
|
|
2244 (data gnus-newsgroup-data)
|
|
2245 (summary gnus-summary-buffer)
|
|
2246 (article-buffer gnus-article-buffer)
|
|
2247 (original gnus-original-article-buffer)
|
|
2248 (gac gnus-article-current)
|
|
2249 (reffed gnus-reffed-article-number)
|
|
2250 (score-file gnus-current-score-file))
|
|
2251 (save-excursion
|
|
2252 (set-buffer gnus-group-buffer)
|
|
2253 (setq gnus-newsgroup-name name)
|
|
2254 (setq gnus-newsgroup-marked marked)
|
|
2255 (setq gnus-newsgroup-unreads unread)
|
|
2256 (setq gnus-current-headers headers)
|
|
2257 (setq gnus-newsgroup-data data)
|
|
2258 (setq gnus-article-current gac)
|
|
2259 (setq gnus-summary-buffer summary)
|
|
2260 (setq gnus-article-buffer article-buffer)
|
|
2261 (setq gnus-original-article-buffer original)
|
|
2262 (setq gnus-reffed-article-number reffed)
|
|
2263 (setq gnus-current-score-file score-file)
|
|
2264 ;; The article buffer also has local variables.
|
|
2265 (when (gnus-buffer-live-p gnus-article-buffer)
|
|
2266 (set-buffer gnus-article-buffer)
|
|
2267 (setq gnus-summary-buffer summary))))))
|
|
2268
|
|
2269 (defun gnus-summary-article-unread-p (article)
|
|
2270 "Say whether ARTICLE is unread or not."
|
|
2271 (memq article gnus-newsgroup-unreads))
|
|
2272
|
|
2273 (defun gnus-summary-first-article-p (&optional article)
|
|
2274 "Return whether ARTICLE is the first article in the buffer."
|
|
2275 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2276 nil
|
|
2277 (eq article (caar gnus-newsgroup-data))))
|
|
2278
|
|
2279 (defun gnus-summary-last-article-p (&optional article)
|
|
2280 "Return whether ARTICLE is the last article in the buffer."
|
|
2281 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2282 t ; All non-existent numbers are the last article. :-)
|
|
2283 (not (cdr (gnus-data-find-list article)))))
|
|
2284
|
|
2285 (defun gnus-make-thread-indent-array ()
|
|
2286 (let ((n 200))
|
|
2287 (unless (and gnus-thread-indent-array
|
|
2288 (= gnus-thread-indent-level gnus-thread-indent-array-level))
|
|
2289 (setq gnus-thread-indent-array (make-vector 201 "")
|
|
2290 gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
2291 (while (>= n 0)
|
|
2292 (aset gnus-thread-indent-array n
|
|
2293 (make-string (* n gnus-thread-indent-level) ? ))
|
|
2294 (setq n (1- n))))))
|
|
2295
|
|
2296 (defun gnus-update-summary-mark-positions ()
|
|
2297 "Compute where the summary marks are to go."
|
|
2298 (save-excursion
|
|
2299 (when (and gnus-summary-buffer
|
|
2300 (get-buffer gnus-summary-buffer)
|
|
2301 (buffer-name (get-buffer gnus-summary-buffer)))
|
|
2302 (set-buffer gnus-summary-buffer))
|
|
2303 (let ((gnus-replied-mark 129)
|
|
2304 (gnus-score-below-mark 130)
|
|
2305 (gnus-score-over-mark 130)
|
|
2306 (spec gnus-summary-line-format-spec)
|
|
2307 thread gnus-visual pos)
|
|
2308 (save-excursion
|
|
2309 (gnus-set-work-buffer)
|
|
2310 (let ((gnus-summary-line-format-spec spec))
|
|
2311 (gnus-summary-insert-line
|
|
2312 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
|
|
2313 (goto-char (point-min))
|
|
2314 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
|
|
2315 (- (point) 2)))))
|
|
2316 (goto-char (point-min))
|
|
2317 (push (cons 'replied (and (search-forward "\201" nil t)
|
|
2318 (- (point) 2)))
|
|
2319 pos)
|
|
2320 (goto-char (point-min))
|
|
2321 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
|
|
2322 pos)))
|
|
2323 (setq gnus-summary-mark-positions pos))))
|
|
2324
|
|
2325 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
|
|
2326 "Insert a dummy root in the summary buffer."
|
|
2327 (beginning-of-line)
|
|
2328 (gnus-add-text-properties
|
|
2329 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
|
|
2330 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
|
|
2331
|
30
|
2332 (defun gnus-summary-insert-line (gnus-tmp-header
|
|
2333 gnus-tmp-level gnus-tmp-current
|
|
2334 gnus-tmp-unread gnus-tmp-replied
|
16
|
2335 gnus-tmp-expirable gnus-tmp-subject-or-nil
|
30
|
2336 &optional gnus-tmp-dummy gnus-tmp-score
|
16
|
2337 gnus-tmp-process)
|
|
2338 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
|
|
2339 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
|
|
2340 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
|
|
2341 (gnus-tmp-score-char
|
|
2342 (if (or (null gnus-summary-default-score)
|
|
2343 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
2344 gnus-summary-zcore-fuzz))
|
|
2345 ?
|
|
2346 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
2347 gnus-score-below-mark gnus-score-over-mark)))
|
|
2348 (gnus-tmp-replied
|
|
2349 (cond (gnus-tmp-process gnus-process-mark)
|
|
2350 ((memq gnus-tmp-current gnus-newsgroup-cached)
|
|
2351 gnus-cached-mark)
|
|
2352 (gnus-tmp-replied gnus-replied-mark)
|
|
2353 ((memq gnus-tmp-current gnus-newsgroup-saved)
|
|
2354 gnus-saved-mark)
|
|
2355 (t gnus-unread-mark)))
|
|
2356 (gnus-tmp-from (mail-header-from gnus-tmp-header))
|
|
2357 (gnus-tmp-name
|
|
2358 (cond
|
|
2359 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
2360 (let ((beg (match-beginning 0)))
|
|
2361 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
2362 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
2363 (1- (match-end 0))))
|
|
2364 (substring gnus-tmp-from 0 beg))))
|
|
2365 ((string-match "(.+)" gnus-tmp-from)
|
|
2366 (substring gnus-tmp-from
|
|
2367 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
2368 (t gnus-tmp-from)))
|
|
2369 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
|
|
2370 (gnus-tmp-number (mail-header-number gnus-tmp-header))
|
|
2371 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
|
|
2372 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
|
|
2373 (buffer-read-only nil))
|
|
2374 (when (string= gnus-tmp-name "")
|
|
2375 (setq gnus-tmp-name gnus-tmp-from))
|
|
2376 (unless (numberp gnus-tmp-lines)
|
|
2377 (setq gnus-tmp-lines 0))
|
|
2378 (gnus-put-text-property
|
|
2379 (point)
|
|
2380 (progn (eval gnus-summary-line-format-spec) (point))
|
|
2381 'gnus-number gnus-tmp-number)
|
|
2382 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2383 (forward-line -1)
|
|
2384 (run-hooks 'gnus-summary-update-hook)
|
|
2385 (forward-line 1))))
|
|
2386
|
|
2387 (defun gnus-summary-update-line (&optional dont-update)
|
|
2388 ;; Update summary line after change.
|
|
2389 (when (and gnus-summary-default-score
|
|
2390 (not gnus-summary-inhibit-highlight))
|
|
2391 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
|
|
2392 (article (gnus-summary-article-number))
|
|
2393 (score (gnus-summary-article-score article)))
|
|
2394 (unless dont-update
|
|
2395 (if (and gnus-summary-mark-below
|
|
2396 (< (gnus-summary-article-score)
|
|
2397 gnus-summary-mark-below))
|
|
2398 ;; This article has a low score, so we mark it as read.
|
|
2399 (when (memq article gnus-newsgroup-unreads)
|
|
2400 (gnus-summary-mark-article-as-read gnus-low-score-mark))
|
|
2401 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
|
|
2402 ;; This article was previously marked as read on account
|
|
2403 ;; of a low score, but now it has risen, so we mark it as
|
|
2404 ;; unread.
|
|
2405 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
|
|
2406 (gnus-summary-update-mark
|
|
2407 (if (or (null gnus-summary-default-score)
|
|
2408 (<= (abs (- score gnus-summary-default-score))
|
|
2409 gnus-summary-zcore-fuzz))
|
|
2410 ?
|
|
2411 (if (< score gnus-summary-default-score)
|
|
2412 gnus-score-below-mark gnus-score-over-mark))
|
|
2413 'score))
|
|
2414 ;; Do visual highlighting.
|
|
2415 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2416 (run-hooks 'gnus-summary-update-hook)))))
|
|
2417
|
|
2418 (defvar gnus-tmp-new-adopts nil)
|
|
2419
|
|
2420 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
|
30
|
2421 "Return the number of articles in THREAD.
|
16
|
2422 This may be 0 in some cases -- if none of the articles in
|
|
2423 the thread are to be displayed."
|
|
2424 (let* ((number
|
|
2425 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
|
|
2426 (cond
|
|
2427 ((not (listp thread))
|
|
2428 1)
|
|
2429 ((and (consp thread) (cdr thread))
|
|
2430 (apply
|
|
2431 '+ 1 (mapcar
|
|
2432 'gnus-summary-number-of-articles-in-thread (cdr thread))))
|
|
2433 ((null thread)
|
|
2434 1)
|
|
2435 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
|
|
2436 1)
|
|
2437 (t 0))))
|
|
2438 (when (and level (zerop level) gnus-tmp-new-adopts)
|
|
2439 (incf number
|
|
2440 (apply '+ (mapcar
|
|
2441 'gnus-summary-number-of-articles-in-thread
|
|
2442 gnus-tmp-new-adopts))))
|
|
2443 (if char
|
|
2444 (if (> number 1) gnus-not-empty-thread-mark
|
|
2445 gnus-empty-thread-mark)
|
|
2446 number)))
|
|
2447
|
|
2448 (defun gnus-summary-set-local-parameters (group)
|
|
2449 "Go through the local params of GROUP and set all variable specs in that list."
|
|
2450 (let ((params (gnus-group-find-parameter group))
|
|
2451 elem)
|
|
2452 (while params
|
|
2453 (setq elem (car params)
|
|
2454 params (cdr params))
|
|
2455 (and (consp elem) ; Has to be a cons.
|
|
2456 (consp (cdr elem)) ; The cdr has to be a list.
|
|
2457 (symbolp (car elem)) ; Has to be a symbol in there.
|
|
2458 (not (memq (car elem)
|
|
2459 '(quit-config to-address to-list to-group)))
|
30
|
2460 (ignore-errors ; So we set it.
|
16
|
2461 (make-local-variable (car elem))
|
|
2462 (set (car elem) (eval (nth 1 elem))))))))
|
|
2463
|
|
2464 (defun gnus-summary-read-group (group &optional show-all no-article
|
|
2465 kill-buffer no-display)
|
|
2466 "Start reading news in newsgroup GROUP.
|
|
2467 If SHOW-ALL is non-nil, already read articles are also listed.
|
|
2468 If NO-ARTICLE is non-nil, no article is selected initially.
|
|
2469 If NO-DISPLAY, don't generate a summary buffer."
|
36
|
2470 (let (result)
|
|
2471 (while (and group
|
|
2472 (null (setq result
|
38
|
2473 (let ((gnus-auto-select-next nil))
|
|
2474 (gnus-summary-read-group-1
|
|
2475 group show-all no-article
|
|
2476 kill-buffer no-display))))
|
36
|
2477 (eq gnus-auto-select-next 'quietly))
|
|
2478 (set-buffer gnus-group-buffer)
|
|
2479 (if (not (equal group (gnus-group-group-name)))
|
|
2480 (setq group (gnus-group-group-name))
|
|
2481 (setq group nil)))
|
|
2482 result))
|
|
2483
|
|
2484 (defun gnus-summary-read-group-1 (group show-all no-article
|
|
2485 kill-buffer no-display)
|
16
|
2486 ;; Killed foreign groups can't be entered.
|
|
2487 (when (and (not (gnus-group-native-p group))
|
|
2488 (not (gnus-gethash group gnus-newsrc-hashtb)))
|
|
2489 (error "Dead non-native groups can't be entered"))
|
|
2490 (gnus-message 5 "Retrieving newsgroup: %s..." group)
|
|
2491 (let* ((new-group (gnus-summary-setup-buffer group))
|
|
2492 (quit-config (gnus-group-quit-config group))
|
|
2493 (did-select (and new-group (gnus-select-newsgroup group show-all))))
|
|
2494 (cond
|
|
2495 ;; This summary buffer exists already, so we just select it.
|
|
2496 ((not new-group)
|
|
2497 (gnus-set-global-variables)
|
|
2498 (when kill-buffer
|
|
2499 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2500 (gnus-configure-windows 'summary 'force)
|
|
2501 (gnus-set-mode-line 'summary)
|
|
2502 (gnus-summary-position-point)
|
|
2503 (message "")
|
|
2504 t)
|
|
2505 ;; We couldn't select this group.
|
|
2506 ((null did-select)
|
|
2507 (when (and (eq major-mode 'gnus-summary-mode)
|
|
2508 (not (equal (current-buffer) kill-buffer)))
|
|
2509 (kill-buffer (current-buffer))
|
|
2510 (if (not quit-config)
|
|
2511 (progn
|
|
2512 (set-buffer gnus-group-buffer)
|
|
2513 (gnus-group-jump-to-group group)
|
|
2514 (gnus-group-next-unread-group 1))
|
|
2515 (gnus-handle-ephemeral-exit quit-config)))
|
|
2516 (gnus-message 3 "Can't select group")
|
|
2517 nil)
|
|
2518 ;; The user did a `C-g' while prompting for number of articles,
|
|
2519 ;; so we exit this group.
|
|
2520 ((eq did-select 'quit)
|
|
2521 (and (eq major-mode 'gnus-summary-mode)
|
|
2522 (not (equal (current-buffer) kill-buffer))
|
|
2523 (kill-buffer (current-buffer)))
|
|
2524 (when kill-buffer
|
|
2525 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2526 (if (not quit-config)
|
|
2527 (progn
|
|
2528 (set-buffer gnus-group-buffer)
|
|
2529 (gnus-group-jump-to-group group)
|
|
2530 (gnus-group-next-unread-group 1)
|
|
2531 (gnus-configure-windows 'group 'force))
|
|
2532 (gnus-handle-ephemeral-exit quit-config))
|
|
2533 ;; Finally signal the quit.
|
|
2534 (signal 'quit nil))
|
|
2535 ;; The group was successfully selected.
|
|
2536 (t
|
|
2537 (gnus-set-global-variables)
|
|
2538 ;; Save the active value in effect when the group was entered.
|
|
2539 (setq gnus-newsgroup-active
|
|
2540 (gnus-copy-sequence
|
|
2541 (gnus-active gnus-newsgroup-name)))
|
|
2542 ;; You can change the summary buffer in some way with this hook.
|
|
2543 (run-hooks 'gnus-select-group-hook)
|
|
2544 ;; Set any local variables in the group parameters.
|
|
2545 (gnus-summary-set-local-parameters gnus-newsgroup-name)
|
|
2546 (gnus-update-format-specifications
|
|
2547 nil 'summary 'summary-mode 'summary-dummy)
|
|
2548 ;; Do score processing.
|
|
2549 (when gnus-use-scoring
|
|
2550 (gnus-possibly-score-headers))
|
|
2551 ;; Check whether to fill in the gaps in the threads.
|
|
2552 (when gnus-build-sparse-threads
|
|
2553 (gnus-build-sparse-threads))
|
|
2554 ;; Find the initial limit.
|
|
2555 (if gnus-show-threads
|
|
2556 (if show-all
|
|
2557 (let ((gnus-newsgroup-dormant nil))
|
|
2558 (gnus-summary-initial-limit show-all))
|
|
2559 (gnus-summary-initial-limit show-all))
|
30
|
2560 (setq gnus-newsgroup-limit
|
|
2561 (mapcar
|
16
|
2562 (lambda (header) (mail-header-number header))
|
|
2563 gnus-newsgroup-headers)))
|
|
2564 ;; Generate the summary buffer.
|
|
2565 (unless no-display
|
|
2566 (gnus-summary-prepare))
|
|
2567 (when gnus-use-trees
|
|
2568 (gnus-tree-open group)
|
|
2569 (setq gnus-summary-highlight-line-function
|
|
2570 'gnus-tree-highlight-article))
|
|
2571 ;; If the summary buffer is empty, but there are some low-scored
|
|
2572 ;; articles or some excluded dormants, we include these in the
|
|
2573 ;; buffer.
|
|
2574 (when (and (zerop (buffer-size))
|
|
2575 (not no-display))
|
|
2576 (cond (gnus-newsgroup-dormant
|
|
2577 (gnus-summary-limit-include-dormant))
|
|
2578 ((and gnus-newsgroup-scored show-all)
|
|
2579 (gnus-summary-limit-include-expunged t))))
|
|
2580 ;; Function `gnus-apply-kill-file' must be called in this hook.
|
|
2581 (run-hooks 'gnus-apply-kill-hook)
|
|
2582 (if (and (zerop (buffer-size))
|
|
2583 (not no-display))
|
|
2584 (progn
|
|
2585 ;; This newsgroup is empty.
|
36
|
2586 (gnus-summary-catchup-and-exit nil t)
|
16
|
2587 (gnus-message 6 "No unread news")
|
|
2588 (when kill-buffer
|
|
2589 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2590 ;; Return nil from this function.
|
|
2591 nil)
|
|
2592 ;; Hide conversation thread subtrees. We cannot do this in
|
|
2593 ;; gnus-summary-prepare-hook since kill processing may not
|
|
2594 ;; work with hidden articles.
|
|
2595 (and gnus-show-threads
|
|
2596 gnus-thread-hide-subtree
|
|
2597 (gnus-summary-hide-all-threads))
|
|
2598 ;; Show first unread article if requested.
|
|
2599 (if (and (not no-article)
|
|
2600 (not no-display)
|
|
2601 gnus-newsgroup-unreads
|
|
2602 gnus-auto-select-first)
|
|
2603 (unless (if (eq gnus-auto-select-first 'best)
|
|
2604 (gnus-summary-best-unread-article)
|
|
2605 (gnus-summary-first-unread-article))
|
|
2606 (gnus-configure-windows 'summary))
|
|
2607 ;; Don't select any articles, just move point to the first
|
|
2608 ;; article in the group.
|
|
2609 (goto-char (point-min))
|
|
2610 (gnus-summary-position-point)
|
|
2611 (gnus-set-mode-line 'summary)
|
|
2612 (gnus-configure-windows 'summary 'force))
|
|
2613 (when kill-buffer
|
|
2614 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2615 (when (get-buffer-window gnus-group-buffer t)
|
|
2616 ;; Gotta use windows, because recenter does weird stuff if
|
|
2617 ;; the current buffer ain't the displayed window.
|
|
2618 (let ((owin (selected-window)))
|
|
2619 (select-window (get-buffer-window gnus-group-buffer t))
|
|
2620 (when (gnus-group-goto-group group)
|
|
2621 (recenter))
|
38
|
2622 (select-window owin)))
|
|
2623 ;; Mark this buffer as "prepared".
|
|
2624 (setq gnus-newsgroup-prepared t)
|
|
2625 t)))))
|
16
|
2626
|
|
2627 (defun gnus-summary-prepare ()
|
|
2628 "Generate the summary buffer."
|
|
2629 (interactive)
|
|
2630 (let ((buffer-read-only nil))
|
|
2631 (erase-buffer)
|
|
2632 (setq gnus-newsgroup-data nil
|
|
2633 gnus-newsgroup-data-reverse nil)
|
|
2634 (run-hooks 'gnus-summary-generate-hook)
|
|
2635 ;; Generate the buffer, either with threads or without.
|
|
2636 (when gnus-newsgroup-headers
|
|
2637 (gnus-summary-prepare-threads
|
|
2638 (if gnus-show-threads
|
|
2639 (gnus-sort-gathered-threads
|
|
2640 (funcall gnus-summary-thread-gathering-function
|
|
2641 (gnus-sort-threads
|
|
2642 (gnus-cut-threads (gnus-make-threads)))))
|
|
2643 ;; Unthreaded display.
|
|
2644 (gnus-sort-articles gnus-newsgroup-headers))))
|
|
2645 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
|
|
2646 ;; Call hooks for modifying summary buffer.
|
|
2647 (goto-char (point-min))
|
|
2648 (run-hooks 'gnus-summary-prepare-hook)))
|
|
2649
|
|
2650 (defsubst gnus-general-simplify-subject (subject)
|
|
2651 "Simply subject by the same rules as gnus-gather-threads-by-subject."
|
|
2652 (setq subject
|
|
2653 (cond
|
|
2654 ;; Truncate the subject.
|
|
2655 ((numberp gnus-summary-gather-subject-limit)
|
|
2656 (setq subject (gnus-simplify-subject-re subject))
|
|
2657 (if (> (length subject) gnus-summary-gather-subject-limit)
|
|
2658 (substring subject 0 gnus-summary-gather-subject-limit)
|
|
2659 subject))
|
|
2660 ;; Fuzzily simplify it.
|
|
2661 ((eq 'fuzzy gnus-summary-gather-subject-limit)
|
|
2662 (gnus-simplify-subject-fuzzy subject))
|
|
2663 ;; Just remove the leading "Re:".
|
|
2664 (t
|
|
2665 (gnus-simplify-subject-re subject))))
|
30
|
2666
|
16
|
2667 (if (and gnus-summary-gather-exclude-subject
|
|
2668 (string-match gnus-summary-gather-exclude-subject subject))
|
|
2669 nil ; This article shouldn't be gathered
|
|
2670 subject))
|
|
2671
|
|
2672 (defun gnus-summary-simplify-subject-query ()
|
|
2673 "Query where the respool algorithm would put this article."
|
|
2674 (interactive)
|
|
2675 (gnus-set-global-variables)
|
|
2676 (gnus-summary-select-article)
|
|
2677 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
|
|
2678
|
|
2679 (defun gnus-gather-threads-by-subject (threads)
|
|
2680 "Gather threads by looking at Subject headers."
|
|
2681 (if (not gnus-summary-make-false-root)
|
|
2682 threads
|
|
2683 (let ((hashtb (gnus-make-hashtable 1024))
|
|
2684 (prev threads)
|
|
2685 (result threads)
|
|
2686 subject hthread whole-subject)
|
|
2687 (while threads
|
|
2688 (setq subject (gnus-general-simplify-subject
|
30
|
2689 (setq whole-subject (mail-header-subject
|
16
|
2690 (caar threads)))))
|
|
2691 (when subject
|
|
2692 (if (setq hthread (gnus-gethash subject hashtb))
|
|
2693 (progn
|
|
2694 ;; We enter a dummy root into the thread, if we
|
|
2695 ;; haven't done that already.
|
|
2696 (unless (stringp (caar hthread))
|
|
2697 (setcar hthread (list whole-subject (car hthread))))
|
|
2698 ;; We add this new gathered thread to this gathered
|
|
2699 ;; thread.
|
|
2700 (setcdr (car hthread)
|
|
2701 (nconc (cdar hthread) (list (car threads))))
|
|
2702 ;; Remove it from the list of threads.
|
|
2703 (setcdr prev (cdr threads))
|
|
2704 (setq threads prev))
|
|
2705 ;; Enter this thread into the hash table.
|
|
2706 (gnus-sethash subject threads hashtb)))
|
|
2707 (setq prev threads)
|
|
2708 (setq threads (cdr threads)))
|
|
2709 result)))
|
|
2710
|
|
2711 (defun gnus-gather-threads-by-references (threads)
|
|
2712 "Gather threads by looking at References headers."
|
|
2713 (let ((idhashtb (gnus-make-hashtable 1024))
|
|
2714 (thhashtb (gnus-make-hashtable 1024))
|
|
2715 (prev threads)
|
|
2716 (result threads)
|
|
2717 ids references id gthread gid entered ref)
|
|
2718 (while threads
|
|
2719 (when (setq references (mail-header-references (caar threads)))
|
|
2720 (setq id (mail-header-id (caar threads))
|
|
2721 ids (gnus-split-references references)
|
|
2722 entered nil)
|
|
2723 (while (setq ref (pop ids))
|
|
2724 (setq ids (delete ref ids))
|
|
2725 (if (not (setq gid (gnus-gethash ref idhashtb)))
|
|
2726 (progn
|
|
2727 (gnus-sethash ref id idhashtb)
|
|
2728 (gnus-sethash id threads thhashtb))
|
|
2729 (setq gthread (gnus-gethash gid thhashtb))
|
|
2730 (unless entered
|
|
2731 ;; We enter a dummy root into the thread, if we
|
|
2732 ;; haven't done that already.
|
|
2733 (unless (stringp (caar gthread))
|
|
2734 (setcar gthread (list (mail-header-subject (caar gthread))
|
|
2735 (car gthread))))
|
|
2736 ;; We add this new gathered thread to this gathered
|
|
2737 ;; thread.
|
|
2738 (setcdr (car gthread)
|
|
2739 (nconc (cdar gthread) (list (car threads)))))
|
|
2740 ;; Add it into the thread hash table.
|
|
2741 (gnus-sethash id gthread thhashtb)
|
|
2742 (setq entered t)
|
|
2743 ;; Remove it from the list of threads.
|
|
2744 (setcdr prev (cdr threads))
|
|
2745 (setq threads prev))))
|
|
2746 (setq prev threads)
|
|
2747 (setq threads (cdr threads)))
|
|
2748 result))
|
|
2749
|
|
2750 (defun gnus-sort-gathered-threads (threads)
|
|
2751 "Sort subtreads inside each gathered thread by article number."
|
|
2752 (let ((result threads))
|
|
2753 (while threads
|
|
2754 (when (stringp (caar threads))
|
|
2755 (setcdr (car threads)
|
|
2756 (sort (cdar threads) 'gnus-thread-sort-by-number)))
|
|
2757 (setq threads (cdr threads)))
|
|
2758 result))
|
|
2759
|
|
2760 (defun gnus-thread-loop-p (root thread)
|
|
2761 "Say whether ROOT is in THREAD."
|
|
2762 (let ((th (cdr thread)))
|
|
2763 (while (and th
|
|
2764 (not (eq (caar th) root)))
|
|
2765 (pop th))
|
|
2766 (if th
|
|
2767 ;; We have found a loop.
|
|
2768 (let (ref-dep)
|
|
2769 (setcdr thread (delq (car th) (cdr thread)))
|
|
2770 (if (boundp (setq ref-dep (intern "none"
|
|
2771 gnus-newsgroup-dependencies)))
|
|
2772 (setcdr (symbol-value ref-dep)
|
|
2773 (nconc (cdr (symbol-value ref-dep))
|
|
2774 (list (car th))))
|
|
2775 (set ref-dep (list nil (car th))))
|
|
2776 1)
|
|
2777 ;; Recurse down into the sub-threads and look for loops.
|
|
2778 (apply '+
|
|
2779 (mapcar
|
|
2780 (lambda (thread) (gnus-thread-loop-p root thread))
|
|
2781 (cdr thread))))))
|
|
2782
|
|
2783 (defun gnus-make-threads ()
|
|
2784 "Go through the dependency hashtb and find the roots. Return all threads."
|
|
2785 (let (threads)
|
|
2786 (while (catch 'infloop
|
|
2787 (mapatoms
|
|
2788 (lambda (refs)
|
|
2789 ;; Deal with self-referencing References loops.
|
|
2790 (when (and (car (symbol-value refs))
|
|
2791 (not (zerop
|
30
|
2792 (apply
|
16
|
2793 '+
|
|
2794 (mapcar
|
|
2795 (lambda (thread)
|
|
2796 (gnus-thread-loop-p
|
|
2797 (car (symbol-value refs)) thread))
|
|
2798 (cdr (symbol-value refs)))))))
|
|
2799 (setq threads nil)
|
|
2800 (throw 'infloop t))
|
|
2801 (unless (car (symbol-value refs))
|
|
2802 ;; These threads do not refer back to any other articles,
|
|
2803 ;; so they're roots.
|
|
2804 (setq threads (append (cdr (symbol-value refs)) threads))))
|
|
2805 gnus-newsgroup-dependencies)))
|
|
2806 threads))
|
|
2807
|
|
2808 (defun gnus-build-sparse-threads ()
|
|
2809 (let ((headers gnus-newsgroup-headers)
|
|
2810 (deps gnus-newsgroup-dependencies)
|
30
|
2811 header references generation relations
|
16
|
2812 cthread subject child end pthread relation)
|
30
|
2813 ;; First we create an alist of generations/relations, where
|
16
|
2814 ;; generations is how much we trust the relation, and the relation
|
|
2815 ;; is parent/child.
|
|
2816 (gnus-message 7 "Making sparse threads...")
|
|
2817 (save-excursion
|
|
2818 (nnheader-set-temp-buffer " *gnus sparse threads*")
|
|
2819 (while (setq header (pop headers))
|
|
2820 (when (and (setq references (mail-header-references header))
|
|
2821 (not (string= references "")))
|
|
2822 (insert references)
|
|
2823 (setq child (mail-header-id header)
|
|
2824 subject (mail-header-subject header))
|
|
2825 (setq generation 0)
|
|
2826 (while (search-backward ">" nil t)
|
|
2827 (setq end (1+ (point)))
|
|
2828 (when (search-backward "<" nil t)
|
|
2829 (push (list (incf generation)
|
|
2830 child (setq child (buffer-substring (point) end))
|
|
2831 subject)
|
|
2832 relations)))
|
|
2833 (push (list (1+ generation) child nil subject) relations)
|
|
2834 (erase-buffer)))
|
|
2835 (kill-buffer (current-buffer)))
|
|
2836 ;; Sort over trustworthiness.
|
|
2837 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
|
|
2838 (while (setq relation (pop relations))
|
|
2839 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
|
|
2840 (unless (car (symbol-value cthread))
|
|
2841 ;; Make this article the parent of these threads.
|
|
2842 (setcar (symbol-value cthread)
|
30
|
2843 (vector gnus-reffed-article-number
|
16
|
2844 (cadddr relation)
|
|
2845 "" ""
|
|
2846 (cadr relation)
|
|
2847 (or (caddr relation) "") 0 0 "")))
|
|
2848 (set cthread (list (vector gnus-reffed-article-number
|
|
2849 (cadddr relation)
|
|
2850 "" "" (cadr relation)
|
|
2851 (or (caddr relation) "") 0 0 ""))))
|
|
2852 (push gnus-reffed-article-number gnus-newsgroup-limit)
|
|
2853 (push gnus-reffed-article-number gnus-newsgroup-sparse)
|
|
2854 (push (cons gnus-reffed-article-number gnus-sparse-mark)
|
|
2855 gnus-newsgroup-reads)
|
|
2856 (decf gnus-reffed-article-number)
|
|
2857 ;; Make this new thread the child of its parent.
|
|
2858 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
|
|
2859 (setcdr (symbol-value pthread)
|
|
2860 (nconc (cdr (symbol-value pthread))
|
|
2861 (list (symbol-value cthread))))
|
|
2862 (set pthread (list nil (symbol-value cthread))))))
|
|
2863 (gnus-message 7 "Making sparse threads...done")))
|
|
2864
|
|
2865 (defun gnus-build-old-threads ()
|
|
2866 ;; Look at all the articles that refer back to old articles, and
|
|
2867 ;; fetch the headers for the articles that aren't there. This will
|
|
2868 ;; build complete threads - if the roots haven't been expired by the
|
|
2869 ;; server, that is.
|
|
2870 (let (id heads)
|
|
2871 (mapatoms
|
|
2872 (lambda (refs)
|
|
2873 (when (not (car (symbol-value refs)))
|
|
2874 (setq heads (cdr (symbol-value refs)))
|
|
2875 (while heads
|
|
2876 (if (memq (mail-header-number (caar heads))
|
|
2877 gnus-newsgroup-dormant)
|
|
2878 (setq heads (cdr heads))
|
|
2879 (setq id (symbol-name refs))
|
|
2880 (while (and (setq id (gnus-build-get-header id))
|
|
2881 (not (car (gnus-gethash
|
|
2882 id gnus-newsgroup-dependencies)))))
|
|
2883 (setq heads nil)))))
|
|
2884 gnus-newsgroup-dependencies)))
|
|
2885
|
|
2886 (defun gnus-build-get-header (id)
|
|
2887 ;; Look through the buffer of NOV lines and find the header to
|
|
2888 ;; ID. Enter this line into the dependencies hash table, and return
|
|
2889 ;; the id of the parent article (if any).
|
|
2890 (let ((deps gnus-newsgroup-dependencies)
|
|
2891 found header)
|
|
2892 (prog1
|
|
2893 (save-excursion
|
|
2894 (set-buffer nntp-server-buffer)
|
38
|
2895 (let ((case-fold-search nil))
|
|
2896 (goto-char (point-min))
|
|
2897 (while (and (not found)
|
|
2898 (search-forward id nil t))
|
|
2899 (beginning-of-line)
|
|
2900 (setq found (looking-at
|
|
2901 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
|
|
2902 (regexp-quote id))))
|
|
2903 (or found (beginning-of-line 2)))
|
|
2904 (when found
|
|
2905 (beginning-of-line)
|
|
2906 (and
|
|
2907 (setq header (gnus-nov-parse-line
|
|
2908 (read (current-buffer)) deps))
|
|
2909 (gnus-parent-id (mail-header-references header))))))
|
16
|
2910 (when header
|
|
2911 (let ((number (mail-header-number header)))
|
|
2912 (push number gnus-newsgroup-limit)
|
|
2913 (push header gnus-newsgroup-headers)
|
|
2914 (if (memq number gnus-newsgroup-unselected)
|
|
2915 (progn
|
|
2916 (push number gnus-newsgroup-unreads)
|
|
2917 (setq gnus-newsgroup-unselected
|
|
2918 (delq number gnus-newsgroup-unselected)))
|
|
2919 (push number gnus-newsgroup-ancient)))))))
|
|
2920
|
|
2921 (defun gnus-summary-update-article-line (article header)
|
|
2922 "Update the line for ARTICLE using HEADERS."
|
|
2923 (let* ((id (mail-header-id header))
|
|
2924 (thread (gnus-id-to-thread id)))
|
|
2925 (unless thread
|
|
2926 (error "Article in no thread"))
|
|
2927 ;; Update the thread.
|
|
2928 (setcar thread header)
|
|
2929 (gnus-summary-goto-subject article)
|
|
2930 (let* ((datal (gnus-data-find-list article))
|
|
2931 (data (car datal))
|
|
2932 (length (when (cdr datal)
|
|
2933 (- (gnus-data-pos data)
|
|
2934 (gnus-data-pos (cadr datal)))))
|
|
2935 (buffer-read-only nil)
|
|
2936 (level (gnus-summary-thread-level)))
|
|
2937 (gnus-delete-line)
|
|
2938 (gnus-summary-insert-line
|
|
2939 header level nil (gnus-article-mark article)
|
|
2940 (memq article gnus-newsgroup-replied)
|
|
2941 (memq article gnus-newsgroup-expirable)
|
28
|
2942 ;; Only insert the Subject string when it's different
|
|
2943 ;; from the previous Subject string.
|
36
|
2944 (if (gnus-subject-equal
|
|
2945 (condition-case ()
|
|
2946 (mail-header-subject
|
|
2947 (gnus-data-header
|
|
2948 (cadr
|
|
2949 (gnus-data-find-list
|
|
2950 article
|
|
2951 (gnus-data-list t)))))
|
|
2952 (error ""))
|
|
2953 (mail-header-subject header))
|
|
2954 (mail-header-subject header)
|
|
2955 "")
|
16
|
2956 nil (cdr (assq article gnus-newsgroup-scored))
|
|
2957 (memq article gnus-newsgroup-processable))
|
|
2958 (when length
|
|
2959 (gnus-data-update-list
|
|
2960 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
|
30
|
2961
|
16
|
2962 (defun gnus-summary-update-article (article &optional iheader)
|
|
2963 "Update ARTICLE in the summary buffer."
|
|
2964 (set-buffer gnus-summary-buffer)
|
|
2965 (let* ((header (or iheader (gnus-summary-article-header article)))
|
|
2966 (id (mail-header-id header))
|
|
2967 (data (gnus-data-find article))
|
|
2968 (thread (gnus-id-to-thread id))
|
|
2969 (references (mail-header-references header))
|
|
2970 (parent
|
|
2971 (gnus-id-to-thread
|
30
|
2972 (or (gnus-parent-id
|
16
|
2973 (when (and references
|
|
2974 (not (equal "" references)))
|
|
2975 references))
|
|
2976 "none")))
|
|
2977 (buffer-read-only nil)
|
|
2978 (old (car thread))
|
|
2979 (number (mail-header-number header))
|
|
2980 pos)
|
|
2981 (when thread
|
|
2982 ;; !!! Should this be in or not?
|
|
2983 (unless iheader
|
|
2984 (setcar thread nil))
|
|
2985 (when parent
|
|
2986 (delq thread parent))
|
|
2987 (if (gnus-summary-insert-subject id header iheader)
|
|
2988 ;; Set the (possibly) new article number in the data structure.
|
|
2989 (gnus-data-set-number data (gnus-id-to-article id))
|
|
2990 (setcar thread old)
|
|
2991 nil))))
|
|
2992
|
|
2993 (defun gnus-rebuild-thread (id)
|
|
2994 "Rebuild the thread containing ID."
|
|
2995 (let ((buffer-read-only nil)
|
|
2996 old-pos current thread data)
|
|
2997 (if (not gnus-show-threads)
|
|
2998 (setq thread (list (car (gnus-id-to-thread id))))
|
|
2999 ;; Get the thread this article is part of.
|
|
3000 (setq thread (gnus-remove-thread id)))
|
18
|
3001 (setq old-pos (gnus-point-at-bol))
|
16
|
3002 (setq current (save-excursion
|
|
3003 (and (zerop (forward-line -1))
|
|
3004 (gnus-summary-article-number))))
|
|
3005 ;; If this is a gathered thread, we have to go some re-gathering.
|
|
3006 (when (stringp (car thread))
|
|
3007 (let ((subject (car thread))
|
|
3008 roots thr)
|
|
3009 (setq thread (cdr thread))
|
|
3010 (while thread
|
|
3011 (unless (memq (setq thr (gnus-id-to-thread
|
|
3012 (gnus-root-id
|
|
3013 (mail-header-id (caar thread)))))
|
|
3014 roots)
|
|
3015 (push thr roots))
|
|
3016 (setq thread (cdr thread)))
|
|
3017 ;; We now have all (unique) roots.
|
|
3018 (if (= (length roots) 1)
|
|
3019 ;; All the loose roots are now one solid root.
|
|
3020 (setq thread (car roots))
|
|
3021 (setq thread (cons subject (gnus-sort-threads roots))))))
|
|
3022 (let (threads)
|
|
3023 ;; We then insert this thread into the summary buffer.
|
|
3024 (let (gnus-newsgroup-data gnus-newsgroup-threads)
|
|
3025 (if gnus-show-threads
|
|
3026 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
|
|
3027 (gnus-summary-prepare-unthreaded thread))
|
|
3028 (setq data (nreverse gnus-newsgroup-data))
|
|
3029 (setq threads gnus-newsgroup-threads))
|
|
3030 ;; We splice the new data into the data structure.
|
|
3031 (gnus-data-enter-list current data (- (point) old-pos))
|
|
3032 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
|
|
3033
|
|
3034 (defun gnus-number-to-header (number)
|
|
3035 "Return the header for article NUMBER."
|
|
3036 (let ((headers gnus-newsgroup-headers))
|
|
3037 (while (and headers
|
|
3038 (not (= number (mail-header-number (car headers)))))
|
|
3039 (pop headers))
|
|
3040 (when headers
|
|
3041 (car headers))))
|
|
3042
|
|
3043 (defun gnus-parent-headers (headers &optional generation)
|
|
3044 "Return the headers of the GENERATIONeth parent of HEADERS."
|
30
|
3045 (unless generation
|
16
|
3046 (setq generation 1))
|
|
3047 (let (references parent)
|
|
3048 (while (and headers (not (zerop generation)))
|
|
3049 (setq references (mail-header-references headers))
|
|
3050 (when (and references
|
|
3051 (setq parent (gnus-parent-id references))
|
|
3052 (setq headers (car (gnus-id-to-thread parent))))
|
|
3053 (decf generation)))
|
|
3054 headers))
|
|
3055
|
|
3056 (defun gnus-id-to-thread (id)
|
|
3057 "Return the (sub-)thread where ID appears."
|
|
3058 (gnus-gethash id gnus-newsgroup-dependencies))
|
|
3059
|
|
3060 (defun gnus-id-to-article (id)
|
|
3061 "Return the article number of ID."
|
|
3062 (let ((thread (gnus-id-to-thread id)))
|
|
3063 (when (and thread
|
|
3064 (car thread))
|
|
3065 (mail-header-number (car thread)))))
|
|
3066
|
|
3067 (defun gnus-id-to-header (id)
|
|
3068 "Return the article headers of ID."
|
|
3069 (car (gnus-id-to-thread id)))
|
|
3070
|
|
3071 (defun gnus-article-displayed-root-p (article)
|
|
3072 "Say whether ARTICLE is a root(ish) article."
|
|
3073 (let ((level (gnus-summary-thread-level article))
|
|
3074 (refs (mail-header-references (gnus-summary-article-header article)))
|
|
3075 particle)
|
30
|
3076 (cond
|
16
|
3077 ((null level) nil)
|
|
3078 ((zerop level) t)
|
|
3079 ((null refs) t)
|
|
3080 ((null (gnus-parent-id refs)) t)
|
|
3081 ((and (= 1 level)
|
|
3082 (null (setq particle (gnus-id-to-article
|
|
3083 (gnus-parent-id refs))))
|
|
3084 (null (gnus-summary-thread-level particle)))))))
|
|
3085
|
|
3086 (defun gnus-root-id (id)
|
|
3087 "Return the id of the root of the thread where ID appears."
|
|
3088 (let (last-id prev)
|
30
|
3089 (while (and id (setq prev (car (gnus-gethash
|
16
|
3090 id gnus-newsgroup-dependencies))))
|
|
3091 (setq last-id id
|
|
3092 id (gnus-parent-id (mail-header-references prev))))
|
|
3093 last-id))
|
|
3094
|
|
3095 (defun gnus-remove-thread (id &optional dont-remove)
|
|
3096 "Remove the thread that has ID in it."
|
|
3097 (let ((dep gnus-newsgroup-dependencies)
|
|
3098 headers thread last-id)
|
|
3099 ;; First go up in this thread until we find the root.
|
|
3100 (setq last-id (gnus-root-id id))
|
|
3101 (setq headers (list (car (gnus-id-to-thread last-id))
|
|
3102 (caadr (gnus-id-to-thread last-id))))
|
|
3103 ;; We have now found the real root of this thread. It might have
|
|
3104 ;; been gathered into some loose thread, so we have to search
|
|
3105 ;; through the threads to find the thread we wanted.
|
|
3106 (let ((threads gnus-newsgroup-threads)
|
|
3107 sub)
|
|
3108 (while threads
|
|
3109 (setq sub (car threads))
|
|
3110 (if (stringp (car sub))
|
|
3111 ;; This is a gathered thread, so we look at the roots
|
|
3112 ;; below it to find whether this article is in this
|
|
3113 ;; gathered root.
|
|
3114 (progn
|
|
3115 (setq sub (cdr sub))
|
|
3116 (while sub
|
|
3117 (when (member (caar sub) headers)
|
|
3118 (setq thread (car threads)
|
|
3119 threads nil
|
|
3120 sub nil))
|
|
3121 (setq sub (cdr sub))))
|
|
3122 ;; It's an ordinary thread, so we check it.
|
|
3123 (when (eq (car sub) (car headers))
|
|
3124 (setq thread sub
|
|
3125 threads nil)))
|
|
3126 (setq threads (cdr threads)))
|
|
3127 ;; If this article is in no thread, then it's a root.
|
|
3128 (if thread
|
|
3129 (unless dont-remove
|
|
3130 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
|
|
3131 (setq thread (gnus-gethash last-id dep)))
|
|
3132 (when thread
|
|
3133 (prog1
|
|
3134 thread ; We return this thread.
|
|
3135 (unless dont-remove
|
|
3136 (if (stringp (car thread))
|
|
3137 (progn
|
|
3138 ;; If we use dummy roots, then we have to remove the
|
|
3139 ;; dummy root as well.
|
|
3140 (when (eq gnus-summary-make-false-root 'dummy)
|
|
3141 (gnus-delete-line)
|
|
3142 (gnus-data-compute-positions))
|
|
3143 (setq thread (cdr thread))
|
|
3144 (while thread
|
|
3145 (gnus-remove-thread-1 (car thread))
|
|
3146 (setq thread (cdr thread))))
|
|
3147 (gnus-remove-thread-1 thread))))))))
|
|
3148
|
|
3149 (defun gnus-remove-thread-1 (thread)
|
|
3150 "Remove the thread THREAD recursively."
|
|
3151 (let ((number (mail-header-number (pop thread)))
|
|
3152 d)
|
|
3153 (setq thread (reverse thread))
|
|
3154 (while thread
|
|
3155 (gnus-remove-thread-1 (pop thread)))
|
|
3156 (when (setq d (gnus-data-find number))
|
|
3157 (goto-char (gnus-data-pos d))
|
30
|
3158 (gnus-data-remove
|
16
|
3159 number
|
18
|
3160 (- (gnus-point-at-bol)
|
16
|
3161 (prog1
|
18
|
3162 (1+ (gnus-point-at-eol))
|
16
|
3163 (gnus-delete-line)))))))
|
|
3164
|
|
3165 (defun gnus-sort-threads (threads)
|
|
3166 "Sort THREADS."
|
|
3167 (if (not gnus-thread-sort-functions)
|
|
3168 threads
|
|
3169 (gnus-message 7 "Sorting threads...")
|
|
3170 (prog1
|
|
3171 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
|
|
3172 (gnus-message 7 "Sorting threads...done"))))
|
|
3173
|
|
3174 (defun gnus-sort-articles (articles)
|
|
3175 "Sort ARTICLES."
|
|
3176 (when gnus-article-sort-functions
|
|
3177 (gnus-message 7 "Sorting articles...")
|
|
3178 (prog1
|
|
3179 (setq gnus-newsgroup-headers
|
30
|
3180 (sort articles (gnus-make-sort-function
|
16
|
3181 gnus-article-sort-functions)))
|
|
3182 (gnus-message 7 "Sorting articles...done"))))
|
|
3183
|
|
3184 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
|
|
3185 (defmacro gnus-thread-header (thread)
|
|
3186 ;; Return header of first article in THREAD.
|
|
3187 ;; Note that THREAD must never, ever be anything else than a variable -
|
|
3188 ;; using some other form will lead to serious barfage.
|
|
3189 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
|
|
3190 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
|
|
3191 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
|
|
3192 (vector thread) 2))
|
|
3193
|
|
3194 (defsubst gnus-article-sort-by-number (h1 h2)
|
|
3195 "Sort articles by article number."
|
|
3196 (< (mail-header-number h1)
|
|
3197 (mail-header-number h2)))
|
|
3198
|
|
3199 (defun gnus-thread-sort-by-number (h1 h2)
|
|
3200 "Sort threads by root article number."
|
|
3201 (gnus-article-sort-by-number
|
|
3202 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3203
|
|
3204 (defsubst gnus-article-sort-by-lines (h1 h2)
|
|
3205 "Sort articles by article Lines header."
|
|
3206 (< (mail-header-lines h1)
|
|
3207 (mail-header-lines h2)))
|
|
3208
|
|
3209 (defun gnus-thread-sort-by-lines (h1 h2)
|
|
3210 "Sort threads by root article Lines header."
|
|
3211 (gnus-article-sort-by-lines
|
|
3212 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3213
|
|
3214 (defsubst gnus-article-sort-by-author (h1 h2)
|
|
3215 "Sort articles by root author."
|
|
3216 (string-lessp
|
|
3217 (let ((extract (funcall
|
|
3218 gnus-extract-address-components
|
|
3219 (mail-header-from h1))))
|
32
|
3220 (or (car extract) (cadr extract) ""))
|
16
|
3221 (let ((extract (funcall
|
|
3222 gnus-extract-address-components
|
|
3223 (mail-header-from h2))))
|
32
|
3224 (or (car extract) (cadr extract) ""))))
|
16
|
3225
|
|
3226 (defun gnus-thread-sort-by-author (h1 h2)
|
|
3227 "Sort threads by root author."
|
|
3228 (gnus-article-sort-by-author
|
|
3229 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3230
|
|
3231 (defsubst gnus-article-sort-by-subject (h1 h2)
|
|
3232 "Sort articles by root subject."
|
|
3233 (string-lessp
|
|
3234 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
|
|
3235 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
|
|
3236
|
|
3237 (defun gnus-thread-sort-by-subject (h1 h2)
|
|
3238 "Sort threads by root subject."
|
|
3239 (gnus-article-sort-by-subject
|
|
3240 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3241
|
|
3242 (defsubst gnus-article-sort-by-date (h1 h2)
|
|
3243 "Sort articles by root article date."
|
|
3244 (gnus-time-less
|
|
3245 (gnus-date-get-time (mail-header-date h1))
|
|
3246 (gnus-date-get-time (mail-header-date h2))))
|
|
3247
|
|
3248 (defun gnus-thread-sort-by-date (h1 h2)
|
|
3249 "Sort threads by root article date."
|
|
3250 (gnus-article-sort-by-date
|
|
3251 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3252
|
|
3253 (defsubst gnus-article-sort-by-score (h1 h2)
|
|
3254 "Sort articles by root article score.
|
|
3255 Unscored articles will be counted as having a score of zero."
|
|
3256 (> (or (cdr (assq (mail-header-number h1)
|
|
3257 gnus-newsgroup-scored))
|
|
3258 gnus-summary-default-score 0)
|
|
3259 (or (cdr (assq (mail-header-number h2)
|
|
3260 gnus-newsgroup-scored))
|
|
3261 gnus-summary-default-score 0)))
|
|
3262
|
|
3263 (defun gnus-thread-sort-by-score (h1 h2)
|
|
3264 "Sort threads by root article score."
|
|
3265 (gnus-article-sort-by-score
|
|
3266 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3267
|
|
3268 (defun gnus-thread-sort-by-total-score (h1 h2)
|
|
3269 "Sort threads by the sum of all scores in the thread.
|
|
3270 Unscored articles will be counted as having a score of zero."
|
|
3271 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
|
|
3272
|
|
3273 (defun gnus-thread-total-score (thread)
|
|
3274 ;; This function find the total score of THREAD.
|
|
3275 (cond ((null thread)
|
|
3276 0)
|
|
3277 ((consp thread)
|
|
3278 (if (stringp (car thread))
|
|
3279 (apply gnus-thread-score-function 0
|
|
3280 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
|
|
3281 (gnus-thread-total-score-1 thread)))
|
|
3282 (t
|
|
3283 (gnus-thread-total-score-1 (list thread)))))
|
|
3284
|
|
3285 (defun gnus-thread-total-score-1 (root)
|
|
3286 ;; This function find the total score of the thread below ROOT.
|
|
3287 (setq root (car root))
|
|
3288 (apply gnus-thread-score-function
|
|
3289 (or (append
|
|
3290 (mapcar 'gnus-thread-total-score
|
|
3291 (cdr (gnus-gethash (mail-header-id root)
|
|
3292 gnus-newsgroup-dependencies)))
|
|
3293 (when (> (mail-header-number root) 0)
|
|
3294 (list (or (cdr (assq (mail-header-number root)
|
|
3295 gnus-newsgroup-scored))
|
|
3296 gnus-summary-default-score 0))))
|
|
3297 (list gnus-summary-default-score)
|
|
3298 '(0))))
|
|
3299
|
|
3300 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
3301 (defvar gnus-tmp-prev-subject nil)
|
|
3302 (defvar gnus-tmp-false-parent nil)
|
|
3303 (defvar gnus-tmp-root-expunged nil)
|
|
3304 (defvar gnus-tmp-dummy-line nil)
|
|
3305
|
|
3306 (defun gnus-summary-prepare-threads (threads)
|
|
3307 "Prepare summary buffer from THREADS and indentation LEVEL.
|
|
3308 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
|
|
3309 or a straight list of headers."
|
|
3310 (gnus-message 7 "Generating summary...")
|
|
3311
|
|
3312 (setq gnus-newsgroup-threads threads)
|
|
3313 (beginning-of-line)
|
|
3314
|
|
3315 (let ((gnus-tmp-level 0)
|
|
3316 (default-score (or gnus-summary-default-score 0))
|
|
3317 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
|
|
3318 thread number subject stack state gnus-tmp-gathered beg-match
|
|
3319 new-roots gnus-tmp-new-adopts thread-end
|
|
3320 gnus-tmp-header gnus-tmp-unread
|
|
3321 gnus-tmp-replied gnus-tmp-subject-or-nil
|
|
3322 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
|
|
3323 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
|
|
3324 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
|
|
3325
|
|
3326 (setq gnus-tmp-prev-subject nil)
|
|
3327
|
|
3328 (if (vectorp (car threads))
|
|
3329 ;; If this is a straight (sic) list of headers, then a
|
|
3330 ;; threaded summary display isn't required, so we just create
|
|
3331 ;; an unthreaded one.
|
|
3332 (gnus-summary-prepare-unthreaded threads)
|
|
3333
|
|
3334 ;; Do the threaded display.
|
|
3335
|
|
3336 (while (or threads stack gnus-tmp-new-adopts new-roots)
|
|
3337
|
|
3338 (if (and (= gnus-tmp-level 0)
|
|
3339 (not (setq gnus-tmp-dummy-line nil))
|
|
3340 (or (not stack)
|
|
3341 (= (caar stack) 0))
|
|
3342 (not gnus-tmp-false-parent)
|
|
3343 (or gnus-tmp-new-adopts new-roots))
|
|
3344 (if gnus-tmp-new-adopts
|
|
3345 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
|
|
3346 thread (list (car gnus-tmp-new-adopts))
|
|
3347 gnus-tmp-header (caar thread)
|
|
3348 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
|
|
3349 (when new-roots
|
|
3350 (setq thread (list (car new-roots))
|
|
3351 gnus-tmp-header (caar thread)
|
|
3352 new-roots (cdr new-roots))))
|
|
3353
|
|
3354 (if threads
|
|
3355 ;; If there are some threads, we do them before the
|
|
3356 ;; threads on the stack.
|
|
3357 (setq thread threads
|
|
3358 gnus-tmp-header (caar thread))
|
|
3359 ;; There were no current threads, so we pop something off
|
|
3360 ;; the stack.
|
|
3361 (setq state (car stack)
|
|
3362 gnus-tmp-level (car state)
|
|
3363 thread (cdr state)
|
|
3364 stack (cdr stack)
|
|
3365 gnus-tmp-header (caar thread))))
|
|
3366
|
|
3367 (setq gnus-tmp-false-parent nil)
|
|
3368 (setq gnus-tmp-root-expunged nil)
|
|
3369 (setq thread-end nil)
|
|
3370
|
|
3371 (if (stringp gnus-tmp-header)
|
|
3372 ;; The header is a dummy root.
|
|
3373 (cond
|
|
3374 ((eq gnus-summary-make-false-root 'adopt)
|
|
3375 ;; We let the first article adopt the rest.
|
|
3376 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
|
|
3377 (cddar thread)))
|
|
3378 (setq gnus-tmp-gathered
|
|
3379 (nconc (mapcar
|
|
3380 (lambda (h) (mail-header-number (car h)))
|
|
3381 (cddar thread))
|
|
3382 gnus-tmp-gathered))
|
|
3383 (setq thread (cons (list (caar thread)
|
|
3384 (cadar thread))
|
|
3385 (cdr thread)))
|
|
3386 (setq gnus-tmp-level -1
|
|
3387 gnus-tmp-false-parent t))
|
|
3388 ((eq gnus-summary-make-false-root 'empty)
|
|
3389 ;; We print adopted articles with empty subject fields.
|
|
3390 (setq gnus-tmp-gathered
|
|
3391 (nconc (mapcar
|
|
3392 (lambda (h) (mail-header-number (car h)))
|
|
3393 (cddar thread))
|
|
3394 gnus-tmp-gathered))
|
|
3395 (setq gnus-tmp-level -1))
|
|
3396 ((eq gnus-summary-make-false-root 'dummy)
|
|
3397 ;; We remember that we probably want to output a dummy
|
|
3398 ;; root.
|
|
3399 (setq gnus-tmp-dummy-line gnus-tmp-header)
|
|
3400 (setq gnus-tmp-prev-subject gnus-tmp-header))
|
|
3401 (t
|
|
3402 ;; We do not make a root for the gathered
|
|
3403 ;; sub-threads at all.
|
|
3404 (setq gnus-tmp-level -1)))
|
|
3405
|
|
3406 (setq number (mail-header-number gnus-tmp-header)
|
|
3407 subject (mail-header-subject gnus-tmp-header))
|
|
3408
|
|
3409 (cond
|
|
3410 ;; If the thread has changed subject, we might want to make
|
|
3411 ;; this subthread into a root.
|
|
3412 ((and (null gnus-thread-ignore-subject)
|
|
3413 (not (zerop gnus-tmp-level))
|
|
3414 gnus-tmp-prev-subject
|
|
3415 (not (inline
|
|
3416 (gnus-subject-equal gnus-tmp-prev-subject subject))))
|
|
3417 (setq new-roots (nconc new-roots (list (car thread)))
|
|
3418 thread-end t
|
|
3419 gnus-tmp-header nil))
|
|
3420 ;; If the article lies outside the current limit,
|
|
3421 ;; then we do not display it.
|
|
3422 ((not (memq number gnus-newsgroup-limit))
|
|
3423 (setq gnus-tmp-gathered
|
|
3424 (nconc (mapcar
|
|
3425 (lambda (h) (mail-header-number (car h)))
|
|
3426 (cdar thread))
|
|
3427 gnus-tmp-gathered))
|
|
3428 (setq gnus-tmp-new-adopts (if (cdar thread)
|
|
3429 (append gnus-tmp-new-adopts
|
|
3430 (cdar thread))
|
|
3431 gnus-tmp-new-adopts)
|
|
3432 thread-end t
|
|
3433 gnus-tmp-header nil)
|
|
3434 (when (zerop gnus-tmp-level)
|
|
3435 (setq gnus-tmp-root-expunged t)))
|
|
3436 ;; Perhaps this article is to be marked as read?
|
|
3437 ((and gnus-summary-mark-below
|
|
3438 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3439 default-score)
|
|
3440 gnus-summary-mark-below)
|
|
3441 ;; Don't touch sparse articles.
|
|
3442 (not (gnus-summary-article-sparse-p number))
|
|
3443 (not (gnus-summary-article-ancient-p number)))
|
|
3444 (setq gnus-newsgroup-unreads
|
|
3445 (delq number gnus-newsgroup-unreads))
|
|
3446 (if gnus-newsgroup-auto-expire
|
|
3447 (push number gnus-newsgroup-expirable)
|
|
3448 (push (cons number gnus-low-score-mark)
|
|
3449 gnus-newsgroup-reads))))
|
|
3450
|
|
3451 (when gnus-tmp-header
|
|
3452 ;; We may have an old dummy line to output before this
|
|
3453 ;; article.
|
|
3454 (when gnus-tmp-dummy-line
|
|
3455 (gnus-summary-insert-dummy-line
|
|
3456 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
|
|
3457 (setq gnus-tmp-dummy-line nil))
|
|
3458
|
|
3459 ;; Compute the mark.
|
|
3460 (setq gnus-tmp-unread (gnus-article-mark number))
|
|
3461
|
|
3462 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
|
|
3463 gnus-tmp-header gnus-tmp-level)
|
|
3464 gnus-newsgroup-data)
|
|
3465
|
|
3466 ;; Actually insert the line.
|
|
3467 (setq
|
|
3468 gnus-tmp-subject-or-nil
|
|
3469 (cond
|
|
3470 ((and gnus-thread-ignore-subject
|
|
3471 gnus-tmp-prev-subject
|
|
3472 (not (inline (gnus-subject-equal
|
|
3473 gnus-tmp-prev-subject subject))))
|
|
3474 subject)
|
|
3475 ((zerop gnus-tmp-level)
|
|
3476 (if (and (eq gnus-summary-make-false-root 'empty)
|
|
3477 (memq number gnus-tmp-gathered)
|
|
3478 gnus-tmp-prev-subject
|
|
3479 (inline (gnus-subject-equal
|
|
3480 gnus-tmp-prev-subject subject)))
|
|
3481 gnus-summary-same-subject
|
|
3482 subject))
|
|
3483 (t gnus-summary-same-subject)))
|
|
3484 (if (and (eq gnus-summary-make-false-root 'adopt)
|
|
3485 (= gnus-tmp-level 1)
|
|
3486 (memq number gnus-tmp-gathered))
|
|
3487 (setq gnus-tmp-opening-bracket ?\<
|
|
3488 gnus-tmp-closing-bracket ?\>)
|
|
3489 (setq gnus-tmp-opening-bracket ?\[
|
|
3490 gnus-tmp-closing-bracket ?\]))
|
|
3491 (setq
|
|
3492 gnus-tmp-indentation
|
|
3493 (aref gnus-thread-indent-array gnus-tmp-level)
|
|
3494 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
|
|
3495 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
|
|
3496 gnus-summary-default-score 0)
|
|
3497 gnus-tmp-score-char
|
|
3498 (if (or (null gnus-summary-default-score)
|
|
3499 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
3500 gnus-summary-zcore-fuzz))
|
|
3501 ?
|
|
3502 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
3503 gnus-score-below-mark gnus-score-over-mark))
|
|
3504 gnus-tmp-replied
|
|
3505 (cond ((memq number gnus-newsgroup-processable)
|
|
3506 gnus-process-mark)
|
|
3507 ((memq number gnus-newsgroup-cached)
|
|
3508 gnus-cached-mark)
|
|
3509 ((memq number gnus-newsgroup-replied)
|
|
3510 gnus-replied-mark)
|
|
3511 ((memq number gnus-newsgroup-saved)
|
|
3512 gnus-saved-mark)
|
|
3513 (t gnus-unread-mark))
|
|
3514 gnus-tmp-from (mail-header-from gnus-tmp-header)
|
|
3515 gnus-tmp-name
|
|
3516 (cond
|
|
3517 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
3518 (setq beg-match (match-beginning 0))
|
|
3519 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
3520 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
3521 (1- (match-end 0))))
|
|
3522 (substring gnus-tmp-from 0 beg-match)))
|
|
3523 ((string-match "(.+)" gnus-tmp-from)
|
|
3524 (substring gnus-tmp-from
|
|
3525 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
3526 (t gnus-tmp-from)))
|
|
3527 (when (string= gnus-tmp-name "")
|
|
3528 (setq gnus-tmp-name gnus-tmp-from))
|
|
3529 (unless (numberp gnus-tmp-lines)
|
|
3530 (setq gnus-tmp-lines 0))
|
|
3531 (gnus-put-text-property
|
|
3532 (point)
|
|
3533 (progn (eval gnus-summary-line-format-spec) (point))
|
|
3534 'gnus-number number)
|
|
3535 (when gnus-visual-p
|
|
3536 (forward-line -1)
|
|
3537 (run-hooks 'gnus-summary-update-hook)
|
|
3538 (forward-line 1))
|
|
3539
|
|
3540 (setq gnus-tmp-prev-subject subject)))
|
|
3541
|
|
3542 (when (nth 1 thread)
|
|
3543 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
|
|
3544 (incf gnus-tmp-level)
|
|
3545 (setq threads (if thread-end nil (cdar thread)))
|
|
3546 (unless threads
|
|
3547 (setq gnus-tmp-level 0)))))
|
|
3548 (gnus-message 7 "Generating summary...done"))
|
|
3549
|
|
3550 (defun gnus-summary-prepare-unthreaded (headers)
|
|
3551 "Generate an unthreaded summary buffer based on HEADERS."
|
|
3552 (let (header number mark)
|
|
3553
|
22
|
3554 (beginning-of-line)
|
|
3555
|
16
|
3556 (while headers
|
|
3557 ;; We may have to root out some bad articles...
|
|
3558 (when (memq (setq number (mail-header-number
|
|
3559 (setq header (pop headers))))
|
|
3560 gnus-newsgroup-limit)
|
|
3561 ;; Mark article as read when it has a low score.
|
|
3562 (when (and gnus-summary-mark-below
|
|
3563 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3564 gnus-summary-default-score 0)
|
|
3565 gnus-summary-mark-below)
|
|
3566 (not (gnus-summary-article-ancient-p number)))
|
|
3567 (setq gnus-newsgroup-unreads
|
|
3568 (delq number gnus-newsgroup-unreads))
|
|
3569 (if gnus-newsgroup-auto-expire
|
|
3570 (push number gnus-newsgroup-expirable)
|
|
3571 (push (cons number gnus-low-score-mark)
|
|
3572 gnus-newsgroup-reads)))
|
|
3573
|
|
3574 (setq mark (gnus-article-mark number))
|
|
3575 (push (gnus-data-make number mark (1+ (point)) header 0)
|
|
3576 gnus-newsgroup-data)
|
|
3577 (gnus-summary-insert-line
|
|
3578 header 0 number
|
|
3579 mark (memq number gnus-newsgroup-replied)
|
|
3580 (memq number gnus-newsgroup-expirable)
|
|
3581 (mail-header-subject header) nil
|
|
3582 (cdr (assq number gnus-newsgroup-scored))
|
|
3583 (memq number gnus-newsgroup-processable))))))
|
|
3584
|
|
3585 (defun gnus-select-newsgroup (group &optional read-all)
|
|
3586 "Select newsgroup GROUP.
|
|
3587 If READ-ALL is non-nil, all articles in the group are selected."
|
|
3588 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
3589 (info (nth 2 entry))
|
|
3590 articles fetched-articles cached)
|
|
3591
|
|
3592 (unless (gnus-check-server
|
30
|
3593 (setq gnus-current-select-method
|
16
|
3594 (gnus-find-method-for-group group)))
|
|
3595 (error "Couldn't open server"))
|
|
3596
|
|
3597 (or (and entry (not (eq (car entry) t))) ; Either it's active...
|
|
3598 (gnus-activate-group group) ; Or we can activate it...
|
|
3599 (progn ; Or we bug out.
|
|
3600 (when (equal major-mode 'gnus-summary-mode)
|
|
3601 (kill-buffer (current-buffer)))
|
|
3602 (error "Couldn't request group %s: %s"
|
|
3603 group (gnus-status-message group))))
|
|
3604
|
|
3605 (unless (gnus-request-group group t)
|
|
3606 (when (equal major-mode 'gnus-summary-mode)
|
|
3607 (kill-buffer (current-buffer)))
|
|
3608 (error "Couldn't request group %s: %s"
|
|
3609 group (gnus-status-message group)))
|
|
3610
|
|
3611 (setq gnus-newsgroup-name group)
|
|
3612 (setq gnus-newsgroup-unselected nil)
|
|
3613 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
|
|
3614
|
|
3615 ;; Adjust and set lists of article marks.
|
|
3616 (when info
|
|
3617 (gnus-adjust-marked-articles info))
|
|
3618
|
|
3619 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3620 (when (gnus-virtual-group-p group)
|
|
3621 (setq cached gnus-newsgroup-cached))
|
|
3622
|
|
3623 (setq gnus-newsgroup-unreads
|
|
3624 (gnus-set-difference
|
|
3625 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
|
|
3626 gnus-newsgroup-dormant))
|
|
3627
|
|
3628 (setq gnus-newsgroup-processable nil)
|
|
3629
|
22
|
3630 (gnus-update-read-articles group gnus-newsgroup-unreads)
|
|
3631 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
3632 (gnus-group-update-group group))
|
30
|
3633
|
16
|
3634 (setq articles (gnus-articles-to-read group read-all))
|
|
3635
|
|
3636 (cond
|
|
3637 ((null articles)
|
|
3638 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
|
|
3639 'quit)
|
|
3640 ((eq articles 0) nil)
|
|
3641 (t
|
|
3642 ;; Init the dependencies hash table.
|
|
3643 (setq gnus-newsgroup-dependencies
|
|
3644 (gnus-make-hashtable (length articles)))
|
|
3645 ;; Retrieve the headers and read them in.
|
|
3646 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
|
|
3647 (setq gnus-newsgroup-headers
|
|
3648 (if (eq 'nov
|
|
3649 (setq gnus-headers-retrieved-by
|
|
3650 (gnus-retrieve-headers
|
|
3651 articles gnus-newsgroup-name
|
|
3652 ;; We might want to fetch old headers, but
|
|
3653 ;; not if there is only 1 article.
|
|
3654 (and gnus-fetch-old-headers
|
|
3655 (or (and
|
|
3656 (not (eq gnus-fetch-old-headers 'some))
|
|
3657 (not (numberp gnus-fetch-old-headers)))
|
|
3658 (> (length articles) 1))))))
|
30
|
3659 (gnus-get-newsgroup-headers-xover
|
16
|
3660 articles nil nil gnus-newsgroup-name t)
|
|
3661 (gnus-get-newsgroup-headers)))
|
|
3662 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
|
|
3663
|
|
3664 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3665 (when cached
|
|
3666 (setq gnus-newsgroup-cached cached))
|
|
3667
|
|
3668 ;; Suppress duplicates?
|
|
3669 (when gnus-suppress-duplicates
|
|
3670 (gnus-dup-suppress-articles))
|
|
3671
|
|
3672 ;; Set the initial limit.
|
|
3673 (setq gnus-newsgroup-limit (copy-sequence articles))
|
|
3674 ;; Remove canceled articles from the list of unread articles.
|
|
3675 (setq gnus-newsgroup-unreads
|
|
3676 (gnus-set-sorted-intersection
|
|
3677 gnus-newsgroup-unreads
|
|
3678 (setq fetched-articles
|
|
3679 (mapcar (lambda (headers) (mail-header-number headers))
|
|
3680 gnus-newsgroup-headers))))
|
|
3681 ;; Removed marked articles that do not exist.
|
|
3682 (gnus-update-missing-marks
|
|
3683 (gnus-sorted-complement fetched-articles articles))
|
|
3684 ;; We might want to build some more threads first.
|
|
3685 (and gnus-fetch-old-headers
|
|
3686 (eq gnus-headers-retrieved-by 'nov)
|
|
3687 (gnus-build-old-threads))
|
|
3688 ;; Check whether auto-expire is to be done in this group.
|
|
3689 (setq gnus-newsgroup-auto-expire
|
|
3690 (gnus-group-auto-expirable-p group))
|
|
3691 ;; Set up the article buffer now, if necessary.
|
|
3692 (unless gnus-single-article-buffer
|
|
3693 (gnus-article-setup-buffer))
|
|
3694 ;; First and last article in this newsgroup.
|
|
3695 (when gnus-newsgroup-headers
|
|
3696 (setq gnus-newsgroup-begin
|
|
3697 (mail-header-number (car gnus-newsgroup-headers))
|
|
3698 gnus-newsgroup-end
|
|
3699 (mail-header-number
|
|
3700 (gnus-last-element gnus-newsgroup-headers))))
|
|
3701 ;; GROUP is successfully selected.
|
|
3702 (or gnus-newsgroup-headers t)))))
|
|
3703
|
|
3704 (defun gnus-articles-to-read (group &optional read-all)
|
|
3705 ;; Find out what articles the user wants to read.
|
|
3706 (let* ((articles
|
|
3707 ;; Select all articles if `read-all' is non-nil, or if there
|
|
3708 ;; are no unread articles.
|
|
3709 (if (or read-all
|
|
3710 (and (zerop (length gnus-newsgroup-marked))
|
|
3711 (zerop (length gnus-newsgroup-unreads)))
|
|
3712 (eq (gnus-group-find-parameter group 'display)
|
|
3713 'all))
|
|
3714 (gnus-uncompress-range (gnus-active group))
|
|
3715 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
|
|
3716 (copy-sequence gnus-newsgroup-unreads))
|
|
3717 '<)))
|
|
3718 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
|
|
3719 (scored (length scored-list))
|
|
3720 (number (length articles))
|
|
3721 (marked (+ (length gnus-newsgroup-marked)
|
|
3722 (length gnus-newsgroup-dormant)))
|
|
3723 (select
|
|
3724 (cond
|
|
3725 ((numberp read-all)
|
|
3726 read-all)
|
|
3727 (t
|
|
3728 (condition-case ()
|
|
3729 (cond
|
|
3730 ((and (or (<= scored marked) (= scored number))
|
|
3731 (numberp gnus-large-newsgroup)
|
|
3732 (> number gnus-large-newsgroup))
|
|
3733 (let ((input
|
|
3734 (read-string
|
|
3735 (format
|
|
3736 "How many articles from %s (default %d): "
|
|
3737 (gnus-limit-string gnus-newsgroup-name 35)
|
|
3738 number))))
|
|
3739 (if (string-match "^[ \t]*$" input) number input)))
|
|
3740 ((and (> scored marked) (< scored number)
|
|
3741 (> (- scored number) 20))
|
|
3742 (let ((input
|
|
3743 (read-string
|
|
3744 (format "%s %s (%d scored, %d total): "
|
|
3745 "How many articles from"
|
|
3746 group scored number))))
|
|
3747 (if (string-match "^[ \t]*$" input)
|
|
3748 number input)))
|
|
3749 (t number))
|
|
3750 (quit nil))))))
|
|
3751 (setq select (if (stringp select) (string-to-number select) select))
|
|
3752 (if (or (null select) (zerop select))
|
|
3753 select
|
|
3754 (if (and (not (zerop scored)) (<= (abs select) scored))
|
|
3755 (progn
|
|
3756 (setq articles (sort scored-list '<))
|
|
3757 (setq number (length articles)))
|
|
3758 (setq articles (copy-sequence articles)))
|
|
3759
|
|
3760 (when (< (abs select) number)
|
|
3761 (if (< select 0)
|
|
3762 ;; Select the N oldest articles.
|
|
3763 (setcdr (nthcdr (1- (abs select)) articles) nil)
|
|
3764 ;; Select the N most recent articles.
|
|
3765 (setq articles (nthcdr (- number select) articles))))
|
|
3766 (setq gnus-newsgroup-unselected
|
|
3767 (gnus-sorted-intersection
|
|
3768 gnus-newsgroup-unreads
|
|
3769 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
|
|
3770 articles)))
|
|
3771
|
|
3772 (defun gnus-killed-articles (killed articles)
|
|
3773 (let (out)
|
|
3774 (while articles
|
|
3775 (when (inline (gnus-member-of-range (car articles) killed))
|
|
3776 (push (car articles) out))
|
|
3777 (setq articles (cdr articles)))
|
|
3778 out))
|
|
3779
|
|
3780 (defun gnus-uncompress-marks (marks)
|
|
3781 "Uncompress the mark ranges in MARKS."
|
|
3782 (let ((uncompressed '(score bookmark))
|
|
3783 out)
|
|
3784 (while marks
|
|
3785 (if (memq (caar marks) uncompressed)
|
|
3786 (push (car marks) out)
|
|
3787 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
|
|
3788 (setq marks (cdr marks)))
|
|
3789 out))
|
|
3790
|
|
3791 (defun gnus-adjust-marked-articles (info)
|
|
3792 "Set all article lists and remove all marks that are no longer legal."
|
|
3793 (let* ((marked-lists (gnus-info-marks info))
|
|
3794 (active (gnus-active (gnus-info-group info)))
|
|
3795 (min (car active))
|
|
3796 (max (cdr active))
|
|
3797 (types gnus-article-mark-lists)
|
|
3798 (uncompressed '(score bookmark killed))
|
|
3799 marks var articles article mark)
|
|
3800
|
|
3801 (while marked-lists
|
|
3802 (setq marks (pop marked-lists))
|
|
3803 (set (setq var (intern (format "gnus-newsgroup-%s"
|
|
3804 (car (rassq (setq mark (car marks))
|
|
3805 types)))))
|
|
3806 (if (memq (car marks) uncompressed) (cdr marks)
|
|
3807 (gnus-uncompress-range (cdr marks))))
|
|
3808
|
|
3809 (setq articles (symbol-value var))
|
|
3810
|
|
3811 ;; All articles have to be subsets of the active articles.
|
|
3812 (cond
|
|
3813 ;; Adjust "simple" lists.
|
|
3814 ((memq mark '(tick dormant expirable reply save))
|
|
3815 (while articles
|
|
3816 (when (or (< (setq article (pop articles)) min) (> article max))
|
|
3817 (set var (delq article (symbol-value var))))))
|
|
3818 ;; Adjust assocs.
|
|
3819 ((memq mark uncompressed)
|
|
3820 (while articles
|
|
3821 (when (or (not (consp (setq article (pop articles))))
|
|
3822 (< (car article) min)
|
|
3823 (> (car article) max))
|
|
3824 (set var (delq article (symbol-value var))))))))))
|
|
3825
|
|
3826 (defun gnus-update-missing-marks (missing)
|
|
3827 "Go through the list of MISSING articles and remove them mark lists."
|
|
3828 (when missing
|
|
3829 (let ((types gnus-article-mark-lists)
|
|
3830 var m)
|
|
3831 ;; Go through all types.
|
|
3832 (while types
|
|
3833 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
|
|
3834 (when (symbol-value var)
|
|
3835 ;; This list has articles. So we delete all missing articles
|
|
3836 ;; from it.
|
|
3837 (setq m missing)
|
|
3838 (while m
|
|
3839 (set var (delq (pop m) (symbol-value var)))))))))
|
|
3840
|
|
3841 (defun gnus-update-marks ()
|
|
3842 "Enter the various lists of marked articles into the newsgroup info list."
|
|
3843 (let ((types gnus-article-mark-lists)
|
|
3844 (info (gnus-get-info gnus-newsgroup-name))
|
|
3845 (uncompressed '(score bookmark killed))
|
|
3846 type list newmarked symbol)
|
|
3847 (when info
|
|
3848 ;; Add all marks lists that are non-nil to the list of marks lists.
|
34
|
3849 (while (setq type (pop types))
|
16
|
3850 (when (setq list (symbol-value
|
|
3851 (setq symbol
|
|
3852 (intern (format "gnus-newsgroup-%s"
|
|
3853 (car type))))))
|
34
|
3854
|
|
3855 ;; Get rid of the entries of the articles that have the
|
|
3856 ;; default score.
|
|
3857 (when (and (eq (cdr type) 'score)
|
|
3858 gnus-save-score
|
|
3859 list)
|
|
3860 (let* ((arts list)
|
36
|
3861 (prev (cons nil list))
|
34
|
3862 (all prev))
|
|
3863 (while arts
|
|
3864 (if (or (not (consp (car arts)))
|
|
3865 (= (cdar arts) gnus-summary-default-score))
|
|
3866 (setcdr prev (cdr arts))
|
|
3867 (setq prev arts))
|
|
3868 (setq arts (cdr arts)))
|
|
3869 (setq list (cdr all))))
|
|
3870
|
16
|
3871 (push (cons (cdr type)
|
|
3872 (if (memq (cdr type) uncompressed) list
|
30
|
3873 (gnus-compress-sequence
|
16
|
3874 (set symbol (sort list '<)) t)))
|
|
3875 newmarked)))
|
|
3876
|
|
3877 ;; Enter these new marks into the info of the group.
|
|
3878 (if (nthcdr 3 info)
|
|
3879 (setcar (nthcdr 3 info) newmarked)
|
|
3880 ;; Add the marks lists to the end of the info.
|
|
3881 (when newmarked
|
|
3882 (setcdr (nthcdr 2 info) (list newmarked))))
|
|
3883
|
|
3884 ;; Cut off the end of the info if there's nothing else there.
|
|
3885 (let ((i 5))
|
|
3886 (while (and (> i 2)
|
|
3887 (not (nth i info)))
|
|
3888 (when (nthcdr (decf i) info)
|
|
3889 (setcdr (nthcdr i info) nil)))))))
|
|
3890
|
|
3891 (defun gnus-set-mode-line (where)
|
|
3892 "This function sets the mode line of the article or summary buffers.
|
|
3893 If WHERE is `summary', the summary mode line format will be used."
|
|
3894 ;; Is this mode line one we keep updated?
|
|
3895 (when (memq where gnus-updated-mode-lines)
|
|
3896 (let (mode-string)
|
|
3897 (save-excursion
|
|
3898 ;; We evaluate this in the summary buffer since these
|
|
3899 ;; variables are buffer-local to that buffer.
|
|
3900 (set-buffer gnus-summary-buffer)
|
|
3901 ;; We bind all these variables that are used in the `eval' form
|
|
3902 ;; below.
|
|
3903 (let* ((mformat (symbol-value
|
|
3904 (intern
|
|
3905 (format "gnus-%s-mode-line-format-spec" where))))
|
|
3906 (gnus-tmp-group-name gnus-newsgroup-name)
|
|
3907 (gnus-tmp-article-number (or gnus-current-article 0))
|
|
3908 (gnus-tmp-unread gnus-newsgroup-unreads)
|
|
3909 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
|
|
3910 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
|
|
3911 (gnus-tmp-unread-and-unselected
|
|
3912 (cond ((and (zerop gnus-tmp-unread-and-unticked)
|
|
3913 (zerop gnus-tmp-unselected))
|
|
3914 "")
|
|
3915 ((zerop gnus-tmp-unselected)
|
|
3916 (format "{%d more}" gnus-tmp-unread-and-unticked))
|
|
3917 (t (format "{%d(+%d) more}"
|
|
3918 gnus-tmp-unread-and-unticked
|
|
3919 gnus-tmp-unselected))))
|
|
3920 (gnus-tmp-subject
|
|
3921 (if (and gnus-current-headers
|
|
3922 (vectorp gnus-current-headers))
|
|
3923 (gnus-mode-string-quote
|
|
3924 (mail-header-subject gnus-current-headers))
|
|
3925 ""))
|
28
|
3926 bufname-length max-len
|
16
|
3927 gnus-tmp-header);; passed as argument to any user-format-funcs
|
|
3928 (setq mode-string (eval mformat))
|
28
|
3929 (setq bufname-length (if (string-match "%b" mode-string)
|
|
3930 (- (length
|
|
3931 (buffer-name
|
|
3932 (if (eq where 'summary)
|
|
3933 nil
|
|
3934 (get-buffer gnus-article-buffer))))
|
|
3935 2)
|
|
3936 0))
|
16
|
3937 (setq max-len (max 4 (if gnus-mode-non-string-length
|
|
3938 (- (window-width)
|
26
|
3939 gnus-mode-non-string-length
|
28
|
3940 bufname-length)
|
16
|
3941 (length mode-string))))
|
|
3942 ;; We might have to chop a bit of the string off...
|
|
3943 (when (> (length mode-string) max-len)
|
|
3944 (setq mode-string
|
|
3945 (concat (gnus-truncate-string mode-string (- max-len 3))
|
|
3946 "...")))
|
|
3947 ;; Pad the mode string a bit.
|
|
3948 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
|
|
3949 ;; Update the mode line.
|
30
|
3950 (setq mode-line-buffer-identification
|
24
|
3951 (gnus-mode-line-buffer-identification (list mode-string)))
|
16
|
3952 (set-buffer-modified-p t))))
|
|
3953
|
|
3954 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
|
|
3955 "Go through the HEADERS list and add all Xrefs to a hash table.
|
|
3956 The resulting hash table is returned, or nil if no Xrefs were found."
|
|
3957 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3958 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
|
|
3959 (xref-hashtb (gnus-make-hashtable))
|
|
3960 start group entry number xrefs header)
|
|
3961 (while headers
|
|
3962 (setq header (pop headers))
|
|
3963 (when (and (setq xrefs (mail-header-xref header))
|
|
3964 (not (memq (setq number (mail-header-number header))
|
|
3965 unreads)))
|
|
3966 (setq start 0)
|
|
3967 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
|
|
3968 (setq start (match-end 0))
|
|
3969 (setq group (if prefix
|
|
3970 (concat prefix (substring xrefs (match-beginning 1)
|
|
3971 (match-end 1)))
|
|
3972 (substring xrefs (match-beginning 1) (match-end 1))))
|
|
3973 (setq number
|
|
3974 (string-to-int (substring xrefs (match-beginning 2)
|
|
3975 (match-end 2))))
|
|
3976 (if (setq entry (gnus-gethash group xref-hashtb))
|
|
3977 (setcdr entry (cons number (cdr entry)))
|
|
3978 (gnus-sethash group (cons number nil) xref-hashtb)))))
|
|
3979 (and start xref-hashtb)))
|
|
3980
|
|
3981 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
|
|
3982 "Look through all the headers and mark the Xrefs as read."
|
|
3983 (let ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3984 name entry info xref-hashtb idlist method nth4)
|
|
3985 (save-excursion
|
|
3986 (set-buffer gnus-group-buffer)
|
|
3987 (when (setq xref-hashtb
|
|
3988 (gnus-create-xref-hashtb from-newsgroup headers unreads))
|
|
3989 (mapatoms
|
|
3990 (lambda (group)
|
|
3991 (unless (string= from-newsgroup (setq name (symbol-name group)))
|
|
3992 (setq idlist (symbol-value group))
|
|
3993 ;; Dead groups are not updated.
|
|
3994 (and (prog1
|
|
3995 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
|
|
3996 info (nth 2 entry))
|
|
3997 (when (stringp (setq nth4 (gnus-info-method info)))
|
|
3998 (setq nth4 (gnus-server-to-method nth4))))
|
|
3999 ;; Only do the xrefs if the group has the same
|
|
4000 ;; select method as the group we have just read.
|
|
4001 (or (gnus-methods-equal-p
|
|
4002 nth4 (gnus-find-method-for-group from-newsgroup))
|
|
4003 virtual
|
|
4004 (equal nth4 (setq method (gnus-find-method-for-group
|
|
4005 from-newsgroup)))
|
|
4006 (and (equal (car nth4) (car method))
|
|
4007 (equal (nth 1 nth4) (nth 1 method))))
|
|
4008 gnus-use-cross-reference
|
|
4009 (or (not (eq gnus-use-cross-reference t))
|
|
4010 virtual
|
|
4011 ;; Only do cross-references on subscribed
|
|
4012 ;; groups, if that is what is wanted.
|
|
4013 (<= (gnus-info-level info) gnus-level-subscribed))
|
|
4014 (gnus-group-make-articles-read name idlist))))
|
|
4015 xref-hashtb)))))
|
|
4016
|
|
4017 (defun gnus-group-make-articles-read (group articles)
|
34
|
4018 "Update the info of GROUP to say that ARTICLES are read."
|
16
|
4019 (let* ((num 0)
|
|
4020 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
4021 (info (nth 2 entry))
|
|
4022 (active (gnus-active group))
|
|
4023 range)
|
|
4024 ;; First peel off all illegal article numbers.
|
|
4025 (when active
|
|
4026 (let ((ids articles)
|
|
4027 id first)
|
|
4028 (while (setq id (pop ids))
|
|
4029 (when (and first (> id (cdr active)))
|
|
4030 ;; We'll end up in this situation in one particular
|
|
4031 ;; obscure situation. If you re-scan a group and get
|
|
4032 ;; a new article that is cross-posted to a different
|
|
4033 ;; group that has not been re-scanned, you might get
|
|
4034 ;; crossposted article that has a higher number than
|
|
4035 ;; Gnus believes possible. So we re-activate this
|
|
4036 ;; group as well. This might mean doing the
|
|
4037 ;; crossposting thingy will *increase* the number
|
|
4038 ;; of articles in some groups. Tsk, tsk.
|
|
4039 (setq active (or (gnus-activate-group group) active)))
|
|
4040 (when (or (> id (cdr active))
|
|
4041 (< id (car active)))
|
|
4042 (setq articles (delq id articles))))))
|
|
4043 (save-excursion
|
|
4044 (set-buffer gnus-group-buffer)
|
|
4045 (gnus-undo-register
|
|
4046 `(progn
|
|
4047 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
4048 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
4049 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
4050 (gnus-group-update-group ,group t))))
|
|
4051 ;; If the read list is nil, we init it.
|
|
4052 (and active
|
|
4053 (null (gnus-info-read info))
|
|
4054 (> (car active) 1)
|
|
4055 (gnus-info-set-read info (cons 1 (1- (car active)))))
|
|
4056 ;; Then we add the read articles to the range.
|
|
4057 (gnus-info-set-read
|
|
4058 info
|
|
4059 (setq range
|
|
4060 (gnus-add-to-range
|
|
4061 (gnus-info-read info) (setq articles (sort articles '<)))))
|
|
4062 ;; Then we have to re-compute how many unread
|
|
4063 ;; articles there are in this group.
|
|
4064 (when active
|
|
4065 (cond
|
|
4066 ((not range)
|
|
4067 (setq num (- (1+ (cdr active)) (car active))))
|
|
4068 ((not (listp (cdr range)))
|
|
4069 (setq num (- (cdr active) (- (1+ (cdr range))
|
|
4070 (car range)))))
|
|
4071 (t
|
|
4072 (while range
|
|
4073 (if (numberp (car range))
|
|
4074 (setq num (1+ num))
|
|
4075 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
|
|
4076 (setq range (cdr range)))
|
|
4077 (setq num (- (cdr active) num))))
|
|
4078 ;; Update the number of unread articles.
|
|
4079 (setcar entry num)
|
|
4080 ;; Update the group buffer.
|
|
4081 (gnus-group-update-group group t))))
|
|
4082
|
|
4083 (defun gnus-methods-equal-p (m1 m2)
|
|
4084 (let ((m1 (or m1 gnus-select-method))
|
|
4085 (m2 (or m2 gnus-select-method)))
|
|
4086 (or (equal m1 m2)
|
|
4087 (and (eq (car m1) (car m2))
|
|
4088 (or (not (memq 'address (assoc (symbol-name (car m1))
|
|
4089 gnus-valid-select-methods)))
|
|
4090 (equal (nth 1 m1) (nth 1 m2)))))))
|
|
4091
|
|
4092 (defvar gnus-newsgroup-none-id 0)
|
|
4093
|
|
4094 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
|
|
4095 (let ((cur nntp-server-buffer)
|
|
4096 (dependencies
|
|
4097 (or dependencies
|
|
4098 (save-excursion (set-buffer gnus-summary-buffer)
|
|
4099 gnus-newsgroup-dependencies)))
|
|
4100 headers id id-dep ref-dep end ref)
|
|
4101 (save-excursion
|
|
4102 (set-buffer nntp-server-buffer)
|
|
4103 ;; Translate all TAB characters into SPACE characters.
|
|
4104 (subst-char-in-region (point-min) (point-max) ?\t ? t)
|
|
4105 (run-hooks 'gnus-parse-headers-hook)
|
|
4106 (let ((case-fold-search t)
|
|
4107 in-reply-to header p lines)
|
|
4108 (goto-char (point-min))
|
|
4109 ;; Search to the beginning of the next header. Error messages
|
|
4110 ;; do not begin with 2 or 3.
|
|
4111 (while (re-search-forward "^[23][0-9]+ " nil t)
|
|
4112 (setq id nil
|
|
4113 ref nil)
|
|
4114 ;; This implementation of this function, with nine
|
|
4115 ;; search-forwards instead of the one re-search-forward and
|
|
4116 ;; a case (which basically was the old function) is actually
|
|
4117 ;; about twice as fast, even though it looks messier. You
|
|
4118 ;; can't have everything, I guess. Speed and elegance
|
|
4119 ;; doesn't always go hand in hand.
|
|
4120 (setq
|
|
4121 header
|
|
4122 (vector
|
|
4123 ;; Number.
|
|
4124 (prog1
|
|
4125 (read cur)
|
|
4126 (end-of-line)
|
|
4127 (setq p (point))
|
|
4128 (narrow-to-region (point)
|
|
4129 (or (and (search-forward "\n.\n" nil t)
|
|
4130 (- (point) 2))
|
|
4131 (point))))
|
|
4132 ;; Subject.
|
|
4133 (progn
|
|
4134 (goto-char p)
|
|
4135 (if (search-forward "\nsubject: " nil t)
|
|
4136 (nnheader-header-value) "(none)"))
|
|
4137 ;; From.
|
|
4138 (progn
|
|
4139 (goto-char p)
|
|
4140 (if (search-forward "\nfrom: " nil t)
|
|
4141 (nnheader-header-value) "(nobody)"))
|
|
4142 ;; Date.
|
|
4143 (progn
|
|
4144 (goto-char p)
|
|
4145 (if (search-forward "\ndate: " nil t)
|
|
4146 (nnheader-header-value) ""))
|
|
4147 ;; Message-ID.
|
|
4148 (progn
|
|
4149 (goto-char p)
|
34
|
4150 (setq id (if (search-forward "\nmessage-id:" nil t)
|
|
4151 (buffer-substring
|
|
4152 (1- (or (search-forward "<" nil t) (point)))
|
|
4153 (or (search-forward ">" nil t) (point)))
|
16
|
4154 ;; If there was no message-id, we just fake one
|
|
4155 ;; to make subsequent routines simpler.
|
|
4156 (nnheader-generate-fake-message-id))))
|
|
4157 ;; References.
|
|
4158 (progn
|
|
4159 (goto-char p)
|
|
4160 (if (search-forward "\nreferences: " nil t)
|
|
4161 (progn
|
|
4162 (setq end (point))
|
|
4163 (prog1
|
|
4164 (nnheader-header-value)
|
|
4165 (setq ref
|
|
4166 (buffer-substring
|
|
4167 (progn
|
|
4168 (end-of-line)
|
|
4169 (search-backward ">" end t)
|
|
4170 (1+ (point)))
|
|
4171 (progn
|
|
4172 (search-backward "<" end t)
|
|
4173 (point))))))
|
|
4174 ;; Get the references from the in-reply-to header if there
|
|
4175 ;; were no references and the in-reply-to header looks
|
|
4176 ;; promising.
|
|
4177 (if (and (search-forward "\nin-reply-to: " nil t)
|
|
4178 (setq in-reply-to (nnheader-header-value))
|
|
4179 (string-match "<[^>]+>" in-reply-to))
|
|
4180 (setq ref (substring in-reply-to (match-beginning 0)
|
|
4181 (match-end 0)))
|
|
4182 (setq ref nil))))
|
|
4183 ;; Chars.
|
|
4184 0
|
|
4185 ;; Lines.
|
|
4186 (progn
|
|
4187 (goto-char p)
|
|
4188 (if (search-forward "\nlines: " nil t)
|
|
4189 (if (numberp (setq lines (read cur)))
|
|
4190 lines 0)
|
|
4191 0))
|
|
4192 ;; Xref.
|
|
4193 (progn
|
|
4194 (goto-char p)
|
|
4195 (and (search-forward "\nxref: " nil t)
|
|
4196 (nnheader-header-value)))))
|
|
4197 (when (equal id ref)
|
|
4198 (setq ref nil))
|
|
4199 ;; We do the threading while we read the headers. The
|
|
4200 ;; message-id and the last reference are both entered into
|
|
4201 ;; the same hash table. Some tippy-toeing around has to be
|
|
4202 ;; done in case an article has arrived before the article
|
|
4203 ;; which it refers to.
|
|
4204 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4205 (if (and (car (symbol-value id-dep))
|
|
4206 (not force-new))
|
38
|
4207 ;; An article with this Message-ID has already been seen.
|
|
4208 (if gnus-summary-ignore-duplicates
|
|
4209 ;; We ignore this one, except we add
|
|
4210 ;; any additional Xrefs (in case the two articles
|
|
4211 ;; came from different servers).
|
|
4212 (progn
|
|
4213 (mail-header-set-xref
|
|
4214 (car (symbol-value id-dep))
|
|
4215 (concat (or (mail-header-xref
|
|
4216 (car (symbol-value id-dep)))
|
|
4217 "")
|
|
4218 (or (mail-header-xref header) "")))
|
|
4219 (setq header nil))
|
|
4220 ;; We rename the Message-ID.
|
30
|
4221 (set
|
|
4222 (setq id-dep (intern (setq id (nnmail-message-id))
|
|
4223 dependencies))
|
|
4224 (list header))
|
|
4225 (mail-header-set-id header id))
|
16
|
4226 (setcar (symbol-value id-dep) header))
|
|
4227 (set id-dep (list header)))
|
|
4228 (when header
|
|
4229 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4230 (setcdr (symbol-value ref-dep)
|
|
4231 (nconc (cdr (symbol-value ref-dep))
|
|
4232 (list (symbol-value id-dep))))
|
|
4233 (set ref-dep (list nil (symbol-value id-dep))))
|
|
4234 (push header headers))
|
|
4235 (goto-char (point-max))
|
|
4236 (widen))
|
|
4237 (nreverse headers)))))
|
|
4238
|
|
4239 ;; The following macros and functions were written by Felix Lee
|
|
4240 ;; <flee@cse.psu.edu>.
|
|
4241
|
|
4242 (defmacro gnus-nov-read-integer ()
|
|
4243 '(prog1
|
|
4244 (if (= (following-char) ?\t)
|
|
4245 0
|
|
4246 (let ((num (ignore-errors (read buffer))))
|
|
4247 (if (numberp num) num 0)))
|
|
4248 (unless (eobp)
|
|
4249 (forward-char 1))))
|
|
4250
|
|
4251 (defmacro gnus-nov-skip-field ()
|
|
4252 '(search-forward "\t" eol 'move))
|
|
4253
|
|
4254 (defmacro gnus-nov-field ()
|
|
4255 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
|
|
4256
|
|
4257 ;; (defvar gnus-nov-none-counter 0)
|
|
4258
|
|
4259 ;; This function has to be called with point after the article number
|
|
4260 ;; on the beginning of the line.
|
|
4261 (defun gnus-nov-parse-line (number dependencies &optional force-new)
|
18
|
4262 (let ((eol (gnus-point-at-eol))
|
16
|
4263 (buffer (current-buffer))
|
|
4264 header ref id id-dep ref-dep)
|
|
4265
|
|
4266 ;; overview: [num subject from date id refs chars lines misc]
|
|
4267 (unwind-protect
|
|
4268 (progn
|
|
4269 (narrow-to-region (point) eol)
|
|
4270 (unless (eobp)
|
|
4271 (forward-char))
|
|
4272
|
|
4273 (setq header
|
|
4274 (vector
|
|
4275 number ; number
|
|
4276 (gnus-nov-field) ; subject
|
|
4277 (gnus-nov-field) ; from
|
|
4278 (gnus-nov-field) ; date
|
|
4279 (setq id (or (gnus-nov-field)
|
|
4280 (nnheader-generate-fake-message-id))) ; id
|
|
4281 (progn
|
|
4282 (let ((beg (point)))
|
|
4283 (search-forward "\t" eol)
|
|
4284 (if (search-backward ">" beg t)
|
|
4285 (setq ref
|
|
4286 (buffer-substring
|
|
4287 (1+ (point))
|
|
4288 (search-backward "<" beg t)))
|
|
4289 (setq ref nil))
|
|
4290 (goto-char beg))
|
|
4291 (gnus-nov-field)) ; refs
|
|
4292 (gnus-nov-read-integer) ; chars
|
|
4293 (gnus-nov-read-integer) ; lines
|
|
4294 (if (= (following-char) ?\n)
|
|
4295 nil
|
30
|
4296 (gnus-nov-field))))) ; misc
|
16
|
4297
|
|
4298 (widen))
|
|
4299
|
|
4300 ;; We build the thread tree.
|
|
4301 (when (equal id ref)
|
|
4302 ;; This article refers back to itself. Naughty, naughty.
|
|
4303 (setq ref nil))
|
|
4304 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4305 (if (and (car (symbol-value id-dep))
|
|
4306 (not force-new))
|
38
|
4307 ;; An article with this Message-ID has already been seen.
|
|
4308 (if gnus-summary-ignore-duplicates
|
|
4309 ;; We ignore this one, except we add any additional
|
|
4310 ;; Xrefs (in case the two articles came from different
|
|
4311 ;; servers.
|
|
4312 (progn
|
|
4313 (mail-header-set-xref
|
|
4314 (car (symbol-value id-dep))
|
|
4315 (concat (or (mail-header-xref
|
|
4316 (car (symbol-value id-dep)))
|
|
4317 "")
|
|
4318 (or (mail-header-xref header) "")))
|
|
4319 (setq header nil))
|
|
4320 ;; We rename the Message-ID.
|
30
|
4321 (set
|
|
4322 (setq id-dep (intern (setq id (nnmail-message-id))
|
|
4323 dependencies))
|
|
4324 (list header))
|
|
4325 (mail-header-set-id header id))
|
16
|
4326 (setcar (symbol-value id-dep) header))
|
|
4327 (set id-dep (list header)))
|
|
4328 (when header
|
|
4329 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4330 (setcdr (symbol-value ref-dep)
|
|
4331 (nconc (cdr (symbol-value ref-dep))
|
|
4332 (list (symbol-value id-dep))))
|
|
4333 (set ref-dep (list nil (symbol-value id-dep)))))
|
|
4334 header))
|
|
4335
|
|
4336 ;; Goes through the xover lines and returns a list of vectors
|
30
|
4337 (defun gnus-get-newsgroup-headers-xover (sequence &optional
|
16
|
4338 force-new dependencies
|
|
4339 group also-fetch-heads)
|
|
4340 "Parse the news overview data in the server buffer, and return a
|
|
4341 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
|
|
4342 ;; Get the Xref when the users reads the articles since most/some
|
|
4343 ;; NNTP servers do not include Xrefs when using XOVER.
|
|
4344 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
|
|
4345 (let ((cur nntp-server-buffer)
|
|
4346 (dependencies (or dependencies gnus-newsgroup-dependencies))
|
|
4347 number headers header)
|
|
4348 (save-excursion
|
|
4349 (set-buffer nntp-server-buffer)
|
|
4350 ;; Allow the user to mangle the headers before parsing them.
|
|
4351 (run-hooks 'gnus-parse-headers-hook)
|
|
4352 (goto-char (point-min))
|
|
4353 (while (not (eobp))
|
|
4354 (condition-case ()
|
|
4355 (while (and sequence (not (eobp)))
|
|
4356 (setq number (read cur))
|
|
4357 (while (and sequence
|
|
4358 (< (car sequence) number))
|
|
4359 (setq sequence (cdr sequence)))
|
|
4360 (and sequence
|
|
4361 (eq number (car sequence))
|
|
4362 (progn
|
|
4363 (setq sequence (cdr sequence))
|
|
4364 (setq header (inline
|
|
4365 (gnus-nov-parse-line
|
|
4366 number dependencies force-new))))
|
|
4367 (push header headers))
|
|
4368 (forward-line 1))
|
|
4369 (error
|
|
4370 (gnus-error 4 "Strange nov line (%d)"
|
|
4371 (count-lines (point-min) (point)))))
|
|
4372 (forward-line 1))
|
|
4373 ;; A common bug in inn is that if you have posted an article and
|
|
4374 ;; then retrieves the active file, it will answer correctly --
|
|
4375 ;; the new article is included. However, a NOV entry for the
|
|
4376 ;; article may not have been generated yet, so this may fail.
|
|
4377 ;; We work around this problem by retrieving the last few
|
|
4378 ;; headers using HEAD.
|
|
4379 (if (or (not also-fetch-heads)
|
|
4380 (not sequence))
|
26
|
4381 ;; We (probably) got all the headers.
|
16
|
4382 (nreverse headers)
|
26
|
4383 (let ((gnus-nov-is-evil t))
|
16
|
4384 (nconc
|
|
4385 (nreverse headers)
|
|
4386 (when (gnus-retrieve-headers sequence group)
|
|
4387 (gnus-get-newsgroup-headers))))))))
|
|
4388
|
|
4389 (defun gnus-article-get-xrefs ()
|
|
4390 "Fill in the Xref value in `gnus-current-headers', if necessary.
|
|
4391 This is meant to be called in `gnus-article-internal-prepare-hook'."
|
|
4392 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
|
|
4393 gnus-current-headers)))
|
|
4394 (or (not gnus-use-cross-reference)
|
|
4395 (not headers)
|
|
4396 (and (mail-header-xref headers)
|
|
4397 (not (string= (mail-header-xref headers) "")))
|
|
4398 (let ((case-fold-search t)
|
|
4399 xref)
|
|
4400 (save-restriction
|
|
4401 (nnheader-narrow-to-headers)
|
|
4402 (goto-char (point-min))
|
|
4403 (when (or (and (eq (downcase (following-char)) ?x)
|
|
4404 (looking-at "Xref:"))
|
|
4405 (search-forward "\nXref:" nil t))
|
|
4406 (goto-char (1+ (match-end 0)))
|
|
4407 (setq xref (buffer-substring (point)
|
|
4408 (progn (end-of-line) (point))))
|
|
4409 (mail-header-set-xref headers xref)))))))
|
|
4410
|
|
4411 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
|
|
4412 "Find article ID and insert the summary line for that article."
|
|
4413 (let ((header (if (and old-header use-old-header)
|
|
4414 old-header (gnus-read-header id)))
|
|
4415 (number (and (numberp id) id))
|
|
4416 pos d)
|
|
4417 (when header
|
|
4418 ;; Rebuild the thread that this article is part of and go to the
|
|
4419 ;; article we have fetched.
|
|
4420 (when (and (not gnus-show-threads)
|
|
4421 old-header)
|
|
4422 (when (setq d (gnus-data-find (mail-header-number old-header)))
|
|
4423 (goto-char (gnus-data-pos d))
|
30
|
4424 (gnus-data-remove
|
16
|
4425 number
|
18
|
4426 (- (gnus-point-at-bol)
|
16
|
4427 (prog1
|
18
|
4428 (1+ (gnus-point-at-eol))
|
16
|
4429 (gnus-delete-line))))))
|
|
4430 (when old-header
|
|
4431 (mail-header-set-number header (mail-header-number old-header)))
|
|
4432 (setq gnus-newsgroup-sparse
|
|
4433 (delq (setq number (mail-header-number header))
|
|
4434 gnus-newsgroup-sparse))
|
|
4435 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
|
|
4436 (gnus-rebuild-thread (mail-header-id header))
|
|
4437 (gnus-summary-goto-subject number nil t))
|
|
4438 (when (and (numberp number)
|
|
4439 (> number 0))
|
|
4440 ;; We have to update the boundaries even if we can't fetch the
|
|
4441 ;; article if ID is a number -- so that the next `P' or `N'
|
|
4442 ;; command will fetch the previous (or next) article even
|
|
4443 ;; if the one we tried to fetch this time has been canceled.
|
|
4444 (when (> number gnus-newsgroup-end)
|
|
4445 (setq gnus-newsgroup-end number))
|
|
4446 (when (< number gnus-newsgroup-begin)
|
|
4447 (setq gnus-newsgroup-begin number))
|
|
4448 (setq gnus-newsgroup-unselected
|
|
4449 (delq number gnus-newsgroup-unselected)))
|
|
4450 ;; Report back a success?
|
|
4451 (and header (mail-header-number header))))
|
|
4452
|
|
4453 ;;; Process/prefix in the summary buffer
|
|
4454
|
|
4455 (defun gnus-summary-work-articles (n)
|
|
4456 "Return a list of articles to be worked upon. The prefix argument,
|
|
4457 the list of process marked articles, and the current article will be
|
|
4458 taken into consideration."
|
|
4459 (cond
|
|
4460 (n
|
|
4461 ;; A numerical prefix has been given.
|
|
4462 (setq n (prefix-numeric-value n))
|
|
4463 (let ((backward (< n 0))
|
|
4464 (n (abs (prefix-numeric-value n)))
|
|
4465 articles article)
|
|
4466 (save-excursion
|
|
4467 (while
|
|
4468 (and (> n 0)
|
|
4469 (push (setq article (gnus-summary-article-number))
|
|
4470 articles)
|
|
4471 (if backward
|
|
4472 (gnus-summary-find-prev nil article)
|
|
4473 (gnus-summary-find-next nil article)))
|
|
4474 (decf n)))
|
|
4475 (nreverse articles)))
|
22
|
4476 ((gnus-region-active-p)
|
16
|
4477 ;; Work on the region between point and mark.
|
|
4478 (let ((max (max (point) (mark)))
|
|
4479 articles article)
|
|
4480 (save-excursion
|
|
4481 (goto-char (min (point) (mark)))
|
|
4482 (while
|
|
4483 (and
|
|
4484 (push (setq article (gnus-summary-article-number)) articles)
|
|
4485 (gnus-summary-find-next nil article)
|
|
4486 (< (point) max)))
|
|
4487 (nreverse articles))))
|
|
4488 (gnus-newsgroup-processable
|
|
4489 ;; There are process-marked articles present.
|
|
4490 ;; Save current state.
|
|
4491 (gnus-summary-save-process-mark)
|
|
4492 ;; Return the list.
|
|
4493 (reverse gnus-newsgroup-processable))
|
|
4494 (t
|
|
4495 ;; Just return the current article.
|
|
4496 (list (gnus-summary-article-number)))))
|
|
4497
|
|
4498 (defun gnus-summary-save-process-mark ()
|
|
4499 "Push the current set of process marked articles on the stack."
|
|
4500 (interactive)
|
|
4501 (push (copy-sequence gnus-newsgroup-processable)
|
|
4502 gnus-newsgroup-process-stack))
|
|
4503
|
|
4504 (defun gnus-summary-kill-process-mark ()
|
|
4505 "Push the current set of process marked articles on the stack and unmark."
|
|
4506 (interactive)
|
|
4507 (gnus-summary-save-process-mark)
|
|
4508 (gnus-summary-unmark-all-processable))
|
|
4509
|
|
4510 (defun gnus-summary-yank-process-mark ()
|
|
4511 "Pop the last process mark state off the stack and restore it."
|
|
4512 (interactive)
|
|
4513 (unless gnus-newsgroup-process-stack
|
|
4514 (error "Empty mark stack"))
|
|
4515 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
|
|
4516
|
|
4517 (defun gnus-summary-process-mark-set (set)
|
|
4518 "Make SET into the current process marked articles."
|
|
4519 (gnus-summary-unmark-all-processable)
|
|
4520 (while set
|
|
4521 (gnus-summary-set-process-mark (pop set))))
|
|
4522
|
|
4523 ;;; Searching and stuff
|
|
4524
|
|
4525 (defun gnus-summary-search-group (&optional backward use-level)
|
|
4526 "Search for next unread newsgroup.
|
|
4527 If optional argument BACKWARD is non-nil, search backward instead."
|
|
4528 (save-excursion
|
|
4529 (set-buffer gnus-group-buffer)
|
|
4530 (when (gnus-group-search-forward
|
|
4531 backward nil (if use-level (gnus-group-group-level) nil))
|
|
4532 (gnus-group-group-name))))
|
|
4533
|
|
4534 (defun gnus-summary-best-group (&optional exclude-group)
|
|
4535 "Find the name of the best unread group.
|
|
4536 If EXCLUDE-GROUP, do not go to this group."
|
|
4537 (save-excursion
|
|
4538 (set-buffer gnus-group-buffer)
|
|
4539 (save-excursion
|
|
4540 (gnus-group-best-unread-group exclude-group))))
|
|
4541
|
|
4542 (defun gnus-summary-find-next (&optional unread article backward)
|
|
4543 (if backward (gnus-summary-find-prev)
|
|
4544 (let* ((dummy (gnus-summary-article-intangible-p))
|
|
4545 (article (or article (gnus-summary-article-number)))
|
|
4546 (arts (gnus-data-find-list article))
|
|
4547 result)
|
|
4548 (when (and (not dummy)
|
|
4549 (or (not gnus-summary-check-current)
|
|
4550 (not unread)
|
|
4551 (not (gnus-data-unread-p (car arts)))))
|
|
4552 (setq arts (cdr arts)))
|
|
4553 (when (setq result
|
|
4554 (if unread
|
|
4555 (progn
|
|
4556 (while arts
|
|
4557 (when (gnus-data-unread-p (car arts))
|
|
4558 (setq result (car arts)
|
|
4559 arts nil))
|
|
4560 (setq arts (cdr arts)))
|
|
4561 result)
|
|
4562 (car arts)))
|
|
4563 (goto-char (gnus-data-pos result))
|
|
4564 (gnus-data-number result)))))
|
|
4565
|
|
4566 (defun gnus-summary-find-prev (&optional unread article)
|
|
4567 (let* ((eobp (eobp))
|
|
4568 (article (or article (gnus-summary-article-number)))
|
|
4569 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
|
|
4570 result)
|
|
4571 (when (and (not eobp)
|
|
4572 (or (not gnus-summary-check-current)
|
|
4573 (not unread)
|
|
4574 (not (gnus-data-unread-p (car arts)))))
|
|
4575 (setq arts (cdr arts)))
|
|
4576 (when (setq result
|
|
4577 (if unread
|
|
4578 (progn
|
|
4579 (while arts
|
|
4580 (when (gnus-data-unread-p (car arts))
|
|
4581 (setq result (car arts)
|
|
4582 arts nil))
|
|
4583 (setq arts (cdr arts)))
|
|
4584 result)
|
|
4585 (car arts)))
|
|
4586 (goto-char (gnus-data-pos result))
|
|
4587 (gnus-data-number result))))
|
|
4588
|
|
4589 (defun gnus-summary-find-subject (subject &optional unread backward article)
|
|
4590 (let* ((simp-subject (gnus-simplify-subject-fully subject))
|
|
4591 (article (or article (gnus-summary-article-number)))
|
|
4592 (articles (gnus-data-list backward))
|
|
4593 (arts (gnus-data-find-list article articles))
|
|
4594 result)
|
|
4595 (when (or (not gnus-summary-check-current)
|
|
4596 (not unread)
|
|
4597 (not (gnus-data-unread-p (car arts))))
|
|
4598 (setq arts (cdr arts)))
|
|
4599 (while arts
|
|
4600 (and (or (not unread)
|
|
4601 (gnus-data-unread-p (car arts)))
|
|
4602 (vectorp (gnus-data-header (car arts)))
|
|
4603 (gnus-subject-equal
|
|
4604 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
|
|
4605 (setq result (car arts)
|
|
4606 arts nil))
|
|
4607 (setq arts (cdr arts)))
|
|
4608 (and result
|
|
4609 (goto-char (gnus-data-pos result))
|
|
4610 (gnus-data-number result))))
|
|
4611
|
|
4612 (defun gnus-summary-search-forward (&optional unread subject backward)
|
|
4613 "Search forward for an article.
|
|
4614 If UNREAD, look for unread articles. If SUBJECT, look for
|
|
4615 articles with that subject. If BACKWARD, search backward instead."
|
|
4616 (cond (subject (gnus-summary-find-subject subject unread backward))
|
|
4617 (backward (gnus-summary-find-prev unread))
|
|
4618 (t (gnus-summary-find-next unread))))
|
|
4619
|
|
4620 (defun gnus-recenter (&optional n)
|
|
4621 "Center point in window and redisplay frame.
|
|
4622 Also do horizontal recentering."
|
|
4623 (interactive "P")
|
|
4624 (when (and gnus-auto-center-summary
|
|
4625 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4626 (gnus-horizontal-recenter))
|
|
4627 (recenter n))
|
|
4628
|
|
4629 (defun gnus-summary-recenter ()
|
|
4630 "Center point in the summary window.
|
|
4631 If `gnus-auto-center-summary' is nil, or the article buffer isn't
|
|
4632 displayed, no centering will be performed."
|
|
4633 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
|
|
4634 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
|
|
4635 (let* ((top (cond ((< (window-height) 4) 0)
|
|
4636 ((< (window-height) 7) 1)
|
|
4637 (t 2)))
|
|
4638 (height (1- (window-height)))
|
|
4639 (bottom (save-excursion (goto-char (point-max))
|
|
4640 (forward-line (- height))
|
|
4641 (point)))
|
|
4642 (window (get-buffer-window (current-buffer))))
|
|
4643 ;; The user has to want it.
|
|
4644 (when gnus-auto-center-summary
|
|
4645 (when (get-buffer-window gnus-article-buffer)
|
|
4646 ;; Only do recentering when the article buffer is displayed,
|
|
4647 ;; Set the window start to either `bottom', which is the biggest
|
|
4648 ;; possible valid number, or the second line from the top,
|
|
4649 ;; whichever is the least.
|
|
4650 (set-window-start
|
30
|
4651 window (min bottom (save-excursion
|
16
|
4652 (forward-line (- top)) (point)))))
|
|
4653 ;; Do horizontal recentering while we're at it.
|
|
4654 (when (and (get-buffer-window (current-buffer) t)
|
|
4655 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4656 (let ((selected (selected-window)))
|
|
4657 (select-window (get-buffer-window (current-buffer) t))
|
|
4658 (gnus-summary-position-point)
|
|
4659 (gnus-horizontal-recenter)
|
|
4660 (select-window selected))))))
|
|
4661
|
|
4662 (defun gnus-summary-jump-to-group (newsgroup)
|
|
4663 "Move point to NEWSGROUP in group mode buffer."
|
|
4664 ;; Keep update point of group mode buffer if visible.
|
|
4665 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
|
|
4666 (save-window-excursion
|
|
4667 ;; Take care of tree window mode.
|
|
4668 (when (get-buffer-window gnus-group-buffer)
|
|
4669 (pop-to-buffer gnus-group-buffer))
|
|
4670 (gnus-group-jump-to-group newsgroup))
|
|
4671 (save-excursion
|
|
4672 ;; Take care of tree window mode.
|
|
4673 (if (get-buffer-window gnus-group-buffer)
|
|
4674 (pop-to-buffer gnus-group-buffer)
|
|
4675 (set-buffer gnus-group-buffer))
|
|
4676 (gnus-group-jump-to-group newsgroup))))
|
|
4677
|
|
4678 ;; This function returns a list of article numbers based on the
|
|
4679 ;; difference between the ranges of read articles in this group and
|
|
4680 ;; the range of active articles.
|
|
4681 (defun gnus-list-of-unread-articles (group)
|
|
4682 (let* ((read (gnus-info-read (gnus-get-info group)))
|
|
4683 (active (or (gnus-active group) (gnus-activate-group group)))
|
|
4684 (last (cdr active))
|
|
4685 first nlast unread)
|
|
4686 ;; If none are read, then all are unread.
|
|
4687 (if (not read)
|
|
4688 (setq first (car active))
|
|
4689 ;; If the range of read articles is a single range, then the
|
|
4690 ;; first unread article is the article after the last read
|
|
4691 ;; article. Sounds logical, doesn't it?
|
|
4692 (if (not (listp (cdr read)))
|
|
4693 (setq first (1+ (cdr read)))
|
|
4694 ;; `read' is a list of ranges.
|
|
4695 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
|
|
4696 (caar read)))
|
|
4697 1)
|
|
4698 (setq first 1))
|
|
4699 (while read
|
|
4700 (when first
|
|
4701 (while (< first nlast)
|
|
4702 (push first unread)
|
|
4703 (setq first (1+ first))))
|
|
4704 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
|
|
4705 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
|
|
4706 (setq read (cdr read)))))
|
|
4707 ;; And add the last unread articles.
|
|
4708 (while (<= first last)
|
|
4709 (push first unread)
|
|
4710 (setq first (1+ first)))
|
|
4711 ;; Return the list of unread articles.
|
|
4712 (nreverse unread)))
|
|
4713
|
|
4714 (defun gnus-list-of-read-articles (group)
|
|
4715 "Return a list of unread, unticked and non-dormant articles."
|
|
4716 (let* ((info (gnus-get-info group))
|
|
4717 (marked (gnus-info-marks info))
|
|
4718 (active (gnus-active group)))
|
|
4719 (and info active
|
|
4720 (gnus-set-difference
|
|
4721 (gnus-sorted-complement
|
|
4722 (gnus-uncompress-range active)
|
|
4723 (gnus-list-of-unread-articles group))
|
|
4724 (append
|
|
4725 (gnus-uncompress-range (cdr (assq 'dormant marked)))
|
|
4726 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
|
|
4727
|
|
4728 ;; Various summary commands
|
|
4729
|
|
4730 (defun gnus-summary-universal-argument (arg)
|
|
4731 "Perform any operation on all articles that are process/prefixed."
|
|
4732 (interactive "P")
|
|
4733 (gnus-set-global-variables)
|
|
4734 (let ((articles (gnus-summary-work-articles arg))
|
|
4735 func article)
|
|
4736 (if (eq
|
|
4737 (setq
|
|
4738 func
|
|
4739 (key-binding
|
|
4740 (read-key-sequence
|
|
4741 (substitute-command-keys
|
|
4742 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
|
|
4743 ))))
|
|
4744 'undefined)
|
|
4745 (gnus-error 1 "Undefined key")
|
|
4746 (save-excursion
|
|
4747 (while articles
|
|
4748 (gnus-summary-goto-subject (setq article (pop articles)))
|
|
4749 (let (gnus-newsgroup-processable)
|
|
4750 (command-execute func))
|
|
4751 (gnus-summary-remove-process-mark article)))))
|
|
4752 (gnus-summary-position-point))
|
|
4753
|
|
4754 (defun gnus-summary-toggle-truncation (&optional arg)
|
|
4755 "Toggle truncation of summary lines.
|
|
4756 With arg, turn line truncation on iff arg is positive."
|
|
4757 (interactive "P")
|
|
4758 (setq truncate-lines
|
|
4759 (if (null arg) (not truncate-lines)
|
|
4760 (> (prefix-numeric-value arg) 0)))
|
|
4761 (redraw-display))
|
|
4762
|
|
4763 (defun gnus-summary-reselect-current-group (&optional all rescan)
|
|
4764 "Exit and then reselect the current newsgroup.
|
|
4765 The prefix argument ALL means to select all articles."
|
|
4766 (interactive "P")
|
|
4767 (gnus-set-global-variables)
|
|
4768 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4769 (error "Ephemeral groups can't be reselected"))
|
|
4770 (let ((current-subject (gnus-summary-article-number))
|
|
4771 (group gnus-newsgroup-name))
|
|
4772 (setq gnus-newsgroup-begin nil)
|
|
4773 (gnus-summary-exit)
|
30
|
4774 ;; We have to adjust the point of group mode buffer because
|
16
|
4775 ;; point was moved to the next unread newsgroup by exiting.
|
|
4776 (gnus-summary-jump-to-group group)
|
|
4777 (when rescan
|
|
4778 (save-excursion
|
|
4779 (gnus-group-get-new-news-this-group 1)))
|
|
4780 (gnus-group-read-group all t)
|
|
4781 (gnus-summary-goto-subject current-subject nil t)))
|
|
4782
|
|
4783 (defun gnus-summary-rescan-group (&optional all)
|
|
4784 "Exit the newsgroup, ask for new articles, and select the newsgroup."
|
|
4785 (interactive "P")
|
|
4786 (gnus-summary-reselect-current-group all t))
|
|
4787
|
|
4788 (defun gnus-summary-update-info (&optional non-destructive)
|
|
4789 (save-excursion
|
|
4790 (let ((group gnus-newsgroup-name))
|
|
4791 (when gnus-newsgroup-kill-headers
|
|
4792 (setq gnus-newsgroup-killed
|
|
4793 (gnus-compress-sequence
|
|
4794 (nconc
|
|
4795 (gnus-set-sorted-intersection
|
|
4796 (gnus-uncompress-range gnus-newsgroup-killed)
|
|
4797 (setq gnus-newsgroup-unselected
|
|
4798 (sort gnus-newsgroup-unselected '<)))
|
|
4799 (setq gnus-newsgroup-unreads
|
|
4800 (sort gnus-newsgroup-unreads '<)))
|
|
4801 t)))
|
|
4802 (unless (listp (cdr gnus-newsgroup-killed))
|
|
4803 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
|
|
4804 (let ((headers gnus-newsgroup-headers))
|
|
4805 (when (and (not gnus-save-score)
|
|
4806 (not non-destructive))
|
|
4807 (setq gnus-newsgroup-scored nil))
|
|
4808 ;; Set the new ranges of read articles.
|
|
4809 (gnus-update-read-articles
|
|
4810 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
|
|
4811 ;; Set the current article marks.
|
|
4812 (gnus-update-marks)
|
|
4813 ;; Do the cross-ref thing.
|
|
4814 (when gnus-use-cross-reference
|
|
4815 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
|
|
4816 ;; Do adaptive scoring, and possibly save score files.
|
|
4817 (when gnus-newsgroup-adaptive
|
|
4818 (gnus-score-adaptive))
|
|
4819 (when gnus-use-scoring
|
|
4820 (gnus-score-save))
|
|
4821 ;; Do not switch windows but change the buffer to work.
|
|
4822 (set-buffer gnus-group-buffer)
|
|
4823 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4824 (gnus-group-update-group group))))))
|
|
4825
|
|
4826 (defun gnus-summary-save-newsrc (&optional force)
|
|
4827 "Save the current number of read/marked articles in the dribble buffer.
|
|
4828 The dribble buffer will then be saved.
|
|
4829 If FORCE (the prefix), also save the .newsrc file(s)."
|
|
4830 (interactive "P")
|
|
4831 (gnus-summary-update-info t)
|
|
4832 (if force
|
|
4833 (gnus-save-newsrc-file)
|
|
4834 (gnus-dribble-save)))
|
|
4835
|
|
4836 (defun gnus-summary-exit (&optional temporary)
|
|
4837 "Exit reading current newsgroup, and then return to group selection mode.
|
|
4838 gnus-exit-group-hook is called with no arguments if that value is non-nil."
|
|
4839 (interactive)
|
|
4840 (gnus-set-global-variables)
|
|
4841 (gnus-kill-save-kill-buffer)
|
|
4842 (let* ((group gnus-newsgroup-name)
|
|
4843 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
|
|
4844 (mode major-mode)
|
|
4845 (buf (current-buffer)))
|
|
4846 (run-hooks 'gnus-summary-prepare-exit-hook)
|
|
4847 ;; If we have several article buffers, we kill them at exit.
|
|
4848 (unless gnus-single-article-buffer
|
|
4849 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4850 (setq gnus-article-current nil))
|
|
4851 (when gnus-use-cache
|
|
4852 (gnus-cache-possibly-remove-articles)
|
|
4853 (gnus-cache-save-buffers))
|
|
4854 (gnus-async-prefetch-remove-group group)
|
|
4855 (when gnus-suppress-duplicates
|
|
4856 (gnus-dup-enter-articles))
|
|
4857 (when gnus-use-trees
|
|
4858 (gnus-tree-close group))
|
|
4859 ;; Make all changes in this group permanent.
|
|
4860 (unless quit-config
|
|
4861 (run-hooks 'gnus-exit-group-hook)
|
|
4862 (gnus-summary-update-info))
|
|
4863 (gnus-close-group group)
|
|
4864 ;; Make sure where I was, and go to next newsgroup.
|
|
4865 (set-buffer gnus-group-buffer)
|
|
4866 (unless quit-config
|
|
4867 (gnus-group-jump-to-group group))
|
|
4868 (run-hooks 'gnus-summary-exit-hook)
|
|
4869 (unless quit-config
|
|
4870 (gnus-group-next-unread-group 1))
|
|
4871 (if temporary
|
|
4872 nil ;Nothing to do.
|
|
4873 ;; If we have several article buffers, we kill them at exit.
|
|
4874 (unless gnus-single-article-buffer
|
|
4875 (gnus-kill-buffer gnus-article-buffer)
|
|
4876 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4877 (setq gnus-article-current nil))
|
|
4878 (set-buffer buf)
|
|
4879 (if (not gnus-kill-summary-on-exit)
|
|
4880 (gnus-deaden-summary)
|
|
4881 ;; We set all buffer-local variables to nil. It is unclear why
|
|
4882 ;; this is needed, but if we don't, buffer-local variables are
|
|
4883 ;; not garbage-collected, it seems. This would the lead to en
|
|
4884 ;; ever-growing Emacs.
|
|
4885 (gnus-summary-clear-local-variables)
|
|
4886 (when (get-buffer gnus-article-buffer)
|
|
4887 (bury-buffer gnus-article-buffer))
|
|
4888 ;; We clear the global counterparts of the buffer-local
|
|
4889 ;; variables as well, just to be on the safe side.
|
|
4890 (set-buffer gnus-group-buffer)
|
|
4891 (gnus-summary-clear-local-variables)
|
|
4892 ;; Return to group mode buffer.
|
|
4893 (when (eq mode 'gnus-summary-mode)
|
|
4894 (gnus-kill-buffer buf)))
|
|
4895 (setq gnus-current-select-method gnus-select-method)
|
|
4896 (pop-to-buffer gnus-group-buffer)
|
|
4897 ;; Clear the current group name.
|
|
4898 (if (not quit-config)
|
|
4899 (progn
|
|
4900 (gnus-group-jump-to-group group)
|
|
4901 (gnus-group-next-unread-group 1)
|
|
4902 (gnus-configure-windows 'group 'force))
|
|
4903 (gnus-handle-ephemeral-exit quit-config))
|
|
4904 (unless quit-config
|
|
4905 (setq gnus-newsgroup-name nil)))))
|
|
4906
|
|
4907 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
|
|
4908 (defun gnus-summary-exit-no-update (&optional no-questions)
|
|
4909 "Quit reading current newsgroup without updating read article info."
|
|
4910 (interactive)
|
|
4911 (gnus-set-global-variables)
|
|
4912 (let* ((group gnus-newsgroup-name)
|
|
4913 (quit-config (gnus-group-quit-config group)))
|
|
4914 (when (or no-questions
|
|
4915 gnus-expert-user
|
|
4916 (gnus-y-or-n-p "Discard changes to this group and exit? "))
|
|
4917 ;; If we have several article buffers, we kill them at exit.
|
|
4918 (unless gnus-single-article-buffer
|
|
4919 (gnus-kill-buffer gnus-article-buffer)
|
|
4920 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4921 (setq gnus-article-current nil))
|
|
4922 (if (not gnus-kill-summary-on-exit)
|
|
4923 (gnus-deaden-summary)
|
|
4924 (gnus-close-group group)
|
|
4925 (gnus-summary-clear-local-variables)
|
|
4926 (set-buffer gnus-group-buffer)
|
|
4927 (gnus-summary-clear-local-variables)
|
|
4928 (when (get-buffer gnus-summary-buffer)
|
|
4929 (kill-buffer gnus-summary-buffer)))
|
|
4930 (unless gnus-single-article-buffer
|
|
4931 (setq gnus-article-current nil))
|
|
4932 (when gnus-use-trees
|
|
4933 (gnus-tree-close group))
|
|
4934 (gnus-async-prefetch-remove-group group)
|
|
4935 (when (get-buffer gnus-article-buffer)
|
|
4936 (bury-buffer gnus-article-buffer))
|
|
4937 ;; Return to the group buffer.
|
|
4938 (gnus-configure-windows 'group 'force)
|
|
4939 ;; Clear the current group name.
|
|
4940 (setq gnus-newsgroup-name nil)
|
|
4941 (when (equal (gnus-group-group-name) group)
|
|
4942 (gnus-group-next-unread-group 1))
|
|
4943 (when quit-config
|
|
4944 (gnus-handle-ephemeral-exit quit-config)))))
|
|
4945
|
|
4946 (defun gnus-handle-ephemeral-exit (quit-config)
|
|
4947 "Handle movement when leaving an ephemeral group. The state
|
|
4948 which existed when entering the ephemeral is reset."
|
|
4949 (if (not (buffer-name (car quit-config)))
|
|
4950 (gnus-configure-windows 'group 'force)
|
|
4951 (set-buffer (car quit-config))
|
|
4952 (cond ((eq major-mode 'gnus-summary-mode)
|
|
4953 (gnus-set-global-variables))
|
|
4954 ((eq major-mode 'gnus-article-mode)
|
|
4955 (save-excursion
|
|
4956 ;; The `gnus-summary-buffer' variable may point
|
|
4957 ;; to the old summary buffer when using a single
|
|
4958 ;; article buffer.
|
|
4959 (unless (gnus-buffer-live-p gnus-summary-buffer)
|
|
4960 (set-buffer gnus-group-buffer))
|
|
4961 (set-buffer gnus-summary-buffer)
|
|
4962 (gnus-set-global-variables))))
|
|
4963 (if (or (eq (cdr quit-config) 'article)
|
|
4964 (eq (cdr quit-config) 'pick))
|
|
4965 (progn
|
|
4966 ;; The current article may be from the ephemeral group
|
|
4967 ;; thus it is best that we reload this article
|
|
4968 (gnus-summary-show-article)
|
|
4969 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
|
|
4970 (gnus-configure-windows 'pick 'force)
|
|
4971 (gnus-configure-windows (cdr quit-config) 'force)))
|
|
4972 (gnus-configure-windows (cdr quit-config) 'force))
|
|
4973 (when (eq major-mode 'gnus-summary-mode)
|
|
4974 (gnus-summary-next-subject 1 nil t)
|
|
4975 (gnus-summary-recenter)
|
|
4976 (gnus-summary-position-point))))
|
|
4977
|
|
4978 ;;; Dead summaries.
|
|
4979
|
|
4980 (defvar gnus-dead-summary-mode-map nil)
|
|
4981
|
|
4982 (unless gnus-dead-summary-mode-map
|
|
4983 (setq gnus-dead-summary-mode-map (make-keymap))
|
|
4984 (suppress-keymap gnus-dead-summary-mode-map)
|
|
4985 (substitute-key-definition
|
|
4986 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
|
|
4987 (let ((keys '("\C-d" "\r" "\177")))
|
|
4988 (while keys
|
|
4989 (define-key gnus-dead-summary-mode-map
|
|
4990 (pop keys) 'gnus-summary-wake-up-the-dead))))
|
|
4991
|
|
4992 (defvar gnus-dead-summary-mode nil
|
|
4993 "Minor mode for Gnus summary buffers.")
|
|
4994
|
|
4995 (defun gnus-dead-summary-mode (&optional arg)
|
|
4996 "Minor mode for Gnus summary buffers."
|
|
4997 (interactive "P")
|
|
4998 (when (eq major-mode 'gnus-summary-mode)
|
|
4999 (make-local-variable 'gnus-dead-summary-mode)
|
|
5000 (setq gnus-dead-summary-mode
|
|
5001 (if (null arg) (not gnus-dead-summary-mode)
|
|
5002 (> (prefix-numeric-value arg) 0)))
|
|
5003 (when gnus-dead-summary-mode
|
|
5004 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
|
|
5005 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
|
|
5006 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
|
|
5007 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
|
|
5008 minor-mode-map-alist)))))
|
|
5009
|
|
5010 (defun gnus-deaden-summary ()
|
|
5011 "Make the current summary buffer into a dead summary buffer."
|
|
5012 ;; Kill any previous dead summary buffer.
|
|
5013 (when (and gnus-dead-summary
|
|
5014 (buffer-name gnus-dead-summary))
|
|
5015 (save-excursion
|
|
5016 (set-buffer gnus-dead-summary)
|
|
5017 (when gnus-dead-summary-mode
|
|
5018 (kill-buffer (current-buffer)))))
|
|
5019 ;; Make this the current dead summary.
|
|
5020 (setq gnus-dead-summary (current-buffer))
|
|
5021 (gnus-dead-summary-mode 1)
|
|
5022 (let ((name (buffer-name)))
|
|
5023 (when (string-match "Summary" name)
|
|
5024 (rename-buffer
|
|
5025 (concat (substring name 0 (match-beginning 0)) "Dead "
|
|
5026 (substring name (match-beginning 0)))
|
|
5027 t))))
|
|
5028
|
|
5029 (defun gnus-kill-or-deaden-summary (buffer)
|
|
5030 "Kill or deaden the summary BUFFER."
|
|
5031 (when (and (buffer-name buffer)
|
|
5032 (not gnus-single-article-buffer))
|
|
5033 (save-excursion
|
|
5034 (set-buffer buffer)
|
|
5035 (gnus-kill-buffer gnus-article-buffer)
|
|
5036 (gnus-kill-buffer gnus-original-article-buffer)))
|
|
5037 (cond (gnus-kill-summary-on-exit
|
|
5038 (when (and gnus-use-trees
|
|
5039 (and (get-buffer buffer)
|
|
5040 (buffer-name (get-buffer buffer))))
|
|
5041 (save-excursion
|
|
5042 (set-buffer (get-buffer buffer))
|
|
5043 (gnus-tree-close gnus-newsgroup-name)))
|
|
5044 (gnus-kill-buffer buffer))
|
|
5045 ((and (get-buffer buffer)
|
|
5046 (buffer-name (get-buffer buffer)))
|
|
5047 (save-excursion
|
|
5048 (set-buffer buffer)
|
|
5049 (gnus-deaden-summary)))))
|
|
5050
|
|
5051 (defun gnus-summary-wake-up-the-dead (&rest args)
|
|
5052 "Wake up the dead summary buffer."
|
|
5053 (interactive)
|
|
5054 (gnus-dead-summary-mode -1)
|
|
5055 (let ((name (buffer-name)))
|
|
5056 (when (string-match "Dead " name)
|
|
5057 (rename-buffer
|
|
5058 (concat (substring name 0 (match-beginning 0))
|
|
5059 (substring name (match-end 0)))
|
|
5060 t)))
|
|
5061 (gnus-message 3 "This dead summary is now alive again"))
|
|
5062
|
|
5063 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
|
|
5064 (defun gnus-summary-fetch-faq (&optional faq-dir)
|
|
5065 "Fetch the FAQ for the current group.
|
|
5066 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
|
|
5067 in."
|
|
5068 (interactive
|
|
5069 (list
|
|
5070 (when current-prefix-arg
|
|
5071 (completing-read
|
|
5072 "Faq dir: " (and (listp gnus-group-faq-directory)
|
|
5073 gnus-group-faq-directory)))))
|
|
5074 (let (gnus-faq-buffer)
|
|
5075 (when (setq gnus-faq-buffer
|
|
5076 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
|
|
5077 (gnus-configure-windows 'summary-faq))))
|
|
5078
|
|
5079 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
5080 (defun gnus-summary-describe-group (&optional force)
|
|
5081 "Describe the current newsgroup."
|
|
5082 (interactive "P")
|
|
5083 (gnus-group-describe-group force gnus-newsgroup-name))
|
|
5084
|
|
5085 (defun gnus-summary-describe-briefly ()
|
|
5086 "Describe summary mode commands briefly."
|
|
5087 (interactive)
|
|
5088 (gnus-message 6
|
|
5089 (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")))
|
|
5090
|
|
5091 ;; Walking around group mode buffer from summary mode.
|
|
5092
|
|
5093 (defun gnus-summary-next-group (&optional no-article target-group backward)
|
|
5094 "Exit current newsgroup and then select next unread newsgroup.
|
|
5095 If prefix argument NO-ARTICLE is non-nil, no article is selected
|
|
5096 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
|
|
5097 previous group instead."
|
|
5098 (interactive "P")
|
|
5099 (gnus-set-global-variables)
|
|
5100 ;; Stop pre-fetching.
|
|
5101 (gnus-async-halt-prefetch)
|
|
5102 (let ((current-group gnus-newsgroup-name)
|
|
5103 (current-buffer (current-buffer))
|
|
5104 entered)
|
|
5105 ;; First we semi-exit this group to update Xrefs and all variables.
|
|
5106 ;; We can't do a real exit, because the window conf must remain
|
|
5107 ;; the same in case the user is prompted for info, and we don't
|
|
5108 ;; want the window conf to change before that...
|
|
5109 (gnus-summary-exit t)
|
|
5110 (while (not entered)
|
|
5111 ;; Then we find what group we are supposed to enter.
|
|
5112 (set-buffer gnus-group-buffer)
|
|
5113 (gnus-group-jump-to-group current-group)
|
|
5114 (setq target-group
|
|
5115 (or target-group
|
|
5116 (if (eq gnus-keep-same-level 'best)
|
|
5117 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5118 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5119 (if (not target-group)
|
|
5120 ;; There are no further groups, so we return to the group
|
|
5121 ;; buffer.
|
|
5122 (progn
|
|
5123 (gnus-message 5 "Returning to the group buffer")
|
|
5124 (setq entered t)
|
|
5125 (set-buffer current-buffer)
|
|
5126 (gnus-summary-exit)
|
|
5127 (run-hooks 'gnus-group-no-more-groups-hook))
|
|
5128 ;; We try to enter the target group.
|
|
5129 (gnus-group-jump-to-group target-group)
|
|
5130 (let ((unreads (gnus-group-group-unread)))
|
|
5131 (if (and (or (eq t unreads)
|
|
5132 (and unreads (not (zerop unreads))))
|
|
5133 (gnus-summary-read-group
|
|
5134 target-group nil no-article current-buffer))
|
|
5135 (setq entered t)
|
|
5136 (setq current-group target-group
|
|
5137 target-group nil)))))))
|
|
5138
|
|
5139 (defun gnus-summary-prev-group (&optional no-article)
|
|
5140 "Exit current newsgroup and then select previous unread newsgroup.
|
|
5141 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
|
|
5142 (interactive "P")
|
|
5143 (gnus-summary-next-group no-article nil t))
|
|
5144
|
|
5145 ;; Walking around summary lines.
|
|
5146
|
|
5147 (defun gnus-summary-first-subject (&optional unread)
|
|
5148 "Go to the first unread subject.
|
|
5149 If UNREAD is non-nil, go to the first unread article.
|
|
5150 Returns the article selected or nil if there are no unread articles."
|
|
5151 (interactive "P")
|
|
5152 (prog1
|
|
5153 (cond
|
|
5154 ;; Empty summary.
|
|
5155 ((null gnus-newsgroup-data)
|
|
5156 (gnus-message 3 "No articles in the group")
|
|
5157 nil)
|
|
5158 ;; Pick the first article.
|
|
5159 ((not unread)
|
|
5160 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
|
|
5161 (gnus-data-number (car gnus-newsgroup-data)))
|
|
5162 ;; No unread articles.
|
|
5163 ((null gnus-newsgroup-unreads)
|
|
5164 (gnus-message 3 "No more unread articles")
|
|
5165 nil)
|
|
5166 ;; Find the first unread article.
|
|
5167 (t
|
|
5168 (let ((data gnus-newsgroup-data))
|
|
5169 (while (and data
|
|
5170 (not (gnus-data-unread-p (car data))))
|
|
5171 (setq data (cdr data)))
|
|
5172 (when data
|
|
5173 (goto-char (gnus-data-pos (car data)))
|
|
5174 (gnus-data-number (car data))))))
|
|
5175 (gnus-summary-position-point)))
|
|
5176
|
|
5177 (defun gnus-summary-next-subject (n &optional unread dont-display)
|
|
5178 "Go to next N'th summary line.
|
|
5179 If N is negative, go to the previous N'th subject line.
|
|
5180 If UNREAD is non-nil, only unread articles are selected.
|
|
5181 The difference between N and the actual number of steps taken is
|
|
5182 returned."
|
|
5183 (interactive "p")
|
|
5184 (let ((backward (< n 0))
|
|
5185 (n (abs n)))
|
|
5186 (while (and (> n 0)
|
|
5187 (if backward
|
|
5188 (gnus-summary-find-prev unread)
|
|
5189 (gnus-summary-find-next unread)))
|
|
5190 (setq n (1- n)))
|
|
5191 (when (/= 0 n)
|
|
5192 (gnus-message 7 "No more%s articles"
|
|
5193 (if unread " unread" "")))
|
|
5194 (unless dont-display
|
|
5195 (gnus-summary-recenter)
|
|
5196 (gnus-summary-position-point))
|
|
5197 n))
|
|
5198
|
|
5199 (defun gnus-summary-next-unread-subject (n)
|
|
5200 "Go to next N'th unread summary line."
|
|
5201 (interactive "p")
|
|
5202 (gnus-summary-next-subject n t))
|
|
5203
|
|
5204 (defun gnus-summary-prev-subject (n &optional unread)
|
|
5205 "Go to previous N'th summary line.
|
|
5206 If optional argument UNREAD is non-nil, only unread article is selected."
|
|
5207 (interactive "p")
|
|
5208 (gnus-summary-next-subject (- n) unread))
|
|
5209
|
|
5210 (defun gnus-summary-prev-unread-subject (n)
|
|
5211 "Go to previous N'th unread summary line."
|
|
5212 (interactive "p")
|
|
5213 (gnus-summary-next-subject (- n) t))
|
|
5214
|
|
5215 (defun gnus-summary-goto-subject (article &optional force silent)
|
|
5216 "Go the subject line of ARTICLE.
|
|
5217 If FORCE, also allow jumping to articles not currently shown."
|
|
5218 (interactive "nArticle number: ")
|
|
5219 (let ((b (point))
|
|
5220 (data (gnus-data-find article)))
|
|
5221 ;; We read in the article if we have to.
|
|
5222 (and (not data)
|
|
5223 force
|
|
5224 (gnus-summary-insert-subject article (and (vectorp force) force) t)
|
|
5225 (setq data (gnus-data-find article)))
|
|
5226 (goto-char b)
|
|
5227 (if (not data)
|
|
5228 (progn
|
|
5229 (unless silent
|
|
5230 (gnus-message 3 "Can't find article %d" article))
|
|
5231 nil)
|
|
5232 (goto-char (gnus-data-pos data))
|
|
5233 article)))
|
|
5234
|
|
5235 ;; Walking around summary lines with displaying articles.
|
|
5236
|
|
5237 (defun gnus-summary-expand-window (&optional arg)
|
|
5238 "Make the summary buffer take up the entire Emacs frame.
|
|
5239 Given a prefix, will force an `article' buffer configuration."
|
|
5240 (interactive "P")
|
|
5241 (gnus-set-global-variables)
|
|
5242 (if arg
|
|
5243 (gnus-configure-windows 'article 'force)
|
|
5244 (gnus-configure-windows 'summary 'force)))
|
|
5245
|
|
5246 (defun gnus-summary-display-article (article &optional all-header)
|
|
5247 "Display ARTICLE in article buffer."
|
|
5248 (gnus-set-global-variables)
|
|
5249 (if (null article)
|
|
5250 nil
|
|
5251 (prog1
|
|
5252 (if gnus-summary-display-article-function
|
|
5253 (funcall gnus-summary-display-article-function article all-header)
|
|
5254 (gnus-article-prepare article all-header))
|
|
5255 (run-hooks 'gnus-select-article-hook)
|
|
5256 (when (and gnus-current-article
|
|
5257 (not (zerop gnus-current-article)))
|
|
5258 (gnus-summary-goto-subject gnus-current-article))
|
|
5259 (gnus-summary-recenter)
|
|
5260 (when (and gnus-use-trees gnus-show-threads)
|
|
5261 (gnus-possibly-generate-tree article)
|
|
5262 (gnus-highlight-selected-tree article))
|
|
5263 ;; Successfully display article.
|
|
5264 (gnus-article-set-window-start
|
|
5265 (cdr (assq article gnus-newsgroup-bookmarks))))))
|
|
5266
|
|
5267 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
|
|
5268 "Select the current article.
|
|
5269 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
|
|
5270 non-nil, the article will be re-fetched even if it already present in
|
|
5271 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
|
|
5272 be displayed."
|
|
5273 ;; Make sure we are in the summary buffer to work around bbdb bug.
|
|
5274 (unless (eq major-mode 'gnus-summary-mode)
|
|
5275 (set-buffer gnus-summary-buffer))
|
|
5276 (let ((article (or article (gnus-summary-article-number)))
|
|
5277 (all-headers (not (not all-headers))) ;Must be T or NIL.
|
|
5278 gnus-summary-display-article-function
|
|
5279 did)
|
|
5280 (and (not pseudo)
|
|
5281 (gnus-summary-article-pseudo-p article)
|
|
5282 (error "This is a pseudo-article."))
|
|
5283 (prog1
|
|
5284 (save-excursion
|
|
5285 (set-buffer gnus-summary-buffer)
|
|
5286 (if (or (and gnus-single-article-buffer
|
|
5287 (or (null gnus-current-article)
|
|
5288 (null gnus-article-current)
|
|
5289 (null (get-buffer gnus-article-buffer))
|
|
5290 (not (eq article (cdr gnus-article-current)))
|
|
5291 (not (equal (car gnus-article-current)
|
|
5292 gnus-newsgroup-name))))
|
|
5293 (and (not gnus-single-article-buffer)
|
|
5294 (or (null gnus-current-article)
|
|
5295 (not (eq gnus-current-article article))))
|
|
5296 force)
|
|
5297 ;; The requested article is different from the current article.
|
|
5298 (prog1
|
|
5299 (gnus-summary-display-article article all-headers)
|
|
5300 (setq did article))
|
|
5301 (when (or all-headers gnus-show-all-headers)
|
|
5302 (gnus-article-show-all-headers))
|
|
5303 'old))
|
|
5304 (when did
|
|
5305 (gnus-article-set-window-start
|
|
5306 (cdr (assq article gnus-newsgroup-bookmarks)))))))
|
|
5307
|
|
5308 (defun gnus-summary-set-current-mark (&optional current-mark)
|
|
5309 "Obsolete function."
|
|
5310 nil)
|
|
5311
|
|
5312 (defun gnus-summary-next-article (&optional unread subject backward push)
|
|
5313 "Select the next article.
|
|
5314 If UNREAD, only unread articles are selected.
|
|
5315 If SUBJECT, only articles with SUBJECT are selected.
|
|
5316 If BACKWARD, the previous article is selected instead of the next."
|
|
5317 (interactive "P")
|
|
5318 (gnus-set-global-variables)
|
|
5319 (cond
|
|
5320 ;; Is there such an article?
|
|
5321 ((and (gnus-summary-search-forward unread subject backward)
|
|
5322 (or (gnus-summary-display-article (gnus-summary-article-number))
|
|
5323 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
|
|
5324 (gnus-summary-position-point))
|
|
5325 ;; If not, we try the first unread, if that is wanted.
|
|
5326 ((and subject
|
|
5327 gnus-auto-select-same
|
|
5328 (gnus-summary-first-unread-article))
|
|
5329 (gnus-summary-position-point)
|
|
5330 (gnus-message 6 "Wrapped"))
|
|
5331 ;; Try to get next/previous article not displayed in this group.
|
|
5332 ((and gnus-auto-extend-newsgroup
|
|
5333 (not unread) (not subject))
|
|
5334 (gnus-summary-goto-article
|
|
5335 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
|
|
5336 nil t))
|
|
5337 ;; Go to next/previous group.
|
|
5338 (t
|
|
5339 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5340 (gnus-summary-jump-to-group gnus-newsgroup-name))
|
|
5341 (let ((cmd last-command-char)
|
26
|
5342 (point
|
|
5343 (save-excursion
|
|
5344 (set-buffer gnus-group-buffer)
|
|
5345 (point)))
|
16
|
5346 (group
|
|
5347 (if (eq gnus-keep-same-level 'best)
|
|
5348 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5349 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5350 ;; For some reason, the group window gets selected. We change
|
|
5351 ;; it back.
|
|
5352 (select-window (get-buffer-window (current-buffer)))
|
|
5353 ;; Select next unread newsgroup automagically.
|
|
5354 (cond
|
|
5355 ((or (not gnus-auto-select-next)
|
|
5356 (not cmd))
|
|
5357 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
|
|
5358 ((or (eq gnus-auto-select-next 'quietly)
|
|
5359 (and (eq gnus-auto-select-next 'slightly-quietly)
|
|
5360 push)
|
|
5361 (and (eq gnus-auto-select-next 'almost-quietly)
|
|
5362 (gnus-summary-last-article-p)))
|
|
5363 ;; Select quietly.
|
|
5364 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5365 (gnus-summary-exit)
|
|
5366 (gnus-message 7 "No more%s articles (%s)..."
|
|
5367 (if unread " unread" "")
|
|
5368 (if group (concat "selecting " group)
|
|
5369 "exiting"))
|
|
5370 (gnus-summary-next-group nil group backward)))
|
|
5371 (t
|
|
5372 (when (gnus-key-press-event-p last-input-event)
|
|
5373 (gnus-summary-walk-group-buffer
|
26
|
5374 gnus-newsgroup-name cmd unread backward point))))))))
|
|
5375
|
|
5376 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
|
16
|
5377 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
|
|
5378 (?\C-p (gnus-group-prev-unread-group 1))))
|
|
5379 (cursor-in-echo-area t)
|
|
5380 keve key group ended)
|
|
5381 (save-excursion
|
|
5382 (set-buffer gnus-group-buffer)
|
26
|
5383 (goto-char start)
|
16
|
5384 (setq group
|
|
5385 (if (eq gnus-keep-same-level 'best)
|
|
5386 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5387 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5388 (while (not ended)
|
|
5389 (gnus-message
|
|
5390 5 "No more%s articles%s" (if unread " unread" "")
|
|
5391 (if (and group
|
|
5392 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
|
|
5393 (format " (Type %s for %s [%s])"
|
|
5394 (single-key-description cmd) group
|
|
5395 (car (gnus-gethash group gnus-newsrc-hashtb)))
|
|
5396 (format " (Type %s to exit %s)"
|
|
5397 (single-key-description cmd)
|
|
5398 gnus-newsgroup-name)))
|
|
5399 ;; Confirm auto selection.
|
|
5400 (setq key (car (setq keve (gnus-read-event-char))))
|
|
5401 (setq ended t)
|
|
5402 (cond
|
|
5403 ((assq key keystrokes)
|
|
5404 (let ((obuf (current-buffer)))
|
|
5405 (switch-to-buffer gnus-group-buffer)
|
|
5406 (when group
|
|
5407 (gnus-group-jump-to-group group))
|
|
5408 (eval (cadr (assq key keystrokes)))
|
|
5409 (setq group (gnus-group-group-name))
|
|
5410 (switch-to-buffer obuf))
|
|
5411 (setq ended nil))
|
|
5412 ((equal key cmd)
|
|
5413 (if (or (not group)
|
|
5414 (gnus-ephemeral-group-p gnus-newsgroup-name))
|
|
5415 (gnus-summary-exit)
|
|
5416 (gnus-summary-next-group nil group backward)))
|
|
5417 (t
|
|
5418 (push (cdr keve) unread-command-events))))))
|
|
5419
|
|
5420 (defun gnus-summary-next-unread-article ()
|
|
5421 "Select unread article after current one."
|
|
5422 (interactive)
|
30
|
5423 (gnus-summary-next-article
|
16
|
5424 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5425 (gnus-summary-last-article-p (gnus-summary-article-number)))
|
|
5426 (and gnus-auto-select-same
|
|
5427 (gnus-summary-article-subject))))
|
|
5428
|
|
5429 (defun gnus-summary-prev-article (&optional unread subject)
|
|
5430 "Select the article after the current one.
|
|
5431 If UNREAD is non-nil, only unread articles are selected."
|
|
5432 (interactive "P")
|
|
5433 (gnus-summary-next-article unread subject t))
|
|
5434
|
|
5435 (defun gnus-summary-prev-unread-article ()
|
|
5436 "Select unread article before current one."
|
|
5437 (interactive)
|
|
5438 (gnus-summary-prev-article
|
|
5439 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5440 (gnus-summary-first-article-p (gnus-summary-article-number)))
|
|
5441 (and gnus-auto-select-same
|
|
5442 (gnus-summary-article-subject))))
|
|
5443
|
|
5444 (defun gnus-summary-next-page (&optional lines circular)
|
|
5445 "Show next page of the selected article.
|
|
5446 If at the end of the current article, select the next article.
|
|
5447 LINES says how many lines should be scrolled up.
|
|
5448
|
|
5449 If CIRCULAR is non-nil, go to the start of the article instead of
|
|
5450 selecting the next article when reaching the end of the current
|
|
5451 article."
|
|
5452 (interactive "P")
|
|
5453 (setq gnus-summary-buffer (current-buffer))
|
|
5454 (gnus-set-global-variables)
|
|
5455 (let ((article (gnus-summary-article-number))
|
24
|
5456 (article-window (get-buffer-window gnus-article-buffer t))
|
30
|
5457 endp)
|
16
|
5458 (gnus-configure-windows 'article)
|
|
5459 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
|
|
5460 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5461 (not (gnus-summary-last-article-p article)))
|
|
5462 (gnus-summary-next-article)
|
|
5463 (gnus-summary-next-unread-article))
|
|
5464 (if (or (null gnus-current-article)
|
|
5465 (null gnus-article-current)
|
|
5466 (/= article (cdr gnus-article-current))
|
|
5467 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5468 ;; Selected subject is different from current article's.
|
|
5469 (gnus-summary-display-article article)
|
|
5470 (when article-window
|
|
5471 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5472 (setq endp (gnus-article-next-page lines)))
|
|
5473 (when endp
|
|
5474 (cond (circular
|
|
5475 (gnus-summary-beginning-of-article))
|
|
5476 (lines
|
|
5477 (gnus-message 3 "End of message"))
|
|
5478 ((null lines)
|
|
5479 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5480 (not (gnus-summary-last-article-p article)))
|
|
5481 (gnus-summary-next-article)
|
|
5482 (gnus-summary-next-unread-article))))))))
|
|
5483 (gnus-summary-recenter)
|
|
5484 (gnus-summary-position-point)))
|
|
5485
|
30
|
5486 (defun gnus-summary-prev-page (&optional lines move)
|
16
|
5487 "Show previous page of selected article.
|
30
|
5488 Argument LINES specifies lines to be scrolled down.
|
|
5489 If MOVE, move to the previous unread article if point is at
|
|
5490 the beginning of the buffer."
|
16
|
5491 (interactive "P")
|
|
5492 (gnus-set-global-variables)
|
22
|
5493 (let ((article (gnus-summary-article-number))
|
30
|
5494 (article-window (get-buffer-window gnus-article-buffer t))
|
|
5495 endp)
|
16
|
5496 (gnus-configure-windows 'article)
|
|
5497 (if (or (null gnus-current-article)
|
|
5498 (null gnus-article-current)
|
|
5499 (/= article (cdr gnus-article-current))
|
|
5500 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5501 ;; Selected subject is different from current article's.
|
|
5502 (gnus-summary-display-article article)
|
|
5503 (gnus-summary-recenter)
|
22
|
5504 (when article-window
|
|
5505 (gnus-eval-in-buffer-window gnus-article-buffer
|
30
|
5506 (setq endp (gnus-article-prev-page lines)))
|
|
5507 (when (and move endp)
|
|
5508 (cond (lines
|
|
5509 (gnus-message 3 "Beginning of message"))
|
|
5510 ((null lines)
|
|
5511 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5512 (not (gnus-summary-first-article-p article)))
|
|
5513 (gnus-summary-prev-article)
|
|
5514 (gnus-summary-prev-unread-article))))))))
|
16
|
5515 (gnus-summary-position-point))
|
|
5516
|
30
|
5517 (defun gnus-summary-prev-page-or-article (&optional lines)
|
|
5518 "Show previous page of selected article.
|
|
5519 Argument LINES specifies lines to be scrolled down.
|
|
5520 If at the beginning of the article, go to the next article."
|
|
5521 (interactive "P")
|
|
5522 (gnus-summary-prev-page lines t))
|
|
5523
|
16
|
5524 (defun gnus-summary-scroll-up (lines)
|
|
5525 "Scroll up (or down) one line current article.
|
|
5526 Argument LINES specifies lines to be scrolled up (or down if negative)."
|
|
5527 (interactive "p")
|
|
5528 (gnus-set-global-variables)
|
|
5529 (gnus-configure-windows 'article)
|
|
5530 (gnus-summary-show-thread)
|
|
5531 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
|
|
5532 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5533 (cond ((> lines 0)
|
|
5534 (when (gnus-article-next-page lines)
|
|
5535 (gnus-message 3 "End of message")))
|
|
5536 ((< lines 0)
|
|
5537 (gnus-article-prev-page (- lines))))))
|
|
5538 (gnus-summary-recenter)
|
|
5539 (gnus-summary-position-point))
|
|
5540
|
|
5541 (defun gnus-summary-next-same-subject ()
|
|
5542 "Select next article which has the same subject as current one."
|
|
5543 (interactive)
|
|
5544 (gnus-set-global-variables)
|
|
5545 (gnus-summary-next-article nil (gnus-summary-article-subject)))
|
|
5546
|
|
5547 (defun gnus-summary-prev-same-subject ()
|
|
5548 "Select previous article which has the same subject as current one."
|
|
5549 (interactive)
|
|
5550 (gnus-set-global-variables)
|
|
5551 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
|
|
5552
|
|
5553 (defun gnus-summary-next-unread-same-subject ()
|
|
5554 "Select next unread article which has the same subject as current one."
|
|
5555 (interactive)
|
|
5556 (gnus-set-global-variables)
|
|
5557 (gnus-summary-next-article t (gnus-summary-article-subject)))
|
|
5558
|
|
5559 (defun gnus-summary-prev-unread-same-subject ()
|
|
5560 "Select previous unread article which has the same subject as current one."
|
|
5561 (interactive)
|
|
5562 (gnus-set-global-variables)
|
|
5563 (gnus-summary-prev-article t (gnus-summary-article-subject)))
|
|
5564
|
|
5565 (defun gnus-summary-first-unread-article ()
|
|
5566 "Select the first unread article.
|
|
5567 Return nil if there are no unread articles."
|
|
5568 (interactive)
|
|
5569 (gnus-set-global-variables)
|
|
5570 (prog1
|
|
5571 (when (gnus-summary-first-subject t)
|
|
5572 (gnus-summary-show-thread)
|
|
5573 (gnus-summary-first-subject t)
|
|
5574 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5575 (gnus-summary-position-point)))
|
|
5576
|
|
5577 (defun gnus-summary-first-article ()
|
|
5578 "Select the first article.
|
|
5579 Return nil if there are no articles."
|
|
5580 (interactive)
|
|
5581 (gnus-set-global-variables)
|
|
5582 (prog1
|
|
5583 (when (gnus-summary-first-subject)
|
|
5584 (gnus-summary-show-thread)
|
|
5585 (gnus-summary-first-subject)
|
|
5586 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5587 (gnus-summary-position-point)))
|
|
5588
|
|
5589 (defun gnus-summary-best-unread-article ()
|
|
5590 "Select the unread article with the highest score."
|
|
5591 (interactive)
|
|
5592 (gnus-set-global-variables)
|
|
5593 (let ((best -1000000)
|
|
5594 (data gnus-newsgroup-data)
|
|
5595 article score)
|
|
5596 (while data
|
|
5597 (and (gnus-data-unread-p (car data))
|
|
5598 (> (setq score
|
|
5599 (gnus-summary-article-score (gnus-data-number (car data))))
|
|
5600 best)
|
|
5601 (setq best score
|
|
5602 article (gnus-data-number (car data))))
|
|
5603 (setq data (cdr data)))
|
|
5604 (prog1
|
|
5605 (if article
|
|
5606 (gnus-summary-goto-article article)
|
|
5607 (error "No unread articles"))
|
|
5608 (gnus-summary-position-point))))
|
|
5609
|
|
5610 (defun gnus-summary-last-subject ()
|
|
5611 "Go to the last displayed subject line in the group."
|
|
5612 (let ((article (gnus-data-number (car (gnus-data-list t)))))
|
|
5613 (when article
|
|
5614 (gnus-summary-goto-subject article))))
|
|
5615
|
|
5616 (defun gnus-summary-goto-article (article &optional all-headers force)
|
|
5617 "Fetch ARTICLE and display it if it exists.
|
|
5618 If ALL-HEADERS is non-nil, no header lines are hidden."
|
|
5619 (interactive
|
|
5620 (list
|
|
5621 (string-to-int
|
|
5622 (completing-read
|
|
5623 "Article number: "
|
|
5624 (mapcar (lambda (number) (list (int-to-string number)))
|
|
5625 gnus-newsgroup-limit)))
|
|
5626 current-prefix-arg
|
|
5627 t))
|
|
5628 (prog1
|
|
5629 (if (gnus-summary-goto-subject article force)
|
|
5630 (gnus-summary-display-article article all-headers)
|
|
5631 (gnus-message 4 "Couldn't go to article %s" article) nil)
|
|
5632 (gnus-summary-position-point)))
|
|
5633
|
|
5634 (defun gnus-summary-goto-last-article ()
|
|
5635 "Go to the previously read article."
|
|
5636 (interactive)
|
|
5637 (prog1
|
|
5638 (when gnus-last-article
|
|
5639 (gnus-summary-goto-article gnus-last-article))
|
|
5640 (gnus-summary-position-point)))
|
|
5641
|
|
5642 (defun gnus-summary-pop-article (number)
|
|
5643 "Pop one article off the history and go to the previous.
|
|
5644 NUMBER articles will be popped off."
|
|
5645 (interactive "p")
|
|
5646 (let (to)
|
|
5647 (setq gnus-newsgroup-history
|
|
5648 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
|
|
5649 (if to
|
|
5650 (gnus-summary-goto-article (car to))
|
|
5651 (error "Article history empty")))
|
|
5652 (gnus-summary-position-point))
|
|
5653
|
|
5654 ;; Summary commands and functions for limiting the summary buffer.
|
|
5655
|
|
5656 (defun gnus-summary-limit-to-articles (n)
|
|
5657 "Limit the summary buffer to the next N articles.
|
|
5658 If not given a prefix, use the process marked articles instead."
|
|
5659 (interactive "P")
|
|
5660 (gnus-set-global-variables)
|
|
5661 (prog1
|
|
5662 (let ((articles (gnus-summary-work-articles n)))
|
|
5663 (setq gnus-newsgroup-processable nil)
|
|
5664 (gnus-summary-limit articles))
|
|
5665 (gnus-summary-position-point)))
|
|
5666
|
|
5667 (defun gnus-summary-pop-limit (&optional total)
|
|
5668 "Restore the previous limit.
|
|
5669 If given a prefix, remove all limits."
|
|
5670 (interactive "P")
|
|
5671 (gnus-set-global-variables)
|
30
|
5672 (when total
|
16
|
5673 (setq gnus-newsgroup-limits
|
|
5674 (list (mapcar (lambda (h) (mail-header-number h))
|
|
5675 gnus-newsgroup-headers))))
|
|
5676 (unless gnus-newsgroup-limits
|
|
5677 (error "No limit to pop"))
|
|
5678 (prog1
|
|
5679 (gnus-summary-limit nil 'pop)
|
|
5680 (gnus-summary-position-point)))
|
|
5681
|
|
5682 (defun gnus-summary-limit-to-subject (subject &optional header)
|
|
5683 "Limit the summary buffer to articles that have subjects that match a regexp."
|
|
5684 (interactive "sLimit to subject (regexp): ")
|
|
5685 (unless header
|
|
5686 (setq header "subject"))
|
|
5687 (when (not (equal "" subject))
|
|
5688 (prog1
|
|
5689 (let ((articles (gnus-summary-find-matching
|
|
5690 (or header "subject") subject 'all)))
|
|
5691 (unless articles
|
|
5692 (error "Found no matches for \"%s\"" subject))
|
|
5693 (gnus-summary-limit articles))
|
|
5694 (gnus-summary-position-point))))
|
|
5695
|
|
5696 (defun gnus-summary-limit-to-author (from)
|
|
5697 "Limit the summary buffer to articles that have authors that match a regexp."
|
|
5698 (interactive "sLimit to author (regexp): ")
|
|
5699 (gnus-summary-limit-to-subject from "from"))
|
|
5700
|
|
5701 (defun gnus-summary-limit-to-age (age &optional younger-p)
|
30
|
5702 "Limit the summary buffer to articles that are older than (or equal) AGE days.
|
16
|
5703 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
|
|
5704 articles that are younger than AGE days."
|
|
5705 (interactive "nTime in days: \nP")
|
|
5706 (prog1
|
|
5707 (let ((data gnus-newsgroup-data)
|
|
5708 (cutoff (nnmail-days-to-time age))
|
|
5709 articles d date is-younger)
|
|
5710 (while (setq d (pop data))
|
|
5711 (when (and (vectorp (gnus-data-header d))
|
|
5712 (setq date (mail-header-date (gnus-data-header d))))
|
|
5713 (setq is-younger (nnmail-time-less
|
|
5714 (nnmail-time-since (nnmail-date-to-time date))
|
|
5715 cutoff))
|
|
5716 (when (if younger-p is-younger (not is-younger))
|
|
5717 (push (gnus-data-number d) articles))))
|
|
5718 (gnus-summary-limit (nreverse articles)))
|
|
5719 (gnus-summary-position-point)))
|
|
5720
|
|
5721 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5722 (make-obsolete
|
|
5723 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5724
|
|
5725 (defun gnus-summary-limit-to-unread (&optional all)
|
|
5726 "Limit the summary buffer to articles that are not marked as read.
|
|
5727 If ALL is non-nil, limit strictly to unread articles."
|
|
5728 (interactive "P")
|
|
5729 (if all
|
|
5730 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
|
|
5731 (gnus-summary-limit-to-marks
|
|
5732 ;; Concat all the marks that say that an article is read and have
|
|
5733 ;; those removed.
|
|
5734 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
|
|
5735 gnus-killed-mark gnus-kill-file-mark
|
|
5736 gnus-low-score-mark gnus-expirable-mark
|
|
5737 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
|
32
|
5738 gnus-duplicate-mark gnus-souped-mark)
|
16
|
5739 'reverse)))
|
|
5740
|
|
5741 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
|
|
5742 (make-obsolete 'gnus-summary-delete-marked-with
|
|
5743 'gnus-summary-limit-exlude-marks)
|
|
5744
|
|
5745 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
|
|
5746 "Exclude articles that are marked with MARKS (e.g. \"DK\").
|
|
5747 If REVERSE, limit the summary buffer to articles that are marked
|
|
5748 with MARKS. MARKS can either be a string of marks or a list of marks.
|
|
5749 Returns how many articles were removed."
|
|
5750 (interactive "sMarks: ")
|
|
5751 (gnus-summary-limit-to-marks marks t))
|
30
|
5752
|
16
|
5753 (defun gnus-summary-limit-to-marks (marks &optional reverse)
|
|
5754 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
|
|
5755 If REVERSE (the prefix), limit the summary buffer to articles that are
|
|
5756 not marked with MARKS. MARKS can either be a string of marks or a
|
|
5757 list of marks.
|
|
5758 Returns how many articles were removed."
|
|
5759 (interactive (list (read-string "Marks: ") current-prefix-arg))
|
|
5760 (gnus-set-global-variables)
|
|
5761 (prog1
|
|
5762 (let ((data gnus-newsgroup-data)
|
|
5763 (marks (if (listp marks) marks
|
|
5764 (append marks nil))) ; Transform to list.
|
|
5765 articles)
|
|
5766 (while data
|
|
5767 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
|
|
5768 (memq (gnus-data-mark (car data)) marks))
|
|
5769 (push (gnus-data-number (car data)) articles))
|
|
5770 (setq data (cdr data)))
|
|
5771 (gnus-summary-limit articles))
|
|
5772 (gnus-summary-position-point)))
|
|
5773
|
|
5774 (defun gnus-summary-limit-to-score (&optional score)
|
|
5775 "Limit to articles with score at or above SCORE."
|
|
5776 (interactive "P")
|
|
5777 (gnus-set-global-variables)
|
|
5778 (setq score (if score
|
|
5779 (prefix-numeric-value score)
|
|
5780 (or gnus-summary-default-score 0)))
|
|
5781 (let ((data gnus-newsgroup-data)
|
|
5782 articles)
|
|
5783 (while data
|
|
5784 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
|
|
5785 score)
|
|
5786 (push (gnus-data-number (car data)) articles))
|
|
5787 (setq data (cdr data)))
|
|
5788 (prog1
|
|
5789 (gnus-summary-limit articles)
|
|
5790 (gnus-summary-position-point))))
|
|
5791
|
|
5792 (defun gnus-summary-limit-include-dormant ()
|
|
5793 "Display all the hidden articles that are marked as dormant."
|
|
5794 (interactive)
|
|
5795 (gnus-set-global-variables)
|
|
5796 (unless gnus-newsgroup-dormant
|
|
5797 (error "There are no dormant articles in this group"))
|
|
5798 (prog1
|
|
5799 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
|
|
5800 (gnus-summary-position-point)))
|
|
5801
|
|
5802 (defun gnus-summary-limit-exclude-dormant ()
|
|
5803 "Hide all dormant articles."
|
|
5804 (interactive)
|
|
5805 (gnus-set-global-variables)
|
|
5806 (prog1
|
|
5807 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
|
|
5808 (gnus-summary-position-point)))
|
|
5809
|
|
5810 (defun gnus-summary-limit-exclude-childless-dormant ()
|
|
5811 "Hide all dormant articles that have no children."
|
|
5812 (interactive)
|
|
5813 (gnus-set-global-variables)
|
|
5814 (let ((data (gnus-data-list t))
|
|
5815 articles d children)
|
|
5816 ;; Find all articles that are either not dormant or have
|
|
5817 ;; children.
|
|
5818 (while (setq d (pop data))
|
|
5819 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
|
30
|
5820 (and (setq children
|
16
|
5821 (gnus-article-children (gnus-data-number d)))
|
|
5822 (let (found)
|
|
5823 (while children
|
|
5824 (when (memq (car children) articles)
|
|
5825 (setq children nil
|
|
5826 found t))
|
|
5827 (pop children))
|
|
5828 found)))
|
|
5829 (push (gnus-data-number d) articles)))
|
|
5830 ;; Do the limiting.
|
|
5831 (prog1
|
|
5832 (gnus-summary-limit articles)
|
|
5833 (gnus-summary-position-point))))
|
|
5834
|
|
5835 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
|
|
5836 "Mark all unread excluded articles as read.
|
|
5837 If ALL, mark even excluded ticked and dormants as read."
|
|
5838 (interactive "P")
|
|
5839 (let ((articles (gnus-sorted-complement
|
|
5840 (sort
|
|
5841 (mapcar (lambda (h) (mail-header-number h))
|
|
5842 gnus-newsgroup-headers)
|
|
5843 '<)
|
|
5844 (sort gnus-newsgroup-limit '<)))
|
|
5845 article)
|
|
5846 (setq gnus-newsgroup-unreads nil)
|
|
5847 (if all
|
|
5848 (setq gnus-newsgroup-dormant nil
|
|
5849 gnus-newsgroup-marked nil
|
|
5850 gnus-newsgroup-reads
|
|
5851 (nconc
|
|
5852 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
|
|
5853 gnus-newsgroup-reads))
|
|
5854 (while (setq article (pop articles))
|
|
5855 (unless (or (memq article gnus-newsgroup-dormant)
|
|
5856 (memq article gnus-newsgroup-marked))
|
|
5857 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
|
|
5858
|
|
5859 (defun gnus-summary-limit (articles &optional pop)
|
|
5860 (if pop
|
|
5861 ;; We pop the previous limit off the stack and use that.
|
|
5862 (setq articles (car gnus-newsgroup-limits)
|
|
5863 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
|
|
5864 ;; We use the new limit, so we push the old limit on the stack.
|
|
5865 (push gnus-newsgroup-limit gnus-newsgroup-limits))
|
|
5866 ;; Set the limit.
|
|
5867 (setq gnus-newsgroup-limit articles)
|
|
5868 (let ((total (length gnus-newsgroup-data))
|
|
5869 (data (gnus-data-find-list (gnus-summary-article-number)))
|
|
5870 (gnus-summary-mark-below nil) ; Inhibit this.
|
|
5871 found)
|
|
5872 ;; This will do all the work of generating the new summary buffer
|
|
5873 ;; according to the new limit.
|
|
5874 (gnus-summary-prepare)
|
|
5875 ;; Hide any threads, possibly.
|
|
5876 (and gnus-show-threads
|
|
5877 gnus-thread-hide-subtree
|
|
5878 (gnus-summary-hide-all-threads))
|
|
5879 ;; Try to return to the article you were at, or one in the
|
|
5880 ;; neighborhood.
|
|
5881 (when data
|
|
5882 ;; We try to find some article after the current one.
|
|
5883 (while data
|
|
5884 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
|
|
5885 (setq data nil
|
|
5886 found t))
|
|
5887 (setq data (cdr data))))
|
|
5888 (unless found
|
|
5889 ;; If there is no data, that means that we were after the last
|
|
5890 ;; article. The same goes when we can't find any articles
|
|
5891 ;; after the current one.
|
|
5892 (goto-char (point-max))
|
|
5893 (gnus-summary-find-prev))
|
|
5894 ;; We return how many articles were removed from the summary
|
|
5895 ;; buffer as a result of the new limit.
|
|
5896 (- total (length gnus-newsgroup-data))))
|
|
5897
|
|
5898 (defsubst gnus-invisible-cut-children (threads)
|
|
5899 (let ((num 0))
|
|
5900 (while threads
|
|
5901 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
|
|
5902 (incf num))
|
|
5903 (pop threads))
|
|
5904 (< num 2)))
|
|
5905
|
|
5906 (defsubst gnus-cut-thread (thread)
|
|
5907 "Go forwards in the thread until we find an article that we want to display."
|
|
5908 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5909 (eq gnus-build-sparse-threads 'some)
|
|
5910 (eq gnus-build-sparse-threads 'more))
|
|
5911 ;; Deal with old-fetched headers and sparse threads.
|
|
5912 (while (and
|
|
5913 thread
|
|
5914 (or
|
|
5915 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
|
|
5916 (gnus-summary-article-ancient-p
|
|
5917 (mail-header-number (car thread))))
|
|
5918 (progn
|
|
5919 (if (<= (length (cdr thread)) 1)
|
|
5920 (setq thread (cadr thread))
|
|
5921 (when (gnus-invisible-cut-children (cdr thread))
|
|
5922 (let ((th (cdr thread)))
|
|
5923 (while th
|
|
5924 (if (memq (mail-header-number (caar th))
|
|
5925 gnus-newsgroup-limit)
|
|
5926 (setq thread (car th)
|
|
5927 th nil)
|
|
5928 (setq th (cdr th)))))))))
|
|
5929 ))
|
|
5930 thread)
|
|
5931
|
|
5932 (defun gnus-cut-threads (threads)
|
|
5933 "Cut off all uninteresting articles from the beginning of threads."
|
|
5934 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5935 (eq gnus-build-sparse-threads 'some)
|
|
5936 (eq gnus-build-sparse-threads 'more))
|
|
5937 (let ((th threads))
|
|
5938 (while th
|
|
5939 (setcar th (gnus-cut-thread (car th)))
|
|
5940 (setq th (cdr th)))))
|
|
5941 ;; Remove nixed out threads.
|
|
5942 (delq nil threads))
|
|
5943
|
|
5944 (defun gnus-summary-initial-limit (&optional show-if-empty)
|
|
5945 "Figure out what the initial limit is supposed to be on group entry.
|
|
5946 This entails weeding out unwanted dormants, low-scored articles,
|
|
5947 fetch-old-headers verbiage, and so on."
|
|
5948 ;; Most groups have nothing to remove.
|
|
5949 (if (or gnus-inhibit-limiting
|
|
5950 (and (null gnus-newsgroup-dormant)
|
|
5951 (not (eq gnus-fetch-old-headers 'some))
|
|
5952 (null gnus-summary-expunge-below)
|
|
5953 (not (eq gnus-build-sparse-threads 'some))
|
|
5954 (not (eq gnus-build-sparse-threads 'more))
|
|
5955 (null gnus-thread-expunge-below)
|
|
5956 (not gnus-use-nocem)))
|
|
5957 () ; Do nothing.
|
|
5958 (push gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
5959 (setq gnus-newsgroup-limit nil)
|
|
5960 (mapatoms
|
|
5961 (lambda (node)
|
|
5962 (unless (car (symbol-value node))
|
|
5963 ;; These threads have no parents -- they are roots.
|
|
5964 (let ((nodes (cdr (symbol-value node)))
|
|
5965 thread)
|
|
5966 (while nodes
|
|
5967 (if (and gnus-thread-expunge-below
|
|
5968 (< (gnus-thread-total-score (car nodes))
|
|
5969 gnus-thread-expunge-below))
|
|
5970 (gnus-expunge-thread (pop nodes))
|
|
5971 (setq thread (pop nodes))
|
|
5972 (gnus-summary-limit-children thread))))))
|
|
5973 gnus-newsgroup-dependencies)
|
|
5974 ;; If this limitation resulted in an empty group, we might
|
|
5975 ;; pop the previous limit and use it instead.
|
|
5976 (when (and (not gnus-newsgroup-limit)
|
|
5977 show-if-empty)
|
|
5978 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
|
|
5979 gnus-newsgroup-limit))
|
|
5980
|
|
5981 (defun gnus-summary-limit-children (thread)
|
|
5982 "Return 1 if this subthread is visible and 0 if it is not."
|
|
5983 ;; First we get the number of visible children to this thread. This
|
|
5984 ;; is done by recursing down the thread using this function, so this
|
|
5985 ;; will really go down to a leaf article first, before slowly
|
|
5986 ;; working its way up towards the root.
|
|
5987 (when thread
|
|
5988 (let ((children
|
|
5989 (if (cdr thread)
|
|
5990 (apply '+ (mapcar 'gnus-summary-limit-children
|
|
5991 (cdr thread)))
|
|
5992 0))
|
|
5993 (number (mail-header-number (car thread)))
|
|
5994 score)
|
|
5995 (if (and
|
|
5996 (not (memq number gnus-newsgroup-marked))
|
|
5997 (or
|
|
5998 ;; If this article is dormant and has absolutely no visible
|
|
5999 ;; children, then this article isn't visible.
|
|
6000 (and (memq number gnus-newsgroup-dormant)
|
|
6001 (zerop children))
|
|
6002 ;; If this is "fetch-old-headered" and there is no
|
|
6003 ;; visible children, then we don't want this article.
|
|
6004 (and (eq gnus-fetch-old-headers 'some)
|
|
6005 (gnus-summary-article-ancient-p number)
|
|
6006 (zerop children))
|
|
6007 ;; If this is a sparsely inserted article with no children,
|
|
6008 ;; we don't want it.
|
|
6009 (and (eq gnus-build-sparse-threads 'some)
|
|
6010 (gnus-summary-article-sparse-p number)
|
|
6011 (zerop children))
|
|
6012 ;; If we use expunging, and this article is really
|
|
6013 ;; low-scored, then we don't want this article.
|
|
6014 (when (and gnus-summary-expunge-below
|
|
6015 (< (setq score
|
|
6016 (or (cdr (assq number gnus-newsgroup-scored))
|
|
6017 gnus-summary-default-score))
|
|
6018 gnus-summary-expunge-below))
|
|
6019 ;; We increase the expunge-tally here, but that has
|
|
6020 ;; nothing to do with the limits, really.
|
|
6021 (incf gnus-newsgroup-expunged-tally)
|
|
6022 ;; We also mark as read here, if that's wanted.
|
|
6023 (when (and gnus-summary-mark-below
|
|
6024 (< score gnus-summary-mark-below))
|
|
6025 (setq gnus-newsgroup-unreads
|
|
6026 (delq number gnus-newsgroup-unreads))
|
|
6027 (if gnus-newsgroup-auto-expire
|
|
6028 (push number gnus-newsgroup-expirable)
|
|
6029 (push (cons number gnus-low-score-mark)
|
|
6030 gnus-newsgroup-reads)))
|
|
6031 t)
|
|
6032 ;; Check NoCeM things.
|
|
6033 (if (and gnus-use-nocem
|
|
6034 (gnus-nocem-unwanted-article-p
|
|
6035 (mail-header-id (car thread))))
|
|
6036 (progn
|
30
|
6037 (setq gnus-newsgroup-reads
|
16
|
6038 (delq number gnus-newsgroup-unreads))
|
|
6039 t))))
|
|
6040 ;; Nope, invisible article.
|
|
6041 0
|
|
6042 ;; Ok, this article is to be visible, so we add it to the limit
|
|
6043 ;; and return 1.
|
|
6044 (push number gnus-newsgroup-limit)
|
|
6045 1))))
|
|
6046
|
|
6047 (defun gnus-expunge-thread (thread)
|
|
6048 "Mark all articles in THREAD as read."
|
|
6049 (let* ((number (mail-header-number (car thread))))
|
|
6050 (incf gnus-newsgroup-expunged-tally)
|
|
6051 ;; We also mark as read here, if that's wanted.
|
|
6052 (setq gnus-newsgroup-unreads
|
|
6053 (delq number gnus-newsgroup-unreads))
|
|
6054 (if gnus-newsgroup-auto-expire
|
|
6055 (push number gnus-newsgroup-expirable)
|
|
6056 (push (cons number gnus-low-score-mark)
|
|
6057 gnus-newsgroup-reads)))
|
|
6058 ;; Go recursively through all subthreads.
|
|
6059 (mapcar 'gnus-expunge-thread (cdr thread)))
|
|
6060
|
|
6061 ;; Summary article oriented commands
|
|
6062
|
|
6063 (defun gnus-summary-refer-parent-article (n)
|
|
6064 "Refer parent article N times.
|
|
6065 If N is negative, go to ancestor -N instead.
|
|
6066 The difference between N and the number of articles fetched is returned."
|
|
6067 (interactive "p")
|
|
6068 (gnus-set-global-variables)
|
|
6069 (let ((skip 1)
|
|
6070 error header ref)
|
|
6071 (when (not (natnump n))
|
|
6072 (setq skip (abs n)
|
|
6073 n 1))
|
|
6074 (while (and (> n 0)
|
|
6075 (not error))
|
|
6076 (setq header (gnus-summary-article-header))
|
|
6077 (if (and (eq (mail-header-number header)
|
|
6078 (cdr gnus-article-current))
|
|
6079 (equal gnus-newsgroup-name
|
|
6080 (car gnus-article-current)))
|
|
6081 ;; If we try to find the parent of the currently
|
|
6082 ;; displayed article, then we take a look at the actual
|
|
6083 ;; References header, since this is slightly more
|
|
6084 ;; reliable than the References field we got from the
|
|
6085 ;; server.
|
|
6086 (save-excursion
|
|
6087 (set-buffer gnus-original-article-buffer)
|
|
6088 (nnheader-narrow-to-headers)
|
|
6089 (unless (setq ref (message-fetch-field "references"))
|
|
6090 (setq ref (message-fetch-field "in-reply-to")))
|
|
6091 (widen))
|
|
6092 (setq ref
|
|
6093 ;; It's not the current article, so we take a bet on
|
|
6094 ;; the value we got from the server.
|
|
6095 (mail-header-references header)))
|
|
6096 (if (and ref
|
|
6097 (not (equal ref "")))
|
|
6098 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
|
|
6099 (gnus-message 1 "Couldn't find parent"))
|
|
6100 (gnus-message 1 "No references in article %d"
|
|
6101 (gnus-summary-article-number))
|
|
6102 (setq error t))
|
|
6103 (decf n))
|
|
6104 (gnus-summary-position-point)
|
|
6105 n))
|
|
6106
|
|
6107 (defun gnus-summary-refer-references ()
|
|
6108 "Fetch all articles mentioned in the References header.
|
|
6109 Return how many articles were fetched."
|
|
6110 (interactive)
|
|
6111 (gnus-set-global-variables)
|
|
6112 (let ((ref (mail-header-references (gnus-summary-article-header)))
|
|
6113 (current (gnus-summary-article-number))
|
|
6114 (n 0))
|
|
6115 (if (or (not ref)
|
|
6116 (equal ref ""))
|
|
6117 (error "No References in the current article")
|
|
6118 ;; For each Message-ID in the References header...
|
|
6119 (while (string-match "<[^>]*>" ref)
|
|
6120 (incf n)
|
|
6121 ;; ... fetch that article.
|
|
6122 (gnus-summary-refer-article
|
|
6123 (prog1 (match-string 0 ref)
|
|
6124 (setq ref (substring ref (match-end 0))))))
|
|
6125 (gnus-summary-goto-subject current)
|
|
6126 (gnus-summary-position-point)
|
|
6127 n)))
|
|
6128
|
|
6129 (defun gnus-summary-refer-article (message-id)
|
|
6130 "Fetch an article specified by MESSAGE-ID."
|
|
6131 (interactive "sMessage-ID: ")
|
|
6132 (when (and (stringp message-id)
|
|
6133 (not (zerop (length message-id))))
|
|
6134 ;; Construct the correct Message-ID if necessary.
|
|
6135 ;; Suggested by tale@pawl.rpi.edu.
|
|
6136 (unless (string-match "^<" message-id)
|
|
6137 (setq message-id (concat "<" message-id)))
|
|
6138 (unless (string-match ">$" message-id)
|
|
6139 (setq message-id (concat message-id ">")))
|
|
6140 (let* ((header (gnus-id-to-header message-id))
|
|
6141 (sparse (and header
|
30
|
6142 (gnus-summary-article-sparse-p
|
16
|
6143 (mail-header-number header)))))
|
|
6144 (if header
|
|
6145 (prog1
|
|
6146 ;; The article is present in the buffer, to we just go to it.
|
30
|
6147 (gnus-summary-goto-article
|
16
|
6148 (mail-header-number header) nil header)
|
|
6149 (when sparse
|
|
6150 (gnus-summary-update-article (mail-header-number header))))
|
|
6151 ;; We fetch the article
|
30
|
6152 (let ((gnus-override-method
|
16
|
6153 (and (gnus-news-group-p gnus-newsgroup-name)
|
|
6154 gnus-refer-article-method))
|
|
6155 number)
|
|
6156 ;; Start the special refer-article method, if necessary.
|
|
6157 (when (and gnus-refer-article-method
|
|
6158 (gnus-news-group-p gnus-newsgroup-name))
|
|
6159 (gnus-check-server gnus-refer-article-method))
|
|
6160 ;; Fetch the header, and display the article.
|
|
6161 (if (setq number (gnus-summary-insert-subject message-id))
|
|
6162 (gnus-summary-select-article nil nil nil number)
|
|
6163 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
|
|
6164
|
|
6165 (defun gnus-summary-enter-digest-group (&optional force)
|
|
6166 "Enter an nndoc group based on the current article.
|
|
6167 If FORCE, force a digest interpretation. If not, try
|
|
6168 to guess what the document format is."
|
|
6169 (interactive "P")
|
|
6170 (gnus-set-global-variables)
|
|
6171 (let ((conf gnus-current-window-configuration))
|
|
6172 (save-excursion
|
|
6173 (gnus-summary-select-article))
|
|
6174 (setq gnus-current-window-configuration conf)
|
|
6175 (let* ((name (format "%s-%d"
|
|
6176 (gnus-group-prefixed-name
|
|
6177 gnus-newsgroup-name (list 'nndoc ""))
|
|
6178 (save-excursion
|
|
6179 (set-buffer gnus-summary-buffer)
|
|
6180 gnus-current-article)))
|
|
6181 (ogroup gnus-newsgroup-name)
|
|
6182 (params (append (gnus-info-params (gnus-get-info ogroup))
|
|
6183 (list (cons 'to-group ogroup))))
|
|
6184 (case-fold-search t)
|
|
6185 (buf (current-buffer))
|
|
6186 dig)
|
|
6187 (save-excursion
|
|
6188 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
|
|
6189 (insert-buffer-substring gnus-original-article-buffer)
|
|
6190 ;; Remove lines that may lead nndoc to misinterpret the
|
|
6191 ;; document type.
|
|
6192 (narrow-to-region
|
|
6193 (goto-char (point-min))
|
|
6194 (or (search-forward "\n\n" nil t) (point)))
|
|
6195 (goto-char (point-min))
|
|
6196 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6197 (widen))
|
|
6198 (unwind-protect
|
|
6199 (if (gnus-group-read-ephemeral-group
|
|
6200 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
|
30
|
6201 (nndoc-article-type
|
16
|
6202 ,(if force 'digest 'guess))) t)
|
|
6203 ;; Make all postings to this group go to the parent group.
|
|
6204 (nconc (gnus-info-params (gnus-get-info name))
|
|
6205 params)
|
|
6206 ;; Couldn't select this doc group.
|
|
6207 (switch-to-buffer buf)
|
|
6208 (gnus-set-global-variables)
|
|
6209 (gnus-configure-windows 'summary)
|
|
6210 (gnus-message 3 "Article couldn't be entered?"))
|
|
6211 (kill-buffer dig)))))
|
|
6212
|
|
6213 (defun gnus-summary-read-document (n)
|
|
6214 "Open a new group based on the current article(s).
|
|
6215 This will allow you to read digests and other similar
|
|
6216 documents as newsgroups.
|
|
6217 Obeys the standard process/prefix convention."
|
|
6218 (interactive "P")
|
|
6219 (let* ((articles (gnus-summary-work-articles n))
|
|
6220 (ogroup gnus-newsgroup-name)
|
|
6221 (params (append (gnus-info-params (gnus-get-info ogroup))
|
|
6222 (list (cons 'to-group ogroup))))
|
|
6223 article group egroup groups vgroup)
|
|
6224 (while (setq article (pop articles))
|
|
6225 (setq group (format "%s-%d" gnus-newsgroup-name article))
|
|
6226 (gnus-summary-remove-process-mark article)
|
|
6227 (when (gnus-summary-display-article article)
|
|
6228 (save-excursion
|
|
6229 (nnheader-temp-write nil
|
|
6230 (insert-buffer-substring gnus-original-article-buffer)
|
|
6231 ;; Remove some headers that may lead nndoc to make
|
|
6232 ;; the wrong guess.
|
|
6233 (message-narrow-to-head)
|
|
6234 (goto-char (point-min))
|
|
6235 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6236 (widen)
|
|
6237 (if (setq egroup
|
|
6238 (gnus-group-read-ephemeral-group
|
|
6239 group `(nndoc ,group (nndoc-address ,(current-buffer))
|
|
6240 (nndoc-article-type guess))
|
|
6241 t nil t))
|
|
6242 (progn
|
|
6243 ;; Make all postings to this group go to the parent group.
|
|
6244 (nconc (gnus-info-params (gnus-get-info egroup))
|
|
6245 params)
|
|
6246 (push egroup groups))
|
|
6247 ;; Couldn't select this doc group.
|
|
6248 (gnus-error 3 "Article couldn't be entered"))))))
|
|
6249 ;; Now we have selected all the documents.
|
|
6250 (cond
|
|
6251 ((not groups)
|
|
6252 (error "None of the articles could be interpreted as documents"))
|
|
6253 ((gnus-group-read-ephemeral-group
|
|
6254 (setq vgroup (format
|
|
6255 "nnvirtual:%s-%s" gnus-newsgroup-name
|
|
6256 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
|
|
6257 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
|
|
6258 t
|
|
6259 (cons (current-buffer) 'summary)))
|
|
6260 (t
|
|
6261 (error "Couldn't select virtual nndoc group")))))
|
30
|
6262
|
16
|
6263 (defun gnus-summary-isearch-article (&optional regexp-p)
|
|
6264 "Do incremental search forward on the current article.
|
|
6265 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
|
|
6266 (interactive "P")
|
|
6267 (gnus-set-global-variables)
|
|
6268 (gnus-summary-select-article)
|
|
6269 (gnus-configure-windows 'article)
|
|
6270 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6271 ;;(goto-char (point-min))
|
|
6272 (isearch-forward regexp-p)))
|
|
6273
|
|
6274 (defun gnus-summary-search-article-forward (regexp &optional backward)
|
|
6275 "Search for an article containing REGEXP forward.
|
|
6276 If BACKWARD, search backward instead."
|
|
6277 (interactive
|
|
6278 (list (read-string
|
|
6279 (format "Search article %s (regexp%s): "
|
|
6280 (if current-prefix-arg "backward" "forward")
|
|
6281 (if gnus-last-search-regexp
|
|
6282 (concat ", default " gnus-last-search-regexp)
|
|
6283 "")))
|
|
6284 current-prefix-arg))
|
|
6285 (gnus-set-global-variables)
|
|
6286 (if (string-equal regexp "")
|
|
6287 (setq regexp (or gnus-last-search-regexp ""))
|
|
6288 (setq gnus-last-search-regexp regexp))
|
|
6289 (if (gnus-summary-search-article regexp backward)
|
|
6290 (gnus-summary-show-thread)
|
|
6291 (error "Search failed: \"%s\"" regexp)))
|
|
6292
|
|
6293 (defun gnus-summary-search-article-backward (regexp)
|
|
6294 "Search for an article containing REGEXP backward."
|
|
6295 (interactive
|
|
6296 (list (read-string
|
|
6297 (format "Search article backward (regexp%s): "
|
|
6298 (if gnus-last-search-regexp
|
|
6299 (concat ", default " gnus-last-search-regexp)
|
|
6300 "")))))
|
|
6301 (gnus-summary-search-article-forward regexp 'backward))
|
|
6302
|
|
6303 (defun gnus-summary-search-article (regexp &optional backward)
|
|
6304 "Search for an article containing REGEXP.
|
|
6305 Optional argument BACKWARD means do search for backward.
|
|
6306 `gnus-select-article-hook' is not called during the search."
|
|
6307 (let ((gnus-select-article-hook nil) ;Disable hook.
|
|
6308 (gnus-article-display-hook nil)
|
|
6309 (gnus-mark-article-hook nil) ;Inhibit marking as read.
|
|
6310 (gnus-use-article-prefetch nil)
|
|
6311 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
|
|
6312 (sum (current-buffer))
|
|
6313 (found nil)
|
|
6314 point)
|
|
6315 (gnus-save-hidden-threads
|
|
6316 (gnus-summary-select-article)
|
|
6317 (set-buffer gnus-article-buffer)
|
|
6318 (when backward
|
|
6319 (forward-line -1))
|
|
6320 (while (not found)
|
|
6321 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
|
|
6322 (if (if backward
|
|
6323 (re-search-backward regexp nil t)
|
|
6324 (re-search-forward regexp nil t))
|
|
6325 ;; We found the regexp.
|
|
6326 (progn
|
|
6327 (setq found 'found)
|
|
6328 (beginning-of-line)
|
|
6329 (set-window-start
|
|
6330 (get-buffer-window (current-buffer))
|
|
6331 (point))
|
|
6332 (forward-line 1)
|
|
6333 (set-buffer sum)
|
|
6334 (setq point (point)))
|
|
6335 ;; We didn't find it, so we go to the next article.
|
|
6336 (set-buffer sum)
|
|
6337 (setq found 'not)
|
|
6338 (while (eq found 'not)
|
|
6339 (if (not (if backward (gnus-summary-find-prev)
|
|
6340 (gnus-summary-find-next)))
|
|
6341 ;; No more articles.
|
|
6342 (setq found t)
|
|
6343 ;; Select the next article and adjust point.
|
|
6344 (unless (gnus-summary-article-sparse-p
|
|
6345 (gnus-summary-article-number))
|
|
6346 (setq found nil)
|
|
6347 (gnus-summary-select-article)
|
|
6348 (set-buffer gnus-article-buffer)
|
|
6349 (widen)
|
|
6350 (goto-char (if backward (point-max) (point-min))))))))
|
|
6351 (gnus-message 7 ""))
|
|
6352 ;; Return whether we found the regexp.
|
|
6353 (when (eq found 'found)
|
|
6354 (goto-char point)
|
|
6355 (gnus-summary-show-thread)
|
|
6356 (gnus-summary-goto-subject gnus-current-article)
|
|
6357 (gnus-summary-position-point)
|
|
6358 t)))
|
|
6359
|
|
6360 (defun gnus-summary-find-matching (header regexp &optional backward unread
|
|
6361 not-case-fold)
|
|
6362 "Return a list of all articles that match REGEXP on HEADER.
|
|
6363 The search stars on the current article and goes forwards unless
|
|
6364 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
|
|
6365 If UNREAD is non-nil, only unread articles will
|
|
6366 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
|
|
6367 in the comparisons."
|
|
6368 (let ((data (if (eq backward 'all) gnus-newsgroup-data
|
|
6369 (gnus-data-find-list
|
|
6370 (gnus-summary-article-number) (gnus-data-list backward))))
|
|
6371 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
|
|
6372 (case-fold-search (not not-case-fold))
|
|
6373 articles d)
|
|
6374 (unless (fboundp (intern (concat "mail-header-" header)))
|
|
6375 (error "%s is not a valid header" header))
|
|
6376 (while data
|
|
6377 (setq d (car data))
|
|
6378 (and (or (not unread) ; We want all articles...
|
|
6379 (gnus-data-unread-p d)) ; Or just unreads.
|
|
6380 (vectorp (gnus-data-header d)) ; It's not a pseudo.
|
|
6381 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
|
|
6382 (push (gnus-data-number d) articles)) ; Success!
|
|
6383 (setq data (cdr data)))
|
|
6384 (nreverse articles)))
|
|
6385
|
|
6386 (defun gnus-summary-execute-command (header regexp command &optional backward)
|
|
6387 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
|
|
6388 If HEADER is an empty string (or nil), the match is done on the entire
|
|
6389 article. If BACKWARD (the prefix) is non-nil, search backward instead."
|
|
6390 (interactive
|
|
6391 (list (let ((completion-ignore-case t))
|
|
6392 (completing-read
|
|
6393 "Header name: "
|
|
6394 (mapcar (lambda (string) (list string))
|
|
6395 '("Number" "Subject" "From" "Lines" "Date"
|
|
6396 "Message-ID" "Xref" "References" "Body"))
|
|
6397 nil 'require-match))
|
|
6398 (read-string "Regexp: ")
|
|
6399 (read-key-sequence "Command: ")
|
|
6400 current-prefix-arg))
|
|
6401 (when (equal header "Body")
|
|
6402 (setq header ""))
|
|
6403 (gnus-set-global-variables)
|
|
6404 ;; Hidden thread subtrees must be searched as well.
|
|
6405 (gnus-summary-show-all-threads)
|
|
6406 ;; We don't want to change current point nor window configuration.
|
|
6407 (save-excursion
|
|
6408 (save-window-excursion
|
|
6409 (gnus-message 6 "Executing %s..." (key-description command))
|
|
6410 ;; We'd like to execute COMMAND interactively so as to give arguments.
|
|
6411 (gnus-execute header regexp
|
|
6412 `(call-interactively ',(key-binding command))
|
|
6413 backward)
|
|
6414 (gnus-message 6 "Executing %s...done" (key-description command)))))
|
|
6415
|
|
6416 (defun gnus-summary-beginning-of-article ()
|
|
6417 "Scroll the article back to the beginning."
|
|
6418 (interactive)
|
|
6419 (gnus-set-global-variables)
|
|
6420 (gnus-summary-select-article)
|
|
6421 (gnus-configure-windows 'article)
|
|
6422 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6423 (widen)
|
|
6424 (goto-char (point-min))
|
|
6425 (when gnus-break-pages
|
|
6426 (gnus-narrow-to-page))))
|
|
6427
|
|
6428 (defun gnus-summary-end-of-article ()
|
|
6429 "Scroll to the end of the article."
|
|
6430 (interactive)
|
|
6431 (gnus-set-global-variables)
|
|
6432 (gnus-summary-select-article)
|
|
6433 (gnus-configure-windows 'article)
|
|
6434 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6435 (widen)
|
|
6436 (goto-char (point-max))
|
|
6437 (recenter -3)
|
|
6438 (when gnus-break-pages
|
|
6439 (gnus-narrow-to-page))))
|
|
6440
|
|
6441 (defun gnus-summary-print-article (&optional filename)
|
|
6442 "Generate and print a PostScript image of the article buffer.
|
|
6443
|
|
6444 If the optional argument FILENAME is nil, send the image to the printer.
|
|
6445 If FILENAME is a string, save the PostScript image in a file with that
|
|
6446 name. If FILENAME is a number, prompt the user for the name of the file
|
|
6447 to save in."
|
|
6448 (interactive (list (ps-print-preprint current-prefix-arg)))
|
|
6449 (gnus-summary-select-article)
|
|
6450 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6451 (let ((buffer (generate-new-buffer " *print*")))
|
|
6452 (unwind-protect
|
|
6453 (progn
|
|
6454 (copy-to-buffer buffer (point-min) (point-max))
|
|
6455 (set-buffer buffer)
|
|
6456 (gnus-article-delete-invisible-text)
|
22
|
6457 (run-hooks 'gnus-ps-print-hook)
|
16
|
6458 (ps-print-buffer-with-faces filename))
|
|
6459 (kill-buffer buffer)))))
|
|
6460
|
|
6461 (defun gnus-summary-show-article (&optional arg)
|
|
6462 "Force re-fetching of the current article.
|
|
6463 If ARG (the prefix) is non-nil, show the raw article without any
|
|
6464 article massaging functions being run."
|
|
6465 (interactive "P")
|
|
6466 (gnus-set-global-variables)
|
|
6467 (if (not arg)
|
|
6468 ;; Select the article the normal way.
|
|
6469 (gnus-summary-select-article nil 'force)
|
|
6470 ;; Bind the article treatment functions to nil.
|
|
6471 (let ((gnus-have-all-headers t)
|
|
6472 gnus-article-display-hook
|
|
6473 gnus-article-prepare-hook
|
|
6474 gnus-break-pages
|
|
6475 gnus-visual)
|
|
6476 (gnus-summary-select-article nil 'force)))
|
|
6477 (gnus-summary-goto-subject gnus-current-article)
|
|
6478 ; (gnus-configure-windows 'article)
|
|
6479 (gnus-summary-position-point))
|
|
6480
|
|
6481 (defun gnus-summary-verbose-headers (&optional arg)
|
|
6482 "Toggle permanent full header display.
|
|
6483 If ARG is a positive number, turn header display on.
|
|
6484 If ARG is a negative number, turn header display off."
|
|
6485 (interactive "P")
|
|
6486 (gnus-set-global-variables)
|
|
6487 (setq gnus-show-all-headers
|
|
6488 (cond ((or (not (numberp arg))
|
|
6489 (zerop arg))
|
|
6490 (not gnus-show-all-headers))
|
|
6491 ((natnump arg)
|
|
6492 t)))
|
|
6493 (gnus-summary-show-article))
|
|
6494
|
|
6495 (defun gnus-summary-toggle-header (&optional arg)
|
|
6496 "Show the headers if they are hidden, or hide them if they are shown.
|
|
6497 If ARG is a positive number, show the entire header.
|
|
6498 If ARG is a negative number, hide the unwanted header lines."
|
|
6499 (interactive "P")
|
|
6500 (gnus-set-global-variables)
|
|
6501 (save-excursion
|
|
6502 (set-buffer gnus-article-buffer)
|
|
6503 (let* ((buffer-read-only nil)
|
|
6504 (inhibit-point-motion-hooks t)
|
|
6505 (hidden (text-property-any
|
|
6506 (goto-char (point-min)) (search-forward "\n\n")
|
|
6507 'invisible t))
|
|
6508 e)
|
|
6509 (goto-char (point-min))
|
|
6510 (when (search-forward "\n\n" nil t)
|
|
6511 (delete-region (point-min) (1- (point))))
|
|
6512 (goto-char (point-min))
|
|
6513 (save-excursion
|
|
6514 (set-buffer gnus-original-article-buffer)
|
|
6515 (goto-char (point-min))
|
|
6516 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
|
|
6517 (insert-buffer-substring gnus-original-article-buffer 1 e)
|
|
6518 (let ((article-inhibit-hiding t))
|
|
6519 (run-hooks 'gnus-article-display-hook))
|
|
6520 (when (or (not hidden) (and (numberp arg) (< arg 0)))
|
|
6521 (gnus-article-hide-headers)))))
|
|
6522
|
|
6523 (defun gnus-summary-show-all-headers ()
|
|
6524 "Make all header lines visible."
|
|
6525 (interactive)
|
|
6526 (gnus-set-global-variables)
|
|
6527 (gnus-article-show-all-headers))
|
|
6528
|
|
6529 (defun gnus-summary-toggle-mime (&optional arg)
|
|
6530 "Toggle MIME processing.
|
|
6531 If ARG is a positive number, turn MIME processing on."
|
|
6532 (interactive "P")
|
|
6533 (gnus-set-global-variables)
|
|
6534 (setq gnus-show-mime
|
|
6535 (if (null arg) (not gnus-show-mime)
|
|
6536 (> (prefix-numeric-value arg) 0)))
|
|
6537 (gnus-summary-select-article t 'force))
|
|
6538
|
|
6539 (defun gnus-summary-caesar-message (&optional arg)
|
|
6540 "Caesar rotate the current article by 13.
|
|
6541 The numerical prefix specifies how many places to rotate each letter
|
|
6542 forward."
|
|
6543 (interactive "P")
|
|
6544 (gnus-set-global-variables)
|
|
6545 (gnus-summary-select-article)
|
|
6546 (let ((mail-header-separator ""))
|
|
6547 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6548 (save-restriction
|
|
6549 (widen)
|
|
6550 (let ((start (window-start))
|
|
6551 buffer-read-only)
|
|
6552 (message-caesar-buffer-body arg)
|
|
6553 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
6554
|
|
6555 (defun gnus-summary-stop-page-breaking ()
|
|
6556 "Stop page breaking in the current article."
|
|
6557 (interactive)
|
|
6558 (gnus-set-global-variables)
|
|
6559 (gnus-summary-select-article)
|
|
6560 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6561 (widen)
|
|
6562 (when (gnus-visual-p 'page-marker)
|
|
6563 (let ((buffer-read-only nil))
|
|
6564 (gnus-remove-text-with-property 'gnus-prev)
|
|
6565 (gnus-remove-text-with-property 'gnus-next)))))
|
|
6566
|
30
|
6567 (defun gnus-summary-move-article (&optional n to-newsgroup
|
16
|
6568 select-method action)
|
|
6569 "Move the current article to a different newsgroup.
|
|
6570 If N is a positive number, move the N next articles.
|
|
6571 If N is a negative number, move the N previous articles.
|
|
6572 If N is nil and any articles have been marked with the process mark,
|
|
6573 move those articles instead.
|
|
6574 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6575 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6576 re-spool using this method.
|
|
6577
|
|
6578 For this function to work, both the current newsgroup and the
|
|
6579 newsgroup that you want to move to have to support the `request-move'
|
|
6580 and `request-accept' functions."
|
|
6581 (interactive "P")
|
|
6582 (unless action
|
|
6583 (setq action 'move))
|
|
6584 (gnus-set-global-variables)
|
|
6585 ;; Disable marking as read.
|
|
6586 (let (gnus-mark-article-hook)
|
|
6587 (save-window-excursion
|
|
6588 (gnus-summary-select-article)))
|
|
6589 ;; Check whether the source group supports the required functions.
|
|
6590 (cond ((and (eq action 'move)
|
|
6591 (not (gnus-check-backend-function
|
|
6592 'request-move-article gnus-newsgroup-name)))
|
|
6593 (error "The current group does not support article moving"))
|
|
6594 ((and (eq action 'crosspost)
|
|
6595 (not (gnus-check-backend-function
|
|
6596 'request-replace-article gnus-newsgroup-name)))
|
|
6597 (error "The current group does not support article editing")))
|
|
6598 (let ((articles (gnus-summary-work-articles n))
|
|
6599 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
|
|
6600 (names '((move "Move" "Moving")
|
|
6601 (copy "Copy" "Copying")
|
|
6602 (crosspost "Crosspost" "Crossposting")))
|
|
6603 (copy-buf (save-excursion
|
|
6604 (nnheader-set-temp-buffer " *copy article*")))
|
|
6605 art-group to-method new-xref article to-groups)
|
|
6606 (unless (assq action names)
|
|
6607 (error "Unknown action %s" action))
|
|
6608 ;; Read the newsgroup name.
|
|
6609 (when (and (not to-newsgroup)
|
|
6610 (not select-method))
|
|
6611 (setq to-newsgroup
|
|
6612 (gnus-read-move-group-name
|
|
6613 (cadr (assq action names))
|
|
6614 (symbol-value (intern (format "gnus-current-%s-group" action)))
|
|
6615 articles prefix))
|
|
6616 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
|
30
|
6617 (setq to-method (or select-method
|
16
|
6618 (gnus-group-name-to-method to-newsgroup)))
|
|
6619 ;; Check the method we are to move this article to...
|
30
|
6620 (unless (gnus-check-backend-function
|
16
|
6621 'request-accept-article (car to-method))
|
|
6622 (error "%s does not support article copying" (car to-method)))
|
|
6623 (unless (gnus-check-server to-method)
|
|
6624 (error "Can't open server %s" (car to-method)))
|
|
6625 (gnus-message 6 "%s to %s: %s..."
|
|
6626 (caddr (assq action names))
|
|
6627 (or (car select-method) to-newsgroup) articles)
|
|
6628 (while articles
|
|
6629 (setq article (pop articles))
|
|
6630 (setq
|
|
6631 art-group
|
|
6632 (cond
|
|
6633 ;; Move the article.
|
|
6634 ((eq action 'move)
|
|
6635 (gnus-request-move-article
|
|
6636 article ; Article to move
|
|
6637 gnus-newsgroup-name ; From newsgroup
|
|
6638 (nth 1 (gnus-find-method-for-group
|
|
6639 gnus-newsgroup-name)) ; Server
|
|
6640 (list 'gnus-request-accept-article
|
|
6641 to-newsgroup (list 'quote select-method)
|
|
6642 (not articles)) ; Accept form
|
|
6643 (not articles))) ; Only save nov last time
|
|
6644 ;; Copy the article.
|
|
6645 ((eq action 'copy)
|
|
6646 (save-excursion
|
|
6647 (set-buffer copy-buf)
|
|
6648 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
|
6649 (gnus-request-accept-article
|
|
6650 to-newsgroup select-method (not articles))))
|
|
6651 ;; Crosspost the article.
|
|
6652 ((eq action 'crosspost)
|
|
6653 (let ((xref (message-tokenize-header
|
|
6654 (mail-header-xref (gnus-summary-article-header article))
|
|
6655 " ")))
|
|
6656 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
|
|
6657 ":" article))
|
30
|
6658 (unless xref
|
16
|
6659 (setq xref (list (system-name))))
|
|
6660 (setq new-xref
|
|
6661 (concat
|
30
|
6662 (mapconcat 'identity
|
16
|
6663 (delete "Xref:" (delete new-xref xref))
|
|
6664 " ")
|
30
|
6665 " " new-xref))
|
16
|
6666 (save-excursion
|
|
6667 (set-buffer copy-buf)
|
30
|
6668 ;; First put the article in the destination group.
|
16
|
6669 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
30
|
6670 (setq art-group
|
|
6671 (gnus-request-accept-article
|
|
6672 to-newsgroup select-method (not articles)))
|
|
6673 (setq new-xref (concat new-xref " " (car art-group)
|
|
6674 ":" (cdr art-group)))
|
|
6675 ;; Now we have the new Xrefs header, so we insert
|
|
6676 ;; it and replace the new article.
|
|
6677 (nnheader-replace-header "Xref" new-xref)
|
|
6678 (gnus-request-replace-article
|
|
6679 (cdr art-group) to-newsgroup (current-buffer))
|
|
6680 art-group)))))
|
16
|
6681 (if (not art-group)
|
|
6682 (gnus-message 1 "Couldn't %s article %s"
|
|
6683 (cadr (assq action names)) article)
|
|
6684 (let* ((entry
|
|
6685 (or
|
|
6686 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
|
|
6687 (gnus-gethash
|
|
6688 (gnus-group-prefixed-name
|
|
6689 (car art-group)
|
30
|
6690 (or select-method
|
16
|
6691 (gnus-find-method-for-group to-newsgroup)))
|
|
6692 gnus-newsrc-hashtb)))
|
|
6693 (info (nth 2 entry))
|
|
6694 (to-group (gnus-info-group info)))
|
|
6695 ;; Update the group that has been moved to.
|
|
6696 (when (and info
|
|
6697 (memq action '(move copy)))
|
|
6698 (unless (member to-group to-groups)
|
|
6699 (push to-group to-groups))
|
|
6700
|
|
6701 (unless (memq article gnus-newsgroup-unreads)
|
|
6702 (gnus-info-set-read
|
|
6703 info (gnus-add-to-range (gnus-info-read info)
|
|
6704 (list (cdr art-group)))))
|
|
6705
|
|
6706 ;; Copy any marks over to the new group.
|
|
6707 (let ((marks gnus-article-mark-lists)
|
|
6708 (to-article (cdr art-group)))
|
|
6709
|
|
6710 ;; See whether the article is to be put in the cache.
|
|
6711 (when gnus-use-cache
|
|
6712 (gnus-cache-possibly-enter-article
|
|
6713 to-group to-article
|
|
6714 (let ((header (copy-sequence
|
|
6715 (gnus-summary-article-header article))))
|
|
6716 (mail-header-set-number header to-article)
|
|
6717 header)
|
|
6718 (memq article gnus-newsgroup-marked)
|
|
6719 (memq article gnus-newsgroup-dormant)
|
|
6720 (memq article gnus-newsgroup-unreads)))
|
|
6721
|
22
|
6722 (when (and (equal to-group gnus-newsgroup-name)
|
|
6723 (not (memq article gnus-newsgroup-unreads)))
|
|
6724 ;; Mark this article as read in this group.
|
|
6725 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
|
|
6726 (setcdr (gnus-active to-group) to-article)
|
|
6727 (setcdr gnus-newsgroup-active to-article))
|
30
|
6728
|
16
|
6729 (while marks
|
|
6730 (when (memq article (symbol-value
|
|
6731 (intern (format "gnus-newsgroup-%s"
|
|
6732 (caar marks)))))
|
|
6733 ;; If the other group is the same as this group,
|
|
6734 ;; then we have to add the mark to the list.
|
|
6735 (when (equal to-group gnus-newsgroup-name)
|
|
6736 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
|
|
6737 (cons to-article
|
|
6738 (symbol-value
|
|
6739 (intern (format "gnus-newsgroup-%s"
|
|
6740 (caar marks)))))))
|
22
|
6741 ;; Copy the marks to other group.
|
16
|
6742 (gnus-add-marked-articles
|
|
6743 to-group (cdar marks) (list to-article) info))
|
|
6744 (setq marks (cdr marks)))))
|
|
6745
|
|
6746 ;; Update the Xref header in this article to point to
|
|
6747 ;; the new crossposted article we have just created.
|
|
6748 (when (eq action 'crosspost)
|
|
6749 (save-excursion
|
|
6750 (set-buffer copy-buf)
|
|
6751 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
30
|
6752 (nnheader-replace-header "Xref" new-xref)
|
16
|
6753 (gnus-request-replace-article
|
|
6754 article gnus-newsgroup-name (current-buffer)))))
|
|
6755
|
|
6756 (gnus-summary-goto-subject article)
|
|
6757 (when (eq action 'move)
|
|
6758 (gnus-summary-mark-article article gnus-canceled-mark)))
|
|
6759 (gnus-summary-remove-process-mark article))
|
|
6760 ;; Re-activate all groups that have been moved to.
|
|
6761 (while to-groups
|
|
6762 (gnus-activate-group (pop to-groups)))
|
30
|
6763
|
16
|
6764 (gnus-kill-buffer copy-buf)
|
|
6765 (gnus-summary-position-point)
|
|
6766 (gnus-set-mode-line 'summary)))
|
|
6767
|
|
6768 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
|
|
6769 "Move the current article to a different newsgroup.
|
|
6770 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6771 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6772 re-spool using this method."
|
|
6773 (interactive "P")
|
24
|
6774 (gnus-summary-move-article n to-newsgroup select-method 'copy))
|
16
|
6775
|
|
6776 (defun gnus-summary-crosspost-article (&optional n)
|
|
6777 "Crosspost the current article to some other group."
|
|
6778 (interactive "P")
|
|
6779 (gnus-summary-move-article n nil nil 'crosspost))
|
|
6780
|
|
6781 (defcustom gnus-summary-respool-default-method nil
|
30
|
6782 "Default method for respooling an article.
|
16
|
6783 If nil, use to the current newsgroup method."
|
|
6784 :type 'gnus-select-method-name
|
|
6785 :group 'gnus-summary-mail)
|
|
6786
|
|
6787 (defun gnus-summary-respool-article (&optional n method)
|
|
6788 "Respool the current article.
|
|
6789 The article will be squeezed through the mail spooling process again,
|
|
6790 which means that it will be put in some mail newsgroup or other
|
|
6791 depending on `nnmail-split-methods'.
|
|
6792 If N is a positive number, respool the N next articles.
|
|
6793 If N is a negative number, respool the N previous articles.
|
|
6794 If N is nil and any articles have been marked with the process mark,
|
|
6795 respool those articles instead.
|
|
6796
|
|
6797 Respooling can be done both from mail groups and \"real\" newsgroups.
|
|
6798 In the former case, the articles in question will be moved from the
|
|
6799 current group into whatever groups they are destined to. In the
|
|
6800 latter case, they will be copied into the relevant groups."
|
30
|
6801 (interactive
|
16
|
6802 (list current-prefix-arg
|
|
6803 (let* ((methods (gnus-methods-using 'respool))
|
|
6804 (methname
|
|
6805 (symbol-name (or gnus-summary-respool-default-method
|
|
6806 (car (gnus-find-method-for-group
|
|
6807 gnus-newsgroup-name)))))
|
|
6808 (method
|
30
|
6809 (gnus-completing-read
|
16
|
6810 methname "What backend do you want to use when respooling?"
|
|
6811 methods nil t nil 'gnus-mail-method-history))
|
|
6812 ms)
|
|
6813 (cond
|
30
|
6814 ((zerop (length (setq ms (gnus-servers-using-backend
|
16
|
6815 (intern method)))))
|
|
6816 (list (intern method) ""))
|
|
6817 ((= 1 (length ms))
|
|
6818 (car ms))
|
|
6819 (t
|
|
6820 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
|
|
6821 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
|
|
6822 ms-alist))))))))
|
|
6823 (gnus-set-global-variables)
|
|
6824 (unless method
|
|
6825 (error "No method given for respooling"))
|
|
6826 (if (assoc (symbol-name
|
|
6827 (car (gnus-find-method-for-group gnus-newsgroup-name)))
|
|
6828 (gnus-methods-using 'respool))
|
|
6829 (gnus-summary-move-article n nil method)
|
|
6830 (gnus-summary-copy-article n nil method)))
|
|
6831
|
|
6832 (defun gnus-summary-import-article (file)
|
|
6833 "Import a random file into a mail newsgroup."
|
|
6834 (interactive "fImport file: ")
|
|
6835 (gnus-set-global-variables)
|
|
6836 (let ((group gnus-newsgroup-name)
|
|
6837 (now (current-time))
|
|
6838 atts lines)
|
|
6839 (unless (gnus-check-backend-function 'request-accept-article group)
|
|
6840 (error "%s does not support article importing" group))
|
|
6841 (or (file-readable-p file)
|
|
6842 (not (file-regular-p file))
|
|
6843 (error "Can't read %s" file))
|
|
6844 (save-excursion
|
|
6845 (set-buffer (get-buffer-create " *import file*"))
|
|
6846 (buffer-disable-undo (current-buffer))
|
|
6847 (erase-buffer)
|
|
6848 (insert-file-contents file)
|
|
6849 (goto-char (point-min))
|
|
6850 (unless (nnheader-article-p)
|
|
6851 ;; This doesn't look like an article, so we fudge some headers.
|
|
6852 (setq atts (file-attributes file)
|
|
6853 lines (count-lines (point-min) (point-max)))
|
|
6854 (insert "From: " (read-string "From: ") "\n"
|
|
6855 "Subject: " (read-string "Subject: ") "\n"
|
|
6856 "Date: " (timezone-make-date-arpa-standard
|
|
6857 (current-time-string (nth 5 atts))
|
|
6858 (current-time-zone now)
|
|
6859 (current-time-zone now))
|
|
6860 "\n"
|
|
6861 "Message-ID: " (message-make-message-id) "\n"
|
|
6862 "Lines: " (int-to-string lines) "\n"
|
|
6863 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
|
|
6864 (gnus-request-accept-article group nil t)
|
|
6865 (kill-buffer (current-buffer)))))
|
|
6866
|
|
6867 (defun gnus-summary-article-posted-p ()
|
|
6868 "Say whether the current (mail) article is available from `gnus-select-method' as well.
|
|
6869 This will be the case if the article has both been mailed and posted."
|
|
6870 (interactive)
|
|
6871 (let ((id (mail-header-references (gnus-summary-article-header)))
|
|
6872 (gnus-override-method
|
|
6873 (or gnus-refer-article-method gnus-select-method)))
|
|
6874 (if (gnus-request-head id "")
|
|
6875 (gnus-message 2 "The current message was found on %s"
|
|
6876 gnus-override-method)
|
|
6877 (gnus-message 2 "The current message couldn't be found on %s"
|
|
6878 gnus-override-method)
|
|
6879 nil)))
|
|
6880
|
|
6881 (defun gnus-summary-expire-articles (&optional now)
|
|
6882 "Expire all articles that are marked as expirable in the current group."
|
|
6883 (interactive)
|
|
6884 (gnus-set-global-variables)
|
|
6885 (when (gnus-check-backend-function
|
|
6886 'request-expire-articles gnus-newsgroup-name)
|
|
6887 ;; This backend supports expiry.
|
|
6888 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
|
|
6889 (expirable (if total
|
|
6890 (progn
|
|
6891 ;; We need to update the info for
|
|
6892 ;; this group for `gnus-list-of-read-articles'
|
|
6893 ;; to give us the right answer.
|
|
6894 (run-hooks 'gnus-exit-group-hook)
|
|
6895 (gnus-summary-update-info)
|
|
6896 (gnus-list-of-read-articles gnus-newsgroup-name))
|
|
6897 (setq gnus-newsgroup-expirable
|
|
6898 (sort gnus-newsgroup-expirable '<))))
|
|
6899 (expiry-wait (if now 'immediate
|
|
6900 (gnus-group-find-parameter
|
|
6901 gnus-newsgroup-name 'expiry-wait)))
|
|
6902 es)
|
|
6903 (when expirable
|
|
6904 ;; There are expirable articles in this group, so we run them
|
|
6905 ;; through the expiry process.
|
|
6906 (gnus-message 6 "Expiring articles...")
|
|
6907 ;; The list of articles that weren't expired is returned.
|
|
6908 (if expiry-wait
|
|
6909 (let ((nnmail-expiry-wait-function nil)
|
|
6910 (nnmail-expiry-wait expiry-wait))
|
|
6911 (setq es (gnus-request-expire-articles
|
|
6912 expirable gnus-newsgroup-name)))
|
|
6913 (setq es (gnus-request-expire-articles
|
|
6914 expirable gnus-newsgroup-name)))
|
|
6915 (unless total
|
|
6916 (setq gnus-newsgroup-expirable es))
|
|
6917 ;; We go through the old list of expirable, and mark all
|
|
6918 ;; really expired articles as nonexistent.
|
|
6919 (unless (eq es expirable) ;If nothing was expired, we don't mark.
|
|
6920 (let ((gnus-use-cache nil))
|
|
6921 (while expirable
|
|
6922 (unless (memq (car expirable) es)
|
|
6923 (when (gnus-data-find (car expirable))
|
|
6924 (gnus-summary-mark-article
|
|
6925 (car expirable) gnus-canceled-mark)))
|
|
6926 (setq expirable (cdr expirable)))))
|
|
6927 (gnus-message 6 "Expiring articles...done")))))
|
|
6928
|
|
6929 (defun gnus-summary-expire-articles-now ()
|
|
6930 "Expunge all expirable articles in the current group.
|
|
6931 This means that *all* articles that are marked as expirable will be
|
|
6932 deleted forever, right now."
|
|
6933 (interactive)
|
|
6934 (gnus-set-global-variables)
|
|
6935 (or gnus-expert-user
|
|
6936 (gnus-yes-or-no-p
|
|
6937 "Are you really, really, really sure you want to delete all these messages? ")
|
|
6938 (error "Phew!"))
|
|
6939 (gnus-summary-expire-articles t))
|
|
6940
|
|
6941 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
|
|
6942 (defun gnus-summary-delete-article (&optional n)
|
|
6943 "Delete the N next (mail) articles.
|
|
6944 This command actually deletes articles. This is not a marking
|
|
6945 command. The article will disappear forever from your life, never to
|
|
6946 return.
|
|
6947 If N is negative, delete backwards.
|
|
6948 If N is nil and articles have been marked with the process mark,
|
|
6949 delete these instead."
|
|
6950 (interactive "P")
|
|
6951 (gnus-set-global-variables)
|
|
6952 (unless (gnus-check-backend-function 'request-expire-articles
|
|
6953 gnus-newsgroup-name)
|
|
6954 (error "The current newsgroup does not support article deletion."))
|
|
6955 ;; Compute the list of articles to delete.
|
|
6956 (let ((articles (gnus-summary-work-articles n))
|
|
6957 not-deleted)
|
|
6958 (if (and gnus-novice-user
|
|
6959 (not (gnus-yes-or-no-p
|
|
6960 (format "Do you really want to delete %s forever? "
|
|
6961 (if (> (length articles) 1)
|
|
6962 (format "these %s articles" (length articles))
|
|
6963 "this article")))))
|
|
6964 ()
|
|
6965 ;; Delete the articles.
|
|
6966 (setq not-deleted (gnus-request-expire-articles
|
|
6967 articles gnus-newsgroup-name 'force))
|
|
6968 (while articles
|
|
6969 (gnus-summary-remove-process-mark (car articles))
|
|
6970 ;; The backend might not have been able to delete the article
|
|
6971 ;; after all.
|
|
6972 (unless (memq (car articles) not-deleted)
|
|
6973 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
|
30
|
6974 (setq articles (cdr articles)))
|
|
6975 (when not-deleted
|
|
6976 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
|
16
|
6977 (gnus-summary-position-point)
|
|
6978 (gnus-set-mode-line 'summary)
|
|
6979 not-deleted))
|
|
6980
|
|
6981 (defun gnus-summary-edit-article (&optional force)
|
|
6982 "Edit the current article.
|
|
6983 This will have permanent effect only in mail groups.
|
|
6984 If FORCE is non-nil, allow editing of articles even in read-only
|
30
|
6985 groups."
|
16
|
6986 (interactive "P")
|
|
6987 (save-excursion
|
|
6988 (set-buffer gnus-summary-buffer)
|
|
6989 (gnus-set-global-variables)
|
|
6990 (when (and (not force)
|
|
6991 (gnus-group-read-only-p))
|
|
6992 (error "The current newsgroup does not support article editing."))
|
|
6993 ;; Select article if needed.
|
|
6994 (unless (eq (gnus-summary-article-number)
|
|
6995 gnus-current-article)
|
|
6996 (gnus-summary-select-article t))
|
|
6997 (gnus-article-edit-article
|
|
6998 `(lambda ()
|
|
6999 (gnus-summary-edit-article-done
|
|
7000 ,(or (mail-header-references gnus-current-headers) "")
|
|
7001 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
|
|
7002
|
|
7003 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
|
|
7004
|
|
7005 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
|
|
7006 "Make edits to the current article permanent."
|
|
7007 (interactive)
|
|
7008 ;; Replace the article.
|
|
7009 (if (and (not read-only)
|
|
7010 (not (gnus-request-replace-article
|
|
7011 (cdr gnus-article-current) (car gnus-article-current)
|
|
7012 (current-buffer))))
|
|
7013 (error "Couldn't replace article.")
|
|
7014 ;; Update the summary buffer.
|
|
7015 (if (and references
|
|
7016 (equal (message-tokenize-header references " ")
|
|
7017 (message-tokenize-header
|
|
7018 (or (message-fetch-field "references") "") " ")))
|
|
7019 ;; We only have to update this line.
|
|
7020 (save-excursion
|
|
7021 (save-restriction
|
|
7022 (message-narrow-to-head)
|
18
|
7023 (let ((head (buffer-string))
|
|
7024 header)
|
|
7025 (nnheader-temp-write nil
|
|
7026 (insert (format "211 %d Article retrieved.\n"
|
|
7027 (cdr gnus-article-current)))
|
|
7028 (insert head)
|
|
7029 (insert ".\n")
|
|
7030 (let ((nntp-server-buffer (current-buffer)))
|
|
7031 (setq header (car (gnus-get-newsgroup-headers
|
|
7032 (save-excursion
|
|
7033 (set-buffer gnus-summary-buffer)
|
|
7034 gnus-newsgroup-dependencies)
|
|
7035 t))))
|
|
7036 (save-excursion
|
|
7037 (set-buffer gnus-summary-buffer)
|
|
7038 (gnus-data-set-header
|
|
7039 (gnus-data-find (cdr gnus-article-current))
|
|
7040 header)
|
|
7041 (gnus-summary-update-article-line
|
|
7042 (cdr gnus-article-current) header))))))
|
16
|
7043 ;; Update threads.
|
|
7044 (set-buffer (or buffer gnus-summary-buffer))
|
|
7045 (gnus-summary-update-article (cdr gnus-article-current)))
|
|
7046 ;; Prettify the article buffer again.
|
|
7047 (save-excursion
|
|
7048 (set-buffer gnus-article-buffer)
|
22
|
7049 (run-hooks 'gnus-article-display-hook)
|
|
7050 (set-buffer gnus-original-article-buffer)
|
|
7051 (gnus-request-article
|
|
7052 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
|
16
|
7053 ;; Prettify the summary buffer line.
|
|
7054 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
7055 (run-hooks 'gnus-visual-mark-article-hook))))
|
|
7056
|
|
7057 (defun gnus-summary-edit-wash (key)
|
|
7058 "Perform editing command in the article buffer."
|
30
|
7059 (interactive
|
16
|
7060 (list
|
|
7061 (progn
|
|
7062 (message "%s" (concat (this-command-keys) "- "))
|
|
7063 (read-char))))
|
|
7064 (message "")
|
|
7065 (gnus-summary-edit-article)
|
|
7066 (execute-kbd-macro (concat (this-command-keys) key))
|
|
7067 (gnus-article-edit-done))
|
|
7068
|
|
7069 ;;; Respooling
|
|
7070
|
|
7071 (defun gnus-summary-respool-query ()
|
|
7072 "Query where the respool algorithm would put this article."
|
|
7073 (interactive)
|
|
7074 (gnus-set-global-variables)
|
|
7075 (let (gnus-mark-article-hook)
|
|
7076 (gnus-summary-select-article)
|
|
7077 (save-excursion
|
30
|
7078 (set-buffer gnus-original-article-buffer)
|
16
|
7079 (save-restriction
|
30
|
7080 (message-narrow-to-head)
|
16
|
7081 (message "This message would go to %s"
|
|
7082 (mapconcat 'car (nnmail-article-group 'identity) ", "))))))
|
|
7083
|
|
7084 ;; Summary marking commands.
|
|
7085
|
|
7086 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
|
|
7087 "Mark articles which has the same subject as read, and then select the next.
|
|
7088 If UNMARK is positive, remove any kind of mark.
|
|
7089 If UNMARK is negative, tick articles."
|
|
7090 (interactive "P")
|
|
7091 (gnus-set-global-variables)
|
|
7092 (when unmark
|
|
7093 (setq unmark (prefix-numeric-value unmark)))
|
|
7094 (let ((count
|
|
7095 (gnus-summary-mark-same-subject
|
|
7096 (gnus-summary-article-subject) unmark)))
|
|
7097 ;; Select next unread article. If auto-select-same mode, should
|
|
7098 ;; select the first unread article.
|
|
7099 (gnus-summary-next-article t (and gnus-auto-select-same
|
|
7100 (gnus-summary-article-subject)))
|
|
7101 (gnus-message 7 "%d article%s marked as %s"
|
|
7102 count (if (= count 1) " is" "s are")
|
|
7103 (if unmark "unread" "read"))))
|
|
7104
|
|
7105 (defun gnus-summary-kill-same-subject (&optional unmark)
|
|
7106 "Mark articles which has the same subject as read.
|
|
7107 If UNMARK is positive, remove any kind of mark.
|
|
7108 If UNMARK is negative, tick articles."
|
|
7109 (interactive "P")
|
|
7110 (gnus-set-global-variables)
|
|
7111 (when unmark
|
|
7112 (setq unmark (prefix-numeric-value unmark)))
|
|
7113 (let ((count
|
|
7114 (gnus-summary-mark-same-subject
|
|
7115 (gnus-summary-article-subject) unmark)))
|
|
7116 ;; If marked as read, go to next unread subject.
|
|
7117 (when (null unmark)
|
|
7118 ;; Go to next unread subject.
|
|
7119 (gnus-summary-next-subject 1 t))
|
|
7120 (gnus-message 7 "%d articles are marked as %s"
|
|
7121 count (if unmark "unread" "read"))))
|
|
7122
|
|
7123 (defun gnus-summary-mark-same-subject (subject &optional unmark)
|
|
7124 "Mark articles with same SUBJECT as read, and return marked number.
|
|
7125 If optional argument UNMARK is positive, remove any kinds of marks.
|
|
7126 If optional argument UNMARK is negative, mark articles as unread instead."
|
|
7127 (let ((count 1))
|
|
7128 (save-excursion
|
|
7129 (cond
|
|
7130 ((null unmark) ; Mark as read.
|
|
7131 (while (and
|
|
7132 (progn
|
|
7133 (gnus-summary-mark-article-as-read gnus-killed-mark)
|
|
7134 (gnus-summary-show-thread) t)
|
|
7135 (gnus-summary-find-subject subject))
|
|
7136 (setq count (1+ count))))
|
|
7137 ((> unmark 0) ; Tick.
|
|
7138 (while (and
|
|
7139 (progn
|
|
7140 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
|
|
7141 (gnus-summary-show-thread) t)
|
|
7142 (gnus-summary-find-subject subject))
|
|
7143 (setq count (1+ count))))
|
|
7144 (t ; Mark as unread.
|
|
7145 (while (and
|
|
7146 (progn
|
|
7147 (gnus-summary-mark-article-as-unread gnus-unread-mark)
|
|
7148 (gnus-summary-show-thread) t)
|
|
7149 (gnus-summary-find-subject subject))
|
|
7150 (setq count (1+ count)))))
|
|
7151 (gnus-set-mode-line 'summary)
|
|
7152 ;; Return the number of marked articles.
|
|
7153 count)))
|
|
7154
|
|
7155 (defun gnus-summary-mark-as-processable (n &optional unmark)
|
|
7156 "Set the process mark on the next N articles.
|
|
7157 If N is negative, mark backward instead. If UNMARK is non-nil, remove
|
|
7158 the process mark instead. The difference between N and the actual
|
|
7159 number of articles marked is returned."
|
|
7160 (interactive "p")
|
|
7161 (gnus-set-global-variables)
|
|
7162 (let ((backward (< n 0))
|
|
7163 (n (abs n)))
|
|
7164 (while (and
|
|
7165 (> n 0)
|
|
7166 (if unmark
|
|
7167 (gnus-summary-remove-process-mark
|
|
7168 (gnus-summary-article-number))
|
|
7169 (gnus-summary-set-process-mark (gnus-summary-article-number)))
|
|
7170 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
|
|
7171 (setq n (1- n)))
|
|
7172 (when (/= 0 n)
|
|
7173 (gnus-message 7 "No more articles"))
|
|
7174 (gnus-summary-recenter)
|
|
7175 (gnus-summary-position-point)
|
|
7176 n))
|
|
7177
|
|
7178 (defun gnus-summary-unmark-as-processable (n)
|
|
7179 "Remove the process mark from the next N articles.
|
|
7180 If N is negative, mark backward instead. The difference between N and
|
|
7181 the actual number of articles marked is returned."
|
|
7182 (interactive "p")
|
|
7183 (gnus-set-global-variables)
|
|
7184 (gnus-summary-mark-as-processable n t))
|
|
7185
|
|
7186 (defun gnus-summary-unmark-all-processable ()
|
|
7187 "Remove the process mark from all articles."
|
|
7188 (interactive)
|
|
7189 (gnus-set-global-variables)
|
|
7190 (save-excursion
|
|
7191 (while gnus-newsgroup-processable
|
|
7192 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
|
|
7193 (gnus-summary-position-point))
|
|
7194
|
|
7195 (defun gnus-summary-mark-as-expirable (n)
|
|
7196 "Mark N articles forward as expirable.
|
|
7197 If N is negative, mark backward instead. The difference between N and
|
|
7198 the actual number of articles marked is returned."
|
|
7199 (interactive "p")
|
|
7200 (gnus-set-global-variables)
|
|
7201 (gnus-summary-mark-forward n gnus-expirable-mark))
|
|
7202
|
|
7203 (defun gnus-summary-mark-article-as-replied (article)
|
|
7204 "Mark ARTICLE replied and update the summary line."
|
|
7205 (push article gnus-newsgroup-replied)
|
|
7206 (let ((buffer-read-only nil))
|
|
7207 (when (gnus-summary-goto-subject article)
|
|
7208 (gnus-summary-update-secondary-mark article))))
|
|
7209
|
|
7210 (defun gnus-summary-set-bookmark (article)
|
|
7211 "Set a bookmark in current article."
|
|
7212 (interactive (list (gnus-summary-article-number)))
|
|
7213 (gnus-set-global-variables)
|
|
7214 (when (or (not (get-buffer gnus-article-buffer))
|
|
7215 (not gnus-current-article)
|
|
7216 (not gnus-article-current)
|
|
7217 (not (equal gnus-newsgroup-name (car gnus-article-current))))
|
|
7218 (error "No current article selected"))
|
|
7219 ;; Remove old bookmark, if one exists.
|
|
7220 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7221 (when old
|
|
7222 (setq gnus-newsgroup-bookmarks
|
|
7223 (delq old gnus-newsgroup-bookmarks))))
|
|
7224 ;; Set the new bookmark, which is on the form
|
|
7225 ;; (article-number . line-number-in-body).
|
|
7226 (push
|
|
7227 (cons article
|
|
7228 (save-excursion
|
|
7229 (set-buffer gnus-article-buffer)
|
|
7230 (count-lines
|
|
7231 (min (point)
|
|
7232 (save-excursion
|
|
7233 (goto-char (point-min))
|
|
7234 (search-forward "\n\n" nil t)
|
|
7235 (point)))
|
|
7236 (point))))
|
|
7237 gnus-newsgroup-bookmarks)
|
|
7238 (gnus-message 6 "A bookmark has been added to the current article."))
|
|
7239
|
|
7240 (defun gnus-summary-remove-bookmark (article)
|
|
7241 "Remove the bookmark from the current article."
|
|
7242 (interactive (list (gnus-summary-article-number)))
|
|
7243 (gnus-set-global-variables)
|
|
7244 ;; Remove old bookmark, if one exists.
|
|
7245 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7246 (if old
|
|
7247 (progn
|
|
7248 (setq gnus-newsgroup-bookmarks
|
|
7249 (delq old gnus-newsgroup-bookmarks))
|
|
7250 (gnus-message 6 "Removed bookmark."))
|
|
7251 (gnus-message 6 "No bookmark in current article."))))
|
|
7252
|
|
7253 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7254 (defun gnus-summary-mark-as-dormant (n)
|
|
7255 "Mark N articles forward as dormant.
|
|
7256 If N is negative, mark backward instead. The difference between N and
|
|
7257 the actual number of articles marked is returned."
|
|
7258 (interactive "p")
|
|
7259 (gnus-set-global-variables)
|
|
7260 (gnus-summary-mark-forward n gnus-dormant-mark))
|
|
7261
|
|
7262 (defun gnus-summary-set-process-mark (article)
|
|
7263 "Set the process mark on ARTICLE and update the summary line."
|
|
7264 (setq gnus-newsgroup-processable
|
|
7265 (cons article
|
|
7266 (delq article gnus-newsgroup-processable)))
|
|
7267 (when (gnus-summary-goto-subject article)
|
|
7268 (gnus-summary-show-thread)
|
|
7269 (gnus-summary-update-secondary-mark article)))
|
|
7270
|
|
7271 (defun gnus-summary-remove-process-mark (article)
|
|
7272 "Remove the process mark from ARTICLE and update the summary line."
|
|
7273 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
|
|
7274 (when (gnus-summary-goto-subject article)
|
|
7275 (gnus-summary-show-thread)
|
|
7276 (gnus-summary-update-secondary-mark article)))
|
|
7277
|
|
7278 (defun gnus-summary-set-saved-mark (article)
|
|
7279 "Set the process mark on ARTICLE and update the summary line."
|
|
7280 (push article gnus-newsgroup-saved)
|
|
7281 (when (gnus-summary-goto-subject article)
|
|
7282 (gnus-summary-update-secondary-mark article)))
|
|
7283
|
|
7284 (defun gnus-summary-mark-forward (n &optional mark no-expire)
|
|
7285 "Mark N articles as read forwards.
|
|
7286 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
|
|
7287 The difference between N and the actual number of articles marked is
|
|
7288 returned."
|
|
7289 (interactive "p")
|
|
7290 (gnus-set-global-variables)
|
|
7291 (let ((backward (< n 0))
|
|
7292 (gnus-summary-goto-unread
|
|
7293 (and gnus-summary-goto-unread
|
|
7294 (not (eq gnus-summary-goto-unread 'never))
|
|
7295 (not (memq mark (list gnus-unread-mark
|
|
7296 gnus-ticked-mark gnus-dormant-mark)))))
|
|
7297 (n (abs n))
|
|
7298 (mark (or mark gnus-del-mark)))
|
|
7299 (while (and (> n 0)
|
|
7300 (gnus-summary-mark-article nil mark no-expire)
|
|
7301 (zerop (gnus-summary-next-subject
|
|
7302 (if backward -1 1)
|
|
7303 (and gnus-summary-goto-unread
|
|
7304 (not (eq gnus-summary-goto-unread 'never)))
|
|
7305 t)))
|
|
7306 (setq n (1- n)))
|
|
7307 (when (/= 0 n)
|
|
7308 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
|
|
7309 (gnus-summary-recenter)
|
|
7310 (gnus-summary-position-point)
|
|
7311 (gnus-set-mode-line 'summary)
|
|
7312 n))
|
|
7313
|
|
7314 (defun gnus-summary-mark-article-as-read (mark)
|
|
7315 "Mark the current article quickly as read with MARK."
|
|
7316 (let ((article (gnus-summary-article-number)))
|
|
7317 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7318 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7319 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7320 (push (cons article mark) gnus-newsgroup-reads)
|
|
7321 ;; Possibly remove from cache, if that is used.
|
|
7322 (when gnus-use-cache
|
|
7323 (gnus-cache-enter-remove-article article))
|
|
7324 ;; Allow the backend to change the mark.
|
|
7325 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
|
|
7326 ;; Check for auto-expiry.
|
|
7327 (when (and gnus-newsgroup-auto-expire
|
|
7328 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7329 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7330 (= mark gnus-ancient-mark)
|
|
7331 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7332 (= mark gnus-duplicate-mark)))
|
|
7333 (setq mark gnus-expirable-mark)
|
|
7334 (push article gnus-newsgroup-expirable))
|
|
7335 ;; Set the mark in the buffer.
|
|
7336 (gnus-summary-update-mark mark 'unread)
|
|
7337 t))
|
|
7338
|
|
7339 (defun gnus-summary-mark-article-as-unread (mark)
|
|
7340 "Mark the current article quickly as unread with MARK."
|
|
7341 (let ((article (gnus-summary-article-number)))
|
|
7342 (if (< article 0)
|
|
7343 (gnus-error 1 "Unmarkable article")
|
|
7344 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7345 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7346 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
|
|
7347 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
|
|
7348 (cond ((= mark gnus-ticked-mark)
|
|
7349 (push article gnus-newsgroup-marked))
|
|
7350 ((= mark gnus-dormant-mark)
|
|
7351 (push article gnus-newsgroup-dormant))
|
|
7352 (t
|
|
7353 (push article gnus-newsgroup-unreads)))
|
|
7354 (setq gnus-newsgroup-reads
|
|
7355 (delq (assq article gnus-newsgroup-reads)
|
|
7356 gnus-newsgroup-reads))
|
|
7357
|
|
7358 ;; See whether the article is to be put in the cache.
|
|
7359 (and gnus-use-cache
|
|
7360 (vectorp (gnus-summary-article-header article))
|
|
7361 (save-excursion
|
|
7362 (gnus-cache-possibly-enter-article
|
|
7363 gnus-newsgroup-name article
|
|
7364 (gnus-summary-article-header article)
|
|
7365 (= mark gnus-ticked-mark)
|
|
7366 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7367
|
|
7368 ;; Fix the mark.
|
|
7369 (gnus-summary-update-mark mark 'unread))
|
|
7370 t))
|
|
7371
|
|
7372 (defun gnus-summary-mark-article (&optional article mark no-expire)
|
|
7373 "Mark ARTICLE with MARK. MARK can be any character.
|
|
7374 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
|
|
7375 `??' (dormant) and `?E' (expirable).
|
|
7376 If MARK is nil, then the default character `?D' is used.
|
|
7377 If ARTICLE is nil, then the article on the current line will be
|
|
7378 marked."
|
|
7379 ;; The mark might be a string.
|
|
7380 (when (stringp mark)
|
|
7381 (setq mark (aref mark 0)))
|
|
7382 ;; If no mark is given, then we check auto-expiring.
|
|
7383 (and (not no-expire)
|
|
7384 gnus-newsgroup-auto-expire
|
|
7385 (or (not mark)
|
|
7386 (and (gnus-characterp mark)
|
|
7387 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7388 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7389 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7390 (= mark gnus-duplicate-mark))))
|
|
7391 (setq mark gnus-expirable-mark))
|
|
7392 (let* ((mark (or mark gnus-del-mark))
|
|
7393 (article (or article (gnus-summary-article-number))))
|
|
7394 (unless article
|
|
7395 (error "No article on current line"))
|
|
7396 (if (or (= mark gnus-unread-mark)
|
|
7397 (= mark gnus-ticked-mark)
|
|
7398 (= mark gnus-dormant-mark))
|
|
7399 (gnus-mark-article-as-unread article mark)
|
|
7400 (gnus-mark-article-as-read article mark))
|
|
7401
|
|
7402 ;; See whether the article is to be put in the cache.
|
|
7403 (and gnus-use-cache
|
|
7404 (not (= mark gnus-canceled-mark))
|
|
7405 (vectorp (gnus-summary-article-header article))
|
|
7406 (save-excursion
|
|
7407 (gnus-cache-possibly-enter-article
|
|
7408 gnus-newsgroup-name article
|
|
7409 (gnus-summary-article-header article)
|
|
7410 (= mark gnus-ticked-mark)
|
|
7411 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7412
|
|
7413 (when (gnus-summary-goto-subject article nil t)
|
|
7414 (let ((buffer-read-only nil))
|
|
7415 (gnus-summary-show-thread)
|
|
7416 ;; Fix the mark.
|
|
7417 (gnus-summary-update-mark mark 'unread)
|
|
7418 t))))
|
|
7419
|
|
7420 (defun gnus-summary-update-secondary-mark (article)
|
|
7421 "Update the secondary (read, process, cache) mark."
|
|
7422 (gnus-summary-update-mark
|
|
7423 (cond ((memq article gnus-newsgroup-processable)
|
|
7424 gnus-process-mark)
|
|
7425 ((memq article gnus-newsgroup-cached)
|
|
7426 gnus-cached-mark)
|
|
7427 ((memq article gnus-newsgroup-replied)
|
|
7428 gnus-replied-mark)
|
|
7429 ((memq article gnus-newsgroup-saved)
|
|
7430 gnus-saved-mark)
|
|
7431 (t gnus-unread-mark))
|
|
7432 'replied)
|
|
7433 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
7434 (run-hooks 'gnus-summary-update-hook))
|
|
7435 t)
|
|
7436
|
|
7437 (defun gnus-summary-update-mark (mark type)
|
|
7438 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
|
|
7439 (buffer-read-only nil))
|
18
|
7440 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
|
16
|
7441 (when (looking-at "\r")
|
|
7442 (incf forward))
|
|
7443 (when (and forward
|
|
7444 (<= (+ forward (point)) (point-max)))
|
|
7445 ;; Go to the right position on the line.
|
|
7446 (goto-char (+ forward (point)))
|
|
7447 ;; Replace the old mark with the new mark.
|
|
7448 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
|
|
7449 ;; Optionally update the marks by some user rule.
|
|
7450 (when (eq type 'unread)
|
|
7451 (gnus-data-set-mark
|
|
7452 (gnus-data-find (gnus-summary-article-number)) mark)
|
|
7453 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
|
|
7454
|
|
7455 (defun gnus-mark-article-as-read (article &optional mark)
|
|
7456 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7457 ;; Make the article expirable.
|
|
7458 (let ((mark (or mark gnus-del-mark)))
|
|
7459 (if (= mark gnus-expirable-mark)
|
|
7460 (push article gnus-newsgroup-expirable)
|
|
7461 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
|
|
7462 ;; Remove from unread and marked lists.
|
|
7463 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7464 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7465 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7466 (push (cons article mark) gnus-newsgroup-reads)
|
|
7467 ;; Possibly remove from cache, if that is used.
|
|
7468 (when gnus-use-cache
|
|
7469 (gnus-cache-enter-remove-article article))))
|
|
7470
|
|
7471 (defun gnus-mark-article-as-unread (article &optional mark)
|
|
7472 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7473 (let ((mark (or mark gnus-ticked-mark)))
|
|
7474 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
|
|
7475 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
|
|
7476 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
|
|
7477 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7478
|
|
7479 ;; Unsuppress duplicates?
|
|
7480 (when gnus-suppress-duplicates
|
|
7481 (gnus-dup-unsuppress-article article))
|
|
7482
|
|
7483 (cond ((= mark gnus-ticked-mark)
|
|
7484 (push article gnus-newsgroup-marked))
|
|
7485 ((= mark gnus-dormant-mark)
|
|
7486 (push article gnus-newsgroup-dormant))
|
|
7487 (t
|
|
7488 (push article gnus-newsgroup-unreads)))
|
|
7489 (setq gnus-newsgroup-reads
|
|
7490 (delq (assq article gnus-newsgroup-reads)
|
|
7491 gnus-newsgroup-reads))))
|
|
7492
|
|
7493 (defalias 'gnus-summary-mark-as-unread-forward
|
|
7494 'gnus-summary-tick-article-forward)
|
|
7495 (make-obsolete 'gnus-summary-mark-as-unread-forward
|
|
7496 'gnus-summary-tick-article-forward)
|
|
7497 (defun gnus-summary-tick-article-forward (n)
|
|
7498 "Tick N articles forwards.
|
|
7499 If N is negative, tick backwards instead.
|
|
7500 The difference between N and the number of articles ticked is returned."
|
|
7501 (interactive "p")
|
|
7502 (gnus-summary-mark-forward n gnus-ticked-mark))
|
|
7503
|
|
7504 (defalias 'gnus-summary-mark-as-unread-backward
|
|
7505 'gnus-summary-tick-article-backward)
|
|
7506 (make-obsolete 'gnus-summary-mark-as-unread-backward
|
|
7507 'gnus-summary-tick-article-backward)
|
|
7508 (defun gnus-summary-tick-article-backward (n)
|
|
7509 "Tick N articles backwards.
|
|
7510 The difference between N and the number of articles ticked is returned."
|
|
7511 (interactive "p")
|
|
7512 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
|
|
7513
|
|
7514 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7515 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7516 (defun gnus-summary-tick-article (&optional article clear-mark)
|
|
7517 "Mark current article as unread.
|
|
7518 Optional 1st argument ARTICLE specifies article number to be marked as unread.
|
|
7519 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
|
|
7520 (interactive)
|
|
7521 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
|
|
7522 gnus-ticked-mark)))
|
|
7523
|
|
7524 (defun gnus-summary-mark-as-read-forward (n)
|
|
7525 "Mark N articles as read forwards.
|
|
7526 If N is negative, mark backwards instead.
|
|
7527 The difference between N and the actual number of articles marked is
|
|
7528 returned."
|
|
7529 (interactive "p")
|
|
7530 (gnus-summary-mark-forward n gnus-del-mark t))
|
|
7531
|
|
7532 (defun gnus-summary-mark-as-read-backward (n)
|
|
7533 "Mark the N articles as read backwards.
|
|
7534 The difference between N and the actual number of articles marked is
|
|
7535 returned."
|
|
7536 (interactive "p")
|
|
7537 (gnus-summary-mark-forward (- n) gnus-del-mark t))
|
|
7538
|
|
7539 (defun gnus-summary-mark-as-read (&optional article mark)
|
|
7540 "Mark current article as read.
|
|
7541 ARTICLE specifies the article to be marked as read.
|
|
7542 MARK specifies a string to be inserted at the beginning of the line."
|
|
7543 (gnus-summary-mark-article article mark))
|
|
7544
|
|
7545 (defun gnus-summary-clear-mark-forward (n)
|
|
7546 "Clear marks from N articles forward.
|
|
7547 If N is negative, clear backward instead.
|
|
7548 The difference between N and the number of marks cleared is returned."
|
|
7549 (interactive "p")
|
|
7550 (gnus-summary-mark-forward n gnus-unread-mark))
|
|
7551
|
|
7552 (defun gnus-summary-clear-mark-backward (n)
|
|
7553 "Clear marks from N articles backward.
|
|
7554 The difference between N and the number of marks cleared is returned."
|
|
7555 (interactive "p")
|
|
7556 (gnus-summary-mark-forward (- n) gnus-unread-mark))
|
|
7557
|
|
7558 (defun gnus-summary-mark-unread-as-read ()
|
|
7559 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7560 (when (memq gnus-current-article gnus-newsgroup-unreads)
|
|
7561 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
|
|
7562
|
|
7563 (defun gnus-summary-mark-read-and-unread-as-read ()
|
|
7564 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7565 (let ((mark (gnus-summary-article-mark)))
|
|
7566 (when (or (gnus-unread-mark-p mark)
|
|
7567 (gnus-read-mark-p mark))
|
|
7568 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
|
|
7569
|
|
7570 (defun gnus-summary-mark-region-as-read (point mark all)
|
|
7571 "Mark all unread articles between point and mark as read.
|
|
7572 If given a prefix, mark all articles between point and mark as read,
|
|
7573 even ticked and dormant ones."
|
|
7574 (interactive "r\nP")
|
|
7575 (save-excursion
|
|
7576 (let (article)
|
|
7577 (goto-char point)
|
|
7578 (beginning-of-line)
|
|
7579 (while (and
|
|
7580 (< (point) mark)
|
|
7581 (progn
|
|
7582 (when (or all
|
|
7583 (memq (setq article (gnus-summary-article-number))
|
|
7584 gnus-newsgroup-unreads))
|
|
7585 (gnus-summary-mark-article article gnus-del-mark))
|
|
7586 t)
|
|
7587 (gnus-summary-find-next))))))
|
|
7588
|
|
7589 (defun gnus-summary-mark-below (score mark)
|
|
7590 "Mark articles with score less than SCORE with MARK."
|
|
7591 (interactive "P\ncMark: ")
|
|
7592 (gnus-set-global-variables)
|
|
7593 (setq score (if score
|
|
7594 (prefix-numeric-value score)
|
|
7595 (or gnus-summary-default-score 0)))
|
|
7596 (save-excursion
|
|
7597 (set-buffer gnus-summary-buffer)
|
|
7598 (goto-char (point-min))
|
30
|
7599 (while
|
16
|
7600 (progn
|
|
7601 (and (< (gnus-summary-article-score) score)
|
|
7602 (gnus-summary-mark-article nil mark))
|
|
7603 (gnus-summary-find-next)))))
|
|
7604
|
|
7605 (defun gnus-summary-kill-below (&optional score)
|
|
7606 "Mark articles with score below SCORE as read."
|
|
7607 (interactive "P")
|
|
7608 (gnus-set-global-variables)
|
|
7609 (gnus-summary-mark-below score gnus-killed-mark))
|
|
7610
|
|
7611 (defun gnus-summary-clear-above (&optional score)
|
|
7612 "Clear all marks from articles with score above SCORE."
|
|
7613 (interactive "P")
|
|
7614 (gnus-set-global-variables)
|
|
7615 (gnus-summary-mark-above score gnus-unread-mark))
|
|
7616
|
|
7617 (defun gnus-summary-tick-above (&optional score)
|
|
7618 "Tick all articles with score above SCORE."
|
|
7619 (interactive "P")
|
|
7620 (gnus-set-global-variables)
|
|
7621 (gnus-summary-mark-above score gnus-ticked-mark))
|
|
7622
|
|
7623 (defun gnus-summary-mark-above (score mark)
|
|
7624 "Mark articles with score over SCORE with MARK."
|
|
7625 (interactive "P\ncMark: ")
|
|
7626 (gnus-set-global-variables)
|
|
7627 (setq score (if score
|
|
7628 (prefix-numeric-value score)
|
|
7629 (or gnus-summary-default-score 0)))
|
|
7630 (save-excursion
|
|
7631 (set-buffer gnus-summary-buffer)
|
|
7632 (goto-char (point-min))
|
|
7633 (while (and (progn
|
|
7634 (when (> (gnus-summary-article-score) score)
|
|
7635 (gnus-summary-mark-article nil mark))
|
|
7636 t)
|
|
7637 (gnus-summary-find-next)))))
|
|
7638
|
|
7639 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7640 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
|
|
7641 (defun gnus-summary-limit-include-expunged (&optional no-error)
|
|
7642 "Display all the hidden articles that were expunged for low scores."
|
|
7643 (interactive)
|
|
7644 (gnus-set-global-variables)
|
|
7645 (let ((buffer-read-only nil))
|
|
7646 (let ((scored gnus-newsgroup-scored)
|
|
7647 headers h)
|
|
7648 (while scored
|
|
7649 (unless (gnus-summary-goto-subject (caar scored))
|
|
7650 (and (setq h (gnus-summary-article-header (caar scored)))
|
|
7651 (< (cdar scored) gnus-summary-expunge-below)
|
|
7652 (push h headers)))
|
|
7653 (setq scored (cdr scored)))
|
|
7654 (if (not headers)
|
|
7655 (when (not no-error)
|
|
7656 (error "No expunged articles hidden."))
|
|
7657 (goto-char (point-min))
|
|
7658 (gnus-summary-prepare-unthreaded (nreverse headers))
|
|
7659 (goto-char (point-min))
|
|
7660 (gnus-summary-position-point)
|
|
7661 t))))
|
|
7662
|
|
7663 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
|
|
7664 "Mark all unread articles in this newsgroup as read.
|
30
|
7665 If prefix argument ALL is non-nil, ticked and dormant articles will
|
16
|
7666 also be marked as read.
|
|
7667 If QUIETLY is non-nil, no questions will be asked.
|
|
7668 If TO-HERE is non-nil, it should be a point in the buffer. All
|
|
7669 articles before this point will be marked as read.
|
|
7670 Note that this function will only catch up the unread article
|
|
7671 in the current summary buffer limitation.
|
|
7672 The number of articles marked as read is returned."
|
|
7673 (interactive "P")
|
|
7674 (gnus-set-global-variables)
|
|
7675 (prog1
|
|
7676 (save-excursion
|
|
7677 (when (or quietly
|
|
7678 (not gnus-interactive-catchup) ;Without confirmation?
|
|
7679 gnus-expert-user
|
|
7680 (gnus-y-or-n-p
|
|
7681 (if all
|
|
7682 "Mark absolutely all articles as read? "
|
|
7683 "Mark all unread articles as read? ")))
|
|
7684 (if (and not-mark
|
|
7685 (not gnus-newsgroup-adaptive)
|
|
7686 (not gnus-newsgroup-auto-expire)
|
|
7687 (not gnus-suppress-duplicates))
|
|
7688 (progn
|
|
7689 (when all
|
|
7690 (setq gnus-newsgroup-marked nil
|
|
7691 gnus-newsgroup-dormant nil))
|
|
7692 (setq gnus-newsgroup-unreads nil))
|
|
7693 ;; We actually mark all articles as canceled, which we
|
|
7694 ;; have to do when using auto-expiry or adaptive scoring.
|
|
7695 (gnus-summary-show-all-threads)
|
|
7696 (when (gnus-summary-first-subject (not all))
|
|
7697 (while (and
|
|
7698 (if to-here (< (point) to-here) t)
|
|
7699 (gnus-summary-mark-article-as-read gnus-catchup-mark)
|
|
7700 (gnus-summary-find-next (not all)))))
|
|
7701 (gnus-set-mode-line 'summary))
|
|
7702 t))
|
|
7703 (gnus-summary-position-point)))
|
|
7704
|
|
7705 (defun gnus-summary-catchup-to-here (&optional all)
|
|
7706 "Mark all unticked articles before the current one as read.
|
|
7707 If ALL is non-nil, also mark ticked and dormant articles as read."
|
|
7708 (interactive "P")
|
|
7709 (gnus-set-global-variables)
|
|
7710 (save-excursion
|
|
7711 (gnus-save-hidden-threads
|
|
7712 (let ((beg (point)))
|
|
7713 ;; We check that there are unread articles.
|
|
7714 (when (or all (gnus-summary-find-prev))
|
|
7715 (gnus-summary-catchup all t beg)))))
|
|
7716 (gnus-summary-position-point))
|
|
7717
|
|
7718 (defun gnus-summary-catchup-all (&optional quietly)
|
|
7719 "Mark all articles in this newsgroup as read."
|
|
7720 (interactive "P")
|
|
7721 (gnus-set-global-variables)
|
|
7722 (gnus-summary-catchup t quietly))
|
|
7723
|
|
7724 (defun gnus-summary-catchup-and-exit (&optional all quietly)
|
|
7725 "Mark all articles not marked as unread in this newsgroup as read, then exit.
|
|
7726 If prefix argument ALL is non-nil, all articles are marked as read."
|
|
7727 (interactive "P")
|
|
7728 (gnus-set-global-variables)
|
|
7729 (when (gnus-summary-catchup all quietly nil 'fast)
|
|
7730 ;; Select next newsgroup or exit.
|
|
7731 (if (eq gnus-auto-select-next 'quietly)
|
|
7732 (gnus-summary-next-group nil)
|
|
7733 (gnus-summary-exit))))
|
|
7734
|
|
7735 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
|
|
7736 "Mark all articles in this newsgroup as read, and then exit."
|
|
7737 (interactive "P")
|
|
7738 (gnus-set-global-variables)
|
|
7739 (gnus-summary-catchup-and-exit t quietly))
|
|
7740
|
|
7741 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
|
|
7742 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
|
|
7743 "Mark all articles in this group as read and select the next group.
|
|
7744 If given a prefix, mark all articles, unread as well as ticked, as
|
|
7745 read."
|
|
7746 (interactive "P")
|
|
7747 (gnus-set-global-variables)
|
|
7748 (save-excursion
|
|
7749 (gnus-summary-catchup all))
|
|
7750 (gnus-summary-next-article t nil nil t))
|
|
7751
|
|
7752 ;; Thread-based commands.
|
|
7753
|
|
7754 (defun gnus-summary-articles-in-thread (&optional article)
|
|
7755 "Return a list of all articles in the current thread.
|
|
7756 If ARTICLE is non-nil, return all articles in the thread that starts
|
|
7757 with that article."
|
|
7758 (let* ((article (or article (gnus-summary-article-number)))
|
|
7759 (data (gnus-data-find-list article))
|
|
7760 (top-level (gnus-data-level (car data)))
|
|
7761 (top-subject
|
|
7762 (cond ((null gnus-thread-operation-ignore-subject)
|
|
7763 (gnus-simplify-subject-re
|
|
7764 (mail-header-subject (gnus-data-header (car data)))))
|
|
7765 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7766 (gnus-simplify-subject-fuzzy
|
|
7767 (mail-header-subject (gnus-data-header (car data)))))
|
|
7768 (t nil)))
|
|
7769 (end-point (save-excursion
|
|
7770 (if (gnus-summary-go-to-next-thread)
|
|
7771 (point) (point-max))))
|
|
7772 articles)
|
|
7773 (while (and data
|
|
7774 (< (gnus-data-pos (car data)) end-point))
|
|
7775 (when (or (not top-subject)
|
|
7776 (string= top-subject
|
|
7777 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7778 (gnus-simplify-subject-fuzzy
|
|
7779 (mail-header-subject
|
|
7780 (gnus-data-header (car data))))
|
|
7781 (gnus-simplify-subject-re
|
|
7782 (mail-header-subject
|
|
7783 (gnus-data-header (car data)))))))
|
|
7784 (push (gnus-data-number (car data)) articles))
|
|
7785 (unless (and (setq data (cdr data))
|
|
7786 (> (gnus-data-level (car data)) top-level))
|
|
7787 (setq data nil)))
|
|
7788 ;; Return the list of articles.
|
|
7789 (nreverse articles)))
|
|
7790
|
|
7791 (defun gnus-summary-rethread-current ()
|
|
7792 "Rethread the thread the current article is part of."
|
|
7793 (interactive)
|
|
7794 (gnus-set-global-variables)
|
|
7795 (let* ((gnus-show-threads t)
|
|
7796 (article (gnus-summary-article-number))
|
|
7797 (id (mail-header-id (gnus-summary-article-header)))
|
|
7798 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
|
|
7799 (unless id
|
|
7800 (error "No article on the current line"))
|
|
7801 (gnus-rebuild-thread id)
|
|
7802 (gnus-summary-goto-subject article)))
|
|
7803
|
|
7804 (defun gnus-summary-reparent-thread ()
|
26
|
7805 "Make the current article child of the marked (or previous) article.
|
16
|
7806
|
|
7807 Note that the re-threading will only work if `gnus-thread-ignore-subject'
|
|
7808 is non-nil or the Subject: of both articles are the same."
|
|
7809 (interactive)
|
|
7810 (unless (not (gnus-group-read-only-p))
|
|
7811 (error "The current newsgroup does not support article editing."))
|
|
7812 (unless (<= (length gnus-newsgroup-processable) 1)
|
|
7813 (error "No more than one article may be marked."))
|
|
7814 (save-window-excursion
|
|
7815 (let ((gnus-article-buffer " *reparent*")
|
|
7816 (current-article (gnus-summary-article-number))
|
26
|
7817 ;; First grab the marked article, otherwise one line up.
|
16
|
7818 (parent-article (if (not (null gnus-newsgroup-processable))
|
|
7819 (car gnus-newsgroup-processable)
|
|
7820 (save-excursion
|
|
7821 (if (eq (forward-line -1) 0)
|
|
7822 (gnus-summary-article-number)
|
|
7823 (error "Beginning of summary buffer."))))))
|
|
7824 (unless (not (eq current-article parent-article))
|
|
7825 (error "An article may not be self-referential."))
|
30
|
7826 (let ((message-id (mail-header-id
|
16
|
7827 (gnus-summary-article-header parent-article))))
|
|
7828 (unless (and message-id (not (equal message-id "")))
|
|
7829 (error "No message-id in desired parent."))
|
|
7830 (gnus-summary-select-article t t nil current-article)
|
26
|
7831 (set-buffer gnus-original-article-buffer)
|
16
|
7832 (let ((buf (format "%s" (buffer-string))))
|
26
|
7833 (nnheader-temp-write nil
|
|
7834 (insert buf)
|
|
7835 (goto-char (point-min))
|
|
7836 (if (search-forward-regexp "^References: " nil t)
|
|
7837 (insert message-id " " )
|
|
7838 (insert "References: " message-id "\n"))
|
|
7839 (unless (gnus-request-replace-article
|
|
7840 current-article (car gnus-article-current)
|
|
7841 (current-buffer))
|
|
7842 (error "Couldn't replace article."))))
|
16
|
7843 (set-buffer gnus-summary-buffer)
|
|
7844 (gnus-summary-unmark-all-processable)
|
|
7845 (gnus-summary-rethread-current)
|
|
7846 (gnus-message 3 "Article %d is now the child of article %d."
|
|
7847 current-article parent-article)))))
|
|
7848
|
|
7849 (defun gnus-summary-toggle-threads (&optional arg)
|
|
7850 "Toggle showing conversation threads.
|
|
7851 If ARG is positive number, turn showing conversation threads on."
|
|
7852 (interactive "P")
|
|
7853 (gnus-set-global-variables)
|
|
7854 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
|
|
7855 (setq gnus-show-threads
|
|
7856 (if (null arg) (not gnus-show-threads)
|
|
7857 (> (prefix-numeric-value arg) 0)))
|
|
7858 (gnus-summary-prepare)
|
|
7859 (gnus-summary-goto-subject current)
|
|
7860 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
|
|
7861 (gnus-summary-position-point)))
|
|
7862
|
|
7863 (defun gnus-summary-show-all-threads ()
|
|
7864 "Show all threads."
|
|
7865 (interactive)
|
|
7866 (gnus-set-global-variables)
|
|
7867 (save-excursion
|
|
7868 (let ((buffer-read-only nil))
|
|
7869 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
|
|
7870 (gnus-summary-position-point))
|
|
7871
|
|
7872 (defun gnus-summary-show-thread ()
|
|
7873 "Show thread subtrees.
|
|
7874 Returns nil if no thread was there to be shown."
|
|
7875 (interactive)
|
|
7876 (gnus-set-global-variables)
|
|
7877 (let ((buffer-read-only nil)
|
|
7878 (orig (point))
|
|
7879 ;; first goto end then to beg, to have point at beg after let
|
|
7880 (end (progn (end-of-line) (point)))
|
|
7881 (beg (progn (beginning-of-line) (point))))
|
|
7882 (prog1
|
|
7883 ;; Any hidden lines here?
|
|
7884 (search-forward "\r" end t)
|
|
7885 (subst-char-in-region beg end ?\^M ?\n t)
|
|
7886 (goto-char orig)
|
|
7887 (gnus-summary-position-point))))
|
|
7888
|
|
7889 (defun gnus-summary-hide-all-threads ()
|
|
7890 "Hide all thread subtrees."
|
|
7891 (interactive)
|
|
7892 (gnus-set-global-variables)
|
|
7893 (save-excursion
|
|
7894 (goto-char (point-min))
|
|
7895 (gnus-summary-hide-thread)
|
|
7896 (while (zerop (gnus-summary-next-thread 1 t))
|
|
7897 (gnus-summary-hide-thread)))
|
|
7898 (gnus-summary-position-point))
|
|
7899
|
|
7900 (defun gnus-summary-hide-thread ()
|
|
7901 "Hide thread subtrees.
|
|
7902 Returns nil if no threads were there to be hidden."
|
|
7903 (interactive)
|
|
7904 (gnus-set-global-variables)
|
|
7905 (let ((buffer-read-only nil)
|
|
7906 (start (point))
|
|
7907 (article (gnus-summary-article-number)))
|
|
7908 (goto-char start)
|
|
7909 ;; Go forward until either the buffer ends or the subthread
|
|
7910 ;; ends.
|
|
7911 (when (and (not (eobp))
|
|
7912 (or (zerop (gnus-summary-next-thread 1 t))
|
|
7913 (goto-char (point-max))))
|
|
7914 (prog1
|
|
7915 (if (and (> (point) start)
|
|
7916 (search-backward "\n" start t))
|
|
7917 (progn
|
|
7918 (subst-char-in-region start (point) ?\n ?\^M)
|
|
7919 (gnus-summary-goto-subject article))
|
|
7920 (goto-char start)
|
|
7921 nil)
|
|
7922 ;;(gnus-summary-position-point)
|
|
7923 ))))
|
|
7924
|
|
7925 (defun gnus-summary-go-to-next-thread (&optional previous)
|
|
7926 "Go to the same level (or less) next thread.
|
|
7927 If PREVIOUS is non-nil, go to previous thread instead.
|
|
7928 Return the article number moved to, or nil if moving was impossible."
|
|
7929 (let ((level (gnus-summary-thread-level))
|
|
7930 (way (if previous -1 1))
|
|
7931 (beg (point)))
|
|
7932 (forward-line way)
|
|
7933 (while (and (not (eobp))
|
|
7934 (< level (gnus-summary-thread-level)))
|
|
7935 (forward-line way))
|
|
7936 (if (eobp)
|
|
7937 (progn
|
|
7938 (goto-char beg)
|
|
7939 nil)
|
|
7940 (setq beg (point))
|
|
7941 (prog1
|
|
7942 (gnus-summary-article-number)
|
|
7943 (goto-char beg)))))
|
|
7944
|
|
7945 (defun gnus-summary-next-thread (n &optional silent)
|
|
7946 "Go to the same level next N'th thread.
|
|
7947 If N is negative, search backward instead.
|
|
7948 Returns the difference between N and the number of skips actually
|
|
7949 done.
|
|
7950
|
|
7951 If SILENT, don't output messages."
|
|
7952 (interactive "p")
|
|
7953 (gnus-set-global-variables)
|
|
7954 (let ((backward (< n 0))
|
|
7955 (n (abs n)))
|
|
7956 (while (and (> n 0)
|
|
7957 (gnus-summary-go-to-next-thread backward))
|
|
7958 (decf n))
|
30
|
7959 (unless silent
|
16
|
7960 (gnus-summary-position-point))
|
|
7961 (when (and (not silent) (/= 0 n))
|
|
7962 (gnus-message 7 "No more threads"))
|
|
7963 n))
|
|
7964
|
|
7965 (defun gnus-summary-prev-thread (n)
|
|
7966 "Go to the same level previous N'th thread.
|
|
7967 Returns the difference between N and the number of skips actually
|
|
7968 done."
|
|
7969 (interactive "p")
|
|
7970 (gnus-set-global-variables)
|
|
7971 (gnus-summary-next-thread (- n)))
|
|
7972
|
|
7973 (defun gnus-summary-go-down-thread ()
|
|
7974 "Go down one level in the current thread."
|
|
7975 (let ((children (gnus-summary-article-children)))
|
|
7976 (when children
|
|
7977 (gnus-summary-goto-subject (car children)))))
|
|
7978
|
|
7979 (defun gnus-summary-go-up-thread ()
|
|
7980 "Go up one level in the current thread."
|
|
7981 (let ((parent (gnus-summary-article-parent)))
|
|
7982 (when parent
|
|
7983 (gnus-summary-goto-subject parent))))
|
|
7984
|
|
7985 (defun gnus-summary-down-thread (n)
|
|
7986 "Go down thread N steps.
|
|
7987 If N is negative, go up instead.
|
|
7988 Returns the difference between N and how many steps down that were
|
|
7989 taken."
|
|
7990 (interactive "p")
|
|
7991 (gnus-set-global-variables)
|
|
7992 (let ((up (< n 0))
|
|
7993 (n (abs n)))
|
|
7994 (while (and (> n 0)
|
|
7995 (if up (gnus-summary-go-up-thread)
|
|
7996 (gnus-summary-go-down-thread)))
|
|
7997 (setq n (1- n)))
|
|
7998 (gnus-summary-position-point)
|
|
7999 (when (/= 0 n)
|
|
8000 (gnus-message 7 "Can't go further"))
|
|
8001 n))
|
|
8002
|
|
8003 (defun gnus-summary-up-thread (n)
|
|
8004 "Go up thread N steps.
|
|
8005 If N is negative, go up instead.
|
|
8006 Returns the difference between N and how many steps down that were
|
|
8007 taken."
|
|
8008 (interactive "p")
|
|
8009 (gnus-set-global-variables)
|
|
8010 (gnus-summary-down-thread (- n)))
|
|
8011
|
|
8012 (defun gnus-summary-top-thread ()
|
|
8013 "Go to the top of the thread."
|
|
8014 (interactive)
|
|
8015 (gnus-set-global-variables)
|
|
8016 (while (gnus-summary-go-up-thread))
|
|
8017 (gnus-summary-article-number))
|
|
8018
|
|
8019 (defun gnus-summary-kill-thread (&optional unmark)
|
|
8020 "Mark articles under current thread as read.
|
|
8021 If the prefix argument is positive, remove any kinds of marks.
|
|
8022 If the prefix argument is negative, tick articles instead."
|
|
8023 (interactive "P")
|
|
8024 (gnus-set-global-variables)
|
|
8025 (when unmark
|
|
8026 (setq unmark (prefix-numeric-value unmark)))
|
|
8027 (let ((articles (gnus-summary-articles-in-thread)))
|
|
8028 (save-excursion
|
|
8029 ;; Expand the thread.
|
|
8030 (gnus-summary-show-thread)
|
|
8031 ;; Mark all the articles.
|
|
8032 (while articles
|
|
8033 (gnus-summary-goto-subject (car articles))
|
|
8034 (cond ((null unmark)
|
|
8035 (gnus-summary-mark-article-as-read gnus-killed-mark))
|
|
8036 ((> unmark 0)
|
|
8037 (gnus-summary-mark-article-as-unread gnus-unread-mark))
|
|
8038 (t
|
|
8039 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
|
|
8040 (setq articles (cdr articles))))
|
|
8041 ;; Hide killed subtrees.
|
|
8042 (and (null unmark)
|
|
8043 gnus-thread-hide-killed
|
|
8044 (gnus-summary-hide-thread))
|
|
8045 ;; If marked as read, go to next unread subject.
|
|
8046 (when (null unmark)
|
|
8047 ;; Go to next unread subject.
|
|
8048 (gnus-summary-next-subject 1 t)))
|
|
8049 (gnus-set-mode-line 'summary))
|
|
8050
|
|
8051 ;; Summary sorting commands
|
|
8052
|
|
8053 (defun gnus-summary-sort-by-number (&optional reverse)
|
|
8054 "Sort the summary buffer by article number.
|
|
8055 Argument REVERSE means reverse order."
|
|
8056 (interactive "P")
|
|
8057 (gnus-summary-sort 'number reverse))
|
|
8058
|
|
8059 (defun gnus-summary-sort-by-author (&optional reverse)
|
|
8060 "Sort the summary buffer by author name alphabetically.
|
|
8061 If case-fold-search is non-nil, case of letters is ignored.
|
|
8062 Argument REVERSE means reverse order."
|
|
8063 (interactive "P")
|
|
8064 (gnus-summary-sort 'author reverse))
|
|
8065
|
|
8066 (defun gnus-summary-sort-by-subject (&optional reverse)
|
|
8067 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
|
|
8068 If case-fold-search is non-nil, case of letters is ignored.
|
|
8069 Argument REVERSE means reverse order."
|
|
8070 (interactive "P")
|
|
8071 (gnus-summary-sort 'subject reverse))
|
|
8072
|
|
8073 (defun gnus-summary-sort-by-date (&optional reverse)
|
|
8074 "Sort the summary buffer by date.
|
|
8075 Argument REVERSE means reverse order."
|
|
8076 (interactive "P")
|
|
8077 (gnus-summary-sort 'date reverse))
|
|
8078
|
|
8079 (defun gnus-summary-sort-by-score (&optional reverse)
|
|
8080 "Sort the summary buffer by score.
|
|
8081 Argument REVERSE means reverse order."
|
|
8082 (interactive "P")
|
|
8083 (gnus-summary-sort 'score reverse))
|
|
8084
|
|
8085 (defun gnus-summary-sort-by-lines (&optional reverse)
|
|
8086 "Sort the summary buffer by article length.
|
|
8087 Argument REVERSE means reverse order."
|
|
8088 (interactive "P")
|
|
8089 (gnus-summary-sort 'lines reverse))
|
|
8090
|
|
8091 (defun gnus-summary-sort (predicate reverse)
|
|
8092 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
|
|
8093 (gnus-set-global-variables)
|
|
8094 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
|
|
8095 (article (intern (format "gnus-article-sort-by-%s" predicate)))
|
|
8096 (gnus-thread-sort-functions
|
|
8097 (list
|
|
8098 (if (not reverse)
|
|
8099 thread
|
|
8100 `(lambda (t1 t2)
|
|
8101 (,thread t2 t1)))))
|
|
8102 (gnus-article-sort-functions
|
|
8103 (list
|
|
8104 (if (not reverse)
|
|
8105 article
|
|
8106 `(lambda (t1 t2)
|
|
8107 (,article t2 t1)))))
|
|
8108 (buffer-read-only)
|
|
8109 (gnus-summary-prepare-hook nil))
|
|
8110 ;; We do the sorting by regenerating the threads.
|
|
8111 (gnus-summary-prepare)
|
|
8112 ;; Hide subthreads if needed.
|
|
8113 (when (and gnus-show-threads gnus-thread-hide-subtree)
|
|
8114 (gnus-summary-hide-all-threads))))
|
|
8115
|
|
8116 ;; Summary saving commands.
|
|
8117
|
|
8118 (defun gnus-summary-save-article (&optional n not-saved)
|
|
8119 "Save the current article using the default saver function.
|
|
8120 If N is a positive number, save the N next articles.
|
|
8121 If N is a negative number, save the N previous articles.
|
|
8122 If N is nil and any articles have been marked with the process mark,
|
|
8123 save those articles instead.
|
|
8124 The variable `gnus-default-article-saver' specifies the saver function."
|
|
8125 (interactive "P")
|
|
8126 (gnus-set-global-variables)
|
|
8127 (let* ((articles (gnus-summary-work-articles n))
|
30
|
8128 (save-buffer (save-excursion
|
16
|
8129 (nnheader-set-temp-buffer " *Gnus Save*")))
|
|
8130 (num (length articles))
|
|
8131 header article file)
|
|
8132 (while articles
|
|
8133 (setq header (gnus-summary-article-header
|
|
8134 (setq article (pop articles))))
|
|
8135 (if (not (vectorp header))
|
|
8136 ;; This is a pseudo-article.
|
|
8137 (if (assq 'name header)
|
|
8138 (gnus-copy-file (cdr (assq 'name header)))
|
|
8139 (gnus-message 1 "Article %d is unsaveable" article))
|
|
8140 ;; This is a real article.
|
|
8141 (save-window-excursion
|
|
8142 (gnus-summary-select-article t nil nil article))
|
|
8143 (save-excursion
|
|
8144 (set-buffer save-buffer)
|
|
8145 (erase-buffer)
|
|
8146 (insert-buffer-substring gnus-original-article-buffer))
|
|
8147 (setq file (gnus-article-save save-buffer file num))
|
|
8148 (gnus-summary-remove-process-mark article)
|
|
8149 (unless not-saved
|
|
8150 (gnus-summary-set-saved-mark article))))
|
|
8151 (gnus-kill-buffer save-buffer)
|
|
8152 (gnus-summary-position-point)
|
|
8153 (gnus-set-mode-line 'summary)
|
|
8154 n))
|
|
8155
|
|
8156 (defun gnus-summary-pipe-output (&optional arg)
|
|
8157 "Pipe the current article to a subprocess.
|
|
8158 If N is a positive number, pipe the N next articles.
|
|
8159 If N is a negative number, pipe the N previous articles.
|
|
8160 If N is nil and any articles have been marked with the process mark,
|
|
8161 pipe those articles instead."
|
|
8162 (interactive "P")
|
|
8163 (gnus-set-global-variables)
|
|
8164 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
|
|
8165 (gnus-summary-save-article arg t))
|
|
8166 (gnus-configure-windows 'pipe))
|
|
8167
|
|
8168 (defun gnus-summary-save-article-mail (&optional arg)
|
|
8169 "Append the current article to an mail file.
|
|
8170 If N is a positive number, save the N next articles.
|
|
8171 If N is a negative number, save the N previous articles.
|
|
8172 If N is nil and any articles have been marked with the process mark,
|
|
8173 save those articles instead."
|
|
8174 (interactive "P")
|
|
8175 (gnus-set-global-variables)
|
|
8176 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
|
|
8177 (gnus-summary-save-article arg)))
|
|
8178
|
|
8179 (defun gnus-summary-save-article-rmail (&optional arg)
|
|
8180 "Append the current article to an rmail file.
|
|
8181 If N is a positive number, save the N next articles.
|
|
8182 If N is a negative number, save the N previous articles.
|
|
8183 If N is nil and any articles have been marked with the process mark,
|
|
8184 save those articles instead."
|
|
8185 (interactive "P")
|
|
8186 (gnus-set-global-variables)
|
|
8187 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
|
|
8188 (gnus-summary-save-article arg)))
|
|
8189
|
|
8190 (defun gnus-summary-save-article-file (&optional arg)
|
|
8191 "Append the current article to a file.
|
|
8192 If N is a positive number, save the N next articles.
|
|
8193 If N is a negative number, save the N previous articles.
|
|
8194 If N is nil and any articles have been marked with the process mark,
|
|
8195 save those articles instead."
|
|
8196 (interactive "P")
|
|
8197 (gnus-set-global-variables)
|
|
8198 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
|
|
8199 (gnus-summary-save-article arg)))
|
|
8200
|
|
8201 (defun gnus-summary-write-article-file (&optional arg)
|
|
8202 "Write the current article to a file, deleting the previous file.
|
|
8203 If N is a positive number, save the N next articles.
|
|
8204 If N is a negative number, save the N previous articles.
|
|
8205 If N is nil and any articles have been marked with the process mark,
|
|
8206 save those articles instead."
|
|
8207 (interactive "P")
|
|
8208 (gnus-set-global-variables)
|
|
8209 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
|
|
8210 (gnus-summary-save-article arg)))
|
|
8211
|
|
8212 (defun gnus-summary-save-article-body-file (&optional arg)
|
|
8213 "Append the current article body to a file.
|
|
8214 If N is a positive number, save the N next articles.
|
|
8215 If N is a negative number, save the N previous articles.
|
|
8216 If N is nil and any articles have been marked with the process mark,
|
|
8217 save those articles instead."
|
|
8218 (interactive "P")
|
|
8219 (gnus-set-global-variables)
|
|
8220 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
|
|
8221 (gnus-summary-save-article arg)))
|
|
8222
|
|
8223 (defun gnus-summary-pipe-message (program)
|
|
8224 "Pipe the current article through PROGRAM."
|
|
8225 (interactive "sProgram: ")
|
|
8226 (gnus-set-global-variables)
|
|
8227 (gnus-summary-select-article)
|
|
8228 (let ((mail-header-separator "")
|
|
8229 (art-buf (get-buffer gnus-article-buffer)))
|
|
8230 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
8231 (save-restriction
|
|
8232 (widen)
|
|
8233 (let ((start (window-start))
|
|
8234 buffer-read-only)
|
|
8235 (message-pipe-buffer-body program)
|
|
8236 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
8237
|
|
8238 (defun gnus-get-split-value (methods)
|
|
8239 "Return a value based on the split METHODS."
|
|
8240 (let (split-name method result match)
|
|
8241 (when methods
|
|
8242 (save-excursion
|
|
8243 (set-buffer gnus-original-article-buffer)
|
|
8244 (save-restriction
|
|
8245 (nnheader-narrow-to-headers)
|
|
8246 (while methods
|
|
8247 (goto-char (point-min))
|
|
8248 (setq method (pop methods))
|
|
8249 (setq match (car method))
|
|
8250 (when (cond
|
|
8251 ((stringp match)
|
|
8252 ;; Regular expression.
|
|
8253 (ignore-errors
|
|
8254 (re-search-forward match nil t)))
|
|
8255 ((gnus-functionp match)
|
|
8256 ;; Function.
|
|
8257 (save-restriction
|
|
8258 (widen)
|
|
8259 (setq result (funcall match gnus-newsgroup-name))))
|
|
8260 ((consp match)
|
|
8261 ;; Form.
|
|
8262 (save-restriction
|
|
8263 (widen)
|
|
8264 (setq result (eval match)))))
|
|
8265 (setq split-name (append (cdr method) split-name))
|
|
8266 (cond ((stringp result)
|
|
8267 (push (expand-file-name
|
|
8268 result gnus-article-save-directory)
|
|
8269 split-name))
|
|
8270 ((consp result)
|
|
8271 (setq split-name (append result split-name)))))))))
|
|
8272 split-name))
|
|
8273
|
|
8274 (defun gnus-valid-move-group-p (group)
|
|
8275 (and (boundp group)
|
|
8276 (symbol-name group)
|
|
8277 (memq 'respool
|
|
8278 (assoc (symbol-name
|
|
8279 (car (gnus-find-method-for-group
|
|
8280 (symbol-name group))))
|
|
8281 gnus-valid-select-methods))))
|
|
8282
|
|
8283 (defun gnus-read-move-group-name (prompt default articles prefix)
|
|
8284 "Read a group name."
|
|
8285 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
|
|
8286 (minibuffer-confirm-incomplete nil) ; XEmacs
|
|
8287 (prom
|
|
8288 (format "%s %s to:"
|
|
8289 prompt
|
|
8290 (if (> (length articles) 1)
|
|
8291 (format "these %d articles" (length articles))
|
|
8292 "this article")))
|
|
8293 (to-newsgroup
|
|
8294 (cond
|
|
8295 ((null split-name)
|
|
8296 (gnus-completing-read default prom
|
|
8297 gnus-active-hashtb
|
|
8298 'gnus-valid-move-group-p
|
|
8299 nil prefix
|
|
8300 'gnus-group-history))
|
|
8301 ((= 1 (length split-name))
|
|
8302 (gnus-completing-read (car split-name) prom
|
|
8303 gnus-active-hashtb
|
|
8304 'gnus-valid-move-group-p
|
|
8305 nil nil
|
|
8306 'gnus-group-history))
|
|
8307 (t
|
30
|
8308 (gnus-completing-read nil prom
|
16
|
8309 (mapcar (lambda (el) (list el))
|
|
8310 (nreverse split-name))
|
|
8311 nil nil nil
|
|
8312 'gnus-group-history)))))
|
|
8313 (when to-newsgroup
|
|
8314 (if (or (string= to-newsgroup "")
|
|
8315 (string= to-newsgroup prefix))
|
30
|
8316 (setq to-newsgroup default))
|
|
8317 (unless to-newsgroup
|
|
8318 (error "No group name entered"))
|
16
|
8319 (or (gnus-active to-newsgroup)
|
|
8320 (gnus-activate-group to-newsgroup)
|
|
8321 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
|
|
8322 to-newsgroup))
|
30
|
8323 (or (and (gnus-request-create-group
|
16
|
8324 to-newsgroup (gnus-group-name-to-method to-newsgroup))
|
|
8325 (gnus-activate-group to-newsgroup nil nil
|
|
8326 (gnus-group-name-to-method
|
|
8327 to-newsgroup)))
|
|
8328 (error "Couldn't create group %s" to-newsgroup)))
|
|
8329 (error "No such group: %s" to-newsgroup)))
|
|
8330 to-newsgroup))
|
|
8331
|
|
8332 ;; Summary extract commands
|
|
8333
|
|
8334 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
|
|
8335 (let ((buffer-read-only nil)
|
|
8336 (article (gnus-summary-article-number))
|
|
8337 after-article b e)
|
|
8338 (unless (gnus-summary-goto-subject article)
|
|
8339 (error "No such article: %d" article))
|
|
8340 (gnus-summary-position-point)
|
|
8341 ;; If all commands are to be bunched up on one line, we collect
|
|
8342 ;; them here.
|
|
8343 (unless gnus-view-pseudos-separately
|
|
8344 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
|
|
8345 files action)
|
|
8346 (while ps
|
|
8347 (setq action (cdr (assq 'action (car ps))))
|
|
8348 (setq files (list (cdr (assq 'name (car ps)))))
|
|
8349 (while (and ps (cdr ps)
|
|
8350 (string= (or action "1")
|
|
8351 (or (cdr (assq 'action (cadr ps))) "2")))
|
|
8352 (push (cdr (assq 'name (cadr ps))) files)
|
|
8353 (setcdr ps (cddr ps)))
|
|
8354 (when files
|
|
8355 (when (not (string-match "%s" action))
|
|
8356 (push " " files))
|
|
8357 (push " " files)
|
|
8358 (when (assq 'execute (car ps))
|
|
8359 (setcdr (assq 'execute (car ps))
|
|
8360 (funcall (if (string-match "%s" action)
|
|
8361 'format 'concat)
|
|
8362 action
|
24
|
8363 (mapconcat
|
|
8364 (lambda (f)
|
|
8365 (if (equal f " ")
|
|
8366 f
|
|
8367 (gnus-quote-arg-for-sh-or-csh f)))
|
|
8368 files " ")))))
|
16
|
8369 (setq ps (cdr ps)))))
|
|
8370 (if (and gnus-view-pseudos (not not-view))
|
|
8371 (while pslist
|
|
8372 (when (assq 'execute (car pslist))
|
|
8373 (gnus-execute-command (cdr (assq 'execute (car pslist)))
|
|
8374 (eq gnus-view-pseudos 'not-confirm)))
|
|
8375 (setq pslist (cdr pslist)))
|
|
8376 (save-excursion
|
|
8377 (while pslist
|
|
8378 (setq after-article (or (cdr (assq 'article (car pslist)))
|
|
8379 (gnus-summary-article-number)))
|
|
8380 (gnus-summary-goto-subject after-article)
|
|
8381 (forward-line 1)
|
|
8382 (setq b (point))
|
|
8383 (insert " " (file-name-nondirectory
|
|
8384 (cdr (assq 'name (car pslist))))
|
|
8385 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
|
|
8386 (setq e (point))
|
|
8387 (forward-line -1) ; back to `b'
|
|
8388 (gnus-add-text-properties
|
|
8389 b (1- e) (list 'gnus-number gnus-reffed-article-number
|
|
8390 gnus-mouse-face-prop gnus-mouse-face))
|
|
8391 (gnus-data-enter
|
|
8392 after-article gnus-reffed-article-number
|
|
8393 gnus-unread-mark b (car pslist) 0 (- e b))
|
|
8394 (push gnus-reffed-article-number gnus-newsgroup-unreads)
|
|
8395 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
|
|
8396 (setq pslist (cdr pslist)))))))
|
|
8397
|
|
8398 (defun gnus-pseudos< (p1 p2)
|
|
8399 (let ((c1 (cdr (assq 'action p1)))
|
|
8400 (c2 (cdr (assq 'action p2))))
|
|
8401 (and c1 c2 (string< c1 c2))))
|
|
8402
|
|
8403 (defun gnus-request-pseudo-article (props)
|
|
8404 (cond ((assq 'execute props)
|
|
8405 (gnus-execute-command (cdr (assq 'execute props)))))
|
|
8406 (let ((gnus-current-article (gnus-summary-article-number)))
|
|
8407 (run-hooks 'gnus-mark-article-hook)))
|
|
8408
|
|
8409 (defun gnus-execute-command (command &optional automatic)
|
|
8410 (save-excursion
|
|
8411 (gnus-article-setup-buffer)
|
|
8412 (set-buffer gnus-article-buffer)
|
|
8413 (setq buffer-read-only nil)
|
34
|
8414 (let ((command (if automatic command (read-string "Command: " command))))
|
16
|
8415 (erase-buffer)
|
|
8416 (insert "$ " command "\n\n")
|
|
8417 (if gnus-view-pseudo-asynchronously
|
34
|
8418 (start-process "gnus-execute" (current-buffer) shell-file-name
|
16
|
8419 shell-command-switch command)
|
|
8420 (call-process shell-file-name nil t nil
|
|
8421 shell-command-switch command)))))
|
|
8422
|
|
8423 ;; Summary kill commands.
|
|
8424
|
|
8425 (defun gnus-summary-edit-global-kill (article)
|
|
8426 "Edit the \"global\" kill file."
|
|
8427 (interactive (list (gnus-summary-article-number)))
|
|
8428 (gnus-set-global-variables)
|
|
8429 (gnus-group-edit-global-kill article))
|
|
8430
|
|
8431 (defun gnus-summary-edit-local-kill ()
|
|
8432 "Edit a local kill file applied to the current newsgroup."
|
|
8433 (interactive)
|
|
8434 (gnus-set-global-variables)
|
|
8435 (setq gnus-current-headers (gnus-summary-article-header))
|
|
8436 (gnus-set-global-variables)
|
|
8437 (gnus-group-edit-local-kill
|
|
8438 (gnus-summary-article-number) gnus-newsgroup-name))
|
|
8439
|
|
8440 ;;; Header reading.
|
|
8441
|
|
8442 (defun gnus-read-header (id &optional header)
|
|
8443 "Read the headers of article ID and enter them into the Gnus system."
|
|
8444 (let ((group gnus-newsgroup-name)
|
30
|
8445 (gnus-override-method
|
16
|
8446 (and (gnus-news-group-p gnus-newsgroup-name)
|
|
8447 gnus-refer-article-method))
|
|
8448 where)
|
|
8449 ;; First we check to see whether the header in question is already
|
|
8450 ;; fetched.
|
|
8451 (if (stringp id)
|
|
8452 ;; This is a Message-ID.
|
|
8453 (setq header (or header (gnus-id-to-header id)))
|
|
8454 ;; This is an article number.
|
|
8455 (setq header (or header (gnus-summary-article-header id))))
|
|
8456 (if (and header
|
|
8457 (not (gnus-summary-article-sparse-p (mail-header-number header))))
|
|
8458 ;; We have found the header.
|
|
8459 header
|
|
8460 ;; We have to really fetch the header to this article.
|
|
8461 (save-excursion
|
|
8462 (set-buffer nntp-server-buffer)
|
|
8463 (when (setq where (gnus-request-head id group))
|
|
8464 (nnheader-fold-continuation-lines)
|
|
8465 (goto-char (point-max))
|
|
8466 (insert ".\n")
|
|
8467 (goto-char (point-min))
|
|
8468 (insert "211 ")
|
|
8469 (princ (cond
|
|
8470 ((numberp id) id)
|
|
8471 ((cdr where) (cdr where))
|
|
8472 (header (mail-header-number header))
|
|
8473 (t gnus-reffed-article-number))
|
|
8474 (current-buffer))
|
|
8475 (insert " Article retrieved.\n"))
|
22
|
8476 (if (or (not where)
|
|
8477 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
|
16
|
8478 () ; Malformed head.
|
|
8479 (unless (gnus-summary-article-sparse-p (mail-header-number header))
|
|
8480 (when (and (stringp id)
|
|
8481 (not (string= (gnus-group-real-name group)
|
|
8482 (car where))))
|
|
8483 ;; If we fetched by Message-ID and the article came
|
|
8484 ;; from a different group, we fudge some bogus article
|
|
8485 ;; numbers for this article.
|
|
8486 (mail-header-set-number header gnus-reffed-article-number))
|
|
8487 (save-excursion
|
|
8488 (set-buffer gnus-summary-buffer)
|
|
8489 (decf gnus-reffed-article-number)
|
|
8490 (gnus-remove-header (mail-header-number header))
|
|
8491 (push header gnus-newsgroup-headers)
|
|
8492 (setq gnus-current-headers header)
|
|
8493 (push (mail-header-number header) gnus-newsgroup-limit)))
|
|
8494 header)))))
|
|
8495
|
|
8496 (defun gnus-remove-header (number)
|
|
8497 "Remove header NUMBER from `gnus-newsgroup-headers'."
|
|
8498 (if (and gnus-newsgroup-headers
|
|
8499 (= number (mail-header-number (car gnus-newsgroup-headers))))
|
|
8500 (pop gnus-newsgroup-headers)
|
|
8501 (let ((headers gnus-newsgroup-headers))
|
|
8502 (while (and (cdr headers)
|
|
8503 (not (= number (mail-header-number (cadr headers)))))
|
|
8504 (pop headers))
|
|
8505 (when (cdr headers)
|
|
8506 (setcdr headers (cddr headers))))))
|
|
8507
|
|
8508 ;;;
|
|
8509 ;;; summary highlights
|
|
8510 ;;;
|
|
8511
|
|
8512 (defun gnus-highlight-selected-summary ()
|
|
8513 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
8514 ;; Highlight selected article in summary buffer
|
|
8515 (when gnus-summary-selected-face
|
|
8516 (save-excursion
|
|
8517 (let* ((beg (progn (beginning-of-line) (point)))
|
|
8518 (end (progn (end-of-line) (point)))
|
|
8519 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
|
|
8520 (from (if (get-text-property beg gnus-mouse-face-prop)
|
|
8521 beg
|
30
|
8522 (or (next-single-property-change
|
16
|
8523 beg gnus-mouse-face-prop nil end)
|
|
8524 beg)))
|
|
8525 (to
|
|
8526 (if (= from end)
|
|
8527 (- from 2)
|
|
8528 (or (next-single-property-change
|
|
8529 from gnus-mouse-face-prop nil end)
|
|
8530 end))))
|
|
8531 ;; If no mouse-face prop on line we will have to = from = end,
|
|
8532 ;; so we highlight the entire line instead.
|
|
8533 (when (= (+ to 2) from)
|
|
8534 (setq from beg)
|
|
8535 (setq to end))
|
|
8536 (if gnus-newsgroup-selected-overlay
|
|
8537 ;; Move old overlay.
|
|
8538 (gnus-move-overlay
|
|
8539 gnus-newsgroup-selected-overlay from to (current-buffer))
|
|
8540 ;; Create new overlay.
|
|
8541 (gnus-overlay-put
|
|
8542 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
|
|
8543 'face gnus-summary-selected-face))))))
|
|
8544
|
|
8545 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
|
|
8546 (defun gnus-summary-highlight-line ()
|
|
8547 "Highlight current line according to `gnus-summary-highlight'."
|
|
8548 (let* ((list gnus-summary-highlight)
|
|
8549 (p (point))
|
|
8550 (end (progn (end-of-line) (point)))
|
|
8551 ;; now find out where the line starts and leave point there.
|
|
8552 (beg (progn (beginning-of-line) (point)))
|
|
8553 (article (gnus-summary-article-number))
|
|
8554 (score (or (cdr (assq (or article gnus-current-article)
|
|
8555 gnus-newsgroup-scored))
|
|
8556 gnus-summary-default-score 0))
|
|
8557 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
|
|
8558 (inhibit-read-only t))
|
|
8559 ;; Eval the cars of the lists until we find a match.
|
|
8560 (let ((default gnus-summary-default-score))
|
|
8561 (while (and list
|
|
8562 (not (eval (caar list))))
|
|
8563 (setq list (cdr list))))
|
|
8564 (let ((face (cdar list)))
|
|
8565 (unless (eq face (get-text-property beg 'face))
|
30
|
8566 (gnus-put-text-property
|
|
8567 beg end 'face
|
16
|
8568 (setq face (if (boundp face) (symbol-value face) face)))
|
|
8569 (when gnus-summary-highlight-line-function
|
|
8570 (funcall gnus-summary-highlight-line-function article face))))
|
|
8571 (goto-char p)))
|
|
8572
|
|
8573 (defun gnus-update-read-articles (group unread)
|
|
8574 "Update the list of read articles in GROUP."
|
|
8575 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
|
|
8576 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
8577 (info (nth 2 entry))
|
|
8578 (prev 1)
|
|
8579 (unread (sort (copy-sequence unread) '<))
|
|
8580 read)
|
|
8581 (if (or (not info) (not active))
|
|
8582 ;; There is no info on this group if it was, in fact,
|
|
8583 ;; killed. Gnus stores no information on killed groups, so
|
|
8584 ;; there's nothing to be done.
|
|
8585 ;; One could store the information somewhere temporarily,
|
|
8586 ;; perhaps... Hmmm...
|
|
8587 ()
|
|
8588 ;; Remove any negative articles numbers.
|
|
8589 (while (and unread (< (car unread) 0))
|
|
8590 (setq unread (cdr unread)))
|
|
8591 ;; Remove any expired article numbers
|
|
8592 (while (and unread (< (car unread) (car active)))
|
|
8593 (setq unread (cdr unread)))
|
|
8594 ;; Compute the ranges of read articles by looking at the list of
|
|
8595 ;; unread articles.
|
|
8596 (while unread
|
|
8597 (when (/= (car unread) prev)
|
|
8598 (push (if (= prev (1- (car unread))) prev
|
|
8599 (cons prev (1- (car unread))))
|
|
8600 read))
|
|
8601 (setq prev (1+ (car unread)))
|
|
8602 (setq unread (cdr unread)))
|
|
8603 (when (<= prev (cdr active))
|
|
8604 (push (cons prev (cdr active)) read))
|
|
8605 (save-excursion
|
|
8606 (set-buffer gnus-group-buffer)
|
|
8607 (gnus-undo-register
|
|
8608 `(progn
|
|
8609 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
8610 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
8611 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
8612 (gnus-group-update-group ,group t))))
|
|
8613 ;; Enter this list into the group info.
|
|
8614 (gnus-info-set-read
|
|
8615 info (if (> (length read) 1) (nreverse read) read))
|
|
8616 ;; Set the number of unread articles in gnus-newsrc-hashtb.
|
|
8617 (gnus-get-unread-articles-in-group info (gnus-active group))
|
|
8618 t)))
|
|
8619
|
24
|
8620 (defun gnus-offer-save-summaries ()
|
|
8621 "Offer to save all active summary buffers."
|
|
8622 (save-excursion
|
|
8623 (let ((buflist (buffer-list))
|
|
8624 buffers bufname)
|
|
8625 ;; Go through all buffers and find all summaries.
|
|
8626 (while buflist
|
|
8627 (and (setq bufname (buffer-name (car buflist)))
|
|
8628 (string-match "Summary" bufname)
|
|
8629 (save-excursion
|
|
8630 (set-buffer bufname)
|
|
8631 ;; We check that this is, indeed, a summary buffer.
|
|
8632 (and (eq major-mode 'gnus-summary-mode)
|
|
8633 ;; Also make sure this isn't bogus.
|
|
8634 gnus-newsgroup-prepared
|
|
8635 ;; Also make sure that this isn't a dead summary buffer.
|
|
8636 (not gnus-dead-summary-mode)))
|
|
8637 (push bufname buffers))
|
|
8638 (setq buflist (cdr buflist)))
|
|
8639 ;; Go through all these summary buffers and offer to save them.
|
|
8640 (when buffers
|
|
8641 (map-y-or-n-p
|
|
8642 "Update summary buffer %s? "
|
|
8643 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
|
|
8644 buffers)))))
|
|
8645
|
16
|
8646 (provide 'gnus-sum)
|
|
8647
|
|
8648 (run-hooks 'gnus-sum-load-hook)
|
|
8649
|
|
8650 ;;; gnus-sum.el ends here
|