1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; For Emacs <22.2 and XEmacs.
29 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
33 (when (featurep 'xemacs)
34 (require 'easy-mmode))) ; for `define-minor-mode'
36 (defvar tool-bar-mode)
37 (defvar gnus-tmp-header)
50 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
51 (autoload 'gnus-cache-write-active "gnus-cache")
52 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
53 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
54 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
55 (autoload 'mm-uu-dissect "mm-uu")
56 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
57 "Deuglify broken Outlook (Express) articles and redisplay."
59 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
60 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
61 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
62 (autoload 'nnir-article-rsv "nnir" nil nil 'macro)
63 (autoload 'nnir-article-group "nnir" nil nil 'macro)
65 (defcustom gnus-kill-summary-on-exit t
66 "*If non-nil, kill the summary buffer when you exit from it.
67 If nil, the summary will become a \"*Dead Summary*\" buffer, and
68 it will be killed sometime later."
69 :group 'gnus-summary-exit
72 (defcustom gnus-summary-next-group-on-exit t
73 "If non-nil, go to the next unread newsgroup on summary exit.
74 See `gnus-group-goto-unread'."
75 :link '(custom-manual "(gnus)Group Maneuvering")
76 :group 'gnus-summary-exit
77 :version "23.1" ;; No Gnus
80 (defcustom gnus-summary-stop-at-end-of-message nil
81 "If non-nil, don't select the next message when using `SPC'."
82 :link '(custom-manual "(gnus)Group Maneuvering")
83 :group 'gnus-summary-maneuvering
87 (defcustom gnus-fetch-old-headers nil
88 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
89 If an unread article in the group refers to an older, already
90 read (or just marked as read) article, the old article will not
91 normally be displayed in the Summary buffer. If this variable is
92 t, Gnus will attempt to grab the headers to the old articles, and
93 thereby build complete threads. If it has the value `some', all
94 old headers will be fetched but only enough headers to connect
95 otherwise loose threads will be displayed. This variable can
96 also be a number. In that case, no more than that number of old
97 headers will be fetched. If it has the value `invisible', all
98 old headers will be fetched, but none will be displayed.
100 The server has to support NOV for any of this to work.
102 This feature can seriously impact performance it ignores all
103 locally cached header entries. Setting it to t for groups for a
104 server that doesn't expire articles (such as news.gmane.org),
105 leads to very slow summary generation."
107 :type '(choice (const :tag "off" nil)
112 (sexp :menu-tag "other" t)))
114 (defcustom gnus-refer-thread-limit 500
115 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
116 If t, fetch all the available old headers."
118 :type '(choice number
119 (sexp :menu-tag "other" t)))
121 (defcustom gnus-refer-thread-use-nnir nil
122 "*Use nnir to search an entire server when referring threads. A
123 nil value will only search for thread-related articles in the
128 (defcustom gnus-summary-make-false-root 'adopt
129 "*nil means that Gnus won't gather loose threads.
130 If the root of a thread has expired or been read in a previous
131 session, the information necessary to build a complete thread has been
132 lost. Instead of having many small sub-threads from this original thread
133 scattered all over the summary buffer, Gnus can gather them.
135 If non-nil, Gnus will try to gather all loose sub-threads from an
136 original thread into one large thread.
138 If this variable is non-nil, it should be one of `none', `adopt',
141 If this variable is `none', Gnus will not make a false root, but just
142 present the sub-threads after another.
143 If this variable is `dummy', Gnus will create a dummy root that will
144 have all the sub-threads as children.
145 If this variable is `adopt', Gnus will make one of the \"children\"
146 the parent and mark all the step-children as such.
147 If this variable is `empty', the \"children\" are printed with empty
148 subject fields. (Or rather, they will be printed with a string
149 given by the `gnus-summary-same-subject' variable.)"
151 :type '(choice (const :tag "off" nil)
157 (defcustom gnus-summary-make-false-root-always nil
158 "Always make a false dummy root."
163 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
164 "*A regexp to match subjects to be excluded from loose thread gathering.
165 As loose thread gathering is done on subjects only, that means that
166 there can be many false gatherings performed. By rooting out certain
167 common subjects, gathering might become saner."
171 (defcustom gnus-summary-gather-subject-limit nil
172 "*Maximum length of subject comparisons when gathering loose threads.
173 Use nil to compare full subjects. Setting this variable to a low
174 number will help gather threads that have been corrupted by
175 newsreaders chopping off subject lines, but it might also mean that
176 unrelated articles that have subject that happen to begin with the
177 same few characters will be incorrectly gathered.
179 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
182 :type '(choice (const :tag "off" nil)
184 (sexp :menu-tag "on" t)))
186 (defcustom gnus-simplify-subject-functions nil
187 "List of functions taking a string argument that simplify subjects.
188 The functions are applied recursively.
190 Useful functions to put in this list include:
191 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
192 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
194 :type '(repeat function))
196 (defcustom gnus-simplify-ignored-prefixes nil
197 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
199 :type '(choice (const :tag "off" nil)
202 (defcustom gnus-build-sparse-threads nil
203 "*If non-nil, fill in the gaps in threads.
204 If `some', only fill in the gaps that are needed to tie loose threads
205 together. If `more', fill in all leaf nodes that Gnus can find. If
206 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
208 :type '(choice (const :tag "off" nil)
211 (sexp :menu-tag "all" t)))
213 (defcustom gnus-summary-thread-gathering-function
214 'gnus-gather-threads-by-subject
215 "*Function used for gathering loose threads.
216 There are two pre-defined functions: `gnus-gather-threads-by-subject',
217 which only takes Subjects into consideration; and
218 `gnus-gather-threads-by-references', which compared the References
219 headers of the articles to find matches."
221 :type '(radio (function-item gnus-gather-threads-by-subject)
222 (function-item gnus-gather-threads-by-references)
223 (function :tag "other")))
225 (defcustom gnus-summary-same-subject ""
226 "*String indicating that the current article has the same subject as the previous.
227 This variable will only be used if the value of
228 `gnus-summary-make-false-root' is `empty'."
229 :group 'gnus-summary-format
232 (defcustom gnus-summary-goto-unread nil
233 "*If t, many commands will go to the next unread article.
234 This applies to marking commands as well as other commands that
235 \"naturally\" select the next article, like, for instance, `SPC' at
236 the end of an article.
238 If nil, the marking commands do NOT go to the next unread article
239 \(they go to the next article instead). If `never', commands that
240 usually go to the next unread article, will go to the next article,
241 whether it is read or not."
243 :group 'gnus-summary-marks
244 :link '(custom-manual "(gnus)Setting Marks")
245 :type '(choice (const :tag "off" nil)
247 (sexp :menu-tag "on" t)))
249 (defcustom gnus-summary-default-score 0
250 "*Default article score level.
251 All scores generated by the score files will be added to this score.
252 If this variable is nil, scoring will be disabled."
253 :group 'gnus-score-default
254 :type '(choice (const :tag "disable")
257 (defcustom gnus-summary-default-high-score 0
258 "*Default threshold for a high scored article.
259 An article will be highlighted as high scored if its score is greater
262 :group 'gnus-score-default
265 (defcustom gnus-summary-default-low-score 0
266 "*Default threshold for a low scored article.
267 An article will be highlighted as low scored if its score is smaller
270 :group 'gnus-score-default
273 (defcustom gnus-summary-zcore-fuzz 0
274 "*Fuzziness factor for the zcore in the summary buffer.
275 Articles with scores closer than this to `gnus-summary-default-score'
277 :group 'gnus-summary-format
280 (defcustom gnus-simplify-subject-fuzzy-regexp nil
281 "*Strings to be removed when doing fuzzy matches.
282 This can either be a regular expression or list of regular expressions
283 that will be removed from subject strings if fuzzy subject
284 simplification is selected."
286 :type '(repeat regexp))
288 (defcustom gnus-show-threads t
289 "*If non-nil, display threads in summary mode."
293 (defcustom gnus-thread-hide-subtree nil
294 "*If non-nil, hide all threads initially.
295 This can be a predicate specifier which says which threads to hide.
296 If threads are hidden, you have to run the command
297 `gnus-summary-show-thread' by hand or select an article."
299 :type '(radio (sexp :format "Non-nil\n"
300 :match (lambda (widget value)
301 (not (or (consp value) (functionp value))))
304 (sexp :tag "Predicate specifier")))
306 (defcustom gnus-thread-hide-killed t
307 "*If non-nil, hide killed threads automatically."
311 (defcustom gnus-thread-ignore-subject t
312 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
313 If nil, articles that have different subjects from their parents will
314 start separate threads."
318 (defcustom gnus-thread-operation-ignore-subject t
319 "*If non-nil, subjects will be ignored when doing thread commands.
320 This affects commands like `gnus-summary-kill-thread' and
321 `gnus-summary-lower-thread'.
323 If this variable is nil, articles in the same thread with different
324 subjects will not be included in the operation in question. If this
325 variable is `fuzzy', only articles that have subjects that are fuzzily
326 equal will be included."
328 :type '(choice (const :tag "off" nil)
332 (defcustom gnus-thread-indent-level 4
333 "*Number that says how much each sub-thread should be indented."
337 (defcustom gnus-auto-extend-newsgroup t
338 "*If non-nil, extend newsgroup forward and backward when requested."
339 :group 'gnus-summary-choose
342 (defcustom gnus-auto-select-first t
343 "If non-nil, select an article on group entry.
344 An article is selected automatically when entering a group
345 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
346 `gnus-summary-catchup-and-goto-next-group'.
348 Which article is selected is controlled by the variable
349 `gnus-auto-select-subject'.
351 If you want to prevent automatic selection of articles in some
352 newsgroups, set the variable to nil in `gnus-select-group-hook'."
353 ;; Commands include...
354 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
355 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
356 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
357 :group 'gnus-group-select
358 :type '(choice (const :tag "none" nil)
359 (sexp :menu-tag "first" t)))
361 (defcustom gnus-auto-select-subject 'unseen-or-unread
362 "*Says what subject to place under point when entering a group.
364 This variable can either be the symbols `first' (place point on the
365 first subject), `unread' (place point on the subject line of the first
366 unread article), `best' (place point on the subject line of the
367 higest-scored article), `unseen' (place point on the subject line of
368 the first unseen article), `unseen-or-unread' (place point on the subject
369 line of the first unseen article or, if all articles have been seen, on the
370 subject line of the first unread article), or a function to be called to
371 place point on some subject line."
373 :group 'gnus-group-select
374 :type '(choice (const best)
378 (const unseen-or-unread)
379 (function :tag "Function to call")))
381 (defcustom gnus-auto-select-next t
382 "*If non-nil, offer to go to the next group from the end of the previous.
383 If the value is t and the next newsgroup is empty, Gnus will exit
384 summary mode and go back to group mode. If the value is neither nil
385 nor t, Gnus will select the following unread newsgroup. In
386 particular, if the value is the symbol `quietly', the next unread
387 newsgroup will be selected without any confirmation, and if it is
388 `almost-quietly', the next group will be selected without any
389 confirmation if you are located on the last article in the group.
390 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
391 will go to the next group without confirmation."
392 :group 'gnus-summary-maneuvering
393 :type '(choice (const :tag "off" nil)
395 (const almost-quietly)
396 (const slightly-quietly)
397 (sexp :menu-tag "on" t)))
399 (defcustom gnus-auto-select-same nil
400 "*If non-nil, select the next article with the same subject.
401 If there are no more articles with the same subject, go to
402 the first unread article."
403 :group 'gnus-summary-maneuvering
406 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
407 "What article should be selected after exiting an ephemeral group.
408 Valid values include:
411 Select the next article.
413 Select the next unread article.
415 Move the cursor to the next article. This is the default.
416 `next-unread-noselect'
417 Move the cursor to the next unread article.
419 If it has any other value or there is no next (unread) article, the
420 article selected before entering to the ephemeral group will appear."
421 :version "23.1" ;; No Gnus
422 :group 'gnus-summary-maneuvering
423 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
424 (const next) (const next-unread)
425 (const next-noselect) (const next-unread-noselect)
426 (sexp :tag "other" :value nil)))
428 (defcustom gnus-auto-goto-ignores 'unfetched
429 "*Says how to handle unfetched articles when maneuvering.
431 This variable can either be the symbols nil (maneuver to any
432 article), `undownloaded' (maneuvering while unplugged ignores articles
433 that have not been fetched), `always-undownloaded' (maneuvering always
434 ignores articles that have not been fetched), `unfetched' (maneuvering
435 ignores articles whose headers have not been fetched).
437 NOTE: The list of unfetched articles will always be nil when plugged
438 and, when unplugged, a subset of the undownloaded article list."
440 :group 'gnus-summary-maneuvering
441 :type '(choice (const :tag "None" nil)
442 (const :tag "Undownloaded when unplugged" undownloaded)
443 (const :tag "Undownloaded" always-undownloaded)
444 (const :tag "Unfetched" unfetched)))
446 (defcustom gnus-summary-check-current nil
447 "*If non-nil, consider the current article when moving.
448 The \"unread\" movement commands will stay on the same line if the
449 current article is unread."
450 :group 'gnus-summary-maneuvering
453 (defcustom gnus-auto-center-summary 2
454 "*If non-nil, always center the current summary buffer.
455 In particular, if `vertical' do only vertical recentering. If non-nil
456 and non-`vertical', do both horizontal and vertical recentering."
457 :group 'gnus-summary-maneuvering
458 :type '(choice (const :tag "none" nil)
460 (integer :tag "height")
461 (sexp :menu-tag "both" t)))
463 (defcustom gnus-auto-center-group t
464 "If non-nil, always center the group buffer."
465 :group 'gnus-summary-maneuvering
468 (defcustom gnus-show-all-headers nil
469 "*If non-nil, don't hide any headers."
470 :group 'gnus-article-hiding
471 :group 'gnus-article-headers
474 (defcustom gnus-summary-ignore-duplicates nil
475 "*If non-nil, ignore articles with identical Message-ID headers."
479 (defcustom gnus-single-article-buffer nil
480 "*If non-nil, display all articles in the same buffer.
481 If nil, each group will get its own article buffer."
483 :group 'gnus-article-various
486 (defcustom gnus-widen-article-window nil
487 "If non-nil, selecting the article buffer will display only the article buffer."
489 :group 'gnus-article-various
492 (defcustom gnus-break-pages t
493 "*If non-nil, do page breaking on articles.
494 The page delimiter is specified by the `gnus-page-delimiter'
496 :group 'gnus-article-various
499 (defcustom gnus-move-split-methods nil
500 "*Variable used to suggest where articles are to be moved to.
501 It uses the same syntax as the `gnus-split-methods' variable.
502 However, whereas `gnus-split-methods' specifies file names as targets,
503 this variable specifies group names."
504 :group 'gnus-summary-mail
505 :type '(repeat (choice (list :value (fun) function)
506 (cons :value ("" "") regexp (repeat string))
509 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
510 "Function used to compute default prefix for article move/copy/etc prompts.
511 The function should take one argument, a group name, and return a
512 string with the suggested prefix."
513 :group 'gnus-summary-mail
516 ;; FIXME: Although the custom type is `character' for the following variables,
517 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
519 (defcustom gnus-unread-mark ? ;Whitespace
520 "*Mark used for unread articles."
521 :group 'gnus-summary-marks
524 (defcustom gnus-ticked-mark ?!
525 "*Mark used for ticked articles."
526 :group 'gnus-summary-marks
529 (defcustom gnus-dormant-mark ??
530 "*Mark used for dormant articles."
531 :group 'gnus-summary-marks
534 (defcustom gnus-del-mark ?r
535 "*Mark used for del'd articles."
536 :group 'gnus-summary-marks
539 (defcustom gnus-read-mark ?R
540 "*Mark used for read articles."
541 :group 'gnus-summary-marks
544 (defcustom gnus-expirable-mark ?E
545 "*Mark used for expirable articles."
546 :group 'gnus-summary-marks
549 (defcustom gnus-killed-mark ?K
550 "*Mark used for killed articles."
551 :group 'gnus-summary-marks
554 (defcustom gnus-spam-mark ?$
555 "*Mark used for spam articles."
557 :group 'gnus-summary-marks
560 (defcustom gnus-kill-file-mark ?X
561 "*Mark used for articles killed by kill files."
562 :group 'gnus-summary-marks
565 (defcustom gnus-low-score-mark ?Y
566 "*Mark used for articles with a low score."
567 :group 'gnus-summary-marks
570 (defcustom gnus-catchup-mark ?C
571 "*Mark used for articles that are caught up."
572 :group 'gnus-summary-marks
575 (defcustom gnus-replied-mark ?A
576 "*Mark used for articles that have been replied to."
577 :group 'gnus-summary-marks
580 (defcustom gnus-forwarded-mark ?F
581 "*Mark used for articles that have been forwarded."
583 :group 'gnus-summary-marks
586 (defcustom gnus-recent-mark ?N
587 "*Mark used for articles that are recent."
589 :group 'gnus-summary-marks
592 (defcustom gnus-cached-mark ?*
593 "*Mark used for articles that are in the cache."
594 :group 'gnus-summary-marks
597 (defcustom gnus-saved-mark ?S
598 "*Mark used for articles that have been saved."
599 :group 'gnus-summary-marks
602 (defcustom gnus-unseen-mark ?.
603 "*Mark used for articles that haven't been seen."
605 :group 'gnus-summary-marks
608 (defcustom gnus-no-mark ? ;Whitespace
609 "*Mark used for articles that have no other secondary mark."
611 :group 'gnus-summary-marks
614 (defcustom gnus-ancient-mark ?O
615 "*Mark used for ancient articles."
616 :group 'gnus-summary-marks
619 (defcustom gnus-sparse-mark ?Q
620 "*Mark used for sparsely reffed articles."
621 :group 'gnus-summary-marks
624 (defcustom gnus-canceled-mark ?G
625 "*Mark used for canceled articles."
626 :group 'gnus-summary-marks
629 (defcustom gnus-duplicate-mark ?M
630 "*Mark used for duplicate articles."
631 :group 'gnus-summary-marks
634 (defcustom gnus-undownloaded-mark ?-
635 "*Mark used for articles that weren't downloaded."
637 :group 'gnus-summary-marks
640 (defcustom gnus-downloaded-mark ?+
641 "*Mark used for articles that were downloaded."
642 :group 'gnus-summary-marks
645 (defcustom gnus-downloadable-mark ?%
646 "*Mark used for articles that are to be downloaded."
647 :group 'gnus-summary-marks
650 (defcustom gnus-unsendable-mark ?=
651 "*Mark used for articles that won't be sent."
652 :group 'gnus-summary-marks
655 (defcustom gnus-score-over-mark ?+
656 "*Score mark used for articles with high scores."
657 :group 'gnus-summary-marks
660 (defcustom gnus-score-below-mark ?-
661 "*Score mark used for articles with low scores."
662 :group 'gnus-summary-marks
665 (defcustom gnus-empty-thread-mark ? ;Whitespace
666 "*There is no thread under the article."
667 :group 'gnus-summary-marks
670 (defcustom gnus-not-empty-thread-mark ?=
671 "*There is a thread under the article."
672 :group 'gnus-summary-marks
675 (defcustom gnus-view-pseudo-asynchronously nil
676 "*If non-nil, Gnus will view pseudo-articles asynchronously."
677 :group 'gnus-extract-view
680 (defcustom gnus-auto-expirable-marks
681 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
682 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
684 "*The list of marks converted into expiration if a group is auto-expirable."
687 :type '(repeat character))
689 (defcustom gnus-inhibit-user-auto-expire t
690 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
695 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
696 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
697 If nil, the expirable marks will be unchanged except that the marks
698 will be removed when copying or moving articles to a group that has
699 not turned auto-expire on. If non-nil, articles that have been read
700 will be marked as expirable when being copied or moved to a group in
701 which auto-expire is turned on."
704 :group 'gnus-summary-marks)
706 (defcustom gnus-view-pseudos nil
707 "*If `automatic', pseudo-articles will be viewed automatically.
708 If `not-confirm', pseudos will be viewed automatically, and the user
709 will not be asked to confirm the command."
710 :group 'gnus-extract-view
711 :type '(choice (const :tag "off" nil)
713 (const not-confirm)))
715 (defcustom gnus-view-pseudos-separately t
716 "*If non-nil, one pseudo-article will be created for each file to be viewed.
717 If nil, all files that use the same viewing command will be given as a
718 list of parameters to that command."
719 :group 'gnus-extract-view
722 (defcustom gnus-insert-pseudo-articles t
723 "*If non-nil, insert pseudo-articles when decoding articles."
724 :group 'gnus-extract-view
727 (defcustom gnus-summary-dummy-line-format
729 "*The format specification for the dummy roots in the summary buffer.
730 It works along the same lines as a normal formatting string,
731 with some simple extensions.
735 General format specifiers can also be used.
736 See `(gnus)Formatting Variables'."
737 :link '(custom-manual "(gnus)Formatting Variables")
738 :group 'gnus-threading
741 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
742 "*The format specification for the summary mode line.
743 It works along the same lines as a normal formatting string,
744 with some simple extensions:
747 %p Unprefixed group name
748 %A Current article number
749 %z Current article score
751 %U Number of unread articles in the group
752 %e Number of unselected articles in the group
753 %Z A string with unread/unselected article counts
754 %g Shortish group name
755 %S Subject of the current article
757 %s Current score file name
758 %d Number of dormant articles
759 %r Number of articles that have been marked as read in this session
760 %E Number of articles expunged by the score files"
761 :group 'gnus-summary-format
764 (defcustom gnus-list-identifiers nil
765 "Regexp that matches list identifiers to be removed from subject.
766 This can also be a list of regexps."
768 :group 'gnus-summary-format
769 :group 'gnus-article-hiding
770 :type '(choice (const :tag "none" nil)
772 (repeat :value (".*") regexp)))
774 (defcustom gnus-summary-mark-below 0
775 "*Mark all articles with a score below this variable as read.
776 This variable is local to each summary buffer and usually set by the
778 :group 'gnus-score-default
781 (defun gnus-widget-reversible-match (widget value)
782 "Ignoring WIDGET, convert VALUE to internal form.
783 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
787 (eq (length value) 2)
788 (eq (nth 0 value) 'not)
789 (symbolp (nth 1 value)))))
791 (defun gnus-widget-reversible-to-internal (widget value)
792 "Ignoring WIDGET, convert VALUE to internal form.
793 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
794 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
798 (list (nth 1 value) t)))
800 (defun gnus-widget-reversible-to-external (widget value)
801 "Ignoring WIDGET, convert VALUE to external form.
802 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
803 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
806 (list 'not (nth 0 value))
809 (define-widget 'gnus-widget-reversible 'group
810 "A `group' that convert values."
811 :match 'gnus-widget-reversible-match
812 :value-to-internal 'gnus-widget-reversible-to-internal
813 :value-to-external 'gnus-widget-reversible-to-external)
815 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
816 "*List of functions used for sorting articles in the summary buffer.
818 Each function takes two articles and returns non-nil if the first
819 article should be sorted before the other. If you use more than one
820 function, the primary sort function should be the last. You should
821 probably always include `gnus-article-sort-by-number' in the list of
822 sorting functions -- preferably first. Also note that sorting by date
823 is often much slower than sorting by number, and the sorting order is
824 very similar. (Sorting by date means sorting by the time the message
825 was sent, sorting by number means sorting by arrival time.)
827 Each item can also be a list `(not F)' where F is a function;
828 this reverses the sort order.
830 Ready-made functions include `gnus-article-sort-by-number',
831 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
832 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
833 and `gnus-article-sort-by-score'.
835 When threading is turned on, the variable `gnus-thread-sort-functions'
836 controls how articles are sorted."
837 :group 'gnus-summary-sort
838 :type '(repeat (gnus-widget-reversible
839 (choice (function-item gnus-article-sort-by-number)
840 (function-item gnus-article-sort-by-author)
841 (function-item gnus-article-sort-by-subject)
842 (function-item gnus-article-sort-by-date)
843 (function-item gnus-article-sort-by-score)
844 (function-item gnus-article-sort-by-random)
845 (function :tag "other"))
846 (boolean :tag "Reverse order"))))
849 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
850 "*List of functions used for sorting threads in the summary buffer.
851 By default, threads are sorted by article number.
853 Each function takes two threads and returns non-nil if the first
854 thread should be sorted before the other. If you use more than one
855 function, the primary sort function should be the last. You should
856 probably always include `gnus-thread-sort-by-number' in the list of
857 sorting functions -- preferably first. Also note that sorting by date
858 is often much slower than sorting by number, and the sorting order is
859 very similar. (Sorting by date means sorting by the time the message
860 was sent, sorting by number means sorting by arrival time.)
862 Each list item can also be a list `(not F)' where F is a
863 function; this specifies reversed sort order.
865 Ready-made functions include `gnus-thread-sort-by-number',
866 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
867 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
868 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
869 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
870 and `gnus-thread-sort-by-total-score' (see
871 `gnus-thread-score-function').
873 When threading is turned off, the variable
874 `gnus-article-sort-functions' controls how articles are sorted."
875 :group 'gnus-summary-sort
877 (gnus-widget-reversible
878 (choice (function-item gnus-thread-sort-by-number)
879 (function-item gnus-thread-sort-by-author)
880 (function-item gnus-thread-sort-by-recipient)
881 (function-item gnus-thread-sort-by-subject)
882 (function-item gnus-thread-sort-by-date)
883 (function-item gnus-thread-sort-by-score)
884 (function-item gnus-thread-sort-by-most-recent-number)
885 (function-item gnus-thread-sort-by-most-recent-date)
886 (function-item gnus-thread-sort-by-random)
887 (function-item gnus-thread-sort-by-total-score)
888 (function :tag "other"))
889 (boolean :tag "Reverse order"))))
891 (defcustom gnus-thread-score-function '+
892 "*Function used for calculating the total score of a thread.
894 The function is called with the scores of the article and each
895 subthread and should then return the score of the thread.
897 Some functions you can use are `+', `max', or `min'."
898 :group 'gnus-summary-sort
901 (defcustom gnus-summary-expunge-below nil
902 "All articles that have a score less than this variable will be expunged.
903 This variable is local to the summary buffers."
904 :group 'gnus-score-default
905 :type '(choice (const :tag "off" nil)
908 (defcustom gnus-thread-expunge-below nil
909 "All threads that have a total score less than this variable will be expunged.
910 See `gnus-thread-score-function' for en explanation of what a
913 This variable is local to the summary buffers."
914 :group 'gnus-threading
915 :group 'gnus-score-default
916 :type '(choice (const :tag "off" nil)
919 (defcustom gnus-summary-mode-hook nil
920 "*A hook for Gnus summary mode.
921 This hook is run before any variables are set in the summary buffer."
922 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
923 :group 'gnus-summary-various
926 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
927 (when (featurep 'xemacs)
928 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
929 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
930 (add-hook 'gnus-summary-mode-hook
931 'gnus-xmas-switch-horizontal-scrollbar-off))
933 (defcustom gnus-summary-menu-hook nil
934 "*Hook run after the creation of the summary mode menu."
935 :group 'gnus-summary-visual
938 (defcustom gnus-summary-exit-hook nil
939 "*A hook called on exit from the summary buffer.
940 It will be called with point in the group buffer."
941 :group 'gnus-summary-exit
944 (defcustom gnus-summary-prepare-hook nil
945 "*A hook called after the summary buffer has been generated.
946 If you want to modify the summary buffer, you can use this hook."
947 :group 'gnus-summary-various
950 (defcustom gnus-summary-prepared-hook nil
951 "*A hook called as the last thing after the summary buffer has been generated."
952 :group 'gnus-summary-various
955 (defcustom gnus-summary-generate-hook nil
956 "*A hook run just before generating the summary buffer.
957 This hook is commonly used to customize threading variables and the
959 :group 'gnus-summary-various
962 (defcustom gnus-select-group-hook nil
963 "*A hook called when a newsgroup is selected.
965 If you'd like to simplify subjects like the
966 `gnus-summary-next-same-subject' command does, you can use the
969 (add-hook gnus-select-group-hook
971 (mapcar (lambda (header)
972 (mail-header-set-subject
974 (gnus-simplify-subject
975 (mail-header-subject header) 're-only)))
976 gnus-newsgroup-headers)))"
977 :group 'gnus-group-select
980 (defcustom gnus-select-article-hook nil
981 "*A hook called when an article is selected."
982 :group 'gnus-summary-choose
983 :options '(gnus-agent-fetch-selected-article)
986 (defcustom gnus-visual-mark-article-hook
987 (list 'gnus-highlight-selected-summary)
988 "*Hook run after selecting an article in the summary buffer.
989 It is meant to be used for highlighting the article in some way. It
990 is not run if `gnus-visual' is nil."
991 :group 'gnus-summary-visual
994 (defcustom gnus-parse-headers-hook nil
995 "*A hook called before parsing the headers."
999 (defcustom gnus-exit-group-hook nil
1000 "*A hook called when exiting summary mode.
1001 This hook is not called from the non-updating exit commands like `Q'."
1002 :group 'gnus-various
1005 (defcustom gnus-summary-update-hook nil
1006 "*A hook called when a summary line is changed.
1007 The hook will not be called if `gnus-visual' is nil.
1009 The default function `gnus-summary-highlight-line' will
1010 highlight the line according to the `gnus-summary-highlight'
1012 :group 'gnus-summary-visual
1015 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
1016 "*A hook called when an article is selected for the first time.
1017 The hook is intended to mark an article as read (or unread)
1018 automatically when it is selected."
1019 :group 'gnus-summary-choose
1022 (defcustom gnus-group-no-more-groups-hook nil
1023 "*A hook run when returning to group mode having no more (unread) groups."
1024 :group 'gnus-group-select
1027 (defcustom gnus-ps-print-hook nil
1028 "*A hook run before ps-printing something from Gnus."
1029 :group 'gnus-summary
1032 (defcustom gnus-summary-article-move-hook nil
1033 "*A hook called after an article is moved, copied, respooled, or crossposted."
1035 :group 'gnus-summary
1038 (defcustom gnus-summary-article-delete-hook nil
1039 "*A hook called after an article is deleted."
1041 :group 'gnus-summary
1044 (defcustom gnus-summary-article-expire-hook nil
1045 "*A hook called after an article is expired."
1047 :group 'gnus-summary
1050 (defcustom gnus-summary-display-arrow
1051 (and (fboundp 'display-graphic-p)
1052 (display-graphic-p))
1053 "*If non-nil, display an arrow highlighting the current article."
1055 :group 'gnus-summary
1058 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1059 "Face used for highlighting the current article in the summary buffer."
1060 :group 'gnus-summary-visual
1063 (defvar gnus-tmp-downloaded nil)
1065 (defcustom gnus-summary-highlight
1066 '(((eq mark gnus-canceled-mark)
1067 . gnus-summary-cancelled)
1068 ((and uncached (> score default-high))
1069 . gnus-summary-high-undownloaded)
1070 ((and uncached (< score default-low))
1071 . gnus-summary-low-undownloaded)
1073 . gnus-summary-normal-undownloaded)
1074 ((and (> score default-high)
1075 (or (eq mark gnus-dormant-mark)
1076 (eq mark gnus-ticked-mark)))
1077 . gnus-summary-high-ticked)
1078 ((and (< score default-low)
1079 (or (eq mark gnus-dormant-mark)
1080 (eq mark gnus-ticked-mark)))
1081 . gnus-summary-low-ticked)
1082 ((or (eq mark gnus-dormant-mark)
1083 (eq mark gnus-ticked-mark))
1084 . gnus-summary-normal-ticked)
1085 ((and (> score default-high) (eq mark gnus-ancient-mark))
1086 . gnus-summary-high-ancient)
1087 ((and (< score default-low) (eq mark gnus-ancient-mark))
1088 . gnus-summary-low-ancient)
1089 ((eq mark gnus-ancient-mark)
1090 . gnus-summary-normal-ancient)
1091 ((and (> score default-high) (eq mark gnus-unread-mark))
1092 . gnus-summary-high-unread)
1093 ((and (< score default-low) (eq mark gnus-unread-mark))
1094 . gnus-summary-low-unread)
1095 ((eq mark gnus-unread-mark)
1096 . gnus-summary-normal-unread)
1097 ((> score default-high)
1098 . gnus-summary-high-read)
1099 ((< score default-low)
1100 . gnus-summary-low-read)
1102 . gnus-summary-normal-read))
1103 "*Controls the highlighting of summary buffer lines.
1105 A list of (FORM . FACE) pairs. When deciding how a particular
1106 summary line should be displayed, each form is evaluated. The content
1107 of the face field after the first true form is used. You can change
1108 how those summary lines are displayed, by editing the face field.
1110 You can use the following variables in the FORM field.
1112 score: The article's score.
1113 default: The default article score.
1114 default-high: The default score for high scored articles.
1115 default-low: The default score for low scored articles.
1116 below: The score below which articles are automatically marked as read.
1117 mark: The article's mark.
1118 uncached: Non-nil if the article is uncached."
1119 :group 'gnus-summary-visual
1120 :type '(repeat (cons (sexp :tag "Form" nil)
1122 (put 'gnus-summary-highlight 'risky-local-variable t)
1124 (defcustom gnus-alter-header-function nil
1125 "Function called to allow alteration of article header structures.
1126 The function is called with one parameter, the article header vector,
1127 which it may alter in any way."
1128 :type '(choice (const :tag "None" nil)
1130 :group 'gnus-summary)
1132 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1133 "Function used to decode a string with encoded words.")
1135 (defvar gnus-decode-encoded-address-function
1136 'mail-decode-encoded-address-string
1137 "Function used to decode addresses with encoded words.")
1139 (defcustom gnus-extra-headers '(To Cc Keywords Gcc Newsgroups)
1140 "*Extra headers to parse."
1141 :version "24.1" ; added Cc Keywords Gcc
1142 :group 'gnus-summary
1143 :type '(repeat symbol))
1145 (defcustom gnus-ignored-from-addresses
1146 (and user-mail-address
1147 (not (string= user-mail-address ""))
1148 (regexp-quote user-mail-address))
1149 "*From headers that may be suppressed in favor of To headers.
1150 This can be a regexp or a list of regexps."
1152 :group 'gnus-summary
1153 :type '(choice regexp
1154 (repeat :tag "Regexp List" regexp)))
1156 (defsubst gnus-ignored-from-addresses ()
1157 (gmm-regexp-concat gnus-ignored-from-addresses))
1159 (defcustom gnus-summary-to-prefix "-> "
1160 "*String prefixed to the To field in the summary line when
1161 using `gnus-ignored-from-addresses'."
1163 :group 'gnus-summary
1166 (defcustom gnus-summary-newsgroup-prefix "=> "
1167 "*String prefixed to the Newsgroup field in the summary
1168 line when using `gnus-ignored-from-addresses'."
1170 :group 'gnus-summary
1173 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1174 "List of charsets that should be ignored.
1175 When these charsets are used in the \"charset\" parameter, the
1176 default charset will be used instead."
1178 :type '(repeat symbol)
1179 :group 'gnus-charset)
1181 (defcustom gnus-newsgroup-maximum-articles nil
1182 "The maximum number of articles a newsgroup.
1183 If this is a number, old articles in a newsgroup exceeding this number
1184 are silently ignored. If it is nil, no article is ignored. Note that
1185 setting this variable to a number might prevent you from reading very
1187 :group 'gnus-group-select
1189 :type '(choice (const :tag "No limit" nil)
1192 (gnus-define-group-parameter
1196 "Return the ignored charsets of GROUP."
1197 :variable gnus-group-ignored-charsets-alist
1199 '(("alt\\.chinese\\.text" iso-8859-1))
1201 "Alist of regexps (to match group names) and charsets that should be ignored.
1202 When these charsets are used in the \"charset\" parameter, the
1203 default charset will be used instead."
1204 :variable-group gnus-charset
1205 :variable-type '(repeat (cons (regexp :tag "Group")
1207 :parameter-type '(choice :tag "Ignored charsets"
1210 :parameter-document "\
1211 List of charsets that should be ignored.
1213 When these charsets are used in the \"charset\" parameter, the
1214 default charset will be used instead.")
1216 (defcustom gnus-group-highlight-words-alist nil
1217 "Alist of group regexps and highlight regexps.
1218 This variable uses the same syntax as `gnus-emphasis-alist'."
1220 :type '(repeat (cons (regexp :tag "Group")
1221 (repeat (list (regexp :tag "Highlight regexp")
1222 (number :tag "Group for entire word" 0)
1223 (number :tag "Group for displayed part" 0)
1225 gnus-emphasis-highlight-words)))))
1226 :group 'gnus-summary-visual)
1228 (defcustom gnus-summary-show-article-charset-alist
1230 "Alist of number and charset.
1231 The article will be shown with the charset corresponding to the
1233 For example: ((1 . cn-gb-2312) (2 . big5))."
1235 :type '(repeat (cons (number :tag "Argument" 1)
1236 (symbol :tag "Charset")))
1237 :group 'gnus-charset)
1239 (defcustom gnus-preserve-marks t
1240 "Whether marks are preserved when moving, copying and respooling messages."
1243 :group 'gnus-summary-marks)
1245 (defcustom gnus-propagate-marks nil
1246 "If non-nil, Gnus will store and retrieve marks from the backends.
1247 This means that marks will be stored both in .newsrc.eld and in
1248 the backend, and will slow operation down somewhat."
1250 :group 'gnus-summary-marks)
1252 (defcustom gnus-alter-articles-to-read-function nil
1253 "Function to be called to alter the list of articles to be selected."
1254 :type '(choice (const nil) function)
1255 :group 'gnus-summary)
1257 (defcustom gnus-orphan-score nil
1258 "*All orphans get this score added. Set in the score file."
1259 :group 'gnus-score-default
1260 :type '(choice (const nil)
1263 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1264 "*A regexp to match MIME parts when saving multiple parts of a
1265 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1266 This regexp will be used by default when prompting the user for which
1267 type of files to save."
1268 :group 'gnus-summary
1271 (defcustom gnus-read-all-available-headers nil
1272 "Whether Gnus should parse all headers made available to it.
1273 This is mostly relevant for slow back ends where the user may
1274 wish to widen the summary buffer to include all headers
1277 :group 'gnus-summary
1278 :type '(choice boolean regexp))
1280 (defcustom gnus-summary-pipe-output-default-command nil
1281 "Command (and optional arguments) used to pipe article to subprocess.
1282 This will be used as the default command if it is non-nil. The value
1283 will be updated if you modify it when executing the command
1284 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1285 :version "23.1" ;; No Gnus
1286 :group 'gnus-summary
1287 :type '(radio (const :tag "None" nil) (string :tag "Command")))
1289 (defcustom gnus-summary-muttprint-program "muttprint"
1290 "Command (and optional arguments) used to run Muttprint.
1291 The value will be updated if you modify it when executing the command
1292 `gnus-summary-muttprint'."
1294 :group 'gnus-summary
1297 (defcustom gnus-article-loose-mime t
1298 "If non-nil, don't require MIME-Version header.
1299 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1300 supply the MIME-Version header or deliberately strip it from the mail.
1301 If non-nil (the default), Gnus will treat some articles as MIME
1302 even if the MIME-Version header is missing."
1305 :group 'gnus-article-mime)
1307 (defcustom gnus-article-emulate-mime t
1308 "If non-nil, use MIME emulation for uuencode and the like.
1309 This means that Gnus will search message bodies for text that look
1310 like uuencoded bits, yEncoded bits, and so on, and present that using
1311 the normal Gnus MIME machinery."
1314 :group 'gnus-article-mime)
1316 ;;; Internal variables
1318 (defvar gnus-summary-display-cache nil)
1319 (defvar gnus-article-mime-handles nil)
1320 (defvar gnus-article-decoded-p nil)
1321 (defvar gnus-article-charset nil)
1322 (defvar gnus-article-ignored-charsets nil)
1323 (defvar gnus-scores-exclude-files nil)
1324 (defvar gnus-page-broken nil)
1326 (defvar gnus-original-article nil)
1327 (defvar gnus-article-internal-prepare-hook nil)
1328 (defvar gnus-newsgroup-process-stack nil)
1330 (defvar gnus-thread-indent-array nil)
1331 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1332 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1333 "Function called to sort the articles within a thread after it has been gathered together.")
1335 (defvar gnus-summary-save-parts-type-history nil)
1336 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1338 ;; Avoid highlighting in kill files.
1339 (defvar gnus-summary-inhibit-highlight nil)
1340 (defvar gnus-newsgroup-selected-overlay nil)
1341 (defvar gnus-inhibit-limiting nil)
1342 (defvar gnus-newsgroup-adaptive-score-file nil)
1343 (defvar gnus-current-score-file nil)
1344 (defvar gnus-current-move-group nil)
1345 (defvar gnus-current-copy-group nil)
1346 (defvar gnus-current-crosspost-group nil)
1347 (defvar gnus-newsgroup-display nil)
1349 (defvar gnus-newsgroup-dependencies nil)
1350 (defvar gnus-newsgroup-adaptive nil)
1351 (defvar gnus-summary-display-article-function nil)
1352 (defvar gnus-summary-highlight-line-function nil
1353 "Function called after highlighting a summary line.")
1355 (defvar gnus-summary-line-format-alist
1356 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1357 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1358 (?s gnus-tmp-subject-or-nil ?s)
1359 (?n gnus-tmp-name ?s)
1360 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1362 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1364 (?F gnus-tmp-from ?s)
1365 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1366 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1367 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1368 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1369 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1370 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1371 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1372 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1373 (?L gnus-tmp-lines ?s)
1374 (?Z (or ,(gnus-macroexpand-all
1375 '(nnir-article-rsv (mail-header-number gnus-tmp-header)))
1377 (?G (or ,(gnus-macroexpand-all
1378 '(nnir-article-group (mail-header-number gnus-tmp-header)))
1380 (?g (or ,(gnus-macroexpand-all
1381 '(gnus-group-short-name
1382 (nnir-article-group (mail-header-number gnus-tmp-header))))
1384 (?O gnus-tmp-downloaded ?c)
1385 (?I gnus-tmp-indentation ?s)
1386 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1387 (?R gnus-tmp-replied ?c)
1388 (?\[ gnus-tmp-opening-bracket ?c)
1389 (?\] gnus-tmp-closing-bracket ?c)
1390 (?\> (make-string gnus-tmp-level ? ) ?s)
1391 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1392 (?i gnus-tmp-score ?d)
1393 (?z gnus-tmp-score-char ?c)
1394 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1395 (?U gnus-tmp-unread ?c)
1396 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1398 (?t (gnus-summary-number-of-articles-in-thread
1399 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1401 (?e (gnus-summary-number-of-articles-in-thread
1402 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1404 (?u gnus-tmp-user-defined ?s)
1405 (?P (gnus-pick-line-number) ?d)
1406 (?B gnus-tmp-thread-tree-header-string ?s)
1407 (user-date (gnus-user-date
1408 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1409 "An alist of format specifications that can appear in summary lines.
1410 These are paired with what variables they correspond with, along with
1411 the type of the variable (string, integer, character, etc).")
1413 (defvar gnus-summary-dummy-line-format-alist
1414 `((?S gnus-tmp-subject ?s)
1415 (?N gnus-tmp-number ?d)
1416 (?u gnus-tmp-user-defined ?s)))
1418 (defvar gnus-summary-mode-line-format-alist
1419 `((?G gnus-tmp-group-name ?s)
1420 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1421 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1422 (?A gnus-tmp-article-number ?d)
1423 (?Z gnus-tmp-unread-and-unselected ?s)
1424 (?V gnus-version ?s)
1425 (?U gnus-tmp-unread-and-unticked ?d)
1426 (?S gnus-tmp-subject ?s)
1427 (?e gnus-tmp-unselected ?d)
1428 (?u gnus-tmp-user-defined ?s)
1429 (?d (length gnus-newsgroup-dormant) ?d)
1430 (?t (length gnus-newsgroup-marked) ?d)
1431 (?h (length gnus-newsgroup-spam-marked) ?d)
1432 (?r (length gnus-newsgroup-reads) ?d)
1433 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1434 (?E gnus-newsgroup-expunged-tally ?d)
1435 (?s (gnus-current-score-file-nondirectory) ?s)))
1437 ;; This is here rather than in gnus-art for compilation reasons.
1438 (defvar gnus-article-mode-line-format-alist
1439 (nconc '((?w (gnus-article-wash-status) ?s)
1440 (?m (gnus-article-mime-part-status) ?s))
1441 gnus-summary-mode-line-format-alist))
1443 (defvar gnus-last-search-regexp nil
1444 "Default regexp for article search command.")
1446 (defvar gnus-last-shell-command nil
1447 "Default shell command on article.")
1449 (defvar gnus-newsgroup-agentized nil
1450 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1451 (defvar gnus-newsgroup-begin nil)
1452 (defvar gnus-newsgroup-end nil)
1453 (defvar gnus-newsgroup-last-rmail nil)
1454 (defvar gnus-newsgroup-last-mail nil)
1455 (defvar gnus-newsgroup-last-folder nil)
1456 (defvar gnus-newsgroup-last-file nil)
1457 (defvar gnus-newsgroup-last-directory nil)
1458 (defvar gnus-newsgroup-auto-expire nil)
1459 (defvar gnus-newsgroup-active nil)
1460 (defvar gnus-newsgroup-highest nil)
1462 (defvar gnus-newsgroup-data nil)
1463 (defvar gnus-newsgroup-data-reverse nil)
1464 (defvar gnus-newsgroup-limit nil)
1465 (defvar gnus-newsgroup-limits nil)
1466 (defvar gnus-summary-use-undownloaded-faces nil)
1468 (defvar gnus-newsgroup-unreads nil
1469 "Sorted list of unread articles in the current newsgroup.")
1471 (defvar gnus-newsgroup-unselected nil
1472 "Sorted list of unselected unread articles in the current newsgroup.")
1474 (defvar gnus-newsgroup-reads nil
1475 "Alist of read articles and article marks in the current newsgroup.")
1477 (defvar gnus-newsgroup-expunged-tally nil)
1479 (defvar gnus-newsgroup-marked nil
1480 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1482 (defvar gnus-newsgroup-spam-marked nil
1483 "List of ranges of articles that have been marked as spam.")
1485 (defvar gnus-newsgroup-killed nil
1486 "List of ranges of articles that have been through the scoring process.")
1488 (defvar gnus-newsgroup-cached nil
1489 "Sorted list of articles that come from the article cache.")
1491 (defvar gnus-newsgroup-saved nil
1492 "List of articles that have been saved.")
1494 (defvar gnus-newsgroup-kill-headers nil)
1496 (defvar gnus-newsgroup-replied nil
1497 "List of articles that have been replied to in the current newsgroup.")
1499 (defvar gnus-newsgroup-forwarded nil
1500 "List of articles that have been forwarded in the current newsgroup.")
1502 (defvar gnus-newsgroup-expirable nil
1503 "Sorted list of articles in the current newsgroup that can be expired.")
1505 (defvar gnus-newsgroup-processable nil
1506 "List of articles in the current newsgroup that can be processed.")
1508 (defvar gnus-newsgroup-downloadable nil
1509 "Sorted list of articles in the current newsgroup that can be processed.")
1511 (defvar gnus-newsgroup-unfetched nil
1512 "Sorted list of articles in the current newsgroup whose headers have
1513 not been fetched into the agent.
1515 This list will always be a subset of gnus-newsgroup-undownloaded.")
1517 (defvar gnus-newsgroup-undownloaded nil
1518 "List of articles in the current newsgroup that haven't been downloaded.")
1520 (defvar gnus-newsgroup-unsendable nil
1521 "List of articles in the current newsgroup that won't be sent.")
1523 (defvar gnus-newsgroup-bookmarks nil
1524 "List of articles in the current newsgroup that have bookmarks.")
1526 (defvar gnus-newsgroup-dormant nil
1527 "Sorted list of dormant articles in the current newsgroup.")
1529 (defvar gnus-newsgroup-unseen nil
1530 "List of unseen articles in the current newsgroup.")
1532 (defvar gnus-newsgroup-seen nil
1533 "Range of seen articles in the current newsgroup.")
1535 (defvar gnus-newsgroup-articles nil
1536 "List of articles in the current newsgroup.")
1538 (defvar gnus-newsgroup-scored nil
1539 "List of scored articles in the current newsgroup.")
1541 (defvar gnus-newsgroup-headers nil
1542 "List of article headers in the current newsgroup.")
1544 (defvar gnus-newsgroup-threads nil)
1546 (defvar gnus-newsgroup-prepared nil
1547 "Whether the current group has been prepared properly.")
1549 (defvar gnus-newsgroup-ancient nil
1550 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1552 (defvar gnus-newsgroup-sparse nil)
1554 (defvar gnus-current-article nil)
1555 (defvar gnus-article-current nil)
1556 (defvar gnus-current-headers nil)
1557 (defvar gnus-have-all-headers nil)
1558 (defvar gnus-last-article nil)
1559 (defvar gnus-newsgroup-history nil)
1560 (defvar gnus-newsgroup-charset nil)
1561 (defvar gnus-newsgroup-ephemeral-charset nil)
1562 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1564 (defvar gnus-article-before-search nil)
1566 (defvar gnus-summary-local-variables
1567 '(gnus-newsgroup-name
1570 gnus-newsgroup-unreads
1571 gnus-newsgroup-unselected
1572 gnus-newsgroup-marked
1573 gnus-newsgroup-spam-marked
1574 gnus-newsgroup-reads
1575 gnus-newsgroup-saved
1576 gnus-newsgroup-replied
1577 gnus-newsgroup-forwarded
1578 gnus-newsgroup-expirable
1579 gnus-newsgroup-killed
1580 gnus-newsgroup-unseen
1582 gnus-newsgroup-cached
1583 gnus-newsgroup-downloadable
1584 gnus-newsgroup-undownloaded
1585 gnus-newsgroup-unsendable
1587 gnus-newsgroup-begin gnus-newsgroup-end
1588 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1589 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1590 gnus-newsgroup-last-directory
1591 gnus-newsgroup-auto-expire
1592 gnus-newsgroup-processable
1593 gnus-newsgroup-unfetched
1594 gnus-newsgroup-articles
1595 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1596 gnus-newsgroup-headers gnus-newsgroup-threads
1597 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1598 gnus-current-article gnus-current-headers gnus-have-all-headers
1599 gnus-last-article gnus-article-internal-prepare-hook
1600 (gnus-summary-article-delete-hook . global)
1601 (gnus-summary-article-move-hook . global)
1602 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1603 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1604 gnus-thread-expunge-below
1605 gnus-score-alist gnus-current-score-file
1606 (gnus-summary-expunge-below . global)
1607 (gnus-summary-mark-below . global)
1608 (gnus-orphan-score . global)
1609 gnus-newsgroup-active gnus-scores-exclude-files
1610 gnus-newsgroup-highest
1611 gnus-newsgroup-history gnus-newsgroup-ancient
1612 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1613 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1614 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1615 (gnus-newsgroup-expunged-tally . 0)
1616 gnus-cache-removable-articles
1617 gnus-newsgroup-data gnus-newsgroup-data-reverse
1618 gnus-newsgroup-limit gnus-newsgroup-limits
1619 gnus-newsgroup-charset gnus-newsgroup-display
1620 gnus-summary-use-undownloaded-faces)
1621 "Variables that are buffer-local to the summary buffers.")
1623 (defvar gnus-newsgroup-variables nil
1624 "A list of variables that have separate values in different newsgroups.
1625 A list of newsgroup (summary buffer) local variables, or cons of
1626 variables and their default expressions to be evalled (when the default
1627 values are not nil), that should be made global while the summary buffer
1630 Note: The default expressions will be evaluated (using function `eval')
1631 before assignment to the local variable rather than just assigned to it.
1632 If the default expression is the symbol `global', that symbol will not
1633 be evaluated but the global value of the local variable will be used
1636 These variables can be used to set variables in the group parameters
1637 while still allowing them to affect operations done in other buffers.
1640 \(setq gnus-newsgroup-variables
1641 '(message-use-followup-to
1642 (gnus-visible-headers .
1643 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1647 ;; Bind features so that require will believe that gnus-sum has
1648 ;; already been loaded (avoids infinite recursion)
1649 (let ((features (cons 'gnus-sum features)))
1650 (require 'gnus-art)))
1654 (defvar gnus-decode-encoded-word-methods
1655 '(mail-decode-encoded-word-string)
1656 "List of methods used to decode encoded words.
1658 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1659 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1660 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1661 whose names match REGEXP.
1664 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1665 mail-decode-encoded-word-string
1666 (\"chinese\" . rfc1843-decode-string))")
1668 (defvar gnus-decode-encoded-word-methods-cache nil)
1670 (defun gnus-multi-decode-encoded-word-string (string)
1671 "Apply the functions from `gnus-encoded-word-methods' that match."
1672 (unless (and gnus-decode-encoded-word-methods-cache
1673 (eq gnus-newsgroup-name
1674 (car gnus-decode-encoded-word-methods-cache)))
1675 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1676 (dolist (method gnus-decode-encoded-word-methods)
1677 (if (symbolp method)
1678 (nconc gnus-decode-encoded-word-methods-cache (list method))
1679 (if (and gnus-newsgroup-name
1680 (string-match (car method) gnus-newsgroup-name))
1681 (nconc gnus-decode-encoded-word-methods-cache
1682 (list (cdr method)))))))
1683 (dolist (method (cdr gnus-decode-encoded-word-methods-cache) string)
1684 (setq string (funcall method string))))
1686 ;; Subject simplification.
1688 (defun gnus-simplify-whitespace (str)
1689 "Remove excessive whitespace from STR."
1691 (while (string-match "[ \t][ \t]+" str)
1692 (setq str (concat (substring str 0 (match-beginning 0))
1694 (substring str (match-end 0)))))
1696 (when (string-match "^[ \t]+" str)
1697 (setq str (substring str (match-end 0))))
1699 (when (string-match "[ \t]+$" str)
1700 (setq str (substring str 0 (match-beginning 0))))
1703 (defun gnus-simplify-all-whitespace (str)
1704 "Remove all whitespace from STR."
1705 (while (string-match "[ \t\n]+" str)
1706 (setq str (replace-match "" nil nil str)))
1709 (defsubst gnus-simplify-subject-re (subject)
1710 "Remove \"Re:\" from subject lines."
1711 (if (string-match message-subject-re-regexp subject)
1712 (substring subject (match-end 0))
1715 (defun gnus-simplify-subject (subject &optional re-only)
1716 "Remove `Re:' and words in parentheses.
1717 If RE-ONLY is non-nil, strip leading `Re:'s only."
1718 (let ((case-fold-search t)) ;Ignore case.
1719 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1720 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1721 (setq subject (substring subject (match-end 0))))
1722 ;; Remove uninteresting prefixes.
1723 (when (and (not re-only)
1724 gnus-simplify-ignored-prefixes
1725 (string-match gnus-simplify-ignored-prefixes subject))
1726 (setq subject (substring subject (match-end 0))))
1727 ;; Remove words in parentheses from end.
1729 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1730 (setq subject (substring subject 0 (match-beginning 0)))))
1731 ;; Return subject string.
1734 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1736 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1737 (goto-char (point-min))
1738 (while (re-search-forward regexp nil t)
1739 (replace-match (or newtext ""))))
1741 (defun gnus-simplify-buffer-fuzzy (regexp)
1742 "Simplify string in the buffer fuzzily.
1743 The string in the accessible portion of the current buffer is simplified.
1744 It is assumed to be a single-line subject.
1745 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1746 matter is removed. Additional things can be deleted by setting
1747 `gnus-simplify-subject-fuzzy-regexp'."
1748 (let ((case-fold-search t)
1750 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1752 (while (not (eq modified-tick (buffer-modified-tick)))
1753 (setq modified-tick (buffer-modified-tick))
1756 (mapc 'gnus-simplify-buffer-fuzzy-step regexp))
1758 (gnus-simplify-buffer-fuzzy-step regexp)))
1759 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1760 (gnus-simplify-buffer-fuzzy-step
1761 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1762 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1764 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1765 (gnus-simplify-buffer-fuzzy-step " +" " ")
1766 (gnus-simplify-buffer-fuzzy-step " $")
1767 (gnus-simplify-buffer-fuzzy-step "^ +")))
1769 (defun gnus-simplify-subject-fuzzy (subject)
1770 "Simplify a subject string fuzzily.
1771 See `gnus-simplify-buffer-fuzzy' for details."
1773 (let ((regexp gnus-simplify-subject-fuzzy-regexp))
1774 (gnus-set-work-buffer)
1775 (let ((case-fold-search t))
1776 ;; Remove uninteresting prefixes.
1777 (when (and gnus-simplify-ignored-prefixes
1778 (string-match gnus-simplify-ignored-prefixes subject))
1779 (setq subject (substring subject (match-end 0))))
1781 (inline (gnus-simplify-buffer-fuzzy regexp))
1784 (defsubst gnus-simplify-subject-fully (subject)
1785 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1787 (gnus-simplify-subject-functions
1788 (gnus-map-function gnus-simplify-subject-functions subject))
1789 ((null gnus-summary-gather-subject-limit)
1790 (gnus-simplify-subject-re subject))
1791 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1792 (gnus-simplify-subject-fuzzy subject))
1793 ((numberp gnus-summary-gather-subject-limit)
1794 (truncate-string-to-width (gnus-simplify-subject-re subject)
1795 gnus-summary-gather-subject-limit))
1799 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1800 "Check whether two subjects are equal.
1801 If optional argument SIMPLE-FIRST is t, first argument is already
1804 ((null simple-first)
1805 (equal (gnus-simplify-subject-fully s1)
1806 (gnus-simplify-subject-fully s2)))
1809 (gnus-simplify-subject-fully s2)))))
1811 (defun gnus-summary-bubble-group ()
1812 "Increase the score of the current group.
1813 This is a handy function to add to `gnus-summary-exit-hook' to
1814 increase the score of each group you read."
1815 (gnus-group-add-score gnus-newsgroup-name))
1819 ;;; Gnus summary mode
1822 (put 'gnus-summary-mode 'mode-class 'special)
1824 (defvar gnus-article-commands-menu)
1826 ;; Non-orthogonal keys
1828 (gnus-define-keys gnus-summary-mode-map
1829 " " gnus-summary-next-page
1830 "\177" gnus-summary-prev-page
1831 [delete] gnus-summary-prev-page
1832 [backspace] gnus-summary-prev-page
1833 "\r" gnus-summary-scroll-up
1834 "\M-\r" gnus-summary-scroll-down
1835 "n" gnus-summary-next-unread-article
1836 "p" gnus-summary-prev-unread-article
1837 "N" gnus-summary-next-article
1838 "P" gnus-summary-prev-article
1839 "\M-\C-n" gnus-summary-next-same-subject
1840 "\M-\C-p" gnus-summary-prev-same-subject
1841 "\M-n" gnus-summary-next-unread-subject
1842 "\M-p" gnus-summary-prev-unread-subject
1843 "." gnus-summary-first-unread-article
1844 "," gnus-summary-best-unread-article
1845 "\M-s" gnus-summary-search-article-forward
1846 "\M-r" gnus-summary-search-article-backward
1847 "\M-S" gnus-summary-repeat-search-article-forward
1848 "\M-R" gnus-summary-repeat-search-article-backward
1849 "<" gnus-summary-beginning-of-article
1850 ">" gnus-summary-end-of-article
1851 "j" gnus-summary-goto-article
1852 "^" gnus-summary-refer-parent-article
1853 "\M-^" gnus-summary-refer-article
1854 "u" gnus-summary-tick-article-forward
1855 "!" gnus-summary-tick-article-forward
1856 "U" gnus-summary-tick-article-backward
1857 "d" gnus-summary-mark-as-read-forward
1858 "D" gnus-summary-mark-as-read-backward
1859 "E" gnus-summary-mark-as-expirable
1860 "\M-u" gnus-summary-clear-mark-forward
1861 "\M-U" gnus-summary-clear-mark-backward
1862 "k" gnus-summary-kill-same-subject-and-select
1863 "\C-k" gnus-summary-kill-same-subject
1864 "\M-\C-k" gnus-summary-kill-thread
1865 "\M-\C-l" gnus-summary-lower-thread
1866 "e" gnus-summary-edit-article
1867 "#" gnus-summary-mark-as-processable
1868 "\M-#" gnus-summary-unmark-as-processable
1869 "\M-\C-t" gnus-summary-toggle-threads
1870 "\M-\C-s" gnus-summary-show-thread
1871 "\M-\C-h" gnus-summary-hide-thread
1872 "\M-\C-f" gnus-summary-next-thread
1873 "\M-\C-b" gnus-summary-prev-thread
1874 [(meta down)] gnus-summary-next-thread
1875 [(meta up)] gnus-summary-prev-thread
1876 "\M-\C-u" gnus-summary-up-thread
1877 "\M-\C-d" gnus-summary-down-thread
1878 "&" gnus-summary-execute-command
1879 "c" gnus-summary-catchup-and-exit
1880 "\C-w" gnus-summary-mark-region-as-read
1881 "\C-t" gnus-summary-toggle-truncation
1882 "?" gnus-summary-mark-as-dormant
1883 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1884 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1885 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1886 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1887 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1888 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1889 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1890 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1891 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1892 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1893 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1894 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1895 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1896 "=" gnus-summary-expand-window
1897 "\C-x\C-s" gnus-summary-reselect-current-group
1898 "\M-g" gnus-summary-rescan-group
1899 "\C-c\C-r" gnus-summary-caesar-message
1900 "f" gnus-summary-followup
1901 "F" gnus-summary-followup-with-original
1902 "C" gnus-summary-cancel-article
1903 "r" gnus-summary-reply
1904 "R" gnus-summary-reply-with-original
1905 "\C-c\C-f" gnus-summary-mail-forward
1906 "o" gnus-summary-save-article
1907 "\C-o" gnus-summary-save-article-mail
1908 "|" gnus-summary-pipe-output
1909 "\M-k" gnus-summary-edit-local-kill
1910 "\M-K" gnus-summary-edit-global-kill
1912 "\C-c\C-d" gnus-summary-describe-group
1913 "q" gnus-summary-exit
1914 "Q" gnus-summary-exit-no-update
1915 "\C-c\C-i" gnus-info-find-node
1916 gnus-mouse-2 gnus-mouse-pick-article
1917 [follow-link] mouse-face
1918 "m" gnus-summary-mail-other-window
1919 "a" gnus-summary-post-news
1920 "x" gnus-summary-limit-to-unread
1921 "s" gnus-summary-isearch-article
1922 [tab] gnus-summary-widget-forward
1923 "t" gnus-summary-toggle-header
1924 "g" gnus-summary-show-article
1925 "l" gnus-summary-goto-last-article
1926 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1927 "\C-d" gnus-summary-enter-digest-group
1928 "\M-\C-d" gnus-summary-read-document
1929 "\M-\C-e" gnus-summary-edit-parameters
1930 "\M-\C-a" gnus-summary-customize-parameters
1932 "*" gnus-cache-enter-article
1933 "\M-*" gnus-cache-remove-article
1934 "\M-&" gnus-summary-universal-argument
1935 "\C-l" gnus-recenter
1936 "I" gnus-summary-increase-score
1937 "L" gnus-summary-lower-score
1938 "\M-i" gnus-symbolic-argument
1939 "h" gnus-summary-select-article-buffer
1941 "b" gnus-article-view-part
1942 "\M-t" gnus-summary-toggle-display-buttonized
1944 "V" gnus-summary-score-map
1945 "X" gnus-uu-extract-map
1946 "S" gnus-summary-send-map)
1948 ;; Sort of orthogonal keymap
1949 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1950 "t" gnus-summary-tick-article-forward
1951 "!" gnus-summary-tick-article-forward
1952 "d" gnus-summary-mark-as-read-forward
1953 "r" gnus-summary-mark-as-read-forward
1954 "c" gnus-summary-clear-mark-forward
1955 " " gnus-summary-clear-mark-forward
1956 "e" gnus-summary-mark-as-expirable
1957 "x" gnus-summary-mark-as-expirable
1958 "?" gnus-summary-mark-as-dormant
1959 "b" gnus-summary-set-bookmark
1960 "B" gnus-summary-remove-bookmark
1961 "#" gnus-summary-mark-as-processable
1962 "\M-#" gnus-summary-unmark-as-processable
1963 "S" gnus-summary-limit-include-expunged
1964 "C" gnus-summary-catchup
1965 "H" gnus-summary-catchup-to-here
1966 "h" gnus-summary-catchup-from-here
1967 "\C-c" gnus-summary-catchup-all
1968 "k" gnus-summary-kill-same-subject-and-select
1969 "K" gnus-summary-kill-same-subject
1970 "P" gnus-uu-mark-map)
1972 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1973 "c" gnus-summary-clear-above
1974 "u" gnus-summary-tick-above
1975 "m" gnus-summary-mark-above
1976 "k" gnus-summary-kill-below)
1978 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1979 "/" gnus-summary-limit-to-subject
1980 "n" gnus-summary-limit-to-articles
1981 "b" gnus-summary-limit-to-bodies
1982 "h" gnus-summary-limit-to-headers
1983 "w" gnus-summary-pop-limit
1984 "s" gnus-summary-limit-to-subject
1985 "a" gnus-summary-limit-to-author
1986 "u" gnus-summary-limit-to-unread
1987 "m" gnus-summary-limit-to-marks
1988 "M" gnus-summary-limit-exclude-marks
1989 "v" gnus-summary-limit-to-score
1990 "*" gnus-summary-limit-include-cached
1991 "D" gnus-summary-limit-include-dormant
1992 "T" gnus-summary-limit-include-thread
1993 "d" gnus-summary-limit-exclude-dormant
1994 "t" gnus-summary-limit-to-age
1995 "." gnus-summary-limit-to-unseen
1996 "x" gnus-summary-limit-to-extra
1997 "p" gnus-summary-limit-to-display-predicate
1998 "E" gnus-summary-limit-include-expunged
1999 "c" gnus-summary-limit-exclude-childless-dormant
2000 "C" gnus-summary-limit-mark-excluded-as-read
2001 "o" gnus-summary-insert-old-articles
2002 "N" gnus-summary-insert-new-articles
2003 "S" gnus-summary-limit-to-singletons
2004 "r" gnus-summary-limit-to-replied
2005 "R" gnus-summary-limit-to-recipient
2006 "A" gnus-summary-limit-to-address)
2008 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
2009 "n" gnus-summary-next-unread-article
2010 "p" gnus-summary-prev-unread-article
2011 "N" gnus-summary-next-article
2012 "P" gnus-summary-prev-article
2013 "\C-n" gnus-summary-next-same-subject
2014 "\C-p" gnus-summary-prev-same-subject
2015 "\M-n" gnus-summary-next-unread-subject
2016 "\M-p" gnus-summary-prev-unread-subject
2017 "f" gnus-summary-first-unread-article
2018 "b" gnus-summary-best-unread-article
2019 "j" gnus-summary-goto-article
2020 "g" gnus-summary-goto-subject
2021 "l" gnus-summary-goto-last-article
2022 "o" gnus-summary-pop-article)
2024 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2025 "k" gnus-summary-kill-thread
2026 "E" gnus-summary-expire-thread
2027 "l" gnus-summary-lower-thread
2028 "i" gnus-summary-raise-thread
2029 "T" gnus-summary-toggle-threads
2030 "t" gnus-summary-rethread-current
2031 "^" gnus-summary-reparent-thread
2032 "\M-^" gnus-summary-reparent-children
2033 "s" gnus-summary-show-thread
2034 "S" gnus-summary-show-all-threads
2035 "h" gnus-summary-hide-thread
2036 "H" gnus-summary-hide-all-threads
2037 "n" gnus-summary-next-thread
2038 "p" gnus-summary-prev-thread
2039 "u" gnus-summary-up-thread
2040 "o" gnus-summary-top-thread
2041 "d" gnus-summary-down-thread
2042 "#" gnus-uu-mark-thread
2043 "\M-#" gnus-uu-unmark-thread)
2045 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2046 "g" gnus-summary-prepare
2047 "c" gnus-summary-insert-cached-articles
2048 "d" gnus-summary-insert-dormant-articles
2049 "t" gnus-summary-insert-ticked-articles)
2051 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2052 "c" gnus-summary-catchup-and-exit
2053 "C" gnus-summary-catchup-all-and-exit
2054 "E" gnus-summary-exit-no-update
2055 "Q" gnus-summary-exit
2056 "Z" gnus-summary-exit
2057 "n" gnus-summary-catchup-and-goto-next-group
2058 "p" gnus-summary-catchup-and-goto-prev-group
2059 "R" gnus-summary-reselect-current-group
2060 "G" gnus-summary-rescan-group
2061 "N" gnus-summary-next-group
2062 "s" gnus-summary-save-newsrc
2063 "P" gnus-summary-prev-group)
2065 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2066 " " gnus-summary-next-page
2067 "n" gnus-summary-next-page
2068 "\177" gnus-summary-prev-page
2069 [delete] gnus-summary-prev-page
2070 "p" gnus-summary-prev-page
2071 "\r" gnus-summary-scroll-up
2072 "\M-\r" gnus-summary-scroll-down
2073 "<" gnus-summary-beginning-of-article
2074 ">" gnus-summary-end-of-article
2075 "b" gnus-summary-beginning-of-article
2076 "e" gnus-summary-end-of-article
2077 "^" gnus-summary-refer-parent-article
2078 "r" gnus-summary-refer-parent-article
2079 "C" gnus-summary-show-complete-article
2080 "D" gnus-summary-enter-digest-group
2081 "R" gnus-summary-refer-references
2082 "T" gnus-summary-refer-thread
2083 "W" gnus-warp-to-article
2084 "g" gnus-summary-show-article
2085 "s" gnus-summary-isearch-article
2086 [tab] gnus-summary-widget-forward
2087 "P" gnus-summary-print-article
2088 "S" gnus-sticky-article
2089 "M" gnus-mailing-list-insinuate
2090 "t" gnus-article-babel)
2092 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2093 "b" gnus-article-add-buttons
2094 "B" gnus-article-add-buttons-to-head
2095 "o" gnus-article-treat-overstrike
2096 "e" gnus-article-emphasize
2097 "w" gnus-article-fill-cited-article
2098 "Q" gnus-article-fill-long-lines
2099 "L" gnus-article-toggle-truncate-lines
2100 "C" gnus-article-capitalize-sentences
2101 "c" gnus-article-remove-cr
2102 "q" gnus-article-de-quoted-unreadable
2103 "6" gnus-article-de-base64-unreadable
2104 "Z" gnus-article-decode-HZ
2105 "A" gnus-article-treat-ansi-sequences
2106 "h" gnus-article-wash-html
2107 "u" gnus-article-unsplit-urls
2108 "s" gnus-summary-force-verify-and-decrypt
2109 "f" gnus-article-display-x-face
2110 "l" gnus-summary-stop-page-breaking
2111 "r" gnus-summary-caesar-message
2112 "m" gnus-summary-morse-message
2113 "t" gnus-summary-toggle-header
2114 "g" gnus-treat-smiley
2115 "v" gnus-summary-verbose-headers
2116 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2117 "p" gnus-article-verify-x-pgp-sig
2118 "d" gnus-article-treat-dumbquotes
2119 "U" gnus-article-treat-non-ascii
2120 "i" gnus-summary-idna-message)
2122 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2123 ;; mnemonic: deuglif*Y*
2124 "u" gnus-article-outlook-unwrap-lines
2125 "a" gnus-article-outlook-repair-attribution
2126 "c" gnus-article-outlook-rearrange-citation
2127 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2129 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2130 "a" gnus-article-hide
2131 "h" gnus-article-hide-headers
2132 "b" gnus-article-hide-boring-headers
2133 "s" gnus-article-hide-signature
2134 "c" gnus-article-hide-citation
2135 "C" gnus-article-hide-citation-in-followups
2136 "l" gnus-article-hide-list-identifiers
2137 "B" gnus-article-strip-banner
2138 "P" gnus-article-hide-pem
2139 "\C-c" gnus-article-hide-citation-maybe)
2141 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2142 "a" gnus-article-highlight
2143 "h" gnus-article-highlight-headers
2144 "c" gnus-article-highlight-citation
2145 "s" gnus-article-highlight-signature)
2147 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2148 "f" gnus-article-treat-fold-headers
2149 "u" gnus-article-treat-unfold-headers
2150 "n" gnus-article-treat-fold-newsgroups)
2152 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2153 "x" gnus-article-display-x-face
2154 "d" gnus-article-display-face
2155 "s" gnus-treat-smiley
2156 "D" gnus-article-remove-images
2157 "W" gnus-article-show-images
2158 "f" gnus-treat-from-picon
2159 "m" gnus-treat-mail-picon
2160 "n" gnus-treat-newsgroups-picon
2161 "g" gnus-treat-from-gravatar
2162 "h" gnus-treat-mail-gravatar)
2164 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2165 "w" gnus-article-decode-mime-words
2166 "c" gnus-article-decode-charset
2167 "v" gnus-mime-view-all-parts
2168 "b" gnus-article-view-part)
2170 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2171 "z" gnus-article-date-ut
2172 "u" gnus-article-date-ut
2173 "l" gnus-article-date-local
2174 "p" gnus-article-date-english
2175 "e" gnus-article-date-lapsed
2176 "o" gnus-article-date-original
2177 "i" gnus-article-date-iso8601
2178 "s" gnus-article-date-user)
2180 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2181 "t" gnus-article-remove-trailing-blank-lines
2182 "l" gnus-article-strip-leading-blank-lines
2183 "m" gnus-article-strip-multiple-blank-lines
2184 "a" gnus-article-strip-blank-lines
2185 "A" gnus-article-strip-all-blank-lines
2186 "s" gnus-article-strip-leading-space
2187 "e" gnus-article-strip-trailing-space
2188 "w" gnus-article-remove-leading-whitespace)
2190 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2192 "d" gnus-summary-describe-group
2193 "h" gnus-summary-describe-briefly
2194 "i" gnus-info-find-node)
2196 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2197 "e" gnus-summary-expire-articles
2198 "\M-\C-e" gnus-summary-expire-articles-now
2199 "\177" gnus-summary-delete-article
2200 [delete] gnus-summary-delete-article
2201 [backspace] gnus-summary-delete-article
2202 "m" gnus-summary-move-article
2203 "r" gnus-summary-respool-article
2204 "w" gnus-summary-edit-article
2205 "c" gnus-summary-copy-article
2206 "B" gnus-summary-crosspost-article
2207 "q" gnus-summary-respool-query
2208 "t" gnus-summary-respool-trace
2209 "i" gnus-summary-import-article
2210 "I" gnus-summary-create-article
2211 "p" gnus-summary-article-posted-p)
2213 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2214 "o" gnus-summary-save-article
2215 "m" gnus-summary-save-article-mail
2216 "F" gnus-summary-write-article-file
2217 "r" gnus-summary-save-article-rmail
2218 "f" gnus-summary-save-article-file
2219 "b" gnus-summary-save-article-body-file
2220 "B" gnus-summary-write-article-body-file
2221 "h" gnus-summary-save-article-folder
2222 "v" gnus-summary-save-article-vm
2223 "p" gnus-summary-pipe-output
2224 "P" gnus-summary-muttprint)
2226 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2227 "b" gnus-summary-display-buttonized
2228 "m" gnus-summary-repair-multipart
2229 "v" gnus-article-view-part
2230 "o" gnus-article-save-part
2231 "O" gnus-article-save-part-and-strip
2232 "r" gnus-article-replace-part
2233 "d" gnus-article-delete-part
2234 "t" gnus-article-view-part-as-type
2235 "j" gnus-article-jump-to-part
2236 "c" gnus-article-copy-part
2237 "C" gnus-article-view-part-as-charset
2238 "e" gnus-article-view-part-externally
2239 "H" gnus-article-browse-html-article
2240 "E" gnus-article-encrypt-body
2241 "i" gnus-article-inline-part
2242 "|" gnus-article-pipe-part)
2244 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2245 "p" gnus-summary-mark-as-processable
2246 "u" gnus-summary-unmark-as-processable
2247 "U" gnus-summary-unmark-all-processable
2248 "v" gnus-uu-mark-over
2249 "s" gnus-uu-mark-series
2250 "r" gnus-uu-mark-region
2251 "g" gnus-uu-unmark-region
2252 "R" gnus-uu-mark-by-regexp
2253 "G" gnus-uu-unmark-by-regexp
2254 "t" gnus-uu-mark-thread
2255 "T" gnus-uu-unmark-thread
2256 "a" gnus-uu-mark-all
2257 "b" gnus-uu-mark-buffer
2258 "S" gnus-uu-mark-sparse
2259 "k" gnus-summary-kill-process-mark
2260 "y" gnus-summary-yank-process-mark
2261 "w" gnus-summary-save-process-mark
2262 "i" gnus-uu-invert-processable)
2264 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2265 ;;"x" gnus-uu-extract-any
2266 "m" gnus-summary-save-parts
2267 "u" gnus-uu-decode-uu
2268 "U" gnus-uu-decode-uu-and-save
2269 "s" gnus-uu-decode-unshar
2270 "S" gnus-uu-decode-unshar-and-save
2271 "o" gnus-uu-decode-save
2272 "O" gnus-uu-decode-save
2273 "b" gnus-uu-decode-binhex
2274 "B" gnus-uu-decode-binhex
2275 "Y" gnus-uu-decode-yenc
2276 "p" gnus-uu-decode-postscript
2277 "P" gnus-uu-decode-postscript-and-save)
2280 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2281 "u" gnus-uu-decode-uu-view
2282 "U" gnus-uu-decode-uu-and-save-view
2283 "s" gnus-uu-decode-unshar-view
2284 "S" gnus-uu-decode-unshar-and-save-view
2285 "o" gnus-uu-decode-save-view
2286 "O" gnus-uu-decode-save-view
2287 "b" gnus-uu-decode-binhex-view
2288 "B" gnus-uu-decode-binhex-view
2289 "p" gnus-uu-decode-postscript-view
2290 "P" gnus-uu-decode-postscript-and-save-view)
2292 (defvar gnus-article-post-menu nil)
2294 (defconst gnus-summary-menu-maxlen 20)
2296 (defun gnus-summary-menu-split (menu)
2297 ;; If we have lots of elements, divide them into groups of 20
2298 ;; and make a pane (or submenu) for each one.
2299 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2300 (let ((menu menu) sublists next
2303 ;; Pull off the next gnus-summary-menu-maxlen elements
2304 ;; and make them the next element of sublist.
2305 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2307 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2309 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2310 (aref (car (last menu)) 0)) menu)
2314 (nreverse sublists))
2315 ;; Few elements--put them all in one pane.
2318 (defun gnus-summary-make-menu-bar ()
2319 (gnus-turn-off-edit-menu 'summary)
2321 (unless (boundp 'gnus-summary-misc-menu)
2324 gnus-summary-kill-menu gnus-summary-mode-map ""
2329 ["Customize" gnus-score-customize t])
2330 (gnus-make-score-map 'increase)
2331 (gnus-make-score-map 'lower)
2333 ["Kill below" gnus-summary-kill-below t]
2334 ["Mark above" gnus-summary-mark-above t]
2335 ["Tick above" gnus-summary-tick-above t]
2336 ["Clear above" gnus-summary-clear-above t])
2337 ["Current score" gnus-summary-current-score t]
2338 ["Set score" gnus-summary-set-score t]
2339 ["Switch current score file..." gnus-score-change-score-file t]
2340 ["Set mark below..." gnus-score-set-mark-below t]
2341 ["Set expunge below..." gnus-score-set-expunge-below t]
2342 ["Edit current score file" gnus-score-edit-current-scores t]
2343 ["Edit score file..." gnus-score-edit-file t]
2344 ["Trace score" gnus-score-find-trace t]
2345 ["Find words" gnus-score-find-favourite-words t]
2346 ["Rescore buffer" gnus-summary-rescore t]
2347 ["Increase score..." gnus-summary-increase-score t]
2348 ["Lower score..." gnus-summary-lower-score t]))))
2350 ;; Define both the Article menu in the summary buffer and the
2351 ;; equivalent Commands menu in the article buffer here for
2355 ["All" gnus-article-hide t]
2356 ["Headers" gnus-article-hide-headers t]
2357 ["Signature" gnus-article-hide-signature t]
2358 ["Citation" gnus-article-hide-citation t]
2359 ["List identifiers" gnus-article-hide-list-identifiers t]
2360 ["Banner" gnus-article-strip-banner t]
2361 ["Boring headers" gnus-article-hide-boring-headers t])
2363 ["All" gnus-article-highlight t]
2364 ["Headers" gnus-article-highlight-headers t]
2365 ["Signature" gnus-article-highlight-signature t]
2366 ["Citation" gnus-article-highlight-citation t])
2368 ["Words" gnus-article-decode-mime-words t]
2369 ["Charset" gnus-article-decode-charset t]
2370 ["QP" gnus-article-de-quoted-unreadable t]
2371 ["Base64" gnus-article-de-base64-unreadable t]
2372 ["View MIME buttons" gnus-summary-display-buttonized t]
2373 ["View all" gnus-mime-view-all-parts t]
2374 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2375 ["Encrypt body" gnus-article-encrypt-body
2376 :active (not (gnus-group-read-only-p))
2377 ,@(if (featurep 'xemacs) nil
2378 '(:help "Encrypt the message body on disk"))]
2379 ["Extract all parts..." gnus-summary-save-parts t]
2381 ["Repair multipart" gnus-summary-repair-multipart t]
2382 ["Pipe part..." gnus-article-pipe-part t]
2383 ["Inline part" gnus-article-inline-part t]
2384 ["View part as type..." gnus-article-view-part-as-type t]
2385 ["Encrypt body" gnus-article-encrypt-body
2386 :active (not (gnus-group-read-only-p))
2387 ,@(if (featurep 'xemacs) nil
2388 '(:help "Encrypt the message body on disk"))]
2389 ["View part externally" gnus-article-view-part-externally t]
2390 ["View HTML parts in browser" gnus-article-browse-html-article t]
2391 ["View part with charset..." gnus-article-view-part-as-charset t]
2392 ["Copy part" gnus-article-copy-part t]
2393 ["Save part..." gnus-article-save-part t]
2394 ["View part" gnus-article-view-part t]))
2396 ["Local" gnus-article-date-local t]
2397 ["ISO8601" gnus-article-date-iso8601 t]
2398 ["UT" gnus-article-date-ut t]
2399 ["Original" gnus-article-date-original t]
2400 ["Lapsed" gnus-article-date-lapsed t]
2401 ["User-defined" gnus-article-date-user t])
2403 ["Remove images" gnus-article-remove-images t]
2404 ["Toggle smiley" gnus-treat-smiley t]
2405 ["Show X-Face" gnus-article-display-x-face t]
2406 ["Show picons in From" gnus-treat-from-picon t]
2407 ["Show picons in mail headers" gnus-treat-mail-picon t]
2408 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2409 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2410 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2411 ("View as different encoding"
2412 ,@(gnus-summary-menu-split
2415 ;; Since easymenu under Emacs doesn't allow
2416 ;; lambda forms for menu commands, we should
2417 ;; provide intern'ed function symbols.
2418 (let ((command (intern (format "\
2419 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2423 (let ((gnus-summary-show-article-charset-alist
2425 (gnus-summary-show-article 1))))
2426 `[,(symbol-name cs) ,command t]))
2427 (sort (if (fboundp 'coding-system-list)
2428 (coding-system-list)
2429 (mapcar 'car mm-mime-mule-charset-alist))
2433 ["Leading" gnus-article-strip-leading-blank-lines t]
2434 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2435 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2436 ["All of the above" gnus-article-strip-blank-lines t]
2437 ["All" gnus-article-strip-all-blank-lines t]
2438 ["Leading space" gnus-article-strip-leading-space t]
2439 ["Trailing space" gnus-article-strip-trailing-space t]
2440 ["Leading space in headers"
2441 gnus-article-remove-leading-whitespace t])
2442 ["Overstrike" gnus-article-treat-overstrike t]
2443 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2444 ["Non-ASCII" gnus-article-treat-non-ascii t]
2445 ["Emphasis" gnus-article-emphasize t]
2446 ["Word wrap" gnus-article-fill-cited-article t]
2447 ["Fill long lines" gnus-article-fill-long-lines t]
2448 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2449 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2450 ["Remove CR" gnus-article-remove-cr t]
2451 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2452 ["Base64" gnus-article-de-base64-unreadable t]
2453 ["Rot 13" gnus-summary-caesar-message
2454 ,@(if (featurep 'xemacs) '(t)
2455 '(:help "\"Caesar rotate\" article by 13"))]
2456 ["De-IDNA" gnus-summary-idna-message t]
2457 ["Morse decode" gnus-summary-morse-message t]
2458 ["Unix pipe..." gnus-summary-pipe-message t]
2459 ["Add buttons" gnus-article-add-buttons t]
2460 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2461 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2462 ["Verbose header" gnus-summary-verbose-headers t]
2463 ["Toggle header" gnus-summary-toggle-header t]
2464 ["Unfold headers" gnus-article-treat-unfold-headers t]
2465 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2466 ["Html" gnus-article-wash-html t]
2467 ["Unsplit URLs" gnus-article-unsplit-urls t]
2468 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2469 ["Decode HZ" gnus-article-decode-HZ t]
2470 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2471 ("(Outlook) Deuglify"
2472 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2473 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2474 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2475 ["Full (Outlook) deuglify"
2476 gnus-article-outlook-deuglify-article t])
2479 ["Save in default format..." gnus-summary-save-article
2480 ,@(if (featurep 'xemacs) '(t)
2481 '(:help "Save article using default method"))]
2482 ["Save in file..." gnus-summary-save-article-file
2483 ,@(if (featurep 'xemacs) '(t)
2484 '(:help "Save article in file"))]
2485 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2486 ["Save in MH folder..." gnus-summary-save-article-folder t]
2487 ["Save in VM folder..." gnus-summary-save-article-vm t]
2488 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2489 ["Save body in file..." gnus-summary-save-article-body-file t]
2490 ["Pipe through a filter..." gnus-summary-pipe-output t]
2491 ["Print with Muttprint..." gnus-summary-muttprint t]
2492 ["Print" gnus-summary-print-article
2493 ,@(if (featurep 'xemacs) '(t)
2494 '(:help "Generate and print a PostScript image"))])
2495 ("Copy, move,... (Backend)"
2496 ,@(if (featurep 'xemacs) nil
2497 '(:help "Copying, moving, expiring articles..."))
2498 ["Respool article..." gnus-summary-respool-article t]
2499 ["Move article..." gnus-summary-move-article
2500 (gnus-check-backend-function
2501 'request-move-article gnus-newsgroup-name)]
2502 ["Copy article..." gnus-summary-copy-article t]
2503 ["Crosspost article..." gnus-summary-crosspost-article
2504 (gnus-check-backend-function
2505 'request-replace-article gnus-newsgroup-name)]
2506 ["Import file..." gnus-summary-import-article
2507 (gnus-check-backend-function
2508 'request-accept-article gnus-newsgroup-name)]
2509 ["Create article..." gnus-summary-create-article
2510 (gnus-check-backend-function
2511 'request-accept-article gnus-newsgroup-name)]
2512 ["Check if posted" gnus-summary-article-posted-p t]
2513 ["Edit article" gnus-summary-edit-article
2514 (not (gnus-group-read-only-p))]
2515 ["Delete article" gnus-summary-delete-article
2516 (gnus-check-backend-function
2517 'request-expire-articles gnus-newsgroup-name)]
2518 ["Query respool" gnus-summary-respool-query t]
2519 ["Trace respool" gnus-summary-respool-trace t]
2520 ["Delete expirable articles" gnus-summary-expire-articles-now
2521 (gnus-check-backend-function
2522 'request-expire-articles gnus-newsgroup-name)])
2524 ["Uudecode" gnus-uu-decode-uu
2525 ,@(if (featurep 'xemacs) '(t)
2526 '(:help "Decode uuencoded article(s)"))]
2527 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2528 ["Unshar" gnus-uu-decode-unshar t]
2529 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2530 ["Save" gnus-uu-decode-save t]
2531 ["Binhex" gnus-uu-decode-binhex t]
2532 ["Postscript" gnus-uu-decode-postscript t]
2533 ["All MIME parts" gnus-summary-save-parts t])
2535 ["Enter article" gnus-cache-enter-article t]
2536 ["Remove article" gnus-cache-remove-article t])
2537 ["Translate" gnus-article-babel t]
2538 ["Select article buffer" gnus-summary-select-article-buffer t]
2539 ["Make article buffer sticky" gnus-sticky-article t]
2540 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2541 ["Isearch article..." gnus-summary-isearch-article t]
2542 ["Beginning of the article" gnus-summary-beginning-of-article t]
2543 ["End of the article" gnus-summary-end-of-article t]
2544 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2545 ["Fetch referenced articles" gnus-summary-refer-references t]
2546 ["Fetch current thread" gnus-summary-refer-thread t]
2547 ["Fetch article with id..." gnus-summary-refer-article t]
2548 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2549 ["Redisplay" gnus-summary-show-article t]
2550 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2552 gnus-summary-article-menu gnus-summary-mode-map ""
2553 (cons "Article" innards))
2555 (if (not (keymapp gnus-summary-article-menu))
2557 gnus-article-commands-menu gnus-article-mode-map ""
2558 (cons "Commands" innards))
2559 ;; in Emacs, don't share menu.
2560 (setq gnus-article-commands-menu
2561 (copy-keymap gnus-summary-article-menu))
2562 (define-key gnus-article-mode-map [menu-bar commands]
2563 (cons "Commands" gnus-article-commands-menu))))
2566 gnus-summary-thread-menu gnus-summary-mode-map ""
2568 ["Find all messages in thread" gnus-summary-refer-thread t]
2569 ["Toggle threading" gnus-summary-toggle-threads t]
2570 ["Hide threads" gnus-summary-hide-all-threads t]
2571 ["Show threads" gnus-summary-show-all-threads t]
2572 ["Hide thread" gnus-summary-hide-thread t]
2573 ["Show thread" gnus-summary-show-thread t]
2574 ["Go to next thread" gnus-summary-next-thread t]
2575 ["Go to previous thread" gnus-summary-prev-thread t]
2576 ["Go down thread" gnus-summary-down-thread t]
2577 ["Go up thread" gnus-summary-up-thread t]
2578 ["Top of thread" gnus-summary-top-thread t]
2579 ["Mark thread as read" gnus-summary-kill-thread t]
2580 ["Mark thread as expired" gnus-summary-expire-thread t]
2581 ["Lower thread score" gnus-summary-lower-thread t]
2582 ["Raise thread score" gnus-summary-raise-thread t]
2583 ["Rethread current" gnus-summary-rethread-current t]))
2586 gnus-summary-post-menu gnus-summary-mode-map ""
2588 ["Send a message (mail or news)" gnus-summary-post-news
2589 ,@(if (featurep 'xemacs) '(t)
2590 '(:help "Compose a new message (mail or news)"))]
2591 ["Followup" gnus-summary-followup
2592 ,@(if (featurep 'xemacs) '(t)
2593 '(:help "Post followup to this article"))]
2594 ["Followup and yank" gnus-summary-followup-with-original
2595 ,@(if (featurep 'xemacs) '(t)
2596 '(:help "Post followup to this article, quoting its contents"))]
2597 ["Supersede article" gnus-summary-supersede-article t]
2598 ["Cancel article" gnus-summary-cancel-article
2599 ,@(if (featurep 'xemacs) '(t)
2600 '(:help "Cancel an article you posted"))]
2601 ["Reply" gnus-summary-reply t]
2602 ["Reply and yank" gnus-summary-reply-with-original t]
2603 ["Wide reply" gnus-summary-wide-reply t]
2604 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2605 ,@(if (featurep 'xemacs) '(t)
2606 '(:help "Mail a reply, quoting this article"))]
2607 ["Very wide reply" gnus-summary-very-wide-reply t]
2608 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2609 ,@(if (featurep 'xemacs) '(t)
2610 '(:help "Mail a very wide reply, quoting this article"))]
2611 ["Mail forward" gnus-summary-mail-forward t]
2612 ["Post forward" gnus-summary-post-forward t]
2613 ["Digest and mail" gnus-uu-digest-mail-forward t]
2614 ["Digest and post" gnus-uu-digest-post-forward t]
2615 ["Resend message" gnus-summary-resend-message t]
2616 ["Resend message edit" gnus-summary-resend-message-edit t]
2617 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2618 ["Send a mail" gnus-summary-mail-other-window t]
2619 ["Create a local message" gnus-summary-news-other-window t]
2620 ["Uuencode and post" gnus-uu-post-news
2621 ,@(if (featurep 'xemacs) '(t)
2622 '(:help "Post a uuencoded article"))]
2623 ["Followup via news" gnus-summary-followup-to-mail t]
2624 ["Followup via news and yank"
2625 gnus-summary-followup-to-mail-with-original t]
2626 ["Strip signature on reply"
2629 (if (not (memq message-cite-function
2630 '(message-cite-original-without-signature
2631 message-cite-original)))
2632 ;; Stupid workaround for XEmacs not honoring :visible.
2633 (message "Can't toggle this value of `message-cite-function'")
2634 (setq message-cite-function
2635 (if (eq message-cite-function
2636 'message-cite-original-without-signature)
2637 'message-cite-original
2638 'message-cite-original-without-signature))))
2639 ;; XEmacs barfs on :visible.
2640 ,@(if (featurep 'xemacs) nil
2641 '(:visible (memq message-cite-function
2642 '(message-cite-original-without-signature
2643 message-cite-original))))
2645 :selected (eq message-cite-function
2646 'message-cite-original-without-signature)
2647 ,@(if (featurep 'xemacs) nil
2648 '(:help "Strip signature from cited article when replying."))]
2650 ;;["Send" gnus-summary-send-draft t]
2651 ;;["Send bounced" gnus-resend-bounced-mail t])
2655 ((not (keymapp gnus-summary-post-menu))
2656 (setq gnus-article-post-menu gnus-summary-post-menu))
2657 ((not gnus-article-post-menu)
2658 ;; Don't share post menu.
2659 (setq gnus-article-post-menu
2660 (copy-keymap gnus-summary-post-menu))))
2661 (define-key gnus-article-mode-map [menu-bar post]
2662 (cons "Post" gnus-article-post-menu))
2665 gnus-summary-misc-menu gnus-summary-mode-map ""
2668 ["Mark as read" gnus-summary-mark-as-read-forward t]
2669 ["Mark same subject and select"
2670 gnus-summary-kill-same-subject-and-select t]
2671 ["Mark same subject" gnus-summary-kill-same-subject t]
2672 ["Catchup" gnus-summary-catchup
2673 ,@(if (featurep 'xemacs) '(t)
2674 '(:help "Mark unread articles in this group as read"))]
2675 ["Catchup all" gnus-summary-catchup-all t]
2676 ["Catchup to here" gnus-summary-catchup-to-here t]
2677 ["Catchup from here" gnus-summary-catchup-from-here t]
2678 ["Catchup region" gnus-summary-mark-region-as-read
2679 (gnus-mark-active-p)]
2680 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2682 ["Tick" gnus-summary-tick-article-forward t]
2683 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2684 ["Remove marks" gnus-summary-clear-mark-forward t]
2685 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2686 ["Set bookmark" gnus-summary-set-bookmark t]
2687 ["Remove bookmark" gnus-summary-remove-bookmark t])
2689 ["Marks..." gnus-summary-limit-to-marks t]
2690 ["Subject..." gnus-summary-limit-to-subject t]
2691 ["Author..." gnus-summary-limit-to-author t]
2692 ["Recipient..." gnus-summary-limit-to-recipient t]
2693 ["Address..." gnus-summary-limit-to-address t]
2694 ["Age..." gnus-summary-limit-to-age t]
2695 ["Extra..." gnus-summary-limit-to-extra t]
2696 ["Score..." gnus-summary-limit-to-score t]
2697 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2698 ["Unread" gnus-summary-limit-to-unread t]
2699 ["Unseen" gnus-summary-limit-to-unseen t]
2700 ["Singletons" gnus-summary-limit-to-singletons t]
2701 ["Replied" gnus-summary-limit-to-replied t]
2702 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2703 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2704 ["Pop limit" gnus-summary-pop-limit t]
2705 ["Show dormant" gnus-summary-limit-include-dormant t]
2706 ["Hide childless dormant"
2707 gnus-summary-limit-exclude-childless-dormant t]
2708 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2709 ["Hide marked" gnus-summary-limit-exclude-marks t]
2710 ["Show expunged" gnus-summary-limit-include-expunged t])
2712 ["Set mark" gnus-summary-mark-as-processable t]
2713 ["Remove mark" gnus-summary-unmark-as-processable t]
2714 ["Remove all marks" gnus-summary-unmark-all-processable t]
2715 ["Invert marks" gnus-uu-invert-processable t]
2716 ["Mark above" gnus-uu-mark-over t]
2717 ["Mark series" gnus-uu-mark-series t]
2718 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2719 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2720 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2721 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2722 ["Mark all" gnus-uu-mark-all t]
2723 ["Mark buffer" gnus-uu-mark-buffer t]
2724 ["Mark sparse" gnus-uu-mark-sparse t]
2725 ["Mark thread" gnus-uu-mark-thread t]
2726 ["Unmark thread" gnus-uu-unmark-thread t]
2727 ("Process Mark Sets"
2728 ["Kill" gnus-summary-kill-process-mark t]
2729 ["Yank" gnus-summary-yank-process-mark
2730 gnus-newsgroup-process-stack]
2731 ["Save" gnus-summary-save-process-mark t]
2732 ["Run command on marked..." gnus-summary-universal-argument t]))
2735 ["Page forward" gnus-summary-next-page
2736 ,@(if (featurep 'xemacs) '(t)
2737 '(:help "Show next page of article"))]
2738 ["Page backward" gnus-summary-prev-page
2739 ,@(if (featurep 'xemacs) '(t)
2740 '(:help "Show previous page of article"))]
2741 ["Line forward" gnus-summary-scroll-up t])
2743 ["Next unread article" gnus-summary-next-unread-article t]
2744 ["Previous unread article" gnus-summary-prev-unread-article t]
2745 ["Next article" gnus-summary-next-article t]
2746 ["Previous article" gnus-summary-prev-article t]
2747 ["Next unread subject" gnus-summary-next-unread-subject t]
2748 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2749 ["Next article same subject" gnus-summary-next-same-subject t]
2750 ["Previous article same subject" gnus-summary-prev-same-subject t]
2751 ["First unread article" gnus-summary-first-unread-article t]
2752 ["Best unread article" gnus-summary-best-unread-article t]
2753 ["Go to subject number..." gnus-summary-goto-subject t]
2754 ["Go to article number..." gnus-summary-goto-article t]
2755 ["Go to the last article" gnus-summary-goto-last-article t]
2756 ["Pop article off history" gnus-summary-pop-article t])
2758 ["Sort by number" gnus-summary-sort-by-number t]
2759 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2760 ["Sort by author" gnus-summary-sort-by-author t]
2761 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2762 ["Sort by subject" gnus-summary-sort-by-subject t]
2763 ["Sort by date" gnus-summary-sort-by-date t]
2764 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2765 ["Sort by score" gnus-summary-sort-by-score t]
2766 ["Sort by lines" gnus-summary-sort-by-lines t]
2767 ["Sort by characters" gnus-summary-sort-by-chars t]
2768 ["Randomize" gnus-summary-sort-by-random t]
2769 ["Original sort" gnus-summary-sort-by-original t])
2771 ["Describe group" gnus-summary-describe-group t]
2772 ["Read manual" gnus-info-find-node t])
2774 ["Pick and read" gnus-pick-mode t]
2775 ["Binary" gnus-binary-mode t])
2777 ["Regenerate" gnus-summary-prepare t]
2778 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2779 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2780 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2781 ["Toggle threading" gnus-summary-toggle-threads t])
2782 ["See old articles" gnus-summary-insert-old-articles t]
2783 ["See new articles" gnus-summary-insert-new-articles t]
2784 ["Filter articles..." gnus-summary-execute-command t]
2785 ["Run command on articles..." gnus-summary-universal-argument t]
2786 ["Search articles forward..." gnus-summary-search-article-forward t]
2787 ["Search articles backward..." gnus-summary-search-article-backward t]
2788 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2789 ["Expand window" gnus-summary-expand-window t]
2790 ["Expire expirable articles" gnus-summary-expire-articles
2791 (gnus-check-backend-function
2792 'request-expire-articles gnus-newsgroup-name)]
2793 ["Edit local kill file" gnus-summary-edit-local-kill t]
2794 ["Edit main kill file" gnus-summary-edit-global-kill t]
2795 ["Edit group parameters" gnus-summary-edit-parameters t]
2796 ["Customize group parameters" gnus-summary-customize-parameters t]
2797 ["Send a bug report" gnus-bug t]
2799 ["Catchup and exit" gnus-summary-catchup-and-exit
2800 ,@(if (featurep 'xemacs) '(t)
2801 '(:help "Mark unread articles in this group as read, then exit"))]
2802 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2803 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2804 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2805 ["Exit group" gnus-summary-exit
2806 ,@(if (featurep 'xemacs) '(t)
2807 '(:help "Exit current group, return to group selection mode"))]
2808 ["Exit group without updating" gnus-summary-exit-no-update t]
2809 ["Exit and goto next group" gnus-summary-next-group t]
2810 ["Exit and goto prev group" gnus-summary-prev-group t]
2811 ["Reselect group" gnus-summary-reselect-current-group t]
2812 ["Rescan group" gnus-summary-rescan-group t]
2813 ["Update dribble" gnus-summary-save-newsrc t])))
2815 (gnus-run-hooks 'gnus-summary-menu-hook)))
2817 (defvar gnus-summary-tool-bar-map nil)
2819 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2820 ;; affect _new_ message buffers. We might add a function that walks thru all
2821 ;; summary-mode buffers and force the update.
2822 (defun gnus-summary-tool-bar-update (&optional symbol value)
2823 "Update summary mode toolbar.
2824 Setter function for custom variables."
2825 (setq-default gnus-summary-tool-bar-map nil)
2827 ;; When used as ":set" function:
2828 (set-default symbol value))
2829 (when (gnus-buffer-live-p gnus-summary-buffer)
2830 (with-current-buffer gnus-summary-buffer
2831 (gnus-summary-make-tool-bar))))
2833 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2834 'gnus-summary-tool-bar-gnome
2835 'gnus-summary-tool-bar-retro)
2836 "Specifies the Gnus summary tool bar.
2838 It can be either a list or a symbol refering to a list. See
2839 `gmm-tool-bar-from-list' for the format of the list. The
2840 default key map is `gnus-summary-mode-map'.
2842 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2843 `gnus-summary-tool-bar-retro'."
2844 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2845 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2846 (repeat :tag "User defined list" gmm-tool-bar-item)
2848 :version "23.1" ;; No Gnus
2849 :initialize 'custom-initialize-default
2850 :set 'gnus-summary-tool-bar-update
2851 :group 'gnus-summary)
2853 (defcustom gnus-summary-tool-bar-gnome
2854 '((gnus-summary-post-news "mail/compose" nil)
2855 (gnus-summary-insert-new-articles "mail/inbox" nil
2856 :visible (or (not gnus-agent)
2858 (gnus-summary-reply-with-original "mail/reply")
2859 (gnus-summary-reply "mail/reply" nil :visible nil)
2860 (gnus-summary-followup-with-original "mail/reply-all")
2861 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2862 (gnus-summary-mail-forward "mail/forward")
2863 (gnus-summary-save-article "mail/save")
2864 (gnus-summary-search-article-forward "search" nil :visible nil)
2865 (gnus-summary-print-article "print")
2866 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2867 ;; Some new commands that may need more suitable icons:
2868 (gnus-summary-save-newsrc "save" nil :visible nil)
2869 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2870 (gnus-summary-prev-article "left-arrow")
2871 (gnus-summary-next-article "right-arrow")
2872 (gnus-summary-next-page "next-page")
2873 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2875 ;; Maybe some sort-by-... could be added:
2876 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2877 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2878 (gnus-summary-mark-as-expirable
2880 :visible (gnus-check-backend-function 'request-expire-articles
2881 gnus-newsgroup-name))
2882 (gnus-summary-mark-as-spam
2884 :visible (and (fboundp 'spam-group-ham-contents-p)
2885 (spam-group-ham-contents-p gnus-newsgroup-name))
2886 :help "Mark as spam")
2887 (gnus-summary-mark-as-read-forward
2889 :visible (and (fboundp 'spam-group-spam-contents-p)
2890 (spam-group-spam-contents-p gnus-newsgroup-name)))
2892 (gnus-summary-exit "exit")
2893 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2894 (gnus-info-find-node "help"))
2895 "List of functions for the summary tool bar (GNOME style).
2897 See `gmm-tool-bar-from-list' for the format of the list."
2898 :type '(repeat gmm-tool-bar-item)
2899 :version "23.1" ;; No Gnus
2900 :initialize 'custom-initialize-default
2901 :set 'gnus-summary-tool-bar-update
2902 :group 'gnus-summary)
2904 (defcustom gnus-summary-tool-bar-retro
2905 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2906 (gnus-summary-next-unread-article "gnus/next-ur")
2907 (gnus-summary-post-news "gnus/post")
2908 (gnus-summary-followup-with-original "gnus/fuwo")
2909 (gnus-summary-followup "gnus/followup")
2910 (gnus-summary-reply-with-original "gnus/reply-wo")
2911 (gnus-summary-reply "gnus/reply")
2912 (gnus-summary-caesar-message "gnus/rot13")
2913 (gnus-uu-decode-uu "gnus/uu-decode")
2914 (gnus-summary-save-article-file "gnus/save-aif")
2915 (gnus-summary-save-article "gnus/save-art")
2916 (gnus-uu-post-news "gnus/uu-post")
2917 (gnus-summary-catchup "gnus/catchup")
2918 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2919 (gnus-summary-exit "gnus/exit-summ")
2920 ;; Some new command that may need more suitable icons:
2921 (gnus-summary-print-article "gnus/print" nil :visible nil)
2922 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2923 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2924 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2925 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2926 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2927 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2929 (gnus-info-find-node "gnus/help" nil :visible nil))
2930 "List of functions for the summary tool bar (retro look).
2932 See `gmm-tool-bar-from-list' for the format of the list."
2933 :type '(repeat gmm-tool-bar-item)
2934 :version "23.1" ;; No Gnus
2935 :initialize 'custom-initialize-default
2936 :set 'gnus-summary-tool-bar-update
2937 :group 'gnus-summary)
2939 (defcustom gnus-summary-tool-bar-zap-list t
2940 "List of icon items from the global tool bar.
2941 These items are not displayed in the Gnus summary mode tool bar.
2943 See `gmm-tool-bar-from-list' for the format of the list."
2944 :type 'gmm-tool-bar-zap-list
2945 :version "23.1" ;; No Gnus
2946 :initialize 'custom-initialize-default
2947 :set 'gnus-summary-tool-bar-update
2948 :group 'gnus-summary)
2950 (defvar image-load-path)
2951 (defvar tool-bar-map)
2953 (defun gnus-summary-make-tool-bar (&optional force)
2954 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2955 When FORCE, rebuild the tool bar."
2956 (when (and (not (featurep 'xemacs))
2957 (boundp 'tool-bar-mode)
2959 (or (not gnus-summary-tool-bar-map) force))
2961 (gmm-image-load-path-for-library "gnus"
2964 (image-load-path (cons (car load-path)
2965 (when (boundp 'image-load-path)
2967 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2968 gnus-summary-tool-bar-zap-list
2969 'gnus-summary-mode-map)))
2971 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2973 (setq gnus-summary-tool-bar-map map))))
2974 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2976 (defun gnus-score-set-default (var value)
2977 "A version of set that updates the GNU Emacs menu-bar."
2979 ;; It is the message that forces the active status to be updated.
2982 (defun gnus-make-score-map (type)
2983 "Make a summary score map of type TYPE."
2986 (let ((headers '(("author" "from" string)
2987 ("subject" "subject" string)
2988 ("article body" "body" string)
2989 ("article head" "head" string)
2990 ("xref" "xref" string)
2991 ("extra header" "extra" string)
2992 ("lines" "lines" number)
2993 ("followups to author" "followup" string)))
2994 (types '((number ("less than" <)
2997 (string ("substring" s)
3001 (perms '(("temporary" (current-time-string))
3009 (if (eq type 'lower)
3014 (setq header (car headers))
3020 (let ((ts (cdr (assoc (nth 2 header) types)))
3036 'gnus-summary-score-entry
3038 (if (or (string= (nth 1 header)
3040 (string= (nth 1 header)
3043 (list 'gnus-summary-header
3045 (list 'quote (nth 1 (car ts)))
3046 (list 'gnus-score-delta-default
3053 (list (nreverse outp))))
3056 (list (nreverse outt))))
3058 (setq headers (cdr headers)))
3059 (list (nreverse outh))))))))
3062 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3063 (defvar bookmark-make-record-function)
3066 (defun gnus-summary-mode (&optional group)
3067 "Major mode for reading articles.
3069 All normal editing commands are switched off.
3070 \\<gnus-summary-mode-map>
3071 Each line in this buffer represents one article. To read an
3072 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3073 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3076 You can also post articles and send mail from this buffer. To
3077 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3078 of an article, type `\\[gnus-summary-reply]'.
3080 There are approx. one gazillion commands you can execute in this
3081 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3083 The following commands are available:
3085 \\{gnus-summary-mode-map}"
3087 (kill-all-local-variables)
3088 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3089 (gnus-summary-make-local-variables))
3090 (gnus-summary-make-local-variables)
3091 (setq gnus-newsgroup-name group)
3092 (when (gnus-visual-p 'summary-menu 'menu)
3093 (gnus-summary-make-menu-bar)
3094 (gnus-summary-make-tool-bar))
3095 (gnus-make-thread-indent-array)
3096 (gnus-simplify-mode-line)
3097 (setq major-mode 'gnus-summary-mode)
3098 (setq mode-name "Summary")
3099 (use-local-map gnus-summary-mode-map)
3100 (buffer-disable-undo)
3101 (setq buffer-read-only t ;Disable modification
3102 show-trailing-whitespace nil)
3103 (setq truncate-lines t)
3104 (add-to-invisibility-spec '(gnus-sum . t))
3105 (gnus-summary-set-display-table)
3106 (gnus-set-default-directory)
3107 (make-local-variable 'gnus-summary-line-format)
3108 (make-local-variable 'gnus-summary-line-format-spec)
3109 (make-local-variable 'gnus-summary-dummy-line-format)
3110 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3111 (make-local-variable 'gnus-summary-mark-positions)
3112 (gnus-make-local-hook 'pre-command-hook)
3113 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3114 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3115 (turn-on-gnus-mailing-list-mode)
3116 (mm-enable-multibyte)
3117 (set (make-local-variable 'bookmark-make-record-function)
3118 'gnus-summary-bookmark-make-record)
3119 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3120 (gnus-update-summary-mark-positions))
3122 (defun gnus-summary-make-local-variables ()
3123 "Make all the local summary buffer variables."
3125 (dolist (local gnus-summary-local-variables)
3128 (if (eq (cdr local) 'global)
3129 ;; Copy the global value of the variable.
3130 (setq global (symbol-value (car local)))
3131 ;; Use the value from the list.
3132 (setq global (eval (cdr local))))
3133 (set (make-local-variable (car local)) global))
3134 ;; Simple nil-valued local variable.
3135 (set (make-local-variable local) nil)))))
3137 ;; Summary data functions.
3139 (defmacro gnus-data-number (data)
3142 (defmacro gnus-data-set-number (data number)
3143 `(setcar ,data ,number))
3145 (defmacro gnus-data-mark (data)
3148 (defmacro gnus-data-set-mark (data mark)
3149 `(setcar (nthcdr 1 ,data) ,mark))
3151 (defmacro gnus-data-pos (data)
3154 (defmacro gnus-data-set-pos (data pos)
3155 `(setcar (nthcdr 2 ,data) ,pos))
3157 (defmacro gnus-data-header (data)
3160 (defmacro gnus-data-set-header (data header)
3161 `(setf (nth 3 ,data) ,header))
3163 (defmacro gnus-data-level (data)
3166 (defmacro gnus-data-unread-p (data)
3167 `(= (nth 1 ,data) gnus-unread-mark))
3169 (defmacro gnus-data-read-p (data)
3170 `(/= (nth 1 ,data) gnus-unread-mark))
3172 (defmacro gnus-data-pseudo-p (data)
3173 `(consp (nth 3 ,data)))
3175 (defmacro gnus-data-find (number)
3176 `(assq ,number gnus-newsgroup-data))
3178 (defmacro gnus-data-find-list (number &optional data)
3179 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3180 (memq (assq ,number bdata)
3183 (defmacro gnus-data-make (number mark pos header level)
3184 `(list ,number ,mark ,pos ,header ,level))
3186 (defun gnus-data-enter (after-article number mark pos header level offset)
3187 (let ((data (gnus-data-find-list after-article)))
3189 (error "No such article: %d" after-article))
3190 (setcdr data (cons (gnus-data-make number mark pos header level)
3192 (setq gnus-newsgroup-data-reverse nil)
3193 (gnus-data-update-list (cddr data) offset)))
3195 (defun gnus-data-enter-list (after-article list &optional offset)
3197 (let ((data (and after-article (gnus-data-find-list after-article)))
3201 (let ((odata gnus-newsgroup-data))
3202 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3204 (gnus-data-update-list odata offset)))
3205 ;; Find the last element in the list to be spliced into the main
3207 (setq list (last list))
3210 (setcdr list gnus-newsgroup-data)
3211 (setq gnus-newsgroup-data ilist)
3213 (gnus-data-update-list (cdr list) offset)))
3214 (setcdr list (cdr data))
3217 (gnus-data-update-list (cdr list) offset))))
3218 (setq gnus-newsgroup-data-reverse nil))))
3220 (defun gnus-data-remove (article &optional offset)
3221 (let ((data gnus-newsgroup-data))
3222 (if (= (gnus-data-number (car data)) article)
3224 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3225 gnus-newsgroup-data-reverse nil)
3227 (gnus-data-update-list gnus-newsgroup-data offset)))
3229 (when (= (gnus-data-number (cadr data)) article)
3230 (setcdr data (cddr data))
3232 (gnus-data-update-list (cdr data) offset))
3234 gnus-newsgroup-data-reverse nil))
3235 (setq data (cdr data))))))
3237 (defmacro gnus-data-list (backward)
3239 (or gnus-newsgroup-data-reverse
3240 (setq gnus-newsgroup-data-reverse
3241 (reverse gnus-newsgroup-data)))
3242 gnus-newsgroup-data))
3244 (defun gnus-data-update-list (data offset)
3245 "Add OFFSET to the POS of all data entries in DATA."
3246 (setq gnus-newsgroup-data-reverse nil)
3248 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3249 (setq data (cdr data))))
3251 (defun gnus-summary-article-pseudo-p (article)
3252 "Say whether this article is a pseudo article or not."
3253 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3255 (defmacro gnus-summary-article-sparse-p (article)
3256 "Say whether this article is a sparse article or not."
3257 `(memq ,article gnus-newsgroup-sparse))
3259 (defmacro gnus-summary-article-ancient-p (article)
3260 "Say whether this article is a sparse article or not."
3261 `(memq ,article gnus-newsgroup-ancient))
3263 (defun gnus-article-parent-p (number)
3264 "Say whether this article is a parent or not."
3265 (let ((data (gnus-data-find-list number)))
3266 (and (cdr data) ; There has to be an article after...
3267 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3268 (gnus-data-level (nth 1 data))))))
3270 (defun gnus-article-children (number)
3271 "Return a list of all children to NUMBER."
3272 (let* ((data (gnus-data-find-list number))
3273 (level (gnus-data-level (car data)))
3275 (setq data (cdr data))
3277 (= (gnus-data-level (car data)) (1+ level)))
3278 (push (gnus-data-number (car data)) children)
3279 (setq data (cdr data)))
3282 (defmacro gnus-summary-skip-intangible ()
3283 "If the current article is intangible, then jump to a different article."
3284 '(let ((to (get-text-property (point) 'gnus-intangible)))
3285 (and to (gnus-summary-goto-subject to))))
3287 (defmacro gnus-summary-article-intangible-p ()
3288 "Say whether this article is intangible or not."
3289 '(get-text-property (point) 'gnus-intangible))
3291 (defun gnus-article-read-p (article)
3292 "Say whether ARTICLE is read or not."
3293 (not (or (memq article gnus-newsgroup-marked)
3294 (memq article gnus-newsgroup-spam-marked)
3295 (memq article gnus-newsgroup-unreads)
3296 (memq article gnus-newsgroup-unselected)
3297 (memq article gnus-newsgroup-dormant))))
3299 ;; Some summary mode macros.
3301 (defmacro gnus-summary-article-number ()
3302 "The article number of the article on the current line.
3303 If there isn't an article number here, then we return the current
3306 (gnus-summary-skip-intangible)
3307 (or (get-text-property (point) 'gnus-number)
3308 (gnus-summary-last-subject))))
3310 (defmacro gnus-summary-article-header (&optional number)
3311 "Return the header of article NUMBER."
3312 `(gnus-data-header (gnus-data-find
3313 ,(or number '(gnus-summary-article-number)))))
3315 (defmacro gnus-summary-thread-level (&optional number)
3316 "Return the level of thread that starts with article NUMBER."
3317 `(if (and (eq gnus-summary-make-false-root 'dummy)
3318 (get-text-property (point) 'gnus-intangible))
3320 (gnus-data-level (gnus-data-find
3321 ,(or number '(gnus-summary-article-number))))))
3323 (defmacro gnus-summary-article-mark (&optional number)
3324 "Return the mark of article NUMBER."
3325 `(gnus-data-mark (gnus-data-find
3326 ,(or number '(gnus-summary-article-number)))))
3328 (defmacro gnus-summary-article-pos (&optional number)
3329 "Return the position of the line of article NUMBER."
3330 `(gnus-data-pos (gnus-data-find
3331 ,(or number '(gnus-summary-article-number)))))
3333 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3334 (defmacro gnus-summary-article-subject (&optional number)
3335 "Return current subject string or nil if nothing."
3338 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3339 '(gnus-data-header (assq (gnus-summary-article-number)
3340 gnus-newsgroup-data)))))
3343 (mail-header-subject headers))))
3345 (defmacro gnus-summary-article-score (&optional number)
3346 "Return current article score."
3347 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3348 gnus-newsgroup-scored))
3349 gnus-summary-default-score 0))
3351 (defun gnus-summary-article-children (&optional number)
3352 "Return a list of article numbers that are children of article NUMBER."
3353 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3354 (level (gnus-data-level (car data)))
3356 (while (and (setq data (cdr data))
3357 (> (setq l (gnus-data-level (car data))) level))
3358 (and (= (1+ level) l)
3359 (push (gnus-data-number (car data))
3361 (nreverse children)))
3363 (defun gnus-summary-article-parent (&optional number)
3364 "Return the article number of the parent of article NUMBER."
3365 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3366 (gnus-data-list t)))
3367 (level (gnus-data-level (car data))))
3369 () ; This is a root.
3370 ;; We search until we find an article with a level less than
3371 ;; this one. That function has to be the parent.
3372 (while (and (setq data (cdr data))
3373 (not (< (gnus-data-level (car data)) level))))
3374 (and data (gnus-data-number (car data))))))
3376 (defun gnus-unread-mark-p (mark)
3377 "Say whether MARK is the unread mark."
3378 (= mark gnus-unread-mark))
3380 (defun gnus-read-mark-p (mark)
3381 "Say whether MARK is one of the marks that mark as read.
3382 This is all marks except unread, ticked, dormant, and expirable."
3383 (not (or (= mark gnus-unread-mark)
3384 (= mark gnus-ticked-mark)
3385 (= mark gnus-spam-mark)
3386 (= mark gnus-dormant-mark)
3387 (= mark gnus-expirable-mark))))
3389 (defmacro gnus-article-mark (number)
3390 "Return the MARK of article NUMBER.
3391 This macro should only be used when computing the mark the \"first\"
3392 time; i.e., when generating the summary lines. After that,
3393 `gnus-summary-article-mark' should be used to examine the
3396 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3397 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3398 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3399 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3400 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3401 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3402 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3403 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3404 gnus-ancient-mark))))
3406 ;; Saving hidden threads.
3408 (defmacro gnus-save-hidden-threads (&rest forms)
3409 "Save hidden threads, eval FORMS, and restore the hidden threads."
3410 (let ((config (make-symbol "config")))
3411 `(let ((,config (gnus-hidden-threads-configuration)))
3415 (gnus-restore-hidden-threads-configuration ,config)))))
3416 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3417 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3419 (defun gnus-data-compute-positions ()
3420 "Compute the positions of all articles."
3421 (setq gnus-newsgroup-data-reverse nil)
3422 (let ((data gnus-newsgroup-data))
3424 (gnus-save-hidden-threads
3425 (gnus-summary-show-all-threads)
3426 (goto-char (point-min))
3428 (while (get-text-property (point) 'gnus-intangible)
3430 (gnus-data-set-pos (car data) (+ (point) 3))
3431 (setq data (cdr data))
3432 (forward-line 1))))))
3434 (defun gnus-hidden-threads-configuration ()
3435 "Return the current hidden threads configuration."
3438 (goto-char (point-min))
3440 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3441 (push (save-excursion (forward-line 0) (point)) config))
3445 (defun gnus-restore-hidden-threads-configuration (config)
3446 "Restore hidden threads configuration from CONFIG."
3448 (let (point (inhibit-read-only t))
3449 (while (setq point (pop config))
3451 (gnus-summary-hide-thread)))))
3453 ;; Various summary mode internalish functions.
3455 (defun gnus-mouse-pick-article (e)
3458 (gnus-summary-next-page nil t))
3460 (defun gnus-summary-set-display-table ()
3461 "Change the display table.
3462 Odd characters have a tendency to mess
3463 up nicely formatted displays - we make all possible glyphs
3464 display only a single character."
3466 ;; We start from the standard display table, if any.
3467 (let ((table (or (copy-sequence standard-display-table)
3468 (make-display-table)))
3470 ;; Nix out all the control chars...
3471 (while (>= (setq i (1- i)) 0)
3472 (gnus-put-display-table i [??] table))
3473 ;; ... but not newline and cr, of course. (cr is necessary for the
3474 ;; selective display).
3475 (gnus-put-display-table ?\n nil table)
3476 (gnus-put-display-table ?\r nil table)
3477 ;; We keep TAB as well.
3478 (gnus-put-display-table ?\t nil table)
3479 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3480 ;; Emacs 23 (unicode), that are not set already.
3481 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3484 (while (>= (setq i (1- i)) 127)
3485 ;; Only modify if the entry is nil.
3486 (unless (gnus-get-display-table i table)
3487 (gnus-put-display-table i [??] table))))
3488 (setq buffer-display-table table)))
3490 (defun gnus-summary-set-article-display-arrow (pos)
3491 "Update the overlay arrow to point to line at position POS."
3492 (when gnus-summary-display-arrow
3493 (make-local-variable 'overlay-arrow-position)
3494 (make-local-variable 'overlay-arrow-string)
3498 (unless overlay-arrow-position
3499 (setq overlay-arrow-position (make-marker)))
3500 (setq overlay-arrow-string "=>"
3501 overlay-arrow-position (set-marker overlay-arrow-position
3503 (current-buffer))))))
3505 (defun gnus-summary-setup-buffer (group)
3506 "Initialize summary buffer."
3507 (let ((buffer (gnus-summary-buffer-name group))
3508 (dead-name (concat "*Dead Summary "
3509 (gnus-group-decoded-name group) "*")))
3510 ;; If a dead summary buffer exists, we kill it.
3511 (when (gnus-buffer-live-p dead-name)
3512 (gnus-kill-buffer dead-name))
3513 (if (get-buffer buffer)
3516 (setq gnus-summary-buffer (current-buffer))
3517 (not gnus-newsgroup-prepared))
3518 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3519 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3520 (gnus-summary-mode group)
3521 (when (gnus-group-quit-config group)
3522 (set (make-local-variable 'gnus-single-article-buffer) nil))
3523 (make-local-variable 'gnus-article-buffer)
3524 (make-local-variable 'gnus-article-current)
3525 (make-local-variable 'gnus-original-article-buffer)
3526 (setq gnus-newsgroup-name group)
3527 ;; Set any local variables in the group parameters.
3528 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3531 (defun gnus-set-global-variables ()
3532 "Set the global equivalents of the buffer-local variables.
3533 They are set to the latest values they had. These reflect the summary
3534 buffer that was in action when the last article was fetched."
3535 (when (eq major-mode 'gnus-summary-mode)
3536 (setq gnus-summary-buffer (current-buffer))
3537 (let ((name gnus-newsgroup-name)
3538 (marked gnus-newsgroup-marked)
3539 (spam gnus-newsgroup-spam-marked)
3540 (unread gnus-newsgroup-unreads)
3541 (headers gnus-current-headers)
3542 (data gnus-newsgroup-data)
3543 (summary gnus-summary-buffer)
3544 (article-buffer gnus-article-buffer)
3545 (original gnus-original-article-buffer)
3546 (gac gnus-article-current)
3547 (reffed gnus-reffed-article-number)
3548 (score-file gnus-current-score-file)
3549 (default-charset gnus-newsgroup-charset)
3551 (let ((locals gnus-newsgroup-variables))
3553 (if (consp (car locals))
3554 (push (eval (caar locals)) vlist)
3555 (push (eval (car locals)) vlist))
3556 (setq locals (cdr locals)))
3557 (setq vlist (nreverse vlist)))
3558 (with-current-buffer gnus-group-buffer
3559 (setq gnus-newsgroup-name name
3560 gnus-newsgroup-marked marked
3561 gnus-newsgroup-spam-marked spam
3562 gnus-newsgroup-unreads unread
3563 gnus-current-headers headers
3564 gnus-newsgroup-data data
3565 gnus-article-current gac
3566 gnus-summary-buffer summary
3567 gnus-article-buffer article-buffer
3568 gnus-original-article-buffer original
3569 gnus-reffed-article-number reffed
3570 gnus-current-score-file score-file
3571 gnus-newsgroup-charset default-charset)
3572 (let ((locals gnus-newsgroup-variables))
3574 (if (consp (car locals))
3575 (set (caar locals) (pop vlist))
3576 (set (car locals) (pop vlist)))
3577 (setq locals (cdr locals))))
3578 ;; The article buffer also has local variables.
3579 (when (gnus-buffer-live-p gnus-article-buffer)
3580 (set-buffer gnus-article-buffer)
3581 (setq gnus-summary-buffer summary))))))
3583 (defun gnus-summary-article-unread-p (article)
3584 "Say whether ARTICLE is unread or not."
3585 (memq article gnus-newsgroup-unreads))
3587 (defun gnus-summary-first-article-p (&optional article)
3588 "Return whether ARTICLE is the first article in the buffer."
3589 (if (not (setq article (or article (gnus-summary-article-number))))
3591 (eq article (caar gnus-newsgroup-data))))
3593 (defun gnus-summary-last-article-p (&optional article)
3594 "Return whether ARTICLE is the last article in the buffer."
3595 (if (not (setq article (or article (gnus-summary-article-number))))
3596 ;; All non-existent numbers are the last article. :-)
3598 (not (cdr (gnus-data-find-list article)))))
3600 (defun gnus-make-thread-indent-array (&optional n)
3602 (progn (setq n 200) nil)
3603 (null gnus-thread-indent-array)
3604 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3605 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3606 gnus-thread-indent-array-level gnus-thread-indent-level)
3608 (aset gnus-thread-indent-array n
3609 (make-string (* n gnus-thread-indent-level) ? ))
3612 (defun gnus-update-summary-mark-positions ()
3613 "Compute where the summary marks are to go."
3615 (when (gnus-buffer-exists-p gnus-summary-buffer)
3616 (set-buffer gnus-summary-buffer))
3617 (let ((spec gnus-summary-line-format-spec)
3620 (gnus-set-work-buffer)
3621 (let ((gnus-tmp-unread ?Z)
3622 (gnus-replied-mark ?Z)
3623 (gnus-score-below-mark ?Z)
3624 (gnus-score-over-mark ?Z)
3625 (gnus-undownloaded-mark ?Z)
3626 (gnus-summary-line-format-spec spec)
3627 (gnus-newsgroup-downloadable '(0))
3628 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3629 case-fold-search ignores)
3630 ;; Here, all marks are bound to Z.
3631 (gnus-summary-insert-line header
3632 0 nil t gnus-tmp-unread t nil "" nil 1)
3633 (goto-char (point-min))
3634 ;; Memorize the positions of the same characters as dummy marks.
3635 (while (re-search-forward "[A-D]" nil t)
3636 (push (point) ignores))
3638 ;; We use A-D as dummy marks in order to know column positions
3639 ;; where marks should be inserted.
3640 (setq gnus-tmp-unread ?A
3641 gnus-replied-mark ?B
3642 gnus-score-below-mark ?C
3643 gnus-score-over-mark ?C
3644 gnus-undownloaded-mark ?D)
3645 (gnus-summary-insert-line header
3646 0 nil t gnus-tmp-unread t nil "" nil 1)
3647 ;; Ignore characters which aren't dummy marks.
3649 (delete-region (goto-char (1- p)) p)
3651 (goto-char (point-min))
3652 (setq pos (list (cons 'unread
3653 (and (search-forward "A" nil t)
3654 (- (point) (point-min) 1)))))
3655 (goto-char (point-min))
3656 (push (cons 'replied (and (search-forward "B" nil t)
3657 (- (point) (point-min) 1)))
3659 (goto-char (point-min))
3660 (push (cons 'score (and (search-forward "C" nil t)
3661 (- (point) (point-min) 1)))
3663 (goto-char (point-min))
3664 (push (cons 'download (and (search-forward "D" nil t)
3665 (- (point) (point-min) 1)))
3667 (setq gnus-summary-mark-positions pos))))
3669 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3670 "Insert a dummy root in the summary buffer."
3672 (gnus-add-text-properties
3673 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3674 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3676 (defun gnus-summary-extract-address-component (from)
3677 (or (car (funcall gnus-extract-address-components from))
3680 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3681 (let ((mail-parse-charset gnus-newsgroup-charset)
3682 (ignored-from-addresses (gnus-ignored-from-addresses))
3683 ; Is it really necessary to do this next part for each summary line?
3684 ; Luckily, doesn't seem to slow things down much.
3685 (mail-parse-ignored-charsets
3686 (with-current-buffer gnus-summary-buffer
3687 gnus-newsgroup-ignored-charsets)))
3689 (and ignored-from-addresses
3690 (string-match ignored-from-addresses gnus-tmp-from)
3691 (let ((extra-headers (mail-header-extra header))
3695 ((setq to (cdr (assq 'To extra-headers)))
3696 (concat gnus-summary-to-prefix
3698 (gnus-summary-extract-address-component
3699 (funcall gnus-decode-encoded-address-function to)))))
3702 (cdr (assq 'Newsgroups extra-headers))
3704 (memq 'Newsgroups gnus-extra-headers)
3705 (eq (car (gnus-find-method-for-group
3706 gnus-newsgroup-name)) 'nntp)
3707 (gnus-group-real-name gnus-newsgroup-name))))
3708 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3709 (gnus-string-mark-left-to-right
3711 (gnus-summary-extract-address-component gnus-tmp-from))))))
3713 (defun gnus-summary-insert-line (gnus-tmp-header
3714 gnus-tmp-level gnus-tmp-current
3715 undownloaded gnus-tmp-unread gnus-tmp-replied
3716 gnus-tmp-expirable gnus-tmp-subject-or-nil
3717 &optional gnus-tmp-dummy gnus-tmp-score
3719 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3720 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3722 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3723 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3724 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3725 (gnus-tmp-score-char
3726 (if (or (null gnus-summary-default-score)
3727 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3728 gnus-summary-zcore-fuzz))
3730 (if (< gnus-tmp-score gnus-summary-default-score)
3731 gnus-score-below-mark gnus-score-over-mark)))
3732 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3734 (cond (gnus-tmp-process gnus-process-mark)
3735 ((memq gnus-tmp-current gnus-newsgroup-cached)
3737 (gnus-tmp-replied gnus-replied-mark)
3738 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3739 gnus-forwarded-mark)
3740 ((memq gnus-tmp-current gnus-newsgroup-saved)
3742 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3745 (gnus-tmp-downloaded
3747 gnus-undownloaded-mark)
3748 (gnus-newsgroup-agentized
3749 gnus-downloaded-mark)
3752 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3755 ((string-match "<[^>]+> *$" gnus-tmp-from)
3756 (let ((beg (match-beginning 0)))
3757 (or (and (string-match "^\".+\"" gnus-tmp-from)
3758 (substring gnus-tmp-from 1 (1- (match-end 0))))
3759 (substring gnus-tmp-from 0 beg))))
3760 ((string-match "(.+)" gnus-tmp-from)
3761 (substring gnus-tmp-from
3762 (1+ (match-beginning 0)) (1- (match-end 0))))
3764 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3765 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3766 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3767 (inhibit-read-only t))
3768 (when (string= gnus-tmp-name "")
3769 (setq gnus-tmp-name gnus-tmp-from))
3770 (unless (numberp gnus-tmp-lines)
3771 (setq gnus-tmp-lines -1))
3772 (if (= gnus-tmp-lines -1)
3773 (setq gnus-tmp-lines "?")
3774 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3776 (gnus-put-text-property
3778 (progn (eval gnus-summary-line-format-spec) (point))
3779 'gnus-number gnus-tmp-number)
3780 (error (gnus-message 5 "Error updating the summary line")))
3781 (when (gnus-visual-p 'summary-highlight 'highlight)
3783 (gnus-summary-highlight-line)
3784 (gnus-run-hooks 'gnus-summary-update-hook)
3787 (defun gnus-summary-update-line (&optional dont-update)
3788 "Update summary line after change."
3789 (when (and gnus-summary-default-score
3790 (not gnus-summary-inhibit-highlight))
3791 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3792 (article (gnus-summary-article-number))
3793 (score (gnus-summary-article-score article)))
3795 (if (and gnus-summary-mark-below
3796 (< (gnus-summary-article-score)
3797 gnus-summary-mark-below))
3798 ;; This article has a low score, so we mark it as read.
3799 (when (memq article gnus-newsgroup-unreads)
3800 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3801 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3802 ;; This article was previously marked as read on account
3803 ;; of a low score, but now it has risen, so we mark it as
3805 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3806 (gnus-summary-update-mark
3807 (if (or (null gnus-summary-default-score)
3808 (<= (abs (- score gnus-summary-default-score))
3809 gnus-summary-zcore-fuzz))
3811 (if (< score gnus-summary-default-score)
3812 gnus-score-below-mark gnus-score-over-mark))
3814 ;; Do visual highlighting.
3815 (when (gnus-visual-p 'summary-highlight 'highlight)
3816 (gnus-summary-highlight-line)
3817 (gnus-run-hooks 'gnus-summary-update-hook)))))
3819 (defvar gnus-tmp-new-adopts nil)
3821 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3822 "Return the number of articles in THREAD.
3823 This may be 0 in some cases -- if none of the articles in
3824 the thread are to be displayed."
3826 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3828 ((not (listp thread))
3830 ((and (consp thread) (cdr thread))
3833 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3836 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3839 (when (and level (zerop level) gnus-tmp-new-adopts)
3842 'gnus-summary-number-of-articles-in-thread
3843 gnus-tmp-new-adopts))))
3845 (if (> number 1) gnus-not-empty-thread-mark
3846 gnus-empty-thread-mark)
3849 (defsubst gnus-summary-line-message-size (head)
3850 "Return pretty-printed version of message size.
3851 This function is intended to be used in
3852 `gnus-summary-line-format-alist'."
3853 (let ((c (or (mail-header-chars head) -1)))
3854 (cond ((< c 0) "n/a") ; chars not available
3855 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3856 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3857 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3858 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3860 (defcustom gnus-user-date-format-alist
3861 '(((gnus-seconds-today) . "Today, %H:%M")
3862 ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M")
3863 (604800 . "%A %H:%M") ; That's one week
3864 ((gnus-seconds-month) . "%A %d")
3865 ((gnus-seconds-year) . "%B %d")
3866 (t . "%b %d %Y")) ; This one is used when no other
3868 "Specifies date format depending on age of article.
3869 This is an alist of items (AGE . FORMAT). AGE can be a number (of
3870 seconds) or a Lisp expression evaluating to a number. When the age of
3871 the article is less than this number, then use `format-time-string'
3872 with the corresponding FORMAT for displaying the date of the article.
3873 If AGE is not a number or a Lisp expression evaluating to a
3874 non-number, then the corresponding FORMAT is used as a default value.
3876 Note that the list is processed from the beginning, so it should be
3877 sorted by ascending AGE. Also note that items following the first
3878 non-number AGE will be ignored.
3880 You can use the functions `gnus-seconds-today', `gnus-seconds-month'
3881 and `gnus-seconds-year' in the AGE spec. They return the number of
3882 seconds passed since the start of today, of this month, of this year,
3885 :group 'gnus-summary-format
3886 :type '(alist :key-type sexp :value-type string))
3888 (defun gnus-user-date (messy-date)
3889 "Format the messy-date according to `gnus-user-date-format-alist'.
3890 Returns \" ? \" if there's bad input or if another error occurs.
3891 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3893 (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date)))
3894 (now (gnus-float-time))
3895 ;;If we don't find something suitable we'll use this one
3896 (my-format "%b %d '%y"))
3897 (let* ((difference (- now messy-date))
3898 (templist gnus-user-date-format-alist)
3899 (top (eval (caar templist))))
3900 (while (if (numberp top) (< top difference) (not top))
3902 (setq templist (cdr templist))
3903 (setq top (eval (caar templist)))))
3904 (if (stringp (cdr (car templist)))
3905 (setq my-format (cdr (car templist)))))
3906 (format-time-string (eval my-format) (seconds-to-time messy-date)))
3909 (defun gnus-summary-set-local-parameters (group)
3910 "Go through the local params of GROUP and set all variable specs in that list."
3911 (let ((vars '(quit-config active))) ; Ignore things that aren't
3913 (dolist (elem (gnus-group-find-parameter group))
3914 (and (consp elem) ; Has to be a cons.
3915 (consp (cdr elem)) ; The cdr has to be a list.
3916 (symbolp (car elem)) ; Has to be a symbol in there.
3917 (not (memq (car elem) vars))
3919 (push (car elem) vars)
3920 ;; Variables like `gnus-show-threads' that are globally
3921 ;; bound, if used as group parameters, need to get to be
3922 ;; buffer-local, whereas just parameters like `gcc-self',
3923 ;; `timestamp', etc. should not be bound as variables.
3924 (if (boundp (car elem))
3925 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3926 (eval (nth 1 elem))))))))
3928 (defun gnus-summary-read-group (group &optional show-all no-article
3929 kill-buffer no-display backward
3931 "Start reading news in newsgroup GROUP.
3932 If SHOW-ALL is non-nil, already read articles are also listed.
3933 If NO-ARTICLE is non-nil, no article is selected initially.
3934 If NO-DISPLAY, don't generate a summary buffer."
3938 (let ((gnus-auto-select-next nil))
3939 (or (gnus-summary-read-group-1
3940 group show-all no-article
3941 kill-buffer no-display
3944 select-articles nil)))))
3945 (eq gnus-auto-select-next 'quietly))
3946 (set-buffer gnus-group-buffer)
3947 ;; The entry function called above goes to the next
3948 ;; group automatically, so we go two groups back
3949 ;; if we are searching for the previous group.
3951 (gnus-group-prev-unread-group 2))
3952 (if (not (equal group (gnus-group-group-name)))
3953 (setq group (gnus-group-group-name))
3957 (defun gnus-summary-read-group-1 (group show-all no-article
3958 kill-buffer no-display
3959 &optional select-articles)
3960 ;; Killed foreign groups can't be entered.
3961 ;; (when (and (not (gnus-group-native-p group))
3962 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3963 ;; (error "Dead non-native groups can't be entered"))
3964 (gnus-message 7 "Retrieving newsgroup: %s..."
3965 (gnus-group-decoded-name group))
3966 (let* ((new-group (gnus-summary-setup-buffer group))
3967 (quit-config (gnus-group-quit-config group))
3968 (did-select (and new-group (gnus-select-newsgroup
3969 group show-all select-articles))))
3971 ;; This summary buffer exists already, so we just select it.
3973 (gnus-set-global-variables)
3975 (gnus-kill-or-deaden-summary kill-buffer))
3976 (gnus-configure-windows 'summary 'force)
3977 (gnus-set-mode-line 'summary)
3978 (gnus-summary-position-point)
3981 ;; We couldn't select this group.
3983 (when (and (eq major-mode 'gnus-summary-mode)
3984 (not (equal (current-buffer) kill-buffer)))
3985 (kill-buffer (current-buffer))
3986 (if (not quit-config)
3988 ;; Update the info -- marks might need to be removed,
3990 (gnus-summary-update-info)
3991 (set-buffer gnus-group-buffer)
3992 (gnus-group-jump-to-group group)
3993 (gnus-group-next-unread-group 1))
3994 (gnus-handle-ephemeral-exit quit-config)))
3995 (if (null (gnus-list-of-unread-articles group))
3996 (gnus-message 3 "Group %s contains no messages" group)
3997 (gnus-message 3 "Can't select group"))
3999 ;; The user did a `C-g' while prompting for number of articles,
4000 ;; so we exit this group.
4001 ((eq did-select 'quit)
4002 (and (eq major-mode 'gnus-summary-mode)
4003 (not (equal (current-buffer) kill-buffer))
4004 (kill-buffer (current-buffer)))
4006 (gnus-kill-or-deaden-summary kill-buffer))
4007 (if (not quit-config)
4009 (set-buffer gnus-group-buffer)
4010 (gnus-group-jump-to-group group)
4011 (gnus-configure-windows 'group 'force))
4012 (gnus-handle-ephemeral-exit quit-config))
4013 ;; Finally signal the quit.
4015 ;; The group was successfully selected.
4017 (gnus-set-global-variables)
4018 ;; Save the active value in effect when the group was entered.
4019 (setq gnus-newsgroup-active
4021 (gnus-active gnus-newsgroup-name)))
4022 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
4023 ;; You can change the summary buffer in some way with this hook.
4024 (gnus-run-hooks 'gnus-select-group-hook)
4025 (when (memq 'summary (gnus-update-format-specifications
4026 nil 'summary 'summary-mode 'summary-dummy))
4027 ;; The format specification for the summary line was updated,
4028 ;; so we need to update the mark positions as well.
4029 (gnus-update-summary-mark-positions))
4030 ;; Do score processing.
4031 (when gnus-use-scoring
4032 (gnus-possibly-score-headers))
4033 ;; Check whether to fill in the gaps in the threads.
4034 (when gnus-build-sparse-threads
4035 (gnus-build-sparse-threads))
4036 ;; Find the initial limit.
4038 (let ((gnus-newsgroup-dormant nil))
4039 (gnus-summary-initial-limit show-all))
4040 (gnus-summary-initial-limit show-all))
4041 ;; Generate the summary buffer.
4043 (gnus-summary-prepare))
4044 (when gnus-use-trees
4045 (gnus-tree-open group)
4046 (setq gnus-summary-highlight-line-function
4047 'gnus-tree-highlight-article))
4048 ;; If the summary buffer is empty, but there are some low-scored
4049 ;; articles or some excluded dormants, we include these in the
4051 (when (and (zerop (buffer-size))
4053 (cond (gnus-newsgroup-dormant
4054 (gnus-summary-limit-include-dormant))
4055 ((and gnus-newsgroup-scored show-all)
4056 (gnus-summary-limit-include-expunged t))))
4057 ;; Function `gnus-apply-kill-file' must be called in this hook.
4058 (gnus-run-hooks 'gnus-apply-kill-hook)
4059 (if (and (zerop (buffer-size))
4062 ;; This newsgroup is empty.
4063 (gnus-summary-catchup-and-exit nil t)
4064 (gnus-message 6 "No unread news")
4066 (gnus-kill-or-deaden-summary kill-buffer))
4067 ;; Return nil from this function.
4069 ;; Hide conversation thread subtrees. We cannot do this in
4070 ;; gnus-summary-prepare-hook since kill processing may not
4071 ;; work with hidden articles.
4072 (gnus-summary-maybe-hide-threads)
4073 (gnus-configure-windows 'summary)
4075 (gnus-kill-or-deaden-summary kill-buffer))
4076 (gnus-summary-auto-select-subject)
4077 ;; Show first unread article if requested.
4078 (if (and (not no-article)
4080 gnus-newsgroup-unreads
4081 gnus-auto-select-first)
4083 (let ((art (gnus-summary-article-number)))
4084 (unless (and (not gnus-plugged)
4085 (or (memq art gnus-newsgroup-undownloaded)
4086 (memq art gnus-newsgroup-downloadable)))
4087 (gnus-summary-goto-article art))))
4088 ;; Don't select any articles.
4089 (gnus-summary-position-point)
4090 (gnus-configure-windows 'summary 'force)
4091 (gnus-set-mode-line 'summary))
4092 (when (and gnus-auto-center-group
4093 (get-buffer-window gnus-group-buffer t))
4094 ;; Gotta use windows, because recenter does weird stuff if
4095 ;; the current buffer ain't the displayed window.
4096 (let ((owin (selected-window)))
4097 (select-window (get-buffer-window gnus-group-buffer t))
4098 (when (gnus-group-goto-group group)
4100 (select-window owin)))
4101 ;; Mark this buffer as "prepared".
4102 (setq gnus-newsgroup-prepared t)
4103 (gnus-run-hooks 'gnus-summary-prepared-hook)
4104 (unless (gnus-ephemeral-group-p group)
4105 (gnus-group-update-group group nil t))
4108 (defun gnus-summary-auto-select-subject ()
4109 "Select the subject line on initial group entry."
4110 (goto-char (point-min))
4112 ((eq gnus-auto-select-subject 'best)
4113 (gnus-summary-best-unread-subject))
4114 ((eq gnus-auto-select-subject 'unread)
4115 (gnus-summary-first-unread-subject))
4116 ((eq gnus-auto-select-subject 'unseen)
4117 (gnus-summary-first-unseen-subject))
4118 ((eq gnus-auto-select-subject 'unseen-or-unread)
4119 (gnus-summary-first-unseen-or-unread-subject))
4120 ((eq gnus-auto-select-subject 'first)
4123 ((functionp gnus-auto-select-subject)
4124 (funcall gnus-auto-select-subject))))
4126 (defun gnus-summary-prepare ()
4127 "Generate the summary buffer."
4129 (let ((inhibit-read-only t))
4131 (setq gnus-newsgroup-data nil
4132 gnus-newsgroup-data-reverse nil)
4133 (gnus-run-hooks 'gnus-summary-generate-hook)
4134 ;; Generate the buffer, either with threads or without.
4135 (when gnus-newsgroup-headers
4136 (gnus-summary-prepare-threads
4137 (if gnus-show-threads
4138 (gnus-sort-gathered-threads
4139 (funcall gnus-summary-thread-gathering-function
4141 (gnus-cut-threads (gnus-make-threads)))))
4142 ;; Unthreaded display.
4143 (gnus-sort-articles gnus-newsgroup-headers))))
4144 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4145 ;; Call hooks for modifying summary buffer.
4146 (goto-char (point-min))
4147 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4149 (defsubst gnus-general-simplify-subject (subject)
4150 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4153 ;; Truncate the subject.
4154 (gnus-simplify-subject-functions
4155 (gnus-map-function gnus-simplify-subject-functions subject))
4156 ((numberp gnus-summary-gather-subject-limit)
4157 (setq subject (gnus-simplify-subject-re subject))
4158 (if (> (length subject) gnus-summary-gather-subject-limit)
4159 (substring subject 0 gnus-summary-gather-subject-limit)
4161 ;; Fuzzily simplify it.
4162 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4163 (gnus-simplify-subject-fuzzy subject))
4164 ;; Just remove the leading "Re:".
4166 (gnus-simplify-subject-re subject))))
4168 (if (and gnus-summary-gather-exclude-subject
4169 (string-match gnus-summary-gather-exclude-subject subject))
4170 nil ; This article shouldn't be gathered
4173 (defun gnus-summary-simplify-subject-query ()
4174 "Query where the respool algorithm would put this article."
4176 (gnus-summary-select-article)
4177 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4179 (defun gnus-gather-threads-by-subject (threads)
4180 "Gather threads by looking at Subject headers."
4181 (if (not gnus-summary-make-false-root)
4183 (let ((hashtb (gnus-make-hashtable 1024))
4186 subject hthread whole-subject)
4188 (setq subject (gnus-general-simplify-subject
4189 (setq whole-subject (mail-header-subject
4192 (if (setq hthread (gnus-gethash subject hashtb))
4194 ;; We enter a dummy root into the thread, if we
4195 ;; haven't done that already.
4196 (unless (stringp (caar hthread))
4197 (setcar hthread (list whole-subject (car hthread))))
4198 ;; We add this new gathered thread to this gathered
4200 (setcdr (car hthread)
4201 (nconc (cdar hthread) (list (car threads))))
4202 ;; Remove it from the list of threads.
4203 (setcdr prev (cdr threads))
4204 (setq threads prev))
4205 ;; Enter this thread into the hash table.
4206 (gnus-sethash subject
4207 (if gnus-summary-make-false-root-always
4209 ;; If you want a dummy root above all
4211 (setcar threads (list whole-subject
4217 (setq threads (cdr threads)))
4220 (defun gnus-gather-threads-by-references (threads)
4221 "Gather threads by looking at References headers."
4222 (let ((idhashtb (gnus-make-hashtable 1024))
4223 (thhashtb (gnus-make-hashtable 1024))
4226 ids references id gthread gid entered ref)
4228 (when (setq references (mail-header-references (caar threads)))
4229 (setq id (mail-header-id (caar threads))
4230 ids (inline (gnus-split-references references))
4232 (while (setq ref (pop ids))
4233 (setq ids (delete ref ids))
4234 (if (not (setq gid (gnus-gethash ref idhashtb)))
4236 (gnus-sethash ref id idhashtb)
4237 (gnus-sethash id threads thhashtb))
4238 (setq gthread (gnus-gethash gid thhashtb))
4240 ;; We enter a dummy root into the thread, if we
4241 ;; haven't done that already.
4242 (unless (stringp (caar gthread))
4243 (setcar gthread (list (mail-header-subject (caar gthread))
4245 ;; We add this new gathered thread to this gathered
4247 (setcdr (car gthread)
4248 (nconc (cdar gthread) (list (car threads)))))
4249 ;; Add it into the thread hash table.
4250 (gnus-sethash id gthread thhashtb)
4252 ;; Remove it from the list of threads.
4253 (setcdr prev (cdr threads))
4254 (setq threads prev))))
4256 (setq threads (cdr threads)))
4259 (defun gnus-sort-gathered-threads (threads)
4260 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4261 (let ((result threads))
4263 (when (stringp (caar threads))
4264 (setcdr (car threads)
4265 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4266 (setq threads (cdr threads)))
4269 (defun gnus-thread-loop-p (root thread)
4270 "Say whether ROOT is in THREAD."
4271 (let ((stack (list thread))
4274 (while (setq thread (pop stack))
4275 (setq th (cdr thread))
4277 (not (eq (caar th) root)))
4280 ;; We have found a loop.
4282 (setcdr thread (delq (car th) (cdr thread)))
4283 (if (boundp (setq ref-dep (intern "none"
4284 gnus-newsgroup-dependencies)))
4285 (setcdr (symbol-value ref-dep)
4286 (nconc (cdr (symbol-value ref-dep))
4288 (set ref-dep (list nil (car th))))
4291 ;; Push all the subthreads onto the stack.
4292 (push (cdr thread) stack)))
4295 (defun gnus-make-threads ()
4296 "Go through the dependency hashtb and find the roots. Return all threads."
4298 (while (catch 'infloop
4301 ;; Deal with self-referencing References loops.
4302 (when (and (car (symbol-value refs))
4309 (car (symbol-value refs)) thread))
4310 (cdr (symbol-value refs)))))))
4313 (unless (car (symbol-value refs))
4314 ;; These threads do not refer back to any other
4315 ;; articles, so they're roots.
4316 (setq threads (append (cdr (symbol-value refs)) threads))))
4317 gnus-newsgroup-dependencies)))
4320 ;; Build the thread tree.
4321 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4322 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4324 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4325 if it was already present.
4327 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4328 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4329 Message-IDs will be renamed to a unique Message-ID before being
4332 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4333 (let* ((id (mail-header-id header))
4334 (id-dep (and id (intern id dependencies)))
4335 parent-id ref ref-dep ref-header replaced)
4336 ;; Enter this `header' in the `dependencies' table.
4340 ;; The first two cases do the normal part: enter a new `header'
4341 ;; in the `dependencies' table.
4342 ((not (boundp id-dep))
4343 (set id-dep (list header)))
4344 ((null (car (symbol-value id-dep)))
4345 (setcar (symbol-value id-dep) header))
4347 ;; From here the `header' was already present in the
4348 ;; `dependencies' table.
4350 ;; Overrides an existing entry;
4351 ;; just set the header part of the entry.
4352 (setcar (symbol-value id-dep) header)
4355 ;; Renames the existing `header' to a unique Message-ID.
4356 ((not gnus-summary-ignore-duplicates)
4357 ;; An article with this Message-ID has already been seen.
4358 ;; We rename the Message-ID.
4359 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4361 (mail-header-set-id header id))
4363 ;; The last case ignores an existing entry, except it adds any
4364 ;; additional Xrefs (in case the two articles came from different
4366 ;; Also sets `header' to `nil' meaning that the `dependencies'
4367 ;; table was *not* modified.
4369 (mail-header-set-xref
4370 (car (symbol-value id-dep))
4371 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4373 (or (mail-header-xref header) "")))
4376 (when (and header (not replaced))
4377 ;; First check that we are not creating a References loop.
4378 (setq parent-id (gnus-parent-id (mail-header-references header)))
4379 (setq ref parent-id)
4381 (setq ref-dep (intern-soft ref dependencies))
4383 (setq ref-header (car (symbol-value ref-dep))))
4384 (if (string= id ref)
4385 ;; Yuk! This is a reference loop. Make the article be a
4388 (mail-header-set-references (car (symbol-value id-dep)) "none")
4390 (setq parent-id nil))
4391 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4392 (setq ref-dep (intern (or parent-id "none") dependencies))
4393 (if (boundp ref-dep)
4394 (setcdr (symbol-value ref-dep)
4395 (nconc (cdr (symbol-value ref-dep))
4396 (list (symbol-value id-dep))))
4397 (set ref-dep (list nil (symbol-value id-dep)))))
4400 (defun gnus-extract-message-id-from-in-reply-to (string)
4401 (if (string-match "<[^>]+>" string)
4402 (substring string (match-beginning 0) (match-end 0))
4405 (defun gnus-build-sparse-threads ()
4406 (let ((headers gnus-newsgroup-headers)
4407 (mail-parse-charset gnus-newsgroup-charset)
4408 (gnus-summary-ignore-duplicates t)
4409 header references generation relations
4410 subject child end new-child date)
4411 ;; First we create an alist of generations/relations, where
4412 ;; generations is how much we trust the relation, and the relation
4414 (gnus-message 7 "Making sparse threads...")
4416 (nnheader-set-temp-buffer " *gnus sparse threads*")
4417 (while (setq header (pop headers))
4418 (when (and (setq references (mail-header-references header))
4419 (not (string= references "")))
4421 (setq child (mail-header-id header)
4422 subject (mail-header-subject header)
4423 date (mail-header-date header)
4425 (while (search-backward ">" nil t)
4426 (setq end (1+ (point)))
4427 (when (search-backward "<" nil t)
4428 (setq new-child (buffer-substring (point) end))
4429 (push (list (incf generation)
4430 child (setq child new-child)
4434 (push (list (1+ generation) child nil subject) relations))
4436 (kill-buffer (current-buffer)))
4437 ;; Sort over trustworthiness.
4438 (dolist (relation (sort relations 'car-less-than-car))
4439 (when (gnus-dependencies-add-header
4440 (make-full-mail-header
4441 gnus-reffed-article-number
4442 (nth 3 relation) "" (or (nth 4 relation) "")
4444 (or (nth 2 relation) "") 0 0 "")
4445 gnus-newsgroup-dependencies nil)
4446 (push gnus-reffed-article-number gnus-newsgroup-limit)
4447 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4448 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4449 gnus-newsgroup-reads)
4450 (decf gnus-reffed-article-number)))
4451 (gnus-message 7 "Making sparse threads...done")))
4453 (defun gnus-build-old-threads ()
4454 ;; Look at all the articles that refer back to old articles, and
4455 ;; fetch the headers for the articles that aren't there. This will
4456 ;; build complete threads - if the roots haven't been expired by the
4458 (let ((mail-parse-charset gnus-newsgroup-charset)
4462 (when (not (car (symbol-value refs)))
4463 (setq heads (cdr (symbol-value refs)))
4465 (if (memq (mail-header-number (caar heads))
4466 gnus-newsgroup-dormant)
4467 (setq heads (cdr heads))
4468 (setq id (symbol-name refs))
4469 (while (and (setq id (gnus-build-get-header id))
4470 (not (car (gnus-id-to-thread id)))))
4471 (setq heads nil)))))
4472 gnus-newsgroup-dependencies)))
4474 (defsubst gnus-remove-odd-characters (string)
4475 "Translate STRING into something that doesn't contain weird characters."
4476 (mm-subst-char-in-string
4478 (mm-subst-char-in-string ?\n ?\- string t) t))
4480 ;; This function has to be called with point after the article number
4481 ;; on the beginning of the line.
4482 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4483 (let ((eol (point-at-eol))
4484 (buffer (current-buffer))
4485 header references in-reply-to)
4487 ;; overview: [num subject from date id refs chars lines misc]
4490 (narrow-to-region (point) eol)
4495 (make-full-mail-header
4497 (condition-case () ; subject
4498 (gnus-remove-odd-characters
4499 (funcall gnus-decode-encoded-word-function
4500 (setq x (nnheader-nov-field))))
4502 (condition-case () ; from
4503 (gnus-remove-odd-characters
4504 (funcall gnus-decode-encoded-address-function
4505 (setq x (nnheader-nov-field))))
4507 (nnheader-nov-field) ; date
4508 (nnheader-nov-read-message-id number) ; id
4509 (setq references (nnheader-nov-field)) ; refs
4510 (nnheader-nov-read-integer) ; chars
4511 (nnheader-nov-read-integer) ; lines
4513 (if (looking-at "Xref: ")
4514 (goto-char (match-end 0)))
4515 (nnheader-nov-field)) ; Xref
4516 (nnheader-nov-parse-extra)))) ; extra
4520 (when (and (string= references "")
4521 (setq in-reply-to (mail-header-extra header))
4522 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4523 (mail-header-set-references
4524 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4526 (when gnus-alter-header-function
4527 (funcall gnus-alter-header-function header))
4528 (gnus-dependencies-add-header header dependencies force-new)))
4530 (defun gnus-build-get-header (id)
4531 "Look through the buffer of NOV lines and find the header to ID.
4532 Enter this line into the dependencies hash table, and return
4533 the id of the parent article (if any)."
4534 (let ((deps gnus-newsgroup-dependencies)
4537 (with-current-buffer nntp-server-buffer
4538 (let ((case-fold-search nil))
4539 (goto-char (point-min))
4540 (while (and (not found)
4541 (search-forward id nil t))
4543 (setq found (looking-at
4544 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4545 (regexp-quote id))))
4546 (or found (beginning-of-line 2)))
4550 (setq header (gnus-nov-parse-line
4551 (read (current-buffer)) deps))
4552 (gnus-parent-id (mail-header-references header))))))
4554 (let ((number (mail-header-number header)))
4555 (push number gnus-newsgroup-limit)
4556 (push header gnus-newsgroup-headers)
4557 (if (memq number gnus-newsgroup-unselected)
4559 (setq gnus-newsgroup-unreads
4560 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4562 (setq gnus-newsgroup-unselected
4563 (delq number gnus-newsgroup-unselected)))
4564 (push number gnus-newsgroup-ancient)))))))
4566 (defun gnus-build-all-threads ()
4567 "Read all the headers."
4568 (let ((gnus-summary-ignore-duplicates t)
4569 (mail-parse-charset gnus-newsgroup-charset)
4570 (dependencies gnus-newsgroup-dependencies)
4572 (with-current-buffer nntp-server-buffer
4573 (let ((case-fold-search nil))
4574 (goto-char (point-min))
4577 (setq article (read (current-buffer))
4578 header (gnus-nov-parse-line article dependencies t)))
4580 (with-current-buffer gnus-summary-buffer
4581 (push header gnus-newsgroup-headers)
4582 (if (memq (setq article (mail-header-number header))
4583 gnus-newsgroup-unselected)
4585 (setq gnus-newsgroup-unreads
4586 (gnus-add-to-sorted-list
4587 gnus-newsgroup-unreads article))
4588 (setq gnus-newsgroup-unselected
4589 (delq article gnus-newsgroup-unselected)))
4590 (push article gnus-newsgroup-ancient)))
4591 (forward-line 1)))))))
4593 (defun gnus-summary-update-article-line (article header)
4594 "Update the line for ARTICLE using HEADER."
4595 (let* ((id (mail-header-id header))
4596 (thread (gnus-id-to-thread id)))
4598 (error "Article in no thread"))
4599 ;; Update the thread.
4600 (setcar thread header)
4601 (gnus-summary-goto-subject article)
4602 (let* ((datal (gnus-data-find-list article))
4604 (inhibit-read-only t)
4605 (level (gnus-summary-thread-level)))
4607 (let ((inserted (- (point)
4609 (gnus-summary-insert-line
4611 (memq article gnus-newsgroup-undownloaded)
4612 (gnus-article-mark article)
4613 (memq article gnus-newsgroup-replied)
4614 (memq article gnus-newsgroup-expirable)
4615 ;; Only insert the Subject string when it's different
4616 ;; from the previous Subject string.
4621 (mail-header-subject
4624 (gnus-data-find-list
4626 (gnus-data-list t)))))
4627 ;; Error on the side of excessive subjects.
4629 (mail-header-subject header)))
4631 (mail-header-subject header))
4632 nil (cdr (assq article gnus-newsgroup-scored))
4633 (memq article gnus-newsgroup-processable))
4636 (gnus-data-update-list
4638 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4640 (defun gnus-summary-update-article (article &optional iheader)
4641 "Update ARTICLE in the summary buffer."
4642 (set-buffer gnus-summary-buffer)
4643 (let* ((header (gnus-summary-article-header article))
4644 (id (mail-header-id header))
4645 (data (gnus-data-find article))
4646 (thread (gnus-id-to-thread id))
4647 (references (mail-header-references header))
4651 (when (and references
4652 (not (equal "" references)))
4655 (inhibit-read-only t)
4661 (delq thread parent)))
4662 (if (gnus-summary-insert-subject id header)
4663 ;; Set the (possibly) new article number in the data structure.
4664 (gnus-data-set-number data (gnus-id-to-article id))
4668 (defun gnus-rebuild-thread (id &optional line)
4669 "Rebuild the thread containing ID.
4670 If LINE, insert the rebuilt thread starting on line LINE."
4671 (let ((inhibit-read-only t)
4672 old-pos current thread data)
4673 (if (not gnus-show-threads)
4674 (setq thread (list (car (gnus-id-to-thread id))))
4675 ;; Get the thread this article is part of.
4676 (setq thread (gnus-remove-thread id)))
4677 (setq old-pos (point-at-bol))
4678 (setq current (save-excursion
4679 (and (re-search-backward "[\r\n]" nil t)
4680 (gnus-summary-article-number))))
4681 ;; If this is a gathered thread, we have to go some re-gathering.
4682 (when (stringp (car thread))
4683 (let ((subject (car thread))
4685 (setq thread (cdr thread))
4687 (unless (memq (setq thr (gnus-id-to-thread
4689 (mail-header-id (caar thread)))))
4692 (setq thread (cdr thread)))
4693 ;; We now have all (unique) roots.
4694 (if (= (length roots) 1)
4695 ;; All the loose roots are now one solid root.
4696 (setq thread (car roots))
4697 (setq thread (cons subject (gnus-sort-threads roots))))))
4699 ;; We then insert this thread into the summary buffer.
4701 (goto-char (point-min))
4702 (forward-line (1- line)))
4703 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4704 (if gnus-show-threads
4705 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4706 (gnus-summary-prepare-unthreaded thread))
4707 (setq data (nreverse gnus-newsgroup-data))
4708 (setq threads gnus-newsgroup-threads))
4709 ;; We splice the new data into the data structure.
4710 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4711 ;;!!! then we want to insert at the beginning of the buffer.
4712 ;;!!! That happens to be true with Gnus now, but that may
4713 ;;!!! change in the future. Perhaps.
4714 (gnus-data-enter-list
4715 (if line nil current) data (- (point) old-pos))
4716 (setq gnus-newsgroup-threads
4717 (nconc threads gnus-newsgroup-threads))
4718 (gnus-data-compute-positions))))
4720 (defun gnus-number-to-header (number)
4721 "Return the header for article NUMBER."
4722 (let ((headers gnus-newsgroup-headers))
4724 (not (= number (mail-header-number (car headers)))))
4729 (defun gnus-parent-headers (in-headers &optional generation)
4730 "Return the headers of the GENERATIONth parent of HEADERS."
4732 (setq generation 1))
4734 (headers in-headers)
4737 (not (zerop generation))
4738 (setq references (mail-header-references headers)))
4739 (setq headers (if (and references
4740 (setq parent (gnus-parent-id references)))
4741 (car (gnus-id-to-thread parent))
4744 (and (not (eq headers in-headers))
4747 (defun gnus-id-to-thread (id)
4748 "Return the (sub-)thread where ID appears."
4749 (gnus-gethash id gnus-newsgroup-dependencies))
4751 (defun gnus-id-to-article (id)
4752 "Return the article number of ID."
4753 (let ((thread (gnus-id-to-thread id)))
4756 (mail-header-number (car thread)))))
4758 (defun gnus-id-to-header (id)
4759 "Return the article headers of ID."
4760 (car (gnus-id-to-thread id)))
4762 (defun gnus-article-displayed-root-p (article)
4763 "Say whether ARTICLE is a root(ish) article."
4764 (let ((level (gnus-summary-thread-level article))
4765 (refs (mail-header-references (gnus-summary-article-header article)))
4771 ((null (gnus-parent-id refs)) t)
4773 (null (setq particle (gnus-id-to-article
4774 (gnus-parent-id refs))))
4775 (null (gnus-summary-thread-level particle)))))))
4777 (defun gnus-root-id (id)
4778 "Return the id of the root of the thread where ID appears."
4780 (while (and id (setq prev (car (gnus-id-to-thread id))))
4782 id (gnus-parent-id (mail-header-references prev))))
4785 (defun gnus-articles-in-thread (thread)
4786 "Return the list of articles in THREAD."
4787 (cons (mail-header-number (car thread))
4788 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4790 (defun gnus-remove-thread (id &optional dont-remove)
4791 "Remove the thread that has ID in it."
4792 (let (headers thread last-id)
4793 ;; First go up in this thread until we find the root.
4794 (setq last-id (gnus-root-id id)
4795 headers (message-flatten-list (gnus-id-to-thread last-id)))
4796 ;; We have now found the real root of this thread. It might have
4797 ;; been gathered into some loose thread, so we have to search
4798 ;; through the threads to find the thread we wanted.
4799 (let ((threads gnus-newsgroup-threads)
4802 (setq sub (car threads))
4803 (if (stringp (car sub))
4804 ;; This is a gathered thread, so we look at the roots
4805 ;; below it to find whether this article is in this
4808 (setq sub (cdr sub))
4810 (when (member (caar sub) headers)
4811 (setq thread (car threads)
4814 (setq sub (cdr sub))))
4815 ;; It's an ordinary thread, so we check it.
4816 (when (eq (car sub) (car headers))
4819 (setq threads (cdr threads)))
4820 ;; If this article is in no thread, then it's a root.
4823 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4824 (setq thread (gnus-id-to-thread last-id)))
4827 thread ; We return this thread.
4829 (if (stringp (car thread))
4831 ;; If we use dummy roots, then we have to remove the
4832 ;; dummy root as well.
4833 (when (eq gnus-summary-make-false-root 'dummy)
4834 ;; We go to the dummy root by going to
4835 ;; the first sub-"thread", and then one line up.
4836 (gnus-summary-goto-article
4837 (mail-header-number (caadr thread)))
4840 (gnus-data-compute-positions))
4841 (setq thread (cdr thread))
4843 (gnus-remove-thread-1 (car thread))
4844 (setq thread (cdr thread))))
4845 (gnus-remove-thread-1 thread))))))))
4847 (defun gnus-remove-thread-1 (thread)
4848 "Remove the thread THREAD recursively."
4849 (let ((number (mail-header-number (pop thread)))
4851 (setq thread (reverse thread))
4853 (gnus-remove-thread-1 (pop thread)))
4854 (when (setq d (gnus-data-find number))
4855 (goto-char (gnus-data-pos d))
4856 (gnus-summary-show-thread)
4862 (gnus-delete-line)))))))
4864 (defun gnus-sort-threads-recursive (threads func)
4865 (sort (mapcar (lambda (thread)
4868 (gnus-sort-threads-recursive (cdr thread) func))))
4871 (defun gnus-sort-threads-loop (threads func)
4872 (let* ((superthread (cons nil threads))
4873 (stack (list (cons superthread threads)))
4874 remaining-threads thread)
4876 (setq remaining-threads (cdr (car stack)))
4877 (if remaining-threads
4878 (progn (setq thread (car remaining-threads))
4879 (setcdr (car stack) (cdr remaining-threads))
4881 (push (cons thread (cdr thread)) stack)))
4882 (setq thread (caar stack))
4883 (setcdr thread (sort (cdr thread) func))
4887 (defun gnus-sort-threads (threads)
4889 (if (not gnus-thread-sort-functions)
4891 (gnus-message 8 "Sorting threads...")
4894 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4895 (gnus-sort-threads-recursive
4896 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4897 ;; Even after binding max-lisp-eval-depth, the recursive
4898 ;; sorter might fail for very long threads. In that case,
4899 ;; try using a (less well-tested) non-recursive sorter.
4900 (error (gnus-message 9 "Sorting threads with loop...")
4901 (gnus-sort-threads-loop
4902 threads (gnus-make-sort-function
4903 gnus-thread-sort-functions))))
4904 (gnus-message 8 "Sorting threads...done"))))
4906 (defun gnus-sort-articles (articles)
4908 (when gnus-article-sort-functions
4909 (gnus-message 7 "Sorting articles...")
4911 (setq gnus-newsgroup-headers
4912 (sort articles (gnus-make-sort-function
4913 gnus-article-sort-functions)))
4914 (gnus-message 7 "Sorting articles...done"))))
4916 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4917 (defmacro gnus-thread-header (thread)
4918 "Return header of first article in THREAD.
4919 Note that THREAD must never, ever be anything else than a variable -
4920 using some other form will lead to serious barfage."
4921 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4922 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4923 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4926 (defsubst gnus-article-sort-by-number (h1 h2)
4927 "Sort articles by article number."
4928 (< (mail-header-number h1)
4929 (mail-header-number h2)))
4931 (defun gnus-thread-sort-by-number (h1 h2)
4932 "Sort threads by root article number."
4933 (gnus-article-sort-by-number
4934 (gnus-thread-header h1) (gnus-thread-header h2)))
4936 (defsubst gnus-article-sort-by-random (h1 h2)
4937 "Sort articles randomly."
4940 (defun gnus-thread-sort-by-random (h1 h2)
4941 "Sort threads randomly."
4942 (gnus-article-sort-by-random
4943 (gnus-thread-header h1) (gnus-thread-header h2)))
4945 (defsubst gnus-article-sort-by-lines (h1 h2)
4946 "Sort articles by article Lines header."
4947 (< (mail-header-lines h1)
4948 (mail-header-lines h2)))
4950 (defun gnus-thread-sort-by-lines (h1 h2)
4951 "Sort threads by root article Lines header."
4952 (gnus-article-sort-by-lines
4953 (gnus-thread-header h1) (gnus-thread-header h2)))
4955 (defsubst gnus-article-sort-by-chars (h1 h2)
4956 "Sort articles by octet length."
4957 (< (mail-header-chars h1)
4958 (mail-header-chars h2)))
4960 (defun gnus-thread-sort-by-chars (h1 h2)
4961 "Sort threads by root article octet length."
4962 (gnus-article-sort-by-chars
4963 (gnus-thread-header h1) (gnus-thread-header h2)))
4965 (defsubst gnus-article-sort-by-author (h1 h2)
4966 "Sort articles by root author."
4968 (let ((extract (funcall
4969 gnus-extract-address-components
4970 (mail-header-from h1))))
4971 (or (car extract) (cadr extract) ""))
4972 (let ((extract (funcall
4973 gnus-extract-address-components
4974 (mail-header-from h2))))
4975 (or (car extract) (cadr extract) ""))))
4977 (defun gnus-thread-sort-by-author (h1 h2)
4978 "Sort threads by root author."
4979 (gnus-article-sort-by-author
4980 (gnus-thread-header h1) (gnus-thread-header h2)))
4982 (defsubst gnus-article-sort-by-recipient (h1 h2)
4983 "Sort articles by recipient."
4985 (let ((extract (funcall
4986 gnus-extract-address-components
4987 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4988 (or (car extract) (cadr extract)))
4989 (let ((extract (funcall
4990 gnus-extract-address-components
4991 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4992 (or (car extract) (cadr extract)))))
4994 (defun gnus-thread-sort-by-recipient (h1 h2)
4995 "Sort threads by root recipient."
4996 (gnus-article-sort-by-recipient
4997 (gnus-thread-header h1) (gnus-thread-header h2)))
4999 (defsubst gnus-article-sort-by-subject (h1 h2)
5000 "Sort articles by root subject."
5002 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
5003 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
5005 (defun gnus-thread-sort-by-subject (h1 h2)
5006 "Sort threads by root subject."
5007 (gnus-article-sort-by-subject
5008 (gnus-thread-header h1) (gnus-thread-header h2)))
5010 (defsubst gnus-article-sort-by-date (h1 h2)
5011 "Sort articles by root article date."
5013 (gnus-date-get-time (mail-header-date h1))
5014 (gnus-date-get-time (mail-header-date h2))))
5016 (defun gnus-thread-sort-by-date (h1 h2)
5017 "Sort threads by root article date."
5018 (gnus-article-sort-by-date
5019 (gnus-thread-header h1) (gnus-thread-header h2)))
5021 (defsubst gnus-article-sort-by-score (h1 h2)
5022 "Sort articles by root article score.
5023 Unscored articles will be counted as having a score of zero."
5024 (> (or (cdr (assq (mail-header-number h1)
5025 gnus-newsgroup-scored))
5026 gnus-summary-default-score 0)
5027 (or (cdr (assq (mail-header-number h2)
5028 gnus-newsgroup-scored))
5029 gnus-summary-default-score 0)))
5031 (defun gnus-thread-sort-by-score (h1 h2)
5032 "Sort threads by root article score."
5033 (gnus-article-sort-by-score
5034 (gnus-thread-header h1) (gnus-thread-header h2)))
5036 (defun gnus-thread-sort-by-total-score (h1 h2)
5037 "Sort threads by the sum of all scores in the thread.
5038 Unscored articles will be counted as having a score of zero."
5039 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
5041 (defun gnus-thread-total-score (thread)
5042 ;; This function find the total score of THREAD.
5047 (if (stringp (car thread))
5048 (apply gnus-thread-score-function 0
5049 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
5050 (gnus-thread-total-score-1 thread)))
5052 (gnus-thread-total-score-1 (list thread)))))
5054 (defun gnus-article-sort-by-most-recent-number (h1 h2)
5055 "Sort articles by number."
5056 (gnus-article-sort-by-number h1 h2))
5058 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
5059 "Sort threads such that the thread with the most recently arrived article comes first."
5060 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5062 (defun gnus-thread-highest-number (thread)
5063 "Return the highest article number in THREAD."
5064 (apply 'max (mapcar (lambda (header)
5065 (mail-header-number header))
5066 (message-flatten-list thread))))
5068 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5069 "Sort articles by number."
5070 (gnus-article-sort-by-date h1 h2))
5072 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5073 "Sort threads such that the thread with the most recently dated article comes first."
5074 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5076 ; Since this is called not only to sort the top-level threads, but
5077 ; also in recursive sorts to order the articles within a thread, each
5078 ; article will be processed many times. Thus it speeds things up
5079 ; quite a bit to use gnus-date-get-time, which caches the time value.
5080 (defun gnus-thread-latest-date (thread)
5081 "Return the highest article date in THREAD."
5083 (mapcar (lambda (header) (gnus-float-time
5085 (mail-header-date header))))
5086 (message-flatten-list thread))))
5088 (defun gnus-thread-total-score-1 (root)
5089 ;; This function find the total score of the thread below ROOT.
5090 (setq root (car root))
5091 (apply gnus-thread-score-function
5093 (mapcar 'gnus-thread-total-score
5094 (cdr (gnus-id-to-thread (mail-header-id root))))
5095 (when (> (mail-header-number root) 0)
5096 (list (or (cdr (assq (mail-header-number root)
5097 gnus-newsgroup-scored))
5098 gnus-summary-default-score 0))))
5099 (list gnus-summary-default-score)
5102 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5103 (defvar gnus-tmp-prev-subject nil)
5104 (defvar gnus-tmp-false-parent nil)
5105 (defvar gnus-tmp-root-expunged nil)
5106 (defvar gnus-tmp-dummy-line nil)
5108 (defun gnus-extra-header (type &optional header)
5109 "Return the extra header of TYPE."
5110 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5113 (defvar gnus-tmp-thread-tree-header-string "")
5115 (defcustom gnus-sum-thread-tree-root "> "
5116 "With %B spec, used for the root of a thread.
5117 If nil, use subject instead."
5119 :type '(radio (const :format "%v " nil) string)
5120 :group 'gnus-thread)
5122 (defcustom gnus-sum-thread-tree-false-root "> "
5123 "With %B spec, used for a false root of a thread.
5124 If nil, use subject instead."
5126 :type '(radio (const :format "%v " nil) string)
5127 :group 'gnus-thread)
5129 (defcustom gnus-sum-thread-tree-single-indent ""
5130 "With %B spec, used for a thread with just one message.
5131 If nil, use subject instead."
5133 :type '(radio (const :format "%v " nil) string)
5134 :group 'gnus-thread)
5136 (defcustom gnus-sum-thread-tree-vertical "| "
5137 "With %B spec, used for drawing a vertical line."
5140 :group 'gnus-thread)
5142 (defcustom gnus-sum-thread-tree-indent " "
5143 "With %B spec, used for indenting."
5146 :group 'gnus-thread)
5148 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5149 "With %B spec, used for a leaf with brothers."
5152 :group 'gnus-thread)
5154 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5155 "With %B spec, used for a leaf without brothers."
5158 :group 'gnus-thread)
5160 (defcustom gnus-summary-display-while-building nil
5161 "If non-nil, show and update the summary buffer as it's being built.
5162 If the value is t, update the buffer after every line is inserted. If
5163 the value is an integer (N), update the display every N lines."
5166 :type '(choice (const :tag "off" nil)
5168 (const :tag "frequently" t)))
5170 (defun gnus-summary-prepare-threads (threads)
5171 "Prepare summary buffer from THREADS and indentation LEVEL.
5172 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5173 or a straight list of headers."
5174 (gnus-message 7 "Generating summary...")
5176 (setq gnus-newsgroup-threads threads)
5179 (let ((gnus-tmp-level 0)
5180 (default-score (or gnus-summary-default-score 0))
5181 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5182 (building-line-count gnus-summary-display-while-building)
5183 (building-count (integerp gnus-summary-display-while-building))
5184 thread number subject stack state gnus-tmp-gathered beg-match
5185 new-roots gnus-tmp-new-adopts thread-end simp-subject
5186 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5187 gnus-tmp-replied gnus-tmp-subject-or-nil
5188 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5189 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5190 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5193 (setq gnus-tmp-prev-subject nil
5194 gnus-tmp-thread-tree-header-string "")
5196 (if (vectorp (car threads))
5197 ;; If this is a straight (sic) list of headers, then a
5198 ;; threaded summary display isn't required, so we just create
5199 ;; an unthreaded one.
5200 (gnus-summary-prepare-unthreaded threads)
5202 ;; Do the threaded display.
5204 (if gnus-summary-display-while-building
5205 (switch-to-buffer (buffer-name)))
5206 (while (or threads stack gnus-tmp-new-adopts new-roots)
5208 (if (and (= gnus-tmp-level 0)
5211 (not gnus-tmp-false-parent)
5212 (or gnus-tmp-new-adopts new-roots))
5213 (if gnus-tmp-new-adopts
5214 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5215 thread (list (car gnus-tmp-new-adopts))
5216 gnus-tmp-header (caar thread)
5217 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5219 (setq thread (list (car new-roots))
5220 gnus-tmp-header (caar thread)
5221 new-roots (cdr new-roots))))
5224 ;; If there are some threads, we do them before the
5225 ;; threads on the stack.
5226 (setq thread threads
5227 gnus-tmp-header (caar thread))
5228 ;; There were no current threads, so we pop something off
5230 (setq state (car stack)
5231 gnus-tmp-level (car state)
5232 tree-stack (cadr state)
5233 thread (caddr state)
5235 gnus-tmp-header (caar thread))))
5237 (setq gnus-tmp-false-parent nil)
5238 (setq gnus-tmp-root-expunged nil)
5239 (setq thread-end nil)
5241 (if (stringp gnus-tmp-header)
5242 ;; The header is a dummy root.
5244 ((eq gnus-summary-make-false-root 'adopt)
5245 ;; We let the first article adopt the rest.
5246 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5248 (setq gnus-tmp-gathered
5250 (lambda (h) (mail-header-number (car h)))
5253 (setq thread (cons (list (caar thread)
5256 (setq gnus-tmp-level -1
5257 gnus-tmp-false-parent t))
5258 ((eq gnus-summary-make-false-root 'empty)
5259 ;; We print adopted articles with empty subject fields.
5260 (setq gnus-tmp-gathered
5262 (lambda (h) (mail-header-number (car h)))
5265 (setq gnus-tmp-level -1))
5266 ((eq gnus-summary-make-false-root 'dummy)
5267 ;; We remember that we probably want to output a dummy
5269 (setq gnus-tmp-dummy-line gnus-tmp-header)
5270 (setq gnus-tmp-prev-subject gnus-tmp-header))
5272 ;; We do not make a root for the gathered
5273 ;; sub-threads at all.
5274 (setq gnus-tmp-level -1)))
5276 (setq number (mail-header-number gnus-tmp-header)
5277 subject (mail-header-subject gnus-tmp-header)
5278 simp-subject (gnus-simplify-subject-fully subject))
5281 ;; If the thread has changed subject, we might want to make
5282 ;; this subthread into a root.
5283 ((and (null gnus-thread-ignore-subject)
5284 (not (zerop gnus-tmp-level))
5285 gnus-tmp-prev-subject
5286 (not (string= gnus-tmp-prev-subject simp-subject)))
5287 (setq new-roots (nconc new-roots (list (car thread)))
5289 gnus-tmp-header nil))
5290 ;; If the article lies outside the current limit,
5291 ;; then we do not display it.
5292 ((not (memq number gnus-newsgroup-limit))
5293 (setq gnus-tmp-gathered
5295 (lambda (h) (mail-header-number (car h)))
5298 (setq gnus-tmp-new-adopts (if (cdar thread)
5299 (append gnus-tmp-new-adopts
5301 gnus-tmp-new-adopts)
5303 gnus-tmp-header nil)
5304 (when (zerop gnus-tmp-level)
5305 (setq gnus-tmp-root-expunged t)))
5306 ;; Perhaps this article is to be marked as read?
5307 ((and gnus-summary-mark-below
5308 (< (or (cdr (assq number gnus-newsgroup-scored))
5310 gnus-summary-mark-below)
5311 ;; Don't touch sparse articles.
5312 (not (gnus-summary-article-sparse-p number))
5313 (not (gnus-summary-article-ancient-p number)))
5314 (setq gnus-newsgroup-unreads
5315 (delq number gnus-newsgroup-unreads))
5316 (if gnus-newsgroup-auto-expire
5317 (setq gnus-newsgroup-expirable
5318 (gnus-add-to-sorted-list
5319 gnus-newsgroup-expirable number))
5320 (push (cons number gnus-low-score-mark)
5321 gnus-newsgroup-reads))))
5323 (when gnus-tmp-header
5324 ;; We may have an old dummy line to output before this
5326 (when (and gnus-tmp-dummy-line
5329 (mail-header-subject gnus-tmp-header)))
5330 (gnus-summary-insert-dummy-line
5331 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5332 (setq gnus-tmp-dummy-line nil))
5334 ;; Compute the mark.
5335 (setq gnus-tmp-unread (gnus-article-mark number))
5337 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5338 gnus-tmp-header gnus-tmp-level)
5339 gnus-newsgroup-data)
5341 ;; Actually insert the line.
5343 gnus-tmp-subject-or-nil
5345 ((and gnus-thread-ignore-subject
5346 gnus-tmp-prev-subject
5347 (not (string= gnus-tmp-prev-subject simp-subject)))
5349 ((zerop gnus-tmp-level)
5350 (if (and (eq gnus-summary-make-false-root 'empty)
5351 (memq number gnus-tmp-gathered)
5352 gnus-tmp-prev-subject
5353 (string= gnus-tmp-prev-subject simp-subject))
5354 gnus-summary-same-subject
5356 (t gnus-summary-same-subject)))
5357 (if (and (eq gnus-summary-make-false-root 'adopt)
5358 (= gnus-tmp-level 1)
5359 (memq number gnus-tmp-gathered))
5360 (setq gnus-tmp-opening-bracket ?\<
5361 gnus-tmp-closing-bracket ?\>)
5362 (setq gnus-tmp-opening-bracket ?\[
5363 gnus-tmp-closing-bracket ?\]))
5364 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5365 (gnus-make-thread-indent-array
5366 (max (* 2 (length gnus-thread-indent-array))
5369 gnus-tmp-indentation
5370 (aref gnus-thread-indent-array gnus-tmp-level)
5371 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5372 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5373 gnus-summary-default-score 0)
5375 (if (or (null gnus-summary-default-score)
5376 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5377 gnus-summary-zcore-fuzz))
5379 (if (< gnus-tmp-score gnus-summary-default-score)
5380 gnus-score-below-mark gnus-score-over-mark))
5382 (cond ((memq number gnus-newsgroup-processable)
5384 ((memq number gnus-newsgroup-cached)
5386 ((memq number gnus-newsgroup-replied)
5388 ((memq number gnus-newsgroup-forwarded)
5389 gnus-forwarded-mark)
5390 ((memq number gnus-newsgroup-saved)
5392 ((memq number gnus-newsgroup-unseen)
5396 (cond ((memq number gnus-newsgroup-undownloaded)
5397 gnus-undownloaded-mark)
5398 (gnus-newsgroup-agentized
5399 gnus-downloaded-mark)
5402 gnus-tmp-from (mail-header-from gnus-tmp-header)
5405 ((string-match "<[^>]+> *$" gnus-tmp-from)
5406 (setq beg-match (match-beginning 0))
5407 (or (and (string-match "^\".+\"" gnus-tmp-from)
5408 (substring gnus-tmp-from 1 (1- (match-end 0))))
5409 (substring gnus-tmp-from 0 beg-match)))
5410 ((string-match "(.+)" gnus-tmp-from)
5411 (substring gnus-tmp-from
5412 (1+ (match-beginning 0)) (1- (match-end 0))))
5416 gnus-tmp-thread-tree-header-string
5418 ((not gnus-show-threads) "")
5419 ((zerop gnus-tmp-level)
5420 (cond ((cdar thread)
5421 (or gnus-sum-thread-tree-root subject))
5422 (gnus-tmp-new-adopts
5423 (or gnus-sum-thread-tree-false-root subject))
5425 (or gnus-sum-thread-tree-single-indent subject))))
5427 (concat (apply 'concat
5428 (mapcar (lambda (item)
5430 gnus-sum-thread-tree-vertical
5431 gnus-sum-thread-tree-indent))
5432 (cdr (reverse tree-stack))))
5434 gnus-sum-thread-tree-leaf-with-other
5435 gnus-sum-thread-tree-single-leaf)))))
5436 (when (string= gnus-tmp-name "")
5437 (setq gnus-tmp-name gnus-tmp-from))
5438 (unless (numberp gnus-tmp-lines)
5439 (setq gnus-tmp-lines -1))
5440 (if (= gnus-tmp-lines -1)
5441 (setq gnus-tmp-lines "?")
5442 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5443 (gnus-put-text-property
5445 (progn (eval gnus-summary-line-format-spec) (point))
5446 'gnus-number number)
5449 (gnus-summary-highlight-line)
5450 (when gnus-summary-update-hook
5451 (gnus-run-hooks 'gnus-summary-update-hook))
5454 (setq gnus-tmp-prev-subject simp-subject)))
5456 (when (nth 1 thread)
5457 (push (list (max 0 gnus-tmp-level)
5458 (copy-sequence tree-stack)
5461 (push (if (nth 1 thread) 1 0) tree-stack)
5462 (incf gnus-tmp-level)
5463 (setq threads (if thread-end nil (cdar thread)))
5464 (if gnus-summary-display-while-building
5467 ;; use a set frequency
5468 (setq building-line-count (1- building-line-count))
5469 (when (= building-line-count 0)
5471 (setq building-line-count
5472 gnus-summary-display-while-building)))
5476 (setq gnus-tmp-level 0)))))
5477 (gnus-message 7 "Generating summary...done"))
5479 (defun gnus-summary-prepare-unthreaded (headers)
5480 "Generate an unthreaded summary buffer based on HEADERS."
5481 (let (header number mark)
5486 ;; We may have to root out some bad articles...
5487 (when (memq (setq number (mail-header-number
5488 (setq header (pop headers))))
5489 gnus-newsgroup-limit)
5490 ;; Mark article as read when it has a low score.
5491 (when (and gnus-summary-mark-below
5492 (< (or (cdr (assq number gnus-newsgroup-scored))
5493 gnus-summary-default-score 0)
5494 gnus-summary-mark-below)
5495 (not (gnus-summary-article-ancient-p number)))
5496 (setq gnus-newsgroup-unreads
5497 (delq number gnus-newsgroup-unreads))
5498 (if gnus-newsgroup-auto-expire
5499 (push number gnus-newsgroup-expirable)
5500 (push (cons number gnus-low-score-mark)
5501 gnus-newsgroup-reads)))
5503 (setq mark (gnus-article-mark number))
5504 (push (gnus-data-make number mark (1+ (point)) header 0)
5505 gnus-newsgroup-data)
5506 (gnus-summary-insert-line
5508 (memq number gnus-newsgroup-undownloaded)
5509 mark (memq number gnus-newsgroup-replied)
5510 (memq number gnus-newsgroup-expirable)
5511 (mail-header-subject header) nil
5512 (cdr (assq number gnus-newsgroup-scored))
5513 (memq number gnus-newsgroup-processable))))))
5515 (defun gnus-group-get-list-identifiers (group)
5516 "Get list identifier regexp for GROUP."
5517 (or (gnus-parameter-list-identifier group)
5518 (if (consp gnus-list-identifiers)
5519 (mapconcat 'identity gnus-list-identifiers " *\\|")
5520 gnus-list-identifiers)))
5522 (defun gnus-summary-remove-list-identifiers ()
5523 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5524 (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name))
5527 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5528 (dolist (header gnus-newsgroup-headers)
5529 (setq subject (mail-header-subject header)
5531 (while (string-match regexp subject)
5533 (concat (substring subject 0 (match-beginning 1))
5534 (substring subject (match-end 0)))
5537 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5539 (concat (substring subject 0 (match-beginning 1))
5540 (substring subject (match-end 1)))))
5541 (mail-header-set-subject header subject))))))
5543 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5544 "Fetch headers of ARTICLES."
5545 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5546 (gnus-message 7 "Fetching headers for %s..." name)
5549 (setq gnus-headers-retrieved-by
5550 (gnus-retrieve-headers
5551 articles gnus-newsgroup-name
5553 ;; We might want to fetch old headers, but
5554 ;; not if there is only 1 article.
5556 (not (eq gnus-fetch-old-headers 'some))
5557 (not (numberp gnus-fetch-old-headers)))
5558 (> (length articles) 1))
5559 gnus-fetch-old-headers)))))
5560 (gnus-get-newsgroup-headers-xover
5561 articles force-new dependencies gnus-newsgroup-name t)
5562 (gnus-get-newsgroup-headers dependencies force-new))
5563 (gnus-message 7 "Fetching headers for %s...done" name))))
5565 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5566 "Select newsgroup GROUP.
5567 If READ-ALL is non-nil, all articles in the group are selected.
5568 If SELECT-ARTICLES, only select those articles from GROUP."
5569 (let* ((entry (gnus-group-entry group))
5570 ;;!!! Dirty hack; should be removed.
5571 (gnus-summary-ignore-duplicates
5572 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5574 gnus-summary-ignore-duplicates))
5575 (info (nth 2 entry))
5576 charset articles fetched-articles cached)
5578 (unless (gnus-check-server
5579 (set (make-local-variable 'gnus-current-select-method)
5580 (gnus-find-method-for-group group)))
5581 (error "Couldn't open server"))
5582 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5584 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5585 (gnus-activate-group group) ; Or we can activate it...
5586 (progn ; Or we bug out.
5587 (when (equal major-mode 'gnus-summary-mode)
5588 (gnus-kill-buffer (current-buffer)))
5590 "Couldn't activate group %s: %s"
5591 (mm-decode-coding-string group charset)
5592 (mm-decode-coding-string (gnus-status-message group) charset))))
5594 (unless (gnus-request-group group t)
5595 (when (equal major-mode 'gnus-summary-mode)
5596 (gnus-kill-buffer (current-buffer)))
5597 (error "Couldn't request group %s: %s"
5598 (mm-decode-coding-string group charset)
5599 (mm-decode-coding-string (gnus-status-message group) charset)))
5601 (when (and gnus-agent
5602 (gnus-active group))
5603 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5605 (setq gnus-summary-use-undownloaded-faces
5606 (gnus-agent-find-parameter
5608 'agent-enable-undownloaded-faces)))
5610 (setq gnus-newsgroup-name group
5611 gnus-newsgroup-unselected nil
5612 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5614 (let ((display (gnus-group-find-parameter group 'display)))
5615 (setq gnus-newsgroup-display
5617 ((not (zerop (or (car-safe read-all) 0)))
5618 ;; The user entered the group with C-u SPC/RET, let's show
5624 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5626 ;; The following is probably the "correct" solution, but
5627 ;; it makes Gnus fetch all headers and then limit the
5628 ;; articles (which is slow), so instead we hack the
5629 ;; select-articles parameter instead. -- Simon Josefsson
5632 ;; (gnus-byte-compile
5633 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5635 (setq select-articles
5636 (gnus-uncompress-range
5637 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5641 (cdr (gnus-active group)))))
5646 (gnus-summary-setup-default-charset)
5648 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5649 (when (gnus-virtual-group-p group)
5650 (setq cached gnus-newsgroup-cached))
5652 (setq gnus-newsgroup-unreads
5653 (gnus-sorted-ndifference
5654 (gnus-sorted-ndifference gnus-newsgroup-unreads
5655 gnus-newsgroup-marked)
5656 gnus-newsgroup-dormant))
5658 (setq gnus-newsgroup-processable nil)
5660 (gnus-update-read-articles group gnus-newsgroup-unreads t)
5662 ;; Adjust and set lists of article marks.
5664 (gnus-adjust-marked-articles info))
5665 (if (setq articles select-articles)
5666 (setq gnus-newsgroup-unselected
5667 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5668 (setq articles (gnus-articles-to-read group read-all)))
5672 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5674 ((eq articles 0) nil)
5676 ;; Init the dependencies hash table.
5677 (setq gnus-newsgroup-dependencies
5678 (gnus-make-hashtable (length articles)))
5679 (gnus-set-global-variables)
5680 ;; Retrieve the headers and read them in.
5682 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5684 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5686 (setq gnus-newsgroup-cached cached))
5688 ;; Suppress duplicates?
5689 (when gnus-suppress-duplicates
5690 (gnus-dup-suppress-articles))
5692 ;; Set the initial limit.
5693 (setq gnus-newsgroup-limit (copy-sequence articles))
5694 ;; Remove canceled articles from the list of unread articles.
5695 (setq fetched-articles
5696 (mapcar (lambda (headers) (mail-header-number headers))
5697 gnus-newsgroup-headers))
5698 (setq gnus-newsgroup-articles fetched-articles)
5699 (setq gnus-newsgroup-unreads
5700 (gnus-sorted-nintersection
5701 gnus-newsgroup-unreads fetched-articles))
5702 (gnus-compute-unseen-list)
5704 ;; Removed marked articles that do not exist.
5705 (gnus-update-missing-marks
5706 (gnus-sorted-difference articles fetched-articles))
5707 ;; We might want to build some more threads first.
5708 (when (and gnus-fetch-old-headers
5709 (eq gnus-headers-retrieved-by 'nov))
5710 (if (eq gnus-fetch-old-headers 'invisible)
5711 (gnus-build-all-threads)
5712 (gnus-build-old-threads)))
5713 ;; Let the Gnus agent mark articles as read.
5715 (gnus-agent-get-undownloaded-list))
5716 ;; Remove list identifiers from subject
5717 (gnus-summary-remove-list-identifiers)
5718 ;; Check whether auto-expire is to be done in this group.
5719 (setq gnus-newsgroup-auto-expire
5720 (and (gnus-group-auto-expirable-p group)
5721 (not (gnus-group-read-only-p group))))
5722 ;; Set up the article buffer now, if necessary.
5723 (unless (and gnus-single-article-buffer
5724 (equal gnus-article-buffer "*Article*"))
5725 (gnus-article-setup-buffer))
5726 ;; First and last article in this newsgroup.
5727 (when gnus-newsgroup-headers
5728 (setq gnus-newsgroup-begin
5729 (mail-header-number (car gnus-newsgroup-headers))
5732 (gnus-last-element gnus-newsgroup-headers))))
5733 ;; GROUP is successfully selected.
5734 (or gnus-newsgroup-headers t)))))
5736 (defun gnus-compute-unseen-list ()
5737 ;; The `seen' marks are treated specially.
5738 (if (not gnus-newsgroup-seen)
5739 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5740 (setq gnus-newsgroup-unseen
5741 (gnus-inverse-list-range-intersection
5742 gnus-newsgroup-articles gnus-newsgroup-seen))))
5744 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5746 (defun gnus-summary-display-make-predicate (display)
5747 (require 'gnus-agent)
5748 (when (= (length display) 1)
5749 (setq display (car display)))
5750 (unless gnus-summary-display-cache
5751 (dolist (elem (append '((unread . unread)
5754 gnus-article-mark-lists))
5755 (push (cons (cdr elem)
5756 (gnus-byte-compile ;Why bother?
5757 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5758 gnus-summary-display-cache)))
5759 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5760 (gnus-category-predicate-cache gnus-summary-display-cache))
5761 (gnus-get-predicate display)))
5763 ;; Uses the dynamically bound `gnus-number' variable.
5764 (defvar gnus-number)
5765 (defun gnus-article-marked-p (type &optional article)
5766 (let ((article (or article gnus-number)))
5769 (memq article gnus-newsgroup-marked))
5771 (memq article gnus-newsgroup-spam-marked))
5773 (memq article gnus-newsgroup-unsendable))
5774 ((eq type 'undownload)
5775 (memq article gnus-newsgroup-undownloaded))
5776 ((eq type 'download)
5777 (memq article gnus-newsgroup-downloadable))
5779 (memq article gnus-newsgroup-unreads))
5781 (memq article gnus-newsgroup-reads))
5783 (memq article gnus-newsgroup-dormant) )
5785 (memq article gnus-newsgroup-expirable))
5787 (memq article gnus-newsgroup-replied))
5789 (memq article gnus-newsgroup-killed))
5790 ((eq type 'bookmark)
5791 (assq article gnus-newsgroup-bookmarks))
5793 (assq article gnus-newsgroup-scored))
5795 (memq article gnus-newsgroup-saved))
5797 (memq article gnus-newsgroup-cached))
5799 (memq article gnus-newsgroup-forwarded))
5801 (not (memq article gnus-newsgroup-unseen)))
5804 (defun gnus-articles-to-read (group &optional read-all)
5805 "Find out what articles the user wants to read."
5806 (let* ((only-read-p t)
5808 ;; Select all articles if `read-all' is non-nil, or if there
5809 ;; are no unread articles.
5811 (and (zerop (length gnus-newsgroup-marked))
5812 (zerop (length gnus-newsgroup-unreads)))
5813 ;; Fetch all if the predicate is non-nil.
5814 gnus-newsgroup-display)
5815 ;; We want to select the headers for all the articles in
5816 ;; the group, so we select either all the active
5817 ;; articles in the group, or (if that's nil), the
5818 ;; articles in the cache.
5820 (if gnus-newsgroup-maximum-articles
5821 (let ((active (gnus-active group)))
5822 (gnus-uncompress-range
5823 (cons (max (car active)
5825 gnus-newsgroup-maximum-articles
5828 (gnus-uncompress-range (gnus-active group)))
5829 (gnus-cache-articles-in-group group))
5830 ;; Select only the "normal" subset of articles.
5831 (setq only-read-p nil)
5833 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5834 gnus-newsgroup-unreads)))
5835 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5836 (scored (length scored-list))
5837 (number (length articles))
5838 (marked (+ (length gnus-newsgroup-marked)
5839 (length gnus-newsgroup-dormant)))
5844 ((numberp gnus-newsgroup-display)
5845 gnus-newsgroup-display)
5849 ((and (or (<= scored marked) (= scored number))
5850 (numberp gnus-large-newsgroup)
5851 (> number gnus-large-newsgroup))
5852 (let* ((cursor-in-echo-area nil)
5853 (initial (gnus-parameter-large-newsgroup-initial
5854 gnus-newsgroup-name))
5855 (default (if only-read-p
5856 (or initial gnus-large-newsgroup)
5862 "How many articles from %s (available %d, default %d): "
5863 (gnus-group-decoded-name
5864 (gnus-group-real-name gnus-newsgroup-name))
5867 "How many articles from %s (%d default): "
5868 (gnus-group-decoded-name
5869 (gnus-group-real-name gnus-newsgroup-name))
5873 (number-to-string default))))
5874 (if (string-match "^[ \t]*$" input) number input)))
5875 ((and (> scored marked) (< scored number)
5876 (> (- scored number) 20))
5879 (format "%s %s (%d scored, %d total): "
5880 "How many articles from"
5881 (gnus-group-decoded-name
5882 (gnus-group-real-name gnus-newsgroup-name))
5884 (if (string-match "^[ \t]*$" input)
5888 (message "Quit getting the articles to read")
5890 (setq select (if (stringp select) (string-to-number select) select))
5891 (if (or (null select) (zerop select))
5893 (if (and (not (zerop scored)) (<= (abs select) scored))
5895 (setq articles (sort scored-list '<))
5896 (setq number (length articles)))
5897 (setq articles (copy-sequence articles)))
5899 (when (< (abs select) number)
5901 ;; Select the N oldest articles.
5902 (setcdr (nthcdr (1- (abs select)) articles) nil)
5903 ;; Select the N most recent articles.
5904 (setq articles (nthcdr (- number select) articles))))
5905 (setq gnus-newsgroup-unselected
5906 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5907 (when gnus-alter-articles-to-read-function
5910 (funcall gnus-alter-articles-to-read-function
5911 gnus-newsgroup-name articles)
5915 (defun gnus-killed-articles (killed articles)
5918 (when (inline (gnus-member-of-range (car articles) killed))
5919 (push (car articles) out))
5920 (setq articles (cdr articles)))
5923 (defun gnus-uncompress-marks (marks)
5924 "Uncompress the mark ranges in MARKS."
5925 (let ((uncompressed '(score bookmark))
5928 (if (memq (caar marks) uncompressed)
5929 (push (car marks) out)
5930 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5931 (setq marks (cdr marks)))
5934 (defun gnus-article-mark-to-type (mark)
5935 "Return the type of MARK."
5936 (or (cadr (assq mark gnus-article-special-mark-lists))
5939 (defun gnus-article-unpropagatable-p (mark)
5940 "Return whether MARK should be propagated to back end."
5941 (memq mark gnus-article-unpropagated-mark-lists))
5943 (defun gnus-adjust-marked-articles (info)
5944 "Set all article lists and remove all marks that are no longer valid."
5945 (let* ((marked-lists (gnus-info-marks info))
5946 (active (gnus-active (gnus-info-group info)))
5949 (types gnus-article-mark-lists)
5950 marks var articles article mark mark-type
5952 ;; Hack to avoid adjusting marks for imap.
5953 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5957 (dolist (marks marked-lists)
5958 (setq mark (car marks)
5959 mark-type (gnus-article-mark-to-type mark)
5960 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5962 ;; We set the variable according to the type of the marks list,
5963 ;; and then adjust the marks to a subset of the active articles.
5965 ;; Adjust "simple" lists - compressed yet unsorted
5966 ((eq mark-type 'list)
5967 ;; Simultaneously uncompress and clip to active range
5968 ;; See gnus-uncompress-range for a description of possible marks
5970 (if (not (cadr marks))
5972 (setq articles (if (numberp (cddr marks))
5978 (while (setq article (pop articles))
5979 (cond ((consp article)
5980 (setq bgn (max (car article) min)
5981 end (min (cdr article) max))
5983 (setq l (setcdr l (cons bgn nil))
5985 ((and (<= min article)
5987 (setq l (setcdr l (cons article nil))))))
5988 (set var (cdr lh)))))
5990 ((eq mark-type 'tuple)
5991 (set var (setq articles (cdr marks)))
5992 (when (not (listp (cdr (symbol-value var))))
5993 (set var (list (symbol-value var))))
5994 (when (not (listp (cdr articles)))
5995 (setq articles (list articles)))
5997 (when (or (not (consp (setq article (pop articles))))
5998 (< (car article) min)
5999 (> (car article) max))
6000 (set var (delq article (symbol-value var))))))
6001 ;; Adjust ranges (sloppily).
6002 ((eq mark-type 'range)
6005 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
6006 ;; It should be (seen (NUM1 . NUM2)).
6007 (when (numberp (cddr marks))
6008 (setcdr marks (list (cdr marks))))
6009 (setq articles (cdr marks))
6010 (while (and articles
6011 (or (and (consp (car articles))
6012 (> min (cdar articles)))
6013 (and (numberp (car articles))
6014 (> min (car articles)))))
6016 (set var articles))))))))
6018 (defun gnus-update-missing-marks (missing)
6019 "Go through the list of MISSING articles and remove them from the mark lists."
6022 ;; Go through all types.
6023 (dolist (elem gnus-article-mark-lists)
6024 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
6025 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
6026 (when (symbol-value var)
6027 ;; This list has articles. So we delete all missing
6028 ;; articles from it.
6031 (set var (delq (pop m) (symbol-value var))))))))))
6033 (defun gnus-update-marks ()
6034 "Enter the various lists of marked articles into the newsgroup info list."
6035 (let ((types gnus-article-mark-lists)
6036 (info (gnus-get-info gnus-newsgroup-name))
6037 type list newmarked symbol delta-marks)
6039 ;; Add all marks lists to the list of marks lists.
6040 (while (setq type (pop types))
6041 (setq list (symbol-value
6043 (intern (format "gnus-newsgroup-%s" (car type))))))
6046 ;; Get rid of the entries of the articles that have the
6048 (when (and (eq (cdr type) 'score)
6052 (prev (cons nil list))
6055 (if (or (not (consp (car arts)))
6056 (= (cdar arts) gnus-summary-default-score))
6057 (setcdr prev (cdr arts))
6059 (setq arts (cdr arts)))
6060 (setq list (cdr all)))))
6062 (when (eq (cdr type) 'seen)
6063 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
6065 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
6066 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
6068 (when (and (gnus-check-backend-function
6069 'request-set-mark gnus-newsgroup-name)
6070 (not (gnus-article-unpropagatable-p (cdr type))))
6071 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
6072 ;; Don't do anything about marks for articles we
6073 ;; didn't actually get any headers for.
6075 (gnus-list-range-intersection
6076 gnus-newsgroup-articles
6077 (gnus-remove-from-range (gnus-copy-sequence old) list)))
6079 (gnus-list-range-intersection
6080 gnus-newsgroup-articles
6081 (gnus-remove-from-range
6082 (gnus-copy-sequence list) old))))
6084 (push (list add 'add (list (cdr type))) delta-marks))
6086 ;; Don't delete marks from outside the active range.
6087 ;; This shouldn't happen, but is a sanity check.
6088 (setq del (gnus-sorted-range-intersection
6089 (gnus-active gnus-newsgroup-name) del))
6090 (push (list del 'del (list (cdr type))) delta-marks))))
6093 (push (cons (cdr type) list) newmarked)))
6096 (unless (gnus-check-group gnus-newsgroup-name)
6097 (error "Can't open server for %s" gnus-newsgroup-name))
6098 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6100 ;; Enter these new marks into the info of the group.
6102 (setcar (nthcdr 3 info) newmarked)
6103 ;; Add the marks lists to the end of the info.
6105 (setcdr (nthcdr 2 info) (list newmarked))))