1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-mode))
45 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
46 (autoload 'gnus-cache-write-active "gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
48 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
49 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
50 (autoload 'mm-uu-dissect "mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
52 "Deuglify broken Outlook (Express) articles and redisplay."
54 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
55 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
56 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
58 (defcustom gnus-kill-summary-on-exit t
59 "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group 'gnus-summary-exit
65 (defcustom gnus-fetch-old-headers nil
66 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
67 If an unread article in the group refers to an older, already
68 read (or just marked as read) article, the old article will not
69 normally be displayed in the Summary buffer. If this variable is
70 t, Gnus will attempt to grab the headers to the old articles, and
71 thereby build complete threads. If it has the value `some', all
72 old headers will be fetched but only enough headers to connect
73 otherwise loose threads will be displayed. This variable can
74 also be a number. In that case, no more than that number of old
75 headers will be fetched. If it has the value `invisible', all
76 old headers will be fetched, but none will be displayed.
78 The server has to support NOV for any of this to work.
80 This feature can seriously impact performance it ignores all
81 locally cached header entries."
83 :type '(choice (const :tag "off" nil)
88 (sexp :menu-tag "other" t)))
90 (defcustom gnus-refer-thread-limit 500
91 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
92 If t, fetch all the available old headers."
95 (sexp :menu-tag "other" t)))
97 (defcustom gnus-summary-make-false-root 'adopt
98 "*nil means that Gnus won't gather loose threads.
99 If the root of a thread has expired or been read in a previous
100 session, the information necessary to build a complete thread has been
101 lost. Instead of having many small sub-threads from this original thread
102 scattered all over the summary buffer, Gnus can gather them.
104 If non-nil, Gnus will try to gather all loose sub-threads from an
105 original thread into one large thread.
107 If this variable is non-nil, it should be one of `none', `adopt',
110 If this variable is `none', Gnus will not make a false root, but just
111 present the sub-threads after another.
112 If this variable is `dummy', Gnus will create a dummy root that will
113 have all the sub-threads as children.
114 If this variable is `adopt', Gnus will make one of the \"children\"
115 the parent and mark all the step-children as such.
116 If this variable is `empty', the \"children\" are printed with empty
117 subject fields. (Or rather, they will be printed with a string
118 given by the `gnus-summary-same-subject' variable.)"
120 :type '(choice (const :tag "off" nil)
126 (defcustom gnus-summary-make-false-root-always nil
127 "Always make a false dummy root."
132 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
133 "*A regexp to match subjects to be excluded from loose thread gathering.
134 As loose thread gathering is done on subjects only, that means that
135 there can be many false gatherings performed. By rooting out certain
136 common subjects, gathering might become saner."
140 (defcustom gnus-summary-gather-subject-limit nil
141 "*Maximum length of subject comparisons when gathering loose threads.
142 Use nil to compare full subjects. Setting this variable to a low
143 number will help gather threads that have been corrupted by
144 newsreaders chopping off subject lines, but it might also mean that
145 unrelated articles that have subject that happen to begin with the
146 same few characters will be incorrectly gathered.
148 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
151 :type '(choice (const :tag "off" nil)
153 (sexp :menu-tag "on" t)))
155 (defcustom gnus-simplify-subject-functions nil
156 "List of functions taking a string argument that simplify subjects.
157 The functions are applied recursively.
159 Useful functions to put in this list include:
160 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
161 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
163 :type '(repeat function))
165 (defcustom gnus-simplify-ignored-prefixes nil
166 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
168 :type '(choice (const :tag "off" nil)
171 (defcustom gnus-build-sparse-threads nil
172 "*If non-nil, fill in the gaps in threads.
173 If `some', only fill in the gaps that are needed to tie loose threads
174 together. If `more', fill in all leaf nodes that Gnus can find. If
175 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
177 :type '(choice (const :tag "off" nil)
180 (sexp :menu-tag "all" t)))
182 (defcustom gnus-summary-thread-gathering-function
183 'gnus-gather-threads-by-subject
184 "*Function used for gathering loose threads.
185 There are two pre-defined functions: `gnus-gather-threads-by-subject',
186 which only takes Subjects into consideration; and
187 `gnus-gather-threads-by-references', which compared the References
188 headers of the articles to find matches."
190 :type '(radio (function-item gnus-gather-threads-by-subject)
191 (function-item gnus-gather-threads-by-references)
192 (function :tag "other")))
194 (defcustom gnus-summary-same-subject ""
195 "*String indicating that the current article has the same subject as the previous.
196 This variable will only be used if the value of
197 `gnus-summary-make-false-root' is `empty'."
198 :group 'gnus-summary-format
201 (defcustom gnus-summary-goto-unread t
202 "*If t, many commands will go to the next unread article.
203 This applies to marking commands as well as other commands that
204 \"naturally\" select the next article, like, for instance, `SPC' at
205 the end of an article.
207 If nil, the marking commands do NOT go to the next unread article
208 \(they go to the next article instead). If `never', commands that
209 usually go to the next unread article, will go to the next article,
210 whether it is read or not."
211 :group 'gnus-summary-marks
212 :link '(custom-manual "(gnus)Setting Marks")
213 :type '(choice (const :tag "off" nil)
215 (sexp :menu-tag "on" t)))
217 (defcustom gnus-summary-default-score 0
218 "*Default article score level.
219 All scores generated by the score files will be added to this score.
220 If this variable is nil, scoring will be disabled."
221 :group 'gnus-score-default
222 :type '(choice (const :tag "disable")
225 (defcustom gnus-summary-default-high-score 0
226 "*Default threshold for a high scored article.
227 An article will be highlighted as high scored if its score is greater
230 :group 'gnus-score-default
233 (defcustom gnus-summary-default-low-score 0
234 "*Default threshold for a low scored article.
235 An article will be highlighted as low scored if its score is smaller
238 :group 'gnus-score-default
241 (defcustom gnus-summary-zcore-fuzz 0
242 "*Fuzziness factor for the zcore in the summary buffer.
243 Articles with scores closer than this to `gnus-summary-default-score'
245 :group 'gnus-summary-format
248 (defcustom gnus-simplify-subject-fuzzy-regexp nil
249 "*Strings to be removed when doing fuzzy matches.
250 This can either be a regular expression or list of regular expressions
251 that will be removed from subject strings if fuzzy subject
252 simplification is selected."
254 :type '(repeat regexp))
256 (defcustom gnus-show-threads t
257 "*If non-nil, display threads in summary mode."
261 (defcustom gnus-thread-hide-subtree nil
262 "*If non-nil, hide all threads initially.
263 This can be a predicate specifier which says which threads to hide.
264 If threads are hidden, you have to run the command
265 `gnus-summary-show-thread' by hand or select an article."
267 :type '(radio (sexp :format "Non-nil\n"
268 :match (lambda (widget value)
269 (not (or (consp value) (functionp value))))
272 (sexp :tag "Predicate specifier")))
274 (defcustom gnus-thread-hide-killed t
275 "*If non-nil, hide killed threads automatically."
279 (defcustom gnus-thread-ignore-subject t
280 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
281 If nil, articles that have different subjects from their parents will
282 start separate threads."
286 (defcustom gnus-thread-operation-ignore-subject t
287 "*If non-nil, subjects will be ignored when doing thread commands.
288 This affects commands like `gnus-summary-kill-thread' and
289 `gnus-summary-lower-thread'.
291 If this variable is nil, articles in the same thread with different
292 subjects will not be included in the operation in question. If this
293 variable is `fuzzy', only articles that have subjects that are fuzzily
294 equal will be included."
296 :type '(choice (const :tag "off" nil)
300 (defcustom gnus-thread-indent-level 4
301 "*Number that says how much each sub-thread should be indented."
305 (defcustom gnus-auto-extend-newsgroup t
306 "*If non-nil, extend newsgroup forward and backward when requested."
307 :group 'gnus-summary-choose
310 (defcustom gnus-auto-select-first t
311 "*If non-nil, select the article under point.
312 Which article this is is controlled by the `gnus-auto-select-subject'
315 If you want to prevent automatic selection of articles in some
316 newsgroups, set the variable to nil in `gnus-select-group-hook'."
317 :group 'gnus-group-select
318 :type '(choice (const :tag "none" nil)
319 (sexp :menu-tag "first" t)))
321 (defcustom gnus-auto-select-subject 'unread
322 "*Says what subject to place under point when entering a group.
324 This variable can either be the symbols `first' (place point on the
325 first subject), `unread' (place point on the subject line of the first
326 unread article), `best' (place point on the subject line of the
327 higest-scored article), `unseen' (place point on the subject line of
328 the first unseen article), `unseen-or-unread' (place point on the subject
329 line of the first unseen article or, if all article have been seen, on the
330 subject line of the first unread article), or a function to be called to
331 place point on some subject line."
333 :group 'gnus-group-select
334 :type '(choice (const best)
338 (const unseen-or-unread)))
340 (defcustom gnus-auto-select-next t
341 "*If non-nil, offer to go to the next group from the end of the previous.
342 If the value is t and the next newsgroup is empty, Gnus will exit
343 summary mode and go back to group mode. If the value is neither nil
344 nor t, Gnus will select the following unread newsgroup. In
345 particular, if the value is the symbol `quietly', the next unread
346 newsgroup will be selected without any confirmation, and if it is
347 `almost-quietly', the next group will be selected without any
348 confirmation if you are located on the last article in the group.
349 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
350 will go to the next group without confirmation."
351 :group 'gnus-summary-maneuvering
352 :type '(choice (const :tag "off" nil)
354 (const almost-quietly)
355 (const slightly-quietly)
356 (sexp :menu-tag "on" t)))
358 (defcustom gnus-auto-select-same nil
359 "*If non-nil, select the next article with the same subject.
360 If there are no more articles with the same subject, go to
361 the first unread article."
362 :group 'gnus-summary-maneuvering
365 (defcustom gnus-auto-goto-ignores 'unfetched
366 "*Says how to handle unfetched articles when maneuvering.
368 This variable can either be the symbols nil (maneuver to any
369 article), `undownloaded' (maneuvering while unplugged ignores articles
370 that have not been fetched), `always-undownloaded' (maneuvering always
371 ignores articles that have not been fetched), `unfetched' (maneuvering
372 ignores articles whose headers have not been fetched).
374 NOTE: The list of unfetched articles will always be nil when plugged
375 and, when unplugged, a subset of the undownloaded article list."
377 :group 'gnus-summary-maneuvering
378 :type '(choice (const :tag "None" nil)
379 (const :tag "Undownloaded when unplugged" undownloaded)
380 (const :tag "Undownloaded" always-undownloaded)
381 (const :tag "Unfetched" unfetched)))
383 (defcustom gnus-summary-check-current nil
384 "*If non-nil, consider the current article when moving.
385 The \"unread\" movement commands will stay on the same line if the
386 current article is unread."
387 :group 'gnus-summary-maneuvering
390 (defcustom gnus-auto-center-summary 2
391 "*If non-nil, always center the current summary buffer.
392 In particular, if `vertical' do only vertical recentering. If non-nil
393 and non-`vertical', do both horizontal and vertical recentering."
394 :group 'gnus-summary-maneuvering
395 :type '(choice (const :tag "none" nil)
397 (integer :tag "height")
398 (sexp :menu-tag "both" t)))
400 (defvar gnus-auto-center-group t
401 "*If non-nil, always center the group buffer.")
403 (defcustom gnus-show-all-headers nil
404 "*If non-nil, don't hide any headers."
405 :group 'gnus-article-hiding
406 :group 'gnus-article-headers
409 (defcustom gnus-summary-ignore-duplicates nil
410 "*If non-nil, ignore articles with identical Message-ID headers."
414 (defcustom gnus-single-article-buffer t
415 "*If non-nil, display all articles in the same buffer.
416 If nil, each group will get its own article buffer."
417 :group 'gnus-article-various
420 (defcustom gnus-break-pages t
421 "*If non-nil, do page breaking on articles.
422 The page delimiter is specified by the `gnus-page-delimiter'
424 :group 'gnus-article-various
427 (defcustom gnus-move-split-methods nil
428 "*Variable used to suggest where articles are to be moved to.
429 It uses the same syntax as the `gnus-split-methods' variable.
430 However, whereas `gnus-split-methods' specifies file names as targets,
431 this variable specifies group names."
432 :group 'gnus-summary-mail
433 :type '(repeat (choice (list :value (fun) function)
434 (cons :value ("" "") regexp (repeat string))
437 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
438 "Function used to compute default prefix for article move/copy/etc prompts.
439 The function should take one argument, a group name, and return a
440 string with the suggested prefix."
441 :group 'gnus-summary-mail
444 ;; FIXME: Although the custom type is `character' for the following variables,
445 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
447 (defcustom gnus-unread-mark ? ;Whitespace
448 "*Mark used for unread articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-ticked-mark ?!
453 "*Mark used for ticked articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-dormant-mark ??
458 "*Mark used for dormant articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-del-mark ?r
463 "*Mark used for del'd articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-read-mark ?R
468 "*Mark used for read articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-expirable-mark ?E
473 "*Mark used for expirable articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-killed-mark ?K
478 "*Mark used for killed articles."
479 :group 'gnus-summary-marks
482 (defcustom gnus-spam-mark ?$
483 "*Mark used for spam articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-souped-mark ?F
489 "*Mark used for souped articles."
490 :group 'gnus-summary-marks
493 (defcustom gnus-kill-file-mark ?X
494 "*Mark used for articles killed by kill files."
495 :group 'gnus-summary-marks
498 (defcustom gnus-low-score-mark ?Y
499 "*Mark used for articles with a low score."
500 :group 'gnus-summary-marks
503 (defcustom gnus-catchup-mark ?C
504 "*Mark used for articles that are caught up."
505 :group 'gnus-summary-marks
508 (defcustom gnus-replied-mark ?A
509 "*Mark used for articles that have been replied to."
510 :group 'gnus-summary-marks
513 (defcustom gnus-forwarded-mark ?F
514 "*Mark used for articles that have been forwarded."
516 :group 'gnus-summary-marks
519 (defcustom gnus-recent-mark ?N
520 "*Mark used for articles that are recent."
522 :group 'gnus-summary-marks
525 (defcustom gnus-cached-mark ?*
526 "*Mark used for articles that are in the cache."
527 :group 'gnus-summary-marks
530 (defcustom gnus-saved-mark ?S
531 "*Mark used for articles that have been saved."
532 :group 'gnus-summary-marks
535 (defcustom gnus-unseen-mark ?.
536 "*Mark used for articles that haven't been seen."
538 :group 'gnus-summary-marks
541 (defcustom gnus-no-mark ? ;Whitespace
542 "*Mark used for articles that have no other secondary mark."
544 :group 'gnus-summary-marks
547 (defcustom gnus-ancient-mark ?O
548 "*Mark used for ancient articles."
549 :group 'gnus-summary-marks
552 (defcustom gnus-sparse-mark ?Q
553 "*Mark used for sparsely reffed articles."
554 :group 'gnus-summary-marks
557 (defcustom gnus-canceled-mark ?G
558 "*Mark used for canceled articles."
559 :group 'gnus-summary-marks
562 (defcustom gnus-duplicate-mark ?M
563 "*Mark used for duplicate articles."
564 :group 'gnus-summary-marks
567 (defcustom gnus-undownloaded-mark ?-
568 "*Mark used for articles that weren't downloaded."
570 :group 'gnus-summary-marks
573 (defcustom gnus-downloaded-mark ?+
574 "*Mark used for articles that were downloaded."
575 :group 'gnus-summary-marks
578 (defcustom gnus-downloadable-mark ?%
579 "*Mark used for articles that are to be downloaded."
580 :group 'gnus-summary-marks
583 (defcustom gnus-unsendable-mark ?=
584 "*Mark used for articles that won't be sent."
585 :group 'gnus-summary-marks
588 (defcustom gnus-score-over-mark ?+
589 "*Score mark used for articles with high scores."
590 :group 'gnus-summary-marks
593 (defcustom gnus-score-below-mark ?-
594 "*Score mark used for articles with low scores."
595 :group 'gnus-summary-marks
598 (defcustom gnus-empty-thread-mark ? ;Whitespace
599 "*There is no thread under the article."
600 :group 'gnus-summary-marks
603 (defcustom gnus-not-empty-thread-mark ?=
604 "*There is a thread under the article."
605 :group 'gnus-summary-marks
608 (defcustom gnus-view-pseudo-asynchronously nil
609 "*If non-nil, Gnus will view pseudo-articles asynchronously."
610 :group 'gnus-extract-view
613 (defcustom gnus-auto-expirable-marks
614 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
615 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
616 gnus-souped-mark gnus-duplicate-mark)
617 "*The list of marks converted into expiration if a group is auto-expirable."
620 :type '(repeat character))
622 (defcustom gnus-inhibit-user-auto-expire t
623 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
628 (defcustom gnus-view-pseudos nil
629 "*If `automatic', pseudo-articles will be viewed automatically.
630 If `not-confirm', pseudos will be viewed automatically, and the user
631 will not be asked to confirm the command."
632 :group 'gnus-extract-view
633 :type '(choice (const :tag "off" nil)
635 (const not-confirm)))
637 (defcustom gnus-view-pseudos-separately t
638 "*If non-nil, one pseudo-article will be created for each file to be viewed.
639 If nil, all files that use the same viewing command will be given as a
640 list of parameters to that command."
641 :group 'gnus-extract-view
644 (defcustom gnus-insert-pseudo-articles t
645 "*If non-nil, insert pseudo-articles when decoding articles."
646 :group 'gnus-extract-view
649 (defcustom gnus-summary-dummy-line-format
651 "*The format specification for the dummy roots in the summary buffer.
652 It works along the same lines as a normal formatting string,
653 with some simple extensions.
657 General format specifiers can also be used.
658 See `(gnus)Formatting Variables'."
659 :link '(custom-manual "(gnus)Formatting Variables")
660 :group 'gnus-threading
663 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
664 "*The format specification for the summary mode line.
665 It works along the same lines as a normal formatting string,
666 with some simple extensions:
669 %p Unprefixed group name
670 %A Current article number
671 %z Current article score
673 %U Number of unread articles in the group
674 %e Number of unselected articles in the group
675 %Z A string with unread/unselected article counts
676 %g Shortish group name
677 %S Subject of the current article
679 %s Current score file name
680 %d Number of dormant articles
681 %r Number of articles that have been marked as read in this session
682 %E Number of articles expunged by the score files"
683 :group 'gnus-summary-format
686 (defcustom gnus-list-identifiers nil
687 "Regexp that matches list identifiers to be removed from subject.
688 This can also be a list of regexps."
690 :group 'gnus-summary-format
691 :group 'gnus-article-hiding
692 :type '(choice (const :tag "none" nil)
694 (repeat :value (".*") regexp)))
696 (defcustom gnus-summary-mark-below 0
697 "*Mark all articles with a score below this variable as read.
698 This variable is local to each summary buffer and usually set by the
700 :group 'gnus-score-default
703 (defun gnus-widget-reversible-match (widget value)
704 "Ignoring WIDGET, convert VALUE to internal form.
705 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
709 (eq (length value) 2)
710 (eq (nth 0 value) 'not)
711 (symbolp (nth 1 value)))))
713 (defun gnus-widget-reversible-to-internal (widget value)
714 "Ignoring WIDGET, convert VALUE to internal form.
715 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
716 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
720 (list (nth 1 value) t)))
722 (defun gnus-widget-reversible-to-external (widget value)
723 "Ignoring WIDGET, convert VALUE to external form.
724 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
725 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
728 (list 'not (nth 0 value))
731 (define-widget 'gnus-widget-reversible 'group
732 "A `group' that convert values."
733 :match 'gnus-widget-reversible-match
734 :value-to-internal 'gnus-widget-reversible-to-internal
735 :value-to-external 'gnus-widget-reversible-to-external)
737 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
738 "*List of functions used for sorting articles in the summary buffer.
740 Each function takes two articles and returns non-nil if the first
741 article should be sorted before the other. If you use more than one
742 function, the primary sort function should be the last. You should
743 probably always include `gnus-article-sort-by-number' in the list of
744 sorting functions -- preferably first. Also note that sorting by date
745 is often much slower than sorting by number, and the sorting order is
746 very similar. (Sorting by date means sorting by the time the message
747 was sent, sorting by number means sorting by arrival time.)
749 Each item can also be a list `(not F)' where F is a function;
750 this reverses the sort order.
752 Ready-made functions include `gnus-article-sort-by-number',
753 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
754 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
755 and `gnus-article-sort-by-score'.
757 When threading is turned on, the variable `gnus-thread-sort-functions'
758 controls how articles are sorted."
759 :group 'gnus-summary-sort
760 :type '(repeat (gnus-widget-reversible
761 (choice (function-item gnus-article-sort-by-number)
762 (function-item gnus-article-sort-by-author)
763 (function-item gnus-article-sort-by-subject)
764 (function-item gnus-article-sort-by-date)
765 (function-item gnus-article-sort-by-score)
766 (function-item gnus-article-sort-by-random)
767 (function :tag "other"))
768 (boolean :tag "Reverse order"))))
771 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
772 "*List of functions used for sorting threads in the summary buffer.
773 By default, threads are sorted by article number.
775 Each function takes two threads and returns non-nil if the first
776 thread should be sorted before the other. If you use more than one
777 function, the primary sort function should be the last. You should
778 probably always include `gnus-thread-sort-by-number' in the list of
779 sorting functions -- preferably first. Also note that sorting by date
780 is often much slower than sorting by number, and the sorting order is
781 very similar. (Sorting by date means sorting by the time the message
782 was sent, sorting by number means sorting by arrival time.)
784 Each list item can also be a list `(not F)' where F is a
785 function; this specifies reversed sort order.
787 Ready-made functions include `gnus-thread-sort-by-number',
788 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
789 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
790 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
791 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
792 and `gnus-thread-sort-by-total-score' (see
793 `gnus-thread-score-function').
795 When threading is turned off, the variable
796 `gnus-article-sort-functions' controls how articles are sorted."
797 :group 'gnus-summary-sort
799 (gnus-widget-reversible
800 (choice (function-item gnus-thread-sort-by-number)
801 (function-item gnus-thread-sort-by-author)
802 (function-item gnus-thread-sort-by-recipient)
803 (function-item gnus-thread-sort-by-subject)
804 (function-item gnus-thread-sort-by-date)
805 (function-item gnus-thread-sort-by-score)
806 (function-item gnus-thread-sort-by-most-recent-number)
807 (function-item gnus-thread-sort-by-most-recent-date)
808 (function-item gnus-thread-sort-by-random)
809 (function-item gnus-thread-sort-by-total-score)
810 (function :tag "other"))
811 (boolean :tag "Reverse order"))))
813 (defcustom gnus-thread-score-function '+
814 "*Function used for calculating the total score of a thread.
816 The function is called with the scores of the article and each
817 subthread and should then return the score of the thread.
819 Some functions you can use are `+', `max', or `min'."
820 :group 'gnus-summary-sort
823 (defcustom gnus-summary-expunge-below nil
824 "All articles that have a score less than this variable will be expunged.
825 This variable is local to the summary buffers."
826 :group 'gnus-score-default
827 :type '(choice (const :tag "off" nil)
830 (defcustom gnus-thread-expunge-below nil
831 "All threads that have a total score less than this variable will be expunged.
832 See `gnus-thread-score-function' for en explanation of what a
835 This variable is local to the summary buffers."
836 :group 'gnus-threading
837 :group 'gnus-score-default
838 :type '(choice (const :tag "off" nil)
841 (defcustom gnus-summary-mode-hook nil
842 "*A hook for Gnus summary mode.
843 This hook is run before any variables are set in the summary buffer."
844 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
845 :group 'gnus-summary-various
848 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
849 (when (featurep 'xemacs)
850 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
851 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
852 (add-hook 'gnus-summary-mode-hook
853 'gnus-xmas-switch-horizontal-scrollbar-off))
855 (defcustom gnus-summary-menu-hook nil
856 "*Hook run after the creation of the summary mode menu."
857 :group 'gnus-summary-visual
860 (defcustom gnus-summary-exit-hook nil
861 "*A hook called on exit from the summary buffer.
862 It will be called with point in the group buffer."
863 :group 'gnus-summary-exit
866 (defcustom gnus-summary-prepare-hook nil
867 "*A hook called after the summary buffer has been generated.
868 If you want to modify the summary buffer, you can use this hook."
869 :group 'gnus-summary-various
872 (defcustom gnus-summary-prepared-hook nil
873 "*A hook called as the last thing after the summary buffer has been generated."
874 :group 'gnus-summary-various
877 (defcustom gnus-summary-generate-hook nil
878 "*A hook run just before generating the summary buffer.
879 This hook is commonly used to customize threading variables and the
881 :group 'gnus-summary-various
884 (defcustom gnus-select-group-hook nil
885 "*A hook called when a newsgroup is selected.
887 If you'd like to simplify subjects like the
888 `gnus-summary-next-same-subject' command does, you can use the
891 (add-hook gnus-select-group-hook
893 (mapcar (lambda (header)
894 (mail-header-set-subject
896 (gnus-simplify-subject
897 (mail-header-subject header) 're-only)))
898 gnus-newsgroup-headers)))"
899 :group 'gnus-group-select
902 (defcustom gnus-select-article-hook nil
903 "*A hook called when an article is selected."
904 :group 'gnus-summary-choose
905 :options '(gnus-agent-fetch-selected-article)
908 (defcustom gnus-visual-mark-article-hook
909 (list 'gnus-highlight-selected-summary)
910 "*Hook run after selecting an article in the summary buffer.
911 It is meant to be used for highlighting the article in some way. It
912 is not run if `gnus-visual' is nil."
913 :group 'gnus-summary-visual
916 (defcustom gnus-parse-headers-hook nil
917 "*A hook called before parsing the headers."
921 (defcustom gnus-exit-group-hook nil
922 "*A hook called when exiting summary mode.
923 This hook is not called from the non-updating exit commands like `Q'."
927 (defcustom gnus-summary-update-hook
928 (list 'gnus-summary-highlight-line)
929 "*A hook called when a summary line is changed.
930 The hook will not be called if `gnus-visual' is nil.
932 The default function `gnus-summary-highlight-line' will
933 highlight the line according to the `gnus-summary-highlight'
935 :group 'gnus-summary-visual
938 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
939 "*A hook called when an article is selected for the first time.
940 The hook is intended to mark an article as read (or unread)
941 automatically when it is selected."
942 :group 'gnus-summary-choose
945 (defcustom gnus-group-no-more-groups-hook nil
946 "*A hook run when returning to group mode having no more (unread) groups."
947 :group 'gnus-group-select
950 (defcustom gnus-ps-print-hook nil
951 "*A hook run before ps-printing something from Gnus."
955 (defcustom gnus-summary-article-move-hook nil
956 "*A hook called after an article is moved, copied, respooled, or crossposted."
961 (defcustom gnus-summary-article-delete-hook nil
962 "*A hook called after an article is deleted."
967 (defcustom gnus-summary-article-expire-hook nil
968 "*A hook called after an article is expired."
973 (defcustom gnus-summary-display-arrow
974 (and (fboundp 'display-graphic-p)
976 "*If non-nil, display an arrow highlighting the current article."
981 (defcustom gnus-summary-selected-face 'gnus-summary-selected
982 "Face used for highlighting the current article in the summary buffer."
983 :group 'gnus-summary-visual
986 (defvar gnus-tmp-downloaded nil)
988 (defcustom gnus-summary-highlight
989 '(((eq mark gnus-canceled-mark)
990 . gnus-summary-cancelled)
991 ((and uncached (> score default-high))
992 . gnus-summary-high-undownloaded)
993 ((and uncached (< score default-low))
994 . gnus-summary-low-undownloaded)
996 . gnus-summary-normal-undownloaded)
997 ((and (> score default-high)
998 (or (eq mark gnus-dormant-mark)
999 (eq mark gnus-ticked-mark)))
1000 . gnus-summary-high-ticked)
1001 ((and (< score default-low)
1002 (or (eq mark gnus-dormant-mark)
1003 (eq mark gnus-ticked-mark)))
1004 . gnus-summary-low-ticked)
1005 ((or (eq mark gnus-dormant-mark)
1006 (eq mark gnus-ticked-mark))
1007 . gnus-summary-normal-ticked)
1008 ((and (> score default-high) (eq mark gnus-ancient-mark))
1009 . gnus-summary-high-ancient)
1010 ((and (< score default-low) (eq mark gnus-ancient-mark))
1011 . gnus-summary-low-ancient)
1012 ((eq mark gnus-ancient-mark)
1013 . gnus-summary-normal-ancient)
1014 ((and (> score default-high) (eq mark gnus-unread-mark))
1015 . gnus-summary-high-unread)
1016 ((and (< score default-low) (eq mark gnus-unread-mark))
1017 . gnus-summary-low-unread)
1018 ((eq mark gnus-unread-mark)
1019 . gnus-summary-normal-unread)
1020 ((> score default-high)
1021 . gnus-summary-high-read)
1022 ((< score default-low)
1023 . gnus-summary-low-read)
1025 . gnus-summary-normal-read))
1026 "*Controls the highlighting of summary buffer lines.
1028 A list of (FORM . FACE) pairs. When deciding how a a particular
1029 summary line should be displayed, each form is evaluated. The content
1030 of the face field after the first true form is used. You can change
1031 how those summary lines are displayed, by editing the face field.
1033 You can use the following variables in the FORM field.
1035 score: The article's score
1036 default: The default article score.
1037 default-high: The default score for high scored articles.
1038 default-low: The default score for low scored articles.
1039 below: The score below which articles are automatically marked as read.
1040 mark: The article's mark.
1041 uncached: Non-nil if the article is uncached."
1042 :group 'gnus-summary-visual
1043 :type '(repeat (cons (sexp :tag "Form" nil)
1046 (defcustom gnus-alter-header-function nil
1047 "Function called to allow alteration of article header structures.
1048 The function is called with one parameter, the article header vector,
1049 which it may alter in any way."
1050 :type '(choice (const :tag "None" nil)
1052 :group 'gnus-summary)
1054 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1055 "Function used to decode a string with encoded words.")
1057 (defvar gnus-decode-encoded-address-function
1058 'mail-decode-encoded-address-string
1059 "Function used to decode addresses with encoded words.")
1061 (defcustom gnus-extra-headers '(To Newsgroups)
1062 "*Extra headers to parse."
1064 :group 'gnus-summary
1065 :type '(repeat symbol))
1067 (defcustom gnus-ignored-from-addresses
1068 (and user-mail-address
1069 (not (string= user-mail-address ""))
1070 (regexp-quote user-mail-address))
1071 "*Regexp of From headers that may be suppressed in favor of To headers."
1073 :group 'gnus-summary
1076 (defcustom gnus-summary-to-prefix "-> "
1077 "*String prefixed to the To field in the summary line when
1078 using `gnus-ignored-from-addresses'."
1080 :group 'gnus-summary
1083 (defcustom gnus-summary-newsgroup-prefix "=> "
1084 "*String prefixed to the Newsgroup field in the summary
1085 line when using `gnus-ignored-from-addresses'."
1087 :group 'gnus-summary
1090 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1091 "List of charsets that should be ignored.
1092 When these charsets are used in the \"charset\" parameter, the
1093 default charset will be used instead."
1095 :type '(repeat symbol)
1096 :group 'gnus-charset)
1098 (gnus-define-group-parameter
1102 "Return the ignored charsets of GROUP."
1103 :variable gnus-group-ignored-charsets-alist
1105 '(("alt\\.chinese\\.text" iso-8859-1))
1107 "Alist of regexps (to match group names) and charsets that should be ignored.
1108 When these charsets are used in the \"charset\" parameter, the
1109 default charset will be used instead."
1110 :variable-group gnus-charset
1111 :variable-type '(repeat (cons (regexp :tag "Group")
1113 :parameter-type '(choice :tag "Ignored charsets"
1116 :parameter-document "\
1117 List of charsets that should be ignored.
1119 When these charsets are used in the \"charset\" parameter, the
1120 default charset will be used instead.")
1122 (defcustom gnus-group-highlight-words-alist nil
1123 "Alist of group regexps and highlight regexps.
1124 This variable uses the same syntax as `gnus-emphasis-alist'."
1126 :type '(repeat (cons (regexp :tag "Group")
1127 (repeat (list (regexp :tag "Highlight regexp")
1128 (number :tag "Group for entire word" 0)
1129 (number :tag "Group for displayed part" 0)
1131 gnus-emphasis-highlight-words)))))
1132 :group 'gnus-summary-visual)
1134 (defcustom gnus-summary-show-article-charset-alist
1136 "Alist of number and charset.
1137 The article will be shown with the charset corresponding to the
1139 For example: ((1 . cn-gb-2312) (2 . big5))."
1141 :type '(repeat (cons (number :tag "Argument" 1)
1142 (symbol :tag "Charset")))
1143 :group 'gnus-charset)
1145 (defcustom gnus-preserve-marks t
1146 "Whether marks are preserved when moving, copying and respooling messages."
1149 :group 'gnus-summary-marks)
1151 (defcustom gnus-alter-articles-to-read-function nil
1152 "Function to be called to alter the list of articles to be selected."
1153 :type '(choice (const nil) function)
1154 :group 'gnus-summary)
1156 (defcustom gnus-orphan-score nil
1157 "*All orphans get this score added. Set in the score file."
1158 :group 'gnus-score-default
1159 :type '(choice (const nil)
1162 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1163 "*A regexp to match MIME parts when saving multiple parts of a
1164 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1165 This regexp will be used by default when prompting the user for which
1166 type of files to save."
1167 :group 'gnus-summary
1170 (defcustom gnus-read-all-available-headers nil
1171 "Whether Gnus should parse all headers made available to it.
1172 This is mostly relevant for slow back ends where the user may
1173 wish to widen the summary buffer to include all headers
1174 that were fetched. Say, for nnultimate groups."
1176 :group 'gnus-summary
1177 :type '(choice boolean regexp))
1179 (defcustom gnus-summary-muttprint-program "muttprint"
1180 "Command (and optional arguments) used to run Muttprint."
1182 :group 'gnus-summary
1185 (defcustom gnus-article-loose-mime t
1186 "If non-nil, don't require MIME-Version header.
1187 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1188 supply the MIME-Version header or deliberately strip it from the mail.
1189 If non-nil (the default), Gnus will treat some articles as MIME
1190 even if the MIME-Version header is missing."
1193 :group 'gnus-article-mime)
1195 (defcustom gnus-article-emulate-mime t
1196 "If non-nil, use MIME emulation for uuencode and the like.
1197 This means that Gnus will search message bodies for text that look
1198 like uuencoded bits, yEncoded bits, and so on, and present that using
1199 the normal Gnus MIME machinery."
1202 :group 'gnus-article-mime)
1204 ;;; Internal variables
1206 (defvar gnus-summary-display-cache nil)
1207 (defvar gnus-article-mime-handles nil)
1208 (defvar gnus-article-decoded-p nil)
1209 (defvar gnus-article-charset nil)
1210 (defvar gnus-article-ignored-charsets nil)
1211 (defvar gnus-scores-exclude-files nil)
1212 (defvar gnus-page-broken nil)
1214 (defvar gnus-original-article nil)
1215 (defvar gnus-article-internal-prepare-hook nil)
1216 (defvar gnus-newsgroup-process-stack nil)
1218 (defvar gnus-thread-indent-array nil)
1219 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1220 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1221 "Function called to sort the articles within a thread after it has been gathered together.")
1223 (defvar gnus-summary-save-parts-type-history nil)
1224 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1226 ;; Avoid highlighting in kill files.
1227 (defvar gnus-summary-inhibit-highlight nil)
1228 (defvar gnus-newsgroup-selected-overlay nil)
1229 (defvar gnus-inhibit-limiting nil)
1230 (defvar gnus-newsgroup-adaptive-score-file nil)
1231 (defvar gnus-current-score-file nil)
1232 (defvar gnus-current-move-group nil)
1233 (defvar gnus-current-copy-group nil)
1234 (defvar gnus-current-crosspost-group nil)
1235 (defvar gnus-newsgroup-display nil)
1237 (defvar gnus-newsgroup-dependencies nil)
1238 (defvar gnus-newsgroup-adaptive nil)
1239 (defvar gnus-summary-display-article-function nil)
1240 (defvar gnus-summary-highlight-line-function nil
1241 "Function called after highlighting a summary line.")
1243 (defvar gnus-summary-line-format-alist
1244 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1245 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1246 (?s gnus-tmp-subject-or-nil ?s)
1247 (?n gnus-tmp-name ?s)
1248 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1250 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1252 (?F gnus-tmp-from ?s)
1253 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1254 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1255 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1256 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1257 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1258 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1259 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1260 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1261 (?L gnus-tmp-lines ?s)
1262 (?O gnus-tmp-downloaded ?c)
1263 (?I gnus-tmp-indentation ?s)
1264 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1265 (?R gnus-tmp-replied ?c)
1266 (?\[ gnus-tmp-opening-bracket ?c)
1267 (?\] gnus-tmp-closing-bracket ?c)
1268 (?\> (make-string gnus-tmp-level ? ) ?s)
1269 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1270 (?i gnus-tmp-score ?d)
1271 (?z gnus-tmp-score-char ?c)
1272 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1273 (?U gnus-tmp-unread ?c)
1274 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1276 (?t (gnus-summary-number-of-articles-in-thread
1277 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1279 (?e (gnus-summary-number-of-articles-in-thread
1280 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1282 (?u gnus-tmp-user-defined ?s)
1283 (?P (gnus-pick-line-number) ?d)
1284 (?B gnus-tmp-thread-tree-header-string ?s)
1285 (user-date (gnus-user-date
1286 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1287 "An alist of format specifications that can appear in summary lines.
1288 These are paired with what variables they correspond with, along with
1289 the type of the variable (string, integer, character, etc).")
1291 (defvar gnus-summary-dummy-line-format-alist
1292 `((?S gnus-tmp-subject ?s)
1293 (?N gnus-tmp-number ?d)
1294 (?u gnus-tmp-user-defined ?s)))
1296 (defvar gnus-summary-mode-line-format-alist
1297 `((?G gnus-tmp-group-name ?s)
1298 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1299 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1300 (?A gnus-tmp-article-number ?d)
1301 (?Z gnus-tmp-unread-and-unselected ?s)
1302 (?V gnus-version ?s)
1303 (?U gnus-tmp-unread-and-unticked ?d)
1304 (?S gnus-tmp-subject ?s)
1305 (?e gnus-tmp-unselected ?d)
1306 (?u gnus-tmp-user-defined ?s)
1307 (?d (length gnus-newsgroup-dormant) ?d)
1308 (?t (length gnus-newsgroup-marked) ?d)
1309 (?h (length gnus-newsgroup-spam-marked) ?d)
1310 (?r (length gnus-newsgroup-reads) ?d)
1311 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1312 (?E gnus-newsgroup-expunged-tally ?d)
1313 (?s (gnus-current-score-file-nondirectory) ?s)))
1315 (defvar gnus-last-search-regexp nil
1316 "Default regexp for article search command.")
1318 (defvar gnus-last-shell-command nil
1319 "Default shell command on article.")
1321 (defvar gnus-newsgroup-agentized nil
1322 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1323 (defvar gnus-newsgroup-begin nil)
1324 (defvar gnus-newsgroup-end nil)
1325 (defvar gnus-newsgroup-last-rmail nil)
1326 (defvar gnus-newsgroup-last-mail nil)
1327 (defvar gnus-newsgroup-last-folder nil)
1328 (defvar gnus-newsgroup-last-file nil)
1329 (defvar gnus-newsgroup-last-directory nil)
1330 (defvar gnus-newsgroup-auto-expire nil)
1331 (defvar gnus-newsgroup-active nil)
1333 (defvar gnus-newsgroup-data nil)
1334 (defvar gnus-newsgroup-data-reverse nil)
1335 (defvar gnus-newsgroup-limit nil)
1336 (defvar gnus-newsgroup-limits nil)
1337 (defvar gnus-summary-use-undownloaded-faces nil)
1339 (defvar gnus-newsgroup-unreads nil
1340 "Sorted list of unread articles in the current newsgroup.")
1342 (defvar gnus-newsgroup-unselected nil
1343 "Sorted list of unselected unread articles in the current newsgroup.")
1345 (defvar gnus-newsgroup-reads nil
1346 "Alist of read articles and article marks in the current newsgroup.")
1348 (defvar gnus-newsgroup-expunged-tally nil)
1350 (defvar gnus-newsgroup-marked nil
1351 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1353 (defvar gnus-newsgroup-spam-marked nil
1354 "List of ranges of articles that have been marked as spam.")
1356 (defvar gnus-newsgroup-killed nil
1357 "List of ranges of articles that have been through the scoring process.")
1359 (defvar gnus-newsgroup-cached nil
1360 "Sorted list of articles that come from the article cache.")
1362 (defvar gnus-newsgroup-saved nil
1363 "List of articles that have been saved.")
1365 (defvar gnus-newsgroup-kill-headers nil)
1367 (defvar gnus-newsgroup-replied nil
1368 "List of articles that have been replied to in the current newsgroup.")
1370 (defvar gnus-newsgroup-forwarded nil
1371 "List of articles that have been forwarded in the current newsgroup.")
1373 (defvar gnus-newsgroup-recent nil
1374 "List of articles that have are recent in the current newsgroup.")
1376 (defvar gnus-newsgroup-expirable nil
1377 "Sorted list of articles in the current newsgroup that can be expired.")
1379 (defvar gnus-newsgroup-processable nil
1380 "List of articles in the current newsgroup that can be processed.")
1382 (defvar gnus-newsgroup-downloadable nil
1383 "Sorted list of articles in the current newsgroup that can be processed.")
1385 (defvar gnus-newsgroup-unfetched nil
1386 "Sorted list of articles in the current newsgroup whose headers have
1387 not been fetched into the agent.
1389 This list will always be a subset of gnus-newsgroup-undownloaded.")
1391 (defvar gnus-newsgroup-undownloaded nil
1392 "List of articles in the current newsgroup that haven't been downloaded.")
1394 (defvar gnus-newsgroup-unsendable nil
1395 "List of articles in the current newsgroup that won't be sent.")
1397 (defvar gnus-newsgroup-bookmarks nil
1398 "List of articles in the current newsgroup that have bookmarks.")
1400 (defvar gnus-newsgroup-dormant nil
1401 "Sorted list of dormant articles in the current newsgroup.")
1403 (defvar gnus-newsgroup-unseen nil
1404 "List of unseen articles in the current newsgroup.")
1406 (defvar gnus-newsgroup-seen nil
1407 "Range of seen articles in the current newsgroup.")
1409 (defvar gnus-newsgroup-articles nil
1410 "List of articles in the current newsgroup.")
1412 (defvar gnus-newsgroup-scored nil
1413 "List of scored articles in the current newsgroup.")
1415 (defvar gnus-newsgroup-headers nil
1416 "List of article headers in the current newsgroup.")
1418 (defvar gnus-newsgroup-threads nil)
1420 (defvar gnus-newsgroup-prepared nil
1421 "Whether the current group has been prepared properly.")
1423 (defvar gnus-newsgroup-ancient nil
1424 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1426 (defvar gnus-newsgroup-sparse nil)
1428 (defvar gnus-current-article nil)
1429 (defvar gnus-article-current nil)
1430 (defvar gnus-current-headers nil)
1431 (defvar gnus-have-all-headers nil)
1432 (defvar gnus-last-article nil)
1433 (defvar gnus-newsgroup-history nil)
1434 (defvar gnus-newsgroup-charset nil)
1435 (defvar gnus-newsgroup-ephemeral-charset nil)
1436 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1438 (defvar gnus-article-before-search nil)
1440 (defvar gnus-summary-local-variables
1441 '(gnus-newsgroup-name
1442 gnus-newsgroup-begin gnus-newsgroup-end
1443 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1444 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1445 gnus-newsgroup-last-directory
1446 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1447 gnus-newsgroup-unselected gnus-newsgroup-marked
1448 gnus-newsgroup-spam-marked
1449 gnus-newsgroup-reads gnus-newsgroup-saved
1450 gnus-newsgroup-replied gnus-newsgroup-forwarded
1451 gnus-newsgroup-recent
1452 gnus-newsgroup-expirable
1453 gnus-newsgroup-processable gnus-newsgroup-killed
1454 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1455 gnus-newsgroup-unfetched
1456 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1457 gnus-newsgroup-seen gnus-newsgroup-articles
1458 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1459 gnus-newsgroup-headers gnus-newsgroup-threads
1460 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1461 gnus-current-article gnus-current-headers gnus-have-all-headers
1462 gnus-last-article gnus-article-internal-prepare-hook
1463 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1464 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1465 gnus-thread-expunge-below
1466 gnus-score-alist gnus-current-score-file
1467 (gnus-summary-expunge-below . global)
1468 (gnus-summary-mark-below . global)
1469 (gnus-orphan-score . global)
1470 gnus-newsgroup-active gnus-scores-exclude-files
1471 gnus-newsgroup-history gnus-newsgroup-ancient
1472 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1473 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1474 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1475 (gnus-newsgroup-expunged-tally . 0)
1476 gnus-cache-removable-articles gnus-newsgroup-cached
1477 gnus-newsgroup-data gnus-newsgroup-data-reverse
1478 gnus-newsgroup-limit gnus-newsgroup-limits
1479 gnus-newsgroup-charset gnus-newsgroup-display
1480 gnus-summary-use-undownloaded-faces)
1481 "Variables that are buffer-local to the summary buffers.")
1483 (defvar gnus-newsgroup-variables nil
1484 "A list of variables that have separate values in different newsgroups.
1485 A list of newsgroup (summary buffer) local variables, or cons of
1486 variables and their default expressions to be evalled (when the default
1487 values are not nil), that should be made global while the summary buffer
1490 Note: The default expressions will be evaluated (using function `eval')
1491 before assignment to the local variable rather than just assigned to it.
1492 If the default expression is the symbol `global', that symbol will not
1493 be evaluated but the global value of the local variable will be used
1496 These variables can be used to set variables in the group parameters
1497 while still allowing them to affect operations done in other buffers.
1500 \(setq gnus-newsgroup-variables
1501 '(message-use-followup-to
1502 (gnus-visible-headers .
1503 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1506 ;; Byte-compiler warning.
1508 ;; Bind features so that require will believe that gnus-sum has
1509 ;; already been loaded (avoids infinite recursion)
1510 (let ((features (cons 'gnus-sum features)))
1511 ;; Several of the declarations in gnus-sum are needed to load the
1512 ;; following files. Right now, these definitions have been
1513 ;; compiled but not defined (evaluated). We could either do a
1514 ;; eval-and-compile about all of the declarations or evaluate the
1516 (if (boundp 'gnus-newsgroup-variables)
1518 (load "gnus-sum.el" t t t))
1520 (require 'gnus-art)))
1524 (defvar gnus-decode-encoded-word-methods
1525 '(mail-decode-encoded-word-string)
1526 "List of methods used to decode encoded words.
1528 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1529 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1530 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1531 whose names match REGEXP.
1534 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1535 mail-decode-encoded-word-string
1536 (\"chinese\" . rfc1843-decode-string))")
1538 (defvar gnus-decode-encoded-word-methods-cache nil)
1540 (defun gnus-multi-decode-encoded-word-string (string)
1541 "Apply the functions from `gnus-encoded-word-methods' that match."
1542 (unless (and gnus-decode-encoded-word-methods-cache
1543 (eq gnus-newsgroup-name
1544 (car gnus-decode-encoded-word-methods-cache)))
1545 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1548 (nconc gnus-decode-encoded-word-methods-cache (list x))
1549 (if (and gnus-newsgroup-name
1550 (string-match (car x) gnus-newsgroup-name))
1551 (nconc gnus-decode-encoded-word-methods-cache
1553 gnus-decode-encoded-word-methods))
1554 (let ((xlist gnus-decode-encoded-word-methods-cache))
1557 (setq string (funcall (pop xlist) string))))
1560 ;; Subject simplification.
1562 (defun gnus-simplify-whitespace (str)
1563 "Remove excessive whitespace from STR."
1565 (while (string-match "[ \t][ \t]+" str)
1566 (setq str (concat (substring str 0 (match-beginning 0))
1568 (substring str (match-end 0)))))
1570 (when (string-match "^[ \t]+" str)
1571 (setq str (substring str (match-end 0))))
1573 (when (string-match "[ \t]+$" str)
1574 (setq str (substring str 0 (match-beginning 0))))
1577 (defun gnus-simplify-all-whitespace (str)
1578 "Remove all whitespace from STR."
1579 (while (string-match "[ \t\n]+" str)
1580 (setq str (replace-match "" nil nil str)))
1583 (defsubst gnus-simplify-subject-re (subject)
1584 "Remove \"Re:\" from subject lines."
1585 (if (string-match message-subject-re-regexp subject)
1586 (substring subject (match-end 0))
1589 (defun gnus-simplify-subject (subject &optional re-only)
1590 "Remove `Re:' and words in parentheses.
1591 If RE-ONLY is non-nil, strip leading `Re:'s only."
1592 (let ((case-fold-search t)) ;Ignore case.
1593 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1594 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1595 (setq subject (substring subject (match-end 0))))
1596 ;; Remove uninteresting prefixes.
1597 (when (and (not re-only)
1598 gnus-simplify-ignored-prefixes
1599 (string-match gnus-simplify-ignored-prefixes subject))
1600 (setq subject (substring subject (match-end 0))))
1601 ;; Remove words in parentheses from end.
1603 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1604 (setq subject (substring subject 0 (match-beginning 0)))))
1605 ;; Return subject string.
1608 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1610 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1611 (goto-char (point-min))
1612 (while (re-search-forward regexp nil t)
1613 (replace-match (or newtext ""))))
1615 (defun gnus-simplify-buffer-fuzzy ()
1616 "Simplify string in the buffer fuzzily.
1617 The string in the accessible portion of the current buffer is simplified.
1618 It is assumed to be a single-line subject.
1619 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1620 matter is removed. Additional things can be deleted by setting
1621 `gnus-simplify-subject-fuzzy-regexp'."
1622 (let ((case-fold-search t)
1624 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1626 (while (not (eq modified-tick (buffer-modified-tick)))
1627 (setq modified-tick (buffer-modified-tick))
1629 ((listp gnus-simplify-subject-fuzzy-regexp)
1630 (mapcar 'gnus-simplify-buffer-fuzzy-step
1631 gnus-simplify-subject-fuzzy-regexp))
1632 (gnus-simplify-subject-fuzzy-regexp
1633 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1634 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1635 (gnus-simplify-buffer-fuzzy-step
1636 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1637 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1639 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1640 (gnus-simplify-buffer-fuzzy-step " +" " ")
1641 (gnus-simplify-buffer-fuzzy-step " $")
1642 (gnus-simplify-buffer-fuzzy-step "^ +")))
1644 (defun gnus-simplify-subject-fuzzy (subject)
1645 "Simplify a subject string fuzzily.
1646 See `gnus-simplify-buffer-fuzzy' for details."
1648 (gnus-set-work-buffer)
1649 (let ((case-fold-search t))
1650 ;; Remove uninteresting prefixes.
1651 (when (and gnus-simplify-ignored-prefixes
1652 (string-match gnus-simplify-ignored-prefixes subject))
1653 (setq subject (substring subject (match-end 0))))
1655 (inline (gnus-simplify-buffer-fuzzy))
1658 (defsubst gnus-simplify-subject-fully (subject)
1659 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1661 (gnus-simplify-subject-functions
1662 (gnus-map-function gnus-simplify-subject-functions subject))
1663 ((null gnus-summary-gather-subject-limit)
1664 (gnus-simplify-subject-re subject))
1665 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1666 (gnus-simplify-subject-fuzzy subject))
1667 ((numberp gnus-summary-gather-subject-limit)
1668 (gnus-limit-string (gnus-simplify-subject-re subject)
1669 gnus-summary-gather-subject-limit))
1673 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1674 "Check whether two subjects are equal.
1675 If optional argument SIMPLE-FIRST is t, first argument is already
1678 ((null simple-first)
1679 (equal (gnus-simplify-subject-fully s1)
1680 (gnus-simplify-subject-fully s2)))
1683 (gnus-simplify-subject-fully s2)))))
1685 (defun gnus-summary-bubble-group ()
1686 "Increase the score of the current group.
1687 This is a handy function to add to `gnus-summary-exit-hook' to
1688 increase the score of each group you read."
1689 (gnus-group-add-score gnus-newsgroup-name))
1693 ;;; Gnus summary mode
1696 (put 'gnus-summary-mode 'mode-class 'special)
1698 (defvar gnus-article-commands-menu)
1700 ;; Non-orthogonal keys
1702 (gnus-define-keys gnus-summary-mode-map
1703 " " gnus-summary-next-page
1704 "\177" gnus-summary-prev-page
1705 [delete] gnus-summary-prev-page
1706 [backspace] gnus-summary-prev-page
1707 "\r" gnus-summary-scroll-up
1708 "\M-\r" gnus-summary-scroll-down
1709 "n" gnus-summary-next-unread-article
1710 "p" gnus-summary-prev-unread-article
1711 "N" gnus-summary-next-article
1712 "P" gnus-summary-prev-article
1713 "\M-\C-n" gnus-summary-next-same-subject
1714 "\M-\C-p" gnus-summary-prev-same-subject
1715 "\M-n" gnus-summary-next-unread-subject
1716 "\M-p" gnus-summary-prev-unread-subject
1717 "." gnus-summary-first-unread-article
1718 "," gnus-summary-best-unread-article
1719 "\M-s" gnus-summary-search-article-forward
1720 "\M-r" gnus-summary-search-article-backward
1721 "\M-S" gnus-summary-repeat-search-article-forward
1722 "\M-R" gnus-summary-repeat-search-article-backward
1723 "<" gnus-summary-beginning-of-article
1724 ">" gnus-summary-end-of-article
1725 "j" gnus-summary-goto-article
1726 "^" gnus-summary-refer-parent-article
1727 "\M-^" gnus-summary-refer-article
1728 "u" gnus-summary-tick-article-forward
1729 "!" gnus-summary-tick-article-forward
1730 "U" gnus-summary-tick-article-backward
1731 "d" gnus-summary-mark-as-read-forward
1732 "D" gnus-summary-mark-as-read-backward
1733 "E" gnus-summary-mark-as-expirable
1734 "\M-u" gnus-summary-clear-mark-forward
1735 "\M-U" gnus-summary-clear-mark-backward
1736 "k" gnus-summary-kill-same-subject-and-select
1737 "\C-k" gnus-summary-kill-same-subject
1738 "\M-\C-k" gnus-summary-kill-thread
1739 "\M-\C-l" gnus-summary-lower-thread
1740 "e" gnus-summary-edit-article
1741 "#" gnus-summary-mark-as-processable
1742 "\M-#" gnus-summary-unmark-as-processable
1743 "\M-\C-t" gnus-summary-toggle-threads
1744 "\M-\C-s" gnus-summary-show-thread
1745 "\M-\C-h" gnus-summary-hide-thread
1746 "\M-\C-f" gnus-summary-next-thread
1747 "\M-\C-b" gnus-summary-prev-thread
1748 [(meta down)] gnus-summary-next-thread
1749 [(meta up)] gnus-summary-prev-thread
1750 "\M-\C-u" gnus-summary-up-thread
1751 "\M-\C-d" gnus-summary-down-thread
1752 "&" gnus-summary-execute-command
1753 "c" gnus-summary-catchup-and-exit
1754 "\C-w" gnus-summary-mark-region-as-read
1755 "\C-t" gnus-summary-toggle-truncation
1756 "?" gnus-summary-mark-as-dormant
1757 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1758 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1759 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1760 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1761 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1762 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1763 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1764 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1765 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1766 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1767 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1768 "=" gnus-summary-expand-window
1769 "\C-x\C-s" gnus-summary-reselect-current-group
1770 "\M-g" gnus-summary-rescan-group
1771 "w" gnus-summary-stop-page-breaking
1772 "\C-c\C-r" gnus-summary-caesar-message
1773 "f" gnus-summary-followup
1774 "F" gnus-summary-followup-with-original
1775 "C" gnus-summary-cancel-article
1776 "r" gnus-summary-reply
1777 "R" gnus-summary-reply-with-original
1778 "\C-c\C-f" gnus-summary-mail-forward
1779 "o" gnus-summary-save-article
1780 "\C-o" gnus-summary-save-article-mail
1781 "|" gnus-summary-pipe-output
1782 "\M-k" gnus-summary-edit-local-kill
1783 "\M-K" gnus-summary-edit-global-kill
1785 "\C-c\C-d" gnus-summary-describe-group
1786 "q" gnus-summary-exit
1787 "Q" gnus-summary-exit-no-update
1788 "\C-c\C-i" gnus-info-find-node
1789 gnus-mouse-2 gnus-mouse-pick-article
1790 [follow-link] mouse-face
1791 "m" gnus-summary-mail-other-window
1792 "a" gnus-summary-post-news
1793 "i" gnus-summary-news-other-window
1794 "x" gnus-summary-limit-to-unread
1795 "s" gnus-summary-isearch-article
1796 "t" gnus-summary-toggle-header
1797 "g" gnus-summary-show-article
1798 "l" gnus-summary-goto-last-article
1799 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1800 "\C-d" gnus-summary-enter-digest-group
1801 "\M-\C-d" gnus-summary-read-document
1802 "\M-\C-e" gnus-summary-edit-parameters
1803 "\M-\C-a" gnus-summary-customize-parameters
1805 "*" gnus-cache-enter-article
1806 "\M-*" gnus-cache-remove-article
1807 "\M-&" gnus-summary-universal-argument
1808 "\C-l" gnus-recenter
1809 "I" gnus-summary-increase-score
1810 "L" gnus-summary-lower-score
1811 "\M-i" gnus-symbolic-argument
1812 "h" gnus-summary-select-article-buffer
1814 "b" gnus-article-view-part
1815 "\M-t" gnus-summary-toggle-display-buttonized
1817 "V" gnus-summary-score-map
1818 "X" gnus-uu-extract-map
1819 "S" gnus-summary-send-map)
1821 ;; Sort of orthogonal keymap
1822 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1823 "t" gnus-summary-tick-article-forward
1824 "!" gnus-summary-tick-article-forward
1825 "d" gnus-summary-mark-as-read-forward
1826 "r" gnus-summary-mark-as-read-forward
1827 "c" gnus-summary-clear-mark-forward
1828 " " gnus-summary-clear-mark-forward
1829 "e" gnus-summary-mark-as-expirable
1830 "x" gnus-summary-mark-as-expirable
1831 "?" gnus-summary-mark-as-dormant
1832 "b" gnus-summary-set-bookmark
1833 "B" gnus-summary-remove-bookmark
1834 "#" gnus-summary-mark-as-processable
1835 "\M-#" gnus-summary-unmark-as-processable
1836 "S" gnus-summary-limit-include-expunged
1837 "C" gnus-summary-catchup
1838 "H" gnus-summary-catchup-to-here
1839 "h" gnus-summary-catchup-from-here
1840 "\C-c" gnus-summary-catchup-all
1841 "k" gnus-summary-kill-same-subject-and-select
1842 "K" gnus-summary-kill-same-subject
1843 "P" gnus-uu-mark-map)
1845 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1846 "c" gnus-summary-clear-above
1847 "u" gnus-summary-tick-above
1848 "m" gnus-summary-mark-above
1849 "k" gnus-summary-kill-below)
1851 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1852 "/" gnus-summary-limit-to-subject
1853 "n" gnus-summary-limit-to-articles
1854 "b" gnus-summary-limit-to-bodies
1855 "h" gnus-summary-limit-to-headers
1856 "w" gnus-summary-pop-limit
1857 "s" gnus-summary-limit-to-subject
1858 "a" gnus-summary-limit-to-author
1859 "u" gnus-summary-limit-to-unread
1860 "m" gnus-summary-limit-to-marks
1861 "M" gnus-summary-limit-exclude-marks
1862 "v" gnus-summary-limit-to-score
1863 "*" gnus-summary-limit-include-cached
1864 "D" gnus-summary-limit-include-dormant
1865 "T" gnus-summary-limit-include-thread
1866 "d" gnus-summary-limit-exclude-dormant
1867 "t" gnus-summary-limit-to-age
1868 "." gnus-summary-limit-to-unseen
1869 "x" gnus-summary-limit-to-extra
1870 "p" gnus-summary-limit-to-display-predicate
1871 "E" gnus-summary-limit-include-expunged
1872 "c" gnus-summary-limit-exclude-childless-dormant
1873 "C" gnus-summary-limit-mark-excluded-as-read
1874 "o" gnus-summary-insert-old-articles
1875 "N" gnus-summary-insert-new-articles
1876 "S" gnus-summary-limit-to-singletons
1877 "r" gnus-summary-limit-to-replied
1878 "R" gnus-summary-limit-to-recipient)
1880 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1881 "n" gnus-summary-next-unread-article
1882 "p" gnus-summary-prev-unread-article
1883 "N" gnus-summary-next-article
1884 "P" gnus-summary-prev-article
1885 "\C-n" gnus-summary-next-same-subject
1886 "\C-p" gnus-summary-prev-same-subject
1887 "\M-n" gnus-summary-next-unread-subject
1888 "\M-p" gnus-summary-prev-unread-subject
1889 "f" gnus-summary-first-unread-article
1890 "b" gnus-summary-best-unread-article
1891 "j" gnus-summary-goto-article
1892 "g" gnus-summary-goto-subject
1893 "l" gnus-summary-goto-last-article
1894 "o" gnus-summary-pop-article)
1896 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1897 "k" gnus-summary-kill-thread
1898 "l" gnus-summary-lower-thread
1899 "i" gnus-summary-raise-thread
1900 "T" gnus-summary-toggle-threads
1901 "t" gnus-summary-rethread-current
1902 "^" gnus-summary-reparent-thread
1903 "\M-^" gnus-summary-reparent-children
1904 "s" gnus-summary-show-thread
1905 "S" gnus-summary-show-all-threads
1906 "h" gnus-summary-hide-thread
1907 "H" gnus-summary-hide-all-threads
1908 "n" gnus-summary-next-thread
1909 "p" gnus-summary-prev-thread
1910 "u" gnus-summary-up-thread
1911 "o" gnus-summary-top-thread
1912 "d" gnus-summary-down-thread
1913 "#" gnus-uu-mark-thread
1914 "\M-#" gnus-uu-unmark-thread)
1916 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1917 "g" gnus-summary-prepare
1918 "c" gnus-summary-insert-cached-articles
1919 "d" gnus-summary-insert-dormant-articles
1920 "t" gnus-summary-insert-ticked-articles)
1922 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1923 "c" gnus-summary-catchup-and-exit
1924 "C" gnus-summary-catchup-all-and-exit
1925 "E" gnus-summary-exit-no-update
1926 "Q" gnus-summary-exit
1927 "Z" gnus-summary-exit
1928 "n" gnus-summary-catchup-and-goto-next-group
1929 "p" gnus-summary-catchup-and-goto-prev-group
1930 "R" gnus-summary-reselect-current-group
1931 "G" gnus-summary-rescan-group
1932 "N" gnus-summary-next-group
1933 "s" gnus-summary-save-newsrc
1934 "P" gnus-summary-prev-group)
1936 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1937 " " gnus-summary-next-page
1938 "n" gnus-summary-next-page
1939 "\177" gnus-summary-prev-page
1940 [delete] gnus-summary-prev-page
1941 "p" gnus-summary-prev-page
1942 "\r" gnus-summary-scroll-up
1943 "\M-\r" gnus-summary-scroll-down
1944 "<" gnus-summary-beginning-of-article
1945 ">" gnus-summary-end-of-article
1946 "b" gnus-summary-beginning-of-article
1947 "e" gnus-summary-end-of-article
1948 "^" gnus-summary-refer-parent-article
1949 "r" gnus-summary-refer-parent-article
1950 "D" gnus-summary-enter-digest-group
1951 "R" gnus-summary-refer-references
1952 "T" gnus-summary-refer-thread
1953 "g" gnus-summary-show-article
1954 "s" gnus-summary-isearch-article
1955 "P" gnus-summary-print-article
1956 "M" gnus-mailing-list-insinuate
1957 "t" gnus-article-babel)
1959 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1960 "b" gnus-article-add-buttons
1961 "B" gnus-article-add-buttons-to-head
1962 "o" gnus-article-treat-overstrike
1963 "e" gnus-article-emphasize
1964 "w" gnus-article-fill-cited-article
1965 "Q" gnus-article-fill-long-lines
1966 "L" gnus-article-toggle-truncate-lines
1967 "C" gnus-article-capitalize-sentences
1968 "c" gnus-article-remove-cr
1969 "q" gnus-article-de-quoted-unreadable
1970 "6" gnus-article-de-base64-unreadable
1971 "Z" gnus-article-decode-HZ
1972 "A" gnus-article-treat-ansi-sequences
1973 "h" gnus-article-wash-html
1974 "u" gnus-article-unsplit-urls
1975 "s" gnus-summary-force-verify-and-decrypt
1976 "f" gnus-article-display-x-face
1977 "l" gnus-summary-stop-page-breaking
1978 "r" gnus-summary-caesar-message
1979 "m" gnus-summary-morse-message
1980 "t" gnus-summary-toggle-header
1981 "g" gnus-treat-smiley
1982 "v" gnus-summary-verbose-headers
1983 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1984 "p" gnus-article-verify-x-pgp-sig
1985 "d" gnus-article-treat-dumbquotes
1986 "i" gnus-summary-idna-message)
1988 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1989 ;; mnemonic: deuglif*Y*
1990 "u" gnus-article-outlook-unwrap-lines
1991 "a" gnus-article-outlook-repair-attribution
1992 "c" gnus-article-outlook-rearrange-citation
1993 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1995 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1996 "a" gnus-article-hide
1997 "h" gnus-article-hide-headers
1998 "b" gnus-article-hide-boring-headers
1999 "s" gnus-article-hide-signature
2000 "c" gnus-article-hide-citation
2001 "C" gnus-article-hide-citation-in-followups
2002 "l" gnus-article-hide-list-identifiers
2003 "B" gnus-article-strip-banner
2004 "P" gnus-article-hide-pem
2005 "\C-c" gnus-article-hide-citation-maybe)
2007 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2008 "a" gnus-article-highlight
2009 "h" gnus-article-highlight-headers
2010 "c" gnus-article-highlight-citation
2011 "s" gnus-article-highlight-signature)
2013 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2014 "f" gnus-article-treat-fold-headers
2015 "u" gnus-article-treat-unfold-headers
2016 "n" gnus-article-treat-fold-newsgroups)
2018 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2019 "x" gnus-article-display-x-face
2020 "d" gnus-article-display-face
2021 "s" gnus-treat-smiley
2022 "D" gnus-article-remove-images
2023 "f" gnus-treat-from-picon
2024 "m" gnus-treat-mail-picon
2025 "n" gnus-treat-newsgroups-picon)
2027 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2028 "w" gnus-article-decode-mime-words
2029 "c" gnus-article-decode-charset
2030 "v" gnus-mime-view-all-parts
2031 "b" gnus-article-view-part)
2033 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2034 "z" gnus-article-date-ut
2035 "u" gnus-article-date-ut
2036 "l" gnus-article-date-local
2037 "p" gnus-article-date-english
2038 "e" gnus-article-date-lapsed
2039 "o" gnus-article-date-original
2040 "i" gnus-article-date-iso8601
2041 "s" gnus-article-date-user)
2043 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2044 "t" gnus-article-remove-trailing-blank-lines
2045 "l" gnus-article-strip-leading-blank-lines
2046 "m" gnus-article-strip-multiple-blank-lines
2047 "a" gnus-article-strip-blank-lines
2048 "A" gnus-article-strip-all-blank-lines
2049 "s" gnus-article-strip-leading-space
2050 "e" gnus-article-strip-trailing-space
2051 "w" gnus-article-remove-leading-whitespace)
2053 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2055 "f" gnus-summary-fetch-faq
2056 "d" gnus-summary-describe-group
2057 "h" gnus-summary-describe-briefly
2058 "i" gnus-info-find-node
2059 "c" gnus-group-fetch-charter
2060 "C" gnus-group-fetch-control)
2062 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2063 "e" gnus-summary-expire-articles
2064 "\M-\C-e" gnus-summary-expire-articles-now
2065 "\177" gnus-summary-delete-article
2066 [delete] gnus-summary-delete-article
2067 [backspace] gnus-summary-delete-article
2068 "m" gnus-summary-move-article
2069 "r" gnus-summary-respool-article
2070 "w" gnus-summary-edit-article
2071 "c" gnus-summary-copy-article
2072 "B" gnus-summary-crosspost-article
2073 "q" gnus-summary-respool-query
2074 "t" gnus-summary-respool-trace
2075 "i" gnus-summary-import-article
2076 "I" gnus-summary-create-article
2077 "p" gnus-summary-article-posted-p)
2079 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2080 "o" gnus-summary-save-article
2081 "m" gnus-summary-save-article-mail
2082 "F" gnus-summary-write-article-file
2083 "r" gnus-summary-save-article-rmail
2084 "f" gnus-summary-save-article-file
2085 "b" gnus-summary-save-article-body-file
2086 "B" gnus-summary-write-article-body-file
2087 "h" gnus-summary-save-article-folder
2088 "v" gnus-summary-save-article-vm
2089 "p" gnus-summary-pipe-output
2090 "P" gnus-summary-muttprint
2091 "s" gnus-soup-add-article)
2093 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2094 "b" gnus-summary-display-buttonized
2095 "m" gnus-summary-repair-multipart
2096 "v" gnus-article-view-part
2097 "o" gnus-article-save-part
2098 "O" gnus-article-save-part-and-strip
2099 "r" gnus-article-replace-part
2100 "d" gnus-article-delete-part
2101 "t" gnus-article-view-part-as-type
2102 "j" gnus-article-jump-to-part
2103 "c" gnus-article-copy-part
2104 "C" gnus-article-view-part-as-charset
2105 "e" gnus-article-view-part-externally
2106 "H" gnus-article-browse-html-article
2107 "E" gnus-article-encrypt-body
2108 "i" gnus-article-inline-part
2109 "|" gnus-article-pipe-part)
2111 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2112 "p" gnus-summary-mark-as-processable
2113 "u" gnus-summary-unmark-as-processable
2114 "U" gnus-summary-unmark-all-processable
2115 "v" gnus-uu-mark-over
2116 "s" gnus-uu-mark-series
2117 "r" gnus-uu-mark-region
2118 "g" gnus-uu-unmark-region
2119 "R" gnus-uu-mark-by-regexp
2120 "G" gnus-uu-unmark-by-regexp
2121 "t" gnus-uu-mark-thread
2122 "T" gnus-uu-unmark-thread
2123 "a" gnus-uu-mark-all
2124 "b" gnus-uu-mark-buffer
2125 "S" gnus-uu-mark-sparse
2126 "k" gnus-summary-kill-process-mark
2127 "y" gnus-summary-yank-process-mark
2128 "w" gnus-summary-save-process-mark
2129 "i" gnus-uu-invert-processable)
2131 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2132 ;;"x" gnus-uu-extract-any
2133 "m" gnus-summary-save-parts
2134 "u" gnus-uu-decode-uu
2135 "U" gnus-uu-decode-uu-and-save
2136 "s" gnus-uu-decode-unshar
2137 "S" gnus-uu-decode-unshar-and-save
2138 "o" gnus-uu-decode-save
2139 "O" gnus-uu-decode-save
2140 "b" gnus-uu-decode-binhex
2141 "B" gnus-uu-decode-binhex
2142 "p" gnus-uu-decode-postscript
2143 "P" gnus-uu-decode-postscript-and-save)
2146 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2147 "u" gnus-uu-decode-uu-view
2148 "U" gnus-uu-decode-uu-and-save-view
2149 "s" gnus-uu-decode-unshar-view
2150 "S" gnus-uu-decode-unshar-and-save-view
2151 "o" gnus-uu-decode-save-view
2152 "O" gnus-uu-decode-save-view
2153 "b" gnus-uu-decode-binhex-view
2154 "B" gnus-uu-decode-binhex-view
2155 "p" gnus-uu-decode-postscript-view
2156 "P" gnus-uu-decode-postscript-and-save-view)
2158 (defvar gnus-article-post-menu nil)
2160 (defconst gnus-summary-menu-maxlen 20)
2162 (defun gnus-summary-menu-split (menu)
2163 ;; If we have lots of elements, divide them into groups of 20
2164 ;; and make a pane (or submenu) for each one.
2165 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2166 (let ((menu menu) sublists next
2169 ;; Pull off the next gnus-summary-menu-maxlen elements
2170 ;; and make them the next element of sublist.
2171 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2173 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2175 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2176 (aref (car (last menu)) 0)) menu)
2180 (nreverse sublists))
2181 ;; Few elements--put them all in one pane.
2184 (defun gnus-summary-make-menu-bar ()
2185 (gnus-turn-off-edit-menu 'summary)
2187 (unless (boundp 'gnus-summary-misc-menu)
2190 gnus-summary-kill-menu gnus-summary-mode-map ""
2195 ["Customize" gnus-score-customize t])
2196 (gnus-make-score-map 'increase)
2197 (gnus-make-score-map 'lower)
2199 ["Kill below" gnus-summary-kill-below t]
2200 ["Mark above" gnus-summary-mark-above t]
2201 ["Tick above" gnus-summary-tick-above t]
2202 ["Clear above" gnus-summary-clear-above t])
2203 ["Current score" gnus-summary-current-score t]
2204 ["Set score" gnus-summary-set-score t]
2205 ["Switch current score file..." gnus-score-change-score-file t]
2206 ["Set mark below..." gnus-score-set-mark-below t]
2207 ["Set expunge below..." gnus-score-set-expunge-below t]
2208 ["Edit current score file" gnus-score-edit-current-scores t]
2209 ["Edit score file" gnus-score-edit-file t]
2210 ["Trace score" gnus-score-find-trace t]
2211 ["Find words" gnus-score-find-favourite-words t]
2212 ["Rescore buffer" gnus-summary-rescore t]
2213 ["Increase score..." gnus-summary-increase-score t]
2214 ["Lower score..." gnus-summary-lower-score t]))))
2216 ;; Define both the Article menu in the summary buffer and the
2217 ;; equivalent Commands menu in the article buffer here for
2221 ["All" gnus-article-hide t]
2222 ["Headers" gnus-article-hide-headers t]
2223 ["Signature" gnus-article-hide-signature t]
2224 ["Citation" gnus-article-hide-citation t]
2225 ["List identifiers" gnus-article-hide-list-identifiers t]
2226 ["Banner" gnus-article-strip-banner t]
2227 ["Boring headers" gnus-article-hide-boring-headers t])
2229 ["All" gnus-article-highlight t]
2230 ["Headers" gnus-article-highlight-headers t]
2231 ["Signature" gnus-article-highlight-signature t]
2232 ["Citation" gnus-article-highlight-citation t])
2234 ["Words" gnus-article-decode-mime-words t]
2235 ["Charset" gnus-article-decode-charset t]
2236 ["QP" gnus-article-de-quoted-unreadable t]
2237 ["Base64" gnus-article-de-base64-unreadable t]
2238 ["View MIME buttons" gnus-summary-display-buttonized t]
2239 ["View all" gnus-mime-view-all-parts t]
2240 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2241 ["Encrypt body" gnus-article-encrypt-body
2242 :active (not (gnus-group-read-only-p))
2243 ,@(if (featurep 'xemacs) nil
2244 '(:help "Encrypt the message body on disk"))]
2245 ["Extract all parts..." gnus-summary-save-parts t]
2247 ["Repair multipart" gnus-summary-repair-multipart t]
2248 ["Pipe part..." gnus-article-pipe-part t]
2249 ["Inline part" gnus-article-inline-part t]
2250 ["View part as type..." gnus-article-view-part-as-type t]
2251 ["Encrypt body" gnus-article-encrypt-body
2252 :active (not (gnus-group-read-only-p))
2253 ,@(if (featurep 'xemacs) nil
2254 '(:help "Encrypt the message body on disk"))]
2255 ["View part externally" gnus-article-view-part-externally t]
2256 ["View HTML parts in browser" gnus-article-browse-html-article t]
2257 ["View part with charset..." gnus-article-view-part-as-charset t]
2258 ["Copy part" gnus-article-copy-part t]
2259 ["Save part..." gnus-article-save-part t]
2260 ["View part" gnus-article-view-part t]))
2262 ["Local" gnus-article-date-local t]
2263 ["ISO8601" gnus-article-date-iso8601 t]
2264 ["UT" gnus-article-date-ut t]
2265 ["Original" gnus-article-date-original t]
2266 ["Lapsed" gnus-article-date-lapsed t]
2267 ["User-defined" gnus-article-date-user t])
2269 ["Remove images" gnus-article-remove-images t]
2270 ["Toggle smiley" gnus-treat-smiley t]
2271 ["Show X-Face" gnus-article-display-x-face t]
2272 ["Show picons in From" gnus-treat-from-picon t]
2273 ["Show picons in mail headers" gnus-treat-mail-picon t]
2274 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2275 ("View as different encoding"
2276 ,@(gnus-summary-menu-split
2279 ;; Since easymenu under Emacs doesn't allow
2280 ;; lambda forms for menu commands, we should
2281 ;; provide intern'ed function symbols.
2282 (let ((command (intern (format "\
2283 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2287 (let ((gnus-summary-show-article-charset-alist
2289 (gnus-summary-show-article 1))))
2290 `[,(symbol-name cs) ,command t]))
2291 (sort (if (fboundp 'coding-system-list)
2292 (coding-system-list)
2293 (mapcar 'car mm-mime-mule-charset-alist))
2297 ["Leading" gnus-article-strip-leading-blank-lines t]
2298 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2299 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2300 ["All of the above" gnus-article-strip-blank-lines t]
2301 ["All" gnus-article-strip-all-blank-lines t]
2302 ["Leading space" gnus-article-strip-leading-space t]
2303 ["Trailing space" gnus-article-strip-trailing-space t]
2304 ["Leading space in headers"
2305 gnus-article-remove-leading-whitespace t])
2306 ["Overstrike" gnus-article-treat-overstrike t]
2307 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2308 ["Emphasis" gnus-article-emphasize t]
2309 ["Word wrap" gnus-article-fill-cited-article t]
2310 ["Fill long lines" gnus-article-fill-long-lines t]
2311 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2312 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2313 ["Remove CR" gnus-article-remove-cr t]
2314 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2315 ["Base64" gnus-article-de-base64-unreadable t]
2316 ["Rot 13" gnus-summary-caesar-message
2317 ,@(if (featurep 'xemacs) '(t)
2318 '(:help "\"Caesar rotate\" article by 13"))]
2319 ["De-IDNA" gnus-summary-idna-message t]
2320 ["Morse decode" gnus-summary-morse-message t]
2321 ["Unix pipe..." gnus-summary-pipe-message t]
2322 ["Add buttons" gnus-article-add-buttons t]
2323 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2324 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2325 ["Verbose header" gnus-summary-verbose-headers t]
2326 ["Toggle header" gnus-summary-toggle-header t]
2327 ["Unfold headers" gnus-article-treat-unfold-headers t]
2328 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2329 ["Html" gnus-article-wash-html t]
2330 ["Unsplit URLs" gnus-article-unsplit-urls t]
2331 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2332 ["Decode HZ" gnus-article-decode-HZ t]
2333 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2334 ("(Outlook) Deuglify"
2335 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2336 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2337 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2338 ["Full (Outlook) deuglify"
2339 gnus-article-outlook-deuglify-article t])
2342 ["Save in default format..." gnus-summary-save-article
2343 ,@(if (featurep 'xemacs) '(t)
2344 '(:help "Save article using default method"))]
2345 ["Save in file..." gnus-summary-save-article-file
2346 ,@(if (featurep 'xemacs) '(t)
2347 '(:help "Save article in file"))]
2348 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2349 ["Save in MH folder..." gnus-summary-save-article-folder t]
2350 ["Save in VM folder..." gnus-summary-save-article-vm t]
2351 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2352 ["Save body in file..." gnus-summary-save-article-body-file t]
2353 ["Pipe through a filter..." gnus-summary-pipe-output t]
2354 ["Add to SOUP packet" gnus-soup-add-article t]
2355 ["Print with Muttprint..." gnus-summary-muttprint t]
2356 ["Print" gnus-summary-print-article
2357 ,@(if (featurep 'xemacs) '(t)
2358 '(:help "Generate and print a PostScript image"))])
2359 ("Copy, move,... (Backend)"
2360 ,@(if (featurep 'xemacs) nil
2361 '(:help "Copying, moving, expiring articles..."))
2362 ["Respool article..." gnus-summary-respool-article t]
2363 ["Move article..." gnus-summary-move-article
2364 (gnus-check-backend-function
2365 'request-move-article gnus-newsgroup-name)]
2366 ["Copy article..." gnus-summary-copy-article t]
2367 ["Crosspost article..." gnus-summary-crosspost-article
2368 (gnus-check-backend-function
2369 'request-replace-article gnus-newsgroup-name)]
2370 ["Import file..." gnus-summary-import-article
2371 (gnus-check-backend-function
2372 'request-accept-article gnus-newsgroup-name)]
2373 ["Create article..." gnus-summary-create-article
2374 (gnus-check-backend-function
2375 'request-accept-article gnus-newsgroup-name)]
2376 ["Check if posted" gnus-summary-article-posted-p t]
2377 ["Edit article" gnus-summary-edit-article
2378 (not (gnus-group-read-only-p))]
2379 ["Delete article" gnus-summary-delete-article
2380 (gnus-check-backend-function
2381 'request-expire-articles gnus-newsgroup-name)]
2382 ["Query respool" gnus-summary-respool-query t]
2383 ["Trace respool" gnus-summary-respool-trace t]
2384 ["Delete expirable articles" gnus-summary-expire-articles-now
2385 (gnus-check-backend-function
2386 'request-expire-articles gnus-newsgroup-name)])
2388 ["Uudecode" gnus-uu-decode-uu
2389 ,@(if (featurep 'xemacs) '(t)
2390 '(:help "Decode uuencoded article(s)"))]
2391 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2392 ["Unshar" gnus-uu-decode-unshar t]
2393 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2394 ["Save" gnus-uu-decode-save t]
2395 ["Binhex" gnus-uu-decode-binhex t]
2396 ["Postscript" gnus-uu-decode-postscript t]
2397 ["All MIME parts" gnus-summary-save-parts t])
2399 ["Enter article" gnus-cache-enter-article t]
2400 ["Remove article" gnus-cache-remove-article t])
2401 ["Translate" gnus-article-babel t]
2402 ["Select article buffer" gnus-summary-select-article-buffer t]
2403 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2404 ["Isearch article..." gnus-summary-isearch-article t]
2405 ["Beginning of the article" gnus-summary-beginning-of-article t]
2406 ["End of the article" gnus-summary-end-of-article t]
2407 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2408 ["Fetch referenced articles" gnus-summary-refer-references t]
2409 ["Fetch current thread" gnus-summary-refer-thread t]
2410 ["Fetch article with id..." gnus-summary-refer-article t]
2411 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2412 ["Redisplay" gnus-summary-show-article t]
2413 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2415 gnus-summary-article-menu gnus-summary-mode-map ""
2416 (cons "Article" innards))
2418 (if (not (keymapp gnus-summary-article-menu))
2420 gnus-article-commands-menu gnus-article-mode-map ""
2421 (cons "Commands" innards))
2422 ;; in Emacs, don't share menu.
2423 (setq gnus-article-commands-menu
2424 (copy-keymap gnus-summary-article-menu))
2425 (define-key gnus-article-mode-map [menu-bar commands]
2426 (cons "Commands" gnus-article-commands-menu))))
2429 gnus-summary-thread-menu gnus-summary-mode-map ""
2431 ["Find all messages in thread" gnus-summary-refer-thread t]
2432 ["Toggle threading" gnus-summary-toggle-threads t]
2433 ["Hide threads" gnus-summary-hide-all-threads t]
2434 ["Show threads" gnus-summary-show-all-threads t]
2435 ["Hide thread" gnus-summary-hide-thread t]
2436 ["Show thread" gnus-summary-show-thread t]
2437 ["Go to next thread" gnus-summary-next-thread t]
2438 ["Go to previous thread" gnus-summary-prev-thread t]
2439 ["Go down thread" gnus-summary-down-thread t]
2440 ["Go up thread" gnus-summary-up-thread t]
2441 ["Top of thread" gnus-summary-top-thread t]
2442 ["Mark thread as read" gnus-summary-kill-thread t]
2443 ["Lower thread score" gnus-summary-lower-thread t]
2444 ["Raise thread score" gnus-summary-raise-thread t]
2445 ["Rethread current" gnus-summary-rethread-current t]))
2448 gnus-summary-post-menu gnus-summary-mode-map ""
2450 ["Send a message (mail or news)" gnus-summary-post-news
2451 ,@(if (featurep 'xemacs) '(t)
2452 '(:help "Compose a new message (mail or news)"))]
2453 ["Followup" gnus-summary-followup
2454 ,@(if (featurep 'xemacs) '(t)
2455 '(:help "Post followup to this article"))]
2456 ["Followup and yank" gnus-summary-followup-with-original
2457 ,@(if (featurep 'xemacs) '(t)
2458 '(:help "Post followup to this article, quoting its contents"))]
2459 ["Supersede article" gnus-summary-supersede-article t]
2460 ["Cancel article" gnus-summary-cancel-article
2461 ,@(if (featurep 'xemacs) '(t)
2462 '(:help "Cancel an article you posted"))]
2463 ["Reply" gnus-summary-reply t]
2464 ["Reply and yank" gnus-summary-reply-with-original t]
2465 ["Wide reply" gnus-summary-wide-reply t]
2466 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2467 ,@(if (featurep 'xemacs) '(t)
2468 '(:help "Mail a reply, quoting this article"))]
2469 ["Very wide reply" gnus-summary-very-wide-reply t]
2470 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2471 ,@(if (featurep 'xemacs) '(t)
2472 '(:help "Mail a very wide reply, quoting this article"))]
2473 ["Mail forward" gnus-summary-mail-forward t]
2474 ["Post forward" gnus-summary-post-forward t]
2475 ["Digest and mail" gnus-uu-digest-mail-forward t]
2476 ["Digest and post" gnus-uu-digest-post-forward t]
2477 ["Resend message" gnus-summary-resend-message t]
2478 ["Resend message edit" gnus-summary-resend-message-edit t]
2479 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2480 ["Send a mail" gnus-summary-mail-other-window t]
2481 ["Create a local message" gnus-summary-news-other-window t]
2482 ["Uuencode and post" gnus-uu-post-news
2483 ,@(if (featurep 'xemacs) '(t)
2484 '(:help "Post a uuencoded article"))]
2485 ["Followup via news" gnus-summary-followup-to-mail t]
2486 ["Followup via news and yank"
2487 gnus-summary-followup-to-mail-with-original t]
2489 ;;["Send" gnus-summary-send-draft t]
2490 ;;["Send bounced" gnus-resend-bounced-mail t])
2494 ((not (keymapp gnus-summary-post-menu))
2495 (setq gnus-article-post-menu gnus-summary-post-menu))
2496 ((not gnus-article-post-menu)
2497 ;; Don't share post menu.
2498 (setq gnus-article-post-menu
2499 (copy-keymap gnus-summary-post-menu))))
2500 (define-key gnus-article-mode-map [menu-bar post]
2501 (cons "Post" gnus-article-post-menu))
2504 gnus-summary-misc-menu gnus-summary-mode-map ""
2507 ["Mark as read" gnus-summary-mark-as-read-forward t]
2508 ["Mark same subject and select"
2509 gnus-summary-kill-same-subject-and-select t]
2510 ["Mark same subject" gnus-summary-kill-same-subject t]
2511 ["Catchup" gnus-summary-catchup
2512 ,@(if (featurep 'xemacs) '(t)
2513 '(:help "Mark unread articles in this group as read"))]
2514 ["Catchup all" gnus-summary-catchup-all t]
2515 ["Catchup to here" gnus-summary-catchup-to-here t]
2516 ["Catchup from here" gnus-summary-catchup-from-here t]
2517 ["Catchup region" gnus-summary-mark-region-as-read
2518 (gnus-mark-active-p)]
2519 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2521 ["Tick" gnus-summary-tick-article-forward t]
2522 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2523 ["Remove marks" gnus-summary-clear-mark-forward t]
2524 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2525 ["Set bookmark" gnus-summary-set-bookmark t]
2526 ["Remove bookmark" gnus-summary-remove-bookmark t])
2528 ["Marks..." gnus-summary-limit-to-marks t]
2529 ["Subject..." gnus-summary-limit-to-subject t]
2530 ["Author..." gnus-summary-limit-to-author t]
2531 ["Recipient..." gnus-summary-limit-to-recipient t]
2532 ["Age..." gnus-summary-limit-to-age t]
2533 ["Extra..." gnus-summary-limit-to-extra t]
2534 ["Score..." gnus-summary-limit-to-score t]
2535 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2536 ["Unread" gnus-summary-limit-to-unread t]
2537 ["Unseen" gnus-summary-limit-to-unseen t]
2538 ["Signletons" gnus-summary-limit-to-singletons t]
2539 ["Replied" gnus-summary-limit-to-replied t]
2540 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2541 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2542 ["Pop limit" gnus-summary-pop-limit t]
2543 ["Show dormant" gnus-summary-limit-include-dormant t]
2544 ["Hide childless dormant"
2545 gnus-summary-limit-exclude-childless-dormant t]
2546 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2547 ["Hide marked" gnus-summary-limit-exclude-marks t]
2548 ["Show expunged" gnus-summary-limit-include-expunged t])
2550 ["Set mark" gnus-summary-mark-as-processable t]
2551 ["Remove mark" gnus-summary-unmark-as-processable t]
2552 ["Remove all marks" gnus-summary-unmark-all-processable t]
2553 ["Invert marks" gnus-uu-invert-processable t]
2554 ["Mark above" gnus-uu-mark-over t]
2555 ["Mark series" gnus-uu-mark-series t]
2556 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2557 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2558 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2559 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2560 ["Mark all" gnus-uu-mark-all t]
2561 ["Mark buffer" gnus-uu-mark-buffer t]
2562 ["Mark sparse" gnus-uu-mark-sparse t]
2563 ["Mark thread" gnus-uu-mark-thread t]
2564 ["Unmark thread" gnus-uu-unmark-thread t]
2565 ("Process Mark Sets"
2566 ["Kill" gnus-summary-kill-process-mark t]
2567 ["Yank" gnus-summary-yank-process-mark
2568 gnus-newsgroup-process-stack]
2569 ["Save" gnus-summary-save-process-mark t]
2570 ["Run command on marked..." gnus-summary-universal-argument t]))
2572 ["Page forward" gnus-summary-next-page
2573 ,@(if (featurep 'xemacs) '(t)
2574 '(:help "Show next page of article"))]
2575 ["Page backward" gnus-summary-prev-page
2576 ,@(if (featurep 'xemacs) '(t)
2577 '(:help "Show previous page of article"))]
2578 ["Line forward" gnus-summary-scroll-up t])
2580 ["Next unread article" gnus-summary-next-unread-article t]
2581 ["Previous unread article" gnus-summary-prev-unread-article t]
2582 ["Next article" gnus-summary-next-article t]
2583 ["Previous article" gnus-summary-prev-article t]
2584 ["Next unread subject" gnus-summary-next-unread-subject t]
2585 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2586 ["Next article same subject" gnus-summary-next-same-subject t]
2587 ["Previous article same subject" gnus-summary-prev-same-subject t]
2588 ["First unread article" gnus-summary-first-unread-article t]
2589 ["Best unread article" gnus-summary-best-unread-article t]
2590 ["Go to subject number..." gnus-summary-goto-subject t]
2591 ["Go to article number..." gnus-summary-goto-article t]
2592 ["Go to the last article" gnus-summary-goto-last-article t]
2593 ["Pop article off history" gnus-summary-pop-article t])
2595 ["Sort by number" gnus-summary-sort-by-number t]
2596 ["Sort by author" gnus-summary-sort-by-author t]
2597 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2598 ["Sort by subject" gnus-summary-sort-by-subject t]
2599 ["Sort by date" gnus-summary-sort-by-date t]
2600 ["Sort by score" gnus-summary-sort-by-score t]
2601 ["Sort by lines" gnus-summary-sort-by-lines t]
2602 ["Sort by characters" gnus-summary-sort-by-chars t]
2603 ["Randomize" gnus-summary-sort-by-random t]
2604 ["Original sort" gnus-summary-sort-by-original t])
2606 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2607 ["Describe group" gnus-summary-describe-group t]
2608 ["Fetch charter" gnus-group-fetch-charter
2609 ,@(if (featurep 'xemacs) nil
2610 '(:help "Display the charter of the current group"))]
2611 ["Fetch control message" gnus-group-fetch-control
2612 ,@(if (featurep 'xemacs) nil
2613 '(:help "Display the archived control message for the current group"))]
2614 ["Read manual" gnus-info-find-node t])
2616 ["Pick and read" gnus-pick-mode t]
2617 ["Binary" gnus-binary-mode t])
2619 ["Regenerate" gnus-summary-prepare t]
2620 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2621 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2622 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2623 ["Toggle threading" gnus-summary-toggle-threads t])
2624 ["See old articles" gnus-summary-insert-old-articles t]
2625 ["See new articles" gnus-summary-insert-new-articles t]
2626 ["Filter articles..." gnus-summary-execute-command t]
2627 ["Run command on articles..." gnus-summary-universal-argument t]
2628 ["Search articles forward..." gnus-summary-search-article-forward t]
2629 ["Search articles backward..." gnus-summary-search-article-backward t]
2630 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2631 ["Expand window" gnus-summary-expand-window t]
2632 ["Expire expirable articles" gnus-summary-expire-articles
2633 (gnus-check-backend-function
2634 'request-expire-articles gnus-newsgroup-name)]
2635 ["Edit local kill file" gnus-summary-edit-local-kill t]
2636 ["Edit main kill file" gnus-summary-edit-global-kill t]
2637 ["Edit group parameters" gnus-summary-edit-parameters t]
2638 ["Customize group parameters" gnus-summary-customize-parameters t]
2639 ["Send a bug report" gnus-bug t]
2641 ["Catchup and exit" gnus-summary-catchup-and-exit
2642 ,@(if (featurep 'xemacs) '(t)
2643 '(:help "Mark unread articles in this group as read, then exit"))]
2644 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2645 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2646 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2647 ["Exit group" gnus-summary-exit
2648 ,@(if (featurep 'xemacs) '(t)
2649 '(:help "Exit current group, return to group selection mode"))]
2650 ["Exit group without updating" gnus-summary-exit-no-update t]
2651 ["Exit and goto next group" gnus-summary-next-group t]
2652 ["Exit and goto prev group" gnus-summary-prev-group t]
2653 ["Reselect group" gnus-summary-reselect-current-group t]
2654 ["Rescan group" gnus-summary-rescan-group t]
2655 ["Update dribble" gnus-summary-save-newsrc t])))
2657 (gnus-run-hooks 'gnus-summary-menu-hook)))
2659 (defvar gnus-summary-tool-bar-map nil)
2661 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2662 ;; affect _new_ message buffers. We might add a function that walks thru all
2663 ;; summary-mode buffers and force the update.
2664 (defun gnus-summary-tool-bar-update (&optional symbol value)
2665 "Update summary mode toolbar.
2666 Setter function for custom variables."
2667 (setq-default gnus-summary-tool-bar-map nil)
2669 ;; When used as ":set" function:
2670 (set-default symbol value))
2671 (when (gnus-buffer-live-p gnus-summary-buffer)
2672 (with-current-buffer gnus-summary-buffer
2673 (gnus-summary-make-tool-bar))))
2675 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2676 'gnus-summary-tool-bar-gnome
2677 'gnus-summary-tool-bar-retro)
2678 "Specifies the Gnus summary tool bar.
2680 It can be either a list or a symbol refering to a list. See
2681 `gmm-tool-bar-from-list' for the format of the list. The
2682 default key map is `gnus-summary-mode-map'.
2684 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2685 `gnus-summary-tool-bar-retro'."
2686 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2687 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2688 (repeat :tag "User defined list" gmm-tool-bar-item)
2690 :version "23.0" ;; No Gnus
2691 :initialize 'custom-initialize-default
2692 :set 'gnus-summary-tool-bar-update
2693 :group 'gnus-summary)
2695 (defcustom gnus-summary-tool-bar-gnome
2696 '((gnus-summary-post-news "mail/compose" nil)
2697 (gnus-summary-insert-new-articles "mail/inbox" nil
2698 :visible (or (not gnus-agent)
2700 (gnus-summary-reply-with-original "mail/reply")
2701 (gnus-summary-reply "mail/reply" nil :visible nil)
2702 (gnus-summary-followup-with-original "mail/reply-all")
2703 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2704 (gnus-summary-mail-forward "mail/forward")
2705 (gnus-summary-save-article "mail/save")
2706 (gnus-summary-search-article-forward "search" nil :visible nil)
2707 (gnus-summary-print-article "print")
2708 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2709 ;; Some new commands that may need more suitable icons:
2710 (gnus-summary-save-newsrc "save" nil :visible nil)
2711 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2712 (gnus-summary-prev-article "left-arrow")
2713 (gnus-summary-next-article "right-arrow")
2714 (gnus-summary-next-page "next-page")
2715 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2717 ;; Maybe some sort-by-... could be added:
2718 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2719 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2720 (gnus-summary-mark-as-expirable
2722 :visible (gnus-check-backend-function 'request-expire-articles
2723 gnus-newsgroup-name))
2724 (gnus-summary-mark-as-spam
2726 :visible (and (fboundp 'spam-group-ham-contents-p)
2727 (spam-group-ham-contents-p gnus-newsgroup-name))
2728 :help "Mark as spam")
2729 (gnus-summary-mark-as-read-forward
2731 :visible (and (fboundp 'spam-group-spam-contents-p)
2732 (spam-group-spam-contents-p gnus-newsgroup-name)))
2734 (gnus-summary-exit "exit")
2735 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2736 (gnus-info-find-node "help"))
2737 "List of functions for the summary tool bar (GNOME style).
2739 See `gmm-tool-bar-from-list' for the format of the list."
2740 :type '(repeat gmm-tool-bar-item)
2741 :version "23.0" ;; No Gnus
2742 :initialize 'custom-initialize-default
2743 :set 'gnus-summary-tool-bar-update
2744 :group 'gnus-summary)
2746 (defcustom gnus-summary-tool-bar-retro
2747 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2748 (gnus-summary-next-unread-article "gnus/next-ur")
2749 (gnus-summary-post-news "gnus/post")
2750 (gnus-summary-followup-with-original "gnus/fuwo")
2751 (gnus-summary-followup "gnus/followup")
2752 (gnus-summary-reply-with-original "gnus/reply-wo")
2753 (gnus-summary-reply "gnus/reply")
2754 (gnus-summary-caesar-message "gnus/rot13")
2755 (gnus-uu-decode-uu "gnus/uu-decode")
2756 (gnus-summary-save-article-file "gnus/save-aif")
2757 (gnus-summary-save-article "gnus/save-art")
2758 (gnus-uu-post-news "gnus/uu-post")
2759 (gnus-summary-catchup "gnus/catchup")
2760 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2761 (gnus-summary-exit "gnus/exit-summ")
2762 ;; Some new command that may need more suitable icons:
2763 (gnus-summary-print-article "gnus/print" nil :visible nil)
2764 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2765 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2766 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2767 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2768 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2769 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2771 (gnus-info-find-node "gnus/help" nil :visible nil))
2772 "List of functions for the summary tool bar (retro look).
2774 See `gmm-tool-bar-from-list' for the format of the list."
2775 :type '(repeat gmm-tool-bar-item)
2776 :version "23.0" ;; No Gnus
2777 :initialize 'custom-initialize-default
2778 :set 'gnus-summary-tool-bar-update
2779 :group 'gnus-summary)
2781 (defcustom gnus-summary-tool-bar-zap-list t
2782 "List of icon items from the global tool bar.
2783 These items are not displayed in the Gnus summary mode tool bar.
2785 See `gmm-tool-bar-from-list' for the format of the list."
2786 :type 'gmm-tool-bar-zap-list
2787 :version "23.0" ;; No Gnus
2788 :initialize 'custom-initialize-default
2789 :set 'gnus-summary-tool-bar-update
2790 :group 'gnus-summary)
2792 (defvar image-load-path)
2794 (defun gnus-summary-make-tool-bar (&optional force)
2795 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2796 When FORCE, rebuild the tool bar."
2797 (when (and (not (featurep 'xemacs))
2798 (boundp 'tool-bar-mode)
2800 (or (not gnus-summary-tool-bar-map) force))
2802 (gmm-image-load-path-for-library "gnus"
2805 (image-load-path (cons (car load-path)
2806 (when (boundp 'image-load-path)
2808 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2809 gnus-summary-tool-bar-zap-list
2810 'gnus-summary-mode-map)))
2812 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2814 (setq gnus-summary-tool-bar-map map))))
2815 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2817 (defun gnus-score-set-default (var value)
2818 "A version of set that updates the GNU Emacs menu-bar."
2820 ;; It is the message that forces the active status to be updated.
2823 (defun gnus-make-score-map (type)
2824 "Make a summary score map of type TYPE."
2827 (let ((headers '(("author" "from" string)
2828 ("subject" "subject" string)
2829 ("article body" "body" string)
2830 ("article head" "head" string)
2831 ("xref" "xref" string)
2832 ("extra header" "extra" string)
2833 ("lines" "lines" number)
2834 ("followups to author" "followup" string)))
2835 (types '((number ("less than" <)
2838 (string ("substring" s)
2842 (perms '(("temporary" (current-time-string))
2850 (if (eq type 'lower)
2855 (setq header (car headers))
2861 (let ((ts (cdr (assoc (nth 2 header) types)))
2877 'gnus-summary-score-entry
2879 (if (or (string= (nth 1 header)
2881 (string= (nth 1 header)
2884 (list 'gnus-summary-header
2886 (list 'quote (nth 1 (car ts)))
2887 (list 'gnus-score-delta-default
2894 (list (nreverse outp))))
2897 (list (nreverse outt))))
2899 (setq headers (cdr headers)))
2900 (list (nreverse outh))))))))
2904 (defun gnus-summary-mode (&optional group)
2905 "Major mode for reading articles.
2907 All normal editing commands are switched off.
2908 \\<gnus-summary-mode-map>
2909 Each line in this buffer represents one article. To read an
2910 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2911 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2914 You can also post articles and send mail from this buffer. To
2915 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2916 of an article, type `\\[gnus-summary-reply]'.
2918 There are approx. one gazillion commands you can execute in this
2919 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2921 The following commands are available:
2923 \\{gnus-summary-mode-map}"
2925 (kill-all-local-variables)
2926 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2927 (gnus-summary-make-local-variables))
2928 (gnus-summary-make-local-variables)
2929 (setq gnus-newsgroup-name group)
2930 (when (gnus-visual-p 'summary-menu 'menu)
2931 (gnus-summary-make-menu-bar)
2932 (gnus-summary-make-tool-bar))
2933 (gnus-make-thread-indent-array)
2934 (gnus-simplify-mode-line)
2935 (setq major-mode 'gnus-summary-mode)
2936 (setq mode-name "Summary")
2937 (make-local-variable 'minor-mode-alist)
2938 (use-local-map gnus-summary-mode-map)
2939 (buffer-disable-undo)
2940 (setq buffer-read-only t ;Disable modification
2941 show-trailing-whitespace nil)
2942 (setq truncate-lines t)
2943 (setq selective-display t)
2944 (setq selective-display-ellipses t) ;Display `...'
2945 (gnus-summary-set-display-table)
2946 (gnus-set-default-directory)
2947 (make-local-variable 'gnus-summary-line-format)
2948 (make-local-variable 'gnus-summary-line-format-spec)
2949 (make-local-variable 'gnus-summary-dummy-line-format)
2950 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2951 (make-local-variable 'gnus-summary-mark-positions)
2952 (gnus-make-local-hook 'pre-command-hook)
2953 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2954 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2955 (turn-on-gnus-mailing-list-mode)
2956 (mm-enable-multibyte)
2957 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2958 (gnus-update-summary-mark-positions))
2960 (defun gnus-summary-make-local-variables ()
2961 "Make all the local summary buffer variables."
2963 (dolist (local gnus-summary-local-variables)
2966 (if (eq (cdr local) 'global)
2967 ;; Copy the global value of the variable.
2968 (setq global (symbol-value (car local)))
2969 ;; Use the value from the list.
2970 (setq global (eval (cdr local))))
2971 (set (make-local-variable (car local)) global))
2972 ;; Simple nil-valued local variable.
2973 (set (make-local-variable local) nil)))))
2975 (defun gnus-summary-clear-local-variables ()
2976 (let ((locals gnus-summary-local-variables))
2978 (if (consp (car locals))
2979 (and (symbolp (caar locals))
2980 (set (caar locals) nil))
2981 (and (symbolp (car locals))
2982 (set (car locals) nil)))
2983 (setq locals (cdr locals)))))
2985 ;; Summary data functions.
2987 (defmacro gnus-data-number (data)
2990 (defmacro gnus-data-set-number (data number)
2991 `(setcar ,data ,number))
2993 (defmacro gnus-data-mark (data)
2996 (defmacro gnus-data-set-mark (data mark)
2997 `(setcar (nthcdr 1 ,data) ,mark))
2999 (defmacro gnus-data-pos (data)
3002 (defmacro gnus-data-set-pos (data pos)
3003 `(setcar (nthcdr 2 ,data) ,pos))
3005 (defmacro gnus-data-header (data)
3008 (defmacro gnus-data-set-header (data header)
3009 `(setf (nth 3 ,data) ,header))
3011 (defmacro gnus-data-level (data)
3014 (defmacro gnus-data-unread-p (data)
3015 `(= (nth 1 ,data) gnus-unread-mark))
3017 (defmacro gnus-data-read-p (data)
3018 `(/= (nth 1 ,data) gnus-unread-mark))
3020 (defmacro gnus-data-pseudo-p (data)
3021 `(consp (nth 3 ,data)))
3023 (defmacro gnus-data-find (number)
3024 `(assq ,number gnus-newsgroup-data))
3026 (defmacro gnus-data-find-list (number &optional data)
3027 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3028 (memq (assq ,number bdata)
3031 (defmacro gnus-data-make (number mark pos header level)
3032 `(list ,number ,mark ,pos ,header ,level))
3034 (defun gnus-data-enter (after-article number mark pos header level offset)
3035 (let ((data (gnus-data-find-list after-article)))
3037 (error "No such article: %d" after-article))
3038 (setcdr data (cons (gnus-data-make number mark pos header level)
3040 (setq gnus-newsgroup-data-reverse nil)
3041 (gnus-data-update-list (cddr data) offset)))
3043 (defun gnus-data-enter-list (after-article list &optional offset)
3045 (let ((data (and after-article (gnus-data-find-list after-article)))
3049 (let ((odata gnus-newsgroup-data))
3050 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3052 (gnus-data-update-list odata offset)))
3053 ;; Find the last element in the list to be spliced into the main
3055 (setq list (last list))
3058 (setcdr list gnus-newsgroup-data)
3059 (setq gnus-newsgroup-data ilist)
3061 (gnus-data-update-list (cdr list) offset)))
3062 (setcdr list (cdr data))
3065 (gnus-data-update-list (cdr list) offset))))
3066 (setq gnus-newsgroup-data-reverse nil))))
3068 (defun gnus-data-remove (article &optional offset)
3069 (let ((data gnus-newsgroup-data))
3070 (if (= (gnus-data-number (car data)) article)
3072 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3073 gnus-newsgroup-data-reverse nil)
3075 (gnus-data-update-list gnus-newsgroup-data offset)))
3077 (when (= (gnus-data-number (cadr data)) article)
3078 (setcdr data (cddr data))
3080 (gnus-data-update-list (cdr data) offset))
3082 gnus-newsgroup-data-reverse nil))
3083 (setq data (cdr data))))))
3085 (defmacro gnus-data-list (backward)
3087 (or gnus-newsgroup-data-reverse
3088 (setq gnus-newsgroup-data-reverse
3089 (reverse gnus-newsgroup-data)))
3090 gnus-newsgroup-data))
3092 (defun gnus-data-update-list (data offset)
3093 "Add OFFSET to the POS of all data entries in DATA."
3094 (setq gnus-newsgroup-data-reverse nil)
3096 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3097 (setq data (cdr data))))
3099 (defun gnus-summary-article-pseudo-p (article)
3100 "Say whether this article is a pseudo article or not."
3101 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3103 (defmacro gnus-summary-article-sparse-p (article)
3104 "Say whether this article is a sparse article or not."
3105 `(memq ,article gnus-newsgroup-sparse))
3107 (defmacro gnus-summary-article-ancient-p (article)
3108 "Say whether this article is a sparse article or not."
3109 `(memq ,article gnus-newsgroup-ancient))
3111 (defun gnus-article-parent-p (number)
3112 "Say whether this article is a parent or not."
3113 (let ((data (gnus-data-find-list number)))
3114 (and (cdr data) ; There has to be an article after...
3115 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3116 (gnus-data-level (nth 1 data))))))
3118 (defun gnus-article-children (number)
3119 "Return a list of all children to NUMBER."
3120 (let* ((data (gnus-data-find-list number))
3121 (level (gnus-data-level (car data)))
3123 (setq data (cdr data))
3125 (= (gnus-data-level (car data)) (1+ level)))
3126 (push (gnus-data-number (car data)) children)
3127 (setq data (cdr data)))
3130 (defmacro gnus-summary-skip-intangible ()
3131 "If the current article is intangible, then jump to a different article."
3132 '(let ((to (get-text-property (point) 'gnus-intangible)))
3133 (and to (gnus-summary-goto-subject to))))
3135 (defmacro gnus-summary-article-intangible-p ()
3136 "Say whether this article is intangible or not."
3137 '(get-text-property (point) 'gnus-intangible))
3139 (defun gnus-article-read-p (article)
3140 "Say whether ARTICLE is read or not."
3141 (not (or (memq article gnus-newsgroup-marked)
3142 (memq article gnus-newsgroup-spam-marked)
3143 (memq article gnus-newsgroup-unreads)
3144 (memq article gnus-newsgroup-unselected)
3145 (memq article gnus-newsgroup-dormant))))
3147 ;; Some summary mode macros.
3149 (defmacro gnus-summary-article-number ()
3150 "The article number of the article on the current line.
3151 If there isn't an article number here, then we return the current
3154 (gnus-summary-skip-intangible)
3155 (or (get-text-property (point) 'gnus-number)
3156 (gnus-summary-last-subject))))
3158 (defmacro gnus-summary-article-header (&optional number)
3159 "Return the header of article NUMBER."
3160 `(gnus-data-header (gnus-data-find
3161 ,(or number '(gnus-summary-article-number)))))
3163 (defmacro gnus-summary-thread-level (&optional number)
3164 "Return the level of thread that starts with article NUMBER."
3165 `(if (and (eq gnus-summary-make-false-root 'dummy)
3166 (get-text-property (point) 'gnus-intangible))
3168 (gnus-data-level (gnus-data-find
3169 ,(or number '(gnus-summary-article-number))))))
3171 (defmacro gnus-summary-article-mark (&optional number)
3172 "Return the mark of article NUMBER."
3173 `(gnus-data-mark (gnus-data-find
3174 ,(or number '(gnus-summary-article-number)))))
3176 (defmacro gnus-summary-article-pos (&optional number)
3177 "Return the position of the line of article NUMBER."
3178 `(gnus-data-pos (gnus-data-find
3179 ,(or number '(gnus-summary-article-number)))))
3181 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3182 (defmacro gnus-summary-article-subject (&optional number)
3183 "Return current subject string or nil if nothing."
3186 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3187 '(gnus-data-header (assq (gnus-summary-article-number)
3188 gnus-newsgroup-data)))))
3191 (mail-header-subject headers))))
3193 (defmacro gnus-summary-article-score (&optional number)
3194 "Return current article score."
3195 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3196 gnus-newsgroup-scored))
3197 gnus-summary-default-score 0))
3199 (defun gnus-summary-article-children (&optional number)
3200 "Return a list of article numbers that are children of article NUMBER."
3201 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3202 (level (gnus-data-level (car data)))
3204 (while (and (setq data (cdr data))
3205 (> (setq l (gnus-data-level (car data))) level))
3206 (and (= (1+ level) l)
3207 (push (gnus-data-number (car data))
3209 (nreverse children)))
3211 (defun gnus-summary-article-parent (&optional number)
3212 "Return the article number of the parent of article NUMBER."
3213 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3214 (gnus-data-list t)))
3215 (level (gnus-data-level (car data))))
3217 () ; This is a root.
3218 ;; We search until we find an article with a level less than
3219 ;; this one. That function has to be the parent.
3220 (while (and (setq data (cdr data))
3221 (not (< (gnus-data-level (car data)) level))))
3222 (and data (gnus-data-number (car data))))))
3224 (defun gnus-unread-mark-p (mark)
3225 "Say whether MARK is the unread mark."
3226 (= mark gnus-unread-mark))
3228 (defun gnus-read-mark-p (mark)
3229 "Say whether MARK is one of the marks that mark as read.
3230 This is all marks except unread, ticked, dormant, and expirable."
3231 (not (or (= mark gnus-unread-mark)
3232 (= mark gnus-ticked-mark)
3233 (= mark gnus-spam-mark)
3234 (= mark gnus-dormant-mark)
3235 (= mark gnus-expirable-mark))))
3237 (defmacro gnus-article-mark (number)
3238 "Return the MARK of article NUMBER.
3239 This macro should only be used when computing the mark the \"first\"
3240 time; i.e., when generating the summary lines. After that,
3241 `gnus-summary-article-mark' should be used to examine the
3244 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3245 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3246 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3247 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3248 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3249 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3250 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3251 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3252 gnus-ancient-mark))))
3254 ;; Saving hidden threads.
3256 (defmacro gnus-save-hidden-threads (&rest forms)
3257 "Save hidden threads, eval FORMS, and restore the hidden threads."
3258 (let ((config (make-symbol "config")))
3259 `(let ((,config (gnus-hidden-threads-configuration)))
3263 (gnus-restore-hidden-threads-configuration ,config)))))
3264 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3265 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3267 (defun gnus-data-compute-positions ()
3268 "Compute the positions of all articles."
3269 (setq gnus-newsgroup-data-reverse nil)
3270 (let ((data gnus-newsgroup-data))
3272 (gnus-save-hidden-threads
3273 (gnus-summary-show-all-threads)
3274 (goto-char (point-min))
3276 (while (get-text-property (point) 'gnus-intangible)
3278 (gnus-data-set-pos (car data) (+ (point) 3))
3279 (setq data (cdr data))
3280 (forward-line 1))))))
3282 (defun gnus-hidden-threads-configuration ()
3283 "Return the current hidden threads configuration."
3286 (goto-char (point-min))
3287 (while (search-forward "\r" nil t)
3288 (push (1- (point)) config))
3291 (defun gnus-restore-hidden-threads-configuration (config)
3292 "Restore hidden threads configuration from CONFIG."
3294 (let (point buffer-read-only)
3295 (while (setq point (pop config))
3296 (when (and (< point (point-max))
3298 (eq (char-after) ?\n))
3299 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3301 ;; Various summary mode internalish functions.
3303 (defun gnus-mouse-pick-article (e)
3306 (gnus-summary-next-page nil t))
3308 (defun gnus-summary-set-display-table ()
3309 "Change the display table.
3310 Odd characters have a tendency to mess
3311 up nicely formatted displays - we make all possible glyphs
3312 display only a single character."
3314 ;; We start from the standard display table, if any.
3315 (let ((table (or (copy-sequence standard-display-table)
3316 (make-display-table)))
3318 ;; Nix out all the control chars...
3319 (while (>= (setq i (1- i)) 0)
3320 (aset table i [??]))
3321 ;; ... but not newline and cr, of course. (cr is necessary for the
3322 ;; selective display).
3323 (aset table ?\n nil)
3324 (aset table ?\r nil)
3325 ;; We keep TAB as well.
3326 (aset table ?\t nil)
3327 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3328 ;; Emacs 23 (unicode), that are not set already.
3329 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3332 (while (>= (setq i (1- i)) 127)
3333 ;; Only modify if the entry is nil.
3334 (unless (aref table i)
3335 (aset table i [??]))))
3336 (setq buffer-display-table table)))
3338 (defun gnus-summary-set-article-display-arrow (pos)
3339 "Update the overlay arrow to point to line at position POS."
3340 (when (and gnus-summary-display-arrow
3341 (boundp 'overlay-arrow-position)
3342 (boundp 'overlay-arrow-string))
3346 (unless overlay-arrow-position
3347 (setq overlay-arrow-position (make-marker)))
3348 (setq overlay-arrow-string "=>"
3349 overlay-arrow-position (set-marker overlay-arrow-position
3351 (current-buffer))))))
3353 (defun gnus-summary-setup-buffer (group)
3354 "Initialize summary buffer."
3355 (let ((buffer (gnus-summary-buffer-name group))
3356 (dead-name (concat "*Dead Summary "
3357 (gnus-group-decoded-name group) "*")))
3358 ;; If a dead summary buffer exists, we kill it.
3359 (when (gnus-buffer-live-p dead-name)
3360 (gnus-kill-buffer dead-name))
3361 (if (get-buffer buffer)
3364 (setq gnus-summary-buffer (current-buffer))
3365 (not gnus-newsgroup-prepared))
3366 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3367 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3368 (gnus-summary-mode group)
3370 (gnus-carpal-setup-buffer 'summary))
3371 (when (gnus-group-quit-config group)
3372 (set (make-local-variable 'gnus-single-article-buffer) nil))
3373 (make-local-variable 'gnus-article-buffer)
3374 (make-local-variable 'gnus-article-current)
3375 (make-local-variable 'gnus-original-article-buffer)
3376 (setq gnus-newsgroup-name group)
3377 ;; Set any local variables in the group parameters.
3378 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3381 (defun gnus-set-global-variables ()
3382 "Set the global equivalents of the buffer-local variables.
3383 They are set to the latest values they had. These reflect the summary
3384 buffer that was in action when the last article was fetched."
3385 (when (eq major-mode 'gnus-summary-mode)
3386 (setq gnus-summary-buffer (current-buffer))
3387 (let ((name gnus-newsgroup-name)
3388 (marked gnus-newsgroup-marked)
3389 (spam gnus-newsgroup-spam-marked)
3390 (unread gnus-newsgroup-unreads)
3391 (headers gnus-current-headers)
3392 (data gnus-newsgroup-data)
3393 (summary gnus-summary-buffer)
3394 (article-buffer gnus-article-buffer)
3395 (original gnus-original-article-buffer)
3396 (gac gnus-article-current)
3397 (reffed gnus-reffed-article-number)
3398 (score-file gnus-current-score-file)
3399 (default-charset gnus-newsgroup-charset)
3401 (let ((locals gnus-newsgroup-variables))
3403 (if (consp (car locals))
3404 (push (eval (caar locals)) vlist)
3405 (push (eval (car locals)) vlist))
3406 (setq locals (cdr locals)))
3407 (setq vlist (nreverse vlist)))
3408 (with-current-buffer gnus-group-buffer
3409 (setq gnus-newsgroup-name name
3410 gnus-newsgroup-marked marked
3411 gnus-newsgroup-spam-marked spam
3412 gnus-newsgroup-unreads unread
3413 gnus-current-headers headers
3414 gnus-newsgroup-data data
3415 gnus-article-current gac
3416 gnus-summary-buffer summary
3417 gnus-article-buffer article-buffer
3418 gnus-original-article-buffer original
3419 gnus-reffed-article-number reffed
3420 gnus-current-score-file score-file
3421 gnus-newsgroup-charset default-charset)
3422 (let ((locals gnus-newsgroup-variables))
3424 (if (consp (car locals))
3425 (set (caar locals) (pop vlist))
3426 (set (car locals) (pop vlist)))
3427 (setq locals (cdr locals))))
3428 ;; The article buffer also has local variables.
3429 (when (gnus-buffer-live-p gnus-article-buffer)
3430 (set-buffer gnus-article-buffer)
3431 (setq gnus-summary-buffer summary))))))
3433 (defun gnus-summary-article-unread-p (article)
3434 "Say whether ARTICLE is unread or not."
3435 (memq article gnus-newsgroup-unreads))
3437 (defun gnus-summary-first-article-p (&optional article)
3438 "Return whether ARTICLE is the first article in the buffer."
3439 (if (not (setq article (or article (gnus-summary-article-number))))
3441 (eq article (caar gnus-newsgroup-data))))
3443 (defun gnus-summary-last-article-p (&optional article)
3444 "Return whether ARTICLE is the last article in the buffer."
3445 (if (not (setq article (or article (gnus-summary-article-number))))
3446 ;; All non-existent numbers are the last article. :-)
3448 (not (cdr (gnus-data-find-list article)))))
3450 (defun gnus-make-thread-indent-array (&optional n)
3452 (progn (setq n 200) nil)
3453 (null gnus-thread-indent-array)
3454 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3455 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3456 gnus-thread-indent-array-level gnus-thread-indent-level)
3458 (aset gnus-thread-indent-array n
3459 (make-string (* n gnus-thread-indent-level) ? ))
3462 (defun gnus-update-summary-mark-positions ()
3463 "Compute where the summary marks are to go."
3465 (when (gnus-buffer-exists-p gnus-summary-buffer)
3466 (set-buffer gnus-summary-buffer))
3467 (let ((spec gnus-summary-line-format-spec)
3470 (gnus-set-work-buffer)
3471 (let ((gnus-tmp-unread ?Z)
3472 (gnus-replied-mark ?Z)
3473 (gnus-score-below-mark ?Z)
3474 (gnus-score-over-mark ?Z)
3475 (gnus-undownloaded-mark ?Z)
3476 (gnus-summary-line-format-spec spec)
3477 (gnus-newsgroup-downloadable '(0))
3478 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3479 case-fold-search ignores)
3480 ;; Here, all marks are bound to Z.
3481 (gnus-summary-insert-line header
3482 0 nil t gnus-tmp-unread t nil "" nil 1)
3483 (goto-char (point-min))
3484 ;; Memorize the positions of the same characters as dummy marks.
3485 (while (re-search-forward "[A-D]" nil t)
3486 (push (point) ignores))
3488 ;; We use A-D as dummy marks in order to know column positions
3489 ;; where marks should be inserted.
3490 (setq gnus-tmp-unread ?A
3491 gnus-replied-mark ?B
3492 gnus-score-below-mark ?C
3493 gnus-score-over-mark ?C
3494 gnus-undownloaded-mark ?D)
3495 (gnus-summary-insert-line header
3496 0 nil t gnus-tmp-unread t nil "" nil 1)
3497 ;; Ignore characters which aren't dummy marks.
3499 (delete-region (goto-char (1- p)) p)
3501 (goto-char (point-min))
3502 (setq pos (list (cons 'unread
3503 (and (search-forward "A" nil t)
3504 (- (point) (point-min) 1)))))
3505 (goto-char (point-min))
3506 (push (cons 'replied (and (search-forward "B" nil t)
3507 (- (point) (point-min) 1)))
3509 (goto-char (point-min))
3510 (push (cons 'score (and (search-forward "C" nil t)
3511 (- (point) (point-min) 1)))
3513 (goto-char (point-min))
3514 (push (cons 'download (and (search-forward "D" nil t)
3515 (- (point) (point-min) 1)))
3517 (setq gnus-summary-mark-positions pos))))
3519 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3520 "Insert a dummy root in the summary buffer."
3522 (gnus-add-text-properties
3523 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3524 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3526 (defun gnus-summary-extract-address-component (from)
3527 (or (car (funcall gnus-extract-address-components from))
3530 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3531 (let ((mail-parse-charset gnus-newsgroup-charset)
3532 ; Is it really necessary to do this next part for each summary line?
3533 ; Luckily, doesn't seem to slow things down much.
3534 (mail-parse-ignored-charsets
3535 (with-current-buffer gnus-summary-buffer
3536 gnus-newsgroup-ignored-charsets)))
3538 (and gnus-ignored-from-addresses
3539 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3540 (let ((extra-headers (mail-header-extra header))
3544 ((setq to (cdr (assq 'To extra-headers)))
3545 (concat gnus-summary-to-prefix
3547 (gnus-summary-extract-address-component
3548 (funcall gnus-decode-encoded-address-function to)))))
3551 (cdr (assq 'Newsgroups extra-headers))
3553 (memq 'Newsgroups gnus-extra-headers)
3554 (eq (car (gnus-find-method-for-group
3555 gnus-newsgroup-name)) 'nntp)
3556 (gnus-group-real-name gnus-newsgroup-name))))
3557 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3558 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3560 (defun gnus-summary-insert-line (gnus-tmp-header
3561 gnus-tmp-level gnus-tmp-current
3562 undownloaded gnus-tmp-unread gnus-tmp-replied
3563 gnus-tmp-expirable gnus-tmp-subject-or-nil
3564 &optional gnus-tmp-dummy gnus-tmp-score
3566 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3567 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3569 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3570 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3571 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3572 (gnus-tmp-score-char
3573 (if (or (null gnus-summary-default-score)
3574 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3575 gnus-summary-zcore-fuzz))
3577 (if (< gnus-tmp-score gnus-summary-default-score)
3578 gnus-score-below-mark gnus-score-over-mark)))
3579 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3581 (cond (gnus-tmp-process gnus-process-mark)
3582 ((memq gnus-tmp-current gnus-newsgroup-cached)
3584 (gnus-tmp-replied gnus-replied-mark)
3585 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3586 gnus-forwarded-mark)
3587 ((memq gnus-tmp-current gnus-newsgroup-saved)
3589 ((memq gnus-tmp-number gnus-newsgroup-recent)
3591 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3594 (gnus-tmp-downloaded
3596 gnus-undownloaded-mark)
3597 (gnus-newsgroup-agentized
3598 gnus-downloaded-mark)
3601 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3604 ((string-match "<[^>]+> *$" gnus-tmp-from)
3605 (let ((beg (match-beginning 0)))
3606 (or (and (string-match "^\".+\"" gnus-tmp-from)
3607 (substring gnus-tmp-from 1 (1- (match-end 0))))
3608 (substring gnus-tmp-from 0 beg))))
3609 ((string-match "(.+)" gnus-tmp-from)
3610 (substring gnus-tmp-from
3611 (1+ (match-beginning 0)) (1- (match-end 0))))
3613 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3614 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3615 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3616 (buffer-read-only nil))
3617 (when (string= gnus-tmp-name "")
3618 (setq gnus-tmp-name gnus-tmp-from))
3619 (unless (numberp gnus-tmp-lines)
3620 (setq gnus-tmp-lines -1))
3621 (if (= gnus-tmp-lines -1)
3622 (setq gnus-tmp-lines "?")
3623 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3624 (gnus-put-text-property
3626 (progn (eval gnus-summary-line-format-spec) (point))
3627 'gnus-number gnus-tmp-number)
3628 (when (gnus-visual-p 'summary-highlight 'highlight)
3630 (gnus-run-hooks 'gnus-summary-update-hook)
3633 (defun gnus-summary-update-line (&optional dont-update)
3634 "Update summary line after change."
3635 (when (and gnus-summary-default-score
3636 (not gnus-summary-inhibit-highlight))
3637 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3638 (article (gnus-summary-article-number))
3639 (score (gnus-summary-article-score article)))
3641 (if (and gnus-summary-mark-below
3642 (< (gnus-summary-article-score)
3643 gnus-summary-mark-below))
3644 ;; This article has a low score, so we mark it as read.
3645 (when (memq article gnus-newsgroup-unreads)
3646 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3647 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3648 ;; This article was previously marked as read on account
3649 ;; of a low score, but now it has risen, so we mark it as
3651 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3652 (gnus-summary-update-mark
3653 (if (or (null gnus-summary-default-score)
3654 (<= (abs (- score gnus-summary-default-score))
3655 gnus-summary-zcore-fuzz))
3657 (if (< score gnus-summary-default-score)
3658 gnus-score-below-mark gnus-score-over-mark))
3660 ;; Do visual highlighting.
3661 (when (gnus-visual-p 'summary-highlight 'highlight)
3662 (gnus-run-hooks 'gnus-summary-update-hook)))))
3664 (defvar gnus-tmp-new-adopts nil)
3666 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3667 "Return the number of articles in THREAD.
3668 This may be 0 in some cases -- if none of the articles in
3669 the thread are to be displayed."
3671 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3673 ((not (listp thread))
3675 ((and (consp thread) (cdr thread))
3678 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3681 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3684 (when (and level (zerop level) gnus-tmp-new-adopts)
3687 'gnus-summary-number-of-articles-in-thread
3688 gnus-tmp-new-adopts))))
3690 (if (> number 1) gnus-not-empty-thread-mark
3691 gnus-empty-thread-mark)
3694 (defsubst gnus-summary-line-message-size (head)
3695 "Return pretty-printed version of message size.
3696 This function is intended to be used in
3697 `gnus-summary-line-format-alist'."
3698 (let ((c (or (mail-header-chars head) -1)))
3699 (cond ((< c 0) "n/a") ; chars not available
3700 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3701 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3702 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3703 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3706 (defun gnus-summary-set-local-parameters (group)
3707 "Go through the local params of GROUP and set all variable specs in that list."
3708 (let ((vars '(quit-config))) ; Ignore quit-config.
3709 (dolist (elem (gnus-group-find-parameter group))
3710 (and (consp elem) ; Has to be a cons.
3711 (consp (cdr elem)) ; The cdr has to be a list.
3712 (symbolp (car elem)) ; Has to be a symbol in there.
3713 (not (memq (car elem) vars))
3714 (ignore-errors ; So we set it.
3715 (push (car elem) vars)
3716 (make-local-variable (car elem))
3717 (set (car elem) (eval (nth 1 elem))))))))
3719 (defun gnus-summary-read-group (group &optional show-all no-article
3720 kill-buffer no-display backward
3722 "Start reading news in newsgroup GROUP.
3723 If SHOW-ALL is non-nil, already read articles are also listed.
3724 If NO-ARTICLE is non-nil, no article is selected initially.
3725 If NO-DISPLAY, don't generate a summary buffer."
3729 (let ((gnus-auto-select-next nil))
3730 (or (gnus-summary-read-group-1
3731 group show-all no-article
3732 kill-buffer no-display
3735 select-articles nil)))))
3736 (eq gnus-auto-select-next 'quietly))
3737 (set-buffer gnus-group-buffer)
3738 ;; The entry function called above goes to the next
3739 ;; group automatically, so we go two groups back
3740 ;; if we are searching for the previous group.
3742 (gnus-group-prev-unread-group 2))
3743 (if (not (equal group (gnus-group-group-name)))
3744 (setq group (gnus-group-group-name))
3748 (defun gnus-summary-read-group-1 (group show-all no-article
3749 kill-buffer no-display
3750 &optional select-articles)
3751 ;; Killed foreign groups can't be entered.
3752 ;; (when (and (not (gnus-group-native-p group))
3753 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3754 ;; (error "Dead non-native groups can't be entered"))
3755 (gnus-message 5 "Retrieving newsgroup: %s..."
3756 (gnus-group-decoded-name group))
3757 (let* ((new-group (gnus-summary-setup-buffer group))
3758 (quit-config (gnus-group-quit-config group))
3759 (did-select (and new-group (gnus-select-newsgroup
3760 group show-all select-articles))))
3762 ;; This summary buffer exists already, so we just select it.
3764 (gnus-set-global-variables)
3766 (gnus-kill-or-deaden-summary kill-buffer))
3767 (gnus-configure-windows 'summary 'force)
3768 (gnus-set-mode-line 'summary)
3769 (gnus-summary-position-point)
3772 ;; We couldn't select this group.
3774 (when (and (eq major-mode 'gnus-summary-mode)
3775 (not (equal (current-buffer) kill-buffer)))
3776 (kill-buffer (current-buffer))
3777 (if (not quit-config)
3779 ;; Update the info -- marks might need to be removed,
3781 (gnus-summary-update-info)
3782 (set-buffer gnus-group-buffer)
3783 (gnus-group-jump-to-group group)
3784 (gnus-group-next-unread-group 1))
3785 (gnus-handle-ephemeral-exit quit-config)))
3786 (let ((grpinfo (gnus-get-info group)))
3787 (if (null (gnus-info-read grpinfo))
3788 (gnus-message 3 "Group %s contains no messages"
3789 (gnus-group-decoded-name group))
3790 (gnus-message 3 "Can't select group")))
3792 ;; The user did a `C-g' while prompting for number of articles,
3793 ;; so we exit this group.
3794 ((eq did-select 'quit)
3795 (and (eq major-mode 'gnus-summary-mode)
3796 (not (equal (current-buffer) kill-buffer))
3797 (kill-buffer (current-buffer)))
3799 (gnus-kill-or-deaden-summary kill-buffer))
3800 (if (not quit-config)
3802 (set-buffer gnus-group-buffer)
3803 (gnus-group-jump-to-group group)
3804 (gnus-group-next-unread-group 1)
3805 (gnus-configure-windows 'group 'force))
3806 (gnus-handle-ephemeral-exit quit-config))
3807 ;; Finally signal the quit.
3809 ;; The group was successfully selected.
3811 (gnus-set-global-variables)
3812 ;; Save the active value in effect when the group was entered.
3813 (setq gnus-newsgroup-active
3815 (gnus-active gnus-newsgroup-name)))
3816 ;; You can change the summary buffer in some way with this hook.
3817 (gnus-run-hooks 'gnus-select-group-hook)
3818 (when (memq 'summary (gnus-update-format-specifications
3819 nil 'summary 'summary-mode 'summary-dummy))
3820 ;; The format specification for the summary line was updated,
3821 ;; so we need to update the mark positions as well.
3822 (gnus-update-summary-mark-positions))
3823 ;; Do score processing.
3824 (when gnus-use-scoring
3825 (gnus-possibly-score-headers))
3826 ;; Check whether to fill in the gaps in the threads.
3827 (when gnus-build-sparse-threads
3828 (gnus-build-sparse-threads))
3829 ;; Find the initial limit.
3831 (let ((gnus-newsgroup-dormant nil))
3832 (gnus-summary-initial-limit show-all))
3833 (gnus-summary-initial-limit show-all))
3834 ;; Generate the summary buffer.
3836 (gnus-summary-prepare))
3837 (when gnus-use-trees
3838 (gnus-tree-open group)
3839 (setq gnus-summary-highlight-line-function
3840 'gnus-tree-highlight-article))
3841 ;; If the summary buffer is empty, but there are some low-scored
3842 ;; articles or some excluded dormants, we include these in the
3844 (when (and (zerop (buffer-size))
3846 (cond (gnus-newsgroup-dormant
3847 (gnus-summary-limit-include-dormant))
3848 ((and gnus-newsgroup-scored show-all)
3849 (gnus-summary-limit-include-expunged t))))
3850 ;; Function `gnus-apply-kill-file' must be called in this hook.
3851 (gnus-run-hooks 'gnus-apply-kill-hook)
3852 (if (and (zerop (buffer-size))
3855 ;; This newsgroup is empty.
3856 (gnus-summary-catchup-and-exit nil t)
3857 (gnus-message 6 "No unread news")
3859 (gnus-kill-or-deaden-summary kill-buffer))
3860 ;; Return nil from this function.
3862 ;; Hide conversation thread subtrees. We cannot do this in
3863 ;; gnus-summary-prepare-hook since kill processing may not
3864 ;; work with hidden articles.
3865 (gnus-summary-maybe-hide-threads)
3867 (gnus-kill-or-deaden-summary kill-buffer))
3868 (gnus-summary-auto-select-subject)
3869 ;; Show first unread article if requested.
3870 (if (and (not no-article)
3872 gnus-newsgroup-unreads
3873 gnus-auto-select-first)
3875 (gnus-configure-windows 'summary)
3876 (let ((art (gnus-summary-article-number)))
3877 (unless (and (not gnus-plugged)
3878 (or (memq art gnus-newsgroup-undownloaded)
3879 (memq art gnus-newsgroup-downloadable)))
3880 (gnus-summary-goto-article art))))
3881 ;; Don't select any articles.
3882 (gnus-summary-position-point)
3883 (gnus-configure-windows 'summary 'force)
3884 (gnus-set-mode-line 'summary))
3885 (when (and gnus-auto-center-group
3886 (get-buffer-window gnus-group-buffer t))
3887 ;; Gotta use windows, because recenter does weird stuff if
3888 ;; the current buffer ain't the displayed window.
3889 (let ((owin (selected-window)))
3890 (select-window (get-buffer-window gnus-group-buffer t))
3891 (when (gnus-group-goto-group group)
3893 (select-window owin)))
3894 ;; Mark this buffer as "prepared".
3895 (setq gnus-newsgroup-prepared t)
3896 (gnus-run-hooks 'gnus-summary-prepared-hook)
3897 (unless (gnus-ephemeral-group-p group)
3898 (gnus-group-update-group group))
3901 (defun gnus-summary-auto-select-subject ()
3902 "Select the subject line on initial group entry."
3903 (goto-char (point-min))
3905 ((eq gnus-auto-select-subject 'best)
3906 (gnus-summary-best-unread-subject))
3907 ((eq gnus-auto-select-subject 'unread)
3908 (gnus-summary-first-unread-subject))
3909 ((eq gnus-auto-select-subject 'unseen)
3910 (gnus-summary-first-unseen-subject))
3911 ((eq gnus-auto-select-subject 'unseen-or-unread)
3912 (gnus-summary-first-unseen-or-unread-subject))
3913 ((eq gnus-auto-select-subject 'first)
3916 ((functionp gnus-auto-select-subject)
3917 (funcall gnus-auto-select-subject))))
3919 (defun gnus-summary-prepare ()
3920 "Generate the summary buffer."
3922 (let ((buffer-read-only nil))
3924 (setq gnus-newsgroup-data nil
3925 gnus-newsgroup-data-reverse nil)
3926 (gnus-run-hooks 'gnus-summary-generate-hook)
3927 ;; Generate the buffer, either with threads or without.
3928 (when gnus-newsgroup-headers
3929 (gnus-summary-prepare-threads
3930 (if gnus-show-threads
3931 (gnus-sort-gathered-threads
3932 (funcall gnus-summary-thread-gathering-function
3934 (gnus-cut-threads (gnus-make-threads)))))
3935 ;; Unthreaded display.
3936 (gnus-sort-articles gnus-newsgroup-headers))))
3937 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3938 ;; Call hooks for modifying summary buffer.
3939 (goto-char (point-min))
3940 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3942 (defsubst gnus-general-simplify-subject (subject)
3943 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3946 ;; Truncate the subject.
3947 (gnus-simplify-subject-functions
3948 (gnus-map-function gnus-simplify-subject-functions subject))
3949 ((numberp gnus-summary-gather-subject-limit)
3950 (setq subject (gnus-simplify-subject-re subject))
3951 (if (> (length subject) gnus-summary-gather-subject-limit)
3952 (substring subject 0 gnus-summary-gather-subject-limit)
3954 ;; Fuzzily simplify it.
3955 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3956 (gnus-simplify-subject-fuzzy subject))
3957 ;; Just remove the leading "Re:".
3959 (gnus-simplify-subject-re subject))))
3961 (if (and gnus-summary-gather-exclude-subject
3962 (string-match gnus-summary-gather-exclude-subject subject))
3963 nil ; This article shouldn't be gathered
3966 (defun gnus-summary-simplify-subject-query ()
3967 "Query where the respool algorithm would put this article."
3969 (gnus-summary-select-article)
3970 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3972 (defun gnus-gather-threads-by-subject (threads)
3973 "Gather threads by looking at Subject headers."
3974 (if (not gnus-summary-make-false-root)
3976 (let ((hashtb (gnus-make-hashtable 1024))
3979 subject hthread whole-subject)
3981 (setq subject (gnus-general-simplify-subject
3982 (setq whole-subject (mail-header-subject
3985 (if (setq hthread (gnus-gethash subject hashtb))
3987 ;; We enter a dummy root into the thread, if we
3988 ;; haven't done that already.
3989 (unless (stringp (caar hthread))
3990 (setcar hthread (list whole-subject (car hthread))))
3991 ;; We add this new gathered thread to this gathered
3993 (setcdr (car hthread)
3994 (nconc (cdar hthread) (list (car threads))))
3995 ;; Remove it from the list of threads.
3996 (setcdr prev (cdr threads))
3997 (setq threads prev))
3998 ;; Enter this thread into the hash table.
3999 (gnus-sethash subject
4000 (if gnus-summary-make-false-root-always
4002 ;; If you want a dummy root above all
4004 (setcar threads (list whole-subject
4010 (setq threads (cdr threads)))
4013 (defun gnus-gather-threads-by-references (threads)
4014 "Gather threads by looking at References headers."
4015 (let ((idhashtb (gnus-make-hashtable 1024))
4016 (thhashtb (gnus-make-hashtable 1024))
4019 ids references id gthread gid entered ref)
4021 (when (setq references (mail-header-references (caar threads)))
4022 (setq id (mail-header-id (caar threads))
4023 ids (inline (gnus-split-references references))
4025 (while (setq ref (pop ids))
4026 (setq ids (delete ref ids))
4027 (if (not (setq gid (gnus-gethash ref idhashtb)))
4029 (gnus-sethash ref id idhashtb)
4030 (gnus-sethash id threads thhashtb))
4031 (setq gthread (gnus-gethash gid thhashtb))
4033 ;; We enter a dummy root into the thread, if we
4034 ;; haven't done that already.
4035 (unless (stringp (caar gthread))
4036 (setcar gthread (list (mail-header-subject (caar gthread))
4038 ;; We add this new gathered thread to this gathered
4040 (setcdr (car gthread)
4041 (nconc (cdar gthread) (list (car threads)))))
4042 ;; Add it into the thread hash table.
4043 (gnus-sethash id gthread thhashtb)
4045 ;; Remove it from the list of threads.
4046 (setcdr prev (cdr threads))
4047 (setq threads prev))))
4049 (setq threads (cdr threads)))
4052 (defun gnus-sort-gathered-threads (threads)
4053 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4054 (let ((result threads))
4056 (when (stringp (caar threads))
4057 (setcdr (car threads)
4058 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4059 (setq threads (cdr threads)))
4062 (defun gnus-thread-loop-p (root thread)
4063 "Say whether ROOT is in THREAD."
4064 (let ((stack (list thread))
4067 (while (setq thread (pop stack))
4068 (setq th (cdr thread))
4070 (not (eq (caar th) root)))
4073 ;; We have found a loop.
4075 (setcdr thread (delq (car th) (cdr thread)))
4076 (if (boundp (setq ref-dep (intern "none"
4077 gnus-newsgroup-dependencies)))
4078 (setcdr (symbol-value ref-dep)
4079 (nconc (cdr (symbol-value ref-dep))
4081 (set ref-dep (list nil (car th))))
4084 ;; Push all the subthreads onto the stack.
4085 (push (cdr thread) stack)))
4088 (defun gnus-make-threads ()
4089 "Go through the dependency hashtb and find the roots. Return all threads."
4091 (while (catch 'infloop
4094 ;; Deal with self-referencing References loops.
4095 (when (and (car (symbol-value refs))
4102 (car (symbol-value refs)) thread))
4103 (cdr (symbol-value refs)))))))
4106 (unless (car (symbol-value refs))
4107 ;; These threads do not refer back to any other
4108 ;; articles, so they're roots.
4109 (setq threads (append (cdr (symbol-value refs)) threads))))
4110 gnus-newsgroup-dependencies)))
4113 ;; Build the thread tree.
4114 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4115 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4117 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4118 if it was already present.
4120 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4121 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4122 Message-IDs will be renamed to a unique Message-ID before being
4125 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4126 (let* ((id (mail-header-id header))
4127 (id-dep (and id (intern id dependencies)))
4128 parent-id ref ref-dep ref-header replaced)
4129 ;; Enter this `header' in the `dependencies' table.
4133 ;; The first two cases do the normal part: enter a new `header'
4134 ;; in the `dependencies' table.
4135 ((not (boundp id-dep))
4136 (set id-dep (list header)))
4137 ((null (car (symbol-value id-dep)))
4138 (setcar (symbol-value id-dep) header))
4140 ;; From here the `header' was already present in the
4141 ;; `dependencies' table.
4143 ;; Overrides an existing entry;
4144 ;; just set the header part of the entry.
4145 (setcar (symbol-value id-dep) header)
4148 ;; Renames the existing `header' to a unique Message-ID.
4149 ((not gnus-summary-ignore-duplicates)
4150 ;; An article with this Message-ID has already been seen.
4151 ;; We rename the Message-ID.
4152 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4154 (mail-header-set-id header id))
4156 ;; The last case ignores an existing entry, except it adds any
4157 ;; additional Xrefs (in case the two articles came from different
4159 ;; Also sets `header' to `nil' meaning that the `dependencies'
4160 ;; table was *not* modified.
4162 (mail-header-set-xref
4163 (car (symbol-value id-dep))
4164 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4166 (or (mail-header-xref header) "")))
4169 (when (and header (not replaced))
4170 ;; First check that we are not creating a References loop.
4171 (setq parent-id (gnus-parent-id (mail-header-references header)))
4172 (setq ref parent-id)
4174 (setq ref-dep (intern-soft ref dependencies))
4176 (setq ref-header (car (symbol-value ref-dep))))
4177 (if (string= id ref)
4178 ;; Yuk! This is a reference loop. Make the article be a
4181 (mail-header-set-references (car (symbol-value id-dep)) "none")
4183 (setq parent-id nil))
4184 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4185 (setq ref-dep (intern (or parent-id "none") dependencies))
4186 (if (boundp ref-dep)
4187 (setcdr (symbol-value ref-dep)
4188 (nconc (cdr (symbol-value ref-dep))
4189 (list (symbol-value id-dep))))
4190 (set ref-dep (list nil (symbol-value id-dep)))))
4193 (defun gnus-extract-message-id-from-in-reply-to (string)
4194 (if (string-match "<[^>]+>" string)
4195 (substring string (match-beginning 0) (match-end 0))
4198 (defun gnus-build-sparse-threads ()
4199 (let ((headers gnus-newsgroup-headers)
4200 (mail-parse-charset gnus-newsgroup-charset)
4201 (gnus-summary-ignore-duplicates t)
4202 header references generation relations
4203 subject child end new-child date)
4204 ;; First we create an alist of generations/relations, where
4205 ;; generations is how much we trust the relation, and the relation
4207 (gnus-message 7 "Making sparse threads...")
4209 (nnheader-set-temp-buffer " *gnus sparse threads*")
4210 (while (setq header (pop headers))
4211 (when (and (setq references (mail-header-references header))
4212 (not (string= references "")))
4214 (setq child (mail-header-id header)
4215 subject (mail-header-subject header)
4216 date (mail-header-date header)
4218 (while (search-backward ">" nil t)
4219 (setq end (1+ (point)))
4220 (when (search-backward "<" nil t)
4221 (setq new-child (buffer-substring (point) end))
4222 (push (list (incf generation)
4223 child (setq child new-child)
4227 (push (list (1+ generation) child nil subject) relations))
4229 (kill-buffer (current-buffer)))
4230 ;; Sort over trustworthiness.
4233 (when (gnus-dependencies-add-header
4234 (make-full-mail-header
4235 gnus-reffed-article-number
4236 (nth 3 relation) "" (or (nth 4 relation) "")
4238 (or (nth 2 relation) "") 0 0 "")
4239 gnus-newsgroup-dependencies nil)
4240 (push gnus-reffed-article-number gnus-newsgroup-limit)
4241 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4242 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4243 gnus-newsgroup-reads)
4244 (decf gnus-reffed-article-number)))
4245 (sort relations 'car-less-than-car))
4246 (gnus-message 7 "Making sparse threads...done")))
4248 (defun gnus-build-old-threads ()
4249 ;; Look at all the articles that refer back to old articles, and
4250 ;; fetch the headers for the articles that aren't there. This will
4251 ;; build complete threads - if the roots haven't been expired by the
4253 (let ((mail-parse-charset gnus-newsgroup-charset)
4257 (when (not (car (symbol-value refs)))
4258 (setq heads (cdr (symbol-value refs)))
4260 (if (memq (mail-header-number (caar heads))
4261 gnus-newsgroup-dormant)
4262 (setq heads (cdr heads))
4263 (setq id (symbol-name refs))
4264 (while (and (setq id (gnus-build-get-header id))
4265 (not (car (gnus-id-to-thread id)))))
4266 (setq heads nil)))))
4267 gnus-newsgroup-dependencies)))
4269 (defsubst gnus-remove-odd-characters (string)
4270 "Translate STRING into something that doesn't contain weird characters."
4271 (mm-subst-char-in-string
4273 (mm-subst-char-in-string ?\n ?\- string t) t))
4275 ;; This function has to be called with point after the article number
4276 ;; on the beginning of the line.
4277 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4278 (let ((eol (point-at-eol))
4279 (buffer (current-buffer))
4280 header references in-reply-to)
4282 ;; overview: [num subject from date id refs chars lines misc]
4285 (narrow-to-region (point) eol)
4290 (make-full-mail-header
4292 (condition-case () ; subject
4293 (gnus-remove-odd-characters
4294 (funcall gnus-decode-encoded-word-function
4295 (setq x (nnheader-nov-field))))
4297 (condition-case () ; from
4298 (gnus-remove-odd-characters
4299 (funcall gnus-decode-encoded-address-function
4300 (setq x (nnheader-nov-field))))
4302 (nnheader-nov-field) ; date
4303 (nnheader-nov-read-message-id number) ; id
4304 (setq references (nnheader-nov-field)) ; refs
4305 (nnheader-nov-read-integer) ; chars
4306 (nnheader-nov-read-integer) ; lines
4308 (if (looking-at "Xref: ")
4309 (goto-char (match-end 0)))
4310 (nnheader-nov-field)) ; Xref
4311 (nnheader-nov-parse-extra)))) ; extra
4315 (when (and (string= references "")
4316 (setq in-reply-to (mail-header-extra header))
4317 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4318 (mail-header-set-references
4319 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4321 (when gnus-alter-header-function
4322 (funcall gnus-alter-header-function header))
4323 (gnus-dependencies-add-header header dependencies force-new)))
4325 (defun gnus-build-get-header (id)
4326 "Look through the buffer of NOV lines and find the header to ID.
4327 Enter this line into the dependencies hash table, and return
4328 the id of the parent article (if any)."
4329 (let ((deps gnus-newsgroup-dependencies)
4333 (set-buffer nntp-server-buffer)
4334 (let ((case-fold-search nil))
4335 (goto-char (point-min))
4336 (while (and (not found)
4337 (search-forward id nil t))
4339 (setq found (looking-at
4340 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4341 (regexp-quote id))))
4342 (or found (beginning-of-line 2)))
4346 (setq header (gnus-nov-parse-line
4347 (read (current-buffer)) deps))
4348 (gnus-parent-id (mail-header-references header))))))
4350 (let ((number (mail-header-number header)))
4351 (push number gnus-newsgroup-limit)
4352 (push header gnus-newsgroup-headers)
4353 (if (memq number gnus-newsgroup-unselected)
4355 (setq gnus-newsgroup-unreads
4356 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4358 (setq gnus-newsgroup-unselected
4359 (delq number gnus-newsgroup-unselected)))
4360 (push number gnus-newsgroup-ancient)))))))
4362 (defun gnus-build-all-threads ()
4363 "Read all the headers."
4364 (let ((gnus-summary-ignore-duplicates t)
4365 (mail-parse-charset gnus-newsgroup-charset)
4366 (dependencies gnus-newsgroup-dependencies)
4369 (set-buffer nntp-server-buffer)
4370 (let ((case-fold-search nil))
4371 (goto-char (point-min))
4374 (setq article (read (current-buffer))
4375 header (gnus-nov-parse-line article dependencies)))
4377 (with-current-buffer gnus-summary-buffer
4378 (push header gnus-newsgroup-headers)
4379 (if (memq (setq article (mail-header-number header))
4380 gnus-newsgroup-unselected)
4382 (setq gnus-newsgroup-unreads
4383 (gnus-add-to-sorted-list
4384 gnus-newsgroup-unreads article))
4385 (setq gnus-newsgroup-unselected
4386 (delq article gnus-newsgroup-unselected)))
4387 (push article gnus-newsgroup-ancient)))
4388 (forward-line 1)))))))
4390 (defun gnus-summary-update-article-line (article header)
4391 "Update the line for ARTICLE using HEADER."
4392 (let* ((id (mail-header-id header))
4393 (thread (gnus-id-to-thread id)))
4395 (error "Article in no thread"))
4396 ;; Update the thread.
4397 (setcar thread header)
4398 (gnus-summary-goto-subject article)
4399 (let* ((datal (gnus-data-find-list article))
4401 (buffer-read-only nil)
4402 (level (gnus-summary-thread-level)))
4404 (let ((inserted (- (point)
4406 (gnus-summary-insert-line
4408 (memq article gnus-newsgroup-undownloaded)
4409 (gnus-article-mark article)
4410 (memq article gnus-newsgroup-replied)
4411 (memq article gnus-newsgroup-expirable)
4412 ;; Only insert the Subject string when it's different
4413 ;; from the previous Subject string.
4418 (mail-header-subject
4421 (gnus-data-find-list
4423 (gnus-data-list t)))))
4424 ;; Error on the side of excessive subjects.
4426 (mail-header-subject header)))
4428 (mail-header-subject header))
4429 nil (cdr (assq article gnus-newsgroup-scored))
4430 (memq article gnus-newsgroup-processable))
4433 (gnus-data-update-list
4435 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4437 (defun gnus-summary-update-article (article &optional iheader)
4438 "Update ARTICLE in the summary buffer."
4439 (set-buffer gnus-summary-buffer)
4440 (let* ((header (gnus-summary-article-header article))
4441 (id (mail-header-id header))
4442 (data (gnus-data-find article))
4443 (thread (gnus-id-to-thread id))
4444 (references (mail-header-references header))
4448 (when (and references
4449 (not (equal "" references)))
4452 (buffer-read-only nil)
4458 (delq thread parent)))
4459 (if (gnus-summary-insert-subject id header)
4460 ;; Set the (possibly) new article number in the data structure.
4461 (gnus-data-set-number data (gnus-id-to-article id))
4465 (defun gnus-rebuild-thread (id &optional line)
4466 "Rebuild the thread containing ID.
4467 If LINE, insert the rebuilt thread starting on line LINE."
4468 (let ((buffer-read-only nil)
4469 old-pos current thread data)
4470 (if (not gnus-show-threads)
4471 (setq thread (list (car (gnus-id-to-thread id))))
4472 ;; Get the thread this article is part of.
4473 (setq thread (gnus-remove-thread id)))
4474 (setq old-pos (point-at-bol))
4475 (setq current (save-excursion
4476 (and (re-search-backward "[\r\n]" nil t)
4477 (gnus-summary-article-number))))
4478 ;; If this is a gathered thread, we have to go some re-gathering.
4479 (when (stringp (car thread))
4480 (let ((subject (car thread))
4482 (setq thread (cdr thread))
4484 (unless (memq (setq thr (gnus-id-to-thread
4486 (mail-header-id (caar thread)))))
4489 (setq thread (cdr thread)))
4490 ;; We now have all (unique) roots.
4491 (if (= (length roots) 1)
4492 ;; All the loose roots are now one solid root.
4493 (setq thread (car roots))
4494 (setq thread (cons subject (gnus-sort-threads roots))))))
4496 ;; We then insert this thread into the summary buffer.
4498 (goto-char (point-min))
4499 (forward-line (1- line)))
4500 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4501 (if gnus-show-threads
4502 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4503 (gnus-summary-prepare-unthreaded thread))
4504 (setq data (nreverse gnus-newsgroup-data))
4505 (setq threads gnus-newsgroup-threads))
4506 ;; We splice the new data into the data structure.
4507 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4508 ;;!!! then we want to insert at the beginning of the buffer.
4509 ;;!!! That happens to be true with Gnus now, but that may
4510 ;;!!! change in the future. Perhaps.
4511 (gnus-data-enter-list
4512 (if line nil current) data (- (point) old-pos))
4513 (setq gnus-newsgroup-threads
4514 (nconc threads gnus-newsgroup-threads))
4515 (gnus-data-compute-positions))))
4517 (defun gnus-number-to-header (number)
4518 "Return the header for article NUMBER."
4519 (let ((headers gnus-newsgroup-headers))
4521 (not (= number (mail-header-number (car headers)))))
4526 (defun gnus-parent-headers (in-headers &optional generation)
4527 "Return the headers of the GENERATIONeth parent of HEADERS."
4529 (setq generation 1))
4531 (headers in-headers)
4534 (not (zerop generation))
4535 (setq references (mail-header-references headers)))
4536 (setq headers (if (and references
4537 (setq parent (gnus-parent-id references)))
4538 (car (gnus-id-to-thread parent))
4541 (and (not (eq headers in-headers))
4544 (defun gnus-id-to-thread (id)
4545 "Return the (sub-)thread where ID appears."
4546 (gnus-gethash id gnus-newsgroup-dependencies))
4548 (defun gnus-id-to-article (id)
4549 "Return the article number of ID."
4550 (let ((thread (gnus-id-to-thread id)))
4553 (mail-header-number (car thread)))))
4555 (defun gnus-id-to-header (id)
4556 "Return the article headers of ID."
4557 (car (gnus-id-to-thread id)))
4559 (defun gnus-article-displayed-root-p (article)
4560 "Say whether ARTICLE is a root(ish) article."
4561 (let ((level (gnus-summary-thread-level article))
4562 (refs (mail-header-references (gnus-summary-article-header article)))
4568 ((null (gnus-parent-id refs)) t)
4570 (null (setq particle (gnus-id-to-article
4571 (gnus-parent-id refs))))
4572 (null (gnus-summary-thread-level particle)))))))
4574 (defun gnus-root-id (id)
4575 "Return the id of the root of the thread where ID appears."
4577 (while (and id (setq prev (car (gnus-id-to-thread id))))
4579 id (gnus-parent-id (mail-header-references prev))))
4582 (defun gnus-articles-in-thread (thread)
4583 "Return the list of articles in THREAD."
4584 (cons (mail-header-number (car thread))
4585 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4587 (defun gnus-remove-thread (id &optional dont-remove)
4588 "Remove the thread that has ID in it."
4589 (let (headers thread last-id)
4590 ;; First go up in this thread until we find the root.
4591 (setq last-id (gnus-root-id id)
4592 headers (message-flatten-list (gnus-id-to-thread last-id)))
4593 ;; We have now found the real root of this thread. It might have
4594 ;; been gathered into some loose thread, so we have to search
4595 ;; through the threads to find the thread we wanted.
4596 (let ((threads gnus-newsgroup-threads)
4599 (setq sub (car threads))
4600 (if (stringp (car sub))
4601 ;; This is a gathered thread, so we look at the roots
4602 ;; below it to find whether this article is in this
4605 (setq sub (cdr sub))
4607 (when (member (caar sub) headers)
4608 (setq thread (car threads)
4611 (setq sub (cdr sub))))
4612 ;; It's an ordinary thread, so we check it.
4613 (when (eq (car sub) (car headers))
4616 (setq threads (cdr threads)))
4617 ;; If this article is in no thread, then it's a root.
4620 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4621 (setq thread (gnus-id-to-thread last-id)))
4624 thread ; We return this thread.
4626 (if (stringp (car thread))
4628 ;; If we use dummy roots, then we have to remove the
4629 ;; dummy root as well.
4630 (when (eq gnus-summary-make-false-root 'dummy)
4631 ;; We go to the dummy root by going to
4632 ;; the first sub-"thread", and then one line up.
4633 (gnus-summary-goto-article
4634 (mail-header-number (caadr thread)))
4637 (gnus-data-compute-positions))
4638 (setq thread (cdr thread))
4640 (gnus-remove-thread-1 (car thread))
4641 (setq thread (cdr thread))))
4642 (gnus-remove-thread-1 thread))))))))
4644 (defun gnus-remove-thread-1 (thread)
4645 "Remove the thread THREAD recursively."
4646 (let ((number (mail-header-number (pop thread)))
4648 (setq thread (reverse thread))
4650 (gnus-remove-thread-1 (pop thread)))
4651 (when (setq d (gnus-data-find number))
4652 (goto-char (gnus-data-pos d))
4653 (gnus-summary-show-thread)
4659 (gnus-delete-line)))))))
4661 (defun gnus-sort-threads-recursive (threads func)
4662 (sort (mapcar (lambda (thread)
4665 (gnus-sort-threads-recursive (cdr thread) func))))
4668 (defun gnus-sort-threads-loop (threads func)
4669 (let* ((superthread (cons nil threads))
4670 (stack (list (cons superthread threads)))
4671 remaining-threads thread)
4673 (setq remaining-threads (cdr (car stack)))
4674 (if remaining-threads
4675 (progn (setq thread (car remaining-threads))
4676 (setcdr (car stack) (cdr remaining-threads))
4678 (push (cons thread (cdr thread)) stack)))
4679 (setq thread (caar stack))
4680 (setcdr thread (sort (cdr thread) func))
4684 (defun gnus-sort-threads (threads)
4686 (if (not gnus-thread-sort-functions)
4688 (gnus-message 8 "Sorting threads...")
4691 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4692 (gnus-sort-threads-recursive
4693 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4694 ;; Even after binding max-lisp-eval-depth, the recursive
4695 ;; sorter might fail for very long threads. In that case,
4696 ;; try using a (less well-tested) non-recursive sorter.
4697 (error (gnus-sort-threads-loop
4698 threads (gnus-make-sort-function
4699 gnus-thread-sort-functions))))
4700 (gnus-message 8 "Sorting threads...done"))))
4702 (defun gnus-sort-articles (articles)
4704 (when gnus-article-sort-functions
4705 (gnus-message 7 "Sorting articles...")
4707 (setq gnus-newsgroup-headers
4708 (sort articles (gnus-make-sort-function
4709 gnus-article-sort-functions)))
4710 (gnus-message 7 "Sorting articles...done"))))
4712 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4713 (defmacro gnus-thread-header (thread)
4714 "Return header of first article in THREAD.
4715 Note that THREAD must never, ever be anything else than a variable -
4716 using some other form will lead to serious barfage."
4717 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4718 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4719 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4722 (defsubst gnus-article-sort-by-number (h1 h2)
4723 "Sort articles by article number."
4724 (< (mail-header-number h1)
4725 (mail-header-number h2)))
4727 (defun gnus-thread-sort-by-number (h1 h2)
4728 "Sort threads by root article number."
4729 (gnus-article-sort-by-number
4730 (gnus-thread-header h1) (gnus-thread-header h2)))
4732 (defsubst gnus-article-sort-by-random (h1 h2)
4733 "Sort articles by article number."
4736 (defun gnus-thread-sort-by-random (h1 h2)
4737 "Sort threads by root article number."
4738 (gnus-article-sort-by-random
4739 (gnus-thread-header h1) (gnus-thread-header h2)))
4741 (defsubst gnus-article-sort-by-lines (h1 h2)
4742 "Sort articles by article Lines header."
4743 (< (mail-header-lines h1)
4744 (mail-header-lines h2)))
4746 (defun gnus-thread-sort-by-lines (h1 h2)
4747 "Sort threads by root article Lines header."
4748 (gnus-article-sort-by-lines
4749 (gnus-thread-header h1) (gnus-thread-header h2)))
4751 (defsubst gnus-article-sort-by-chars (h1 h2)
4752 "Sort articles by octet length."
4753 (< (mail-header-chars h1)
4754 (mail-header-chars h2)))
4756 (defun gnus-thread-sort-by-chars (h1 h2)
4757 "Sort threads by root article octet length."
4758 (gnus-article-sort-by-chars
4759 (gnus-thread-header h1) (gnus-thread-header h2)))
4761 (defsubst gnus-article-sort-by-author (h1 h2)
4762 "Sort articles by root author."
4764 (let ((extract (funcall
4765 gnus-extract-address-components
4766 (mail-header-from h1))))
4767 (or (car extract) (cadr extract) ""))
4768 (let ((extract (funcall
4769 gnus-extract-address-components
4770 (mail-header-from h2))))
4771 (or (car extract) (cadr extract) ""))))
4773 (defun gnus-thread-sort-by-author (h1 h2)
4774 "Sort threads by root author."
4775 (gnus-article-sort-by-author
4776 (gnus-thread-header h1) (gnus-thread-header h2)))
4778 (defsubst gnus-article-sort-by-recipient (h1 h2)
4779 "Sort articles by recipient."
4781 (let ((extract (funcall
4782 gnus-extract-address-components
4783 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4784 (or (car extract) (cadr extract)))
4785 (let ((extract (funcall
4786 gnus-extract-address-components
4787 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4788 (or (car extract) (cadr extract)))))
4790 (defun gnus-thread-sort-by-recipient (h1 h2)
4791 "Sort threads by root recipient."
4792 (gnus-article-sort-by-recipient
4793 (gnus-thread-header h1) (gnus-thread-header h2)))
4795 (defsubst gnus-article-sort-by-subject (h1 h2)
4796 "Sort articles by root subject."
4798 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4799 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4801 (defun gnus-thread-sort-by-subject (h1 h2)
4802 "Sort threads by root subject."
4803 (gnus-article-sort-by-subject
4804 (gnus-thread-header h1) (gnus-thread-header h2)))
4806 (defsubst gnus-article-sort-by-date (h1 h2)
4807 "Sort articles by root article date."
4809 (gnus-date-get-time (mail-header-date h1))
4810 (gnus-date-get-time (mail-header-date h2))))
4812 (defun gnus-thread-sort-by-date (h1 h2)
4813 "Sort threads by root article date."
4814 (gnus-article-sort-by-date
4815 (gnus-thread-header h1) (gnus-thread-header h2)))
4817 (defsubst gnus-article-sort-by-score (h1 h2)
4818 "Sort articles by root article score.
4819 Unscored articles will be counted as having a score of zero."
4820 (> (or (cdr (assq (mail-header-number h1)
4821 gnus-newsgroup-scored))
4822 gnus-summary-default-score 0)
4823 (or (cdr (assq (mail-header-number h2)
4824 gnus-newsgroup-scored))
4825 gnus-summary-default-score 0)))
4827 (defun gnus-thread-sort-by-score (h1 h2)
4828 "Sort threads by root article score."
4829 (gnus-article-sort-by-score
4830 (gnus-thread-header h1) (gnus-thread-header h2)))
4832 (defun gnus-thread-sort-by-total-score (h1 h2)
4833 "Sort threads by the sum of all scores in the thread.
4834 Unscored articles will be counted as having a score of zero."
4835 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4837 (defun gnus-thread-total-score (thread)
4838 ;; This function find the total score of THREAD.
4843 (if (stringp (car thread))
4844 (apply gnus-thread-score-function 0
4845 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4846 (gnus-thread-total-score-1 thread)))
4848 (gnus-thread-total-score-1 (list thread)))))
4850 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4851 "Sort threads such that the thread with the most recently arrived article comes first."
4852 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4854 (defun gnus-thread-highest-number (thread)
4855 "Return the highest article number in THREAD."
4856 (apply 'max (mapcar (lambda (header)
4857 (mail-header-number header))
4858 (message-flatten-list thread))))
4860 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4861 "Sort threads such that the thread with the most recently dated article comes first."
4862 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4864 (defun gnus-thread-latest-date (thread)
4865 "Return the highest article date in THREAD."
4866 (let ((previous-time 0))
4872 (time-to-seconds (mail-header-parse-date
4873 (mail-header-date header)))
4874 (error previous-time))))
4876 (message-flatten-list thread)
4878 (< (mail-header-number h1)
4879 (mail-header-number h2))))))))
4881 (defun gnus-thread-total-score-1 (root)
4882 ;; This function find the total score of the thread below ROOT.
4883 (setq root (car root))
4884 (apply gnus-thread-score-function
4886 (mapcar 'gnus-thread-total-score
4887 (cdr (gnus-id-to-thread (mail-header-id root))))
4888 (when (> (mail-header-number root) 0)
4889 (list (or (cdr (assq (mail-header-number root)
4890 gnus-newsgroup-scored))
4891 gnus-summary-default-score 0))))
4892 (list gnus-summary-default-score)
4895 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4896 (defvar gnus-tmp-prev-subject nil)
4897 (defvar gnus-tmp-false-parent nil)
4898 (defvar gnus-tmp-root-expunged nil)
4899 (defvar gnus-tmp-dummy-line nil)
4901 (eval-when-compile (defvar gnus-tmp-header))
4902 (defun gnus-extra-header (type &optional header)
4903 "Return the extra header of TYPE."
4904 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4907 (defvar gnus-tmp-thread-tree-header-string "")
4909 (defcustom gnus-sum-thread-tree-root "> "
4910 "With %B spec, used for the root of a thread.
4911 If nil, use subject instead."
4913 :type '(radio (const :format "%v " nil) string)
4914 :group 'gnus-thread)
4916 (defcustom gnus-sum-thread-tree-false-root "> "
4917 "With %B spec, used for a false root of a thread.
4918 If nil, use subject instead."
4920 :type '(radio (const :format "%v " nil) string)
4921 :group 'gnus-thread)
4923 (defcustom gnus-sum-thread-tree-single-indent ""
4924 "With %B spec, used for a thread with just one message.
4925 If nil, use subject instead."
4927 :type '(radio (const :format "%v " nil) string)
4928 :group 'gnus-thread)
4930 (defcustom gnus-sum-thread-tree-vertical "| "
4931 "With %B spec, used for drawing a vertical line."
4934 :group 'gnus-thread)
4936 (defcustom gnus-sum-thread-tree-indent " "
4937 "With %B spec, used for indenting."
4940 :group 'gnus-thread)
4942 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4943 "With %B spec, used for a leaf with brothers."
4946 :group 'gnus-thread)
4948 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4949 "With %B spec, used for a leaf without brothers."
4952 :group 'gnus-thread)
4954 (defun gnus-summary-prepare-threads (threads)
4955 "Prepare summary buffer from THREADS and indentation LEVEL.
4956 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4957 or a straight list of headers."
4958 (gnus-message 7 "Generating summary...")
4960 (setq gnus-newsgroup-threads threads)
4963 (let ((gnus-tmp-level 0)
4964 (default-score (or gnus-summary-default-score 0))
4965 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4966 (building-line-count gnus-summary-display-while-building)
4967 (building-count (integerp gnus-summary-display-while-building))
4968 thread number subject stack state gnus-tmp-gathered beg-match
4969 new-roots gnus-tmp-new-adopts thread-end simp-subject
4970 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4971 gnus-tmp-replied gnus-tmp-subject-or-nil
4972 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4973 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4974 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4977 (setq gnus-tmp-prev-subject nil
4978 gnus-tmp-thread-tree-header-string "")
4980 (if (vectorp (car threads))
4981 ;; If this is a straight (sic) list of headers, then a
4982 ;; threaded summary display isn't required, so we just create
4983 ;; an unthreaded one.
4984 (gnus-summary-prepare-unthreaded threads)
4986 ;; Do the threaded display.
4988 (if gnus-summary-display-while-building
4989 (switch-to-buffer (buffer-name)))
4990 (while (or threads stack gnus-tmp-new-adopts new-roots)
4992 (if (and (= gnus-tmp-level 0)
4995 (not gnus-tmp-false-parent)
4996 (or gnus-tmp-new-adopts new-roots))
4997 (if gnus-tmp-new-adopts
4998 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4999 thread (list (car gnus-tmp-new-adopts))
5000 gnus-tmp-header (caar thread)
5001 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5003 (setq thread (list (car new-roots))
5004 gnus-tmp-header (caar thread)
5005 new-roots (cdr new-roots))))
5008 ;; If there are some threads, we do them before the
5009 ;; threads on the stack.
5010 (setq thread threads
5011 gnus-tmp-header (caar thread))
5012 ;; There were no current threads, so we pop something off
5014 (setq state (car stack)
5015 gnus-tmp-level (car state)
5016 tree-stack (cadr state)
5017 thread (caddr state)
5019 gnus-tmp-header (caar thread))))
5021 (setq gnus-tmp-false-parent nil)
5022 (setq gnus-tmp-root-expunged nil)
5023 (setq thread-end nil)
5025 (if (stringp gnus-tmp-header)
5026 ;; The header is a dummy root.
5028 ((eq gnus-summary-make-false-root 'adopt)
5029 ;; We let the first article adopt the rest.
5030 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5032 (setq gnus-tmp-gathered
5034 (lambda (h) (mail-header-number (car h)))
5037 (setq thread (cons (list (caar thread)
5040 (setq gnus-tmp-level -1
5041 gnus-tmp-false-parent t))
5042 ((eq gnus-summary-make-false-root 'empty)
5043 ;; We print adopted articles with empty subject fields.
5044 (setq gnus-tmp-gathered
5046 (lambda (h) (mail-header-number (car h)))
5049 (setq gnus-tmp-level -1))
5050 ((eq gnus-summary-make-false-root 'dummy)
5051 ;; We remember that we probably want to output a dummy
5053 (setq gnus-tmp-dummy-line gnus-tmp-header)
5054 (setq gnus-tmp-prev-subject gnus-tmp-header))
5056 ;; We do not make a root for the gathered
5057 ;; sub-threads at all.
5058 (setq gnus-tmp-level -1)))
5060 (setq number (mail-header-number gnus-tmp-header)
5061 subject (mail-header-subject gnus-tmp-header)
5062 simp-subject (gnus-simplify-subject-fully subject))
5065 ;; If the thread has changed subject, we might want to make
5066 ;; this subthread into a root.
5067 ((and (null gnus-thread-ignore-subject)
5068 (not (zerop gnus-tmp-level))
5069 gnus-tmp-prev-subject
5070 (not (string= gnus-tmp-prev-subject simp-subject)))
5071 (setq new-roots (nconc new-roots (list (car thread)))
5073 gnus-tmp-header nil))
5074 ;; If the article lies outside the current limit,
5075 ;; then we do not display it.
5076 ((not (memq number gnus-newsgroup-limit))
5077 (setq gnus-tmp-gathered
5079 (lambda (h) (mail-header-number (car h)))
5082 (setq gnus-tmp-new-adopts (if (cdar thread)
5083 (append gnus-tmp-new-adopts
5085 gnus-tmp-new-adopts)
5087 gnus-tmp-header nil)
5088 (when (zerop gnus-tmp-level)
5089 (setq gnus-tmp-root-expunged t)))
5090 ;; Perhaps this article is to be marked as read?
5091 ((and gnus-summary-mark-below
5092 (< (or (cdr (assq number gnus-newsgroup-scored))
5094 gnus-summary-mark-below)
5095 ;; Don't touch sparse articles.
5096 (not (gnus-summary-article-sparse-p number))
5097 (not (gnus-summary-article-ancient-p number)))
5098 (setq gnus-newsgroup-unreads
5099 (delq number gnus-newsgroup-unreads))
5100 (if gnus-newsgroup-auto-expire
5101 (setq gnus-newsgroup-expirable
5102 (gnus-add-to-sorted-list
5103 gnus-newsgroup-expirable number))
5104 (push (cons number gnus-low-score-mark)
5105 gnus-newsgroup-reads))))
5107 (when gnus-tmp-header
5108 ;; We may have an old dummy line to output before this
5110 (when (and gnus-tmp-dummy-line
5113 (mail-header-subject gnus-tmp-header)))
5114 (gnus-summary-insert-dummy-line
5115 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5116 (setq gnus-tmp-dummy-line nil))
5118 ;; Compute the mark.
5119 (setq gnus-tmp-unread (gnus-article-mark number))
5121 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5122 gnus-tmp-header gnus-tmp-level)
5123 gnus-newsgroup-data)
5125 ;; Actually insert the line.
5127 gnus-tmp-subject-or-nil
5129 ((and gnus-thread-ignore-subject
5130 gnus-tmp-prev-subject
5131 (not (string= gnus-tmp-prev-subject simp-subject)))
5133 ((zerop gnus-tmp-level)
5134 (if (and (eq gnus-summary-make-false-root 'empty)
5135 (memq number gnus-tmp-gathered)
5136 gnus-tmp-prev-subject
5137 (string= gnus-tmp-prev-subject simp-subject))
5138 gnus-summary-same-subject
5140 (t gnus-summary-same-subject)))
5141 (if (and (eq gnus-summary-make-false-root 'adopt)
5142 (= gnus-tmp-level 1)
5143 (memq number gnus-tmp-gathered))
5144 (setq gnus-tmp-opening-bracket ?\<
5145 gnus-tmp-closing-bracket ?\>)
5146 (setq gnus-tmp-opening-bracket ?\[
5147 gnus-tmp-closing-bracket ?\]))
5148 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5149 (gnus-make-thread-indent-array
5150 (max (* 2 (length gnus-thread-indent-array))
5153 gnus-tmp-indentation
5154 (aref gnus-thread-indent-array gnus-tmp-level)
5155 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5156 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5157 gnus-summary-default-score 0)
5159 (if (or (null gnus-summary-default-score)
5160 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5161 gnus-summary-zcore-fuzz))
5163 (if (< gnus-tmp-score gnus-summary-default-score)
5164 gnus-score-below-mark gnus-score-over-mark))
5166 (cond ((memq number gnus-newsgroup-processable)
5168 ((memq number gnus-newsgroup-cached)
5170 ((memq number gnus-newsgroup-replied)
5172 ((memq number gnus-newsgroup-forwarded)
5173 gnus-forwarded-mark)
5174 ((memq number gnus-newsgroup-saved)
5176 ((memq number gnus-newsgroup-recent)
5178 ((memq number gnus-newsgroup-unseen)
5182 (cond ((memq number gnus-newsgroup-undownloaded)
5183 gnus-undownloaded-mark)
5184 (gnus-newsgroup-agentized
5185 gnus-downloaded-mark)
5188 gnus-tmp-from (mail-header-from gnus-tmp-header)
5191 ((string-match "<[^>]+> *$" gnus-tmp-from)
5192 (setq beg-match (match-beginning 0))
5193 (or (and (string-match "^\".+\"" gnus-tmp-from)
5194 (substring gnus-tmp-from 1 (1- (match-end 0))))
5195 (substring gnus-tmp-from 0 beg-match)))
5196 ((string-match "(.+)" gnus-tmp-from)
5197 (substring gnus-tmp-from
5198 (1+ (match-beginning 0)) (1- (match-end 0))))
5202 gnus-tmp-thread-tree-header-string
5204 ((not gnus-show-threads) "")
5205 ((zerop gnus-tmp-level)
5206 (cond ((cdar thread)
5207 (or gnus-sum-thread-tree-root subject))
5208 (gnus-tmp-new-adopts
5209 (or gnus-sum-thread-tree-false-root subject))
5211 (or gnus-sum-thread-tree-single-indent subject))))
5213 (concat (apply 'concat
5214 (mapcar (lambda (item)
5216 gnus-sum-thread-tree-vertical
5217 gnus-sum-thread-tree-indent))
5218 (cdr (reverse tree-stack))))
5220 gnus-sum-thread-tree-leaf-with-other
5221 gnus-sum-thread-tree-single-leaf)))))
5222 (when (string= gnus-tmp-name "")
5223 (setq gnus-tmp-name gnus-tmp-from))
5224 (unless (numberp gnus-tmp-lines)
5225 (setq gnus-tmp-lines -1))
5226 (if (= gnus-tmp-lines -1)
5227 (setq gnus-tmp-lines "?")
5228 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5229 (gnus-put-text-property
5231 (progn (eval gnus-summary-line-format-spec) (point))
5232 'gnus-number number)
5235 (gnus-run-hooks 'gnus-summary-update-hook)
5238 (setq gnus-tmp-prev-subject simp-subject)))
5240 (when (nth 1 thread)
5241 (push (list (max 0 gnus-tmp-level)
5242 (copy-sequence tree-stack)
5245 (push (if (nth 1 thread) 1 0) tree-stack)
5246 (incf gnus-tmp-level)
5247 (setq threads (if thread-end nil (cdar thread)))
5248 (if gnus-summary-display-while-building
5251 ;; use a set frequency
5252 (setq building-line-count (1- building-line-count))
5253 (when (= building-line-count 0)
5255 (setq building-line-count
5256 gnus-summary-display-while-building)))
5260 (setq gnus-tmp-level 0)))))
5261 (gnus-message 7 "Generating summary...done"))
5263 (defun gnus-summary-prepare-unthreaded (headers)
5264 "Generate an unthreaded summary buffer based on HEADERS."
5265 (let (header number mark)
5270 ;; We may have to root out some bad articles...
5271 (when (memq (setq number (mail-header-number
5272 (setq header (pop headers))))
5273 gnus-newsgroup-limit)
5274 ;; Mark article as read when it has a low score.
5275 (when (and gnus-summary-mark-below
5276 (< (or (cdr (assq number gnus-newsgroup-scored))
5277 gnus-summary-default-score 0)
5278 gnus-summary-mark-below)
5279 (not (gnus-summary-article-ancient-p number)))
5280 (setq gnus-newsgroup-unreads
5281 (delq number gnus-newsgroup-unreads))
5282 (if gnus-newsgroup-auto-expire
5283 (push number gnus-newsgroup-expirable)
5284 (push (cons number gnus-low-score-mark)
5285 gnus-newsgroup-reads)))
5287 (setq mark (gnus-article-mark number))
5288 (push (gnus-data-make number mark (1+ (point)) header 0)
5289 gnus-newsgroup-data)
5290 (gnus-summary-insert-line
5292 (memq number gnus-newsgroup-undownloaded)
5293 mark (memq number gnus-newsgroup-replied)
5294 (memq number gnus-newsgroup-expirable)
5295 (mail-header-subject header) nil
5296 (cdr (assq number gnus-newsgroup-scored))
5297 (memq number gnus-newsgroup-processable))))))
5299 (defun gnus-summary-remove-list-identifiers ()
5300 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5301 (let ((regexp (if (consp gnus-list-identifiers)
5302 (mapconcat 'identity gnus-list-identifiers " *\\|")
5303 gnus-list-identifiers))
5306 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5307 (dolist (header gnus-newsgroup-headers)
5308 (setq subject (mail-header-subject header)
5310 (while (string-match regexp subject)
5312 (concat (substring subject 0 (match-beginning 1))
5313 (substring subject (match-end 0)))
5316 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5318 (concat (substring subject 0 (match-beginning 1))
5319 (substring subject (match-end 1)))))
5320 (mail-header-set-subject header subject))))))
5322 (defun gnus-fetch-headers (articles)
5323 "Fetch headers of ARTICLES."
5324 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5325 (gnus-message 5 "Fetching headers for %s..." name)
5328 (setq gnus-headers-retrieved-by
5329 (gnus-retrieve-headers
5330 articles gnus-newsgroup-name
5331 ;; We might want to fetch old headers, but
5332 ;; not if there is only 1 article.
5334 (not (eq gnus-fetch-old-headers 'some))
5335 (not (numberp gnus-fetch-old-headers)))
5336 (> (length articles) 1))
5337 gnus-fetch-old-headers))))
5338 (gnus-get-newsgroup-headers-xover
5339 articles nil nil gnus-newsgroup-name t)
5340 (gnus-get-newsgroup-headers))
5341 (gnus-message 5 "Fetching headers for %s...done" name))))
5343 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5344 "Select newsgroup GROUP.
5345 If READ-ALL is non-nil, all articles in the group are selected.
5346 If SELECT-ARTICLES, only select those articles from GROUP."
5347 (let* ((entry (gnus-group-entry group))
5348 ;;!!! Dirty hack; should be removed.
5349 (gnus-summary-ignore-duplicates
5350 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5352 gnus-summary-ignore-duplicates))
5353 (info (nth 2 entry))
5354 articles fetched-articles cached)
5356 (unless (gnus-check-server
5357 (set (make-local-variable 'gnus-current-select-method)
5358 (gnus-find-method-for-group group)))
5359 (error "Couldn't open server"))
5361 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5362 (gnus-activate-group group) ; Or we can activate it...
5363 (progn ; Or we bug out.
5364 (when (equal major-mode 'gnus-summary-mode)
5365 (gnus-kill-buffer (current-buffer)))
5366 (error "Couldn't activate group %s: %s"
5367 (gnus-group-decoded-name group) (gnus-status-message group))))
5369 (unless (gnus-request-group group t)
5370 (when (equal major-mode 'gnus-summary-mode)
5371 (gnus-kill-buffer (current-buffer)))
5372 (error "Couldn't request group %s: %s"
5373 (gnus-group-decoded-name group) (gnus-status-message group)))
5376 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5378 (setq gnus-summary-use-undownloaded-faces
5379 (gnus-agent-find-parameter
5381 'agent-enable-undownloaded-faces)))
5383 (setq gnus-newsgroup-name group
5384 gnus-newsgroup-unselected nil
5385 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5387 (let ((display (gnus-group-find-parameter group 'display)))
5388 (setq gnus-newsgroup-display
5390 ((not (zerop (or (car-safe read-all) 0)))
5391 ;; The user entered the group with C-u SPC/RET, let's show
5397 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5399 ;; The following is probably the "correct" solution, but
5400 ;; it makes Gnus fetch all headers and then limit the
5401 ;; articles (which is slow), so instead we hack the
5402 ;; select-articles parameter instead. -- Simon Josefsson
5405 ;; (gnus-byte-compile
5406 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5408 (setq select-articles
5409 (gnus-uncompress-range
5410 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5414 (cdr (gnus-active group)))))
5419 (gnus-summary-setup-default-charset)
5421 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5422 (when (gnus-virtual-group-p group)
5423 (setq cached gnus-newsgroup-cached))
5425 (setq gnus-newsgroup-unreads
5426 (gnus-sorted-ndifference
5427 (gnus-sorted-ndifference gnus-newsgroup-unreads
5428 gnus-newsgroup-marked)
5429 gnus-newsgroup-dormant))
5431 (setq gnus-newsgroup-processable nil)
5433 (gnus-update-read-articles group gnus-newsgroup-unreads)
5435 ;; Adjust and set lists of article marks.
5437 (gnus-adjust-marked-articles info))
5438 (if (setq articles select-articles)
5439 (setq gnus-newsgroup-unselected
5440 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5441 (setq articles (gnus-articles-to-read group read-all)))
5445 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5447 ((eq articles 0) nil)
5449 ;; Init the dependencies hash table.
5450 (setq gnus-newsgroup-dependencies
5451 (gnus-make-hashtable (length articles)))
5452 (gnus-set-global-variables)
5453 ;; Retrieve the headers and read them in.
5455 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5457 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5459 (setq gnus-newsgroup-cached cached))
5461 ;; Suppress duplicates?
5462 (when gnus-suppress-duplicates
5463 (gnus-dup-suppress-articles))
5465 ;; Set the initial limit.
5466 (setq gnus-newsgroup-limit (copy-sequence articles))
5467 ;; Remove canceled articles from the list of unread articles.
5468 (setq fetched-articles
5469 (mapcar (lambda (headers) (mail-header-number headers))
5470 gnus-newsgroup-headers))
5471 (setq gnus-newsgroup-articles fetched-articles)
5472 (setq gnus-newsgroup-unreads
5473 (gnus-sorted-nintersection
5474 gnus-newsgroup-unreads fetched-articles))
5475 (gnus-compute-unseen-list)
5477 ;; Removed marked articles that do not exist.
5478 (gnus-update-missing-marks
5479 (gnus-sorted-difference articles fetched-articles))
5480 ;; We might want to build some more threads first.
5481 (when (and gnus-fetch-old-headers
5482 (eq gnus-headers-retrieved-by 'nov))
5483 (if (eq gnus-fetch-old-headers 'invisible)
5484 (gnus-build-all-threads)
5485 (gnus-build-old-threads)))
5486 ;; Let the Gnus agent mark articles as read.
5488 (gnus-agent-get-undownloaded-list))
5489 ;; Remove list identifiers from subject
5490 (when gnus-list-identifiers
5491 (gnus-summary-remove-list-identifiers))
5492 ;; Check whether auto-expire is to be done in this group.
5493 (setq gnus-newsgroup-auto-expire
5494 (gnus-group-auto-expirable-p group))
5495 ;; Set up the article buffer now, if necessary.
5496 (unless (and gnus-single-article-buffer
5497 (equal gnus-article-buffer "*Article*"))
5498 (gnus-article-setup-buffer))
5499 ;; First and last article in this newsgroup.
5500 (when gnus-newsgroup-headers
5501 (setq gnus-newsgroup-begin
5502 (mail-header-number (car gnus-newsgroup-headers))
5505 (gnus-last-element gnus-newsgroup-headers))))
5506 ;; GROUP is successfully selected.
5507 (or gnus-newsgroup-headers t)))))
5509 (defun gnus-compute-unseen-list ()
5510 ;; The `seen' marks are treated specially.
5511 (if (not gnus-newsgroup-seen)
5512 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5513 (setq gnus-newsgroup-unseen
5514 (gnus-inverse-list-range-intersection
5515 gnus-newsgroup-articles gnus-newsgroup-seen))))
5517 (defun gnus-summary-display-make-predicate (display)
5518 (require 'gnus-agent)
5519 (when (= (length display) 1)
5520 (setq display (car display)))
5521 (unless gnus-summary-display-cache
5522 (dolist (elem (append '((unread . unread)
5525 gnus-article-mark-lists))
5526 (push (cons (cdr elem)
5528 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5529 gnus-summary-display-cache)))
5530 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5531 (gnus-category-predicate-cache gnus-summary-display-cache))
5532 (gnus-get-predicate display)))
5534 ;; Uses the dynamically bound `number' variable.
5537 (defun gnus-article-marked-p (type &optional article)
5538 (let ((article (or article number)))
5541 (memq article gnus-newsgroup-marked))
5543 (memq article gnus-newsgroup-spam-marked))
5545 (memq article gnus-newsgroup-unsendable))
5546 ((eq type 'undownload)
5547 (memq article gnus-newsgroup-undownloaded))
5548 ((eq type 'download)
5549 (memq article gnus-newsgroup-downloadable))
5551 (memq article gnus-newsgroup-unreads))
5553 (memq article gnus-newsgroup-reads))
5555 (memq article gnus-newsgroup-dormant) )
5557 (memq article gnus-newsgroup-expirable))
5559 (memq article gnus-newsgroup-replied))
5561 (memq article gnus-newsgroup-killed))
5562 ((eq type 'bookmark)
5563 (assq article gnus-newsgroup-bookmarks))
5565 (assq article gnus-newsgroup-scored))
5567 (memq article gnus-newsgroup-saved))
5569 (memq article gnus-newsgroup-cached))
5571 (memq article gnus-newsgroup-forwarded))
5573 (not (memq article gnus-newsgroup-unseen)))
5575 (memq article gnus-newsgroup-recent))
5578 (defun gnus-articles-to-read (group &optional read-all)
5579 "Find out what articles the user wants to read."
5581 ;; Select all articles if `read-all' is non-nil, or if there
5582 ;; are no unread articles.
5584 (and (zerop (length gnus-newsgroup-marked))
5585 (zerop (length gnus-newsgroup-unreads)))
5586 ;; Fetch all if the predicate is non-nil.
5587 gnus-newsgroup-display)
5588 ;; We want to select the headers for all the articles in
5589 ;; the group, so we select either all the active
5590 ;; articles in the group, or (if that's nil), the
5591 ;; articles in the cache.
5593 (gnus-uncompress-range (gnus-active group))
5594 (gnus-cache-articles-in-group group))
5595 ;; Select only the "normal" subset of articles.
5597 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5598 gnus-newsgroup-unreads)))
5599 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5600 (scored (length scored-list))
5601 (number (length articles))
5602 (marked (+ (length gnus-newsgroup-marked)
5603 (length gnus-newsgroup-dormant)))
5608 ((numberp gnus-newsgroup-display)
5609 gnus-newsgroup-display)
5613 ((and (or (<= scored marked) (= scored number))
5614 (numberp gnus-large-newsgroup)
5615 (> number gnus-large-newsgroup))
5616 (let* ((cursor-in-echo-area nil)
5617 (initial (gnus-parameter-large-newsgroup-initial
5618 gnus-newsgroup-name))
5622 "How many articles from %s (%s %d): "
5624 (gnus-group-decoded-name gnus-newsgroup-name)
5626 (if initial "max" "default")
5629 (cons (number-to-string initial)
5631 (if (string-match "^[ \t]*$" input) number input)))
5632 ((and (> scored marked) (< scored number)
5633 (> (- scored number) 20))
5636 (format "%s %s (%d scored, %d total): "
5637 "How many articles from"
5638 (gnus-group-decoded-name group)
5640 (if (string-match "^[ \t]*$" input)
5644 (message "Quit getting the articles to read")
5646 (setq select (if (stringp select) (string-to-number select) select))
5647 (if (or (null select) (zerop select))
5649 (if (and (not (zerop scored)) (<= (abs select) scored))
5651 (setq articles (sort scored-list '<))
5652 (setq number (length articles)))
5653 (setq articles (copy-sequence articles)))
5655 (when (< (abs select) number)
5657 ;; Select the N oldest articles.
5658 (setcdr (nthcdr (1- (abs select)) articles) nil)
5659 ;; Select the N most recent articles.
5660 (setq articles (nthcdr (- number select) articles))))
5661 (setq gnus-newsgroup-unselected
5662 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5663 (when gnus-alter-articles-to-read-function
5666 (funcall gnus-alter-articles-to-read-function
5667 gnus-newsgroup-name articles)
5671 (defun gnus-killed-articles (killed articles)
5674 (when (inline (gnus-member-of-range (car articles) killed))
5675 (push (car articles) out))
5676 (setq articles (cdr articles)))
5679 (defun gnus-uncompress-marks (marks)
5680 "Uncompress the mark ranges in MARKS."
5681 (let ((uncompressed '(score bookmark))
5684 (if (memq (caar marks) uncompressed)
5685 (push (car marks) out)
5686 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5687 (setq marks (cdr marks)))
5690 (defun gnus-article-mark-to-type (mark)
5691 "Return the type of MARK."
5692 (or (cadr (assq mark gnus-article-special-mark-lists))
5695 (defun gnus-article-unpropagatable-p (mark)
5696 "Return whether MARK should be propagated to back end."
5697 (memq mark gnus-article-unpropagated-mark-lists))
5699 (defun gnus-adjust-marked-articles (info)
5700 "Set all article lists and remove all marks that are no longer valid."
5701 (let* ((marked-lists (gnus-info-marks info))
5702 (active (gnus-active (gnus-info-group info)))
5705 (types gnus-article-mark-lists)
5706 marks var articles article mark mark-type
5709 (dolist (marks marked-lists)
5710 (setq mark (car marks)
5711 mark-type (gnus-article-mark-to-type mark)
5712 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5714 ;; We set the variable according to the type of the marks list,
5715 ;; and then adjust the marks to a subset of the active articles.
5717 ;; Adjust "simple" lists - compressed yet unsorted
5718 ((eq mark-type 'list)
5719 ;; Simultaneously uncompress and clip to active range
5720 ;; See gnus-uncompress-range for a description of possible marks
5722 (if (not (cadr marks))
5724 (setq articles (if (numberp (cddr marks))
5730 (while (setq article (pop articles))
5731 (cond ((consp article)
5732 (setq bgn (max (car article) min)
5733 end (min (cdr article) max))
5735 (setq l (setcdr l (cons bgn nil))
5737 ((and (<= min article)
5739 (setq l (setcdr l (cons article nil))))))
5740 (set var (cdr lh)))))
5742 ((eq mark-type 'tuple)
5743 (set var (setq articles (cdr marks)))
5744 (when (not (listp (cdr (symbol-value var))))
5745 (set var (list (symbol-value var))))
5746 (when (not (listp (cdr articles)))
5747 (setq articles (list articles)))
5749 (when (or (not (consp (setq article (pop articles))))
5750 (< (car article) min)
5751 (> (car article) max))
5752 (set var (delq article (symbol-value var))))))
5753 ;; Adjust ranges (sloppily).
5754 ((eq mark-type 'range)
5757 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5758 ;; It should be (seen (NUM1 . NUM2)).
5759 (when (numberp (cddr marks))
5760 (setcdr marks (list (cdr marks))))
5761 (setq articles (cdr marks))
5762 (while (and articles
5763 (or (and (consp (car articles))
5764 (> min (cdar articles)))
5765 (and (numberp (car articles))
5766 (> min (car articles)))))
5768 (set var articles))))))))
5770 (defun gnus-update-missing-marks (missing)
5771 "Go through the list of MISSING articles and remove them from the mark lists."
5774 ;; Go through all types.
5775 (dolist (elem gnus-article-mark-lists)
5776 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5777 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5778 (when (symbol-value var)
5779 ;; This list has articles. So we delete all missing
5780 ;; articles from it.
5783 (set var (delq (pop m) (symbol-value var))))))))))
5785 (defun gnus-update-marks ()
5786 "Enter the various lists of marked articles into the newsgroup info list."
5787 (let ((types gnus-article-mark-lists)
5788 (info (gnus-get-info gnus-newsgroup-name))
5789 type list newmarked symbol delta-marks)
5791 ;; Add all marks lists to the list of marks lists.
5792 (while (setq type (pop types))
5793 (setq list (symbol-value
5795 (intern (format "gnus-newsgroup-%s" (car type))))))
5798 ;; Get rid of the entries of the articles that have the
5800 (when (and (eq (cdr type) 'score)
5804 (prev (cons nil list))
5807 (if (or (not (consp (car arts)))
5808 (= (cdar arts) gnus-summary-default-score))
5809 (setcdr prev (cdr arts))
5811 (setq arts (cdr arts)))
5812 (setq list (cdr all)))))
5814 (when (eq (cdr type) 'seen)
5815 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5817 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5818 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5820 (when (and (gnus-check-backend-function
5821 'request-set-mark gnus-newsgroup-name)
5822 (not (gnus-article-unpropagatable-p (cdr type))))
5823 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5824 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5825 (add (gnus-remove-from-range
5826 (gnus-copy-sequence list) old)))
5828 (push (list add 'add (list (cdr type))) delta-marks))
5830 (push (list del 'del (list (cdr type))) delta-marks))))
5833 (push (cons (cdr type) list) newmarked)))
5836 (unless (gnus-check-group gnus-newsgroup-name)
5837 (error "Can't open server for %s" gnus-newsgroup-name))
5838 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5840 ;; Enter these new marks into the info of the group.
5842 (setcar (nthcdr 3 info) newmarked)
5843 ;; Add the marks lists to the end of the info.
5845 (setcdr (nthcdr 2 info) (list newmarked))))
5847 ;; Cut off the end of the info if there's nothing else there.
5851 (when (nthcdr (decf i) info)
5852 (setcdr (nthcdr i info) nil)))))))
5854 (defun gnus-set-mode-line (where)
5855 "Set the mode line of the article or summary buffers.
5856 If WHERE is `summary', the summary mode line format will be used."
5857 ;; Is this mode line one we keep updated?
5858 (when (and (memq where gnus-updated-mode-lines)
5860 (intern (format "gnus-%s-mode-line-format-spec" where))))
5863 ;; We evaluate this in the summary buffer since these
5864 ;; variables are buffer-local to that buffer.
5865 (set-buffer gnus-summary-buffer)
5866 ;; We bind all these variables that are used in the `eval' form
5868 (let* ((mformat (symbol-value
5870 (format "gnus-%s-mode-line-format-spec" where))))
5871 (gnus-tmp-group-name (gnus-mode-string-quote
5872 (gnus-group-decoded-name
5873 gnus-newsgroup-name)))
5874 (gnus-tmp-article-number (or gnus-current-article 0))
5875 (gnus-tmp-unread gnus-newsgroup-unreads)
5876 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5877 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5878 (gnus-tmp-unread-and-unselected
5879 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5880 (zerop gnus-tmp-unselected))
5882 ((zerop gnus-tmp-unselected)
5883 (format "{%d more}" gnus-tmp-unread-and-unticked))
5884 (t (format "{%d(+%d) more}"
5885 gnus-tmp-unread-and-unticked
5886 gnus-tmp-unselected))))
5888 (if (and gnus-current-headers
5889 (vectorp gnus-current-headers))
5890 (gnus-mode-string-quote
5891 (mail-header-subject gnus-current-headers))
5893 bufname-length max-len
5894 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5895 (setq mode-string (eval mformat))
5896 (setq bufname-length (if (string-match "%b" mode-string)
5899 (if (eq where 'summary)
5901 (get-buffer gnus-article-buffer))))
5904 (setq max-len (max 4 (if gnus-mode-non-string-length
5906 gnus-mode-non-string-length
5908 (length mode-string))))
5909 ;; We might have to chop a bit of the string off...
5910 (when (> (length mode-string) max-len)
5912 (concat (truncate-string-to-width mode-string (- max-len 3))
5914 ;; Pad the mode string a bit.
5915 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5916 ;; Update the mode line.
5917 (setq mode-line-buffer-identification
5918 (gnus-mode-line-buffer-identification (list mode-string)))
5919 (set-buffer-modified-p t))))
5921 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5922 "Go through the HEADERS list and add all Xrefs to a hash table.
5923 The resulting hash table is returned, or nil if no Xrefs were found."
5924 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5925 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5926 (xref-hashtb (gnus-make-hashtable))
5927 start group entry number xrefs header)
5929 (setq header (pop headers))
5930 (when (and (setq xrefs (mail-header-xref header))
5931 (not (memq (setq number (mail-header-number header))
5934 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5935 (setq start (match-end 0))
5936 (setq group (if prefix
5937 (concat prefix (substring xrefs (match-beginning 1)
5939 (substring xrefs (match-beginning 1) (match-end 1))))
5941 (string-to-number (substring xrefs (match-beginning 2)
5943 (if (setq entry (gnus-gethash group xref-hashtb))
5944 (setcdr entry (cons number (cdr entry)))
5945 (gnus-sethash group (cons number nil) xref-hashtb)))))
5946 (and start xref-hashtb)))
5948 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5949 "Look through all the headers and mark the Xrefs as read."
5950 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5951 name info xref-hashtb idlist method nth4)
5953 (set-buffer gnus-group-buffer)
5954 (when (setq xref-hashtb
5955 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5958 (unless (string= from-newsgroup (setq name (symbol-name group)))
5959 (setq idlist (symbol-value group))
5960 ;; Dead groups are not updated.
5962 (setq info (gnus-get-info name))
5963 (when (stringp (setq nth4 (gnus-info-method info)))
5964 (setq nth4 (gnus-server-to-method nth4))))
5965 ;; Only do the xrefs if the group has the same
5966 ;; select method as the group we have just read.
5967 (or (gnus-methods-equal-p
5968 nth4 (gnus-find-method-for-group from-newsgroup))
5970 (equal nth4 (setq method (gnus-find-method-for-group
5972 (and (equal (car nth4) (car method))
5973 (equal (nth 1 nth4) (nth 1 method))))
5974 gnus-use-cross-reference
5975 (or (not (eq gnus-use-cross-reference t))
5977 ;; Only do cross-references on subscribed
5978 ;; groups, if that is what is wanted.
5979 (<= (gnus-info-level info) gnus-level-subscribed))
5980 (gnus-group-make-articles-read name idlist))))
5983 (defun gnus-compute-read-articles (group articles)
5984 (let* ((entry (gnus-group-entry group))
5985 (info (nth 2 entry))
5986 (active (gnus-active group))
5989 ;; First peel off all invalid article numbers.
5991 (let ((ids articles)
5993 (while (setq id (pop ids))
5994 (when (and first (> id (cdr active)))
5995 ;; We'll end up in this situation in one particular
5996 ;; obscure situation. If you re-scan a group and get
5997 ;; a new article that is cross-posted to a different
5998 ;; group that has not been re-scanned, you might get
5999 ;; crossposted article that has a higher number than
6000 ;; Gnus believes possible. So we re-activate this
6001 ;; group as well. This might mean doing the
6002 ;; crossposting thingy will *increase* the number
6003 ;; of articles in some groups. Tsk, tsk.
6004 (setq active (or (gnus-activate-group group) active)))
6005 (when (or (> id (cdr active))
6006 (< id (car active)))
6007 (setq articles (delq id articles))))))
6008 ;; If the read list is nil, we init it.
6010 (null (gnus-info-read info))
6012 (setq ninfo (cons 1 (1- (car active))))
6013 (setq ninfo (gnus-info-read info)))
6014 ;; Then we add the read articles to the range.
6016 ninfo (setq articles (sort articles '<))))))
6018 (defun gnus-group-make-articles-read (group articles)
6019 "Update the info of GROUP to say that ARTICLES are read."
6021 (entry (gnus-group-entry group))
6022 (info (nth 2 entry))
6023 (active (gnus-active group))
6026 (setq range (gnus-compute-read-articles group articles))
6027 (with-current-buffer gnus-group-buffer
6030 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6031 (gnus-info-set-read ',info ',(gnus-info-read info))
6032 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6033 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6034 (gnus-group-update-group ,group t))))
6035 ;; Add the read articles to the range.
6036 (gnus-info-set-read info range)
6037 (gnus-request-set-mark group (list (list range 'add '(read))))
6038 ;; Then we have to re-compute how many unread
6039 ;; articles there are in this group.
6043 (setq num (- (1+ (cdr active)) (car active))))
6044 ((not (listp (cdr range)))
6045 (setq num (- (cdr active) (- (1+ (cdr range))
6049 (if (numberp (car range))
6051 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6052 (setq range (cdr range)))
6053 (setq num (- (cdr active) num))))
6054 ;; Update the number of unread articles.
6056 ;; Update the group buffer.
6057 (unless (gnus-ephemeral-group-p group)
6058 (gnus-group-update-group group t))))))
6060 (defvar gnus-newsgroup-none-id 0)
6062 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6063 (let ((cur nntp-server-buffer)
6066 (with-current-buffer gnus-summary-buffer
6067 gnus-newsgroup-dependencies)))
6068 headers id end ref number
6069 (mail-parse-charset gnus-newsgroup-charset)
6070 (mail-parse-ignored-charsets
6071 (save-excursion (condition-case nil
6072 (set-buffer gnus-summary-buffer)
6074 gnus-newsgroup-ignored-charsets)))
6076 (set-buffer nntp-server-buffer)
6077 ;; Translate all TAB characters into SPACE characters.
6078 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6079 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6080 (ietf-drums-unfold-fws)
6081 (gnus-run-hooks 'gnus-parse-headers-hook)
6082 (let ((case-fold-search t)
6083 in-reply-to header p lines chars)
6084 (goto-char (point-min))
6085 ;; Search to the beginning of the next header. Error messages
6086 ;; do not begin with 2 or 3.
6087 (while (re-search-forward "^[23][0-9]+ " nil t)
6090 ;; This implementation of this function, with nine
6091 ;; search-forwards instead of the one re-search-forward and
6092 ;; a case (which basically was the old function) is actually
6093 ;; about twice as fast, even though it looks messier. You
6094 ;; can't have everything, I guess. Speed and elegance
6095 ;; doesn't always go hand in hand.
6101 (setq number (read cur))
6104 (narrow-to-region (point)
6105 (or (and (search-forward "\n.\n" nil t)
6111 (if (search-forward "\nsubject:" nil t)
6112 (funcall gnus-decode-encoded-word-function
6113 (nnheader-header-value))
6118 (if (search-forward "\nfrom:" nil t)
6119 (funcall gnus-decode-encoded-address-function
6120 (nnheader-header-value))
6125 (if (search-forward "\ndate:" nil t)
6126 (nnheader-header-value) ""))
6130 (setq id (if (re-search-forward
6131 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6132 ;; We do it this way to make sure the Message-ID
6133 ;; is (somewhat) syntactically valid.
6134 (buffer-substring (match-beginning 1)
6136 ;; If there was no message-id, we just fake one
6137 ;; to make subsequent routines simpler.
6138 (nnheader-generate-fake-message-id number))))
6142 (if (search-forward "\nreferences:" nil t)
6146 (nnheader-header-value)
6151 (search-backward ">" end t)
6154 (search-backward "<" end t)
6156 ;; Get the references from the in-reply-to header if there
6157 ;; were no references and the in-reply-to header looks
6159 (if (and (search-forward "\nin-reply-to:" nil t)
6160 (setq in-reply-to (nnheader-header-value))
6161 (string-match "<[^>]+>" in-reply-to))
6163 (setq ref (substring in-reply-to (match-beginning 0)
6165 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6166 (setq ref2 (substring in-reply-to (match-beginning 0)
6168 (when (> (length ref2) (length ref))
6175 (if (search-forward "\nchars: " nil t)
6176 (if (numberp (setq chars (ignore-errors (read cur))))
6182 (if (search-forward "\nlines: " nil t)
6183 (if (numberp (setq lines (ignore-errors (read cur))))
6189 (and (search-forward "\nxref:" nil t)
6190 (nnheader-header-value)))
6192 (when gnus-extra-headers
6193 (let ((extra gnus-extra-headers)
6197 (when (search-forward
6198 (concat "\n" (symbol-name (car extra)) ":") nil t)
6199 (push (cons (car extra) (nnheader-header-value))
6203 (when (equal id ref)
6206 (when gnus-alter-header-function
6207 (funcall gnus-alter-header-function header)
6208 (setq id (mail-header-id header)
6209 ref (gnus-parent-id (mail-header-references header))))
6212 (gnus-dependencies-add-header
6213 header dependencies force-new))
6214 (push header headers))
6215 (goto-char (point-max))
6217 (nreverse headers)))))
6219 ;; Goes through the xover lines and returns a list of vectors
6220 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6221 force-new dependencies
6222 group also-fetch-heads)
6223 "Parse the news overview data in the server buffer.
6224 Return a list of headers that match SEQUENCE (see
6225 `nntp-retrieve-headers')."
6226 ;; Get the Xref when the users reads the articles since most/some
6227 ;; NNTP servers do not include Xrefs when using XOVER.
6228 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6229 (let ((mail-parse-charset gnus-newsgroup-charset)
6230 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6231 (cur nntp-server-buffer)
6232 (dependencies (or dependencies gnus-newsgroup-dependencies))
6234 ((eq gnus-read-all-available-headers t)
6236 ((and (stringp gnus-read-all-available-headers)
6238 (string-match gnus-read-all-available-headers group))
6241 number headers header)
6243 (set-buffer nntp-server-buffer)
6244 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6245 ;; Allow the user to mangle the headers before parsing them.
6246 (gnus-run-hooks 'gnus-parse-headers-hook)
6247 (goto-char (point-min))
6248 (gnus-parse-without-error
6249 (while (and (or sequence allp)
6251 (setq number (read cur))
6253 (while (and sequence
6254 (< (car sequence) number))
6255 (setq sequence (cdr sequence))))
6258 (eq number (car sequence))))
6260 (setq sequence (cdr sequence))
6261 (setq header (inline
6262 (gnus-nov-parse-line
6263 number dependencies force-new)))))
6264 (push header headers))
6266 ;; A common bug in inn is that if you have posted an article and
6267 ;; then retrieves the active file, it will answer correctly --
6268 ;; the new article is included. However, a NOV entry for the
6269 ;; article may not have been generated yet, so this may fail.
6270 ;; We work around this problem by retrieving the last few
6271 ;; headers using HEAD.
6272 (if (or (not also-fetch-heads)
6274 ;; We (probably) got all the headers.
6276 (let ((gnus-nov-is-evil t))
6279 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6280 (gnus-get-newsgroup-headers))))))))
6282 (defun gnus-article-get-xrefs ()
6283 "Fill in the Xref value in `gnus-current-headers', if necessary.
6284 This is meant to be called in `gnus-article-internal-prepare-hook'."
6285 (let ((headers (with-current-buffer gnus-summary-buffer
6286 gnus-current-headers)))
6287 (or (not gnus-use-cross-reference)
6289 (and (mail-header-xref headers)
6290 (not (string= (mail-header-xref headers) "")))
6291 (let ((case-fold-search t)
6294 (nnheader-narrow-to-headers)
6295 (goto-char (point-min))
6296 (when (or (and (not (eobp))
6297 (eq (downcase (char-after)) ?x)
6298 (looking-at "Xref:"))
6299 (search-forward "\nXref:" nil t))
6300 (goto-char (1+ (match-end 0)))
6301 (setq xref (buffer-substring (point) (point-at-eol)))
6302 (mail-header-set-xref headers xref)))))))
6304 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6305 "Find article ID and insert the summary line for that article.
6306 OLD-HEADER can either be a header or a line number to insert
6307 the subject line on."
6308 (let* ((line (and (numberp old-header) old-header))
6309 (old-header (and (vectorp old-header) old-header))
6310 (header (cond ((and old-header use-old-header)
6313 (gnus-number-to-header id))
6314 (gnus-number-to-header id))
6316 (gnus-read-header id))))
6317 (number (and (numberp id) id))
6320 ;; Rebuild the thread that this article is part of and go to the
6321 ;; article we have fetched.
6322 (when (and (not gnus-show-threads)
6325 (setq d (gnus-data-find (mail-header-number old-header))))
6326 (goto-char (gnus-data-pos d))
6332 (gnus-delete-line))))))
6333 ;; Remove list identifiers from subject.
6334 (when gnus-list-identifiers
6335 (let ((gnus-newsgroup-headers (list header)))
6336 (gnus-summary-remove-list-identifiers)))
6338 (mail-header-set-number header (mail-header-number old-header)))
6339 (setq gnus-newsgroup-sparse
6340 (delq (setq number (mail-header-number header))
6341 gnus-newsgroup-sparse))
6342 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6343 (push number gnus-newsgroup-limit)
6344 (gnus-rebuild-thread (mail-header-id header) line)
6345 (gnus-summary-goto-subject number nil t))
6346 (when (and (numberp number)
6348 ;; We have to update the boundaries even if we can't fetch the
6349 ;; article if ID is a number -- so that the next `P' or `N'
6350 ;; command will fetch the previous (or next) article even
6351 ;; if the one we tried to fetch this time has been canceled.
6352 (when (> number gnus-newsgroup-end)
6353 (setq gnus-newsgroup-end number))
6354 (when (< number gnus-newsgroup-begin)
6355 (setq gnus-newsgroup-begin number))
6356 (setq gnus-newsgroup-unselected
6357 (delq number gnus-newsgroup-unselected)))
6358 ;; Report back a success?
6359 (and header (mail-header-number header))))
6361 ;;; Process/prefix in the summary buffer
6363 (defun gnus-summary-work-articles (n)
6364 "Return a list of articles to be worked upon.
6365 The prefix argument, the list of process marked articles, and the
6366 current article will be taken into consideration."
6368 (set-buffer gnus-summary-buffer)
6371 ;; A numerical prefix has been given.
6372 (setq n (prefix-numeric-value n))
6373 (let ((backward (< n 0))
6374 (n (abs (prefix-numeric-value n)))
6379 (push (setq article (gnus-summary-article-number))
6382 (gnus-summary-find-prev nil article)
6383 (gnus-summary-find-next nil article)))
6385 (nreverse articles)))
6386 ((and (gnus-region-active-p) (mark))
6387 (message "region active")
6388 ;; Work on the region between point and mark.
6389 (let ((max (max (point) (mark)))
6392 (goto-char (min (point) (mark)))
6395 (push (setq article (gnus-summary-article-number)) articles)
6396 (gnus-summary-find-next nil article)
6398 (nreverse articles))))
6399 (gnus-newsgroup-processable
6400 ;; There are process-marked articles present.
6401 ;; Save current state.
6402 (gnus-summary-save-process-mark)
6404 (reverse gnus-newsgroup-processable))
6406 ;; Just return the current article.
6407 (list (gnus-summary-article-number))))))
6409 (defmacro gnus-summary-iterate (arg &rest forms)
6410 "Iterate over the process/prefixed articles and do FORMS.
6411 ARG is the interactive prefix given to the command. FORMS will be
6412 executed with point over the summary line of the articles."
6413 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6414 `(let ((,articles (gnus-summary-work-articles ,arg)))
6416 (gnus-summary-goto-subject (car ,articles))
6420 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6421 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6423 (defun gnus-summary-save-process-mark ()
6424 "Push the current set of process marked articles on the stack."
6426 (push (copy-sequence gnus-newsgroup-processable)
6427 gnus-newsgroup-process-stack))
6429 (defun gnus-summary-kill-process-mark ()
6430 "Push the current set of process marked articles on the stack and unmark."
6432 (gnus-summary-save-process-mark)
6433 (gnus-summary-unmark-all-processable))
6435 (defun gnus-summary-yank-process-mark ()
6436 "Pop the last process mark state off the stack and restore it."
6438 (unless gnus-newsgroup-process-stack
6439 (error "Empty mark stack"))
6440 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6442 (defun gnus-summary-process-mark-set (set)
6443 "Make SET into the current process marked articles."
6444 (gnus-summary-unmark-all-processable)
6445 (mapc 'gnus-summary-set-process-mark set))
6447 ;;; Searching and stuff
6449 (defun gnus-summary-search-group (&optional backward use-level)
6450 "Search for next unread newsgroup.
6451 If optional argument BACKWARD is non-nil, search backward instead."
6453 (set-buffer gnus-group-buffer)
6454 (when (gnus-group-search-forward
6455 backward nil (if use-level (gnus-group-group-level) nil))
6456 (gnus-group-group-name))))
6458 (defun gnus-summary-best-group (&optional exclude-group)
6459 "Find the name of the best unread group.
6460 If EXCLUDE-GROUP, do not go to this group."
6461 (with-current-buffer gnus-group-buffer
6463 (gnus-group-best-unread-group exclude-group))))
6465 (defun gnus-summary-find-next (&optional unread article backward)
6467 (gnus-summary-find-prev unread article)
6468 (let* ((dummy (gnus-summary-article-intangible-p))
6469 (article (or article (gnus-summary-article-number)))
6470 (data (gnus-data-find-list article))
6472 (when (and (not dummy)
6473 (or (not gnus-summary-check-current)
6475 (not (gnus-data-unread-p (car data)))))
6476 (setq data (cdr data)))
6481 (unless (memq (gnus-data-number (car data))
6483 ((eq gnus-auto-goto-ignores
6484 'always-undownloaded)
6485 gnus-newsgroup-undownloaded)
6488 ((eq gnus-auto-goto-ignores
6490 gnus-newsgroup-unfetched)
6491 ((eq gnus-auto-goto-ignores
6493 gnus-newsgroup-undownloaded)))
6494 (when (gnus-data-unread-p (car data))
6495 (setq result (car data)
6497 (setq data (cdr data)))
6500 (goto-char (gnus-data-pos result))
6501 (gnus-data-number result)))))
6503 (defun gnus-summary-find-prev (&optional unread article)
6504 (let* ((eobp (eobp))
6505 (article (or article (gnus-summary-article-number)))
6506 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6508 (when (and (not eobp)
6509 (or (not gnus-summary-check-current)
6511 (not (gnus-data-unread-p (car data)))))
6512 (setq data (cdr data)))
6517 (unless (memq (gnus-data-number (car data))
6519 ((eq gnus-auto-goto-ignores
6520 'always-undownloaded)
6521 gnus-newsgroup-undownloaded)
6524 ((eq gnus-auto-goto-ignores
6526 gnus-newsgroup-unfetched)
6527 ((eq gnus-auto-goto-ignores
6529 gnus-newsgroup-undownloaded)))
6530 (when (gnus-data-unread-p (car data))
6531 (setq result (car data)
6533 (setq data (cdr data)))
6536 (goto-char (gnus-data-pos result))
6537 (gnus-data-number result))))
6539 (defun gnus-summary-find-subject (subject &optional unread backward article)
6540 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6541 (article (or article (gnus-summary-article-number)))
6542 (articles (gnus-data-list backward))
6543 (arts (gnus-data-find-list article articles))
6545 (when (or (not gnus-summary-check-current)
6547 (not (gnus-data-unread-p (car arts))))
6548 (setq arts (cdr arts)))
6550 (and (or (not unread)
6551 (gnus-data-unread-p (car arts)))
6552 (vectorp (gnus-data-header (car arts)))
6554 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6555 (setq result (car arts)
6557 (setq arts (cdr arts)))
6559 (goto-char (gnus-data-pos result))
6560 (gnus-data-number result))))
6562 (defun gnus-summary-search-forward (&optional unread subject backward)
6563 "Search forward for an article.
6564 If UNREAD, look for unread articles. If SUBJECT, look for
6565 articles with that subject. If BACKWARD, search backward instead."
6566 (cond (subject (gnus-summary-find-subject subject unread backward))
6567 (backward (gnus-summary-find-prev unread))
6568 (t (gnus-summary-find-next unread))))
6570 (defun gnus-recenter (&optional n)
6571 "Center point in window and redisplay frame.
6572 Also do horizontal recentering."
6574 (when (and gnus-auto-center-summary
6575 (not (eq gnus-auto-center-summary 'vertical)))
6576 (gnus-horizontal-recenter))
6579 (defun gnus-summary-recenter ()
6580 "Center point in the summary window.
6581 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6582 displayed, no centering will be performed."
6583 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6584 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6586 ;; The user has to want it.
6587 (when gnus-auto-center-summary
6588 (let* ((top (cond ((< (window-height) 4) 0)
6589 ((< (window-height) 7) 1)
6590 (t (if (numberp gnus-auto-center-summary)
6591 gnus-auto-center-summary
6592 (/ (1- (window-height)) 2)))))
6593 (height (1- (window-height)))
6594 (bottom (save-excursion (goto-char (point-max))
6595 (forward-line (- height))
6597 (window (get-buffer-window (current-buffer))))
6598 (when (get-buffer-window gnus-article-buffer)
6599 ;; Only do recentering when the article buffer is displayed,
6600 ;; Set the window start to either `bottom', which is the biggest
6601 ;; possible valid number, or the second line from the top,
6602 ;; whichever is the least.
6603 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6604 (if (> bottom top-pos)
6605 ;; Keep the second line from the top visible
6606 (set-window-start window top-pos)
6607 ;; Try to keep the bottom line visible; if it's partially
6608 ;; obscured, either scroll one more line to make it fully
6609 ;; visible, or revert to using TOP-POS.
6611 (goto-char (point-max))
6613 (let ((last-line-start (point)))
6615 (set-window-start window (point) t)
6616 (when (not (pos-visible-in-window-p last-line-start window))
6618 (set-window-start window (min (point) top-pos) t)))))))
6619 ;; Do horizontal recentering while we're at it.
6620 (when (and (get-buffer-window (current-buffer) t)
6621 (not (eq gnus-auto-center-summary 'vertical)))
6622 (let ((selected (selected-window)))
6623 (select-window (get-buffer-window (current-buffer) t))
6624 (gnus-summary-position-point)
6625 (gnus-horizontal-recenter)
6626 (select-window selected))))))
6628 (defun gnus-summary-jump-to-group (newsgroup)
6629 "Move point to NEWSGROUP in group mode buffer."
6630 ;; Keep update point of group mode buffer if visible.
6631 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6632 (save-window-excursion
6633 ;; Take care of tree window mode.
6634 (when (get-buffer-window gnus-group-buffer)
6635 (pop-to-buffer gnus-group-buffer))
6636 (gnus-group-jump-to-group newsgroup))
6638 ;; Take care of tree window mode.
6639 (if (get-buffer-window gnus-group-buffer)
6640 (pop-to-buffer gnus-group-buffer)
6641 (set-buffer gnus-group-buffer))
6642 (gnus-group-jump-to-group newsgroup))))
6644 ;; This function returns a list of article numbers based on the
6645 ;; difference between the ranges of read articles in this group and
6646 ;; the range of active articles.
6647 (defun gnus-list-of-unread-articles (group)
6648 (let* ((read (gnus-info-read (gnus-get-info group)))
6649 (active (or (gnus-active group) (gnus-activate-group group)))
6650 (last (or (cdr active)
6651 (error "Group %s couldn't be activated " group)))
6653 ;; If none are read, then all are unread.
6655 (setq first (car active))
6656 ;; If the range of read articles is a single range, then the
6657 ;; first unread article is the article after the last read
6658 ;; article. Sounds logical, doesn't it?
6659 (if (and (not (listp (cdr read)))
6660 (or (< (car read) (car active))
6661 (progn (setq read (list read))
6663 (setq first (max (car active) (1+ (cdr read))))
6664 ;; `read' is a list of ranges.
6665 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6668 (setq first (car active)))
6671 (while (< first nlast)
6672 (setq unread (cons first unread)
6674 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6675 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6676 (setq read (cdr read)))))
6677 ;; And add the last unread articles.
6678 (while (<= first last)
6679 (setq unread (cons first unread)
6681 ;; Return the list of unread articles.
6682 (delq 0 (nreverse unread))))
6684 (defun gnus-list-of-read-articles (group)
6685 "Return a list of unread, unticked and non-dormant articles."
6686 (let* ((info (gnus-get-info group))
6687 (marked (gnus-info-marks info))
6688 (active (gnus-active group)))
6690 (gnus-list-range-difference
6691 (gnus-list-range-difference
6692 (gnus-sorted-complement
6693 (gnus-uncompress-range active)
6694 (gnus-list-of-unread-articles group))
6695 (cdr (assq 'dormant marked)))
6696 (cdr (assq 'tick marked))))))
6698 ;; This function returns a sequence of article numbers based on the
6699 ;; difference between the ranges of read articles in this group and
6700 ;; the range of active articles.
6701 (defun gnus-sequence-of-unread-articles (group)
6702 (let* ((read (gnus-info-read (gnus-get-info group)))
6703 (active (or (gnus-active group) (gnus-activate-group group)))
6706 ;; If none are read, then all are unread.
6708 (setq first (car active))
6709 ;; If the range of read articles is a single range, then the
6710 ;; first unread article is the article after the last read
6711 ;; article. Sounds logical, doesn't it?
6712 (if (and (not (listp (cdr read)))
6713 (or (< (car read) (car active))
6714 (progn (setq read (list read))
6716 (setq first (max (car active) (1+ (cdr read))))
6717 ;; `read' is a list of ranges.
6718 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6721 (setq first (car active)))
6724 (push (cons first nlast) unread))
6725 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6726 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6727 (setq read (cdr read)))))
6728 ;; And add the last unread articles.
6729 (cond ((not (and first last))
6732 (push (cons first last) unread))
6734 (push first unread)))
6735 ;; Return the sequence of unread articles.
6736 (delq 0 (nreverse unread))))
6738 ;; Various summary commands
6740 (defun gnus-summary-select-article-buffer ()
6741 "Reconfigure windows to show article buffer."
6743 (if (not (gnus-buffer-live-p gnus-article-buffer))
6744 (error "There is no article buffer for this summary buffer")
6745 (gnus-configure-windows 'article)
6746 (select-window (get-buffer-window gnus-article-buffer))))
6748 (defun gnus-summary-universal-argument (arg)
6749 "Perform any operation on all articles that are process/prefixed."
6751 (let ((articles (gnus-summary-work-articles arg))
6758 (substitute-command-keys
6759 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6761 (gnus-error 1 "Undefined key")
6764 (gnus-summary-goto-subject (setq article (pop articles)))
6765 (let (gnus-newsgroup-processable)
6766 (command-execute func))
6767 (gnus-summary-remove-process-mark article)))))
6768 (gnus-summary-position-point))
6770 (defun gnus-summary-toggle-truncation (&optional arg)
6771 "Toggle truncation of summary lines.
6772 With ARG, turn line truncation on if ARG is positive."
6774 (setq truncate-lines
6775 (if (null arg) (not truncate-lines)
6776 (> (prefix-numeric-value arg) 0)))
6779 (defun gnus-summary-find-for-reselect ()
6780 "Return the number of an article to stay on across a reselect.
6781 The current article is considered, then following articles, then previous
6782 articles. An article is sought which is not cancelled and isn't a temporary
6783 insertion from another group. If there's no such then return a dummy 0."
6785 (dolist (rev '(nil t))
6786 (unless found ; don't demand the reverse list if we don't need it
6787 (let ((data (gnus-data-find-list
6788 (gnus-summary-article-number) (gnus-data-list rev))))
6789 (while (and data (not found))
6790 (if (and (< 0 (gnus-data-number (car data)))
6791 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6792 (setq found (gnus-data-number (car data))))
6793 (setq data (cdr data))))))
6796 (defun gnus-summary-reselect-current-group (&optional all rescan)
6797 "Exit and then reselect the current newsgroup.
6798 The prefix argument ALL means to select all articles."
6800 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6801 (error "Ephemeral groups can't be reselected"))
6802 (let ((current-subject (gnus-summary-find-for-reselect))
6803 (group gnus-newsgroup-name))
6804 (setq gnus-newsgroup-begin nil)
6805 (gnus-summary-exit nil 'leave-hidden)
6806 ;; We have to adjust the point of group mode buffer because
6807 ;; point was moved to the next unread newsgroup by exiting.
6808 (gnus-summary-jump-to-group group)
6811 (gnus-group-get-new-news-this-group 1)))
6812 (gnus-group-read-group all t)
6813 (gnus-summary-goto-subject current-subject nil t)))
6815 (defun gnus-summary-rescan-group (&optional all)
6816 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6818 (gnus-summary-reselect-current-group all t))
6820 (defun gnus-summary-update-info (&optional non-destructive)
6822 (let ((group gnus-newsgroup-name))
6824 (when gnus-newsgroup-kill-headers
6825 (setq gnus-newsgroup-killed
6826 (gnus-compress-sequence
6828 (gnus-list-range-intersection
6829 gnus-newsgroup-unselected gnus-newsgroup-killed)
6830 gnus-newsgroup-unreads)
6832 (unless (listp (cdr gnus-newsgroup-killed))
6833 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6834 (let ((headers gnus-newsgroup-headers))
6835 ;; Set the new ranges of read articles.
6836 (with-current-buffer gnus-group-buffer
6837 (gnus-undo-force-boundary))
6838 (gnus-update-read-articles
6839 group (gnus-sorted-union
6840 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6841 ;; Set the current article marks.
6842 (let ((gnus-newsgroup-scored
6843 (if (and (not gnus-save-score)
6844 (not non-destructive))
6846 gnus-newsgroup-scored)))
6848 (gnus-update-marks)))
6849 ;; Do the cross-ref thing.
6850 (when gnus-use-cross-reference
6851 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6852 ;; Do not switch windows but change the buffer to work.
6853 (set-buffer gnus-group-buffer)
6854 (unless (gnus-ephemeral-group-p group)
6855 (gnus-group-update-group group)))))))
6857 (defun gnus-summary-save-newsrc (&optional force)
6858 "Save the current number of read/marked articles in the dribble buffer.
6859 The dribble buffer will then be saved.
6860 If FORCE (the prefix), also save the .newsrc file(s)."
6862 (gnus-summary-update-info t)
6864 (gnus-save-newsrc-file)
6865 (gnus-dribble-save)))
6867 (defun gnus-summary-exit (&optional temporary leave-hidden)
6868 "Exit reading current newsgroup, and then return to group selection mode.
6869 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6871 (gnus-set-global-variables)
6872 (when (gnus-buffer-live-p gnus-article-buffer)
6874 (set-buffer gnus-article-buffer)
6875 (mm-destroy-parts gnus-article-mime-handles)
6876 ;; Set it to nil for safety reason.
6877 (setq gnus-article-mime-handle-alist nil)
6878 (setq gnus-article-mime-handles nil)))
6879 (gnus-kill-save-kill-buffer)
6880 (gnus-async-halt-prefetch)
6881 (let* ((group gnus-newsgroup-name)
6882 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6883 (gnus-group-is-exiting-p t)
6886 (buf (current-buffer)))
6888 ;; Do adaptive scoring, and possibly save score files.
6889 (when gnus-newsgroup-adaptive
6890 (gnus-score-adaptive))
6891 (when gnus-use-scoring
6893 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6894 ;; If we have several article buffers, we kill them at exit.
6895 (unless gnus-single-article-buffer
6896 (gnus-kill-buffer gnus-article-buffer)
6897 (gnus-kill-buffer gnus-original-article-buffer)
6898 (setq gnus-article-current nil))
6899 (when gnus-use-cache
6900 (gnus-cache-possibly-remove-articles)
6901 (gnus-cache-save-buffers))
6902 (gnus-async-prefetch-remove-group group)
6903 (when gnus-suppress-duplicates
6904 (gnus-dup-enter-articles))
6905 (when gnus-use-trees
6906 (gnus-tree-close group))
6907 (when gnus-use-cache
6908 (gnus-cache-write-active))
6909 ;; Remove entries for this group.
6910 (nnmail-purge-split-history (gnus-group-real-name group))
6911 ;; Make all changes in this group permanent.
6913 (gnus-run-hooks 'gnus-exit-group-hook)
6914 (gnus-summary-update-info))
6915 (gnus-close-group group)
6916 ;; Make sure where we were, and go to next newsgroup.
6917 (set-buffer gnus-group-buffer)
6919 (gnus-group-jump-to-group group))
6920 (gnus-run-hooks 'gnus-summary-exit-hook)
6921 (unless (or quit-config
6922 ;; If this group has disappeared from the summary
6923 ;; buffer, don't skip forwards.
6924 (not (string= group (gnus-group-group-name))))
6925 (gnus-group-next-unread-group 1))
6926 (setq group-point (point))
6929 ;; If we have several article buffers, we kill them at exit.
6930 (unless gnus-single-article-buffer
6931 (gnus-kill-buffer gnus-article-buffer)
6932 (gnus-kill-buffer gnus-original-article-buffer)
6933 (setq gnus-article-current nil))
6935 (if (not gnus-kill-summary-on-exit)
6937 (gnus-deaden-summary)
6939 ;; We set all buffer-local variables to nil. It is unclear why
6940 ;; this is needed, but if we don't, buffer-local variables are
6941 ;; not garbage-collected, it seems. This would the lead to en
6942 ;; ever-growing Emacs.
6943 (gnus-summary-clear-local-variables)
6944 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6945 (gnus-summary-clear-local-variables))
6946 (when (get-buffer gnus-article-buffer)
6947 (bury-buffer gnus-article-buffer))
6948 ;; Return to group mode buffer.
6949 (when (eq mode 'gnus-summary-mode)
6950 (gnus-kill-buffer buf)))
6951 (setq gnus-current-select-method gnus-select-method)
6952 (set-buffer gnus-group-buffer)
6954 (gnus-handle-ephemeral-exit quit-config)
6955 (goto-char group-point)
6956 ;; If gnus-group-buffer is already displayed, make sure we also move
6957 ;; the cursor in the window that displays it.
6958 (let ((win (get-buffer-window (current-buffer) 0)))
6959 (if win (set-window-point win (point))))
6960 (unless leave-hidden
6961 (gnus-configure-windows 'group 'force)))
6962 ;; Clear the current group name.
6964 (setq gnus-newsgroup-name nil)))))
6966 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6967 (defun gnus-summary-exit-no-update (&optional no-questions)
6968 "Quit reading current newsgroup without updating read article info."
6970 (let* ((group gnus-newsgroup-name)
6971 (gnus-group-is-exiting-p t)
6972 (gnus-group-is-exiting-without-update-p t)
6973 (quit-config (gnus-group-quit-config group)))
6974 (when (or no-questions
6976 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6977 (gnus-async-halt-prefetch)
6978 (run-hooks 'gnus-summary-prepare-exit-hook)
6979 (when (gnus-buffer-live-p gnus-article-buffer)
6981 (set-buffer gnus-article-buffer)
6982 (mm-destroy-parts gnus-article-mime-handles)
6983 ;; Set it to nil for safety reason.
6984 (setq gnus-article-mime-handle-alist nil)
6985 (setq gnus-article-mime-handles nil)))
6986 ;; If we have several article buffers, we kill them at exit.
6987 (unless gnus-single-article-buffer
6988 (gnus-kill-buffer gnus-article-buffer)
6989 (gnus-kill-buffer gnus-original-article-buffer)
6990 (setq gnus-article-current nil))
6991 (if (not gnus-kill-summary-on-exit)
6992 (gnus-deaden-summary)
6993 (gnus-close-group group)
6994 (gnus-summary-clear-local-variables)
6995 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6996 (gnus-summary-clear-local-variables))
6997 (gnus-kill-buffer gnus-summary-buffer))
6998 (unless gnus-single-article-buffer
6999 (setq gnus-article-current nil))
7000 (when gnus-use-trees
7001 (gnus-tree-close group))
7002 (gnus-async-prefetch-remove-group group)
7003 (when (get-buffer gnus-article-buffer)
7004 (bury-buffer gnus-article-buffer))
7005 ;; Return to the group buffer.
7006 (gnus-configure-windows 'group 'force)
7007 ;; Clear the current group name.
7008 (setq gnus-newsgroup-name nil)
7009 (unless (gnus-ephemeral-group-p group)
7010 (gnus-group-update-group group))
7011 (when (equal (gnus-group-group-name) group)
7012 (gnus-group-next-unread-group 1))
7014 (gnus-handle-ephemeral-exit quit-config)))))
7016 (defun gnus-handle-ephemeral-exit (quit-config)
7017 "Handle movement when leaving an ephemeral group.
7018 The state which existed when entering the ephemeral is reset."
7019 (if (not (buffer-name (car quit-config)))
7020 (gnus-configure-windows 'group 'force)
7021 (set-buffer (car quit-config))
7022 (cond ((eq major-mode 'gnus-summary-mode)
7023 (gnus-set-global-variables))
7024 ((eq major-mode 'gnus-article-mode)
7026 ;; The `gnus-summary-buffer' variable may point
7027 ;; to the old summary buffer when using a single
7029 (unless (gnus-buffer-live-p gnus-summary-buffer)
7030 (set-buffer gnus-group-buffer))
7031 (set-buffer gnus-summary-buffer)
7032 (gnus-set-global-variables))))
7033 (if (or (eq (cdr quit-config) 'article)
7034 (eq (cdr quit-config) 'pick))
7035 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7036 (gnus-configure-windows 'pick 'force)
7037 (gnus-configure-windows (cdr quit-config) 'force))
7038 (gnus-configure-windows (cdr quit-config) 'force))
7039 (when (eq major-mode 'gnus-summary-mode)
7040 (gnus-summary-recenter)
7041 (gnus-summary-position-point))))
7045 (defvar gnus-dead-summary-mode-map nil)
7047 (unless gnus-dead-summary-mode-map
7048 (setq gnus-dead-summary-mode-map (make-keymap))
7049 (suppress-keymap gnus-dead-summary-mode-map)
7050 (substitute-key-definition
7051 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7052 (dolist (key '("\C-d" "\r" "\177" [delete]))
7053 (define-key gnus-dead-summary-mode-map
7054 key 'gnus-summary-wake-up-the-dead))
7055 (dolist (key '("q" "Q"))
7056 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
7058 (defvar gnus-dead-summary-mode nil
7059 "Minor mode for Gnus summary buffers.")
7061 (defun gnus-dead-summary-mode (&optional arg)
7062 "Minor mode for Gnus summary buffers."
7064 (when (eq major-mode 'gnus-summary-mode)
7065 (make-local-variable 'gnus-dead-summary-mode)
7066 (setq gnus-dead-summary-mode
7067 (if (null arg) (not gnus-dead-summary-mode)
7068 (> (prefix-numeric-value arg) 0)))
7069 (when gnus-dead-summary-mode
7071 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7073 (defun gnus-deaden-summary ()
7074 "Make the current summary buffer into a dead summary buffer."
7075 ;; Kill any previous dead summary buffer.
7076 (when (and gnus-dead-summary
7077 (buffer-name gnus-dead-summary))
7078 (with-current-buffer gnus-dead-summary
7079 (when gnus-dead-summary-mode
7080 (kill-buffer (current-buffer)))))
7081 ;; Make this the current dead summary.
7082 (setq gnus-dead-summary (current-buffer))
7083 (gnus-dead-summary-mode 1)
7084 (let ((name (buffer-name)))
7085 (when (string-match "Summary" name)
7087 (concat (substring name 0 (match-beginning 0)) "Dead "
7088 (substring name (match-beginning 0)))
7092 (defun gnus-kill-or-deaden-summary (buffer)
7093 "Kill or deaden the summary BUFFER."
7095 (when (and (buffer-name buffer)
7096 (not gnus-single-article-buffer))
7097 (with-current-buffer buffer
7098 (gnus-kill-buffer gnus-article-buffer)
7099 (gnus-kill-buffer gnus-original-article-buffer)))
7102 (gnus-kill-summary-on-exit
7103 (when (and gnus-use-trees
7104 (gnus-buffer-exists-p buffer))
7107 (gnus-tree-close gnus-newsgroup-name)))
7108 (gnus-kill-buffer buffer))
7109 ;; Deaden the buffer.
7110 ((gnus-buffer-exists-p buffer)
7113 (gnus-deaden-summary))))))
7115 (defun gnus-summary-wake-up-the-dead (&rest args)
7116 "Wake up the dead summary buffer."
7118 (gnus-dead-summary-mode -1)
7119 (let ((name (buffer-name)))
7120 (when (string-match "Dead " name)
7122 (concat (substring name 0 (match-beginning 0))
7123 (substring name (match-end 0)))
7125 (gnus-message 3 "This dead summary is now alive again"))
7127 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7128 (defun gnus-summary-fetch-faq (&optional faq-dir)
7129 "Fetch the FAQ for the current group.
7130 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7134 (when current-prefix-arg
7136 "FAQ dir: " (and (listp gnus-group-faq-directory)
7138 gnus-group-faq-directory))))))
7139 (let (gnus-faq-buffer)
7140 (when (setq gnus-faq-buffer
7141 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7142 (gnus-configure-windows 'summary-faq))))
7144 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7145 (defun gnus-summary-describe-group (&optional force)
7146 "Describe the current newsgroup."
7148 (gnus-group-describe-group force gnus-newsgroup-name))
7150 (defun gnus-summary-describe-briefly ()
7151 "Describe summary mode commands briefly."
7153 (gnus-message 6 (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")))
7155 ;; Walking around group mode buffer from summary mode.
7157 (defun gnus-summary-next-group (&optional no-article target-group backward)
7158 "Exit current newsgroup and then select next unread newsgroup.
7159 If prefix argument NO-ARTICLE is non-nil, no article is selected
7160 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7161 previous group instead."
7163 ;; Stop pre-fetching.
7164 (gnus-async-halt-prefetch)
7165 (let ((current-group gnus-newsgroup-name)
7166 (current-buffer (current-buffer))
7168 ;; First we semi-exit this group to update Xrefs and all variables.
7169 ;; We can't do a real exit, because the window conf must remain
7170 ;; the same in case the user is prompted for info, and we don't
7171 ;; want the window conf to change before that...
7172 (gnus-summary-exit t)
7173 (while (not entered)
7174 ;; Then we find what group we are supposed to enter.
7175 (set-buffer gnus-group-buffer)
7176 (gnus-group-jump-to-group current-group)
7179 (if (eq gnus-keep-same-level 'best)
7180 (gnus-summary-best-group gnus-newsgroup-name)
7181 (gnus-summary-search-group backward gnus-keep-same-level))))
7182 (if (not target-group)
7183 ;; There are no further groups, so we return to the group
7186 (gnus-message 5 "Returning to the group buffer")
7188 (when (gnus-buffer-live-p current-buffer)
7189 (set-buffer current-buffer)
7190 (gnus-summary-exit))
7191 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7192 ;; We try to enter the target group.
7193 (gnus-group-jump-to-group target-group)
7194 (let ((unreads (gnus-group-group-unread)))
7195 (if (and (or (eq t unreads)
7196 (and unreads (not (zerop unreads))))
7197 (gnus-summary-read-group
7198 target-group nil no-article
7199 (and (buffer-name current-buffer) current-buffer)
7202 (setq current-group target-group
7203 target-group nil)))))))
7205 (defun gnus-summary-prev-group (&optional no-article)
7206 "Exit current newsgroup and then select previous unread newsgroup.
7207 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7209 (gnus-summary-next-group no-article nil t))
7211 ;; Walking around summary lines.
7213 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7214 "Go to the first subject satisfying any non-nil constraint.
7215 If UNREAD is non-nil, the article should be unread.
7216 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7217 If UNSEEN is non-nil, the article should be unseen.
7218 Returns the article selected or nil if there are no matching articles."
7222 ((null gnus-newsgroup-data)
7223 (gnus-message 3 "No articles in the group")
7225 ;; Pick the first article.
7226 ((not (or unread undownloaded unseen))
7227 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7228 (gnus-data-number (car gnus-newsgroup-data)))
7229 ;; Find the first unread article.
7231 (let ((data gnus-newsgroup-data))
7233 (let ((num (gnus-data-number (car data))))
7234 (or (memq num gnus-newsgroup-unfetched)
7235 (not (or (and unread
7236 (memq num gnus-newsgroup-unreads))
7238 (memq num gnus-newsgroup-undownloaded))
7240 (memq num gnus-newsgroup-unseen)))))))
7241 (setq data (cdr data)))
7245 (goto-char (gnus-data-pos (car data)))
7246 (gnus-data-number (car data)))
7247 (gnus-message 3 "No more%s articles"
7248 (let* ((r (when unread " unread"))
7249 (d (when undownloaded " undownloaded"))
7250 (s (when unseen " unseen"))
7251 (l (delq nil (list r d s))))
7252 (cond ((= 3 (length l))
7253 (concat r "," d ", or" s))
7255 (concat (car l) ", or" (cadr l)))
7262 (gnus-summary-position-point))))))
7264 (defun gnus-summary-next-subject (n &optional unread dont-display)
7265 "Go to next N'th summary line.
7266 If N is negative, go to the previous N'th subject line.
7267 If UNREAD is non-nil, only unread articles are selected.
7268 The difference between N and the actual number of steps taken is
7271 (let ((backward (< n 0))
7275 (gnus-summary-find-prev unread)
7276 (gnus-summary-find-next unread)))
7277 (unless (zerop (setq n (1- n)))
7278 (gnus-summary-show-thread)))
7280 (gnus-message 7 "No more%s articles"
7281 (if unread " unread" "")))
7282 (unless dont-display
7283 (gnus-summary-recenter)
7284 (gnus-summary-position-point))
7287 (defun gnus-summary-next-unread-subject (n)
7288 "Go to next N'th unread summary line."
7290 (gnus-summary-next-subject n t))
7292 (defun gnus-summary-prev-subject (n &optional unread)
7293 "Go to previous N'th summary line.
7294 If optional argument UNREAD is non-nil, only unread article is selected."
7296 (gnus-summary-next-subject (- n) unread))
7298 (defun gnus-summary-prev-unread-subject (n)
7299 "Go to previous N'th unread summary line."
7301 (gnus-summary-next-subject (- n) t))
7303 (defun gnus-summary-goto-subjects (articles)
7304 "Insert the subject header for ARTICLES in the current buffer."
7306 (dolist (article articles)
7307 (gnus-summary-goto-subject article t)))
7308 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7309 (gnus-summary-position-point))
7311 (defun gnus-summary-goto-subject (article &optional force silent)
7312 "Go the subject line of ARTICLE.
7313 If FORCE, also allow jumping to articles not currently shown."
7314 (interactive "nArticle number: ")
7315 (unless (numberp article)
7316 (error "Article %s is not a number" article))
7318 (data (gnus-data-find article)))
7319 ;; We read in the article if we have to.
7322 (gnus-summary-insert-subject
7324 (if (or (numberp force) (vectorp force)) force)
7326 (setq data (gnus-data-find article)))
7331 (gnus-message 3 "Can't find article %d" article))
7333 (let ((pt (gnus-data-pos data)))
7335 (gnus-summary-set-article-display-arrow pt))
7336 (gnus-summary-position-point)
7339 ;; Walking around summary lines with displaying articles.
7341 (defun gnus-summary-expand-window (&optional arg)
7342 "Make the summary buffer take up the entire Emacs frame.
7343 Given a prefix, will force an `article' buffer configuration."
7346 (gnus-configure-windows 'article 'force)
7347 (gnus-configure-windows 'summary 'force)))
7349 (defun gnus-summary-display-article (article &optional all-header)
7350 "Display ARTICLE in article buffer."
7351 (when (gnus-buffer-live-p gnus-article-buffer)
7352 (with-current-buffer gnus-article-buffer
7353 (mm-enable-multibyte)))
7354 (gnus-set-global-variables)
7355 (when (gnus-buffer-live-p gnus-article-buffer)
7356 (with-current-buffer gnus-article-buffer
7357 (setq gnus-article-charset gnus-newsgroup-charset)
7358 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7359 (mm-enable-multibyte)))
7363 (if gnus-summary-display-article-function
7364 (funcall gnus-summary-display-article-function article all-header)
7365 (gnus-article-prepare article all-header))
7366 (gnus-run-hooks 'gnus-select-article-hook)
7367 (when (and gnus-current-article
7368 (not (zerop gnus-current-article)))
7369 (gnus-summary-goto-subject gnus-current-article))
7370 (gnus-summary-recenter)
7371 (when (and gnus-use-trees gnus-show-threads)
7372 (gnus-possibly-generate-tree article)
7373 (gnus-highlight-selected-tree article))
7374 ;; Successfully display article.
7375 (gnus-article-set-window-start
7376 (cdr (assq article gnus-newsgroup-bookmarks))))))
7378 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7379 "Select the current article.
7380 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7381 non-nil, the article will be re-fetched even if it already present in
7382 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7384 ;; Make sure we are in the summary buffer to work around bbdb bug.
7385 (unless (eq major-mode 'gnus-summary-mode)
7386 (set-buffer gnus-summary-buffer))
7387 (let ((article (or article (gnus-summary-article-number)))
7388 (all-headers (not (not all-headers))) ;Must be t or nil.
7389 gnus-summary-display-article-function)
7391 (gnus-summary-article-pseudo-p article)
7392 (error "This is a pseudo-article"))
7394 (set-buffer gnus-summary-buffer)
7395 (if (or (and gnus-single-article-buffer
7396 (or (null gnus-current-article)
7397 (null gnus-article-current)
7398 (null (get-buffer gnus-article-buffer))
7399 (not (eq article (cdr gnus-article-current)))
7400 (not (equal (car gnus-article-current)
7401 gnus-newsgroup-name))))
7402 (and (not gnus-single-article-buffer)
7403 (or (null gnus-current-article)
7404 (not (eq gnus-current-article article))))
7406 ;; The requested article is different from the current article.
7408 (gnus-summary-display-article article all-headers)
7409 (when (gnus-buffer-live-p gnus-article-buffer)
7410 (with-current-buffer gnus-article-buffer
7411 (if (not gnus-article-decoded-p) ;; a local variable
7412 (mm-disable-multibyte))))
7413 (gnus-article-set-window-start
7414 (cdr (assq article gnus-newsgroup-bookmarks)))
7418 (defun gnus-summary-force-verify-and-decrypt ()
7419 "Display buttons for signed/encrypted parts and verify/decrypt them."
7421 (let ((mm-verify-option 'known)
7422 (mm-decrypt-option 'known)
7423 (gnus-article-emulate-mime t)
7424 (gnus-buttonized-mime-types (append (list "multipart/signed"
7425 "multipart/encrypted")
7426 gnus-buttonized-mime-types)))
7427 (gnus-summary-select-article nil 'force)))
7429 (defun gnus-summary-set-current-mark (&optional current-mark)
7430 "Obsolete function."
7433 (defun gnus-summary-next-article (&optional unread subject backward push)
7434 "Select the next article.
7435 If UNREAD, only unread articles are selected.
7436 If SUBJECT, only articles with SUBJECT are selected.
7437 If BACKWARD, the previous article is selected instead of the next."
7439 ;; Make sure we are in the summary buffer.
7440 (unless (eq major-mode 'gnus-summary-mode)
7441 (set-buffer gnus-summary-buffer))
7443 ;; Is there such an article?
7444 ((and (gnus-summary-search-forward unread subject backward)
7445 (or (gnus-summary-display-article (gnus-summary-article-number))
7446 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7447 (gnus-summary-position-point))
7448 ;; If not, we try the first unread, if that is wanted.
7450 gnus-auto-select-same
7451 (gnus-summary-first-unread-article))
7452 (gnus-summary-position-point)
7453 (gnus-message 6 "Wrapped"))
7454 ;; Try to get next/previous article not displayed in this group.
7455 ((and gnus-auto-extend-newsgroup
7456 (not unread) (not subject))
7457 (gnus-summary-goto-article
7458 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7459 nil (count-lines (point-min) (point))))
7460 ;; Go to next/previous group.
7462 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7463 (gnus-summary-jump-to-group gnus-newsgroup-name))
7464 (let ((cmd last-command-char)
7466 (with-current-buffer gnus-group-buffer
7469 (if (eq gnus-keep-same-level 'best)
7470 (gnus-summary-best-group gnus-newsgroup-name)
7471 (gnus-summary-search-group backward gnus-keep-same-level))))
7472 ;; For some reason, the group window gets selected. We change
7474 (select-window (get-buffer-window (current-buffer)))
7475 ;; Select next unread newsgroup automagically.
7477 ((or (not gnus-auto-select-next)
7479 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7480 ((or (eq gnus-auto-select-next 'quietly)
7481 (and (eq gnus-auto-select-next 'slightly-quietly)
7483 (and (eq gnus-auto-select-next 'almost-quietly)
7484 (gnus-summary-last-article-p)))
7486 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7488 (gnus-message 7 "No more%s articles (%s)..."
7489 (if unread " unread" "")
7490 (if group (concat "selecting " group)
7492 (gnus-summary-next-group nil group backward)))
7494 (when (gnus-key-press-event-p last-input-event)
7495 (gnus-summary-walk-group-buffer
7496 gnus-newsgroup-name cmd unread backward point))))))))
7498 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7499 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7500 (?\C-p (gnus-group-prev-unread-group 1))))
7501 (cursor-in-echo-area t)
7502 keve key group ended prompt)
7504 (set-buffer gnus-group-buffer)
7507 (if (eq gnus-keep-same-level 'best)
7508 (gnus-summary-best-group gnus-newsgroup-name)
7509 (gnus-summary-search-group backward gnus-keep-same-level))))
7513 "No more%s articles%s " (if unread " unread" "")
7515 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7516 (format " (Type %s for %s [%s])"
7517 (single-key-description cmd)
7518 (gnus-group-decoded-name group)
7519 (gnus-group-unread group))
7520 (format " (Type %s to exit %s)"
7521 (single-key-description cmd)
7522 (gnus-group-decoded-name gnus-newsgroup-name)))))
7523 ;; Confirm auto selection.
7524 (setq key (car (setq keve (gnus-read-event-char prompt)))
7527 ((assq key keystrokes)
7528 (let ((obuf (current-buffer)))
7529 (switch-to-buffer gnus-group-buffer)
7531 (gnus-group-jump-to-group group))
7532 (eval (cadr (assq key keystrokes)))
7533 (setq group (gnus-group-group-name))
7534 (switch-to-buffer obuf))
7538 (gnus-ephemeral-group-p gnus-newsgroup-name))
7540 (gnus-summary-next-group nil group backward)))
7542 (push (cdr keve) unread-command-events))))))
7544 (defun gnus-summary-next-unread-article ()
7545 "Select unread article after current one."
7547 (gnus-summary-next-article
7548 (or (not (eq gnus-summary-goto-unread 'never))
7549 (gnus-summary-last-article-p (gnus-summary-article-number)))
7550 (and gnus-auto-select-same
7551 (gnus-summary-article-subject))))
7553 (defun gnus-summary-prev-article (&optional unread subject)
7554 "Select the article after the current one.
7555 If UNREAD is non-nil, only unread articles are selected."
7557 (gnus-summary-next-article unread subject t))
7559 (defun gnus-summary-prev-unread-article ()
7560 "Select unread article before current one."
7562 (gnus-summary-prev-article
7563 (or (not (eq gnus-summary-goto-unread 'never))
7564 (gnus-summary-first-article-p (gnus-summary-article-number)))
7565 (and gnus-auto-select-same
7566 (gnus-summary-article-subject))))
7568 (defun gnus-summary-next-page (&optional lines circular stop)
7569 "Show next page of the selected article.
7570 If at the end of the current article, select the next article.
7571 LINES says how many lines should be scrolled up.
7573 If CIRCULAR is non-nil, go to the start of the article instead of
7574 selecting the next article when reaching the end of the current
7577 If STOP is non-nil, just stop when reaching the end of the message.
7579 Also see the variable `gnus-article-skip-boring'."
7581 (setq gnus-summary-buffer (current-buffer))
7582 (gnus-set-global-variables)
7583 (let ((article (gnus-summary-article-number))
7584 (article-window (get-buffer-window gnus-article-buffer t))
7586 ;; If the buffer is empty, we have no article.
7588 (error "No article to select"))
7589 (gnus-configure-windows 'article)
7590 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7591 (if (and (eq gnus-summary-goto-unread 'never)
7592 (not (gnus-summary-last-article-p article)))
7593 (gnus-summary-next-article)
7594 (gnus-summary-next-unread-article))
7595 (if (or (null gnus-current-article)
7596 (null gnus-article-current)
7597 (/= article (cdr gnus-article-current))
7598 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7599 ;; Selected subject is different from current article's.
7600 (gnus-summary-display-article article)
7601 (when article-window
7602 (gnus-eval-in-buffer-window gnus-article-buffer
7603 (setq endp (or (gnus-article-next-page lines)
7604 (gnus-article-only-boring-p))))
7607 (gnus-message 3 "End of message"))
7609 (gnus-summary-beginning-of-article))
7611 (gnus-message 3 "End of message"))
7613 (if (and (eq gnus-summary-goto-unread 'never)
7614 (not (gnus-summary-last-article-p article)))
7615 (gnus-summary-next-article)
7616 (gnus-summary-next-unread-article))))))))
7617 (gnus-summary-recenter)
7618 (gnus-summary-position-point)))
7620 (defun gnus-summary-prev-page (&optional lines move)
7621 "Show previous page of selected article.
7622 Argument LINES specifies lines to be scrolled down.
7623 If MOVE, move to the previous unread article if point is at
7624 the beginning of the buffer."
7626 (let ((article (gnus-summary-article-number))
7627 (article-window (get-buffer-window gnus-article-buffer t))
7629 (gnus-configure-windows 'article)
7630 (if (or (null gnus-current-article)
7631 (null gnus-article-current)
7632 (/= article (cdr gnus-article-current))
7633 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7634 ;; Selected subject is different from current article's.
7635 (gnus-summary-display-article article)
7636 (gnus-summary-recenter)
7637 (when article-window
7638 (gnus-eval-in-buffer-window gnus-article-buffer
7639 (setq endp (gnus-article-prev-page lines)))
7640 (when (and move endp)
7642 (gnus-message 3 "Beginning of message"))
7644 (if (and (eq gnus-summary-goto-unread 'never)
7645 (not (gnus-summary-first-article-p article)))
7646 (gnus-summary-prev-article)
7647 (gnus-summary-prev-unread-article))))))))
7648 (gnus-summary-position-point))
7650 (defun gnus-summary-prev-page-or-article (&optional lines)
7651 "Show previous page of selected article.
7652 Argument LINES specifies lines to be scrolled down.
7653 If at the beginning of the article, go to the next article."
7655 (gnus-summary-prev-page lines t))
7657 (defun gnus-summary-scroll-up (lines)
7658 "Scroll up (or down) one line current article.
7659 Argument LINES specifies lines to be scrolled up (or down if negative)."
7661 (gnus-configure-windows 'article)
7662 (gnus-summary-show-thread)
7663 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7664 (gnus-eval-in-buffer-window gnus-article-buffer
7666 (when (gnus-article-next-page lines)
7667 (gnus-message 3 "End of message")))
7669 (gnus-article-prev-page (- lines))))))
7670 (gnus-summary-recenter)
7671 (gnus-summary-position-point))
7673 (defun gnus-summary-scroll-down (lines)
7674 "Scroll down (or up) one line current article.
7675 Argument LINES specifies lines to be scrolled down (or up if negative)."
7677 (gnus-summary-scroll-up (- lines)))
7679 (defun gnus-summary-next-same-subject ()
7680 "Select next article which has the same subject as current one."
7682 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7684 (defun gnus-summary-prev-same-subject ()
7685 "Select previous article which has the same subject as current one."
7687 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7689 (defun gnus-summary-next-unread-same-subject ()
7690 "Select next unread article which has the same subject as current one."
7692 (gnus-summary-next-article t (gnus-summary-article-subject)))
7694 (defun gnus-summary-prev-unread-same-subject ()
7695 "Select previous unread article which has the same subject as current one."
7697 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7699 (defun gnus-summary-first-unread-article ()
7700 "Select the first unread article.
7701 Return nil if there are no unread articles."
7704 (when (gnus-summary-first-subject t)
7705 (gnus-summary-show-thread)
7706 (gnus-summary-first-subject t)
7707 (gnus-summary-display-article (gnus-summary-article-number)))
7708 (gnus-summary-position-point)))
7710 (defun gnus-summary-first-unread-subject ()
7711 "Place the point on the subject line of the first unread article.
7712 Return nil if there are no unread articles."
7715 (when (gnus-summary-first-subject t)
7716 (gnus-summary-show-thread)
7717 (gnus-summary-first-subject t))
7718 (gnus-summary-position-point)))
7720 (defun gnus-summary-first-unseen-subject ()
7721 "Place the point on the subject line of the first unseen article.
7722 Return nil if there are no unseen articles."
7725 (when (gnus-summary-first-subject nil nil t)
7726 (gnus-summary-show-thread)
7727 (gnus-summary-first-subject nil nil t))
7728 (gnus-summary-position-point)))
7730 (defun gnus-summary-first-unseen-or-unread-subject ()
7731 "Place the point on the subject line of the first unseen article or,
7732 if all article have been seen, on the subject line of the first unread
7736 (unless (when (gnus-summary-first-subject nil nil t)
7737 (gnus-summary-show-thread)
7738 (gnus-summary-first-subject nil nil t))
7739 (when (gnus-summary-first-subject t)
7740 (gnus-summary-show-thread)
7741 (gnus-summary-first-subject t)))
7742 (gnus-summary-position-point)))
7744 (defun gnus-summary-first-article ()
7745 "Select the first article.
7746 Return nil if there are no articles."
7749 (when (gnus-summary-first-subject)
7750 (gnus-summary-show-thread)
7751 (gnus-summary-first-subject)
7752 (gnus-summary-display-article (gnus-summary-article-number)))
7753 (gnus-summary-position-point)))
7755 (defun gnus-summary-best-unread-article (&optional arg)
7756 "Select the unread article with the highest score.
7757 If given a prefix argument, select the next unread article that has a
7758 score higher than the default score."
7760 (let ((article (if arg
7761 (gnus-summary-better-unread-subject)
7762 (gnus-summary-best-unread-subject))))
7764 (gnus-summary-goto-article article)
7765 (error "No unread articles"))))
7767 (defun gnus-summary-best-unread-subject ()
7768 "Select the unread subject with the highest score."
7770 (let ((best -1000000)
7771 (data gnus-newsgroup-data)
7774 (and (gnus-data-unread-p (car data))
7776 (gnus-summary-article-score (gnus-data-number (car data))))
7779 article (gnus-data-number (car data))))
7780 (setq data (cdr data)))
7782 (gnus-summary-goto-subject article))
7783 (gnus-summary-position-point)
7786 (defun gnus-summary-better-unread-subject ()
7787 "Select the first unread subject that has a score over the default score."
7789 (let ((data gnus-newsgroup-data)
7791 (while (and (setq article (gnus-data-number (car data)))
7792 (or (gnus-data-read-p (car data))
7793 (not (> (gnus-summary-article-score article)
7794 gnus-summary-default-score))))
7795 (setq data (cdr data)))
7797 (gnus-summary-goto-subject article))
7798 (gnus-summary-position-point)
7801 (defun gnus-summary-last-subject ()
7802 "Go to the last displayed subject line in the group."
7803 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7805 (gnus-summary-goto-subject article))))
7807 (defun gnus-summary-goto-article (article &optional all-headers force)
7808 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7809 If ALL-HEADERS is non-nil, no header lines are hidden.
7810 If FORCE, go to the article even if it isn't displayed. If FORCE
7811 is a number, it is the line the article is to be displayed on."
7815 "Article number or Message-ID: "
7816 (mapcar (lambda (number) (list (int-to-string number)))
7817 gnus-newsgroup-limit))
7821 (if (and (stringp article)
7822 (string-match "@\\|%40" article))
7823 (gnus-summary-refer-article article)
7824 (when (stringp article)
7825 (setq article (string-to-number article)))
7826 (if (gnus-summary-goto-subject article force)
7827 (gnus-summary-display-article article all-headers)
7828 (gnus-message 4 "Couldn't go to article %s" article) nil))
7829 (gnus-summary-position-point)))
7831 (defun gnus-summary-goto-last-article ()
7832 "Go to the previously read article."
7835 (when gnus-last-article
7836 (gnus-summary-goto-article gnus-last-article nil t))
7837 (gnus-summary-position-point)))
7839 (defun gnus-summary-pop-article (number)
7840 "Pop one article off the history and go to the previous.
7841 NUMBER articles will be popped off."
7844 (setq gnus-newsgroup-history
7845 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7847 (gnus-summary-goto-article (car to) nil t)
7848 (error "Article history empty")))
7849 (gnus-summary-position-point))
7851 ;; Summary commands and functions for limiting the summary buffer.
7853 (defun gnus-summary-limit-to-articles (n)
7854 "Limit the summary buffer to the next N articles.
7855 If not given a prefix, use the process marked articles instead."
7858 (let ((articles (gnus-summary-work-articles n)))
7859 (setq gnus-newsgroup-processable nil)
7860 (gnus-summary-limit articles))
7861 (gnus-summary-position-point)))
7863 (defun gnus-summary-pop-limit (&optional total)
7864 "Restore the previous limit.
7865 If given a prefix, remove all limits."
7868 (setq gnus-newsgroup-limits
7869 (list (mapcar (lambda (h) (mail-header-number h))
7870 gnus-newsgroup-headers))))
7871 (unless gnus-newsgroup-limits
7872 (error "No limit to pop"))
7874 (gnus-summary-limit nil 'pop)
7875 (gnus-summary-position-point)))
7877 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7878 "Limit the summary buffer to articles that have subjects that match a regexp.
7879 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7881 (list (read-string (if current-prefix-arg
7882 "Exclude subject (regexp): "
7883 "Limit to subject (regexp): "))
7884 nil current-prefix-arg))
7886 (setq header "subject"))
7887 (when (not (equal "" subject))
7889 (let ((articles (gnus-summary-find-matching
7890 (or header "subject") subject 'all nil nil
7893 (error "Found no matches for \"%s\"" subject))
7894 (gnus-summary-limit articles))
7895 (gnus-summary-position-point))))
7897 (defun gnus-summary-limit-to-author (from &optional not-matching)
7898 "Limit the summary buffer to articles that have authors that match a regexp.
7899 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7901 (list (read-string (if current-prefix-arg
7902 "Exclude author (regexp): "
7903 "Limit to author (regexp): "))
7904 current-prefix-arg))
7905 (gnus-summary-limit-to-subject from "from" not-matching))
7907 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7908 "Limit the summary buffer to articles with the given RECIPIENT.
7910 If NOT-MATCHING, exclude RECIPIENT.
7912 To and Cc headers are checked. You need to include them in
7913 `nnmail-extra-headers'."
7914 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7916 (list (read-string (format "%s recipient (regexp): "
7917 (if current-prefix-arg "Exclude" "Limit to")))
7918 current-prefix-arg))
7919 (when (not (equal "" recipient))
7921 (if (memq 'To nnmail-extra-headers)
7922 (gnus-summary-find-matching
7923 (cons 'extra 'To) recipient 'all nil nil
7926 1 "`To' isn't present in `nnmail-extra-headers'")
7930 (if (memq 'Cc nnmail-extra-headers)
7931 (gnus-summary-find-matching
7932 (cons 'extra 'Cc) recipient 'all nil nil
7935 1 "`Cc' isn't present in `nnmail-extra-headers'")
7940 ;; We need the numbers that are in both lists:
7942 (and (memq a to) a))
7946 (error "Found no matches for \"%s\"" recipient))
7947 (gnus-summary-limit articles))
7948 (gnus-summary-position-point))))
7950 (defun gnus-summary-limit-strange-charsets-predicate (header)
7951 (let ((string (concat (mail-header-subject header)
7952 (mail-header-from header)))
7954 (dotimes (i (1- (length string)))
7955 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
7956 (when (string-match "unicode\\|big\\|japanese" charset)
7960 (defun gnus-summary-limit-to-predicate (predicate)
7961 "Limit to articles where PREDICATE returns non-nil.
7962 PREDICATE will be called with the header structures of the
7964 (let ((articles nil)
7965 (case-fold-search t))
7966 (dolist (header gnus-newsgroup-headers)
7967 (when (funcall predicate header)
7968 (push (mail-header-number header) articles)))
7969 (gnus-summary-limit (nreverse articles))))
7971 (defun gnus-summary-limit-to-age (age &optional younger-p)
7972 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7973 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7974 articles that are younger than AGE days."
7976 (let ((younger current-prefix-arg)
7979 (while (not days-got)
7980 (setq days (if younger
7981 (read-string "Limit to articles younger than (in days, older when negative): ")
7983 "Limit to articles older than (in days, younger when negative): ")))
7984 (when (> (length days) 0)
7985 (setq days (read days)))
7990 (setq younger (not younger))
7991 (setq days (* days -1))))
7992 (message "Please enter a number.")
7994 (list days younger)))
7996 (let ((data gnus-newsgroup-data)
7997 (cutoff (days-to-time age))
7998 articles d date is-younger)
7999 (while (setq d (pop data))
8000 (when (and (vectorp (gnus-data-header d))
8001 (setq date (mail-header-date (gnus-data-header d))))
8002 (setq is-younger (time-less-p
8003 (time-since (condition-case ()
8010 (push (gnus-data-number d) articles))))
8011 (gnus-summary-limit (nreverse articles)))
8012 (gnus-summary-position-point)))
8014 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8015 "Limit the summary buffer to articles that match an 'extra' header."
8019 (gnus-completing-read-with-default
8020 (symbol-name (car gnus-extra-headers))
8021 (if current-prefix-arg
8022 "Exclude extra header"
8023 "Limit extra header")
8025 (cons (symbol-name x) x))
8030 (read-string (format "%s header %s (regexp): "
8031 (if current-prefix-arg "Exclude" "Limit to")
8033 current-prefix-arg)))
8034 (when (not (equal "" regexp))
8036 (let ((articles (gnus-summary-find-matching
8037 (cons 'extra header) regexp 'all nil nil
8040 (error "Found no matches for \"%s\"" regexp))
8041 (gnus-summary-limit articles))
8042 (gnus-summary-position-point))))
8044 (defun gnus-summary-limit-to-display-predicate ()
8045 "Limit the summary buffer to the predicated in the `display' group parameter."
8047 (unless gnus-newsgroup-display
8048 (error "There is no `display' group parameter"))
8050 (dolist (number gnus-newsgroup-articles)
8051 (when (funcall gnus-newsgroup-display)
8052 (push number articles)))
8053 (gnus-summary-limit articles))
8054 (gnus-summary-position-point))
8056 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8058 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8060 (defun gnus-summary-limit-to-unread (&optional all)
8061 "Limit the summary buffer to articles that are not marked as read.
8062 If ALL is non-nil, limit strictly to unread articles."
8065 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8066 (gnus-summary-limit-to-marks
8067 ;; Concat all the marks that say that an article is read and have
8069 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8070 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8071 gnus-low-score-mark gnus-expirable-mark
8072 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8073 gnus-duplicate-mark gnus-souped-mark)
8076 (defun gnus-summary-limit-to-headers (match &optional reverse)
8077 "Limit the summary buffer to articles that have headers that match MATCH.
8078 If REVERSE (the prefix), limit to articles that don't match."
8079 (interactive "sMatch headers (regexp): \nP")
8080 (gnus-summary-limit-to-bodies match reverse t))
8082 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8083 "Limit the summary buffer to articles that have bodies that match MATCH.
8084 If REVERSE (the prefix), limit to articles that don't match."
8085 (interactive "sMatch body (regexp): \nP")
8086 (let ((articles nil)
8087 (gnus-select-article-hook nil) ;Disable hook.
8088 (gnus-article-prepare-hook nil)
8089 (gnus-use-article-prefetch nil)
8090 (gnus-keep-backlog nil)
8091 (gnus-break-pages nil)
8092 (gnus-summary-display-arrow nil)
8093 (gnus-updated-mode-lines nil)
8094 (gnus-auto-center-summary nil)
8095 (gnus-display-mime-function nil))
8096 (dolist (data gnus-newsgroup-data)
8097 (let (gnus-mark-article-hook)
8098 (gnus-summary-select-article t t nil (gnus-data-number data)))
8100 (set-buffer gnus-article-buffer)
8102 (let* ((case-fold-search t)
8104 (re-search-backward match nil t)
8105 (re-search-forward match nil t))))
8106 (when (or (and found
8110 (push (gnus-data-number data) articles)))))
8112 (message "No messages matched")
8113 (gnus-summary-limit articles)))
8114 (gnus-summary-position-point))
8116 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8117 "Limit the summary buffer to articles that aren't part on any thread.
8118 If THREADSP (the prefix), limit to articles that are in threads."
8120 (let ((articles nil)
8123 (dolist (thread gnus-newsgroup-threads)
8124 (if (stringp (car thread))
8125 (dolist (thread (cdr thread))
8126 (push thread threads))
8127 (push thread threads)))
8128 (dolist (thread threads)
8129 (setq thread-articles (gnus-articles-in-thread thread))
8130 (when (or (and threadsp
8131 (> (length thread-articles) 1))
8133 (= (length thread-articles) 1)))
8134 (setq articles (nconc thread-articles articles))))
8136 (message "No messages matched")
8137 (gnus-summary-limit articles))
8138 (gnus-summary-position-point)))
8140 (defun gnus-summary-limit-to-replied (&optional unreplied)
8141 "Limit the summary buffer to replied articles.
8142 If UNREPLIED (the prefix), limit to unreplied articles."
8146 (gnus-set-difference gnus-newsgroup-articles
8147 gnus-newsgroup-replied))
8148 (gnus-summary-limit gnus-newsgroup-replied))
8149 (gnus-summary-position-point))
8151 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8152 (make-obsolete 'gnus-summary-delete-marked-with
8153 'gnus-summary-limit-exclude-marks)
8155 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8156 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8157 If REVERSE, limit the summary buffer to articles that are marked
8158 with MARKS. MARKS can either be a string of marks or a list of marks.
8159 Returns how many articles were removed."
8160 (interactive "sMarks: ")
8161 (gnus-summary-limit-to-marks marks t))
8163 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8164 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8165 If REVERSE (the prefix), limit the summary buffer to articles that are
8166 not marked with MARKS. MARKS can either be a string of marks or a
8168 Returns how many articles were removed."
8169 (interactive "sMarks: \nP")
8171 (let ((data gnus-newsgroup-data)
8172 (marks (if (listp marks) marks
8173 (append marks nil))) ; Transform to list.
8176 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8177 (memq (gnus-data-mark (car data)) marks))
8178 (push (gnus-data-number (car data)) articles))
8179 (setq data (cdr data)))
8180 (gnus-summary-limit articles))
8181 (gnus-summary-position-point)))
8183 (defun gnus-summary-limit-to-score (score)
8184 "Limit to articles with score at or above SCORE."
8185 (interactive "NLimit to articles with score of at least: ")
8186 (let ((data gnus-newsgroup-data)
8189 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8191 (push (gnus-data-number (car data)) articles))
8192 (setq data (cdr data)))
8194 (gnus-summary-limit articles)
8195 (gnus-summary-position-point))))
8197 (defun gnus-summary-limit-to-unseen ()
8198 "Limit to unseen articles."
8201 (gnus-summary-limit gnus-newsgroup-unseen)
8202 (gnus-summary-position-point)))
8204 (defun gnus-summary-limit-include-thread (id)
8205 "Display all the hidden articles that is in the thread with ID in it.
8206 When called interactively, ID is the Message-ID of the current
8208 (interactive (list (mail-header-id (gnus-summary-article-header))))
8209 (let ((articles (gnus-articles-in-thread
8210 (gnus-id-to-thread (gnus-root-id id)))))
8212 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8213 (gnus-summary-limit-include-matching-articles
8215 (regexp-quote (gnus-simplify-subject-re
8216 (mail-header-subject (gnus-id-to-header id)))))
8217 (gnus-summary-position-point))))
8219 (defun gnus-summary-limit-include-matching-articles (header regexp)
8220 "Display all the hidden articles that have HEADERs that match REGEXP."
8221 (interactive (list (read-string "Match on header: ")
8222 (read-string "Regexp: ")))
8223 (let ((articles (gnus-find-matching-articles header regexp)))
8225 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8226 (gnus-summary-position-point))))
8228 (defun gnus-summary-insert-dormant-articles ()
8229 "Insert all the dormant articles for this group into the current buffer."
8231 (let ((gnus-verbose (max 6 gnus-verbose)))
8232 (if (not gnus-newsgroup-dormant)
8233 (gnus-message 3 "No dormant articles for this group")
8234 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8236 (defun gnus-summary-insert-ticked-articles ()
8237 "Insert ticked articles for this group into the current buffer."
8239 (let ((gnus-verbose (max 6 gnus-verbose)))
8240 (if (not gnus-newsgroup-marked)
8241 (gnus-message 3 "No ticked articles for this group")
8242 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8244 (defun gnus-summary-limit-include-dormant ()
8245 "Display all the hidden articles that are marked as dormant.
8246 Note that this command only works on a subset of the articles currently
8247 fetched for this group."
8249 (unless gnus-newsgroup-dormant
8250 (error "There are no dormant articles in this group"))
8252 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8253 (gnus-summary-position-point)))
8255 (defun gnus-summary-limit-exclude-dormant ()
8256 "Hide all dormant articles."
8259 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8260 (gnus-summary-position-point)))
8262 (defun gnus-summary-limit-exclude-childless-dormant ()
8263 "Hide all dormant articles that have no children."
8265 (let ((data (gnus-data-list t))
8266 articles d children)
8267 ;; Find all articles that are either not dormant or have
8269 (while (setq d (pop data))
8270 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8272 (gnus-article-children (gnus-data-number d)))
8275 (when (memq (car children) articles)
8280 (push (gnus-data-number d) articles)))
8283 (gnus-summary-limit articles)
8284 (gnus-summary-position-point))))
8286 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8287 "Mark all unread excluded articles as read.
8288 If ALL, mark even excluded ticked and dormants as read."
8290 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8291 (let ((articles (gnus-sorted-ndifference
8293 (mapcar (lambda (h) (mail-header-number h))
8294 gnus-newsgroup-headers)
8296 gnus-newsgroup-limit))
8298 (setq gnus-newsgroup-unreads
8299 (gnus-sorted-intersection gnus-newsgroup-unreads
8300 gnus-newsgroup-limit))
8302 (setq gnus-newsgroup-dormant nil
8303 gnus-newsgroup-marked nil
8304 gnus-newsgroup-reads
8306 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8307 gnus-newsgroup-reads))
8308 (while (setq article (pop articles))
8309 (unless (or (memq article gnus-newsgroup-dormant)
8310 (memq article gnus-newsgroup-marked))
8311 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8313 (defun gnus-summary-limit (articles &optional pop)
8315 ;; We pop the previous limit off the stack and use that.
8316 (setq articles (car gnus-newsgroup-limits)
8317 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8318 ;; We use the new limit, so we push the old limit on the stack.
8319 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8321 (setq gnus-newsgroup-limit articles)
8322 (let ((total (length gnus-newsgroup-data))
8323 (data (gnus-data-find-list (gnus-summary-article-number)))
8324 (gnus-summary-mark-below nil) ; Inhibit this.
8326 ;; This will do all the work of generating the new summary buffer
8327 ;; according to the new limit.
8328 (gnus-summary-prepare)
8329 ;; Hide any threads, possibly.
8330 (gnus-summary-maybe-hide-threads)
8331 ;; Try to return to the article you were at, or one in the
8334 ;; We try to find some article after the current one.
8336 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8339 (setq data (cdr data))))
8341 ;; If there is no data, that means that we were after the last
8342 ;; article. The same goes when we can't find any articles
8343 ;; after the current one.
8344 (goto-char (point-max))
8345 (gnus-summary-find-prev))
8346 (gnus-set-mode-line 'summary)
8347 ;; We return how many articles were removed from the summary
8348 ;; buffer as a result of the new limit.
8349 (- total (length gnus-newsgroup-data))))
8351 (defsubst gnus-invisible-cut-children (threads)
8354 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8359 (defsubst gnus-cut-thread (thread)
8360 "Go forwards in the thread until we find an article that we want to display."
8361 (when (or (eq gnus-fetch-old-headers 'some)
8362 (eq gnus-fetch-old-headers 'invisible)
8363 (numberp gnus-fetch-old-headers)
8364 (eq gnus-build-sparse-threads 'some)
8365 (eq gnus-build-sparse-threads 'more))
8366 ;; Deal with old-fetched headers and sparse threads.
8370 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8371 (gnus-summary-article-ancient-p
8372 (mail-header-number (car thread))))
8373 (if (or (<= (length (cdr thread)) 1)
8374 (eq gnus-fetch-old-headers 'invisible))
8375 (setq gnus-newsgroup-limit
8376 (delq (mail-header-number (car thread))
8377 gnus-newsgroup-limit)
8378 thread (cadr thread))
8379 (when (gnus-invisible-cut-children (cdr thread))
8380 (let ((th (cdr thread)))
8382 (if (memq (mail-header-number (caar th))
8383 gnus-newsgroup-limit)
8384 (setq thread (car th)
8386 (setq th (cdr th))))))))))
8389 (defun gnus-cut-threads (threads)
8390 "Cut off all uninteresting articles from the beginning of THREADS."
8391 (when (or (eq gnus-fetch-old-headers 'some)
8392 (eq gnus-fetch-old-headers 'invisible)
8393 (numberp gnus-fetch-old-headers)
8394 (eq gnus-build-sparse-threads 'some)
8395 (eq gnus-build-sparse-threads 'more))
8398 (setcar th (gnus-cut-thread (car th)))
8399 (setq th (cdr th)))))
8400 ;; Remove nixed out threads.
8403 (defun gnus-summary-initial-limit (&optional show-if-empty)
8404 "Figure out what the initial limit is supposed to be on group entry.
8405 This entails weeding out unwanted dormants, low-scored articles,
8406 fetch-old-headers verbiage, and so on."
8407 ;; Most groups have nothing to remove.
8408 (if (or gnus-inhibit-limiting
8409 (and (null gnus-newsgroup-dormant)
8410 (eq gnus-newsgroup-display 'gnus-not-ignore)
8411 (not (eq gnus-fetch-old-headers 'some))
8412 (not (numberp gnus-fetch-old-headers))
8413 (not (eq gnus-fetch-old-headers 'invisible))
8414 (null gnus-summary-expunge-below)
8415 (not (eq gnus-build-sparse-threads 'some))
8416 (not (eq gnus-build-sparse-threads 'more))
8417 (null gnus-thread-expunge-below)
8418 (not gnus-use-nocem)))
8420 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8421 (setq gnus-newsgroup-limit nil)
8424 (unless (car (symbol-value node))
8425 ;; These threads have no parents -- they are roots.
8426 (let ((nodes (cdr (symbol-value node)))
8429 (if (and gnus-thread-expunge-below
8430 (< (gnus-thread-total-score (car nodes))
8431 gnus-thread-expunge-below))
8432 (gnus-expunge-thread (pop nodes))
8433 (setq thread (pop nodes))
8434 (gnus-summary-limit-children thread))))))
8435 gnus-newsgroup-dependencies)
8436 ;; If this limitation resulted in an empty group, we might
8437 ;; pop the previous limit and use it instead.
8438 (when (and (not gnus-newsgroup-limit)
8440 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8441 gnus-newsgroup-limit))
8443 (defun gnus-summary-limit-children (thread)
8444 "Return 1 if this subthread is visible and 0 if it is not."
8445 ;; First we get the number of visible children to this thread. This
8446 ;; is done by recursing down the thread using this function, so this
8447 ;; will really go down to a leaf article first, before slowly
8448 ;; working its way up towards the root.
8450 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8453 (apply '+ (mapcar 'gnus-summary-limit-children
8456 (number (mail-header-number (car thread)))
8459 (not (memq number gnus-newsgroup-marked))
8461 ;; If this article is dormant and has absolutely no visible
8462 ;; children, then this article isn't visible.
8463 (and (memq number gnus-newsgroup-dormant)
8465 ;; If this is "fetch-old-headered" and there is no
8466 ;; visible children, then we don't want this article.
8467 (and (or (eq gnus-fetch-old-headers 'some)
8468 (numberp gnus-fetch-old-headers))
8469 (gnus-summary-article-ancient-p number)
8471 ;; If this is "fetch-old-headered" and `invisible', then
8472 ;; we don't want this article.
8473 (and (eq gnus-fetch-old-headers 'invisible)
8474 (gnus-summary-article-ancient-p number))
8475 ;; If this is a sparsely inserted article with no children,
8476 ;; we don't want it.
8477 (and (eq gnus-build-sparse-threads 'some)
8478 (gnus-summary-article-sparse-p number)
8480 ;; If we use expunging, and this article is really
8481 ;; low-scored, then we don't want this article.
8482 (when (and gnus-summary-expunge-below
8484 (or (cdr (assq number gnus-newsgroup-scored))
8485 gnus-summary-default-score))
8486 gnus-summary-expunge-below))
8487 ;; We increase the expunge-tally here, but that has
8488 ;; nothing to do with the limits, really.
8489 (incf gnus-newsgroup-expunged-tally)
8490 ;; We also mark as read here, if that's wanted.
8491 (when (and gnus-summary-mark-below
8492 (< score gnus-summary-mark-below))
8493 (setq gnus-newsgroup-unreads
8494 (delq number gnus-newsgroup-unreads))
8495 (if gnus-newsgroup-auto-expire
8496 (push number gnus-newsgroup-expirable)
8497 (push (cons number gnus-low-score-mark)
8498 gnus-newsgroup-reads)))
8500 ;; Do the `display' group parameter.
8501 (and gnus-newsgroup-display
8502 (not (funcall gnus-newsgroup-display)))
8503 ;; Check NoCeM things.
8504 (when (and gnus-use-nocem
8505 (gnus-nocem-unwanted-article-p
8506 (mail-header-id (car thread))))
8507 (setq gnus-newsgroup-unreads
8508 (delq number gnus-newsgroup-unreads))
8510 ;; Nope, invisible article.
8512 ;; Ok, this article is to be visible, so we add it to the limit
8514 (push number gnus-newsgroup-limit)
8517 (defun gnus-expunge-thread (thread)
8518 "Mark all articles in THREAD as read."
8519 (let* ((number (mail-header-number (car thread))))
8520 (incf gnus-newsgroup-expunged-tally)
8521 ;; We also mark as read here, if that's wanted.
8522 (setq gnus-newsgroup-unreads
8523 (delq number gnus-newsgroup-unreads))
8524 (if gnus-newsgroup-auto-expire
8525 (push number gnus-newsgroup-expirable)
8526 (push (cons number gnus-low-score-mark)
8527 gnus-newsgroup-reads)))
8528 ;; Go recursively through all subthreads.
8529 (mapcar 'gnus-expunge-thread (cdr thread)))
8531 ;; Summary article oriented commands
8533 (defun gnus-summary-refer-parent-article (n)
8534 "Refer parent article N times.
8535 If N is negative, go to ancestor -N instead.
8536 The difference between N and the number of articles fetched is returned."
8540 (when (not (natnump n))
8545 (setq header (gnus-summary-article-header))
8546 (if (and (eq (mail-header-number header)
8547 (cdr gnus-article-current))
8548 (equal gnus-newsgroup-name
8549 (car gnus-article-current)))
8550 ;; If we try to find the parent of the currently
8551 ;; displayed article, then we take a look at the actual
8552 ;; References header, since this is slightly more
8553 ;; reliable than the References field we got from the
8556 (set-buffer gnus-original-article-buffer)
8557 (nnheader-narrow-to-headers)
8558 (unless (setq ref (message-fetch-field "references"))
8559 (when (setq ref (message-fetch-field "in-reply-to"))
8560 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8563 ;; It's not the current article, so we take a bet on
8564 ;; the value we got from the server.
8565 (mail-header-references header)))
8567 (not (equal ref "")))
8568 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8569 (gnus-message 1 "Couldn't find parent"))
8570 (gnus-message 1 "No references in article %d"
8571 (gnus-summary-article-number))
8574 (gnus-summary-position-point)
8577 (defun gnus-summary-refer-references ()
8578 "Fetch all articles mentioned in the References header.
8579 Return the number of articles fetched."
8581 (let ((ref (mail-header-references (gnus-summary-article-header)))
8582 (current (gnus-summary-article-number))
8586 (error "No References in the current article")
8587 ;; For each Message-ID in the References header...
8588 (while (string-match "<[^>]*>" ref)
8590 ;; ... fetch that article.
8591 (gnus-summary-refer-article
8592 (prog1 (match-string 0 ref)
8593 (setq ref (substring ref (match-end 0))))))
8594 (gnus-summary-goto-subject current)
8595 (gnus-summary-position-point)
8598 (defun gnus-summary-refer-thread (&optional limit)
8599 "Fetch all articles in the current thread.
8600 If LIMIT (the numerical prefix), fetch that many old headers instead
8601 of what's specified by the `gnus-refer-thread-limit' variable."
8603 (let ((id (mail-header-id (gnus-summary-article-header)))
8604 (limit (if limit (prefix-numeric-value limit)
8605 gnus-refer-thread-limit)))
8606 (unless (eq gnus-fetch-old-headers 'invisible)
8607 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8608 ;; Retrieve the headers and read them in.
8609 (if (eq (if (numberp limit)
8610 (gnus-retrieve-headers
8612 (+ (mail-header-number
8613 (gnus-summary-article-header))
8615 gnus-newsgroup-end))
8616 gnus-newsgroup-name (* limit 2))
8617 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8619 (gnus-retrieve-headers (list gnus-newsgroup-end)
8620 gnus-newsgroup-name limit))
8622 (gnus-build-all-threads)
8623 (error "Can't fetch thread from back ends that don't support NOV"))
8624 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8625 (gnus-summary-limit-include-thread id)))
8627 (defun gnus-summary-refer-article (message-id)
8628 "Fetch an article specified by MESSAGE-ID."
8629 (interactive "sMessage-ID: ")
8630 (when (and (stringp message-id)
8631 (not (zerop (length message-id))))
8632 (setq message-id (gnus-replace-in-string message-id " " ""))
8633 ;; Construct the correct Message-ID if necessary.
8634 ;; Suggested by tale@pawl.rpi.edu.
8635 (unless (string-match "^<" message-id)
8636 (setq message-id (concat "<" message-id)))
8637 (unless (string-match ">$" message-id)
8638 (setq message-id (concat message-id ">")))
8639 ;; People often post MIDs from URLs, so unhex it:
8640 (unless (string-match "@" message-id)
8641 (setq message-id (gnus-url-unhex-string message-id)))
8642 (let* ((header (gnus-id-to-header message-id))
8644 (gnus-summary-article-sparse-p
8645 (mail-header-number header))
8646 (memq (mail-header-number header)
8647 gnus-newsgroup-limit)))
8650 ;; If the article is present in the buffer we just go to it.
8652 (or (not (gnus-summary-article-sparse-p
8653 (mail-header-number header)))
8656 (gnus-summary-goto-article
8657 (mail-header-number header) nil t)
8659 (gnus-summary-update-article (mail-header-number header)))))
8661 ;; We fetch the article.
8663 (dolist (gnus-override-method (gnus-refer-article-methods))
8664 (when (and (gnus-check-server gnus-override-method)
8665 ;; Fetch the header,
8666 (setq number (gnus-summary-insert-subject message-id)))
8667 ;; and display the article.
8668 (gnus-summary-select-article nil nil nil number)
8670 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8672 (defun gnus-refer-article-methods ()
8673 "Return a list of referable methods."
8675 ;; No method, so we default to current and native.
8676 ((null gnus-refer-article-method)
8677 (list gnus-current-select-method gnus-select-method))
8679 ((eq 'current gnus-refer-article-method)
8680 (list gnus-current-select-method))
8681 ;; List of select methods.
8682 ((not (and (symbolp (car gnus-refer-article-method))
8683 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8685 (dolist (method gnus-refer-article-method)
8686 (push (if (eq 'current method)
8687 gnus-current-select-method
8691 ;; One single select method.
8693 (list gnus-refer-article-method))))
8695 (defun gnus-summary-edit-parameters ()
8696 "Edit the group parameters of the current group."
8698 (gnus-group-edit-group gnus-newsgroup-name 'params))
8700 (defun gnus-summary-customize-parameters ()
8701 "Customize the group parameters of the current group."
8703 (gnus-group-customize gnus-newsgroup-name))
8705 (defun gnus-summary-enter-digest-group (&optional force)
8706 "Enter an nndoc group based on the current article.
8707 If FORCE, force a digest interpretation. If not, try
8708 to guess what the document format is."
8710 (let ((conf gnus-current-window-configuration))
8711 (save-window-excursion
8713 (let (gnus-article-prepare-hook
8714 gnus-display-mime-function
8716 (gnus-summary-select-article))))
8717 (setq gnus-current-window-configuration conf)
8718 (let* ((name (format "%s-%d"
8719 (gnus-group-prefixed-name
8720 gnus-newsgroup-name (list 'nndoc ""))
8721 (with-current-buffer gnus-summary-buffer
8722 gnus-current-article)))
8723 (ogroup gnus-newsgroup-name)
8724 (params (append (gnus-info-params (gnus-get-info ogroup))
8725 (list (cons 'to-group ogroup))
8726 (list (cons 'parent-group ogroup))
8727 (list (cons 'save-article-group ogroup))))
8728 (case-fold-search t)
8729 (buf (current-buffer))
8732 (set-buffer gnus-original-article-buffer)
8733 ;; Have the digest group inherit the main mail address of
8734 ;; the parent article.
8735 (when (setq to-address (or (gnus-fetch-field "reply-to")
8736 (gnus-fetch-field "from")))
8739 (list (cons 'to-address
8740 (funcall gnus-decode-encoded-address-function
8742 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8743 (insert-buffer-substring gnus-original-article-buffer)
8744 ;; Remove lines that may lead nndoc to misinterpret the
8747 (goto-char (point-min))
8748 (or (search-forward "\n\n" nil t) (point)))
8749 (goto-char (point-min))
8750 (delete-matching-lines "^Path:\\|^From ")
8753 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8754 (gnus-newsgroup-ephemeral-ignored-charsets
8755 gnus-newsgroup-ignored-charsets))
8756 (gnus-group-read-ephemeral-group
8757 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8759 ,(if force 'mbox 'guess)))
8761 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8763 ;; Make all postings to this group go to the parent group.
8764 (nconc (gnus-info-params (gnus-get-info name))
8766 ;; Couldn't select this doc group.
8767 (switch-to-buffer buf)
8768 (gnus-set-global-variables)
8769 (gnus-configure-windows 'summary)
8770 (gnus-message 3 "Article couldn't be entered?"))
8771 (kill-buffer dig)))))
8773 (defun gnus-summary-read-document (n)
8774 "Open a new group based on the current article(s).
8775 This will allow you to read digests and other similar
8776 documents as newsgroups.
8777 Obeys the standard process/prefix convention."
8779 (let* ((ogroup gnus-newsgroup-name)
8780 (params (append (gnus-info-params (gnus-get-info ogroup))
8781 (list (cons 'to-group ogroup))))
8782 group egroup groups vgroup)
8783 (dolist (article (gnus-summary-work-articles n))
8784 (setq group (format "%s-%d" gnus-newsgroup-name article))
8785 (gnus-summary-remove-process-mark article)
8786 (when (gnus-summary-display-article article)
8789 (insert-buffer-substring gnus-original-article-buffer)
8790 ;; Remove some headers that may lead nndoc to make
8792 (message-narrow-to-head)
8793 (goto-char (point-min))
8794 (delete-matching-lines "^Path:\\|^From ")
8797 (gnus-group-read-ephemeral-group
8798 group `(nndoc ,group (nndoc-address ,(current-buffer))
8799 (nndoc-article-type guess))
8802 ;; Make all postings to this group go to the parent group.
8803 (nconc (gnus-info-params (gnus-get-info egroup))
8805 (push egroup groups))
8806 ;; Couldn't select this doc group.
8807 (gnus-error 3 "Article couldn't be entered"))))))
8808 ;; Now we have selected all the documents.
8811 (error "None of the articles could be interpreted as documents"))
8812 ((gnus-group-read-ephemeral-group
8813 (setq vgroup (format
8814 "nnvirtual:%s-%s" gnus-newsgroup-name
8815 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8816 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8818 (cons (current-buffer) 'summary)))
8820 (error "Couldn't select virtual nndoc group")))))
8822 (defun gnus-summary-isearch-article (&optional regexp-p)
8823 "Do incremental search forward on the current article.
8824 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8826 (gnus-summary-select-article)
8827 (gnus-configure-windows 'article)
8828 (gnus-eval-in-buffer-window gnus-article-buffer
8831 (isearch-forward regexp-p))))
8833 (defun gnus-summary-repeat-search-article-forward ()
8834 "Repeat the previous search forwards."
8836 (unless gnus-last-search-regexp
8837 (error "No previous search"))
8838 (gnus-summary-search-article-forward gnus-last-search-regexp))
8840 (defun gnus-summary-repeat-search-article-backward ()
8841 "Repeat the previous search backwards."
8843 (unless gnus-last-search-regexp
8844 (error "No previous search"))
8845 (gnus-summary-search-article-forward gnus-last-search-regexp t))
8847 (defun gnus-summary-search-article-forward (regexp &optional backward)
8848 "Search for an article containing REGEXP forward.
8849 If BACKWARD, search backward instead."
8852 (format "Search article %s (regexp%s): "
8853 (if current-prefix-arg "backward" "forward")
8854 (if gnus-last-search-regexp
8855 (concat ", default " gnus-last-search-regexp)
8857 current-prefix-arg))
8858 (if (string-equal regexp "")
8859 (setq regexp (or gnus-last-search-regexp ""))
8860 (setq gnus-last-search-regexp regexp)
8861 (setq gnus-article-before-search gnus-current-article))
8862 ;; Intentionally set gnus-last-article.
8863 (setq gnus-last-article gnus-article-before-search)
8864 (let ((gnus-last-article gnus-last-article))
8865 (if (gnus-summary-search-article regexp backward)
8866 (gnus-summary-show-thread)
8867 (signal 'search-failed (list regexp)))))
8869 (defun gnus-summary-search-article-backward (regexp)
8870 "Search for an article containing REGEXP backward."
8873 (format "Search article backward (regexp%s): "
8874 (if gnus-last-search-regexp
8875 (concat ", default " gnus-last-search-regexp)
8877 (gnus-summary-search-article-forward regexp 'backward))
8879 (defun gnus-summary-search-article (regexp &optional backward)
8880 "Search for an article containing REGEXP.
8881 Optional argument BACKWARD means do search for backward.
8882 `gnus-select-article-hook' is not called during the search."
8883 ;; We have to require this here to make sure that the following
8884 ;; dynamic binding isn't shadowed by autoloading.
8885 (require 'gnus-async)
8887 (let ((gnus-select-article-hook nil) ;Disable hook.
8888 (gnus-article-prepare-hook nil)
8889 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8890 (gnus-use-article-prefetch nil)
8891 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8892 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8894 (gnus-keep-backlog nil)
8895 (gnus-break-pages nil)
8896 (gnus-summary-display-arrow nil)
8897 (gnus-updated-mode-lines nil)
8898 (gnus-auto-center-summary nil)
8899 (sum (current-buffer))
8900 (gnus-display-mime-function nil)
8903 (gnus-save-hidden-threads
8904 (gnus-summary-select-article)
8905 (set-buffer gnus-article-buffer)
8906 (goto-char (window-point (get-buffer-window (current-buffer))))
8910 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8912 (re-search-backward regexp nil t)
8913 (re-search-forward regexp nil t))
8914 ;; We found the regexp.
8919 (get-buffer-window (current-buffer))
8923 (get-buffer-window (current-buffer))
8926 (setq point (point)))
8927 ;; We didn't find it, so we go to the next article.
8930 (while (eq found 'not)
8931 (if (not (if backward (gnus-summary-find-prev)
8932 (gnus-summary-find-next)))
8933 ;; No more articles.
8935 ;; Select the next article and adjust point.
8936 (unless (gnus-summary-article-sparse-p
8937 (gnus-summary-article-number))
8939 (gnus-summary-select-article)
8940 (set-buffer gnus-article-buffer)
8942 (goto-char (if backward (point-max) (point-min))))))))
8943 (gnus-message 7 ""))
8944 ;; Return whether we found the regexp.
8945 (when (eq found 'found)
8947 (gnus-summary-show-thread)
8948 (gnus-summary-goto-subject gnus-current-article)
8949 (gnus-summary-position-point)
8952 (defun gnus-find-matching-articles (header regexp)
8953 "Return a list of all articles that match REGEXP on HEADER.
8954 This search includes all articles in the current group that Gnus has
8955 fetched headers for, whether they are displayed or not."
8956 (let ((articles nil)
8957 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8958 (case-fold-search t))
8959 (dolist (header gnus-newsgroup-headers)
8960 (when (string-match regexp (funcall func header))
8961 (push (mail-header-number header) articles)))
8962 (nreverse articles)))
8964 (defun gnus-summary-find-matching (header regexp &optional backward unread
8965 not-case-fold not-matching)
8966 "Return a list of all articles that match REGEXP on HEADER.
8967 The search stars on the current article and goes forwards unless
8968 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8969 If UNREAD is non-nil, only unread articles will
8970 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8971 in the comparisons. If NOT-MATCHING, return a list of all articles that
8972 not match REGEXP on HEADER."
8973 (let ((case-fold-search (not not-case-fold))
8976 (if (eq (car header) 'extra)
8979 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8981 (error "%s is an invalid header" header))
8982 (unless (fboundp (intern (concat "mail-header-" header)))
8983 (error "%s is not a valid header" header))
8984 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8985 (dolist (d (if (eq backward 'all)
8987 (gnus-data-find-list
8988 (gnus-summary-article-number)
8989 (gnus-data-list backward))))
8990 (when (and (or (not unread) ; We want all articles...
8991 (gnus-data-unread-p d)) ; Or just unreads.
8992 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8996 (funcall func (gnus-data-header d))))
8997 (string-match regexp
8998 (funcall func (gnus-data-header d)))))
8999 (push (gnus-data-number d) articles))) ; Success!
9000 (nreverse articles)))
9002 (defun gnus-summary-execute-command (header regexp command &optional backward)
9003 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9004 If HEADER is an empty string (or nil), the match is done on the entire
9005 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9007 (list (let ((completion-ignore-case t))
9010 (mapcar (lambda (header) (list (format "%s" header)))
9012 '("Number" "Subject" "From" "Lines" "Date"
9013 "Message-ID" "Xref" "References" "Body")
9014 gnus-extra-headers))
9015 nil 'require-match))
9016 (read-string "Regexp: ")
9017 (read-key-sequence "Command: ")
9018 current-prefix-arg))
9019 (when (equal header "Body")
9021 ;; Hidden thread subtrees must be searched as well.
9022 (gnus-summary-show-all-threads)
9023 ;; We don't want to change current point nor window configuration.
9025 (save-window-excursion
9027 gnus-treat-strip-trailing-blank-lines
9028 gnus-treat-strip-leading-blank-lines
9029 gnus-treat-strip-multiple-blank-lines
9030 gnus-treat-hide-boring-headers
9031 gnus-treat-fold-newsgroups
9032 gnus-article-prepare-hook)
9033 (gnus-message 6 "Executing %s..." (key-description command))
9034 ;; We'd like to execute COMMAND interactively so as to give arguments.
9035 (gnus-execute header regexp
9036 `(call-interactively ',(key-binding command))
9038 (gnus-message 6 "Executing %s...done" (key-description command))))))
9040 (defun gnus-summary-beginning-of-article ()
9041 "Scroll the article back to the beginning."
9043 (gnus-summary-select-article)
9044 (gnus-configure-windows 'article)
9045 (gnus-eval-in-buffer-window gnus-article-buffer
9047 (goto-char (point-min))
9048 (when gnus-break-pages
9049 (gnus-narrow-to-page))))
9051 (defun gnus-summary-end-of-article ()
9052 "Scroll to the end of the article."
9054 (gnus-summary-select-article)
9055 (gnus-configure-windows 'article)
9056 (gnus-eval-in-buffer-window gnus-article-buffer
9058 (goto-char (point-max))
9060 (when gnus-break-pages
9061 (when (re-search-backward page-delimiter nil t)
9062 (narrow-to-region (match-end 0) (point-max)))
9063 (gnus-narrow-to-page))))
9065 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9066 "Truncate to LEN and quote all \"(\"'s in STRING."
9067 (gnus-replace-in-string (if (and len (> (length string) len))
9068 (substring string 0 len)
9072 (defun gnus-summary-print-article (&optional filename n)
9073 "Generate and print a PostScript image of the process-marked (mail) articles.
9075 If used interactively, print the current article if none are
9076 process-marked. With prefix arg, prompt the user for the name of the
9079 When used from Lisp, accept two optional args FILENAME and N. N means
9080 to print the next N articles. If N is negative, print the N previous
9081 articles. If N is nil and articles have been marked with the process
9082 mark, print these instead.
9084 If the optional first argument FILENAME is nil, send the image to the
9085 printer. If FILENAME is a string, save the PostScript image in a file with
9086 that name. If FILENAME is a number, prompt the user for the name of the file
9088 (interactive (list (ps-print-preprint current-prefix-arg)))
9089 (dolist (article (gnus-summary-work-articles n))
9090 (gnus-summary-select-article nil nil 'pseudo article)
9091 (gnus-eval-in-buffer-window gnus-article-buffer
9092 (gnus-print-buffer))
9093 (gnus-summary-remove-process-mark article))
9094 (ps-despool filename))
9096 (defun gnus-print-buffer ()
9097 (let ((buffer (generate-new-buffer " *print*")))
9100 (copy-to-buffer buffer (point-min) (point-max))
9102 (gnus-remove-text-with-property 'gnus-decoration)
9103 (when (gnus-visual-p 'article-highlight 'highlight)
9104 ;; Copy-to-buffer doesn't copy overlay. So redo
9106 (let ((gnus-article-buffer buffer))
9107 (gnus-article-highlight-citation t)
9108 (gnus-article-highlight-signature)
9109 (gnus-article-emphasize)
9110 (gnus-article-delete-invisible-text)))
9111 (let ((ps-left-header
9114 (gnus-summary-print-truncate-and-quote
9115 (mail-header-subject gnus-current-headers)
9118 (gnus-summary-print-truncate-and-quote
9119 (mail-header-from gnus-current-headers)
9123 "/pagenumberstring load"
9125 (mail-header-date gnus-current-headers) ")"))))
9126 (gnus-run-hooks 'gnus-ps-print-hook)
9129 (ps-spool-buffer-with-faces)
9130 (ps-spool-buffer)))))
9131 (kill-buffer buffer))))
9133 (defun gnus-summary-show-article (&optional arg)
9134 "Force redisplaying of the current article.
9135 If ARG (the prefix) is a number, show the article with the charset
9136 defined in `gnus-summary-show-article-charset-alist', or the charset
9138 If ARG (the prefix) is non-nil and not a number, show the raw article
9139 without any article massaging functions being run. Normally, the key
9140 strokes are `C-u g'."
9144 (gnus-summary-show-article t)
9145 (let ((gnus-newsgroup-charset
9146 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9147 (mm-read-coding-system
9148 "View as charset: " ;; actually it is coding system.
9149 (with-current-buffer gnus-article-buffer
9150 (mm-detect-coding-region (point) (point-max))))))
9151 (gnus-newsgroup-ignored-charsets 'gnus-all))
9152 (gnus-summary-select-article nil 'force)
9153 (let ((deps gnus-newsgroup-dependencies)
9156 (set-buffer gnus-original-article-buffer)
9158 (message-narrow-to-head)
9159 (setq head (buffer-string))
9160 (goto-char (point-min))
9161 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9162 (goto-char (point-max))
9164 (setq lines (1- (count-lines (point) (point-max))))))
9166 (insert (format "211 %d Article retrieved.\n"
9167 (cdr gnus-article-current)))
9169 (if lines (insert (format "Lines: %d\n" lines)))
9171 (let ((nntp-server-buffer (current-buffer)))
9172 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9173 (gnus-data-set-header
9174 (gnus-data-find (cdr gnus-article-current))
9176 (gnus-summary-update-article-line
9177 (cdr gnus-article-current) header)
9178 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9179 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9181 ;; Select the article the normal way.
9182 (gnus-summary-select-article nil 'force))
9184 ;; We have to require this here to make sure that the following
9185 ;; dynamic binding isn't shadowed by autoloading.
9186 (require 'gnus-async)
9188 ;; Bind the article treatment functions to nil.
9189 (let ((gnus-have-all-headers t)
9190 gnus-article-prepare-hook
9191 gnus-article-decode-hook
9192 gnus-display-mime-function
9194 ;; Destroy any MIME parts.
9195 (when (gnus-buffer-live-p gnus-article-buffer)
9197 (set-buffer gnus-article-buffer)
9198 (mm-destroy-parts gnus-article-mime-handles)
9199 ;; Set it to nil for safety reason.
9200 (setq gnus-article-mime-handle-alist nil)
9201 (setq gnus-article-mime-handles nil)))
9202 (gnus-summary-select-article nil 'force))))
9203 (gnus-summary-goto-subject gnus-current-article)
9204 (gnus-summary-position-point))
9206 (defun gnus-summary-show-raw-article ()
9207 "Show the raw article without any article massaging functions being run."
9209 (gnus-summary-show-article t))
9211 (defun gnus-summary-verbose-headers (&optional arg)
9212 "Toggle permanent full header display.
9213 If ARG is a positive number, turn header display on.
9214 If ARG is a negative number, turn header display off."
9216 (setq gnus-show-all-headers
9217 (cond ((or (not (numberp arg))
9219 (not gnus-show-all-headers))
9222 (gnus-summary-show-article))
9224 (defun gnus-summary-toggle-header (&optional arg)
9225 "Show the headers if they are hidden, or hide them if they are shown.
9226 If ARG is a positive number, show the entire header.
9227 If ARG is a negative number, hide the unwanted header lines."
9229 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9230 (get-buffer-window gnus-article-buffer t))))
9231 (with-current-buffer gnus-article-buffer
9233 (article-narrow-to-head)
9234 (let* ((buffer-read-only nil)
9235 (inhibit-point-motion-hooks t)
9236 (hidden (if (numberp arg)
9238 (or (not (looking-at "[^ \t\n]+:"))
9239 (gnus-article-hidden-text-p 'headers))))
9241 (delete-region (point-min) (point-max))
9242 (with-current-buffer gnus-original-article-buffer
9243 (goto-char (setq s (point-min)))
9244 (setq e (if (search-forward "\n\n" nil t)
9247 (insert-buffer-substring gnus-original-article-buffer s e)
9248 (run-hooks 'gnus-article-decode-hook)
9250 (let ((gnus-treat-hide-headers nil)
9251 (gnus-treat-hide-boring-headers nil))
9252 (gnus-delete-wash-type 'headers)
9253 (gnus-treat-article 'head))
9254 (gnus-treat-article 'head))
9257 (set-window-start window (goto-char (point-min))))
9258 (if gnus-break-pages
9259 (gnus-narrow-to-page)
9260 (when (gnus-visual-p 'page-marker)
9261 (let ((buffer-read-only nil))
9262 (gnus-remove-text-with-property 'gnus-prev)
9263 (gnus-remove-text-with-property 'gnus-next))))
9264 (gnus-set-mode-line 'article)))))
9266 (defun gnus-summary-show-all-headers ()
9267 "Make all header lines visible."
9269 (gnus-summary-toggle-header 1))
9271 (defun gnus-summary-caesar-message (&optional arg)
9272 "Caesar rotate the current article by 13.
9273 With a non-numerical prefix, also rotate headers. A numerical
9274 prefix specifies how many places to rotate each letter forward."
9276 (gnus-summary-select-article)
9277 (let ((mail-header-separator ""))
9278 (gnus-eval-in-buffer-window gnus-article-buffer
9281 (let ((start (window-start))
9283 (if (equal arg '(4))
9284 (message-caesar-buffer-body nil t)
9285 (message-caesar-buffer-body arg))
9286 (set-window-start (get-buffer-window (current-buffer)) start)))))
9287 ;; Create buttons and stuff...
9288 (gnus-treat-article nil))
9290 (defun gnus-summary-idna-message (&optional arg)
9291 "Decode IDNA encoded domain names in the current articles.
9292 IDNA encoded domain names looks like `xn--bar'. If a string
9293 remain unencoded after running this function, it is likely an
9294 invalid IDNA string (`xn--bar' is invalid).
9296 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9297 installed for this command to work."
9299 (if (not (and (condition-case nil (require 'idna)
9301 (mm-coding-system-p 'utf-8)
9302 (executable-find (symbol-value 'idna-program))))
9304 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9305 (gnus-summary-select-article)
9306 (let ((mail-header-separator ""))
9307 (gnus-eval-in-buffer-window gnus-article-buffer
9310 (let ((start (window-start))
9312 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9313 (replace-match (idna-to-unicode (match-string 1))))
9314 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9316 (defun gnus-summary-morse-message (&optional arg)
9317 "Morse decode the current article."
9319 (gnus-summary-select-article)
9320 (let ((mail-header-separator ""))
9321 (gnus-eval-in-buffer-window gnus-article-buffer
9325 (let ((pos (window-start))
9327 (goto-char (point-min))
9328 (when (message-goto-body)
9329 (gnus-narrow-to-body))
9330 (goto-char (point-min))
9331 (while (search-forward "·" (point-max) t)
9332 (replace-match "."))
9333 (unmorse-region (point-min) (point-max))
9335 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9337 (defun gnus-summary-stop-page-breaking ()
9338 "Stop page breaking in the current article."
9340 (gnus-summary-select-article)
9341 (gnus-eval-in-buffer-window gnus-article-buffer
9343 (when (gnus-visual-p 'page-marker)
9344 (let ((buffer-read-only nil))
9345 (gnus-remove-text-with-property 'gnus-prev)
9346 (gnus-remove-text-with-property 'gnus-next))
9347 (setq gnus-page-broken nil))))
9349 (defun gnus-summary-move-article (&optional n to-newsgroup
9350 select-method action)
9351 "Move the current article to a different newsgroup.
9352 If N is a positive number, move the N next articles.
9353 If N is a negative number, move the N previous articles.
9354 If N is nil and any articles have been marked with the process mark,
9355 move those articles instead.
9356 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9357 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9358 re-spool using this method.
9360 When called interactively with TO-NEWSGROUP being nil, the value of
9361 the variable `gnus-move-split-methods' is used for finding a default
9362 for the target newsgroup.
9364 For this function to work, both the current newsgroup and the
9365 newsgroup that you want to move to have to support the `request-move'
9366 and `request-accept' functions.
9368 ACTION can be either `move' (the default), `crosspost' or `copy'."
9371 (setq action 'move))
9372 ;; Check whether the source group supports the required functions.
9373 (cond ((and (eq action 'move)
9374 (not (gnus-check-backend-function
9375 'request-move-article gnus-newsgroup-name)))
9376 (error "The current group does not support article moving"))
9377 ((and (eq action 'crosspost)
9378 (not (gnus-check-backend-function
9379 'request-replace-article gnus-newsgroup-name)))
9380 (error "The current group does not support article editing")))
9381 (let ((articles (gnus-summary-work-articles n))
9382 (prefix (if (gnus-check-backend-function
9383 'request-move-article gnus-newsgroup-name)
9384 (funcall gnus-move-group-prefix-function
9385 gnus-newsgroup-name)
9387 (names '((move "Move" "Moving")
9388 (copy "Copy" "Copying")
9389 (crosspost "Crosspost" "Crossposting")))
9390 (copy-buf (save-excursion
9391 (nnheader-set-temp-buffer " *copy article*")))
9392 art-group to-method new-xref article to-groups articles-to-update-marks)
9393 (unless (assq action names)
9394 (error "Unknown action %s" action))
9395 ;; Read the newsgroup name.
9396 (when (and (not to-newsgroup)
9397 (not select-method))
9398 (if (and gnus-move-split-methods
9400 (and (memq gnus-current-article articles)
9401 (gnus-buffer-live-p gnus-original-article-buffer))))
9402 ;; When `gnus-move-split-methods' is non-nil, we have to
9403 ;; select an article to give `gnus-read-move-group-name' an
9404 ;; opportunity to suggest an appropriate default. However,
9405 ;; we needn't render or mark the article.
9406 (let ((gnus-display-mime-function nil)
9407 (gnus-article-prepare-hook nil)
9408 (gnus-mark-article-hook nil))
9409 (gnus-summary-select-article nil nil nil (car articles))))
9411 (gnus-read-move-group-name
9412 (cadr (assq action names))
9413 (symbol-value (intern (format "gnus-current-%s-group" action)))
9415 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9416 (setq to-method (or select-method
9417 (gnus-server-to-method
9418 (gnus-group-method to-newsgroup))))
9419 ;; Check the method we are to move this article to...
9420 (unless (gnus-check-backend-function
9421 'request-accept-article (car to-method))
9422 (error "%s does not support article copying" (car to-method)))
9423 (unless (gnus-check-server to-method)
9424 (error "Can't open server %s" (car to-method)))
9425 (gnus-message 6 "%s to %s: %s..."
9426 (caddr (assq action names))
9427 (or (car select-method) to-newsgroup) articles)
9429 (setq article (pop articles))
9433 ;; Move the article.
9435 ;; Remove this article from future suppression.
9436 (gnus-dup-unsuppress-article article)
9437 (let* ((from-method (gnus-find-method-for-group
9438 gnus-newsgroup-name))
9439 (to-method (gnus-find-method-for-group
9441 (move-is-internal (gnus-method-equal from-method to-method)))
9442 (gnus-request-move-article
9443 article ; Article to move
9444 gnus-newsgroup-name ; From newsgroup
9445 (nth 1 (gnus-find-method-for-group
9446 gnus-newsgroup-name)) ; Server
9447 (list 'gnus-request-accept-article
9448 to-newsgroup (list 'quote select-method)
9449 (not articles) t) ; Accept form
9450 (not articles) ; Only save nov last time
9451 move-is-internal))) ; is this move internal?
9452 ;; Copy the article.
9455 (set-buffer copy-buf)
9456 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9458 (nnheader-narrow-to-headers)
9459 (dolist (hdr gnus-copy-article-ignored-headers)
9460 (message-remove-header hdr t)))
9461 (gnus-request-accept-article
9462 to-newsgroup select-method (not articles) t))))
9463 ;; Crosspost the article.
9464 ((eq action 'crosspost)
9465 (let ((xref (message-tokenize-header
9466 (mail-header-xref (gnus-summary-article-header article))
9468 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9469 ":" (number-to-string article)))
9471 (setq xref (list (system-name))))
9474 (mapconcat 'identity
9475 (delete "Xref:" (delete new-xref xref))
9479 (set-buffer copy-buf)
9480 ;; First put the article in the destination group.
9481 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9482 (when (consp (setq art-group
9483 (gnus-request-accept-article
9484 to-newsgroup select-method (not articles) t)))
9485 (setq new-xref (concat new-xref " " (car art-group)
9487 (number-to-string (cdr art-group))))
9488 ;; Now we have the new Xrefs header, so we insert
9489 ;; it and replace the new article.
9490 (nnheader-replace-header "Xref" new-xref)
9491 (gnus-request-replace-article
9492 (cdr art-group) to-newsgroup (current-buffer) t)
9496 (gnus-message 1 "Couldn't %s article %s: %s"
9497 (cadr (assq action names)) article
9498 (nnheader-get-report (car to-method))))
9499 ((eq art-group 'junk)
9500 (when (eq action 'move)
9501 (gnus-summary-mark-article article gnus-canceled-mark)
9502 (gnus-message 4 "Deleted article %s" article)
9503 ;; run the delete hook
9504 (run-hook-with-args 'gnus-summary-article-delete-hook
9507 (assoc article (gnus-data-list nil)))
9508 gnus-newsgroup-name nil
9511 (let* ((pto-group (gnus-group-prefixed-name
9512 (car art-group) to-method))
9513 (info (gnus-get-info pto-group))
9514 (to-group (gnus-info-group info))
9516 ;; Update the group that has been moved to.
9518 (memq action '(move copy)))
9519 (unless (member to-group to-groups)
9520 (push to-group to-groups))
9522 (unless (memq article gnus-newsgroup-unreads)
9523 (push 'read to-marks)
9525 info (gnus-add-to-range (gnus-info-read info)
9526 (list (cdr art-group)))))
9528 ;; See whether the article is to be put in the cache.
9529 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9530 gnus-article-mark-lists
9531 (delete '(expirable . expire)
9532 (copy-sequence gnus-article-mark-lists))))
9533 (to-article (cdr art-group)))
9535 ;; Enter the article into the cache in the new group,
9536 ;; if that is required.
9537 (when gnus-use-cache
9538 (gnus-cache-possibly-enter-article
9540 (memq article gnus-newsgroup-marked)
9541 (memq article gnus-newsgroup-dormant)
9542 (memq article gnus-newsgroup-unreads)))
9544 (when gnus-preserve-marks
9545 ;; Copy any marks over to the new group.
9546 (when (and (equal to-group gnus-newsgroup-name)
9547 (not (memq article gnus-newsgroup-unreads)))
9548 ;; Mark this article as read in this group.
9549 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9550 (setcdr (gnus-active to-group) to-article)
9551 (setcdr gnus-newsgroup-active to-article))
9554 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9555 (when (memq article (symbol-value
9556 (intern (format "gnus-newsgroup-%s"
9558 (push (cdar marks) to-marks)
9559 ;; If the other group is the same as this group,
9560 ;; then we have to add the mark to the list.
9561 (when (equal to-group gnus-newsgroup-name)
9562 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9565 (intern (format "gnus-newsgroup-%s"
9567 ;; Copy the marks to other group.
9568 (gnus-add-marked-articles
9569 to-group (cdar marks) (list to-article) info)))
9570 (setq marks (cdr marks)))
9572 (gnus-request-set-mark
9573 to-group (list (list (list to-article) 'add to-marks))))
9576 (concat "(gnus-group-set-info '"
9577 (gnus-prin1-to-string (gnus-get-info to-group))
9580 ;; Update the Xref header in this article to point to
9581 ;; the new crossposted article we have just created.
9582 (when (eq action 'crosspost)
9584 (set-buffer copy-buf)
9585 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9586 (nnheader-replace-header "Xref" new-xref)
9587 (gnus-request-replace-article
9588 article gnus-newsgroup-name (current-buffer) t)))
9590 ;; run the move/copy/crosspost/respool hook
9591 (run-hook-with-args 'gnus-summary-article-move-hook
9594 (assoc article (gnus-data-list nil)))
9599 ;;;!!!Why is this necessary?
9600 (set-buffer gnus-summary-buffer)
9602 (gnus-summary-goto-subject article)
9603 (when (eq action 'move)
9604 (gnus-summary-mark-article article gnus-canceled-mark))))
9605 (push article articles-to-update-marks))
9607 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9608 ;; Re-activate all groups that have been moved to.
9610 (set-buffer gnus-group-buffer)
9611 (let ((gnus-group-marked to-groups))
9612 (gnus-group-get-new-news-this-group nil t)))
9614 (gnus-kill-buffer copy-buf)
9615 (gnus-summary-position-point)
9616 (gnus-set-mode-line 'summary)))
9618 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9619 "Copy the current article to some other group.
9620 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9621 When called interactively, if TO-NEWSGROUP is nil, use the value of
9622 the variable `gnus-move-split-methods' for finding a default target
9624 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9625 re-spool using this method."
9627 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9629 (defun gnus-summary-crosspost-article (&optional n)
9630 "Crosspost the current article to some other group."
9632 (gnus-summary-move-article n nil nil 'crosspost))
9634 (defcustom gnus-summary-respool-default-method nil
9635 "Default method type for respooling an article.
9636 If nil, use to the current newsgroup method."
9638 :group 'gnus-summary-mail)
9640 (defcustom gnus-summary-display-while-building nil
9641 "If non-nil, show and update the summary buffer as it's being built.
9642 If the value is t, update the buffer after every line is inserted. If
9643 the value is an integer (N), update the display every N lines."
9646 :type '(choice (const :tag "off" nil)
9648 (const :tag "frequently" t)))
9650 (defun gnus-summary-respool-article (&optional n method)
9651 "Respool the current article.
9652 The article will be squeezed through the mail spooling process again,
9653 which means that it will be put in some mail newsgroup or other
9654 depending on `nnmail-split-methods'.
9655 If N is a positive number, respool the N next articles.
9656 If N is a negative number, respool the N previous articles.
9657 If N is nil and any articles have been marked with the process mark,
9658 respool those articles instead.
9660 Respooling can be done both from mail groups and \"real\" newsgroups.
9661 In the former case, the articles in question will be moved from the
9662 current group into whatever groups they are destined to. In the
9663 latter case, they will be copied into the relevant groups."
9665 (list current-prefix-arg
9666 (let* ((methods (gnus-methods-using 'respool))
9668 (symbol-name (or gnus-summary-respool-default-method
9669 (car (gnus-find-method-for-group
9670 gnus-newsgroup-name)))))
9672 (gnus-completing-read-with-default
9673 methname "Backend to use when respooling"
9674 methods nil t nil 'gnus-mail-method-history))
9677 ((zerop (length (setq ms (gnus-servers-using-backend
9679 (list (intern method) ""))
9683 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9684 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9687 (error "No method given for respooling"))
9688 (if (assoc (symbol-name
9689 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9690 (gnus-methods-using 'respool))
9691 (gnus-summary-move-article n nil method)
9692 (gnus-summary-copy-article n nil method)))
9694 (defun gnus-summary-import-article (file &optional edit)
9695 "Import an arbitrary file into a mail newsgroup."
9696 (interactive "fImport file: \nP")
9697 (let ((group gnus-newsgroup-name)
9698 (now (current-time))
9699 atts lines group-art)
9700 (unless (gnus-check-backend-function 'request-accept-article group)
9701 (error "%s does not support article importing" group))
9702 (or (file-readable-p file)
9703 (not (file-regular-p file))
9704 (error "Can't read %s" file))
9706 (set-buffer (gnus-get-buffer-create " *import file*"))
9708 (nnheader-insert-file-contents file)
9709 (goto-char (point-min))
9710 (if (nnheader-article-p)
9712 (goto-char (point-min))
9713 (search-forward "\n\n" nil t)
9714 (narrow-to-region (point-min) (1- (point)))
9715 (goto-char (point-min))
9716 (unless (re-search-forward "^date:" nil t)
9717 (goto-char (point-max))
9718 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9719 ;; This doesn't look like an article, so we fudge some headers.
9720 (setq atts (file-attributes file)
9721 lines (count-lines (point-min) (point-max)))
9722 (insert "From: " (read-string "From: ") "\n"
9723 "Subject: " (read-string "Subject: ") "\n"
9724 "Date: " (message-make-date (nth 5 atts)) "\n"
9725 "Message-ID: " (message-make-message-id) "\n"
9726 "Lines: " (int-to-string lines) "\n"
9727 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9728 (setq group-art (gnus-request-accept-article group nil t))
9729 (kill-buffer (current-buffer)))
9730 (setq gnus-newsgroup-active (gnus-activate-group group))
9732 (gnus-summary-goto-article (cdr group-art) nil t)
9734 (gnus-summary-edit-article))))
9736 (defun gnus-summary-create-article ()
9737 "Create an article in a mail newsgroup."
9739 (let ((group gnus-newsgroup-name)
9740 (now (current-time))
9742 (unless (gnus-check-backend-function 'request-accept-article group)
9743 (error "%s does not support article importing" group))
9745 (set-buffer (gnus-get-buffer-create " *import file*"))
9747 (goto-char (point-min))
9748 ;; This doesn't look like an article, so we fudge some headers.
9749 (insert "From: " (read-string "From: ") "\n"
9750 "Subject: " (read-string "Subject: ") "\n"
9751 "Date: " (message-make-date now) "\n"
9752 "Message-ID: " (message-make-message-id) "\n")
9753 (setq group-art (gnus-request-accept-article group nil t))
9754 (kill-buffer (current-buffer)))
9755 (setq gnus-newsgroup-active (gnus-activate-group group))
9757 (gnus-summary-goto-article (cdr group-art) nil t)
9758 (gnus-summary-edit-article)))
9760 (defun gnus-summary-article-posted-p ()
9761 "Say whether the current (mail) article is available from news as well.
9762 This will be the case if the article has both been mailed and posted."
9764 (let ((id (mail-header-references (gnus-summary-article-header)))
9765 (gnus-override-method (car (gnus-refer-article-methods))))
9766 (if (gnus-request-head id "")
9767 (gnus-message 2 "The current message was found on %s"
9768 gnus-override-method)
9769 (gnus-message 2 "The current message couldn't be found on %s"
9770 gnus-override-method)
9773 (defun gnus-summary-expire-articles (&optional now)
9774 "Expire all articles that are marked as expirable in the current group."
9776 (when (and (not gnus-group-is-exiting-without-update-p)
9777 (gnus-check-backend-function
9778 'request-expire-articles gnus-newsgroup-name))
9779 ;; This backend supports expiry.
9780 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9781 (expirable (if total
9783 ;; We need to update the info for
9784 ;; this group for `gnus-list-of-read-articles'
9785 ;; to give us the right answer.
9786 (gnus-run-hooks 'gnus-exit-group-hook)
9787 (gnus-summary-update-info)
9788 (gnus-list-of-read-articles gnus-newsgroup-name))
9789 (setq gnus-newsgroup-expirable
9790 (sort gnus-newsgroup-expirable '<))))
9791 (expiry-wait (if now 'immediate
9792 (gnus-group-find-parameter
9793 gnus-newsgroup-name 'expiry-wait)))
9794 (nnmail-expiry-target
9795 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9796 nnmail-expiry-target))
9799 ;; There are expirable articles in this group, so we run them
9800 ;; through the expiry process.
9801 (gnus-message 6 "Expiring articles...")
9802 (unless (gnus-check-group gnus-newsgroup-name)
9803 (error "Can't open server for %s" gnus-newsgroup-name))
9804 ;; The list of articles that weren't expired is returned.
9807 (let ((nnmail-expiry-wait-function nil)
9808 (nnmail-expiry-wait expiry-wait))
9809 (setq es (gnus-request-expire-articles
9810 expirable gnus-newsgroup-name)))
9811 (setq es (gnus-request-expire-articles
9812 expirable gnus-newsgroup-name)))
9814 (setq gnus-newsgroup-expirable es))
9815 ;; We go through the old list of expirable, and mark all
9816 ;; really expired articles as nonexistent.
9817 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9818 (let ((gnus-use-cache nil))
9819 (dolist (article expirable)
9820 (when (and (not (memq article es))
9821 (gnus-data-find article))
9822 (gnus-summary-mark-article article gnus-canceled-mark)
9823 (run-hook-with-args 'gnus-summary-article-expire-hook
9826 (assoc article (gnus-data-list nil)))
9830 (gnus-message 6 "Expiring articles...done")))))
9832 (defun gnus-summary-expire-articles-now ()
9833 "Expunge all expirable articles in the current group.
9834 This means that *all* articles that are marked as expirable will be
9835 deleted forever, right now."
9837 (or gnus-expert-user
9839 "Are you really, really sure you want to delete all expirable messages? ")
9841 (gnus-summary-expire-articles t))
9843 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9844 (defun gnus-summary-delete-article (&optional n)
9845 "Delete the N next (mail) articles.
9846 This command actually deletes articles. This is not a marking
9847 command. The article will disappear forever from your life, never to
9850 If N is negative, delete backwards.
9851 If N is nil and articles have been marked with the process mark,
9852 delete these instead.
9854 If `gnus-novice-user' is non-nil you will be asked for
9855 confirmation before the articles are deleted."
9857 (unless (gnus-check-backend-function 'request-expire-articles
9858 gnus-newsgroup-name)
9859 (error "The current newsgroup does not support article deletion"))
9860 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9861 (error "Couldn't open server"))
9862 ;; Compute the list of articles to delete.
9863 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9864 (nnmail-expiry-target 'delete)
9866 (if (and gnus-novice-user
9867 (not (gnus-yes-or-no-p
9868 (format "Do you really want to delete %s forever? "
9869 (if (> (length articles) 1)
9870 (format "these %s articles" (length articles))
9873 ;; Delete the articles.
9874 (setq not-deleted (gnus-request-expire-articles
9875 articles gnus-newsgroup-name 'force))
9877 (gnus-summary-remove-process-mark (car articles))
9878 ;; The backend might not have been able to delete the article
9880 (unless (memq (car articles) not-deleted)
9881 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9882 (let* ((article (car articles))
9883 (ghead (gnus-data-header
9884 (assoc article (gnus-data-list nil)))))
9885 (run-hook-with-args 'gnus-summary-article-delete-hook
9886 'delete ghead gnus-newsgroup-name nil
9888 (setq articles (cdr articles)))
9890 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9891 (gnus-summary-position-point)
9892 (gnus-set-mode-line 'summary)
9895 (defun gnus-summary-edit-article (&optional arg)
9896 "Edit the current article.
9897 This will have permanent effect only in mail groups.
9898 If ARG is nil, edit the decoded articles.
9899 If ARG is 1, edit the raw articles.
9900 If ARG is 2, edit the raw articles even in read-only groups.
9901 If ARG is 3, edit the articles with the current handles.
9902 Otherwise, allow editing of articles even in read-only
9905 (let (force raw current-handles)
9914 (setq current-handles
9915 (and (gnus-buffer-live-p gnus-article-buffer)
9916 (with-current-buffer gnus-article-buffer
9918 gnus-article-mime-handles
9919 (setq gnus-article-mime-handles nil))))))
9922 (when (and raw (not force)
9923 (member gnus-newsgroup-name '("nndraft:delayed"
9926 (error "Can't edit the raw article in group %s"
9927 gnus-newsgroup-name))
9929 (set-buffer gnus-summary-buffer)
9930 (let ((mail-parse-charset gnus-newsgroup-charset)
9931 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9932 (gnus-set-global-variables)
9933 (when (and (not force)
9934 (gnus-group-read-only-p))
9935 (error "The current newsgroup does not support article editing"))
9936 (gnus-summary-show-article t)
9937 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9938 (with-current-buffer gnus-article-buffer
9939 (mm-enable-multibyte)))
9940 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9942 (gnus-article-edit-article
9945 (let ((mbl mml-buffer-list))
9946 (setq mml-buffer-list nil)
9947 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
9948 (mime-to-mml ,'current-handles))
9949 (let ((mbl1 mml-buffer-list))
9950 (setq mml-buffer-list mbl)
9951 (set (make-local-variable 'mml-buffer-list) mbl1))
9952 (gnus-make-local-hook 'kill-buffer-hook)
9953 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9954 `(lambda (no-highlight)
9955 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9956 (message-options message-options)
9957 (message-options-set-recipient)
9958 (mail-parse-ignored-charsets
9959 ',gnus-newsgroup-ignored-charsets))
9960 ,(if (not raw) '(progn
9962 (mml-destroy-buffers)
9963 (remove-hook 'kill-buffer-hook
9964 'mml-destroy-buffers t)
9965 (kill-local-variable 'mml-buffer-list)))
9966 (gnus-summary-edit-article-done
9967 ,(or (mail-header-references gnus-current-headers) "")
9968 ,(gnus-group-read-only-p)
9969 ,gnus-summary-buffer no-highlight))))))))
9971 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9973 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9975 "Make edits to the current article permanent."
9978 ;; The buffer restriction contains the entire article if it exists.
9979 (when (article-goto-body)
9980 (let ((lines (count-lines (point) (point-max)))
9981 (length (- (point-max) (point)))
9982 (case-fold-search t)
9983 (body (copy-marker (point))))
9984 (goto-char (point-min))
9985 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9986 (delete-region (match-beginning 1) (match-end 1))
9987 (insert (number-to-string length)))
9988 (goto-char (point-min))
9989 (when (re-search-forward
9990 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9991 (delete-region (match-beginning 1) (match-end 1))
9992 (insert (number-to-string length)))
9993 (goto-char (point-min))
9994 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9995 (delete-region (match-beginning 1) (match-end 1))
9996 (insert (number-to-string lines))))))
9997 ;; Replace the article.
9998 (let ((buf (current-buffer)))
10000 (insert-buffer-substring buf)
10002 (if (and (not read-only)
10003 (not (gnus-request-replace-article
10004 (cdr gnus-article-current) (car gnus-article-current)
10005 (current-buffer) t)))
10006 (error "Couldn't replace article")
10007 ;; Update the summary buffer.
10008 (if (and references
10009 (equal (message-tokenize-header references " ")
10010 (message-tokenize-header
10011 (or (message-fetch-field "references") "") " ")))
10012 ;; We only have to update this line.
10015 (message-narrow-to-head)
10016 (let ((head (buffer-substring-no-properties
10017 (point-min) (point-max)))
10020 (insert (format "211 %d Article retrieved.\n"
10021 (cdr gnus-article-current)))
10024 (let ((nntp-server-buffer (current-buffer)))
10025 (setq header (car (gnus-get-newsgroup-headers
10028 (set-buffer gnus-summary-buffer)
10029 (gnus-data-set-header
10030 (gnus-data-find (cdr gnus-article-current))
10032 (gnus-summary-update-article-line
10033 (cdr gnus-article-current) header)
10034 (if (gnus-summary-goto-subject
10035 (cdr gnus-article-current) nil t)
10036 (gnus-summary-update-secondary-mark
10037 (cdr gnus-article-current))))))))
10039 (set-buffer (or buffer gnus-summary-buffer))
10040 (gnus-summary-update-article (cdr gnus-article-current))
10041 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10042 (gnus-summary-update-secondary-mark
10043 (cdr gnus-article-current))))
10044 ;; Prettify the article buffer again.
10045 (unless no-highlight
10047 (set-buffer gnus-article-buffer)
10048 ;;;!!! Fix this -- article should be rehighlighted.
10049 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10050 (set-buffer gnus-original-article-buffer)
10051 (gnus-request-article
10052 (cdr gnus-article-current)
10053 (car gnus-article-current) (current-buffer))))
10054 ;; Prettify the summary buffer line.
10055 (when (gnus-visual-p 'summary-highlight 'highlight)
10056 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10058 (defun gnus-summary-edit-wash (key)
10059 "Perform editing command KEY in the article buffer."
10063 (message "%s" (concat (this-command-keys) "- "))
10066 (gnus-summary-edit-article)
10067 (execute-kbd-macro (concat (this-command-keys) key))
10068 (gnus-article-edit-done))
10072 (defun gnus-summary-respool-query (&optional silent trace)
10073 "Query where the respool algorithm would put this article."
10075 (let (gnus-mark-article-hook)
10076 (gnus-summary-select-article)
10078 (set-buffer gnus-original-article-buffer)
10079 (let ((groups (nnmail-article-group 'identity trace)))
10082 (message "This message would go to %s"
10083 (mapconcat 'car groups ", "))
10084 (message "This message would go to no groups"))
10087 (defun gnus-summary-respool-trace ()
10088 "Trace where the respool algorithm would put this article.
10089 Display a buffer showing all fancy splitting patterns which matched."
10091 (gnus-summary-respool-query nil t))
10093 ;; Summary marking commands.
10095 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10096 "Mark articles which has the same subject as read, and then select the next.
10097 If UNMARK is positive, remove any kind of mark.
10098 If UNMARK is negative, tick articles."
10101 (setq unmark (prefix-numeric-value unmark)))
10103 (gnus-summary-mark-same-subject
10104 (gnus-summary-article-subject) unmark)))
10105 ;; Select next unread article. If auto-select-same mode, should
10106 ;; select the first unread article.
10107 (gnus-summary-next-article t (and gnus-auto-select-same
10108 (gnus-summary-article-subject)))
10109 (gnus-message 7 "%d article%s marked as %s"
10110 count (if (= count 1) " is" "s are")
10111 (if unmark "unread" "read"))))
10113 (defun gnus-summary-kill-same-subject (&optional unmark)
10114 "Mark articles which has the same subject as read.
10115 If UNMARK is positive, remove any kind of mark.
10116 If UNMARK is negative, tick articles."
10119 (setq unmark (prefix-numeric-value unmark)))
10121 (gnus-summary-mark-same-subject
10122 (gnus-summary-article-subject) unmark)))
10123 ;; If marked as read, go to next unread subject.
10124 (when (null unmark)
10125 ;; Go to next unread subject.
10126 (gnus-summary-next-subject 1 t))
10127 (gnus-message 7 "%d articles are marked as %s"
10128 count (if unmark "unread" "read"))))
10130 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10131 "Mark articles with same SUBJECT as read, and return marked number.
10132 If optional argument UNMARK is positive, remove any kinds of marks.
10133 If optional argument UNMARK is negative, mark articles as unread instead."
10137 ((null unmark) ; Mark as read.
10140 (gnus-summary-mark-article-as-read gnus-killed-mark)
10141 (gnus-summary-show-thread) t)
10142 (gnus-summary-find-subject subject))
10143 (setq count (1+ count))))
10144 ((> unmark 0) ; Tick.
10147 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10148 (gnus-summary-show-thread) t)
10149 (gnus-summary-find-subject subject))
10150 (setq count (1+ count))))
10151 (t ; Mark as unread.
10154 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10155 (gnus-summary-show-thread) t)
10156 (gnus-summary-find-subject subject))
10157 (setq count (1+ count)))))
10158 (gnus-set-mode-line 'summary)
10159 ;; Return the number of marked articles.
10162 (defun gnus-summary-mark-as-processable (n &optional unmark)
10163 "Set the process mark on the next N articles.
10164 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10165 the process mark instead. The difference between N and the actual
10166 number of articles marked is returned."
10168 (if (and (null n) (gnus-region-active-p))
10169 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10170 (setq n (prefix-numeric-value n))
10171 (let ((backward (< n 0))
10176 (gnus-summary-remove-process-mark
10177 (gnus-summary-article-number))
10178 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10179 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10182 (gnus-message 7 "No more articles"))
10183 (gnus-summary-recenter)
10184 (gnus-summary-position-point)
10187 (defun gnus-summary-unmark-as-processable (n)
10188 "Remove the process mark from the next N articles.
10189 If N is negative, unmark backward instead. The difference between N and
10190 the actual number of articles unmarked is returned."
10192 (gnus-summary-mark-as-processable n t))
10194 (defun gnus-summary-unmark-all-processable ()
10195 "Remove the process mark from all articles."
10198 (while gnus-newsgroup-processable
10199 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10200 (gnus-summary-position-point))
10202 (defun gnus-summary-add-mark (article type)
10203 "Mark ARTICLE with a mark of TYPE."
10204 (let ((vtype (car (assq type gnus-article-mark-lists)))
10207 (error "No such mark type: %s" type)
10208 (setq var (intern (format "gnus-newsgroup-%s" type)))
10209 (set var (cons article (symbol-value var)))
10210 (if (memq type '(processable cached replied forwarded recent saved))
10211 (gnus-summary-update-secondary-mark article)
10212 ;;; !!! This is bogus. We should find out what primary
10213 ;;; !!! mark we want to set.
10214 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10216 (defun gnus-summary-mark-as-expirable (n)
10217 "Mark N articles forward as expirable.
10218 If N is negative, mark backward instead. The difference between N and
10219 the actual number of articles marked is returned."
10221 (gnus-summary-mark-forward n gnus-expirable-mark))
10223 (defun gnus-summary-mark-as-spam (n)
10224 "Mark N articles forward as spam.
10225 If N is negative, mark backward instead. The difference between N and
10226 the actual number of articles marked is returned."
10228 (gnus-summary-mark-forward n gnus-spam-mark))
10230 (defun gnus-summary-mark-article-as-replied (article)
10231 "Mark ARTICLE as replied to and update the summary line.
10232 ARTICLE can also be a list of articles."
10233 (interactive (list (gnus-summary-article-number)))
10234 (let ((articles (if (listp article) article (list article))))
10235 (dolist (article articles)
10236 (unless (numberp article)
10237 (error "%s is not a number" article))
10238 (push article gnus-newsgroup-replied)
10239 (let ((buffer-read-only nil))
10240 (when (gnus-summary-goto-subject article nil t)
10241 (gnus-summary-update-secondary-mark article))))))
10243 (defun gnus-summary-mark-article-as-forwarded (article)
10244 "Mark ARTICLE as forwarded and update the summary line.
10245 ARTICLE can also be a list of articles."
10246 (let ((articles (if (listp article) article (list article))))
10247 (dolist (article articles)
10248 (push article gnus-newsgroup-forwarded)
10249 (let ((buffer-read-only nil))
10250 (when (gnus-summary-goto-subject article nil t)
10251 (gnus-summary-update-secondary-mark article))))))
10253 (defun gnus-summary-set-bookmark (article)
10254 "Set a bookmark in current article."
10255 (interactive (list (gnus-summary-article-number)))
10256 (when (or (not (get-buffer gnus-article-buffer))
10257 (not gnus-current-article)
10258 (not gnus-article-current)
10259 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10260 (error "No current article selected"))
10261 ;; Remove old bookmark, if one exists.
10262 (gnus-pull article gnus-newsgroup-bookmarks)
10263 ;; Set the new bookmark, which is on the form
10264 ;; (article-number . line-number-in-body).
10267 (with-current-buffer gnus-article-buffer
10271 (article-goto-body)
10274 gnus-newsgroup-bookmarks)
10275 (gnus-message 6 "A bookmark has been added to the current article."))
10277 (defun gnus-summary-remove-bookmark (article)
10278 "Remove the bookmark from the current article."
10279 (interactive (list (gnus-summary-article-number)))
10280 ;; Remove old bookmark, if one exists.
10281 (if (not (assq article gnus-newsgroup-bookmarks))
10282 (gnus-message 6 "No bookmark in current article.")
10283 (gnus-pull article gnus-newsgroup-bookmarks)
10284 (gnus-message 6 "Removed bookmark.")))
10286 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10287 (defun gnus-summary-mark-as-dormant (n)
10288 "Mark N articles forward as dormant.
10289 If N is negative, mark backward instead. The difference between N and
10290 the actual number of articles marked is returned."
10292 (gnus-summary-mark-forward n gnus-dormant-mark))
10294 (defun gnus-summary-set-process-mark (article)
10295 "Set the process mark on ARTICLE and update the summary line."
10296 (setq gnus-newsgroup-processable
10298 (delq article gnus-newsgroup-processable)))
10299 (when (gnus-summary-goto-subject article)
10300 (gnus-summary-show-thread)
10301 (gnus-summary-goto-subject article)
10302 (gnus-summary-update-secondary-mark article)))
10304 (defun gnus-summary-remove-process-mark (&rest articles)
10305 "Remove the process mark from ARTICLES and update the summary line."
10306 (dolist (article articles)
10307 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10308 (when (gnus-summary-goto-subject article)
10309 (gnus-summary-show-thread)
10310 (gnus-summary-goto-subject article)
10311 (gnus-summary-update-secondary-mark article)))
10314 (defun gnus-summary-set-saved-mark (article)
10315 "Set the process mark on ARTICLE and update the summary line."
10316 (push article gnus-newsgroup-saved)
10317 (when (gnus-summary-goto-subject article)
10318 (gnus-summary-update-secondary-mark article)))
10320 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10321 "Mark N articles as read forwards.
10322 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10323 The difference between N and the actual number of articles marked is
10325 If NO-EXPIRE, auto-expiry will be inhibited."
10327 (gnus-summary-show-thread)
10328 (let ((backward (< n 0))
10329 (gnus-summary-goto-unread
10330 (and gnus-summary-goto-unread
10331 (not (eq gnus-summary-goto-unread 'never))
10332 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10333 gnus-ticked-mark gnus-dormant-mark)))))
10335 (mark (or mark gnus-del-mark)))
10336 (while (and (> n 0)
10337 (gnus-summary-mark-article nil mark no-expire)
10338 (zerop (gnus-summary-next-subject
10340 (and gnus-summary-goto-unread
10341 (not (eq gnus-summary-goto-unread 'never)))
10345 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10346 (gnus-summary-recenter)
10347 (gnus-summary-position-point)
10348 (gnus-set-mode-line 'summary)
10351 (defun gnus-summary-mark-article-as-read (mark)
10352 "Mark the current article quickly as read with MARK."
10353 (let ((article (gnus-summary-article-number)))
10354 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10355 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10356 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10357 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10358 (push (cons article mark) gnus-newsgroup-reads)
10359 ;; Possibly remove from cache, if that is used.
10360 (when gnus-use-cache
10361 (gnus-cache-enter-remove-article article))
10362 ;; Allow the backend to change the mark.
10363 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10364 ;; Check for auto-expiry.
10365 (when (and gnus-newsgroup-auto-expire
10366 (memq mark gnus-auto-expirable-marks))
10367 (setq mark gnus-expirable-mark)
10368 ;; Let the backend know about the mark change.
10369 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10370 (push article gnus-newsgroup-expirable))
10371 ;; Set the mark in the buffer.
10372 (gnus-summary-update-mark mark 'unread)
10375 (defun gnus-summary-mark-article-as-unread (mark)
10376 "Mark the current article quickly as unread with MARK."
10377 (let* ((article (gnus-summary-article-number))
10378 (old-mark (gnus-summary-article-mark article)))
10379 ;; Allow the backend to change the mark.
10380 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10381 (if (eq mark old-mark)
10385 (gnus-error 1 "Can't mark negative article numbers")
10387 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10388 (setq gnus-newsgroup-spam-marked
10389 (delq article gnus-newsgroup-spam-marked))
10390 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10391 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10392 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10393 (cond ((= mark gnus-ticked-mark)
10394 (setq gnus-newsgroup-marked
10395 (gnus-add-to-sorted-list gnus-newsgroup-marked
10397 ((= mark gnus-spam-mark)
10398 (setq gnus-newsgroup-spam-marked
10399 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10401 ((= mark gnus-dormant-mark)
10402 (setq gnus-newsgroup-dormant
10403 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10406 (setq gnus-newsgroup-unreads
10407 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10409 (gnus-pull article gnus-newsgroup-reads)
10411 ;; See whether the article is to be put in the cache.
10412 (and gnus-use-cache
10413 (vectorp (gnus-summary-article-header article))
10415 (gnus-cache-possibly-enter-article
10416 gnus-newsgroup-name article
10417 (= mark gnus-ticked-mark)
10418 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10421 (gnus-summary-update-mark mark 'unread)
10424 (defun gnus-summary-mark-article (&optional article mark no-expire)
10425 "Mark ARTICLE with MARK. MARK can be any character.
10426 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10427 `??' (dormant) and `?E' (expirable).
10428 If MARK is nil, then the default character `?r' is used.
10429 If ARTICLE is nil, then the article on the current line will be
10431 If NO-EXPIRE, auto-expiry will be inhibited."
10432 ;; The mark might be a string.
10433 (when (stringp mark)
10434 (setq mark (aref mark 0)))
10435 ;; If no mark is given, then we check auto-expiring.
10437 (setq mark gnus-del-mark))
10438 (when (and (not no-expire)
10439 gnus-newsgroup-auto-expire
10440 (memq mark gnus-auto-expirable-marks))
10441 (setq mark gnus-expirable-mark))
10442 (let ((article (or article (gnus-summary-article-number)))
10443 (old-mark (gnus-summary-article-mark article)))
10444 ;; Allow the backend to change the mark.
10445 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10446 (if (eq mark old-mark)
10449 (error "No article on current line"))
10450 (if (not (if (or (= mark gnus-unread-mark)
10451 (= mark gnus-ticked-mark)
10452 (= mark gnus-spam-mark)
10453 (= mark gnus-dormant-mark))
10454 (gnus-mark-article-as-unread article mark)
10455 (gnus-mark-article-as-read article mark)))
10457 ;; See whether the article is to be put in the cache.
10458 (and gnus-use-cache
10459 (not (= mark gnus-canceled-mark))
10460 (vectorp (gnus-summary-article-header article))
10462 (gnus-cache-possibly-enter-article
10463 gnus-newsgroup-name article
10464 (= mark gnus-ticked-mark)
10465 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10467 (when (gnus-summary-goto-subject article nil t)
10468 (let ((buffer-read-only nil))
10469 (gnus-summary-show-thread)
10471 (gnus-summary-update-mark mark 'unread)
10474 (defun gnus-summary-update-secondary-mark (article)
10475 "Update the secondary (read, process, cache) mark."
10476 (gnus-summary-update-mark
10477 (cond ((memq article gnus-newsgroup-processable)
10479 ((memq article gnus-newsgroup-cached)
10481 ((memq article gnus-newsgroup-replied)
10483 ((memq article gnus-newsgroup-forwarded)
10484 gnus-forwarded-mark)
10485 ((memq article gnus-newsgroup-saved)
10487 ((memq article gnus-newsgroup-recent)
10489 ((memq article gnus-newsgroup-unseen)
10493 (when (gnus-visual-p 'summary-highlight 'highlight)
10494 (gnus-run-hooks 'gnus-summary-update-hook))
10497 (defun gnus-summary-update-download-mark (article)
10498 "Update the download mark."
10499 (gnus-summary-update-mark
10500 (cond ((memq article gnus-newsgroup-undownloaded)
10501 gnus-undownloaded-mark)
10502 (gnus-newsgroup-agentized
10503 gnus-downloaded-mark)
10507 (gnus-summary-update-line t)
10510 (defun gnus-summary-update-mark (mark type)
10511 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10512 (buffer-read-only nil))
10513 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10515 (when (looking-at "\r")
10517 (when (<= (+ forward (point)) (point-max))
10518 ;; Go to the right position on the line.
10519 (goto-char (+ forward (point)))
10520 ;; Replace the old mark with the new mark.
10521 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10522 ;; Optionally update the marks by some user rule.
10523 (when (eq type 'unread)
10524 (gnus-data-set-mark
10525 (gnus-data-find (gnus-summary-article-number)) mark)
10526 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10528 (defun gnus-mark-article-as-read (article &optional mark)
10529 "Enter ARTICLE in the pertinent lists and remove it from others."
10530 ;; Make the article expirable.
10531 (let ((mark (or mark gnus-del-mark)))
10532 (setq gnus-newsgroup-expirable
10533 (if (= mark gnus-expirable-mark)
10534 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10535 (delq article gnus-newsgroup-expirable)))
10536 ;; Remove from unread and marked lists.
10537 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10538 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10539 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10540 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10541 (push (cons article mark) gnus-newsgroup-reads)
10542 ;; Possibly remove from cache, if that is used.
10543 (when gnus-use-cache
10544 (gnus-cache-enter-remove-article article))
10547 (defun gnus-mark-article-as-unread (article &optional mark)
10548 "Enter ARTICLE in the pertinent lists and remove it from others."
10549 (let ((mark (or mark gnus-ticked-mark)))
10552 (gnus-error 1 "Can't mark negative article numbers")
10554 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10555 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10556 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10557 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10558 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10560 ;; Unsuppress duplicates?
10561 (when gnus-suppress-duplicates
10562 (gnus-dup-unsuppress-article article))
10564 (cond ((= mark gnus-ticked-mark)
10565 (setq gnus-newsgroup-marked
10566 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10567 ((= mark gnus-spam-mark)
10568 (setq gnus-newsgroup-spam-marked
10569 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10571 ((= mark gnus-dormant-mark)
10572 (setq gnus-newsgroup-dormant
10573 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10575 (setq gnus-newsgroup-unreads
10576 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10577 (gnus-pull article gnus-newsgroup-reads)
10580 (defalias 'gnus-summary-mark-as-unread-forward
10581 'gnus-summary-tick-article-forward)
10582 (make-obsolete 'gnus-summary-mark-as-unread-forward
10583 'gnus-summary-tick-article-forward)
10584 (defun gnus-summary-tick-article-forward (n)
10585 "Tick N articles forwards.
10586 If N is negative, tick backwards instead.
10587 The difference between N and the number of articles ticked is returned."
10589 (gnus-summary-mark-forward n gnus-ticked-mark))
10591 (defalias 'gnus-summary-mark-as-unread-backward
10592 'gnus-summary-tick-article-backward)
10593 (make-obsolete 'gnus-summary-mark-as-unread-backward
10594 'gnus-summary-tick-article-backward)
10595 (defun gnus-summary-tick-article-backward (n)
10596 "Tick N articles backwards.
10597 The difference between N and the number of articles ticked is returned."
10599 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10601 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10602 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10603 (defun gnus-summary-tick-article (&optional article clear-mark)
10604 "Mark current article as unread.
10605 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10606 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10608 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10609 gnus-ticked-mark)))
10611 (defun gnus-summary-mark-as-read-forward (n)
10612 "Mark N articles as read forwards.
10613 If N is negative, mark backwards instead.
10614 The difference between N and the actual number of articles marked is
10617 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10619 (defun gnus-summary-mark-as-read-backward (n)
10620 "Mark the N articles as read backwards.
10621 The difference between N and the actual number of articles marked is
10624 (gnus-summary-mark-forward
10625 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10627 (defun gnus-summary-mark-as-read (&optional article mark)
10628 "Mark current article as read.
10629 ARTICLE specifies the article to be marked as read.
10630 MARK specifies a string to be inserted at the beginning of the line."
10631 (gnus-summary-mark-article article mark))
10633 (defun gnus-summary-clear-mark-forward (n)
10634 "Clear marks from N articles forward.
10635 If N is negative, clear backward instead.
10636 The difference between N and the number of marks cleared is returned."
10638 (gnus-summary-mark-forward n gnus-unread-mark))
10640 (defun gnus-summary-clear-mark-backward (n)
10641 "Clear marks from N articles backward.
10642 The difference between N and the number of marks cleared is returned."
10644 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10646 (defun gnus-summary-mark-unread-as-read ()
10647 "Intended to be used by `gnus-summary-mark-article-hook'."
10648 (when (memq gnus-current-article gnus-newsgroup-unreads)
10649 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10651 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10652 "Intended to be used by `gnus-summary-mark-article-hook'."
10653 (let ((mark (gnus-summary-article-mark)))
10654 (when (or (gnus-unread-mark-p mark)
10655 (gnus-read-mark-p mark))
10656 (gnus-summary-mark-article gnus-current-article
10657 (or new-mark gnus-read-mark)))))
10659 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10660 "Intended to be used by `gnus-summary-mark-article-hook'."
10661 (let ((mark (gnus-summary-article-mark)))
10662 (when (or (gnus-unread-mark-p mark)
10663 (gnus-read-mark-p mark))
10664 (gnus-summary-mark-article (gnus-summary-article-number)
10665 (or new-mark gnus-read-mark)))))
10667 (defun gnus-summary-mark-unread-as-ticked ()
10668 "Intended to be used by `gnus-summary-mark-article-hook'."
10669 (when (memq gnus-current-article gnus-newsgroup-unreads)
10670 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10672 (defun gnus-summary-mark-region-as-read (point mark all)
10673 "Mark all unread articles between point and mark as read.
10674 If given a prefix, mark all articles between point and mark as read,
10675 even ticked and dormant ones."
10676 (interactive "r\nP")
10680 (beginning-of-line)
10685 (memq (setq article (gnus-summary-article-number))
10686 gnus-newsgroup-unreads))
10687 (gnus-summary-mark-article article gnus-del-mark))
10689 (gnus-summary-find-next))))))
10691 (defun gnus-summary-mark-below (score mark)
10692 "Mark articles with score less than SCORE with MARK."
10693 (interactive "P\ncMark: ")
10694 (setq score (if score
10695 (prefix-numeric-value score)
10696 (or gnus-summary-default-score 0)))
10698 (set-buffer gnus-summary-buffer)
10699 (goto-char (point-min))
10702 (and (< (gnus-summary-article-score) score)
10703 (gnus-summary-mark-article nil mark))
10704 (gnus-summary-find-next)))))
10706 (defun gnus-summary-kill-below (&optional score)
10707 "Mark articles with score below SCORE as read."
10709 (gnus-summary-mark-below score gnus-killed-mark))
10711 (defun gnus-summary-clear-above (&optional score)
10712 "Clear all marks from articles with score above SCORE."
10714 (gnus-summary-mark-above score gnus-unread-mark))
10716 (defun gnus-summary-tick-above (&optional score)
10717 "Tick all articles with score above SCORE."
10719 (gnus-summary-mark-above score gnus-ticked-mark))
10721 (defun gnus-summary-mark-above (score mark)
10722 "Mark articles with score over SCORE with MARK."
10723 (interactive "P\ncMark: ")
10724 (setq score (if score
10725 (prefix-numeric-value score)
10726 (or gnus-summary-default-score 0)))
10728 (set-buffer gnus-summary-buffer)
10729 (goto-char (point-min))
10731 (when (> (gnus-summary-article-score) score)
10732 (gnus-summary-mark-article nil mark))
10734 (gnus-summary-find-next)))))
10736 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10737 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10738 (defun gnus-summary-limit-include-expunged (&optional no-error)
10739 "Display all the hidden articles that were expunged for low scores."
10741 (let ((buffer-read-only nil))
10742 (let ((scored gnus-newsgroup-scored)
10745 (unless (gnus-summary-article-header (caar scored))
10746 (and (setq h (gnus-number-to-header (caar scored)))
10747 (< (cdar scored) gnus-summary-expunge-below)
10749 (setq scored (cdr scored)))
10751 (when (not no-error)
10752 (error "No expunged articles hidden"))
10753 (goto-char (point-min))
10754 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10755 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10756 (mapcar (lambda (x) (push (mail-header-number x)
10757 gnus-newsgroup-limit))
10759 (gnus-summary-prepare-unthreaded (nreverse headers))
10760 (goto-char (point-min))
10761 (gnus-summary-position-point)
10764 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10765 "Mark all unread articles in this newsgroup as read.
10766 If prefix argument ALL is non-nil, ticked and dormant articles will
10767 also be marked as read.
10768 If QUIETLY is non-nil, no questions will be asked.
10770 If TO-HERE is non-nil, it should be a point in the buffer. All
10771 articles before (after, if REVERSE is set) this point will be marked
10774 Note that this function will only catch up the unread article
10775 in the current summary buffer limitation.
10777 The number of articles marked as read is returned."
10782 (not gnus-interactive-catchup) ;Without confirmation?
10786 "Mark absolutely all articles as read? "
10787 "Mark all unread articles as read? ")))
10789 (not gnus-newsgroup-adaptive)
10790 (not gnus-newsgroup-auto-expire)
10791 (not gnus-suppress-duplicates)
10792 (or (not gnus-use-cache)
10793 (eq gnus-use-cache 'passive)))
10796 (setq gnus-newsgroup-marked nil
10797 gnus-newsgroup-spam-marked nil
10798 gnus-newsgroup-dormant nil))
10799 (setq gnus-newsgroup-unreads
10800 (gnus-sorted-nunion
10801 (gnus-sorted-intersection gnus-newsgroup-unreads
10802 gnus-newsgroup-downloadable)
10803 gnus-newsgroup-unfetched)))
10804 ;; We actually mark all articles as canceled, which we
10805 ;; have to do when using auto-expiry or adaptive scoring.
10806 (gnus-summary-show-all-threads)
10807 (if (and to-here reverse)
10809 (goto-char to-here)
10810 (gnus-summary-mark-current-read-and-unread-as-read
10812 (while (gnus-summary-find-next (not all))
10813 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10814 (when (gnus-summary-first-subject (not all))
10816 (if to-here (< (point) to-here) t)
10817 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10818 (gnus-summary-find-next (not all))))))
10819 (gnus-set-mode-line 'summary))
10821 (gnus-summary-position-point)))
10823 (defun gnus-summary-catchup-to-here (&optional all)
10824 "Mark all unticked articles before the current one as read.
10825 If ALL is non-nil, also mark ticked and dormant articles as read."
10828 (gnus-save-hidden-threads
10829 (let ((beg (point)))
10830 ;; We check that there are unread articles.
10831 (when (or all (gnus-summary-find-prev))
10832 (gnus-summary-catchup all t beg)))))
10833 (gnus-summary-position-point))
10835 (defun gnus-summary-catchup-from-here (&optional all)
10836 "Mark all unticked articles after (and including) the current one as read.
10837 If ALL is non-nil, also mark ticked and dormant articles as read."
10840 (gnus-save-hidden-threads
10841 (let ((beg (point)))
10842 ;; We check that there are unread articles.
10843 (when (or all (gnus-summary-find-next))
10844 (gnus-summary-catchup all t beg nil t)))))
10845 (gnus-summary-position-point))
10847 (defun gnus-summary-catchup-all (&optional quietly)
10848 "Mark all articles in this newsgroup as read.
10849 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10850 instead, which marks only unread articles as read."
10852 (gnus-summary-catchup t quietly))
10854 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10855 "Mark all unread articles in this group as read, then exit.
10856 If prefix argument ALL is non-nil, all articles are marked as read.
10857 If QUIETLY is non-nil, no questions will be asked."
10859 (when (gnus-summary-catchup all quietly nil 'fast)
10860 ;; Select next newsgroup or exit.
10861 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10862 (eq gnus-auto-select-next 'quietly))
10863 (gnus-summary-next-group nil)
10864 (gnus-summary-exit))))
10866 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10867 "Mark all articles in this newsgroup as read, and then exit.
10868 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10869 instead, which marks only unread articles as read."
10871 (gnus-summary-catchup-and-exit t quietly))
10873 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10874 "Mark all articles in this group as read and select the next group.
10875 If given a prefix, mark all articles, unread as well as ticked, as
10879 (gnus-summary-catchup all))
10880 (gnus-summary-next-group))
10882 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10883 "Mark all articles in this group as read and select the previous group.
10884 If given a prefix, mark all articles, unread as well as ticked, as
10888 (gnus-summary-catchup all))
10889 (gnus-summary-next-group nil nil t))
10895 (defmacro gnus-with-article (article &rest forms)
10896 "Select ARTICLE and perform FORMS in the original article buffer.
10897 Then replace the article with the result."
10899 ;; We don't want the article to be marked as read.
10900 (let (gnus-mark-article-hook)
10901 (gnus-summary-select-article t t nil ,article))
10902 (set-buffer gnus-original-article-buffer)
10904 (if (not (gnus-check-backend-function
10905 'request-replace-article (car gnus-article-current)))
10906 (gnus-message 5 "Read-only group; not replacing")
10907 (unless (gnus-request-replace-article
10908 ,article (car gnus-article-current)
10909 (current-buffer) t)
10910 (error "Couldn't replace article")))
10911 ;; The cache and backlog have to be flushed somewhat.
10912 (when gnus-keep-backlog
10913 (gnus-backlog-remove-article
10914 (car gnus-article-current) (cdr gnus-article-current)))
10915 (when gnus-use-cache
10916 (gnus-cache-update-article
10917 (car gnus-article-current) (cdr gnus-article-current)))))
10919 (put 'gnus-with-article 'lisp-indent-function 1)
10920 (put 'gnus-with-article 'edebug-form-spec '(form body))
10922 ;; Thread-based commands.
10924 (defun gnus-summary-articles-in-thread (&optional article)
10925 "Return a list of all articles in the current thread.
10926 If ARTICLE is non-nil, return all articles in the thread that starts
10927 with that article."
10928 (let* ((article (or article (gnus-summary-article-number)))
10929 (data (gnus-data-find-list article))
10930 (top-level (gnus-data-level (car data)))
10932 (cond ((null gnus-thread-operation-ignore-subject)
10933 (gnus-simplify-subject-re
10934 (mail-header-subject (gnus-data-header (car data)))))
10935 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10936 (gnus-simplify-subject-fuzzy
10937 (mail-header-subject (gnus-data-header (car data)))))
10939 (end-point (save-excursion
10940 (if (gnus-summary-go-to-next-thread)
10941 (point) (point-max))))
10944 (< (gnus-data-pos (car data)) end-point))
10945 (when (or (not top-subject)
10946 (string= top-subject
10947 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10948 (gnus-simplify-subject-fuzzy
10949 (mail-header-subject
10950 (gnus-data-header (car data))))
10951 (gnus-simplify-subject-re
10952 (mail-header-subject
10953 (gnus-data-header (car data)))))))
10954 (push (gnus-data-number (car data)) articles))
10955 (unless (and (setq data (cdr data))
10956 (> (gnus-data-level (car data)) top-level))
10958 ;; Return the list of articles.
10959 (nreverse articles)))
10961 (defun gnus-summary-rethread-current ()
10962 "Rethread the thread the current article is part of."
10964 (let* ((gnus-show-threads t)
10965 (article (gnus-summary-article-number))
10966 (id (mail-header-id (gnus-summary-article-header)))
10967 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10969 (error "No article on the current line"))
10970 (gnus-rebuild-thread id)
10971 (gnus-summary-goto-subject article)))
10973 (defun gnus-summary-reparent-thread ()
10974 "Make the current article child of the marked (or previous) article.
10976 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10977 is non-nil or the Subject: of both articles are the same."
10979 (unless (not (gnus-group-read-only-p))
10980 (error "The current newsgroup does not support article editing"))
10981 (unless (<= (length gnus-newsgroup-processable) 1)
10982 (error "No more than one article may be marked"))
10983 (let ((child (gnus-summary-article-number))
10984 ;; First grab the marked article, otherwise one line up.
10985 (parent (if (not (null gnus-newsgroup-processable))
10986 (car gnus-newsgroup-processable)
10988 (if (eq (forward-line -1) 0)
10989 (gnus-summary-article-number)
10990 (error "Beginning of summary buffer"))))))
10991 (gnus-summary-reparent-children parent (list child))))
10993 (defun gnus-summary-reparent-children (parent children)
10994 "Make PARENT the parent of CHILDREN.
10995 When called interactively, PARENT is is current article and
10996 CHILDREN are the process-marked articles."
10998 (list (gnus-summary-article-number)
10999 (gnus-summary-work-articles nil)))
11000 (dolist (child children)
11001 (save-window-excursion
11002 (let ((gnus-article-buffer " *reparent*"))
11003 (unless (not (eq parent child))
11004 (error "An article may not be self-referential"))
11005 (let ((message-id (mail-header-id
11006 (gnus-summary-article-header parent))))
11007 (unless (and message-id (not (equal message-id "")))
11008 (error "No message-id in desired parent"))
11009 (gnus-with-article child
11011 (goto-char (point-min))
11012 (message-narrow-to-head)
11013 (if (re-search-forward "^References: " nil t)
11015 (re-search-forward "^[^ \t]" nil t)
11018 (insert " " message-id))
11019 (insert "References: " message-id "\n"))))
11020 (set-buffer gnus-summary-buffer)
11021 (gnus-summary-unmark-all-processable)
11022 (gnus-summary-update-article child)
11023 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11024 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11025 (gnus-summary-rethread-current)
11026 (gnus-message 3 "Article %d is now the child of article %d"
11029 (defun gnus-summary-toggle-threads (&optional arg)
11030 "Toggle showing conversation threads.
11031 If ARG is positive number, turn showing conversation threads on."
11033 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11034 (setq gnus-show-threads
11035 (if (null arg) (not gnus-show-threads)
11036 (> (prefix-numeric-value arg) 0)))
11037 (gnus-summary-prepare)
11038 (gnus-summary-goto-subject current)
11039 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11040 (gnus-summary-position-point)))
11042 (defun gnus-summary-show-all-threads ()
11043 "Show all threads."
11046 (let ((buffer-read-only nil))
11047 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
11048 (gnus-summary-position-point))
11050 (defun gnus-summary-show-thread ()
11051 "Show thread subtrees.
11052 Returns nil if no thread was there to be shown."
11054 (let ((buffer-read-only nil)
11056 (end (point-at-eol))
11057 ;; Leave point at bol
11058 (beg (progn (beginning-of-line) (point))))
11060 ;; Any hidden lines here?
11061 (search-forward "\r" end t)
11062 (subst-char-in-region beg end ?\^M ?\n t)
11064 (gnus-summary-position-point))))
11066 (defun gnus-summary-maybe-hide-threads ()
11067 "If requested, hide the threads that should be hidden."
11068 (when (and gnus-show-threads
11069 gnus-thread-hide-subtree)
11070 (gnus-summary-hide-all-threads
11071 (if (or (consp gnus-thread-hide-subtree)
11072 (functionp gnus-thread-hide-subtree))
11073 (gnus-make-predicate gnus-thread-hide-subtree)
11076 ;;; Hiding predicates.
11078 (defun gnus-article-unread-p (header)
11079 (memq (mail-header-number header) gnus-newsgroup-unreads))
11081 (defun gnus-article-unseen-p (header)
11082 (memq (mail-header-number header) gnus-newsgroup-unseen))
11084 (defun gnus-map-articles (predicate articles)
11085 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11086 (apply 'gnus-or (mapcar predicate
11087 (mapcar (lambda (number)
11088 (gnus-summary-article-header number))
11091 (defun gnus-summary-hide-all-threads (&optional predicate)
11092 "Hide all thread subtrees.
11093 If PREDICATE is supplied, threads that satisfy this predicate
11094 will not be hidden."
11097 (goto-char (point-min))
11100 (when (or (not predicate)
11102 predicate (gnus-summary-article-children)))
11103 (gnus-summary-hide-thread))
11104 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11105 (gnus-summary-position-point))
11107 (defun gnus-summary-hide-thread ()
11108 "Hide thread subtrees.
11109 If PREDICATE is supplied, threads that satisfy this predicate
11110 will not be hidden.
11111 Returns nil if no threads were there to be hidden."
11113 (let ((buffer-read-only nil)
11115 (article (gnus-summary-article-number)))
11117 ;; Go forward until either the buffer ends or the subthread
11119 (when (and (not (eobp))
11120 (or (zerop (gnus-summary-next-thread 1 t))
11121 (goto-char (point-max))))
11123 (if (and (> (point) start)
11124 (search-backward "\n" start t))
11126 (subst-char-in-region start (point) ?\n ?\^M)
11127 (gnus-summary-goto-subject article))
11131 (defun gnus-summary-go-to-next-thread (&optional previous)
11132 "Go to the same level (or less) next thread.
11133 If PREVIOUS is non-nil, go to previous thread instead.
11134 Return the article number moved to, or nil if moving was impossible."
11135 (let ((level (gnus-summary-thread-level))
11136 (way (if previous -1 1))
11139 (while (and (not (eobp))
11140 (< level (gnus-summary-thread-level)))
11141 (forward-line way))
11148 (gnus-summary-article-number)
11149 (goto-char beg)))))
11151 (defun gnus-summary-next-thread (n &optional silent)
11152 "Go to the same level next N'th thread.
11153 If N is negative, search backward instead.
11154 Returns the difference between N and the number of skips actually
11157 If SILENT, don't output messages."
11159 (let ((backward (< n 0))
11161 (while (and (> n 0)
11162 (gnus-summary-go-to-next-thread backward))
11165 (gnus-summary-position-point))
11166 (when (and (not silent) (/= 0 n))
11167 (gnus-message 7 "No more threads"))
11170 (defun gnus-summary-prev-thread (n)
11171 "Go to the same level previous N'th thread.
11172 Returns the difference between N and the number of skips actually
11175 (gnus-summary-next-thread (- n)))
11177 (defun gnus-summary-go-down-thread ()
11178 "Go down one level in the current thread."
11179 (let ((children (gnus-summary-article-children)))
11181 (gnus-summary-goto-subject (car children)))))
11183 (defun gnus-summary-go-up-thread ()
11184 "Go up one level in the current thread."
11185 (let ((parent (gnus-summary-article-parent)))
11187 (gnus-summary-goto-subject parent))))
11189 (defun gnus-summary-down-thread (n)
11190 "Go down thread N steps.
11191 If N is negative, go up instead.
11192 Returns the difference between N and how many steps down that were
11197 (while (and (> n 0)
11198 (if up (gnus-summary-go-up-thread)
11199 (gnus-summary-go-down-thread)))
11201 (gnus-summary-position-point)
11203 (gnus-message 7 "Can't go further"))
11206 (defun gnus-summary-up-thread (n)
11207 "Go up thread N steps.
11208 If N is negative, go down instead.
11209 Returns the difference between N and how many steps down that were
11212 (gnus-summary-down-thread (- n)))
11214 (defun gnus-summary-top-thread ()
11215 "Go to the top of the thread."
11217 (while (gnus-summary-go-up-thread))
11218 (gnus-summary-article-number))
11220 (defun gnus-summary-kill-thread (&optional unmark)
11221 "Mark articles under current thread as read.
11222 If the prefix argument is positive, remove any kinds of marks.
11223 If the prefix argument is negative, tick articles instead."
11226 (setq unmark (prefix-numeric-value unmark)))
11227 (let ((articles (gnus-summary-articles-in-thread)))
11229 ;; Expand the thread.
11230 (gnus-summary-show-thread)
11231 ;; Mark all the articles.
11233 (gnus-summary-goto-subject (car articles))
11234 (cond ((null unmark)
11235 (gnus-summary-mark-article-as-read gnus-killed-mark))
11237 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11239 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11240 (setq articles (cdr articles))))
11241 ;; Hide killed subtrees.
11243 gnus-thread-hide-killed
11244 (gnus-summary-hide-thread))
11245 ;; If marked as read, go to next unread subject.
11246 (when (null unmark)
11247 ;; Go to next unread subject.
11248 (gnus-summary-next-subject 1 t)))
11249 (gnus-set-mode-line 'summary))
11251 ;; Summary sorting commands
11253 (defun gnus-summary-sort-by-number (&optional reverse)
11254 "Sort the summary buffer by article number.
11255 Argument REVERSE means reverse order."
11257 (gnus-summary-sort 'number reverse))
11259 (defun gnus-summary-sort-by-random (&optional reverse)
11260 "Randomize the order in the summary buffer.
11261 Argument REVERSE means to randomize in reverse order."
11263 (gnus-summary-sort 'random reverse))
11265 (defun gnus-summary-sort-by-author (&optional reverse)
11266 "Sort the summary buffer by author name alphabetically.
11267 If `case-fold-search' is non-nil, case of letters is ignored.
11268 Argument REVERSE means reverse order."
11270 (gnus-summary-sort 'author reverse))
11272 (defun gnus-summary-sort-by-recipient (&optional reverse)
11273 "Sort the summary buffer by recipient name alphabetically.
11274 If `case-fold-search' is non-nil, case of letters is ignored.
11275 Argument REVERSE means reverse order."
11277 (gnus-summary-sort 'recipient reverse))
11279 (defun gnus-summary-sort-by-subject (&optional reverse)
11280 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11281 If `case-fold-search' is non-nil, case of letters is ignored.
11282 Argument REVERSE means reverse order."
11284 (gnus-summary-sort 'subject reverse))
11286 (defun gnus-summary-sort-by-date (&optional reverse)
11287 "Sort the summary buffer by date.
11288 Argument REVERSE means reverse order."
11290 (gnus-summary-sort 'date reverse))
11292 (defun gnus-summary-sort-by-score (&optional reverse)
11293 "Sort the summary buffer by score.
11294 Argument REVERSE means reverse order."
11296 (gnus-summary-sort 'score reverse))
11298 (defun gnus-summary-sort-by-lines (&optional reverse)
11299 "Sort the summary buffer by the number of lines.
11300 Argument REVERSE means reverse order."
11302 (gnus-summary-sort 'lines reverse))
11304 (defun gnus-summary-sort-by-chars (&optional reverse)
11305 "Sort the summary buffer by article length.
11306 Argument REVERSE means reverse order."
11308 (gnus-summary-sort 'chars reverse))
11310 (defun gnus-summary-sort-by-original (&optional reverse)
11311 "Sort the summary buffer using the default sorting method.
11312 Argument REVERSE means reverse order."
11314 (let* ((buffer-read-only)
11315 (gnus-summary-prepare-hook nil))
11316 ;; We do the sorting by regenerating the threads.
11317 (gnus-summary-prepare)
11318 ;; Hide subthreads if needed.
11319 (gnus-summary-maybe-hide-threads)))
11321 (defun gnus-summary-sort (predicate reverse)
11322 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11323 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11324 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11325 (gnus-thread-sort-functions
11330 (gnus-sort-gathered-threads-function
11331 gnus-thread-sort-functions)
11332 (gnus-article-sort-functions
11336 (,article t2 t1))))
11338 (gnus-summary-prepare-hook nil))
11339 ;; We do the sorting by regenerating the threads.
11340 (gnus-summary-prepare)
11341 ;; Hide subthreads if needed.
11342 (gnus-summary-maybe-hide-threads)))
11344 ;; Summary saving commands.
11346 (defun gnus-summary-save-article (&optional n not-saved)
11347 "Save the current article using the default saver function.
11348 If N is a positive number, save the N next articles.
11349 If N is a negative number, save the N previous articles.
11350 If N is nil and any articles have been marked with the process mark,
11351 save those articles instead.
11352 The variable `gnus-default-article-saver' specifies the saver function.
11354 If the optional second argument NOT-SAVED is non-nil, articles saved
11355 will not be marked as saved."
11357 (require 'gnus-art)
11358 (let* ((articles (gnus-summary-work-articles n))
11359 (save-buffer (save-excursion
11360 (nnheader-set-temp-buffer " *Gnus Save*")))
11361 (num (length articles))
11362 ;; Whether to save decoded articles or raw articles.
11363 (decode (when gnus-article-save-coding-system
11364 (get gnus-default-article-saver :decode)))
11365 ;; When saving many articles in a single file, use the other
11366 ;; function to save articles other than the first one.
11367 (saver2 (get gnus-default-article-saver :function))
11368 (gnus-prompt-before-saving (if saver2
11370 gnus-prompt-before-saving))
11371 (gnus-default-article-saver gnus-default-article-saver)
11373 (dolist (article articles)
11374 (setq header (gnus-summary-article-header article))
11375 (if (not (vectorp header))
11376 ;; This is a pseudo-article.
11377 (if (assq 'name header)
11378 (gnus-copy-file (cdr (assq 'name header)))
11379 (gnus-message 1 "Article %d is unsaveable" article))
11380 ;; This is a real article.
11381 (save-window-excursion
11382 (let ((gnus-display-mime-function (when decode
11383 gnus-display-mime-function))
11384 (gnus-article-prepare-hook (when decode
11385 gnus-article-prepare-hook)))
11386 (gnus-summary-select-article t nil nil article)
11387 (gnus-summary-goto-subject article)))
11389 (set-buffer save-buffer)
11391 (insert-buffer-substring (if decode
11392 gnus-article-buffer
11393 gnus-original-article-buffer)))
11394 (setq file (gnus-article-save save-buffer file num))
11395 (gnus-summary-remove-process-mark article)
11397 (gnus-summary-set-saved-mark article)))
11399 (setq gnus-default-article-saver saver2
11401 (gnus-kill-buffer save-buffer)
11402 (gnus-summary-position-point)
11403 (gnus-set-mode-line 'summary)
11406 (defun gnus-summary-pipe-output (&optional arg headers)
11407 "Pipe the current article to a subprocess.
11408 If N is a positive number, pipe the N next articles.
11409 If N is a negative number, pipe the N previous articles.
11410 If N is nil and any articles have been marked with the process mark,
11411 pipe those articles instead.
11412 If HEADERS (the symbolic prefix), include the headers, too."
11413 (interactive (gnus-interactive "P\ny"))
11414 (require 'gnus-art)
11415 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11416 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11417 (gnus-summary-save-article arg t))
11418 (let ((buffer (get-buffer "*Shell Command Output*")))
11420 (not (zerop (buffer-size buffer))))
11421 (gnus-configure-windows 'pipe))))
11423 (defun gnus-summary-save-article-mail (&optional arg)
11424 "Append the current article to a Unix mail box file.
11425 If N is a positive number, save the N next articles.
11426 If N is a negative number, save the N previous articles.
11427 If N is nil and any articles have been marked with the process mark,
11428 save those articles instead."
11430 (require 'gnus-art)
11431 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11432 (gnus-summary-save-article arg)))
11434 (defun gnus-summary-save-article-rmail (&optional arg)
11435 "Append the current article to an rmail file.
11436 If N is a positive number, save the N next articles.
11437 If N is a negative number, save the N previous articles.
11438 If N is nil and any articles have been marked with the process mark,
11439 save those articles instead."
11441 (require 'gnus-art)
11442 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11443 (gnus-summary-save-article arg)))
11445 (defun gnus-summary-save-article-file (&optional arg)
11446 "Append the current article to a file.
11447 If N is a positive number, save the N next articles.
11448 If N is a negative number, save the N previous articles.
11449 If N is nil and any articles have been marked with the process mark,
11450 save those articles instead."
11452 (require 'gnus-art)
11453 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11454 (gnus-summary-save-article arg)))
11456 (defun gnus-summary-write-article-file (&optional arg)
11457 "Write the current article to a file, deleting the previous file.
11458 If N is a positive number, save the N next articles.
11459 If N is a negative number, save the N previous articles.
11460 If N is nil and any articles have been marked with the process mark,
11461 save those articles instead."
11463 (require 'gnus-art)
11464 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11465 (gnus-summary-save-article arg)))
11467 (defun gnus-summary-save-article-body-file (&optional arg)
11468 "Append the current article body to a file.
11469 If N is a positive number, save the N next articles.
11470 If N is a negative number, save the N previous articles.
11471 If N is nil and any articles have been marked with the process mark,
11472 save those articles instead."
11474 (require 'gnus-art)
11475 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11476 (gnus-summary-save-article arg)))
11478 (defun gnus-summary-write-article-body-file (&optional arg)
11479 "Write the current article body to a file, deleting the previous file.
11480 If N is a positive number, save the N next articles.
11481 If N is a negative number, save the N previous articles.
11482 If N is nil and any articles have been marked with the process mark,
11483 save those articles instead."
11485 (require 'gnus-art)
11486 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
11487 (gnus-summary-save-article arg)))
11489 (defun gnus-summary-muttprint (&optional arg)
11490 "Print the current article using Muttprint.
11491 If N is a positive number, save the N next articles.
11492 If N is a negative number, save the N previous articles.
11493 If N is nil and any articles have been marked with the process mark,
11494 save those articles instead."
11496 (require 'gnus-art)
11497 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11498 (gnus-summary-save-article arg t)))
11500 (defun gnus-summary-pipe-message (program)
11501 "Pipe the current article through PROGRAM."
11502 (interactive "sProgram: ")
11503 (gnus-summary-select-article)
11504 (let ((mail-header-separator ""))
11505 (gnus-eval-in-buffer-window gnus-article-buffer
11508 (let ((start (window-start))
11510 (message-pipe-buffer-body program)
11511 (set-window-start (get-buffer-window (current-buffer)) start))))))
11513 (defun gnus-get-split-value (methods)
11514 "Return a value based on the split METHODS."
11515 (let (split-name method result match)
11518 (set-buffer gnus-original-article-buffer)
11520 (nnheader-narrow-to-headers)
11521 (while (and methods (not split-name))
11522 (goto-char (point-min))
11523 (setq method (pop methods))
11524 (setq match (car method))
11527 ;; Regular expression.
11529 (re-search-forward match nil t)))
11534 (setq result (funcall match gnus-newsgroup-name))))
11539 (setq result (eval match)))))
11540 (setq split-name (cdr method))
11541 (cond ((stringp result)
11542 (push (expand-file-name
11543 result gnus-article-save-directory)
11546 (setq split-name (append result split-name)))))))))
11547 (nreverse split-name)))
11549 (defun gnus-valid-move-group-p (group)
11550 (and (boundp group)
11551 (symbol-name group)
11552 (symbol-value group)
11553 (gnus-get-function (gnus-find-method-for-group
11554 (symbol-name group)) 'request-accept-article t)))
11556 (defun gnus-read-move-group-name (prompt default articles prefix)
11557 "Read a group name."
11558 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11559 (minibuffer-confirm-incomplete nil) ; XEmacs
11563 (if (> (length articles) 1)
11564 (format "these %d articles" (length articles))
11569 (gnus-completing-read-with-default
11572 'gnus-valid-move-group-p
11574 'gnus-group-history))
11575 ((= 1 (length split-name))
11576 (gnus-completing-read-with-default
11577 (car split-name) prom
11579 'gnus-valid-move-group-p
11581 'gnus-group-history))
11583 (gnus-completing-read-with-default
11585 (mapcar 'list (nreverse split-name))
11587 'gnus-group-history))))
11588 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11590 (if (or (string= to-newsgroup "")
11591 (string= to-newsgroup prefix))
11592 (setq to-newsgroup default))
11593 (unless to-newsgroup
11594 (error "No group name entered"))
11595 (or (gnus-active to-newsgroup)
11596 (gnus-activate-group to-newsgroup nil nil to-method)
11597 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11599 (or (and (gnus-request-create-group to-newsgroup to-method)
11600 (gnus-activate-group
11601 to-newsgroup nil nil to-method)
11602 (gnus-subscribe-group to-newsgroup))
11603 (error "Couldn't create group %s" to-newsgroup)))
11604 (error "No such group: %s" to-newsgroup)))
11607 (defvar gnus-summary-save-parts-counter)
11609 (defun gnus-summary-save-parts (type dir n &optional reverse)
11610 "Save parts matching TYPE to DIR.
11611 If REVERSE, save parts that do not match TYPE."
11613 (list (read-string "Save parts of type: "
11614 (or (car gnus-summary-save-parts-type-history)
11615 gnus-summary-save-parts-default-mime)
11616 'gnus-summary-save-parts-type-history)
11617 (setq gnus-summary-save-parts-last-directory
11618 (read-file-name "Save to directory: "
11619 gnus-summary-save-parts-last-directory
11621 current-prefix-arg))
11622 (gnus-summary-iterate n
11623 (let ((gnus-display-mime-function nil)
11624 (gnus-inhibit-treatment t))
11625 (gnus-summary-select-article))
11627 (set-buffer gnus-article-buffer)
11628 (let ((handles (or gnus-article-mime-handles
11629 (mm-dissect-buffer nil gnus-article-loose-mime)
11630 (and gnus-article-emulate-mime
11632 (gnus-summary-save-parts-counter 1))
11634 (gnus-summary-save-parts-1 type dir handles reverse)
11635 (unless gnus-article-mime-handles ;; Don't destroy this case.
11636 (mm-destroy-parts handles)))))))
11638 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11639 (if (stringp (car handle))
11640 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11643 (not (string-match type (mm-handle-media-type handle)))
11644 (string-match type (mm-handle-media-type handle)))
11645 (let ((file (expand-file-name
11647 mm-file-name-rewrite-functions
11648 (file-name-nondirectory
11650 (mail-content-type-get
11651 (mm-handle-disposition handle) 'filename)
11652 (mail-content-type-get
11653 (mm-handle-type handle) 'name)
11654 (format "%s.%d.%d" gnus-newsgroup-name
11655 (cdr gnus-article-current)
11656 gnus-summary-save-parts-counter))))
11658 (incf gnus-summary-save-parts-counter)
11659 (unless (file-exists-p file)
11660 (mm-save-part-to-file handle file))))))
11662 ;; Summary extract commands
11664 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11665 (let ((buffer-read-only nil)
11666 (article (gnus-summary-article-number))
11668 (unless (gnus-summary-goto-subject article)
11669 (error "No such article: %d" article))
11670 (gnus-summary-position-point)
11671 ;; If all commands are to be bunched up on one line, we collect
11673 (unless gnus-view-pseudos-separately
11674 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11677 (setq action (cdr (assq 'action (car ps))))
11678 (setq files (list (cdr (assq 'name (car ps)))))
11679 (while (and ps (cdr ps)
11680 (string= (or action "1")
11681 (or (cdr (assq 'action (cadr ps))) "2")))
11682 (push (cdr (assq 'name (cadr ps))) files)
11683 (setcdr ps (cddr ps)))
11685 (when (not (string-match "%s" action))
11688 (when (assq 'execute (car ps))
11689 (setcdr (assq 'execute (car ps))
11690 (funcall (if (string-match "%s" action)
11697 (shell-quote-argument f)))
11699 (setq ps (cdr ps)))))
11700 (if (and gnus-view-pseudos (not not-view))
11702 (when (assq 'execute (car pslist))
11703 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11704 (eq gnus-view-pseudos 'not-confirm)))
11705 (setq pslist (cdr pslist)))
11708 (setq after-article (or (cdr (assq 'article (car pslist)))
11709 (gnus-summary-article-number)))
11710 (gnus-summary-goto-subject after-article)
11713 (insert " " (file-name-nondirectory
11714 (cdr (assq 'name (car pslist))))
11715 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11717 (forward-line -1) ; back to `b'
11718 (gnus-add-text-properties
11719 b (1- e) (list 'gnus-number gnus-reffed-article-number
11720 gnus-mouse-face-prop gnus-mouse-face))
11722 after-article gnus-reffed-article-number
11723 gnus-unread-mark b (car pslist) 0 (- e b))
11724 (setq gnus-newsgroup-unreads
11725 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11726 gnus-reffed-article-number))
11727 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11728 (setq pslist (cdr pslist)))))))
11730 (defun gnus-pseudos< (p1 p2)
11731 (let ((c1 (cdr (assq 'action p1)))
11732 (c2 (cdr (assq 'action p2))))
11733 (and c1 c2 (string< c1 c2))))
11735 (defun gnus-request-pseudo-article (props)
11736 (cond ((assq 'execute props)
11737 (gnus-execute-command (cdr (assq 'execute props)))))
11738 (let ((gnus-current-article (gnus-summary-article-number)))
11739 (gnus-run-hooks 'gnus-mark-article-hook)))
11741 (defun gnus-execute-command (command &optional automatic)
11743 (gnus-article-setup-buffer)
11744 (set-buffer gnus-article-buffer)
11745 (setq buffer-read-only nil)
11746 (let ((command (if automatic command
11747 (read-string "Command: " (cons command 0)))))
11749 (insert "$ " command "\n\n")
11750 (if gnus-view-pseudo-asynchronously
11751 (start-process "gnus-execute" (current-buffer) shell-file-name
11752 shell-command-switch command)
11753 (call-process shell-file-name nil t nil
11754 shell-command-switch command)))))
11756 ;; Summary kill commands.
11758 (defun gnus-summary-edit-global-kill (article)
11759 "Edit the \"global\" kill file."
11760 (interactive (list (gnus-summary-article-number)))
11761 (gnus-group-edit-global-kill article))
11763 (defun gnus-summary-edit-local-kill ()
11764 "Edit a local kill file applied to the current newsgroup."
11766 (setq gnus-current-headers (gnus-summary-article-header))
11767 (gnus-group-edit-local-kill
11768 (gnus-summary-article-number) gnus-newsgroup-name))
11770 ;;; Header reading.
11772 (defun gnus-read-header (id &optional header)
11773 "Read the headers of article ID and enter them into the Gnus system."
11774 (let ((group gnus-newsgroup-name)
11775 (gnus-override-method
11777 gnus-override-method
11778 (and (gnus-news-group-p gnus-newsgroup-name)
11779 (car (gnus-refer-article-methods)))))
11781 ;; First we check to see whether the header in question is already
11784 ;; This is a Message-ID.
11785 (setq header (or header (gnus-id-to-header id)))
11786 ;; This is an article number.
11787 (setq header (or header (gnus-summary-article-header id))))
11789 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11790 ;; We have found the header.
11792 ;; We have to really fetch the header to this article.
11794 (set-buffer nntp-server-buffer)
11795 (when (setq where (gnus-request-head id group))
11796 (nnheader-fold-continuation-lines)
11797 (goto-char (point-max))
11799 (goto-char (point-min))
11803 ((cdr where) (cdr where))
11804 (header (mail-header-number header))
11805 (t gnus-reffed-article-number))
11807 (insert " Article retrieved.\n"))
11808 (if (or (not where)
11809 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11810 () ; Malformed head.
11811 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11812 (when (and (stringp id)
11814 (not (string= (gnus-group-real-name group)
11816 (not (gnus-server-equal gnus-override-method
11817 (gnus-group-method group)))))
11818 ;; If we fetched by Message-ID and the article came from
11819 ;; a different group (or server), we fudge some bogus
11820 ;; article numbers for this article.
11821 (mail-header-set-number header gnus-reffed-article-number))
11823 (set-buffer gnus-summary-buffer)
11824 (decf gnus-reffed-article-number)
11825 (gnus-remove-header (mail-header-number header))
11826 (push header gnus-newsgroup-headers)
11827 (setq gnus-current-headers header)
11828 (push (mail-header-number header) gnus-newsgroup-limit)))
11831 (defun gnus-remove-header (number)
11832 "Remove header NUMBER from `gnus-newsgroup-headers'."
11833 (if (and gnus-newsgroup-headers
11834 (= number (mail-header-number (car gnus-newsgroup-headers))))
11835 (pop gnus-newsgroup-headers)
11836 (let ((headers gnus-newsgroup-headers))
11837 (while (and (cdr headers)
11838 (not (= number (mail-header-number (cadr headers)))))
11840 (when (cdr headers)
11841 (setcdr headers (cddr headers))))))
11844 ;;; summary highlights
11847 (defun gnus-highlight-selected-summary ()
11848 "Highlight selected article in summary buffer."
11849 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11850 (when gnus-summary-selected-face
11852 (let* ((beg (point-at-bol))
11853 (end (point-at-eol))
11854 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11855 (from (if (get-text-property beg gnus-mouse-face-prop)
11857 (or (next-single-property-change
11858 beg gnus-mouse-face-prop nil end)
11863 (or (next-single-property-change
11864 from gnus-mouse-face-prop nil end)
11866 ;; If no mouse-face prop on line we will have to = from = end,
11867 ;; so we highlight the entire line instead.
11868 (when (= (+ to 2) from)
11871 (if gnus-newsgroup-selected-overlay
11872 ;; Move old overlay.
11874 gnus-newsgroup-selected-overlay from to (current-buffer))
11875 ;; Create new overlay.
11877 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11878 'face gnus-summary-selected-face))))))
11880 (defvar gnus-summary-highlight-line-cached nil)
11881 (defvar gnus-summary-highlight-line-trigger nil)
11883 (defun gnus-summary-highlight-line-0 ()
11884 (if (and (eq gnus-summary-highlight-line-trigger
11885 gnus-summary-highlight)
11886 gnus-summary-highlight-line-cached)
11887 gnus-summary-highlight-line-cached
11888 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11889 gnus-summary-highlight-line-cached
11890 (let* ((cond (list 'cond))
11892 (list gnus-summary-highlight))
11894 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11898 (gnus-byte-compile (list 'lambda nil cond))))))
11900 (defun gnus-summary-highlight-line ()
11901 "Highlight current line according to `gnus-summary-highlight'."
11902 (let* ((beg (point-at-bol))
11903 (article (or (gnus-summary-article-number) gnus-current-article))
11904 (score (or (cdr (assq article
11905 gnus-newsgroup-scored))
11906 gnus-summary-default-score 0))
11907 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11908 (inhibit-read-only t)
11909 (default gnus-summary-default-score)
11910 (default-high gnus-summary-default-high-score)
11911 (default-low gnus-summary-default-low-score)
11912 (uncached (and gnus-summary-use-undownloaded-faces
11913 (memq article gnus-newsgroup-undownloaded)
11914 (not (memq article gnus-newsgroup-cached)))))
11915 (let ((face (funcall (gnus-summary-highlight-line-0))))
11916 (unless (eq face (get-text-property beg 'face))
11917 (gnus-put-text-property-excluding-characters-with-faces
11918 beg (point-at-eol) 'face
11919 (setq face (if (boundp face) (symbol-value face) face)))
11920 (when gnus-summary-highlight-line-function
11921 (funcall gnus-summary-highlight-line-function article face))))))
11923 (defun gnus-update-read-articles (group unread &optional compute)
11924 "Update the list of read articles in GROUP.
11925 UNREAD is a sorted list."
11926 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11927 (info (gnus-get-info group))
11930 (if (or (not info) (not active))
11931 ;; There is no info on this group if it was, in fact,
11932 ;; killed. Gnus stores no information on killed groups, so
11933 ;; there's nothing to be done.
11934 ;; One could store the information somewhere temporarily,
11935 ;; perhaps... Hmmm...
11937 ;; Remove any negative articles numbers.
11938 (while (and unread (< (car unread) 0))
11939 (setq unread (cdr unread)))
11940 ;; Remove any expired article numbers
11941 (while (and unread (< (car unread) (car active)))
11942 (setq unread (cdr unread)))
11943 ;; Compute the ranges of read articles by looking at the list of
11944 ;; unread articles.
11946 (when (/= (car unread) prev)
11947 (push (if (= prev (1- (car unread))) prev
11948 (cons prev (1- (car unread))))
11950 (setq prev (1+ (car unread)))
11951 (setq unread (cdr unread)))
11952 (when (<= prev (cdr active))
11953 (push (cons prev (cdr active)) read))
11954 (setq read (if (> (length read) 1) (nreverse read) read))
11959 ;; Propagate the read marks to the backend.
11960 (when (gnus-check-backend-function 'request-set-mark group)
11961 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11962 (add (gnus-remove-from-range read (gnus-info-read info))))
11964 (unless (gnus-check-group group)
11965 (error "Can't open server for %s" group))
11966 (gnus-request-set-mark
11967 group (delq nil (list (if add (list add 'add '(read)))
11968 (if del (list del 'del '(read))))))
11970 `(gnus-request-set-mark
11973 (if del (list del 'add '(read)))
11974 (if add (list add 'del '(read))))))))))
11975 (set-buffer gnus-group-buffer)
11976 (gnus-undo-register
11978 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11979 (gnus-info-set-read ',info ',(gnus-info-read info))
11980 (gnus-get-unread-articles-in-group ',info
11981 (gnus-active ,group))
11982 (gnus-group-update-group ,group t)
11984 ;; Enter this list into the group info.
11985 (gnus-info-set-read info read)
11986 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11987 (gnus-get-unread-articles-in-group info (gnus-active group))
11990 (defun gnus-offer-save-summaries ()
11991 "Offer to save all active summary buffers."
11993 ;; Go through all buffers and find all summaries.
11994 (dolist (buffer (buffer-list))
11995 (when (and (setq buffer (buffer-name buffer))
11996 (string-match "Summary" buffer)
11997 (with-current-buffer buffer
11998 ;; We check that this is, indeed, a summary buffer.
11999 (and (eq major-mode 'gnus-summary-mode)
12000 ;; Also make sure this isn't bogus.
12001 gnus-newsgroup-prepared
12002 ;; Also make sure that this isn't a
12003 ;; dead summary buffer.
12004 (not gnus-dead-summary-mode))))
12005 (push buffer buffers)))
12006 ;; Go through all these summary buffers and offer to save them.
12010 "Update summary buffer %s? "
12012 (switch-to-buffer buf)
12013 (gnus-summary-exit))
12016 (defun gnus-summary-setup-default-charset ()
12017 "Setup newsgroup default charset."
12018 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12019 (setq gnus-newsgroup-charset nil)
12020 (let* ((ignored-charsets
12021 (or gnus-newsgroup-ephemeral-ignored-charsets
12023 (and gnus-newsgroup-name
12024 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12025 gnus-newsgroup-ignored-charsets))))
12026 (setq gnus-newsgroup-charset
12027 (or gnus-newsgroup-ephemeral-charset
12028 (and gnus-newsgroup-name
12029 (gnus-parameter-charset gnus-newsgroup-name))
12030 gnus-default-charset))
12031 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12032 ignored-charsets))))
12038 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12039 "Display the current article buffer fully MIME-buttonized.
12040 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12041 treated as multipart/mixed."
12043 (require 'gnus-art)
12044 (let ((gnus-unbuttonized-mime-types nil)
12045 (gnus-mime-display-multipart-as-mixed show-all-parts))
12046 (gnus-summary-show-article)))
12048 (defun gnus-summary-repair-multipart (article)
12049 "Add a Content-Type header to a multipart article without one."
12050 (interactive (list (gnus-summary-article-number)))
12051 (gnus-with-article article
12052 (message-narrow-to-head)
12053 (message-remove-header "Mime-Version")
12054 (goto-char (point-max))
12055 (insert "Mime-Version: 1.0\n")
12057 (when (search-forward "\n--" nil t)
12058 (let ((separator (buffer-substring (point) (point-at-eol))))
12059 (message-narrow-to-head)
12060 (message-remove-header "Content-Type")
12061 (goto-char (point-max))
12062 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12065 (let (gnus-mark-article-hook)
12066 (gnus-summary-select-article t t nil article)))
12068 (defun gnus-summary-toggle-display-buttonized ()
12069 "Toggle the buttonizing of the article buffer."
12071 (require 'gnus-art)
12072 (if (setq gnus-inhibit-mime-unbuttonizing
12073 (not gnus-inhibit-mime-unbuttonizing))
12074 (let ((gnus-unbuttonized-mime-types nil))
12075 (gnus-summary-show-article))
12076 (gnus-summary-show-article)))
12079 ;;; Generic summary marking commands
12082 (defvar gnus-summary-marking-alist
12083 '((read gnus-del-mark "d")
12084 (unread gnus-unread-mark "u")
12085 (ticked gnus-ticked-mark "!")
12086 (dormant gnus-dormant-mark "?")
12087 (expirable gnus-expirable-mark "e"))
12088 "An alist of names/marks/keystrokes.")
12090 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12091 (defvar gnus-summary-mark-map)
12093 (defun gnus-summary-make-all-marking-commands ()
12094 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12095 (dolist (elem gnus-summary-marking-alist)
12096 (apply 'gnus-summary-make-marking-command elem)))
12098 (defun gnus-summary-make-marking-command (name mark keystroke)
12099 (let ((map (make-sparse-keymap)))
12100 (define-key gnus-summary-generic-mark-map keystroke map)
12101 (dolist (lway `((next "next" next nil "n")
12102 (next-unread "next unread" next t "N")
12103 (prev "previous" prev nil "p")
12104 (prev-unread "previous unread" prev t "P")
12105 (nomove "" nil nil ,keystroke)))
12106 (let ((func (gnus-summary-make-marking-command-1
12107 mark (car lway) lway name)))
12108 (setq func (eval func))
12109 (define-key map (nth 4 lway) func)))))
12111 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12113 (format "gnus-summary-put-mark-as-%s%s"
12114 name (if (eq way 'nomove)
12116 (concat "-" (symbol-name way)))))
12119 "Mark the current article as %s%s.
12120 If N, the prefix, then repeat N times.
12121 If N is negative, move in reverse order.
12122 The difference between N and the actual number of articles marked is
12126 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12128 (defun gnus-summary-generic-mark (n mark move unread)
12129 "Mark N articles with MARK."
12130 (unless (eq major-mode 'gnus-summary-mode)
12131 (error "This command can only be used in the summary buffer"))
12132 (gnus-summary-show-thread)
12135 ((eq move 'next) 1)
12136 ((eq move 'prev) -1)
12138 (if (zerop nummove)
12142 nummove (* -1 nummove))))
12143 (while (and (> n 0)
12144 (gnus-summary-mark-article nil mark)
12145 (zerop (gnus-summary-next-subject nummove unread t)))
12148 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12149 (gnus-summary-recenter)
12150 (gnus-summary-position-point)
12151 (gnus-set-mode-line 'summary)
12154 (defun gnus-summary-insert-articles (articles)
12155 (when (setq articles
12156 (gnus-sorted-difference articles
12157 (mapcar (lambda (h)
12158 (mail-header-number h))
12159 gnus-newsgroup-headers)))
12160 (setq gnus-newsgroup-headers
12162 gnus-newsgroup-headers
12163 (gnus-fetch-headers articles)
12164 'gnus-article-sort-by-number))
12165 ;; Suppress duplicates?
12166 (when gnus-suppress-duplicates
12167 (gnus-dup-suppress-articles))
12169 ;; We might want to build some more threads first.
12170 (when (and gnus-fetch-old-headers
12171 (eq gnus-headers-retrieved-by 'nov))
12172 (if (eq gnus-fetch-old-headers 'invisible)
12173 (gnus-build-all-threads)
12174 (gnus-build-old-threads)))
12175 ;; Let the Gnus agent mark articles as read.
12177 (gnus-agent-get-undownloaded-list))
12178 ;; Remove list identifiers from subject
12179 (when gnus-list-identifiers
12180 (gnus-summary-remove-list-identifiers))
12181 ;; First and last article in this newsgroup.
12182 (when gnus-newsgroup-headers
12183 (setq gnus-newsgroup-begin
12184 (mail-header-number (car gnus-newsgroup-headers))
12186 (mail-header-number
12187 (gnus-last-element gnus-newsgroup-headers))))
12188 (when gnus-use-scoring
12189 (gnus-possibly-score-headers))))
12191 (defun gnus-summary-insert-old-articles (&optional all)
12192 "Insert all old articles in this group.
12193 If ALL is non-nil, already read articles become readable.
12194 If ALL is a number, fetch this number of articles."
12197 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12200 ;; Some nntp servers lie about their active range. When
12201 ;; this happens, the active range can be in the millions.
12202 ;; Use a compressed range to avoid creating a huge list.
12203 (gnus-range-difference (list gnus-newsgroup-active) old))
12204 (setq len (gnus-range-length older))
12209 (let ((older-range (nreverse older)))
12213 (let* ((r (pop older-range))
12214 (min (if (numberp r) r (car r)))
12215 (max (if (numberp r) r (cdr r))))
12216 (while (and (<= min max)
12221 (setq older (gnus-uncompress-range older))))
12223 (setq older (gnus-uncompress-range older)))
12225 (when (and (numberp gnus-large-newsgroup)
12226 (> len gnus-large-newsgroup))
12227 (let* ((cursor-in-echo-area nil)
12228 (initial (gnus-parameter-large-newsgroup-initial
12229 gnus-newsgroup-name))
12233 "How many articles from %s (%s %d): "
12235 (gnus-group-decoded-name gnus-newsgroup-name) 35)
12236 (if initial "max" "default")
12239 (cons (number-to-string initial)
12241 (unless (string-match "^[ \t]*$" input)
12242 (setq all (string-to-number input))
12244 (let ((older-range (nreverse older)))
12248 (let* ((r (pop older-range))
12249 (min (if (numberp r) r (car r)))
12250 (max (if (numberp r) r (cdr r))))
12251 (while (and (<= min max)
12255 max (1- max))))))))))
12256 (setq older (gnus-uncompress-range older))))
12258 (message "No old news.")
12259 (gnus-summary-insert-articles older)
12260 (gnus-summary-limit (gnus-sorted-nunion old older))))
12261 (gnus-summary-position-point)))
12263 (defun gnus-summary-insert-new-articles ()
12264 "Insert all new articles in this group."
12267 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12268 (old-active gnus-newsgroup-active)
12269 (nnmail-fetched-sources (list t))
12271 (setq gnus-newsgroup-active
12272 (gnus-activate-group gnus-newsgroup-name 'scan))
12273 (setq i (cdr gnus-newsgroup-active))
12274 (while (> i (cdr old-active))
12278 (message "No gnus is bad news")
12279 (gnus-summary-insert-articles new)
12280 (setq gnus-newsgroup-unreads
12281 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12282 (gnus-summary-limit (gnus-sorted-nunion old new))))
12283 (gnus-summary-position-point)))
12285 (gnus-summary-make-all-marking-commands)
12287 (gnus-ems-redefine)
12289 (provide 'gnus-sum)
12291 (run-hooks 'gnus-sum-load-hook)
12293 ;; Local Variables:
12294 ;; coding: iso-8859-1
12297 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12298 ;;; gnus-sum.el ends here