1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
28 (eval-when-compile (require 'cl))
37 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
39 (defcustom gnus-kill-summary-on-exit t
40 "*If non-nil, kill the summary buffer when you exit from it.
41 If nil, the summary will become a \"*Dead Summary*\" buffer, and
42 it will be killed sometime later."
43 :group 'gnus-summary-exit
46 (defcustom gnus-fetch-old-headers nil
47 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
48 If an unread article in the group refers to an older, already read (or
49 just marked as read) article, the old article will not normally be
50 displayed in the Summary buffer. If this variable is non-nil, Gnus
51 will attempt to grab the headers to the old articles, and thereby
52 build complete threads. If it has the value `some', only enough
53 headers to connect otherwise loose threads will be displayed. This
54 variable can also be a number. In that case, no more than that number
55 of old headers will be fetched. If it has the value `invisible', all
56 old headers will be fetched, but none will be displayed.
58 The server has to support NOV for any of this to work."
60 :type '(choice (const :tag "off" nil)
63 (sexp :menu-tag "other" t)))
65 (defcustom gnus-refer-thread-limit 200
66 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
67 If t, fetch all the available old headers."
70 (sexp :menu-tag "other" t)))
72 (defcustom gnus-summary-make-false-root 'adopt
73 "*nil means that Gnus won't gather loose threads.
74 If the root of a thread has expired or been read in a previous
75 session, the information necessary to build a complete thread has been
76 lost. Instead of having many small sub-threads from this original thread
77 scattered all over the summary buffer, Gnus can gather them.
79 If non-nil, Gnus will try to gather all loose sub-threads from an
80 original thread into one large thread.
82 If this variable is non-nil, it should be one of `none', `adopt',
85 If this variable is `none', Gnus will not make a false root, but just
86 present the sub-threads after another.
87 If this variable is `dummy', Gnus will create a dummy root that will
88 have all the sub-threads as children.
89 If this variable is `adopt', Gnus will make one of the \"children\"
90 the parent and mark all the step-children as such.
91 If this variable is `empty', the \"children\" are printed with empty
92 subject fields. (Or rather, they will be printed with a string
93 given by the `gnus-summary-same-subject' variable.)"
95 :type '(choice (const :tag "off" nil)
101 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
102 "*A regexp to match subjects to be excluded from loose thread gathering.
103 As loose thread gathering is done on subjects only, that means that
104 there can be many false gatherings performed. By rooting out certain
105 common subjects, gathering might become saner."
109 (defcustom gnus-summary-gather-subject-limit nil
110 "*Maximum length of subject comparisons when gathering loose threads.
111 Use nil to compare full subjects. Setting this variable to a low
112 number will help gather threads that have been corrupted by
113 newsreaders chopping off subject lines, but it might also mean that
114 unrelated articles that have subject that happen to begin with the
115 same few characters will be incorrectly gathered.
117 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
120 :type '(choice (const :tag "off" nil)
122 (sexp :menu-tag "on" t)))
124 (defcustom gnus-simplify-subject-functions nil
125 "List of functions taking a string argument that simplify subjects.
126 The functions are applied recursively.
128 Useful functions to put in this list include: `gnus-simplify-subject-re',
129 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
131 :type '(repeat function))
133 (defcustom gnus-simplify-ignored-prefixes nil
134 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
136 :type '(choice (const :tag "off" nil)
139 (defcustom gnus-build-sparse-threads nil
140 "*If non-nil, fill in the gaps in threads.
141 If `some', only fill in the gaps that are needed to tie loose threads
142 together. If `more', fill in all leaf nodes that Gnus can find. If
143 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
145 :type '(choice (const :tag "off" nil)
148 (sexp :menu-tag "all" t)))
150 (defcustom gnus-summary-thread-gathering-function
151 'gnus-gather-threads-by-subject
152 "*Function used for gathering loose threads.
153 There are two pre-defined functions: `gnus-gather-threads-by-subject',
154 which only takes Subjects into consideration; and
155 `gnus-gather-threads-by-references', which compared the References
156 headers of the articles to find matches."
158 :type '(radio (function-item gnus-gather-threads-by-subject)
159 (function-item gnus-gather-threads-by-references)
160 (function :tag "other")))
162 (defcustom gnus-summary-same-subject ""
163 "*String indicating that the current article has the same subject as the previous.
164 This variable will only be used if the value of
165 `gnus-summary-make-false-root' is `empty'."
166 :group 'gnus-summary-format
169 (defcustom gnus-summary-goto-unread t
170 "*If t, marking commands will go to the next unread article.
171 If `never', commands that usually go to the next unread article, will
172 go to the next article, whether it is read or not.
173 If nil, only the marking commands will go to the next (un)read article."
174 :group 'gnus-summary-marks
175 :link '(custom-manual "(gnus)Setting Marks")
176 :type '(choice (const :tag "off" nil)
178 (sexp :menu-tag "on" t)))
180 (defcustom gnus-summary-default-score 0
181 "*Default article score level.
182 All scores generated by the score files will be added to this score.
183 If this variable is nil, scoring will be disabled."
184 :group 'gnus-score-default
185 :type '(choice (const :tag "disable")
188 (defcustom gnus-summary-zcore-fuzz 0
189 "*Fuzziness factor for the zcore in the summary buffer.
190 Articles with scores closer than this to `gnus-summary-default-score'
192 :group 'gnus-summary-format
195 (defcustom gnus-simplify-subject-fuzzy-regexp nil
196 "*Strings to be removed when doing fuzzy matches.
197 This can either be a regular expression or list of regular expressions
198 that will be removed from subject strings if fuzzy subject
199 simplification is selected."
201 :type '(repeat regexp))
203 (defcustom gnus-show-threads t
204 "*If non-nil, display threads in summary mode."
208 (defcustom gnus-thread-hide-subtree nil
209 "*If non-nil, hide all threads initially.
210 If threads are hidden, you have to run the command
211 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
212 to expose hidden threads."
216 (defcustom gnus-thread-hide-killed t
217 "*If non-nil, hide killed threads automatically."
221 (defcustom gnus-thread-ignore-subject t
222 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
223 If nil, articles that have different subjects from their parents will
224 start separate threads."
228 (defcustom gnus-thread-operation-ignore-subject t
229 "*If non-nil, subjects will be ignored when doing thread commands.
230 This affects commands like `gnus-summary-kill-thread' and
231 `gnus-summary-lower-thread'.
233 If this variable is nil, articles in the same thread with different
234 subjects will not be included in the operation in question. If this
235 variable is `fuzzy', only articles that have subjects that are fuzzily
236 equal will be included."
238 :type '(choice (const :tag "off" nil)
242 (defcustom gnus-thread-indent-level 4
243 "*Number that says how much each sub-thread should be indented."
247 (defcustom gnus-auto-extend-newsgroup t
248 "*If non-nil, extend newsgroup forward and backward when requested."
249 :group 'gnus-summary-choose
252 (defcustom gnus-auto-select-first t
253 "*If nil, don't select the first unread article when entering a group.
254 If this variable is `best', select the highest-scored unread article
255 in the group. If neither nil nor `best', select the first unread
258 If you want to prevent automatic selection of the first unread article
259 in some newsgroups, set the variable to nil in
260 `gnus-select-group-hook'."
261 :group 'gnus-group-select
262 :type '(choice (const :tag "none" nil)
264 (sexp :menu-tag "first" t)))
266 (defcustom gnus-auto-select-next t
267 "*If non-nil, offer to go to the next group from the end of the previous.
268 If the value is t and the next newsgroup is empty, Gnus will exit
269 summary mode and go back to group mode. If the value is neither nil
270 nor t, Gnus will select the following unread newsgroup. In
271 particular, if the value is the symbol `quietly', the next unread
272 newsgroup will be selected without any confirmation, and if it is
273 `almost-quietly', the next group will be selected without any
274 confirmation if you are located on the last article in the group.
275 Finally, if this variable is `slightly-quietly', the `Z n' command
276 will go to the next group without confirmation."
277 :group 'gnus-summary-maneuvering
278 :type '(choice (const :tag "off" nil)
280 (const almost-quietly)
281 (const slightly-quietly)
282 (sexp :menu-tag "on" t)))
284 (defcustom gnus-auto-select-same nil
285 "*If non-nil, select the next article with the same subject.
286 If there are no more articles with the same subject, go to
287 the first unread article."
288 :group 'gnus-summary-maneuvering
291 (defcustom gnus-summary-check-current nil
292 "*If non-nil, consider the current article when moving.
293 The \"unread\" movement commands will stay on the same line if the
294 current article is unread."
295 :group 'gnus-summary-maneuvering
298 (defcustom gnus-auto-center-summary t
299 "*If non-nil, always center the current summary buffer.
300 In particular, if `vertical' do only vertical recentering. If non-nil
301 and non-`vertical', do both horizontal and vertical recentering."
302 :group 'gnus-summary-maneuvering
303 :type '(choice (const :tag "none" nil)
305 (sexp :menu-tag "both" t)))
307 (defcustom gnus-show-all-headers nil
308 "*If non-nil, don't hide any headers."
309 :group 'gnus-article-hiding
310 :group 'gnus-article-headers
313 (defcustom gnus-summary-ignore-duplicates nil
314 "*If non-nil, ignore articles with identical Message-ID headers."
318 (defcustom gnus-single-article-buffer t
319 "*If non-nil, display all articles in the same buffer.
320 If nil, each group will get its own article buffer."
321 :group 'gnus-article-various
324 (defcustom gnus-break-pages t
325 "*If non-nil, do page breaking on articles.
326 The page delimiter is specified by the `gnus-page-delimiter'
328 :group 'gnus-article-various
331 (defcustom gnus-show-mime nil
332 "*If non-nil, do mime processing of articles.
333 The articles will simply be fed to the function given by
334 `gnus-show-mime-method'."
335 :group 'gnus-article-mime
338 (defcustom gnus-move-split-methods nil
339 "*Variable used to suggest where articles are to be moved to.
340 It uses the same syntax as the `gnus-split-methods' variable."
341 :group 'gnus-summary-mail
342 :type '(repeat (choice (list :value (fun) function)
343 (cons :value ("" "") regexp (repeat string))
346 (defcustom gnus-unread-mark ?
347 "*Mark used for unread articles."
348 :group 'gnus-summary-marks
351 (defcustom gnus-ticked-mark ?!
352 "*Mark used for ticked articles."
353 :group 'gnus-summary-marks
356 (defcustom gnus-dormant-mark ??
357 "*Mark used for dormant articles."
358 :group 'gnus-summary-marks
361 (defcustom gnus-del-mark ?r
362 "*Mark used for del'd articles."
363 :group 'gnus-summary-marks
366 (defcustom gnus-read-mark ?R
367 "*Mark used for read articles."
368 :group 'gnus-summary-marks
371 (defcustom gnus-expirable-mark ?E
372 "*Mark used for expirable articles."
373 :group 'gnus-summary-marks
376 (defcustom gnus-killed-mark ?K
377 "*Mark used for killed articles."
378 :group 'gnus-summary-marks
381 (defcustom gnus-souped-mark ?F
382 "*Mark used for killed articles."
383 :group 'gnus-summary-marks
386 (defcustom gnus-kill-file-mark ?X
387 "*Mark used for articles killed by kill files."
388 :group 'gnus-summary-marks
391 (defcustom gnus-low-score-mark ?Y
392 "*Mark used for articles with a low score."
393 :group 'gnus-summary-marks
396 (defcustom gnus-catchup-mark ?C
397 "*Mark used for articles that are caught up."
398 :group 'gnus-summary-marks
401 (defcustom gnus-replied-mark ?A
402 "*Mark used for articles that have been replied to."
403 :group 'gnus-summary-marks
406 (defcustom gnus-cached-mark ?*
407 "*Mark used for articles that are in the cache."
408 :group 'gnus-summary-marks
411 (defcustom gnus-saved-mark ?S
412 "*Mark used for articles that have been saved to."
413 :group 'gnus-summary-marks
416 (defcustom gnus-ancient-mark ?O
417 "*Mark used for ancient articles."
418 :group 'gnus-summary-marks
421 (defcustom gnus-sparse-mark ?Q
422 "*Mark used for sparsely reffed articles."
423 :group 'gnus-summary-marks
426 (defcustom gnus-canceled-mark ?G
427 "*Mark used for canceled articles."
428 :group 'gnus-summary-marks
431 (defcustom gnus-duplicate-mark ?M
432 "*Mark used for duplicate articles."
433 :group 'gnus-summary-marks
436 (defcustom gnus-undownloaded-mark ?@
437 "*Mark used for articles that weren't downloaded."
438 :group 'gnus-summary-marks
441 (defcustom gnus-downloadable-mark ?%
442 "*Mark used for articles that are to be downloaded."
443 :group 'gnus-summary-marks
446 (defcustom gnus-unsendable-mark ?=
447 "*Mark used for articles that won't be sent."
448 :group 'gnus-summary-marks
451 (defcustom gnus-score-over-mark ?+
452 "*Score mark used for articles with high scores."
453 :group 'gnus-summary-marks
456 (defcustom gnus-score-below-mark ?-
457 "*Score mark used for articles with low scores."
458 :group 'gnus-summary-marks
461 (defcustom gnus-empty-thread-mark ?
462 "*There is no thread under the article."
463 :group 'gnus-summary-marks
466 (defcustom gnus-not-empty-thread-mark ?=
467 "*There is a thread under the article."
468 :group 'gnus-summary-marks
471 (defcustom gnus-view-pseudo-asynchronously nil
472 "*If non-nil, Gnus will view pseudo-articles asynchronously."
473 :group 'gnus-extract-view
476 (defcustom gnus-view-pseudos nil
477 "*If `automatic', pseudo-articles will be viewed automatically.
478 If `not-confirm', pseudos will be viewed automatically, and the user
479 will not be asked to confirm the command."
480 :group 'gnus-extract-view
481 :type '(choice (const :tag "off" nil)
483 (const not-confirm)))
485 (defcustom gnus-view-pseudos-separately t
486 "*If non-nil, one pseudo-article will be created for each file to be viewed.
487 If nil, all files that use the same viewing command will be given as a
488 list of parameters to that command."
489 :group 'gnus-extract-view
492 (defcustom gnus-insert-pseudo-articles t
493 "*If non-nil, insert pseudo-articles when decoding articles."
494 :group 'gnus-extract-view
497 (defcustom gnus-summary-dummy-line-format
499 "*The format specification for the dummy roots in the summary buffer.
500 It works along the same lines as a normal formatting string,
501 with some simple extensions.
504 :group 'gnus-threading
507 (defcustom gnus-summary-mode-line-format "Gnus: %%b [%A] %Z"
508 "*The format specification for the summary mode line.
509 It works along the same lines as a normal formatting string,
510 with some simple extensions:
513 %p Unprefixed group name
514 %A Current article number
515 %z Current article score
517 %U Number of unread articles in the group
518 %e Number of unselected articles in the group
519 %Z A string with unread/unselected article counts
520 %g Shortish group name
521 %S Subject of the current article
523 %s Current score file name
524 %d Number of dormant articles
525 %r Number of articles that have been marked as read in this session
526 %E Number of articles expunged by the score files"
527 :group 'gnus-summary-format
530 (defcustom gnus-summary-mark-below 0
531 "*Mark all articles with a score below this variable as read.
532 This variable is local to each summary buffer and usually set by the
534 :group 'gnus-score-default
537 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
538 "*List of functions used for sorting articles in the summary buffer.
539 This variable is only used when not using a threaded display."
540 :group 'gnus-summary-sort
541 :type '(repeat (choice (function-item gnus-article-sort-by-number)
542 (function-item gnus-article-sort-by-author)
543 (function-item gnus-article-sort-by-subject)
544 (function-item gnus-article-sort-by-date)
545 (function-item gnus-article-sort-by-score)
546 (function :tag "other"))))
548 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
549 "*List of functions used for sorting threads in the summary buffer.
550 By default, threads are sorted by article number.
552 Each function takes two threads and return non-nil if the first thread
553 should be sorted before the other. If you use more than one function,
554 the primary sort function should be the last. You should probably
555 always include `gnus-thread-sort-by-number' in the list of sorting
556 functions -- preferably first.
558 Ready-made functions include `gnus-thread-sort-by-number',
559 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
560 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
561 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
562 :group 'gnus-summary-sort
563 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
564 (function-item gnus-thread-sort-by-author)
565 (function-item gnus-thread-sort-by-subject)
566 (function-item gnus-thread-sort-by-date)
567 (function-item gnus-thread-sort-by-score)
568 (function-item gnus-thread-sort-by-total-score)
569 (function :tag "other"))))
571 (defcustom gnus-thread-score-function '+
572 "*Function used for calculating the total score of a thread.
574 The function is called with the scores of the article and each
575 subthread and should then return the score of the thread.
577 Some functions you can use are `+', `max', or `min'."
578 :group 'gnus-summary-sort
581 (defcustom gnus-summary-expunge-below nil
582 "All articles that have a score less than this variable will be expunged.
583 This variable is local to the summary buffers."
584 :group 'gnus-score-default
585 :type '(choice (const :tag "off" nil)
588 (defcustom gnus-thread-expunge-below nil
589 "All threads that have a total score less than this variable will be expunged.
590 See `gnus-thread-score-function' for en explanation of what a
593 This variable is local to the summary buffers."
594 :group 'gnus-treading
595 :group 'gnus-score-default
596 :type '(choice (const :tag "off" nil)
599 (defcustom gnus-summary-mode-hook nil
600 "*A hook for Gnus summary mode.
601 This hook is run before any variables are set in the summary buffer."
602 :group 'gnus-summary-various
605 (defcustom gnus-summary-menu-hook nil
606 "*Hook run after the creation of the summary mode menu."
607 :group 'gnus-summary-visual
610 (defcustom gnus-summary-exit-hook nil
611 "*A hook called on exit from the summary buffer.
612 It will be called with point in the group buffer."
613 :group 'gnus-summary-exit
616 (defcustom gnus-summary-prepare-hook nil
617 "*A hook called after the summary buffer has been generated.
618 If you want to modify the summary buffer, you can use this hook."
619 :group 'gnus-summary-various
622 (defcustom gnus-summary-prepared-hook nil
623 "*A hook called as the last thing after the summary buffer has been generated."
624 :group 'gnus-summary-various
627 (defcustom gnus-summary-generate-hook nil
628 "*A hook run just before generating the summary buffer.
629 This hook is commonly used to customize threading variables and the
631 :group 'gnus-summary-various
634 (defcustom gnus-select-group-hook nil
635 "*A hook called when a newsgroup is selected.
637 If you'd like to simplify subjects like the
638 `gnus-summary-next-same-subject' command does, you can use the
641 (setq gnus-select-group-hook
644 (mapcar (lambda (header)
645 (mail-header-set-subject
647 (gnus-simplify-subject
648 (mail-header-subject header) 're-only)))
649 gnus-newsgroup-headers))))"
650 :group 'gnus-group-select
653 (defcustom gnus-select-article-hook nil
654 "*A hook called when an article is selected."
655 :group 'gnus-summary-choose
658 (defcustom gnus-visual-mark-article-hook
659 (list 'gnus-highlight-selected-summary)
660 "*Hook run after selecting an article in the summary buffer.
661 It is meant to be used for highlighting the article in some way. It
662 is not run if `gnus-visual' is nil."
663 :group 'gnus-summary-visual
666 (defcustom gnus-parse-headers-hook nil
667 "*A hook called before parsing the headers."
671 (defcustom gnus-exit-group-hook nil
672 "*A hook called when exiting (not quitting) summary mode."
676 (defcustom gnus-summary-update-hook
677 (list 'gnus-summary-highlight-line)
678 "*A hook called when a summary line is changed.
679 The hook will not be called if `gnus-visual' is nil.
681 The default function `gnus-summary-highlight-line' will
682 highlight the line according to the `gnus-summary-highlight'
684 :group 'gnus-summary-visual
687 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
688 "*A hook called when an article is selected for the first time.
689 The hook is intended to mark an article as read (or unread)
690 automatically when it is selected."
691 :group 'gnus-summary-choose
694 (defcustom gnus-group-no-more-groups-hook nil
695 "*A hook run when returning to group mode having no more (unread) groups."
696 :group 'gnus-group-select
699 (defcustom gnus-ps-print-hook nil
700 "*A hook run before ps-printing something from Gnus."
704 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
705 "Face used for highlighting the current article in the summary buffer."
706 :group 'gnus-summary-visual
709 (defcustom gnus-summary-highlight
710 '(((= mark gnus-canceled-mark)
711 . gnus-summary-cancelled-face)
712 ((and (> score default)
713 (or (= mark gnus-dormant-mark)
714 (= mark gnus-ticked-mark)))
715 . gnus-summary-high-ticked-face)
716 ((and (< score default)
717 (or (= mark gnus-dormant-mark)
718 (= mark gnus-ticked-mark)))
719 . gnus-summary-low-ticked-face)
720 ((or (= mark gnus-dormant-mark)
721 (= mark gnus-ticked-mark))
722 . gnus-summary-normal-ticked-face)
723 ((and (> score default) (= mark gnus-ancient-mark))
724 . gnus-summary-high-ancient-face)
725 ((and (< score default) (= mark gnus-ancient-mark))
726 . gnus-summary-low-ancient-face)
727 ((= mark gnus-ancient-mark)
728 . gnus-summary-normal-ancient-face)
729 ((and (> score default) (= mark gnus-unread-mark))
730 . gnus-summary-high-unread-face)
731 ((and (< score default) (= mark gnus-unread-mark))
732 . gnus-summary-low-unread-face)
733 ((= mark gnus-unread-mark)
734 . gnus-summary-normal-unread-face)
735 ((and (> score default) (memq mark (list gnus-downloadable-mark
736 gnus-undownloaded-mark)))
737 . gnus-summary-high-unread-face)
738 ((and (< score default) (memq mark (list gnus-downloadable-mark
739 gnus-undownloaded-mark)))
740 . gnus-summary-low-unread-face)
741 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
742 . gnus-summary-normal-unread-face)
744 . gnus-summary-high-read-face)
746 . gnus-summary-low-read-face)
748 . gnus-summary-normal-read-face))
749 "*Controls the highlighting of summary buffer lines.
751 A list of (FORM . FACE) pairs. When deciding how a a particular
752 summary line should be displayed, each form is evaluated. The content
753 of the face field after the first true form is used. You can change
754 how those summary lines are displayed, by editing the face field.
756 You can use the following variables in the FORM field.
758 score: The articles score
759 default: The default article score.
760 below: The score below which articles are automatically marked as read.
761 mark: The articles mark."
762 :group 'gnus-summary-visual
763 :type '(repeat (cons (sexp :tag "Form" nil)
766 (defcustom gnus-alter-header-function nil
767 "Function called to allow alteration of article header structures.
768 The function is called with one parameter, the article header vector,
769 which it may alter in any way.")
771 ;;; Internal variables
773 (defvar gnus-scores-exclude-files nil)
774 (defvar gnus-page-broken nil)
776 (defvar gnus-original-article nil)
777 (defvar gnus-article-internal-prepare-hook nil)
778 (defvar gnus-newsgroup-process-stack nil)
780 (defvar gnus-thread-indent-array nil)
781 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
783 ;; Avoid highlighting in kill files.
784 (defvar gnus-summary-inhibit-highlight nil)
785 (defvar gnus-newsgroup-selected-overlay nil)
786 (defvar gnus-inhibit-limiting nil)
787 (defvar gnus-newsgroup-adaptive-score-file nil)
788 (defvar gnus-current-score-file nil)
789 (defvar gnus-current-move-group nil)
790 (defvar gnus-current-copy-group nil)
791 (defvar gnus-current-crosspost-group nil)
793 (defvar gnus-newsgroup-dependencies nil)
794 (defvar gnus-newsgroup-adaptive nil)
795 (defvar gnus-summary-display-article-function nil)
796 (defvar gnus-summary-highlight-line-function nil
797 "Function called after highlighting a summary line.")
799 (defvar gnus-summary-line-format-alist
800 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
801 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
802 (?s gnus-tmp-subject-or-nil ?s)
803 (?n gnus-tmp-name ?s)
804 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
806 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
808 (?F gnus-tmp-from ?s)
809 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
810 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
811 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
812 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
813 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
814 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
815 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
816 (?L gnus-tmp-lines ?d)
817 (?I gnus-tmp-indentation ?s)
818 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
819 (?R gnus-tmp-replied ?c)
820 (?\[ gnus-tmp-opening-bracket ?c)
821 (?\] gnus-tmp-closing-bracket ?c)
822 (?\> (make-string gnus-tmp-level ? ) ?s)
823 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
824 (?i gnus-tmp-score ?d)
825 (?z gnus-tmp-score-char ?c)
826 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
827 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
828 (?U gnus-tmp-unread ?c)
829 (?t (gnus-summary-number-of-articles-in-thread
830 (and (boundp 'thread) (car thread)) gnus-tmp-level)
832 (?e (gnus-summary-number-of-articles-in-thread
833 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
835 (?u gnus-tmp-user-defined ?s)
836 (?P (gnus-pick-line-number) ?d))
837 "An alist of format specifications that can appear in summary lines,
838 and what variables they correspond with, along with the type of the
839 variable (string, integer, character, etc).")
841 (defvar gnus-summary-dummy-line-format-alist
842 `((?S gnus-tmp-subject ?s)
843 (?N gnus-tmp-number ?d)
844 (?u gnus-tmp-user-defined ?s)))
846 (defvar gnus-summary-mode-line-format-alist
847 `((?G gnus-tmp-group-name ?s)
848 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
849 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
850 (?A gnus-tmp-article-number ?d)
851 (?Z gnus-tmp-unread-and-unselected ?s)
853 (?U gnus-tmp-unread-and-unticked ?d)
854 (?S gnus-tmp-subject ?s)
855 (?e gnus-tmp-unselected ?d)
856 (?u gnus-tmp-user-defined ?s)
857 (?d (length gnus-newsgroup-dormant) ?d)
858 (?t (length gnus-newsgroup-marked) ?d)
859 (?r (length gnus-newsgroup-reads) ?d)
860 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
861 (?E gnus-newsgroup-expunged-tally ?d)
862 (?s (gnus-current-score-file-nondirectory) ?s)))
864 (defvar gnus-last-search-regexp nil
865 "Default regexp for article search command.")
867 (defvar gnus-last-shell-command nil
868 "Default shell command on article.")
870 (defvar gnus-newsgroup-begin nil)
871 (defvar gnus-newsgroup-end nil)
872 (defvar gnus-newsgroup-last-rmail nil)
873 (defvar gnus-newsgroup-last-mail nil)
874 (defvar gnus-newsgroup-last-folder nil)
875 (defvar gnus-newsgroup-last-file nil)
876 (defvar gnus-newsgroup-auto-expire nil)
877 (defvar gnus-newsgroup-active nil)
879 (defvar gnus-newsgroup-data nil)
880 (defvar gnus-newsgroup-data-reverse nil)
881 (defvar gnus-newsgroup-limit nil)
882 (defvar gnus-newsgroup-limits nil)
884 (defvar gnus-newsgroup-unreads nil
885 "List of unread articles in the current newsgroup.")
887 (defvar gnus-newsgroup-unselected nil
888 "List of unselected unread articles in the current newsgroup.")
890 (defvar gnus-newsgroup-reads nil
891 "Alist of read articles and article marks in the current newsgroup.")
893 (defvar gnus-newsgroup-expunged-tally nil)
895 (defvar gnus-newsgroup-marked nil
896 "List of ticked articles in the current newsgroup (a subset of unread art).")
898 (defvar gnus-newsgroup-killed nil
899 "List of ranges of articles that have been through the scoring process.")
901 (defvar gnus-newsgroup-cached nil
902 "List of articles that come from the article cache.")
904 (defvar gnus-newsgroup-saved nil
905 "List of articles that have been saved.")
907 (defvar gnus-newsgroup-kill-headers nil)
909 (defvar gnus-newsgroup-replied nil
910 "List of articles that have been replied to in the current newsgroup.")
912 (defvar gnus-newsgroup-expirable nil
913 "List of articles in the current newsgroup that can be expired.")
915 (defvar gnus-newsgroup-processable nil
916 "List of articles in the current newsgroup that can be processed.")
918 (defvar gnus-newsgroup-downloadable nil
919 "List of articles in the current newsgroup that can be processed.")
921 (defvar gnus-newsgroup-undownloaded nil
922 "List of articles in the current newsgroup that haven't been downloaded..")
924 (defvar gnus-newsgroup-unsendable nil
925 "List of articles in the current newsgroup that won't be sent.")
927 (defvar gnus-newsgroup-bookmarks nil
928 "List of articles in the current newsgroup that have bookmarks.")
930 (defvar gnus-newsgroup-dormant nil
931 "List of dormant articles in the current newsgroup.")
933 (defvar gnus-newsgroup-scored nil
934 "List of scored articles in the current newsgroup.")
936 (defvar gnus-newsgroup-headers nil
937 "List of article headers in the current newsgroup.")
939 (defvar gnus-newsgroup-threads nil)
941 (defvar gnus-newsgroup-prepared nil
942 "Whether the current group has been prepared properly.")
944 (defvar gnus-newsgroup-ancient nil
945 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
947 (defvar gnus-newsgroup-sparse nil)
949 (defvar gnus-current-article nil)
950 (defvar gnus-article-current nil)
951 (defvar gnus-current-headers nil)
952 (defvar gnus-have-all-headers nil)
953 (defvar gnus-last-article nil)
954 (defvar gnus-newsgroup-history nil)
956 (defconst gnus-summary-local-variables
957 '(gnus-newsgroup-name
958 gnus-newsgroup-begin gnus-newsgroup-end
959 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
960 gnus-newsgroup-last-folder gnus-newsgroup-last-file
961 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
962 gnus-newsgroup-unselected gnus-newsgroup-marked
963 gnus-newsgroup-reads gnus-newsgroup-saved
964 gnus-newsgroup-replied gnus-newsgroup-expirable
965 gnus-newsgroup-processable gnus-newsgroup-killed
966 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
967 gnus-newsgroup-unsendable
968 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
969 gnus-newsgroup-headers gnus-newsgroup-threads
970 gnus-newsgroup-prepared gnus-summary-highlight-line-function
971 gnus-current-article gnus-current-headers gnus-have-all-headers
972 gnus-last-article gnus-article-internal-prepare-hook
973 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
974 gnus-newsgroup-scored gnus-newsgroup-kill-headers
975 gnus-thread-expunge-below
976 gnus-score-alist gnus-current-score-file gnus-summary-expunge-below
977 (gnus-summary-mark-below . global)
978 gnus-newsgroup-active gnus-scores-exclude-files
979 gnus-newsgroup-history gnus-newsgroup-ancient
980 gnus-newsgroup-sparse gnus-newsgroup-process-stack
981 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
982 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
983 (gnus-newsgroup-expunged-tally . 0)
984 gnus-cache-removable-articles gnus-newsgroup-cached
985 gnus-newsgroup-data gnus-newsgroup-data-reverse
986 gnus-newsgroup-limit gnus-newsgroup-limits)
987 "Variables that are buffer-local to the summary buffers.")
989 ;; Byte-compiler warning.
990 (defvar gnus-article-mode-map)
992 ;; Subject simplification.
994 (defun gnus-simplify-whitespace (str)
995 "Remove excessive whitespace."
998 (while (string-match "[ \t][ \t]+" mystr)
999 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1001 (substring mystr (match-end 0)))))
1003 (when (string-match "^[ \t]+" mystr)
1004 (setq mystr (substring mystr (match-end 0))))
1006 (when (string-match "[ \t]+$" mystr)
1007 (setq mystr (substring mystr 0 (match-beginning 0))))
1010 (defsubst gnus-simplify-subject-re (subject)
1011 "Remove \"Re:\" from subject lines."
1012 (if (string-match "^[Rr][Ee]: *" subject)
1013 (substring subject (match-end 0))
1016 (defun gnus-simplify-subject (subject &optional re-only)
1017 "Remove `Re:' and words in parentheses.
1018 If RE-ONLY is non-nil, strip leading `Re:'s only."
1019 (let ((case-fold-search t)) ;Ignore case.
1020 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1021 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1022 (setq subject (substring subject (match-end 0))))
1023 ;; Remove uninteresting prefixes.
1024 (when (and (not re-only)
1025 gnus-simplify-ignored-prefixes
1026 (string-match gnus-simplify-ignored-prefixes subject))
1027 (setq subject (substring subject (match-end 0))))
1028 ;; Remove words in parentheses from end.
1030 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1031 (setq subject (substring subject 0 (match-beginning 0)))))
1032 ;; Return subject string.
1035 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1037 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1038 (goto-char (point-min))
1039 (while (re-search-forward regexp nil t)
1040 (replace-match (or newtext ""))))
1042 (defun gnus-simplify-buffer-fuzzy ()
1043 "Simplify string in the buffer fuzzily.
1044 The string in the accessible portion of the current buffer is simplified.
1045 It is assumed to be a single-line subject.
1046 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1047 matter is removed. Additional things can be deleted by setting
1048 gnus-simplify-subject-fuzzy-regexp."
1049 (let ((case-fold-search t)
1051 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1053 (while (not (eq modified-tick (buffer-modified-tick)))
1054 (setq modified-tick (buffer-modified-tick))
1056 ((listp gnus-simplify-subject-fuzzy-regexp)
1057 (mapcar 'gnus-simplify-buffer-fuzzy-step
1058 gnus-simplify-subject-fuzzy-regexp))
1059 (gnus-simplify-subject-fuzzy-regexp
1060 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1061 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1062 (gnus-simplify-buffer-fuzzy-step
1063 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1064 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1066 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1067 (gnus-simplify-buffer-fuzzy-step " +" " ")
1068 (gnus-simplify-buffer-fuzzy-step " $")
1069 (gnus-simplify-buffer-fuzzy-step "^ +")))
1071 (defun gnus-simplify-subject-fuzzy (subject)
1072 "Simplify a subject string fuzzily.
1073 See `gnus-simplify-buffer-fuzzy' for details."
1075 (gnus-set-work-buffer)
1076 (let ((case-fold-search t))
1077 ;; Remove uninteresting prefixes.
1078 (when (and gnus-simplify-ignored-prefixes
1079 (string-match gnus-simplify-ignored-prefixes subject))
1080 (setq subject (substring subject (match-end 0))))
1082 (inline (gnus-simplify-buffer-fuzzy))
1085 (defsubst gnus-simplify-subject-fully (subject)
1086 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1088 (gnus-simplify-subject-functions
1089 (gnus-map-function gnus-simplify-subject-functions subject))
1090 ((null gnus-summary-gather-subject-limit)
1091 (gnus-simplify-subject-re subject))
1092 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1093 (gnus-simplify-subject-fuzzy subject))
1094 ((numberp gnus-summary-gather-subject-limit)
1095 (gnus-limit-string (gnus-simplify-subject-re subject)
1096 gnus-summary-gather-subject-limit))
1100 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1101 "Check whether two subjects are equal.
1102 If optional argument simple-first is t, first argument is already
1105 ((null simple-first)
1106 (equal (gnus-simplify-subject-fully s1)
1107 (gnus-simplify-subject-fully s2)))
1110 (gnus-simplify-subject-fully s2)))))
1112 (defun gnus-summary-bubble-group ()
1113 "Increase the score of the current group.
1114 This is a handy function to add to `gnus-summary-exit-hook' to
1115 increase the score of each group you read."
1116 (gnus-group-add-score gnus-newsgroup-name))
1120 ;;; Gnus summary mode
1123 (put 'gnus-summary-mode 'mode-class 'special)
1126 ;; Non-orthogonal keys
1128 (gnus-define-keys gnus-summary-mode-map
1129 " " gnus-summary-next-page
1130 "\177" gnus-summary-prev-page
1131 [delete] gnus-summary-prev-page
1132 [backspace] gnus-summary-prev-page
1133 "\r" gnus-summary-scroll-up
1134 "\M-\r" gnus-summary-scroll-down
1135 "n" gnus-summary-next-unread-article
1136 "p" gnus-summary-prev-unread-article
1137 "N" gnus-summary-next-article
1138 "P" gnus-summary-prev-article
1139 "\M-\C-n" gnus-summary-next-same-subject
1140 "\M-\C-p" gnus-summary-prev-same-subject
1141 "\M-n" gnus-summary-next-unread-subject
1142 "\M-p" gnus-summary-prev-unread-subject
1143 "." gnus-summary-first-unread-article
1144 "," gnus-summary-best-unread-article
1145 "\M-s" gnus-summary-search-article-forward
1146 "\M-r" gnus-summary-search-article-backward
1147 "<" gnus-summary-beginning-of-article
1148 ">" gnus-summary-end-of-article
1149 "j" gnus-summary-goto-article
1150 "^" gnus-summary-refer-parent-article
1151 "\M-^" gnus-summary-refer-article
1152 "u" gnus-summary-tick-article-forward
1153 "!" gnus-summary-tick-article-forward
1154 "U" gnus-summary-tick-article-backward
1155 "d" gnus-summary-mark-as-read-forward
1156 "D" gnus-summary-mark-as-read-backward
1157 "E" gnus-summary-mark-as-expirable
1158 "\M-u" gnus-summary-clear-mark-forward
1159 "\M-U" gnus-summary-clear-mark-backward
1160 "k" gnus-summary-kill-same-subject-and-select
1161 "\C-k" gnus-summary-kill-same-subject
1162 "\M-\C-k" gnus-summary-kill-thread
1163 "\M-\C-l" gnus-summary-lower-thread
1164 "e" gnus-summary-edit-article
1165 "#" gnus-summary-mark-as-processable
1166 "\M-#" gnus-summary-unmark-as-processable
1167 "\M-\C-t" gnus-summary-toggle-threads
1168 "\M-\C-s" gnus-summary-show-thread
1169 "\M-\C-h" gnus-summary-hide-thread
1170 "\M-\C-f" gnus-summary-next-thread
1171 "\M-\C-b" gnus-summary-prev-thread
1172 "\M-\C-u" gnus-summary-up-thread
1173 "\M-\C-d" gnus-summary-down-thread
1174 "&" gnus-summary-execute-command
1175 "c" gnus-summary-catchup-and-exit
1176 "\C-w" gnus-summary-mark-region-as-read
1177 "\C-t" gnus-summary-toggle-truncation
1178 "?" gnus-summary-mark-as-dormant
1179 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1180 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1181 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1182 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1183 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1184 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1185 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1186 "=" gnus-summary-expand-window
1187 "\C-x\C-s" gnus-summary-reselect-current-group
1188 "\M-g" gnus-summary-rescan-group
1189 "w" gnus-summary-stop-page-breaking
1190 "\C-c\C-r" gnus-summary-caesar-message
1191 "\M-t" gnus-summary-toggle-mime
1192 "f" gnus-summary-followup
1193 "F" gnus-summary-followup-with-original
1194 "C" gnus-summary-cancel-article
1195 "r" gnus-summary-reply
1196 "R" gnus-summary-reply-with-original
1197 "\C-c\C-f" gnus-summary-mail-forward
1198 "o" gnus-summary-save-article
1199 "\C-o" gnus-summary-save-article-mail
1200 "|" gnus-summary-pipe-output
1201 "\M-k" gnus-summary-edit-local-kill
1202 "\M-K" gnus-summary-edit-global-kill
1204 "\C-c\C-d" gnus-summary-describe-group
1205 "q" gnus-summary-exit
1206 "Q" gnus-summary-exit-no-update
1207 "\C-c\C-i" gnus-info-find-node
1208 gnus-mouse-2 gnus-mouse-pick-article
1209 "m" gnus-summary-mail-other-window
1210 "a" gnus-summary-post-news
1211 "x" gnus-summary-limit-to-unread
1212 "s" gnus-summary-isearch-article
1213 "t" gnus-article-hide-headers
1214 "g" gnus-summary-show-article
1215 "l" gnus-summary-goto-last-article
1216 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1217 "\C-d" gnus-summary-enter-digest-group
1218 "\M-\C-d" gnus-summary-read-document
1219 "\M-\C-e" gnus-summary-edit-parameters
1221 "*" gnus-cache-enter-article
1222 "\M-*" gnus-cache-remove-article
1223 "\M-&" gnus-summary-universal-argument
1224 "\C-l" gnus-recenter
1225 "I" gnus-summary-increase-score
1226 "L" gnus-summary-lower-score
1227 "\M-i" gnus-symbolic-argument
1228 "h" gnus-summary-select-article-buffer
1230 "V" gnus-summary-score-map
1231 "X" gnus-uu-extract-map
1232 "S" gnus-summary-send-map)
1234 ;; Sort of orthogonal keymap
1235 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1236 "t" gnus-summary-tick-article-forward
1237 "!" gnus-summary-tick-article-forward
1238 "d" gnus-summary-mark-as-read-forward
1239 "r" gnus-summary-mark-as-read-forward
1240 "c" gnus-summary-clear-mark-forward
1241 " " gnus-summary-clear-mark-forward
1242 "e" gnus-summary-mark-as-expirable
1243 "x" gnus-summary-mark-as-expirable
1244 "?" gnus-summary-mark-as-dormant
1245 "b" gnus-summary-set-bookmark
1246 "B" gnus-summary-remove-bookmark
1247 "#" gnus-summary-mark-as-processable
1248 "\M-#" gnus-summary-unmark-as-processable
1249 "S" gnus-summary-limit-include-expunged
1250 "C" gnus-summary-catchup
1251 "H" gnus-summary-catchup-to-here
1252 "\C-c" gnus-summary-catchup-all
1253 "k" gnus-summary-kill-same-subject-and-select
1254 "K" gnus-summary-kill-same-subject
1255 "P" gnus-uu-mark-map)
1257 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1258 "c" gnus-summary-clear-above
1259 "u" gnus-summary-tick-above
1260 "m" gnus-summary-mark-above
1261 "k" gnus-summary-kill-below)
1263 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1264 "/" gnus-summary-limit-to-subject
1265 "n" gnus-summary-limit-to-articles
1266 "w" gnus-summary-pop-limit
1267 "s" gnus-summary-limit-to-subject
1268 "a" gnus-summary-limit-to-author
1269 "u" gnus-summary-limit-to-unread
1270 "m" gnus-summary-limit-to-marks
1271 "v" gnus-summary-limit-to-score
1272 "*" gnus-summary-limit-include-cached
1273 "D" gnus-summary-limit-include-dormant
1274 "T" gnus-summary-limit-include-thread
1275 "d" gnus-summary-limit-exclude-dormant
1276 "t" gnus-summary-limit-to-age
1277 "E" gnus-summary-limit-include-expunged
1278 "c" gnus-summary-limit-exclude-childless-dormant
1279 "C" gnus-summary-limit-mark-excluded-as-read)
1281 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1282 "n" gnus-summary-next-unread-article
1283 "p" gnus-summary-prev-unread-article
1284 "N" gnus-summary-next-article
1285 "P" gnus-summary-prev-article
1286 "\C-n" gnus-summary-next-same-subject
1287 "\C-p" gnus-summary-prev-same-subject
1288 "\M-n" gnus-summary-next-unread-subject
1289 "\M-p" gnus-summary-prev-unread-subject
1290 "f" gnus-summary-first-unread-article
1291 "b" gnus-summary-best-unread-article
1292 "j" gnus-summary-goto-article
1293 "g" gnus-summary-goto-subject
1294 "l" gnus-summary-goto-last-article
1295 "o" gnus-summary-pop-article)
1297 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1298 "k" gnus-summary-kill-thread
1299 "l" gnus-summary-lower-thread
1300 "i" gnus-summary-raise-thread
1301 "T" gnus-summary-toggle-threads
1302 "t" gnus-summary-rethread-current
1303 "^" gnus-summary-reparent-thread
1304 "s" gnus-summary-show-thread
1305 "S" gnus-summary-show-all-threads
1306 "h" gnus-summary-hide-thread
1307 "H" gnus-summary-hide-all-threads
1308 "n" gnus-summary-next-thread
1309 "p" gnus-summary-prev-thread
1310 "u" gnus-summary-up-thread
1311 "o" gnus-summary-top-thread
1312 "d" gnus-summary-down-thread
1313 "#" gnus-uu-mark-thread
1314 "\M-#" gnus-uu-unmark-thread)
1316 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1317 "g" gnus-summary-prepare
1318 "c" gnus-summary-insert-cached-articles)
1320 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1321 "c" gnus-summary-catchup-and-exit
1322 "C" gnus-summary-catchup-all-and-exit
1323 "E" gnus-summary-exit-no-update
1324 "Q" gnus-summary-exit
1325 "Z" gnus-summary-exit
1326 "n" gnus-summary-catchup-and-goto-next-group
1327 "R" gnus-summary-reselect-current-group
1328 "G" gnus-summary-rescan-group
1329 "N" gnus-summary-next-group
1330 "s" gnus-summary-save-newsrc
1331 "P" gnus-summary-prev-group)
1333 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1334 " " gnus-summary-next-page
1335 "n" gnus-summary-next-page
1336 "\177" gnus-summary-prev-page
1337 [delete] gnus-summary-prev-page
1338 "p" gnus-summary-prev-page
1339 "\r" gnus-summary-scroll-up
1340 "\M-\r" gnus-summary-scroll-down
1341 "<" gnus-summary-beginning-of-article
1342 ">" gnus-summary-end-of-article
1343 "b" gnus-summary-beginning-of-article
1344 "e" gnus-summary-end-of-article
1345 "^" gnus-summary-refer-parent-article
1346 "r" gnus-summary-refer-parent-article
1347 "R" gnus-summary-refer-references
1348 "T" gnus-summary-refer-thread
1349 "g" gnus-summary-show-article
1350 "s" gnus-summary-isearch-article
1351 "P" gnus-summary-print-article)
1353 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1354 "b" gnus-article-add-buttons
1355 "B" gnus-article-add-buttons-to-head
1356 "o" gnus-article-treat-overstrike
1357 "e" gnus-article-emphasize
1358 "w" gnus-article-fill-cited-article
1359 "c" gnus-article-remove-cr
1360 "q" gnus-article-de-quoted-unreadable
1361 "f" gnus-article-display-x-face
1362 "l" gnus-summary-stop-page-breaking
1363 "r" gnus-summary-caesar-message
1364 "t" gnus-article-hide-headers
1365 "v" gnus-summary-verbose-headers
1366 "m" gnus-summary-toggle-mime
1367 "h" gnus-article-treat-html
1368 "d" gnus-article-treat-dumbquotes)
1370 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1371 "a" gnus-article-hide
1372 "h" gnus-article-hide-headers
1373 "b" gnus-article-hide-boring-headers
1374 "s" gnus-article-hide-signature
1375 "c" gnus-article-hide-citation
1376 "C" gnus-article-hide-citation-in-followups
1377 "p" gnus-article-hide-pgp
1378 "P" gnus-article-hide-pem
1379 "\C-c" gnus-article-hide-citation-maybe)
1381 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1382 "a" gnus-article-highlight
1383 "h" gnus-article-highlight-headers
1384 "c" gnus-article-highlight-citation
1385 "s" gnus-article-highlight-signature)
1387 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1388 "w" gnus-article-decode-mime-words
1389 "c" gnus-article-decode-charset)
1391 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1392 "z" gnus-article-date-ut
1393 "u" gnus-article-date-ut
1394 "l" gnus-article-date-local
1395 "e" gnus-article-date-lapsed
1396 "o" gnus-article-date-original
1397 "i" gnus-article-date-iso8601
1398 "s" gnus-article-date-user)
1400 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1401 "t" gnus-article-remove-trailing-blank-lines
1402 "l" gnus-article-strip-leading-blank-lines
1403 "m" gnus-article-strip-multiple-blank-lines
1404 "a" gnus-article-strip-blank-lines
1405 "A" gnus-article-strip-all-blank-lines
1406 "s" gnus-article-strip-leading-space)
1408 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1410 "f" gnus-summary-fetch-faq
1411 "d" gnus-summary-describe-group
1412 "h" gnus-summary-describe-briefly
1413 "i" gnus-info-find-node)
1415 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1416 "e" gnus-summary-expire-articles
1417 "\M-\C-e" gnus-summary-expire-articles-now
1418 "\177" gnus-summary-delete-article
1419 [delete] gnus-summary-delete-article
1420 "m" gnus-summary-move-article
1421 "r" gnus-summary-respool-article
1422 "w" gnus-summary-edit-article
1423 "c" gnus-summary-copy-article
1424 "B" gnus-summary-crosspost-article
1425 "q" gnus-summary-respool-query
1426 "t" gnus-summary-respool-trace
1427 "i" gnus-summary-import-article
1428 "p" gnus-summary-article-posted-p)
1430 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1431 "o" gnus-summary-save-article
1432 "m" gnus-summary-save-article-mail
1433 "F" gnus-summary-write-article-file
1434 "r" gnus-summary-save-article-rmail
1435 "f" gnus-summary-save-article-file
1436 "b" gnus-summary-save-article-body-file
1437 "h" gnus-summary-save-article-folder
1438 "v" gnus-summary-save-article-vm
1439 "p" gnus-summary-pipe-output
1440 "s" gnus-soup-add-article))
1442 (defun gnus-summary-make-menu-bar ()
1443 (gnus-turn-off-edit-menu 'summary)
1445 (unless (boundp 'gnus-summary-misc-menu)
1448 gnus-summary-kill-menu gnus-summary-mode-map ""
1453 ["Enter score..." gnus-summary-score-entry t]
1454 ["Customize" gnus-score-customize t])
1455 (gnus-make-score-map 'increase)
1456 (gnus-make-score-map 'lower)
1458 ["Kill below" gnus-summary-kill-below t]
1459 ["Mark above" gnus-summary-mark-above t]
1460 ["Tick above" gnus-summary-tick-above t]
1461 ["Clear above" gnus-summary-clear-above t])
1462 ["Current score" gnus-summary-current-score t]
1463 ["Set score" gnus-summary-set-score t]
1464 ["Switch current score file..." gnus-score-change-score-file t]
1465 ["Set mark below..." gnus-score-set-mark-below t]
1466 ["Set expunge below..." gnus-score-set-expunge-below t]
1467 ["Edit current score file" gnus-score-edit-current-scores t]
1468 ["Edit score file" gnus-score-edit-file t]
1469 ["Trace score" gnus-score-find-trace t]
1470 ["Find words" gnus-score-find-favourite-words t]
1471 ["Rescore buffer" gnus-summary-rescore t]
1472 ["Increase score..." gnus-summary-increase-score t]
1473 ["Lower score..." gnus-summary-lower-score t]))))
1475 ;; Define both the Article menu in the summary buffer and the equivalent
1476 ;; Commands menu in the article buffer here for consistency.
1479 ["All" gnus-article-hide t]
1480 ["Headers" gnus-article-hide-headers t]
1481 ["Signature" gnus-article-hide-signature t]
1482 ["Citation" gnus-article-hide-citation t]
1483 ["PGP" gnus-article-hide-pgp t]
1484 ["Boring headers" gnus-article-hide-boring-headers t])
1486 ["All" gnus-article-highlight t]
1487 ["Headers" gnus-article-highlight-headers t]
1488 ["Signature" gnus-article-highlight-signature t]
1489 ["Citation" gnus-article-highlight-citation t])
1491 ["Words" gnus-article-decode-mime-words t]
1492 ["Charset" gnus-article-decode-charset t]
1493 ["QP" gnus-article-de-quoted-unreadable t])
1495 ["Local" gnus-article-date-local t]
1496 ["ISO8601" gnus-article-date-iso8601 t]
1497 ["UT" gnus-article-date-ut t]
1498 ["Original" gnus-article-date-original t]
1499 ["Lapsed" gnus-article-date-lapsed t]
1500 ["User-defined" gnus-article-date-user t])
1503 ["Leading" gnus-article-strip-leading-blank-lines t]
1504 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1505 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1506 ["All of the above" gnus-article-strip-blank-lines t]
1507 ["All" gnus-article-strip-all-blank-lines t]
1508 ["Leading space" gnus-article-strip-leading-space t])
1509 ["Overstrike" gnus-article-treat-overstrike t]
1510 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1511 ["Emphasis" gnus-article-emphasize t]
1512 ["Word wrap" gnus-article-fill-cited-article t]
1513 ["CR" gnus-article-remove-cr t]
1514 ["Show X-Face" gnus-article-display-x-face t]
1515 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1516 ["UnHTMLize" gnus-article-treat-html t]
1517 ["Rot 13" gnus-summary-caesar-message t]
1518 ["Unix pipe" gnus-summary-pipe-message t]
1519 ["Add buttons" gnus-article-add-buttons t]
1520 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1521 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1522 ["Toggle MIME" gnus-summary-toggle-mime t]
1523 ["Verbose header" gnus-summary-verbose-headers t]
1524 ["Toggle header" gnus-summary-toggle-header t])
1526 ["Save in default format" gnus-summary-save-article t]
1527 ["Save in file" gnus-summary-save-article-file t]
1528 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1529 ["Save in MH folder" gnus-summary-save-article-folder t]
1530 ["Save in VM folder" gnus-summary-save-article-vm t]
1531 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1532 ["Save body in file" gnus-summary-save-article-body-file t]
1533 ["Pipe through a filter" gnus-summary-pipe-output t]
1534 ["Add to SOUP packet" gnus-soup-add-article t]
1535 ["Print" gnus-summary-print-article t])
1537 ["Respool article..." gnus-summary-respool-article t]
1538 ["Move article..." gnus-summary-move-article
1539 (gnus-check-backend-function
1540 'request-move-article gnus-newsgroup-name)]
1541 ["Copy article..." gnus-summary-copy-article t]
1542 ["Crosspost article..." gnus-summary-crosspost-article
1543 (gnus-check-backend-function
1544 'request-replace-article gnus-newsgroup-name)]
1545 ["Import file..." gnus-summary-import-article t]
1546 ["Check if posted" gnus-summary-article-posted-p t]
1547 ["Edit article" gnus-summary-edit-article
1548 (not (gnus-group-read-only-p))]
1549 ["Delete article" gnus-summary-delete-article
1550 (gnus-check-backend-function
1551 'request-expire-articles gnus-newsgroup-name)]
1552 ["Query respool" gnus-summary-respool-query t]
1553 ["Trace respool" gnus-summary-respool-trace t]
1554 ["Delete expirable articles" gnus-summary-expire-articles-now
1555 (gnus-check-backend-function
1556 'request-expire-articles gnus-newsgroup-name)])
1558 ["Uudecode" gnus-uu-decode-uu t]
1559 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1560 ["Unshar" gnus-uu-decode-unshar t]
1561 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1562 ["Save" gnus-uu-decode-save t]
1563 ["Binhex" gnus-uu-decode-binhex t]
1564 ["Postscript" gnus-uu-decode-postscript t])
1566 ["Enter article" gnus-cache-enter-article t]
1567 ["Remove article" gnus-cache-remove-article t])
1568 ["Select article buffer" gnus-summary-select-article-buffer t]
1569 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1570 ["Isearch article..." gnus-summary-isearch-article t]
1571 ["Beginning of the article" gnus-summary-beginning-of-article t]
1572 ["End of the article" gnus-summary-end-of-article t]
1573 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1574 ["Fetch referenced articles" gnus-summary-refer-references t]
1575 ["Fetch current thread" gnus-summary-refer-thread t]
1576 ["Fetch article with id..." gnus-summary-refer-article t]
1577 ["Redisplay" gnus-summary-show-article t])))
1579 gnus-summary-article-menu gnus-summary-mode-map ""
1580 (cons "Article" innards))
1583 gnus-article-commands-menu gnus-article-mode-map ""
1584 (cons "Commands" innards)))
1587 gnus-summary-thread-menu gnus-summary-mode-map ""
1589 ["Toggle threading" gnus-summary-toggle-threads t]
1590 ["Hide threads" gnus-summary-hide-all-threads t]
1591 ["Show threads" gnus-summary-show-all-threads t]
1592 ["Hide thread" gnus-summary-hide-thread t]
1593 ["Show thread" gnus-summary-show-thread t]
1594 ["Go to next thread" gnus-summary-next-thread t]
1595 ["Go to previous thread" gnus-summary-prev-thread t]
1596 ["Go down thread" gnus-summary-down-thread t]
1597 ["Go up thread" gnus-summary-up-thread t]
1598 ["Top of thread" gnus-summary-top-thread t]
1599 ["Mark thread as read" gnus-summary-kill-thread t]
1600 ["Lower thread score" gnus-summary-lower-thread t]
1601 ["Raise thread score" gnus-summary-raise-thread t]
1602 ["Rethread current" gnus-summary-rethread-current t]
1606 gnus-summary-post-menu gnus-summary-mode-map ""
1608 ["Post an article" gnus-summary-post-news t]
1609 ["Followup" gnus-summary-followup t]
1610 ["Followup and yank" gnus-summary-followup-with-original t]
1611 ["Supersede article" gnus-summary-supersede-article t]
1612 ["Cancel article" gnus-summary-cancel-article t]
1613 ["Reply" gnus-summary-reply t]
1614 ["Reply and yank" gnus-summary-reply-with-original t]
1615 ["Wide reply" gnus-summary-wide-reply t]
1616 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1617 ["Mail forward" gnus-summary-mail-forward t]
1618 ["Post forward" gnus-summary-post-forward t]
1619 ["Digest and mail" gnus-uu-digest-mail-forward t]
1620 ["Digest and post" gnus-uu-digest-post-forward t]
1621 ["Resend message" gnus-summary-resend-message t]
1622 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1623 ["Send a mail" gnus-summary-mail-other-window t]
1624 ["Uuencode and post" gnus-uu-post-news t]
1625 ["Followup via news" gnus-summary-followup-to-mail t]
1626 ["Followup via news and yank"
1627 gnus-summary-followup-to-mail-with-original t]
1629 ;;["Send" gnus-summary-send-draft t]
1630 ;;["Send bounced" gnus-resend-bounced-mail t])
1634 gnus-summary-misc-menu gnus-summary-mode-map ""
1637 ["Mark as read" gnus-summary-mark-as-read-forward t]
1638 ["Mark same subject and select"
1639 gnus-summary-kill-same-subject-and-select t]
1640 ["Mark same subject" gnus-summary-kill-same-subject t]
1641 ["Catchup" gnus-summary-catchup t]
1642 ["Catchup all" gnus-summary-catchup-all t]
1643 ["Catchup to here" gnus-summary-catchup-to-here t]
1644 ["Catchup region" gnus-summary-mark-region-as-read t]
1645 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1647 ["Tick" gnus-summary-tick-article-forward t]
1648 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1649 ["Remove marks" gnus-summary-clear-mark-forward t]
1650 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1651 ["Set bookmark" gnus-summary-set-bookmark t]
1652 ["Remove bookmark" gnus-summary-remove-bookmark t])
1654 ["Marks..." gnus-summary-limit-to-marks t]
1655 ["Subject..." gnus-summary-limit-to-subject t]
1656 ["Author..." gnus-summary-limit-to-author t]
1657 ["Age..." gnus-summary-limit-to-age t]
1658 ["Score" gnus-summary-limit-to-score t]
1659 ["Unread" gnus-summary-limit-to-unread t]
1660 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1661 ["Articles" gnus-summary-limit-to-articles t]
1662 ["Pop limit" gnus-summary-pop-limit t]
1663 ["Show dormant" gnus-summary-limit-include-dormant t]
1664 ["Hide childless dormant"
1665 gnus-summary-limit-exclude-childless-dormant t]
1666 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1667 ["Show expunged" gnus-summary-show-all-expunged t])
1669 ["Set mark" gnus-summary-mark-as-processable t]
1670 ["Remove mark" gnus-summary-unmark-as-processable t]
1671 ["Remove all marks" gnus-summary-unmark-all-processable t]
1672 ["Mark above" gnus-uu-mark-over t]
1673 ["Mark series" gnus-uu-mark-series t]
1674 ["Mark region" gnus-uu-mark-region t]
1675 ["Unmark region" gnus-uu-unmark-region t]
1676 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1677 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1678 ["Mark all" gnus-uu-mark-all t]
1679 ["Mark buffer" gnus-uu-mark-buffer t]
1680 ["Mark sparse" gnus-uu-mark-sparse t]
1681 ["Mark thread" gnus-uu-mark-thread t]
1682 ["Unmark thread" gnus-uu-unmark-thread t]
1683 ("Process Mark Sets"
1684 ["Kill" gnus-summary-kill-process-mark t]
1685 ["Yank" gnus-summary-yank-process-mark
1686 gnus-newsgroup-process-stack]
1687 ["Save" gnus-summary-save-process-mark t]))
1689 ["Page forward" gnus-summary-next-page t]
1690 ["Page backward" gnus-summary-prev-page t]
1691 ["Line forward" gnus-summary-scroll-up t])
1693 ["Next unread article" gnus-summary-next-unread-article t]
1694 ["Previous unread article" gnus-summary-prev-unread-article t]
1695 ["Next article" gnus-summary-next-article t]
1696 ["Previous article" gnus-summary-prev-article t]
1697 ["Next unread subject" gnus-summary-next-unread-subject t]
1698 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1699 ["Next article same subject" gnus-summary-next-same-subject t]
1700 ["Previous article same subject" gnus-summary-prev-same-subject t]
1701 ["First unread article" gnus-summary-first-unread-article t]
1702 ["Best unread article" gnus-summary-best-unread-article t]
1703 ["Go to subject number..." gnus-summary-goto-subject t]
1704 ["Go to article number..." gnus-summary-goto-article t]
1705 ["Go to the last article" gnus-summary-goto-last-article t]
1706 ["Pop article off history" gnus-summary-pop-article t])
1708 ["Sort by number" gnus-summary-sort-by-number t]
1709 ["Sort by author" gnus-summary-sort-by-author t]
1710 ["Sort by subject" gnus-summary-sort-by-subject t]
1711 ["Sort by date" gnus-summary-sort-by-date t]
1712 ["Sort by score" gnus-summary-sort-by-score t]
1713 ["Sort by lines" gnus-summary-sort-by-lines t])
1715 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1716 ["Describe group" gnus-summary-describe-group t]
1717 ["Read manual" gnus-info-find-node t])
1719 ["Pick and read" gnus-pick-mode t]
1720 ["Binary" gnus-binary-mode t])
1722 ["Regenerate" gnus-summary-prepare t]
1723 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1724 ["Toggle threading" gnus-summary-toggle-threads t])
1725 ["Filter articles..." gnus-summary-execute-command t]
1726 ["Run command on subjects..." gnus-summary-universal-argument t]
1727 ["Search articles forward..." gnus-summary-search-article-forward t]
1728 ["Search articles backward..." gnus-summary-search-article-backward t]
1729 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1730 ["Expand window" gnus-summary-expand-window t]
1731 ["Expire expirable articles" gnus-summary-expire-articles
1732 (gnus-check-backend-function
1733 'request-expire-articles gnus-newsgroup-name)]
1734 ["Edit local kill file" gnus-summary-edit-local-kill t]
1735 ["Edit main kill file" gnus-summary-edit-global-kill t]
1736 ["Edit group parameters" gnus-summary-edit-parameters t]
1737 ["Send a bug report" gnus-bug t]
1739 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1740 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1741 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1742 ["Exit group" gnus-summary-exit t]
1743 ["Exit group without updating" gnus-summary-exit-no-update t]
1744 ["Exit and goto next group" gnus-summary-next-group t]
1745 ["Exit and goto prev group" gnus-summary-prev-group t]
1746 ["Reselect group" gnus-summary-reselect-current-group t]
1747 ["Rescan group" gnus-summary-rescan-group t]
1748 ["Update dribble" gnus-summary-save-newsrc t])))
1750 (gnus-run-hooks 'gnus-summary-menu-hook)))
1752 (defun gnus-score-set-default (var value)
1753 "A version of set that updates the GNU Emacs menu-bar."
1755 ;; It is the message that forces the active status to be updated.
1758 (defun gnus-make-score-map (type)
1759 "Make a summary score map of type TYPE."
1762 (let ((headers '(("author" "from" string)
1763 ("subject" "subject" string)
1764 ("article body" "body" string)
1765 ("article head" "head" string)
1766 ("xref" "xref" string)
1767 ("lines" "lines" number)
1768 ("followups to author" "followup" string)))
1769 (types '((number ("less than" <)
1772 (string ("substring" s)
1776 (perms '(("temporary" (current-time-string))
1784 (if (eq type 'lower)
1789 (setq header (car headers))
1795 (let ((ts (cdr (assoc (nth 2 header) types)))
1811 'gnus-summary-score-entry
1813 (if (or (string= (nth 1 header)
1815 (string= (nth 1 header)
1818 (list 'gnus-summary-header
1820 (list 'quote (nth 1 (car ts)))
1821 (list 'gnus-score-default nil)
1827 (list (nreverse outp))))
1830 (list (nreverse outt))))
1832 (setq headers (cdr headers)))
1833 (list (nreverse outh))))))))
1837 (defun gnus-summary-mode (&optional group)
1838 "Major mode for reading articles.
1840 All normal editing commands are switched off.
1841 \\<gnus-summary-mode-map>
1842 Each line in this buffer represents one article. To read an
1843 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
1844 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
1847 You can also post articles and send mail from this buffer. To
1848 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
1849 of an article, type `\\[gnus-summary-reply]'.
1851 There are approx. one gazillion commands you can execute in this
1852 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
1854 The following commands are available:
1856 \\{gnus-summary-mode-map}"
1858 (when (gnus-visual-p 'summary-menu 'menu)
1859 (gnus-summary-make-menu-bar))
1860 (kill-all-local-variables)
1861 (gnus-summary-make-local-variables)
1862 (gnus-make-thread-indent-array)
1863 (gnus-simplify-mode-line)
1864 (setq major-mode 'gnus-summary-mode)
1865 (setq mode-name "Summary")
1866 (make-local-variable 'minor-mode-alist)
1867 (use-local-map gnus-summary-mode-map)
1868 (buffer-disable-undo (current-buffer))
1869 (setq buffer-read-only t) ;Disable modification
1870 (setq truncate-lines t)
1871 (setq selective-display t)
1872 (setq selective-display-ellipses t) ;Display `...'
1873 (gnus-summary-set-display-table)
1874 (gnus-set-default-directory)
1875 (setq gnus-newsgroup-name group)
1876 (make-local-variable 'gnus-summary-line-format)
1877 (make-local-variable 'gnus-summary-line-format-spec)
1878 (make-local-variable 'gnus-summary-dummy-line-format)
1879 (make-local-variable 'gnus-summary-dummy-line-format-spec)
1880 (make-local-variable 'gnus-summary-mark-positions)
1881 (make-local-hook 'post-command-hook)
1882 (add-hook 'post-command-hook 'gnus-clear-inboxes-moved nil t)
1883 (make-local-hook 'pre-command-hook)
1884 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
1885 (gnus-run-hooks 'gnus-summary-mode-hook)
1886 (mm-enable-multibyte)
1887 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
1888 (gnus-update-summary-mark-positions))
1890 (defun gnus-summary-make-local-variables ()
1891 "Make all the local summary buffer variables."
1892 (let ((locals gnus-summary-local-variables)
1894 (while (setq local (pop locals))
1897 (if (eq (cdr local) 'global)
1898 ;; Copy the global value of the variable.
1899 (setq global (symbol-value (car local)))
1900 ;; Use the value from the list.
1901 (setq global (eval (cdr local))))
1902 (make-local-variable (car local))
1903 (set (car local) global))
1904 ;; Simple nil-valued local variable.
1905 (make-local-variable local)
1908 (defun gnus-summary-clear-local-variables ()
1909 (let ((locals gnus-summary-local-variables))
1911 (if (consp (car locals))
1912 (and (vectorp (caar locals))
1913 (set (caar locals) nil))
1914 (and (vectorp (car locals))
1915 (set (car locals) nil)))
1916 (setq locals (cdr locals)))))
1918 ;; Summary data functions.
1920 (defmacro gnus-data-number (data)
1923 (defmacro gnus-data-set-number (data number)
1924 `(setcar ,data ,number))
1926 (defmacro gnus-data-mark (data)
1929 (defmacro gnus-data-set-mark (data mark)
1930 `(setcar (nthcdr 1 ,data) ,mark))
1932 (defmacro gnus-data-pos (data)
1935 (defmacro gnus-data-set-pos (data pos)
1936 `(setcar (nthcdr 2 ,data) ,pos))
1938 (defmacro gnus-data-header (data)
1941 (defmacro gnus-data-set-header (data header)
1942 `(setf (nth 3 ,data) ,header))
1944 (defmacro gnus-data-level (data)
1947 (defmacro gnus-data-unread-p (data)
1948 `(= (nth 1 ,data) gnus-unread-mark))
1950 (defmacro gnus-data-read-p (data)
1951 `(/= (nth 1 ,data) gnus-unread-mark))
1953 (defmacro gnus-data-pseudo-p (data)
1954 `(consp (nth 3 ,data)))
1956 (defmacro gnus-data-find (number)
1957 `(assq ,number gnus-newsgroup-data))
1959 (defmacro gnus-data-find-list (number &optional data)
1960 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
1961 (memq (assq ,number bdata)
1964 (defmacro gnus-data-make (number mark pos header level)
1965 `(list ,number ,mark ,pos ,header ,level))
1967 (defun gnus-data-enter (after-article number mark pos header level offset)
1968 (let ((data (gnus-data-find-list after-article)))
1970 (error "No such article: %d" after-article))
1971 (setcdr data (cons (gnus-data-make number mark pos header level)
1973 (setq gnus-newsgroup-data-reverse nil)
1974 (gnus-data-update-list (cddr data) offset)))
1976 (defun gnus-data-enter-list (after-article list &optional offset)
1978 (let ((data (and after-article (gnus-data-find-list after-article)))
1982 (let ((odata gnus-newsgroup-data))
1983 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
1985 (gnus-data-update-list odata offset)))
1986 ;; Find the last element in the list to be spliced into the main
1989 (setq list (cdr list)))
1992 (setcdr list gnus-newsgroup-data)
1993 (setq gnus-newsgroup-data ilist)
1995 (gnus-data-update-list (cdr list) offset)))
1996 (setcdr list (cdr data))
1999 (gnus-data-update-list (cdr list) offset))))
2000 (setq gnus-newsgroup-data-reverse nil))))
2002 (defun gnus-data-remove (article &optional offset)
2003 (let ((data gnus-newsgroup-data))
2004 (if (= (gnus-data-number (car data)) article)
2006 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2007 gnus-newsgroup-data-reverse nil)
2009 (gnus-data-update-list gnus-newsgroup-data offset)))
2011 (when (= (gnus-data-number (cadr data)) article)
2012 (setcdr data (cddr data))
2014 (gnus-data-update-list (cdr data) offset))
2016 gnus-newsgroup-data-reverse nil))
2017 (setq data (cdr data))))))
2019 (defmacro gnus-data-list (backward)
2021 (or gnus-newsgroup-data-reverse
2022 (setq gnus-newsgroup-data-reverse
2023 (reverse gnus-newsgroup-data)))
2024 gnus-newsgroup-data))
2026 (defun gnus-data-update-list (data offset)
2027 "Add OFFSET to the POS of all data entries in DATA."
2028 (setq gnus-newsgroup-data-reverse nil)
2030 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2031 (setq data (cdr data))))
2033 (defun gnus-data-compute-positions ()
2034 "Compute the positions of all articles."
2035 (setq gnus-newsgroup-data-reverse nil)
2036 (let ((data gnus-newsgroup-data))
2038 (gnus-save-hidden-threads
2039 (goto-char (point-min))
2041 (while (get-text-property (point) 'gnus-intangible)
2043 (gnus-data-set-pos (car data) (+ (point) 3))
2044 (setq data (cdr data))
2045 (forward-line 1))))))
2047 (defun gnus-summary-article-pseudo-p (article)
2048 "Say whether this article is a pseudo article or not."
2049 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2051 (defmacro gnus-summary-article-sparse-p (article)
2052 "Say whether this article is a sparse article or not."
2053 `(memq ,article gnus-newsgroup-sparse))
2055 (defmacro gnus-summary-article-ancient-p (article)
2056 "Say whether this article is a sparse article or not."
2057 `(memq ,article gnus-newsgroup-ancient))
2059 (defun gnus-article-parent-p (number)
2060 "Say whether this article is a parent or not."
2061 (let ((data (gnus-data-find-list number)))
2062 (and (cdr data) ; There has to be an article after...
2063 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2064 (gnus-data-level (nth 1 data))))))
2066 (defun gnus-article-children (number)
2067 "Return a list of all children to NUMBER."
2068 (let* ((data (gnus-data-find-list number))
2069 (level (gnus-data-level (car data)))
2071 (setq data (cdr data))
2073 (= (gnus-data-level (car data)) (1+ level)))
2074 (push (gnus-data-number (car data)) children)
2075 (setq data (cdr data)))
2078 (defmacro gnus-summary-skip-intangible ()
2079 "If the current article is intangible, then jump to a different article."
2080 '(let ((to (get-text-property (point) 'gnus-intangible)))
2081 (and to (gnus-summary-goto-subject to))))
2083 (defmacro gnus-summary-article-intangible-p ()
2084 "Say whether this article is intangible or not."
2085 '(get-text-property (point) 'gnus-intangible))
2087 (defun gnus-article-read-p (article)
2088 "Say whether ARTICLE is read or not."
2089 (not (or (memq article gnus-newsgroup-marked)
2090 (memq article gnus-newsgroup-unreads)
2091 (memq article gnus-newsgroup-unselected)
2092 (memq article gnus-newsgroup-dormant))))
2094 ;; Some summary mode macros.
2096 (defmacro gnus-summary-article-number ()
2097 "The article number of the article on the current line.
2098 If there isn's an article number here, then we return the current
2101 (gnus-summary-skip-intangible)
2102 (or (get-text-property (point) 'gnus-number)
2103 (gnus-summary-last-subject))))
2105 (defmacro gnus-summary-article-header (&optional number)
2106 "Return the header of article NUMBER."
2107 `(gnus-data-header (gnus-data-find
2108 ,(or number '(gnus-summary-article-number)))))
2110 (defmacro gnus-summary-thread-level (&optional number)
2111 "Return the level of thread that starts with article NUMBER."
2112 `(if (and (eq gnus-summary-make-false-root 'dummy)
2113 (get-text-property (point) 'gnus-intangible))
2115 (gnus-data-level (gnus-data-find
2116 ,(or number '(gnus-summary-article-number))))))
2118 (defmacro gnus-summary-article-mark (&optional number)
2119 "Return the mark of article NUMBER."
2120 `(gnus-data-mark (gnus-data-find
2121 ,(or number '(gnus-summary-article-number)))))
2123 (defmacro gnus-summary-article-pos (&optional number)
2124 "Return the position of the line of article NUMBER."
2125 `(gnus-data-pos (gnus-data-find
2126 ,(or number '(gnus-summary-article-number)))))
2128 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2129 (defmacro gnus-summary-article-subject (&optional number)
2130 "Return current subject string or nil if nothing."
2133 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2134 '(gnus-data-header (assq (gnus-summary-article-number)
2135 gnus-newsgroup-data)))))
2138 (mail-header-subject headers))))
2140 (defmacro gnus-summary-article-score (&optional number)
2141 "Return current article score."
2142 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2143 gnus-newsgroup-scored))
2144 gnus-summary-default-score 0))
2146 (defun gnus-summary-article-children (&optional number)
2147 "Return a list of article numbers that are children of article NUMBER."
2148 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2149 (level (gnus-data-level (car data)))
2151 (while (and (setq data (cdr data))
2152 (> (setq l (gnus-data-level (car data))) level))
2153 (and (= (1+ level) l)
2154 (push (gnus-data-number (car data))
2156 (nreverse children)))
2158 (defun gnus-summary-article-parent (&optional number)
2159 "Return the article number of the parent of article NUMBER."
2160 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2161 (gnus-data-list t)))
2162 (level (gnus-data-level (car data))))
2164 () ; This is a root.
2165 ;; We search until we find an article with a level less than
2166 ;; this one. That function has to be the parent.
2167 (while (and (setq data (cdr data))
2168 (not (< (gnus-data-level (car data)) level))))
2169 (and data (gnus-data-number (car data))))))
2171 (defun gnus-unread-mark-p (mark)
2172 "Say whether MARK is the unread mark."
2173 (= mark gnus-unread-mark))
2175 (defun gnus-read-mark-p (mark)
2176 "Say whether MARK is one of the marks that mark as read.
2177 This is all marks except unread, ticked, dormant, and expirable."
2178 (not (or (= mark gnus-unread-mark)
2179 (= mark gnus-ticked-mark)
2180 (= mark gnus-dormant-mark)
2181 (= mark gnus-expirable-mark))))
2183 (defmacro gnus-article-mark (number)
2184 "Return the MARK of article NUMBER.
2185 This macro should only be used when computing the mark the \"first\"
2186 time; i.e., when generating the summary lines. After that,
2187 `gnus-summary-article-mark' should be used to examine the
2190 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2191 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2192 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2193 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2194 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2195 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2196 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2197 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2198 gnus-ancient-mark))))
2200 ;; Saving hidden threads.
2202 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2203 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2205 (defmacro gnus-save-hidden-threads (&rest forms)
2206 "Save hidden threads, eval FORMS, and restore the hidden threads."
2207 (let ((config (make-symbol "config")))
2208 `(let ((,config (gnus-hidden-threads-configuration)))
2212 (gnus-restore-hidden-threads-configuration ,config)))))
2214 (defun gnus-hidden-threads-configuration ()
2215 "Return the current hidden threads configuration."
2218 (goto-char (point-min))
2219 (while (search-forward "\r" nil t)
2220 (push (1- (point)) config))
2223 (defun gnus-restore-hidden-threads-configuration (config)
2224 "Restore hidden threads configuration from CONFIG."
2225 (let (point buffer-read-only)
2226 (while (setq point (pop config))
2227 (when (and (< point (point-max))
2229 (= (following-char) ?\n))
2230 (subst-char-in-region point (1+ point) ?\n ?\r)))))
2232 ;; Various summary mode internalish functions.
2234 (defun gnus-mouse-pick-article (e)
2237 (gnus-summary-next-page nil t))
2239 (defun gnus-summary-set-display-table ()
2240 ;; Change the display table. Odd characters have a tendency to mess
2241 ;; up nicely formatted displays - we make all possible glyphs
2242 ;; display only a single character.
2244 ;; We start from the standard display table, if any.
2245 (let ((table (or (copy-sequence standard-display-table)
2246 (make-display-table)))
2248 ;; Nix out all the control chars...
2249 (while (>= (setq i (1- i)) 0)
2250 (aset table i [??]))
2251 ;; ... but not newline and cr, of course. (cr is necessary for the
2252 ;; selective display).
2253 (aset table ?\n nil)
2254 (aset table ?\r nil)
2255 ;; We keep TAB as well.
2256 (aset table ?\t nil)
2257 ;; We nix out any glyphs over 126 that are not set already.
2259 (while (>= (setq i (1- i)) 127)
2260 ;; Only modify if the entry is nil.
2261 (unless (aref table i)
2262 (aset table i [??]))))
2263 (setq buffer-display-table table)))
2265 (defun gnus-summary-setup-buffer (group)
2266 "Initialize summary buffer."
2267 (let ((buffer (concat "*Summary " group "*")))
2268 (if (get-buffer buffer)
2271 (setq gnus-summary-buffer (current-buffer))
2272 (not gnus-newsgroup-prepared))
2273 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2274 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2275 (gnus-summary-mode group)
2277 (gnus-carpal-setup-buffer 'summary))
2278 (unless gnus-single-article-buffer
2279 (make-local-variable 'gnus-article-buffer)
2280 (make-local-variable 'gnus-article-current)
2281 (make-local-variable 'gnus-original-article-buffer))
2282 (setq gnus-newsgroup-name group)
2285 (defun gnus-set-global-variables ()
2286 ;; Set the global equivalents of the summary buffer-local variables
2287 ;; to the latest values they had. These reflect the summary buffer
2288 ;; that was in action when the last article was fetched.
2289 (when (eq major-mode 'gnus-summary-mode)
2290 (setq gnus-summary-buffer (current-buffer))
2291 (let ((name gnus-newsgroup-name)
2292 (marked gnus-newsgroup-marked)
2293 (unread gnus-newsgroup-unreads)
2294 (headers gnus-current-headers)
2295 (data gnus-newsgroup-data)
2296 (summary gnus-summary-buffer)
2297 (article-buffer gnus-article-buffer)
2298 (original gnus-original-article-buffer)
2299 (gac gnus-article-current)
2300 (reffed gnus-reffed-article-number)
2301 (score-file gnus-current-score-file))
2303 (set-buffer gnus-group-buffer)
2304 (setq gnus-newsgroup-name name
2305 gnus-newsgroup-marked marked
2306 gnus-newsgroup-unreads unread
2307 gnus-current-headers headers
2308 gnus-newsgroup-data data
2309 gnus-article-current gac
2310 gnus-summary-buffer summary
2311 gnus-article-buffer article-buffer
2312 gnus-original-article-buffer original
2313 gnus-reffed-article-number reffed
2314 gnus-current-score-file score-file)
2315 ;; The article buffer also has local variables.
2316 (when (gnus-buffer-live-p gnus-article-buffer)
2317 (set-buffer gnus-article-buffer)
2318 (setq gnus-summary-buffer summary))))))
2320 (defun gnus-summary-article-unread-p (article)
2321 "Say whether ARTICLE is unread or not."
2322 (memq article gnus-newsgroup-unreads))
2324 (defun gnus-summary-first-article-p (&optional article)
2325 "Return whether ARTICLE is the first article in the buffer."
2326 (if (not (setq article (or article (gnus-summary-article-number))))
2328 (eq article (caar gnus-newsgroup-data))))
2330 (defun gnus-summary-last-article-p (&optional article)
2331 "Return whether ARTICLE is the last article in the buffer."
2332 (if (not (setq article (or article (gnus-summary-article-number))))
2333 t ; All non-existent numbers are the last article. :-)
2334 (not (cdr (gnus-data-find-list article)))))
2336 (defun gnus-make-thread-indent-array ()
2338 (unless (and gnus-thread-indent-array
2339 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2340 (setq gnus-thread-indent-array (make-vector 201 "")
2341 gnus-thread-indent-array-level gnus-thread-indent-level)
2343 (aset gnus-thread-indent-array n
2344 (make-string (* n gnus-thread-indent-level) ? ))
2347 (defun gnus-update-summary-mark-positions ()
2348 "Compute where the summary marks are to go."
2350 (when (gnus-buffer-exists-p gnus-summary-buffer)
2351 (set-buffer gnus-summary-buffer))
2352 (let ((gnus-replied-mark 129)
2353 (gnus-score-below-mark 130)
2354 (gnus-score-over-mark 130)
2355 (gnus-download-mark 131)
2356 (spec gnus-summary-line-format-spec)
2359 (gnus-set-work-buffer)
2360 (let ((gnus-summary-line-format-spec spec)
2361 (gnus-newsgroup-downloadable '((0 . t))))
2362 (gnus-summary-insert-line
2363 [0 "" "" "" "" "" 0 0 ""] 0 nil 128 t nil "" nil 1)
2364 (goto-char (point-min))
2365 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2367 (goto-char (point-min))
2368 (push (cons 'replied (and (search-forward "\201" nil t)
2371 (goto-char (point-min))
2372 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2374 (goto-char (point-min))
2375 (push (cons 'download
2376 (and (search-forward "\203" nil t) (- (point) 2)))
2378 (setq gnus-summary-mark-positions pos))))
2380 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2381 "Insert a dummy root in the summary buffer."
2383 (gnus-add-text-properties
2384 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2385 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2387 (defun gnus-summary-insert-line (gnus-tmp-header
2388 gnus-tmp-level gnus-tmp-current
2389 gnus-tmp-unread gnus-tmp-replied
2390 gnus-tmp-expirable gnus-tmp-subject-or-nil
2391 &optional gnus-tmp-dummy gnus-tmp-score
2393 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2394 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2395 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2396 (gnus-tmp-score-char
2397 (if (or (null gnus-summary-default-score)
2398 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2399 gnus-summary-zcore-fuzz))
2401 (if (< gnus-tmp-score gnus-summary-default-score)
2402 gnus-score-below-mark gnus-score-over-mark)))
2404 (cond (gnus-tmp-process gnus-process-mark)
2405 ((memq gnus-tmp-current gnus-newsgroup-cached)
2407 (gnus-tmp-replied gnus-replied-mark)
2408 ((memq gnus-tmp-current gnus-newsgroup-saved)
2410 (t gnus-unread-mark)))
2411 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2414 ((string-match "<[^>]+> *$" gnus-tmp-from)
2415 (let ((beg (match-beginning 0)))
2416 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2417 (substring gnus-tmp-from (1+ (match-beginning 0))
2418 (1- (match-end 0))))
2419 (substring gnus-tmp-from 0 beg))))
2420 ((string-match "(.+)" gnus-tmp-from)
2421 (substring gnus-tmp-from
2422 (1+ (match-beginning 0)) (1- (match-end 0))))
2424 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2425 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2426 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2427 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2428 (buffer-read-only nil))
2429 (when (string= gnus-tmp-name "")
2430 (setq gnus-tmp-name gnus-tmp-from))
2431 (unless (numberp gnus-tmp-lines)
2432 (setq gnus-tmp-lines 0))
2433 (gnus-put-text-property-excluding-characters-with-faces
2435 (progn (eval gnus-summary-line-format-spec) (point))
2436 'gnus-number gnus-tmp-number)
2437 (when (gnus-visual-p 'summary-highlight 'highlight)
2439 (gnus-run-hooks 'gnus-summary-update-hook)
2442 (defun gnus-summary-update-line (&optional dont-update)
2443 ;; Update summary line after change.
2444 (when (and gnus-summary-default-score
2445 (not gnus-summary-inhibit-highlight))
2446 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2447 (article (gnus-summary-article-number))
2448 (score (gnus-summary-article-score article)))
2450 (if (and gnus-summary-mark-below
2451 (< (gnus-summary-article-score)
2452 gnus-summary-mark-below))
2453 ;; This article has a low score, so we mark it as read.
2454 (when (memq article gnus-newsgroup-unreads)
2455 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2456 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2457 ;; This article was previously marked as read on account
2458 ;; of a low score, but now it has risen, so we mark it as
2460 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2461 (gnus-summary-update-mark
2462 (if (or (null gnus-summary-default-score)
2463 (<= (abs (- score gnus-summary-default-score))
2464 gnus-summary-zcore-fuzz))
2466 (if (< score gnus-summary-default-score)
2467 gnus-score-below-mark gnus-score-over-mark))
2469 ;; Do visual highlighting.
2470 (when (gnus-visual-p 'summary-highlight 'highlight)
2471 (gnus-run-hooks 'gnus-summary-update-hook)))))
2473 (defvar gnus-tmp-new-adopts nil)
2475 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2476 "Return the number of articles in THREAD.
2477 This may be 0 in some cases -- if none of the articles in
2478 the thread are to be displayed."
2480 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2482 ((not (listp thread))
2484 ((and (consp thread) (cdr thread))
2487 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2490 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2493 (when (and level (zerop level) gnus-tmp-new-adopts)
2496 'gnus-summary-number-of-articles-in-thread
2497 gnus-tmp-new-adopts))))
2499 (if (> number 1) gnus-not-empty-thread-mark
2500 gnus-empty-thread-mark)
2503 (defun gnus-summary-set-local-parameters (group)
2504 "Go through the local params of GROUP and set all variable specs in that list."
2505 (let ((params (gnus-group-find-parameter group))
2508 (setq elem (car params)
2509 params (cdr params))
2510 (and (consp elem) ; Has to be a cons.
2511 (consp (cdr elem)) ; The cdr has to be a list.
2512 (symbolp (car elem)) ; Has to be a symbol in there.
2513 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2514 (ignore-errors ; So we set it.
2515 (make-local-variable (car elem))
2516 (set (car elem) (eval (nth 1 elem))))))))
2518 (defun gnus-summary-read-group (group &optional show-all no-article
2519 kill-buffer no-display backward
2521 "Start reading news in newsgroup GROUP.
2522 If SHOW-ALL is non-nil, already read articles are also listed.
2523 If NO-ARTICLE is non-nil, no article is selected initially.
2524 If NO-DISPLAY, don't generate a summary buffer."
2528 (let ((gnus-auto-select-next nil))
2529 (or (gnus-summary-read-group-1
2530 group show-all no-article
2531 kill-buffer no-display
2534 select-articles nil)))))
2535 (eq gnus-auto-select-next 'quietly))
2536 (set-buffer gnus-group-buffer)
2537 ;; The entry function called above goes to the next
2538 ;; group automatically, so we go two groups back
2539 ;; if we are searching for the previous group.
2541 (gnus-group-prev-unread-group 2))
2542 (if (not (equal group (gnus-group-group-name)))
2543 (setq group (gnus-group-group-name))
2547 (defun gnus-summary-read-group-1 (group show-all no-article
2548 kill-buffer no-display
2549 &optional select-articles)
2550 ;; Killed foreign groups can't be entered.
2551 (when (and (not (gnus-group-native-p group))
2552 (not (gnus-gethash group gnus-newsrc-hashtb)))
2553 (error "Dead non-native groups can't be entered"))
2554 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2555 (let* ((new-group (gnus-summary-setup-buffer group))
2556 (quit-config (gnus-group-quit-config group))
2557 (did-select (and new-group (gnus-select-newsgroup
2558 group show-all select-articles))))
2560 ;; This summary buffer exists already, so we just select it.
2562 (gnus-set-global-variables)
2564 (gnus-kill-or-deaden-summary kill-buffer))
2565 (gnus-configure-windows 'summary 'force)
2566 (gnus-set-mode-line 'summary)
2567 (gnus-summary-position-point)
2570 ;; We couldn't select this group.
2572 (when (and (eq major-mode 'gnus-summary-mode)
2573 (not (equal (current-buffer) kill-buffer)))
2574 (kill-buffer (current-buffer))
2575 (if (not quit-config)
2577 ;; Update the info -- marks might need to be removed,
2579 (gnus-summary-update-info)
2580 (set-buffer gnus-group-buffer)
2581 (gnus-group-jump-to-group group)
2582 (gnus-group-next-unread-group 1))
2583 (gnus-handle-ephemeral-exit quit-config)))
2584 (gnus-message 3 "Can't select group")
2586 ;; The user did a `C-g' while prompting for number of articles,
2587 ;; so we exit this group.
2588 ((eq did-select 'quit)
2589 (and (eq major-mode 'gnus-summary-mode)
2590 (not (equal (current-buffer) kill-buffer))
2591 (kill-buffer (current-buffer)))
2593 (gnus-kill-or-deaden-summary kill-buffer))
2594 (if (not quit-config)
2596 (set-buffer gnus-group-buffer)
2597 (gnus-group-jump-to-group group)
2598 (gnus-group-next-unread-group 1)
2599 (gnus-configure-windows 'group 'force))
2600 (gnus-handle-ephemeral-exit quit-config))
2601 ;; Finally signal the quit.
2603 ;; The group was successfully selected.
2605 (gnus-set-global-variables)
2606 ;; Save the active value in effect when the group was entered.
2607 (setq gnus-newsgroup-active
2609 (gnus-active gnus-newsgroup-name)))
2610 ;; You can change the summary buffer in some way with this hook.
2611 (gnus-run-hooks 'gnus-select-group-hook)
2612 ;; Set any local variables in the group parameters.
2613 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2614 (gnus-update-format-specifications
2615 nil 'summary 'summary-mode 'summary-dummy)
2616 ;; Do score processing.
2617 (when gnus-use-scoring
2618 (gnus-possibly-score-headers))
2619 ;; Check whether to fill in the gaps in the threads.
2620 (when gnus-build-sparse-threads
2621 (gnus-build-sparse-threads))
2622 ;; Find the initial limit.
2623 (if gnus-show-threads
2625 (let ((gnus-newsgroup-dormant nil))
2626 (gnus-summary-initial-limit show-all))
2627 (gnus-summary-initial-limit show-all))
2628 (setq gnus-newsgroup-limit
2630 (lambda (header) (mail-header-number header))
2631 gnus-newsgroup-headers)))
2632 ;; Generate the summary buffer.
2634 (gnus-summary-prepare))
2635 (when gnus-use-trees
2636 (gnus-tree-open group)
2637 (setq gnus-summary-highlight-line-function
2638 'gnus-tree-highlight-article))
2639 ;; If the summary buffer is empty, but there are some low-scored
2640 ;; articles or some excluded dormants, we include these in the
2642 (when (and (zerop (buffer-size))
2644 (cond (gnus-newsgroup-dormant
2645 (gnus-summary-limit-include-dormant))
2646 ((and gnus-newsgroup-scored show-all)
2647 (gnus-summary-limit-include-expunged t))))
2648 ;; Function `gnus-apply-kill-file' must be called in this hook.
2649 (gnus-run-hooks 'gnus-apply-kill-hook)
2650 (if (and (zerop (buffer-size))
2653 ;; This newsgroup is empty.
2654 (gnus-summary-catchup-and-exit nil t)
2655 (gnus-message 6 "No unread news")
2657 (gnus-kill-or-deaden-summary kill-buffer))
2658 ;; Return nil from this function.
2660 ;; Hide conversation thread subtrees. We cannot do this in
2661 ;; gnus-summary-prepare-hook since kill processing may not
2662 ;; work with hidden articles.
2663 (and gnus-show-threads
2664 gnus-thread-hide-subtree
2665 (gnus-summary-hide-all-threads))
2667 (gnus-kill-or-deaden-summary kill-buffer))
2668 ;; Show first unread article if requested.
2669 (if (and (not no-article)
2671 gnus-newsgroup-unreads
2672 gnus-auto-select-first)
2673 (unless (if (eq gnus-auto-select-first 'best)
2674 (gnus-summary-best-unread-article)
2675 (gnus-summary-first-unread-article))
2676 (gnus-configure-windows 'summary))
2677 ;; Don't select any articles, just move point to the first
2678 ;; article in the group.
2679 (goto-char (point-min))
2680 (gnus-summary-position-point)
2681 (gnus-configure-windows 'summary 'force)
2682 (gnus-set-mode-line 'summary))
2683 (when (get-buffer-window gnus-group-buffer t)
2684 ;; Gotta use windows, because recenter does weird stuff if
2685 ;; the current buffer ain't the displayed window.
2686 (let ((owin (selected-window)))
2687 (select-window (get-buffer-window gnus-group-buffer t))
2688 (when (gnus-group-goto-group group)
2690 (select-window owin)))
2691 ;; Mark this buffer as "prepared".
2692 (setq gnus-newsgroup-prepared t)
2693 (gnus-run-hooks 'gnus-summary-prepared-hook)
2696 (defun gnus-summary-prepare ()
2697 "Generate the summary buffer."
2699 (let ((buffer-read-only nil))
2701 (setq gnus-newsgroup-data nil
2702 gnus-newsgroup-data-reverse nil)
2703 (gnus-run-hooks 'gnus-summary-generate-hook)
2704 ;; Generate the buffer, either with threads or without.
2705 (when gnus-newsgroup-headers
2706 (gnus-summary-prepare-threads
2707 (if gnus-show-threads
2708 (gnus-sort-gathered-threads
2709 (funcall gnus-summary-thread-gathering-function
2711 (gnus-cut-threads (gnus-make-threads)))))
2712 ;; Unthreaded display.
2713 (gnus-sort-articles gnus-newsgroup-headers))))
2714 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2715 ;; Call hooks for modifying summary buffer.
2716 (goto-char (point-min))
2717 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2719 (defsubst gnus-general-simplify-subject (subject)
2720 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2723 ;; Truncate the subject.
2724 (gnus-simplify-subject-functions
2725 (gnus-map-function gnus-simplify-subject-functions subject))
2726 ((numberp gnus-summary-gather-subject-limit)
2727 (setq subject (gnus-simplify-subject-re subject))
2728 (if (> (length subject) gnus-summary-gather-subject-limit)
2729 (substring subject 0 gnus-summary-gather-subject-limit)
2731 ;; Fuzzily simplify it.
2732 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2733 (gnus-simplify-subject-fuzzy subject))
2734 ;; Just remove the leading "Re:".
2736 (gnus-simplify-subject-re subject))))
2738 (if (and gnus-summary-gather-exclude-subject
2739 (string-match gnus-summary-gather-exclude-subject subject))
2740 nil ; This article shouldn't be gathered
2743 (defun gnus-summary-simplify-subject-query ()
2744 "Query where the respool algorithm would put this article."
2746 (gnus-summary-select-article)
2747 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
2749 (defun gnus-gather-threads-by-subject (threads)
2750 "Gather threads by looking at Subject headers."
2751 (if (not gnus-summary-make-false-root)
2753 (let ((hashtb (gnus-make-hashtable 1024))
2756 subject hthread whole-subject)
2758 (setq subject (gnus-general-simplify-subject
2759 (setq whole-subject (mail-header-subject
2762 (if (setq hthread (gnus-gethash subject hashtb))
2764 ;; We enter a dummy root into the thread, if we
2765 ;; haven't done that already.
2766 (unless (stringp (caar hthread))
2767 (setcar hthread (list whole-subject (car hthread))))
2768 ;; We add this new gathered thread to this gathered
2770 (setcdr (car hthread)
2771 (nconc (cdar hthread) (list (car threads))))
2772 ;; Remove it from the list of threads.
2773 (setcdr prev (cdr threads))
2774 (setq threads prev))
2775 ;; Enter this thread into the hash table.
2776 (gnus-sethash subject threads hashtb)))
2778 (setq threads (cdr threads)))
2781 (defun gnus-gather-threads-by-references (threads)
2782 "Gather threads by looking at References headers."
2783 (let ((idhashtb (gnus-make-hashtable 1024))
2784 (thhashtb (gnus-make-hashtable 1024))
2787 ids references id gthread gid entered ref)
2789 (when (setq references (mail-header-references (caar threads)))
2790 (setq id (mail-header-id (caar threads))
2791 ids (gnus-split-references references)
2793 (while (setq ref (pop ids))
2794 (setq ids (delete ref ids))
2795 (if (not (setq gid (gnus-gethash ref idhashtb)))
2797 (gnus-sethash ref id idhashtb)
2798 (gnus-sethash id threads thhashtb))
2799 (setq gthread (gnus-gethash gid thhashtb))
2801 ;; We enter a dummy root into the thread, if we
2802 ;; haven't done that already.
2803 (unless (stringp (caar gthread))
2804 (setcar gthread (list (mail-header-subject (caar gthread))
2806 ;; We add this new gathered thread to this gathered
2808 (setcdr (car gthread)
2809 (nconc (cdar gthread) (list (car threads)))))
2810 ;; Add it into the thread hash table.
2811 (gnus-sethash id gthread thhashtb)
2813 ;; Remove it from the list of threads.
2814 (setcdr prev (cdr threads))
2815 (setq threads prev))))
2817 (setq threads (cdr threads)))
2820 (defun gnus-sort-gathered-threads (threads)
2821 "Sort subtreads inside each gathered thread by article number."
2822 (let ((result threads))
2824 (when (stringp (caar threads))
2825 (setcdr (car threads)
2826 (sort (cdar threads) 'gnus-thread-sort-by-number)))
2827 (setq threads (cdr threads)))
2830 (defun gnus-thread-loop-p (root thread)
2831 "Say whether ROOT is in THREAD."
2832 (let ((stack (list thread))
2835 (while (setq thread (pop stack))
2836 (setq th (cdr thread))
2838 (not (eq (caar th) root)))
2841 ;; We have found a loop.
2843 (setcdr thread (delq (car th) (cdr thread)))
2844 (if (boundp (setq ref-dep (intern "none"
2845 gnus-newsgroup-dependencies)))
2846 (setcdr (symbol-value ref-dep)
2847 (nconc (cdr (symbol-value ref-dep))
2849 (set ref-dep (list nil (car th))))
2852 ;; Push all the subthreads onto the stack.
2853 (push (cdr thread) stack)))
2856 (defun gnus-make-threads ()
2857 "Go through the dependency hashtb and find the roots. Return all threads."
2859 (while (catch 'infloop
2862 ;; Deal with self-referencing References loops.
2863 (when (and (car (symbol-value refs))
2870 (car (symbol-value refs)) thread))
2871 (cdr (symbol-value refs)))))))
2874 (unless (car (symbol-value refs))
2875 ;; These threads do not refer back to any other articles,
2876 ;; so they're roots.
2877 (setq threads (append (cdr (symbol-value refs)) threads))))
2878 gnus-newsgroup-dependencies)))
2881 ;; Build the thread tree.
2882 (defun gnus-dependencies-add-header (header dependencies force-new)
2883 "Enter HEADER into the DEPENDENCIES table if it is not already there.
2885 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
2886 if it was already present.
2888 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
2889 will not be entered in the DEPENDENCIES table. Otherwise duplicate
2890 Message-IDs will be renamed be renamed to a unique Message-ID before
2893 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
2894 (let* ((id (mail-header-id header))
2895 (id-dep (and id (intern id dependencies)))
2896 ref ref-dep ref-header)
2897 ;; Enter this `header' in the `dependencies' table.
2901 ;; The first two cases do the normal part: enter a new `header'
2902 ;; in the `dependencies' table.
2903 ((not (boundp id-dep))
2904 (set id-dep (list header)))
2905 ((null (car (symbol-value id-dep)))
2906 (setcar (symbol-value id-dep) header))
2908 ;; From here the `header' was already present in the
2909 ;; `dependencies' table.
2911 ;; Overrides an existing entry;
2912 ;; just set the header part of the entry.
2913 (setcar (symbol-value id-dep) header))
2915 ;; Renames the existing `header' to a unique Message-ID.
2916 ((not gnus-summary-ignore-duplicates)
2917 ;; An article with this Message-ID has already been seen.
2918 ;; We rename the Message-ID.
2919 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
2921 (mail-header-set-id header id))
2923 ;; The last case ignores an existing entry, except it adds any
2924 ;; additional Xrefs (in case the two articles came from different
2926 ;; Also sets `header' to `nil' meaning that the `dependencies'
2927 ;; table was *not* modified.
2929 (mail-header-set-xref
2930 (car (symbol-value id-dep))
2931 (concat (or (mail-header-xref (car (symbol-value id-dep)))
2933 (or (mail-header-xref header) "")))
2937 ;; First check if that we are not creating a References loop.
2938 (setq ref (gnus-parent-id (mail-header-references header)))
2940 (setq ref-dep (intern-soft ref dependencies))
2942 (setq ref-header (car (symbol-value ref-dep))))
2943 (if (string= id ref)
2944 ;; Yuk! This is a reference loop. Make the article be a
2947 (mail-header-set-references (car (symbol-value id-dep)) "none")
2949 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
2950 (setq ref (gnus-parent-id (mail-header-references header)))
2951 (setq ref-dep (intern (or ref "none") dependencies))
2952 (if (boundp ref-dep)
2953 (setcdr (symbol-value ref-dep)
2954 (nconc (cdr (symbol-value ref-dep))
2955 (list (symbol-value id-dep))))
2956 (set ref-dep (list nil (symbol-value id-dep)))))
2959 (defun gnus-build-sparse-threads ()
2960 (let ((headers gnus-newsgroup-headers)
2961 (gnus-summary-ignore-duplicates t)
2962 header references generation relations
2963 subject child end new-child date)
2964 ;; First we create an alist of generations/relations, where
2965 ;; generations is how much we trust the relation, and the relation
2967 (gnus-message 7 "Making sparse threads...")
2969 (nnheader-set-temp-buffer " *gnus sparse threads*")
2970 (while (setq header (pop headers))
2971 (when (and (setq references (mail-header-references header))
2972 (not (string= references "")))
2974 (setq child (mail-header-id header)
2975 subject (mail-header-subject header)
2976 date (mail-header-date header)
2978 (while (search-backward ">" nil t)
2979 (setq end (1+ (point)))
2980 (when (search-backward "<" nil t)
2981 (setq new-child (buffer-substring (point) end))
2982 (push (list (incf generation)
2983 child (setq child new-child)
2987 (push (list (1+ generation) child nil subject) relations))
2989 (kill-buffer (current-buffer)))
2990 ;; Sort over trustworthiness.
2993 (when (gnus-dependencies-add-header
2994 (make-full-mail-header
2995 gnus-reffed-article-number
2996 (nth 3 relation) "" (or (nth 4 relation) "")
2998 (or (nth 2 relation) "") 0 0 "")
2999 gnus-newsgroup-dependencies nil)
3000 (push gnus-reffed-article-number gnus-newsgroup-limit)
3001 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3002 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3003 gnus-newsgroup-reads)
3004 (decf gnus-reffed-article-number)))
3005 (sort relations 'car-less-than-car))
3006 (gnus-message 7 "Making sparse threads...done")))
3008 (defun gnus-build-old-threads ()
3009 ;; Look at all the articles that refer back to old articles, and
3010 ;; fetch the headers for the articles that aren't there. This will
3011 ;; build complete threads - if the roots haven't been expired by the
3016 (when (not (car (symbol-value refs)))
3017 (setq heads (cdr (symbol-value refs)))
3019 (if (memq (mail-header-number (caar heads))
3020 gnus-newsgroup-dormant)
3021 (setq heads (cdr heads))
3022 (setq id (symbol-name refs))
3023 (while (and (setq id (gnus-build-get-header id))
3024 (not (car (gnus-id-to-thread id)))))
3025 (setq heads nil)))))
3026 gnus-newsgroup-dependencies)))
3028 ;; The following macros and functions were written by Felix Lee
3029 ;; <flee@cse.psu.edu>.
3031 (defmacro gnus-nov-read-integer ()
3033 (if (= (following-char) ?\t)
3035 (let ((num (ignore-errors (read buffer))))
3036 (if (numberp num) num 0)))
3038 (search-forward "\t" eol 'move))))
3040 (defmacro gnus-nov-skip-field ()
3041 '(search-forward "\t" eol 'move))
3043 (defmacro gnus-nov-field ()
3044 '(buffer-substring (point) (if (gnus-nov-skip-field) (1- (point)) eol)))
3046 ;; This function has to be called with point after the article number
3047 ;; on the beginning of the line.
3048 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3049 (let ((eol (gnus-point-at-eol))
3050 (buffer (current-buffer))
3053 ;; overview: [num subject from date id refs chars lines misc]
3056 (narrow-to-region (point) eol)
3061 (make-full-mail-header
3063 (rfc2047-decode-string (gnus-nov-field)) ; subject
3064 (rfc2047-decode-string (gnus-nov-field)) ; from
3065 (gnus-nov-field) ; date
3066 (or (gnus-nov-field)
3067 (nnheader-generate-fake-message-id)) ; id
3068 (gnus-nov-field) ; refs
3069 (gnus-nov-read-integer) ; chars
3070 (gnus-nov-read-integer) ; lines
3071 (unless (= (following-char) ?\n)
3072 (gnus-nov-field))))) ; misc
3076 (when gnus-alter-header-function
3077 (funcall gnus-alter-header-function header))
3078 (gnus-dependencies-add-header header dependencies force-new)))
3080 (defun gnus-build-get-header (id)
3081 ;; Look through the buffer of NOV lines and find the header to
3082 ;; ID. Enter this line into the dependencies hash table, and return
3083 ;; the id of the parent article (if any).
3084 (let ((deps gnus-newsgroup-dependencies)
3088 (set-buffer nntp-server-buffer)
3089 (let ((case-fold-search nil))
3090 (goto-char (point-min))
3091 (while (and (not found)
3092 (search-forward id nil t))
3094 (setq found (looking-at
3095 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3096 (regexp-quote id))))
3097 (or found (beginning-of-line 2)))
3101 (setq header (gnus-nov-parse-line
3102 (read (current-buffer)) deps))
3103 (gnus-parent-id (mail-header-references header))))))
3105 (let ((number (mail-header-number header)))
3106 (push number gnus-newsgroup-limit)
3107 (push header gnus-newsgroup-headers)
3108 (if (memq number gnus-newsgroup-unselected)
3110 (push number gnus-newsgroup-unreads)
3111 (setq gnus-newsgroup-unselected
3112 (delq number gnus-newsgroup-unselected)))
3113 (push number gnus-newsgroup-ancient)))))))
3115 (defun gnus-build-all-threads ()
3116 "Read all the headers."
3117 (let ((gnus-summary-ignore-duplicates t)
3118 (dependencies gnus-newsgroup-dependencies)
3121 (set-buffer nntp-server-buffer)
3122 (let ((case-fold-search nil))
3123 (goto-char (point-min))
3126 (setq article (read (current-buffer))
3127 header (gnus-nov-parse-line
3128 article dependencies)))
3131 (set-buffer gnus-summary-buffer)
3132 (push header gnus-newsgroup-headers)
3133 (if (memq (setq article (mail-header-number header))
3134 gnus-newsgroup-unselected)
3136 (push article gnus-newsgroup-unreads)
3137 (setq gnus-newsgroup-unselected
3138 (delq article gnus-newsgroup-unselected)))
3139 (push article gnus-newsgroup-ancient)))
3140 (forward-line 1)))))))
3142 (defun gnus-summary-update-article-line (article header)
3143 "Update the line for ARTICLE using HEADERS."
3144 (let* ((id (mail-header-id header))
3145 (thread (gnus-id-to-thread id)))
3147 (error "Article in no thread"))
3148 ;; Update the thread.
3149 (setcar thread header)
3150 (gnus-summary-goto-subject article)
3151 (let* ((datal (gnus-data-find-list article))
3153 (length (when (cdr datal)
3154 (- (gnus-data-pos data)
3155 (gnus-data-pos (cadr datal)))))
3156 (buffer-read-only nil)
3157 (level (gnus-summary-thread-level)))
3159 (gnus-summary-insert-line
3160 header level nil (gnus-article-mark article)
3161 (memq article gnus-newsgroup-replied)
3162 (memq article gnus-newsgroup-expirable)
3163 ;; Only insert the Subject string when it's different
3164 ;; from the previous Subject string.
3165 (if (gnus-subject-equal
3167 (mail-header-subject
3170 (gnus-data-find-list
3172 (gnus-data-list t)))))
3173 ;; Error on the side of excessive subjects.
3175 (mail-header-subject header))
3177 (mail-header-subject header))
3178 nil (cdr (assq article gnus-newsgroup-scored))
3179 (memq article gnus-newsgroup-processable))
3181 (gnus-data-update-list
3182 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3184 (defun gnus-summary-update-article (article &optional iheader)
3185 "Update ARTICLE in the summary buffer."
3186 (set-buffer gnus-summary-buffer)
3187 (let* ((header (gnus-summary-article-header article))
3188 (id (mail-header-id header))
3189 (data (gnus-data-find article))
3190 (thread (gnus-id-to-thread id))
3191 (references (mail-header-references header))
3195 (when (and references
3196 (not (equal "" references)))
3199 (buffer-read-only nil)
3205 (delq thread parent)))
3206 (if (gnus-summary-insert-subject id header)
3207 ;; Set the (possibly) new article number in the data structure.
3208 (gnus-data-set-number data (gnus-id-to-article id))
3212 (defun gnus-rebuild-thread (id &optional line)
3213 "Rebuild the thread containing ID.
3214 If LINE, insert the rebuilt thread starting on line LINE."
3215 (let ((buffer-read-only nil)
3216 old-pos current thread data)
3217 (if (not gnus-show-threads)
3218 (setq thread (list (car (gnus-id-to-thread id))))
3219 ;; Get the thread this article is part of.
3220 (setq thread (gnus-remove-thread id)))
3221 (setq old-pos (gnus-point-at-bol))
3222 (setq current (save-excursion
3223 (and (zerop (forward-line -1))
3224 (gnus-summary-article-number))))
3225 ;; If this is a gathered thread, we have to go some re-gathering.
3226 (when (stringp (car thread))
3227 (let ((subject (car thread))
3229 (setq thread (cdr thread))
3231 (unless (memq (setq thr (gnus-id-to-thread
3233 (mail-header-id (caar thread)))))
3236 (setq thread (cdr thread)))
3237 ;; We now have all (unique) roots.
3238 (if (= (length roots) 1)
3239 ;; All the loose roots are now one solid root.
3240 (setq thread (car roots))
3241 (setq thread (cons subject (gnus-sort-threads roots))))))
3243 ;; We then insert this thread into the summary buffer.
3245 (goto-char (point-min))
3246 (forward-line (1- line)))
3247 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3248 (if gnus-show-threads
3249 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3250 (gnus-summary-prepare-unthreaded thread))
3251 (setq data (nreverse gnus-newsgroup-data))
3252 (setq threads gnus-newsgroup-threads))
3253 ;; We splice the new data into the data structure.
3254 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3255 ;;!!! then we want to insert at the beginning of the buffer.
3256 ;;!!! That happens to be true with Gnus now, but that may
3257 ;;!!! change in the future. Perhaps.
3258 (gnus-data-enter-list
3259 (if line nil current) data (- (point) old-pos))
3260 (setq gnus-newsgroup-threads
3261 (nconc threads gnus-newsgroup-threads))
3262 (gnus-data-compute-positions))))
3264 (defun gnus-number-to-header (number)
3265 "Return the header for article NUMBER."
3266 (let ((headers gnus-newsgroup-headers))
3268 (not (= number (mail-header-number (car headers)))))
3273 (defun gnus-parent-headers (in-headers &optional generation)
3274 "Return the headers of the GENERATIONeth parent of HEADERS."
3276 (setq generation 1))
3278 (headers in-headers)
3281 (not (zerop generation))
3282 (setq references (mail-header-references headers)))
3283 (setq headers (if (and references
3284 (setq parent (gnus-parent-id references)))
3285 (car (gnus-id-to-thread parent))
3288 (and (not (eq headers in-headers))
3291 (defun gnus-id-to-thread (id)
3292 "Return the (sub-)thread where ID appears."
3293 (gnus-gethash id gnus-newsgroup-dependencies))
3295 (defun gnus-id-to-article (id)
3296 "Return the article number of ID."
3297 (let ((thread (gnus-id-to-thread id)))
3300 (mail-header-number (car thread)))))
3302 (defun gnus-id-to-header (id)
3303 "Return the article headers of ID."
3304 (car (gnus-id-to-thread id)))
3306 (defun gnus-article-displayed-root-p (article)
3307 "Say whether ARTICLE is a root(ish) article."
3308 (let ((level (gnus-summary-thread-level article))
3309 (refs (mail-header-references (gnus-summary-article-header article)))
3315 ((null (gnus-parent-id refs)) t)
3317 (null (setq particle (gnus-id-to-article
3318 (gnus-parent-id refs))))
3319 (null (gnus-summary-thread-level particle)))))))
3321 (defun gnus-root-id (id)
3322 "Return the id of the root of the thread where ID appears."
3324 (while (and id (setq prev (car (gnus-id-to-thread id))))
3326 id (gnus-parent-id (mail-header-references prev))))
3329 (defun gnus-articles-in-thread (thread)
3330 "Return the list of articles in THREAD."
3331 (cons (mail-header-number (car thread))
3332 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3334 (defun gnus-remove-thread (id &optional dont-remove)
3335 "Remove the thread that has ID in it."
3336 (let (headers thread last-id)
3337 ;; First go up in this thread until we find the root.
3338 (setq last-id (gnus-root-id id)
3339 headers (message-flatten-list (gnus-id-to-thread last-id)))
3340 ;; We have now found the real root of this thread. It might have
3341 ;; been gathered into some loose thread, so we have to search
3342 ;; through the threads to find the thread we wanted.
3343 (let ((threads gnus-newsgroup-threads)
3346 (setq sub (car threads))
3347 (if (stringp (car sub))
3348 ;; This is a gathered thread, so we look at the roots
3349 ;; below it to find whether this article is in this
3352 (setq sub (cdr sub))
3354 (when (member (caar sub) headers)
3355 (setq thread (car threads)
3358 (setq sub (cdr sub))))
3359 ;; It's an ordinary thread, so we check it.
3360 (when (eq (car sub) (car headers))
3363 (setq threads (cdr threads)))
3364 ;; If this article is in no thread, then it's a root.
3367 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3368 (setq thread (gnus-id-to-thread last-id)))
3371 thread ; We return this thread.
3373 (if (stringp (car thread))
3375 ;; If we use dummy roots, then we have to remove the
3376 ;; dummy root as well.
3377 (when (eq gnus-summary-make-false-root 'dummy)
3378 ;; We go to the dummy root by going to
3379 ;; the first sub-"thread", and then one line up.
3380 (gnus-summary-goto-article
3381 (mail-header-number (caadr thread)))
3384 (gnus-data-compute-positions))
3385 (setq thread (cdr thread))
3387 (gnus-remove-thread-1 (car thread))
3388 (setq thread (cdr thread))))
3389 (gnus-remove-thread-1 thread))))))))
3391 (defun gnus-remove-thread-1 (thread)
3392 "Remove the thread THREAD recursively."
3393 (let ((number (mail-header-number (pop thread)))
3395 (setq thread (reverse thread))
3397 (gnus-remove-thread-1 (pop thread)))
3398 (when (setq d (gnus-data-find number))
3399 (goto-char (gnus-data-pos d))
3402 (- (gnus-point-at-bol)
3404 (1+ (gnus-point-at-eol))
3405 (gnus-delete-line)))))))
3407 (defun gnus-sort-threads (threads)
3409 (if (not gnus-thread-sort-functions)
3411 (gnus-message 8 "Sorting threads...")
3413 (sort threads (gnus-make-sort-function gnus-thread-sort-functions))
3414 (gnus-message 8 "Sorting threads...done"))))
3416 (defun gnus-sort-articles (articles)
3418 (when gnus-article-sort-functions
3419 (gnus-message 7 "Sorting articles...")
3421 (setq gnus-newsgroup-headers
3422 (sort articles (gnus-make-sort-function
3423 gnus-article-sort-functions)))
3424 (gnus-message 7 "Sorting articles...done"))))
3426 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3427 (defmacro gnus-thread-header (thread)
3428 ;; Return header of first article in THREAD.
3429 ;; Note that THREAD must never, ever be anything else than a variable -
3430 ;; using some other form will lead to serious barfage.
3431 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3432 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3433 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207" ;
3436 (defsubst gnus-article-sort-by-number (h1 h2)
3437 "Sort articles by article number."
3438 (< (mail-header-number h1)
3439 (mail-header-number h2)))
3441 (defun gnus-thread-sort-by-number (h1 h2)
3442 "Sort threads by root article number."
3443 (gnus-article-sort-by-number
3444 (gnus-thread-header h1) (gnus-thread-header h2)))
3446 (defsubst gnus-article-sort-by-lines (h1 h2)
3447 "Sort articles by article Lines header."
3448 (< (mail-header-lines h1)
3449 (mail-header-lines h2)))
3451 (defun gnus-thread-sort-by-lines (h1 h2)
3452 "Sort threads by root article Lines header."
3453 (gnus-article-sort-by-lines
3454 (gnus-thread-header h1) (gnus-thread-header h2)))
3456 (defsubst gnus-article-sort-by-author (h1 h2)
3457 "Sort articles by root author."
3459 (let ((extract (funcall
3460 gnus-extract-address-components
3461 (mail-header-from h1))))
3462 (or (car extract) (cadr extract) ""))
3463 (let ((extract (funcall
3464 gnus-extract-address-components
3465 (mail-header-from h2))))
3466 (or (car extract) (cadr extract) ""))))
3468 (defun gnus-thread-sort-by-author (h1 h2)
3469 "Sort threads by root author."
3470 (gnus-article-sort-by-author
3471 (gnus-thread-header h1) (gnus-thread-header h2)))
3473 (defsubst gnus-article-sort-by-subject (h1 h2)
3474 "Sort articles by root subject."
3476 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3477 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3479 (defun gnus-thread-sort-by-subject (h1 h2)
3480 "Sort threads by root subject."
3481 (gnus-article-sort-by-subject
3482 (gnus-thread-header h1) (gnus-thread-header h2)))
3484 (defsubst gnus-article-sort-by-date (h1 h2)
3485 "Sort articles by root article date."
3487 (gnus-date-get-time (mail-header-date h1))
3488 (gnus-date-get-time (mail-header-date h2))))
3490 (defun gnus-thread-sort-by-date (h1 h2)
3491 "Sort threads by root article date."
3492 (gnus-article-sort-by-date
3493 (gnus-thread-header h1) (gnus-thread-header h2)))
3495 (defsubst gnus-article-sort-by-score (h1 h2)
3496 "Sort articles by root article score.
3497 Unscored articles will be counted as having a score of zero."
3498 (> (or (cdr (assq (mail-header-number h1)
3499 gnus-newsgroup-scored))
3500 gnus-summary-default-score 0)
3501 (or (cdr (assq (mail-header-number h2)
3502 gnus-newsgroup-scored))
3503 gnus-summary-default-score 0)))
3505 (defun gnus-thread-sort-by-score (h1 h2)
3506 "Sort threads by root article score."
3507 (gnus-article-sort-by-score
3508 (gnus-thread-header h1) (gnus-thread-header h2)))
3510 (defun gnus-thread-sort-by-total-score (h1 h2)
3511 "Sort threads by the sum of all scores in the thread.
3512 Unscored articles will be counted as having a score of zero."
3513 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3515 (defun gnus-thread-total-score (thread)
3516 ;; This function find the total score of THREAD.
3517 (cond ((null thread)
3520 (if (stringp (car thread))
3521 (apply gnus-thread-score-function 0
3522 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3523 (gnus-thread-total-score-1 thread)))
3525 (gnus-thread-total-score-1 (list thread)))))
3527 (defun gnus-thread-total-score-1 (root)
3528 ;; This function find the total score of the thread below ROOT.
3529 (setq root (car root))
3530 (apply gnus-thread-score-function
3532 (mapcar 'gnus-thread-total-score
3533 (cdr (gnus-id-to-thread (mail-header-id root))))
3534 (when (> (mail-header-number root) 0)
3535 (list (or (cdr (assq (mail-header-number root)
3536 gnus-newsgroup-scored))
3537 gnus-summary-default-score 0))))
3538 (list gnus-summary-default-score)
3541 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3542 (defvar gnus-tmp-prev-subject nil)
3543 (defvar gnus-tmp-false-parent nil)
3544 (defvar gnus-tmp-root-expunged nil)
3545 (defvar gnus-tmp-dummy-line nil)
3547 (defun gnus-summary-prepare-threads (threads)
3548 "Prepare summary buffer from THREADS and indentation LEVEL.
3549 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3550 or a straight list of headers."
3551 (gnus-message 7 "Generating summary...")
3553 (setq gnus-newsgroup-threads threads)
3556 (let ((gnus-tmp-level 0)
3557 (default-score (or gnus-summary-default-score 0))
3558 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3559 thread number subject stack state gnus-tmp-gathered beg-match
3560 new-roots gnus-tmp-new-adopts thread-end
3561 gnus-tmp-header gnus-tmp-unread
3562 gnus-tmp-replied gnus-tmp-subject-or-nil
3563 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3564 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3565 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3567 (setq gnus-tmp-prev-subject nil)
3569 (if (vectorp (car threads))
3570 ;; If this is a straight (sic) list of headers, then a
3571 ;; threaded summary display isn't required, so we just create
3572 ;; an unthreaded one.
3573 (gnus-summary-prepare-unthreaded threads)
3575 ;; Do the threaded display.
3577 (while (or threads stack gnus-tmp-new-adopts new-roots)
3579 (if (and (= gnus-tmp-level 0)
3582 (not gnus-tmp-false-parent)
3583 (or gnus-tmp-new-adopts new-roots))
3584 (if gnus-tmp-new-adopts
3585 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3586 thread (list (car gnus-tmp-new-adopts))
3587 gnus-tmp-header (caar thread)
3588 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3590 (setq thread (list (car new-roots))
3591 gnus-tmp-header (caar thread)
3592 new-roots (cdr new-roots))))
3595 ;; If there are some threads, we do them before the
3596 ;; threads on the stack.
3597 (setq thread threads
3598 gnus-tmp-header (caar thread))
3599 ;; There were no current threads, so we pop something off
3601 (setq state (car stack)
3602 gnus-tmp-level (car state)
3605 gnus-tmp-header (caar thread))))
3607 (setq gnus-tmp-false-parent nil)
3608 (setq gnus-tmp-root-expunged nil)
3609 (setq thread-end nil)
3611 (if (stringp gnus-tmp-header)
3612 ;; The header is a dummy root.
3614 ((eq gnus-summary-make-false-root 'adopt)
3615 ;; We let the first article adopt the rest.
3616 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3618 (setq gnus-tmp-gathered
3620 (lambda (h) (mail-header-number (car h)))
3623 (setq thread (cons (list (caar thread)
3626 (setq gnus-tmp-level -1
3627 gnus-tmp-false-parent t))
3628 ((eq gnus-summary-make-false-root 'empty)
3629 ;; We print adopted articles with empty subject fields.
3630 (setq gnus-tmp-gathered
3632 (lambda (h) (mail-header-number (car h)))
3635 (setq gnus-tmp-level -1))
3636 ((eq gnus-summary-make-false-root 'dummy)
3637 ;; We remember that we probably want to output a dummy
3639 (setq gnus-tmp-dummy-line gnus-tmp-header)
3640 (setq gnus-tmp-prev-subject gnus-tmp-header))
3642 ;; We do not make a root for the gathered
3643 ;; sub-threads at all.
3644 (setq gnus-tmp-level -1)))
3646 (setq number (mail-header-number gnus-tmp-header)
3647 subject (mail-header-subject gnus-tmp-header))
3650 ;; If the thread has changed subject, we might want to make
3651 ;; this subthread into a root.
3652 ((and (null gnus-thread-ignore-subject)
3653 (not (zerop gnus-tmp-level))
3654 gnus-tmp-prev-subject
3656 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3657 (setq new-roots (nconc new-roots (list (car thread)))
3659 gnus-tmp-header nil))
3660 ;; If the article lies outside the current limit,
3661 ;; then we do not display it.
3662 ((not (memq number gnus-newsgroup-limit))
3663 (setq gnus-tmp-gathered
3665 (lambda (h) (mail-header-number (car h)))
3668 (setq gnus-tmp-new-adopts (if (cdar thread)
3669 (append gnus-tmp-new-adopts
3671 gnus-tmp-new-adopts)
3673 gnus-tmp-header nil)
3674 (when (zerop gnus-tmp-level)
3675 (setq gnus-tmp-root-expunged t)))
3676 ;; Perhaps this article is to be marked as read?