1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000
3 ;; Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
29 (eval-when-compile (require 'cl))
39 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
41 (defcustom gnus-kill-summary-on-exit t
42 "*If non-nil, kill the summary buffer when you exit from it.
43 If nil, the summary will become a \"*Dead Summary*\" buffer, and
44 it will be killed sometime later."
45 :group 'gnus-summary-exit
48 (defcustom gnus-fetch-old-headers nil
49 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
50 If an unread article in the group refers to an older, already read (or
51 just marked as read) article, the old article will not normally be
52 displayed in the Summary buffer. If this variable is non-nil, Gnus
53 will attempt to grab the headers to the old articles, and thereby
54 build complete threads. If it has the value `some', only enough
55 headers to connect otherwise loose threads will be displayed. This
56 variable can also be a number. In that case, no more than that number
57 of old headers will be fetched. If it has the value `invisible', all
58 old headers will be fetched, but none will be displayed.
60 The server has to support NOV for any of this to work."
62 :type '(choice (const :tag "off" nil)
65 (sexp :menu-tag "other" t)))
67 (defcustom gnus-refer-thread-limit 200
68 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
69 If t, fetch all the available old headers."
72 (sexp :menu-tag "other" t)))
74 (defcustom gnus-summary-make-false-root 'adopt
75 "*nil means that Gnus won't gather loose threads.
76 If the root of a thread has expired or been read in a previous
77 session, the information necessary to build a complete thread has been
78 lost. Instead of having many small sub-threads from this original thread
79 scattered all over the summary buffer, Gnus can gather them.
81 If non-nil, Gnus will try to gather all loose sub-threads from an
82 original thread into one large thread.
84 If this variable is non-nil, it should be one of `none', `adopt',
87 If this variable is `none', Gnus will not make a false root, but just
88 present the sub-threads after another.
89 If this variable is `dummy', Gnus will create a dummy root that will
90 have all the sub-threads as children.
91 If this variable is `adopt', Gnus will make one of the \"children\"
92 the parent and mark all the step-children as such.
93 If this variable is `empty', the \"children\" are printed with empty
94 subject fields. (Or rather, they will be printed with a string
95 given by the `gnus-summary-same-subject' variable.)"
97 :type '(choice (const :tag "off" nil)
103 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
104 "*A regexp to match subjects to be excluded from loose thread gathering.
105 As loose thread gathering is done on subjects only, that means that
106 there can be many false gatherings performed. By rooting out certain
107 common subjects, gathering might become saner."
111 (defcustom gnus-summary-gather-subject-limit nil
112 "*Maximum length of subject comparisons when gathering loose threads.
113 Use nil to compare full subjects. Setting this variable to a low
114 number will help gather threads that have been corrupted by
115 newsreaders chopping off subject lines, but it might also mean that
116 unrelated articles that have subject that happen to begin with the
117 same few characters will be incorrectly gathered.
119 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
122 :type '(choice (const :tag "off" nil)
124 (sexp :menu-tag "on" t)))
126 (defcustom gnus-simplify-subject-functions nil
127 "List of functions taking a string argument that simplify subjects.
128 The functions are applied recursively.
130 Useful functions to put in this list include: `gnus-simplify-subject-re',
131 `gnus-simplify-subject-fuzzy' and `gnus-simplify-whitespace'."
133 :type '(repeat function))
135 (defcustom gnus-simplify-ignored-prefixes nil
136 "*Regexp, matches for which are removed from subject lines when simplifying fuzzily."
138 :type '(choice (const :tag "off" nil)
141 (defcustom gnus-build-sparse-threads nil
142 "*If non-nil, fill in the gaps in threads.
143 If `some', only fill in the gaps that are needed to tie loose threads
144 together. If `more', fill in all leaf nodes that Gnus can find. If
145 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
147 :type '(choice (const :tag "off" nil)
150 (sexp :menu-tag "all" t)))
152 (defcustom gnus-summary-thread-gathering-function
153 'gnus-gather-threads-by-subject
154 "*Function used for gathering loose threads.
155 There are two pre-defined functions: `gnus-gather-threads-by-subject',
156 which only takes Subjects into consideration; and
157 `gnus-gather-threads-by-references', which compared the References
158 headers of the articles to find matches."
160 :type '(radio (function-item gnus-gather-threads-by-subject)
161 (function-item gnus-gather-threads-by-references)
162 (function :tag "other")))
164 (defcustom gnus-summary-same-subject ""
165 "*String indicating that the current article has the same subject as the previous.
166 This variable will only be used if the value of
167 `gnus-summary-make-false-root' is `empty'."
168 :group 'gnus-summary-format
171 (defcustom gnus-summary-goto-unread t
172 "*If t, many commands will go to the next unread article.
173 This applies to marking commands as well as other commands that
174 \"naturally\" select the next article, like, for instance, `SPC' at
175 the end of an article.
177 If nil, the marking commands do NOT go to the next unread article
178 (they go to the next article instead). If `never', commands that
179 usually go to the next unread article, will go to the next article,
180 whether it is read or not."
181 :group 'gnus-summary-marks
182 :link '(custom-manual "(gnus)Setting Marks")
183 :type '(choice (const :tag "off" nil)
185 (sexp :menu-tag "on" t)))
187 (defcustom gnus-summary-default-score 0
188 "*Default article score level.
189 All scores generated by the score files will be added to this score.
190 If this variable is nil, scoring will be disabled."
191 :group 'gnus-score-default
192 :type '(choice (const :tag "disable")
195 (defcustom gnus-summary-zcore-fuzz 0
196 "*Fuzziness factor for the zcore in the summary buffer.
197 Articles with scores closer than this to `gnus-summary-default-score'
199 :group 'gnus-summary-format
202 (defcustom gnus-simplify-subject-fuzzy-regexp nil
203 "*Strings to be removed when doing fuzzy matches.
204 This can either be a regular expression or list of regular expressions
205 that will be removed from subject strings if fuzzy subject
206 simplification is selected."
208 :type '(repeat regexp))
210 (defcustom gnus-show-threads t
211 "*If non-nil, display threads in summary mode."
215 (defcustom gnus-thread-hide-subtree nil
216 "*If non-nil, hide all threads initially.
217 If threads are hidden, you have to run the command
218 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
219 to expose hidden threads."
223 (defcustom gnus-thread-hide-killed t
224 "*If non-nil, hide killed threads automatically."
228 (defcustom gnus-thread-ignore-subject t
229 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
230 If nil, articles that have different subjects from their parents will
231 start separate threads."
235 (defcustom gnus-thread-operation-ignore-subject t
236 "*If non-nil, subjects will be ignored when doing thread commands.
237 This affects commands like `gnus-summary-kill-thread' and
238 `gnus-summary-lower-thread'.
240 If this variable is nil, articles in the same thread with different
241 subjects will not be included in the operation in question. If this
242 variable is `fuzzy', only articles that have subjects that are fuzzily
243 equal will be included."
245 :type '(choice (const :tag "off" nil)
249 (defcustom gnus-thread-indent-level 4
250 "*Number that says how much each sub-thread should be indented."
254 (defcustom gnus-auto-extend-newsgroup t
255 "*If non-nil, extend newsgroup forward and backward when requested."
256 :group 'gnus-summary-choose
259 (defcustom gnus-auto-select-first t
260 "*If nil, don't select the first unread article when entering a group.
261 If this variable is `best', select the highest-scored unread article
262 in the group. If t, select the first unread article.
264 This variable can also be a function to place point on a likely
265 subject line. Useful values include `gnus-summary-first-unread-subject',
266 `gnus-summary-first-unread-article' and
267 `gnus-summary-best-unread-article'.
269 If you want to prevent automatic selection of the first unread article
270 in some newsgroups, set the variable to nil in
271 `gnus-select-group-hook'."
272 :group 'gnus-group-select
273 :type '(choice (const :tag "none" nil)
275 (sexp :menu-tag "first" t)
276 (function-item gnus-summary-first-unread-subject)
277 (function-item gnus-summary-first-unread-article)
278 (function-item gnus-summary-best-unread-article)))
280 (defcustom gnus-auto-select-next t
281 "*If non-nil, offer to go to the next group from the end of the previous.
282 If the value is t and the next newsgroup is empty, Gnus will exit
283 summary mode and go back to group mode. If the value is neither nil
284 nor t, Gnus will select the following unread newsgroup. In
285 particular, if the value is the symbol `quietly', the next unread
286 newsgroup will be selected without any confirmation, and if it is
287 `almost-quietly', the next group will be selected without any
288 confirmation if you are located on the last article in the group.
289 Finally, if this variable is `slightly-quietly', the `Z n' command
290 will go to the next group without confirmation."
291 :group 'gnus-summary-maneuvering
292 :type '(choice (const :tag "off" nil)
294 (const almost-quietly)
295 (const slightly-quietly)
296 (sexp :menu-tag "on" t)))
298 (defcustom gnus-auto-select-same nil
299 "*If non-nil, select the next article with the same subject.
300 If there are no more articles with the same subject, go to
301 the first unread article."
302 :group 'gnus-summary-maneuvering
305 (defcustom gnus-summary-check-current nil
306 "*If non-nil, consider the current article when moving.
307 The \"unread\" movement commands will stay on the same line if the
308 current article is unread."
309 :group 'gnus-summary-maneuvering
312 (defcustom gnus-auto-center-summary t
313 "*If non-nil, always center the current summary buffer.
314 In particular, if `vertical' do only vertical recentering. If non-nil
315 and non-`vertical', do both horizontal and vertical recentering."
316 :group 'gnus-summary-maneuvering
317 :type '(choice (const :tag "none" nil)
319 (integer :tag "height")
320 (sexp :menu-tag "both" t)))
322 (defcustom gnus-show-all-headers nil
323 "*If non-nil, don't hide any headers."
324 :group 'gnus-article-hiding
325 :group 'gnus-article-headers
328 (defcustom gnus-summary-ignore-duplicates nil
329 "*If non-nil, ignore articles with identical Message-ID headers."
333 (defcustom gnus-single-article-buffer t
334 "*If non-nil, display all articles in the same buffer.
335 If nil, each group will get its own article buffer."
336 :group 'gnus-article-various
339 (defcustom gnus-break-pages t
340 "*If non-nil, do page breaking on articles.
341 The page delimiter is specified by the `gnus-page-delimiter'
343 :group 'gnus-article-various
346 (defcustom gnus-move-split-methods nil
347 "*Variable used to suggest where articles are to be moved to.
348 It uses the same syntax as the `gnus-split-methods' variable."
349 :group 'gnus-summary-mail
350 :type '(repeat (choice (list :value (fun) function)
351 (cons :value ("" "") regexp (repeat string))
354 (defcustom gnus-unread-mark ? ;Whitespace
355 "*Mark used for unread articles."
356 :group 'gnus-summary-marks
359 (defcustom gnus-ticked-mark ?!
360 "*Mark used for ticked articles."
361 :group 'gnus-summary-marks
364 (defcustom gnus-dormant-mark ??
365 "*Mark used for dormant articles."
366 :group 'gnus-summary-marks
369 (defcustom gnus-del-mark ?r
370 "*Mark used for del'd articles."
371 :group 'gnus-summary-marks
374 (defcustom gnus-read-mark ?R
375 "*Mark used for read articles."
376 :group 'gnus-summary-marks
379 (defcustom gnus-expirable-mark ?E
380 "*Mark used for expirable articles."
381 :group 'gnus-summary-marks
384 (defcustom gnus-killed-mark ?K
385 "*Mark used for killed articles."
386 :group 'gnus-summary-marks
389 (defcustom gnus-souped-mark ?F
390 "*Mark used for killed articles."
391 :group 'gnus-summary-marks
394 (defcustom gnus-kill-file-mark ?X
395 "*Mark used for articles killed by kill files."
396 :group 'gnus-summary-marks
399 (defcustom gnus-low-score-mark ?Y
400 "*Mark used for articles with a low score."
401 :group 'gnus-summary-marks
404 (defcustom gnus-catchup-mark ?C
405 "*Mark used for articles that are caught up."
406 :group 'gnus-summary-marks
409 (defcustom gnus-replied-mark ?A
410 "*Mark used for articles that have been replied to."
411 :group 'gnus-summary-marks
414 (defcustom gnus-cached-mark ?*
415 "*Mark used for articles that are in the cache."
416 :group 'gnus-summary-marks
419 (defcustom gnus-saved-mark ?S
420 "*Mark used for articles that have been saved to."
421 :group 'gnus-summary-marks
424 (defcustom gnus-ancient-mark ?O
425 "*Mark used for ancient articles."
426 :group 'gnus-summary-marks
429 (defcustom gnus-sparse-mark ?Q
430 "*Mark used for sparsely reffed articles."
431 :group 'gnus-summary-marks
434 (defcustom gnus-canceled-mark ?G
435 "*Mark used for canceled articles."
436 :group 'gnus-summary-marks
439 (defcustom gnus-duplicate-mark ?M
440 "*Mark used for duplicate articles."
441 :group 'gnus-summary-marks
444 (defcustom gnus-undownloaded-mark ?@
445 "*Mark used for articles that weren't downloaded."
446 :group 'gnus-summary-marks
449 (defcustom gnus-downloadable-mark ?%
450 "*Mark used for articles that are to be downloaded."
451 :group 'gnus-summary-marks
454 (defcustom gnus-unsendable-mark ?=
455 "*Mark used for articles that won't be sent."
456 :group 'gnus-summary-marks
459 (defcustom gnus-score-over-mark ?+
460 "*Score mark used for articles with high scores."
461 :group 'gnus-summary-marks
464 (defcustom gnus-score-below-mark ?-
465 "*Score mark used for articles with low scores."
466 :group 'gnus-summary-marks
469 (defcustom gnus-empty-thread-mark ? ;Whitespace
470 "*There is no thread under the article."
471 :group 'gnus-summary-marks
474 (defcustom gnus-not-empty-thread-mark ?=
475 "*There is a thread under the article."
476 :group 'gnus-summary-marks
479 (defcustom gnus-view-pseudo-asynchronously nil
480 "*If non-nil, Gnus will view pseudo-articles asynchronously."
481 :group 'gnus-extract-view
484 (defcustom gnus-auto-expirable-marks
485 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
486 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
487 gnus-souped-mark gnus-duplicate-mark)
488 "*The list of marks converted into expiration if a group is auto-expirable."
490 :type '(repeat character))
492 (defcustom gnus-inhibit-user-auto-expire t
493 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
497 (defcustom gnus-view-pseudos nil
498 "*If `automatic', pseudo-articles will be viewed automatically.
499 If `not-confirm', pseudos will be viewed automatically, and the user
500 will not be asked to confirm the command."
501 :group 'gnus-extract-view
502 :type '(choice (const :tag "off" nil)
504 (const not-confirm)))
506 (defcustom gnus-view-pseudos-separately t
507 "*If non-nil, one pseudo-article will be created for each file to be viewed.
508 If nil, all files that use the same viewing command will be given as a
509 list of parameters to that command."
510 :group 'gnus-extract-view
513 (defcustom gnus-insert-pseudo-articles t
514 "*If non-nil, insert pseudo-articles when decoding articles."
515 :group 'gnus-extract-view
518 (defcustom gnus-summary-dummy-line-format
520 "*The format specification for the dummy roots in the summary buffer.
521 It works along the same lines as a normal formatting string,
522 with some simple extensions.
525 :group 'gnus-threading
528 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
529 "*The format specification for the summary mode line.
530 It works along the same lines as a normal formatting string,
531 with some simple extensions:
534 %p Unprefixed group name
535 %A Current article number
536 %z Current article score
538 %U Number of unread articles in the group
539 %e Number of unselected articles in the group
540 %Z A string with unread/unselected article counts
541 %g Shortish group name
542 %S Subject of the current article
544 %s Current score file name
545 %d Number of dormant articles
546 %r Number of articles that have been marked as read in this session
547 %E Number of articles expunged by the score files"
548 :group 'gnus-summary-format
551 (defcustom gnus-list-identifiers nil
552 "Regexp that matches list identifiers to be removed from subject.
553 This can also be a list of regexps."
554 :group 'gnus-summary-format
555 :group 'gnus-article-hiding
556 :type '(choice (const :tag "none" nil)
558 (repeat :value (".*") regexp)))
560 (defcustom gnus-summary-mark-below 0
561 "*Mark all articles with a score below this variable as read.
562 This variable is local to each summary buffer and usually set by the
564 :group 'gnus-score-default
567 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
568 "*List of functions used for sorting articles in the summary buffer.
569 This variable is only used when not using a threaded display."
570 :group 'gnus-summary-sort
571 :type '(repeat (choice (function-item gnus-article-sort-by-number)
572 (function-item gnus-article-sort-by-author)
573 (function-item gnus-article-sort-by-subject)
574 (function-item gnus-article-sort-by-date)
575 (function-item gnus-article-sort-by-score)
576 (function :tag "other"))))
578 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
579 "*List of functions used for sorting threads in the summary buffer.
580 By default, threads are sorted by article number.
582 Each function takes two threads and return non-nil if the first thread
583 should be sorted before the other. If you use more than one function,
584 the primary sort function should be the last. You should probably
585 always include `gnus-thread-sort-by-number' in the list of sorting
586 functions -- preferably first.
588 Ready-made functions include `gnus-thread-sort-by-number',
589 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
590 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score' and
591 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function')."
592 :group 'gnus-summary-sort
593 :type '(repeat (choice (function-item gnus-thread-sort-by-number)
594 (function-item gnus-thread-sort-by-author)
595 (function-item gnus-thread-sort-by-subject)
596 (function-item gnus-thread-sort-by-date)
597 (function-item gnus-thread-sort-by-score)
598 (function-item gnus-thread-sort-by-total-score)
599 (function :tag "other"))))
601 (defcustom gnus-thread-score-function '+
602 "*Function used for calculating the total score of a thread.
604 The function is called with the scores of the article and each
605 subthread and should then return the score of the thread.
607 Some functions you can use are `+', `max', or `min'."
608 :group 'gnus-summary-sort
611 (defcustom gnus-summary-expunge-below nil
612 "All articles that have a score less than this variable will be expunged.
613 This variable is local to the summary buffers."
614 :group 'gnus-score-default
615 :type '(choice (const :tag "off" nil)
618 (defcustom gnus-thread-expunge-below nil
619 "All threads that have a total score less than this variable will be expunged.
620 See `gnus-thread-score-function' for en explanation of what a
623 This variable is local to the summary buffers."
624 :group 'gnus-threading
625 :group 'gnus-score-default
626 :type '(choice (const :tag "off" nil)
629 (defcustom gnus-summary-mode-hook nil
630 "*A hook for Gnus summary mode.
631 This hook is run before any variables are set in the summary buffer."
632 :group 'gnus-summary-various
635 (defcustom gnus-summary-menu-hook nil
636 "*Hook run after the creation of the summary mode menu."
637 :group 'gnus-summary-visual
640 (defcustom gnus-summary-exit-hook nil
641 "*A hook called on exit from the summary buffer.
642 It will be called with point in the group buffer."
643 :group 'gnus-summary-exit
646 (defcustom gnus-summary-prepare-hook nil
647 "*A hook called after the summary buffer has been generated.
648 If you want to modify the summary buffer, you can use this hook."
649 :group 'gnus-summary-various
652 (defcustom gnus-summary-prepared-hook nil
653 "*A hook called as the last thing after the summary buffer has been generated."
654 :group 'gnus-summary-various
657 (defcustom gnus-summary-generate-hook nil
658 "*A hook run just before generating the summary buffer.
659 This hook is commonly used to customize threading variables and the
661 :group 'gnus-summary-various
664 (defcustom gnus-select-group-hook nil
665 "*A hook called when a newsgroup is selected.
667 If you'd like to simplify subjects like the
668 `gnus-summary-next-same-subject' command does, you can use the
671 (setq gnus-select-group-hook
674 (mapcar (lambda (header)
675 (mail-header-set-subject
677 (gnus-simplify-subject
678 (mail-header-subject header) 're-only)))
679 gnus-newsgroup-headers))))"
680 :group 'gnus-group-select
683 (defcustom gnus-select-article-hook nil
684 "*A hook called when an article is selected."
685 :group 'gnus-summary-choose
688 (defcustom gnus-visual-mark-article-hook
689 (list 'gnus-highlight-selected-summary)
690 "*Hook run after selecting an article in the summary buffer.
691 It is meant to be used for highlighting the article in some way. It
692 is not run if `gnus-visual' is nil."
693 :group 'gnus-summary-visual
696 (defcustom gnus-parse-headers-hook nil
697 "*A hook called before parsing the headers."
701 (defcustom gnus-exit-group-hook nil
702 "*A hook called when exiting summary mode.
703 This hook is not called from the non-updating exit commands like `Q'."
707 (defcustom gnus-summary-update-hook
708 (list 'gnus-summary-highlight-line)
709 "*A hook called when a summary line is changed.
710 The hook will not be called if `gnus-visual' is nil.
712 The default function `gnus-summary-highlight-line' will
713 highlight the line according to the `gnus-summary-highlight'
715 :group 'gnus-summary-visual
718 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
719 "*A hook called when an article is selected for the first time.
720 The hook is intended to mark an article as read (or unread)
721 automatically when it is selected."
722 :group 'gnus-summary-choose
725 (defcustom gnus-group-no-more-groups-hook nil
726 "*A hook run when returning to group mode having no more (unread) groups."
727 :group 'gnus-group-select
730 (defcustom gnus-ps-print-hook nil
731 "*A hook run before ps-printing something from Gnus."
735 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
736 "Face used for highlighting the current article in the summary buffer."
737 :group 'gnus-summary-visual
740 (defcustom gnus-summary-highlight
741 '(((= mark gnus-canceled-mark)
742 . gnus-summary-cancelled-face)
743 ((and (> score default)
744 (or (= mark gnus-dormant-mark)
745 (= mark gnus-ticked-mark)))
746 . gnus-summary-high-ticked-face)
747 ((and (< score default)
748 (or (= mark gnus-dormant-mark)
749 (= mark gnus-ticked-mark)))
750 . gnus-summary-low-ticked-face)
751 ((or (= mark gnus-dormant-mark)
752 (= mark gnus-ticked-mark))
753 . gnus-summary-normal-ticked-face)
754 ((and (> score default) (= mark gnus-ancient-mark))
755 . gnus-summary-high-ancient-face)
756 ((and (< score default) (= mark gnus-ancient-mark))
757 . gnus-summary-low-ancient-face)
758 ((= mark gnus-ancient-mark)
759 . gnus-summary-normal-ancient-face)
760 ((and (> score default) (= mark gnus-unread-mark))
761 . gnus-summary-high-unread-face)
762 ((and (< score default) (= mark gnus-unread-mark))
763 . gnus-summary-low-unread-face)
764 ((= mark gnus-unread-mark)
765 . gnus-summary-normal-unread-face)
766 ((and (> score default) (memq mark (list gnus-downloadable-mark
767 gnus-undownloaded-mark)))
768 . gnus-summary-high-unread-face)
769 ((and (< score default) (memq mark (list gnus-downloadable-mark
770 gnus-undownloaded-mark)))
771 . gnus-summary-low-unread-face)
772 ((memq mark (list gnus-downloadable-mark gnus-undownloaded-mark))
773 . gnus-summary-normal-unread-face)
775 . gnus-summary-high-read-face)
777 . gnus-summary-low-read-face)
779 . gnus-summary-normal-read-face))
780 "*Controls the highlighting of summary buffer lines.
782 A list of (FORM . FACE) pairs. When deciding how a a particular
783 summary line should be displayed, each form is evaluated. The content
784 of the face field after the first true form is used. You can change
785 how those summary lines are displayed, by editing the face field.
787 You can use the following variables in the FORM field.
789 score: The articles score
790 default: The default article score.
791 below: The score below which articles are automatically marked as read.
792 mark: The articles mark."
793 :group 'gnus-summary-visual
794 :type '(repeat (cons (sexp :tag "Form" nil)
797 (defcustom gnus-alter-header-function nil
798 "Function called to allow alteration of article header structures.
799 The function is called with one parameter, the article header vector,
800 which it may alter in any way.")
802 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
803 "Variable that says which function should be used to decode a string with encoded words.")
805 (defcustom gnus-extra-headers nil
806 "*Extra headers to parse."
808 :type '(repeat symbol))
810 (defcustom gnus-ignored-from-addresses
811 (and user-mail-address (regexp-quote user-mail-address))
812 "*Regexp of From headers that may be suppressed in favor of To headers."
816 (defcustom gnus-group-charset-alist
817 '(("^hk\\>\\|^tw\\>\\|\\<big5\\>" cn-big5)
818 ("^cn\\>\\|\\<chinese\\>" cn-gb-2312)
819 ("^fj\\>\\|^japan\\>" iso-2022-jp-2)
820 ("^tnn\\>\\|^pin\\>\\|^sci.lang.japan" iso-2022-7bit)
821 ("^relcom\\>" koi8-r)
823 ("^\\(cz\\|hun\\|pl\\|sk\\|hr\\)\\>" iso-8859-2)
824 ("^israel\\>" iso-8859-1)
826 ("^alt.chinese.text.big5\\>" chinese-big5)
827 ("^soc.culture.vietnamese\\>" vietnamese-viqr)
828 ("^\\(comp\\|rec\\|alt\\|sci\\|soc\\|news\\|gnu\\|bofh\\)\\>" iso-8859-1)
830 "Alist of regexps (to match group names) and default charsets to be used when reading."
831 :type '(repeat (list (regexp :tag "Group")
832 (symbol :tag "Charset")))
833 :group 'gnus-charset)
835 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
836 "List of charsets that should be ignored.
837 When these charsets are used in the \"charset\" parameter, the
838 default charset will be used instead."
839 :type '(repeat symbol)
840 :group 'gnus-charset)
842 (defcustom gnus-group-ignored-charsets-alist
843 '(("alt\\.chinese\\.text" iso-8859-1))
844 "Alist of regexps (to match group names) and charsets that should be ignored.
845 When these charsets are used in the \"charset\" parameter, the
846 default charset will be used instead."
847 :type '(repeat (cons (regexp :tag "Group")
849 :group 'gnus-charset)
851 (defcustom gnus-group-highlight-words-alist nil
852 "Alist of group regexps and highlight regexps.
853 This variable uses the same syntax as `gnus-emphasis-alist'."
854 :type '(repeat (cons (regexp :tag "Group")
855 (repeat (list (regexp :tag "Highlight regexp")
856 (number :tag "Group for entire word" 0)
857 (number :tag "Group for displayed part" 0)
859 gnus-emphasis-highlight-words)))))
860 :group 'gnus-summary-visual)
862 (defcustom gnus-summary-show-article-charset-alist
864 "Alist of number and charset.
865 The article will be shown with the charset corresponding to the
867 For example: ((1 . cn-gb-2312) (2 . big5))."
868 :type '(repeat (cons (number :tag "Argument" 1)
869 (symbol :tag "Charset")))
870 :group 'gnus-charset)
872 (defcustom gnus-preserve-marks t
873 "Whether marks are preserved when moving, copying and respooling messages."
875 :group 'gnus-summary-marks)
877 (defcustom gnus-alter-articles-to-read-function nil
878 "Function to be called to alter the list of articles to be selected."
880 :group 'gnus-summary)
882 (defcustom gnus-orphan-score nil
883 "*All orphans get this score added. Set in the score file."
884 :group 'gnus-score-default
885 :type '(choice (const nil)
888 (defcustom gnus-summary-save-parts-default-mime "image/.*"
889 "*A regexp to match MIME parts when saving multiple parts of a message
890 with gnus-summary-save-parts (X m). This regexp will be used by default
891 when prompting the user for which type of files to save."
896 ;;; Internal variables
898 (defvar gnus-article-mime-handles nil)
899 (defvar gnus-article-decoded-p nil)
900 (defvar gnus-scores-exclude-files nil)
901 (defvar gnus-page-broken nil)
902 (defvar gnus-inhibit-mime-unbuttonizing nil)
904 (defvar gnus-original-article nil)
905 (defvar gnus-article-internal-prepare-hook nil)
906 (defvar gnus-newsgroup-process-stack nil)
908 (defvar gnus-thread-indent-array nil)
909 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
910 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
911 "Function called to sort the articles within a thread after it has been gathered together.")
913 (defvar gnus-summary-save-parts-type-history nil)
914 (defvar gnus-summary-save-parts-last-directory nil)
916 ;; Avoid highlighting in kill files.
917 (defvar gnus-summary-inhibit-highlight nil)
918 (defvar gnus-newsgroup-selected-overlay nil)
919 (defvar gnus-inhibit-limiting nil)
920 (defvar gnus-newsgroup-adaptive-score-file nil)
921 (defvar gnus-current-score-file nil)
922 (defvar gnus-current-move-group nil)
923 (defvar gnus-current-copy-group nil)
924 (defvar gnus-current-crosspost-group nil)
926 (defvar gnus-newsgroup-dependencies nil)
927 (defvar gnus-newsgroup-adaptive nil)
928 (defvar gnus-summary-display-article-function nil)
929 (defvar gnus-summary-highlight-line-function nil
930 "Function called after highlighting a summary line.")
932 (defvar gnus-summary-line-format-alist
933 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
934 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
935 (?s gnus-tmp-subject-or-nil ?s)
936 (?n gnus-tmp-name ?s)
937 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
939 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
941 (?F gnus-tmp-from ?s)
942 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
943 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
944 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
945 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
946 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
947 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
948 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
949 (?L gnus-tmp-lines ?d)
950 (?I gnus-tmp-indentation ?s)
951 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
952 (?R gnus-tmp-replied ?c)
953 (?\[ gnus-tmp-opening-bracket ?c)
954 (?\] gnus-tmp-closing-bracket ?c)
955 (?\> (make-string gnus-tmp-level ? ) ?s)
956 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
957 (?i gnus-tmp-score ?d)
958 (?z gnus-tmp-score-char ?c)
959 (?l (bbb-grouplens-score gnus-tmp-header) ?s)
960 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
961 (?U gnus-tmp-unread ?c)
962 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header) ?s)
963 (?t (gnus-summary-number-of-articles-in-thread
964 (and (boundp 'thread) (car thread)) gnus-tmp-level)
966 (?e (gnus-summary-number-of-articles-in-thread
967 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
969 (?u gnus-tmp-user-defined ?s)
970 (?P (gnus-pick-line-number) ?d))
971 "An alist of format specifications that can appear in summary lines.
972 These are paired with what variables they correspond with, along with
973 the type of the variable (string, integer, character, etc).")
975 (defvar gnus-summary-dummy-line-format-alist
976 `((?S gnus-tmp-subject ?s)
977 (?N gnus-tmp-number ?d)
978 (?u gnus-tmp-user-defined ?s)))
980 (defvar gnus-summary-mode-line-format-alist
981 `((?G gnus-tmp-group-name ?s)
982 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
983 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
984 (?A gnus-tmp-article-number ?d)
985 (?Z gnus-tmp-unread-and-unselected ?s)
987 (?U gnus-tmp-unread-and-unticked ?d)
988 (?S gnus-tmp-subject ?s)
989 (?e gnus-tmp-unselected ?d)
990 (?u gnus-tmp-user-defined ?s)
991 (?d (length gnus-newsgroup-dormant) ?d)
992 (?t (length gnus-newsgroup-marked) ?d)
993 (?r (length gnus-newsgroup-reads) ?d)
994 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
995 (?E gnus-newsgroup-expunged-tally ?d)
996 (?s (gnus-current-score-file-nondirectory) ?s)))
998 (defvar gnus-last-search-regexp nil
999 "Default regexp for article search command.")
1001 (defvar gnus-last-shell-command nil
1002 "Default shell command on article.")
1004 (defvar gnus-newsgroup-begin nil)
1005 (defvar gnus-newsgroup-end nil)
1006 (defvar gnus-newsgroup-last-rmail nil)
1007 (defvar gnus-newsgroup-last-mail nil)
1008 (defvar gnus-newsgroup-last-folder nil)
1009 (defvar gnus-newsgroup-last-file nil)
1010 (defvar gnus-newsgroup-auto-expire nil)
1011 (defvar gnus-newsgroup-active nil)
1013 (defvar gnus-newsgroup-data nil)
1014 (defvar gnus-newsgroup-data-reverse nil)
1015 (defvar gnus-newsgroup-limit nil)
1016 (defvar gnus-newsgroup-limits nil)
1018 (defvar gnus-newsgroup-unreads nil
1019 "List of unread articles in the current newsgroup.")
1021 (defvar gnus-newsgroup-unselected nil
1022 "List of unselected unread articles in the current newsgroup.")
1024 (defvar gnus-newsgroup-reads nil
1025 "Alist of read articles and article marks in the current newsgroup.")
1027 (defvar gnus-newsgroup-expunged-tally nil)
1029 (defvar gnus-newsgroup-marked nil
1030 "List of ticked articles in the current newsgroup (a subset of unread art).")
1032 (defvar gnus-newsgroup-killed nil
1033 "List of ranges of articles that have been through the scoring process.")
1035 (defvar gnus-newsgroup-cached nil
1036 "List of articles that come from the article cache.")
1038 (defvar gnus-newsgroup-saved nil
1039 "List of articles that have been saved.")
1041 (defvar gnus-newsgroup-kill-headers nil)
1043 (defvar gnus-newsgroup-replied nil
1044 "List of articles that have been replied to in the current newsgroup.")
1046 (defvar gnus-newsgroup-expirable nil
1047 "List of articles in the current newsgroup that can be expired.")
1049 (defvar gnus-newsgroup-processable nil
1050 "List of articles in the current newsgroup that can be processed.")
1052 (defvar gnus-newsgroup-downloadable nil
1053 "List of articles in the current newsgroup that can be processed.")
1055 (defvar gnus-newsgroup-undownloaded nil
1056 "List of articles in the current newsgroup that haven't been downloaded..")
1058 (defvar gnus-newsgroup-unsendable nil
1059 "List of articles in the current newsgroup that won't be sent.")
1061 (defvar gnus-newsgroup-bookmarks nil
1062 "List of articles in the current newsgroup that have bookmarks.")
1064 (defvar gnus-newsgroup-dormant nil
1065 "List of dormant articles in the current newsgroup.")
1067 (defvar gnus-newsgroup-scored nil
1068 "List of scored articles in the current newsgroup.")
1070 (defvar gnus-newsgroup-headers nil
1071 "List of article headers in the current newsgroup.")
1073 (defvar gnus-newsgroup-threads nil)
1075 (defvar gnus-newsgroup-prepared nil
1076 "Whether the current group has been prepared properly.")
1078 (defvar gnus-newsgroup-ancient nil
1079 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1081 (defvar gnus-newsgroup-sparse nil)
1083 (defvar gnus-current-article nil)
1084 (defvar gnus-article-current nil)
1085 (defvar gnus-current-headers nil)
1086 (defvar gnus-have-all-headers nil)
1087 (defvar gnus-last-article nil)
1088 (defvar gnus-newsgroup-history nil)
1089 (defvar gnus-newsgroup-charset nil)
1090 (defvar gnus-newsgroup-ephemeral-charset nil)
1091 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1093 (defconst gnus-summary-local-variables
1094 '(gnus-newsgroup-name
1095 gnus-newsgroup-begin gnus-newsgroup-end
1096 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1097 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1098 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1099 gnus-newsgroup-unselected gnus-newsgroup-marked
1100 gnus-newsgroup-reads gnus-newsgroup-saved
1101 gnus-newsgroup-replied gnus-newsgroup-expirable
1102 gnus-newsgroup-processable gnus-newsgroup-killed
1103 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1104 gnus-newsgroup-unsendable
1105 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1106 gnus-newsgroup-headers gnus-newsgroup-threads
1107 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1108 gnus-current-article gnus-current-headers gnus-have-all-headers
1109 gnus-last-article gnus-article-internal-prepare-hook
1110 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1111 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1112 gnus-thread-expunge-below
1113 gnus-score-alist gnus-current-score-file
1114 (gnus-summary-expunge-below . global)
1115 (gnus-summary-mark-below . global)
1116 (gnus-orphan-score . global)
1117 gnus-newsgroup-active gnus-scores-exclude-files
1118 gnus-newsgroup-history gnus-newsgroup-ancient
1119 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1120 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1121 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1122 (gnus-newsgroup-expunged-tally . 0)
1123 gnus-cache-removable-articles gnus-newsgroup-cached
1124 gnus-newsgroup-data gnus-newsgroup-data-reverse
1125 gnus-newsgroup-limit gnus-newsgroup-limits
1126 gnus-newsgroup-charset)
1127 "Variables that are buffer-local to the summary buffers.")
1129 ;; Byte-compiler warning.
1130 (defvar gnus-article-mode-map)
1134 (defvar gnus-decode-encoded-word-methods
1135 '(mail-decode-encoded-word-string)
1136 "List of methods used to decode encoded words.
1138 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item is
1139 FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1140 (REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1141 whose names match REGEXP.
1144 ((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1145 mail-decode-encoded-word-string
1146 (\"chinese\" . rfc1843-decode-string))")
1148 (defvar gnus-decode-encoded-word-methods-cache nil)
1150 (defun gnus-multi-decode-encoded-word-string (string)
1151 "Apply the functions from `gnus-encoded-word-methods' that match."
1152 (unless (and gnus-decode-encoded-word-methods-cache
1153 (eq gnus-newsgroup-name
1154 (car gnus-decode-encoded-word-methods-cache)))
1155 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1158 (nconc gnus-decode-encoded-word-methods-cache (list x))
1159 (if (and gnus-newsgroup-name
1160 (string-match (car x) gnus-newsgroup-name))
1161 (nconc gnus-decode-encoded-word-methods-cache
1163 gnus-decode-encoded-word-methods))
1164 (let ((xlist gnus-decode-encoded-word-methods-cache))
1167 (setq string (funcall (pop xlist) string))))
1170 ;; Subject simplification.
1172 (defun gnus-simplify-whitespace (str)
1173 "Remove excessive whitespace from STR."
1176 (while (string-match "[ \t][ \t]+" mystr)
1177 (setq mystr (concat (substring mystr 0 (match-beginning 0))
1179 (substring mystr (match-end 0)))))
1181 (when (string-match "^[ \t]+" mystr)
1182 (setq mystr (substring mystr (match-end 0))))
1184 (when (string-match "[ \t]+$" mystr)
1185 (setq mystr (substring mystr 0 (match-beginning 0))))
1188 (defsubst gnus-simplify-subject-re (subject)
1189 "Remove \"Re:\" from subject lines."
1190 (if (string-match "^[Rr][Ee]: *" subject)
1191 (substring subject (match-end 0))
1194 (defun gnus-simplify-subject (subject &optional re-only)
1195 "Remove `Re:' and words in parentheses.
1196 If RE-ONLY is non-nil, strip leading `Re:'s only."
1197 (let ((case-fold-search t)) ;Ignore case.
1198 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1199 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1200 (setq subject (substring subject (match-end 0))))
1201 ;; Remove uninteresting prefixes.
1202 (when (and (not re-only)
1203 gnus-simplify-ignored-prefixes
1204 (string-match gnus-simplify-ignored-prefixes subject))
1205 (setq subject (substring subject (match-end 0))))
1206 ;; Remove words in parentheses from end.
1208 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1209 (setq subject (substring subject 0 (match-beginning 0)))))
1210 ;; Return subject string.
1213 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1215 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1216 (goto-char (point-min))
1217 (while (re-search-forward regexp nil t)
1218 (replace-match (or newtext ""))))
1220 (defun gnus-simplify-buffer-fuzzy ()
1221 "Simplify string in the buffer fuzzily.
1222 The string in the accessible portion of the current buffer is simplified.
1223 It is assumed to be a single-line subject.
1224 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1225 matter is removed. Additional things can be deleted by setting
1226 `gnus-simplify-subject-fuzzy-regexp'."
1227 (let ((case-fold-search t)
1229 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1231 (while (not (eq modified-tick (buffer-modified-tick)))
1232 (setq modified-tick (buffer-modified-tick))
1234 ((listp gnus-simplify-subject-fuzzy-regexp)
1235 (mapcar 'gnus-simplify-buffer-fuzzy-step
1236 gnus-simplify-subject-fuzzy-regexp))
1237 (gnus-simplify-subject-fuzzy-regexp
1238 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1239 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1240 (gnus-simplify-buffer-fuzzy-step
1241 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1242 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1244 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1245 (gnus-simplify-buffer-fuzzy-step " +" " ")
1246 (gnus-simplify-buffer-fuzzy-step " $")
1247 (gnus-simplify-buffer-fuzzy-step "^ +")))
1249 (defun gnus-simplify-subject-fuzzy (subject)
1250 "Simplify a subject string fuzzily.
1251 See `gnus-simplify-buffer-fuzzy' for details."
1253 (gnus-set-work-buffer)
1254 (let ((case-fold-search t))
1255 ;; Remove uninteresting prefixes.
1256 (when (and gnus-simplify-ignored-prefixes
1257 (string-match gnus-simplify-ignored-prefixes subject))
1258 (setq subject (substring subject (match-end 0))))
1260 (inline (gnus-simplify-buffer-fuzzy))
1263 (defsubst gnus-simplify-subject-fully (subject)
1264 "Simplify a subject string according to gnus-summary-gather-subject-limit."
1266 (gnus-simplify-subject-functions
1267 (gnus-map-function gnus-simplify-subject-functions subject))
1268 ((null gnus-summary-gather-subject-limit)
1269 (gnus-simplify-subject-re subject))
1270 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1271 (gnus-simplify-subject-fuzzy subject))
1272 ((numberp gnus-summary-gather-subject-limit)
1273 (gnus-limit-string (gnus-simplify-subject-re subject)
1274 gnus-summary-gather-subject-limit))
1278 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1279 "Check whether two subjects are equal.
1280 If optional argument simple-first is t, first argument is already
1283 ((null simple-first)
1284 (equal (gnus-simplify-subject-fully s1)
1285 (gnus-simplify-subject-fully s2)))
1288 (gnus-simplify-subject-fully s2)))))
1290 (defun gnus-summary-bubble-group ()
1291 "Increase the score of the current group.
1292 This is a handy function to add to `gnus-summary-exit-hook' to
1293 increase the score of each group you read."
1294 (gnus-group-add-score gnus-newsgroup-name))
1298 ;;; Gnus summary mode
1301 (put 'gnus-summary-mode 'mode-class 'special)
1304 ;; Non-orthogonal keys
1306 (gnus-define-keys gnus-summary-mode-map
1307 " " gnus-summary-next-page
1308 "\177" gnus-summary-prev-page
1309 [delete] gnus-summary-prev-page
1310 [backspace] gnus-summary-prev-page
1311 "\r" gnus-summary-scroll-up
1312 "\M-\r" gnus-summary-scroll-down
1313 "n" gnus-summary-next-unread-article
1314 "p" gnus-summary-prev-unread-article
1315 "N" gnus-summary-next-article
1316 "P" gnus-summary-prev-article
1317 "\M-\C-n" gnus-summary-next-same-subject
1318 "\M-\C-p" gnus-summary-prev-same-subject
1319 "\M-n" gnus-summary-next-unread-subject
1320 "\M-p" gnus-summary-prev-unread-subject
1321 "." gnus-summary-first-unread-article
1322 "," gnus-summary-best-unread-article
1323 "\M-s" gnus-summary-search-article-forward
1324 "\M-r" gnus-summary-search-article-backward
1325 "<" gnus-summary-beginning-of-article
1326 ">" gnus-summary-end-of-article
1327 "j" gnus-summary-goto-article
1328 "^" gnus-summary-refer-parent-article
1329 "\M-^" gnus-summary-refer-article
1330 "u" gnus-summary-tick-article-forward
1331 "!" gnus-summary-tick-article-forward
1332 "U" gnus-summary-tick-article-backward
1333 "d" gnus-summary-mark-as-read-forward
1334 "D" gnus-summary-mark-as-read-backward
1335 "E" gnus-summary-mark-as-expirable
1336 "\M-u" gnus-summary-clear-mark-forward
1337 "\M-U" gnus-summary-clear-mark-backward
1338 "k" gnus-summary-kill-same-subject-and-select
1339 "\C-k" gnus-summary-kill-same-subject
1340 "\M-\C-k" gnus-summary-kill-thread
1341 "\M-\C-l" gnus-summary-lower-thread
1342 "e" gnus-summary-edit-article
1343 "#" gnus-summary-mark-as-processable
1344 "\M-#" gnus-summary-unmark-as-processable
1345 "\M-\C-t" gnus-summary-toggle-threads
1346 "\M-\C-s" gnus-summary-show-thread
1347 "\M-\C-h" gnus-summary-hide-thread
1348 "\M-\C-f" gnus-summary-next-thread
1349 "\M-\C-b" gnus-summary-prev-thread
1350 [(meta down)] gnus-summary-next-thread
1351 [(meta up)] gnus-summary-prev-thread
1352 "\M-\C-u" gnus-summary-up-thread
1353 "\M-\C-d" gnus-summary-down-thread
1354 "&" gnus-summary-execute-command
1355 "c" gnus-summary-catchup-and-exit
1356 "\C-w" gnus-summary-mark-region-as-read
1357 "\C-t" gnus-summary-toggle-truncation
1358 "?" gnus-summary-mark-as-dormant
1359 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1360 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1361 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1362 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1363 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1364 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1365 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1366 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1367 "=" gnus-summary-expand-window
1368 "\C-x\C-s" gnus-summary-reselect-current-group
1369 "\M-g" gnus-summary-rescan-group
1370 "w" gnus-summary-stop-page-breaking
1371 "\C-c\C-r" gnus-summary-caesar-message
1372 "f" gnus-summary-followup
1373 "F" gnus-summary-followup-with-original
1374 "C" gnus-summary-cancel-article
1375 "r" gnus-summary-reply
1376 "R" gnus-summary-reply-with-original
1377 "\C-c\C-f" gnus-summary-mail-forward
1378 "o" gnus-summary-save-article
1379 "\C-o" gnus-summary-save-article-mail
1380 "|" gnus-summary-pipe-output
1381 "\M-k" gnus-summary-edit-local-kill
1382 "\M-K" gnus-summary-edit-global-kill
1384 "\C-c\C-d" gnus-summary-describe-group
1385 "q" gnus-summary-exit
1386 "Q" gnus-summary-exit-no-update
1387 "\C-c\C-i" gnus-info-find-node
1388 gnus-mouse-2 gnus-mouse-pick-article
1389 "m" gnus-summary-mail-other-window
1390 "a" gnus-summary-post-news
1391 "x" gnus-summary-limit-to-unread
1392 "s" gnus-summary-isearch-article
1393 "t" gnus-summary-toggle-header
1394 "g" gnus-summary-show-article
1395 "l" gnus-summary-goto-last-article
1396 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1397 "\C-d" gnus-summary-enter-digest-group
1398 "\M-\C-d" gnus-summary-read-document
1399 "\M-\C-e" gnus-summary-edit-parameters
1400 "\M-\C-a" gnus-summary-customize-parameters
1402 "*" gnus-cache-enter-article
1403 "\M-*" gnus-cache-remove-article
1404 "\M-&" gnus-summary-universal-argument
1405 "\C-l" gnus-recenter
1406 "I" gnus-summary-increase-score
1407 "L" gnus-summary-lower-score
1408 "\M-i" gnus-symbolic-argument
1409 "h" gnus-summary-select-article-buffer
1411 "b" gnus-article-view-part
1412 "\M-t" gnus-summary-toggle-display-buttonized
1414 "V" gnus-summary-score-map
1415 "X" gnus-uu-extract-map
1416 "S" gnus-summary-send-map)
1418 ;; Sort of orthogonal keymap
1419 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1420 "t" gnus-summary-tick-article-forward
1421 "!" gnus-summary-tick-article-forward
1422 "d" gnus-summary-mark-as-read-forward
1423 "r" gnus-summary-mark-as-read-forward
1424 "c" gnus-summary-clear-mark-forward
1425 " " gnus-summary-clear-mark-forward
1426 "e" gnus-summary-mark-as-expirable
1427 "x" gnus-summary-mark-as-expirable
1428 "?" gnus-summary-mark-as-dormant
1429 "b" gnus-summary-set-bookmark
1430 "B" gnus-summary-remove-bookmark
1431 "#" gnus-summary-mark-as-processable
1432 "\M-#" gnus-summary-unmark-as-processable
1433 "S" gnus-summary-limit-include-expunged
1434 "C" gnus-summary-catchup
1435 "H" gnus-summary-catchup-to-here
1436 "\C-c" gnus-summary-catchup-all
1437 "k" gnus-summary-kill-same-subject-and-select
1438 "K" gnus-summary-kill-same-subject
1439 "P" gnus-uu-mark-map)
1441 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1442 "c" gnus-summary-clear-above
1443 "u" gnus-summary-tick-above
1444 "m" gnus-summary-mark-above
1445 "k" gnus-summary-kill-below)
1447 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1448 "/" gnus-summary-limit-to-subject
1449 "n" gnus-summary-limit-to-articles
1450 "w" gnus-summary-pop-limit
1451 "s" gnus-summary-limit-to-subject
1452 "a" gnus-summary-limit-to-author
1453 "u" gnus-summary-limit-to-unread
1454 "m" gnus-summary-limit-to-marks
1455 "M" gnus-summary-limit-exclude-marks
1456 "v" gnus-summary-limit-to-score
1457 "*" gnus-summary-limit-include-cached
1458 "D" gnus-summary-limit-include-dormant
1459 "T" gnus-summary-limit-include-thread
1460 "d" gnus-summary-limit-exclude-dormant
1461 "t" gnus-summary-limit-to-age
1462 "x" gnus-summary-limit-to-extra
1463 "E" gnus-summary-limit-include-expunged
1464 "c" gnus-summary-limit-exclude-childless-dormant
1465 "C" gnus-summary-limit-mark-excluded-as-read)
1467 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1468 "n" gnus-summary-next-unread-article
1469 "p" gnus-summary-prev-unread-article
1470 "N" gnus-summary-next-article
1471 "P" gnus-summary-prev-article
1472 "\C-n" gnus-summary-next-same-subject
1473 "\C-p" gnus-summary-prev-same-subject
1474 "\M-n" gnus-summary-next-unread-subject
1475 "\M-p" gnus-summary-prev-unread-subject
1476 "f" gnus-summary-first-unread-article
1477 "b" gnus-summary-best-unread-article
1478 "j" gnus-summary-goto-article
1479 "g" gnus-summary-goto-subject
1480 "l" gnus-summary-goto-last-article
1481 "o" gnus-summary-pop-article)
1483 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1484 "k" gnus-summary-kill-thread
1485 "l" gnus-summary-lower-thread
1486 "i" gnus-summary-raise-thread
1487 "T" gnus-summary-toggle-threads
1488 "t" gnus-summary-rethread-current
1489 "^" gnus-summary-reparent-thread
1490 "s" gnus-summary-show-thread
1491 "S" gnus-summary-show-all-threads
1492 "h" gnus-summary-hide-thread
1493 "H" gnus-summary-hide-all-threads
1494 "n" gnus-summary-next-thread
1495 "p" gnus-summary-prev-thread
1496 "u" gnus-summary-up-thread
1497 "o" gnus-summary-top-thread
1498 "d" gnus-summary-down-thread
1499 "#" gnus-uu-mark-thread
1500 "\M-#" gnus-uu-unmark-thread)
1502 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1503 "g" gnus-summary-prepare
1504 "c" gnus-summary-insert-cached-articles)
1506 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1507 "c" gnus-summary-catchup-and-exit
1508 "C" gnus-summary-catchup-all-and-exit
1509 "E" gnus-summary-exit-no-update
1510 "Q" gnus-summary-exit
1511 "Z" gnus-summary-exit
1512 "n" gnus-summary-catchup-and-goto-next-group
1513 "R" gnus-summary-reselect-current-group
1514 "G" gnus-summary-rescan-group
1515 "N" gnus-summary-next-group
1516 "s" gnus-summary-save-newsrc
1517 "P" gnus-summary-prev-group)
1519 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1520 " " gnus-summary-next-page
1521 "n" gnus-summary-next-page
1522 "\177" gnus-summary-prev-page
1523 [delete] gnus-summary-prev-page
1524 "p" gnus-summary-prev-page
1525 "\r" gnus-summary-scroll-up
1526 "\M-\r" gnus-summary-scroll-down
1527 "<" gnus-summary-beginning-of-article
1528 ">" gnus-summary-end-of-article
1529 "b" gnus-summary-beginning-of-article
1530 "e" gnus-summary-end-of-article
1531 "^" gnus-summary-refer-parent-article
1532 "r" gnus-summary-refer-parent-article
1533 "D" gnus-summary-enter-digest-group
1534 "R" gnus-summary-refer-references
1535 "T" gnus-summary-refer-thread
1536 "g" gnus-summary-show-article
1537 "s" gnus-summary-isearch-article
1538 "P" gnus-summary-print-article
1539 "t" gnus-article-babel)
1541 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1542 "b" gnus-article-add-buttons
1543 "B" gnus-article-add-buttons-to-head
1544 "o" gnus-article-treat-overstrike
1545 "e" gnus-article-emphasize
1546 "w" gnus-article-fill-cited-article
1547 "Q" gnus-article-fill-long-lines
1548 "C" gnus-article-capitalize-sentences
1549 "c" gnus-article-remove-cr
1550 "q" gnus-article-de-quoted-unreadable
1551 "6" gnus-article-de-base64-unreadable
1552 "Z" gnus-article-decode-HZ
1553 "h" gnus-article-wash-html
1554 "f" gnus-article-display-x-face
1555 "l" gnus-summary-stop-page-breaking
1556 "r" gnus-summary-caesar-message
1557 "t" gnus-summary-toggle-header
1558 "v" gnus-summary-verbose-headers
1559 "H" gnus-article-strip-headers-in-body
1560 "d" gnus-article-treat-dumbquotes)
1562 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1563 "a" gnus-article-hide
1564 "h" gnus-article-hide-headers
1565 "b" gnus-article-hide-boring-headers
1566 "s" gnus-article-hide-signature
1567 "c" gnus-article-hide-citation
1568 "C" gnus-article-hide-citation-in-followups
1569 "l" gnus-article-hide-list-identifiers
1570 "p" gnus-article-hide-pgp
1571 "B" gnus-article-strip-banner
1572 "P" gnus-article-hide-pem
1573 "\C-c" gnus-article-hide-citation-maybe)
1575 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1576 "a" gnus-article-highlight
1577 "h" gnus-article-highlight-headers
1578 "c" gnus-article-highlight-citation
1579 "s" gnus-article-highlight-signature)
1581 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1582 "w" gnus-article-decode-mime-words
1583 "c" gnus-article-decode-charset
1584 "v" gnus-mime-view-all-parts
1585 "b" gnus-article-view-part)
1587 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1588 "z" gnus-article-date-ut
1589 "u" gnus-article-date-ut
1590 "l" gnus-article-date-local
1591 "e" gnus-article-date-lapsed
1592 "o" gnus-article-date-original
1593 "i" gnus-article-date-iso8601
1594 "s" gnus-article-date-user)
1596 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
1597 "t" gnus-article-remove-trailing-blank-lines
1598 "l" gnus-article-strip-leading-blank-lines
1599 "m" gnus-article-strip-multiple-blank-lines
1600 "a" gnus-article-strip-blank-lines
1601 "A" gnus-article-strip-all-blank-lines
1602 "s" gnus-article-strip-leading-space
1603 "e" gnus-article-strip-trailing-space)
1605 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
1607 "f" gnus-summary-fetch-faq
1608 "d" gnus-summary-describe-group
1609 "h" gnus-summary-describe-briefly
1610 "i" gnus-info-find-node)
1612 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
1613 "e" gnus-summary-expire-articles
1614 "\M-\C-e" gnus-summary-expire-articles-now
1615 "\177" gnus-summary-delete-article
1616 [delete] gnus-summary-delete-article
1617 [backspace] gnus-summary-delete-article
1618 "m" gnus-summary-move-article
1619 "r" gnus-summary-respool-article
1620 "w" gnus-summary-edit-article
1621 "c" gnus-summary-copy-article
1622 "B" gnus-summary-crosspost-article
1623 "q" gnus-summary-respool-query
1624 "t" gnus-summary-respool-trace
1625 "i" gnus-summary-import-article
1626 "p" gnus-summary-article-posted-p)
1628 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
1629 "o" gnus-summary-save-article
1630 "m" gnus-summary-save-article-mail
1631 "F" gnus-summary-write-article-file
1632 "r" gnus-summary-save-article-rmail
1633 "f" gnus-summary-save-article-file
1634 "b" gnus-summary-save-article-body-file
1635 "h" gnus-summary-save-article-folder
1636 "v" gnus-summary-save-article-vm
1637 "p" gnus-summary-pipe-output
1638 "s" gnus-soup-add-article)
1640 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
1641 "b" gnus-summary-display-buttonized
1642 "m" gnus-summary-repair-multipart
1643 "v" gnus-article-view-part
1644 "o" gnus-article-save-part
1645 "c" gnus-article-copy-part
1646 "e" gnus-article-externalize-part
1647 "i" gnus-article-inline-part
1648 "|" gnus-article-pipe-part))
1650 (defun gnus-summary-make-menu-bar ()
1651 (gnus-turn-off-edit-menu 'summary)
1653 (unless (boundp 'gnus-summary-misc-menu)
1656 gnus-summary-kill-menu gnus-summary-mode-map ""
1661 ["Enter score..." gnus-summary-score-entry t]
1662 ["Customize" gnus-score-customize t])
1663 (gnus-make-score-map 'increase)
1664 (gnus-make-score-map 'lower)
1666 ["Kill below" gnus-summary-kill-below t]
1667 ["Mark above" gnus-summary-mark-above t]
1668 ["Tick above" gnus-summary-tick-above t]
1669 ["Clear above" gnus-summary-clear-above t])
1670 ["Current score" gnus-summary-current-score t]
1671 ["Set score" gnus-summary-set-score t]
1672 ["Switch current score file..." gnus-score-change-score-file t]
1673 ["Set mark below..." gnus-score-set-mark-below t]
1674 ["Set expunge below..." gnus-score-set-expunge-below t]
1675 ["Edit current score file" gnus-score-edit-current-scores t]
1676 ["Edit score file" gnus-score-edit-file t]
1677 ["Trace score" gnus-score-find-trace t]
1678 ["Find words" gnus-score-find-favourite-words t]
1679 ["Rescore buffer" gnus-summary-rescore t]
1680 ["Increase score..." gnus-summary-increase-score t]
1681 ["Lower score..." gnus-summary-lower-score t]))))
1683 ;; Define both the Article menu in the summary buffer and the equivalent
1684 ;; Commands menu in the article buffer here for consistency.
1687 ["All" gnus-article-hide t]
1688 ["Headers" gnus-article-hide-headers t]
1689 ["Signature" gnus-article-hide-signature t]
1690 ["Citation" gnus-article-hide-citation t]
1691 ["List identifiers" gnus-article-hide-list-identifiers t]
1692 ["PGP" gnus-article-hide-pgp t]
1693 ["Banner" gnus-article-strip-banner t]
1694 ["Boring headers" gnus-article-hide-boring-headers t])
1696 ["All" gnus-article-highlight t]
1697 ["Headers" gnus-article-highlight-headers t]
1698 ["Signature" gnus-article-highlight-signature t]
1699 ["Citation" gnus-article-highlight-citation t])
1701 ["Words" gnus-article-decode-mime-words t]
1702 ["Charset" gnus-article-decode-charset t]
1703 ["QP" gnus-article-de-quoted-unreadable t]
1704 ["Base64" gnus-article-de-base64-unreadable t]
1705 ["View all" gnus-mime-view-all-parts t])
1707 ["Local" gnus-article-date-local t]
1708 ["ISO8601" gnus-article-date-iso8601 t]
1709 ["UT" gnus-article-date-ut t]
1710 ["Original" gnus-article-date-original t]
1711 ["Lapsed" gnus-article-date-lapsed t]
1712 ["User-defined" gnus-article-date-user t])
1715 ["Leading" gnus-article-strip-leading-blank-lines t]
1716 ["Multiple" gnus-article-strip-multiple-blank-lines t]
1717 ["Trailing" gnus-article-remove-trailing-blank-lines t]
1718 ["All of the above" gnus-article-strip-blank-lines t]
1719 ["All" gnus-article-strip-all-blank-lines t]
1720 ["Leading space" gnus-article-strip-leading-space t]
1721 ["Trailing space" gnus-article-strip-trailing-space t])
1722 ["Overstrike" gnus-article-treat-overstrike t]
1723 ["Dumb quotes" gnus-article-treat-dumbquotes t]
1724 ["Emphasis" gnus-article-emphasize t]
1725 ["Word wrap" gnus-article-fill-cited-article t]
1726 ["Fill long lines" gnus-article-fill-long-lines t]
1727 ["Capitalize sentences" gnus-article-capitalize-sentences t]
1728 ["CR" gnus-article-remove-cr t]
1729 ["Show X-Face" gnus-article-display-x-face t]
1730 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
1731 ["Base64" gnus-article-de-base64-unreadable t]
1732 ["Rot 13" gnus-summary-caesar-message t]
1733 ["Unix pipe" gnus-summary-pipe-message t]
1734 ["Add buttons" gnus-article-add-buttons t]
1735 ["Add buttons to head" gnus-article-add-buttons-to-head t]
1736 ["Stop page breaking" gnus-summary-stop-page-breaking t]
1737 ["Verbose header" gnus-summary-verbose-headers t]
1738 ["Toggle header" gnus-summary-toggle-header t]
1739 ["Html" gnus-article-wash-html t]
1740 ["HZ" gnus-article-decode-HZ t])
1742 ["Save in default format" gnus-summary-save-article t]
1743 ["Save in file" gnus-summary-save-article-file t]
1744 ["Save in Unix mail format" gnus-summary-save-article-mail t]
1745 ["Save in MH folder" gnus-summary-save-article-folder t]
1746 ["Save in VM folder" gnus-summary-save-article-vm t]
1747 ["Save in RMAIL mbox" gnus-summary-save-article-rmail t]
1748 ["Save body in file" gnus-summary-save-article-body-file t]
1749 ["Pipe through a filter" gnus-summary-pipe-output t]
1750 ["Add to SOUP packet" gnus-soup-add-article t]
1751 ["Print" gnus-summary-print-article t])
1753 ["Respool article..." gnus-summary-respool-article t]
1754 ["Move article..." gnus-summary-move-article
1755 (gnus-check-backend-function
1756 'request-move-article gnus-newsgroup-name)]
1757 ["Copy article..." gnus-summary-copy-article t]
1758 ["Crosspost article..." gnus-summary-crosspost-article
1759 (gnus-check-backend-function
1760 'request-replace-article gnus-newsgroup-name)]
1761 ["Import file..." gnus-summary-import-article t]
1762 ["Check if posted" gnus-summary-article-posted-p t]
1763 ["Edit article" gnus-summary-edit-article
1764 (not (gnus-group-read-only-p))]
1765 ["Delete article" gnus-summary-delete-article
1766 (gnus-check-backend-function
1767 'request-expire-articles gnus-newsgroup-name)]
1768 ["Query respool" gnus-summary-respool-query t]
1769 ["Trace respool" gnus-summary-respool-trace t]
1770 ["Delete expirable articles" gnus-summary-expire-articles-now
1771 (gnus-check-backend-function
1772 'request-expire-articles gnus-newsgroup-name)])
1774 ["Uudecode" gnus-uu-decode-uu t]
1775 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
1776 ["Unshar" gnus-uu-decode-unshar t]
1777 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
1778 ["Save" gnus-uu-decode-save t]
1779 ["Binhex" gnus-uu-decode-binhex t]
1780 ["Postscript" gnus-uu-decode-postscript t])
1782 ["Enter article" gnus-cache-enter-article t]
1783 ["Remove article" gnus-cache-remove-article t])
1784 ["Translate" gnus-article-babel t]
1785 ["Select article buffer" gnus-summary-select-article-buffer t]
1786 ["Enter digest buffer" gnus-summary-enter-digest-group t]
1787 ["Isearch article..." gnus-summary-isearch-article t]
1788 ["Beginning of the article" gnus-summary-beginning-of-article t]
1789 ["End of the article" gnus-summary-end-of-article t]
1790 ["Fetch parent of article" gnus-summary-refer-parent-article t]
1791 ["Fetch referenced articles" gnus-summary-refer-references t]
1792 ["Fetch current thread" gnus-summary-refer-thread t]
1793 ["Fetch article with id..." gnus-summary-refer-article t]
1794 ["Redisplay" gnus-summary-show-article t])))
1796 gnus-summary-article-menu gnus-summary-mode-map ""
1797 (cons "Article" innards))
1800 gnus-article-commands-menu gnus-article-mode-map ""
1801 (cons "Commands" innards)))
1804 gnus-summary-thread-menu gnus-summary-mode-map ""
1806 ["Toggle threading" gnus-summary-toggle-threads t]
1807 ["Hide threads" gnus-summary-hide-all-threads t]
1808 ["Show threads" gnus-summary-show-all-threads t]
1809 ["Hide thread" gnus-summary-hide-thread t]
1810 ["Show thread" gnus-summary-show-thread t]
1811 ["Go to next thread" gnus-summary-next-thread t]
1812 ["Go to previous thread" gnus-summary-prev-thread t]
1813 ["Go down thread" gnus-summary-down-thread t]
1814 ["Go up thread" gnus-summary-up-thread t]
1815 ["Top of thread" gnus-summary-top-thread t]
1816 ["Mark thread as read" gnus-summary-kill-thread t]
1817 ["Lower thread score" gnus-summary-lower-thread t]
1818 ["Raise thread score" gnus-summary-raise-thread t]
1819 ["Rethread current" gnus-summary-rethread-current t]))
1822 gnus-summary-post-menu gnus-summary-mode-map ""
1824 ["Post an article" gnus-summary-post-news t]
1825 ["Followup" gnus-summary-followup t]
1826 ["Followup and yank" gnus-summary-followup-with-original t]
1827 ["Supersede article" gnus-summary-supersede-article t]
1828 ["Cancel article" gnus-summary-cancel-article t]
1829 ["Reply" gnus-summary-reply t]
1830 ["Reply and yank" gnus-summary-reply-with-original t]
1831 ["Wide reply" gnus-summary-wide-reply t]
1832 ["Wide reply and yank" gnus-summary-wide-reply-with-original t]
1833 ["Mail forward" gnus-summary-mail-forward t]
1834 ["Post forward" gnus-summary-post-forward t]
1835 ["Digest and mail" gnus-uu-digest-mail-forward t]
1836 ["Digest and post" gnus-uu-digest-post-forward t]
1837 ["Resend message" gnus-summary-resend-message t]
1838 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
1839 ["Send a mail" gnus-summary-mail-other-window t]
1840 ["Uuencode and post" gnus-uu-post-news t]
1841 ["Followup via news" gnus-summary-followup-to-mail t]
1842 ["Followup via news and yank"
1843 gnus-summary-followup-to-mail-with-original t]
1845 ;;["Send" gnus-summary-send-draft t]
1846 ;;["Send bounced" gnus-resend-bounced-mail t])
1850 gnus-summary-misc-menu gnus-summary-mode-map ""
1853 ["Mark as read" gnus-summary-mark-as-read-forward t]
1854 ["Mark same subject and select"
1855 gnus-summary-kill-same-subject-and-select t]
1856 ["Mark same subject" gnus-summary-kill-same-subject t]
1857 ["Catchup" gnus-summary-catchup t]
1858 ["Catchup all" gnus-summary-catchup-all t]
1859 ["Catchup to here" gnus-summary-catchup-to-here t]
1860 ["Catchup region" gnus-summary-mark-region-as-read t]
1861 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
1863 ["Tick" gnus-summary-tick-article-forward t]
1864 ["Mark as dormant" gnus-summary-mark-as-dormant t]
1865 ["Remove marks" gnus-summary-clear-mark-forward t]
1866 ["Set expirable mark" gnus-summary-mark-as-expirable t]
1867 ["Set bookmark" gnus-summary-set-bookmark t]
1868 ["Remove bookmark" gnus-summary-remove-bookmark t])
1870 ["Marks..." gnus-summary-limit-to-marks t]
1871 ["Subject..." gnus-summary-limit-to-subject t]
1872 ["Author..." gnus-summary-limit-to-author t]
1873 ["Age..." gnus-summary-limit-to-age t]
1874 ["Extra..." gnus-summary-limit-to-extra t]
1875 ["Score" gnus-summary-limit-to-score t]
1876 ["Unread" gnus-summary-limit-to-unread t]
1877 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
1878 ["Articles" gnus-summary-limit-to-articles t]
1879 ["Pop limit" gnus-summary-pop-limit t]
1880 ["Show dormant" gnus-summary-limit-include-dormant t]
1881 ["Hide childless dormant"
1882 gnus-summary-limit-exclude-childless-dormant t]
1883 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
1884 ["Hide marked" gnus-summary-limit-exclude-marks t]
1885 ["Show expunged" gnus-summary-show-all-expunged t])
1887 ["Set mark" gnus-summary-mark-as-processable t]
1888 ["Remove mark" gnus-summary-unmark-as-processable t]
1889 ["Remove all marks" gnus-summary-unmark-all-processable t]
1890 ["Mark above" gnus-uu-mark-over t]
1891 ["Mark series" gnus-uu-mark-series t]
1892 ["Mark region" gnus-uu-mark-region t]
1893 ["Unmark region" gnus-uu-unmark-region t]
1894 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
1895 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
1896 ["Mark all" gnus-uu-mark-all t]
1897 ["Mark buffer" gnus-uu-mark-buffer t]
1898 ["Mark sparse" gnus-uu-mark-sparse t]
1899 ["Mark thread" gnus-uu-mark-thread t]
1900 ["Unmark thread" gnus-uu-unmark-thread t]
1901 ("Process Mark Sets"
1902 ["Kill" gnus-summary-kill-process-mark t]
1903 ["Yank" gnus-summary-yank-process-mark
1904 gnus-newsgroup-process-stack]
1905 ["Save" gnus-summary-save-process-mark t]))
1907 ["Page forward" gnus-summary-next-page t]
1908 ["Page backward" gnus-summary-prev-page t]
1909 ["Line forward" gnus-summary-scroll-up t])
1911 ["Next unread article" gnus-summary-next-unread-article t]
1912 ["Previous unread article" gnus-summary-prev-unread-article t]
1913 ["Next article" gnus-summary-next-article t]
1914 ["Previous article" gnus-summary-prev-article t]
1915 ["Next unread subject" gnus-summary-next-unread-subject t]
1916 ["Previous unread subject" gnus-summary-prev-unread-subject t]
1917 ["Next article same subject" gnus-summary-next-same-subject t]
1918 ["Previous article same subject" gnus-summary-prev-same-subject t]
1919 ["First unread article" gnus-summary-first-unread-article t]
1920 ["Best unread article" gnus-summary-best-unread-article t]
1921 ["Go to subject number..." gnus-summary-goto-subject t]
1922 ["Go to article number..." gnus-summary-goto-article t]
1923 ["Go to the last article" gnus-summary-goto-last-article t]
1924 ["Pop article off history" gnus-summary-pop-article t])
1926 ["Sort by number" gnus-summary-sort-by-number t]
1927 ["Sort by author" gnus-summary-sort-by-author t]
1928 ["Sort by subject" gnus-summary-sort-by-subject t]
1929 ["Sort by date" gnus-summary-sort-by-date t]
1930 ["Sort by score" gnus-summary-sort-by-score t]
1931 ["Sort by lines" gnus-summary-sort-by-lines t]
1932 ["Sort by characters" gnus-summary-sort-by-chars t])
1934 ["Fetch group FAQ" gnus-summary-fetch-faq t]
1935 ["Describe group" gnus-summary-describe-group t]
1936 ["Read manual" gnus-info-find-node t])
1938 ["Pick and read" gnus-pick-mode t]
1939 ["Binary" gnus-binary-mode t])
1941 ["Regenerate" gnus-summary-prepare t]
1942 ["Insert cached articles" gnus-summary-insert-cached-articles t]
1943 ["Toggle threading" gnus-summary-toggle-threads t])
1944 ["Filter articles..." gnus-summary-execute-command t]
1945 ["Run command on subjects..." gnus-summary-universal-argument t]
1946 ["Search articles forward..." gnus-summary-search-article-forward t]
1947 ["Search articles backward..." gnus-summary-search-article-backward t]
1948 ["Toggle line truncation" gnus-summary-toggle-truncation t]
1949 ["Expand window" gnus-summary-expand-window t]
1950 ["Expire expirable articles" gnus-summary-expire-articles
1951 (gnus-check-backend-function
1952 'request-expire-articles gnus-newsgroup-name)]
1953 ["Edit local kill file" gnus-summary-edit-local-kill t]
1954 ["Edit main kill file" gnus-summary-edit-global-kill t]
1955 ["Edit group parameters" gnus-summary-edit-parameters t]
1956 ["Customize group parameters" gnus-summary-customize-parameters t]
1957 ["Send a bug report" gnus-bug t]
1959 ["Catchup and exit" gnus-summary-catchup-and-exit t]
1960 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
1961 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
1962 ["Exit group" gnus-summary-exit t]
1963 ["Exit group without updating" gnus-summary-exit-no-update t]
1964 ["Exit and goto next group" gnus-summary-next-group t]
1965 ["Exit and goto prev group" gnus-summary-prev-group t]
1966 ["Reselect group" gnus-summary-reselect-current-group t]
1967 ["Rescan group" gnus-summary-rescan-group t]
1968 ["Update dribble" gnus-summary-save-newsrc t])))
1970 (gnus-run-hooks 'gnus-summary-menu-hook)))
1972 (defun gnus-score-set-default (var value)
1973 "A version of set that updates the GNU Emacs menu-bar."
1975 ;; It is the message that forces the active status to be updated.
1978 (defun gnus-make-score-map (type)
1979 "Make a summary score map of type TYPE."
1982 (let ((headers '(("author" "from" string)
1983 ("subject" "subject" string)
1984 ("article body" "body" string)
1985 ("article head" "head" string)
1986 ("xref" "xref" string)
1987 ("extra header" "extra" string)
1988 ("lines" "lines" number)
1989 ("followups to author" "followup" string)))
1990 (types '((number ("less than" <)
1993 (string ("substring" s)
1997 (perms '(("temporary" (current-time-string))
2005 (if (eq type 'lower)
2010 (setq header (car headers))
2016 (let ((ts (cdr (assoc (nth 2 header) types)))
2032 'gnus-summary-score-entry
2034 (if (or (string= (nth 1 header)
2036 (string= (nth 1 header)
2039 (list 'gnus-summary-header
2041 (list 'quote (nth 1 (car ts)))
2042 (list 'gnus-score-delta-default
2049 (list (nreverse outp))))
2052 (list (nreverse outt))))
2054 (setq headers (cdr headers)))
2055 (list (nreverse outh))))))))
2059 (defun gnus-summary-mode (&optional group)
2060 "Major mode for reading articles.
2062 All normal editing commands are switched off.
2063 \\<gnus-summary-mode-map>
2064 Each line in this buffer represents one article. To read an
2065 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2066 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2069 You can also post articles and send mail from this buffer. To
2070 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2071 of an article, type `\\[gnus-summary-reply]'.
2073 There are approx. one gazillion commands you can execute in this
2074 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2076 The following commands are available:
2078 \\{gnus-summary-mode-map}"
2080 (when (gnus-visual-p 'summary-menu 'menu)
2081 (gnus-summary-make-menu-bar))
2082 (kill-all-local-variables)
2083 (gnus-summary-make-local-variables)
2084 (gnus-make-thread-indent-array)
2085 (gnus-simplify-mode-line)
2086 (setq major-mode 'gnus-summary-mode)
2087 (setq mode-name "Summary")
2088 (make-local-variable 'minor-mode-alist)
2089 (use-local-map gnus-summary-mode-map)
2090 (buffer-disable-undo)
2091 (setq buffer-read-only t) ;Disable modification
2092 (setq truncate-lines t)
2093 (setq selective-display t)
2094 (setq selective-display-ellipses t) ;Display `...'
2095 (gnus-summary-set-display-table)
2096 (gnus-set-default-directory)
2097 (setq gnus-newsgroup-name group)
2098 (make-local-variable 'gnus-summary-line-format)
2099 (make-local-variable 'gnus-summary-line-format-spec)
2100 (make-local-variable 'gnus-summary-dummy-line-format)
2101 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2102 (make-local-variable 'gnus-summary-mark-positions)
2103 (make-local-hook 'pre-command-hook)
2104 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2105 (gnus-run-hooks 'gnus-summary-mode-hook)
2106 (mm-enable-multibyte)
2107 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2108 (gnus-update-summary-mark-positions))
2110 (defun gnus-summary-make-local-variables ()
2111 "Make all the local summary buffer variables."
2113 (dolist (local gnus-summary-local-variables)
2116 (if (eq (cdr local) 'global)
2117 ;; Copy the global value of the variable.
2118 (setq global (symbol-value (car local)))
2119 ;; Use the value from the list.
2120 (setq global (eval (cdr local))))
2121 (set (make-local-variable (car local)) global))
2122 ;; Simple nil-valued local variable.
2123 (set (make-local-variable local) nil)))))
2125 (defun gnus-summary-clear-local-variables ()
2126 (let ((locals gnus-summary-local-variables))
2128 (if (consp (car locals))
2129 (and (vectorp (caar locals))
2130 (set (caar locals) nil))
2131 (and (vectorp (car locals))
2132 (set (car locals) nil)))
2133 (setq locals (cdr locals)))))
2135 ;; Summary data functions.
2137 (defmacro gnus-data-number (data)
2140 (defmacro gnus-data-set-number (data number)
2141 `(setcar ,data ,number))
2143 (defmacro gnus-data-mark (data)
2146 (defmacro gnus-data-set-mark (data mark)
2147 `(setcar (nthcdr 1 ,data) ,mark))
2149 (defmacro gnus-data-pos (data)
2152 (defmacro gnus-data-set-pos (data pos)
2153 `(setcar (nthcdr 2 ,data) ,pos))
2155 (defmacro gnus-data-header (data)
2158 (defmacro gnus-data-set-header (data header)
2159 `(setf (nth 3 ,data) ,header))
2161 (defmacro gnus-data-level (data)
2164 (defmacro gnus-data-unread-p (data)
2165 `(= (nth 1 ,data) gnus-unread-mark))
2167 (defmacro gnus-data-read-p (data)
2168 `(/= (nth 1 ,data) gnus-unread-mark))
2170 (defmacro gnus-data-pseudo-p (data)
2171 `(consp (nth 3 ,data)))
2173 (defmacro gnus-data-find (number)
2174 `(assq ,number gnus-newsgroup-data))
2176 (defmacro gnus-data-find-list (number &optional data)
2177 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2178 (memq (assq ,number bdata)
2181 (defmacro gnus-data-make (number mark pos header level)
2182 `(list ,number ,mark ,pos ,header ,level))
2184 (defun gnus-data-enter (after-article number mark pos header level offset)
2185 (let ((data (gnus-data-find-list after-article)))
2187 (error "No such article: %d" after-article))
2188 (setcdr data (cons (gnus-data-make number mark pos header level)
2190 (setq gnus-newsgroup-data-reverse nil)
2191 (gnus-data-update-list (cddr data) offset)))
2193 (defun gnus-data-enter-list (after-article list &optional offset)
2195 (let ((data (and after-article (gnus-data-find-list after-article)))
2199 (let ((odata gnus-newsgroup-data))
2200 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2202 (gnus-data-update-list odata offset)))
2203 ;; Find the last element in the list to be spliced into the main
2206 (setq list (cdr list)))
2209 (setcdr list gnus-newsgroup-data)
2210 (setq gnus-newsgroup-data ilist)
2212 (gnus-data-update-list (cdr list) offset)))
2213 (setcdr list (cdr data))
2216 (gnus-data-update-list (cdr list) offset))))
2217 (setq gnus-newsgroup-data-reverse nil))))
2219 (defun gnus-data-remove (article &optional offset)
2220 (let ((data gnus-newsgroup-data))
2221 (if (= (gnus-data-number (car data)) article)
2223 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2224 gnus-newsgroup-data-reverse nil)
2226 (gnus-data-update-list gnus-newsgroup-data offset)))
2228 (when (= (gnus-data-number (cadr data)) article)
2229 (setcdr data (cddr data))
2231 (gnus-data-update-list (cdr data) offset))
2233 gnus-newsgroup-data-reverse nil))
2234 (setq data (cdr data))))))
2236 (defmacro gnus-data-list (backward)
2238 (or gnus-newsgroup-data-reverse
2239 (setq gnus-newsgroup-data-reverse
2240 (reverse gnus-newsgroup-data)))
2241 gnus-newsgroup-data))
2243 (defun gnus-data-update-list (data offset)
2244 "Add OFFSET to the POS of all data entries in DATA."
2245 (setq gnus-newsgroup-data-reverse nil)
2247 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2248 (setq data (cdr data))))
2250 (defun gnus-summary-article-pseudo-p (article)
2251 "Say whether this article is a pseudo article or not."
2252 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2254 (defmacro gnus-summary-article-sparse-p (article)
2255 "Say whether this article is a sparse article or not."
2256 `(memq ,article gnus-newsgroup-sparse))
2258 (defmacro gnus-summary-article-ancient-p (article)
2259 "Say whether this article is a sparse article or not."
2260 `(memq ,article gnus-newsgroup-ancient))
2262 (defun gnus-article-parent-p (number)
2263 "Say whether this article is a parent or not."
2264 (let ((data (gnus-data-find-list number)))
2265 (and (cdr data) ; There has to be an article after...
2266 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2267 (gnus-data-level (nth 1 data))))))
2269 (defun gnus-article-children (number)
2270 "Return a list of all children to NUMBER."
2271 (let* ((data (gnus-data-find-list number))
2272 (level (gnus-data-level (car data)))
2274 (setq data (cdr data))
2276 (= (gnus-data-level (car data)) (1+ level)))
2277 (push (gnus-data-number (car data)) children)
2278 (setq data (cdr data)))
2281 (defmacro gnus-summary-skip-intangible ()
2282 "If the current article is intangible, then jump to a different article."
2283 '(let ((to (get-text-property (point) 'gnus-intangible)))
2284 (and to (gnus-summary-goto-subject to))))
2286 (defmacro gnus-summary-article-intangible-p ()
2287 "Say whether this article is intangible or not."
2288 '(get-text-property (point) 'gnus-intangible))
2290 (defun gnus-article-read-p (article)
2291 "Say whether ARTICLE is read or not."
2292 (not (or (memq article gnus-newsgroup-marked)
2293 (memq article gnus-newsgroup-unreads)
2294 (memq article gnus-newsgroup-unselected)
2295 (memq article gnus-newsgroup-dormant))))
2297 ;; Some summary mode macros.
2299 (defmacro gnus-summary-article-number ()
2300 "The article number of the article on the current line.
2301 If there isn's an article number here, then we return the current
2304 (gnus-summary-skip-intangible)
2305 (or (get-text-property (point) 'gnus-number)
2306 (gnus-summary-last-subject))))
2308 (defmacro gnus-summary-article-header (&optional number)
2309 "Return the header of article NUMBER."
2310 `(gnus-data-header (gnus-data-find
2311 ,(or number '(gnus-summary-article-number)))))
2313 (defmacro gnus-summary-thread-level (&optional number)
2314 "Return the level of thread that starts with article NUMBER."
2315 `(if (and (eq gnus-summary-make-false-root 'dummy)
2316 (get-text-property (point) 'gnus-intangible))
2318 (gnus-data-level (gnus-data-find
2319 ,(or number '(gnus-summary-article-number))))))
2321 (defmacro gnus-summary-article-mark (&optional number)
2322 "Return the mark of article NUMBER."
2323 `(gnus-data-mark (gnus-data-find
2324 ,(or number '(gnus-summary-article-number)))))
2326 (defmacro gnus-summary-article-pos (&optional number)
2327 "Return the position of the line of article NUMBER."
2328 `(gnus-data-pos (gnus-data-find
2329 ,(or number '(gnus-summary-article-number)))))
2331 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
2332 (defmacro gnus-summary-article-subject (&optional number)
2333 "Return current subject string or nil if nothing."
2336 `(gnus-data-header (assq ,number gnus-newsgroup-data))
2337 '(gnus-data-header (assq (gnus-summary-article-number)
2338 gnus-newsgroup-data)))))
2341 (mail-header-subject headers))))
2343 (defmacro gnus-summary-article-score (&optional number)
2344 "Return current article score."
2345 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
2346 gnus-newsgroup-scored))
2347 gnus-summary-default-score 0))
2349 (defun gnus-summary-article-children (&optional number)
2350 "Return a list of article numbers that are children of article NUMBER."
2351 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
2352 (level (gnus-data-level (car data)))
2354 (while (and (setq data (cdr data))
2355 (> (setq l (gnus-data-level (car data))) level))
2356 (and (= (1+ level) l)
2357 (push (gnus-data-number (car data))
2359 (nreverse children)))
2361 (defun gnus-summary-article-parent (&optional number)
2362 "Return the article number of the parent of article NUMBER."
2363 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
2364 (gnus-data-list t)))
2365 (level (gnus-data-level (car data))))
2367 () ; This is a root.
2368 ;; We search until we find an article with a level less than
2369 ;; this one. That function has to be the parent.
2370 (while (and (setq data (cdr data))
2371 (not (< (gnus-data-level (car data)) level))))
2372 (and data (gnus-data-number (car data))))))
2374 (defun gnus-unread-mark-p (mark)
2375 "Say whether MARK is the unread mark."
2376 (= mark gnus-unread-mark))
2378 (defun gnus-read-mark-p (mark)
2379 "Say whether MARK is one of the marks that mark as read.
2380 This is all marks except unread, ticked, dormant, and expirable."
2381 (not (or (= mark gnus-unread-mark)
2382 (= mark gnus-ticked-mark)
2383 (= mark gnus-dormant-mark)
2384 (= mark gnus-expirable-mark))))
2386 (defmacro gnus-article-mark (number)
2387 "Return the MARK of article NUMBER.
2388 This macro should only be used when computing the mark the \"first\"
2389 time; i.e., when generating the summary lines. After that,
2390 `gnus-summary-article-mark' should be used to examine the
2393 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
2394 ((memq ,number gnus-newsgroup-undownloaded) gnus-undownloaded-mark)
2395 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
2396 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
2397 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
2398 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
2399 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
2400 (t (or (cdr (assq ,number gnus-newsgroup-reads))
2401 gnus-ancient-mark))))
2403 ;; Saving hidden threads.
2405 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
2406 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
2408 (defmacro gnus-save-hidden-threads (&rest forms)
2409 "Save hidden threads, eval FORMS, and restore the hidden threads."
2410 (let ((config (make-symbol "config")))
2411 `(let ((,config (gnus-hidden-threads-configuration)))
2415 (gnus-restore-hidden-threads-configuration ,config)))))
2417 (defun gnus-data-compute-positions ()
2418 "Compute the positions of all articles."
2419 (setq gnus-newsgroup-data-reverse nil)
2420 (let ((data gnus-newsgroup-data))
2422 (gnus-save-hidden-threads
2423 (gnus-summary-show-all-threads)
2424 (goto-char (point-min))
2426 (while (get-text-property (point) 'gnus-intangible)
2428 (gnus-data-set-pos (car data) (+ (point) 3))
2429 (setq data (cdr data))
2430 (forward-line 1))))))
2432 (defun gnus-hidden-threads-configuration ()
2433 "Return the current hidden threads configuration."
2436 (goto-char (point-min))
2437 (while (search-forward "\r" nil t)
2438 (push (1- (point)) config))
2441 (defun gnus-restore-hidden-threads-configuration (config)
2442 "Restore hidden threads configuration from CONFIG."
2444 (let (point buffer-read-only)
2445 (while (setq point (pop config))
2446 (when (and (< point (point-max))
2448 (eq (char-after) ?\n))
2449 (subst-char-in-region point (1+ point) ?\n ?\r))))))
2451 ;; Various summary mode internalish functions.
2453 (defun gnus-mouse-pick-article (e)
2456 (gnus-summary-next-page nil t))
2458 (defun gnus-summary-set-display-table ()
2459 "Change the display table.
2460 Odd characters have a tendency to mess
2461 up nicely formatted displays - we make all possible glyphs
2462 display only a single character."
2464 ;; We start from the standard display table, if any.
2465 (let ((table (or (copy-sequence standard-display-table)
2466 (make-display-table)))
2468 ;; Nix out all the control chars...
2469 (while (>= (setq i (1- i)) 0)
2470 (aset table i [??]))
2471 ;; ... but not newline and cr, of course. (cr is necessary for the
2472 ;; selective display).
2473 (aset table ?\n nil)
2474 (aset table ?\r nil)
2475 ;; We keep TAB as well.
2476 (aset table ?\t nil)
2477 ;; We nix out any glyphs over 126 that are not set already.
2479 (while (>= (setq i (1- i)) 127)
2480 ;; Only modify if the entry is nil.
2481 (unless (aref table i)
2482 (aset table i [??]))))
2483 (setq buffer-display-table table)))
2485 (defun gnus-summary-setup-buffer (group)
2486 "Initialize summary buffer."
2487 (let ((buffer (concat "*Summary " group "*")))
2488 (if (get-buffer buffer)
2491 (setq gnus-summary-buffer (current-buffer))
2492 (not gnus-newsgroup-prepared))
2493 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
2494 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
2495 (gnus-summary-mode group)
2497 (gnus-carpal-setup-buffer 'summary))
2498 (unless gnus-single-article-buffer
2499 (make-local-variable 'gnus-article-buffer)
2500 (make-local-variable 'gnus-article-current)
2501 (make-local-variable 'gnus-original-article-buffer))
2502 (setq gnus-newsgroup-name group)
2505 (defun gnus-set-global-variables ()
2506 "Set the global equivalents of the buffer-local variables.
2507 They are set to the latest values they had. These reflect the summary
2508 buffer that was in action when the last article was fetched."
2509 (when (eq major-mode 'gnus-summary-mode)
2510 (setq gnus-summary-buffer (current-buffer))
2511 (let ((name gnus-newsgroup-name)
2512 (marked gnus-newsgroup-marked)
2513 (unread gnus-newsgroup-unreads)
2514 (headers gnus-current-headers)
2515 (data gnus-newsgroup-data)
2516 (summary gnus-summary-buffer)
2517 (article-buffer gnus-article-buffer)
2518 (original gnus-original-article-buffer)
2519 (gac gnus-article-current)
2520 (reffed gnus-reffed-article-number)
2521 (score-file gnus-current-score-file)
2522 (default-charset gnus-newsgroup-charset))
2524 (set-buffer gnus-group-buffer)
2525 (setq gnus-newsgroup-name name
2526 gnus-newsgroup-marked marked
2527 gnus-newsgroup-unreads unread
2528 gnus-current-headers headers
2529 gnus-newsgroup-data data
2530 gnus-article-current gac
2531 gnus-summary-buffer summary
2532 gnus-article-buffer article-buffer
2533 gnus-original-article-buffer original
2534 gnus-reffed-article-number reffed
2535 gnus-current-score-file score-file
2536 gnus-newsgroup-charset default-charset)
2537 ;; The article buffer also has local variables.
2538 (when (gnus-buffer-live-p gnus-article-buffer)
2539 (set-buffer gnus-article-buffer)
2540 (setq gnus-summary-buffer summary))))))
2542 (defun gnus-summary-article-unread-p (article)
2543 "Say whether ARTICLE is unread or not."
2544 (memq article gnus-newsgroup-unreads))
2546 (defun gnus-summary-first-article-p (&optional article)
2547 "Return whether ARTICLE is the first article in the buffer."
2548 (if (not (setq article (or article (gnus-summary-article-number))))
2550 (eq article (caar gnus-newsgroup-data))))
2552 (defun gnus-summary-last-article-p (&optional article)
2553 "Return whether ARTICLE is the last article in the buffer."
2554 (if (not (setq article (or article (gnus-summary-article-number))))
2555 ;; All non-existent numbers are the last article. :-)
2557 (not (cdr (gnus-data-find-list article)))))
2559 (defun gnus-make-thread-indent-array ()
2561 (unless (and gnus-thread-indent-array
2562 (= gnus-thread-indent-level gnus-thread-indent-array-level))
2563 (setq gnus-thread-indent-array (make-vector 201 "")
2564 gnus-thread-indent-array-level gnus-thread-indent-level)
2566 (aset gnus-thread-indent-array n
2567 (make-string (* n gnus-thread-indent-level) ? ))
2570 (defun gnus-update-summary-mark-positions ()
2571 "Compute where the summary marks are to go."
2573 (when (gnus-buffer-exists-p gnus-summary-buffer)
2574 (set-buffer gnus-summary-buffer))
2575 (let ((gnus-replied-mark 129)
2576 (gnus-score-below-mark 130)
2577 (gnus-score-over-mark 130)
2578 (gnus-download-mark 131)
2579 (spec gnus-summary-line-format-spec)
2582 (gnus-set-work-buffer)
2583 (let ((gnus-summary-line-format-spec spec)
2584 (gnus-newsgroup-downloadable '((0 . t))))
2585 (gnus-summary-insert-line
2586 [0 "" "" "" "" "" 0 0 "" nil] 0 nil 128 t nil "" nil 1)
2587 (goto-char (point-min))
2588 (setq pos (list (cons 'unread (and (search-forward "\200" nil t)
2590 (goto-char (point-min))
2591 (push (cons 'replied (and (search-forward "\201" nil t)
2594 (goto-char (point-min))
2595 (push (cons 'score (and (search-forward "\202" nil t) (- (point) 2)))
2597 (goto-char (point-min))
2598 (push (cons 'download
2599 (and (search-forward "\203" nil t) (- (point) 2)))
2601 (setq gnus-summary-mark-positions pos))))
2603 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
2604 "Insert a dummy root in the summary buffer."
2606 (gnus-add-text-properties
2607 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
2608 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
2610 (defun gnus-summary-from-or-to-or-newsgroups (header)
2611 (let ((to (cdr (assq 'To (mail-header-extra header))))
2612 (newsgroups (cdr (assq 'Newsgroups (mail-header-extra header))))
2613 (mail-parse-charset gnus-newsgroup-charset)
2614 (mail-parse-ignored-charsets
2615 (save-excursion (set-buffer gnus-summary-buffer)
2616 gnus-newsgroup-ignored-charsets)))
2619 gnus-ignored-from-addresses
2620 (string-match gnus-ignored-from-addresses
2621 (mail-header-from header)))
2623 (or (car (funcall gnus-extract-address-components
2625 gnus-decode-encoded-word-function to)))
2626 (funcall gnus-decode-encoded-word-function to))))
2628 gnus-ignored-from-addresses
2629 (string-match gnus-ignored-from-addresses
2630 (mail-header-from header)))
2631 (concat "=> " newsgroups))
2633 (or (car (funcall gnus-extract-address-components
2634 (mail-header-from header)))
2635 (mail-header-from header))))))
2637 (defun gnus-summary-insert-line (gnus-tmp-header
2638 gnus-tmp-level gnus-tmp-current
2639 gnus-tmp-unread gnus-tmp-replied
2640 gnus-tmp-expirable gnus-tmp-subject-or-nil
2641 &optional gnus-tmp-dummy gnus-tmp-score
2643 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
2644 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
2645 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
2646 (gnus-tmp-score-char
2647 (if (or (null gnus-summary-default-score)
2648 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
2649 gnus-summary-zcore-fuzz))
2651 (if (< gnus-tmp-score gnus-summary-default-score)
2652 gnus-score-below-mark gnus-score-over-mark)))
2654 (cond (gnus-tmp-process gnus-process-mark)
2655 ((memq gnus-tmp-current gnus-newsgroup-cached)
2657 (gnus-tmp-replied gnus-replied-mark)
2658 ((memq gnus-tmp-current gnus-newsgroup-saved)
2660 (t gnus-unread-mark)))
2661 (gnus-tmp-from (mail-header-from gnus-tmp-header))
2664 ((string-match "<[^>]+> *$" gnus-tmp-from)
2665 (let ((beg (match-beginning 0)))
2666 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
2667 (substring gnus-tmp-from (1+ (match-beginning 0))
2668 (1- (match-end 0))))
2669 (substring gnus-tmp-from 0 beg))))
2670 ((string-match "(.+)" gnus-tmp-from)
2671 (substring gnus-tmp-from
2672 (1+ (match-beginning 0)) (1- (match-end 0))))
2674 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
2675 (gnus-tmp-number (mail-header-number gnus-tmp-header))
2676 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
2677 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
2678 (buffer-read-only nil))
2679 (when (string= gnus-tmp-name "")
2680 (setq gnus-tmp-name gnus-tmp-from))
2681 (unless (numberp gnus-tmp-lines)
2682 (setq gnus-tmp-lines 0))
2683 (gnus-put-text-property
2685 (progn (eval gnus-summary-line-format-spec) (point))
2686 'gnus-number gnus-tmp-number)
2687 (when (gnus-visual-p 'summary-highlight 'highlight)
2689 (gnus-run-hooks 'gnus-summary-update-hook)
2692 (defun gnus-summary-update-line (&optional dont-update)
2693 "Update summary line after change."
2694 (when (and gnus-summary-default-score
2695 (not gnus-summary-inhibit-highlight))
2696 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
2697 (article (gnus-summary-article-number))
2698 (score (gnus-summary-article-score article)))
2700 (if (and gnus-summary-mark-below
2701 (< (gnus-summary-article-score)
2702 gnus-summary-mark-below))
2703 ;; This article has a low score, so we mark it as read.
2704 (when (memq article gnus-newsgroup-unreads)
2705 (gnus-summary-mark-article-as-read gnus-low-score-mark))
2706 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
2707 ;; This article was previously marked as read on account
2708 ;; of a low score, but now it has risen, so we mark it as
2710 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
2711 (gnus-summary-update-mark
2712 (if (or (null gnus-summary-default-score)
2713 (<= (abs (- score gnus-summary-default-score))
2714 gnus-summary-zcore-fuzz))
2716 (if (< score gnus-summary-default-score)
2717 gnus-score-below-mark gnus-score-over-mark))
2719 ;; Do visual highlighting.
2720 (when (gnus-visual-p 'summary-highlight 'highlight)
2721 (gnus-run-hooks 'gnus-summary-update-hook)))))
2723 (defvar gnus-tmp-new-adopts nil)
2725 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
2726 "Return the number of articles in THREAD.
2727 This may be 0 in some cases -- if none of the articles in
2728 the thread are to be displayed."
2730 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
2732 ((not (listp thread))
2734 ((and (consp thread) (cdr thread))
2737 'gnus-summary-number-of-articles-in-thread (cdr thread))))
2740 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
2743 (when (and level (zerop level) gnus-tmp-new-adopts)
2746 'gnus-summary-number-of-articles-in-thread
2747 gnus-tmp-new-adopts))))
2749 (if (> number 1) gnus-not-empty-thread-mark
2750 gnus-empty-thread-mark)
2753 (defun gnus-summary-set-local-parameters (group)
2754 "Go through the local params of GROUP and set all variable specs in that list."
2755 (let ((params (gnus-group-find-parameter group))
2758 (setq elem (car params)
2759 params (cdr params))
2760 (and (consp elem) ; Has to be a cons.
2761 (consp (cdr elem)) ; The cdr has to be a list.
2762 (symbolp (car elem)) ; Has to be a symbol in there.
2763 (not (memq (car elem) '(quit-config))) ; Ignore quit-config.
2764 (ignore-errors ; So we set it.
2765 (make-local-variable (car elem))
2766 (set (car elem) (eval (nth 1 elem))))))))
2768 (defun gnus-summary-read-group (group &optional show-all no-article
2769 kill-buffer no-display backward
2771 "Start reading news in newsgroup GROUP.
2772 If SHOW-ALL is non-nil, already read articles are also listed.
2773 If NO-ARTICLE is non-nil, no article is selected initially.
2774 If NO-DISPLAY, don't generate a summary buffer."
2778 (let ((gnus-auto-select-next nil))
2779 (or (gnus-summary-read-group-1
2780 group show-all no-article
2781 kill-buffer no-display
2784 select-articles nil)))))
2785 (eq gnus-auto-select-next 'quietly))
2786 (set-buffer gnus-group-buffer)
2787 ;; The entry function called above goes to the next
2788 ;; group automatically, so we go two groups back
2789 ;; if we are searching for the previous group.
2791 (gnus-group-prev-unread-group 2))
2792 (if (not (equal group (gnus-group-group-name)))
2793 (setq group (gnus-group-group-name))
2797 (defun gnus-summary-read-group-1 (group show-all no-article
2798 kill-buffer no-display
2799 &optional select-articles)
2800 ;; Killed foreign groups can't be entered.
2801 (when (and (not (gnus-group-native-p group))
2802 (not (gnus-gethash group gnus-newsrc-hashtb)))
2803 (error "Dead non-native groups can't be entered"))
2804 (gnus-message 5 "Retrieving newsgroup: %s..." group)
2805 (let* ((new-group (gnus-summary-setup-buffer group))
2806 (quit-config (gnus-group-quit-config group))
2807 (did-select (and new-group (gnus-select-newsgroup
2808 group show-all select-articles))))
2810 ;; This summary buffer exists already, so we just select it.
2812 (gnus-set-global-variables)
2814 (gnus-kill-or-deaden-summary kill-buffer))
2815 (gnus-configure-windows 'summary 'force)
2816 (gnus-set-mode-line 'summary)
2817 (gnus-summary-position-point)
2820 ;; We couldn't select this group.
2822 (when (and (eq major-mode 'gnus-summary-mode)
2823 (not (equal (current-buffer) kill-buffer)))
2824 (kill-buffer (current-buffer))
2825 (if (not quit-config)
2827 ;; Update the info -- marks might need to be removed,
2829 (gnus-summary-update-info)
2830 (set-buffer gnus-group-buffer)
2831 (gnus-group-jump-to-group group)
2832 (gnus-group-next-unread-group 1))
2833 (gnus-handle-ephemeral-exit quit-config)))
2834 (gnus-message 3 "Can't select group")
2836 ;; The user did a `C-g' while prompting for number of articles,
2837 ;; so we exit this group.
2838 ((eq did-select 'quit)
2839 (and (eq major-mode 'gnus-summary-mode)
2840 (not (equal (current-buffer) kill-buffer))
2841 (kill-buffer (current-buffer)))
2843 (gnus-kill-or-deaden-summary kill-buffer))
2844 (if (not quit-config)
2846 (set-buffer gnus-group-buffer)
2847 (gnus-group-jump-to-group group)
2848 (gnus-group-next-unread-group 1)
2849 (gnus-configure-windows 'group 'force))
2850 (gnus-handle-ephemeral-exit quit-config))
2851 ;; Finally signal the quit.
2853 ;; The group was successfully selected.
2855 (gnus-set-global-variables)
2856 ;; Save the active value in effect when the group was entered.
2857 (setq gnus-newsgroup-active
2859 (gnus-active gnus-newsgroup-name)))
2860 ;; You can change the summary buffer in some way with this hook.
2861 (gnus-run-hooks 'gnus-select-group-hook)
2862 ;; Set any local variables in the group parameters.
2863 (gnus-summary-set-local-parameters gnus-newsgroup-name)
2864 (gnus-update-format-specifications
2865 nil 'summary 'summary-mode 'summary-dummy)
2866 (gnus-update-summary-mark-positions)
2867 ;; Do score processing.
2868 (when gnus-use-scoring
2869 (gnus-possibly-score-headers))
2870 ;; Check whether to fill in the gaps in the threads.
2871 (when gnus-build-sparse-threads
2872 (gnus-build-sparse-threads))
2873 ;; Find the initial limit.
2874 (if gnus-show-threads
2876 (let ((gnus-newsgroup-dormant nil))
2877 (gnus-summary-initial-limit show-all))
2878 (gnus-summary-initial-limit show-all))
2879 ;; When untreaded, all articles are always shown.
2880 (setq gnus-newsgroup-limit
2882 (lambda (header) (mail-header-number header))
2883 gnus-newsgroup-headers)))
2884 ;; Generate the summary buffer.
2886 (gnus-summary-prepare))
2887 (when gnus-use-trees
2888 (gnus-tree-open group)
2889 (setq gnus-summary-highlight-line-function
2890 'gnus-tree-highlight-article))
2891 ;; If the summary buffer is empty, but there are some low-scored
2892 ;; articles or some excluded dormants, we include these in the
2894 (when (and (zerop (buffer-size))
2896 (cond (gnus-newsgroup-dormant
2897 (gnus-summary-limit-include-dormant))
2898 ((and gnus-newsgroup-scored show-all)
2899 (gnus-summary-limit-include-expunged t))))
2900 ;; Function `gnus-apply-kill-file' must be called in this hook.
2901 (gnus-run-hooks 'gnus-apply-kill-hook)
2902 (if (and (zerop (buffer-size))
2905 ;; This newsgroup is empty.
2906 (gnus-summary-catchup-and-exit nil t)
2907 (gnus-message 6 "No unread news")
2909 (gnus-kill-or-deaden-summary kill-buffer))
2910 ;; Return nil from this function.
2912 ;; Hide conversation thread subtrees. We cannot do this in
2913 ;; gnus-summary-prepare-hook since kill processing may not
2914 ;; work with hidden articles.
2915 (and gnus-show-threads
2916 gnus-thread-hide-subtree
2917 (gnus-summary-hide-all-threads))
2919 (gnus-kill-or-deaden-summary kill-buffer))
2920 ;; Show first unread article if requested.
2921 (if (and (not no-article)
2923 gnus-newsgroup-unreads
2924 gnus-auto-select-first)
2926 (gnus-configure-windows 'summary)
2928 ((eq gnus-auto-select-first 'best)
2929 (gnus-summary-best-unread-article))
2930 ((eq gnus-auto-select-first t)
2931 (gnus-summary-first-unread-article))
2932 ((gnus-functionp gnus-auto-select-first)
2933 (funcall gnus-auto-select-first))))
2934 ;; Don't select any articles, just move point to the first
2935 ;; article in the group.
2936 (goto-char (point-min))
2937 (gnus-summary-position-point)
2938 (gnus-configure-windows 'summary 'force)
2939 (gnus-set-mode-line 'summary))
2940 (when (get-buffer-window gnus-group-buffer t)
2941 ;; Gotta use windows, because recenter does weird stuff if
2942 ;; the current buffer ain't the displayed window.
2943 (let ((owin (selected-window)))
2944 (select-window (get-buffer-window gnus-group-buffer t))
2945 (when (gnus-group-goto-group group)
2947 (select-window owin)))
2948 ;; Mark this buffer as "prepared".
2949 (setq gnus-newsgroup-prepared t)
2950 (gnus-run-hooks 'gnus-summary-prepared-hook)
2953 (defun gnus-summary-prepare ()
2954 "Generate the summary buffer."
2956 (let ((buffer-read-only nil))
2958 (setq gnus-newsgroup-data nil
2959 gnus-newsgroup-data-reverse nil)
2960 (gnus-run-hooks 'gnus-summary-generate-hook)
2961 ;; Generate the buffer, either with threads or without.
2962 (when gnus-newsgroup-headers
2963 (gnus-summary-prepare-threads
2964 (if gnus-show-threads
2965 (gnus-sort-gathered-threads
2966 (funcall gnus-summary-thread-gathering-function
2968 (gnus-cut-threads (gnus-make-threads)))))
2969 ;; Unthreaded display.
2970 (gnus-sort-articles gnus-newsgroup-headers))))
2971 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
2972 ;; Call hooks for modifying summary buffer.
2973 (goto-char (point-min))
2974 (gnus-run-hooks 'gnus-summary-prepare-hook)))
2976 (defsubst gnus-general-simplify-subject (subject)
2977 "Simply subject by the same rules as gnus-gather-threads-by-subject."
2980 ;; Truncate the subject.
2981 (gnus-simplify-subject-functions
2982 (gnus-map-function gnus-simplify-subject-functions subject))
2983 ((numberp gnus-summary-gather-subject-limit)
2984 (setq subject (gnus-simplify-subject-re subject))
2985 (if (> (length subject) gnus-summary-gather-subject-limit)
2986 (substring subject 0 gnus-summary-gather-subject-limit)
2988 ;; Fuzzily simplify it.
2989 ((eq 'fuzzy gnus-summary-gather-subject-limit)
2990 (gnus-simplify-subject-fuzzy subject))
2991 ;; Just remove the leading "Re:".
2993 (gnus-simplify-subject-re subject))))
2995 (if (and gnus-summary-gather-exclude-subject
2996 (string-match gnus-summary-gather-exclude-subject subject))
2997 nil ; This article shouldn't be gathered
3000 (defun gnus-summary-simplify-subject-query ()
3001 "Query where the respool algorithm would put this article."
3003 (gnus-summary-select-article)
3004 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3006 (defun gnus-gather-threads-by-subject (threads)
3007 "Gather threads by looking at Subject headers."
3008 (if (not gnus-summary-make-false-root)
3010 (let ((hashtb (gnus-make-hashtable 1024))
3013 subject hthread whole-subject)
3015 (setq subject (gnus-general-simplify-subject
3016 (setq whole-subject (mail-header-subject
3019 (if (setq hthread (gnus-gethash subject hashtb))
3021 ;; We enter a dummy root into the thread, if we
3022 ;; haven't done that already.
3023 (unless (stringp (caar hthread))
3024 (setcar hthread (list whole-subject (car hthread))))
3025 ;; We add this new gathered thread to this gathered
3027 (setcdr (car hthread)
3028 (nconc (cdar hthread) (list (car threads))))
3029 ;; Remove it from the list of threads.
3030 (setcdr prev (cdr threads))
3031 (setq threads prev))
3032 ;; Enter this thread into the hash table.
3033 (gnus-sethash subject threads hashtb)))
3035 (setq threads (cdr threads)))
3038 (defun gnus-gather-threads-by-references (threads)
3039 "Gather threads by looking at References headers."
3040 (let ((idhashtb (gnus-make-hashtable 1024))
3041 (thhashtb (gnus-make-hashtable 1024))
3044 ids references id gthread gid entered ref)
3046 (when (setq references (mail-header-references (caar threads)))
3047 (setq id (mail-header-id (caar threads))
3048 ids (gnus-split-references references)
3050 (while (setq ref (pop ids))
3051 (setq ids (delete ref ids))
3052 (if (not (setq gid (gnus-gethash ref idhashtb)))
3054 (gnus-sethash ref id idhashtb)
3055 (gnus-sethash id threads thhashtb))
3056 (setq gthread (gnus-gethash gid thhashtb))
3058 ;; We enter a dummy root into the thread, if we
3059 ;; haven't done that already.
3060 (unless (stringp (caar gthread))
3061 (setcar gthread (list (mail-header-subject (caar gthread))
3063 ;; We add this new gathered thread to this gathered
3065 (setcdr (car gthread)
3066 (nconc (cdar gthread) (list (car threads)))))
3067 ;; Add it into the thread hash table.
3068 (gnus-sethash id gthread thhashtb)
3070 ;; Remove it from the list of threads.
3071 (setcdr prev (cdr threads))
3072 (setq threads prev))))
3074 (setq threads (cdr threads)))
3077 (defun gnus-sort-gathered-threads (threads)
3078 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3079 (let ((result threads))
3081 (when (stringp (caar threads))
3082 (setcdr (car threads)
3083 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3084 (setq threads (cdr threads)))
3087 (defun gnus-thread-loop-p (root thread)
3088 "Say whether ROOT is in THREAD."
3089 (let ((stack (list thread))
3092 (while (setq thread (pop stack))
3093 (setq th (cdr thread))
3095 (not (eq (caar th) root)))
3098 ;; We have found a loop.
3100 (setcdr thread (delq (car th) (cdr thread)))
3101 (if (boundp (setq ref-dep (intern "none"
3102 gnus-newsgroup-dependencies)))
3103 (setcdr (symbol-value ref-dep)
3104 (nconc (cdr (symbol-value ref-dep))
3106 (set ref-dep (list nil (car th))))
3109 ;; Push all the subthreads onto the stack.
3110 (push (cdr thread) stack)))
3113 (defun gnus-make-threads ()
3114 "Go through the dependency hashtb and find the roots. Return all threads."
3116 (while (catch 'infloop
3119 ;; Deal with self-referencing References loops.
3120 (when (and (car (symbol-value refs))
3127 (car (symbol-value refs)) thread))
3128 (cdr (symbol-value refs)))))))
3131 (unless (car (symbol-value refs))
3132 ;; These threads do not refer back to any other articles,
3133 ;; so they're roots.
3134 (setq threads (append (cdr (symbol-value refs)) threads))))
3135 gnus-newsgroup-dependencies)))
3138 ;; Build the thread tree.
3139 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3140 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3142 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3143 if it was already present.
3145 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3146 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3147 Message-IDs will be renamed be renamed to a unique Message-ID before
3150 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3151 (let* ((id (mail-header-id header))
3152 (id-dep (and id (intern id dependencies)))
3153 ref ref-dep ref-header)
3154 ;; Enter this `header' in the `dependencies' table.
3158 ;; The first two cases do the normal part: enter a new `header'
3159 ;; in the `dependencies' table.
3160 ((not (boundp id-dep))
3161 (set id-dep (list header)))
3162 ((null (car (symbol-value id-dep)))
3163 (setcar (symbol-value id-dep) header))
3165 ;; From here the `header' was already present in the
3166 ;; `dependencies' table.
3168 ;; Overrides an existing entry;
3169 ;; just set the header part of the entry.
3170 (setcar (symbol-value id-dep) header))
3172 ;; Renames the existing `header' to a unique Message-ID.
3173 ((not gnus-summary-ignore-duplicates)
3174 ;; An article with this Message-ID has already been seen.
3175 ;; We rename the Message-ID.
3176 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3178 (mail-header-set-id header id))
3180 ;; The last case ignores an existing entry, except it adds any
3181 ;; additional Xrefs (in case the two articles came from different
3183 ;; Also sets `header' to `nil' meaning that the `dependencies'
3184 ;; table was *not* modified.
3186 (mail-header-set-xref
3187 (car (symbol-value id-dep))
3188 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3190 (or (mail-header-xref header) "")))
3194 ;; First check if that we are not creating a References loop.
3195 (setq ref (gnus-parent-id (mail-header-references header)))
3197 (setq ref-dep (intern-soft ref dependencies))
3199 (setq ref-header (car (symbol-value ref-dep))))
3200 (if (string= id ref)
3201 ;; Yuk! This is a reference loop. Make the article be a
3204 (mail-header-set-references (car (symbol-value id-dep)) "none")
3206 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
3207 (setq ref (gnus-parent-id (mail-header-references header)))
3208 (setq ref-dep (intern (or ref "none") dependencies))
3209 (if (boundp ref-dep)
3210 (setcdr (symbol-value ref-dep)
3211 (nconc (cdr (symbol-value ref-dep))
3212 (list (symbol-value id-dep))))
3213 (set ref-dep (list nil (symbol-value id-dep)))))
3216 (defun gnus-build-sparse-threads ()
3217 (let ((headers gnus-newsgroup-headers)
3218 (mail-parse-charset gnus-newsgroup-charset)
3219 (gnus-summary-ignore-duplicates t)
3220 header references generation relations
3221 subject child end new-child date)
3222 ;; First we create an alist of generations/relations, where
3223 ;; generations is how much we trust the relation, and the relation
3225 (gnus-message 7 "Making sparse threads...")
3227 (nnheader-set-temp-buffer " *gnus sparse threads*")
3228 (while (setq header (pop headers))
3229 (when (and (setq references (mail-header-references header))
3230 (not (string= references "")))
3232 (setq child (mail-header-id header)
3233 subject (mail-header-subject header)
3234 date (mail-header-date header)
3236 (while (search-backward ">" nil t)
3237 (setq end (1+ (point)))
3238 (when (search-backward "<" nil t)
3239 (setq new-child (buffer-substring (point) end))
3240 (push (list (incf generation)
3241 child (setq child new-child)
3245 (push (list (1+ generation) child nil subject) relations))
3247 (kill-buffer (current-buffer)))
3248 ;; Sort over trustworthiness.
3251 (when (gnus-dependencies-add-header
3252 (make-full-mail-header
3253 gnus-reffed-article-number
3254 (nth 3 relation) "" (or (nth 4 relation) "")
3256 (or (nth 2 relation) "") 0 0 "")
3257 gnus-newsgroup-dependencies nil)
3258 (push gnus-reffed-article-number gnus-newsgroup-limit)
3259 (push gnus-reffed-article-number gnus-newsgroup-sparse)
3260 (push (cons gnus-reffed-article-number gnus-sparse-mark)
3261 gnus-newsgroup-reads)
3262 (decf gnus-reffed-article-number)))
3263 (sort relations 'car-less-than-car))
3264 (gnus-message 7 "Making sparse threads...done")))
3266 (defun gnus-build-old-threads ()
3267 ;; Look at all the articles that refer back to old articles, and
3268 ;; fetch the headers for the articles that aren't there. This will
3269 ;; build complete threads - if the roots haven't been expired by the
3271 (let ((mail-parse-charset gnus-newsgroup-charset)
3275 (when (not (car (symbol-value refs)))
3276 (setq heads (cdr (symbol-value refs)))
3278 (if (memq (mail-header-number (caar heads))
3279 gnus-newsgroup-dormant)
3280 (setq heads (cdr heads))
3281 (setq id (symbol-name refs))
3282 (while (and (setq id (gnus-build-get-header id))
3283 (not (car (gnus-id-to-thread id)))))
3284 (setq heads nil)))))
3285 gnus-newsgroup-dependencies)))
3287 ;; This function has to be called with point after the article number
3288 ;; on the beginning of the line.
3289 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
3290 (let ((eol (gnus-point-at-eol))
3291 (buffer (current-buffer))
3294 ;; overview: [num subject from date id refs chars lines misc]
3297 (narrow-to-region (point) eol)
3302 (make-full-mail-header
3304 (funcall gnus-decode-encoded-word-function
3305 (nnheader-nov-field)) ; subject
3306 (funcall gnus-decode-encoded-word-function
3307 (nnheader-nov-field)) ; from
3308 (nnheader-nov-field) ; date
3309 (nnheader-nov-read-message-id) ; id
3310 (nnheader-nov-field) ; refs
3311 (nnheader-nov-read-integer) ; chars
3312 (nnheader-nov-read-integer) ; lines
3314 (if (looking-at "Xref: ")
3315 (goto-char (match-end 0)))
3316 (nnheader-nov-field)) ; Xref
3317 (nnheader-nov-parse-extra)))) ; extra
3321 (when gnus-alter-header-function
3322 (funcall gnus-alter-header-function header))
3323 (gnus-dependencies-add-header header dependencies force-new)))
3325 (defun gnus-build-get-header (id)
3326 "Look through the buffer of NOV lines and find the header to ID.
3327 Enter this line into the dependencies hash table, and return
3328 the id of the parent article (if any)."
3329 (let ((deps gnus-newsgroup-dependencies)
3333 (set-buffer nntp-server-buffer)
3334 (let ((case-fold-search nil))
3335 (goto-char (point-min))
3336 (while (and (not found)
3337 (search-forward id nil t))
3339 (setq found (looking-at
3340 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
3341 (regexp-quote id))))
3342 (or found (beginning-of-line 2)))
3346 (setq header (gnus-nov-parse-line
3347 (read (current-buffer)) deps))
3348 (gnus-parent-id (mail-header-references header))))))
3350 (let ((number (mail-header-number header)))
3351 (push number gnus-newsgroup-limit)
3352 (push header gnus-newsgroup-headers)
3353 (if (memq number gnus-newsgroup-unselected)
3355 (push number gnus-newsgroup-unreads)
3356 (setq gnus-newsgroup-unselected
3357 (delq number gnus-newsgroup-unselected)))
3358 (push number gnus-newsgroup-ancient)))))))
3360 (defun gnus-build-all-threads ()
3361 "Read all the headers."
3362 (let ((gnus-summary-ignore-duplicates t)
3363 (mail-parse-charset gnus-newsgroup-charset)
3364 (dependencies gnus-newsgroup-dependencies)
3367 (set-buffer nntp-server-buffer)
3368 (let ((case-fold-search nil))
3369 (goto-char (point-min))
3372 (setq article (read (current-buffer))
3373 header (gnus-nov-parse-line article dependencies)))
3376 (set-buffer gnus-summary-buffer)
3377 (push header gnus-newsgroup-headers)
3378 (if (memq (setq article (mail-header-number header))
3379 gnus-newsgroup-unselected)
3381 (push article gnus-newsgroup-unreads)
3382 (setq gnus-newsgroup-unselected
3383 (delq article gnus-newsgroup-unselected)))
3384 (push article gnus-newsgroup-ancient)))
3385 (forward-line 1)))))))
3387 (defun gnus-summary-update-article-line (article header)
3388 "Update the line for ARTICLE using HEADERS."
3389 (let* ((id (mail-header-id header))
3390 (thread (gnus-id-to-thread id)))
3392 (error "Article in no thread"))
3393 ;; Update the thread.
3394 (setcar thread header)
3395 (gnus-summary-goto-subject article)
3396 (let* ((datal (gnus-data-find-list article))
3398 (length (when (cdr datal)
3399 (- (gnus-data-pos data)
3400 (gnus-data-pos (cadr datal)))))
3401 (buffer-read-only nil)
3402 (level (gnus-summary-thread-level)))
3404 (gnus-summary-insert-line
3405 header level nil (gnus-article-mark article)
3406 (memq article gnus-newsgroup-replied)
3407 (memq article gnus-newsgroup-expirable)
3408 ;; Only insert the Subject string when it's different
3409 ;; from the previous Subject string.
3414 (mail-header-subject
3417 (gnus-data-find-list
3419 (gnus-data-list t)))))
3420 ;; Error on the side of excessive subjects.
3422 (mail-header-subject header)))
3424 (mail-header-subject header))
3425 nil (cdr (assq article gnus-newsgroup-scored))
3426 (memq article gnus-newsgroup-processable))
3428 (gnus-data-update-list
3429 (cdr datal) (- length (- (gnus-data-pos data) (point))))))))
3431 (defun gnus-summary-update-article (article &optional iheader)
3432 "Update ARTICLE in the summary buffer."
3433 (set-buffer gnus-summary-buffer)
3434 (let* ((header (gnus-summary-article-header article))
3435 (id (mail-header-id header))
3436 (data (gnus-data-find article))
3437 (thread (gnus-id-to-thread id))
3438 (references (mail-header-references header))
3442 (when (and references
3443 (not (equal "" references)))
3446 (buffer-read-only nil)
3452 (delq thread parent)))
3453 (if (gnus-summary-insert-subject id header)
3454 ;; Set the (possibly) new article number in the data structure.
3455 (gnus-data-set-number data (gnus-id-to-article id))
3459 (defun gnus-rebuild-thread (id &optional line)
3460 "Rebuild the thread containing ID.
3461 If LINE, insert the rebuilt thread starting on line LINE."
3462 (let ((buffer-read-only nil)
3463 old-pos current thread data)
3464 (if (not gnus-show-threads)
3465 (setq thread (list (car (gnus-id-to-thread id))))
3466 ;; Get the thread this article is part of.
3467 (setq thread (gnus-remove-thread id)))
3468 (setq old-pos (gnus-point-at-bol))
3469 (setq current (save-excursion
3470 (and (zerop (forward-line -1))
3471 (gnus-summary-article-number))))
3472 ;; If this is a gathered thread, we have to go some re-gathering.
3473 (when (stringp (car thread))
3474 (let ((subject (car thread))
3476 (setq thread (cdr thread))
3478 (unless (memq (setq thr (gnus-id-to-thread
3480 (mail-header-id (caar thread)))))
3483 (setq thread (cdr thread)))
3484 ;; We now have all (unique) roots.
3485 (if (= (length roots) 1)
3486 ;; All the loose roots are now one solid root.
3487 (setq thread (car roots))
3488 (setq thread (cons subject (gnus-sort-threads roots))))))
3490 ;; We then insert this thread into the summary buffer.
3492 (goto-char (point-min))
3493 (forward-line (1- line)))
3494 (let (gnus-newsgroup-data gnus-newsgroup-threads)
3495 (if gnus-show-threads
3496 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
3497 (gnus-summary-prepare-unthreaded thread))
3498 (setq data (nreverse gnus-newsgroup-data))
3499 (setq threads gnus-newsgroup-threads))
3500 ;; We splice the new data into the data structure.
3501 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
3502 ;;!!! then we want to insert at the beginning of the buffer.
3503 ;;!!! That happens to be true with Gnus now, but that may
3504 ;;!!! change in the future. Perhaps.
3505 (gnus-data-enter-list
3506 (if line nil current) data (- (point) old-pos))
3507 (setq gnus-newsgroup-threads
3508 (nconc threads gnus-newsgroup-threads))
3509 (gnus-data-compute-positions))))
3511 (defun gnus-number-to-header (number)
3512 "Return the header for article NUMBER."
3513 (let ((headers gnus-newsgroup-headers))
3515 (not (= number (mail-header-number (car headers)))))
3520 (defun gnus-parent-headers (in-headers &optional generation)
3521 "Return the headers of the GENERATIONeth parent of HEADERS."
3523 (setq generation 1))
3525 (headers in-headers)
3528 (not (zerop generation))
3529 (setq references (mail-header-references headers)))
3530 (setq headers (if (and references
3531 (setq parent (gnus-parent-id references)))
3532 (car (gnus-id-to-thread parent))
3535 (and (not (eq headers in-headers))
3538 (defun gnus-id-to-thread (id)
3539 "Return the (sub-)thread where ID appears."
3540 (gnus-gethash id gnus-newsgroup-dependencies))
3542 (defun gnus-id-to-article (id)
3543 "Return the article number of ID."
3544 (let ((thread (gnus-id-to-thread id)))
3547 (mail-header-number (car thread)))))
3549 (defun gnus-id-to-header (id)
3550 "Return the article headers of ID."
3551 (car (gnus-id-to-thread id)))
3553 (defun gnus-article-displayed-root-p (article)
3554 "Say whether ARTICLE is a root(ish) article."
3555 (let ((level (gnus-summary-thread-level article))
3556 (refs (mail-header-references (gnus-summary-article-header article)))
3562 ((null (gnus-parent-id refs)) t)
3564 (null (setq particle (gnus-id-to-article
3565 (gnus-parent-id refs))))
3566 (null (gnus-summary-thread-level particle)))))))
3568 (defun gnus-root-id (id)
3569 "Return the id of the root of the thread where ID appears."
3571 (while (and id (setq prev (car (gnus-id-to-thread id))))
3573 id (gnus-parent-id (mail-header-references prev))))
3576 (defun gnus-articles-in-thread (thread)
3577 "Return the list of articles in THREAD."
3578 (cons (mail-header-number (car thread))
3579 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
3581 (defun gnus-remove-thread (id &optional dont-remove)
3582 "Remove the thread that has ID in it."
3583 (let (headers thread last-id)
3584 ;; First go up in this thread until we find the root.
3585 (setq last-id (gnus-root-id id)
3586 headers (message-flatten-list (gnus-id-to-thread last-id)))
3587 ;; We have now found the real root of this thread. It might have
3588 ;; been gathered into some loose thread, so we have to search
3589 ;; through the threads to find the thread we wanted.
3590 (let ((threads gnus-newsgroup-threads)
3593 (setq sub (car threads))
3594 (if (stringp (car sub))
3595 ;; This is a gathered thread, so we look at the roots
3596 ;; below it to find whether this article is in this
3599 (setq sub (cdr sub))
3601 (when (member (caar sub) headers)
3602 (setq thread (car threads)
3605 (setq sub (cdr sub))))
3606 ;; It's an ordinary thread, so we check it.
3607 (when (eq (car sub) (car headers))
3610 (setq threads (cdr threads)))
3611 ;; If this article is in no thread, then it's a root.
3614 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
3615 (setq thread (gnus-id-to-thread last-id)))
3618 thread ; We return this thread.
3620 (if (stringp (car thread))
3622 ;; If we use dummy roots, then we have to remove the
3623 ;; dummy root as well.
3624 (when (eq gnus-summary-make-false-root 'dummy)
3625 ;; We go to the dummy root by going to
3626 ;; the first sub-"thread", and then one line up.
3627 (gnus-summary-goto-article
3628 (mail-header-number (caadr thread)))
3631 (gnus-data-compute-positions))
3632 (setq thread (cdr thread))
3634 (gnus-remove-thread-1 (car thread))
3635 (setq thread (cdr thread))))
3636 (gnus-remove-thread-1 thread))))))))
3638 (defun gnus-remove-thread-1 (thread)
3639 "Remove the thread THREAD recursively."
3640 (let ((number (mail-header-number (pop thread)))
3642 (setq thread (reverse thread))
3644 (gnus-remove-thread-1 (pop thread)))
3645 (when (setq d (gnus-data-find number))
3646 (goto-char (gnus-data-pos d))
3647 (gnus-summary-show-thread)
3650 (- (gnus-point-at-bol)
3652 (1+ (gnus-point-at-eol))
3653 (gnus-delete-line)))))))
3655 (defun gnus-sort-threads-1 (threads func)
3656 (sort (mapcar (lambda (thread)
3659 (gnus-sort-threads-1 (cdr thread) func))))
3662 (defun gnus-sort-threads (threads)
3664 (if (not gnus-thread-sort-functions)
3666 (gnus-message 8 "Sorting threads...")
3668 (gnus-sort-threads-1
3670 (gnus-make-sort-function gnus-thread-sort-functions))
3671 (gnus-message 8 "Sorting threads...done"))))
3673 (defun gnus-sort-articles (articles)
3675 (when gnus-article-sort-functions
3676 (gnus-message 7 "Sorting articles...")
3678 (setq gnus-newsgroup-headers
3679 (sort articles (gnus-make-sort-function
3680 gnus-article-sort-functions)))
3681 (gnus-message 7 "Sorting articles...done"))))
3683 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
3684 (defmacro gnus-thread-header (thread)
3685 "Return header of first article in THREAD.
3686 Note that THREAD must never, ever be anything else than a variable -
3687 using some other form will lead to serious barfage."
3688 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
3689 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
3690 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
3693 (defsubst gnus-article-sort-by-number (h1 h2)
3694 "Sort articles by article number."
3695 (< (mail-header-number h1)
3696 (mail-header-number h2)))
3698 (defun gnus-thread-sort-by-number (h1 h2)
3699 "Sort threads by root article number."
3700 (gnus-article-sort-by-number
3701 (gnus-thread-header h1) (gnus-thread-header h2)))
3703 (defsubst gnus-article-sort-by-lines (h1 h2)
3704 "Sort articles by article Lines header."
3705 (< (mail-header-lines h1)
3706 (mail-header-lines h2)))
3708 (defun gnus-thread-sort-by-lines (h1 h2)
3709 "Sort threads by root article Lines header."
3710 (gnus-article-sort-by-lines
3711 (gnus-thread-header h1) (gnus-thread-header h2)))
3713 (defsubst gnus-article-sort-by-chars (h1 h2)
3714 "Sort articles by octet length."
3715 (< (mail-header-chars h1)
3716 (mail-header-chars h2)))
3718 (defun gnus-thread-sort-by-chars (h1 h2)
3719 "Sort threads by root article octet length."
3720 (gnus-article-sort-by-chars
3721 (gnus-thread-header h1) (gnus-thread-header h2)))
3723 (defsubst gnus-article-sort-by-author (h1 h2)
3724 "Sort articles by root author."
3726 (let ((extract (funcall
3727 gnus-extract-address-components
3728 (mail-header-from h1))))
3729 (or (car extract) (cadr extract) ""))
3730 (let ((extract (funcall
3731 gnus-extract-address-components
3732 (mail-header-from h2))))
3733 (or (car extract) (cadr extract) ""))))
3735 (defun gnus-thread-sort-by-author (h1 h2)
3736 "Sort threads by root author."
3737 (gnus-article-sort-by-author
3738 (gnus-thread-header h1) (gnus-thread-header h2)))
3740 (defsubst gnus-article-sort-by-subject (h1 h2)
3741 "Sort articles by root subject."
3743 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
3744 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
3746 (defun gnus-thread-sort-by-subject (h1 h2)
3747 "Sort threads by root subject."
3748 (gnus-article-sort-by-subject
3749 (gnus-thread-header h1) (gnus-thread-header h2)))
3751 (defsubst gnus-article-sort-by-date (h1 h2)
3752 "Sort articles by root article date."
3754 (gnus-date-get-time (mail-header-date h1))
3755 (gnus-date-get-time (mail-header-date h2))))
3757 (defun gnus-thread-sort-by-date (h1 h2)
3758 "Sort threads by root article date."
3759 (gnus-article-sort-by-date
3760 (gnus-thread-header h1) (gnus-thread-header h2)))
3762 (defsubst gnus-article-sort-by-score (h1 h2)
3763 "Sort articles by root article score.
3764 Unscored articles will be counted as having a score of zero."
3765 (> (or (cdr (assq (mail-header-number h1)
3766 gnus-newsgroup-scored))
3767 gnus-summary-default-score 0)
3768 (or (cdr (assq (mail-header-number h2)
3769 gnus-newsgroup-scored))
3770 gnus-summary-default-score 0)))
3772 (defun gnus-thread-sort-by-score (h1 h2)
3773 "Sort threads by root article score."
3774 (gnus-article-sort-by-score
3775 (gnus-thread-header h1) (gnus-thread-header h2)))
3777 (defun gnus-thread-sort-by-total-score (h1 h2)
3778 "Sort threads by the sum of all scores in the thread.
3779 Unscored articles will be counted as having a score of zero."
3780 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
3782 (defun gnus-thread-total-score (thread)
3783 ;; This function find the total score of THREAD.
3784 (cond ((null thread)
3787 (if (stringp (car thread))
3788 (apply gnus-thread-score-function 0
3789 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
3790 (gnus-thread-total-score-1 thread)))
3792 (gnus-thread-total-score-1 (list thread)))))
3794 (defun gnus-thread-total-score-1 (root)
3795 ;; This function find the total score of the thread below ROOT.
3796 (setq root (car root))
3797 (apply gnus-thread-score-function
3799 (mapcar 'gnus-thread-total-score
3800 (cdr (gnus-id-to-thread (mail-header-id root))))
3801 (when (> (mail-header-number root) 0)
3802 (list (or (cdr (assq (mail-header-number root)
3803 gnus-newsgroup-scored))
3804 gnus-summary-default-score 0))))
3805 (list gnus-summary-default-score)
3808 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
3809 (defvar gnus-tmp-prev-subject nil)
3810 (defvar gnus-tmp-false-parent nil)
3811 (defvar gnus-tmp-root-expunged nil)
3812 (defvar gnus-tmp-dummy-line nil)
3814 (defvar gnus-tmp-header)
3815 (defun gnus-extra-header (type &optional header)
3816 "Return the extra header of TYPE."
3817 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
3820 (defun gnus-summary-prepare-threads (threads)
3821 "Prepare summary buffer from THREADS and indentation LEVEL.
3822 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
3823 or a straight list of headers."
3824 (gnus-message 7 "Generating summary...")
3826 (setq gnus-newsgroup-threads threads)
3829 (let ((gnus-tmp-level 0)
3830 (default-score (or gnus-summary-default-score 0))
3831 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
3832 thread number subject stack state gnus-tmp-gathered beg-match
3833 new-roots gnus-tmp-new-adopts thread-end
3834 gnus-tmp-header gnus-tmp-unread
3835 gnus-tmp-replied gnus-tmp-subject-or-nil
3836 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
3837 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
3838 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket)
3840 (setq gnus-tmp-prev-subject nil)
3842 (if (vectorp (car threads))
3843 ;; If this is a straight (sic) list of headers, then a
3844 ;; threaded summary display isn't required, so we just create
3845 ;; an unthreaded one.
3846 (gnus-summary-prepare-unthreaded threads)
3848 ;; Do the threaded display.
3850 (while (or threads stack gnus-tmp-new-adopts new-roots)
3852 (if (and (= gnus-tmp-level 0)
3855 (not gnus-tmp-false-parent)
3856 (or gnus-tmp-new-adopts new-roots))
3857 (if gnus-tmp-new-adopts
3858 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
3859 thread (list (car gnus-tmp-new-adopts))
3860 gnus-tmp-header (caar thread)
3861 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
3863 (setq thread (list (car new-roots))
3864 gnus-tmp-header (caar thread)
3865 new-roots (cdr new-roots))))
3868 ;; If there are some threads, we do them before the
3869 ;; threads on the stack.
3870 (setq thread threads
3871 gnus-tmp-header (caar thread))
3872 ;; There were no current threads, so we pop something off
3874 (setq state (car stack)
3875 gnus-tmp-level (car state)
3878 gnus-tmp-header (caar thread))))
3880 (setq gnus-tmp-false-parent nil)
3881 (setq gnus-tmp-root-expunged nil)
3882 (setq thread-end nil)
3884 (if (stringp gnus-tmp-header)
3885 ;; The header is a dummy root.
3887 ((eq gnus-summary-make-false-root 'adopt)
3888 ;; We let the first article adopt the rest.
3889 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
3891 (setq gnus-tmp-gathered
3893 (lambda (h) (mail-header-number (car h)))
3896 (setq thread (cons (list (caar thread)
3899 (setq gnus-tmp-level -1
3900 gnus-tmp-false-parent t))
3901 ((eq gnus-summary-make-false-root 'empty)
3902 ;; We print adopted articles with empty subject fields.
3903 (setq gnus-tmp-gathered
3905 (lambda (h) (mail-header-number (car h)))
3908 (setq gnus-tmp-level -1))
3909 ((eq gnus-summary-make-false-root 'dummy)
3910 ;; We remember that we probably want to output a dummy
3912 (setq gnus-tmp-dummy-line gnus-tmp-header)
3913 (setq gnus-tmp-prev-subject gnus-tmp-header))
3915 ;; We do not make a root for the gathered
3916 ;; sub-threads at all.
3917 (setq gnus-tmp-level -1)))
3919 (setq number (mail-header-number gnus-tmp-header)
3920 subject (mail-header-subject gnus-tmp-header))
3923 ;; If the thread has changed subject, we might want to make
3924 ;; this subthread into a root.
3925 ((and (null gnus-thread-ignore-subject)
3926 (not (zerop gnus-tmp-level))
3927 gnus-tmp-prev-subject
3929 (gnus-subject-equal gnus-tmp-prev-subject subject))))
3930 (setq new-roots (nconc new-roots (list (car thread)))
3932 gnus-tmp-header nil))
3933 ;; If the article lies outside the current limit,
3934 ;; then we do not display it.
3935 ((not (memq number gnus-newsgroup-limit))
3936 (setq gnus-tmp-gathered
3938 (lambda (h) (mail-header-number (car h)))
3941 (setq gnus-tmp-new-adopts (if (cdar thread)
3942 (append gnus-tmp-new-adopts
3944 gnus-tmp-new-adopts)
3946 gnus-tmp-header nil)
3947 (when (zerop gnus-tmp-level)
3948 (setq gnus-tmp-root-expunged t)))
3949 ;; Perhaps this article is to be marked as read?
3950 ((and gnus-summary-mark-below
3951 (< (or (cdr (assq number gnus-newsgroup-scored))
3953 gnus-summary-mark-below)
3954 ;; Don't touch sparse articles.
3955 (not (gnus-summary-article-sparse-p number))
3956 (not (gnus-summary-article-ancient-p number)))
3957 (setq gnus-newsgroup-unreads
3958 (delq number gnus-newsgroup-unreads))
3959 (if gnus-newsgroup-auto-expire
3960 (push number gnus-newsgroup-expirable)
3961 (push (cons number gnus-low-score-mark)
3962 gnus-newsgroup-reads))))
3964 (when gnus-tmp-header
3965 ;; We may have an old dummy line to output before this
3967 (when (and gnus-tmp-dummy-line
3970 (mail-header-subject gnus-tmp-header)))
3971 (gnus-summary-insert-dummy-line
3972 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
3973 (setq gnus-tmp-dummy-line nil))
3975 ;; Compute the mark.
3976 (setq gnus-tmp-unread (gnus-article-mark number))
3978 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
3979 gnus-tmp-header gnus-tmp-level)
3980 gnus-newsgroup-data)
3982 ;; Actually insert the line.
3984 gnus-tmp-subject-or-nil
3986 ((and gnus-thread-ignore-subject
3987 gnus-tmp-prev-subject
3988 (not (inline (gnus-subject-equal
3989 gnus-tmp-prev-subject subject))))
3991 ((zerop gnus-tmp-level)
3992 (if (and (eq gnus-summary-make-false-root 'empty)
3993 (memq number gnus-tmp-gathered)
3994 gnus-tmp-prev-subject
3995 (inline (gnus-subject-equal
3996 gnus-tmp-prev-subject subject)))
3997 gnus-summary-same-subject
3999 (t gnus-summary-same-subject)))
4000 (if (and (eq gnus-summary-make-false-root 'adopt)
4001 (= gnus-tmp-level 1)
4002 (memq number gnus-tmp-gathered))
4003 (setq gnus-tmp-opening-bracket ?\<
4004 gnus-tmp-closing-bracket ?\>)
4005 (setq gnus-tmp-opening-bracket ?\[
4006 gnus-tmp-closing-bracket ?\]))
4008 gnus-tmp-indentation
4009 (aref gnus-thread-indent-array gnus-tmp-level)
4010 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4011 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4012 gnus-summary-default-score 0)
4014 (if (or (null gnus-summary-default-score)
4015 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4016 gnus-summary-zcore-fuzz))
4018 (if (< gnus-tmp-score gnus-summary-default-score)
4019 gnus-score-below-mark gnus-score-over-mark))
4021 (cond ((memq number gnus-newsgroup-processable)
4023 ((memq number gnus-newsgroup-cached)
4025 ((memq number gnus-newsgroup-replied)
4027 ((memq number gnus-newsgroup-saved)
4029 (t gnus-unread-mark))
4030 gnus-tmp-from (mail-header-from gnus-tmp-header)
4033 ((string-match "<[^>]+> *$" gnus-tmp-from)
4034 (setq beg-match (match-beginning 0))
4035 (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
4036 (substring gnus-tmp-from (1+ (match-beginning 0))
4037 (1- (match-end 0))))
4038 (substring gnus-tmp-from 0 beg-match)))
4039 ((string-match "(.+)" gnus-tmp-from)
4040 (substring gnus-tmp-from
4041 (1+ (match-beginning 0)) (1- (match-end 0))))
4043 (when (string= gnus-tmp-name "")
4044 (setq gnus-tmp-name gnus-tmp-from))
4045 (unless (numberp gnus-tmp-lines)
4046 (setq gnus-tmp-lines 0))
4047 (gnus-put-text-property
4049 (progn (eval gnus-summary-line-format-spec) (point))
4050 'gnus-number number)
4053 (gnus-run-hooks 'gnus-summary-update-hook)
4056 (setq gnus-tmp-prev-subject subject)))
4058 (when (nth 1 thread)
4059 (push (cons (max 0 gnus-tmp-level) (nthcdr 1 thread)) stack))
4060 (incf gnus-tmp-level)
4061 (setq threads (if thread-end nil (cdar thread)))
4063 (setq gnus-tmp-level 0)))))
4064 (gnus-message 7 "Generating summary...done"))
4066 (defun gnus-summary-prepare-unthreaded (headers)
4067 "Generate an unthreaded summary buffer based on HEADERS."
4068 (let (header number mark)
4073 ;; We may have to root out some bad articles...
4074 (when (memq (setq number (mail-header-number
4075 (setq header (pop headers))))
4076 gnus-newsgroup-limit)
4077 ;; Mark article as read when it has a low score.
4078 (when (and gnus-summary-mark-below
4079 (< (or (cdr (assq number gnus-newsgroup-scored))
4080 gnus-summary-default-score 0)
4081 gnus-summary-mark-below)
4082 (not (gnus-summary-article-ancient-p number)))
4083 (setq gnus-newsgroup-unreads
4084 (delq number gnus-newsgroup-unreads))
4085 (if gnus-newsgroup-auto-expire
4086 (push number gnus-newsgroup-expirable)
4087 (push (cons number gnus-low-score-mark)
4088 gnus-newsgroup-reads)))
4090 (setq mark (gnus-article-mark number))
4091 (push (gnus-data-make number mark (1+ (point)) header 0)
4092 gnus-newsgroup-data)
4093 (gnus-summary-insert-line
4095 mark (memq number gnus-newsgroup-replied)
4096 (memq number gnus-newsgroup-expirable)
4097 (mail-header-subject header) nil
4098 (cdr (assq number gnus-newsgroup-scored))
4099 (memq number gnus-newsgroup-processable))))))
4101 (defun gnus-summary-remove-list-identifiers ()
4102 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
4103 (let ((regexp (if (stringp gnus-list-identifiers)
4104 gnus-list-identifiers
4105 (mapconcat 'identity gnus-list-identifiers " *\\|"))))
4106 (dolist (header gnus-newsgroup-headers)
4107 (when (string-match (concat "\\(\\(\\(Re: +\\)?\\(" regexp
4108 " *\\)\\)+\\(Re: +\\)?\\)")
4109 (mail-header-subject header))
4110 (mail-header-set-subject
4111 header (concat (substring (mail-header-subject header)
4112 0 (match-beginning 1))
4114 (match-string 3 (mail-header-subject header))
4115 (match-string 5 (mail-header-subject header)))
4116 (substring (mail-header-subject header)
4117 (match-end 1))))))))
4119 (defun gnus-select-newsgroup (group &optional read-all select-articles)
4120 "Select newsgroup GROUP.
4121 If READ-ALL is non-nil, all articles in the group are selected.
4122 If SELECT-ARTICLES, only select those articles from GROUP."
4123 (let* ((entry (gnus-gethash group gnus-newsrc-hashtb))
4124 ;;!!! Dirty hack; should be removed.
4125 (gnus-summary-ignore-duplicates
4126 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
4128 gnus-summary-ignore-duplicates))
4129 (info (nth 2 entry))
4130 articles fetched-articles cached)
4132 (unless (gnus-check-server
4133 (setq gnus-current-select-method
4134 (gnus-find-method-for-group group)))
4135 (error "Couldn't open server"))
4137 (or (and entry (not (eq (car entry) t))) ; Either it's active...
4138 (gnus-activate-group group) ; Or we can activate it...
4139 (progn ; Or we bug out.
4140 (when (equal major-mode 'gnus-summary-mode)
4141 (kill-buffer (current-buffer)))
4142 (error "Couldn't request group %s: %s"
4143 group (gnus-status-message group))))
4145 (unless (gnus-request-group group t)
4146 (when (equal major-mode 'gnus-summary-mode)
4147 (kill-buffer (current-buffer)))
4148 (error "Couldn't request group %s: %s"
4149 group (gnus-status-message group)))
4151 (setq gnus-newsgroup-name group)
4152 (setq gnus-newsgroup-unselected nil)
4153 (setq gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
4154 (gnus-summary-setup-default-charset)
4156 ;; Adjust and set lists of article marks.
4158 (gnus-adjust-marked-articles info))
4160 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4161 (when (gnus-virtual-group-p group)
4162 (setq cached gnus-newsgroup-cached))
4164 (setq gnus-newsgroup-unreads
4165 (gnus-set-difference
4166 (gnus-set-difference gnus-newsgroup-unreads gnus-newsgroup-marked)
4167 gnus-newsgroup-dormant))
4169 (setq gnus-newsgroup-processable nil)
4171 (gnus-update-read-articles group gnus-newsgroup-unreads)
4173 (if (setq articles select-articles)
4174 (setq gnus-newsgroup-unselected
4175 (gnus-sorted-intersection
4176 gnus-newsgroup-unreads
4177 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4178 (setq articles (gnus-articles-to-read group read-all)))
4182 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
4184 ((eq articles 0) nil)
4186 ;; Init the dependencies hash table.
4187 (setq gnus-newsgroup-dependencies
4188 (gnus-make-hashtable (length articles)))
4189 (gnus-set-global-variables)
4190 ;; Retrieve the headers and read them in.
4191 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
4192 (setq gnus-newsgroup-headers
4194 (setq gnus-headers-retrieved-by
4195 (gnus-retrieve-headers
4196 articles gnus-newsgroup-name
4197 ;; We might want to fetch old headers, but
4198 ;; not if there is only 1 article.
4200 (not (eq gnus-fetch-old-headers 'some))
4201 (not (numberp gnus-fetch-old-headers)))
4202 (> (length articles) 1))
4203 gnus-fetch-old-headers))))
4204 (gnus-get-newsgroup-headers-xover
4205 articles nil nil gnus-newsgroup-name t)
4206 (gnus-get-newsgroup-headers)))
4207 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name)
4209 ;; Kludge to avoid having cached articles nixed out in virtual groups.
4211 (setq gnus-newsgroup-cached cached))
4213 ;; Suppress duplicates?
4214 (when gnus-suppress-duplicates
4215 (gnus-dup-suppress-articles))
4217 ;; Set the initial limit.
4218 (setq gnus-newsgroup-limit (copy-sequence articles))
4219 ;; Remove canceled articles from the list of unread articles.
4220 (setq gnus-newsgroup-unreads
4221 (gnus-set-sorted-intersection
4222 gnus-newsgroup-unreads
4223 (setq fetched-articles
4224 (mapcar (lambda (headers) (mail-header-number headers))
4225 gnus-newsgroup-headers))))
4226 ;; Removed marked articles that do not exist.
4227 (gnus-update-missing-marks
4228 (gnus-sorted-complement fetched-articles articles))
4229 ;; We might want to build some more threads first.
4230 (when (and gnus-fetch-old-headers
4231 (eq gnus-headers-retrieved-by 'nov))
4232 (if (eq gnus-fetch-old-headers 'invisible)
4233 (gnus-build-all-threads)
4234 (gnus-build-old-threads)))
4235 ;; Let the Gnus agent mark articles as read.
4237 (gnus-agent-get-undownloaded-list))
4238 ;; Remove list identifiers from subject
4239 (when gnus-list-identifiers
4240 (gnus-summary-remove-list-identifiers))
4241 ;; Check whether auto-expire is to be done in this group.
4242 (setq gnus-newsgroup-auto-expire
4243 (gnus-group-auto-expirable-p group))
4244 ;; Set up the article buffer now, if necessary.
4245 (unless gnus-single-article-buffer
4246 (gnus-article-setup-buffer))
4247 ;; First and last article in this newsgroup.
4248 (when gnus-newsgroup-headers
4249 (setq gnus-newsgroup-begin
4250 (mail-header-number (car gnus-newsgroup-headers))
4253 (gnus-last-element gnus-newsgroup-headers))))
4254 ;; GROUP is successfully selected.
4255 (or gnus-newsgroup-headers t)))))
4257 (defun gnus-articles-to-read (group &optional read-all)
4258 "Find out what articles the user wants to read."
4260 ;; Select all articles if `read-all' is non-nil, or if there
4261 ;; are no unread articles.
4263 (and (zerop (length gnus-newsgroup-marked))
4264 (zerop (length gnus-newsgroup-unreads)))
4265 (eq (gnus-group-find-parameter group 'display)
4268 (gnus-uncompress-range (gnus-active group))
4269 (gnus-cache-articles-in-group group))
4270 (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
4271 (copy-sequence gnus-newsgroup-unreads))
4273 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
4274 (scored (length scored-list))
4275 (number (length articles))
4276 (marked (+ (length gnus-newsgroup-marked)
4277 (length gnus-newsgroup-dormant)))
4285 ((and (or (<= scored marked) (= scored number))
4286 (numberp gnus-large-newsgroup)
4287 (> number gnus-large-newsgroup))
4291 "How many articles from %s (default %d): "
4292 (gnus-limit-string gnus-newsgroup-name 35)
4294 (if (string-match "^[ \t]*$" input) number input)))
4295 ((and (> scored marked) (< scored number)
4296 (> (- scored number) 20))
4299 (format "%s %s (%d scored, %d total): "
4300 "How many articles from"
4301 group scored number))))
4302 (if (string-match "^[ \t]*$" input)
4306 (message "Quit getting the articles to read")
4308 (setq select (if (stringp select) (string-to-number select) select))
4309 (if (or (null select) (zerop select))
4311 (if (and (not (zerop scored)) (<= (abs select) scored))
4313 (setq articles (sort scored-list '<))
4314 (setq number (length articles)))
4315 (setq articles (copy-sequence articles)))
4317 (when (< (abs select) number)
4319 ;; Select the N oldest articles.
4320 (setcdr (nthcdr (1- (abs select)) articles) nil)
4321 ;; Select the N most recent articles.
4322 (setq articles (nthcdr (- number select) articles))))
4323 (setq gnus-newsgroup-unselected
4324 (gnus-sorted-intersection
4325 gnus-newsgroup-unreads
4326 (gnus-sorted-complement gnus-newsgroup-unreads articles)))
4327 (when gnus-alter-articles-to-read-function
4328 (setq gnus-newsgroup-unreads
4330 (funcall gnus-alter-articles-to-read-function
4331 gnus-newsgroup-name gnus-newsgroup-unreads)
4335 (defun gnus-killed-articles (killed articles)
4338 (when (inline (gnus-member-of-range (car articles) killed))
4339 (push (car articles) out))
4340 (setq articles (cdr articles)))
4343 (defun gnus-uncompress-marks (marks)
4344 "Uncompress the mark ranges in MARKS."
4345 (let ((uncompressed '(score bookmark))
4348 (if (memq (caar marks) uncompressed)
4349 (push (car marks) out)
4350 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
4351 (setq marks (cdr marks)))
4354 (defun gnus-adjust-marked-articles (info)
4355 "Set all article lists and remove all marks that are no longer valid."
4356 (let* ((marked-lists (gnus-info-marks info))
4357 (active (gnus-active (gnus-info-group info)))
4360 (types gnus-article-mark-lists)
4361 (uncompressed '(score bookmark killed))
4362 marks var articles article mark)
4365 (setq marks (pop marked-lists))
4366 (set (setq var (intern (format "gnus-newsgroup-%s"
4367 (car (rassq (setq mark (car marks))
4369 (if (memq (car marks) uncompressed) (cdr marks)
4370 (gnus-uncompress-range (cdr marks))))
4372 (setq articles (symbol-value var))
4374 ;; All articles have to be subsets of the active articles.
4376 ;; Adjust "simple" lists.
4377 ((memq mark '(tick dormant expire reply save))
4379 (when (or (< (setq article (pop articles)) min) (> article max))
4380 (set var (delq article (symbol-value var))))))
4382 ((memq mark uncompressed)
4383 (when (not (listp (cdr (symbol-value var))))
4384 (set var (list (symbol-value var))))
4385 (when (not (listp (cdr articles)))
4386 (setq articles (list articles)))
4388 (when (or (not (consp (setq article (pop articles))))
4389 (< (car article) min)
4390 (> (car article) max))
4391 (set var (delq article (symbol-value var))))))))))