98
|
1 ;;; gnus-sum.el --- summary mode commands for Gnus
|
|
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
|
|
3
|
|
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
|
|
5 ;; Keywords: news
|
|
6
|
|
7 ;; This file is part of GNU Emacs.
|
|
8
|
|
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
10 ;; it under the terms of the GNU General Public License as published by
|
|
11 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
12 ;; any later version.
|
|
13
|
|
14 ;; GNU Emacs is distributed in the hope that it will be useful,
|
|
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17 ;; GNU General Public License for more details.
|
|
18
|
|
19 ;; You should have received a copy of the GNU General Public License
|
|
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 ;; Boston, MA 02111-1307, USA.
|
|
23
|
|
24 ;;; Commentary:
|
|
25
|
|
26 ;;; Code:
|
|
27
|
|
28 (require 'gnus)
|
|
29 (require 'gnus-group)
|
|
30 (require 'gnus-spec)
|
|
31 (require 'gnus-range)
|
|
32 (require 'gnus-int)
|
|
33 (require 'gnus-undo)
|
|
34
|
|
35 (defcustom gnus-kill-summary-on-exit t
|
|
36 "*If non-nil, kill the summary buffer when you exit from it.
|
|
37 If nil, the summary will become a \"*Dead Summary*\" buffer, and
|
|
38 it will be killed sometime later."
|
|
39 :group 'gnus-summary-exit
|
|
40 :type 'boolean)
|
|
41
|
|
42 (defcustom gnus-fetch-old-headers nil
|
|
43 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
|
|
44 If an unread article in the group refers to an older, already read (or
|
|
45 just marked as read) article, the old article will not normally be
|
|
46 displayed in the Summary buffer. If this variable is non-nil, Gnus
|
|
47 will attempt to grab the headers to the old articles, and thereby
|
|
48 build complete threads. If it has the value `some', only enough
|
|
49 headers to connect otherwise loose threads will be displayed.
|
|
50 This variable can also be a number. In that case, no more than that
|
|
51 number of old headers will be fetched.
|
|
52
|
|
53 The server has to support NOV for any of this to work."
|
|
54 :group 'gnus-thread
|
|
55 :type '(choice (const :tag "off" nil)
|
|
56 (const some)
|
|
57 number
|
|
58 (sexp :menu-tag "other" t)))
|
|
59
|
|
60 (defcustom gnus-summary-make-false-root 'adopt
|
|
61 "*nil means that Gnus won't gather loose threads.
|
|
62 If the root of a thread has expired or been read in a previous
|
|
63 session, the information necessary to build a complete thread has been
|
|
64 lost. Instead of having many small sub-threads from this original thread
|
|
65 scattered all over the summary buffer, Gnus can gather them.
|
|
66
|
|
67 If non-nil, Gnus will try to gather all loose sub-threads from an
|
|
68 original thread into one large thread.
|
|
69
|
|
70 If this variable is non-nil, it should be one of `none', `adopt',
|
|
71 `dummy' or `empty'.
|
|
72
|
|
73 If this variable is `none', Gnus will not make a false root, but just
|
|
74 present the sub-threads after another.
|
|
75 If this variable is `dummy', Gnus will create a dummy root that will
|
|
76 have all the sub-threads as children.
|
|
77 If this variable is `adopt', Gnus will make one of the \"children\"
|
|
78 the parent and mark all the step-children as such.
|
|
79 If this variable is `empty', the \"children\" are printed with empty
|
|
80 subject fields. (Or rather, they will be printed with a string
|
|
81 given by the `gnus-summary-same-subject' variable.)"
|
|
82 :group 'gnus-thread
|
|
83 :type '(choice (const :tag "off" nil)
|
|
84 (const none)
|
|
85 (const dummy)
|
|
86 (const adopt)
|
|
87 (const empty)))
|
|
88
|
|
89 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
|
|
90 "*A regexp to match subjects to be excluded from loose thread gathering.
|
|
91 As loose thread gathering is done on subjects only, that means that
|
|
92 there can be many false gatherings performed. By rooting out certain
|
|
93 common subjects, gathering might become saner."
|
|
94 :group 'gnus-thread
|
|
95 :type 'regexp)
|
|
96
|
|
97 (defcustom gnus-summary-gather-subject-limit nil
|
|
98 "*Maximum length of subject comparisons when gathering loose threads.
|
|
99 Use nil to compare full subjects. Setting this variable to a low
|
|
100 number will help gather threads that have been corrupted by
|
|
101 newsreaders chopping off subject lines, but it might also mean that
|
|
102 unrelated articles that have subject that happen to begin with the
|
|
103 same few characters will be incorrectly gathered.
|
|
104
|
|
105 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
|
|
106 comparing subjects."
|
|
107 :group 'gnus-thread
|
|
108 :type '(choice (const :tag "off" nil)
|
|
109 (const fuzzy)
|
|
110 (sexp :menu-tag "on" t)))
|
|
111
|
|
112 (defcustom gnus-simplify-ignored-prefixes nil
|
|
113 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
|
|
114 :group 'gnus-thread
|
|
115 :type '(choice (const :tag "off" nil)
|
|
116 regexp))
|
|
117
|
|
118 (defcustom gnus-build-sparse-threads nil
|
|
119 "*If non-nil, fill in the gaps in threads.
|
|
120 If `some', only fill in the gaps that are needed to tie loose threads
|
|
121 together. If `more', fill in all leaf nodes that Gnus can find. If
|
|
122 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
|
|
123 :group 'gnus-thread
|
|
124 :type '(choice (const :tag "off" nil)
|
|
125 (const some)
|
|
126 (const more)
|
|
127 (sexp :menu-tag "all" t)))
|
|
128
|
112
|
129 (defcustom gnus-summary-thread-gathering-function
|
|
130 'gnus-gather-threads-by-subject
|
98
|
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.
|
108
|
162 All scores generated by the score files will be added to this score.
|
98
|
163 If this variable is nil, scoring will be disabled."
|
100
|
164 :group 'gnus-score-default
|
98
|
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
|
114
|
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
|
98
|
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."
|
100
|
496 :group 'gnus-score-default
|
98
|
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."
|
100
|
545 :group 'gnus-score-default
|
98
|
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
|
100
|
554 :group 'gnus-score-default
|
98
|
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
|
108
|
620 (defcustom gnus-parse-headers-hook
|
155
|
621 (list 'gnus-hack-decode-rfc1522 'gnus-decode-rfc1522)
|
98
|
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
|
|
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
|
|
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
|
108
|
664 (defcustom gnus-summary-highlight
|
98
|
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)
|
108
|
690 ((> score default)
|
98
|
691 . gnus-summary-high-read-face)
|
108
|
692 ((< score default)
|
98
|
693 . gnus-summary-low-read-face)
|
108
|
694 (t
|
98
|
695 . gnus-summary-normal-read-face))
|
108
|
696 "Controls the highlighting of summary buffer lines.
|
98
|
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.
|
108
|
707 below: The score below which articles are automatically marked as read.
|
98
|
708 mark: The articles mark."
|
|
709 :group 'gnus-summary-visual
|
|
710 :type '(repeat (cons (sexp :tag "Form" nil)
|
|
711 face)))
|
|
712
|
|
713
|
|
714 ;;; Internal variables
|
|
715
|
|
716 (defvar gnus-scores-exclude-files nil)
|
120
|
717 (defvar gnus-page-broken nil)
|
98
|
718
|
|
719 (defvar gnus-original-article nil)
|
|
720 (defvar gnus-article-internal-prepare-hook nil)
|
|
721 (defvar gnus-newsgroup-process-stack nil)
|
|
722
|
|
723 (defvar gnus-thread-indent-array nil)
|
|
724 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
725
|
|
726 ;; Avoid highlighting in kill files.
|
|
727 (defvar gnus-summary-inhibit-highlight nil)
|
|
728 (defvar gnus-newsgroup-selected-overlay nil)
|
|
729 (defvar gnus-inhibit-limiting nil)
|
|
730 (defvar gnus-newsgroup-adaptive-score-file nil)
|
|
731 (defvar gnus-current-score-file nil)
|
|
732 (defvar gnus-current-move-group nil)
|
|
733 (defvar gnus-current-copy-group nil)
|
|
734 (defvar gnus-current-crosspost-group nil)
|
|
735
|
|
736 (defvar gnus-newsgroup-dependencies nil)
|
|
737 (defvar gnus-newsgroup-adaptive nil)
|
|
738 (defvar gnus-summary-display-article-function nil)
|
|
739 (defvar gnus-summary-highlight-line-function nil
|
|
740 "Function called after highlighting a summary line.")
|
|
741
|
|
742 (defvar gnus-summary-line-format-alist
|
|
743 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
|
|
744 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
|
|
745 (?s gnus-tmp-subject-or-nil ?s)
|
|
746 (?n gnus-tmp-name ?s)
|
|
747 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
|
|
748 ?s)
|
|
749 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
|
|
750 gnus-tmp-from) ?s)
|
|
751 (?F gnus-tmp-from ?s)
|
|
752 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
|
|
753 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
|
|
754 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
|
|
755 (?o (gnus-date-iso8601 gnus-tmp-header) ?s)
|
|
756 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
|
|
757 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
|
|
758 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
|
|
759 (?L gnus-tmp-lines ?d)
|
|
760 (?I gnus-tmp-indentation ?s)
|
|
761 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
|
|
762 (?R gnus-tmp-replied ?c)
|
|
763 (?\[ gnus-tmp-opening-bracket ?c)
|
|
764 (?\] gnus-tmp-closing-bracket ?c)
|
|
765 (?\> (make-string gnus-tmp-level ? ) ?s)
|
|
766 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
|
|
767 (?i gnus-tmp-score ?d)
|
|
768 (?z gnus-tmp-score-char ?c)
|
|
769 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
|
|
770 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
|
|
771 (?U gnus-tmp-unread ?c)
|
|
772 (?t (gnus-summary-number-of-articles-in-thread
|
|
773 (and (boundp 'thread) (car thread)) gnus-tmp-level)
|
|
774 ?d)
|
|
775 (?e (gnus-summary-number-of-articles-in-thread
|
|
776 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
|
|
777 ?c)
|
|
778 (?u gnus-tmp-user-defined ?s)
|
|
779 (?P (gnus-pick-line-number) ?d))
|
|
780 "An alist of format specifications that can appear in summary lines,
|
|
781 and what variables they correspond with, along with the type of the
|
|
782 variable (string, integer, character, etc).")
|
|
783
|
|
784 (defvar gnus-summary-dummy-line-format-alist
|
|
785 `((?S gnus-tmp-subject ?s)
|
|
786 (?N gnus-tmp-number ?d)
|
|
787 (?u gnus-tmp-user-defined ?s)))
|
|
788
|
|
789 (defvar gnus-summary-mode-line-format-alist
|
|
790 `((?G gnus-tmp-group-name ?s)
|
|
791 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
|
|
792 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
|
|
793 (?A gnus-tmp-article-number ?d)
|
|
794 (?Z gnus-tmp-unread-and-unselected ?s)
|
|
795 (?V gnus-version ?s)
|
|
796 (?U gnus-tmp-unread-and-unticked ?d)
|
|
797 (?S gnus-tmp-subject ?s)
|
|
798 (?e gnus-tmp-unselected ?d)
|
|
799 (?u gnus-tmp-user-defined ?s)
|
|
800 (?d (length gnus-newsgroup-dormant) ?d)
|
|
801 (?t (length gnus-newsgroup-marked) ?d)
|
|
802 (?r (length gnus-newsgroup-reads) ?d)
|
|
803 (?E gnus-newsgroup-expunged-tally ?d)
|
|
804 (?s (gnus-current-score-file-nondirectory) ?s)))
|
|
805
|
|
806 (defvar gnus-last-search-regexp nil
|
|
807 "Default regexp for article search command.")
|
|
808
|
|
809 (defvar gnus-last-shell-command nil
|
|
810 "Default shell command on article.")
|
|
811
|
|
812 (defvar gnus-newsgroup-begin nil)
|
|
813 (defvar gnus-newsgroup-end nil)
|
|
814 (defvar gnus-newsgroup-last-rmail nil)
|
|
815 (defvar gnus-newsgroup-last-mail nil)
|
|
816 (defvar gnus-newsgroup-last-folder nil)
|
|
817 (defvar gnus-newsgroup-last-file nil)
|
|
818 (defvar gnus-newsgroup-auto-expire nil)
|
|
819 (defvar gnus-newsgroup-active nil)
|
|
820
|
|
821 (defvar gnus-newsgroup-data nil)
|
|
822 (defvar gnus-newsgroup-data-reverse nil)
|
|
823 (defvar gnus-newsgroup-limit nil)
|
|
824 (defvar gnus-newsgroup-limits nil)
|
|
825
|
|
826 (defvar gnus-newsgroup-unreads nil
|
|
827 "List of unread articles in the current newsgroup.")
|
|
828
|
|
829 (defvar gnus-newsgroup-unselected nil
|
|
830 "List of unselected unread articles in the current newsgroup.")
|
|
831
|
|
832 (defvar gnus-newsgroup-reads nil
|
|
833 "Alist of read articles and article marks in the current newsgroup.")
|
|
834
|
|
835 (defvar gnus-newsgroup-expunged-tally nil)
|
|
836
|
|
837 (defvar gnus-newsgroup-marked nil
|
|
838 "List of ticked articles in the current newsgroup (a subset of unread art).")
|
|
839
|
|
840 (defvar gnus-newsgroup-killed nil
|
|
841 "List of ranges of articles that have been through the scoring process.")
|
|
842
|
|
843 (defvar gnus-newsgroup-cached nil
|
|
844 "List of articles that come from the article cache.")
|
|
845
|
|
846 (defvar gnus-newsgroup-saved nil
|
|
847 "List of articles that have been saved.")
|
|
848
|
|
849 (defvar gnus-newsgroup-kill-headers nil)
|
|
850
|
|
851 (defvar gnus-newsgroup-replied nil
|
|
852 "List of articles that have been replied to in the current newsgroup.")
|
|
853
|
|
854 (defvar gnus-newsgroup-expirable nil
|
|
855 "List of articles in the current newsgroup that can be expired.")
|
|
856
|
|
857 (defvar gnus-newsgroup-processable nil
|
|
858 "List of articles in the current newsgroup that can be processed.")
|
|
859
|
|
860 (defvar gnus-newsgroup-bookmarks nil
|
|
861 "List of articles in the current newsgroup that have bookmarks.")
|
|
862
|
|
863 (defvar gnus-newsgroup-dormant nil
|
|
864 "List of dormant articles in the current newsgroup.")
|
|
865
|
|
866 (defvar gnus-newsgroup-scored nil
|
|
867 "List of scored articles in the current newsgroup.")
|
|
868
|
|
869 (defvar gnus-newsgroup-headers nil
|
|
870 "List of article headers in the current newsgroup.")
|
|
871
|
|
872 (defvar gnus-newsgroup-threads nil)
|
|
873
|
|
874 (defvar gnus-newsgroup-prepared nil
|
|
875 "Whether the current group has been prepared properly.")
|
|
876
|
|
877 (defvar gnus-newsgroup-ancient nil
|
|
878 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
|
|
879
|
|
880 (defvar gnus-newsgroup-sparse nil)
|
|
881
|
|
882 (defvar gnus-current-article nil)
|
|
883 (defvar gnus-article-current nil)
|
|
884 (defvar gnus-current-headers nil)
|
|
885 (defvar gnus-have-all-headers nil)
|
|
886 (defvar gnus-last-article nil)
|
|
887 (defvar gnus-newsgroup-history nil)
|
|
888
|
|
889 (defconst gnus-summary-local-variables
|
|
890 '(gnus-newsgroup-name
|
|
891 gnus-newsgroup-begin gnus-newsgroup-end
|
|
892 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
|
|
893 gnus-newsgroup-last-folder gnus-newsgroup-last-file
|
|
894 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
|
|
895 gnus-newsgroup-unselected gnus-newsgroup-marked
|
|
896 gnus-newsgroup-reads gnus-newsgroup-saved
|
|
897 gnus-newsgroup-replied gnus-newsgroup-expirable
|
|
898 gnus-newsgroup-processable gnus-newsgroup-killed
|
|
899 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
|
|
900 gnus-newsgroup-headers gnus-newsgroup-threads
|
|
901 gnus-newsgroup-prepared gnus-summary-highlight-line-function
|
|
902 gnus-current-article gnus-current-headers gnus-have-all-headers
|
|
903 gnus-last-article gnus-article-internal-prepare-hook
|
|
904 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
|
|
905 gnus-newsgroup-scored gnus-newsgroup-kill-headers
|
|
906 gnus-thread-expunge-below
|
|
907 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
|
|
908 (gnus-summary-mark-below . global)
|
|
909 gnus-newsgroup-active gnus-scores-exclude-files
|
|
910 gnus-newsgroup-history gnus-newsgroup-ancient
|
|
911 gnus-newsgroup-sparse gnus-newsgroup-process-stack
|
|
912 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
|
|
913 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
|
|
914 (gnus-newsgroup-expunged-tally . 0)
|
|
915 gnus-cache-removable-articles gnus-newsgroup-cached
|
|
916 gnus-newsgroup-data gnus-newsgroup-data-reverse
|
|
917 gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
918 "Variables that are buffer-local to the summary buffers.")
|
|
919
|
|
920 ;; Byte-compiler warning.
|
|
921 (defvar gnus-article-mode-map)
|
|
922
|
|
923 ;; Subject simplification.
|
|
924
|
|
925 (defsubst gnus-simplify-subject-re (subject)
|
|
926 "Remove \"Re:\" from subject lines."
|
|
927 (if (string-match "^[Rr][Ee]: *" subject)
|
|
928 (substring subject (match-end 0))
|
|
929 subject))
|
|
930
|
|
931 (defun gnus-simplify-subject (subject &optional re-only)
|
|
932 "Remove `Re:' and words in parentheses.
|
|
933 If RE-ONLY is non-nil, strip leading `Re:'s only."
|
|
934 (let ((case-fold-search t)) ;Ignore case.
|
|
935 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
|
|
936 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
|
|
937 (setq subject (substring subject (match-end 0))))
|
|
938 ;; Remove uninteresting prefixes.
|
|
939 (when (and (not re-only)
|
|
940 gnus-simplify-ignored-prefixes
|
|
941 (string-match gnus-simplify-ignored-prefixes subject))
|
|
942 (setq subject (substring subject (match-end 0))))
|
|
943 ;; Remove words in parentheses from end.
|
|
944 (unless re-only
|
|
945 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
|
|
946 (setq subject (substring subject 0 (match-beginning 0)))))
|
|
947 ;; Return subject string.
|
|
948 subject))
|
|
949
|
|
950 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
|
|
951 ;; all whitespace.
|
|
952 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
|
|
953 (goto-char (point-min))
|
|
954 (while (re-search-forward regexp nil t)
|
|
955 (replace-match (or newtext ""))))
|
|
956
|
|
957 (defun gnus-simplify-buffer-fuzzy ()
|
|
958 "Simplify string in the buffer fuzzily.
|
|
959 The string in the accessible portion of the current buffer is simplified.
|
|
960 It is assumed to be a single-line subject.
|
|
961 Whitespace is generally cleaned up, and miscellaneous leading/trailing
|
|
962 matter is removed. Additional things can be deleted by setting
|
|
963 gnus-simplify-subject-fuzzy-regexp."
|
|
964 (let ((case-fold-search t)
|
|
965 (modified-tick))
|
|
966 (gnus-simplify-buffer-fuzzy-step "\t" " ")
|
|
967
|
|
968 (while (not (eq modified-tick (buffer-modified-tick)))
|
|
969 (setq modified-tick (buffer-modified-tick))
|
|
970 (cond
|
|
971 ((listp gnus-simplify-subject-fuzzy-regexp)
|
|
972 (mapcar 'gnus-simplify-buffer-fuzzy-step
|
|
973 gnus-simplify-subject-fuzzy-regexp))
|
|
974 (gnus-simplify-subject-fuzzy-regexp
|
|
975 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
|
|
976 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
|
|
977 (gnus-simplify-buffer-fuzzy-step
|
|
978 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
|
|
979 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
|
|
980
|
|
981 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
|
|
982 (gnus-simplify-buffer-fuzzy-step " +" " ")
|
|
983 (gnus-simplify-buffer-fuzzy-step " $")
|
|
984 (gnus-simplify-buffer-fuzzy-step "^ +")))
|
|
985
|
|
986 (defun gnus-simplify-subject-fuzzy (subject)
|
|
987 "Simplify a subject string fuzzily.
|
|
988 See gnus-simplify-buffer-fuzzy for details."
|
|
989 (save-excursion
|
|
990 (gnus-set-work-buffer)
|
|
991 (let ((case-fold-search t))
|
|
992 (insert subject)
|
|
993 (inline (gnus-simplify-buffer-fuzzy))
|
|
994 (buffer-string))))
|
|
995
|
|
996 (defsubst gnus-simplify-subject-fully (subject)
|
|
997 "Simplify a subject string according to gnus-summary-gather-subject-limit."
|
|
998 (cond
|
|
999 ((null gnus-summary-gather-subject-limit)
|
|
1000 (gnus-simplify-subject-re subject))
|
|
1001 ((eq gnus-summary-gather-subject-limit 'fuzzy)
|
|
1002 (gnus-simplify-subject-fuzzy subject))
|
|
1003 ((numberp gnus-summary-gather-subject-limit)
|
|
1004 (gnus-limit-string (gnus-simplify-subject-re subject)
|
|
1005 gnus-summary-gather-subject-limit))
|
|
1006 (t
|
|
1007 subject)))
|
|
1008
|
|
1009 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
|
|
1010 "Check whether two subjects are equal. If optional argument
|
|
1011 simple-first is t, first argument is already simplified."
|
|
1012 (cond
|
|
1013 ((null simple-first)
|
|
1014 (equal (gnus-simplify-subject-fully s1)
|
|
1015 (gnus-simplify-subject-fully s2)))
|
|
1016 (t
|
|
1017 (equal s1
|
|
1018 (gnus-simplify-subject-fully s2)))))
|
|
1019
|
|
1020 (defun gnus-summary-bubble-group ()
|
|
1021 "Increase the score of the current group.
|
|
1022 This is a handy function to add to `gnus-summary-exit-hook' to
|
|
1023 increase the score of each group you read."
|
|
1024 (gnus-group-add-score gnus-newsgroup-name))
|
|
1025
|
|
1026
|
|
1027 ;;;
|
|
1028 ;;; Gnus summary mode
|
|
1029 ;;;
|
|
1030
|
|
1031 (put 'gnus-summary-mode 'mode-class 'special)
|
|
1032
|
|
1033 (when t
|
|
1034 ;; Non-orthogonal keys
|
|
1035
|
|
1036 (gnus-define-keys gnus-summary-mode-map
|
|
1037 " " gnus-summary-next-page
|
|
1038 "\177" gnus-summary-prev-page
|
163
|
1039 [backspace] gnus-summary-prev-page
|
98
|
1040 [delete] gnus-summary-prev-page
|
|
1041 "\r" gnus-summary-scroll-up
|
|
1042 "n" gnus-summary-next-unread-article
|
|
1043 "p" gnus-summary-prev-unread-article
|
|
1044 "N" gnus-summary-next-article
|
|
1045 "P" gnus-summary-prev-article
|
|
1046 "\M-\C-n" gnus-summary-next-same-subject
|
|
1047 "\M-\C-p" gnus-summary-prev-same-subject
|
|
1048 "\M-n" gnus-summary-next-unread-subject
|
|
1049 "\M-p" gnus-summary-prev-unread-subject
|
|
1050 "." gnus-summary-first-unread-article
|
|
1051 "," gnus-summary-best-unread-article
|
|
1052 "\M-s" gnus-summary-search-article-forward
|
|
1053 "\M-r" gnus-summary-search-article-backward
|
|
1054 "<" gnus-summary-beginning-of-article
|
|
1055 ">" gnus-summary-end-of-article
|
|
1056 "j" gnus-summary-goto-article
|
|
1057 "^" gnus-summary-refer-parent-article
|
|
1058 "\M-^" gnus-summary-refer-article
|
|
1059 "u" gnus-summary-tick-article-forward
|
|
1060 "!" gnus-summary-tick-article-forward
|
|
1061 "U" gnus-summary-tick-article-backward
|
|
1062 "d" gnus-summary-mark-as-read-forward
|
|
1063 "D" gnus-summary-mark-as-read-backward
|
|
1064 "E" gnus-summary-mark-as-expirable
|
|
1065 "\M-u" gnus-summary-clear-mark-forward
|
|
1066 "\M-U" gnus-summary-clear-mark-backward
|
|
1067 "k" gnus-summary-kill-same-subject-and-select
|
|
1068 "\C-k" gnus-summary-kill-same-subject
|
|
1069 "\M-\C-k" gnus-summary-kill-thread
|
|
1070 "\M-\C-l" gnus-summary-lower-thread
|
|
1071 "e" gnus-summary-edit-article
|
|
1072 "#" gnus-summary-mark-as-processable
|
|
1073 "\M-#" gnus-summary-unmark-as-processable
|
|
1074 "\M-\C-t" gnus-summary-toggle-threads
|
|
1075 "\M-\C-s" gnus-summary-show-thread
|
|
1076 "\M-\C-h" gnus-summary-hide-thread
|
|
1077 "\M-\C-f" gnus-summary-next-thread
|
|
1078 "\M-\C-b" gnus-summary-prev-thread
|
|
1079 "\M-\C-u" gnus-summary-up-thread
|
|
1080 "\M-\C-d" gnus-summary-down-thread
|
|
1081 "&" gnus-summary-execute-command
|
|
1082 "c" gnus-summary-catchup-and-exit
|
|
1083 "\C-w" gnus-summary-mark-region-as-read
|
|
1084 "\C-t" gnus-summary-toggle-truncation
|
|
1085 "?" gnus-summary-mark-as-dormant
|
|
1086 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
|
|
1087 "\C-c\C-s\C-n" gnus-summary-sort-by-number
|
|
1088 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
|
|
1089 "\C-c\C-s\C-a" gnus-summary-sort-by-author
|
|
1090 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
|
|
1091 "\C-c\C-s\C-d" gnus-summary-sort-by-date
|
|
1092 "\C-c\C-s\C-i" gnus-summary-sort-by-score
|
|
1093 "=" gnus-summary-expand-window
|
|
1094 "\C-x\C-s" gnus-summary-reselect-current-group
|
|
1095 "\M-g" gnus-summary-rescan-group
|
|
1096 "w" gnus-summary-stop-page-breaking
|
|
1097 "\C-c\C-r" gnus-summary-caesar-message
|
|
1098 "\M-t" gnus-summary-toggle-mime
|
|
1099 "f" gnus-summary-followup
|
|
1100 "F" gnus-summary-followup-with-original
|
|
1101 "C" gnus-summary-cancel-article
|
|
1102 "r" gnus-summary-reply
|
|
1103 "R" gnus-summary-reply-with-original
|
|
1104 "\C-c\C-f" gnus-summary-mail-forward
|
|
1105 "o" gnus-summary-save-article
|
|
1106 "\C-o" gnus-summary-save-article-mail
|
|
1107 "|" gnus-summary-pipe-output
|
|
1108 "\M-k" gnus-summary-edit-local-kill
|
|
1109 "\M-K" gnus-summary-edit-global-kill
|
|
1110 ;; "V" gnus-version
|
|
1111 "\C-c\C-d" gnus-summary-describe-group
|
|
1112 "q" gnus-summary-exit
|
|
1113 "Q" gnus-summary-exit-no-update
|
|
1114 "\C-c\C-i" gnus-info-find-node
|
|
1115 gnus-mouse-2 gnus-mouse-pick-article
|
|
1116 "m" gnus-summary-mail-other-window
|
|
1117 "a" gnus-summary-post-news
|
|
1118 "x" gnus-summary-limit-to-unread
|
|
1119 "s" gnus-summary-isearch-article
|
|
1120 "t" gnus-article-hide-headers
|
|
1121 "g" gnus-summary-show-article
|
|
1122 "l" gnus-summary-goto-last-article
|
|
1123 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
|
|
1124 "\C-d" gnus-summary-enter-digest-group
|
|
1125 "\M-\C-d" gnus-summary-read-document
|
|
1126 "\C-c\C-b" gnus-bug
|
|
1127 "*" gnus-cache-enter-article
|
|
1128 "\M-*" gnus-cache-remove-article
|
|
1129 "\M-&" gnus-summary-universal-argument
|
|
1130 "\C-l" gnus-recenter
|
|
1131 "I" gnus-summary-increase-score
|
|
1132 "L" gnus-summary-lower-score
|
|
1133
|
|
1134 "V" gnus-summary-score-map
|
|
1135 "X" gnus-uu-extract-map
|
|
1136 "S" gnus-summary-send-map)
|
|
1137
|
|
1138 ;; Sort of orthogonal keymap
|
|
1139 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
|
|
1140 "t" gnus-summary-tick-article-forward
|
|
1141 "!" gnus-summary-tick-article-forward
|
|
1142 "d" gnus-summary-mark-as-read-forward
|
|
1143 "r" gnus-summary-mark-as-read-forward
|
|
1144 "c" gnus-summary-clear-mark-forward
|
|
1145 " " gnus-summary-clear-mark-forward
|
|
1146 "e" gnus-summary-mark-as-expirable
|
|
1147 "x" gnus-summary-mark-as-expirable
|
|
1148 "?" gnus-summary-mark-as-dormant
|
|
1149 "b" gnus-summary-set-bookmark
|
|
1150 "B" gnus-summary-remove-bookmark
|
|
1151 "#" gnus-summary-mark-as-processable
|
|
1152 "\M-#" gnus-summary-unmark-as-processable
|
|
1153 "S" gnus-summary-limit-include-expunged
|
|
1154 "C" gnus-summary-catchup
|
|
1155 "H" gnus-summary-catchup-to-here
|
|
1156 "\C-c" gnus-summary-catchup-all
|
|
1157 "k" gnus-summary-kill-same-subject-and-select
|
|
1158 "K" gnus-summary-kill-same-subject
|
|
1159 "P" gnus-uu-mark-map)
|
|
1160
|
|
1161 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
|
|
1162 "c" gnus-summary-clear-above
|
|
1163 "u" gnus-summary-tick-above
|
|
1164 "m" gnus-summary-mark-above
|
|
1165 "k" gnus-summary-kill-below)
|
|
1166
|
|
1167 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
|
|
1168 "/" gnus-summary-limit-to-subject
|
|
1169 "n" gnus-summary-limit-to-articles
|
|
1170 "w" gnus-summary-pop-limit
|
|
1171 "s" gnus-summary-limit-to-subject
|
|
1172 "a" gnus-summary-limit-to-author
|
|
1173 "u" gnus-summary-limit-to-unread
|
|
1174 "m" gnus-summary-limit-to-marks
|
|
1175 "v" gnus-summary-limit-to-score
|
|
1176 "D" gnus-summary-limit-include-dormant
|
|
1177 "d" gnus-summary-limit-exclude-dormant
|
|
1178 "t" gnus-summary-limit-to-age
|
|
1179 "E" gnus-summary-limit-include-expunged
|
|
1180 "c" gnus-summary-limit-exclude-childless-dormant
|
|
1181 "C" gnus-summary-limit-mark-excluded-as-read)
|
|
1182
|
|
1183 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
|
|
1184 "n" gnus-summary-next-unread-article
|
|
1185 "p" gnus-summary-prev-unread-article
|
|
1186 "N" gnus-summary-next-article
|
|
1187 "P" gnus-summary-prev-article
|
|
1188 "\C-n" gnus-summary-next-same-subject
|
|
1189 "\C-p" gnus-summary-prev-same-subject
|
|
1190 "\M-n" gnus-summary-next-unread-subject
|
|
1191 "\M-p" gnus-summary-prev-unread-subject
|
|
1192 "f" gnus-summary-first-unread-article
|
|
1193 "b" gnus-summary-best-unread-article
|
|
1194 "j" gnus-summary-goto-article
|
|
1195 "g" gnus-summary-goto-subject
|
|
1196 "l" gnus-summary-goto-last-article
|
163
|
1197 "o" gnus-summary-pop-article)
|
98
|
1198
|
|
1199 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
|
|
1200 "k" gnus-summary-kill-thread
|
|
1201 "l" gnus-summary-lower-thread
|
|
1202 "i" gnus-summary-raise-thread
|
|
1203 "T" gnus-summary-toggle-threads
|
|
1204 "t" gnus-summary-rethread-current
|
|
1205 "^" gnus-summary-reparent-thread
|
|
1206 "s" gnus-summary-show-thread
|
|
1207 "S" gnus-summary-show-all-threads
|
|
1208 "h" gnus-summary-hide-thread
|
|
1209 "H" gnus-summary-hide-all-threads
|
|
1210 "n" gnus-summary-next-thread
|
|
1211 "p" gnus-summary-prev-thread
|
|
1212 "u" gnus-summary-up-thread
|
|
1213 "o" gnus-summary-top-thread
|
|
1214 "d" gnus-summary-down-thread
|
|
1215 "#" gnus-uu-mark-thread
|
|
1216 "\M-#" gnus-uu-unmark-thread)
|
|
1217
|
|
1218 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
|
108
|
1219 "g" gnus-summary-prepare
|
98
|
1220 "c" gnus-summary-insert-cached-articles)
|
|
1221
|
|
1222 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
|
|
1223 "c" gnus-summary-catchup-and-exit
|
|
1224 "C" gnus-summary-catchup-all-and-exit
|
|
1225 "E" gnus-summary-exit-no-update
|
|
1226 "Q" gnus-summary-exit
|
|
1227 "Z" gnus-summary-exit
|
|
1228 "n" gnus-summary-catchup-and-goto-next-group
|
|
1229 "R" gnus-summary-reselect-current-group
|
|
1230 "G" gnus-summary-rescan-group
|
|
1231 "N" gnus-summary-next-group
|
|
1232 "s" gnus-summary-save-newsrc
|
|
1233 "P" gnus-summary-prev-group)
|
|
1234
|
|
1235 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
|
|
1236 " " gnus-summary-next-page
|
|
1237 "n" gnus-summary-next-page
|
|
1238 "\177" gnus-summary-prev-page
|
163
|
1239 [backspace] gnus-summary-prev-page
|
98
|
1240 [delete] gnus-summary-prev-page
|
|
1241 "p" gnus-summary-prev-page
|
|
1242 "\r" gnus-summary-scroll-up
|
|
1243 "<" gnus-summary-beginning-of-article
|
|
1244 ">" gnus-summary-end-of-article
|
|
1245 "b" gnus-summary-beginning-of-article
|
|
1246 "e" gnus-summary-end-of-article
|
|
1247 "^" gnus-summary-refer-parent-article
|
|
1248 "r" gnus-summary-refer-parent-article
|
|
1249 "R" gnus-summary-refer-references
|
|
1250 "g" gnus-summary-show-article
|
|
1251 "s" gnus-summary-isearch-article
|
|
1252 "P" gnus-summary-print-article)
|
|
1253
|
|
1254 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
|
|
1255 "b" gnus-article-add-buttons
|
|
1256 "B" gnus-article-add-buttons-to-head
|
|
1257 "o" gnus-article-treat-overstrike
|
|
1258 "e" gnus-article-emphasize
|
|
1259 "w" gnus-article-fill-cited-article
|
|
1260 "c" gnus-article-remove-cr
|
|
1261 "q" gnus-article-de-quoted-unreadable
|
|
1262 "f" gnus-article-display-x-face
|
|
1263 "l" gnus-summary-stop-page-breaking
|
|
1264 "r" gnus-summary-caesar-message
|
|
1265 "t" gnus-article-hide-headers
|
|
1266 "v" gnus-summary-verbose-headers
|
104
|
1267 "m" gnus-summary-toggle-mime
|
|
1268 "h" gnus-article-treat-html)
|
98
|
1269
|
|
1270 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
|
|
1271 "a" gnus-article-hide
|
|
1272 "h" gnus-article-hide-headers
|
|
1273 "b" gnus-article-hide-boring-headers
|
|
1274 "s" gnus-article-hide-signature
|
|
1275 "c" gnus-article-hide-citation
|
|
1276 "p" gnus-article-hide-pgp
|
|
1277 "P" gnus-article-hide-pem
|
|
1278 "\C-c" gnus-article-hide-citation-maybe)
|
|
1279
|
|
1280 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
|
|
1281 "a" gnus-article-highlight
|
|
1282 "h" gnus-article-highlight-headers
|
|
1283 "c" gnus-article-highlight-citation
|
|
1284 "s" gnus-article-highlight-signature)
|
|
1285
|
|
1286 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
|
|
1287 "z" gnus-article-date-ut
|
|
1288 "u" gnus-article-date-ut
|
|
1289 "l" gnus-article-date-local
|
|
1290 "e" gnus-article-date-lapsed
|
|
1291 "o" gnus-article-date-original
|
|
1292 "s" gnus-article-date-user)
|
|
1293
|
|
1294 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
|
|
1295 "t" gnus-article-remove-trailing-blank-lines
|
|
1296 "l" gnus-article-strip-leading-blank-lines
|
|
1297 "m" gnus-article-strip-multiple-blank-lines
|
114
|
1298 "a" gnus-article-strip-blank-lines
|
|
1299 "s" gnus-article-strip-leading-space)
|
98
|
1300
|
|
1301 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
|
|
1302 "v" gnus-version
|
|
1303 "f" gnus-summary-fetch-faq
|
|
1304 "d" gnus-summary-describe-group
|
|
1305 "h" gnus-summary-describe-briefly
|
|
1306 "i" gnus-info-find-node)
|
|
1307
|
|
1308 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
|
|
1309 "e" gnus-summary-expire-articles
|
|
1310 "\M-\C-e" gnus-summary-expire-articles-now
|
|
1311 "\177" gnus-summary-delete-article
|
163
|
1312 [backspace] gnus-summary-delete-article
|
98
|
1313 [delete] gnus-summary-delete-article
|
|
1314 "m" gnus-summary-move-article
|
|
1315 "r" gnus-summary-respool-article
|
|
1316 "w" gnus-summary-edit-article
|
|
1317 "c" gnus-summary-copy-article
|
|
1318 "B" gnus-summary-crosspost-article
|
|
1319 "q" gnus-summary-respool-query
|
|
1320 "i" gnus-summary-import-article
|
|
1321 "p" gnus-summary-article-posted-p)
|
|
1322
|
|
1323 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
|
|
1324 "o" gnus-summary-save-article
|
|
1325 "m" gnus-summary-save-article-mail
|
|
1326 "F" gnus-summary-write-article-file
|
|
1327 "r" gnus-summary-save-article-rmail
|
|
1328 "f" gnus-summary-save-article-file
|
|
1329 "b" gnus-summary-save-article-body-file
|
|
1330 "h" gnus-summary-save-article-folder
|
|
1331 "v" gnus-summary-save-article-vm
|
|
1332 "p" gnus-summary-pipe-output
|
|
1333 "s" gnus-soup-add-article))
|
|
1334
|
|
1335 (defun gnus-summary-make-menu-bar ()
|
|
1336 (gnus-turn-off-edit-menu 'summary)
|
|
1337
|
|
1338 (unless (boundp 'gnus-summary-misc-menu)
|
|
1339
|
|
1340 (easy-menu-define
|
|
1341 gnus-summary-kill-menu gnus-summary-mode-map ""
|
|
1342 (cons
|
|
1343 "Score"
|
|
1344 (nconc
|
|
1345 (list
|
|
1346 ["Enter score..." gnus-summary-score-entry t]
|
|
1347 ["Customize" gnus-score-customize t])
|
|
1348 (gnus-make-score-map 'increase)
|
|
1349 (gnus-make-score-map 'lower)
|
|
1350 '(("Mark"
|
|
1351 ["Kill below" gnus-summary-kill-below t]
|
|
1352 ["Mark above" gnus-summary-mark-above t]
|
|
1353 ["Tick above" gnus-summary-tick-above t]
|
|
1354 ["Clear above" gnus-summary-clear-above t])
|
|
1355 ["Current score" gnus-summary-current-score t]
|
|
1356 ["Set score" gnus-summary-set-score t]
|
|
1357 ["Switch current score file..." gnus-score-change-score-file t]
|
|
1358 ["Set mark below..." gnus-score-set-mark-below t]
|
|
1359 ["Set expunge below..." gnus-score-set-expunge-below t]
|
|
1360 ["Edit current score file" gnus-score-edit-current-scores t]
|
|
1361 ["Edit score file" gnus-score-edit-file t]
|
|
1362 ["Trace score" gnus-score-find-trace t]
|
|
1363 ["Find words" gnus-score-find-favourite-words t]
|
|
1364 ["Rescore buffer" gnus-summary-rescore t]
|
|
1365 ["Increase score..." gnus-summary-increase-score t]
|
|
1366 ["Lower score..." gnus-summary-lower-score t]))))
|
|
1367
|
|
1368 '(("Default header"
|
|
1369 ["Ask" (gnus-score-set-default 'gnus-score-default-header nil)
|
108
|
1370 :style radio
|
98
|
1371 :selected (null gnus-score-default-header)]
|
|
1372 ["From" (gnus-score-set-default 'gnus-score-default-header 'a)
|
108
|
1373 :style radio
|
98
|
1374 :selected (eq gnus-score-default-header 'a)]
|
|
1375 ["Subject" (gnus-score-set-default 'gnus-score-default-header 's)
|
108
|
1376 :style radio
|
98
|
1377 :selected (eq gnus-score-default-header 's)]
|
|
1378 ["Article body"
|
|
1379 (gnus-score-set-default 'gnus-score-default-header 'b)
|
108
|
1380 :style radio
|
98
|
1381 :selected (eq gnus-score-default-header 'b )]
|
|
1382 ["All headers"
|
|
1383 (gnus-score-set-default 'gnus-score-default-header 'h)
|
108
|
1384 :style radio
|
98
|
1385 :selected (eq gnus-score-default-header 'h )]
|
|
1386 ["Message-ID" (gnus-score-set-default 'gnus-score-default-header 'i)
|
108
|
1387 :style radio
|
98
|
1388 :selected (eq gnus-score-default-header 'i )]
|
|
1389 ["Thread" (gnus-score-set-default 'gnus-score-default-header 't)
|
108
|
1390 :style radio
|
98
|
1391 :selected (eq gnus-score-default-header 't )]
|
|
1392 ["Crossposting"
|
|
1393 (gnus-score-set-default 'gnus-score-default-header 'x)
|
108
|
1394 :style radio
|
98
|
1395 :selected (eq gnus-score-default-header 'x )]
|
|
1396 ["Lines" (gnus-score-set-default 'gnus-score-default-header 'l)
|
108
|
1397 :style radio
|
98
|
1398 :selected (eq gnus-score-default-header 'l )]
|
|
1399 ["Date" (gnus-score-set-default 'gnus-score-default-header 'd)
|
108
|
1400 :style radio
|
98
|
1401 :selected (eq gnus-score-default-header 'd )]
|
|
1402 ["Followups to author"
|
|
1403 (gnus-score-set-default 'gnus-score-default-header 'f)
|
108
|
1404 :style radio
|
98
|
1405 :selected (eq gnus-score-default-header 'f )])
|
|
1406 ("Default type"
|
|
1407 ["Ask" (gnus-score-set-default 'gnus-score-default-type nil)
|
108
|
1408 :style radio
|
98
|
1409 :selected (null gnus-score-default-type)]
|
|
1410 ;; The `:active' key is commented out in the following,
|
|
1411 ;; because the GNU Emacs hack to support radio buttons use
|
108
|
1412 ;; active to indicate which button is selected.
|
98
|
1413 ["Substring" (gnus-score-set-default 'gnus-score-default-type 's)
|
108
|
1414 :style radio
|
98
|
1415 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1416 :selected (eq gnus-score-default-type 's)]
|
|
1417 ["Regexp" (gnus-score-set-default 'gnus-score-default-type 'r)
|
|
1418 :style radio
|
|
1419 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1420 :selected (eq gnus-score-default-type 'r)]
|
|
1421 ["Exact" (gnus-score-set-default 'gnus-score-default-type 'e)
|
|
1422 :style radio
|
|
1423 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1424 :selected (eq gnus-score-default-type 'e)]
|
|
1425 ["Fuzzy" (gnus-score-set-default 'gnus-score-default-type 'f)
|
108
|
1426 :style radio
|
98
|
1427 ;; :active (not (memq gnus-score-default-header '(l d)))
|
|
1428 :selected (eq gnus-score-default-type 'f)]
|
|
1429 ["Before date" (gnus-score-set-default 'gnus-score-default-type 'b)
|
108
|
1430 :style radio
|
98
|
1431 ;; :active (eq (gnus-score-default-header 'd))
|
|
1432 :selected (eq gnus-score-default-type 'b)]
|
|
1433 ["At date" (gnus-score-set-default 'gnus-score-default-type 'n)
|
108
|
1434 :style radio
|
98
|
1435 ;; :active (eq (gnus-score-default-header 'd))
|
|
1436 :selected (eq gnus-score-default-type 'n)]
|
|
1437 ["After date" (gnus-score-set-default 'gnus-score-default-type 'a)
|
108
|
1438 :style radio
|
98
|
1439 ;; :active (eq (gnus-score-default-header 'd))
|
|
1440 :selected (eq gnus-score-default-type 'a)]
|
|
1441 ["Less than number"
|
|
1442 (gnus-score-set-default 'gnus-score-default-type '<)
|
108
|
1443 :style radio
|
98
|
1444 ;; :active (eq (gnus-score-default-header 'l))
|
|
1445 :selected (eq gnus-score-default-type '<)]
|
|
1446 ["Equal to number"
|
|
1447 (gnus-score-set-default 'gnus-score-default-type '=)
|
108
|
1448 :style radio
|
98
|
1449 ;; :active (eq (gnus-score-default-header 'l))
|
|
1450 :selected (eq gnus-score-default-type '=)]
|
108
|
1451 ["Greater than number"
|
98
|
1452 (gnus-score-set-default 'gnus-score-default-type '>)
|
108
|
1453 :style radio
|
98
|
1454 ;; :active (eq (gnus-score-default-header 'l))
|
|
1455 :selected (eq gnus-score-default-type '>)])
|
|
1456 ["Default fold" gnus-score-default-fold-toggle
|
|
1457 :style toggle
|
|
1458 :selected gnus-score-default-fold]
|
|
1459 ("Default duration"
|
|
1460 ["Ask" (gnus-score-set-default 'gnus-score-default-duration nil)
|
|
1461 :style radio
|
|
1462 :selected (null gnus-score-default-duration)]
|
|
1463 ["Permanent"
|
|
1464 (gnus-score-set-default 'gnus-score-default-duration 'p)
|
|
1465 :style radio
|
|
1466 :selected (eq gnus-score-default-duration 'p)]
|
|
1467 ["Temporary"
|
|
1468 (gnus-score-set-default 'gnus-score-default-duration 't)
|
|
1469 :style radio
|
|
1470 :selected (eq gnus-score-default-duration 't)]
|
108
|
1471 ["Immediate"
|
98
|
1472 (gnus-score-set-default 'gnus-score-default-duration 'i)
|
|
1473 :style radio
|
|
1474 :selected (eq gnus-score-default-duration 'i)]))
|
|
1475
|
|
1476 (easy-menu-define
|
|
1477 gnus-summary-article-menu gnus-summary-mode-map ""
|
|
1478 '("Article"
|
|
1479 ("Hide"
|
|
1480 ["All" gnus-article-hide t]
|
|
1481 ["Headers" gnus-article-hide-headers t]
|
|
1482 ["Signature" gnus-article-hide-signature t]
|
|
1483 ["Citation" gnus-article-hide-citation t]
|
|
1484 ["PGP" gnus-article-hide-pgp t]
|
|
1485 ["Boring headers" gnus-article-hide-boring-headers t])
|
|
1486 ("Highlight"
|
|
1487 ["All" gnus-article-highlight t]
|
|
1488 ["Headers" gnus-article-highlight-headers t]
|
|
1489 ["Signature" gnus-article-highlight-signature t]
|
|
1490 ["Citation" gnus-article-highlight-citation t])
|
|
1491 ("Date"
|
|
1492 ["Local" gnus-article-date-local t]
|
|
1493 ["UT" gnus-article-date-ut t]
|
|
1494 ["Original" gnus-article-date-original t]
|
|
1495 ["Lapsed" gnus-article-date-lapsed t]
|
|
1496 ["User-defined" gnus-article-date-user t])
|
|
1497 ("Washing"
|
|
1498 ("Remove Blanks"
|
|
1499 ["Leading" gnus-article-strip-leading-blank-lines t]
|
|
1500 ["Multiple" gnus-article-strip-multiple-blank-lines t]
|
|
1501 ["Trailing" gnus-article-remove-trailing-blank-lines t]
|
114
|
1502 ["All of the above" gnus-article-strip-blank-lines t]
|
|
1503 ["Leading space" gnus-article-strip-leading-space t])
|
98
|
1504 ["Overstrike" gnus-article-treat-overstrike t]
|
|
1505 ["Emphasis" gnus-article-emphasize t]
|
|
1506 ["Word wrap" gnus-article-fill-cited-article t]
|
|
1507 ["CR" gnus-article-remove-cr t]
|
|
1508 ["Show X-Face" gnus-article-display-x-face t]
|
|
1509 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
|
108
|
1510 ["UnHTMLize" gnus-article-treat-html t]
|
98
|
1511 ["Rot 13" gnus-summary-caesar-message t]
|
|
1512 ["Unix pipe" gnus-summary-pipe-message t]
|
|
1513 ["Add buttons" gnus-article-add-buttons t]
|
|
1514 ["Add buttons to head" gnus-article-add-buttons-to-head t]
|
|
1515 ["Stop page breaking" gnus-summary-stop-page-breaking t]
|
|
1516 ["Toggle MIME" gnus-summary-toggle-mime t]
|
|
1517 ["Verbose header" gnus-summary-verbose-headers t]
|
|
1518 ["Toggle header" gnus-summary-toggle-header t])
|
|
1519 ("Output"
|
|
1520 ["Save in default format" gnus-summary-save-article t]
|
|
1521 ["Save in file" gnus-summary-save-article-file t]
|
|
1522 ["Save in Unix mail format" gnus-summary-save-article-mail t]
|
|
1523 ["Write to file" gnus-summary-write-article-mail t]
|
|
1524 ["Save in MH folder" gnus-summary-save-article-folder t]
|
|
1525 ["Save in VM folder" gnus-summary-save-article-vm t]
|
|
1526 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
|
|
1527 ["Save body in file" gnus-summary-save-article-body-file t]
|
|
1528 ["Pipe through a filter" gnus-summary-pipe-output t]
|
|
1529 ["Add to SOUP packet" gnus-soup-add-article t]
|
|
1530 ["Print" gnus-summary-print-article t])
|
|
1531 ("Backend"
|
|
1532 ["Respool article..." gnus-summary-respool-article t]
|
|
1533 ["Move article..." gnus-summary-move-article
|
|
1534 (gnus-check-backend-function
|
|
1535 'request-move-article gnus-newsgroup-name)]
|
|
1536 ["Copy article..." gnus-summary-copy-article t]
|
|
1537 ["Crosspost article..." gnus-summary-crosspost-article
|
|
1538 (gnus-check-backend-function
|
|
1539 'request-replace-article gnus-newsgroup-name)]
|
|
1540 ["Import file..." gnus-summary-import-article t]
|
|
1541 ["Check if posted" gnus-summary-article-posted-p t]
|
|
1542 ["Edit article" gnus-summary-edit-article
|
|
1543 (not (gnus-group-read-only-p))]
|
|
1544 ["Delete article" gnus-summary-delete-article
|
|
1545 (gnus-check-backend-function
|
|
1546 'request-expire-articles gnus-newsgroup-name)]
|
|
1547 ["Query respool" gnus-summary-respool-query t]
|
|
1548 ["Delete expirable articles" gnus-summary-expire-articles-now
|
|
1549 (gnus-check-backend-function
|
|
1550 'request-expire-articles gnus-newsgroup-name)])
|
|
1551 ("Extract"
|
|
1552 ["Uudecode" gnus-uu-decode-uu t]
|
|
1553 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
|
|
1554 ["Unshar" gnus-uu-decode-unshar t]
|
|
1555 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
|
|
1556 ["Save" gnus-uu-decode-save t]
|
|
1557 ["Binhex" gnus-uu-decode-binhex t]
|
|
1558 ["Postscript" gnus-uu-decode-postscript t])
|
|
1559 ("Cache"
|
|
1560 ["Enter article" gnus-cache-enter-article t]
|
|
1561 ["Remove article" gnus-cache-remove-article t])
|
|
1562 ["Enter digest buffer" gnus-summary-enter-digest-group t]
|
|
1563 ["Isearch article..." gnus-summary-isearch-article t]
|
|
1564 ["Beginning of the article" gnus-summary-beginning-of-article t]
|
|
1565 ["End of the article" gnus-summary-end-of-article t]
|
|
1566 ["Fetch parent of article" gnus-summary-refer-parent-article t]
|
|
1567 ["Fetch referenced articles" gnus-summary-refer-references t]
|
|
1568 ["Fetch article with id..." gnus-summary-refer-article t]
|
|
1569 ["Redisplay" gnus-summary-show-article t]))
|
|
1570
|
|
1571 (easy-menu-define
|
|
1572 gnus-summary-thread-menu gnus-summary-mode-map ""
|
|
1573 '("Threads"
|
|
1574 ["Toggle threading" gnus-summary-toggle-threads t]
|
|
1575 ["Hide threads" gnus-summary-hide-all-threads t]
|
|
1576 ["Show threads" gnus-summary-show-all-threads t]
|
|
1577 ["Hide thread" gnus-summary-hide-thread t]
|
|
1578 ["Show thread" gnus-summary-show-thread t]
|
|
1579 ["Go to next thread" gnus-summary-next-thread t]
|
|
1580 ["Go to previous thread" gnus-summary-prev-thread t]
|
|
1581 ["Go down thread" gnus-summary-down-thread t]
|
|
1582 ["Go up thread" gnus-summary-up-thread t]
|
|
1583 ["Top of thread" gnus-summary-top-thread t]
|
|
1584 ["Mark thread as read" gnus-summary-kill-thread t]
|
|
1585 ["Lower thread score" gnus-summary-lower-thread t]
|
|
1586 ["Raise thread score" gnus-summary-raise-thread t]
|
|
1587 ["Rethread current" gnus-summary-rethread-current t]
|
|
1588 ))
|
|
1589
|
|
1590 (easy-menu-define
|
|
1591 gnus-summary-post-menu gnus-summary-mode-map ""
|
|
1592 '("Post"
|
|
1593 ["Post an article" gnus-summary-post-news t]
|
|
1594 ["Followup" gnus-summary-followup t]
|
|
1595 ["Followup and yank" gnus-summary-followup-with-original t]
|
|
1596 ["Supersede article" gnus-summary-supersede-article t]
|
|
1597 ["Cancel article" gnus-summary-cancel-article t]
|
|
1598 ["Reply" gnus-summary-reply t]
|
|
1599 ["Reply and yank" gnus-summary-reply-with-original t]
|
|
1600 ["Wide reply" gnus-summary-wide-reply t]
|
|
1601 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
|
|
1602 ["Mail forward" gnus-summary-mail-forward t]
|
|
1603 ["Post forward" gnus-summary-post-forward t]
|
|
1604 ["Digest and mail" gnus-uu-digest-mail-forward t]
|
|
1605 ["Digest and post" gnus-uu-digest-post-forward t]
|
|
1606 ["Resend message" gnus-summary-resend-message t]
|
|
1607 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
|
|
1608 ["Send a mail" gnus-summary-mail-other-window t]
|
|
1609 ["Uuencode and post" gnus-uu-post-news t]
|
|
1610 ["Followup via news" gnus-summary-followup-to-mail t]
|
|
1611 ["Followup via news and yank"
|
|
1612 gnus-summary-followup-to-mail-with-original t]
|
|
1613 ;;("Draft"
|
|
1614 ;;["Send" gnus-summary-send-draft t]
|
|
1615 ;;["Send bounced" gnus-resend-bounced-mail t])
|
|
1616 ))
|
|
1617
|
|
1618 (easy-menu-define
|
|
1619 gnus-summary-misc-menu gnus-summary-mode-map ""
|
|
1620 '("Misc"
|
|
1621 ("Mark Read"
|
|
1622 ["Mark as read" gnus-summary-mark-as-read-forward t]
|
|
1623 ["Mark same subject and select"
|
|
1624 gnus-summary-kill-same-subject-and-select t]
|
|
1625 ["Mark same subject" gnus-summary-kill-same-subject t]
|
|
1626 ["Catchup" gnus-summary-catchup t]
|
|
1627 ["Catchup all" gnus-summary-catchup-all t]
|
|
1628 ["Catchup to here" gnus-summary-catchup-to-here t]
|
|
1629 ["Catchup region" gnus-summary-mark-region-as-read t]
|
|
1630 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
|
|
1631 ("Mark Various"
|
|
1632 ["Tick" gnus-summary-tick-article-forward t]
|
|
1633 ["Mark as dormant" gnus-summary-mark-as-dormant t]
|
|
1634 ["Remove marks" gnus-summary-clear-mark-forward t]
|
|
1635 ["Set expirable mark" gnus-summary-mark-as-expirable t]
|
|
1636 ["Set bookmark" gnus-summary-set-bookmark t]
|
|
1637 ["Remove bookmark" gnus-summary-remove-bookmark t])
|
|
1638 ("Mark Limit"
|
|
1639 ["Marks..." gnus-summary-limit-to-marks t]
|
|
1640 ["Subject..." gnus-summary-limit-to-subject t]
|
|
1641 ["Author..." gnus-summary-limit-to-author t]
|
|
1642 ["Age..." gnus-summary-limit-to-age t]
|
|
1643 ["Score" gnus-summary-limit-to-score t]
|
|
1644 ["Unread" gnus-summary-limit-to-unread t]
|
|
1645 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
|
|
1646 ["Articles" gnus-summary-limit-to-articles t]
|
|
1647 ["Pop limit" gnus-summary-pop-limit t]
|
|
1648 ["Show dormant" gnus-summary-limit-include-dormant t]
|
108
|
1649 ["Hide childless dormant"
|
98
|
1650 gnus-summary-limit-exclude-childless-dormant t]
|
|
1651 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
|
|
1652 ["Show expunged" gnus-summary-show-all-expunged t])
|
|
1653 ("Process Mark"
|
|
1654 ["Set mark" gnus-summary-mark-as-processable t]
|
|
1655 ["Remove mark" gnus-summary-unmark-as-processable t]
|
|
1656 ["Remove all marks" gnus-summary-unmark-all-processable t]
|
|
1657 ["Mark above" gnus-uu-mark-over t]
|
|
1658 ["Mark series" gnus-uu-mark-series t]
|
|
1659 ["Mark region" gnus-uu-mark-region t]
|
|
1660 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
|
|
1661 ["Mark all" gnus-uu-mark-all t]
|
|
1662 ["Mark buffer" gnus-uu-mark-buffer t]
|
|
1663 ["Mark sparse" gnus-uu-mark-sparse t]
|
|
1664 ["Mark thread" gnus-uu-mark-thread t]
|
|
1665 ["Unmark thread" gnus-uu-unmark-thread t]
|
|
1666 ("Process Mark Sets"
|
|
1667 ["Kill" gnus-summary-kill-process-mark t]
|
|
1668 ["Yank" gnus-summary-yank-process-mark
|
|
1669 gnus-newsgroup-process-stack]
|
|
1670 ["Save" gnus-summary-save-process-mark t]))
|
|
1671 ("Scroll article"
|
|
1672 ["Page forward" gnus-summary-next-page t]
|
|
1673 ["Page backward" gnus-summary-prev-page t]
|
|
1674 ["Line forward" gnus-summary-scroll-up t])
|
|
1675 ("Move"
|
|
1676 ["Next unread article" gnus-summary-next-unread-article t]
|
|
1677 ["Previous unread article" gnus-summary-prev-unread-article t]
|
|
1678 ["Next article" gnus-summary-next-article t]
|
|
1679 ["Previous article" gnus-summary-prev-article t]
|
|
1680 ["Next unread subject" gnus-summary-next-unread-subject t]
|
|
1681 ["Previous unread subject" gnus-summary-prev-unread-subject t]
|
|
1682 ["Next article same subject" gnus-summary-next-same-subject t]
|
|
1683 ["Previous article same subject" gnus-summary-prev-same-subject t]
|
|
1684 ["First unread article" gnus-summary-first-unread-article t]
|
|
1685 ["Best unread article" gnus-summary-best-unread-article t]
|
|
1686 ["Go to subject number..." gnus-summary-goto-subject t]
|
|
1687 ["Go to article number..." gnus-summary-goto-article t]
|
|
1688 ["Go to the last article" gnus-summary-goto-last-article t]
|
|
1689 ["Pop article off history" gnus-summary-pop-article t])
|
|
1690 ("Sort"
|
|
1691 ["Sort by number" gnus-summary-sort-by-number t]
|
|
1692 ["Sort by author" gnus-summary-sort-by-author t]
|
|
1693 ["Sort by subject" gnus-summary-sort-by-subject t]
|
|
1694 ["Sort by date" gnus-summary-sort-by-date t]
|
|
1695 ["Sort by score" gnus-summary-sort-by-score t]
|
|
1696 ["Sort by lines" gnus-summary-sort-by-lines t])
|
|
1697 ("Help"
|
|
1698 ["Fetch group FAQ" gnus-summary-fetch-faq t]
|
|
1699 ["Describe group" gnus-summary-describe-group t]
|
|
1700 ["Read manual" gnus-info-find-node t])
|
|
1701 ("Modes"
|
|
1702 ["Pick and read" gnus-pick-mode t]
|
|
1703 ["Binary" gnus-binary-mode t])
|
|
1704 ("Regeneration"
|
|
1705 ["Regenerate" gnus-summary-prepare t]
|
|
1706 ["Insert cached articles" gnus-summary-insert-cached-articles t]
|
|
1707 ["Toggle threading" gnus-summary-toggle-threads t])
|
|
1708 ["Filter articles..." gnus-summary-execute-command t]
|
|
1709 ["Run command on subjects..." gnus-summary-universal-argument t]
|
|
1710 ["Search articles forward..." gnus-summary-search-article-forward t]
|
|
1711 ["Search articles backward..." gnus-summary-search-article-backward t]
|
|
1712 ["Toggle line truncation" gnus-summary-toggle-truncation t]
|
|
1713 ["Expand window" gnus-summary-expand-window t]
|
|
1714 ["Expire expirable articles" gnus-summary-expire-articles
|
|
1715 (gnus-check-backend-function
|
|
1716 'request-expire-articles gnus-newsgroup-name)]
|
|
1717 ["Edit local kill file" gnus-summary-edit-local-kill t]
|
|
1718 ["Edit main kill file" gnus-summary-edit-global-kill t]
|
|
1719 ("Exit"
|
|
1720 ["Catchup and exit" gnus-summary-catchup-and-exit t]
|
|
1721 ["Catchup all and exit" gnus-summary-catchup-and-exit t]
|
|
1722 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
|
|
1723 ["Exit group" gnus-summary-exit t]
|
|
1724 ["Exit group without updating" gnus-summary-exit-no-update t]
|
|
1725 ["Exit and goto next group" gnus-summary-next-group t]
|
|
1726 ["Exit and goto prev group" gnus-summary-prev-group t]
|
|
1727 ["Reselect group" gnus-summary-reselect-current-group t]
|
|
1728 ["Rescan group" gnus-summary-rescan-group t]
|
|
1729 ["Update dribble" gnus-summary-save-newsrc t])))
|
|
1730
|
|
1731 (run-hooks 'gnus-summary-menu-hook)))
|
|
1732
|
|
1733 (defun gnus-score-set-default (var value)
|
|
1734 "A version of set that updates the GNU Emacs menu-bar."
|
|
1735 (set var value)
|
|
1736 ;; It is the message that forces the active status to be updated.
|
|
1737 (message ""))
|
|
1738
|
|
1739 (defun gnus-make-score-map (type)
|
|
1740 "Make a summary score map of type TYPE."
|
|
1741 (if t
|
|
1742 nil
|
|
1743 (let ((headers '(("author" "from" string)
|
|
1744 ("subject" "subject" string)
|
|
1745 ("article body" "body" string)
|
|
1746 ("article head" "head" string)
|
|
1747 ("xref" "xref" string)
|
|
1748 ("lines" "lines" number)
|
|
1749 ("followups to author" "followup" string)))
|
|
1750 (types '((number ("less than" <)
|
|
1751 ("greater than" >)
|
|
1752 ("equal" =))
|
|
1753 (string ("substring" s)
|
|
1754 ("exact string" e)
|
|
1755 ("fuzzy string" f)
|
|
1756 ("regexp" r))))
|
|
1757 (perms '(("temporary" (current-time-string))
|
|
1758 ("permanent" nil)
|
|
1759 ("immediate" now)))
|
|
1760 header)
|
108
|
1761 (list
|
|
1762 (apply
|
98
|
1763 'nconc
|
|
1764 (list
|
|
1765 (if (eq type 'lower)
|
|
1766 "Lower score"
|
|
1767 "Increase score"))
|
|
1768 (let (outh)
|
|
1769 (while headers
|
|
1770 (setq header (car headers))
|
108
|
1771 (setq outh
|
|
1772 (cons
|
|
1773 (apply
|
98
|
1774 'nconc
|
|
1775 (list (car header))
|
|
1776 (let ((ts (cdr (assoc (nth 2 header) types)))
|
|
1777 outt)
|
|
1778 (while ts
|
|
1779 (setq outt
|
108
|
1780 (cons
|
|
1781 (apply
|
98
|
1782 'nconc
|
|
1783 (list (caar ts))
|
|
1784 (let ((ps perms)
|
|
1785 outp)
|
|
1786 (while ps
|
|
1787 (setq outp
|
|
1788 (cons
|
|
1789 (vector
|
|
1790 (caar ps)
|
|
1791 (list
|
|
1792 'gnus-summary-score-entry
|
|
1793 (nth 1 header)
|
|
1794 (if (or (string= (nth 1 header)
|
|
1795 "head")
|
|
1796 (string= (nth 1 header)
|
|
1797 "body"))
|
|
1798 ""
|
108
|
1799 (list 'gnus-summary-header
|
98
|
1800 (nth 1 header)))
|
|
1801 (list 'quote (nth 1 (car ts)))
|
|
1802 (list 'gnus-score-default nil)
|
|
1803 (nth 1 (car ps))
|
|
1804 t)
|
|
1805 t)
|
|
1806 outp))
|
|
1807 (setq ps (cdr ps)))
|
|
1808 (list (nreverse outp))))
|
|
1809 outt))
|
|
1810 (setq ts (cdr ts)))
|
|
1811 (list (nreverse outt))))
|
|
1812 outh))
|
|
1813 (setq headers (cdr headers)))
|
|
1814 (list (nreverse outh))))))))
|
|
1815
|
|
1816
|
|
1817
|
|
1818 (defun gnus-summary-mode (&optional group)
|
|
1819 "Major mode for reading articles.
|
|
1820
|
|
1821 All normal editing commands are switched off.
|
|
1822 \\<gnus-summary-mode-map>
|
|
1823 Each line in this buffer represents one article. To read an
|
|
1824 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
|
|
1825 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
|
|
1826 respectively.
|
|
1827
|
|
1828 You can also post articles and send mail from this buffer. To
|
|
1829 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
|
|
1830 of an article, type `\\[gnus-summary-reply]'.
|
|
1831
|
|
1832 There are approx. one gazillion commands you can execute in this
|
|
1833 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
|
|
1834
|
|
1835 The following commands are available:
|
|
1836
|
|
1837 \\{gnus-summary-mode-map}"
|
|
1838 (interactive)
|
|
1839 (when (gnus-visual-p 'summary-menu 'menu)
|
|
1840 (gnus-summary-make-menu-bar))
|
|
1841 (kill-all-local-variables)
|
|
1842 (gnus-summary-make-local-variables)
|
|
1843 (gnus-make-thread-indent-array)
|
|
1844 (gnus-simplify-mode-line)
|
|
1845 (setq major-mode 'gnus-summary-mode)
|
|
1846 (setq mode-name "Summary")
|
|
1847 (make-local-variable 'minor-mode-alist)
|
|
1848 (use-local-map gnus-summary-mode-map)
|
|
1849 (buffer-disable-undo (current-buffer))
|
|
1850 (setq buffer-read-only t) ;Disable modification
|
|
1851 (setq truncate-lines t)
|
|
1852 (setq selective-display t)
|
|
1853 (setq selective-display-ellipses t) ;Display `...'
|
116
|
1854 (gnus-summary-set-display-table)
|
98
|
1855 (gnus-set-default-directory)
|
|
1856 (setq gnus-newsgroup-name group)
|
|
1857 (make-local-variable 'gnus-summary-line-format)
|
|
1858 (make-local-variable 'gnus-summary-line-format-spec)
|
|
1859 (make-local-variable 'gnus-summary-mark-positions)
|
|
1860 (make-local-hook 'post-command-hook)
|
122
|
1861 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
|
98
|
1862 (run-hooks 'gnus-summary-mode-hook)
|
|
1863 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
|
|
1864 (gnus-update-summary-mark-positions))
|
|
1865
|
|
1866 (defun gnus-summary-make-local-variables ()
|
|
1867 "Make all the local summary buffer variables."
|
|
1868 (let ((locals gnus-summary-local-variables)
|
|
1869 global local)
|
|
1870 (while (setq local (pop locals))
|
|
1871 (if (consp local)
|
|
1872 (progn
|
|
1873 (if (eq (cdr local) 'global)
|
|
1874 ;; Copy the global value of the variable.
|
|
1875 (setq global (symbol-value (car local)))
|
|
1876 ;; Use the value from the list.
|
|
1877 (setq global (eval (cdr local))))
|
|
1878 (make-local-variable (car local))
|
|
1879 (set (car local) global))
|
|
1880 ;; Simple nil-valued local variable.
|
|
1881 (make-local-variable local)
|
|
1882 (set local nil)))))
|
|
1883
|
|
1884 (defun gnus-summary-clear-local-variables ()
|
|
1885 (let ((locals gnus-summary-local-variables))
|
|
1886 (while locals
|
|
1887 (if (consp (car locals))
|
|
1888 (and (vectorp (caar locals))
|
|
1889 (set (caar locals) nil))
|
|
1890 (and (vectorp (car locals))
|
|
1891 (set (car locals) nil)))
|
|
1892 (setq locals (cdr locals)))))
|
|
1893
|
|
1894 ;; Summary data functions.
|
|
1895
|
|
1896 (defmacro gnus-data-number (data)
|
|
1897 `(car ,data))
|
|
1898
|
|
1899 (defmacro gnus-data-set-number (data number)
|
|
1900 `(setcar ,data ,number))
|
|
1901
|
|
1902 (defmacro gnus-data-mark (data)
|
|
1903 `(nth 1 ,data))
|
|
1904
|
|
1905 (defmacro gnus-data-set-mark (data mark)
|
|
1906 `(setcar (nthcdr 1 ,data) ,mark))
|
|
1907
|
|
1908 (defmacro gnus-data-pos (data)
|
|
1909 `(nth 2 ,data))
|
|
1910
|
|
1911 (defmacro gnus-data-set-pos (data pos)
|
|
1912 `(setcar (nthcdr 2 ,data) ,pos))
|
|
1913
|
|
1914 (defmacro gnus-data-header (data)
|
|
1915 `(nth 3 ,data))
|
|
1916
|
|
1917 (defmacro gnus-data-set-header (data header)
|
|
1918 `(setf (nth 3 ,data) ,header))
|
|
1919
|
|
1920 (defmacro gnus-data-level (data)
|
|
1921 `(nth 4 ,data))
|
|
1922
|
|
1923 (defmacro gnus-data-unread-p (data)
|
|
1924 `(= (nth 1 ,data) gnus-unread-mark))
|
|
1925
|
|
1926 (defmacro gnus-data-read-p (data)
|
|
1927 `(/= (nth 1 ,data) gnus-unread-mark))
|
|
1928
|
|
1929 (defmacro gnus-data-pseudo-p (data)
|
|
1930 `(consp (nth 3 ,data)))
|
|
1931
|
|
1932 (defmacro gnus-data-find (number)
|
|
1933 `(assq ,number gnus-newsgroup-data))
|
|
1934
|
|
1935 (defmacro gnus-data-find-list (number &optional data)
|
|
1936 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
|
|
1937 (memq (assq ,number bdata)
|
|
1938 bdata)))
|
|
1939
|
|
1940 (defmacro gnus-data-make (number mark pos header level)
|
|
1941 `(list ,number ,mark ,pos ,header ,level))
|
|
1942
|
|
1943 (defun gnus-data-enter (after-article number mark pos header level offset)
|
|
1944 (let ((data (gnus-data-find-list after-article)))
|
|
1945 (unless data
|
|
1946 (error "No such article: %d" after-article))
|
|
1947 (setcdr data (cons (gnus-data-make number mark pos header level)
|
|
1948 (cdr data)))
|
|
1949 (setq gnus-newsgroup-data-reverse nil)
|
|
1950 (gnus-data-update-list (cddr data) offset)))
|
|
1951
|
|
1952 (defun gnus-data-enter-list (after-article list &optional offset)
|
|
1953 (when list
|
|
1954 (let ((data (and after-article (gnus-data-find-list after-article)))
|
|
1955 (ilist list))
|
|
1956 (or data (not after-article) (error "No such article: %d" after-article))
|
|
1957 ;; Find the last element in the list to be spliced into the main
|
|
1958 ;; list.
|
|
1959 (while (cdr list)
|
|
1960 (setq list (cdr list)))
|
|
1961 (if (not data)
|
|
1962 (progn
|
|
1963 (setcdr list gnus-newsgroup-data)
|
|
1964 (setq gnus-newsgroup-data ilist)
|
|
1965 (when offset
|
|
1966 (gnus-data-update-list (cdr list) offset)))
|
|
1967 (setcdr list (cdr data))
|
|
1968 (setcdr data ilist)
|
|
1969 (when offset
|
|
1970 (gnus-data-update-list (cdr list) offset)))
|
|
1971 (setq gnus-newsgroup-data-reverse nil))))
|
|
1972
|
|
1973 (defun gnus-data-remove (article &optional offset)
|
|
1974 (let ((data gnus-newsgroup-data))
|
|
1975 (if (= (gnus-data-number (car data)) article)
|
|
1976 (progn
|
|
1977 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
|
|
1978 gnus-newsgroup-data-reverse nil)
|
|
1979 (when offset
|
|
1980 (gnus-data-update-list gnus-newsgroup-data offset)))
|
|
1981 (while (cdr data)
|
|
1982 (when (= (gnus-data-number (cadr data)) article)
|
|
1983 (setcdr data (cddr data))
|
|
1984 (when offset
|
|
1985 (gnus-data-update-list (cdr data) offset))
|
|
1986 (setq data nil
|
|
1987 gnus-newsgroup-data-reverse nil))
|
|
1988 (setq data (cdr data))))))
|
|
1989
|
|
1990 (defmacro gnus-data-list (backward)
|
|
1991 `(if ,backward
|
|
1992 (or gnus-newsgroup-data-reverse
|
|
1993 (setq gnus-newsgroup-data-reverse
|
|
1994 (reverse gnus-newsgroup-data)))
|
|
1995 gnus-newsgroup-data))
|
|
1996
|
|
1997 (defun gnus-data-update-list (data offset)
|
|
1998 "Add OFFSET to the POS of all data entries in DATA."
|
|
1999 (while data
|
|
2000 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
|
|
2001 (setq data (cdr data))))
|
|
2002
|
|
2003 (defun gnus-data-compute-positions ()
|
|
2004 "Compute the positions of all articles."
|
|
2005 (let ((data gnus-newsgroup-data)
|
|
2006 pos)
|
|
2007 (while data
|
|
2008 (when (setq pos (text-property-any
|
|
2009 (point-min) (point-max)
|
|
2010 'gnus-number (gnus-data-number (car data))))
|
|
2011 (gnus-data-set-pos (car data) (+ pos 3)))
|
|
2012 (setq data (cdr data)))))
|
|
2013
|
|
2014 (defun gnus-summary-article-pseudo-p (article)
|
|
2015 "Say whether this article is a pseudo article or not."
|
|
2016 (not (vectorp (gnus-data-header (gnus-data-find article)))))
|
|
2017
|
|
2018 (defmacro gnus-summary-article-sparse-p (article)
|
|
2019 "Say whether this article is a sparse article or not."
|
144
|
2020 `(memq ,article gnus-newsgroup-sparse))
|
98
|
2021
|
|
2022 (defmacro gnus-summary-article-ancient-p (article)
|
|
2023 "Say whether this article is a sparse article or not."
|
|
2024 `(memq ,article gnus-newsgroup-ancient))
|
|
2025
|
|
2026 (defun gnus-article-parent-p (number)
|
|
2027 "Say whether this article is a parent or not."
|
|
2028 (let ((data (gnus-data-find-list number)))
|
|
2029 (and (cdr data) ; There has to be an article after...
|
|
2030 (< (gnus-data-level (car data)) ; And it has to have a higher level.
|
|
2031 (gnus-data-level (nth 1 data))))))
|
|
2032
|
|
2033 (defun gnus-article-children (number)
|
|
2034 "Return a list of all children to NUMBER."
|
|
2035 (let* ((data (gnus-data-find-list number))
|
|
2036 (level (gnus-data-level (car data)))
|
|
2037 children)
|
|
2038 (setq data (cdr data))
|
108
|
2039 (while (and data
|
98
|
2040 (= (gnus-data-level (car data)) (1+ level)))
|
|
2041 (push (gnus-data-number (car data)) children)
|
|
2042 (setq data (cdr data)))
|
|
2043 children))
|
|
2044
|
|
2045 (defmacro gnus-summary-skip-intangible ()
|
|
2046 "If the current article is intangible, then jump to a different article."
|
|
2047 '(let ((to (get-text-property (point) 'gnus-intangible)))
|
|
2048 (and to (gnus-summary-goto-subject to))))
|
|
2049
|
|
2050 (defmacro gnus-summary-article-intangible-p ()
|
|
2051 "Say whether this article is intangible or not."
|
|
2052 '(get-text-property (point) 'gnus-intangible))
|
|
2053
|
|
2054 (defun gnus-article-read-p (article)
|
|
2055 "Say whether ARTICLE is read or not."
|
|
2056 (not (or (memq article gnus-newsgroup-marked)
|
|
2057 (memq article gnus-newsgroup-unreads)
|
|
2058 (memq article gnus-newsgroup-unselected)
|
|
2059 (memq article gnus-newsgroup-dormant))))
|
|
2060
|
|
2061 ;; Some summary mode macros.
|
|
2062
|
106
|
2063 (defmacro gnus-summary-article-number ()
|
98
|
2064 "The article number of the article on the current line.
|
|
2065 If there isn's an article number here, then we return the current
|
|
2066 article number."
|
|
2067 '(progn
|
|
2068 (gnus-summary-skip-intangible)
|
|
2069 (or (get-text-property (point) 'gnus-number)
|
|
2070 (gnus-summary-last-subject))))
|
|
2071
|
|
2072 (defmacro gnus-summary-article-header (&optional number)
|
|
2073 `(gnus-data-header (gnus-data-find
|
|
2074 ,(or number '(gnus-summary-article-number)))))
|
|
2075
|
|
2076 (defmacro gnus-summary-thread-level (&optional number)
|
|
2077 `(if (and (eq gnus-summary-make-false-root 'dummy)
|
|
2078 (get-text-property (point) 'gnus-intangible))
|
|
2079 0
|
|
2080 (gnus-data-level (gnus-data-find
|
|
2081 ,(or number '(gnus-summary-article-number))))))
|
|
2082
|
|
2083 (defmacro gnus-summary-article-mark (&optional number)
|
|
2084 `(gnus-data-mark (gnus-data-find
|
|
2085 ,(or number '(gnus-summary-article-number)))))
|
|
2086
|
|
2087 (defmacro gnus-summary-article-pos (&optional number)
|
|
2088 `(gnus-data-pos (gnus-data-find
|
|
2089 ,(or number '(gnus-summary-article-number)))))
|
|
2090
|
|
2091 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
|
|
2092 (defmacro gnus-summary-article-subject (&optional number)
|
|
2093 "Return current subject string or nil if nothing."
|
|
2094 `(let ((headers
|
|
2095 ,(if number
|
|
2096 `(gnus-data-header (assq ,number gnus-newsgroup-data))
|
|
2097 '(gnus-data-header (assq (gnus-summary-article-number)
|
|
2098 gnus-newsgroup-data)))))
|
|
2099 (and headers
|
|
2100 (vectorp headers)
|
|
2101 (mail-header-subject headers))))
|
|
2102
|
|
2103 (defmacro gnus-summary-article-score (&optional number)
|
|
2104 "Return current article score."
|
|
2105 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
|
|
2106 gnus-newsgroup-scored))
|
|
2107 gnus-summary-default-score 0))
|
|
2108
|
|
2109 (defun gnus-summary-article-children (&optional number)
|
|
2110 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
|
|
2111 (level (gnus-data-level (car data)))
|
|
2112 l children)
|
|
2113 (while (and (setq data (cdr data))
|
|
2114 (> (setq l (gnus-data-level (car data))) level))
|
|
2115 (and (= (1+ level) l)
|
|
2116 (push (gnus-data-number (car data))
|
|
2117 children)))
|
|
2118 (nreverse children)))
|
|
2119
|
|
2120 (defun gnus-summary-article-parent (&optional number)
|
|
2121 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
|
|
2122 (gnus-data-list t)))
|
|
2123 (level (gnus-data-level (car data))))
|
|
2124 (if (zerop level)
|
|
2125 () ; This is a root.
|
|
2126 ;; We search until we find an article with a level less than
|
|
2127 ;; this one. That function has to be the parent.
|
|
2128 (while (and (setq data (cdr data))
|
|
2129 (not (< (gnus-data-level (car data)) level))))
|
|
2130 (and data (gnus-data-number (car data))))))
|
|
2131
|
|
2132 (defun gnus-unread-mark-p (mark)
|
|
2133 "Say whether MARK is the unread mark."
|
|
2134 (= mark gnus-unread-mark))
|
|
2135
|
|
2136 (defun gnus-read-mark-p (mark)
|
|
2137 "Say whether MARK is one of the marks that mark as read.
|
|
2138 This is all marks except unread, ticked, dormant, and expirable."
|
|
2139 (not (or (= mark gnus-unread-mark)
|
|
2140 (= mark gnus-ticked-mark)
|
|
2141 (= mark gnus-dormant-mark)
|
|
2142 (= mark gnus-expirable-mark))))
|
|
2143
|
|
2144 (defmacro gnus-article-mark (number)
|
|
2145 `(cond
|
|
2146 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
|
|
2147 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
|
|
2148 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
|
|
2149 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
|
|
2150 (t (or (cdr (assq ,number gnus-newsgroup-reads))
|
|
2151 gnus-ancient-mark))))
|
|
2152
|
|
2153 ;; Saving hidden threads.
|
|
2154
|
|
2155 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
|
|
2156 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
|
|
2157
|
|
2158 (defmacro gnus-save-hidden-threads (&rest forms)
|
|
2159 "Save hidden threads, eval FORMS, and restore the hidden threads."
|
|
2160 (let ((config (make-symbol "config")))
|
|
2161 `(let ((,config (gnus-hidden-threads-configuration)))
|
|
2162 (unwind-protect
|
|
2163 (save-excursion
|
|
2164 ,@forms)
|
|
2165 (gnus-restore-hidden-threads-configuration ,config)))))
|
|
2166
|
|
2167 (defun gnus-hidden-threads-configuration ()
|
|
2168 "Return the current hidden threads configuration."
|
|
2169 (save-excursion
|
|
2170 (let (config)
|
|
2171 (goto-char (point-min))
|
|
2172 (while (search-forward "\r" nil t)
|
|
2173 (push (1- (point)) config))
|
|
2174 config)))
|
|
2175
|
|
2176 (defun gnus-restore-hidden-threads-configuration (config)
|
|
2177 "Restore hidden threads configuration from CONFIG."
|
|
2178 (let (point buffer-read-only)
|
|
2179 (while (setq point (pop config))
|
|
2180 (when (and (< point (point-max))
|
|
2181 (goto-char point)
|
|
2182 (= (following-char) ?\n))
|
|
2183 (subst-char-in-region point (1+ point) ?\n ?\r)))))
|
|
2184
|
|
2185 ;; Various summary mode internalish functions.
|
|
2186
|
|
2187 (defun gnus-mouse-pick-article (e)
|
|
2188 (interactive "e")
|
|
2189 (mouse-set-point e)
|
|
2190 (gnus-summary-next-page nil t))
|
|
2191
|
116
|
2192 (defun gnus-summary-set-display-table ()
|
|
2193 ;; Change the display table. Odd characters have a tendency to mess
|
|
2194 ;; up nicely formatted displays - we make all possible glyphs
|
|
2195 ;; display only a single character.
|
|
2196
|
|
2197 ;; We start from the standard display table, if any.
|
|
2198 (let ((table (or (copy-sequence standard-display-table)
|
|
2199 (make-display-table)))
|
|
2200 (i 32))
|
118
|
2201 ;; Nix out all the control chars...
|
116
|
2202 (while (>= (setq i (1- i)) 0)
|
|
2203 (aset table i [??]))
|
|
2204 ;; ... but not newline and cr, of course. (cr is necessary for the
|
|
2205 ;; selective display).
|
|
2206 (aset table ?\n nil)
|
|
2207 (aset table ?\r nil)
|
|
2208 ;; We nix out any glyphs over 126 that are not set already.
|
|
2209 (let ((i 256))
|
|
2210 (while (>= (setq i (1- i)) 127)
|
|
2211 ;; Only modify if the entry is nil.
|
118
|
2212 (unless (aref table i)
|
|
2213 (aset table i [??]))))
|
116
|
2214 (setq buffer-display-table table)))
|
|
2215
|
98
|
2216 (defun gnus-summary-setup-buffer (group)
|
|
2217 "Initialize summary buffer."
|
|
2218 (let ((buffer (concat "*Summary " group "*")))
|
|
2219 (if (get-buffer buffer)
|
|
2220 (progn
|
|
2221 (set-buffer buffer)
|
|
2222 (setq gnus-summary-buffer (current-buffer))
|
|
2223 (not gnus-newsgroup-prepared))
|
|
2224 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
|
|
2225 (setq gnus-summary-buffer (set-buffer (get-buffer-create buffer)))
|
|
2226 (gnus-add-current-to-buffer-list)
|
|
2227 (gnus-summary-mode group)
|
|
2228 (when gnus-carpal
|
|
2229 (gnus-carpal-setup-buffer 'summary))
|
|
2230 (unless gnus-single-article-buffer
|
|
2231 (make-local-variable 'gnus-article-buffer)
|
|
2232 (make-local-variable 'gnus-article-current)
|
|
2233 (make-local-variable 'gnus-original-article-buffer))
|
|
2234 (setq gnus-newsgroup-name group)
|
|
2235 t)))
|
|
2236
|
|
2237 (defun gnus-set-global-variables ()
|
|
2238 ;; Set the global equivalents of the summary buffer-local variables
|
|
2239 ;; to the latest values they had. These reflect the summary buffer
|
|
2240 ;; that was in action when the last article was fetched.
|
|
2241 (when (eq major-mode 'gnus-summary-mode)
|
|
2242 (setq gnus-summary-buffer (current-buffer))
|
|
2243 (let ((name gnus-newsgroup-name)
|
|
2244 (marked gnus-newsgroup-marked)
|
|
2245 (unread gnus-newsgroup-unreads)
|
|
2246 (headers gnus-current-headers)
|
|
2247 (data gnus-newsgroup-data)
|
|
2248 (summary gnus-summary-buffer)
|
|
2249 (article-buffer gnus-article-buffer)
|
|
2250 (original gnus-original-article-buffer)
|
|
2251 (gac gnus-article-current)
|
|
2252 (reffed gnus-reffed-article-number)
|
|
2253 (score-file gnus-current-score-file))
|
|
2254 (save-excursion
|
|
2255 (set-buffer gnus-group-buffer)
|
|
2256 (setq gnus-newsgroup-name name)
|
|
2257 (setq gnus-newsgroup-marked marked)
|
|
2258 (setq gnus-newsgroup-unreads unread)
|
|
2259 (setq gnus-current-headers headers)
|
|
2260 (setq gnus-newsgroup-data data)
|
|
2261 (setq gnus-article-current gac)
|
|
2262 (setq gnus-summary-buffer summary)
|
|
2263 (setq gnus-article-buffer article-buffer)
|
|
2264 (setq gnus-original-article-buffer original)
|
|
2265 (setq gnus-reffed-article-number reffed)
|
|
2266 (setq gnus-current-score-file score-file)
|
|
2267 ;; The article buffer also has local variables.
|
|
2268 (when (gnus-buffer-live-p gnus-article-buffer)
|
|
2269 (set-buffer gnus-article-buffer)
|
|
2270 (setq gnus-summary-buffer summary))))))
|
|
2271
|
|
2272 (defun gnus-summary-article-unread-p (article)
|
|
2273 "Say whether ARTICLE is unread or not."
|
|
2274 (memq article gnus-newsgroup-unreads))
|
|
2275
|
|
2276 (defun gnus-summary-first-article-p (&optional article)
|
|
2277 "Return whether ARTICLE is the first article in the buffer."
|
|
2278 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2279 nil
|
|
2280 (eq article (caar gnus-newsgroup-data))))
|
|
2281
|
|
2282 (defun gnus-summary-last-article-p (&optional article)
|
|
2283 "Return whether ARTICLE is the last article in the buffer."
|
|
2284 (if (not (setq article (or article (gnus-summary-article-number))))
|
|
2285 t ; All non-existent numbers are the last article. :-)
|
|
2286 (not (cdr (gnus-data-find-list article)))))
|
|
2287
|
|
2288 (defun gnus-make-thread-indent-array ()
|
|
2289 (let ((n 200))
|
|
2290 (unless (and gnus-thread-indent-array
|
|
2291 (= gnus-thread-indent-level gnus-thread-indent-array-level))
|
|
2292 (setq gnus-thread-indent-array (make-vector 201 "")
|
|
2293 gnus-thread-indent-array-level gnus-thread-indent-level)
|
|
2294 (while (>= n 0)
|
|
2295 (aset gnus-thread-indent-array n
|
|
2296 (make-string (* n gnus-thread-indent-level) ? ))
|
|
2297 (setq n (1- n))))))
|
|
2298
|
|
2299 (defun gnus-update-summary-mark-positions ()
|
|
2300 "Compute where the summary marks are to go."
|
|
2301 (save-excursion
|
|
2302 (when (and gnus-summary-buffer
|
|
2303 (get-buffer gnus-summary-buffer)
|
|
2304 (buffer-name (get-buffer gnus-summary-buffer)))
|
|
2305 (set-buffer gnus-summary-buffer))
|
|
2306 (let ((gnus-replied-mark 129)
|
|
2307 (gnus-score-below-mark 130)
|
|
2308 (gnus-score-over-mark 130)
|
|
2309 (spec gnus-summary-line-format-spec)
|
|
2310 thread gnus-visual pos)
|
|
2311 (save-excursion
|
|
2312 (gnus-set-work-buffer)
|
|
2313 (let ((gnus-summary-line-format-spec spec))
|
|
2314 (gnus-summary-insert-line
|
|
2315 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
|
|
2316 (goto-char (point-min))
|
|
2317 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
|
|
2318 (- (point) 2)))))
|
|
2319 (goto-char (point-min))
|
|
2320 (push (cons 'replied (and (search-forward "\201" nil t)
|
|
2321 (- (point) 2)))
|
|
2322 pos)
|
|
2323 (goto-char (point-min))
|
|
2324 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
|
|
2325 pos)))
|
|
2326 (setq gnus-summary-mark-positions pos))))
|
|
2327
|
|
2328 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
|
|
2329 "Insert a dummy root in the summary buffer."
|
|
2330 (beginning-of-line)
|
|
2331 (gnus-add-text-properties
|
|
2332 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
|
|
2333 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
|
|
2334
|
108
|
2335 (defun gnus-summary-insert-line (gnus-tmp-header
|
|
2336 gnus-tmp-level gnus-tmp-current
|
|
2337 gnus-tmp-unread gnus-tmp-replied
|
98
|
2338 gnus-tmp-expirable gnus-tmp-subject-or-nil
|
108
|
2339 &optional gnus-tmp-dummy gnus-tmp-score
|
98
|
2340 gnus-tmp-process)
|
|
2341 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
|
|
2342 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
|
|
2343 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
|
|
2344 (gnus-tmp-score-char
|
|
2345 (if (or (null gnus-summary-default-score)
|
|
2346 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
2347 gnus-summary-zcore-fuzz))
|
|
2348 ?
|
|
2349 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
2350 gnus-score-below-mark gnus-score-over-mark)))
|
|
2351 (gnus-tmp-replied
|
|
2352 (cond (gnus-tmp-process gnus-process-mark)
|
|
2353 ((memq gnus-tmp-current gnus-newsgroup-cached)
|
|
2354 gnus-cached-mark)
|
|
2355 (gnus-tmp-replied gnus-replied-mark)
|
|
2356 ((memq gnus-tmp-current gnus-newsgroup-saved)
|
|
2357 gnus-saved-mark)
|
|
2358 (t gnus-unread-mark)))
|
|
2359 (gnus-tmp-from (mail-header-from gnus-tmp-header))
|
|
2360 (gnus-tmp-name
|
|
2361 (cond
|
|
2362 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
2363 (let ((beg (match-beginning 0)))
|
|
2364 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
2365 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
2366 (1- (match-end 0))))
|
|
2367 (substring gnus-tmp-from 0 beg))))
|
|
2368 ((string-match "(.+)" gnus-tmp-from)
|
|
2369 (substring gnus-tmp-from
|
|
2370 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
2371 (t gnus-tmp-from)))
|
|
2372 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
|
|
2373 (gnus-tmp-number (mail-header-number gnus-tmp-header))
|
|
2374 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
|
|
2375 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
|
|
2376 (buffer-read-only nil))
|
|
2377 (when (string= gnus-tmp-name "")
|
|
2378 (setq gnus-tmp-name gnus-tmp-from))
|
|
2379 (unless (numberp gnus-tmp-lines)
|
|
2380 (setq gnus-tmp-lines 0))
|
|
2381 (gnus-put-text-property
|
|
2382 (point)
|
|
2383 (progn (eval gnus-summary-line-format-spec) (point))
|
|
2384 'gnus-number gnus-tmp-number)
|
|
2385 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2386 (forward-line -1)
|
|
2387 (run-hooks 'gnus-summary-update-hook)
|
|
2388 (forward-line 1))))
|
|
2389
|
|
2390 (defun gnus-summary-update-line (&optional dont-update)
|
|
2391 ;; Update summary line after change.
|
|
2392 (when (and gnus-summary-default-score
|
|
2393 (not gnus-summary-inhibit-highlight))
|
|
2394 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
|
|
2395 (article (gnus-summary-article-number))
|
|
2396 (score (gnus-summary-article-score article)))
|
|
2397 (unless dont-update
|
|
2398 (if (and gnus-summary-mark-below
|
|
2399 (< (gnus-summary-article-score)
|
|
2400 gnus-summary-mark-below))
|
|
2401 ;; This article has a low score, so we mark it as read.
|
|
2402 (when (memq article gnus-newsgroup-unreads)
|
|
2403 (gnus-summary-mark-article-as-read gnus-low-score-mark))
|
|
2404 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
|
|
2405 ;; This article was previously marked as read on account
|
|
2406 ;; of a low score, but now it has risen, so we mark it as
|
|
2407 ;; unread.
|
|
2408 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
|
|
2409 (gnus-summary-update-mark
|
|
2410 (if (or (null gnus-summary-default-score)
|
|
2411 (<= (abs (- score gnus-summary-default-score))
|
|
2412 gnus-summary-zcore-fuzz))
|
|
2413 ?
|
|
2414 (if (< score gnus-summary-default-score)
|
|
2415 gnus-score-below-mark gnus-score-over-mark))
|
|
2416 'score))
|
|
2417 ;; Do visual highlighting.
|
|
2418 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
2419 (run-hooks 'gnus-summary-update-hook)))))
|
|
2420
|
|
2421 (defvar gnus-tmp-new-adopts nil)
|
|
2422
|
|
2423 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
|
108
|
2424 "Return the number of articles in THREAD.
|
98
|
2425 This may be 0 in some cases -- if none of the articles in
|
|
2426 the thread are to be displayed."
|
|
2427 (let* ((number
|
|
2428 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
|
|
2429 (cond
|
|
2430 ((not (listp thread))
|
|
2431 1)
|
|
2432 ((and (consp thread) (cdr thread))
|
|
2433 (apply
|
|
2434 '+ 1 (mapcar
|
|
2435 'gnus-summary-number-of-articles-in-thread (cdr thread))))
|
|
2436 ((null thread)
|
|
2437 1)
|
|
2438 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
|
|
2439 1)
|
|
2440 (t 0))))
|
|
2441 (when (and level (zerop level) gnus-tmp-new-adopts)
|
|
2442 (incf number
|
|
2443 (apply '+ (mapcar
|
|
2444 'gnus-summary-number-of-articles-in-thread
|
|
2445 gnus-tmp-new-adopts))))
|
|
2446 (if char
|
|
2447 (if (> number 1) gnus-not-empty-thread-mark
|
|
2448 gnus-empty-thread-mark)
|
|
2449 number)))
|
|
2450
|
|
2451 (defun gnus-summary-set-local-parameters (group)
|
|
2452 "Go through the local params of GROUP and set all variable specs in that list."
|
|
2453 (let ((params (gnus-group-find-parameter group))
|
|
2454 elem)
|
|
2455 (while params
|
|
2456 (setq elem (car params)
|
|
2457 params (cdr params))
|
|
2458 (and (consp elem) ; Has to be a cons.
|
|
2459 (consp (cdr elem)) ; The cdr has to be a list.
|
|
2460 (symbolp (car elem)) ; Has to be a symbol in there.
|
|
2461 (not (memq (car elem)
|
|
2462 '(quit-config to-address to-list to-group)))
|
110
|
2463 (ignore-errors ; So we set it.
|
98
|
2464 (make-local-variable (car elem))
|
|
2465 (set (car elem) (eval (nth 1 elem))))))))
|
|
2466
|
|
2467 (defun gnus-summary-read-group (group &optional show-all no-article
|
|
2468 kill-buffer no-display)
|
|
2469 "Start reading news in newsgroup GROUP.
|
|
2470 If SHOW-ALL is non-nil, already read articles are also listed.
|
|
2471 If NO-ARTICLE is non-nil, no article is selected initially.
|
|
2472 If NO-DISPLAY, don't generate a summary buffer."
|
114
|
2473 (let (result)
|
|
2474 (while (and group
|
|
2475 (null (setq result
|
|
2476 (let ((gnus-auto-select-next nil))
|
|
2477 (gnus-summary-read-group-1
|
|
2478 group show-all no-article
|
|
2479 kill-buffer no-display))))
|
|
2480 (eq gnus-auto-select-next 'quietly))
|
|
2481 (set-buffer gnus-group-buffer)
|
|
2482 (if (not (equal group (gnus-group-group-name)))
|
|
2483 (setq group (gnus-group-group-name))
|
|
2484 (setq group nil)))
|
|
2485 result))
|
|
2486
|
|
2487 (defun gnus-summary-read-group-1 (group show-all no-article
|
|
2488 kill-buffer no-display)
|
98
|
2489 ;; Killed foreign groups can't be entered.
|
|
2490 (when (and (not (gnus-group-native-p group))
|
|
2491 (not (gnus-gethash group gnus-newsrc-hashtb)))
|
|
2492 (error "Dead non-native groups can't be entered"))
|
|
2493 (gnus-message 5 "Retrieving newsgroup: %s..." group)
|
|
2494 (let* ((new-group (gnus-summary-setup-buffer group))
|
|
2495 (quit-config (gnus-group-quit-config group))
|
|
2496 (did-select (and new-group (gnus-select-newsgroup group show-all))))
|
|
2497 (cond
|
|
2498 ;; This summary buffer exists already, so we just select it.
|
|
2499 ((not new-group)
|
|
2500 (gnus-set-global-variables)
|
|
2501 (when kill-buffer
|
|
2502 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2503 (gnus-configure-windows 'summary 'force)
|
|
2504 (gnus-set-mode-line 'summary)
|
|
2505 (gnus-summary-position-point)
|
|
2506 (message "")
|
|
2507 t)
|
|
2508 ;; We couldn't select this group.
|
|
2509 ((null did-select)
|
|
2510 (when (and (eq major-mode 'gnus-summary-mode)
|
|
2511 (not (equal (current-buffer) kill-buffer)))
|
|
2512 (kill-buffer (current-buffer))
|
|
2513 (if (not quit-config)
|
|
2514 (progn
|
|
2515 (set-buffer gnus-group-buffer)
|
|
2516 (gnus-group-jump-to-group group)
|
|
2517 (gnus-group-next-unread-group 1))
|
|
2518 (gnus-handle-ephemeral-exit quit-config)))
|
|
2519 (gnus-message 3 "Can't select group")
|
|
2520 nil)
|
|
2521 ;; The user did a `C-g' while prompting for number of articles,
|
|
2522 ;; so we exit this group.
|
|
2523 ((eq did-select 'quit)
|
|
2524 (and (eq major-mode 'gnus-summary-mode)
|
|
2525 (not (equal (current-buffer) kill-buffer))
|
|
2526 (kill-buffer (current-buffer)))
|
|
2527 (when kill-buffer
|
|
2528 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2529 (if (not quit-config)
|
|
2530 (progn
|
|
2531 (set-buffer gnus-group-buffer)
|
|
2532 (gnus-group-jump-to-group group)
|
|
2533 (gnus-group-next-unread-group 1)
|
|
2534 (gnus-configure-windows 'group 'force))
|
|
2535 (gnus-handle-ephemeral-exit quit-config))
|
|
2536 ;; Finally signal the quit.
|
|
2537 (signal 'quit nil))
|
|
2538 ;; The group was successfully selected.
|
|
2539 (t
|
|
2540 (gnus-set-global-variables)
|
|
2541 ;; Save the active value in effect when the group was entered.
|
|
2542 (setq gnus-newsgroup-active
|
|
2543 (gnus-copy-sequence
|
|
2544 (gnus-active gnus-newsgroup-name)))
|
|
2545 ;; You can change the summary buffer in some way with this hook.
|
|
2546 (run-hooks 'gnus-select-group-hook)
|
|
2547 ;; Set any local variables in the group parameters.
|
|
2548 (gnus-summary-set-local-parameters gnus-newsgroup-name)
|
|
2549 (gnus-update-format-specifications
|
|
2550 nil 'summary 'summary-mode 'summary-dummy)
|
|
2551 ;; Do score processing.
|
|
2552 (when gnus-use-scoring
|
|
2553 (gnus-possibly-score-headers))
|
|
2554 ;; Check whether to fill in the gaps in the threads.
|
|
2555 (when gnus-build-sparse-threads
|
|
2556 (gnus-build-sparse-threads))
|
|
2557 ;; Find the initial limit.
|
|
2558 (if gnus-show-threads
|
|
2559 (if show-all
|
|
2560 (let ((gnus-newsgroup-dormant nil))
|
|
2561 (gnus-summary-initial-limit show-all))
|
|
2562 (gnus-summary-initial-limit show-all))
|
108
|
2563 (setq gnus-newsgroup-limit
|
|
2564 (mapcar
|
98
|
2565 (lambda (header) (mail-header-number header))
|
|
2566 gnus-newsgroup-headers)))
|
|
2567 ;; Generate the summary buffer.
|
|
2568 (unless no-display
|
|
2569 (gnus-summary-prepare))
|
|
2570 (when gnus-use-trees
|
|
2571 (gnus-tree-open group)
|
|
2572 (setq gnus-summary-highlight-line-function
|
|
2573 'gnus-tree-highlight-article))
|
|
2574 ;; If the summary buffer is empty, but there are some low-scored
|
|
2575 ;; articles or some excluded dormants, we include these in the
|
|
2576 ;; buffer.
|
|
2577 (when (and (zerop (buffer-size))
|
|
2578 (not no-display))
|
|
2579 (cond (gnus-newsgroup-dormant
|
|
2580 (gnus-summary-limit-include-dormant))
|
|
2581 ((and gnus-newsgroup-scored show-all)
|
|
2582 (gnus-summary-limit-include-expunged t))))
|
|
2583 ;; Function `gnus-apply-kill-file' must be called in this hook.
|
|
2584 (run-hooks 'gnus-apply-kill-hook)
|
|
2585 (if (and (zerop (buffer-size))
|
|
2586 (not no-display))
|
|
2587 (progn
|
|
2588 ;; This newsgroup is empty.
|
114
|
2589 (gnus-summary-catchup-and-exit nil t)
|
98
|
2590 (gnus-message 6 "No unread news")
|
|
2591 (when kill-buffer
|
|
2592 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2593 ;; Return nil from this function.
|
|
2594 nil)
|
|
2595 ;; Hide conversation thread subtrees. We cannot do this in
|
|
2596 ;; gnus-summary-prepare-hook since kill processing may not
|
|
2597 ;; work with hidden articles.
|
|
2598 (and gnus-show-threads
|
|
2599 gnus-thread-hide-subtree
|
|
2600 (gnus-summary-hide-all-threads))
|
|
2601 ;; Show first unread article if requested.
|
|
2602 (if (and (not no-article)
|
|
2603 (not no-display)
|
|
2604 gnus-newsgroup-unreads
|
|
2605 gnus-auto-select-first)
|
|
2606 (unless (if (eq gnus-auto-select-first 'best)
|
|
2607 (gnus-summary-best-unread-article)
|
|
2608 (gnus-summary-first-unread-article))
|
|
2609 (gnus-configure-windows 'summary))
|
|
2610 ;; Don't select any articles, just move point to the first
|
|
2611 ;; article in the group.
|
|
2612 (goto-char (point-min))
|
|
2613 (gnus-summary-position-point)
|
|
2614 (gnus-set-mode-line 'summary)
|
|
2615 (gnus-configure-windows 'summary 'force))
|
|
2616 (when kill-buffer
|
|
2617 (gnus-kill-or-deaden-summary kill-buffer))
|
|
2618 (when (get-buffer-window gnus-group-buffer t)
|
|
2619 ;; Gotta use windows, because recenter does weird stuff if
|
|
2620 ;; the current buffer ain't the displayed window.
|
|
2621 (let ((owin (selected-window)))
|
|
2622 (select-window (get-buffer-window gnus-group-buffer t))
|
|
2623 (when (gnus-group-goto-group group)
|
|
2624 (recenter))
|
114
|
2625 (select-window owin)))
|
|
2626 ;; Mark this buffer as "prepared".
|
|
2627 (setq gnus-newsgroup-prepared t)
|
|
2628 t)))))
|
98
|
2629
|
|
2630 (defun gnus-summary-prepare ()
|
|
2631 "Generate the summary buffer."
|
|
2632 (interactive)
|
|
2633 (let ((buffer-read-only nil))
|
|
2634 (erase-buffer)
|
|
2635 (setq gnus-newsgroup-data nil
|
|
2636 gnus-newsgroup-data-reverse nil)
|
|
2637 (run-hooks 'gnus-summary-generate-hook)
|
|
2638 ;; Generate the buffer, either with threads or without.
|
|
2639 (when gnus-newsgroup-headers
|
|
2640 (gnus-summary-prepare-threads
|
|
2641 (if gnus-show-threads
|
|
2642 (gnus-sort-gathered-threads
|
|
2643 (funcall gnus-summary-thread-gathering-function
|
|
2644 (gnus-sort-threads
|
|
2645 (gnus-cut-threads (gnus-make-threads)))))
|
|
2646 ;; Unthreaded display.
|
|
2647 (gnus-sort-articles gnus-newsgroup-headers))))
|
|
2648 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
|
|
2649 ;; Call hooks for modifying summary buffer.
|
|
2650 (goto-char (point-min))
|
|
2651 (run-hooks 'gnus-summary-prepare-hook)))
|
|
2652
|
|
2653 (defsubst gnus-general-simplify-subject (subject)
|
|
2654 "Simply subject by the same rules as gnus-gather-threads-by-subject."
|
|
2655 (setq subject
|
|
2656 (cond
|
|
2657 ;; Truncate the subject.
|
|
2658 ((numberp gnus-summary-gather-subject-limit)
|
|
2659 (setq subject (gnus-simplify-subject-re subject))
|
|
2660 (if (> (length subject) gnus-summary-gather-subject-limit)
|
|
2661 (substring subject 0 gnus-summary-gather-subject-limit)
|
|
2662 subject))
|
|
2663 ;; Fuzzily simplify it.
|
|
2664 ((eq 'fuzzy gnus-summary-gather-subject-limit)
|
|
2665 (gnus-simplify-subject-fuzzy subject))
|
|
2666 ;; Just remove the leading "Re:".
|
|
2667 (t
|
|
2668 (gnus-simplify-subject-re subject))))
|
108
|
2669
|
98
|
2670 (if (and gnus-summary-gather-exclude-subject
|
|
2671 (string-match gnus-summary-gather-exclude-subject subject))
|
|
2672 nil ; This article shouldn't be gathered
|
|
2673 subject))
|
|
2674
|
|
2675 (defun gnus-summary-simplify-subject-query ()
|
|
2676 "Query where the respool algorithm would put this article."
|
|
2677 (interactive)
|
|
2678 (gnus-set-global-variables)
|
|
2679 (gnus-summary-select-article)
|
|
2680 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
|
|
2681
|
|
2682 (defun gnus-gather-threads-by-subject (threads)
|
|
2683 "Gather threads by looking at Subject headers."
|
|
2684 (if (not gnus-summary-make-false-root)
|
|
2685 threads
|
|
2686 (let ((hashtb (gnus-make-hashtable 1024))
|
|
2687 (prev threads)
|
|
2688 (result threads)
|
|
2689 subject hthread whole-subject)
|
|
2690 (while threads
|
|
2691 (setq subject (gnus-general-simplify-subject
|
108
|
2692 (setq whole-subject (mail-header-subject
|
98
|
2693 (caar threads)))))
|
|
2694 (when subject
|
|
2695 (if (setq hthread (gnus-gethash subject hashtb))
|
|
2696 (progn
|
|
2697 ;; We enter a dummy root into the thread, if we
|
|
2698 ;; haven't done that already.
|
|
2699 (unless (stringp (caar hthread))
|
|
2700 (setcar hthread (list whole-subject (car hthread))))
|
|
2701 ;; We add this new gathered thread to this gathered
|
|
2702 ;; thread.
|
|
2703 (setcdr (car hthread)
|
|
2704 (nconc (cdar hthread) (list (car threads))))
|
|
2705 ;; Remove it from the list of threads.
|
|
2706 (setcdr prev (cdr threads))
|
|
2707 (setq threads prev))
|
|
2708 ;; Enter this thread into the hash table.
|
|
2709 (gnus-sethash subject threads hashtb)))
|
|
2710 (setq prev threads)
|
|
2711 (setq threads (cdr threads)))
|
|
2712 result)))
|
|
2713
|
|
2714 (defun gnus-gather-threads-by-references (threads)
|
|
2715 "Gather threads by looking at References headers."
|
|
2716 (let ((idhashtb (gnus-make-hashtable 1024))
|
|
2717 (thhashtb (gnus-make-hashtable 1024))
|
|
2718 (prev threads)
|
|
2719 (result threads)
|
|
2720 ids references id gthread gid entered ref)
|
|
2721 (while threads
|
|
2722 (when (setq references (mail-header-references (caar threads)))
|
|
2723 (setq id (mail-header-id (caar threads))
|
|
2724 ids (gnus-split-references references)
|
|
2725 entered nil)
|
|
2726 (while (setq ref (pop ids))
|
|
2727 (setq ids (delete ref ids))
|
|
2728 (if (not (setq gid (gnus-gethash ref idhashtb)))
|
|
2729 (progn
|
|
2730 (gnus-sethash ref id idhashtb)
|
|
2731 (gnus-sethash id threads thhashtb))
|
|
2732 (setq gthread (gnus-gethash gid thhashtb))
|
|
2733 (unless entered
|
|
2734 ;; We enter a dummy root into the thread, if we
|
|
2735 ;; haven't done that already.
|
|
2736 (unless (stringp (caar gthread))
|
|
2737 (setcar gthread (list (mail-header-subject (caar gthread))
|
|
2738 (car gthread))))
|
|
2739 ;; We add this new gathered thread to this gathered
|
|
2740 ;; thread.
|
|
2741 (setcdr (car gthread)
|
|
2742 (nconc (cdar gthread) (list (car threads)))))
|
|
2743 ;; Add it into the thread hash table.
|
|
2744 (gnus-sethash id gthread thhashtb)
|
|
2745 (setq entered t)
|
|
2746 ;; Remove it from the list of threads.
|
|
2747 (setcdr prev (cdr threads))
|
|
2748 (setq threads prev))))
|
|
2749 (setq prev threads)
|
|
2750 (setq threads (cdr threads)))
|
|
2751 result))
|
|
2752
|
|
2753 (defun gnus-sort-gathered-threads (threads)
|
|
2754 "Sort subtreads inside each gathered thread by article number."
|
|
2755 (let ((result threads))
|
|
2756 (while threads
|
|
2757 (when (stringp (caar threads))
|
|
2758 (setcdr (car threads)
|
|
2759 (sort (cdar threads) 'gnus-thread-sort-by-number)))
|
|
2760 (setq threads (cdr threads)))
|
|
2761 result))
|
|
2762
|
|
2763 (defun gnus-thread-loop-p (root thread)
|
|
2764 "Say whether ROOT is in THREAD."
|
124
|
2765 (let ((stack (list thread))
|
|
2766 (infloop 0)
|
|
2767 th)
|
|
2768 (while (setq thread (pop stack))
|
|
2769 (setq th (cdr thread))
|
|
2770 (while (and th
|
|
2771 (not (eq (caar th) root)))
|
|
2772 (pop th))
|
|
2773 (if th
|
|
2774 ;; We have found a loop.
|
|
2775 (let (ref-dep)
|
|
2776 (setcdr thread (delq (car th) (cdr thread)))
|
|
2777 (if (boundp (setq ref-dep (intern "none"
|
|
2778 gnus-newsgroup-dependencies)))
|
|
2779 (setcdr (symbol-value ref-dep)
|
|
2780 (nconc (cdr (symbol-value ref-dep))
|
|
2781 (list (car th))))
|
|
2782 (set ref-dep (list nil (car th))))
|
|
2783 (setq infloop 1
|
|
2784 stack nil))
|
|
2785 ;; Push all the subthreads onto the stack.
|
|
2786 (push (cdr thread) stack)))
|
|
2787 infloop))
|
98
|
2788
|
|
2789 (defun gnus-make-threads ()
|
|
2790 "Go through the dependency hashtb and find the roots. Return all threads."
|
|
2791 (let (threads)
|
|
2792 (while (catch 'infloop
|
|
2793 (mapatoms
|
|
2794 (lambda (refs)
|
|
2795 ;; Deal with self-referencing References loops.
|
|
2796 (when (and (car (symbol-value refs))
|
|
2797 (not (zerop
|
108
|
2798 (apply
|
98
|
2799 '+
|
|
2800 (mapcar
|
|
2801 (lambda (thread)
|
|
2802 (gnus-thread-loop-p
|
|
2803 (car (symbol-value refs)) thread))
|
|
2804 (cdr (symbol-value refs)))))))
|
|
2805 (setq threads nil)
|
|
2806 (throw 'infloop t))
|
|
2807 (unless (car (symbol-value refs))
|
|
2808 ;; These threads do not refer back to any other articles,
|
|
2809 ;; so they're roots.
|
|
2810 (setq threads (append (cdr (symbol-value refs)) threads))))
|
|
2811 gnus-newsgroup-dependencies)))
|
|
2812 threads))
|
|
2813
|
|
2814 (defun gnus-build-sparse-threads ()
|
|
2815 (let ((headers gnus-newsgroup-headers)
|
|
2816 (deps gnus-newsgroup-dependencies)
|
108
|
2817 header references generation relations
|
98
|
2818 cthread subject child end pthread relation)
|
108
|
2819 ;; First we create an alist of generations/relations, where
|
98
|
2820 ;; generations is how much we trust the relation, and the relation
|
|
2821 ;; is parent/child.
|
|
2822 (gnus-message 7 "Making sparse threads...")
|
|
2823 (save-excursion
|
|
2824 (nnheader-set-temp-buffer " *gnus sparse threads*")
|
|
2825 (while (setq header (pop headers))
|
|
2826 (when (and (setq references (mail-header-references header))
|
|
2827 (not (string= references "")))
|
|
2828 (insert references)
|
|
2829 (setq child (mail-header-id header)
|
|
2830 subject (mail-header-subject header))
|
|
2831 (setq generation 0)
|
|
2832 (while (search-backward ">" nil t)
|
|
2833 (setq end (1+ (point)))
|
|
2834 (when (search-backward "<" nil t)
|
|
2835 (push (list (incf generation)
|
|
2836 child (setq child (buffer-substring (point) end))
|
|
2837 subject)
|
|
2838 relations)))
|
|
2839 (push (list (1+ generation) child nil subject) relations)
|
|
2840 (erase-buffer)))
|
|
2841 (kill-buffer (current-buffer)))
|
|
2842 ;; Sort over trustworthiness.
|
|
2843 (setq relations (sort relations (lambda (r1 r2) (< (car r1) (car r2)))))
|
|
2844 (while (setq relation (pop relations))
|
|
2845 (when (if (boundp (setq cthread (intern (cadr relation) deps)))
|
|
2846 (unless (car (symbol-value cthread))
|
|
2847 ;; Make this article the parent of these threads.
|
|
2848 (setcar (symbol-value cthread)
|
108
|
2849 (vector gnus-reffed-article-number
|
98
|
2850 (cadddr relation)
|
|
2851 "" ""
|
|
2852 (cadr relation)
|
|
2853 (or (caddr relation) "") 0 0 "")))
|
|
2854 (set cthread (list (vector gnus-reffed-article-number
|
|
2855 (cadddr relation)
|
|
2856 "" "" (cadr relation)
|
|
2857 (or (caddr relation) "") 0 0 ""))))
|
|
2858 (push gnus-reffed-article-number gnus-newsgroup-limit)
|
|
2859 (push gnus-reffed-article-number gnus-newsgroup-sparse)
|
|
2860 (push (cons gnus-reffed-article-number gnus-sparse-mark)
|
|
2861 gnus-newsgroup-reads)
|
|
2862 (decf gnus-reffed-article-number)
|
|
2863 ;; Make this new thread the child of its parent.
|
|
2864 (if (boundp (setq pthread (intern (or (caddr relation) "none") deps)))
|
|
2865 (setcdr (symbol-value pthread)
|
|
2866 (nconc (cdr (symbol-value pthread))
|
|
2867 (list (symbol-value cthread))))
|
|
2868 (set pthread (list nil (symbol-value cthread))))))
|
|
2869 (gnus-message 7 "Making sparse threads...done")))
|
|
2870
|
|
2871 (defun gnus-build-old-threads ()
|
|
2872 ;; Look at all the articles that refer back to old articles, and
|
|
2873 ;; fetch the headers for the articles that aren't there. This will
|
|
2874 ;; build complete threads - if the roots haven't been expired by the
|
|
2875 ;; server, that is.
|
|
2876 (let (id heads)
|
|
2877 (mapatoms
|
|
2878 (lambda (refs)
|
|
2879 (when (not (car (symbol-value refs)))
|
|
2880 (setq heads (cdr (symbol-value refs)))
|
|
2881 (while heads
|
|
2882 (if (memq (mail-header-number (caar heads))
|
|
2883 gnus-newsgroup-dormant)
|
|
2884 (setq heads (cdr heads))
|
|
2885 (setq id (symbol-name refs))
|
|
2886 (while (and (setq id (gnus-build-get-header id))
|
|
2887 (not (car (gnus-gethash
|
|
2888 id gnus-newsgroup-dependencies)))))
|
|
2889 (setq heads nil)))))
|
|
2890 gnus-newsgroup-dependencies)))
|
|
2891
|
|
2892 (defun gnus-build-get-header (id)
|
|
2893 ;; Look through the buffer of NOV lines and find the header to
|
|
2894 ;; ID. Enter this line into the dependencies hash table, and return
|
|
2895 ;; the id of the parent article (if any).
|
|
2896 (let ((deps gnus-newsgroup-dependencies)
|
|
2897 found header)
|
|
2898 (prog1
|
|
2899 (save-excursion
|
|
2900 (set-buffer nntp-server-buffer)
|
114
|
2901 (let ((case-fold-search nil))
|
|
2902 (goto-char (point-min))
|
|
2903 (while (and (not found)
|
|
2904 (search-forward id nil t))
|
|
2905 (beginning-of-line)
|
|
2906 (setq found (looking-at
|
|
2907 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
|
|
2908 (regexp-quote id))))
|
|
2909 (or found (beginning-of-line 2)))
|
|
2910 (when found
|
|
2911 (beginning-of-line)
|
|
2912 (and
|
|
2913 (setq header (gnus-nov-parse-line
|
|
2914 (read (current-buffer)) deps))
|
|
2915 (gnus-parent-id (mail-header-references header))))))
|
98
|
2916 (when header
|
|
2917 (let ((number (mail-header-number header)))
|
|
2918 (push number gnus-newsgroup-limit)
|
|
2919 (push header gnus-newsgroup-headers)
|
|
2920 (if (memq number gnus-newsgroup-unselected)
|
|
2921 (progn
|
|
2922 (push number gnus-newsgroup-unreads)
|
|
2923 (setq gnus-newsgroup-unselected
|
|
2924 (delq number gnus-newsgroup-unselected)))
|
|
2925 (push number gnus-newsgroup-ancient)))))))
|
|
2926
|
|
2927 (defun gnus-summary-update-article-line (article header)
|
|
2928 "Update the line for ARTICLE using HEADERS."
|
|
2929 (let* ((id (mail-header-id header))
|
|
2930 (thread (gnus-id-to-thread id)))
|
|
2931 (unless thread
|
|
2932 (error "Article in no thread"))
|
|
2933 ;; Update the thread.
|
|
2934 (setcar thread header)
|
|
2935 (gnus-summary-goto-subject article)
|
|
2936 (let* ((datal (gnus-data-find-list article))
|
|
2937 (data (car datal))
|
|
2938 (length (when (cdr datal)
|
|
2939 (- (gnus-data-pos data)
|
|
2940 (gnus-data-pos (cadr datal)))))
|
|
2941 (buffer-read-only nil)
|
|
2942 (level (gnus-summary-thread-level)))
|
|
2943 (gnus-delete-line)
|
|
2944 (gnus-summary-insert-line
|
|
2945 header level nil (gnus-article-mark article)
|
|
2946 (memq article gnus-newsgroup-replied)
|
|
2947 (memq article gnus-newsgroup-expirable)
|
104
|
2948 ;; Only insert the Subject string when it's different
|
|
2949 ;; from the previous Subject string.
|
114
|
2950 (if (gnus-subject-equal
|
|
2951 (condition-case ()
|
|
2952 (mail-header-subject
|
|
2953 (gnus-data-header
|
|
2954 (cadr
|
|
2955 (gnus-data-find-list
|
|
2956 article
|
|
2957 (gnus-data-list t)))))
|
118
|
2958 ;; Error on the side of excessive subjects.
|
124
|
2959 (error ""))
|
114
|
2960 (mail-header-subject header))
|
124
|
2961 ""
|
|
2962 (mail-header-subject header))
|
98
|
2963 nil (cdr (assq article gnus-newsgroup-scored))
|
|
2964 (memq article gnus-newsgroup-processable))
|
|
2965 (when length
|
|
2966 (gnus-data-update-list
|
|
2967 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
|
108
|
2968
|
98
|
2969 (defun gnus-summary-update-article (article &optional iheader)
|
|
2970 "Update ARTICLE in the summary buffer."
|
|
2971 (set-buffer gnus-summary-buffer)
|
|
2972 (let* ((header (or iheader (gnus-summary-article-header article)))
|
|
2973 (id (mail-header-id header))
|
|
2974 (data (gnus-data-find article))
|
|
2975 (thread (gnus-id-to-thread id))
|
|
2976 (references (mail-header-references header))
|
|
2977 (parent
|
|
2978 (gnus-id-to-thread
|
108
|
2979 (or (gnus-parent-id
|
98
|
2980 (when (and references
|
|
2981 (not (equal "" references)))
|
|
2982 references))
|
|
2983 "none")))
|
|
2984 (buffer-read-only nil)
|
|
2985 (old (car thread))
|
|
2986 (number (mail-header-number header))
|
|
2987 pos)
|
|
2988 (when thread
|
|
2989 ;; !!! Should this be in or not?
|
|
2990 (unless iheader
|
|
2991 (setcar thread nil))
|
|
2992 (when parent
|
|
2993 (delq thread parent))
|
|
2994 (if (gnus-summary-insert-subject id header iheader)
|
|
2995 ;; Set the (possibly) new article number in the data structure.
|
|
2996 (gnus-data-set-number data (gnus-id-to-article id))
|
|
2997 (setcar thread old)
|
|
2998 nil))))
|
|
2999
|
|
3000 (defun gnus-rebuild-thread (id)
|
|
3001 "Rebuild the thread containing ID."
|
|
3002 (let ((buffer-read-only nil)
|
|
3003 old-pos current thread data)
|
|
3004 (if (not gnus-show-threads)
|
|
3005 (setq thread (list (car (gnus-id-to-thread id))))
|
|
3006 ;; Get the thread this article is part of.
|
|
3007 (setq thread (gnus-remove-thread id)))
|
|
3008 (setq old-pos (gnus-point-at-bol))
|
|
3009 (setq current (save-excursion
|
|
3010 (and (zerop (forward-line -1))
|
|
3011 (gnus-summary-article-number))))
|
|
3012 ;; If this is a gathered thread, we have to go some re-gathering.
|
|
3013 (when (stringp (car thread))
|
|
3014 (let ((subject (car thread))
|
|
3015 roots thr)
|
|
3016 (setq thread (cdr thread))
|
|
3017 (while thread
|
|
3018 (unless (memq (setq thr (gnus-id-to-thread
|
|
3019 (gnus-root-id
|
|
3020 (mail-header-id (caar thread)))))
|
|
3021 roots)
|
|
3022 (push thr roots))
|
|
3023 (setq thread (cdr thread)))
|
|
3024 ;; We now have all (unique) roots.
|
|
3025 (if (= (length roots) 1)
|
|
3026 ;; All the loose roots are now one solid root.
|
|
3027 (setq thread (car roots))
|
|
3028 (setq thread (cons subject (gnus-sort-threads roots))))))
|
|
3029 (let (threads)
|
|
3030 ;; We then insert this thread into the summary buffer.
|
|
3031 (let (gnus-newsgroup-data gnus-newsgroup-threads)
|
|
3032 (if gnus-show-threads
|
|
3033 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
|
|
3034 (gnus-summary-prepare-unthreaded thread))
|
|
3035 (setq data (nreverse gnus-newsgroup-data))
|
|
3036 (setq threads gnus-newsgroup-threads))
|
|
3037 ;; We splice the new data into the data structure.
|
|
3038 (gnus-data-enter-list current data (- (point) old-pos))
|
|
3039 (setq gnus-newsgroup-threads (nconc threads gnus-newsgroup-threads)))))
|
|
3040
|
|
3041 (defun gnus-number-to-header (number)
|
|
3042 "Return the header for article NUMBER."
|
|
3043 (let ((headers gnus-newsgroup-headers))
|
|
3044 (while (and headers
|
|
3045 (not (= number (mail-header-number (car headers)))))
|
|
3046 (pop headers))
|
|
3047 (when headers
|
|
3048 (car headers))))
|
|
3049
|
|
3050 (defun gnus-parent-headers (headers &optional generation)
|
|
3051 "Return the headers of the GENERATIONeth parent of HEADERS."
|
108
|
3052 (unless generation
|
98
|
3053 (setq generation 1))
|
|
3054 (let (references parent)
|
|
3055 (while (and headers (not (zerop generation)))
|
|
3056 (setq references (mail-header-references headers))
|
|
3057 (when (and references
|
|
3058 (setq parent (gnus-parent-id references))
|
|
3059 (setq headers (car (gnus-id-to-thread parent))))
|
|
3060 (decf generation)))
|
|
3061 headers))
|
|
3062
|
|
3063 (defun gnus-id-to-thread (id)
|
|
3064 "Return the (sub-)thread where ID appears."
|
|
3065 (gnus-gethash id gnus-newsgroup-dependencies))
|
|
3066
|
|
3067 (defun gnus-id-to-article (id)
|
|
3068 "Return the article number of ID."
|
|
3069 (let ((thread (gnus-id-to-thread id)))
|
|
3070 (when (and thread
|
|
3071 (car thread))
|
|
3072 (mail-header-number (car thread)))))
|
|
3073
|
|
3074 (defun gnus-id-to-header (id)
|
|
3075 "Return the article headers of ID."
|
|
3076 (car (gnus-id-to-thread id)))
|
|
3077
|
|
3078 (defun gnus-article-displayed-root-p (article)
|
|
3079 "Say whether ARTICLE is a root(ish) article."
|
|
3080 (let ((level (gnus-summary-thread-level article))
|
|
3081 (refs (mail-header-references (gnus-summary-article-header article)))
|
|
3082 particle)
|
108
|
3083 (cond
|
98
|
3084 ((null level) nil)
|
|
3085 ((zerop level) t)
|
|
3086 ((null refs) t)
|
|
3087 ((null (gnus-parent-id refs)) t)
|
|
3088 ((and (= 1 level)
|
|
3089 (null (setq particle (gnus-id-to-article
|
|
3090 (gnus-parent-id refs))))
|
|
3091 (null (gnus-summary-thread-level particle)))))))
|
|
3092
|
|
3093 (defun gnus-root-id (id)
|
|
3094 "Return the id of the root of the thread where ID appears."
|
|
3095 (let (last-id prev)
|
108
|
3096 (while (and id (setq prev (car (gnus-gethash
|
98
|
3097 id gnus-newsgroup-dependencies))))
|
|
3098 (setq last-id id
|
|
3099 id (gnus-parent-id (mail-header-references prev))))
|
|
3100 last-id))
|
|
3101
|
|
3102 (defun gnus-remove-thread (id &optional dont-remove)
|
|
3103 "Remove the thread that has ID in it."
|
|
3104 (let ((dep gnus-newsgroup-dependencies)
|
|
3105 headers thread last-id)
|
|
3106 ;; First go up in this thread until we find the root.
|
|
3107 (setq last-id (gnus-root-id id))
|
|
3108 (setq headers (list (car (gnus-id-to-thread last-id))
|
|
3109 (caadr (gnus-id-to-thread last-id))))
|
|
3110 ;; We have now found the real root of this thread. It might have
|
|
3111 ;; been gathered into some loose thread, so we have to search
|
|
3112 ;; through the threads to find the thread we wanted.
|
|
3113 (let ((threads gnus-newsgroup-threads)
|
|
3114 sub)
|
|
3115 (while threads
|
|
3116 (setq sub (car threads))
|
|
3117 (if (stringp (car sub))
|
|
3118 ;; This is a gathered thread, so we look at the roots
|
|
3119 ;; below it to find whether this article is in this
|
|
3120 ;; gathered root.
|
|
3121 (progn
|
|
3122 (setq sub (cdr sub))
|
|
3123 (while sub
|
|
3124 (when (member (caar sub) headers)
|
|
3125 (setq thread (car threads)
|
|
3126 threads nil
|
|
3127 sub nil))
|
|
3128 (setq sub (cdr sub))))
|
|
3129 ;; It's an ordinary thread, so we check it.
|
|
3130 (when (eq (car sub) (car headers))
|
|
3131 (setq thread sub
|
|
3132 threads nil)))
|
|
3133 (setq threads (cdr threads)))
|
|
3134 ;; If this article is in no thread, then it's a root.
|
|
3135 (if thread
|
|
3136 (unless dont-remove
|
|
3137 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
|
|
3138 (setq thread (gnus-gethash last-id dep)))
|
|
3139 (when thread
|
|
3140 (prog1
|
|
3141 thread ; We return this thread.
|
|
3142 (unless dont-remove
|
|
3143 (if (stringp (car thread))
|
|
3144 (progn
|
|
3145 ;; If we use dummy roots, then we have to remove the
|
|
3146 ;; dummy root as well.
|
|
3147 (when (eq gnus-summary-make-false-root 'dummy)
|
|
3148 (gnus-delete-line)
|
|
3149 (gnus-data-compute-positions))
|
|
3150 (setq thread (cdr thread))
|
|
3151 (while thread
|
|
3152 (gnus-remove-thread-1 (car thread))
|
|
3153 (setq thread (cdr thread))))
|
|
3154 (gnus-remove-thread-1 thread))))))))
|
|
3155
|
|
3156 (defun gnus-remove-thread-1 (thread)
|
|
3157 "Remove the thread THREAD recursively."
|
|
3158 (let ((number (mail-header-number (pop thread)))
|
|
3159 d)
|
|
3160 (setq thread (reverse thread))
|
|
3161 (while thread
|
|
3162 (gnus-remove-thread-1 (pop thread)))
|
|
3163 (when (setq d (gnus-data-find number))
|
|
3164 (goto-char (gnus-data-pos d))
|
108
|
3165 (gnus-data-remove
|
98
|
3166 number
|
|
3167 (- (gnus-point-at-bol)
|
|
3168 (prog1
|
|
3169 (1+ (gnus-point-at-eol))
|
|
3170 (gnus-delete-line)))))))
|
|
3171
|
|
3172 (defun gnus-sort-threads (threads)
|
|
3173 "Sort THREADS."
|
|
3174 (if (not gnus-thread-sort-functions)
|
|
3175 threads
|
|
3176 (gnus-message 7 "Sorting threads...")
|
|
3177 (prog1
|
|
3178 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
|
|
3179 (gnus-message 7 "Sorting threads...done"))))
|
|
3180
|
|
3181 (defun gnus-sort-articles (articles)
|
|
3182 "Sort ARTICLES."
|
|
3183 (when gnus-article-sort-functions
|
|
3184 (gnus-message 7 "Sorting articles...")
|
|
3185 (prog1
|
|
3186 (setq gnus-newsgroup-headers
|
108
|
3187 (sort articles (gnus-make-sort-function
|
98
|
3188 gnus-article-sort-functions)))
|
|
3189 (gnus-message 7 "Sorting articles...done"))))
|
|
3190
|
|
3191 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
|
|
3192 (defmacro gnus-thread-header (thread)
|
|
3193 ;; Return header of first article in THREAD.
|
|
3194 ;; Note that THREAD must never, ever be anything else than a variable -
|
|
3195 ;; using some other form will lead to serious barfage.
|
|
3196 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
|
|
3197 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
|
|
3198 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
|
|
3199 (vector thread) 2))
|
|
3200
|
|
3201 (defsubst gnus-article-sort-by-number (h1 h2)
|
|
3202 "Sort articles by article number."
|
|
3203 (< (mail-header-number h1)
|
|
3204 (mail-header-number h2)))
|
|
3205
|
|
3206 (defun gnus-thread-sort-by-number (h1 h2)
|
|
3207 "Sort threads by root article number."
|
|
3208 (gnus-article-sort-by-number
|
|
3209 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3210
|
|
3211 (defsubst gnus-article-sort-by-lines (h1 h2)
|
|
3212 "Sort articles by article Lines header."
|
|
3213 (< (mail-header-lines h1)
|
|
3214 (mail-header-lines h2)))
|
|
3215
|
|
3216 (defun gnus-thread-sort-by-lines (h1 h2)
|
|
3217 "Sort threads by root article Lines header."
|
|
3218 (gnus-article-sort-by-lines
|
|
3219 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3220
|
|
3221 (defsubst gnus-article-sort-by-author (h1 h2)
|
|
3222 "Sort articles by root author."
|
|
3223 (string-lessp
|
|
3224 (let ((extract (funcall
|
|
3225 gnus-extract-address-components
|
|
3226 (mail-header-from h1))))
|
110
|
3227 (or (car extract) (cadr extract) ""))
|
98
|
3228 (let ((extract (funcall
|
|
3229 gnus-extract-address-components
|
|
3230 (mail-header-from h2))))
|
110
|
3231 (or (car extract) (cadr extract) ""))))
|
98
|
3232
|
|
3233 (defun gnus-thread-sort-by-author (h1 h2)
|
|
3234 "Sort threads by root author."
|
|
3235 (gnus-article-sort-by-author
|
|
3236 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3237
|
|
3238 (defsubst gnus-article-sort-by-subject (h1 h2)
|
|
3239 "Sort articles by root subject."
|
|
3240 (string-lessp
|
|
3241 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
|
|
3242 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
|
|
3243
|
|
3244 (defun gnus-thread-sort-by-subject (h1 h2)
|
|
3245 "Sort threads by root subject."
|
|
3246 (gnus-article-sort-by-subject
|
|
3247 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3248
|
|
3249 (defsubst gnus-article-sort-by-date (h1 h2)
|
|
3250 "Sort articles by root article date."
|
|
3251 (gnus-time-less
|
|
3252 (gnus-date-get-time (mail-header-date h1))
|
|
3253 (gnus-date-get-time (mail-header-date h2))))
|
|
3254
|
|
3255 (defun gnus-thread-sort-by-date (h1 h2)
|
|
3256 "Sort threads by root article date."
|
|
3257 (gnus-article-sort-by-date
|
|
3258 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3259
|
|
3260 (defsubst gnus-article-sort-by-score (h1 h2)
|
|
3261 "Sort articles by root article score.
|
|
3262 Unscored articles will be counted as having a score of zero."
|
|
3263 (> (or (cdr (assq (mail-header-number h1)
|
|
3264 gnus-newsgroup-scored))
|
|
3265 gnus-summary-default-score 0)
|
|
3266 (or (cdr (assq (mail-header-number h2)
|
|
3267 gnus-newsgroup-scored))
|
|
3268 gnus-summary-default-score 0)))
|
|
3269
|
|
3270 (defun gnus-thread-sort-by-score (h1 h2)
|
|
3271 "Sort threads by root article score."
|
|
3272 (gnus-article-sort-by-score
|
|
3273 (gnus-thread-header h1) (gnus-thread-header h2)))
|
|
3274
|
|
3275 (defun gnus-thread-sort-by-total-score (h1 h2)
|
|
3276 "Sort threads by the sum of all scores in the thread.
|
|
3277 Unscored articles will be counted as having a score of zero."
|
|
3278 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
|
|
3279
|
|
3280 (defun gnus-thread-total-score (thread)
|
|
3281 ;; This function find the total score of THREAD.
|
|
3282 (cond ((null thread)
|
|
3283 0)
|
|
3284 ((consp thread)
|
|
3285 (if (stringp (car thread))
|
|
3286 (apply gnus-thread-score-function 0
|
|
3287 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
|
|
3288 (gnus-thread-total-score-1 thread)))
|
|
3289 (t
|
|
3290 (gnus-thread-total-score-1 (list thread)))))
|
|
3291
|
|
3292 (defun gnus-thread-total-score-1 (root)
|
|
3293 ;; This function find the total score of the thread below ROOT.
|
|
3294 (setq root (car root))
|
|
3295 (apply gnus-thread-score-function
|
|
3296 (or (append
|
|
3297 (mapcar 'gnus-thread-total-score
|
|
3298 (cdr (gnus-gethash (mail-header-id root)
|
|
3299 gnus-newsgroup-dependencies)))
|
|
3300 (when (> (mail-header-number root) 0)
|
|
3301 (list (or (cdr (assq (mail-header-number root)
|
|
3302 gnus-newsgroup-scored))
|
|
3303 gnus-summary-default-score 0))))
|
|
3304 (list gnus-summary-default-score)
|
|
3305 '(0))))
|
|
3306
|
|
3307 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
3308 (defvar gnus-tmp-prev-subject nil)
|
|
3309 (defvar gnus-tmp-false-parent nil)
|
|
3310 (defvar gnus-tmp-root-expunged nil)
|
|
3311 (defvar gnus-tmp-dummy-line nil)
|
|
3312
|
|
3313 (defun gnus-summary-prepare-threads (threads)
|
|
3314 "Prepare summary buffer from THREADS and indentation LEVEL.
|
|
3315 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
|
|
3316 or a straight list of headers."
|
|
3317 (gnus-message 7 "Generating summary...")
|
|
3318
|
|
3319 (setq gnus-newsgroup-threads threads)
|
|
3320 (beginning-of-line)
|
|
3321
|
|
3322 (let ((gnus-tmp-level 0)
|
|
3323 (default-score (or gnus-summary-default-score 0))
|
|
3324 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
|
|
3325 thread number subject stack state gnus-tmp-gathered beg-match
|
|
3326 new-roots gnus-tmp-new-adopts thread-end
|
|
3327 gnus-tmp-header gnus-tmp-unread
|
|
3328 gnus-tmp-replied gnus-tmp-subject-or-nil
|
|
3329 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
|
|
3330 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
|
|
3331 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
|
|
3332
|
|
3333 (setq gnus-tmp-prev-subject nil)
|
|
3334
|
|
3335 (if (vectorp (car threads))
|
|
3336 ;; If this is a straight (sic) list of headers, then a
|
|
3337 ;; threaded summary display isn't required, so we just create
|
|
3338 ;; an unthreaded one.
|
|
3339 (gnus-summary-prepare-unthreaded threads)
|
|
3340
|
|
3341 ;; Do the threaded display.
|
|
3342
|
|
3343 (while (or threads stack gnus-tmp-new-adopts new-roots)
|
|
3344
|
|
3345 (if (and (= gnus-tmp-level 0)
|
|
3346 (not (setq gnus-tmp-dummy-line nil))
|
|
3347 (or (not stack)
|
|
3348 (= (caar stack) 0))
|
|
3349 (not gnus-tmp-false-parent)
|
|
3350 (or gnus-tmp-new-adopts new-roots))
|
|
3351 (if gnus-tmp-new-adopts
|
|
3352 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
|
|
3353 thread (list (car gnus-tmp-new-adopts))
|
|
3354 gnus-tmp-header (caar thread)
|
|
3355 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
|
|
3356 (when new-roots
|
|
3357 (setq thread (list (car new-roots))
|
|
3358 gnus-tmp-header (caar thread)
|
|
3359 new-roots (cdr new-roots))))
|
|
3360
|
|
3361 (if threads
|
|
3362 ;; If there are some threads, we do them before the
|
|
3363 ;; threads on the stack.
|
|
3364 (setq thread threads
|
|
3365 gnus-tmp-header (caar thread))
|
|
3366 ;; There were no current threads, so we pop something off
|
|
3367 ;; the stack.
|
|
3368 (setq state (car stack)
|
|
3369 gnus-tmp-level (car state)
|
|
3370 thread (cdr state)
|
|
3371 stack (cdr stack)
|
|
3372 gnus-tmp-header (caar thread))))
|
|
3373
|
|
3374 (setq gnus-tmp-false-parent nil)
|
|
3375 (setq gnus-tmp-root-expunged nil)
|
|
3376 (setq thread-end nil)
|
|
3377
|
|
3378 (if (stringp gnus-tmp-header)
|
|
3379 ;; The header is a dummy root.
|
|
3380 (cond
|
|
3381 ((eq gnus-summary-make-false-root 'adopt)
|
|
3382 ;; We let the first article adopt the rest.
|
|
3383 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
|
|
3384 (cddar thread)))
|
|
3385 (setq gnus-tmp-gathered
|
|
3386 (nconc (mapcar
|
|
3387 (lambda (h) (mail-header-number (car h)))
|
|
3388 (cddar thread))
|
|
3389 gnus-tmp-gathered))
|
|
3390 (setq thread (cons (list (caar thread)
|
|
3391 (cadar thread))
|
|
3392 (cdr thread)))
|
|
3393 (setq gnus-tmp-level -1
|
|
3394 gnus-tmp-false-parent t))
|
|
3395 ((eq gnus-summary-make-false-root 'empty)
|
|
3396 ;; We print adopted articles with empty subject fields.
|
|
3397 (setq gnus-tmp-gathered
|
|
3398 (nconc (mapcar
|
|
3399 (lambda (h) (mail-header-number (car h)))
|
|
3400 (cddar thread))
|
|
3401 gnus-tmp-gathered))
|
|
3402 (setq gnus-tmp-level -1))
|
|
3403 ((eq gnus-summary-make-false-root 'dummy)
|
|
3404 ;; We remember that we probably want to output a dummy
|
|
3405 ;; root.
|
|
3406 (setq gnus-tmp-dummy-line gnus-tmp-header)
|
|
3407 (setq gnus-tmp-prev-subject gnus-tmp-header))
|
|
3408 (t
|
|
3409 ;; We do not make a root for the gathered
|
|
3410 ;; sub-threads at all.
|
|
3411 (setq gnus-tmp-level -1)))
|
|
3412
|
|
3413 (setq number (mail-header-number gnus-tmp-header)
|
|
3414 subject (mail-header-subject gnus-tmp-header))
|
|
3415
|
|
3416 (cond
|
|
3417 ;; If the thread has changed subject, we might want to make
|
|
3418 ;; this subthread into a root.
|
|
3419 ((and (null gnus-thread-ignore-subject)
|
|
3420 (not (zerop gnus-tmp-level))
|
|
3421 gnus-tmp-prev-subject
|
|
3422 (not (inline
|
|
3423 (gnus-subject-equal gnus-tmp-prev-subject subject))))
|
|
3424 (setq new-roots (nconc new-roots (list (car thread)))
|
|
3425 thread-end t
|
|
3426 gnus-tmp-header nil))
|
|
3427 ;; If the article lies outside the current limit,
|
|
3428 ;; then we do not display it.
|
|
3429 ((not (memq number gnus-newsgroup-limit))
|
|
3430 (setq gnus-tmp-gathered
|
|
3431 (nconc (mapcar
|
|
3432 (lambda (h) (mail-header-number (car h)))
|
|
3433 (cdar thread))
|
|
3434 gnus-tmp-gathered))
|
|
3435 (setq gnus-tmp-new-adopts (if (cdar thread)
|
|
3436 (append gnus-tmp-new-adopts
|
|
3437 (cdar thread))
|
|
3438 gnus-tmp-new-adopts)
|
|
3439 thread-end t
|
|
3440 gnus-tmp-header nil)
|
|
3441 (when (zerop gnus-tmp-level)
|
|
3442 (setq gnus-tmp-root-expunged t)))
|
|
3443 ;; Perhaps this article is to be marked as read?
|
|
3444 ((and gnus-summary-mark-below
|
|
3445 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3446 default-score)
|
|
3447 gnus-summary-mark-below)
|
|
3448 ;; Don't touch sparse articles.
|
|
3449 (not (gnus-summary-article-sparse-p number))
|
|
3450 (not (gnus-summary-article-ancient-p number)))
|
|
3451 (setq gnus-newsgroup-unreads
|
|
3452 (delq number gnus-newsgroup-unreads))
|
|
3453 (if gnus-newsgroup-auto-expire
|
|
3454 (push number gnus-newsgroup-expirable)
|
|
3455 (push (cons number gnus-low-score-mark)
|
|
3456 gnus-newsgroup-reads))))
|
|
3457
|
|
3458 (when gnus-tmp-header
|
|
3459 ;; We may have an old dummy line to output before this
|
|
3460 ;; article.
|
|
3461 (when gnus-tmp-dummy-line
|
|
3462 (gnus-summary-insert-dummy-line
|
|
3463 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
|
|
3464 (setq gnus-tmp-dummy-line nil))
|
|
3465
|
|
3466 ;; Compute the mark.
|
|
3467 (setq gnus-tmp-unread (gnus-article-mark number))
|
|
3468
|
|
3469 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
|
|
3470 gnus-tmp-header gnus-tmp-level)
|
|
3471 gnus-newsgroup-data)
|
|
3472
|
|
3473 ;; Actually insert the line.
|
|
3474 (setq
|
|
3475 gnus-tmp-subject-or-nil
|
|
3476 (cond
|
|
3477 ((and gnus-thread-ignore-subject
|
|
3478 gnus-tmp-prev-subject
|
|
3479 (not (inline (gnus-subject-equal
|
|
3480 gnus-tmp-prev-subject subject))))
|
|
3481 subject)
|
|
3482 ((zerop gnus-tmp-level)
|
|
3483 (if (and (eq gnus-summary-make-false-root 'empty)
|
|
3484 (memq number gnus-tmp-gathered)
|
|
3485 gnus-tmp-prev-subject
|
|
3486 (inline (gnus-subject-equal
|
|
3487 gnus-tmp-prev-subject subject)))
|
|
3488 gnus-summary-same-subject
|
|
3489 subject))
|
|
3490 (t gnus-summary-same-subject)))
|
|
3491 (if (and (eq gnus-summary-make-false-root 'adopt)
|
|
3492 (= gnus-tmp-level 1)
|
|
3493 (memq number gnus-tmp-gathered))
|
|
3494 (setq gnus-tmp-opening-bracket ?\<
|
|
3495 gnus-tmp-closing-bracket ?\>)
|
|
3496 (setq gnus-tmp-opening-bracket ?\[
|
|
3497 gnus-tmp-closing-bracket ?\]))
|
|
3498 (setq
|
|
3499 gnus-tmp-indentation
|
|
3500 (aref gnus-thread-indent-array gnus-tmp-level)
|
|
3501 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
|
|
3502 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
|
|
3503 gnus-summary-default-score 0)
|
|
3504 gnus-tmp-score-char
|
|
3505 (if (or (null gnus-summary-default-score)
|
|
3506 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
|
|
3507 gnus-summary-zcore-fuzz))
|
|
3508 ?
|
|
3509 (if (< gnus-tmp-score gnus-summary-default-score)
|
|
3510 gnus-score-below-mark gnus-score-over-mark))
|
|
3511 gnus-tmp-replied
|
|
3512 (cond ((memq number gnus-newsgroup-processable)
|
|
3513 gnus-process-mark)
|
|
3514 ((memq number gnus-newsgroup-cached)
|
|
3515 gnus-cached-mark)
|
|
3516 ((memq number gnus-newsgroup-replied)
|
|
3517 gnus-replied-mark)
|
|
3518 ((memq number gnus-newsgroup-saved)
|
|
3519 gnus-saved-mark)
|
|
3520 (t gnus-unread-mark))
|
|
3521 gnus-tmp-from (mail-header-from gnus-tmp-header)
|
|
3522 gnus-tmp-name
|
|
3523 (cond
|
|
3524 ((string-match "<[^>]+> *$" gnus-tmp-from)
|
|
3525 (setq beg-match (match-beginning 0))
|
|
3526 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
|
|
3527 (substring gnus-tmp-from (1+ (match-beginning 0))
|
|
3528 (1- (match-end 0))))
|
|
3529 (substring gnus-tmp-from 0 beg-match)))
|
|
3530 ((string-match "(.+)" gnus-tmp-from)
|
|
3531 (substring gnus-tmp-from
|
|
3532 (1+ (match-beginning 0)) (1- (match-end 0))))
|
|
3533 (t gnus-tmp-from)))
|
|
3534 (when (string= gnus-tmp-name "")
|
|
3535 (setq gnus-tmp-name gnus-tmp-from))
|
|
3536 (unless (numberp gnus-tmp-lines)
|
|
3537 (setq gnus-tmp-lines 0))
|
|
3538 (gnus-put-text-property
|
|
3539 (point)
|
|
3540 (progn (eval gnus-summary-line-format-spec) (point))
|
|
3541 'gnus-number number)
|
|
3542 (when gnus-visual-p
|
|
3543 (forward-line -1)
|
|
3544 (run-hooks 'gnus-summary-update-hook)
|
|
3545 (forward-line 1))
|
|
3546
|
|
3547 (setq gnus-tmp-prev-subject subject)))
|
|
3548
|
|
3549 (when (nth 1 thread)
|
|
3550 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
|
|
3551 (incf gnus-tmp-level)
|
|
3552 (setq threads (if thread-end nil (cdar thread)))
|
|
3553 (unless threads
|
|
3554 (setq gnus-tmp-level 0)))))
|
|
3555 (gnus-message 7 "Generating summary...done"))
|
|
3556
|
|
3557 (defun gnus-summary-prepare-unthreaded (headers)
|
|
3558 "Generate an unthreaded summary buffer based on HEADERS."
|
|
3559 (let (header number mark)
|
|
3560
|
|
3561 (beginning-of-line)
|
|
3562
|
|
3563 (while headers
|
|
3564 ;; We may have to root out some bad articles...
|
|
3565 (when (memq (setq number (mail-header-number
|
|
3566 (setq header (pop headers))))
|
|
3567 gnus-newsgroup-limit)
|
|
3568 ;; Mark article as read when it has a low score.
|
|
3569 (when (and gnus-summary-mark-below
|
|
3570 (< (or (cdr (assq number gnus-newsgroup-scored))
|
|
3571 gnus-summary-default-score 0)
|
|
3572 gnus-summary-mark-below)
|
|
3573 (not (gnus-summary-article-ancient-p number)))
|
|
3574 (setq gnus-newsgroup-unreads
|
|
3575 (delq number gnus-newsgroup-unreads))
|
|
3576 (if gnus-newsgroup-auto-expire
|
|
3577 (push number gnus-newsgroup-expirable)
|
|
3578 (push (cons number gnus-low-score-mark)
|
|
3579 gnus-newsgroup-reads)))
|
|
3580
|
|
3581 (setq mark (gnus-article-mark number))
|
|
3582 (push (gnus-data-make number mark (1+ (point)) header 0)
|
|
3583 gnus-newsgroup-data)
|
|
3584 (gnus-summary-insert-line
|
|
3585 header 0 number
|
|
3586 mark (memq number gnus-newsgroup-replied)
|
|
3587 (memq number gnus-newsgroup-expirable)
|
|
3588 (mail-header-subject header) nil
|
|
3589 (cdr (assq number gnus-newsgroup-scored))
|
|
3590 (memq number gnus-newsgroup-processable))))))
|
|
3591
|
|
3592 (defun gnus-select-newsgroup (group &optional read-all)
|
|
3593 "Select newsgroup GROUP.
|
|
3594 If READ-ALL is non-nil, all articles in the group are selected."
|
|
3595 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
|
116
|
3596 ;;!!! Dirty hack; should be removed.
|
|
3597 (gnus-summary-ignore-duplicates
|
|
3598 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
|
|
3599 t
|
|
3600 gnus-summary-ignore-duplicates))
|
98
|
3601 (info (nth 2 entry))
|
|
3602 articles fetched-articles cached)
|
|
3603
|
|
3604 (unless (gnus-check-server
|
108
|
3605 (setq gnus-current-select-method
|
98
|
3606 (gnus-find-method-for-group group)))
|
|
3607 (error "Couldn't open server"))
|
|
3608
|
|
3609 (or (and entry (not (eq (car entry) t))) ; Either it's active...
|
|
3610 (gnus-activate-group group) ; Or we can activate it...
|
|
3611 (progn ; Or we bug out.
|
|
3612 (when (equal major-mode 'gnus-summary-mode)
|
|
3613 (kill-buffer (current-buffer)))
|
|
3614 (error "Couldn't request group %s: %s"
|
|
3615 group (gnus-status-message group))))
|
|
3616
|
|
3617 (unless (gnus-request-group group t)
|
|
3618 (when (equal major-mode 'gnus-summary-mode)
|
|
3619 (kill-buffer (current-buffer)))
|
|
3620 (error "Couldn't request group %s: %s"
|
|
3621 group (gnus-status-message group)))
|
|
3622
|
|
3623 (setq gnus-newsgroup-name group)
|
|
3624 (setq gnus-newsgroup-unselected nil)
|
|
3625 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
|
|
3626
|
|
3627 ;; Adjust and set lists of article marks.
|
|
3628 (when info
|
|
3629 (gnus-adjust-marked-articles info))
|
|
3630
|
|
3631 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3632 (when (gnus-virtual-group-p group)
|
|
3633 (setq cached gnus-newsgroup-cached))
|
|
3634
|
|
3635 (setq gnus-newsgroup-unreads
|
|
3636 (gnus-set-difference
|
|
3637 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
|
|
3638 gnus-newsgroup-dormant))
|
|
3639
|
|
3640 (setq gnus-newsgroup-processable nil)
|
|
3641
|
|
3642 (gnus-update-read-articles group gnus-newsgroup-unreads)
|
|
3643 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
3644 (gnus-group-update-group group))
|
108
|
3645
|
98
|
3646 (setq articles (gnus-articles-to-read group read-all))
|
|
3647
|
|
3648 (cond
|
|
3649 ((null articles)
|
|
3650 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
|
|
3651 'quit)
|
|
3652 ((eq articles 0) nil)
|
|
3653 (t
|
|
3654 ;; Init the dependencies hash table.
|
|
3655 (setq gnus-newsgroup-dependencies
|
|
3656 (gnus-make-hashtable (length articles)))
|
|
3657 ;; Retrieve the headers and read them in.
|
|
3658 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
|
|
3659 (setq gnus-newsgroup-headers
|
|
3660 (if (eq 'nov
|
|
3661 (setq gnus-headers-retrieved-by
|
|
3662 (gnus-retrieve-headers
|
|
3663 articles gnus-newsgroup-name
|
|
3664 ;; We might want to fetch old headers, but
|
|
3665 ;; not if there is only 1 article.
|
|
3666 (and gnus-fetch-old-headers
|
|
3667 (or (and
|
|
3668 (not (eq gnus-fetch-old-headers 'some))
|
|
3669 (not (numberp gnus-fetch-old-headers)))
|
|
3670 (> (length articles) 1))))))
|
108
|
3671 (gnus-get-newsgroup-headers-xover
|
98
|
3672 articles nil nil gnus-newsgroup-name t)
|
|
3673 (gnus-get-newsgroup-headers)))
|
|
3674 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
|
|
3675
|
|
3676 ;; Kludge to avoid having cached articles nixed out in virtual groups.
|
|
3677 (when cached
|
|
3678 (setq gnus-newsgroup-cached cached))
|
|
3679
|
|
3680 ;; Suppress duplicates?
|
|
3681 (when gnus-suppress-duplicates
|
|
3682 (gnus-dup-suppress-articles))
|
|
3683
|
|
3684 ;; Set the initial limit.
|
|
3685 (setq gnus-newsgroup-limit (copy-sequence articles))
|
|
3686 ;; Remove canceled articles from the list of unread articles.
|
|
3687 (setq gnus-newsgroup-unreads
|
|
3688 (gnus-set-sorted-intersection
|
|
3689 gnus-newsgroup-unreads
|
|
3690 (setq fetched-articles
|
|
3691 (mapcar (lambda (headers) (mail-header-number headers))
|
|
3692 gnus-newsgroup-headers))))
|
|
3693 ;; Removed marked articles that do not exist.
|
|
3694 (gnus-update-missing-marks
|
|
3695 (gnus-sorted-complement fetched-articles articles))
|
|
3696 ;; We might want to build some more threads first.
|
|
3697 (and gnus-fetch-old-headers
|
|
3698 (eq gnus-headers-retrieved-by 'nov)
|
|
3699 (gnus-build-old-threads))
|
|
3700 ;; Check whether auto-expire is to be done in this group.
|
|
3701 (setq gnus-newsgroup-auto-expire
|
|
3702 (gnus-group-auto-expirable-p group))
|
|
3703 ;; Set up the article buffer now, if necessary.
|
|
3704 (unless gnus-single-article-buffer
|
|
3705 (gnus-article-setup-buffer))
|
|
3706 ;; First and last article in this newsgroup.
|
|
3707 (when gnus-newsgroup-headers
|
|
3708 (setq gnus-newsgroup-begin
|
|
3709 (mail-header-number (car gnus-newsgroup-headers))
|
|
3710 gnus-newsgroup-end
|
|
3711 (mail-header-number
|
|
3712 (gnus-last-element gnus-newsgroup-headers))))
|
|
3713 ;; GROUP is successfully selected.
|
|
3714 (or gnus-newsgroup-headers t)))))
|
|
3715
|
|
3716 (defun gnus-articles-to-read (group &optional read-all)
|
|
3717 ;; Find out what articles the user wants to read.
|
|
3718 (let* ((articles
|
|
3719 ;; Select all articles if `read-all' is non-nil, or if there
|
|
3720 ;; are no unread articles.
|
|
3721 (if (or read-all
|
|
3722 (and (zerop (length gnus-newsgroup-marked))
|
|
3723 (zerop (length gnus-newsgroup-unreads)))
|
|
3724 (eq (gnus-group-find-parameter group 'display)
|
|
3725 'all))
|
|
3726 (gnus-uncompress-range (gnus-active group))
|
|
3727 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
|
|
3728 (copy-sequence gnus-newsgroup-unreads))
|
|
3729 '<)))
|
|
3730 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
|
|
3731 (scored (length scored-list))
|
|
3732 (number (length articles))
|
|
3733 (marked (+ (length gnus-newsgroup-marked)
|
|
3734 (length gnus-newsgroup-dormant)))
|
|
3735 (select
|
|
3736 (cond
|
|
3737 ((numberp read-all)
|
|
3738 read-all)
|
|
3739 (t
|
|
3740 (condition-case ()
|
|
3741 (cond
|
|
3742 ((and (or (<= scored marked) (= scored number))
|
|
3743 (numberp gnus-large-newsgroup)
|
|
3744 (> number gnus-large-newsgroup))
|
|
3745 (let ((input
|
|
3746 (read-string
|
|
3747 (format
|
|
3748 "How many articles from %s (default %d): "
|
|
3749 (gnus-limit-string gnus-newsgroup-name 35)
|
|
3750 number))))
|
|
3751 (if (string-match "^[ \t]*$" input) number input)))
|
|
3752 ((and (> scored marked) (< scored number)
|
|
3753 (> (- scored number) 20))
|
|
3754 (let ((input
|
|
3755 (read-string
|
|
3756 (format "%s %s (%d scored, %d total): "
|
|
3757 "How many articles from"
|
|
3758 group scored number))))
|
|
3759 (if (string-match "^[ \t]*$" input)
|
|
3760 number input)))
|
|
3761 (t number))
|
|
3762 (quit nil))))))
|
|
3763 (setq select (if (stringp select) (string-to-number select) select))
|
|
3764 (if (or (null select) (zerop select))
|
|
3765 select
|
|
3766 (if (and (not (zerop scored)) (<= (abs select) scored))
|
|
3767 (progn
|
|
3768 (setq articles (sort scored-list '<))
|
|
3769 (setq number (length articles)))
|
|
3770 (setq articles (copy-sequence articles)))
|
|
3771
|
|
3772 (when (< (abs select) number)
|
|
3773 (if (< select 0)
|
|
3774 ;; Select the N oldest articles.
|
|
3775 (setcdr (nthcdr (1- (abs select)) articles) nil)
|
|
3776 ;; Select the N most recent articles.
|
|
3777 (setq articles (nthcdr (- number select) articles))))
|
|
3778 (setq gnus-newsgroup-unselected
|
|
3779 (gnus-sorted-intersection
|
|
3780 gnus-newsgroup-unreads
|
|
3781 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
|
|
3782 articles)))
|
|
3783
|
|
3784 (defun gnus-killed-articles (killed articles)
|
|
3785 (let (out)
|
|
3786 (while articles
|
|
3787 (when (inline (gnus-member-of-range (car articles) killed))
|
|
3788 (push (car articles) out))
|
|
3789 (setq articles (cdr articles)))
|
|
3790 out))
|
|
3791
|
|
3792 (defun gnus-uncompress-marks (marks)
|
|
3793 "Uncompress the mark ranges in MARKS."
|
|
3794 (let ((uncompressed '(score bookmark))
|
|
3795 out)
|
|
3796 (while marks
|
|
3797 (if (memq (caar marks) uncompressed)
|
|
3798 (push (car marks) out)
|
|
3799 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
|
|
3800 (setq marks (cdr marks)))
|
|
3801 out))
|
|
3802
|
|
3803 (defun gnus-adjust-marked-articles (info)
|
|
3804 "Set all article lists and remove all marks that are no longer legal."
|
|
3805 (let* ((marked-lists (gnus-info-marks info))
|
|
3806 (active (gnus-active (gnus-info-group info)))
|
|
3807 (min (car active))
|
|
3808 (max (cdr active))
|
|
3809 (types gnus-article-mark-lists)
|
|
3810 (uncompressed '(score bookmark killed))
|
|
3811 marks var articles article mark)
|
|
3812
|
|
3813 (while marked-lists
|
|
3814 (setq marks (pop marked-lists))
|
|
3815 (set (setq var (intern (format "gnus-newsgroup-%s"
|
|
3816 (car (rassq (setq mark (car marks))
|
|
3817 types)))))
|
|
3818 (if (memq (car marks) uncompressed) (cdr marks)
|
|
3819 (gnus-uncompress-range (cdr marks))))
|
|
3820
|
|
3821 (setq articles (symbol-value var))
|
|
3822
|
|
3823 ;; All articles have to be subsets of the active articles.
|
|
3824 (cond
|
|
3825 ;; Adjust "simple" lists.
|
124
|
3826 ((memq mark '(tick dormant expire reply save))
|
98
|
3827 (while articles
|
|
3828 (when (or (< (setq article (pop articles)) min) (> article max))
|
|
3829 (set var (delq article (symbol-value var))))))
|
|
3830 ;; Adjust assocs.
|
|
3831 ((memq mark uncompressed)
|
|
3832 (while articles
|
|
3833 (when (or (not (consp (setq article (pop articles))))
|
|
3834 (< (car article) min)
|
|
3835 (> (car article) max))
|
|
3836 (set var (delq article (symbol-value var))))))))))
|
|
3837
|
|
3838 (defun gnus-update-missing-marks (missing)
|
|
3839 "Go through the list of MISSING articles and remove them mark lists."
|
|
3840 (when missing
|
|
3841 (let ((types gnus-article-mark-lists)
|
|
3842 var m)
|
|
3843 ;; Go through all types.
|
|
3844 (while types
|
|
3845 (setq var (intern (format "gnus-newsgroup-%s" (car (pop types)))))
|
|
3846 (when (symbol-value var)
|
|
3847 ;; This list has articles. So we delete all missing articles
|
|
3848 ;; from it.
|
|
3849 (setq m missing)
|
|
3850 (while m
|
|
3851 (set var (delq (pop m) (symbol-value var)))))))))
|
|
3852
|
|
3853 (defun gnus-update-marks ()
|
|
3854 "Enter the various lists of marked articles into the newsgroup info list."
|
|
3855 (let ((types gnus-article-mark-lists)
|
|
3856 (info (gnus-get-info gnus-newsgroup-name))
|
|
3857 (uncompressed '(score bookmark killed))
|
|
3858 type list newmarked symbol)
|
|
3859 (when info
|
|
3860 ;; Add all marks lists that are non-nil to the list of marks lists.
|
112
|
3861 (while (setq type (pop types))
|
98
|
3862 (when (setq list (symbol-value
|
|
3863 (setq symbol
|
|
3864 (intern (format "gnus-newsgroup-%s"
|
|
3865 (car type))))))
|
112
|
3866
|
|
3867 ;; Get rid of the entries of the articles that have the
|
|
3868 ;; default score.
|
|
3869 (when (and (eq (cdr type) 'score)
|
|
3870 gnus-save-score
|
|
3871 list)
|
|
3872 (let* ((arts list)
|
114
|
3873 (prev (cons nil list))
|
112
|
3874 (all prev))
|
|
3875 (while arts
|
|
3876 (if (or (not (consp (car arts)))
|
|
3877 (= (cdar arts) gnus-summary-default-score))
|
|
3878 (setcdr prev (cdr arts))
|
|
3879 (setq prev arts))
|
|
3880 (setq arts (cdr arts)))
|
|
3881 (setq list (cdr all))))
|
|
3882
|
98
|
3883 (push (cons (cdr type)
|
|
3884 (if (memq (cdr type) uncompressed) list
|
108
|
3885 (gnus-compress-sequence
|
98
|
3886 (set symbol (sort list '<)) t)))
|
|
3887 newmarked)))
|
|
3888
|
|
3889 ;; Enter these new marks into the info of the group.
|
|
3890 (if (nthcdr 3 info)
|
|
3891 (setcar (nthcdr 3 info) newmarked)
|
|
3892 ;; Add the marks lists to the end of the info.
|
|
3893 (when newmarked
|
|
3894 (setcdr (nthcdr 2 info) (list newmarked))))
|
|
3895
|
|
3896 ;; Cut off the end of the info if there's nothing else there.
|
|
3897 (let ((i 5))
|
|
3898 (while (and (> i 2)
|
|
3899 (not (nth i info)))
|
|
3900 (when (nthcdr (decf i) info)
|
|
3901 (setcdr (nthcdr i info) nil)))))))
|
|
3902
|
|
3903 (defun gnus-set-mode-line (where)
|
|
3904 "This function sets the mode line of the article or summary buffers.
|
|
3905 If WHERE is `summary', the summary mode line format will be used."
|
|
3906 ;; Is this mode line one we keep updated?
|
|
3907 (when (memq where gnus-updated-mode-lines)
|
|
3908 (let (mode-string)
|
|
3909 (save-excursion
|
|
3910 ;; We evaluate this in the summary buffer since these
|
|
3911 ;; variables are buffer-local to that buffer.
|
|
3912 (set-buffer gnus-summary-buffer)
|
|
3913 ;; We bind all these variables that are used in the `eval' form
|
|
3914 ;; below.
|
|
3915 (let* ((mformat (symbol-value
|
|
3916 (intern
|
|
3917 (format "gnus-%s-mode-line-format-spec" where))))
|
|
3918 (gnus-tmp-group-name gnus-newsgroup-name)
|
|
3919 (gnus-tmp-article-number (or gnus-current-article 0))
|
|
3920 (gnus-tmp-unread gnus-newsgroup-unreads)
|
|
3921 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
|
|
3922 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
|
|
3923 (gnus-tmp-unread-and-unselected
|
|
3924 (cond ((and (zerop gnus-tmp-unread-and-unticked)
|
|
3925 (zerop gnus-tmp-unselected))
|
|
3926 "")
|
|
3927 ((zerop gnus-tmp-unselected)
|
|
3928 (format "{%d more}" gnus-tmp-unread-and-unticked))
|
|
3929 (t (format "{%d(+%d) more}"
|
|
3930 gnus-tmp-unread-and-unticked
|
|
3931 gnus-tmp-unselected))))
|
|
3932 (gnus-tmp-subject
|
|
3933 (if (and gnus-current-headers
|
|
3934 (vectorp gnus-current-headers))
|
|
3935 (gnus-mode-string-quote
|
|
3936 (mail-header-subject gnus-current-headers))
|
|
3937 ""))
|
104
|
3938 bufname-length max-len
|
98
|
3939 gnus-tmp-header);; passed as argument to any user-format-funcs
|
|
3940 (setq mode-string (eval mformat))
|
104
|
3941 (setq bufname-length (if (string-match "%b" mode-string)
|
|
3942 (- (length
|
|
3943 (buffer-name
|
|
3944 (if (eq where 'summary)
|
|
3945 nil
|
|
3946 (get-buffer gnus-article-buffer))))
|
|
3947 2)
|
|
3948 0))
|
98
|
3949 (setq max-len (max 4 (if gnus-mode-non-string-length
|
|
3950 (- (window-width)
|
104
|
3951 gnus-mode-non-string-length
|
|
3952 bufname-length)
|
98
|
3953 (length mode-string))))
|
|
3954 ;; We might have to chop a bit of the string off...
|
|
3955 (when (> (length mode-string) max-len)
|
|
3956 (setq mode-string
|
|
3957 (concat (gnus-truncate-string mode-string (- max-len 3))
|
|
3958 "...")))
|
|
3959 ;; Pad the mode string a bit.
|
|
3960 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
|
|
3961 ;; Update the mode line.
|
108
|
3962 (setq mode-line-buffer-identification
|
100
|
3963 (gnus-mode-line-buffer-identification (list mode-string)))
|
98
|
3964 (set-buffer-modified-p t))))
|
|
3965
|
|
3966 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
|
|
3967 "Go through the HEADERS list and add all Xrefs to a hash table.
|
|
3968 The resulting hash table is returned, or nil if no Xrefs were found."
|
|
3969 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3970 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
|
|
3971 (xref-hashtb (gnus-make-hashtable))
|
|
3972 start group entry number xrefs header)
|
|
3973 (while headers
|
|
3974 (setq header (pop headers))
|
|
3975 (when (and (setq xrefs (mail-header-xref header))
|
|
3976 (not (memq (setq number (mail-header-number header))
|
|
3977 unreads)))
|
|
3978 (setq start 0)
|
|
3979 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
|
|
3980 (setq start (match-end 0))
|
|
3981 (setq group (if prefix
|
|
3982 (concat prefix (substring xrefs (match-beginning 1)
|
|
3983 (match-end 1)))
|
|
3984 (substring xrefs (match-beginning 1) (match-end 1))))
|
|
3985 (setq number
|
|
3986 (string-to-int (substring xrefs (match-beginning 2)
|
|
3987 (match-end 2))))
|
|
3988 (if (setq entry (gnus-gethash group xref-hashtb))
|
|
3989 (setcdr entry (cons number (cdr entry)))
|
|
3990 (gnus-sethash group (cons number nil) xref-hashtb)))))
|
|
3991 (and start xref-hashtb)))
|
|
3992
|
|
3993 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
|
|
3994 "Look through all the headers and mark the Xrefs as read."
|
|
3995 (let ((virtual (gnus-virtual-group-p from-newsgroup))
|
|
3996 name entry info xref-hashtb idlist method nth4)
|
|
3997 (save-excursion
|
|
3998 (set-buffer gnus-group-buffer)
|
|
3999 (when (setq xref-hashtb
|
|
4000 (gnus-create-xref-hashtb from-newsgroup headers unreads))
|
|
4001 (mapatoms
|
|
4002 (lambda (group)
|
|
4003 (unless (string= from-newsgroup (setq name (symbol-name group)))
|
|
4004 (setq idlist (symbol-value group))
|
|
4005 ;; Dead groups are not updated.
|
|
4006 (and (prog1
|
|
4007 (setq entry (gnus-gethash name gnus-newsrc-hashtb)
|
|
4008 info (nth 2 entry))
|
|
4009 (when (stringp (setq nth4 (gnus-info-method info)))
|
|
4010 (setq nth4 (gnus-server-to-method nth4))))
|
|
4011 ;; Only do the xrefs if the group has the same
|
|
4012 ;; select method as the group we have just read.
|
|
4013 (or (gnus-methods-equal-p
|
|
4014 nth4 (gnus-find-method-for-group from-newsgroup))
|
|
4015 virtual
|
|
4016 (equal nth4 (setq method (gnus-find-method-for-group
|
|
4017 from-newsgroup)))
|
|
4018 (and (equal (car nth4) (car method))
|
|
4019 (equal (nth 1 nth4) (nth 1 method))))
|
|
4020 gnus-use-cross-reference
|
|
4021 (or (not (eq gnus-use-cross-reference t))
|
|
4022 virtual
|
|
4023 ;; Only do cross-references on subscribed
|
|
4024 ;; groups, if that is what is wanted.
|
|
4025 (<= (gnus-info-level info) gnus-level-subscribed))
|
|
4026 (gnus-group-make-articles-read name idlist))))
|
|
4027 xref-hashtb)))))
|
|
4028
|
|
4029 (defun gnus-group-make-articles-read (group articles)
|
112
|
4030 "Update the info of GROUP to say that ARTICLES are read."
|
98
|
4031 (let* ((num 0)
|
|
4032 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
4033 (info (nth 2 entry))
|
|
4034 (active (gnus-active group))
|
|
4035 range)
|
|
4036 ;; First peel off all illegal article numbers.
|
|
4037 (when active
|
|
4038 (let ((ids articles)
|
|
4039 id first)
|
|
4040 (while (setq id (pop ids))
|
|
4041 (when (and first (> id (cdr active)))
|
|
4042 ;; We'll end up in this situation in one particular
|
|
4043 ;; obscure situation. If you re-scan a group and get
|
|
4044 ;; a new article that is cross-posted to a different
|
|
4045 ;; group that has not been re-scanned, you might get
|
|
4046 ;; crossposted article that has a higher number than
|
|
4047 ;; Gnus believes possible. So we re-activate this
|
|
4048 ;; group as well. This might mean doing the
|
|
4049 ;; crossposting thingy will *increase* the number
|
|
4050 ;; of articles in some groups. Tsk, tsk.
|
|
4051 (setq active (or (gnus-activate-group group) active)))
|
|
4052 (when (or (> id (cdr active))
|
|
4053 (< id (car active)))
|
|
4054 (setq articles (delq id articles))))))
|
|
4055 (save-excursion
|
|
4056 (set-buffer gnus-group-buffer)
|
|
4057 (gnus-undo-register
|
|
4058 `(progn
|
|
4059 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
4060 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
4061 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
4062 (gnus-group-update-group ,group t))))
|
|
4063 ;; If the read list is nil, we init it.
|
|
4064 (and active
|
|
4065 (null (gnus-info-read info))
|
|
4066 (> (car active) 1)
|
|
4067 (gnus-info-set-read info (cons 1 (1- (car active)))))
|
|
4068 ;; Then we add the read articles to the range.
|
|
4069 (gnus-info-set-read
|
|
4070 info
|
|
4071 (setq range
|
|
4072 (gnus-add-to-range
|
|
4073 (gnus-info-read info) (setq articles (sort articles '<)))))
|
|
4074 ;; Then we have to re-compute how many unread
|
|
4075 ;; articles there are in this group.
|
|
4076 (when active
|
|
4077 (cond
|
|
4078 ((not range)
|
|
4079 (setq num (- (1+ (cdr active)) (car active))))
|
|
4080 ((not (listp (cdr range)))
|
|
4081 (setq num (- (cdr active) (- (1+ (cdr range))
|
|
4082 (car range)))))
|
|
4083 (t
|
|
4084 (while range
|
|
4085 (if (numberp (car range))
|
|
4086 (setq num (1+ num))
|
|
4087 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
|
|
4088 (setq range (cdr range)))
|
|
4089 (setq num (- (cdr active) num))))
|
|
4090 ;; Update the number of unread articles.
|
|
4091 (setcar entry num)
|
|
4092 ;; Update the group buffer.
|
|
4093 (gnus-group-update-group group t))))
|
|
4094
|
|
4095 (defun gnus-methods-equal-p (m1 m2)
|
|
4096 (let ((m1 (or m1 gnus-select-method))
|
|
4097 (m2 (or m2 gnus-select-method)))
|
|
4098 (or (equal m1 m2)
|
|
4099 (and (eq (car m1) (car m2))
|
|
4100 (or (not (memq 'address (assoc (symbol-name (car m1))
|
|
4101 gnus-valid-select-methods)))
|
|
4102 (equal (nth 1 m1) (nth 1 m2)))))))
|
|
4103
|
|
4104 (defvar gnus-newsgroup-none-id 0)
|
|
4105
|
|
4106 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
|
|
4107 (let ((cur nntp-server-buffer)
|
|
4108 (dependencies
|
|
4109 (or dependencies
|
|
4110 (save-excursion (set-buffer gnus-summary-buffer)
|
|
4111 gnus-newsgroup-dependencies)))
|
|
4112 headers id id-dep ref-dep end ref)
|
|
4113 (save-excursion
|
|
4114 (set-buffer nntp-server-buffer)
|
|
4115 ;; Translate all TAB characters into SPACE characters.
|
|
4116 (subst-char-in-region (point-min) (point-max) ?\t ? t)
|
|
4117 (run-hooks 'gnus-parse-headers-hook)
|
|
4118 (let ((case-fold-search t)
|
|
4119 in-reply-to header p lines)
|
|
4120 (goto-char (point-min))
|
|
4121 ;; Search to the beginning of the next header. Error messages
|
|
4122 ;; do not begin with 2 or 3.
|
|
4123 (while (re-search-forward "^[23][0-9]+ " nil t)
|
|
4124 (setq id nil
|
|
4125 ref nil)
|
|
4126 ;; This implementation of this function, with nine
|
|
4127 ;; search-forwards instead of the one re-search-forward and
|
|
4128 ;; a case (which basically was the old function) is actually
|
|
4129 ;; about twice as fast, even though it looks messier. You
|
|
4130 ;; can't have everything, I guess. Speed and elegance
|
|
4131 ;; doesn't always go hand in hand.
|
|
4132 (setq
|
|
4133 header
|
|
4134 (vector
|
|
4135 ;; Number.
|
|
4136 (prog1
|
|
4137 (read cur)
|
|
4138 (end-of-line)
|
|
4139 (setq p (point))
|
|
4140 (narrow-to-region (point)
|
|
4141 (or (and (search-forward "\n.\n" nil t)
|
|
4142 (- (point) 2))
|
|
4143 (point))))
|
|
4144 ;; Subject.
|
|
4145 (progn
|
|
4146 (goto-char p)
|
|
4147 (if (search-forward "\nsubject: " nil t)
|
|
4148 (nnheader-header-value) "(none)"))
|
|
4149 ;; From.
|
|
4150 (progn
|
|
4151 (goto-char p)
|
|
4152 (if (search-forward "\nfrom: " nil t)
|
|
4153 (nnheader-header-value) "(nobody)"))
|
|
4154 ;; Date.
|
|
4155 (progn
|
|
4156 (goto-char p)
|
|
4157 (if (search-forward "\ndate: " nil t)
|
|
4158 (nnheader-header-value) ""))
|
|
4159 ;; Message-ID.
|
|
4160 (progn
|
|
4161 (goto-char p)
|
112
|
4162 (setq id (if (search-forward "\nmessage-id:" nil t)
|
|
4163 (buffer-substring
|
|
4164 (1- (or (search-forward "<" nil t) (point)))
|
|
4165 (or (search-forward ">" nil t) (point)))
|
98
|
4166 ;; If there was no message-id, we just fake one
|
|
4167 ;; to make subsequent routines simpler.
|
|
4168 (nnheader-generate-fake-message-id))))
|
|
4169 ;; References.
|
|
4170 (progn
|
|
4171 (goto-char p)
|
|
4172 (if (search-forward "\nreferences: " nil t)
|
|
4173 (progn
|
|
4174 (setq end (point))
|
|
4175 (prog1
|
|
4176 (nnheader-header-value)
|
|
4177 (setq ref
|
|
4178 (buffer-substring
|
|
4179 (progn
|
|
4180 (end-of-line)
|
|
4181 (search-backward ">" end t)
|
|
4182 (1+ (point)))
|
|
4183 (progn
|
|
4184 (search-backward "<" end t)
|
|
4185 (point))))))
|
|
4186 ;; Get the references from the in-reply-to header if there
|
|
4187 ;; were no references and the in-reply-to header looks
|
|
4188 ;; promising.
|
|
4189 (if (and (search-forward "\nin-reply-to: " nil t)
|
|
4190 (setq in-reply-to (nnheader-header-value))
|
|
4191 (string-match "<[^>]+>" in-reply-to))
|
|
4192 (setq ref (substring in-reply-to (match-beginning 0)
|
|
4193 (match-end 0)))
|
|
4194 (setq ref nil))))
|
|
4195 ;; Chars.
|
|
4196 0
|
|
4197 ;; Lines.
|
|
4198 (progn
|
|
4199 (goto-char p)
|
|
4200 (if (search-forward "\nlines: " nil t)
|
136
|
4201 (if (numberp (setq lines (ignore-errors (read cur))))
|
98
|
4202 lines 0)
|
|
4203 0))
|
|
4204 ;; Xref.
|
|
4205 (progn
|
|
4206 (goto-char p)
|
|
4207 (and (search-forward "\nxref: " nil t)
|
|
4208 (nnheader-header-value)))))
|
|
4209 (when (equal id ref)
|
|
4210 (setq ref nil))
|
|
4211 ;; We do the threading while we read the headers. The
|
|
4212 ;; message-id and the last reference are both entered into
|
|
4213 ;; the same hash table. Some tippy-toeing around has to be
|
|
4214 ;; done in case an article has arrived before the article
|
|
4215 ;; which it refers to.
|
|
4216 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4217 (if (and (car (symbol-value id-dep))
|
|
4218 (not force-new))
|
114
|
4219 ;; An article with this Message-ID has already been seen.
|
|
4220 (if gnus-summary-ignore-duplicates
|
|
4221 ;; We ignore this one, except we add
|
|
4222 ;; any additional Xrefs (in case the two articles
|
|
4223 ;; came from different servers).
|
|
4224 (progn
|
|
4225 (mail-header-set-xref
|
|
4226 (car (symbol-value id-dep))
|
|
4227 (concat (or (mail-header-xref
|
|
4228 (car (symbol-value id-dep)))
|
|
4229 "")
|
|
4230 (or (mail-header-xref header) "")))
|
|
4231 (setq header nil))
|
|
4232 ;; We rename the Message-ID.
|
108
|
4233 (set
|
|
4234 (setq id-dep (intern (setq id (nnmail-message-id))
|
|
4235 dependencies))
|
|
4236 (list header))
|
|
4237 (mail-header-set-id header id))
|
98
|
4238 (setcar (symbol-value id-dep) header))
|
|
4239 (set id-dep (list header)))
|
|
4240 (when header
|
|
4241 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4242 (setcdr (symbol-value ref-dep)
|
|
4243 (nconc (cdr (symbol-value ref-dep))
|
|
4244 (list (symbol-value id-dep))))
|
|
4245 (set ref-dep (list nil (symbol-value id-dep))))
|
|
4246 (push header headers))
|
|
4247 (goto-char (point-max))
|
|
4248 (widen))
|
|
4249 (nreverse headers)))))
|
|
4250
|
|
4251 ;; The following macros and functions were written by Felix Lee
|
|
4252 ;; <flee@cse.psu.edu>.
|
|
4253
|
|
4254 (defmacro gnus-nov-read-integer ()
|
|
4255 '(prog1
|
|
4256 (if (= (following-char) ?\t)
|
|
4257 0
|
|
4258 (let ((num (ignore-errors (read buffer))))
|
|
4259 (if (numberp num) num 0)))
|
|
4260 (unless (eobp)
|
|
4261 (forward-char 1))))
|
|
4262
|
|
4263 (defmacro gnus-nov-skip-field ()
|
|
4264 '(search-forward "\t" eol 'move))
|
|
4265
|
|
4266 (defmacro gnus-nov-field ()
|
|
4267 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
|
|
4268
|
|
4269 ;; (defvar gnus-nov-none-counter 0)
|
|
4270
|
|
4271 ;; This function has to be called with point after the article number
|
|
4272 ;; on the beginning of the line.
|
|
4273 (defun gnus-nov-parse-line (number dependencies &optional force-new)
|
|
4274 (let ((eol (gnus-point-at-eol))
|
|
4275 (buffer (current-buffer))
|
|
4276 header ref id id-dep ref-dep)
|
|
4277
|
|
4278 ;; overview: [num subject from date id refs chars lines misc]
|
|
4279 (unwind-protect
|
|
4280 (progn
|
|
4281 (narrow-to-region (point) eol)
|
|
4282 (unless (eobp)
|
|
4283 (forward-char))
|
|
4284
|
|
4285 (setq header
|
|
4286 (vector
|
|
4287 number ; number
|
|
4288 (gnus-nov-field) ; subject
|
|
4289 (gnus-nov-field) ; from
|
|
4290 (gnus-nov-field) ; date
|
|
4291 (setq id (or (gnus-nov-field)
|
|
4292 (nnheader-generate-fake-message-id))) ; id
|
|
4293 (progn
|
|
4294 (let ((beg (point)))
|
|
4295 (search-forward "\t" eol)
|
|
4296 (if (search-backward ">" beg t)
|
|
4297 (setq ref
|
|
4298 (buffer-substring
|
|
4299 (1+ (point))
|
|
4300 (search-backward "<" beg t)))
|
|
4301 (setq ref nil))
|
|
4302 (goto-char beg))
|
|
4303 (gnus-nov-field)) ; refs
|
|
4304 (gnus-nov-read-integer) ; chars
|
|
4305 (gnus-nov-read-integer) ; lines
|
|
4306 (if (= (following-char) ?\n)
|
|
4307 nil
|
108
|
4308 (gnus-nov-field))))) ; misc
|
98
|
4309
|
|
4310 (widen))
|
|
4311
|
|
4312 ;; We build the thread tree.
|
|
4313 (when (equal id ref)
|
|
4314 ;; This article refers back to itself. Naughty, naughty.
|
|
4315 (setq ref nil))
|
|
4316 (if (boundp (setq id-dep (intern id dependencies)))
|
|
4317 (if (and (car (symbol-value id-dep))
|
|
4318 (not force-new))
|
114
|
4319 ;; An article with this Message-ID has already been seen.
|
|
4320 (if gnus-summary-ignore-duplicates
|
|
4321 ;; We ignore this one, except we add any additional
|
|
4322 ;; Xrefs (in case the two articles came from different
|
|
4323 ;; servers.
|
|
4324 (progn
|
|
4325 (mail-header-set-xref
|
|
4326 (car (symbol-value id-dep))
|
|
4327 (concat (or (mail-header-xref
|
|
4328 (car (symbol-value id-dep)))
|
|
4329 "")
|
|
4330 (or (mail-header-xref header) "")))
|
|
4331 (setq header nil))
|
|
4332 ;; We rename the Message-ID.
|
108
|
4333 (set
|
|
4334 (setq id-dep (intern (setq id (nnmail-message-id))
|
|
4335 dependencies))
|
|
4336 (list header))
|
|
4337 (mail-header-set-id header id))
|
98
|
4338 (setcar (symbol-value id-dep) header))
|
|
4339 (set id-dep (list header)))
|
|
4340 (when header
|
|
4341 (if (boundp (setq ref-dep (intern (or ref "none") dependencies)))
|
|
4342 (setcdr (symbol-value ref-dep)
|
|
4343 (nconc (cdr (symbol-value ref-dep))
|
|
4344 (list (symbol-value id-dep))))
|
|
4345 (set ref-dep (list nil (symbol-value id-dep)))))
|
|
4346 header))
|
|
4347
|
|
4348 ;; Goes through the xover lines and returns a list of vectors
|
108
|
4349 (defun gnus-get-newsgroup-headers-xover (sequence &optional
|
98
|
4350 force-new dependencies
|
|
4351 group also-fetch-heads)
|
|
4352 "Parse the news overview data in the server buffer, and return a
|
|
4353 list of headers that match SEQUENCE (see `nntp-retrieve-headers')."
|
|
4354 ;; Get the Xref when the users reads the articles since most/some
|
|
4355 ;; NNTP servers do not include Xrefs when using XOVER.
|
|
4356 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
|
|
4357 (let ((cur nntp-server-buffer)
|
|
4358 (dependencies (or dependencies gnus-newsgroup-dependencies))
|
|
4359 number headers header)
|
|
4360 (save-excursion
|
|
4361 (set-buffer nntp-server-buffer)
|
|
4362 ;; Allow the user to mangle the headers before parsing them.
|
|
4363 (run-hooks 'gnus-parse-headers-hook)
|
|
4364 (goto-char (point-min))
|
|
4365 (while (not (eobp))
|
|
4366 (condition-case ()
|
|
4367 (while (and sequence (not (eobp)))
|
|
4368 (setq number (read cur))
|
|
4369 (while (and sequence
|
|
4370 (< (car sequence) number))
|
|
4371 (setq sequence (cdr sequence)))
|
|
4372 (and sequence
|
|
4373 (eq number (car sequence))
|
|
4374 (progn
|
|
4375 (setq sequence (cdr sequence))
|
|
4376 (setq header (inline
|
|
4377 (gnus-nov-parse-line
|
|
4378 number dependencies force-new))))
|
|
4379 (push header headers))
|
|
4380 (forward-line 1))
|
|
4381 (error
|
|
4382 (gnus-error 4 "Strange nov line (%d)"
|
|
4383 (count-lines (point-min) (point)))))
|
|
4384 (forward-line 1))
|
|
4385 ;; A common bug in inn is that if you have posted an article and
|
|
4386 ;; then retrieves the active file, it will answer correctly --
|
|
4387 ;; the new article is included. However, a NOV entry for the
|
|
4388 ;; article may not have been generated yet, so this may fail.
|
|
4389 ;; We work around this problem by retrieving the last few
|
|
4390 ;; headers using HEAD.
|
|
4391 (if (or (not also-fetch-heads)
|
|
4392 (not sequence))
|
104
|
4393 ;; We (probably) got all the headers.
|
98
|
4394 (nreverse headers)
|
104
|
4395 (let ((gnus-nov-is-evil t))
|
98
|
4396 (nconc
|
|
4397 (nreverse headers)
|
|
4398 (when (gnus-retrieve-headers sequence group)
|
|
4399 (gnus-get-newsgroup-headers))))))))
|
|
4400
|
|
4401 (defun gnus-article-get-xrefs ()
|
|
4402 "Fill in the Xref value in `gnus-current-headers', if necessary.
|
|
4403 This is meant to be called in `gnus-article-internal-prepare-hook'."
|
|
4404 (let ((headers (save-excursion (set-buffer gnus-summary-buffer)
|
|
4405 gnus-current-headers)))
|
|
4406 (or (not gnus-use-cross-reference)
|
|
4407 (not headers)
|
|
4408 (and (mail-header-xref headers)
|
|
4409 (not (string= (mail-header-xref headers) "")))
|
|
4410 (let ((case-fold-search t)
|
|
4411 xref)
|
|
4412 (save-restriction
|
|
4413 (nnheader-narrow-to-headers)
|
|
4414 (goto-char (point-min))
|
|
4415 (when (or (and (eq (downcase (following-char)) ?x)
|
|
4416 (looking-at "Xref:"))
|
|
4417 (search-forward "\nXref:" nil t))
|
|
4418 (goto-char (1+ (match-end 0)))
|
|
4419 (setq xref (buffer-substring (point)
|
|
4420 (progn (end-of-line) (point))))
|
|
4421 (mail-header-set-xref headers xref)))))))
|
|
4422
|
|
4423 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
|
|
4424 "Find article ID and insert the summary line for that article."
|
|
4425 (let ((header (if (and old-header use-old-header)
|
|
4426 old-header (gnus-read-header id)))
|
|
4427 (number (and (numberp id) id))
|
|
4428 pos d)
|
|
4429 (when header
|
|
4430 ;; Rebuild the thread that this article is part of and go to the
|
|
4431 ;; article we have fetched.
|
|
4432 (when (and (not gnus-show-threads)
|
|
4433 old-header)
|
|
4434 (when (setq d (gnus-data-find (mail-header-number old-header)))
|
|
4435 (goto-char (gnus-data-pos d))
|
108
|
4436 (gnus-data-remove
|
98
|
4437 number
|
|
4438 (- (gnus-point-at-bol)
|
|
4439 (prog1
|
|
4440 (1+ (gnus-point-at-eol))
|
|
4441 (gnus-delete-line))))))
|
|
4442 (when old-header
|
|
4443 (mail-header-set-number header (mail-header-number old-header)))
|
|
4444 (setq gnus-newsgroup-sparse
|
|
4445 (delq (setq number (mail-header-number header))
|
|
4446 gnus-newsgroup-sparse))
|
|
4447 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
|
|
4448 (gnus-rebuild-thread (mail-header-id header))
|
|
4449 (gnus-summary-goto-subject number nil t))
|
|
4450 (when (and (numberp number)
|
|
4451 (> number 0))
|
|
4452 ;; We have to update the boundaries even if we can't fetch the
|
|
4453 ;; article if ID is a number -- so that the next `P' or `N'
|
|
4454 ;; command will fetch the previous (or next) article even
|
|
4455 ;; if the one we tried to fetch this time has been canceled.
|
|
4456 (when (> number gnus-newsgroup-end)
|
|
4457 (setq gnus-newsgroup-end number))
|
|
4458 (when (< number gnus-newsgroup-begin)
|
|
4459 (setq gnus-newsgroup-begin number))
|
|
4460 (setq gnus-newsgroup-unselected
|
|
4461 (delq number gnus-newsgroup-unselected)))
|
|
4462 ;; Report back a success?
|
|
4463 (and header (mail-header-number header))))
|
|
4464
|
|
4465 ;;; Process/prefix in the summary buffer
|
|
4466
|
|
4467 (defun gnus-summary-work-articles (n)
|
|
4468 "Return a list of articles to be worked upon. The prefix argument,
|
|
4469 the list of process marked articles, and the current article will be
|
|
4470 taken into consideration."
|
|
4471 (cond
|
|
4472 (n
|
|
4473 ;; A numerical prefix has been given.
|
|
4474 (setq n (prefix-numeric-value n))
|
|
4475 (let ((backward (< n 0))
|
|
4476 (n (abs (prefix-numeric-value n)))
|
|
4477 articles article)
|
|
4478 (save-excursion
|
|
4479 (while
|
|
4480 (and (> n 0)
|
|
4481 (push (setq article (gnus-summary-article-number))
|
|
4482 articles)
|
|
4483 (if backward
|
|
4484 (gnus-summary-find-prev nil article)
|
|
4485 (gnus-summary-find-next nil article)))
|
|
4486 (decf n)))
|
|
4487 (nreverse articles)))
|
|
4488 ((gnus-region-active-p)
|
|
4489 ;; Work on the region between point and mark.
|
|
4490 (let ((max (max (point) (mark)))
|
|
4491 articles article)
|
|
4492 (save-excursion
|
|
4493 (goto-char (min (point) (mark)))
|
|
4494 (while
|
|
4495 (and
|
|
4496 (push (setq article (gnus-summary-article-number)) articles)
|
|
4497 (gnus-summary-find-next nil article)
|
|
4498 (< (point) max)))
|
|
4499 (nreverse articles))))
|
|
4500 (gnus-newsgroup-processable
|
|
4501 ;; There are process-marked articles present.
|
|
4502 ;; Save current state.
|
|
4503 (gnus-summary-save-process-mark)
|
|
4504 ;; Return the list.
|
|
4505 (reverse gnus-newsgroup-processable))
|
|
4506 (t
|
|
4507 ;; Just return the current article.
|
|
4508 (list (gnus-summary-article-number)))))
|
|
4509
|
|
4510 (defun gnus-summary-save-process-mark ()
|
|
4511 "Push the current set of process marked articles on the stack."
|
|
4512 (interactive)
|
|
4513 (push (copy-sequence gnus-newsgroup-processable)
|
|
4514 gnus-newsgroup-process-stack))
|
|
4515
|
|
4516 (defun gnus-summary-kill-process-mark ()
|
|
4517 "Push the current set of process marked articles on the stack and unmark."
|
|
4518 (interactive)
|
|
4519 (gnus-summary-save-process-mark)
|
|
4520 (gnus-summary-unmark-all-processable))
|
|
4521
|
|
4522 (defun gnus-summary-yank-process-mark ()
|
|
4523 "Pop the last process mark state off the stack and restore it."
|
|
4524 (interactive)
|
|
4525 (unless gnus-newsgroup-process-stack
|
|
4526 (error "Empty mark stack"))
|
|
4527 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
|
|
4528
|
|
4529 (defun gnus-summary-process-mark-set (set)
|
|
4530 "Make SET into the current process marked articles."
|
|
4531 (gnus-summary-unmark-all-processable)
|
|
4532 (while set
|
|
4533 (gnus-summary-set-process-mark (pop set))))
|
|
4534
|
|
4535 ;;; Searching and stuff
|
|
4536
|
|
4537 (defun gnus-summary-search-group (&optional backward use-level)
|
|
4538 "Search for next unread newsgroup.
|
|
4539 If optional argument BACKWARD is non-nil, search backward instead."
|
|
4540 (save-excursion
|
|
4541 (set-buffer gnus-group-buffer)
|
|
4542 (when (gnus-group-search-forward
|
|
4543 backward nil (if use-level (gnus-group-group-level) nil))
|
|
4544 (gnus-group-group-name))))
|
|
4545
|
|
4546 (defun gnus-summary-best-group (&optional exclude-group)
|
|
4547 "Find the name of the best unread group.
|
|
4548 If EXCLUDE-GROUP, do not go to this group."
|
|
4549 (save-excursion
|
|
4550 (set-buffer gnus-group-buffer)
|
|
4551 (save-excursion
|
|
4552 (gnus-group-best-unread-group exclude-group))))
|
|
4553
|
|
4554 (defun gnus-summary-find-next (&optional unread article backward)
|
|
4555 (if backward (gnus-summary-find-prev)
|
|
4556 (let* ((dummy (gnus-summary-article-intangible-p))
|
|
4557 (article (or article (gnus-summary-article-number)))
|
|
4558 (arts (gnus-data-find-list article))
|
|
4559 result)
|
|
4560 (when (and (not dummy)
|
|
4561 (or (not gnus-summary-check-current)
|
|
4562 (not unread)
|
|
4563 (not (gnus-data-unread-p (car arts)))))
|
|
4564 (setq arts (cdr arts)))
|
|
4565 (when (setq result
|
|
4566 (if unread
|
|
4567 (progn
|
|
4568 (while arts
|
|
4569 (when (gnus-data-unread-p (car arts))
|
|
4570 (setq result (car arts)
|
|
4571 arts nil))
|
|
4572 (setq arts (cdr arts)))
|
|
4573 result)
|
|
4574 (car arts)))
|
|
4575 (goto-char (gnus-data-pos result))
|
|
4576 (gnus-data-number result)))))
|
|
4577
|
|
4578 (defun gnus-summary-find-prev (&optional unread article)
|
|
4579 (let* ((eobp (eobp))
|
|
4580 (article (or article (gnus-summary-article-number)))
|
|
4581 (arts (gnus-data-find-list article (gnus-data-list 'rev)))
|
|
4582 result)
|
|
4583 (when (and (not eobp)
|
|
4584 (or (not gnus-summary-check-current)
|
|
4585 (not unread)
|
|
4586 (not (gnus-data-unread-p (car arts)))))
|
|
4587 (setq arts (cdr arts)))
|
|
4588 (when (setq result
|
|
4589 (if unread
|
|
4590 (progn
|
|
4591 (while arts
|
|
4592 (when (gnus-data-unread-p (car arts))
|
|
4593 (setq result (car arts)
|
|
4594 arts nil))
|
|
4595 (setq arts (cdr arts)))
|
|
4596 result)
|
|
4597 (car arts)))
|
|
4598 (goto-char (gnus-data-pos result))
|
|
4599 (gnus-data-number result))))
|
|
4600
|
|
4601 (defun gnus-summary-find-subject (subject &optional unread backward article)
|
|
4602 (let* ((simp-subject (gnus-simplify-subject-fully subject))
|
|
4603 (article (or article (gnus-summary-article-number)))
|
|
4604 (articles (gnus-data-list backward))
|
|
4605 (arts (gnus-data-find-list article articles))
|
|
4606 result)
|
|
4607 (when (or (not gnus-summary-check-current)
|
|
4608 (not unread)
|
|
4609 (not (gnus-data-unread-p (car arts))))
|
|
4610 (setq arts (cdr arts)))
|
|
4611 (while arts
|
|
4612 (and (or (not unread)
|
|
4613 (gnus-data-unread-p (car arts)))
|
|
4614 (vectorp (gnus-data-header (car arts)))
|
|
4615 (gnus-subject-equal
|
|
4616 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
|
|
4617 (setq result (car arts)
|
|
4618 arts nil))
|
|
4619 (setq arts (cdr arts)))
|
|
4620 (and result
|
|
4621 (goto-char (gnus-data-pos result))
|
|
4622 (gnus-data-number result))))
|
|
4623
|
|
4624 (defun gnus-summary-search-forward (&optional unread subject backward)
|
|
4625 "Search forward for an article.
|
|
4626 If UNREAD, look for unread articles. If SUBJECT, look for
|
|
4627 articles with that subject. If BACKWARD, search backward instead."
|
|
4628 (cond (subject (gnus-summary-find-subject subject unread backward))
|
|
4629 (backward (gnus-summary-find-prev unread))
|
|
4630 (t (gnus-summary-find-next unread))))
|
|
4631
|
|
4632 (defun gnus-recenter (&optional n)
|
|
4633 "Center point in window and redisplay frame.
|
|
4634 Also do horizontal recentering."
|
|
4635 (interactive "P")
|
|
4636 (when (and gnus-auto-center-summary
|
|
4637 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4638 (gnus-horizontal-recenter))
|
|
4639 (recenter n))
|
|
4640
|
|
4641 (defun gnus-summary-recenter ()
|
|
4642 "Center point in the summary window.
|
|
4643 If `gnus-auto-center-summary' is nil, or the article buffer isn't
|
|
4644 displayed, no centering will be performed."
|
|
4645 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
|
|
4646 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
|
|
4647 (let* ((top (cond ((< (window-height) 4) 0)
|
|
4648 ((< (window-height) 7) 1)
|
|
4649 (t 2)))
|
|
4650 (height (1- (window-height)))
|
|
4651 (bottom (save-excursion (goto-char (point-max))
|
|
4652 (forward-line (- height))
|
|
4653 (point)))
|
|
4654 (window (get-buffer-window (current-buffer))))
|
|
4655 ;; The user has to want it.
|
|
4656 (when gnus-auto-center-summary
|
|
4657 (when (get-buffer-window gnus-article-buffer)
|
|
4658 ;; Only do recentering when the article buffer is displayed,
|
|
4659 ;; Set the window start to either `bottom', which is the biggest
|
|
4660 ;; possible valid number, or the second line from the top,
|
|
4661 ;; whichever is the least.
|
|
4662 (set-window-start
|
108
|
4663 window (min bottom (save-excursion
|
98
|
4664 (forward-line (- top)) (point)))))
|
|
4665 ;; Do horizontal recentering while we're at it.
|
|
4666 (when (and (get-buffer-window (current-buffer) t)
|
|
4667 (not (eq gnus-auto-center-summary 'vertical)))
|
|
4668 (let ((selected (selected-window)))
|
|
4669 (select-window (get-buffer-window (current-buffer) t))
|
|
4670 (gnus-summary-position-point)
|
|
4671 (gnus-horizontal-recenter)
|
|
4672 (select-window selected))))))
|
|
4673
|
|
4674 (defun gnus-summary-jump-to-group (newsgroup)
|
|
4675 "Move point to NEWSGROUP in group mode buffer."
|
|
4676 ;; Keep update point of group mode buffer if visible.
|
|
4677 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
|
|
4678 (save-window-excursion
|
|
4679 ;; Take care of tree window mode.
|
|
4680 (when (get-buffer-window gnus-group-buffer)
|
|
4681 (pop-to-buffer gnus-group-buffer))
|
|
4682 (gnus-group-jump-to-group newsgroup))
|
|
4683 (save-excursion
|
|
4684 ;; Take care of tree window mode.
|
|
4685 (if (get-buffer-window gnus-group-buffer)
|
|
4686 (pop-to-buffer gnus-group-buffer)
|
|
4687 (set-buffer gnus-group-buffer))
|
|
4688 (gnus-group-jump-to-group newsgroup))))
|
|
4689
|
|
4690 ;; This function returns a list of article numbers based on the
|
|
4691 ;; difference between the ranges of read articles in this group and
|
|
4692 ;; the range of active articles.
|
|
4693 (defun gnus-list-of-unread-articles (group)
|
|
4694 (let* ((read (gnus-info-read (gnus-get-info group)))
|
|
4695 (active (or (gnus-active group) (gnus-activate-group group)))
|
|
4696 (last (cdr active))
|
|
4697 first nlast unread)
|
|
4698 ;; If none are read, then all are unread.
|
|
4699 (if (not read)
|
|
4700 (setq first (car active))
|
|
4701 ;; If the range of read articles is a single range, then the
|
|
4702 ;; first unread article is the article after the last read
|
|
4703 ;; article. Sounds logical, doesn't it?
|
|
4704 (if (not (listp (cdr read)))
|
|
4705 (setq first (1+ (cdr read)))
|
|
4706 ;; `read' is a list of ranges.
|
|
4707 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
|
|
4708 (caar read)))
|
|
4709 1)
|
|
4710 (setq first 1))
|
|
4711 (while read
|
|
4712 (when first
|
|
4713 (while (< first nlast)
|
|
4714 (push first unread)
|
|
4715 (setq first (1+ first))))
|
|
4716 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
|
|
4717 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
|
|
4718 (setq read (cdr read)))))
|
|
4719 ;; And add the last unread articles.
|
|
4720 (while (<= first last)
|
|
4721 (push first unread)
|
|
4722 (setq first (1+ first)))
|
|
4723 ;; Return the list of unread articles.
|
|
4724 (nreverse unread)))
|
|
4725
|
|
4726 (defun gnus-list-of-read-articles (group)
|
|
4727 "Return a list of unread, unticked and non-dormant articles."
|
|
4728 (let* ((info (gnus-get-info group))
|
|
4729 (marked (gnus-info-marks info))
|
|
4730 (active (gnus-active group)))
|
|
4731 (and info active
|
|
4732 (gnus-set-difference
|
|
4733 (gnus-sorted-complement
|
|
4734 (gnus-uncompress-range active)
|
|
4735 (gnus-list-of-unread-articles group))
|
|
4736 (append
|
|
4737 (gnus-uncompress-range (cdr (assq 'dormant marked)))
|
|
4738 (gnus-uncompress-range (cdr (assq 'tick marked))))))))
|
|
4739
|
|
4740 ;; Various summary commands
|
|
4741
|
|
4742 (defun gnus-summary-universal-argument (arg)
|
|
4743 "Perform any operation on all articles that are process/prefixed."
|
|
4744 (interactive "P")
|
|
4745 (gnus-set-global-variables)
|
|
4746 (let ((articles (gnus-summary-work-articles arg))
|
|
4747 func article)
|
|
4748 (if (eq
|
|
4749 (setq
|
|
4750 func
|
|
4751 (key-binding
|
|
4752 (read-key-sequence
|
|
4753 (substitute-command-keys
|
|
4754 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"
|
|
4755 ))))
|
|
4756 'undefined)
|
|
4757 (gnus-error 1 "Undefined key")
|
|
4758 (save-excursion
|
|
4759 (while articles
|
|
4760 (gnus-summary-goto-subject (setq article (pop articles)))
|
|
4761 (let (gnus-newsgroup-processable)
|
|
4762 (command-execute func))
|
|
4763 (gnus-summary-remove-process-mark article)))))
|
|
4764 (gnus-summary-position-point))
|
|
4765
|
|
4766 (defun gnus-summary-toggle-truncation (&optional arg)
|
|
4767 "Toggle truncation of summary lines.
|
|
4768 With arg, turn line truncation on iff arg is positive."
|
|
4769 (interactive "P")
|
|
4770 (setq truncate-lines
|
|
4771 (if (null arg) (not truncate-lines)
|
|
4772 (> (prefix-numeric-value arg) 0)))
|
|
4773 (redraw-display))
|
|
4774
|
|
4775 (defun gnus-summary-reselect-current-group (&optional all rescan)
|
|
4776 "Exit and then reselect the current newsgroup.
|
|
4777 The prefix argument ALL means to select all articles."
|
|
4778 (interactive "P")
|
|
4779 (gnus-set-global-variables)
|
|
4780 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4781 (error "Ephemeral groups can't be reselected"))
|
|
4782 (let ((current-subject (gnus-summary-article-number))
|
|
4783 (group gnus-newsgroup-name))
|
|
4784 (setq gnus-newsgroup-begin nil)
|
|
4785 (gnus-summary-exit)
|
108
|
4786 ;; We have to adjust the point of group mode buffer because
|
98
|
4787 ;; point was moved to the next unread newsgroup by exiting.
|
|
4788 (gnus-summary-jump-to-group group)
|
|
4789 (when rescan
|
|
4790 (save-excursion
|
|
4791 (gnus-group-get-new-news-this-group 1)))
|
|
4792 (gnus-group-read-group all t)
|
|
4793 (gnus-summary-goto-subject current-subject nil t)))
|
|
4794
|
|
4795 (defun gnus-summary-rescan-group (&optional all)
|
|
4796 "Exit the newsgroup, ask for new articles, and select the newsgroup."
|
|
4797 (interactive "P")
|
|
4798 (gnus-summary-reselect-current-group all t))
|
|
4799
|
|
4800 (defun gnus-summary-update-info (&optional non-destructive)
|
|
4801 (save-excursion
|
|
4802 (let ((group gnus-newsgroup-name))
|
|
4803 (when gnus-newsgroup-kill-headers
|
|
4804 (setq gnus-newsgroup-killed
|
|
4805 (gnus-compress-sequence
|
|
4806 (nconc
|
|
4807 (gnus-set-sorted-intersection
|
|
4808 (gnus-uncompress-range gnus-newsgroup-killed)
|
|
4809 (setq gnus-newsgroup-unselected
|
|
4810 (sort gnus-newsgroup-unselected '<)))
|
|
4811 (setq gnus-newsgroup-unreads
|
|
4812 (sort gnus-newsgroup-unreads '<)))
|
|
4813 t)))
|
|
4814 (unless (listp (cdr gnus-newsgroup-killed))
|
|
4815 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
|
|
4816 (let ((headers gnus-newsgroup-headers))
|
|
4817 (when (and (not gnus-save-score)
|
|
4818 (not non-destructive))
|
|
4819 (setq gnus-newsgroup-scored nil))
|
|
4820 ;; Set the new ranges of read articles.
|
142
|
4821 (save-excursion
|
|
4822 (set-buffer gnus-group-buffer)
|
|
4823 (gnus-undo-force-boundary))
|
98
|
4824 (gnus-update-read-articles
|
|
4825 group (append gnus-newsgroup-unreads gnus-newsgroup-unselected))
|
|
4826 ;; Set the current article marks.
|
|
4827 (gnus-update-marks)
|
|
4828 ;; Do the cross-ref thing.
|
|
4829 (when gnus-use-cross-reference
|
|
4830 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
|
|
4831 ;; Do adaptive scoring, and possibly save score files.
|
|
4832 (when gnus-newsgroup-adaptive
|
|
4833 (gnus-score-adaptive))
|
|
4834 (when gnus-use-scoring
|
|
4835 (gnus-score-save))
|
|
4836 ;; Do not switch windows but change the buffer to work.
|
|
4837 (set-buffer gnus-group-buffer)
|
|
4838 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
4839 (gnus-group-update-group group))))))
|
|
4840
|
|
4841 (defun gnus-summary-save-newsrc (&optional force)
|
|
4842 "Save the current number of read/marked articles in the dribble buffer.
|
|
4843 The dribble buffer will then be saved.
|
|
4844 If FORCE (the prefix), also save the .newsrc file(s)."
|
|
4845 (interactive "P")
|
|
4846 (gnus-summary-update-info t)
|
|
4847 (if force
|
|
4848 (gnus-save-newsrc-file)
|
|
4849 (gnus-dribble-save)))
|
|
4850
|
|
4851 (defun gnus-summary-exit (&optional temporary)
|
|
4852 "Exit reading current newsgroup, and then return to group selection mode.
|
|
4853 gnus-exit-group-hook is called with no arguments if that value is non-nil."
|
|
4854 (interactive)
|
|
4855 (gnus-set-global-variables)
|
|
4856 (gnus-kill-save-kill-buffer)
|
|
4857 (let* ((group gnus-newsgroup-name)
|
|
4858 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
|
|
4859 (mode major-mode)
|
140
|
4860 (group-point nil)
|
98
|
4861 (buf (current-buffer)))
|
|
4862 (run-hooks 'gnus-summary-prepare-exit-hook)
|
|
4863 ;; If we have several article buffers, we kill them at exit.
|
|
4864 (unless gnus-single-article-buffer
|
|
4865 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4866 (setq gnus-article-current nil))
|
|
4867 (when gnus-use-cache
|
|
4868 (gnus-cache-possibly-remove-articles)
|
|
4869 (gnus-cache-save-buffers))
|
|
4870 (gnus-async-prefetch-remove-group group)
|
|
4871 (when gnus-suppress-duplicates
|
|
4872 (gnus-dup-enter-articles))
|
|
4873 (when gnus-use-trees
|
|
4874 (gnus-tree-close group))
|
|
4875 ;; Make all changes in this group permanent.
|
|
4876 (unless quit-config
|
|
4877 (run-hooks 'gnus-exit-group-hook)
|
|
4878 (gnus-summary-update-info))
|
|
4879 (gnus-close-group group)
|
124
|
4880 ;; Make sure where we were, and go to next newsgroup.
|
98
|
4881 (set-buffer gnus-group-buffer)
|
|
4882 (unless quit-config
|
|
4883 (gnus-group-jump-to-group group))
|
|
4884 (run-hooks 'gnus-summary-exit-hook)
|
|
4885 (unless quit-config
|
|
4886 (gnus-group-next-unread-group 1))
|
140
|
4887 (setq group-point (point))
|
98
|
4888 (if temporary
|
|
4889 nil ;Nothing to do.
|
|
4890 ;; If we have several article buffers, we kill them at exit.
|
|
4891 (unless gnus-single-article-buffer
|
|
4892 (gnus-kill-buffer gnus-article-buffer)
|
|
4893 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4894 (setq gnus-article-current nil))
|
|
4895 (set-buffer buf)
|
|
4896 (if (not gnus-kill-summary-on-exit)
|
|
4897 (gnus-deaden-summary)
|
|
4898 ;; We set all buffer-local variables to nil. It is unclear why
|
|
4899 ;; this is needed, but if we don't, buffer-local variables are
|
|
4900 ;; not garbage-collected, it seems. This would the lead to en
|
|
4901 ;; ever-growing Emacs.
|
|
4902 (gnus-summary-clear-local-variables)
|
|
4903 (when (get-buffer gnus-article-buffer)
|
|
4904 (bury-buffer gnus-article-buffer))
|
|
4905 ;; We clear the global counterparts of the buffer-local
|
|
4906 ;; variables as well, just to be on the safe side.
|
|
4907 (set-buffer gnus-group-buffer)
|
|
4908 (gnus-summary-clear-local-variables)
|
|
4909 ;; Return to group mode buffer.
|
|
4910 (when (eq mode 'gnus-summary-mode)
|
|
4911 (gnus-kill-buffer buf)))
|
|
4912 (setq gnus-current-select-method gnus-select-method)
|
|
4913 (pop-to-buffer gnus-group-buffer)
|
|
4914 ;; Clear the current group name.
|
|
4915 (if (not quit-config)
|
|
4916 (progn
|
140
|
4917 (goto-char group-point)
|
98
|
4918 (gnus-configure-windows 'group 'force))
|
|
4919 (gnus-handle-ephemeral-exit quit-config))
|
|
4920 (unless quit-config
|
|
4921 (setq gnus-newsgroup-name nil)))))
|
|
4922
|
|
4923 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
|
|
4924 (defun gnus-summary-exit-no-update (&optional no-questions)
|
|
4925 "Quit reading current newsgroup without updating read article info."
|
|
4926 (interactive)
|
|
4927 (gnus-set-global-variables)
|
|
4928 (let* ((group gnus-newsgroup-name)
|
|
4929 (quit-config (gnus-group-quit-config group)))
|
|
4930 (when (or no-questions
|
|
4931 gnus-expert-user
|
|
4932 (gnus-y-or-n-p "Discard changes to this group and exit? "))
|
|
4933 ;; If we have several article buffers, we kill them at exit.
|
|
4934 (unless gnus-single-article-buffer
|
|
4935 (gnus-kill-buffer gnus-article-buffer)
|
|
4936 (gnus-kill-buffer gnus-original-article-buffer)
|
|
4937 (setq gnus-article-current nil))
|
|
4938 (if (not gnus-kill-summary-on-exit)
|
|
4939 (gnus-deaden-summary)
|
|
4940 (gnus-close-group group)
|
|
4941 (gnus-summary-clear-local-variables)
|
|
4942 (set-buffer gnus-group-buffer)
|
|
4943 (gnus-summary-clear-local-variables)
|
|
4944 (when (get-buffer gnus-summary-buffer)
|
|
4945 (kill-buffer gnus-summary-buffer)))
|
|
4946 (unless gnus-single-article-buffer
|
|
4947 (setq gnus-article-current nil))
|
|
4948 (when gnus-use-trees
|
|
4949 (gnus-tree-close group))
|
|
4950 (gnus-async-prefetch-remove-group group)
|
|
4951 (when (get-buffer gnus-article-buffer)
|
|
4952 (bury-buffer gnus-article-buffer))
|
|
4953 ;; Return to the group buffer.
|
|
4954 (gnus-configure-windows 'group 'force)
|
|
4955 ;; Clear the current group name.
|
|
4956 (setq gnus-newsgroup-name nil)
|
|
4957 (when (equal (gnus-group-group-name) group)
|
|
4958 (gnus-group-next-unread-group 1))
|
|
4959 (when quit-config
|
|
4960 (gnus-handle-ephemeral-exit quit-config)))))
|
|
4961
|
|
4962 (defun gnus-handle-ephemeral-exit (quit-config)
|
|
4963 "Handle movement when leaving an ephemeral group. The state
|
|
4964 which existed when entering the ephemeral is reset."
|
|
4965 (if (not (buffer-name (car quit-config)))
|
|
4966 (gnus-configure-windows 'group 'force)
|
|
4967 (set-buffer (car quit-config))
|
|
4968 (cond ((eq major-mode 'gnus-summary-mode)
|
|
4969 (gnus-set-global-variables))
|
|
4970 ((eq major-mode 'gnus-article-mode)
|
|
4971 (save-excursion
|
|
4972 ;; The `gnus-summary-buffer' variable may point
|
|
4973 ;; to the old summary buffer when using a single
|
|
4974 ;; article buffer.
|
|
4975 (unless (gnus-buffer-live-p gnus-summary-buffer)
|
|
4976 (set-buffer gnus-group-buffer))
|
|
4977 (set-buffer gnus-summary-buffer)
|
|
4978 (gnus-set-global-variables))))
|
|
4979 (if (or (eq (cdr quit-config) 'article)
|
|
4980 (eq (cdr quit-config) 'pick))
|
|
4981 (progn
|
|
4982 ;; The current article may be from the ephemeral group
|
|
4983 ;; thus it is best that we reload this article
|
|
4984 (gnus-summary-show-article)
|
|
4985 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
|
|
4986 (gnus-configure-windows 'pick 'force)
|
|
4987 (gnus-configure-windows (cdr quit-config) 'force)))
|
|
4988 (gnus-configure-windows (cdr quit-config) 'force))
|
|
4989 (when (eq major-mode 'gnus-summary-mode)
|
|
4990 (gnus-summary-next-subject 1 nil t)
|
|
4991 (gnus-summary-recenter)
|
|
4992 (gnus-summary-position-point))))
|
|
4993
|
|
4994 ;;; Dead summaries.
|
|
4995
|
|
4996 (defvar gnus-dead-summary-mode-map nil)
|
|
4997
|
|
4998 (unless gnus-dead-summary-mode-map
|
|
4999 (setq gnus-dead-summary-mode-map (make-keymap))
|
|
5000 (suppress-keymap gnus-dead-summary-mode-map)
|
|
5001 (substitute-key-definition
|
|
5002 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
|
163
|
5003 (let ((keys '("\C-d" "\r" "\177" [backspace] [delete])))
|
98
|
5004 (while keys
|
|
5005 (define-key gnus-dead-summary-mode-map
|
|
5006 (pop keys) 'gnus-summary-wake-up-the-dead))))
|
|
5007
|
|
5008 (defvar gnus-dead-summary-mode nil
|
|
5009 "Minor mode for Gnus summary buffers.")
|
|
5010
|
|
5011 (defun gnus-dead-summary-mode (&optional arg)
|
|
5012 "Minor mode for Gnus summary buffers."
|
|
5013 (interactive "P")
|
|
5014 (when (eq major-mode 'gnus-summary-mode)
|
|
5015 (make-local-variable 'gnus-dead-summary-mode)
|
|
5016 (setq gnus-dead-summary-mode
|
|
5017 (if (null arg) (not gnus-dead-summary-mode)
|
|
5018 (> (prefix-numeric-value arg) 0)))
|
|
5019 (when gnus-dead-summary-mode
|
|
5020 (unless (assq 'gnus-dead-summary-mode minor-mode-alist)
|
|
5021 (push '(gnus-dead-summary-mode " Dead") minor-mode-alist))
|
|
5022 (unless (assq 'gnus-dead-summary-mode minor-mode-map-alist)
|
|
5023 (push (cons 'gnus-dead-summary-mode gnus-dead-summary-mode-map)
|
|
5024 minor-mode-map-alist)))))
|
|
5025
|
|
5026 (defun gnus-deaden-summary ()
|
|
5027 "Make the current summary buffer into a dead summary buffer."
|
|
5028 ;; Kill any previous dead summary buffer.
|
|
5029 (when (and gnus-dead-summary
|
|
5030 (buffer-name gnus-dead-summary))
|
|
5031 (save-excursion
|
|
5032 (set-buffer gnus-dead-summary)
|
|
5033 (when gnus-dead-summary-mode
|
|
5034 (kill-buffer (current-buffer)))))
|
|
5035 ;; Make this the current dead summary.
|
|
5036 (setq gnus-dead-summary (current-buffer))
|
|
5037 (gnus-dead-summary-mode 1)
|
|
5038 (let ((name (buffer-name)))
|
|
5039 (when (string-match "Summary" name)
|
|
5040 (rename-buffer
|
|
5041 (concat (substring name 0 (match-beginning 0)) "Dead "
|
|
5042 (substring name (match-beginning 0)))
|
|
5043 t))))
|
|
5044
|
|
5045 (defun gnus-kill-or-deaden-summary (buffer)
|
|
5046 "Kill or deaden the summary BUFFER."
|
|
5047 (when (and (buffer-name buffer)
|
|
5048 (not gnus-single-article-buffer))
|
|
5049 (save-excursion
|
|
5050 (set-buffer buffer)
|
|
5051 (gnus-kill-buffer gnus-article-buffer)
|
|
5052 (gnus-kill-buffer gnus-original-article-buffer)))
|
|
5053 (cond (gnus-kill-summary-on-exit
|
|
5054 (when (and gnus-use-trees
|
|
5055 (and (get-buffer buffer)
|
|
5056 (buffer-name (get-buffer buffer))))
|
|
5057 (save-excursion
|
|
5058 (set-buffer (get-buffer buffer))
|
|
5059 (gnus-tree-close gnus-newsgroup-name)))
|
|
5060 (gnus-kill-buffer buffer))
|
|
5061 ((and (get-buffer buffer)
|
|
5062 (buffer-name (get-buffer buffer)))
|
|
5063 (save-excursion
|
|
5064 (set-buffer buffer)
|
|
5065 (gnus-deaden-summary)))))
|
|
5066
|
|
5067 (defun gnus-summary-wake-up-the-dead (&rest args)
|
|
5068 "Wake up the dead summary buffer."
|
|
5069 (interactive)
|
|
5070 (gnus-dead-summary-mode -1)
|
|
5071 (let ((name (buffer-name)))
|
|
5072 (when (string-match "Dead " name)
|
|
5073 (rename-buffer
|
|
5074 (concat (substring name 0 (match-beginning 0))
|
|
5075 (substring name (match-end 0)))
|
|
5076 t)))
|
|
5077 (gnus-message 3 "This dead summary is now alive again"))
|
|
5078
|
|
5079 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
|
|
5080 (defun gnus-summary-fetch-faq (&optional faq-dir)
|
|
5081 "Fetch the FAQ for the current group.
|
|
5082 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
|
|
5083 in."
|
|
5084 (interactive
|
|
5085 (list
|
|
5086 (when current-prefix-arg
|
|
5087 (completing-read
|
|
5088 "Faq dir: " (and (listp gnus-group-faq-directory)
|
163
|
5089 (mapcar (lambda (file) (list file))
|
|
5090 gnus-group-faq-directory))))))
|
98
|
5091 (let (gnus-faq-buffer)
|
|
5092 (when (setq gnus-faq-buffer
|
|
5093 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
|
|
5094 (gnus-configure-windows 'summary-faq))))
|
|
5095
|
|
5096 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
5097 (defun gnus-summary-describe-group (&optional force)
|
|
5098 "Describe the current newsgroup."
|
|
5099 (interactive "P")
|
|
5100 (gnus-group-describe-group force gnus-newsgroup-name))
|
|
5101
|
|
5102 (defun gnus-summary-describe-briefly ()
|
|
5103 "Describe summary mode commands briefly."
|
|
5104 (interactive)
|
|
5105 (gnus-message 6
|
|
5106 (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")))
|
|
5107
|
|
5108 ;; Walking around group mode buffer from summary mode.
|
|
5109
|
|
5110 (defun gnus-summary-next-group (&optional no-article target-group backward)
|
|
5111 "Exit current newsgroup and then select next unread newsgroup.
|
|
5112 If prefix argument NO-ARTICLE is non-nil, no article is selected
|
|
5113 initially. If NEXT-GROUP, go to this group. If BACKWARD, go to
|
|
5114 previous group instead."
|
|
5115 (interactive "P")
|
|
5116 (gnus-set-global-variables)
|
|
5117 ;; Stop pre-fetching.
|
|
5118 (gnus-async-halt-prefetch)
|
|
5119 (let ((current-group gnus-newsgroup-name)
|
|
5120 (current-buffer (current-buffer))
|
|
5121 entered)
|
|
5122 ;; First we semi-exit this group to update Xrefs and all variables.
|
|
5123 ;; We can't do a real exit, because the window conf must remain
|
|
5124 ;; the same in case the user is prompted for info, and we don't
|
|
5125 ;; want the window conf to change before that...
|
|
5126 (gnus-summary-exit t)
|
|
5127 (while (not entered)
|
|
5128 ;; Then we find what group we are supposed to enter.
|
|
5129 (set-buffer gnus-group-buffer)
|
|
5130 (gnus-group-jump-to-group current-group)
|
|
5131 (setq target-group
|
|
5132 (or target-group
|
|
5133 (if (eq gnus-keep-same-level 'best)
|
|
5134 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5135 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5136 (if (not target-group)
|
|
5137 ;; There are no further groups, so we return to the group
|
|
5138 ;; buffer.
|
|
5139 (progn
|
|
5140 (gnus-message 5 "Returning to the group buffer")
|
|
5141 (setq entered t)
|
122
|
5142 (when (gnus-buffer-live-p current-buffer)
|
120
|
5143 (set-buffer current-buffer)
|
|
5144 (gnus-summary-exit))
|
98
|
5145 (run-hooks 'gnus-group-no-more-groups-hook))
|
|
5146 ;; We try to enter the target group.
|
|
5147 (gnus-group-jump-to-group target-group)
|
|
5148 (let ((unreads (gnus-group-group-unread)))
|
|
5149 (if (and (or (eq t unreads)
|
|
5150 (and unreads (not (zerop unreads))))
|
|
5151 (gnus-summary-read-group
|
151
|
5152 target-group nil no-article
|
|
5153 (and (buffer-name current-buffer) current-buffer)))
|
98
|
5154 (setq entered t)
|
|
5155 (setq current-group target-group
|
|
5156 target-group nil)))))))
|
|
5157
|
|
5158 (defun gnus-summary-prev-group (&optional no-article)
|
|
5159 "Exit current newsgroup and then select previous unread newsgroup.
|
|
5160 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
|
|
5161 (interactive "P")
|
|
5162 (gnus-summary-next-group no-article nil t))
|
|
5163
|
|
5164 ;; Walking around summary lines.
|
|
5165
|
|
5166 (defun gnus-summary-first-subject (&optional unread)
|
|
5167 "Go to the first unread subject.
|
|
5168 If UNREAD is non-nil, go to the first unread article.
|
|
5169 Returns the article selected or nil if there are no unread articles."
|
|
5170 (interactive "P")
|
|
5171 (prog1
|
|
5172 (cond
|
|
5173 ;; Empty summary.
|
|
5174 ((null gnus-newsgroup-data)
|
|
5175 (gnus-message 3 "No articles in the group")
|
|
5176 nil)
|
|
5177 ;; Pick the first article.
|
|
5178 ((not unread)
|
|
5179 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
|
|
5180 (gnus-data-number (car gnus-newsgroup-data)))
|
|
5181 ;; No unread articles.
|
|
5182 ((null gnus-newsgroup-unreads)
|
|
5183 (gnus-message 3 "No more unread articles")
|
|
5184 nil)
|
|
5185 ;; Find the first unread article.
|
|
5186 (t
|
|
5187 (let ((data gnus-newsgroup-data))
|
|
5188 (while (and data
|
|
5189 (not (gnus-data-unread-p (car data))))
|
|
5190 (setq data (cdr data)))
|
|
5191 (when data
|
|
5192 (goto-char (gnus-data-pos (car data)))
|
|
5193 (gnus-data-number (car data))))))
|
|
5194 (gnus-summary-position-point)))
|
|
5195
|
|
5196 (defun gnus-summary-next-subject (n &optional unread dont-display)
|
|
5197 "Go to next N'th summary line.
|
|
5198 If N is negative, go to the previous N'th subject line.
|
|
5199 If UNREAD is non-nil, only unread articles are selected.
|
|
5200 The difference between N and the actual number of steps taken is
|
|
5201 returned."
|
|
5202 (interactive "p")
|
|
5203 (let ((backward (< n 0))
|
|
5204 (n (abs n)))
|
|
5205 (while (and (> n 0)
|
|
5206 (if backward
|
|
5207 (gnus-summary-find-prev unread)
|
|
5208 (gnus-summary-find-next unread)))
|
|
5209 (setq n (1- n)))
|
|
5210 (when (/= 0 n)
|
|
5211 (gnus-message 7 "No more%s articles"
|
|
5212 (if unread " unread" "")))
|
|
5213 (unless dont-display
|
|
5214 (gnus-summary-recenter)
|
|
5215 (gnus-summary-position-point))
|
|
5216 n))
|
|
5217
|
|
5218 (defun gnus-summary-next-unread-subject (n)
|
|
5219 "Go to next N'th unread summary line."
|
|
5220 (interactive "p")
|
|
5221 (gnus-summary-next-subject n t))
|
|
5222
|
|
5223 (defun gnus-summary-prev-subject (n &optional unread)
|
|
5224 "Go to previous N'th summary line.
|
|
5225 If optional argument UNREAD is non-nil, only unread article is selected."
|
|
5226 (interactive "p")
|
|
5227 (gnus-summary-next-subject (- n) unread))
|
|
5228
|
|
5229 (defun gnus-summary-prev-unread-subject (n)
|
|
5230 "Go to previous N'th unread summary line."
|
|
5231 (interactive "p")
|
|
5232 (gnus-summary-next-subject (- n) t))
|
|
5233
|
|
5234 (defun gnus-summary-goto-subject (article &optional force silent)
|
|
5235 "Go the subject line of ARTICLE.
|
|
5236 If FORCE, also allow jumping to articles not currently shown."
|
|
5237 (interactive "nArticle number: ")
|
|
5238 (let ((b (point))
|
|
5239 (data (gnus-data-find article)))
|
|
5240 ;; We read in the article if we have to.
|
|
5241 (and (not data)
|
|
5242 force
|
|
5243 (gnus-summary-insert-subject article (and (vectorp force) force) t)
|
|
5244 (setq data (gnus-data-find article)))
|
|
5245 (goto-char b)
|
|
5246 (if (not data)
|
|
5247 (progn
|
|
5248 (unless silent
|
|
5249 (gnus-message 3 "Can't find article %d" article))
|
|
5250 nil)
|
|
5251 (goto-char (gnus-data-pos data))
|
|
5252 article)))
|
|
5253
|
|
5254 ;; Walking around summary lines with displaying articles.
|
|
5255
|
|
5256 (defun gnus-summary-expand-window (&optional arg)
|
|
5257 "Make the summary buffer take up the entire Emacs frame.
|
|
5258 Given a prefix, will force an `article' buffer configuration."
|
|
5259 (interactive "P")
|
|
5260 (gnus-set-global-variables)
|
|
5261 (if arg
|
|
5262 (gnus-configure-windows 'article 'force)
|
|
5263 (gnus-configure-windows 'summary 'force)))
|
|
5264
|
|
5265 (defun gnus-summary-display-article (article &optional all-header)
|
|
5266 "Display ARTICLE in article buffer."
|
|
5267 (gnus-set-global-variables)
|
|
5268 (if (null article)
|
|
5269 nil
|
|
5270 (prog1
|
|
5271 (if gnus-summary-display-article-function
|
|
5272 (funcall gnus-summary-display-article-function article all-header)
|
|
5273 (gnus-article-prepare article all-header))
|
|
5274 (run-hooks 'gnus-select-article-hook)
|
|
5275 (when (and gnus-current-article
|
|
5276 (not (zerop gnus-current-article)))
|
|
5277 (gnus-summary-goto-subject gnus-current-article))
|
|
5278 (gnus-summary-recenter)
|
|
5279 (when (and gnus-use-trees gnus-show-threads)
|
|
5280 (gnus-possibly-generate-tree article)
|
|
5281 (gnus-highlight-selected-tree article))
|
|
5282 ;; Successfully display article.
|
|
5283 (gnus-article-set-window-start
|
|
5284 (cdr (assq article gnus-newsgroup-bookmarks))))))
|
|
5285
|
|
5286 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
|
|
5287 "Select the current article.
|
|
5288 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
|
|
5289 non-nil, the article will be re-fetched even if it already present in
|
|
5290 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
|
|
5291 be displayed."
|
|
5292 ;; Make sure we are in the summary buffer to work around bbdb bug.
|
|
5293 (unless (eq major-mode 'gnus-summary-mode)
|
|
5294 (set-buffer gnus-summary-buffer))
|
|
5295 (let ((article (or article (gnus-summary-article-number)))
|
|
5296 (all-headers (not (not all-headers))) ;Must be T or NIL.
|
|
5297 gnus-summary-display-article-function
|
|
5298 did)
|
|
5299 (and (not pseudo)
|
|
5300 (gnus-summary-article-pseudo-p article)
|
|
5301 (error "This is a pseudo-article."))
|
|
5302 (prog1
|
|
5303 (save-excursion
|
|
5304 (set-buffer gnus-summary-buffer)
|
|
5305 (if (or (and gnus-single-article-buffer
|
|
5306 (or (null gnus-current-article)
|
|
5307 (null gnus-article-current)
|
|
5308 (null (get-buffer gnus-article-buffer))
|
|
5309 (not (eq article (cdr gnus-article-current)))
|
|
5310 (not (equal (car gnus-article-current)
|
|
5311 gnus-newsgroup-name))))
|
|
5312 (and (not gnus-single-article-buffer)
|
|
5313 (or (null gnus-current-article)
|
|
5314 (not (eq gnus-current-article article))))
|
|
5315 force)
|
|
5316 ;; The requested article is different from the current article.
|
|
5317 (prog1
|
|
5318 (gnus-summary-display-article article all-headers)
|
|
5319 (setq did article))
|
|
5320 (when (or all-headers gnus-show-all-headers)
|
|
5321 (gnus-article-show-all-headers))
|
|
5322 'old))
|
|
5323 (when did
|
|
5324 (gnus-article-set-window-start
|
|
5325 (cdr (assq article gnus-newsgroup-bookmarks)))))))
|
|
5326
|
|
5327 (defun gnus-summary-set-current-mark (&optional current-mark)
|
|
5328 "Obsolete function."
|
|
5329 nil)
|
|
5330
|
|
5331 (defun gnus-summary-next-article (&optional unread subject backward push)
|
|
5332 "Select the next article.
|
|
5333 If UNREAD, only unread articles are selected.
|
|
5334 If SUBJECT, only articles with SUBJECT are selected.
|
|
5335 If BACKWARD, the previous article is selected instead of the next."
|
|
5336 (interactive "P")
|
|
5337 (gnus-set-global-variables)
|
|
5338 (cond
|
|
5339 ;; Is there such an article?
|
|
5340 ((and (gnus-summary-search-forward unread subject backward)
|
|
5341 (or (gnus-summary-display-article (gnus-summary-article-number))
|
|
5342 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
|
|
5343 (gnus-summary-position-point))
|
|
5344 ;; If not, we try the first unread, if that is wanted.
|
|
5345 ((and subject
|
|
5346 gnus-auto-select-same
|
|
5347 (gnus-summary-first-unread-article))
|
|
5348 (gnus-summary-position-point)
|
|
5349 (gnus-message 6 "Wrapped"))
|
|
5350 ;; Try to get next/previous article not displayed in this group.
|
|
5351 ((and gnus-auto-extend-newsgroup
|
|
5352 (not unread) (not subject))
|
|
5353 (gnus-summary-goto-article
|
|
5354 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
|
|
5355 nil t))
|
|
5356 ;; Go to next/previous group.
|
|
5357 (t
|
|
5358 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5359 (gnus-summary-jump-to-group gnus-newsgroup-name))
|
|
5360 (let ((cmd last-command-char)
|
104
|
5361 (point
|
|
5362 (save-excursion
|
|
5363 (set-buffer gnus-group-buffer)
|
|
5364 (point)))
|
98
|
5365 (group
|
|
5366 (if (eq gnus-keep-same-level 'best)
|
|
5367 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5368 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5369 ;; For some reason, the group window gets selected. We change
|
|
5370 ;; it back.
|
|
5371 (select-window (get-buffer-window (current-buffer)))
|
|
5372 ;; Select next unread newsgroup automagically.
|
|
5373 (cond
|
|
5374 ((or (not gnus-auto-select-next)
|
|
5375 (not cmd))
|
|
5376 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
|
|
5377 ((or (eq gnus-auto-select-next 'quietly)
|
|
5378 (and (eq gnus-auto-select-next 'slightly-quietly)
|
|
5379 push)
|
|
5380 (and (eq gnus-auto-select-next 'almost-quietly)
|
|
5381 (gnus-summary-last-article-p)))
|
|
5382 ;; Select quietly.
|
|
5383 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
|
|
5384 (gnus-summary-exit)
|
|
5385 (gnus-message 7 "No more%s articles (%s)..."
|
|
5386 (if unread " unread" "")
|
|
5387 (if group (concat "selecting " group)
|
|
5388 "exiting"))
|
|
5389 (gnus-summary-next-group nil group backward)))
|
|
5390 (t
|
|
5391 (when (gnus-key-press-event-p last-input-event)
|
|
5392 (gnus-summary-walk-group-buffer
|
104
|
5393 gnus-newsgroup-name cmd unread backward point))))))))
|
|
5394
|
|
5395 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
|
98
|
5396 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
|
|
5397 (?\C-p (gnus-group-prev-unread-group 1))))
|
|
5398 (cursor-in-echo-area t)
|
|
5399 keve key group ended)
|
|
5400 (save-excursion
|
|
5401 (set-buffer gnus-group-buffer)
|
104
|
5402 (goto-char start)
|
98
|
5403 (setq group
|
|
5404 (if (eq gnus-keep-same-level 'best)
|
|
5405 (gnus-summary-best-group gnus-newsgroup-name)
|
|
5406 (gnus-summary-search-group backward gnus-keep-same-level))))
|
|
5407 (while (not ended)
|
|
5408 (gnus-message
|
|
5409 5 "No more%s articles%s" (if unread " unread" "")
|
|
5410 (if (and group
|
|
5411 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
|
|
5412 (format " (Type %s for %s [%s])"
|
|
5413 (single-key-description cmd) group
|
|
5414 (car (gnus-gethash group gnus-newsrc-hashtb)))
|
|
5415 (format " (Type %s to exit %s)"
|
|
5416 (single-key-description cmd)
|
|
5417 gnus-newsgroup-name)))
|
|
5418 ;; Confirm auto selection.
|
|
5419 (setq key (car (setq keve (gnus-read-event-char))))
|
|
5420 (setq ended t)
|
|
5421 (cond
|
|
5422 ((assq key keystrokes)
|
|
5423 (let ((obuf (current-buffer)))
|
|
5424 (switch-to-buffer gnus-group-buffer)
|
|
5425 (when group
|
|
5426 (gnus-group-jump-to-group group))
|
|
5427 (eval (cadr (assq key keystrokes)))
|
|
5428 (setq group (gnus-group-group-name))
|
|
5429 (switch-to-buffer obuf))
|
|
5430 (setq ended nil))
|
|
5431 ((equal key cmd)
|
|
5432 (if (or (not group)
|
|
5433 (gnus-ephemeral-group-p gnus-newsgroup-name))
|
|
5434 (gnus-summary-exit)
|
|
5435 (gnus-summary-next-group nil group backward)))
|
|
5436 (t
|
|
5437 (push (cdr keve) unread-command-events))))))
|
|
5438
|
|
5439 (defun gnus-summary-next-unread-article ()
|
|
5440 "Select unread article after current one."
|
|
5441 (interactive)
|
108
|
5442 (gnus-summary-next-article
|
98
|
5443 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5444 (gnus-summary-last-article-p (gnus-summary-article-number)))
|
|
5445 (and gnus-auto-select-same
|
|
5446 (gnus-summary-article-subject))))
|
|
5447
|
|
5448 (defun gnus-summary-prev-article (&optional unread subject)
|
|
5449 "Select the article after the current one.
|
|
5450 If UNREAD is non-nil, only unread articles are selected."
|
|
5451 (interactive "P")
|
|
5452 (gnus-summary-next-article unread subject t))
|
|
5453
|
|
5454 (defun gnus-summary-prev-unread-article ()
|
|
5455 "Select unread article before current one."
|
|
5456 (interactive)
|
|
5457 (gnus-summary-prev-article
|
|
5458 (or (not (eq gnus-summary-goto-unread 'never))
|
|
5459 (gnus-summary-first-article-p (gnus-summary-article-number)))
|
|
5460 (and gnus-auto-select-same
|
|
5461 (gnus-summary-article-subject))))
|
|
5462
|
|
5463 (defun gnus-summary-next-page (&optional lines circular)
|
|
5464 "Show next page of the selected article.
|
|
5465 If at the end of the current article, select the next article.
|
|
5466 LINES says how many lines should be scrolled up.
|
|
5467
|
|
5468 If CIRCULAR is non-nil, go to the start of the article instead of
|
|
5469 selecting the next article when reaching the end of the current
|
|
5470 article."
|
|
5471 (interactive "P")
|
|
5472 (setq gnus-summary-buffer (current-buffer))
|
|
5473 (gnus-set-global-variables)
|
|
5474 (let ((article (gnus-summary-article-number))
|
100
|
5475 (article-window (get-buffer-window gnus-article-buffer t))
|
110
|
5476 endp)
|
98
|
5477 (gnus-configure-windows 'article)
|
|
5478 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
|
|
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 (if (or (null gnus-current-article)
|
|
5484 (null gnus-article-current)
|
|
5485 (/= article (cdr gnus-article-current))
|
|
5486 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5487 ;; Selected subject is different from current article's.
|
|
5488 (gnus-summary-display-article article)
|
|
5489 (when article-window
|
|
5490 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5491 (setq endp (gnus-article-next-page lines)))
|
|
5492 (when endp
|
|
5493 (cond (circular
|
|
5494 (gnus-summary-beginning-of-article))
|
|
5495 (lines
|
|
5496 (gnus-message 3 "End of message"))
|
|
5497 ((null lines)
|
|
5498 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5499 (not (gnus-summary-last-article-p article)))
|
|
5500 (gnus-summary-next-article)
|
|
5501 (gnus-summary-next-unread-article))))))))
|
|
5502 (gnus-summary-recenter)
|
|
5503 (gnus-summary-position-point)))
|
|
5504
|
110
|
5505 (defun gnus-summary-prev-page (&optional lines move)
|
98
|
5506 "Show previous page of selected article.
|
110
|
5507 Argument LINES specifies lines to be scrolled down.
|
|
5508 If MOVE, move to the previous unread article if point is at
|
|
5509 the beginning of the buffer."
|
98
|
5510 (interactive "P")
|
|
5511 (gnus-set-global-variables)
|
|
5512 (let ((article (gnus-summary-article-number))
|
110
|
5513 (article-window (get-buffer-window gnus-article-buffer t))
|
|
5514 endp)
|
98
|
5515 (gnus-configure-windows 'article)
|
|
5516 (if (or (null gnus-current-article)
|
|
5517 (null gnus-article-current)
|
|
5518 (/= article (cdr gnus-article-current))
|
|
5519 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
|
|
5520 ;; Selected subject is different from current article's.
|
|
5521 (gnus-summary-display-article article)
|
|
5522 (gnus-summary-recenter)
|
|
5523 (when article-window
|
|
5524 (gnus-eval-in-buffer-window gnus-article-buffer
|
110
|
5525 (setq endp (gnus-article-prev-page lines)))
|
|
5526 (when (and move endp)
|
|
5527 (cond (lines
|
|
5528 (gnus-message 3 "Beginning of message"))
|
|
5529 ((null lines)
|
|
5530 (if (and (eq gnus-summary-goto-unread 'never)
|
|
5531 (not (gnus-summary-first-article-p article)))
|
|
5532 (gnus-summary-prev-article)
|
|
5533 (gnus-summary-prev-unread-article))))))))
|
98
|
5534 (gnus-summary-position-point))
|
|
5535
|
110
|
5536 (defun gnus-summary-prev-page-or-article (&optional lines)
|
|
5537 "Show previous page of selected article.
|
|
5538 Argument LINES specifies lines to be scrolled down.
|
|
5539 If at the beginning of the article, go to the next article."
|
|
5540 (interactive "P")
|
|
5541 (gnus-summary-prev-page lines t))
|
|
5542
|
98
|
5543 (defun gnus-summary-scroll-up (lines)
|
|
5544 "Scroll up (or down) one line current article.
|
|
5545 Argument LINES specifies lines to be scrolled up (or down if negative)."
|
|
5546 (interactive "p")
|
|
5547 (gnus-set-global-variables)
|
|
5548 (gnus-configure-windows 'article)
|
|
5549 (gnus-summary-show-thread)
|
|
5550 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
|
|
5551 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
5552 (cond ((> lines 0)
|
|
5553 (when (gnus-article-next-page lines)
|
|
5554 (gnus-message 3 "End of message")))
|
|
5555 ((< lines 0)
|
|
5556 (gnus-article-prev-page (- lines))))))
|
|
5557 (gnus-summary-recenter)
|
|
5558 (gnus-summary-position-point))
|
|
5559
|
|
5560 (defun gnus-summary-next-same-subject ()
|
|
5561 "Select next article which has the same subject as current one."
|
|
5562 (interactive)
|
|
5563 (gnus-set-global-variables)
|
|
5564 (gnus-summary-next-article nil (gnus-summary-article-subject)))
|
|
5565
|
|
5566 (defun gnus-summary-prev-same-subject ()
|
|
5567 "Select previous article which has the same subject as current one."
|
|
5568 (interactive)
|
|
5569 (gnus-set-global-variables)
|
|
5570 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
|
|
5571
|
|
5572 (defun gnus-summary-next-unread-same-subject ()
|
|
5573 "Select next unread article which has the same subject as current one."
|
|
5574 (interactive)
|
|
5575 (gnus-set-global-variables)
|
|
5576 (gnus-summary-next-article t (gnus-summary-article-subject)))
|
|
5577
|
|
5578 (defun gnus-summary-prev-unread-same-subject ()
|
|
5579 "Select previous unread article which has the same subject as current one."
|
|
5580 (interactive)
|
|
5581 (gnus-set-global-variables)
|
|
5582 (gnus-summary-prev-article t (gnus-summary-article-subject)))
|
|
5583
|
|
5584 (defun gnus-summary-first-unread-article ()
|
|
5585 "Select the first unread article.
|
|
5586 Return nil if there are no unread articles."
|
|
5587 (interactive)
|
|
5588 (gnus-set-global-variables)
|
|
5589 (prog1
|
|
5590 (when (gnus-summary-first-subject t)
|
|
5591 (gnus-summary-show-thread)
|
|
5592 (gnus-summary-first-subject t)
|
|
5593 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5594 (gnus-summary-position-point)))
|
|
5595
|
|
5596 (defun gnus-summary-first-article ()
|
|
5597 "Select the first article.
|
|
5598 Return nil if there are no articles."
|
|
5599 (interactive)
|
|
5600 (gnus-set-global-variables)
|
|
5601 (prog1
|
|
5602 (when (gnus-summary-first-subject)
|
|
5603 (gnus-summary-show-thread)
|
|
5604 (gnus-summary-first-subject)
|
|
5605 (gnus-summary-display-article (gnus-summary-article-number)))
|
|
5606 (gnus-summary-position-point)))
|
|
5607
|
|
5608 (defun gnus-summary-best-unread-article ()
|
|
5609 "Select the unread article with the highest score."
|
|
5610 (interactive)
|
|
5611 (gnus-set-global-variables)
|
|
5612 (let ((best -1000000)
|
|
5613 (data gnus-newsgroup-data)
|
|
5614 article score)
|
|
5615 (while data
|
|
5616 (and (gnus-data-unread-p (car data))
|
|
5617 (> (setq score
|
|
5618 (gnus-summary-article-score (gnus-data-number (car data))))
|
|
5619 best)
|
|
5620 (setq best score
|
|
5621 article (gnus-data-number (car data))))
|
|
5622 (setq data (cdr data)))
|
|
5623 (prog1
|
|
5624 (if article
|
|
5625 (gnus-summary-goto-article article)
|
|
5626 (error "No unread articles"))
|
|
5627 (gnus-summary-position-point))))
|
|
5628
|
|
5629 (defun gnus-summary-last-subject ()
|
|
5630 "Go to the last displayed subject line in the group."
|
|
5631 (let ((article (gnus-data-number (car (gnus-data-list t)))))
|
|
5632 (when article
|
|
5633 (gnus-summary-goto-subject article))))
|
|
5634
|
|
5635 (defun gnus-summary-goto-article (article &optional all-headers force)
|
|
5636 "Fetch ARTICLE and display it if it exists.
|
|
5637 If ALL-HEADERS is non-nil, no header lines are hidden."
|
|
5638 (interactive
|
|
5639 (list
|
|
5640 (string-to-int
|
|
5641 (completing-read
|
|
5642 "Article number: "
|
|
5643 (mapcar (lambda (number) (list (int-to-string number)))
|
|
5644 gnus-newsgroup-limit)))
|
|
5645 current-prefix-arg
|
|
5646 t))
|
|
5647 (prog1
|
|
5648 (if (gnus-summary-goto-subject article force)
|
|
5649 (gnus-summary-display-article article all-headers)
|
|
5650 (gnus-message 4 "Couldn't go to article %s" article) nil)
|
|
5651 (gnus-summary-position-point)))
|
|
5652
|
|
5653 (defun gnus-summary-goto-last-article ()
|
|
5654 "Go to the previously read article."
|
|
5655 (interactive)
|
|
5656 (prog1
|
|
5657 (when gnus-last-article
|
|
5658 (gnus-summary-goto-article gnus-last-article))
|
|
5659 (gnus-summary-position-point)))
|
|
5660
|
|
5661 (defun gnus-summary-pop-article (number)
|
|
5662 "Pop one article off the history and go to the previous.
|
|
5663 NUMBER articles will be popped off."
|
|
5664 (interactive "p")
|
|
5665 (let (to)
|
|
5666 (setq gnus-newsgroup-history
|
|
5667 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
|
|
5668 (if to
|
|
5669 (gnus-summary-goto-article (car to))
|
|
5670 (error "Article history empty")))
|
|
5671 (gnus-summary-position-point))
|
|
5672
|
|
5673 ;; Summary commands and functions for limiting the summary buffer.
|
|
5674
|
|
5675 (defun gnus-summary-limit-to-articles (n)
|
|
5676 "Limit the summary buffer to the next N articles.
|
|
5677 If not given a prefix, use the process marked articles instead."
|
|
5678 (interactive "P")
|
|
5679 (gnus-set-global-variables)
|
|
5680 (prog1
|
|
5681 (let ((articles (gnus-summary-work-articles n)))
|
|
5682 (setq gnus-newsgroup-processable nil)
|
|
5683 (gnus-summary-limit articles))
|
|
5684 (gnus-summary-position-point)))
|
|
5685
|
|
5686 (defun gnus-summary-pop-limit (&optional total)
|
|
5687 "Restore the previous limit.
|
|
5688 If given a prefix, remove all limits."
|
|
5689 (interactive "P")
|
|
5690 (gnus-set-global-variables)
|
108
|
5691 (when total
|
98
|
5692 (setq gnus-newsgroup-limits
|
|
5693 (list (mapcar (lambda (h) (mail-header-number h))
|
|
5694 gnus-newsgroup-headers))))
|
|
5695 (unless gnus-newsgroup-limits
|
|
5696 (error "No limit to pop"))
|
|
5697 (prog1
|
|
5698 (gnus-summary-limit nil 'pop)
|
|
5699 (gnus-summary-position-point)))
|
|
5700
|
|
5701 (defun gnus-summary-limit-to-subject (subject &optional header)
|
|
5702 "Limit the summary buffer to articles that have subjects that match a regexp."
|
|
5703 (interactive "sLimit to subject (regexp): ")
|
|
5704 (unless header
|
|
5705 (setq header "subject"))
|
|
5706 (when (not (equal "" subject))
|
|
5707 (prog1
|
|
5708 (let ((articles (gnus-summary-find-matching
|
|
5709 (or header "subject") subject 'all)))
|
|
5710 (unless articles
|
|
5711 (error "Found no matches for \"%s\"" subject))
|
|
5712 (gnus-summary-limit articles))
|
|
5713 (gnus-summary-position-point))))
|
|
5714
|
|
5715 (defun gnus-summary-limit-to-author (from)
|
|
5716 "Limit the summary buffer to articles that have authors that match a regexp."
|
|
5717 (interactive "sLimit to author (regexp): ")
|
|
5718 (gnus-summary-limit-to-subject from "from"))
|
|
5719
|
|
5720 (defun gnus-summary-limit-to-age (age &optional younger-p)
|
108
|
5721 "Limit the summary buffer to articles that are older than (or equal) AGE days.
|
98
|
5722 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
|
|
5723 articles that are younger than AGE days."
|
|
5724 (interactive "nTime in days: \nP")
|
|
5725 (prog1
|
|
5726 (let ((data gnus-newsgroup-data)
|
|
5727 (cutoff (nnmail-days-to-time age))
|
|
5728 articles d date is-younger)
|
|
5729 (while (setq d (pop data))
|
|
5730 (when (and (vectorp (gnus-data-header d))
|
|
5731 (setq date (mail-header-date (gnus-data-header d))))
|
|
5732 (setq is-younger (nnmail-time-less
|
|
5733 (nnmail-time-since (nnmail-date-to-time date))
|
|
5734 cutoff))
|
|
5735 (when (if younger-p is-younger (not is-younger))
|
|
5736 (push (gnus-data-number d) articles))))
|
|
5737 (gnus-summary-limit (nreverse articles)))
|
|
5738 (gnus-summary-position-point)))
|
|
5739
|
|
5740 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5741 (make-obsolete
|
|
5742 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
|
|
5743
|
|
5744 (defun gnus-summary-limit-to-unread (&optional all)
|
|
5745 "Limit the summary buffer to articles that are not marked as read.
|
|
5746 If ALL is non-nil, limit strictly to unread articles."
|
|
5747 (interactive "P")
|
|
5748 (if all
|
|
5749 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
|
|
5750 (gnus-summary-limit-to-marks
|
|
5751 ;; Concat all the marks that say that an article is read and have
|
|
5752 ;; those removed.
|
|
5753 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
|
|
5754 gnus-killed-mark gnus-kill-file-mark
|
|
5755 gnus-low-score-mark gnus-expirable-mark
|
|
5756 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
|
110
|
5757 gnus-duplicate-mark gnus-souped-mark)
|
98
|
5758 'reverse)))
|
|
5759
|
|
5760 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
|
|
5761 (make-obsolete 'gnus-summary-delete-marked-with
|
|
5762 'gnus-summary-limit-exlude-marks)
|
|
5763
|
|
5764 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
|
|
5765 "Exclude articles that are marked with MARKS (e.g. \"DK\").
|
|
5766 If REVERSE, limit the summary buffer to articles that are marked
|
|
5767 with MARKS. MARKS can either be a string of marks or a list of marks.
|
|
5768 Returns how many articles were removed."
|
|
5769 (interactive "sMarks: ")
|
|
5770 (gnus-summary-limit-to-marks marks t))
|
108
|
5771
|
98
|
5772 (defun gnus-summary-limit-to-marks (marks &optional reverse)
|
|
5773 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
|
|
5774 If REVERSE (the prefix), limit the summary buffer to articles that are
|
|
5775 not marked with MARKS. MARKS can either be a string of marks or a
|
|
5776 list of marks.
|
|
5777 Returns how many articles were removed."
|
|
5778 (interactive (list (read-string "Marks: ") current-prefix-arg))
|
|
5779 (gnus-set-global-variables)
|
|
5780 (prog1
|
|
5781 (let ((data gnus-newsgroup-data)
|
|
5782 (marks (if (listp marks) marks
|
|
5783 (append marks nil))) ; Transform to list.
|
|
5784 articles)
|
|
5785 (while data
|
|
5786 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
|
|
5787 (memq (gnus-data-mark (car data)) marks))
|
|
5788 (push (gnus-data-number (car data)) articles))
|
|
5789 (setq data (cdr data)))
|
|
5790 (gnus-summary-limit articles))
|
|
5791 (gnus-summary-position-point)))
|
|
5792
|
|
5793 (defun gnus-summary-limit-to-score (&optional score)
|
|
5794 "Limit to articles with score at or above SCORE."
|
|
5795 (interactive "P")
|
|
5796 (gnus-set-global-variables)
|
|
5797 (setq score (if score
|
|
5798 (prefix-numeric-value score)
|
|
5799 (or gnus-summary-default-score 0)))
|
|
5800 (let ((data gnus-newsgroup-data)
|
|
5801 articles)
|
|
5802 (while data
|
|
5803 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
|
|
5804 score)
|
|
5805 (push (gnus-data-number (car data)) articles))
|
|
5806 (setq data (cdr data)))
|
|
5807 (prog1
|
|
5808 (gnus-summary-limit articles)
|
|
5809 (gnus-summary-position-point))))
|
|
5810
|
|
5811 (defun gnus-summary-limit-include-dormant ()
|
|
5812 "Display all the hidden articles that are marked as dormant."
|
|
5813 (interactive)
|
|
5814 (gnus-set-global-variables)
|
|
5815 (unless gnus-newsgroup-dormant
|
|
5816 (error "There are no dormant articles in this group"))
|
|
5817 (prog1
|
|
5818 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
|
|
5819 (gnus-summary-position-point)))
|
|
5820
|
|
5821 (defun gnus-summary-limit-exclude-dormant ()
|
|
5822 "Hide all dormant articles."
|
|
5823 (interactive)
|
|
5824 (gnus-set-global-variables)
|
|
5825 (prog1
|
|
5826 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
|
|
5827 (gnus-summary-position-point)))
|
|
5828
|
|
5829 (defun gnus-summary-limit-exclude-childless-dormant ()
|
|
5830 "Hide all dormant articles that have no children."
|
|
5831 (interactive)
|
|
5832 (gnus-set-global-variables)
|
|
5833 (let ((data (gnus-data-list t))
|
|
5834 articles d children)
|
|
5835 ;; Find all articles that are either not dormant or have
|
|
5836 ;; children.
|
|
5837 (while (setq d (pop data))
|
|
5838 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
|
108
|
5839 (and (setq children
|
98
|
5840 (gnus-article-children (gnus-data-number d)))
|
|
5841 (let (found)
|
|
5842 (while children
|
|
5843 (when (memq (car children) articles)
|
|
5844 (setq children nil
|
|
5845 found t))
|
|
5846 (pop children))
|
|
5847 found)))
|
|
5848 (push (gnus-data-number d) articles)))
|
|
5849 ;; Do the limiting.
|
|
5850 (prog1
|
|
5851 (gnus-summary-limit articles)
|
|
5852 (gnus-summary-position-point))))
|
|
5853
|
|
5854 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
|
|
5855 "Mark all unread excluded articles as read.
|
|
5856 If ALL, mark even excluded ticked and dormants as read."
|
|
5857 (interactive "P")
|
|
5858 (let ((articles (gnus-sorted-complement
|
|
5859 (sort
|
|
5860 (mapcar (lambda (h) (mail-header-number h))
|
|
5861 gnus-newsgroup-headers)
|
|
5862 '<)
|
|
5863 (sort gnus-newsgroup-limit '<)))
|
|
5864 article)
|
153
|
5865 (setq gnus-newsgroup-unreads gnus-newsgroup-limit)
|
98
|
5866 (if all
|
|
5867 (setq gnus-newsgroup-dormant nil
|
|
5868 gnus-newsgroup-marked nil
|
|
5869 gnus-newsgroup-reads
|
|
5870 (nconc
|
|
5871 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
|
|
5872 gnus-newsgroup-reads))
|
|
5873 (while (setq article (pop articles))
|
|
5874 (unless (or (memq article gnus-newsgroup-dormant)
|
|
5875 (memq article gnus-newsgroup-marked))
|
|
5876 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
|
|
5877
|
|
5878 (defun gnus-summary-limit (articles &optional pop)
|
|
5879 (if pop
|
|
5880 ;; We pop the previous limit off the stack and use that.
|
|
5881 (setq articles (car gnus-newsgroup-limits)
|
|
5882 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
|
|
5883 ;; We use the new limit, so we push the old limit on the stack.
|
|
5884 (push gnus-newsgroup-limit gnus-newsgroup-limits))
|
|
5885 ;; Set the limit.
|
|
5886 (setq gnus-newsgroup-limit articles)
|
|
5887 (let ((total (length gnus-newsgroup-data))
|
|
5888 (data (gnus-data-find-list (gnus-summary-article-number)))
|
|
5889 (gnus-summary-mark-below nil) ; Inhibit this.
|
|
5890 found)
|
|
5891 ;; This will do all the work of generating the new summary buffer
|
|
5892 ;; according to the new limit.
|
|
5893 (gnus-summary-prepare)
|
|
5894 ;; Hide any threads, possibly.
|
|
5895 (and gnus-show-threads
|
|
5896 gnus-thread-hide-subtree
|
|
5897 (gnus-summary-hide-all-threads))
|
|
5898 ;; Try to return to the article you were at, or one in the
|
|
5899 ;; neighborhood.
|
|
5900 (when data
|
|
5901 ;; We try to find some article after the current one.
|
|
5902 (while data
|
|
5903 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
|
|
5904 (setq data nil
|
|
5905 found t))
|
|
5906 (setq data (cdr data))))
|
|
5907 (unless found
|
|
5908 ;; If there is no data, that means that we were after the last
|
|
5909 ;; article. The same goes when we can't find any articles
|
|
5910 ;; after the current one.
|
|
5911 (goto-char (point-max))
|
|
5912 (gnus-summary-find-prev))
|
|
5913 ;; We return how many articles were removed from the summary
|
|
5914 ;; buffer as a result of the new limit.
|
|
5915 (- total (length gnus-newsgroup-data))))
|
|
5916
|
|
5917 (defsubst gnus-invisible-cut-children (threads)
|
|
5918 (let ((num 0))
|
|
5919 (while threads
|
|
5920 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
|
|
5921 (incf num))
|
|
5922 (pop threads))
|
|
5923 (< num 2)))
|
|
5924
|
|
5925 (defsubst gnus-cut-thread (thread)
|
|
5926 "Go forwards in the thread until we find an article that we want to display."
|
|
5927 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5928 (eq gnus-build-sparse-threads 'some)
|
|
5929 (eq gnus-build-sparse-threads 'more))
|
|
5930 ;; Deal with old-fetched headers and sparse threads.
|
|
5931 (while (and
|
|
5932 thread
|
|
5933 (or
|
|
5934 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
|
|
5935 (gnus-summary-article-ancient-p
|
|
5936 (mail-header-number (car thread))))
|
|
5937 (progn
|
|
5938 (if (<= (length (cdr thread)) 1)
|
144
|
5939 (setq gnus-newsgroup-limit
|
|
5940 (delq (mail-header-number (car thread))
|
|
5941 gnus-newsgroup-limit)
|
|
5942 thread (cadr thread))
|
98
|
5943 (when (gnus-invisible-cut-children (cdr thread))
|
|
5944 (let ((th (cdr thread)))
|
|
5945 (while th
|
|
5946 (if (memq (mail-header-number (caar th))
|
|
5947 gnus-newsgroup-limit)
|
|
5948 (setq thread (car th)
|
|
5949 th nil)
|
144
|
5950 (setq th (cdr th)))))))))))
|
98
|
5951 thread)
|
|
5952
|
|
5953 (defun gnus-cut-threads (threads)
|
|
5954 "Cut off all uninteresting articles from the beginning of threads."
|
|
5955 (when (or (eq gnus-fetch-old-headers 'some)
|
|
5956 (eq gnus-build-sparse-threads 'some)
|
|
5957 (eq gnus-build-sparse-threads 'more))
|
|
5958 (let ((th threads))
|
|
5959 (while th
|
|
5960 (setcar th (gnus-cut-thread (car th)))
|
|
5961 (setq th (cdr th)))))
|
|
5962 ;; Remove nixed out threads.
|
|
5963 (delq nil threads))
|
|
5964
|
|
5965 (defun gnus-summary-initial-limit (&optional show-if-empty)
|
|
5966 "Figure out what the initial limit is supposed to be on group entry.
|
|
5967 This entails weeding out unwanted dormants, low-scored articles,
|
|
5968 fetch-old-headers verbiage, and so on."
|
|
5969 ;; Most groups have nothing to remove.
|
|
5970 (if (or gnus-inhibit-limiting
|
|
5971 (and (null gnus-newsgroup-dormant)
|
|
5972 (not (eq gnus-fetch-old-headers 'some))
|
|
5973 (null gnus-summary-expunge-below)
|
|
5974 (not (eq gnus-build-sparse-threads 'some))
|
|
5975 (not (eq gnus-build-sparse-threads 'more))
|
|
5976 (null gnus-thread-expunge-below)
|
|
5977 (not gnus-use-nocem)))
|
|
5978 () ; Do nothing.
|
|
5979 (push gnus-newsgroup-limit gnus-newsgroup-limits)
|
|
5980 (setq gnus-newsgroup-limit nil)
|
|
5981 (mapatoms
|
|
5982 (lambda (node)
|
|
5983 (unless (car (symbol-value node))
|
|
5984 ;; These threads have no parents -- they are roots.
|
|
5985 (let ((nodes (cdr (symbol-value node)))
|
|
5986 thread)
|
|
5987 (while nodes
|
|
5988 (if (and gnus-thread-expunge-below
|
|
5989 (< (gnus-thread-total-score (car nodes))
|
|
5990 gnus-thread-expunge-below))
|
|
5991 (gnus-expunge-thread (pop nodes))
|
|
5992 (setq thread (pop nodes))
|
|
5993 (gnus-summary-limit-children thread))))))
|
|
5994 gnus-newsgroup-dependencies)
|
|
5995 ;; If this limitation resulted in an empty group, we might
|
|
5996 ;; pop the previous limit and use it instead.
|
|
5997 (when (and (not gnus-newsgroup-limit)
|
|
5998 show-if-empty)
|
|
5999 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
|
|
6000 gnus-newsgroup-limit))
|
|
6001
|
|
6002 (defun gnus-summary-limit-children (thread)
|
|
6003 "Return 1 if this subthread is visible and 0 if it is not."
|
|
6004 ;; First we get the number of visible children to this thread. This
|
|
6005 ;; is done by recursing down the thread using this function, so this
|
|
6006 ;; will really go down to a leaf article first, before slowly
|
|
6007 ;; working its way up towards the root.
|
|
6008 (when thread
|
|
6009 (let ((children
|
|
6010 (if (cdr thread)
|
|
6011 (apply '+ (mapcar 'gnus-summary-limit-children
|
|
6012 (cdr thread)))
|
|
6013 0))
|
|
6014 (number (mail-header-number (car thread)))
|
|
6015 score)
|
|
6016 (if (and
|
|
6017 (not (memq number gnus-newsgroup-marked))
|
|
6018 (or
|
|
6019 ;; If this article is dormant and has absolutely no visible
|
|
6020 ;; children, then this article isn't visible.
|
|
6021 (and (memq number gnus-newsgroup-dormant)
|
|
6022 (zerop children))
|
|
6023 ;; If this is "fetch-old-headered" and there is no
|
|
6024 ;; visible children, then we don't want this article.
|
|
6025 (and (eq gnus-fetch-old-headers 'some)
|
|
6026 (gnus-summary-article-ancient-p number)
|
|
6027 (zerop children))
|
|
6028 ;; If this is a sparsely inserted article with no children,
|
|
6029 ;; we don't want it.
|
|
6030 (and (eq gnus-build-sparse-threads 'some)
|
|
6031 (gnus-summary-article-sparse-p number)
|
|
6032 (zerop children))
|
|
6033 ;; If we use expunging, and this article is really
|
|
6034 ;; low-scored, then we don't want this article.
|
|
6035 (when (and gnus-summary-expunge-below
|
|
6036 (< (setq score
|
|
6037 (or (cdr (assq number gnus-newsgroup-scored))
|
|
6038 gnus-summary-default-score))
|
|
6039 gnus-summary-expunge-below))
|
|
6040 ;; We increase the expunge-tally here, but that has
|
|
6041 ;; nothing to do with the limits, really.
|
|
6042 (incf gnus-newsgroup-expunged-tally)
|
|
6043 ;; We also mark as read here, if that's wanted.
|
|
6044 (when (and gnus-summary-mark-below
|
|
6045 (< score gnus-summary-mark-below))
|
|
6046 (setq gnus-newsgroup-unreads
|
|
6047 (delq number gnus-newsgroup-unreads))
|
|
6048 (if gnus-newsgroup-auto-expire
|
|
6049 (push number gnus-newsgroup-expirable)
|
|
6050 (push (cons number gnus-low-score-mark)
|
|
6051 gnus-newsgroup-reads)))
|
|
6052 t)
|
|
6053 ;; Check NoCeM things.
|
|
6054 (if (and gnus-use-nocem
|
|
6055 (gnus-nocem-unwanted-article-p
|
|
6056 (mail-header-id (car thread))))
|
|
6057 (progn
|
108
|
6058 (setq gnus-newsgroup-reads
|
155
|
6059 (delq number gnus-newsgroup-reads))
|
98
|
6060 t))))
|
|
6061 ;; Nope, invisible article.
|
|
6062 0
|
|
6063 ;; Ok, this article is to be visible, so we add it to the limit
|
|
6064 ;; and return 1.
|
|
6065 (push number gnus-newsgroup-limit)
|
|
6066 1))))
|
|
6067
|
|
6068 (defun gnus-expunge-thread (thread)
|
|
6069 "Mark all articles in THREAD as read."
|
|
6070 (let* ((number (mail-header-number (car thread))))
|
|
6071 (incf gnus-newsgroup-expunged-tally)
|
|
6072 ;; We also mark as read here, if that's wanted.
|
|
6073 (setq gnus-newsgroup-unreads
|
|
6074 (delq number gnus-newsgroup-unreads))
|
|
6075 (if gnus-newsgroup-auto-expire
|
|
6076 (push number gnus-newsgroup-expirable)
|
|
6077 (push (cons number gnus-low-score-mark)
|
|
6078 gnus-newsgroup-reads)))
|
|
6079 ;; Go recursively through all subthreads.
|
|
6080 (mapcar 'gnus-expunge-thread (cdr thread)))
|
|
6081
|
|
6082 ;; Summary article oriented commands
|
|
6083
|
|
6084 (defun gnus-summary-refer-parent-article (n)
|
|
6085 "Refer parent article N times.
|
|
6086 If N is negative, go to ancestor -N instead.
|
|
6087 The difference between N and the number of articles fetched is returned."
|
|
6088 (interactive "p")
|
|
6089 (gnus-set-global-variables)
|
|
6090 (let ((skip 1)
|
|
6091 error header ref)
|
|
6092 (when (not (natnump n))
|
|
6093 (setq skip (abs n)
|
|
6094 n 1))
|
|
6095 (while (and (> n 0)
|
|
6096 (not error))
|
|
6097 (setq header (gnus-summary-article-header))
|
|
6098 (if (and (eq (mail-header-number header)
|
|
6099 (cdr gnus-article-current))
|
|
6100 (equal gnus-newsgroup-name
|
|
6101 (car gnus-article-current)))
|
|
6102 ;; If we try to find the parent of the currently
|
|
6103 ;; displayed article, then we take a look at the actual
|
|
6104 ;; References header, since this is slightly more
|
|
6105 ;; reliable than the References field we got from the
|
|
6106 ;; server.
|
|
6107 (save-excursion
|
|
6108 (set-buffer gnus-original-article-buffer)
|
|
6109 (nnheader-narrow-to-headers)
|
|
6110 (unless (setq ref (message-fetch-field "references"))
|
|
6111 (setq ref (message-fetch-field "in-reply-to")))
|
|
6112 (widen))
|
|
6113 (setq ref
|
|
6114 ;; It's not the current article, so we take a bet on
|
|
6115 ;; the value we got from the server.
|
|
6116 (mail-header-references header)))
|
|
6117 (if (and ref
|
|
6118 (not (equal ref "")))
|
|
6119 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
|
|
6120 (gnus-message 1 "Couldn't find parent"))
|
|
6121 (gnus-message 1 "No references in article %d"
|
|
6122 (gnus-summary-article-number))
|
|
6123 (setq error t))
|
|
6124 (decf n))
|
|
6125 (gnus-summary-position-point)
|
|
6126 n))
|
|
6127
|
|
6128 (defun gnus-summary-refer-references ()
|
|
6129 "Fetch all articles mentioned in the References header.
|
|
6130 Return how many articles were fetched."
|
|
6131 (interactive)
|
|
6132 (gnus-set-global-variables)
|
|
6133 (let ((ref (mail-header-references (gnus-summary-article-header)))
|
|
6134 (current (gnus-summary-article-number))
|
|
6135 (n 0))
|
|
6136 (if (or (not ref)
|
|
6137 (equal ref ""))
|
|
6138 (error "No References in the current article")
|
|
6139 ;; For each Message-ID in the References header...
|
|
6140 (while (string-match "<[^>]*>" ref)
|
|
6141 (incf n)
|
|
6142 ;; ... fetch that article.
|
|
6143 (gnus-summary-refer-article
|
|
6144 (prog1 (match-string 0 ref)
|
|
6145 (setq ref (substring ref (match-end 0))))))
|
|
6146 (gnus-summary-goto-subject current)
|
|
6147 (gnus-summary-position-point)
|
|
6148 n)))
|
|
6149
|
122
|
6150 (defun gnus-summary-refer-article (message-id &optional arg)
|
|
6151 "Fetch an article specified by MESSAGE-ID.
|
|
6152 If ARG (the prefix), fetch the article using `gnus-refer-article-method'
|
|
6153 or `gnus-select-method', no matter what backend the article comes from."
|
|
6154 (interactive "sMessage-ID: \nP")
|
98
|
6155 (when (and (stringp message-id)
|
|
6156 (not (zerop (length message-id))))
|
|
6157 ;; Construct the correct Message-ID if necessary.
|
|
6158 ;; Suggested by tale@pawl.rpi.edu.
|
|
6159 (unless (string-match "^<" message-id)
|
|
6160 (setq message-id (concat "<" message-id)))
|
|
6161 (unless (string-match ">$" message-id)
|
|
6162 (setq message-id (concat message-id ">")))
|
|
6163 (let* ((header (gnus-id-to-header message-id))
|
|
6164 (sparse (and header
|
108
|
6165 (gnus-summary-article-sparse-p
|
144
|
6166 (mail-header-number header))
|
|
6167 (memq (mail-header-number header)
|
|
6168 gnus-newsgroup-limit))))
|
|
6169 (if (and header
|
|
6170 (or (not (gnus-summary-article-sparse-p
|
|
6171 (mail-header-number header)))
|
|
6172 sparse))
|
98
|
6173 (prog1
|
140
|
6174 ;; The article is present in the buffer, so we just go to it.
|
108
|
6175 (gnus-summary-goto-article
|
140
|
6176 (mail-header-number header) nil t)
|
98
|
6177 (when sparse
|
|
6178 (gnus-summary-update-article (mail-header-number header))))
|
|
6179 ;; We fetch the article
|
108
|
6180 (let ((gnus-override-method
|
122
|
6181 (cond ((gnus-news-group-p gnus-newsgroup-name)
|
|
6182 gnus-refer-article-method)
|
|
6183 (arg
|
|
6184 (or gnus-refer-article-method gnus-select-method))
|
|
6185 (t nil)))
|
98
|
6186 number)
|
|
6187 ;; Start the special refer-article method, if necessary.
|
|
6188 (when (and gnus-refer-article-method
|
|
6189 (gnus-news-group-p gnus-newsgroup-name))
|
|
6190 (gnus-check-server gnus-refer-article-method))
|
|
6191 ;; Fetch the header, and display the article.
|
|
6192 (if (setq number (gnus-summary-insert-subject message-id))
|
|
6193 (gnus-summary-select-article nil nil nil number)
|
|
6194 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
|
|
6195
|
|
6196 (defun gnus-summary-enter-digest-group (&optional force)
|
|
6197 "Enter an nndoc group based on the current article.
|
|
6198 If FORCE, force a digest interpretation. If not, try
|
|
6199 to guess what the document format is."
|
|
6200 (interactive "P")
|
|
6201 (gnus-set-global-variables)
|
|
6202 (let ((conf gnus-current-window-configuration))
|
|
6203 (save-excursion
|
|
6204 (gnus-summary-select-article))
|
|
6205 (setq gnus-current-window-configuration conf)
|
|
6206 (let* ((name (format "%s-%d"
|
|
6207 (gnus-group-prefixed-name
|
|
6208 gnus-newsgroup-name (list 'nndoc ""))
|
|
6209 (save-excursion
|
|
6210 (set-buffer gnus-summary-buffer)
|
|
6211 gnus-current-article)))
|
|
6212 (ogroup gnus-newsgroup-name)
|
|
6213 (params (append (gnus-info-params (gnus-get-info ogroup))
|
116
|
6214 (list (cons 'to-group ogroup))
|
|
6215 (list (cons 'save-article-group ogroup))))
|
98
|
6216 (case-fold-search t)
|
|
6217 (buf (current-buffer))
|
|
6218 dig)
|
|
6219 (save-excursion
|
|
6220 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
|
|
6221 (insert-buffer-substring gnus-original-article-buffer)
|
|
6222 ;; Remove lines that may lead nndoc to misinterpret the
|
|
6223 ;; document type.
|
|
6224 (narrow-to-region
|
|
6225 (goto-char (point-min))
|
|
6226 (or (search-forward "\n\n" nil t) (point)))
|
|
6227 (goto-char (point-min))
|
|
6228 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6229 (widen))
|
|
6230 (unwind-protect
|
|
6231 (if (gnus-group-read-ephemeral-group
|
|
6232 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
|
108
|
6233 (nndoc-article-type
|
98
|
6234 ,(if force 'digest 'guess))) t)
|
|
6235 ;; Make all postings to this group go to the parent group.
|
|
6236 (nconc (gnus-info-params (gnus-get-info name))
|
|
6237 params)
|
|
6238 ;; Couldn't select this doc group.
|
|
6239 (switch-to-buffer buf)
|
|
6240 (gnus-set-global-variables)
|
|
6241 (gnus-configure-windows 'summary)
|
|
6242 (gnus-message 3 "Article couldn't be entered?"))
|
|
6243 (kill-buffer dig)))))
|
|
6244
|
|
6245 (defun gnus-summary-read-document (n)
|
|
6246 "Open a new group based on the current article(s).
|
|
6247 This will allow you to read digests and other similar
|
|
6248 documents as newsgroups.
|
|
6249 Obeys the standard process/prefix convention."
|
|
6250 (interactive "P")
|
|
6251 (let* ((articles (gnus-summary-work-articles n))
|
|
6252 (ogroup gnus-newsgroup-name)
|
|
6253 (params (append (gnus-info-params (gnus-get-info ogroup))
|
|
6254 (list (cons 'to-group ogroup))))
|
|
6255 article group egroup groups vgroup)
|
|
6256 (while (setq article (pop articles))
|
|
6257 (setq group (format "%s-%d" gnus-newsgroup-name article))
|
|
6258 (gnus-summary-remove-process-mark article)
|
|
6259 (when (gnus-summary-display-article article)
|
|
6260 (save-excursion
|
|
6261 (nnheader-temp-write nil
|
|
6262 (insert-buffer-substring gnus-original-article-buffer)
|
|
6263 ;; Remove some headers that may lead nndoc to make
|
|
6264 ;; the wrong guess.
|
|
6265 (message-narrow-to-head)
|
|
6266 (goto-char (point-min))
|
|
6267 (delete-matching-lines "^\\(Path\\):\\|^From ")
|
|
6268 (widen)
|
|
6269 (if (setq egroup
|
|
6270 (gnus-group-read-ephemeral-group
|
|
6271 group `(nndoc ,group (nndoc-address ,(current-buffer))
|
|
6272 (nndoc-article-type guess))
|
|
6273 t nil t))
|
|
6274 (progn
|
|
6275 ;; Make all postings to this group go to the parent group.
|
|
6276 (nconc (gnus-info-params (gnus-get-info egroup))
|
|
6277 params)
|
|
6278 (push egroup groups))
|
|
6279 ;; Couldn't select this doc group.
|
|
6280 (gnus-error 3 "Article couldn't be entered"))))))
|
|
6281 ;; Now we have selected all the documents.
|
|
6282 (cond
|
|
6283 ((not groups)
|
|
6284 (error "None of the articles could be interpreted as documents"))
|
|
6285 ((gnus-group-read-ephemeral-group
|
|
6286 (setq vgroup (format
|
|
6287 "nnvirtual:%s-%s" gnus-newsgroup-name
|
|
6288 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
|
|
6289 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
|
|
6290 t
|
|
6291 (cons (current-buffer) 'summary)))
|
|
6292 (t
|
|
6293 (error "Couldn't select virtual nndoc group")))))
|
108
|
6294
|
98
|
6295 (defun gnus-summary-isearch-article (&optional regexp-p)
|
|
6296 "Do incremental search forward on the current article.
|
|
6297 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
|
|
6298 (interactive "P")
|
|
6299 (gnus-set-global-variables)
|
|
6300 (gnus-summary-select-article)
|
|
6301 (gnus-configure-windows 'article)
|
|
6302 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6303 ;;(goto-char (point-min))
|
|
6304 (isearch-forward regexp-p)))
|
|
6305
|
|
6306 (defun gnus-summary-search-article-forward (regexp &optional backward)
|
|
6307 "Search for an article containing REGEXP forward.
|
|
6308 If BACKWARD, search backward instead."
|
|
6309 (interactive
|
|
6310 (list (read-string
|
|
6311 (format "Search article %s (regexp%s): "
|
|
6312 (if current-prefix-arg "backward" "forward")
|
|
6313 (if gnus-last-search-regexp
|
|
6314 (concat ", default " gnus-last-search-regexp)
|
|
6315 "")))
|
|
6316 current-prefix-arg))
|
|
6317 (gnus-set-global-variables)
|
|
6318 (if (string-equal regexp "")
|
|
6319 (setq regexp (or gnus-last-search-regexp ""))
|
|
6320 (setq gnus-last-search-regexp regexp))
|
|
6321 (if (gnus-summary-search-article regexp backward)
|
|
6322 (gnus-summary-show-thread)
|
|
6323 (error "Search failed: \"%s\"" regexp)))
|
|
6324
|
|
6325 (defun gnus-summary-search-article-backward (regexp)
|
|
6326 "Search for an article containing REGEXP backward."
|
|
6327 (interactive
|
|
6328 (list (read-string
|
|
6329 (format "Search article backward (regexp%s): "
|
|
6330 (if gnus-last-search-regexp
|
|
6331 (concat ", default " gnus-last-search-regexp)
|
|
6332 "")))))
|
|
6333 (gnus-summary-search-article-forward regexp 'backward))
|
|
6334
|
|
6335 (defun gnus-summary-search-article (regexp &optional backward)
|
|
6336 "Search for an article containing REGEXP.
|
|
6337 Optional argument BACKWARD means do search for backward.
|
|
6338 `gnus-select-article-hook' is not called during the search."
|
151
|
6339 ;; We have to require this here to make sure that the following
|
|
6340 ;; dynamic binding isn't shadowed by autoloading.
|
153
|
6341 (require 'gnus-async)
|
98
|
6342 (let ((gnus-select-article-hook nil) ;Disable hook.
|
|
6343 (gnus-article-display-hook nil)
|
|
6344 (gnus-mark-article-hook nil) ;Inhibit marking as read.
|
|
6345 (gnus-use-article-prefetch nil)
|
|
6346 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
|
|
6347 (sum (current-buffer))
|
|
6348 (found nil)
|
|
6349 point)
|
|
6350 (gnus-save-hidden-threads
|
|
6351 (gnus-summary-select-article)
|
|
6352 (set-buffer gnus-article-buffer)
|
|
6353 (when backward
|
|
6354 (forward-line -1))
|
|
6355 (while (not found)
|
|
6356 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
|
|
6357 (if (if backward
|
|
6358 (re-search-backward regexp nil t)
|
|
6359 (re-search-forward regexp nil t))
|
|
6360 ;; We found the regexp.
|
|
6361 (progn
|
|
6362 (setq found 'found)
|
|
6363 (beginning-of-line)
|
|
6364 (set-window-start
|
|
6365 (get-buffer-window (current-buffer))
|
|
6366 (point))
|
|
6367 (forward-line 1)
|
|
6368 (set-buffer sum)
|
|
6369 (setq point (point)))
|
|
6370 ;; We didn't find it, so we go to the next article.
|
|
6371 (set-buffer sum)
|
|
6372 (setq found 'not)
|
|
6373 (while (eq found 'not)
|
|
6374 (if (not (if backward (gnus-summary-find-prev)
|
|
6375 (gnus-summary-find-next)))
|
|
6376 ;; No more articles.
|
|
6377 (setq found t)
|
|
6378 ;; Select the next article and adjust point.
|
|
6379 (unless (gnus-summary-article-sparse-p
|
|
6380 (gnus-summary-article-number))
|
|
6381 (setq found nil)
|
|
6382 (gnus-summary-select-article)
|
|
6383 (set-buffer gnus-article-buffer)
|
|
6384 (widen)
|
|
6385 (goto-char (if backward (point-max) (point-min))))))))
|
|
6386 (gnus-message 7 ""))
|
|
6387 ;; Return whether we found the regexp.
|
|
6388 (when (eq found 'found)
|
|
6389 (goto-char point)
|
|
6390 (gnus-summary-show-thread)
|
|
6391 (gnus-summary-goto-subject gnus-current-article)
|
|
6392 (gnus-summary-position-point)
|
|
6393 t)))
|
|
6394
|
|
6395 (defun gnus-summary-find-matching (header regexp &optional backward unread
|
|
6396 not-case-fold)
|
|
6397 "Return a list of all articles that match REGEXP on HEADER.
|
|
6398 The search stars on the current article and goes forwards unless
|
|
6399 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
|
|
6400 If UNREAD is non-nil, only unread articles will
|
|
6401 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
|
|
6402 in the comparisons."
|
|
6403 (let ((data (if (eq backward 'all) gnus-newsgroup-data
|
|
6404 (gnus-data-find-list
|
|
6405 (gnus-summary-article-number) (gnus-data-list backward))))
|
|
6406 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
|
|
6407 (case-fold-search (not not-case-fold))
|
|
6408 articles d)
|
|
6409 (unless (fboundp (intern (concat "mail-header-" header)))
|
|
6410 (error "%s is not a valid header" header))
|
|
6411 (while data
|
|
6412 (setq d (car data))
|
|
6413 (and (or (not unread) ; We want all articles...
|
|
6414 (gnus-data-unread-p d)) ; Or just unreads.
|
|
6415 (vectorp (gnus-data-header d)) ; It's not a pseudo.
|
|
6416 (string-match regexp (funcall func (gnus-data-header d))) ; Match.
|
|
6417 (push (gnus-data-number d) articles)) ; Success!
|
|
6418 (setq data (cdr data)))
|
|
6419 (nreverse articles)))
|
|
6420
|
|
6421 (defun gnus-summary-execute-command (header regexp command &optional backward)
|
|
6422 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
|
|
6423 If HEADER is an empty string (or nil), the match is done on the entire
|
|
6424 article. If BACKWARD (the prefix) is non-nil, search backward instead."
|
|
6425 (interactive
|
|
6426 (list (let ((completion-ignore-case t))
|
|
6427 (completing-read
|
|
6428 "Header name: "
|
|
6429 (mapcar (lambda (string) (list string))
|
|
6430 '("Number" "Subject" "From" "Lines" "Date"
|
|
6431 "Message-ID" "Xref" "References" "Body"))
|
|
6432 nil 'require-match))
|
|
6433 (read-string "Regexp: ")
|
|
6434 (read-key-sequence "Command: ")
|
|
6435 current-prefix-arg))
|
|
6436 (when (equal header "Body")
|
|
6437 (setq header ""))
|
|
6438 (gnus-set-global-variables)
|
|
6439 ;; Hidden thread subtrees must be searched as well.
|
|
6440 (gnus-summary-show-all-threads)
|
|
6441 ;; We don't want to change current point nor window configuration.
|
|
6442 (save-excursion
|
|
6443 (save-window-excursion
|
|
6444 (gnus-message 6 "Executing %s..." (key-description command))
|
|
6445 ;; We'd like to execute COMMAND interactively so as to give arguments.
|
|
6446 (gnus-execute header regexp
|
|
6447 `(call-interactively ',(key-binding command))
|
|
6448 backward)
|
|
6449 (gnus-message 6 "Executing %s...done" (key-description command)))))
|
|
6450
|
|
6451 (defun gnus-summary-beginning-of-article ()
|
|
6452 "Scroll the article back to the beginning."
|
|
6453 (interactive)
|
|
6454 (gnus-set-global-variables)
|
|
6455 (gnus-summary-select-article)
|
|
6456 (gnus-configure-windows 'article)
|
|
6457 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6458 (widen)
|
|
6459 (goto-char (point-min))
|
120
|
6460 (when gnus-page-broken
|
98
|
6461 (gnus-narrow-to-page))))
|
|
6462
|
|
6463 (defun gnus-summary-end-of-article ()
|
|
6464 "Scroll to the end of the article."
|
|
6465 (interactive)
|
|
6466 (gnus-set-global-variables)
|
|
6467 (gnus-summary-select-article)
|
|
6468 (gnus-configure-windows 'article)
|
|
6469 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6470 (widen)
|
|
6471 (goto-char (point-max))
|
|
6472 (recenter -3)
|
120
|
6473 (when gnus-page-broken
|
98
|
6474 (gnus-narrow-to-page))))
|
|
6475
|
|
6476 (defun gnus-summary-print-article (&optional filename)
|
|
6477 "Generate and print a PostScript image of the article buffer.
|
|
6478
|
|
6479 If the optional argument FILENAME is nil, send the image to the printer.
|
|
6480 If FILENAME is a string, save the PostScript image in a file with that
|
|
6481 name. If FILENAME is a number, prompt the user for the name of the file
|
|
6482 to save in."
|
|
6483 (interactive (list (ps-print-preprint current-prefix-arg)))
|
|
6484 (gnus-summary-select-article)
|
|
6485 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6486 (let ((buffer (generate-new-buffer " *print*")))
|
|
6487 (unwind-protect
|
|
6488 (progn
|
|
6489 (copy-to-buffer buffer (point-min) (point-max))
|
|
6490 (set-buffer buffer)
|
|
6491 (gnus-article-delete-invisible-text)
|
|
6492 (run-hooks 'gnus-ps-print-hook)
|
|
6493 (ps-print-buffer-with-faces filename))
|
|
6494 (kill-buffer buffer)))))
|
|
6495
|
|
6496 (defun gnus-summary-show-article (&optional arg)
|
|
6497 "Force re-fetching of the current article.
|
|
6498 If ARG (the prefix) is non-nil, show the raw article without any
|
|
6499 article massaging functions being run."
|
|
6500 (interactive "P")
|
|
6501 (gnus-set-global-variables)
|
|
6502 (if (not arg)
|
|
6503 ;; Select the article the normal way.
|
|
6504 (gnus-summary-select-article nil 'force)
|
|
6505 ;; Bind the article treatment functions to nil.
|
|
6506 (let ((gnus-have-all-headers t)
|
|
6507 gnus-article-display-hook
|
|
6508 gnus-article-prepare-hook
|
|
6509 gnus-break-pages
|
122
|
6510 gnus-show-mime
|
98
|
6511 gnus-visual)
|
|
6512 (gnus-summary-select-article nil 'force)))
|
|
6513 (gnus-summary-goto-subject gnus-current-article)
|
|
6514 (gnus-summary-position-point))
|
|
6515
|
|
6516 (defun gnus-summary-verbose-headers (&optional arg)
|
|
6517 "Toggle permanent full header display.
|
|
6518 If ARG is a positive number, turn header display on.
|
|
6519 If ARG is a negative number, turn header display off."
|
|
6520 (interactive "P")
|
|
6521 (gnus-set-global-variables)
|
|
6522 (setq gnus-show-all-headers
|
|
6523 (cond ((or (not (numberp arg))
|
|
6524 (zerop arg))
|
|
6525 (not gnus-show-all-headers))
|
|
6526 ((natnump arg)
|
|
6527 t)))
|
|
6528 (gnus-summary-show-article))
|
|
6529
|
|
6530 (defun gnus-summary-toggle-header (&optional arg)
|
|
6531 "Show the headers if they are hidden, or hide them if they are shown.
|
|
6532 If ARG is a positive number, show the entire header.
|
|
6533 If ARG is a negative number, hide the unwanted header lines."
|
|
6534 (interactive "P")
|
|
6535 (gnus-set-global-variables)
|
|
6536 (save-excursion
|
|
6537 (set-buffer gnus-article-buffer)
|
|
6538 (let* ((buffer-read-only nil)
|
|
6539 (inhibit-point-motion-hooks t)
|
|
6540 (hidden (text-property-any
|
|
6541 (goto-char (point-min)) (search-forward "\n\n")
|
|
6542 'invisible t))
|
|
6543 e)
|
|
6544 (goto-char (point-min))
|
|
6545 (when (search-forward "\n\n" nil t)
|
|
6546 (delete-region (point-min) (1- (point))))
|
|
6547 (goto-char (point-min))
|
|
6548 (save-excursion
|
|
6549 (set-buffer gnus-original-article-buffer)
|
|
6550 (goto-char (point-min))
|
|
6551 (setq e (1- (or (search-forward "\n\n" nil t) (point-max)))))
|
|
6552 (insert-buffer-substring gnus-original-article-buffer 1 e)
|
|
6553 (let ((article-inhibit-hiding t))
|
|
6554 (run-hooks 'gnus-article-display-hook))
|
|
6555 (when (or (not hidden) (and (numberp arg) (< arg 0)))
|
|
6556 (gnus-article-hide-headers)))))
|
|
6557
|
|
6558 (defun gnus-summary-show-all-headers ()
|
|
6559 "Make all header lines visible."
|
|
6560 (interactive)
|
|
6561 (gnus-set-global-variables)
|
|
6562 (gnus-article-show-all-headers))
|
|
6563
|
|
6564 (defun gnus-summary-toggle-mime (&optional arg)
|
|
6565 "Toggle MIME processing.
|
|
6566 If ARG is a positive number, turn MIME processing on."
|
|
6567 (interactive "P")
|
|
6568 (gnus-set-global-variables)
|
|
6569 (setq gnus-show-mime
|
|
6570 (if (null arg) (not gnus-show-mime)
|
|
6571 (> (prefix-numeric-value arg) 0)))
|
|
6572 (gnus-summary-select-article t 'force))
|
|
6573
|
|
6574 (defun gnus-summary-caesar-message (&optional arg)
|
|
6575 "Caesar rotate the current article by 13.
|
|
6576 The numerical prefix specifies how many places to rotate each letter
|
|
6577 forward."
|
|
6578 (interactive "P")
|
|
6579 (gnus-set-global-variables)
|
|
6580 (gnus-summary-select-article)
|
|
6581 (let ((mail-header-separator ""))
|
|
6582 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6583 (save-restriction
|
|
6584 (widen)
|
|
6585 (let ((start (window-start))
|
|
6586 buffer-read-only)
|
|
6587 (message-caesar-buffer-body arg)
|
|
6588 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
6589
|
|
6590 (defun gnus-summary-stop-page-breaking ()
|
|
6591 "Stop page breaking in the current article."
|
|
6592 (interactive)
|
|
6593 (gnus-set-global-variables)
|
|
6594 (gnus-summary-select-article)
|
|
6595 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
6596 (widen)
|
|
6597 (when (gnus-visual-p 'page-marker)
|
|
6598 (let ((buffer-read-only nil))
|
|
6599 (gnus-remove-text-with-property 'gnus-prev)
|
|
6600 (gnus-remove-text-with-property 'gnus-next)))))
|
|
6601
|
108
|
6602 (defun gnus-summary-move-article (&optional n to-newsgroup
|
98
|
6603 select-method action)
|
|
6604 "Move the current article to a different newsgroup.
|
|
6605 If N is a positive number, move the N next articles.
|
|
6606 If N is a negative number, move the N previous articles.
|
|
6607 If N is nil and any articles have been marked with the process mark,
|
|
6608 move those articles instead.
|
|
6609 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6610 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6611 re-spool using this method.
|
|
6612
|
|
6613 For this function to work, both the current newsgroup and the
|
|
6614 newsgroup that you want to move to have to support the `request-move'
|
|
6615 and `request-accept' functions."
|
|
6616 (interactive "P")
|
|
6617 (unless action
|
|
6618 (setq action 'move))
|
|
6619 (gnus-set-global-variables)
|
|
6620 ;; Disable marking as read.
|
|
6621 (let (gnus-mark-article-hook)
|
|
6622 (save-window-excursion
|
|
6623 (gnus-summary-select-article)))
|
|
6624 ;; Check whether the source group supports the required functions.
|
|
6625 (cond ((and (eq action 'move)
|
|
6626 (not (gnus-check-backend-function
|
|
6627 'request-move-article gnus-newsgroup-name)))
|
|
6628 (error "The current group does not support article moving"))
|
|
6629 ((and (eq action 'crosspost)
|
|
6630 (not (gnus-check-backend-function
|
|
6631 'request-replace-article gnus-newsgroup-name)))
|
|
6632 (error "The current group does not support article editing")))
|
|
6633 (let ((articles (gnus-summary-work-articles n))
|
|
6634 (prefix (gnus-group-real-prefix gnus-newsgroup-name))
|
|
6635 (names '((move "Move" "Moving")
|
|
6636 (copy "Copy" "Copying")
|
|
6637 (crosspost "Crosspost" "Crossposting")))
|
|
6638 (copy-buf (save-excursion
|
|
6639 (nnheader-set-temp-buffer " *copy article*")))
|
|
6640 art-group to-method new-xref article to-groups)
|
|
6641 (unless (assq action names)
|
|
6642 (error "Unknown action %s" action))
|
|
6643 ;; Read the newsgroup name.
|
|
6644 (when (and (not to-newsgroup)
|
|
6645 (not select-method))
|
|
6646 (setq to-newsgroup
|
|
6647 (gnus-read-move-group-name
|
|
6648 (cadr (assq action names))
|
|
6649 (symbol-value (intern (format "gnus-current-%s-group" action)))
|
|
6650 articles prefix))
|
|
6651 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
|
108
|
6652 (setq to-method (or select-method
|
98
|
6653 (gnus-group-name-to-method to-newsgroup)))
|
|
6654 ;; Check the method we are to move this article to...
|
108
|
6655 (unless (gnus-check-backend-function
|
98
|
6656 'request-accept-article (car to-method))
|
|
6657 (error "%s does not support article copying" (car to-method)))
|
|
6658 (unless (gnus-check-server to-method)
|
|
6659 (error "Can't open server %s" (car to-method)))
|
|
6660 (gnus-message 6 "%s to %s: %s..."
|
|
6661 (caddr (assq action names))
|
|
6662 (or (car select-method) to-newsgroup) articles)
|
|
6663 (while articles
|
|
6664 (setq article (pop articles))
|
|
6665 (setq
|
|
6666 art-group
|
|
6667 (cond
|
|
6668 ;; Move the article.
|
|
6669 ((eq action 'move)
|
153
|
6670 ;; Remove this article from future suppression.
|
|
6671 (gnus-dup-unsuppress-article article)
|
98
|
6672 (gnus-request-move-article
|
|
6673 article ; Article to move
|
|
6674 gnus-newsgroup-name ; From newsgroup
|
|
6675 (nth 1 (gnus-find-method-for-group
|
|
6676 gnus-newsgroup-name)) ; Server
|
|
6677 (list 'gnus-request-accept-article
|
|
6678 to-newsgroup (list 'quote select-method)
|
|
6679 (not articles)) ; Accept form
|
|
6680 (not articles))) ; Only save nov last time
|
|
6681 ;; Copy the article.
|
|
6682 ((eq action 'copy)
|
|
6683 (save-excursion
|
|
6684 (set-buffer copy-buf)
|
|
6685 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
|
6686 (gnus-request-accept-article
|
|
6687 to-newsgroup select-method (not articles))))
|
|
6688 ;; Crosspost the article.
|
|
6689 ((eq action 'crosspost)
|
|
6690 (let ((xref (message-tokenize-header
|
|
6691 (mail-header-xref (gnus-summary-article-header article))
|
|
6692 " ")))
|
|
6693 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
|
|
6694 ":" article))
|
108
|
6695 (unless xref
|
98
|
6696 (setq xref (list (system-name))))
|
|
6697 (setq new-xref
|
|
6698 (concat
|
108
|
6699 (mapconcat 'identity
|
98
|
6700 (delete "Xref:" (delete new-xref xref))
|
|
6701 " ")
|
108
|
6702 " " new-xref))
|
98
|
6703 (save-excursion
|
|
6704 (set-buffer copy-buf)
|
108
|
6705 ;; First put the article in the destination group.
|
98
|
6706 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
116
|
6707 (when (consp (setq art-group
|
|
6708 (gnus-request-accept-article
|
|
6709 to-newsgroup select-method (not articles))))
|
|
6710 (setq new-xref (concat new-xref " " (car art-group)
|
|
6711 ":" (cdr art-group)))
|
|
6712 ;; Now we have the new Xrefs header, so we insert
|
|
6713 ;; it and replace the new article.
|
|
6714 (nnheader-replace-header "Xref" new-xref)
|
|
6715 (gnus-request-replace-article
|
|
6716 (cdr art-group) to-newsgroup (current-buffer))
|
|
6717 art-group))))))
|
|
6718 (cond
|
|
6719 ((not art-group)
|
|
6720 (gnus-message 1 "Couldn't %s article %s"
|
|
6721 (cadr (assq action names)) article))
|
|
6722 ((and (eq art-group 'junk)
|
|
6723 (eq action 'move))
|
|
6724 (gnus-summary-mark-article article gnus-canceled-mark)
|
|
6725 (gnus-message 4 "Deleted article %s" article))
|
|
6726 (t
|
98
|
6727 (let* ((entry
|
|
6728 (or
|
|
6729 (gnus-gethash (car art-group) gnus-newsrc-hashtb)
|
|
6730 (gnus-gethash
|
|
6731 (gnus-group-prefixed-name
|
|
6732 (car art-group)
|
108
|
6733 (or select-method
|
98
|
6734 (gnus-find-method-for-group to-newsgroup)))
|
|
6735 gnus-newsrc-hashtb)))
|
|
6736 (info (nth 2 entry))
|
|
6737 (to-group (gnus-info-group info)))
|
|
6738 ;; Update the group that has been moved to.
|
|
6739 (when (and info
|
|
6740 (memq action '(move copy)))
|
|
6741 (unless (member to-group to-groups)
|
|
6742 (push to-group to-groups))
|
|
6743
|
|
6744 (unless (memq article gnus-newsgroup-unreads)
|
|
6745 (gnus-info-set-read
|
|
6746 info (gnus-add-to-range (gnus-info-read info)
|
|
6747 (list (cdr art-group)))))
|
|
6748
|
|
6749 ;; Copy any marks over to the new group.
|
|
6750 (let ((marks gnus-article-mark-lists)
|
|
6751 (to-article (cdr art-group)))
|
|
6752
|
|
6753 ;; See whether the article is to be put in the cache.
|
|
6754 (when gnus-use-cache
|
|
6755 (gnus-cache-possibly-enter-article
|
|
6756 to-group to-article
|
|
6757 (let ((header (copy-sequence
|
|
6758 (gnus-summary-article-header article))))
|
|
6759 (mail-header-set-number header to-article)
|
|
6760 header)
|
|
6761 (memq article gnus-newsgroup-marked)
|
|
6762 (memq article gnus-newsgroup-dormant)
|
|
6763 (memq article gnus-newsgroup-unreads)))
|
|
6764
|
|
6765 (when (and (equal to-group gnus-newsgroup-name)
|
|
6766 (not (memq article gnus-newsgroup-unreads)))
|
|
6767 ;; Mark this article as read in this group.
|
|
6768 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
|
|
6769 (setcdr (gnus-active to-group) to-article)
|
|
6770 (setcdr gnus-newsgroup-active to-article))
|
108
|
6771
|
98
|
6772 (while marks
|
|
6773 (when (memq article (symbol-value
|
|
6774 (intern (format "gnus-newsgroup-%s"
|
|
6775 (caar marks)))))
|
|
6776 ;; If the other group is the same as this group,
|
|
6777 ;; then we have to add the mark to the list.
|
|
6778 (when (equal to-group gnus-newsgroup-name)
|
|
6779 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
|
|
6780 (cons to-article
|
|
6781 (symbol-value
|
|
6782 (intern (format "gnus-newsgroup-%s"
|
|
6783 (caar marks)))))))
|
|
6784 ;; Copy the marks to other group.
|
|
6785 (gnus-add-marked-articles
|
|
6786 to-group (cdar marks) (list to-article) info))
|
120
|
6787 (setq marks (cdr marks)))
|
|
6788
|
|
6789 (gnus-dribble-enter
|
|
6790 (concat "(gnus-group-set-info '"
|
|
6791 (gnus-prin1-to-string (gnus-get-info to-group))
|
|
6792 ")"))))
|
98
|
6793
|
|
6794 ;; Update the Xref header in this article to point to
|
|
6795 ;; the new crossposted article we have just created.
|
|
6796 (when (eq action 'crosspost)
|
|
6797 (save-excursion
|
|
6798 (set-buffer copy-buf)
|
|
6799 (gnus-request-article-this-buffer article gnus-newsgroup-name)
|
108
|
6800 (nnheader-replace-header "Xref" new-xref)
|
98
|
6801 (gnus-request-replace-article
|
|
6802 article gnus-newsgroup-name (current-buffer)))))
|
|
6803
|
|
6804 (gnus-summary-goto-subject article)
|
|
6805 (when (eq action 'move)
|
116
|
6806 (gnus-summary-mark-article article gnus-canceled-mark))))
|
98
|
6807 (gnus-summary-remove-process-mark article))
|
|
6808 ;; Re-activate all groups that have been moved to.
|
|
6809 (while to-groups
|
122
|
6810 (save-excursion
|
|
6811 (set-buffer gnus-group-buffer)
|
|
6812 (when (gnus-group-goto-group (car to-groups) t)
|
153
|
6813 (gnus-group-get-new-news-this-group 1 t))
|
122
|
6814 (pop to-groups)))
|
108
|
6815
|
98
|
6816 (gnus-kill-buffer copy-buf)
|
|
6817 (gnus-summary-position-point)
|
|
6818 (gnus-set-mode-line 'summary)))
|
|
6819
|
|
6820 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
|
|
6821 "Move the current article to a different newsgroup.
|
|
6822 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
|
|
6823 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
|
|
6824 re-spool using this method."
|
|
6825 (interactive "P")
|
100
|
6826 (gnus-summary-move-article n to-newsgroup select-method 'copy))
|
98
|
6827
|
|
6828 (defun gnus-summary-crosspost-article (&optional n)
|
|
6829 "Crosspost the current article to some other group."
|
|
6830 (interactive "P")
|
|
6831 (gnus-summary-move-article n nil nil 'crosspost))
|
|
6832
|
|
6833 (defcustom gnus-summary-respool-default-method nil
|
108
|
6834 "Default method for respooling an article.
|
98
|
6835 If nil, use to the current newsgroup method."
|
|
6836 :type 'gnus-select-method-name
|
|
6837 :group 'gnus-summary-mail)
|
|
6838
|
|
6839 (defun gnus-summary-respool-article (&optional n method)
|
|
6840 "Respool the current article.
|
|
6841 The article will be squeezed through the mail spooling process again,
|
|
6842 which means that it will be put in some mail newsgroup or other
|
|
6843 depending on `nnmail-split-methods'.
|
|
6844 If N is a positive number, respool the N next articles.
|
|
6845 If N is a negative number, respool the N previous articles.
|
|
6846 If N is nil and any articles have been marked with the process mark,
|
|
6847 respool those articles instead.
|
|
6848
|
|
6849 Respooling can be done both from mail groups and \"real\" newsgroups.
|
|
6850 In the former case, the articles in question will be moved from the
|
|
6851 current group into whatever groups they are destined to. In the
|
|
6852 latter case, they will be copied into the relevant groups."
|
108
|
6853 (interactive
|
98
|
6854 (list current-prefix-arg
|
|
6855 (let* ((methods (gnus-methods-using 'respool))
|
|
6856 (methname
|
|
6857 (symbol-name (or gnus-summary-respool-default-method
|
|
6858 (car (gnus-find-method-for-group
|
|
6859 gnus-newsgroup-name)))))
|
|
6860 (method
|
108
|
6861 (gnus-completing-read
|
98
|
6862 methname "What backend do you want to use when respooling?"
|
|
6863 methods nil t nil 'gnus-mail-method-history))
|
|
6864 ms)
|
|
6865 (cond
|
108
|
6866 ((zerop (length (setq ms (gnus-servers-using-backend
|
98
|
6867 (intern method)))))
|
|
6868 (list (intern method) ""))
|
|
6869 ((= 1 (length ms))
|
|
6870 (car ms))
|
|
6871 (t
|
|
6872 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
|
|
6873 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
|
|
6874 ms-alist))))))))
|
|
6875 (gnus-set-global-variables)
|
|
6876 (unless method
|
|
6877 (error "No method given for respooling"))
|
|
6878 (if (assoc (symbol-name
|
|
6879 (car (gnus-find-method-for-group gnus-newsgroup-name)))
|
|
6880 (gnus-methods-using 'respool))
|
|
6881 (gnus-summary-move-article n nil method)
|
|
6882 (gnus-summary-copy-article n nil method)))
|
|
6883
|
|
6884 (defun gnus-summary-import-article (file)
|
|
6885 "Import a random file into a mail newsgroup."
|
|
6886 (interactive "fImport file: ")
|
|
6887 (gnus-set-global-variables)
|
|
6888 (let ((group gnus-newsgroup-name)
|
|
6889 (now (current-time))
|
|
6890 atts lines)
|
|
6891 (unless (gnus-check-backend-function 'request-accept-article group)
|
|
6892 (error "%s does not support article importing" group))
|
|
6893 (or (file-readable-p file)
|
|
6894 (not (file-regular-p file))
|
|
6895 (error "Can't read %s" file))
|
|
6896 (save-excursion
|
|
6897 (set-buffer (get-buffer-create " *import file*"))
|
|
6898 (buffer-disable-undo (current-buffer))
|
|
6899 (erase-buffer)
|
|
6900 (insert-file-contents file)
|
|
6901 (goto-char (point-min))
|
|
6902 (unless (nnheader-article-p)
|
|
6903 ;; This doesn't look like an article, so we fudge some headers.
|
|
6904 (setq atts (file-attributes file)
|
|
6905 lines (count-lines (point-min) (point-max)))
|
|
6906 (insert "From: " (read-string "From: ") "\n"
|
|
6907 "Subject: " (read-string "Subject: ") "\n"
|
|
6908 "Date: " (timezone-make-date-arpa-standard
|
|
6909 (current-time-string (nth 5 atts))
|
|
6910 (current-time-zone now)
|
|
6911 (current-time-zone now))
|
|
6912 "\n"
|
|
6913 "Message-ID: " (message-make-message-id) "\n"
|
|
6914 "Lines: " (int-to-string lines) "\n"
|
|
6915 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
|
|
6916 (gnus-request-accept-article group nil t)
|
|
6917 (kill-buffer (current-buffer)))))
|
|
6918
|
|
6919 (defun gnus-summary-article-posted-p ()
|
|
6920 "Say whether the current (mail) article is available from `gnus-select-method' as well.
|
|
6921 This will be the case if the article has both been mailed and posted."
|
|
6922 (interactive)
|
|
6923 (let ((id (mail-header-references (gnus-summary-article-header)))
|
|
6924 (gnus-override-method
|
|
6925 (or gnus-refer-article-method gnus-select-method)))
|
|
6926 (if (gnus-request-head id "")
|
|
6927 (gnus-message 2 "The current message was found on %s"
|
|
6928 gnus-override-method)
|
|
6929 (gnus-message 2 "The current message couldn't be found on %s"
|
|
6930 gnus-override-method)
|
|
6931 nil)))
|
|
6932
|
|
6933 (defun gnus-summary-expire-articles (&optional now)
|
|
6934 "Expire all articles that are marked as expirable in the current group."
|
|
6935 (interactive)
|
|
6936 (gnus-set-global-variables)
|
|
6937 (when (gnus-check-backend-function
|
|
6938 'request-expire-articles gnus-newsgroup-name)
|
|
6939 ;; This backend supports expiry.
|
|
6940 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
|
|
6941 (expirable (if total
|
|
6942 (progn
|
|
6943 ;; We need to update the info for
|
|
6944 ;; this group for `gnus-list-of-read-articles'
|
|
6945 ;; to give us the right answer.
|
|
6946 (run-hooks 'gnus-exit-group-hook)
|
|
6947 (gnus-summary-update-info)
|
|
6948 (gnus-list-of-read-articles gnus-newsgroup-name))
|
|
6949 (setq gnus-newsgroup-expirable
|
|
6950 (sort gnus-newsgroup-expirable '<))))
|
|
6951 (expiry-wait (if now 'immediate
|
|
6952 (gnus-group-find-parameter
|
|
6953 gnus-newsgroup-name 'expiry-wait)))
|
|
6954 es)
|
|
6955 (when expirable
|
|
6956 ;; There are expirable articles in this group, so we run them
|
|
6957 ;; through the expiry process.
|
|
6958 (gnus-message 6 "Expiring articles...")
|
|
6959 ;; The list of articles that weren't expired is returned.
|
|
6960 (if expiry-wait
|
|
6961 (let ((nnmail-expiry-wait-function nil)
|
|
6962 (nnmail-expiry-wait expiry-wait))
|
|
6963 (setq es (gnus-request-expire-articles
|
|
6964 expirable gnus-newsgroup-name)))
|
|
6965 (setq es (gnus-request-expire-articles
|
|
6966 expirable gnus-newsgroup-name)))
|
|
6967 (unless total
|
|
6968 (setq gnus-newsgroup-expirable es))
|
|
6969 ;; We go through the old list of expirable, and mark all
|
|
6970 ;; really expired articles as nonexistent.
|
|
6971 (unless (eq es expirable) ;If nothing was expired, we don't mark.
|
|
6972 (let ((gnus-use-cache nil))
|
|
6973 (while expirable
|
|
6974 (unless (memq (car expirable) es)
|
|
6975 (when (gnus-data-find (car expirable))
|
|
6976 (gnus-summary-mark-article
|
|
6977 (car expirable) gnus-canceled-mark)))
|
|
6978 (setq expirable (cdr expirable)))))
|
|
6979 (gnus-message 6 "Expiring articles...done")))))
|
|
6980
|
|
6981 (defun gnus-summary-expire-articles-now ()
|
|
6982 "Expunge all expirable articles in the current group.
|
|
6983 This means that *all* articles that are marked as expirable will be
|
|
6984 deleted forever, right now."
|
|
6985 (interactive)
|
|
6986 (gnus-set-global-variables)
|
|
6987 (or gnus-expert-user
|
|
6988 (gnus-yes-or-no-p
|
|
6989 "Are you really, really, really sure you want to delete all these messages? ")
|
|
6990 (error "Phew!"))
|
|
6991 (gnus-summary-expire-articles t))
|
|
6992
|
|
6993 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
|
|
6994 (defun gnus-summary-delete-article (&optional n)
|
|
6995 "Delete the N next (mail) articles.
|
|
6996 This command actually deletes articles. This is not a marking
|
|
6997 command. The article will disappear forever from your life, never to
|
|
6998 return.
|
|
6999 If N is negative, delete backwards.
|
|
7000 If N is nil and articles have been marked with the process mark,
|
|
7001 delete these instead."
|
|
7002 (interactive "P")
|
|
7003 (gnus-set-global-variables)
|
|
7004 (unless (gnus-check-backend-function 'request-expire-articles
|
|
7005 gnus-newsgroup-name)
|
|
7006 (error "The current newsgroup does not support article deletion."))
|
|
7007 ;; Compute the list of articles to delete.
|
|
7008 (let ((articles (gnus-summary-work-articles n))
|
|
7009 not-deleted)
|
|
7010 (if (and gnus-novice-user
|
|
7011 (not (gnus-yes-or-no-p
|
|
7012 (format "Do you really want to delete %s forever? "
|
|
7013 (if (> (length articles) 1)
|
|
7014 (format "these %s articles" (length articles))
|
|
7015 "this article")))))
|
|
7016 ()
|
|
7017 ;; Delete the articles.
|
|
7018 (setq not-deleted (gnus-request-expire-articles
|
|
7019 articles gnus-newsgroup-name 'force))
|
|
7020 (while articles
|
|
7021 (gnus-summary-remove-process-mark (car articles))
|
|
7022 ;; The backend might not have been able to delete the article
|
|
7023 ;; after all.
|
|
7024 (unless (memq (car articles) not-deleted)
|
|
7025 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
|
108
|
7026 (setq articles (cdr articles)))
|
|
7027 (when not-deleted
|
|
7028 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
|
98
|
7029 (gnus-summary-position-point)
|
|
7030 (gnus-set-mode-line 'summary)
|
|
7031 not-deleted))
|
|
7032
|
|
7033 (defun gnus-summary-edit-article (&optional force)
|
|
7034 "Edit the current article.
|
|
7035 This will have permanent effect only in mail groups.
|
|
7036 If FORCE is non-nil, allow editing of articles even in read-only
|
108
|
7037 groups."
|
98
|
7038 (interactive "P")
|
|
7039 (save-excursion
|
|
7040 (set-buffer gnus-summary-buffer)
|
|
7041 (gnus-set-global-variables)
|
|
7042 (when (and (not force)
|
|
7043 (gnus-group-read-only-p))
|
|
7044 (error "The current newsgroup does not support article editing."))
|
|
7045 ;; Select article if needed.
|
|
7046 (unless (eq (gnus-summary-article-number)
|
|
7047 gnus-current-article)
|
|
7048 (gnus-summary-select-article t))
|
|
7049 (gnus-article-edit-article
|
|
7050 `(lambda ()
|
|
7051 (gnus-summary-edit-article-done
|
|
7052 ,(or (mail-header-references gnus-current-headers) "")
|
|
7053 ,(gnus-group-read-only-p) ,gnus-summary-buffer)))))
|
|
7054
|
|
7055 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
|
|
7056
|
|
7057 (defun gnus-summary-edit-article-done (&optional references read-only buffer)
|
|
7058 "Make edits to the current article permanent."
|
|
7059 (interactive)
|
|
7060 ;; Replace the article.
|
|
7061 (if (and (not read-only)
|
|
7062 (not (gnus-request-replace-article
|
|
7063 (cdr gnus-article-current) (car gnus-article-current)
|
|
7064 (current-buffer))))
|
|
7065 (error "Couldn't replace article.")
|
|
7066 ;; Update the summary buffer.
|
|
7067 (if (and references
|
|
7068 (equal (message-tokenize-header references " ")
|
|
7069 (message-tokenize-header
|
|
7070 (or (message-fetch-field "references") "") " ")))
|
|
7071 ;; We only have to update this line.
|
|
7072 (save-excursion
|
|
7073 (save-restriction
|
|
7074 (message-narrow-to-head)
|
|
7075 (let ((head (buffer-string))
|
|
7076 header)
|
|
7077 (nnheader-temp-write nil
|
|
7078 (insert (format "211 %d Article retrieved.\n"
|
|
7079 (cdr gnus-article-current)))
|
|
7080 (insert head)
|
|
7081 (insert ".\n")
|
|
7082 (let ((nntp-server-buffer (current-buffer)))
|
|
7083 (setq header (car (gnus-get-newsgroup-headers
|
|
7084 (save-excursion
|
|
7085 (set-buffer gnus-summary-buffer)
|
|
7086 gnus-newsgroup-dependencies)
|
|
7087 t))))
|
|
7088 (save-excursion
|
|
7089 (set-buffer gnus-summary-buffer)
|
|
7090 (gnus-data-set-header
|
|
7091 (gnus-data-find (cdr gnus-article-current))
|
|
7092 header)
|
|
7093 (gnus-summary-update-article-line
|
|
7094 (cdr gnus-article-current) header))))))
|
|
7095 ;; Update threads.
|
|
7096 (set-buffer (or buffer gnus-summary-buffer))
|
|
7097 (gnus-summary-update-article (cdr gnus-article-current)))
|
|
7098 ;; Prettify the article buffer again.
|
|
7099 (save-excursion
|
|
7100 (set-buffer gnus-article-buffer)
|
|
7101 (run-hooks 'gnus-article-display-hook)
|
|
7102 (set-buffer gnus-original-article-buffer)
|
|
7103 (gnus-request-article
|
|
7104 (cdr gnus-article-current) (car gnus-article-current) (current-buffer)))
|
|
7105 ;; Prettify the summary buffer line.
|
|
7106 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
7107 (run-hooks 'gnus-visual-mark-article-hook))))
|
|
7108
|
|
7109 (defun gnus-summary-edit-wash (key)
|
|
7110 "Perform editing command in the article buffer."
|
108
|
7111 (interactive
|
98
|
7112 (list
|
|
7113 (progn
|
|
7114 (message "%s" (concat (this-command-keys) "- "))
|
|
7115 (read-char))))
|
|
7116 (message "")
|
|
7117 (gnus-summary-edit-article)
|
|
7118 (execute-kbd-macro (concat (this-command-keys) key))
|
|
7119 (gnus-article-edit-done))
|
|
7120
|
|
7121 ;;; Respooling
|
|
7122
|
116
|
7123 (defun gnus-summary-respool-query (&optional silent)
|
98
|
7124 "Query where the respool algorithm would put this article."
|
|
7125 (interactive)
|
|
7126 (gnus-set-global-variables)
|
|
7127 (let (gnus-mark-article-hook)
|
|
7128 (gnus-summary-select-article)
|
|
7129 (save-excursion
|
108
|
7130 (set-buffer gnus-original-article-buffer)
|
98
|
7131 (save-restriction
|
108
|
7132 (message-narrow-to-head)
|
116
|
7133 (let ((groups (nnmail-article-group 'identity)))
|
|
7134 (unless silent
|
|
7135 (if groups
|
|
7136 (message "This message would go to %s"
|
|
7137 (mapconcat 'car groups ", "))
|
|
7138 (message "This message would go to no groups"))
|
|
7139 groups))))))
|
98
|
7140
|
|
7141 ;; Summary marking commands.
|
|
7142
|
|
7143 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
|
|
7144 "Mark articles which has the same subject as read, and then select the next.
|
|
7145 If UNMARK is positive, remove any kind of mark.
|
|
7146 If UNMARK is negative, tick articles."
|
|
7147 (interactive "P")
|
|
7148 (gnus-set-global-variables)
|
|
7149 (when unmark
|
|
7150 (setq unmark (prefix-numeric-value unmark)))
|
|
7151 (let ((count
|
|
7152 (gnus-summary-mark-same-subject
|
|
7153 (gnus-summary-article-subject) unmark)))
|
|
7154 ;; Select next unread article. If auto-select-same mode, should
|
|
7155 ;; select the first unread article.
|
|
7156 (gnus-summary-next-article t (and gnus-auto-select-same
|
|
7157 (gnus-summary-article-subject)))
|
|
7158 (gnus-message 7 "%d article%s marked as %s"
|
|
7159 count (if (= count 1) " is" "s are")
|
|
7160 (if unmark "unread" "read"))))
|
|
7161
|
|
7162 (defun gnus-summary-kill-same-subject (&optional unmark)
|
|
7163 "Mark articles which has the same subject as read.
|
|
7164 If UNMARK is positive, remove any kind of mark.
|
|
7165 If UNMARK is negative, tick articles."
|
|
7166 (interactive "P")
|
|
7167 (gnus-set-global-variables)
|
|
7168 (when unmark
|
|
7169 (setq unmark (prefix-numeric-value unmark)))
|
|
7170 (let ((count
|
|
7171 (gnus-summary-mark-same-subject
|
|
7172 (gnus-summary-article-subject) unmark)))
|
|
7173 ;; If marked as read, go to next unread subject.
|
|
7174 (when (null unmark)
|
|
7175 ;; Go to next unread subject.
|
|
7176 (gnus-summary-next-subject 1 t))
|
|
7177 (gnus-message 7 "%d articles are marked as %s"
|
|
7178 count (if unmark "unread" "read"))))
|
|
7179
|
|
7180 (defun gnus-summary-mark-same-subject (subject &optional unmark)
|
|
7181 "Mark articles with same SUBJECT as read, and return marked number.
|
|
7182 If optional argument UNMARK is positive, remove any kinds of marks.
|
|
7183 If optional argument UNMARK is negative, mark articles as unread instead."
|
|
7184 (let ((count 1))
|
|
7185 (save-excursion
|
|
7186 (cond
|
|
7187 ((null unmark) ; Mark as read.
|
|
7188 (while (and
|
|
7189 (progn
|
|
7190 (gnus-summary-mark-article-as-read gnus-killed-mark)
|
|
7191 (gnus-summary-show-thread) t)
|
|
7192 (gnus-summary-find-subject subject))
|
|
7193 (setq count (1+ count))))
|
|
7194 ((> unmark 0) ; Tick.
|
|
7195 (while (and
|
|
7196 (progn
|
|
7197 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
|
|
7198 (gnus-summary-show-thread) t)
|
|
7199 (gnus-summary-find-subject subject))
|
|
7200 (setq count (1+ count))))
|
|
7201 (t ; Mark as unread.
|
|
7202 (while (and
|
|
7203 (progn
|
|
7204 (gnus-summary-mark-article-as-unread gnus-unread-mark)
|
|
7205 (gnus-summary-show-thread) t)
|
|
7206 (gnus-summary-find-subject subject))
|
|
7207 (setq count (1+ count)))))
|
|
7208 (gnus-set-mode-line 'summary)
|
|
7209 ;; Return the number of marked articles.
|
|
7210 count)))
|
|
7211
|
|
7212 (defun gnus-summary-mark-as-processable (n &optional unmark)
|
|
7213 "Set the process mark on the next N articles.
|
|
7214 If N is negative, mark backward instead. If UNMARK is non-nil, remove
|
|
7215 the process mark instead. The difference between N and the actual
|
|
7216 number of articles marked is returned."
|
|
7217 (interactive "p")
|
|
7218 (gnus-set-global-variables)
|
|
7219 (let ((backward (< n 0))
|
|
7220 (n (abs n)))
|
|
7221 (while (and
|
|
7222 (> n 0)
|
|
7223 (if unmark
|
|
7224 (gnus-summary-remove-process-mark
|
|
7225 (gnus-summary-article-number))
|
|
7226 (gnus-summary-set-process-mark (gnus-summary-article-number)))
|
|
7227 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
|
|
7228 (setq n (1- n)))
|
|
7229 (when (/= 0 n)
|
|
7230 (gnus-message 7 "No more articles"))
|
|
7231 (gnus-summary-recenter)
|
|
7232 (gnus-summary-position-point)
|
|
7233 n))
|
|
7234
|
|
7235 (defun gnus-summary-unmark-as-processable (n)
|
|
7236 "Remove the process mark from the next N articles.
|
|
7237 If N is negative, mark backward instead. The difference between N and
|
|
7238 the actual number of articles marked is returned."
|
|
7239 (interactive "p")
|
|
7240 (gnus-set-global-variables)
|
|
7241 (gnus-summary-mark-as-processable n t))
|
|
7242
|
|
7243 (defun gnus-summary-unmark-all-processable ()
|
|
7244 "Remove the process mark from all articles."
|
|
7245 (interactive)
|
|
7246 (gnus-set-global-variables)
|
|
7247 (save-excursion
|
|
7248 (while gnus-newsgroup-processable
|
|
7249 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
|
|
7250 (gnus-summary-position-point))
|
|
7251
|
|
7252 (defun gnus-summary-mark-as-expirable (n)
|
|
7253 "Mark N articles forward as expirable.
|
|
7254 If N is negative, mark backward instead. The difference between N and
|
|
7255 the actual number of articles marked is returned."
|
|
7256 (interactive "p")
|
|
7257 (gnus-set-global-variables)
|
|
7258 (gnus-summary-mark-forward n gnus-expirable-mark))
|
|
7259
|
|
7260 (defun gnus-summary-mark-article-as-replied (article)
|
|
7261 "Mark ARTICLE replied and update the summary line."
|
|
7262 (push article gnus-newsgroup-replied)
|
|
7263 (let ((buffer-read-only nil))
|
|
7264 (when (gnus-summary-goto-subject article)
|
|
7265 (gnus-summary-update-secondary-mark article))))
|
|
7266
|
|
7267 (defun gnus-summary-set-bookmark (article)
|
|
7268 "Set a bookmark in current article."
|
|
7269 (interactive (list (gnus-summary-article-number)))
|
|
7270 (gnus-set-global-variables)
|
|
7271 (when (or (not (get-buffer gnus-article-buffer))
|
|
7272 (not gnus-current-article)
|
|
7273 (not gnus-article-current)
|
|
7274 (not (equal gnus-newsgroup-name (car gnus-article-current))))
|
|
7275 (error "No current article selected"))
|
|
7276 ;; Remove old bookmark, if one exists.
|
|
7277 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7278 (when old
|
|
7279 (setq gnus-newsgroup-bookmarks
|
|
7280 (delq old gnus-newsgroup-bookmarks))))
|
|
7281 ;; Set the new bookmark, which is on the form
|
|
7282 ;; (article-number . line-number-in-body).
|
|
7283 (push
|
|
7284 (cons article
|
|
7285 (save-excursion
|
|
7286 (set-buffer gnus-article-buffer)
|
|
7287 (count-lines
|
|
7288 (min (point)
|
|
7289 (save-excursion
|
|
7290 (goto-char (point-min))
|
|
7291 (search-forward "\n\n" nil t)
|
|
7292 (point)))
|
|
7293 (point))))
|
|
7294 gnus-newsgroup-bookmarks)
|
|
7295 (gnus-message 6 "A bookmark has been added to the current article."))
|
|
7296
|
|
7297 (defun gnus-summary-remove-bookmark (article)
|
|
7298 "Remove the bookmark from the current article."
|
|
7299 (interactive (list (gnus-summary-article-number)))
|
|
7300 (gnus-set-global-variables)
|
|
7301 ;; Remove old bookmark, if one exists.
|
|
7302 (let ((old (assq article gnus-newsgroup-bookmarks)))
|
|
7303 (if old
|
|
7304 (progn
|
|
7305 (setq gnus-newsgroup-bookmarks
|
|
7306 (delq old gnus-newsgroup-bookmarks))
|
|
7307 (gnus-message 6 "Removed bookmark."))
|
|
7308 (gnus-message 6 "No bookmark in current article."))))
|
|
7309
|
|
7310 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7311 (defun gnus-summary-mark-as-dormant (n)
|
|
7312 "Mark N articles forward as dormant.
|
|
7313 If N is negative, mark backward instead. The difference between N and
|
|
7314 the actual number of articles marked is returned."
|
|
7315 (interactive "p")
|
|
7316 (gnus-set-global-variables)
|
|
7317 (gnus-summary-mark-forward n gnus-dormant-mark))
|
|
7318
|
|
7319 (defun gnus-summary-set-process-mark (article)
|
|
7320 "Set the process mark on ARTICLE and update the summary line."
|
|
7321 (setq gnus-newsgroup-processable
|
|
7322 (cons article
|
|
7323 (delq article gnus-newsgroup-processable)))
|
|
7324 (when (gnus-summary-goto-subject article)
|
|
7325 (gnus-summary-show-thread)
|
|
7326 (gnus-summary-update-secondary-mark article)))
|
|
7327
|
|
7328 (defun gnus-summary-remove-process-mark (article)
|
|
7329 "Remove the process mark from ARTICLE and update the summary line."
|
|
7330 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
|
|
7331 (when (gnus-summary-goto-subject article)
|
|
7332 (gnus-summary-show-thread)
|
|
7333 (gnus-summary-update-secondary-mark article)))
|
|
7334
|
|
7335 (defun gnus-summary-set-saved-mark (article)
|
|
7336 "Set the process mark on ARTICLE and update the summary line."
|
|
7337 (push article gnus-newsgroup-saved)
|
|
7338 (when (gnus-summary-goto-subject article)
|
|
7339 (gnus-summary-update-secondary-mark article)))
|
|
7340
|
|
7341 (defun gnus-summary-mark-forward (n &optional mark no-expire)
|
|
7342 "Mark N articles as read forwards.
|
|
7343 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
|
|
7344 The difference between N and the actual number of articles marked is
|
|
7345 returned."
|
|
7346 (interactive "p")
|
|
7347 (gnus-set-global-variables)
|
|
7348 (let ((backward (< n 0))
|
|
7349 (gnus-summary-goto-unread
|
|
7350 (and gnus-summary-goto-unread
|
|
7351 (not (eq gnus-summary-goto-unread 'never))
|
|
7352 (not (memq mark (list gnus-unread-mark
|
|
7353 gnus-ticked-mark gnus-dormant-mark)))))
|
|
7354 (n (abs n))
|
|
7355 (mark (or mark gnus-del-mark)))
|
|
7356 (while (and (> n 0)
|
|
7357 (gnus-summary-mark-article nil mark no-expire)
|
|
7358 (zerop (gnus-summary-next-subject
|
|
7359 (if backward -1 1)
|
|
7360 (and gnus-summary-goto-unread
|
|
7361 (not (eq gnus-summary-goto-unread 'never)))
|
|
7362 t)))
|
|
7363 (setq n (1- n)))
|
|
7364 (when (/= 0 n)
|
|
7365 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
|
|
7366 (gnus-summary-recenter)
|
|
7367 (gnus-summary-position-point)
|
|
7368 (gnus-set-mode-line 'summary)
|
|
7369 n))
|
|
7370
|
|
7371 (defun gnus-summary-mark-article-as-read (mark)
|
|
7372 "Mark the current article quickly as read with MARK."
|
|
7373 (let ((article (gnus-summary-article-number)))
|
|
7374 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7375 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7376 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7377 (push (cons article mark) gnus-newsgroup-reads)
|
|
7378 ;; Possibly remove from cache, if that is used.
|
|
7379 (when gnus-use-cache
|
|
7380 (gnus-cache-enter-remove-article article))
|
|
7381 ;; Allow the backend to change the mark.
|
|
7382 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
|
|
7383 ;; Check for auto-expiry.
|
|
7384 (when (and gnus-newsgroup-auto-expire
|
|
7385 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7386 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7387 (= mark gnus-ancient-mark)
|
|
7388 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7389 (= mark gnus-duplicate-mark)))
|
|
7390 (setq mark gnus-expirable-mark)
|
|
7391 (push article gnus-newsgroup-expirable))
|
|
7392 ;; Set the mark in the buffer.
|
|
7393 (gnus-summary-update-mark mark 'unread)
|
|
7394 t))
|
|
7395
|
|
7396 (defun gnus-summary-mark-article-as-unread (mark)
|
|
7397 "Mark the current article quickly as unread with MARK."
|
|
7398 (let ((article (gnus-summary-article-number)))
|
|
7399 (if (< article 0)
|
|
7400 (gnus-error 1 "Unmarkable article")
|
|
7401 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7402 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7403 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
|
|
7404 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
|
|
7405 (cond ((= mark gnus-ticked-mark)
|
|
7406 (push article gnus-newsgroup-marked))
|
|
7407 ((= mark gnus-dormant-mark)
|
|
7408 (push article gnus-newsgroup-dormant))
|
|
7409 (t
|
|
7410 (push article gnus-newsgroup-unreads)))
|
|
7411 (setq gnus-newsgroup-reads
|
|
7412 (delq (assq article gnus-newsgroup-reads)
|
|
7413 gnus-newsgroup-reads))
|
|
7414
|
|
7415 ;; See whether the article is to be put in the cache.
|
|
7416 (and gnus-use-cache
|
|
7417 (vectorp (gnus-summary-article-header article))
|
|
7418 (save-excursion
|
|
7419 (gnus-cache-possibly-enter-article
|
|
7420 gnus-newsgroup-name article
|
|
7421 (gnus-summary-article-header article)
|
|
7422 (= mark gnus-ticked-mark)
|
|
7423 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7424
|
|
7425 ;; Fix the mark.
|
|
7426 (gnus-summary-update-mark mark 'unread))
|
|
7427 t))
|
|
7428
|
|
7429 (defun gnus-summary-mark-article (&optional article mark no-expire)
|
|
7430 "Mark ARTICLE with MARK. MARK can be any character.
|
|
7431 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
|
|
7432 `??' (dormant) and `?E' (expirable).
|
|
7433 If MARK is nil, then the default character `?D' is used.
|
|
7434 If ARTICLE is nil, then the article on the current line will be
|
|
7435 marked."
|
|
7436 ;; The mark might be a string.
|
|
7437 (when (stringp mark)
|
|
7438 (setq mark (aref mark 0)))
|
|
7439 ;; If no mark is given, then we check auto-expiring.
|
|
7440 (and (not no-expire)
|
|
7441 gnus-newsgroup-auto-expire
|
|
7442 (or (not mark)
|
|
7443 (and (gnus-characterp mark)
|
|
7444 (or (= mark gnus-killed-mark) (= mark gnus-del-mark)
|
|
7445 (= mark gnus-catchup-mark) (= mark gnus-low-score-mark)
|
|
7446 (= mark gnus-read-mark) (= mark gnus-souped-mark)
|
|
7447 (= mark gnus-duplicate-mark))))
|
|
7448 (setq mark gnus-expirable-mark))
|
|
7449 (let* ((mark (or mark gnus-del-mark))
|
|
7450 (article (or article (gnus-summary-article-number))))
|
|
7451 (unless article
|
|
7452 (error "No article on current line"))
|
|
7453 (if (or (= mark gnus-unread-mark)
|
|
7454 (= mark gnus-ticked-mark)
|
|
7455 (= mark gnus-dormant-mark))
|
|
7456 (gnus-mark-article-as-unread article mark)
|
|
7457 (gnus-mark-article-as-read article mark))
|
|
7458
|
|
7459 ;; See whether the article is to be put in the cache.
|
|
7460 (and gnus-use-cache
|
|
7461 (not (= mark gnus-canceled-mark))
|
|
7462 (vectorp (gnus-summary-article-header article))
|
|
7463 (save-excursion
|
|
7464 (gnus-cache-possibly-enter-article
|
|
7465 gnus-newsgroup-name article
|
|
7466 (gnus-summary-article-header article)
|
|
7467 (= mark gnus-ticked-mark)
|
|
7468 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
|
|
7469
|
|
7470 (when (gnus-summary-goto-subject article nil t)
|
|
7471 (let ((buffer-read-only nil))
|
|
7472 (gnus-summary-show-thread)
|
|
7473 ;; Fix the mark.
|
|
7474 (gnus-summary-update-mark mark 'unread)
|
|
7475 t))))
|
|
7476
|
|
7477 (defun gnus-summary-update-secondary-mark (article)
|
|
7478 "Update the secondary (read, process, cache) mark."
|
|
7479 (gnus-summary-update-mark
|
|
7480 (cond ((memq article gnus-newsgroup-processable)
|
|
7481 gnus-process-mark)
|
|
7482 ((memq article gnus-newsgroup-cached)
|
|
7483 gnus-cached-mark)
|
|
7484 ((memq article gnus-newsgroup-replied)
|
|
7485 gnus-replied-mark)
|
|
7486 ((memq article gnus-newsgroup-saved)
|
|
7487 gnus-saved-mark)
|
|
7488 (t gnus-unread-mark))
|
|
7489 'replied)
|
|
7490 (when (gnus-visual-p 'summary-highlight 'highlight)
|
|
7491 (run-hooks 'gnus-summary-update-hook))
|
|
7492 t)
|
|
7493
|
|
7494 (defun gnus-summary-update-mark (mark type)
|
|
7495 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
|
|
7496 (buffer-read-only nil))
|
|
7497 (re-search-backward "[\n\r]" (gnus-point-at-bol) 'move-to-limit)
|
|
7498 (when (looking-at "\r")
|
|
7499 (incf forward))
|
|
7500 (when (and forward
|
|
7501 (<= (+ forward (point)) (point-max)))
|
|
7502 ;; Go to the right position on the line.
|
|
7503 (goto-char (+ forward (point)))
|
|
7504 ;; Replace the old mark with the new mark.
|
|
7505 (subst-char-in-region (point) (1+ (point)) (following-char) mark)
|
|
7506 ;; Optionally update the marks by some user rule.
|
|
7507 (when (eq type 'unread)
|
|
7508 (gnus-data-set-mark
|
|
7509 (gnus-data-find (gnus-summary-article-number)) mark)
|
|
7510 (gnus-summary-update-line (eq mark gnus-unread-mark))))))
|
|
7511
|
|
7512 (defun gnus-mark-article-as-read (article &optional mark)
|
|
7513 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7514 ;; Make the article expirable.
|
|
7515 (let ((mark (or mark gnus-del-mark)))
|
|
7516 (if (= mark gnus-expirable-mark)
|
|
7517 (push article gnus-newsgroup-expirable)
|
|
7518 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)))
|
|
7519 ;; Remove from unread and marked lists.
|
|
7520 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7521 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
|
|
7522 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
|
|
7523 (push (cons article mark) gnus-newsgroup-reads)
|
|
7524 ;; Possibly remove from cache, if that is used.
|
|
7525 (when gnus-use-cache
|
|
7526 (gnus-cache-enter-remove-article article))))
|
|
7527
|
|
7528 (defun gnus-mark-article-as-unread (article &optional mark)
|
|
7529 "Enter ARTICLE in the pertinent lists and remove it from others."
|
|
7530 (let ((mark (or mark gnus-ticked-mark)))
|
|
7531 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
|
|
7532 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
|
|
7533 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
|
|
7534 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
|
|
7535
|
|
7536 ;; Unsuppress duplicates?
|
|
7537 (when gnus-suppress-duplicates
|
|
7538 (gnus-dup-unsuppress-article article))
|
|
7539
|
|
7540 (cond ((= mark gnus-ticked-mark)
|
|
7541 (push article gnus-newsgroup-marked))
|
|
7542 ((= mark gnus-dormant-mark)
|
|
7543 (push article gnus-newsgroup-dormant))
|
|
7544 (t
|
|
7545 (push article gnus-newsgroup-unreads)))
|
|
7546 (setq gnus-newsgroup-reads
|
|
7547 (delq (assq article gnus-newsgroup-reads)
|
|
7548 gnus-newsgroup-reads))))
|
|
7549
|
|
7550 (defalias 'gnus-summary-mark-as-unread-forward
|
|
7551 'gnus-summary-tick-article-forward)
|
|
7552 (make-obsolete 'gnus-summary-mark-as-unread-forward
|
|
7553 'gnus-summary-tick-article-forward)
|
|
7554 (defun gnus-summary-tick-article-forward (n)
|
|
7555 "Tick N articles forwards.
|
|
7556 If N is negative, tick backwards instead.
|
|
7557 The difference between N and the number of articles ticked is returned."
|
|
7558 (interactive "p")
|
|
7559 (gnus-summary-mark-forward n gnus-ticked-mark))
|
|
7560
|
|
7561 (defalias 'gnus-summary-mark-as-unread-backward
|
|
7562 'gnus-summary-tick-article-backward)
|
|
7563 (make-obsolete 'gnus-summary-mark-as-unread-backward
|
|
7564 'gnus-summary-tick-article-backward)
|
|
7565 (defun gnus-summary-tick-article-backward (n)
|
|
7566 "Tick N articles backwards.
|
|
7567 The difference between N and the number of articles ticked is returned."
|
|
7568 (interactive "p")
|
|
7569 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
|
|
7570
|
|
7571 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7572 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
|
|
7573 (defun gnus-summary-tick-article (&optional article clear-mark)
|
|
7574 "Mark current article as unread.
|
|
7575 Optional 1st argument ARTICLE specifies article number to be marked as unread.
|
|
7576 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
|
|
7577 (interactive)
|
|
7578 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
|
|
7579 gnus-ticked-mark)))
|
|
7580
|
|
7581 (defun gnus-summary-mark-as-read-forward (n)
|
|
7582 "Mark N articles as read forwards.
|
|
7583 If N is negative, mark backwards instead.
|
|
7584 The difference between N and the actual number of articles marked is
|
|
7585 returned."
|
|
7586 (interactive "p")
|
|
7587 (gnus-summary-mark-forward n gnus-del-mark t))
|
|
7588
|
|
7589 (defun gnus-summary-mark-as-read-backward (n)
|
|
7590 "Mark the N articles as read backwards.
|
|
7591 The difference between N and the actual number of articles marked is
|
|
7592 returned."
|
|
7593 (interactive "p")
|
|
7594 (gnus-summary-mark-forward (- n) gnus-del-mark t))
|
|
7595
|
|
7596 (defun gnus-summary-mark-as-read (&optional article mark)
|
|
7597 "Mark current article as read.
|
|
7598 ARTICLE specifies the article to be marked as read.
|
|
7599 MARK specifies a string to be inserted at the beginning of the line."
|
|
7600 (gnus-summary-mark-article article mark))
|
|
7601
|
|
7602 (defun gnus-summary-clear-mark-forward (n)
|
|
7603 "Clear marks from N articles forward.
|
|
7604 If N is negative, clear backward instead.
|
|
7605 The difference between N and the number of marks cleared is returned."
|
|
7606 (interactive "p")
|
|
7607 (gnus-summary-mark-forward n gnus-unread-mark))
|
|
7608
|
|
7609 (defun gnus-summary-clear-mark-backward (n)
|
|
7610 "Clear marks from N articles backward.
|
|
7611 The difference between N and the number of marks cleared is returned."
|
|
7612 (interactive "p")
|
|
7613 (gnus-summary-mark-forward (- n) gnus-unread-mark))
|
|
7614
|
|
7615 (defun gnus-summary-mark-unread-as-read ()
|
|
7616 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7617 (when (memq gnus-current-article gnus-newsgroup-unreads)
|
|
7618 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
|
|
7619
|
|
7620 (defun gnus-summary-mark-read-and-unread-as-read ()
|
|
7621 "Intended to be used by `gnus-summary-mark-article-hook'."
|
|
7622 (let ((mark (gnus-summary-article-mark)))
|
|
7623 (when (or (gnus-unread-mark-p mark)
|
|
7624 (gnus-read-mark-p mark))
|
|
7625 (gnus-summary-mark-article gnus-current-article gnus-read-mark))))
|
|
7626
|
|
7627 (defun gnus-summary-mark-region-as-read (point mark all)
|
|
7628 "Mark all unread articles between point and mark as read.
|
|
7629 If given a prefix, mark all articles between point and mark as read,
|
|
7630 even ticked and dormant ones."
|
|
7631 (interactive "r\nP")
|
|
7632 (save-excursion
|
|
7633 (let (article)
|
|
7634 (goto-char point)
|
|
7635 (beginning-of-line)
|
|
7636 (while (and
|
|
7637 (< (point) mark)
|
|
7638 (progn
|
|
7639 (when (or all
|
|
7640 (memq (setq article (gnus-summary-article-number))
|
|
7641 gnus-newsgroup-unreads))
|
|
7642 (gnus-summary-mark-article article gnus-del-mark))
|
|
7643 t)
|
|
7644 (gnus-summary-find-next))))))
|
|
7645
|
|
7646 (defun gnus-summary-mark-below (score mark)
|
|
7647 "Mark articles with score less than SCORE with MARK."
|
|
7648 (interactive "P\ncMark: ")
|
|
7649 (gnus-set-global-variables)
|
|
7650 (setq score (if score
|
|
7651 (prefix-numeric-value score)
|
|
7652 (or gnus-summary-default-score 0)))
|
|
7653 (save-excursion
|
|
7654 (set-buffer gnus-summary-buffer)
|
|
7655 (goto-char (point-min))
|
108
|
7656 (while
|
98
|
7657 (progn
|
|
7658 (and (< (gnus-summary-article-score) score)
|
|
7659 (gnus-summary-mark-article nil mark))
|
|
7660 (gnus-summary-find-next)))))
|
|
7661
|
|
7662 (defun gnus-summary-kill-below (&optional score)
|
|
7663 "Mark articles with score below SCORE as read."
|
|
7664 (interactive "P")
|
|
7665 (gnus-set-global-variables)
|
|
7666 (gnus-summary-mark-below score gnus-killed-mark))
|
|
7667
|
|
7668 (defun gnus-summary-clear-above (&optional score)
|
|
7669 "Clear all marks from articles with score above SCORE."
|
|
7670 (interactive "P")
|
|
7671 (gnus-set-global-variables)
|
|
7672 (gnus-summary-mark-above score gnus-unread-mark))
|
|
7673
|
|
7674 (defun gnus-summary-tick-above (&optional score)
|
|
7675 "Tick all articles with score above SCORE."
|
|
7676 (interactive "P")
|
|
7677 (gnus-set-global-variables)
|
|
7678 (gnus-summary-mark-above score gnus-ticked-mark))
|
|
7679
|
|
7680 (defun gnus-summary-mark-above (score mark)
|
|
7681 "Mark articles with score over SCORE with MARK."
|
|
7682 (interactive "P\ncMark: ")
|
|
7683 (gnus-set-global-variables)
|
|
7684 (setq score (if score
|
|
7685 (prefix-numeric-value score)
|
|
7686 (or gnus-summary-default-score 0)))
|
|
7687 (save-excursion
|
|
7688 (set-buffer gnus-summary-buffer)
|
|
7689 (goto-char (point-min))
|
|
7690 (while (and (progn
|
|
7691 (when (> (gnus-summary-article-score) score)
|
|
7692 (gnus-summary-mark-article nil mark))
|
|
7693 t)
|
|
7694 (gnus-summary-find-next)))))
|
|
7695
|
|
7696 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
|
|
7697 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
|
|
7698 (defun gnus-summary-limit-include-expunged (&optional no-error)
|
|
7699 "Display all the hidden articles that were expunged for low scores."
|
|
7700 (interactive)
|
|
7701 (gnus-set-global-variables)
|
|
7702 (let ((buffer-read-only nil))
|
|
7703 (let ((scored gnus-newsgroup-scored)
|
|
7704 headers h)
|
|
7705 (while scored
|
|
7706 (unless (gnus-summary-goto-subject (caar scored))
|
|
7707 (and (setq h (gnus-summary-article-header (caar scored)))
|
|
7708 (< (cdar scored) gnus-summary-expunge-below)
|
|
7709 (push h headers)))
|
|
7710 (setq scored (cdr scored)))
|
|
7711 (if (not headers)
|
|
7712 (when (not no-error)
|
|
7713 (error "No expunged articles hidden."))
|
|
7714 (goto-char (point-min))
|
|
7715 (gnus-summary-prepare-unthreaded (nreverse headers))
|
|
7716 (goto-char (point-min))
|
|
7717 (gnus-summary-position-point)
|
|
7718 t))))
|
|
7719
|
|
7720 (defun gnus-summary-catchup (&optional all quietly to-here not-mark)
|
|
7721 "Mark all unread articles in this newsgroup as read.
|
108
|
7722 If prefix argument ALL is non-nil, ticked and dormant articles will
|
98
|
7723 also be marked as read.
|
|
7724 If QUIETLY is non-nil, no questions will be asked.
|
|
7725 If TO-HERE is non-nil, it should be a point in the buffer. All
|
|
7726 articles before this point will be marked as read.
|
|
7727 Note that this function will only catch up the unread article
|
|
7728 in the current summary buffer limitation.
|
|
7729 The number of articles marked as read is returned."
|
|
7730 (interactive "P")
|
|
7731 (gnus-set-global-variables)
|
|
7732 (prog1
|
|
7733 (save-excursion
|
|
7734 (when (or quietly
|
|
7735 (not gnus-interactive-catchup) ;Without confirmation?
|
|
7736 gnus-expert-user
|
|
7737 (gnus-y-or-n-p
|
|
7738 (if all
|
|
7739 "Mark absolutely all articles as read? "
|
|
7740 "Mark all unread articles as read? ")))
|
|
7741 (if (and not-mark
|
|
7742 (not gnus-newsgroup-adaptive)
|
|
7743 (not gnus-newsgroup-auto-expire)
|
|
7744 (not gnus-suppress-duplicates))
|
|
7745 (progn
|
|
7746 (when all
|
|
7747 (setq gnus-newsgroup-marked nil
|
|
7748 gnus-newsgroup-dormant nil))
|
|
7749 (setq gnus-newsgroup-unreads nil))
|
|
7750 ;; We actually mark all articles as canceled, which we
|
|
7751 ;; have to do when using auto-expiry or adaptive scoring.
|
|
7752 (gnus-summary-show-all-threads)
|
|
7753 (when (gnus-summary-first-subject (not all))
|
|
7754 (while (and
|
|
7755 (if to-here (< (point) to-here) t)
|
|
7756 (gnus-summary-mark-article-as-read gnus-catchup-mark)
|
|
7757 (gnus-summary-find-next (not all)))))
|
|
7758 (gnus-set-mode-line 'summary))
|
|
7759 t))
|
|
7760 (gnus-summary-position-point)))
|
|
7761
|
|
7762 (defun gnus-summary-catchup-to-here (&optional all)
|
|
7763 "Mark all unticked articles before the current one as read.
|
|
7764 If ALL is non-nil, also mark ticked and dormant articles as read."
|
|
7765 (interactive "P")
|
|
7766 (gnus-set-global-variables)
|
|
7767 (save-excursion
|
|
7768 (gnus-save-hidden-threads
|
|
7769 (let ((beg (point)))
|
|
7770 ;; We check that there are unread articles.
|
|
7771 (when (or all (gnus-summary-find-prev))
|
|
7772 (gnus-summary-catchup all t beg)))))
|
|
7773 (gnus-summary-position-point))
|
|
7774
|
|
7775 (defun gnus-summary-catchup-all (&optional quietly)
|
|
7776 "Mark all articles in this newsgroup as read."
|
|
7777 (interactive "P")
|
|
7778 (gnus-set-global-variables)
|
|
7779 (gnus-summary-catchup t quietly))
|
|
7780
|
|
7781 (defun gnus-summary-catchup-and-exit (&optional all quietly)
|
|
7782 "Mark all articles not marked as unread in this newsgroup as read, then exit.
|
|
7783 If prefix argument ALL is non-nil, all articles are marked as read."
|
|
7784 (interactive "P")
|
|
7785 (gnus-set-global-variables)
|
|
7786 (when (gnus-summary-catchup all quietly nil 'fast)
|
|
7787 ;; Select next newsgroup or exit.
|
|
7788 (if (eq gnus-auto-select-next 'quietly)
|
|
7789 (gnus-summary-next-group nil)
|
|
7790 (gnus-summary-exit))))
|
|
7791
|
|
7792 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
|
|
7793 "Mark all articles in this newsgroup as read, and then exit."
|
|
7794 (interactive "P")
|
|
7795 (gnus-set-global-variables)
|
|
7796 (gnus-summary-catchup-and-exit t quietly))
|
|
7797
|
|
7798 ;; Suggested by "Arne Eofsson" <arne@hodgkin.mbi.ucla.edu>.
|
|
7799 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
|
|
7800 "Mark all articles in this group as read and select the next group.
|
|
7801 If given a prefix, mark all articles, unread as well as ticked, as
|
|
7802 read."
|
|
7803 (interactive "P")
|
|
7804 (gnus-set-global-variables)
|
|
7805 (save-excursion
|
|
7806 (gnus-summary-catchup all))
|
|
7807 (gnus-summary-next-article t nil nil t))
|
|
7808
|
|
7809 ;; Thread-based commands.
|
|
7810
|
|
7811 (defun gnus-summary-articles-in-thread (&optional article)
|
|
7812 "Return a list of all articles in the current thread.
|
|
7813 If ARTICLE is non-nil, return all articles in the thread that starts
|
|
7814 with that article."
|
|
7815 (let* ((article (or article (gnus-summary-article-number)))
|
|
7816 (data (gnus-data-find-list article))
|
|
7817 (top-level (gnus-data-level (car data)))
|
|
7818 (top-subject
|
|
7819 (cond ((null gnus-thread-operation-ignore-subject)
|
|
7820 (gnus-simplify-subject-re
|
|
7821 (mail-header-subject (gnus-data-header (car data)))))
|
|
7822 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7823 (gnus-simplify-subject-fuzzy
|
|
7824 (mail-header-subject (gnus-data-header (car data)))))
|
|
7825 (t nil)))
|
|
7826 (end-point (save-excursion
|
|
7827 (if (gnus-summary-go-to-next-thread)
|
|
7828 (point) (point-max))))
|
|
7829 articles)
|
|
7830 (while (and data
|
|
7831 (< (gnus-data-pos (car data)) end-point))
|
|
7832 (when (or (not top-subject)
|
|
7833 (string= top-subject
|
|
7834 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
|
|
7835 (gnus-simplify-subject-fuzzy
|
|
7836 (mail-header-subject
|
|
7837 (gnus-data-header (car data))))
|
|
7838 (gnus-simplify-subject-re
|
|
7839 (mail-header-subject
|
|
7840 (gnus-data-header (car data)))))))
|
|
7841 (push (gnus-data-number (car data)) articles))
|
|
7842 (unless (and (setq data (cdr data))
|
|
7843 (> (gnus-data-level (car data)) top-level))
|
|
7844 (setq data nil)))
|
|
7845 ;; Return the list of articles.
|
|
7846 (nreverse articles)))
|
|
7847
|
|
7848 (defun gnus-summary-rethread-current ()
|
|
7849 "Rethread the thread the current article is part of."
|
|
7850 (interactive)
|
|
7851 (gnus-set-global-variables)
|
|
7852 (let* ((gnus-show-threads t)
|
|
7853 (article (gnus-summary-article-number))
|
|
7854 (id (mail-header-id (gnus-summary-article-header)))
|
|
7855 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
|
|
7856 (unless id
|
|
7857 (error "No article on the current line"))
|
|
7858 (gnus-rebuild-thread id)
|
|
7859 (gnus-summary-goto-subject article)))
|
|
7860
|
|
7861 (defun gnus-summary-reparent-thread ()
|
104
|
7862 "Make the current article child of the marked (or previous) article.
|
98
|
7863
|
|
7864 Note that the re-threading will only work if `gnus-thread-ignore-subject'
|
|
7865 is non-nil or the Subject: of both articles are the same."
|
|
7866 (interactive)
|
|
7867 (unless (not (gnus-group-read-only-p))
|
|
7868 (error "The current newsgroup does not support article editing."))
|
|
7869 (unless (<= (length gnus-newsgroup-processable) 1)
|
|
7870 (error "No more than one article may be marked."))
|
|
7871 (save-window-excursion
|
|
7872 (let ((gnus-article-buffer " *reparent*")
|
|
7873 (current-article (gnus-summary-article-number))
|
104
|
7874 ;; First grab the marked article, otherwise one line up.
|
98
|
7875 (parent-article (if (not (null gnus-newsgroup-processable))
|
|
7876 (car gnus-newsgroup-processable)
|
|
7877 (save-excursion
|
|
7878 (if (eq (forward-line -1) 0)
|
|
7879 (gnus-summary-article-number)
|
|
7880 (error "Beginning of summary buffer."))))))
|
|
7881 (unless (not (eq current-article parent-article))
|
|
7882 (error "An article may not be self-referential."))
|
108
|
7883 (let ((message-id (mail-header-id
|
98
|
7884 (gnus-summary-article-header parent-article))))
|
|
7885 (unless (and message-id (not (equal message-id "")))
|
|
7886 (error "No message-id in desired parent."))
|
|
7887 (gnus-summary-select-article t t nil current-article)
|
104
|
7888 (set-buffer gnus-original-article-buffer)
|
98
|
7889 (let ((buf (format "%s" (buffer-string))))
|
104
|
7890 (nnheader-temp-write nil
|
|
7891 (insert buf)
|
|
7892 (goto-char (point-min))
|
|
7893 (if (search-forward-regexp "^References: " nil t)
|
|
7894 (insert message-id " " )
|
|
7895 (insert "References: " message-id "\n"))
|
|
7896 (unless (gnus-request-replace-article
|
|
7897 current-article (car gnus-article-current)
|
|
7898 (current-buffer))
|
|
7899 (error "Couldn't replace article."))))
|
98
|
7900 (set-buffer gnus-summary-buffer)
|
|
7901 (gnus-summary-unmark-all-processable)
|
|
7902 (gnus-summary-rethread-current)
|
|
7903 (gnus-message 3 "Article %d is now the child of article %d."
|
|
7904 current-article parent-article)))))
|
|
7905
|
|
7906 (defun gnus-summary-toggle-threads (&optional arg)
|
|
7907 "Toggle showing conversation threads.
|
|
7908 If ARG is positive number, turn showing conversation threads on."
|
|
7909 (interactive "P")
|
|
7910 (gnus-set-global-variables)
|
|
7911 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
|
|
7912 (setq gnus-show-threads
|
|
7913 (if (null arg) (not gnus-show-threads)
|
|
7914 (> (prefix-numeric-value arg) 0)))
|
|
7915 (gnus-summary-prepare)
|
|
7916 (gnus-summary-goto-subject current)
|
|
7917 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
|
|
7918 (gnus-summary-position-point)))
|
|
7919
|
|
7920 (defun gnus-summary-show-all-threads ()
|
|
7921 "Show all threads."
|
|
7922 (interactive)
|
|
7923 (gnus-set-global-variables)
|
|
7924 (save-excursion
|
|
7925 (let ((buffer-read-only nil))
|
|
7926 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
|
|
7927 (gnus-summary-position-point))
|
|
7928
|
|
7929 (defun gnus-summary-show-thread ()
|
|
7930 "Show thread subtrees.
|
|
7931 Returns nil if no thread was there to be shown."
|
|
7932 (interactive)
|
|
7933 (gnus-set-global-variables)
|
|
7934 (let ((buffer-read-only nil)
|
|
7935 (orig (point))
|
|
7936 ;; first goto end then to beg, to have point at beg after let
|
|
7937 (end (progn (end-of-line) (point)))
|
|
7938 (beg (progn (beginning-of-line) (point))))
|
|
7939 (prog1
|
|
7940 ;; Any hidden lines here?
|
|
7941 (search-forward "\r" end t)
|
|
7942 (subst-char-in-region beg end ?\^M ?\n t)
|
|
7943 (goto-char orig)
|
|
7944 (gnus-summary-position-point))))
|
|
7945
|
|
7946 (defun gnus-summary-hide-all-threads ()
|
|
7947 "Hide all thread subtrees."
|
|
7948 (interactive)
|
|
7949 (gnus-set-global-variables)
|
|
7950 (save-excursion
|
|
7951 (goto-char (point-min))
|
|
7952 (gnus-summary-hide-thread)
|
|
7953 (while (zerop (gnus-summary-next-thread 1 t))
|
|
7954 (gnus-summary-hide-thread)))
|
|
7955 (gnus-summary-position-point))
|
|
7956
|
|
7957 (defun gnus-summary-hide-thread ()
|
|
7958 "Hide thread subtrees.
|
|
7959 Returns nil if no threads were there to be hidden."
|
|
7960 (interactive)
|
|
7961 (gnus-set-global-variables)
|
|
7962 (let ((buffer-read-only nil)
|
|
7963 (start (point))
|
|
7964 (article (gnus-summary-article-number)))
|
|
7965 (goto-char start)
|
|
7966 ;; Go forward until either the buffer ends or the subthread
|
|
7967 ;; ends.
|
|
7968 (when (and (not (eobp))
|
|
7969 (or (zerop (gnus-summary-next-thread 1 t))
|
|
7970 (goto-char (point-max))))
|
|
7971 (prog1
|
|
7972 (if (and (> (point) start)
|
|
7973 (search-backward "\n" start t))
|
|
7974 (progn
|
|
7975 (subst-char-in-region start (point) ?\n ?\^M)
|
|
7976 (gnus-summary-goto-subject article))
|
|
7977 (goto-char start)
|
|
7978 nil)
|
|
7979 ;;(gnus-summary-position-point)
|
|
7980 ))))
|
|
7981
|
|
7982 (defun gnus-summary-go-to-next-thread (&optional previous)
|
|
7983 "Go to the same level (or less) next thread.
|
|
7984 If PREVIOUS is non-nil, go to previous thread instead.
|
|
7985 Return the article number moved to, or nil if moving was impossible."
|
|
7986 (let ((level (gnus-summary-thread-level))
|
|
7987 (way (if previous -1 1))
|
|
7988 (beg (point)))
|
|
7989 (forward-line way)
|
|
7990 (while (and (not (eobp))
|
|
7991 (< level (gnus-summary-thread-level)))
|
|
7992 (forward-line way))
|
|
7993 (if (eobp)
|
|
7994 (progn
|
|
7995 (goto-char beg)
|
|
7996 nil)
|
|
7997 (setq beg (point))
|
|
7998 (prog1
|
|
7999 (gnus-summary-article-number)
|
|
8000 (goto-char beg)))))
|
|
8001
|
|
8002 (defun gnus-summary-next-thread (n &optional silent)
|
|
8003 "Go to the same level next N'th thread.
|
|
8004 If N is negative, search backward instead.
|
|
8005 Returns the difference between N and the number of skips actually
|
|
8006 done.
|
|
8007
|
|
8008 If SILENT, don't output messages."
|
|
8009 (interactive "p")
|
|
8010 (gnus-set-global-variables)
|
|
8011 (let ((backward (< n 0))
|
|
8012 (n (abs n)))
|
|
8013 (while (and (> n 0)
|
|
8014 (gnus-summary-go-to-next-thread backward))
|
|
8015 (decf n))
|
108
|
8016 (unless silent
|
98
|
8017 (gnus-summary-position-point))
|
|
8018 (when (and (not silent) (/= 0 n))
|
|
8019 (gnus-message 7 "No more threads"))
|
|
8020 n))
|
|
8021
|
|
8022 (defun gnus-summary-prev-thread (n)
|
|
8023 "Go to the same level previous N'th thread.
|
|
8024 Returns the difference between N and the number of skips actually
|
|
8025 done."
|
|
8026 (interactive "p")
|
|
8027 (gnus-set-global-variables)
|
|
8028 (gnus-summary-next-thread (- n)))
|
|
8029
|
|
8030 (defun gnus-summary-go-down-thread ()
|
|
8031 "Go down one level in the current thread."
|
|
8032 (let ((children (gnus-summary-article-children)))
|
|
8033 (when children
|
|
8034 (gnus-summary-goto-subject (car children)))))
|
|
8035
|
|
8036 (defun gnus-summary-go-up-thread ()
|
|
8037 "Go up one level in the current thread."
|
|
8038 (let ((parent (gnus-summary-article-parent)))
|
|
8039 (when parent
|
|
8040 (gnus-summary-goto-subject parent))))
|
|
8041
|
|
8042 (defun gnus-summary-down-thread (n)
|
|
8043 "Go down thread N steps.
|
|
8044 If N is negative, go up instead.
|
|
8045 Returns the difference between N and how many steps down that were
|
|
8046 taken."
|
|
8047 (interactive "p")
|
|
8048 (gnus-set-global-variables)
|
|
8049 (let ((up (< n 0))
|
|
8050 (n (abs n)))
|
|
8051 (while (and (> n 0)
|
|
8052 (if up (gnus-summary-go-up-thread)
|
|
8053 (gnus-summary-go-down-thread)))
|
|
8054 (setq n (1- n)))
|
|
8055 (gnus-summary-position-point)
|
|
8056 (when (/= 0 n)
|
|
8057 (gnus-message 7 "Can't go further"))
|
|
8058 n))
|
|
8059
|
|
8060 (defun gnus-summary-up-thread (n)
|
|
8061 "Go up thread N steps.
|
|
8062 If N is negative, go up instead.
|
|
8063 Returns the difference between N and how many steps down that were
|
|
8064 taken."
|
|
8065 (interactive "p")
|
|
8066 (gnus-set-global-variables)
|
|
8067 (gnus-summary-down-thread (- n)))
|
|
8068
|
|
8069 (defun gnus-summary-top-thread ()
|
|
8070 "Go to the top of the thread."
|
|
8071 (interactive)
|
|
8072 (gnus-set-global-variables)
|
|
8073 (while (gnus-summary-go-up-thread))
|
|
8074 (gnus-summary-article-number))
|
|
8075
|
|
8076 (defun gnus-summary-kill-thread (&optional unmark)
|
|
8077 "Mark articles under current thread as read.
|
|
8078 If the prefix argument is positive, remove any kinds of marks.
|
|
8079 If the prefix argument is negative, tick articles instead."
|
|
8080 (interactive "P")
|
|
8081 (gnus-set-global-variables)
|
|
8082 (when unmark
|
|
8083 (setq unmark (prefix-numeric-value unmark)))
|
|
8084 (let ((articles (gnus-summary-articles-in-thread)))
|
|
8085 (save-excursion
|
|
8086 ;; Expand the thread.
|
|
8087 (gnus-summary-show-thread)
|
|
8088 ;; Mark all the articles.
|
|
8089 (while articles
|
|
8090 (gnus-summary-goto-subject (car articles))
|
|
8091 (cond ((null unmark)
|
|
8092 (gnus-summary-mark-article-as-read gnus-killed-mark))
|
|
8093 ((> unmark 0)
|
|
8094 (gnus-summary-mark-article-as-unread gnus-unread-mark))
|
|
8095 (t
|
|
8096 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
|
|
8097 (setq articles (cdr articles))))
|
|
8098 ;; Hide killed subtrees.
|
|
8099 (and (null unmark)
|
|
8100 gnus-thread-hide-killed
|
|
8101 (gnus-summary-hide-thread))
|
|
8102 ;; If marked as read, go to next unread subject.
|
|
8103 (when (null unmark)
|
|
8104 ;; Go to next unread subject.
|
|
8105 (gnus-summary-next-subject 1 t)))
|
|
8106 (gnus-set-mode-line 'summary))
|
|
8107
|
|
8108 ;; Summary sorting commands
|
|
8109
|
|
8110 (defun gnus-summary-sort-by-number (&optional reverse)
|
|
8111 "Sort the summary buffer by article number.
|
|
8112 Argument REVERSE means reverse order."
|
|
8113 (interactive "P")
|
|
8114 (gnus-summary-sort 'number reverse))
|
|
8115
|
|
8116 (defun gnus-summary-sort-by-author (&optional reverse)
|
|
8117 "Sort the summary buffer by author name alphabetically.
|
|
8118 If case-fold-search is non-nil, case of letters is ignored.
|
|
8119 Argument REVERSE means reverse order."
|
|
8120 (interactive "P")
|
|
8121 (gnus-summary-sort 'author reverse))
|
|
8122
|
|
8123 (defun gnus-summary-sort-by-subject (&optional reverse)
|
|
8124 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
|
|
8125 If case-fold-search is non-nil, case of letters is ignored.
|
|
8126 Argument REVERSE means reverse order."
|
|
8127 (interactive "P")
|
|
8128 (gnus-summary-sort 'subject reverse))
|
|
8129
|
|
8130 (defun gnus-summary-sort-by-date (&optional reverse)
|
|
8131 "Sort the summary buffer by date.
|
|
8132 Argument REVERSE means reverse order."
|
|
8133 (interactive "P")
|
|
8134 (gnus-summary-sort 'date reverse))
|
|
8135
|
|
8136 (defun gnus-summary-sort-by-score (&optional reverse)
|
|
8137 "Sort the summary buffer by score.
|
|
8138 Argument REVERSE means reverse order."
|
|
8139 (interactive "P")
|
|
8140 (gnus-summary-sort 'score reverse))
|
|
8141
|
|
8142 (defun gnus-summary-sort-by-lines (&optional reverse)
|
|
8143 "Sort the summary buffer by article length.
|
|
8144 Argument REVERSE means reverse order."
|
|
8145 (interactive "P")
|
|
8146 (gnus-summary-sort 'lines reverse))
|
|
8147
|
|
8148 (defun gnus-summary-sort (predicate reverse)
|
|
8149 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
|
|
8150 (gnus-set-global-variables)
|
|
8151 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
|
|
8152 (article (intern (format "gnus-article-sort-by-%s" predicate)))
|
|
8153 (gnus-thread-sort-functions
|
|
8154 (list
|
|
8155 (if (not reverse)
|
|
8156 thread
|
|
8157 `(lambda (t1 t2)
|
|
8158 (,thread t2 t1)))))
|
|
8159 (gnus-article-sort-functions
|
|
8160 (list
|
|
8161 (if (not reverse)
|
|
8162 article
|
|
8163 `(lambda (t1 t2)
|
|
8164 (,article t2 t1)))))
|
|
8165 (buffer-read-only)
|
|
8166 (gnus-summary-prepare-hook nil))
|
|
8167 ;; We do the sorting by regenerating the threads.
|
|
8168 (gnus-summary-prepare)
|
|
8169 ;; Hide subthreads if needed.
|
|
8170 (when (and gnus-show-threads gnus-thread-hide-subtree)
|
|
8171 (gnus-summary-hide-all-threads))))
|
|
8172
|
|
8173 ;; Summary saving commands.
|
|
8174
|
|
8175 (defun gnus-summary-save-article (&optional n not-saved)
|
|
8176 "Save the current article using the default saver function.
|
|
8177 If N is a positive number, save the N next articles.
|
|
8178 If N is a negative number, save the N previous articles.
|
|
8179 If N is nil and any articles have been marked with the process mark,
|
|
8180 save those articles instead.
|
|
8181 The variable `gnus-default-article-saver' specifies the saver function."
|
|
8182 (interactive "P")
|
|
8183 (gnus-set-global-variables)
|
|
8184 (let* ((articles (gnus-summary-work-articles n))
|
108
|
8185 (save-buffer (save-excursion
|
98
|
8186 (nnheader-set-temp-buffer " *Gnus Save*")))
|
|
8187 (num (length articles))
|
|
8188 header article file)
|
|
8189 (while articles
|
|
8190 (setq header (gnus-summary-article-header
|
|
8191 (setq article (pop articles))))
|
|
8192 (if (not (vectorp header))
|
|
8193 ;; This is a pseudo-article.
|
|
8194 (if (assq 'name header)
|
|
8195 (gnus-copy-file (cdr (assq 'name header)))
|
|
8196 (gnus-message 1 "Article %d is unsaveable" article))
|
|
8197 ;; This is a real article.
|
|
8198 (save-window-excursion
|
|
8199 (gnus-summary-select-article t nil nil article))
|
|
8200 (save-excursion
|
|
8201 (set-buffer save-buffer)
|
|
8202 (erase-buffer)
|
|
8203 (insert-buffer-substring gnus-original-article-buffer))
|
|
8204 (setq file (gnus-article-save save-buffer file num))
|
|
8205 (gnus-summary-remove-process-mark article)
|
|
8206 (unless not-saved
|
|
8207 (gnus-summary-set-saved-mark article))))
|
|
8208 (gnus-kill-buffer save-buffer)
|
|
8209 (gnus-summary-position-point)
|
|
8210 (gnus-set-mode-line 'summary)
|
|
8211 n))
|
|
8212
|
|
8213 (defun gnus-summary-pipe-output (&optional arg)
|
|
8214 "Pipe the current article to a subprocess.
|
|
8215 If N is a positive number, pipe the N next articles.
|
|
8216 If N is a negative number, pipe the N previous articles.
|
|
8217 If N is nil and any articles have been marked with the process mark,
|
|
8218 pipe those articles instead."
|
|
8219 (interactive "P")
|
|
8220 (gnus-set-global-variables)
|
|
8221 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe))
|
|
8222 (gnus-summary-save-article arg t))
|
|
8223 (gnus-configure-windows 'pipe))
|
|
8224
|
|
8225 (defun gnus-summary-save-article-mail (&optional arg)
|
|
8226 "Append the current article to an mail file.
|
|
8227 If N is a positive number, save the N next articles.
|
|
8228 If N is a negative number, save the N previous articles.
|
|
8229 If N is nil and any articles have been marked with the process mark,
|
|
8230 save those articles instead."
|
|
8231 (interactive "P")
|
|
8232 (gnus-set-global-variables)
|
|
8233 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
|
|
8234 (gnus-summary-save-article arg)))
|
|
8235
|
|
8236 (defun gnus-summary-save-article-rmail (&optional arg)
|
|
8237 "Append the current article to an rmail file.
|
|
8238 If N is a positive number, save the N next articles.
|
|
8239 If N is a negative number, save the N previous articles.
|
|
8240 If N is nil and any articles have been marked with the process mark,
|
|
8241 save those articles instead."
|
|
8242 (interactive "P")
|
|
8243 (gnus-set-global-variables)
|
|
8244 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
|
|
8245 (gnus-summary-save-article arg)))
|
|
8246
|
|
8247 (defun gnus-summary-save-article-file (&optional arg)
|
|
8248 "Append the current article to a file.
|
|
8249 If N is a positive number, save the N next articles.
|
|
8250 If N is a negative number, save the N previous articles.
|
|
8251 If N is nil and any articles have been marked with the process mark,
|
|
8252 save those articles instead."
|
|
8253 (interactive "P")
|
|
8254 (gnus-set-global-variables)
|
|
8255 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
|
|
8256 (gnus-summary-save-article arg)))
|
|
8257
|
|
8258 (defun gnus-summary-write-article-file (&optional arg)
|
|
8259 "Write the current article to a file, deleting the previous file.
|
|
8260 If N is a positive number, save the N next articles.
|
|
8261 If N is a negative number, save the N previous articles.
|
|
8262 If N is nil and any articles have been marked with the process mark,
|
|
8263 save those articles instead."
|
|
8264 (interactive "P")
|
|
8265 (gnus-set-global-variables)
|
|
8266 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
|
|
8267 (gnus-summary-save-article arg)))
|
|
8268
|
|
8269 (defun gnus-summary-save-article-body-file (&optional arg)
|
|
8270 "Append the current article body to a file.
|
|
8271 If N is a positive number, save the N next articles.
|
|
8272 If N is a negative number, save the N previous articles.
|
|
8273 If N is nil and any articles have been marked with the process mark,
|
|
8274 save those articles instead."
|
|
8275 (interactive "P")
|
|
8276 (gnus-set-global-variables)
|
|
8277 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
|
|
8278 (gnus-summary-save-article arg)))
|
|
8279
|
|
8280 (defun gnus-summary-pipe-message (program)
|
|
8281 "Pipe the current article through PROGRAM."
|
|
8282 (interactive "sProgram: ")
|
|
8283 (gnus-set-global-variables)
|
|
8284 (gnus-summary-select-article)
|
|
8285 (let ((mail-header-separator "")
|
|
8286 (art-buf (get-buffer gnus-article-buffer)))
|
|
8287 (gnus-eval-in-buffer-window gnus-article-buffer
|
|
8288 (save-restriction
|
|
8289 (widen)
|
|
8290 (let ((start (window-start))
|
|
8291 buffer-read-only)
|
|
8292 (message-pipe-buffer-body program)
|
|
8293 (set-window-start (get-buffer-window (current-buffer)) start))))))
|
|
8294
|
|
8295 (defun gnus-get-split-value (methods)
|
|
8296 "Return a value based on the split METHODS."
|
|
8297 (let (split-name method result match)
|
|
8298 (when methods
|
|
8299 (save-excursion
|
|
8300 (set-buffer gnus-original-article-buffer)
|
|
8301 (save-restriction
|
|
8302 (nnheader-narrow-to-headers)
|
|
8303 (while methods
|
|
8304 (goto-char (point-min))
|
|
8305 (setq method (pop methods))
|
|
8306 (setq match (car method))
|
|
8307 (when (cond
|
|
8308 ((stringp match)
|
|
8309 ;; Regular expression.
|
|
8310 (ignore-errors
|
|
8311 (re-search-forward match nil t)))
|
|
8312 ((gnus-functionp match)
|
|
8313 ;; Function.
|
|
8314 (save-restriction
|
|
8315 (widen)
|
|
8316 (setq result (funcall match gnus-newsgroup-name))))
|
|
8317 ((consp match)
|
|
8318 ;; Form.
|
|
8319 (save-restriction
|
|
8320 (widen)
|
|
8321 (setq result (eval match)))))
|
|
8322 (setq split-name (append (cdr method) split-name))
|
|
8323 (cond ((stringp result)
|
|
8324 (push (expand-file-name
|
|
8325 result gnus-article-save-directory)
|
|
8326 split-name))
|
|
8327 ((consp result)
|
|
8328 (setq split-name (append result split-name)))))))))
|
|
8329 split-name))
|
|
8330
|
|
8331 (defun gnus-valid-move-group-p (group)
|
|
8332 (and (boundp group)
|
|
8333 (symbol-name group)
|
|
8334 (memq 'respool
|
|
8335 (assoc (symbol-name
|
|
8336 (car (gnus-find-method-for-group
|
|
8337 (symbol-name group))))
|
|
8338 gnus-valid-select-methods))))
|
|
8339
|
|
8340 (defun gnus-read-move-group-name (prompt default articles prefix)
|
|
8341 "Read a group name."
|
|
8342 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
|
|
8343 (minibuffer-confirm-incomplete nil) ; XEmacs
|
|
8344 (prom
|
|
8345 (format "%s %s to:"
|
|
8346 prompt
|
|
8347 (if (> (length articles) 1)
|
|
8348 (format "these %d articles" (length articles))
|
|
8349 "this article")))
|
|
8350 (to-newsgroup
|
|
8351 (cond
|
|
8352 ((null split-name)
|
|
8353 (gnus-completing-read default prom
|
|
8354 gnus-active-hashtb
|
|
8355 'gnus-valid-move-group-p
|
|
8356 nil prefix
|
|
8357 'gnus-group-history))
|
|
8358 ((= 1 (length split-name))
|
|
8359 (gnus-completing-read (car split-name) prom
|
|
8360 gnus-active-hashtb
|
|
8361 'gnus-valid-move-group-p
|
|
8362 nil nil
|
|
8363 'gnus-group-history))
|
|
8364 (t
|
108
|
8365 (gnus-completing-read nil prom
|
98
|
8366 (mapcar (lambda (el) (list el))
|
|
8367 (nreverse split-name))
|
|
8368 nil nil nil
|
|
8369 'gnus-group-history)))))
|
|
8370 (when to-newsgroup
|
|
8371 (if (or (string= to-newsgroup "")
|
|
8372 (string= to-newsgroup prefix))
|
108
|
8373 (setq to-newsgroup default))
|
|
8374 (unless to-newsgroup
|
|
8375 (error "No group name entered"))
|
98
|
8376 (or (gnus-active to-newsgroup)
|
|
8377 (gnus-activate-group to-newsgroup)
|
|
8378 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
|
|
8379 to-newsgroup))
|
108
|
8380 (or (and (gnus-request-create-group
|
98
|
8381 to-newsgroup (gnus-group-name-to-method to-newsgroup))
|
|
8382 (gnus-activate-group to-newsgroup nil nil
|
|
8383 (gnus-group-name-to-method
|
|
8384 to-newsgroup)))
|
|
8385 (error "Couldn't create group %s" to-newsgroup)))
|
|
8386 (error "No such group: %s" to-newsgroup)))
|
|
8387 to-newsgroup))
|
|
8388
|
|
8389 ;; Summary extract commands
|
|
8390
|
|
8391 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
|
|
8392 (let ((buffer-read-only nil)
|
|
8393 (article (gnus-summary-article-number))
|
|
8394 after-article b e)
|
|
8395 (unless (gnus-summary-goto-subject article)
|
|
8396 (error "No such article: %d" article))
|
|
8397 (gnus-summary-position-point)
|
|
8398 ;; If all commands are to be bunched up on one line, we collect
|
|
8399 ;; them here.
|
|
8400 (unless gnus-view-pseudos-separately
|
|
8401 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
|
|
8402 files action)
|
|
8403 (while ps
|
|
8404 (setq action (cdr (assq 'action (car ps))))
|
|
8405 (setq files (list (cdr (assq 'name (car ps)))))
|
|
8406 (while (and ps (cdr ps)
|
|
8407 (string= (or action "1")
|
|
8408 (or (cdr (assq 'action (cadr ps))) "2")))
|
|
8409 (push (cdr (assq 'name (cadr ps))) files)
|
|
8410 (setcdr ps (cddr ps)))
|
|
8411 (when files
|
|
8412 (when (not (string-match "%s" action))
|
|
8413 (push " " files))
|
|
8414 (push " " files)
|
|
8415 (when (assq 'execute (car ps))
|
|
8416 (setcdr (assq 'execute (car ps))
|
|
8417 (funcall (if (string-match "%s" action)
|
|
8418 'format 'concat)
|
|
8419 action
|
100
|
8420 (mapconcat
|
|
8421 (lambda (f)
|
|
8422 (if (equal f " ")
|
|
8423 f
|
|
8424 (gnus-quote-arg-for-sh-or-csh f)))
|
|
8425 files " ")))))
|
98
|
8426 (setq ps (cdr ps)))))
|
|
8427 (if (and gnus-view-pseudos (not not-view))
|
|
8428 (while pslist
|
|
8429 (when (assq 'execute (car pslist))
|
|
8430 (gnus-execute-command (cdr (assq 'execute (car pslist)))
|
|
8431 (eq gnus-view-pseudos 'not-confirm)))
|
|
8432 (setq pslist (cdr pslist)))
|
|
8433 (save-excursion
|
|
8434 (while pslist
|
|
8435 (setq after-article (or (cdr (assq 'article (car pslist)))
|
|
8436 (gnus-summary-article-number)))
|
|
8437 (gnus-summary-goto-subject after-article)
|
|
8438 (forward-line 1)
|
|
8439 (setq b (point))
|
|
8440 (insert " " (file-name-nondirectory
|
|
8441 (cdr (assq 'name (car pslist))))
|
|
8442 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
|
|
8443 (setq e (point))
|
|
8444 (forward-line -1) ; back to `b'
|
|
8445 (gnus-add-text-properties
|
|
8446 b (1- e) (list 'gnus-number gnus-reffed-article-number
|
|
8447 gnus-mouse-face-prop gnus-mouse-face))
|
|
8448 (gnus-data-enter
|
|
8449 after-article gnus-reffed-article-number
|
|
8450 gnus-unread-mark b (car pslist) 0 (- e b))
|
|
8451 (push gnus-reffed-article-number gnus-newsgroup-unreads)
|
|
8452 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
|
|
8453 (setq pslist (cdr pslist)))))))
|
|
8454
|
|
8455 (defun gnus-pseudos< (p1 p2)
|
|
8456 (let ((c1 (cdr (assq 'action p1)))
|
|
8457 (c2 (cdr (assq 'action p2))))
|
|
8458 (and c1 c2 (string< c1 c2))))
|
|
8459
|
|
8460 (defun gnus-request-pseudo-article (props)
|
|
8461 (cond ((assq 'execute props)
|
|
8462 (gnus-execute-command (cdr (assq 'execute props)))))
|
|
8463 (let ((gnus-current-article (gnus-summary-article-number)))
|
|
8464 (run-hooks 'gnus-mark-article-hook)))
|
|
8465
|
|
8466 (defun gnus-execute-command (command &optional automatic)
|
|
8467 (save-excursion
|
|
8468 (gnus-article-setup-buffer)
|
|
8469 (set-buffer gnus-article-buffer)
|
|
8470 (setq buffer-read-only nil)
|
142
|
8471 (let ((command (if automatic command
|
|
8472 (read-string "Command: " (cons command 0)))))
|
98
|
8473 (erase-buffer)
|
|
8474 (insert "$ " command "\n\n")
|
|
8475 (if gnus-view-pseudo-asynchronously
|
112
|
8476 (start-process "gnus-execute" (current-buffer) shell-file-name
|
98
|
8477 shell-command-switch command)
|
|
8478 (call-process shell-file-name nil t nil
|
|
8479 shell-command-switch command)))))
|
|
8480
|
|
8481 ;; Summary kill commands.
|
|
8482
|
|
8483 (defun gnus-summary-edit-global-kill (article)
|
|
8484 "Edit the \"global\" kill file."
|
|
8485 (interactive (list (gnus-summary-article-number)))
|
|
8486 (gnus-set-global-variables)
|
|
8487 (gnus-group-edit-global-kill article))
|
|
8488
|
|
8489 (defun gnus-summary-edit-local-kill ()
|
|
8490 "Edit a local kill file applied to the current newsgroup."
|
|
8491 (interactive)
|
|
8492 (gnus-set-global-variables)
|
|
8493 (setq gnus-current-headers (gnus-summary-article-header))
|
|
8494 (gnus-set-global-variables)
|
|
8495 (gnus-group-edit-local-kill
|
|
8496 (gnus-summary-article-number) gnus-newsgroup-name))
|
|
8497
|
|
8498 ;;; Header reading.
|
|
8499
|
|
8500 (defun gnus-read-header (id &optional header)
|
|
8501 "Read the headers of article ID and enter them into the Gnus system."
|
|
8502 (let ((group gnus-newsgroup-name)
|
108
|
8503 (gnus-override-method
|
98
|
8504 (and (gnus-news-group-p gnus-newsgroup-name)
|
|
8505 gnus-refer-article-method))
|
|
8506 where)
|
|
8507 ;; First we check to see whether the header in question is already
|
|
8508 ;; fetched.
|
|
8509 (if (stringp id)
|
|
8510 ;; This is a Message-ID.
|
|
8511 (setq header (or header (gnus-id-to-header id)))
|
|
8512 ;; This is an article number.
|
|
8513 (setq header (or header (gnus-summary-article-header id))))
|
|
8514 (if (and header
|
|
8515 (not (gnus-summary-article-sparse-p (mail-header-number header))))
|
|
8516 ;; We have found the header.
|
|
8517 header
|
|
8518 ;; We have to really fetch the header to this article.
|
|
8519 (save-excursion
|
|
8520 (set-buffer nntp-server-buffer)
|
|
8521 (when (setq where (gnus-request-head id group))
|
|
8522 (nnheader-fold-continuation-lines)
|
|
8523 (goto-char (point-max))
|
|
8524 (insert ".\n")
|
|
8525 (goto-char (point-min))
|
|
8526 (insert "211 ")
|
|
8527 (princ (cond
|
|
8528 ((numberp id) id)
|
|
8529 ((cdr where) (cdr where))
|
|
8530 (header (mail-header-number header))
|
|
8531 (t gnus-reffed-article-number))
|
|
8532 (current-buffer))
|
|
8533 (insert " Article retrieved.\n"))
|
|
8534 (if (or (not where)
|
|
8535 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
|
|
8536 () ; Malformed head.
|
|
8537 (unless (gnus-summary-article-sparse-p (mail-header-number header))
|
|
8538 (when (and (stringp id)
|
|
8539 (not (string= (gnus-group-real-name group)
|
|
8540 (car where))))
|
|
8541 ;; If we fetched by Message-ID and the article came
|
|
8542 ;; from a different group, we fudge some bogus article
|
|
8543 ;; numbers for this article.
|
|
8544 (mail-header-set-number header gnus-reffed-article-number))
|
|
8545 (save-excursion
|
|
8546 (set-buffer gnus-summary-buffer)
|
|
8547 (decf gnus-reffed-article-number)
|
|
8548 (gnus-remove-header (mail-header-number header))
|
|
8549 (push header gnus-newsgroup-headers)
|
|
8550 (setq gnus-current-headers header)
|
|
8551 (push (mail-header-number header) gnus-newsgroup-limit)))
|
|
8552 header)))))
|
|
8553
|
|
8554 (defun gnus-remove-header (number)
|
|
8555 "Remove header NUMBER from `gnus-newsgroup-headers'."
|
|
8556 (if (and gnus-newsgroup-headers
|
|
8557 (= number (mail-header-number (car gnus-newsgroup-headers))))
|
|
8558 (pop gnus-newsgroup-headers)
|
|
8559 (let ((headers gnus-newsgroup-headers))
|
|
8560 (while (and (cdr headers)
|
|
8561 (not (= number (mail-header-number (cadr headers)))))
|
|
8562 (pop headers))
|
|
8563 (when (cdr headers)
|
|
8564 (setcdr headers (cddr headers))))))
|
|
8565
|
|
8566 ;;;
|
|
8567 ;;; summary highlights
|
|
8568 ;;;
|
|
8569
|
|
8570 (defun gnus-highlight-selected-summary ()
|
|
8571 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
|
|
8572 ;; Highlight selected article in summary buffer
|
|
8573 (when gnus-summary-selected-face
|
|
8574 (save-excursion
|
|
8575 (let* ((beg (progn (beginning-of-line) (point)))
|
|
8576 (end (progn (end-of-line) (point)))
|
|
8577 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
|
|
8578 (from (if (get-text-property beg gnus-mouse-face-prop)
|
|
8579 beg
|
108
|
8580 (or (next-single-property-change
|
98
|
8581 beg gnus-mouse-face-prop nil end)
|
|
8582 beg)))
|
|
8583 (to
|
|
8584 (if (= from end)
|
|
8585 (- from 2)
|
|
8586 (or (next-single-property-change
|
|
8587 from gnus-mouse-face-prop nil end)
|
|
8588 end))))
|
|
8589 ;; If no mouse-face prop on line we will have to = from = end,
|
|
8590 ;; so we highlight the entire line instead.
|
|
8591 (when (= (+ to 2) from)
|
|
8592 (setq from beg)
|
|
8593 (setq to end))
|
|
8594 (if gnus-newsgroup-selected-overlay
|
|
8595 ;; Move old overlay.
|
|
8596 (gnus-move-overlay
|
|
8597 gnus-newsgroup-selected-overlay from to (current-buffer))
|
|
8598 ;; Create new overlay.
|
|
8599 (gnus-overlay-put
|
|
8600 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
|
|
8601 'face gnus-summary-selected-face))))))
|
|
8602
|
|
8603 ;; New implementation by Christian Limpach <Christian.Limpach@nice.ch>.
|
|
8604 (defun gnus-summary-highlight-line ()
|
|
8605 "Highlight current line according to `gnus-summary-highlight'."
|
|
8606 (let* ((list gnus-summary-highlight)
|
|
8607 (p (point))
|
|
8608 (end (progn (end-of-line) (point)))
|
|
8609 ;; now find out where the line starts and leave point there.
|
|
8610 (beg (progn (beginning-of-line) (point)))
|
|
8611 (article (gnus-summary-article-number))
|
|
8612 (score (or (cdr (assq (or article gnus-current-article)
|
|
8613 gnus-newsgroup-scored))
|
|
8614 gnus-summary-default-score 0))
|
|
8615 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
|
|
8616 (inhibit-read-only t))
|
|
8617 ;; Eval the cars of the lists until we find a match.
|
|
8618 (let ((default gnus-summary-default-score))
|
|
8619 (while (and list
|
|
8620 (not (eval (caar list))))
|
|
8621 (setq list (cdr list))))
|
|
8622 (let ((face (cdar list)))
|
|
8623 (unless (eq face (get-text-property beg 'face))
|
108
|
8624 (gnus-put-text-property
|
|
8625 beg end 'face
|
98
|
8626 (setq face (if (boundp face) (symbol-value face) face)))
|
|
8627 (when gnus-summary-highlight-line-function
|
|
8628 (funcall gnus-summary-highlight-line-function article face))))
|
|
8629 (goto-char p)))
|
|
8630
|
|
8631 (defun gnus-update-read-articles (group unread)
|
|
8632 "Update the list of read articles in GROUP."
|
|
8633 (let* ((active (or gnus-newsgroup-active (gnus-active group)))
|
|
8634 (entry (gnus-gethash group gnus-newsrc-hashtb))
|
|
8635 (info (nth 2 entry))
|
|
8636 (prev 1)
|
|
8637 (unread (sort (copy-sequence unread) '<))
|
|
8638 read)
|
|
8639 (if (or (not info) (not active))
|
|
8640 ;; There is no info on this group if it was, in fact,
|
|
8641 ;; killed. Gnus stores no information on killed groups, so
|
|
8642 ;; there's nothing to be done.
|
|
8643 ;; One could store the information somewhere temporarily,
|
|
8644 ;; perhaps... Hmmm...
|
|
8645 ()
|
|
8646 ;; Remove any negative articles numbers.
|
|
8647 (while (and unread (< (car unread) 0))
|
|
8648 (setq unread (cdr unread)))
|
|
8649 ;; Remove any expired article numbers
|
|
8650 (while (and unread (< (car unread) (car active)))
|
|
8651 (setq unread (cdr unread)))
|
|
8652 ;; Compute the ranges of read articles by looking at the list of
|
|
8653 ;; unread articles.
|
|
8654 (while unread
|
|
8655 (when (/= (car unread) prev)
|
|
8656 (push (if (= prev (1- (car unread))) prev
|
|
8657 (cons prev (1- (car unread))))
|
|
8658 read))
|
|
8659 (setq prev (1+ (car unread)))
|
|
8660 (setq unread (cdr unread)))
|
|
8661 (when (<= prev (cdr active))
|
|
8662 (push (cons prev (cdr active)) read))
|
|
8663 (save-excursion
|
|
8664 (set-buffer gnus-group-buffer)
|
|
8665 (gnus-undo-register
|
|
8666 `(progn
|
|
8667 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
|
|
8668 (gnus-info-set-read ',info ',(gnus-info-read info))
|
|
8669 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
|
|
8670 (gnus-group-update-group ,group t))))
|
|
8671 ;; Enter this list into the group info.
|
|
8672 (gnus-info-set-read
|
|
8673 info (if (> (length read) 1) (nreverse read) read))
|
|
8674 ;; Set the number of unread articles in gnus-newsrc-hashtb.
|
|
8675 (gnus-get-unread-articles-in-group info (gnus-active group))
|
|
8676 t)))
|
|
8677
|
100
|
8678 (defun gnus-offer-save-summaries ()
|
|
8679 "Offer to save all active summary buffers."
|
|
8680 (save-excursion
|
|
8681 (let ((buflist (buffer-list))
|
|
8682 buffers bufname)
|
|
8683 ;; Go through all buffers and find all summaries.
|
|
8684 (while buflist
|
|
8685 (and (setq bufname (buffer-name (car buflist)))
|
|
8686 (string-match "Summary" bufname)
|
|
8687 (save-excursion
|
|
8688 (set-buffer bufname)
|
|
8689 ;; We check that this is, indeed, a summary buffer.
|
|
8690 (and (eq major-mode 'gnus-summary-mode)
|
|
8691 ;; Also make sure this isn't bogus.
|
|
8692 gnus-newsgroup-prepared
|
|
8693 ;; Also make sure that this isn't a dead summary buffer.
|
|
8694 (not gnus-dead-summary-mode)))
|
|
8695 (push bufname buffers))
|
|
8696 (setq buflist (cdr buflist)))
|
|
8697 ;; Go through all these summary buffers and offer to save them.
|
|
8698 (when buffers
|
|
8699 (map-y-or-n-p
|
|
8700 "Update summary buffer %s? "
|
|
8701 (lambda (buf) (switch-to-buffer buf) (gnus-summary-exit))
|
|
8702 buffers)))))
|
|
8703
|
136
|
8704 (gnus-ems-redefine)
|
|
8705
|
98
|
8706 (provide 'gnus-sum)
|
|
8707
|
|
8708 (run-hooks 'gnus-sum-load-hook)
|
|
8709
|
|
8710 ;;; gnus-sum.el ends here
|