1 ;;; gnus-sum.el --- summary mode commands for Gnus
2 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
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.
31 (defvar tool-bar-map))
43 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
44 (autoload 'gnus-cache-write-active "gnus-cache")
45 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
46 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
47 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
48 (autoload 'mm-uu-dissect "mm-uu")
49 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
50 "Deuglify broken Outlook (Express) articles and redisplay."
52 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
53 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
54 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
56 (defcustom gnus-kill-summary-on-exit t
57 "*If non-nil, kill the summary buffer when you exit from it.
58 If nil, the summary will become a \"*Dead Summary*\" buffer, and
59 it will be killed sometime later."
60 :group 'gnus-summary-exit
63 (defcustom gnus-fetch-old-headers nil
64 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
65 If an unread article in the group refers to an older, already read (or
66 just marked as read) article, the old article will not normally be
67 displayed in the Summary buffer. If this variable is t, Gnus
68 will attempt to grab the headers to the old articles, and thereby
69 build complete threads. If it has the value `some', only enough
70 headers to connect otherwise loose threads will be displayed. This
71 variable can also be a number. In that case, no more than that number
72 of old headers will be fetched. If it has the value `invisible', all
73 old headers will be fetched, but none will be displayed.
75 The server has to support NOV for any of this to work."
77 :type '(choice (const :tag "off" nil)
82 (sexp :menu-tag "other" t)))
84 (defcustom gnus-refer-thread-limit 200
85 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
86 If t, fetch all the available old headers."
89 (sexp :menu-tag "other" t)))
91 (defcustom gnus-summary-make-false-root 'adopt
92 "*nil means that Gnus won't gather loose threads.
93 If the root of a thread has expired or been read in a previous
94 session, the information necessary to build a complete thread has been
95 lost. Instead of having many small sub-threads from this original thread
96 scattered all over the summary buffer, Gnus can gather them.
98 If non-nil, Gnus will try to gather all loose sub-threads from an
99 original thread into one large thread.
101 If this variable is non-nil, it should be one of `none', `adopt',
104 If this variable is `none', Gnus will not make a false root, but just
105 present the sub-threads after another.
106 If this variable is `dummy', Gnus will create a dummy root that will
107 have all the sub-threads as children.
108 If this variable is `adopt', Gnus will make one of the \"children\"
109 the parent and mark all the step-children as such.
110 If this variable is `empty', the \"children\" are printed with empty
111 subject fields. (Or rather, they will be printed with a string
112 given by the `gnus-summary-same-subject' variable.)"
114 :type '(choice (const :tag "off" nil)
120 (defcustom gnus-summary-make-false-root-always nil
121 "Always make a false dummy root."
126 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
127 "*A regexp to match subjects to be excluded from loose thread gathering.
128 As loose thread gathering is done on subjects only, that means that
129 there can be many false gatherings performed. By rooting out certain
130 common subjects, gathering might become saner."
134 (defcustom gnus-summary-gather-subject-limit nil
135 "*Maximum length of subject comparisons when gathering loose threads.
136 Use nil to compare full subjects. Setting this variable to a low
137 number will help gather threads that have been corrupted by
138 newsreaders chopping off subject lines, but it might also mean that
139 unrelated articles that have subject that happen to begin with the
140 same few characters will be incorrectly gathered.
142 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
145 :type '(choice (const :tag "off" nil)
147 (sexp :menu-tag "on" t)))
149 (defcustom gnus-simplify-subject-functions nil
150 "List of functions taking a string argument that simplify subjects.
151 The functions are applied recursively.
153 Useful functions to put in this list include:
154 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
155 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
157 :type '(repeat function))
159 (defcustom gnus-simplify-ignored-prefixes nil
160 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
162 :type '(choice (const :tag "off" nil)
165 (defcustom gnus-build-sparse-threads nil
166 "*If non-nil, fill in the gaps in threads.
167 If `some', only fill in the gaps that are needed to tie loose threads
168 together. If `more', fill in all leaf nodes that Gnus can find. If
169 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
171 :type '(choice (const :tag "off" nil)
174 (sexp :menu-tag "all" t)))
176 (defcustom gnus-summary-thread-gathering-function
177 'gnus-gather-threads-by-subject
178 "*Function used for gathering loose threads.
179 There are two pre-defined functions: `gnus-gather-threads-by-subject',
180 which only takes Subjects into consideration; and
181 `gnus-gather-threads-by-references', which compared the References
182 headers of the articles to find matches."
184 :type '(radio (function-item gnus-gather-threads-by-subject)
185 (function-item gnus-gather-threads-by-references)
186 (function :tag "other")))
188 (defcustom gnus-summary-same-subject ""
189 "*String indicating that the current article has the same subject as the previous.
190 This variable will only be used if the value of
191 `gnus-summary-make-false-root' is `empty'."
192 :group 'gnus-summary-format
195 (defcustom gnus-summary-goto-unread t
196 "*If t, many commands will go to the next unread article.
197 This applies to marking commands as well as other commands that
198 \"naturally\" select the next article, like, for instance, `SPC' at
199 the end of an article.
201 If nil, the marking commands do NOT go to the next unread article
202 \(they go to the next article instead). If `never', commands that
203 usually go to the next unread article, will go to the next article,
204 whether it is read or not."
205 :group 'gnus-summary-marks
206 :link '(custom-manual "(gnus)Setting Marks")
207 :type '(choice (const :tag "off" nil)
209 (sexp :menu-tag "on" t)))
211 (defcustom gnus-summary-default-score 0
212 "*Default article score level.
213 All scores generated by the score files will be added to this score.
214 If this variable is nil, scoring will be disabled."
215 :group 'gnus-score-default
216 :type '(choice (const :tag "disable")
219 (defcustom gnus-summary-default-high-score 0
220 "*Default threshold for a high scored article.
221 An article will be highlighted as high scored if its score is greater
224 :group 'gnus-score-default
227 (defcustom gnus-summary-default-low-score 0
228 "*Default threshold for a low scored article.
229 An article will be highlighted as low scored if its score is smaller
232 :group 'gnus-score-default
235 (defcustom gnus-summary-zcore-fuzz 0
236 "*Fuzziness factor for the zcore in the summary buffer.
237 Articles with scores closer than this to `gnus-summary-default-score'
239 :group 'gnus-summary-format
242 (defcustom gnus-simplify-subject-fuzzy-regexp nil
243 "*Strings to be removed when doing fuzzy matches.
244 This can either be a regular expression or list of regular expressions
245 that will be removed from subject strings if fuzzy subject
246 simplification is selected."
248 :type '(repeat regexp))
250 (defcustom gnus-show-threads t
251 "*If non-nil, display threads in summary mode."
255 (defcustom gnus-thread-hide-subtree nil
256 "*If non-nil, hide all threads initially.
257 This can be a predicate specifier which says which threads to hide.
258 If threads are hidden, you have to run the command
259 `gnus-summary-show-thread' by hand or use `gnus-select-article-hook'
260 to expose hidden threads."
262 :type '(radio (sexp :format "Non-nil\n"
263 :match (lambda (widget value)
264 (not (or (consp value) (functionp value))))
267 (sexp :tag "Predicate specifier")))
269 (defcustom gnus-thread-hide-killed t
270 "*If non-nil, hide killed threads automatically."
274 (defcustom gnus-thread-ignore-subject t
275 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
276 If nil, articles that have different subjects from their parents will
277 start separate threads."
281 (defcustom gnus-thread-operation-ignore-subject t
282 "*If non-nil, subjects will be ignored when doing thread commands.
283 This affects commands like `gnus-summary-kill-thread' and
284 `gnus-summary-lower-thread'.
286 If this variable is nil, articles in the same thread with different
287 subjects will not be included in the operation in question. If this
288 variable is `fuzzy', only articles that have subjects that are fuzzily
289 equal will be included."
291 :type '(choice (const :tag "off" nil)
295 (defcustom gnus-thread-indent-level 4
296 "*Number that says how much each sub-thread should be indented."
300 (defcustom gnus-auto-extend-newsgroup t
301 "*If non-nil, extend newsgroup forward and backward when requested."
302 :group 'gnus-summary-choose
305 (defcustom gnus-auto-select-first t
306 "*If non-nil, select the article under point.
307 Which article this is is controlled by the `gnus-auto-select-subject'
310 If you want to prevent automatic selection of articles in some
311 newsgroups, set the variable to nil in `gnus-select-group-hook'."
312 :group 'gnus-group-select
313 :type '(choice (const :tag "none" nil)
314 (sexp :menu-tag "first" t)))
316 (defcustom gnus-auto-select-subject 'unread
317 "*Says what subject to place under point when entering a group.
319 This variable can either be the symbols `first' (place point on the
320 first subject), `unread' (place point on the subject line of the first
321 unread article), `best' (place point on the subject line of the
322 higest-scored article), `unseen' (place point on the subject line of
323 the first unseen article), 'unseen-or-unread' (place point on the subject
324 line of the first unseen article or, if all article have been seen, on the
325 subject line of the first unread article), or a function to be called to
326 place point on some subject line."
328 :group 'gnus-group-select
329 :type '(choice (const best)
333 (const unseen-or-unread)))
335 (defcustom gnus-auto-select-next t
336 "*If non-nil, offer to go to the next group from the end of the previous.
337 If the value is t and the next newsgroup is empty, Gnus will exit
338 summary mode and go back to group mode. If the value is neither nil
339 nor t, Gnus will select the following unread newsgroup. In
340 particular, if the value is the symbol `quietly', the next unread
341 newsgroup will be selected without any confirmation, and if it is
342 `almost-quietly', the next group will be selected without any
343 confirmation if you are located on the last article in the group.
344 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
345 will go to the next group without confirmation."
346 :group 'gnus-summary-maneuvering
347 :type '(choice (const :tag "off" nil)
349 (const almost-quietly)
350 (const slightly-quietly)
351 (sexp :menu-tag "on" t)))
353 (defcustom gnus-auto-select-same nil
354 "*If non-nil, select the next article with the same subject.
355 If there are no more articles with the same subject, go to
356 the first unread article."
357 :group 'gnus-summary-maneuvering
360 (defcustom gnus-auto-goto-ignores 'unfetched
361 "*Says how to handle unfetched articles when maneuvering.
363 This variable can either be the symbols nil (maneuver to any
364 article), `undownloaded' (maneuvering while unplugged ignores articles
365 that have not been fetched), `always-undownloaded' (maneuvering always
366 ignores articles that have not been fetched), `unfetched' (maneuvering
367 ignores articles whose headers have not been fetched).
369 NOTE: The list of unfetched articles will always be nil when plugged
370 and, when unplugged, a subset of the undownloaded article list."
372 :group 'gnus-summary-maneuvering
373 :type '(choice (const :tag "None" nil)
374 (const :tag "Undownloaded when unplugged" undownloaded)
375 (const :tag "Undownloaded" always-undownloaded)
376 (const :tag "Unfetched" unfetched)))
378 (defcustom gnus-summary-check-current nil
379 "*If non-nil, consider the current article when moving.
380 The \"unread\" movement commands will stay on the same line if the
381 current article is unread."
382 :group 'gnus-summary-maneuvering
385 (defcustom gnus-auto-center-summary 2
386 "*If non-nil, always center the current summary buffer.
387 In particular, if `vertical' do only vertical recentering. If non-nil
388 and non-`vertical', do both horizontal and vertical recentering."
389 :group 'gnus-summary-maneuvering
390 :type '(choice (const :tag "none" nil)
392 (integer :tag "height")
393 (sexp :menu-tag "both" t)))
395 (defvar gnus-auto-center-group t
396 "*If non-nil, always center the group buffer.")
398 (defcustom gnus-show-all-headers nil
399 "*If non-nil, don't hide any headers."
400 :group 'gnus-article-hiding
401 :group 'gnus-article-headers
404 (defcustom gnus-summary-ignore-duplicates nil
405 "*If non-nil, ignore articles with identical Message-ID headers."
409 (defcustom gnus-single-article-buffer t
410 "*If non-nil, display all articles in the same buffer.
411 If nil, each group will get its own article buffer."
412 :group 'gnus-article-various
415 (defcustom gnus-break-pages t
416 "*If non-nil, do page breaking on articles.
417 The page delimiter is specified by the `gnus-page-delimiter'
419 :group 'gnus-article-various
422 (defcustom gnus-move-split-methods nil
423 "*Variable used to suggest where articles are to be moved to.
424 It uses the same syntax as the `gnus-split-methods' variable.
425 However, whereas `gnus-split-methods' specifies file names as targets,
426 this variable specifies group names."
427 :group 'gnus-summary-mail
428 :type '(repeat (choice (list :value (fun) function)
429 (cons :value ("" "") regexp (repeat string))
432 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
433 "Function used to compute default prefix for article move/copy/etc prompts.
434 The function should take one argument, a group name, and return a
435 string with the suggested prefix."
436 :group 'gnus-summary-mail
439 ;; FIXME: Although the custom type is `character' for the following variables,
440 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
442 (defcustom gnus-unread-mark ? ;Whitespace
443 "*Mark used for unread articles."
444 :group 'gnus-summary-marks
447 (defcustom gnus-ticked-mark ?!
448 "*Mark used for ticked articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-dormant-mark ??
453 "*Mark used for dormant articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-del-mark ?r
458 "*Mark used for del'd articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-read-mark ?R
463 "*Mark used for read articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-expirable-mark ?E
468 "*Mark used for expirable articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-killed-mark ?K
473 "*Mark used for killed articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-spam-mark ?$
478 "*Mark used for spam articles."
480 :group 'gnus-summary-marks
483 (defcustom gnus-souped-mark ?F
484 "*Mark used for souped articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-kill-file-mark ?X
489 "*Mark used for articles killed by kill files."
490 :group 'gnus-summary-marks
493 (defcustom gnus-low-score-mark ?Y
494 "*Mark used for articles with a low score."
495 :group 'gnus-summary-marks
498 (defcustom gnus-catchup-mark ?C
499 "*Mark used for articles that are caught up."
500 :group 'gnus-summary-marks
503 (defcustom gnus-replied-mark ?A
504 "*Mark used for articles that have been replied to."
505 :group 'gnus-summary-marks
508 (defcustom gnus-forwarded-mark ?F
509 "*Mark used for articles that have been forwarded."
511 :group 'gnus-summary-marks
514 (defcustom gnus-recent-mark ?N
515 "*Mark used for articles that are recent."
517 :group 'gnus-summary-marks
520 (defcustom gnus-cached-mark ?*
521 "*Mark used for articles that are in the cache."
522 :group 'gnus-summary-marks
525 (defcustom gnus-saved-mark ?S
526 "*Mark used for articles that have been saved."
527 :group 'gnus-summary-marks
530 (defcustom gnus-unseen-mark ?.
531 "*Mark used for articles that haven't been seen."
533 :group 'gnus-summary-marks
536 (defcustom gnus-no-mark ? ;Whitespace
537 "*Mark used for articles that have no other secondary mark."
539 :group 'gnus-summary-marks
542 (defcustom gnus-ancient-mark ?O
543 "*Mark used for ancient articles."
544 :group 'gnus-summary-marks
547 (defcustom gnus-sparse-mark ?Q
548 "*Mark used for sparsely reffed articles."
549 :group 'gnus-summary-marks
552 (defcustom gnus-canceled-mark ?G
553 "*Mark used for canceled articles."
554 :group 'gnus-summary-marks
557 (defcustom gnus-duplicate-mark ?M
558 "*Mark used for duplicate articles."
559 :group 'gnus-summary-marks
562 (defcustom gnus-undownloaded-mark ?-
563 "*Mark used for articles that weren't downloaded."
565 :group 'gnus-summary-marks
568 (defcustom gnus-downloaded-mark ?+
569 "*Mark used for articles that were downloaded."
570 :group 'gnus-summary-marks
573 (defcustom gnus-downloadable-mark ?%
574 "*Mark used for articles that are to be downloaded."
575 :group 'gnus-summary-marks
578 (defcustom gnus-unsendable-mark ?=
579 "*Mark used for articles that won't be sent."
580 :group 'gnus-summary-marks
583 (defcustom gnus-score-over-mark ?+
584 "*Score mark used for articles with high scores."
585 :group 'gnus-summary-marks
588 (defcustom gnus-score-below-mark ?-
589 "*Score mark used for articles with low scores."
590 :group 'gnus-summary-marks
593 (defcustom gnus-empty-thread-mark ? ;Whitespace
594 "*There is no thread under the article."
595 :group 'gnus-summary-marks
598 (defcustom gnus-not-empty-thread-mark ?=
599 "*There is a thread under the article."
600 :group 'gnus-summary-marks
603 (defcustom gnus-view-pseudo-asynchronously nil
604 "*If non-nil, Gnus will view pseudo-articles asynchronously."
605 :group 'gnus-extract-view
608 (defcustom gnus-auto-expirable-marks
609 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
610 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
611 gnus-souped-mark gnus-duplicate-mark)
612 "*The list of marks converted into expiration if a group is auto-expirable."
615 :type '(repeat character))
617 (defcustom gnus-inhibit-user-auto-expire t
618 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
623 (defcustom gnus-view-pseudos nil
624 "*If `automatic', pseudo-articles will be viewed automatically.
625 If `not-confirm', pseudos will be viewed automatically, and the user
626 will not be asked to confirm the command."
627 :group 'gnus-extract-view
628 :type '(choice (const :tag "off" nil)
630 (const not-confirm)))
632 (defcustom gnus-view-pseudos-separately t
633 "*If non-nil, one pseudo-article will be created for each file to be viewed.
634 If nil, all files that use the same viewing command will be given as a
635 list of parameters to that command."
636 :group 'gnus-extract-view
639 (defcustom gnus-insert-pseudo-articles t
640 "*If non-nil, insert pseudo-articles when decoding articles."
641 :group 'gnus-extract-view
644 (defcustom gnus-summary-dummy-line-format
646 "*The format specification for the dummy roots in the summary buffer.
647 It works along the same lines as a normal formatting string,
648 with some simple extensions.
652 General format specifiers can also be used.
653 See `(gnus)Formatting Variables'."
654 :link '(custom-manual "(gnus)Formatting Variables")
655 :group 'gnus-threading
658 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
659 "*The format specification for the summary mode line.
660 It works along the same lines as a normal formatting string,
661 with some simple extensions:
664 %p Unprefixed group name
665 %A Current article number
666 %z Current article score
668 %U Number of unread articles in the group
669 %e Number of unselected articles in the group
670 %Z A string with unread/unselected article counts
671 %g Shortish group name
672 %S Subject of the current article
674 %s Current score file name
675 %d Number of dormant articles
676 %r Number of articles that have been marked as read in this session
677 %E Number of articles expunged by the score files"
678 :group 'gnus-summary-format
681 (defcustom gnus-list-identifiers nil
682 "Regexp that matches list identifiers to be removed from subject.
683 This can also be a list of regexps."
685 :group 'gnus-summary-format
686 :group 'gnus-article-hiding
687 :type '(choice (const :tag "none" nil)
689 (repeat :value (".*") regexp)))
691 (defcustom gnus-summary-mark-below 0
692 "*Mark all articles with a score below this variable as read.
693 This variable is local to each summary buffer and usually set by the
695 :group 'gnus-score-default
698 (defun gnus-widget-reversible-match (widget value)
699 "Ignoring WIDGET, convert VALUE to internal form.
700 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
704 (eq (length value) 2)
705 (eq (nth 0 value) 'not)
706 (symbolp (nth 1 value)))))
708 (defun gnus-widget-reversible-to-internal (widget value)
709 "Ignoring WIDGET, convert VALUE to internal form.
710 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
711 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
715 (list (nth 1 value) t)))
717 (defun gnus-widget-reversible-to-external (widget value)
718 "Ignoring WIDGET, convert VALUE to external form.
719 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
720 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
723 (list 'not (nth 0 value))
726 (define-widget 'gnus-widget-reversible 'group
727 "A `group' that convert values."
728 :match 'gnus-widget-reversible-match
729 :value-to-internal 'gnus-widget-reversible-to-internal
730 :value-to-external 'gnus-widget-reversible-to-external)
732 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
733 "*List of functions used for sorting articles in the summary buffer.
735 Each function takes two articles and returns non-nil if the first
736 article should be sorted before the other. If you use more than one
737 function, the primary sort function should be the last. You should
738 probably always include `gnus-article-sort-by-number' in the list of
739 sorting functions -- preferably first. Also note that sorting by date
740 is often much slower than sorting by number, and the sorting order is
741 very similar. (Sorting by date means sorting by the time the message
742 was sent, sorting by number means sorting by arrival time.)
744 Each item can also be a list `(not F)' where F is a function;
745 this reverses the sort order.
747 Ready-made functions include `gnus-article-sort-by-number',
748 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
749 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
750 and `gnus-article-sort-by-score'.
752 When threading is turned on, the variable `gnus-thread-sort-functions'
753 controls how articles are sorted."
754 :group 'gnus-summary-sort
755 :type '(repeat (gnus-widget-reversible
756 (choice (function-item gnus-article-sort-by-number)
757 (function-item gnus-article-sort-by-author)
758 (function-item gnus-article-sort-by-subject)
759 (function-item gnus-article-sort-by-date)
760 (function-item gnus-article-sort-by-score)
761 (function-item gnus-article-sort-by-random)
762 (function :tag "other"))
763 (boolean :tag "Reverse order"))))
766 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
767 "*List of functions used for sorting threads in the summary buffer.
768 By default, threads are sorted by article number.
770 Each function takes two threads and returns non-nil if the first
771 thread should be sorted before the other. If you use more than one
772 function, the primary sort function should be the last. You should
773 probably always include `gnus-thread-sort-by-number' in the list of
774 sorting functions -- preferably first. Also note that sorting by date
775 is often much slower than sorting by number, and the sorting order is
776 very similar. (Sorting by date means sorting by the time the message
777 was sent, sorting by number means sorting by arrival time.)
779 Each list item can also be a list `(not F)' where F is a
780 function; this specifies reversed sort order.
782 Ready-made functions include `gnus-thread-sort-by-number',
783 `gnus-thread-sort-by-author', `gnus-thread-sort-by-subject',
784 `gnus-thread-sort-by-date', `gnus-thread-sort-by-score',
785 `gnus-thread-sort-by-most-recent-number',
786 `gnus-thread-sort-by-most-recent-date',
787 `gnus-thread-sort-by-random', and
788 `gnus-thread-sort-by-total-score' (see `gnus-thread-score-function').
790 When threading is turned off, the variable
791 `gnus-article-sort-functions' controls how articles are sorted."
792 :group 'gnus-summary-sort
794 (gnus-widget-reversible
795 (choice (function-item gnus-thread-sort-by-number)
796 (function-item gnus-thread-sort-by-author)
797 (function-item gnus-thread-sort-by-subject)
798 (function-item gnus-thread-sort-by-date)
799 (function-item gnus-thread-sort-by-score)
800 (function-item gnus-thread-sort-by-most-recent-number)
801 (function-item gnus-thread-sort-by-most-recent-date)
802 (function-item gnus-thread-sort-by-random)
803 (function-item gnus-thread-sort-by-total-score)
804 (function :tag "other"))
805 (boolean :tag "Reverse order"))))
807 (defcustom gnus-thread-score-function '+
808 "*Function used for calculating the total score of a thread.
810 The function is called with the scores of the article and each
811 subthread and should then return the score of the thread.
813 Some functions you can use are `+', `max', or `min'."
814 :group 'gnus-summary-sort
817 (defcustom gnus-summary-expunge-below nil
818 "All articles that have a score less than this variable will be expunged.
819 This variable is local to the summary buffers."
820 :group 'gnus-score-default
821 :type '(choice (const :tag "off" nil)
824 (defcustom gnus-thread-expunge-below nil
825 "All threads that have a total score less than this variable will be expunged.
826 See `gnus-thread-score-function' for en explanation of what a
829 This variable is local to the summary buffers."
830 :group 'gnus-threading
831 :group 'gnus-score-default
832 :type '(choice (const :tag "off" nil)
835 (defcustom gnus-summary-mode-hook nil
836 "*A hook for Gnus summary mode.
837 This hook is run before any variables are set in the summary buffer."
838 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
839 :group 'gnus-summary-various
842 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
843 (when (featurep 'xemacs)
844 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
845 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
846 (add-hook 'gnus-summary-mode-hook
847 'gnus-xmas-switch-horizontal-scrollbar-off))
849 (defcustom gnus-summary-menu-hook nil
850 "*Hook run after the creation of the summary mode menu."
851 :group 'gnus-summary-visual
854 (defcustom gnus-summary-exit-hook nil
855 "*A hook called on exit from the summary buffer.
856 It will be called with point in the group buffer."
857 :group 'gnus-summary-exit
860 (defcustom gnus-summary-prepare-hook nil
861 "*A hook called after the summary buffer has been generated.
862 If you want to modify the summary buffer, you can use this hook."
863 :group 'gnus-summary-various
866 (defcustom gnus-summary-prepared-hook nil
867 "*A hook called as the last thing after the summary buffer has been generated."
868 :group 'gnus-summary-various
871 (defcustom gnus-summary-generate-hook nil
872 "*A hook run just before generating the summary buffer.
873 This hook is commonly used to customize threading variables and the
875 :group 'gnus-summary-various
878 (defcustom gnus-select-group-hook nil
879 "*A hook called when a newsgroup is selected.
881 If you'd like to simplify subjects like the
882 `gnus-summary-next-same-subject' command does, you can use the
885 (add-hook gnus-select-group-hook
887 (mapcar (lambda (header)
888 (mail-header-set-subject
890 (gnus-simplify-subject
891 (mail-header-subject header) 're-only)))
892 gnus-newsgroup-headers)))"
893 :group 'gnus-group-select
896 (defcustom gnus-select-article-hook nil
897 "*A hook called when an article is selected."
898 :group 'gnus-summary-choose
899 :options '(gnus-agent-fetch-selected-article)
902 (defcustom gnus-visual-mark-article-hook
903 (list 'gnus-highlight-selected-summary)
904 "*Hook run after selecting an article in the summary buffer.
905 It is meant to be used for highlighting the article in some way. It
906 is not run if `gnus-visual' is nil."
907 :group 'gnus-summary-visual
910 (defcustom gnus-parse-headers-hook nil
911 "*A hook called before parsing the headers."
915 (defcustom gnus-exit-group-hook nil
916 "*A hook called when exiting summary mode.
917 This hook is not called from the non-updating exit commands like `Q'."
921 (defcustom gnus-summary-update-hook
922 (list 'gnus-summary-highlight-line)
923 "*A hook called when a summary line is changed.
924 The hook will not be called if `gnus-visual' is nil.
926 The default function `gnus-summary-highlight-line' will
927 highlight the line according to the `gnus-summary-highlight'
929 :group 'gnus-summary-visual
932 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
933 "*A hook called when an article is selected for the first time.
934 The hook is intended to mark an article as read (or unread)
935 automatically when it is selected."
936 :group 'gnus-summary-choose
939 (defcustom gnus-group-no-more-groups-hook nil
940 "*A hook run when returning to group mode having no more (unread) groups."
941 :group 'gnus-group-select
944 (defcustom gnus-ps-print-hook nil
945 "*A hook run before ps-printing something from Gnus."
949 (defcustom gnus-summary-article-move-hook nil
950 "*A hook called after an article is moved, copied, respooled, or crossposted."
955 (defcustom gnus-summary-article-delete-hook nil
956 "*A hook called after an article is deleted."
961 (defcustom gnus-summary-article-expire-hook nil
962 "*A hook called after an article is expired."
967 (defcustom gnus-summary-display-arrow
968 (and (fboundp 'display-graphic-p)
970 "*If non-nil, display an arrow highlighting the current article."
975 (defcustom gnus-summary-selected-face 'gnus-summary-selected-face
976 "Face used for highlighting the current article in the summary buffer."
977 :group 'gnus-summary-visual
980 (defvar gnus-tmp-downloaded nil)
982 (defcustom gnus-summary-highlight
983 '(((eq mark gnus-canceled-mark)
984 . gnus-summary-cancelled-face)
985 ((and uncached (> score default-high))
986 . gnus-summary-high-undownloaded-face)
987 ((and uncached (< score default-low))
988 . gnus-summary-low-undownloaded-face)
990 . gnus-summary-normal-undownloaded-face)
991 ((and (> score default-high)
992 (or (eq mark gnus-dormant-mark)
993 (eq mark gnus-ticked-mark)))
994 . gnus-summary-high-ticked-face)
995 ((and (< score default-low)
996 (or (eq mark gnus-dormant-mark)
997 (eq mark gnus-ticked-mark)))
998 . gnus-summary-low-ticked-face)
999 ((or (eq mark gnus-dormant-mark)
1000 (eq mark gnus-ticked-mark))
1001 . gnus-summary-normal-ticked-face)
1002 ((and (> score default-high) (eq mark gnus-ancient-mark))
1003 . gnus-summary-high-ancient-face)
1004 ((and (< score default-low) (eq mark gnus-ancient-mark))
1005 . gnus-summary-low-ancient-face)
1006 ((eq mark gnus-ancient-mark)
1007 . gnus-summary-normal-ancient-face)
1008 ((and (> score default-high) (eq mark gnus-unread-mark))
1009 . gnus-summary-high-unread-face)
1010 ((and (< score default-low) (eq mark gnus-unread-mark))
1011 . gnus-summary-low-unread-face)
1012 ((eq mark gnus-unread-mark)
1013 . gnus-summary-normal-unread-face)
1014 ((> score default-high)
1015 . gnus-summary-high-read-face)
1016 ((< score default-low)
1017 . gnus-summary-low-read-face)
1019 . gnus-summary-normal-read-face))
1020 "*Controls the highlighting of summary buffer lines.
1022 A list of (FORM . FACE) pairs. When deciding how a a particular
1023 summary line should be displayed, each form is evaluated. The content
1024 of the face field after the first true form is used. You can change
1025 how those summary lines are displayed, by editing the face field.
1027 You can use the following variables in the FORM field.
1029 score: The article's score
1030 default: The default article score.
1031 default-high: The default score for high scored articles.
1032 default-low: The default score for low scored articles.
1033 below: The score below which articles are automatically marked as read.
1034 mark: The article's mark.
1035 uncached: Non-nil if the article is uncached."
1036 :group 'gnus-summary-visual
1037 :type '(repeat (cons (sexp :tag "Form" nil)
1040 (defcustom gnus-alter-header-function nil
1041 "Function called to allow alteration of article header structures.
1042 The function is called with one parameter, the article header vector,
1043 which it may alter in any way."
1044 :type '(choice (const :tag "None" nil)
1046 :group 'gnus-summary)
1048 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1049 "Variable that says which function should be used to decode a string with encoded words.")
1051 (defcustom gnus-extra-headers '(To Newsgroups)
1052 "*Extra headers to parse."
1054 :group 'gnus-summary
1055 :type '(repeat symbol))
1057 (defcustom gnus-ignored-from-addresses
1058 (and user-mail-address (regexp-quote user-mail-address))
1059 "*Regexp of From headers that may be suppressed in favor of To headers."
1061 :group 'gnus-summary
1064 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1065 "List of charsets that should be ignored.
1066 When these charsets are used in the \"charset\" parameter, the
1067 default charset will be used instead."
1069 :type '(repeat symbol)
1070 :group 'gnus-charset)
1072 (gnus-define-group-parameter
1076 "Return the ignored charsets of GROUP."
1077 :variable gnus-group-ignored-charsets-alist
1079 '(("alt\\.chinese\\.text" iso-8859-1))
1081 "Alist of regexps (to match group names) and charsets that should be ignored.
1082 When these charsets are used in the \"charset\" parameter, the
1083 default charset will be used instead."
1084 :variable-group gnus-charset
1085 :variable-type '(repeat (cons (regexp :tag "Group")
1087 :parameter-type '(choice :tag "Ignored charsets"
1090 :parameter-document "\
1091 List of charsets that should be ignored.
1093 When these charsets are used in the \"charset\" parameter, the
1094 default charset will be used instead.")
1096 (defcustom gnus-group-highlight-words-alist nil
1097 "Alist of group regexps and highlight regexps.
1098 This variable uses the same syntax as `gnus-emphasis-alist'."
1100 :type '(repeat (cons (regexp :tag "Group")
1101 (repeat (list (regexp :tag "Highlight regexp")
1102 (number :tag "Group for entire word" 0)
1103 (number :tag "Group for displayed part" 0)
1105 gnus-emphasis-highlight-words)))))
1106 :group 'gnus-summary-visual)
1108 (defcustom gnus-summary-show-article-charset-alist
1110 "Alist of number and charset.
1111 The article will be shown with the charset corresponding to the
1113 For example: ((1 . cn-gb-2312) (2 . big5))."
1115 :type '(repeat (cons (number :tag "Argument" 1)
1116 (symbol :tag "Charset")))
1117 :group 'gnus-charset)
1119 (defcustom gnus-preserve-marks t
1120 "Whether marks are preserved when moving, copying and respooling messages."
1123 :group 'gnus-summary-marks)
1125 (defcustom gnus-alter-articles-to-read-function nil
1126 "Function to be called to alter the list of articles to be selected."
1127 :type '(choice (const nil) function)
1128 :group 'gnus-summary)
1130 (defcustom gnus-orphan-score nil
1131 "*All orphans get this score added. Set in the score file."
1132 :group 'gnus-score-default
1133 :type '(choice (const nil)
1136 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1137 "*A regexp to match MIME parts when saving multiple parts of a
1138 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1139 This regexp will be used by default when prompting the user for which
1140 type of files to save."
1141 :group 'gnus-summary
1144 (defcustom gnus-read-all-available-headers nil
1145 "Whether Gnus should parse all headers made available to it.
1146 This is mostly relevant for slow back ends where the user may
1147 wish to widen the summary buffer to include all headers
1148 that were fetched. Say, for nnultimate groups."
1150 :group 'gnus-summary
1151 :type '(choice boolean regexp))
1153 (defcustom gnus-summary-muttprint-program "muttprint"
1154 "Command (and optional arguments) used to run Muttprint."
1156 :group 'gnus-summary
1159 (defcustom gnus-article-loose-mime t
1160 "If non-nil, don't require MIME-Version header.
1161 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1162 supply the MIME-Version header or deliberately strip it from the mail.
1163 If non-nil (the default), Gnus will treat some articles as MIME
1164 even if the MIME-Version header is missing."
1167 :group 'gnus-article-mime)
1169 (defcustom gnus-article-emulate-mime t
1170 "If non-nil, use MIME emulation for uuencode and the like.
1171 This means that Gnus will search message bodies for text that look
1172 like uuencoded bits, yEncoded bits, and so on, and present that using
1173 the normal Gnus MIME machinery."
1176 :group 'gnus-article-mime)
1178 ;;; Internal variables
1180 (defvar gnus-summary-display-cache nil)
1181 (defvar gnus-article-mime-handles nil)
1182 (defvar gnus-article-decoded-p nil)
1183 (defvar gnus-article-charset nil)
1184 (defvar gnus-article-ignored-charsets nil)
1185 (defvar gnus-scores-exclude-files nil)
1186 (defvar gnus-page-broken nil)
1188 (defvar gnus-original-article nil)
1189 (defvar gnus-article-internal-prepare-hook nil)
1190 (defvar gnus-newsgroup-process-stack nil)
1192 (defvar gnus-thread-indent-array nil)
1193 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1194 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1195 "Function called to sort the articles within a thread after it has been gathered together.")
1197 (defvar gnus-summary-save-parts-type-history nil)
1198 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1200 ;; Avoid highlighting in kill files.
1201 (defvar gnus-summary-inhibit-highlight nil)
1202 (defvar gnus-newsgroup-selected-overlay nil)
1203 (defvar gnus-inhibit-limiting nil)
1204 (defvar gnus-newsgroup-adaptive-score-file nil)
1205 (defvar gnus-current-score-file nil)
1206 (defvar gnus-current-move-group nil)
1207 (defvar gnus-current-copy-group nil)
1208 (defvar gnus-current-crosspost-group nil)
1209 (defvar gnus-newsgroup-display nil)
1211 (defvar gnus-newsgroup-dependencies nil)
1212 (defvar gnus-newsgroup-adaptive nil)
1213 (defvar gnus-summary-display-article-function nil)
1214 (defvar gnus-summary-highlight-line-function nil
1215 "Function called after highlighting a summary line.")
1217 (defvar gnus-summary-line-format-alist
1218 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1219 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1220 (?s gnus-tmp-subject-or-nil ?s)
1221 (?n gnus-tmp-name ?s)
1222 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1224 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1226 (?F gnus-tmp-from ?s)
1227 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1228 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1229 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1230 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1231 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1232 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1233 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1234 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1235 (?L gnus-tmp-lines ?s)
1236 (?O gnus-tmp-downloaded ?c)
1237 (?I gnus-tmp-indentation ?s)
1238 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1239 (?R gnus-tmp-replied ?c)
1240 (?\[ gnus-tmp-opening-bracket ?c)
1241 (?\] gnus-tmp-closing-bracket ?c)
1242 (?\> (make-string gnus-tmp-level ? ) ?s)
1243 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1244 (?i gnus-tmp-score ?d)
1245 (?z gnus-tmp-score-char ?c)
1246 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1247 (?U gnus-tmp-unread ?c)
1248 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1250 (?t (gnus-summary-number-of-articles-in-thread
1251 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1253 (?e (gnus-summary-number-of-articles-in-thread
1254 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1256 (?u gnus-tmp-user-defined ?s)
1257 (?P (gnus-pick-line-number) ?d)
1258 (?B gnus-tmp-thread-tree-header-string ?s)
1259 (user-date (gnus-user-date
1260 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1261 "An alist of format specifications that can appear in summary lines.
1262 These are paired with what variables they correspond with, along with
1263 the type of the variable (string, integer, character, etc).")
1265 (defvar gnus-summary-dummy-line-format-alist
1266 `((?S gnus-tmp-subject ?s)
1267 (?N gnus-tmp-number ?d)
1268 (?u gnus-tmp-user-defined ?s)))
1270 (defvar gnus-summary-mode-line-format-alist
1271 `((?G gnus-tmp-group-name ?s)
1272 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1273 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1274 (?A gnus-tmp-article-number ?d)
1275 (?Z gnus-tmp-unread-and-unselected ?s)
1276 (?V gnus-version ?s)
1277 (?U gnus-tmp-unread-and-unticked ?d)
1278 (?S gnus-tmp-subject ?s)
1279 (?e gnus-tmp-unselected ?d)
1280 (?u gnus-tmp-user-defined ?s)
1281 (?d (length gnus-newsgroup-dormant) ?d)
1282 (?t (length gnus-newsgroup-marked) ?d)
1283 (?h (length gnus-newsgroup-spam-marked) ?d)
1284 (?r (length gnus-newsgroup-reads) ?d)
1285 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1286 (?E gnus-newsgroup-expunged-tally ?d)
1287 (?s (gnus-current-score-file-nondirectory) ?s)))
1289 (defvar gnus-last-search-regexp nil
1290 "Default regexp for article search command.")
1292 (defvar gnus-last-shell-command nil
1293 "Default shell command on article.")
1295 (defvar gnus-newsgroup-agentized nil
1296 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1297 (defvar gnus-newsgroup-begin nil)
1298 (defvar gnus-newsgroup-end nil)
1299 (defvar gnus-newsgroup-last-rmail nil)
1300 (defvar gnus-newsgroup-last-mail nil)
1301 (defvar gnus-newsgroup-last-folder nil)
1302 (defvar gnus-newsgroup-last-file nil)
1303 (defvar gnus-newsgroup-auto-expire nil)
1304 (defvar gnus-newsgroup-active nil)
1306 (defvar gnus-newsgroup-data nil)
1307 (defvar gnus-newsgroup-data-reverse nil)
1308 (defvar gnus-newsgroup-limit nil)
1309 (defvar gnus-newsgroup-limits nil)
1310 (defvar gnus-summary-use-undownloaded-faces nil)
1312 (defvar gnus-newsgroup-unreads nil
1313 "Sorted list of unread articles in the current newsgroup.")
1315 (defvar gnus-newsgroup-unselected nil
1316 "Sorted list of unselected unread articles in the current newsgroup.")
1318 (defvar gnus-newsgroup-reads nil
1319 "Alist of read articles and article marks in the current newsgroup.")
1321 (defvar gnus-newsgroup-expunged-tally nil)
1323 (defvar gnus-newsgroup-marked nil
1324 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1326 (defvar gnus-newsgroup-spam-marked nil
1327 "List of ranges of articles that have been marked as spam.")
1329 (defvar gnus-newsgroup-killed nil
1330 "List of ranges of articles that have been through the scoring process.")
1332 (defvar gnus-newsgroup-cached nil
1333 "Sorted list of articles that come from the article cache.")
1335 (defvar gnus-newsgroup-saved nil
1336 "List of articles that have been saved.")
1338 (defvar gnus-newsgroup-kill-headers nil)
1340 (defvar gnus-newsgroup-replied nil
1341 "List of articles that have been replied to in the current newsgroup.")
1343 (defvar gnus-newsgroup-forwarded nil
1344 "List of articles that have been forwarded in the current newsgroup.")
1346 (defvar gnus-newsgroup-recent nil
1347 "List of articles that have are recent in the current newsgroup.")
1349 (defvar gnus-newsgroup-expirable nil
1350 "Sorted list of articles in the current newsgroup that can be expired.")
1352 (defvar gnus-newsgroup-processable nil
1353 "List of articles in the current newsgroup that can be processed.")
1355 (defvar gnus-newsgroup-downloadable nil
1356 "Sorted list of articles in the current newsgroup that can be processed.")
1358 (defvar gnus-newsgroup-unfetched nil
1359 "Sorted list of articles in the current newsgroup whose headers have
1360 not been fetched into the agent.
1362 This list will always be a subset of gnus-newsgroup-undownloaded.")
1364 (defvar gnus-newsgroup-undownloaded nil
1365 "List of articles in the current newsgroup that haven't been downloaded.")
1367 (defvar gnus-newsgroup-unsendable nil
1368 "List of articles in the current newsgroup that won't be sent.")
1370 (defvar gnus-newsgroup-bookmarks nil
1371 "List of articles in the current newsgroup that have bookmarks.")
1373 (defvar gnus-newsgroup-dormant nil
1374 "Sorted list of dormant articles in the current newsgroup.")
1376 (defvar gnus-newsgroup-unseen nil
1377 "List of unseen articles in the current newsgroup.")
1379 (defvar gnus-newsgroup-seen nil
1380 "Range of seen articles in the current newsgroup.")
1382 (defvar gnus-newsgroup-articles nil
1383 "List of articles in the current newsgroup.")
1385 (defvar gnus-newsgroup-scored nil
1386 "List of scored articles in the current newsgroup.")
1388 (defvar gnus-newsgroup-headers nil
1389 "List of article headers in the current newsgroup.")
1391 (defvar gnus-newsgroup-threads nil)
1393 (defvar gnus-newsgroup-prepared nil
1394 "Whether the current group has been prepared properly.")
1396 (defvar gnus-newsgroup-ancient nil
1397 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1399 (defvar gnus-newsgroup-sparse nil)
1401 (defvar gnus-current-article nil)
1402 (defvar gnus-article-current nil)
1403 (defvar gnus-current-headers nil)
1404 (defvar gnus-have-all-headers nil)
1405 (defvar gnus-last-article nil)
1406 (defvar gnus-newsgroup-history nil)
1407 (defvar gnus-newsgroup-charset nil)
1408 (defvar gnus-newsgroup-ephemeral-charset nil)
1409 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1411 (defvar gnus-article-before-search nil)
1413 (defvar gnus-summary-local-variables
1414 '(gnus-newsgroup-name
1415 gnus-newsgroup-begin gnus-newsgroup-end
1416 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1417 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1418 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1419 gnus-newsgroup-unselected gnus-newsgroup-marked
1420 gnus-newsgroup-spam-marked
1421 gnus-newsgroup-reads gnus-newsgroup-saved
1422 gnus-newsgroup-replied gnus-newsgroup-forwarded
1423 gnus-newsgroup-recent
1424 gnus-newsgroup-expirable
1425 gnus-newsgroup-processable gnus-newsgroup-killed
1426 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1427 gnus-newsgroup-unfetched
1428 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1429 gnus-newsgroup-seen gnus-newsgroup-articles
1430 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1431 gnus-newsgroup-headers gnus-newsgroup-threads
1432 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1433 gnus-current-article gnus-current-headers gnus-have-all-headers
1434 gnus-last-article gnus-article-internal-prepare-hook
1435 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1436 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1437 gnus-thread-expunge-below
1438 gnus-score-alist gnus-current-score-file
1439 (gnus-summary-expunge-below . global)
1440 (gnus-summary-mark-below . global)
1441 (gnus-orphan-score . global)
1442 gnus-newsgroup-active gnus-scores-exclude-files
1443 gnus-newsgroup-history gnus-newsgroup-ancient
1444 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1445 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1446 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1447 (gnus-newsgroup-expunged-tally . 0)
1448 gnus-cache-removable-articles gnus-newsgroup-cached
1449 gnus-newsgroup-data gnus-newsgroup-data-reverse
1450 gnus-newsgroup-limit gnus-newsgroup-limits
1451 gnus-newsgroup-charset gnus-newsgroup-display
1452 gnus-summary-use-undownloaded-faces)
1453 "Variables that are buffer-local to the summary buffers.")
1455 (defvar gnus-newsgroup-variables nil
1456 "A list of variables that have separate values in different newsgroups.
1457 A list of newsgroup (summary buffer) local variables, or cons of
1458 variables and their default expressions to be evalled (when the default
1459 values are not nil), that should be made global while the summary buffer
1462 Note: The default expressions will be evaluated (using function `eval')
1463 before assignment to the local variable rather than just assigned to it.
1464 If the default expression is the symbol `global', that symbol will not
1465 be evaluated but the global value of the local variable will be used
1468 These variables can be used to set variables in the group parameters
1469 while still allowing them to affect operations done in other buffers.
1472 \(setq gnus-newsgroup-variables
1473 '(message-use-followup-to
1474 (gnus-visible-headers .
1475 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1478 ;; Byte-compiler warning.
1480 ;; Bind features so that require will believe that gnus-sum has
1481 ;; already been loaded (avoids infinite recursion)
1482 (let ((features (cons 'gnus-sum features)))
1483 ;; Several of the declarations in gnus-sum are needed to load the
1484 ;; following files. Right now, these definitions have been
1485 ;; compiled but not defined (evaluated). We could either do a
1486 ;; eval-and-compile about all of the declarations or evaluate the
1488 (if (boundp 'gnus-newsgroup-variables)
1490 (load "gnus-sum.el" t t t))
1492 (require 'gnus-art)))
1496 (defvar gnus-decode-encoded-word-methods
1497 '(mail-decode-encoded-word-string)
1498 "List of methods used to decode encoded words.
1500 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1501 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1502 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1503 whose names match REGEXP.
1506 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1507 mail-decode-encoded-word-string
1508 (\"chinese\" . rfc1843-decode-string))")
1510 (defvar gnus-decode-encoded-word-methods-cache nil)
1512 (defun gnus-multi-decode-encoded-word-string (string)
1513 "Apply the functions from `gnus-encoded-word-methods' that match."
1514 (unless (and gnus-decode-encoded-word-methods-cache
1515 (eq gnus-newsgroup-name
1516 (car gnus-decode-encoded-word-methods-cache)))
1517 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1520 (nconc gnus-decode-encoded-word-methods-cache (list x))
1521 (if (and gnus-newsgroup-name
1522 (string-match (car x) gnus-newsgroup-name))
1523 (nconc gnus-decode-encoded-word-methods-cache
1525 gnus-decode-encoded-word-methods))
1526 (let ((xlist gnus-decode-encoded-word-methods-cache))
1529 (setq string (funcall (pop xlist) string))))
1532 ;; Subject simplification.
1534 (defun gnus-simplify-whitespace (str)
1535 "Remove excessive whitespace from STR."
1537 (while (string-match "[ \t][ \t]+" str)
1538 (setq str (concat (substring str 0 (match-beginning 0))
1540 (substring str (match-end 0)))))
1542 (when (string-match "^[ \t]+" str)
1543 (setq str (substring str (match-end 0))))
1545 (when (string-match "[ \t]+$" str)
1546 (setq str (substring str 0 (match-beginning 0))))
1549 (defun gnus-simplify-all-whitespace (str)
1550 "Remove all whitespace from STR."
1551 (while (string-match "[ \t\n]+" str)
1552 (setq str (replace-match "" nil nil str)))
1555 (defsubst gnus-simplify-subject-re (subject)
1556 "Remove \"Re:\" from subject lines."
1557 (if (string-match message-subject-re-regexp subject)
1558 (substring subject (match-end 0))
1561 (defun gnus-simplify-subject (subject &optional re-only)
1562 "Remove `Re:' and words in parentheses.
1563 If RE-ONLY is non-nil, strip leading `Re:'s only."
1564 (let ((case-fold-search t)) ;Ignore case.
1565 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1566 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1567 (setq subject (substring subject (match-end 0))))
1568 ;; Remove uninteresting prefixes.
1569 (when (and (not re-only)
1570 gnus-simplify-ignored-prefixes
1571 (string-match gnus-simplify-ignored-prefixes subject))
1572 (setq subject (substring subject (match-end 0))))
1573 ;; Remove words in parentheses from end.
1575 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1576 (setq subject (substring subject 0 (match-beginning 0)))))
1577 ;; Return subject string.
1580 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1582 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1583 (goto-char (point-min))
1584 (while (re-search-forward regexp nil t)
1585 (replace-match (or newtext ""))))
1587 (defun gnus-simplify-buffer-fuzzy ()
1588 "Simplify string in the buffer fuzzily.
1589 The string in the accessible portion of the current buffer is simplified.
1590 It is assumed to be a single-line subject.
1591 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1592 matter is removed. Additional things can be deleted by setting
1593 `gnus-simplify-subject-fuzzy-regexp'."
1594 (let ((case-fold-search t)
1596 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1598 (while (not (eq modified-tick (buffer-modified-tick)))
1599 (setq modified-tick (buffer-modified-tick))
1601 ((listp gnus-simplify-subject-fuzzy-regexp)
1602 (mapcar 'gnus-simplify-buffer-fuzzy-step
1603 gnus-simplify-subject-fuzzy-regexp))
1604 (gnus-simplify-subject-fuzzy-regexp
1605 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1606 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1607 (gnus-simplify-buffer-fuzzy-step
1608 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1609 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1611 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1612 (gnus-simplify-buffer-fuzzy-step " +" " ")
1613 (gnus-simplify-buffer-fuzzy-step " $")
1614 (gnus-simplify-buffer-fuzzy-step "^ +")))
1616 (defun gnus-simplify-subject-fuzzy (subject)
1617 "Simplify a subject string fuzzily.
1618 See `gnus-simplify-buffer-fuzzy' for details."
1620 (gnus-set-work-buffer)
1621 (let ((case-fold-search t))
1622 ;; Remove uninteresting prefixes.
1623 (when (and gnus-simplify-ignored-prefixes
1624 (string-match gnus-simplify-ignored-prefixes subject))
1625 (setq subject (substring subject (match-end 0))))
1627 (inline (gnus-simplify-buffer-fuzzy))
1630 (defsubst gnus-simplify-subject-fully (subject)
1631 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1633 (gnus-simplify-subject-functions
1634 (gnus-map-function gnus-simplify-subject-functions subject))
1635 ((null gnus-summary-gather-subject-limit)
1636 (gnus-simplify-subject-re subject))
1637 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1638 (gnus-simplify-subject-fuzzy subject))
1639 ((numberp gnus-summary-gather-subject-limit)
1640 (gnus-limit-string (gnus-simplify-subject-re subject)
1641 gnus-summary-gather-subject-limit))
1645 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1646 "Check whether two subjects are equal.
1647 If optional argument SIMPLE-FIRST is t, first argument is already
1650 ((null simple-first)
1651 (equal (gnus-simplify-subject-fully s1)
1652 (gnus-simplify-subject-fully s2)))
1655 (gnus-simplify-subject-fully s2)))))
1657 (defun gnus-summary-bubble-group ()
1658 "Increase the score of the current group.
1659 This is a handy function to add to `gnus-summary-exit-hook' to
1660 increase the score of each group you read."
1661 (gnus-group-add-score gnus-newsgroup-name))
1665 ;;; Gnus summary mode
1668 (put 'gnus-summary-mode 'mode-class 'special)
1670 (defvar gnus-article-commands-menu)
1672 ;; Non-orthogonal keys
1674 (gnus-define-keys gnus-summary-mode-map
1675 " " gnus-summary-next-page
1676 "\177" gnus-summary-prev-page
1677 [delete] gnus-summary-prev-page
1678 [backspace] gnus-summary-prev-page
1679 "\r" gnus-summary-scroll-up
1680 "\M-\r" gnus-summary-scroll-down
1681 "n" gnus-summary-next-unread-article
1682 "p" gnus-summary-prev-unread-article
1683 "N" gnus-summary-next-article
1684 "P" gnus-summary-prev-article
1685 "\M-\C-n" gnus-summary-next-same-subject
1686 "\M-\C-p" gnus-summary-prev-same-subject
1687 "\M-n" gnus-summary-next-unread-subject
1688 "\M-p" gnus-summary-prev-unread-subject
1689 "." gnus-summary-first-unread-article
1690 "," gnus-summary-best-unread-article
1691 "\M-s" gnus-summary-search-article-forward
1692 "\M-r" gnus-summary-search-article-backward
1693 "<" gnus-summary-beginning-of-article
1694 ">" gnus-summary-end-of-article
1695 "j" gnus-summary-goto-article
1696 "^" gnus-summary-refer-parent-article
1697 "\M-^" gnus-summary-refer-article
1698 "u" gnus-summary-tick-article-forward
1699 "!" gnus-summary-tick-article-forward
1700 "U" gnus-summary-tick-article-backward
1701 "d" gnus-summary-mark-as-read-forward
1702 "D" gnus-summary-mark-as-read-backward
1703 "E" gnus-summary-mark-as-expirable
1704 "\M-u" gnus-summary-clear-mark-forward
1705 "\M-U" gnus-summary-clear-mark-backward
1706 "k" gnus-summary-kill-same-subject-and-select
1707 "\C-k" gnus-summary-kill-same-subject
1708 "\M-\C-k" gnus-summary-kill-thread
1709 "\M-\C-l" gnus-summary-lower-thread
1710 "e" gnus-summary-edit-article
1711 "#" gnus-summary-mark-as-processable
1712 "\M-#" gnus-summary-unmark-as-processable
1713 "\M-\C-t" gnus-summary-toggle-threads
1714 "\M-\C-s" gnus-summary-show-thread
1715 "\M-\C-h" gnus-summary-hide-thread
1716 "\M-\C-f" gnus-summary-next-thread
1717 "\M-\C-b" gnus-summary-prev-thread
1718 [(meta down)] gnus-summary-next-thread
1719 [(meta up)] gnus-summary-prev-thread
1720 "\M-\C-u" gnus-summary-up-thread
1721 "\M-\C-d" gnus-summary-down-thread
1722 "&" gnus-summary-execute-command
1723 "c" gnus-summary-catchup-and-exit
1724 "\C-w" gnus-summary-mark-region-as-read
1725 "\C-t" gnus-summary-toggle-truncation
1726 "?" gnus-summary-mark-as-dormant
1727 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1728 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1729 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1730 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1731 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1732 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1733 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1734 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1735 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1736 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1737 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1738 "=" gnus-summary-expand-window
1739 "\C-x\C-s" gnus-summary-reselect-current-group
1740 "\M-g" gnus-summary-rescan-group
1741 "w" gnus-summary-stop-page-breaking
1742 "\C-c\C-r" gnus-summary-caesar-message
1743 "f" gnus-summary-followup
1744 "F" gnus-summary-followup-with-original
1745 "C" gnus-summary-cancel-article
1746 "r" gnus-summary-reply
1747 "R" gnus-summary-reply-with-original
1748 "\C-c\C-f" gnus-summary-mail-forward
1749 "o" gnus-summary-save-article
1750 "\C-o" gnus-summary-save-article-mail
1751 "|" gnus-summary-pipe-output
1752 "\M-k" gnus-summary-edit-local-kill
1753 "\M-K" gnus-summary-edit-global-kill
1755 "\C-c\C-d" gnus-summary-describe-group
1756 "q" gnus-summary-exit
1757 "Q" gnus-summary-exit-no-update
1758 "\C-c\C-i" gnus-info-find-node
1759 gnus-mouse-2 gnus-mouse-pick-article
1760 "m" gnus-summary-mail-other-window
1761 "a" gnus-summary-post-news
1762 "i" gnus-summary-news-other-window
1763 "x" gnus-summary-limit-to-unread
1764 "s" gnus-summary-isearch-article
1765 "t" gnus-summary-toggle-header
1766 "g" gnus-summary-show-article
1767 "l" gnus-summary-goto-last-article
1768 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1769 "\C-d" gnus-summary-enter-digest-group
1770 "\M-\C-d" gnus-summary-read-document
1771 "\M-\C-e" gnus-summary-edit-parameters
1772 "\M-\C-a" gnus-summary-customize-parameters
1774 "*" gnus-cache-enter-article
1775 "\M-*" gnus-cache-remove-article
1776 "\M-&" gnus-summary-universal-argument
1777 "\C-l" gnus-recenter
1778 "I" gnus-summary-increase-score
1779 "L" gnus-summary-lower-score
1780 "\M-i" gnus-symbolic-argument
1781 "h" gnus-summary-select-article-buffer
1783 "b" gnus-article-view-part
1784 "\M-t" gnus-summary-toggle-display-buttonized
1786 "V" gnus-summary-score-map
1787 "X" gnus-uu-extract-map
1788 "S" gnus-summary-send-map)
1790 ;; Sort of orthogonal keymap
1791 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1792 "t" gnus-summary-tick-article-forward
1793 "!" gnus-summary-tick-article-forward
1794 "d" gnus-summary-mark-as-read-forward
1795 "r" gnus-summary-mark-as-read-forward
1796 "c" gnus-summary-clear-mark-forward
1797 " " gnus-summary-clear-mark-forward
1798 "e" gnus-summary-mark-as-expirable
1799 "x" gnus-summary-mark-as-expirable
1800 "?" gnus-summary-mark-as-dormant
1801 "b" gnus-summary-set-bookmark
1802 "B" gnus-summary-remove-bookmark
1803 "#" gnus-summary-mark-as-processable
1804 "\M-#" gnus-summary-unmark-as-processable
1805 "S" gnus-summary-limit-include-expunged
1806 "C" gnus-summary-catchup
1807 "H" gnus-summary-catchup-to-here
1808 "h" gnus-summary-catchup-from-here
1809 "\C-c" gnus-summary-catchup-all
1810 "k" gnus-summary-kill-same-subject-and-select
1811 "K" gnus-summary-kill-same-subject
1812 "P" gnus-uu-mark-map)
1814 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1815 "c" gnus-summary-clear-above
1816 "u" gnus-summary-tick-above
1817 "m" gnus-summary-mark-above
1818 "k" gnus-summary-kill-below)
1820 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1821 "/" gnus-summary-limit-to-subject
1822 "n" gnus-summary-limit-to-articles
1823 "w" gnus-summary-pop-limit
1824 "s" gnus-summary-limit-to-subject
1825 "a" gnus-summary-limit-to-author
1826 "u" gnus-summary-limit-to-unread
1827 "m" gnus-summary-limit-to-marks
1828 "M" gnus-summary-limit-exclude-marks
1829 "v" gnus-summary-limit-to-score
1830 "*" gnus-summary-limit-include-cached
1831 "D" gnus-summary-limit-include-dormant
1832 "T" gnus-summary-limit-include-thread
1833 "d" gnus-summary-limit-exclude-dormant
1834 "t" gnus-summary-limit-to-age
1835 "." gnus-summary-limit-to-unseen
1836 "x" gnus-summary-limit-to-extra
1837 "p" gnus-summary-limit-to-display-predicate
1838 "E" gnus-summary-limit-include-expunged
1839 "c" gnus-summary-limit-exclude-childless-dormant
1840 "C" gnus-summary-limit-mark-excluded-as-read
1841 "o" gnus-summary-insert-old-articles
1842 "N" gnus-summary-insert-new-articles
1843 "r" gnus-summary-limit-to-replied
1844 "R" gnus-summary-limit-to-recipient)
1846 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1847 "n" gnus-summary-next-unread-article
1848 "p" gnus-summary-prev-unread-article
1849 "N" gnus-summary-next-article
1850 "P" gnus-summary-prev-article
1851 "\C-n" gnus-summary-next-same-subject
1852 "\C-p" gnus-summary-prev-same-subject
1853 "\M-n" gnus-summary-next-unread-subject
1854 "\M-p" gnus-summary-prev-unread-subject
1855 "f" gnus-summary-first-unread-article
1856 "b" gnus-summary-best-unread-article
1857 "j" gnus-summary-goto-article
1858 "g" gnus-summary-goto-subject
1859 "l" gnus-summary-goto-last-article
1860 "o" gnus-summary-pop-article)
1862 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1863 "k" gnus-summary-kill-thread
1864 "l" gnus-summary-lower-thread
1865 "i" gnus-summary-raise-thread
1866 "T" gnus-summary-toggle-threads
1867 "t" gnus-summary-rethread-current
1868 "^" gnus-summary-reparent-thread
1869 "s" gnus-summary-show-thread
1870 "S" gnus-summary-show-all-threads
1871 "h" gnus-summary-hide-thread
1872 "H" gnus-summary-hide-all-threads
1873 "n" gnus-summary-next-thread
1874 "p" gnus-summary-prev-thread
1875 "u" gnus-summary-up-thread
1876 "o" gnus-summary-top-thread
1877 "d" gnus-summary-down-thread
1878 "#" gnus-uu-mark-thread
1879 "\M-#" gnus-uu-unmark-thread)
1881 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1882 "g" gnus-summary-prepare
1883 "c" gnus-summary-insert-cached-articles
1884 "d" gnus-summary-insert-dormant-articles)
1886 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1887 "c" gnus-summary-catchup-and-exit
1888 "C" gnus-summary-catchup-all-and-exit
1889 "E" gnus-summary-exit-no-update
1890 "Q" gnus-summary-exit
1891 "Z" gnus-summary-exit
1892 "n" gnus-summary-catchup-and-goto-next-group
1893 "R" gnus-summary-reselect-current-group
1894 "G" gnus-summary-rescan-group
1895 "N" gnus-summary-next-group
1896 "s" gnus-summary-save-newsrc
1897 "P" gnus-summary-prev-group)
1899 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1900 " " gnus-summary-next-page
1901 "n" gnus-summary-next-page
1902 "\177" gnus-summary-prev-page
1903 [delete] gnus-summary-prev-page
1904 "p" gnus-summary-prev-page
1905 "\r" gnus-summary-scroll-up
1906 "\M-\r" gnus-summary-scroll-down
1907 "<" gnus-summary-beginning-of-article
1908 ">" gnus-summary-end-of-article
1909 "b" gnus-summary-beginning-of-article
1910 "e" gnus-summary-end-of-article
1911 "^" gnus-summary-refer-parent-article
1912 "r" gnus-summary-refer-parent-article
1913 "D" gnus-summary-enter-digest-group
1914 "R" gnus-summary-refer-references
1915 "T" gnus-summary-refer-thread
1916 "g" gnus-summary-show-article
1917 "s" gnus-summary-isearch-article
1918 "P" gnus-summary-print-article
1919 "M" gnus-mailing-list-insinuate
1920 "t" gnus-article-babel)
1922 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1923 "b" gnus-article-add-buttons
1924 "B" gnus-article-add-buttons-to-head
1925 "o" gnus-article-treat-overstrike
1926 "e" gnus-article-emphasize
1927 "w" gnus-article-fill-cited-article
1928 "Q" gnus-article-fill-long-lines
1929 "C" gnus-article-capitalize-sentences
1930 "c" gnus-article-remove-cr
1931 "q" gnus-article-de-quoted-unreadable
1932 "6" gnus-article-de-base64-unreadable
1933 "Z" gnus-article-decode-HZ
1934 "A" gnus-article-treat-ansi-sequences
1935 "h" gnus-article-wash-html
1936 "u" gnus-article-unsplit-urls
1937 "s" gnus-summary-force-verify-and-decrypt
1938 "f" gnus-article-display-x-face
1939 "l" gnus-summary-stop-page-breaking
1940 "r" gnus-summary-caesar-message
1941 "m" gnus-summary-morse-message
1942 "t" gnus-summary-toggle-header
1943 "g" gnus-treat-smiley
1944 "v" gnus-summary-verbose-headers
1945 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1946 "p" gnus-article-verify-x-pgp-sig
1947 "d" gnus-article-treat-dumbquotes)
1949 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1950 ;; mnemonic: deuglif*Y*
1951 "u" gnus-article-outlook-unwrap-lines
1952 "a" gnus-article-outlook-repair-attribution
1953 "c" gnus-article-outlook-rearrange-citation
1954 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1956 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1957 "a" gnus-article-hide
1958 "h" gnus-article-hide-headers
1959 "b" gnus-article-hide-boring-headers
1960 "s" gnus-article-hide-signature
1961 "c" gnus-article-hide-citation
1962 "C" gnus-article-hide-citation-in-followups
1963 "l" gnus-article-hide-list-identifiers
1964 "B" gnus-article-strip-banner
1965 "P" gnus-article-hide-pem
1966 "\C-c" gnus-article-hide-citation-maybe)
1968 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1969 "a" gnus-article-highlight
1970 "h" gnus-article-highlight-headers
1971 "c" gnus-article-highlight-citation
1972 "s" gnus-article-highlight-signature)
1974 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
1975 "f" gnus-article-treat-fold-headers
1976 "u" gnus-article-treat-unfold-headers
1977 "n" gnus-article-treat-fold-newsgroups)
1979 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
1980 "x" gnus-article-display-x-face
1981 "d" gnus-article-display-face
1982 "s" gnus-treat-smiley
1983 "D" gnus-article-remove-images
1984 "f" gnus-treat-from-picon
1985 "m" gnus-treat-mail-picon
1986 "n" gnus-treat-newsgroups-picon)
1988 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
1989 "w" gnus-article-decode-mime-words
1990 "c" gnus-article-decode-charset
1991 "v" gnus-mime-view-all-parts
1992 "b" gnus-article-view-part)
1994 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
1995 "z" gnus-article-date-ut
1996 "u" gnus-article-date-ut
1997 "l" gnus-article-date-local
1998 "p" gnus-article-date-english
1999 "e" gnus-article-date-lapsed
2000 "o" gnus-article-date-original
2001 "i" gnus-article-date-iso8601
2002 "s" gnus-article-date-user)
2004 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2005 "t" gnus-article-remove-trailing-blank-lines
2006 "l" gnus-article-strip-leading-blank-lines
2007 "m" gnus-article-strip-multiple-blank-lines
2008 "a" gnus-article-strip-blank-lines
2009 "A" gnus-article-strip-all-blank-lines
2010 "s" gnus-article-strip-leading-space
2011 "e" gnus-article-strip-trailing-space
2012 "w" gnus-article-remove-leading-whitespace)
2014 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2016 "f" gnus-summary-fetch-faq
2017 "d" gnus-summary-describe-group
2018 "h" gnus-summary-describe-briefly
2019 "i" gnus-info-find-node
2020 "c" gnus-group-fetch-charter
2021 "C" gnus-group-fetch-control)
2023 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2024 "e" gnus-summary-expire-articles
2025 "\M-\C-e" gnus-summary-expire-articles-now
2026 "\177" gnus-summary-delete-article
2027 [delete] gnus-summary-delete-article
2028 [backspace] gnus-summary-delete-article
2029 "m" gnus-summary-move-article
2030 "r" gnus-summary-respool-article
2031 "w" gnus-summary-edit-article
2032 "c" gnus-summary-copy-article
2033 "B" gnus-summary-crosspost-article
2034 "q" gnus-summary-respool-query
2035 "t" gnus-summary-respool-trace
2036 "i" gnus-summary-import-article
2037 "I" gnus-summary-create-article
2038 "p" gnus-summary-article-posted-p)
2040 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2041 "o" gnus-summary-save-article
2042 "m" gnus-summary-save-article-mail
2043 "F" gnus-summary-write-article-file
2044 "r" gnus-summary-save-article-rmail
2045 "f" gnus-summary-save-article-file
2046 "b" gnus-summary-save-article-body-file
2047 "h" gnus-summary-save-article-folder
2048 "v" gnus-summary-save-article-vm
2049 "p" gnus-summary-pipe-output
2050 "P" gnus-summary-muttprint
2051 "s" gnus-soup-add-article)
2053 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2054 "b" gnus-summary-display-buttonized
2055 "m" gnus-summary-repair-multipart
2056 "v" gnus-article-view-part
2057 "o" gnus-article-save-part
2058 "c" gnus-article-copy-part
2059 "C" gnus-article-view-part-as-charset
2060 "e" gnus-article-view-part-externally
2061 "E" gnus-article-encrypt-body
2062 "i" gnus-article-inline-part
2063 "|" gnus-article-pipe-part)
2065 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2066 "p" gnus-summary-mark-as-processable
2067 "u" gnus-summary-unmark-as-processable
2068 "U" gnus-summary-unmark-all-processable
2069 "v" gnus-uu-mark-over
2070 "s" gnus-uu-mark-series
2071 "r" gnus-uu-mark-region
2072 "g" gnus-uu-unmark-region
2073 "R" gnus-uu-mark-by-regexp
2074 "G" gnus-uu-unmark-by-regexp
2075 "t" gnus-uu-mark-thread
2076 "T" gnus-uu-unmark-thread
2077 "a" gnus-uu-mark-all
2078 "b" gnus-uu-mark-buffer
2079 "S" gnus-uu-mark-sparse
2080 "k" gnus-summary-kill-process-mark
2081 "y" gnus-summary-yank-process-mark
2082 "w" gnus-summary-save-process-mark
2083 "i" gnus-uu-invert-processable)
2085 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2086 ;;"x" gnus-uu-extract-any
2087 "m" gnus-summary-save-parts
2088 "u" gnus-uu-decode-uu
2089 "U" gnus-uu-decode-uu-and-save
2090 "s" gnus-uu-decode-unshar
2091 "S" gnus-uu-decode-unshar-and-save
2092 "o" gnus-uu-decode-save
2093 "O" gnus-uu-decode-save
2094 "b" gnus-uu-decode-binhex
2095 "B" gnus-uu-decode-binhex
2096 "p" gnus-uu-decode-postscript
2097 "P" gnus-uu-decode-postscript-and-save)
2100 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2101 "u" gnus-uu-decode-uu-view
2102 "U" gnus-uu-decode-uu-and-save-view
2103 "s" gnus-uu-decode-unshar-view
2104 "S" gnus-uu-decode-unshar-and-save-view
2105 "o" gnus-uu-decode-save-view
2106 "O" gnus-uu-decode-save-view
2107 "b" gnus-uu-decode-binhex-view
2108 "B" gnus-uu-decode-binhex-view
2109 "p" gnus-uu-decode-postscript-view
2110 "P" gnus-uu-decode-postscript-and-save-view)
2112 (defvar gnus-article-post-menu nil)
2114 (defconst gnus-summary-menu-maxlen 20)
2116 (defun gnus-summary-menu-split (menu)
2117 ;; If we have lots of elements, divide them into groups of 20
2118 ;; and make a pane (or submenu) for each one.
2119 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2120 (let ((menu menu) sublists next
2123 ;; Pull off the next gnus-summary-menu-maxlen elements
2124 ;; and make them the next element of sublist.
2125 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2127 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2129 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2130 (aref (car (last menu)) 0)) menu)
2134 (nreverse sublists))
2135 ;; Few elements--put them all in one pane.
2138 (defun gnus-summary-make-menu-bar ()
2139 (gnus-turn-off-edit-menu 'summary)
2141 (unless (boundp 'gnus-summary-misc-menu)
2144 gnus-summary-kill-menu gnus-summary-mode-map ""
2149 ["Customize" gnus-score-customize t])
2150 (gnus-make-score-map 'increase)
2151 (gnus-make-score-map 'lower)
2153 ["Kill below" gnus-summary-kill-below t]
2154 ["Mark above" gnus-summary-mark-above t]
2155 ["Tick above" gnus-summary-tick-above t]
2156 ["Clear above" gnus-summary-clear-above t])
2157 ["Current score" gnus-summary-current-score t]
2158 ["Set score" gnus-summary-set-score t]
2159 ["Switch current score file..." gnus-score-change-score-file t]
2160 ["Set mark below..." gnus-score-set-mark-below t]
2161 ["Set expunge below..." gnus-score-set-expunge-below t]
2162 ["Edit current score file" gnus-score-edit-current-scores t]
2163 ["Edit score file" gnus-score-edit-file t]
2164 ["Trace score" gnus-score-find-trace t]
2165 ["Find words" gnus-score-find-favourite-words t]
2166 ["Rescore buffer" gnus-summary-rescore t]
2167 ["Increase score..." gnus-summary-increase-score t]
2168 ["Lower score..." gnus-summary-lower-score t]))))
2170 ;; Define both the Article menu in the summary buffer and the
2171 ;; equivalent Commands menu in the article buffer here for
2175 ["All" gnus-article-hide t]
2176 ["Headers" gnus-article-hide-headers t]
2177 ["Signature" gnus-article-hide-signature t]
2178 ["Citation" gnus-article-hide-citation t]
2179 ["List identifiers" gnus-article-hide-list-identifiers t]
2180 ["Banner" gnus-article-strip-banner t]
2181 ["Boring headers" gnus-article-hide-boring-headers t])
2183 ["All" gnus-article-highlight t]
2184 ["Headers" gnus-article-highlight-headers t]
2185 ["Signature" gnus-article-highlight-signature t]
2186 ["Citation" gnus-article-highlight-citation t])
2188 ["Words" gnus-article-decode-mime-words t]
2189 ["Charset" gnus-article-decode-charset t]
2190 ["QP" gnus-article-de-quoted-unreadable t]
2191 ["Base64" gnus-article-de-base64-unreadable t]
2192 ["View MIME buttons" gnus-summary-display-buttonized t]
2193 ["View all" gnus-mime-view-all-parts t]
2194 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2195 ["Encrypt body" gnus-article-encrypt-body
2196 :active (not (gnus-group-read-only-p))
2197 ,@(if (featurep 'xemacs) nil
2198 '(:help "Encrypt the message body on disk"))]
2199 ["Extract all parts..." gnus-summary-save-parts t]
2201 ["Repair multipart" gnus-summary-repair-multipart t]
2202 ["Pipe part..." gnus-article-pipe-part t]
2203 ["Inline part" gnus-article-inline-part t]
2204 ["Encrypt body" gnus-article-encrypt-body
2205 :active (not (gnus-group-read-only-p))
2206 ,@(if (featurep 'xemacs) nil
2207 '(:help "Encrypt the message body on disk"))]
2208 ["View part externally" gnus-article-view-part-externally t]
2209 ["View part with charset..." gnus-article-view-part-as-charset t]
2210 ["Copy part" gnus-article-copy-part t]
2211 ["Save part..." gnus-article-save-part t]
2212 ["View part" gnus-article-view-part t]))
2214 ["Local" gnus-article-date-local t]
2215 ["ISO8601" gnus-article-date-iso8601 t]
2216 ["UT" gnus-article-date-ut t]
2217 ["Original" gnus-article-date-original t]
2218 ["Lapsed" gnus-article-date-lapsed t]
2219 ["User-defined" gnus-article-date-user t])
2221 ["Remove images" gnus-article-remove-images t]
2222 ["Toggle smiley" gnus-treat-smiley t]
2223 ["Show X-Face" gnus-article-display-x-face t]
2224 ["Show picons in From" gnus-treat-from-picon t]
2225 ["Show picons in mail headers" gnus-treat-mail-picon t]
2226 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2227 ("View as different encoding"
2228 ,@(gnus-summary-menu-split
2231 ;; Since easymenu under Emacs doesn't allow
2232 ;; lambda forms for menu commands, we should
2233 ;; provide intern'ed function symbols.
2234 (let ((command (intern (format "\
2235 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2239 (let ((gnus-summary-show-article-charset-alist
2241 (gnus-summary-show-article 1))))
2242 `[,(symbol-name cs) ,command t]))
2243 (sort (if (fboundp 'coding-system-list)
2244 (coding-system-list)
2245 (mapcar 'car mm-mime-mule-charset-alist))
2249 ["Leading" gnus-article-strip-leading-blank-lines t]
2250 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2251 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2252 ["All of the above" gnus-article-strip-blank-lines t]
2253 ["All" gnus-article-strip-all-blank-lines t]
2254 ["Leading space" gnus-article-strip-leading-space t]
2255 ["Trailing space" gnus-article-strip-trailing-space t]
2256 ["Leading space in headers"
2257 gnus-article-remove-leading-whitespace t])
2258 ["Overstrike" gnus-article-treat-overstrike t]
2259 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2260 ["Emphasis" gnus-article-emphasize t]
2261 ["Word wrap" gnus-article-fill-cited-article t]
2262 ["Fill long lines" gnus-article-fill-long-lines t]
2263 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2264 ["Remove CR" gnus-article-remove-cr t]
2265 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2266 ["Base64" gnus-article-de-base64-unreadable t]
2267 ["Rot 13" gnus-summary-caesar-message
2268 ,@(if (featurep 'xemacs) '(t)
2269 '(:help "\"Caesar rotate\" article by 13"))]
2270 ["Morse decode" gnus-summary-morse-message t]
2271 ["Unix pipe..." gnus-summary-pipe-message t]
2272 ["Add buttons" gnus-article-add-buttons t]
2273 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2274 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2275 ["Verbose header" gnus-summary-verbose-headers t]
2276 ["Toggle header" gnus-summary-toggle-header t]
2277 ["Unfold headers" gnus-article-treat-unfold-headers t]
2278 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2279 ["Html" gnus-article-wash-html t]
2280 ["Unsplit URLs" gnus-article-unsplit-urls t]
2281 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2282 ["Decode HZ" gnus-article-decode-HZ t]
2283 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2284 ("(Outlook) Deuglify"
2285 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2286 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2287 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2288 ["Full (Outlook) deuglify"
2289 gnus-article-outlook-deuglify-article t])
2292 ["Save in default format..." gnus-summary-save-article
2293 ,@(if (featurep 'xemacs) '(t)
2294 '(:help "Save article using default method"))]
2295 ["Save in file..." gnus-summary-save-article-file
2296 ,@(if (featurep 'xemacs) '(t)
2297 '(:help "Save article in file"))]
2298 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2299 ["Save in MH folder..." gnus-summary-save-article-folder t]
2300 ["Save in VM folder..." gnus-summary-save-article-vm t]
2301 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2302 ["Save body in file..." gnus-summary-save-article-body-file t]
2303 ["Pipe through a filter..." gnus-summary-pipe-output t]
2304 ["Add to SOUP packet" gnus-soup-add-article t]
2305 ["Print with Muttprint..." gnus-summary-muttprint t]
2306 ["Print" gnus-summary-print-article
2307 ,@(if (featurep 'xemacs) '(t)
2308 '(:help "Generate and print a PostScript image"))])
2309 ("Copy, move,... (Backend)"
2310 ,@(if (featurep 'xemacs) nil
2311 '(:help "Copying, moving, expiring articles..."))
2312 ["Respool article..." gnus-summary-respool-article t]
2313 ["Move article..." gnus-summary-move-article
2314 (gnus-check-backend-function
2315 'request-move-article gnus-newsgroup-name)]
2316 ["Copy article..." gnus-summary-copy-article t]
2317 ["Crosspost article..." gnus-summary-crosspost-article
2318 (gnus-check-backend-function
2319 'request-replace-article gnus-newsgroup-name)]
2320 ["Import file..." gnus-summary-import-article
2321 (gnus-check-backend-function
2322 'request-accept-article gnus-newsgroup-name)]
2323 ["Create article..." gnus-summary-create-article
2324 (gnus-check-backend-function
2325 'request-accept-article gnus-newsgroup-name)]
2326 ["Check if posted" gnus-summary-article-posted-p t]
2327 ["Edit article" gnus-summary-edit-article
2328 (not (gnus-group-read-only-p))]
2329 ["Delete article" gnus-summary-delete-article
2330 (gnus-check-backend-function
2331 'request-expire-articles gnus-newsgroup-name)]
2332 ["Query respool" gnus-summary-respool-query t]
2333 ["Trace respool" gnus-summary-respool-trace t]
2334 ["Delete expirable articles" gnus-summary-expire-articles-now
2335 (gnus-check-backend-function
2336 'request-expire-articles gnus-newsgroup-name)])
2338 ["Uudecode" gnus-uu-decode-uu
2339 ,@(if (featurep 'xemacs) '(t)
2340 '(:help "Decode uuencoded article(s)"))]
2341 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2342 ["Unshar" gnus-uu-decode-unshar t]
2343 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2344 ["Save" gnus-uu-decode-save t]
2345 ["Binhex" gnus-uu-decode-binhex t]
2346 ["Postscript" gnus-uu-decode-postscript t]
2347 ["All MIME parts" gnus-summary-save-parts t])
2349 ["Enter article" gnus-cache-enter-article t]
2350 ["Remove article" gnus-cache-remove-article t])
2351 ["Translate" gnus-article-babel t]
2352 ["Select article buffer" gnus-summary-select-article-buffer t]
2353 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2354 ["Isearch article..." gnus-summary-isearch-article t]
2355 ["Beginning of the article" gnus-summary-beginning-of-article t]
2356 ["End of the article" gnus-summary-end-of-article t]
2357 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2358 ["Fetch referenced articles" gnus-summary-refer-references t]
2359 ["Fetch current thread" gnus-summary-refer-thread t]
2360 ["Fetch article with id..." gnus-summary-refer-article t]
2361 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2362 ["Redisplay" gnus-summary-show-article t]
2363 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2365 gnus-summary-article-menu gnus-summary-mode-map ""
2366 (cons "Article" innards))
2368 (if (not (keymapp gnus-summary-article-menu))
2370 gnus-article-commands-menu gnus-article-mode-map ""
2371 (cons "Commands" innards))
2372 ;; in Emacs, don't share menu.
2373 (setq gnus-article-commands-menu
2374 (copy-keymap gnus-summary-article-menu))
2375 (define-key gnus-article-mode-map [menu-bar commands]
2376 (cons "Commands" gnus-article-commands-menu))))
2379 gnus-summary-thread-menu gnus-summary-mode-map ""
2381 ["Find all messages in thread" gnus-summary-refer-thread t]
2382 ["Toggle threading" gnus-summary-toggle-threads t]
2383 ["Hide threads" gnus-summary-hide-all-threads t]
2384 ["Show threads" gnus-summary-show-all-threads t]
2385 ["Hide thread" gnus-summary-hide-thread t]
2386 ["Show thread" gnus-summary-show-thread t]
2387 ["Go to next thread" gnus-summary-next-thread t]
2388 ["Go to previous thread" gnus-summary-prev-thread t]
2389 ["Go down thread" gnus-summary-down-thread t]
2390 ["Go up thread" gnus-summary-up-thread t]
2391 ["Top of thread" gnus-summary-top-thread t]
2392 ["Mark thread as read" gnus-summary-kill-thread t]
2393 ["Lower thread score" gnus-summary-lower-thread t]
2394 ["Raise thread score" gnus-summary-raise-thread t]
2395 ["Rethread current" gnus-summary-rethread-current t]))
2398 gnus-summary-post-menu gnus-summary-mode-map ""
2400 ["Send a message (mail or news)" gnus-summary-post-news
2401 ,@(if (featurep 'xemacs) '(t)
2402 '(:help "Compose a new message (mail or news)"))]
2403 ["Followup" gnus-summary-followup
2404 ,@(if (featurep 'xemacs) '(t)
2405 '(:help "Post followup to this article"))]
2406 ["Followup and yank" gnus-summary-followup-with-original
2407 ,@(if (featurep 'xemacs) '(t)
2408 '(:help "Post followup to this article, quoting its contents"))]
2409 ["Supersede article" gnus-summary-supersede-article t]
2410 ["Cancel article" gnus-summary-cancel-article
2411 ,@(if (featurep 'xemacs) '(t)
2412 '(:help "Cancel an article you posted"))]
2413 ["Reply" gnus-summary-reply t]
2414 ["Reply and yank" gnus-summary-reply-with-original t]
2415 ["Wide reply" gnus-summary-wide-reply t]
2416 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2417 ,@(if (featurep 'xemacs) '(t)
2418 '(:help "Mail a reply, quoting this article"))]
2419 ["Very wide reply" gnus-summary-very-wide-reply t]
2420 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2421 ,@(if (featurep 'xemacs) '(t)
2422 '(:help "Mail a very wide reply, quoting this article"))]
2423 ["Mail forward" gnus-summary-mail-forward t]
2424 ["Post forward" gnus-summary-post-forward t]
2425 ["Digest and mail" gnus-uu-digest-mail-forward t]
2426 ["Digest and post" gnus-uu-digest-post-forward t]
2427 ["Resend message" gnus-summary-resend-message t]
2428 ["Resend message edit" gnus-summary-resend-message-edit t]
2429 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2430 ["Send a mail" gnus-summary-mail-other-window t]
2431 ["Create a local message" gnus-summary-news-other-window t]
2432 ["Uuencode and post" gnus-uu-post-news
2433 ,@(if (featurep 'xemacs) '(t)
2434 '(:help "Post a uuencoded article"))]
2435 ["Followup via news" gnus-summary-followup-to-mail t]
2436 ["Followup via news and yank"
2437 gnus-summary-followup-to-mail-with-original t]
2439 ;;["Send" gnus-summary-send-draft t]
2440 ;;["Send bounced" gnus-resend-bounced-mail t])
2444 ((not (keymapp gnus-summary-post-menu))
2445 (setq gnus-article-post-menu gnus-summary-post-menu))
2446 ((not gnus-article-post-menu)
2447 ;; Don't share post menu.
2448 (setq gnus-article-post-menu
2449 (copy-keymap gnus-summary-post-menu))))
2450 (define-key gnus-article-mode-map [menu-bar post]
2451 (cons "Post" gnus-article-post-menu))
2454 gnus-summary-misc-menu gnus-summary-mode-map ""
2457 ["Mark as read" gnus-summary-mark-as-read-forward t]
2458 ["Mark same subject and select"
2459 gnus-summary-kill-same-subject-and-select t]
2460 ["Mark same subject" gnus-summary-kill-same-subject t]
2461 ["Catchup" gnus-summary-catchup
2462 ,@(if (featurep 'xemacs) '(t)
2463 '(:help "Mark unread articles in this group as read"))]
2464 ["Catchup all" gnus-summary-catchup-all t]
2465 ["Catchup to here" gnus-summary-catchup-to-here t]
2466 ["Catchup from here" gnus-summary-catchup-from-here t]
2467 ["Catchup region" gnus-summary-mark-region-as-read
2468 (gnus-mark-active-p)]
2469 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2471 ["Tick" gnus-summary-tick-article-forward t]
2472 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2473 ["Remove marks" gnus-summary-clear-mark-forward t]
2474 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2475 ["Set bookmark" gnus-summary-set-bookmark t]
2476 ["Remove bookmark" gnus-summary-remove-bookmark t])
2478 ["Marks..." gnus-summary-limit-to-marks t]
2479 ["Subject..." gnus-summary-limit-to-subject t]
2480 ["Author..." gnus-summary-limit-to-author t]
2481 ["Recipient..." gnus-summary-limit-to-recipient t]
2482 ["Age..." gnus-summary-limit-to-age t]
2483 ["Extra..." gnus-summary-limit-to-extra t]
2484 ["Score..." gnus-summary-limit-to-score t]
2485 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2486 ["Unread" gnus-summary-limit-to-unread t]
2487 ["Unseen" gnus-summary-limit-to-unseen t]
2488 ["Replied" gnus-summary-limit-to-replied t]
2489 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2490 ["Next articles" gnus-summary-limit-to-articles t]
2491 ["Pop limit" gnus-summary-pop-limit t]
2492 ["Show dormant" gnus-summary-limit-include-dormant t]
2493 ["Hide childless dormant"
2494 gnus-summary-limit-exclude-childless-dormant t]
2495 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2496 ["Hide marked" gnus-summary-limit-exclude-marks t]
2497 ["Show expunged" gnus-summary-limit-include-expunged t])
2499 ["Set mark" gnus-summary-mark-as-processable t]
2500 ["Remove mark" gnus-summary-unmark-as-processable t]
2501 ["Remove all marks" gnus-summary-unmark-all-processable t]
2502 ["Invert marks" gnus-uu-invert-processable t]
2503 ["Mark above" gnus-uu-mark-over t]
2504 ["Mark series" gnus-uu-mark-series t]
2505 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2506 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2507 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2508 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2509 ["Mark all" gnus-uu-mark-all t]
2510 ["Mark buffer" gnus-uu-mark-buffer t]
2511 ["Mark sparse" gnus-uu-mark-sparse t]
2512 ["Mark thread" gnus-uu-mark-thread t]
2513 ["Unmark thread" gnus-uu-unmark-thread t]
2514 ("Process Mark Sets"
2515 ["Kill" gnus-summary-kill-process-mark t]
2516 ["Yank" gnus-summary-yank-process-mark
2517 gnus-newsgroup-process-stack]
2518 ["Save" gnus-summary-save-process-mark t]
2519 ["Run command on marked..." gnus-summary-universal-argument t]))
2521 ["Page forward" gnus-summary-next-page
2522 ,@(if (featurep 'xemacs) '(t)
2523 '(:help "Show next page of article"))]
2524 ["Page backward" gnus-summary-prev-page
2525 ,@(if (featurep 'xemacs) '(t)
2526 '(:help "Show previous page of article"))]
2527 ["Line forward" gnus-summary-scroll-up t])
2529 ["Next unread article" gnus-summary-next-unread-article t]
2530 ["Previous unread article" gnus-summary-prev-unread-article t]
2531 ["Next article" gnus-summary-next-article t]
2532 ["Previous article" gnus-summary-prev-article t]
2533 ["Next unread subject" gnus-summary-next-unread-subject t]
2534 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2535 ["Next article same subject" gnus-summary-next-same-subject t]
2536 ["Previous article same subject" gnus-summary-prev-same-subject t]
2537 ["First unread article" gnus-summary-first-unread-article t]
2538 ["Best unread article" gnus-summary-best-unread-article t]
2539 ["Go to subject number..." gnus-summary-goto-subject t]
2540 ["Go to article number..." gnus-summary-goto-article t]
2541 ["Go to the last article" gnus-summary-goto-last-article t]
2542 ["Pop article off history" gnus-summary-pop-article t])
2544 ["Sort by number" gnus-summary-sort-by-number t]
2545 ["Sort by author" gnus-summary-sort-by-author t]
2546 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2547 ["Sort by subject" gnus-summary-sort-by-subject t]
2548 ["Sort by date" gnus-summary-sort-by-date t]
2549 ["Sort by score" gnus-summary-sort-by-score t]
2550 ["Sort by lines" gnus-summary-sort-by-lines t]
2551 ["Sort by characters" gnus-summary-sort-by-chars t]
2552 ["Randomize" gnus-summary-sort-by-random t]
2553 ["Original sort" gnus-summary-sort-by-original t])
2555 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2556 ["Describe group" gnus-summary-describe-group t]
2557 ["Fetch charter" gnus-group-fetch-charter
2558 ,@(if (featurep 'xemacs) nil
2559 '(:help "Display the charter of the current group"))]
2560 ["Fetch control message" gnus-group-fetch-control
2561 ,@(if (featurep 'xemacs) nil
2562 '(:help "Display the archived control message for the current group"))]
2563 ["Read manual" gnus-info-find-node t])
2565 ["Pick and read" gnus-pick-mode t]
2566 ["Binary" gnus-binary-mode t])
2568 ["Regenerate" gnus-summary-prepare t]
2569 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2570 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2571 ["Toggle threading" gnus-summary-toggle-threads t])
2572 ["See old articles" gnus-summary-insert-old-articles t]
2573 ["See new articles" gnus-summary-insert-new-articles t]
2574 ["Filter articles..." gnus-summary-execute-command t]
2575 ["Run command on articles..." gnus-summary-universal-argument t]
2576 ["Search articles forward..." gnus-summary-search-article-forward t]
2577 ["Search articles backward..." gnus-summary-search-article-backward t]
2578 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2579 ["Expand window" gnus-summary-expand-window t]
2580 ["Expire expirable articles" gnus-summary-expire-articles
2581 (gnus-check-backend-function
2582 'request-expire-articles gnus-newsgroup-name)]
2583 ["Edit local kill file" gnus-summary-edit-local-kill t]
2584 ["Edit main kill file" gnus-summary-edit-global-kill t]
2585 ["Edit group parameters" gnus-summary-edit-parameters t]
2586 ["Customize group parameters" gnus-summary-customize-parameters t]
2587 ["Send a bug report" gnus-bug t]
2589 ["Catchup and exit" gnus-summary-catchup-and-exit
2590 ,@(if (featurep 'xemacs) '(t)
2591 '(:help "Mark unread articles in this group as read, then exit"))]
2592 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2593 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2594 ["Exit group" gnus-summary-exit
2595 ,@(if (featurep 'xemacs) '(t)
2596 '(:help "Exit current group, return to group selection mode"))]
2597 ["Exit group without updating" gnus-summary-exit-no-update t]
2598 ["Exit and goto next group" gnus-summary-next-group t]
2599 ["Exit and goto prev group" gnus-summary-prev-group t]
2600 ["Reselect group" gnus-summary-reselect-current-group t]
2601 ["Rescan group" gnus-summary-rescan-group t]
2602 ["Update dribble" gnus-summary-save-newsrc t])))
2604 (gnus-run-hooks 'gnus-summary-menu-hook)))
2606 (defvar gnus-summary-tool-bar-map nil)
2608 ;; Emacs 21 tool bar. Should be no-op otherwise.
2609 (defun gnus-summary-make-tool-bar ()
2610 (if (and (fboundp 'tool-bar-add-item-from-menu)
2611 (default-value 'tool-bar-mode)
2612 (not gnus-summary-tool-bar-map))
2613 (setq gnus-summary-tool-bar-map
2614 (let ((tool-bar-map (make-sparse-keymap))
2615 (load-path (mm-image-load-path)))
2616 (tool-bar-add-item-from-menu
2617 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map)
2618 (tool-bar-add-item-from-menu
2619 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map)
2620 (tool-bar-add-item-from-menu
2621 'gnus-summary-post-news "post" gnus-summary-mode-map)
2622 (tool-bar-add-item-from-menu
2623 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map)
2624 (tool-bar-add-item-from-menu
2625 'gnus-summary-followup "followup" gnus-summary-mode-map)
2626 (tool-bar-add-item-from-menu
2627 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map)
2628 (tool-bar-add-item-from-menu
2629 'gnus-summary-reply "reply" gnus-summary-mode-map)
2630 (tool-bar-add-item-from-menu
2631 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map)
2632 (tool-bar-add-item-from-menu
2633 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map)
2634 (tool-bar-add-item-from-menu
2635 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map)
2636 (tool-bar-add-item-from-menu
2637 'gnus-summary-save-article "save-art" gnus-summary-mode-map)
2638 (tool-bar-add-item-from-menu
2639 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2640 (tool-bar-add-item-from-menu
2641 'gnus-uu-post-news "uu-post" gnus-summary-mode-map)
2642 (tool-bar-add-item-from-menu
2643 'gnus-summary-catchup "catchup" gnus-summary-mode-map)
2644 (tool-bar-add-item-from-menu
2645 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map)
2646 (tool-bar-add-item-from-menu
2647 'gnus-summary-exit "exit-summ" gnus-summary-mode-map)
2649 (if gnus-summary-tool-bar-map
2650 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)))
2652 (defun gnus-score-set-default (var value)
2653 "A version of set that updates the GNU Emacs menu-bar."
2655 ;; It is the message that forces the active status to be updated.
2658 (defun gnus-make-score-map (type)
2659 "Make a summary score map of type TYPE."
2662 (let ((headers '(("author" "from" string)
2663 ("subject" "subject" string)
2664 ("article body" "body" string)
2665 ("article head" "head" string)
2666 ("xref" "xref" string)
2667 ("extra header" "extra" string)
2668 ("lines" "lines" number)
2669 ("followups to author" "followup" string)))
2670 (types '((number ("less than" <)
2673 (string ("substring" s)
2677 (perms '(("temporary" (current-time-string))
2685 (if (eq type 'lower)
2690 (setq header (car headers))
2696 (let ((ts (cdr (assoc (nth 2 header) types)))
2712 'gnus-summary-score-entry
2714 (if (or (string= (nth 1 header)
2716 (string= (nth 1 header)
2719 (list 'gnus-summary-header
2721 (list 'quote (nth 1 (car ts)))
2722 (list 'gnus-score-delta-default
2729 (list (nreverse outp))))
2732 (list (nreverse outt))))
2734 (setq headers (cdr headers)))
2735 (list (nreverse outh))))))))
2739 (defun gnus-summary-mode (&optional group)
2740 "Major mode for reading articles.
2742 All normal editing commands are switched off.
2743 \\<gnus-summary-mode-map>
2744 Each line in this buffer represents one article. To read an
2745 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2746 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2749 You can also post articles and send mail from this buffer. To
2750 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2751 of an article, type `\\[gnus-summary-reply]'.
2753 There are approx. one gazillion commands you can execute in this
2754 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2756 The following commands are available:
2758 \\{gnus-summary-mode-map}"
2760 (kill-all-local-variables)
2761 (when (gnus-visual-p 'summary-menu 'menu)
2762 (gnus-summary-make-menu-bar)
2763 (gnus-summary-make-tool-bar))
2764 (gnus-summary-make-local-variables)
2765 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2766 (gnus-summary-make-local-variables))
2767 (gnus-make-thread-indent-array)
2768 (gnus-simplify-mode-line)
2769 (setq major-mode 'gnus-summary-mode)
2770 (setq mode-name "Summary")
2771 (make-local-variable 'minor-mode-alist)
2772 (use-local-map gnus-summary-mode-map)
2773 (buffer-disable-undo)
2774 (setq buffer-read-only t ;Disable modification
2775 show-trailing-whitespace nil)
2776 (setq truncate-lines t)
2777 (setq selective-display t)
2778 (setq selective-display-ellipses t) ;Display `...'
2779 (gnus-summary-set-display-table)
2780 (gnus-set-default-directory)
2781 (setq gnus-newsgroup-name group)
2782 (make-local-variable 'gnus-summary-line-format)
2783 (make-local-variable 'gnus-summary-line-format-spec)
2784 (make-local-variable 'gnus-summary-dummy-line-format)
2785 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2786 (make-local-variable 'gnus-summary-mark-positions)
2787 (gnus-make-local-hook 'pre-command-hook)
2788 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2789 (gnus-run-hooks 'gnus-summary-mode-hook)
2790 (turn-on-gnus-mailing-list-mode)
2791 (mm-enable-multibyte)
2792 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2793 (gnus-update-summary-mark-positions))
2795 (defun gnus-summary-make-local-variables ()
2796 "Make all the local summary buffer variables."
2798 (dolist (local gnus-summary-local-variables)
2801 (if (eq (cdr local) 'global)
2802 ;; Copy the global value of the variable.
2803 (setq global (symbol-value (car local)))
2804 ;; Use the value from the list.
2805 (setq global (eval (cdr local))))
2806 (set (make-local-variable (car local)) global))
2807 ;; Simple nil-valued local variable.
2808 (set (make-local-variable local) nil)))))
2810 (defun gnus-summary-clear-local-variables ()
2811 (let ((locals gnus-summary-local-variables))
2813 (if (consp (car locals))
2814 (and (symbolp (caar locals))
2815 (set (caar locals) nil))
2816 (and (symbolp (car locals))
2817 (set (car locals) nil)))
2818 (setq locals (cdr locals)))))
2820 ;; Summary data functions.
2822 (defmacro gnus-data-number (data)
2825 (defmacro gnus-data-set-number (data number)
2826 `(setcar ,data ,number))
2828 (defmacro gnus-data-mark (data)
2831 (defmacro gnus-data-set-mark (data mark)
2832 `(setcar (nthcdr 1 ,data) ,mark))
2834 (defmacro gnus-data-pos (data)
2837 (defmacro gnus-data-set-pos (data pos)
2838 `(setcar (nthcdr 2 ,data) ,pos))
2840 (defmacro gnus-data-header (data)
2843 (defmacro gnus-data-set-header (data header)
2844 `(setf (nth 3 ,data) ,header))
2846 (defmacro gnus-data-level (data)
2849 (defmacro gnus-data-unread-p (data)
2850 `(= (nth 1 ,data) gnus-unread-mark))
2852 (defmacro gnus-data-read-p (data)
2853 `(/= (nth 1 ,data) gnus-unread-mark))
2855 (defmacro gnus-data-pseudo-p (data)
2856 `(consp (nth 3 ,data)))
2858 (defmacro gnus-data-find (number)
2859 `(assq ,number gnus-newsgroup-data))
2861 (defmacro gnus-data-find-list (number &optional data)
2862 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2863 (memq (assq ,number bdata)
2866 (defmacro gnus-data-make (number mark pos header level)
2867 `(list ,number ,mark ,pos ,header ,level))
2869 (defun gnus-data-enter (after-article number mark pos header level offset)
2870 (let ((data (gnus-data-find-list after-article)))
2872 (error "No such article: %d" after-article))
2873 (setcdr data (cons (gnus-data-make number mark pos header level)
2875 (setq gnus-newsgroup-data-reverse nil)
2876 (gnus-data-update-list (cddr data) offset)))
2878 (defun gnus-data-enter-list (after-article list &optional offset)
2880 (let ((data (and after-article (gnus-data-find-list after-article)))
2884 (let ((odata gnus-newsgroup-data))
2885 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
2887 (gnus-data-update-list odata offset)))
2888 ;; Find the last element in the list to be spliced into the main
2890 (setq list (last list))
2893 (setcdr list gnus-newsgroup-data)
2894 (setq gnus-newsgroup-data ilist)
2896 (gnus-data-update-list (cdr list) offset)))
2897 (setcdr list (cdr data))
2900 (gnus-data-update-list (cdr list) offset))))
2901 (setq gnus-newsgroup-data-reverse nil))))
2903 (defun gnus-data-remove (article &optional offset)
2904 (let ((data gnus-newsgroup-data))
2905 (if (= (gnus-data-number (car data)) article)
2907 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
2908 gnus-newsgroup-data-reverse nil)
2910 (gnus-data-update-list gnus-newsgroup-data offset)))
2912 (when (= (gnus-data-number (cadr data)) article)
2913 (setcdr data (cddr data))
2915 (gnus-data-update-list (cdr data) offset))
2917 gnus-newsgroup-data-reverse nil))
2918 (setq data (cdr data))))))
2920 (defmacro gnus-data-list (backward)
2922 (or gnus-newsgroup-data-reverse
2923 (setq gnus-newsgroup-data-reverse
2924 (reverse gnus-newsgroup-data)))
2925 gnus-newsgroup-data))
2927 (defun gnus-data-update-list (data offset)
2928 "Add OFFSET to the POS of all data entries in DATA."
2929 (setq gnus-newsgroup-data-reverse nil)
2931 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
2932 (setq data (cdr data))))
2934 (defun gnus-summary-article-pseudo-p (article)
2935 "Say whether this article is a pseudo article or not."
2936 (not (vectorp (gnus-data-header (gnus-data-find article)))))
2938 (defmacro gnus-summary-article-sparse-p (article)
2939 "Say whether this article is a sparse article or not."
2940 `(memq ,article gnus-newsgroup-sparse))
2942 (defmacro gnus-summary-article-ancient-p (article)
2943 "Say whether this article is a sparse article or not."
2944 `(memq ,article gnus-newsgroup-ancient))
2946 (defun gnus-article-parent-p (number)
2947 "Say whether this article is a parent or not."
2948 (let ((data (gnus-data-find-list number)))
2949 (and (cdr data) ; There has to be an article after...
2950 (< (gnus-data-level (car data)) ; And it has to have a higher level.
2951 (gnus-data-level (nth 1 data))))))
2953 (defun gnus-article-children (number)
2954 "Return a list of all children to NUMBER."
2955 (let* ((data (gnus-data-find-list number))
2956 (level (gnus-data-level (car data)))
2958 (setq data (cdr data))
2960 (= (gnus-data-level (car data)) (1+ level)))
2961 (push (gnus-data-number (car data)) children)
2962 (setq data (cdr data)))
2965 (defmacro gnus-summary-skip-intangible ()
2966 "If the current article is intangible, then jump to a different article."
2967 '(let ((to (get-text-property (point) 'gnus-intangible)))
2968 (and to (gnus-summary-goto-subject to))))
2970 (defmacro gnus-summary-article-intangible-p ()
2971 "Say whether this article is intangible or not."
2972 '(get-text-property (point) 'gnus-intangible))
2974 (defun gnus-article-read-p (article)
2975 "Say whether ARTICLE is read or not."
2976 (not (or (memq article gnus-newsgroup-marked)
2977 (memq article gnus-newsgroup-spam-marked)
2978 (memq article gnus-newsgroup-unreads)
2979 (memq article gnus-newsgroup-unselected)
2980 (memq article gnus-newsgroup-dormant))))
2982 ;; Some summary mode macros.
2984 (defmacro gnus-summary-article-number ()
2985 "The article number of the article on the current line.
2986 If there isn't an article number here, then we return the current
2989 (gnus-summary-skip-intangible)
2990 (or (get-text-property (point) 'gnus-number)
2991 (gnus-summary-last-subject))))
2993 (defmacro gnus-summary-article-header (&optional number)
2994 "Return the header of article NUMBER."
2995 `(gnus-data-header (gnus-data-find
2996 ,(or number '(gnus-summary-article-number)))))
2998 (defmacro gnus-summary-thread-level (&optional number)
2999 "Return the level of thread that starts with article NUMBER."
3000 `(if (and (eq gnus-summary-make-false-root 'dummy)
3001 (get-text-property (point) 'gnus-intangible))
3003 (gnus-data-level (gnus-data-find
3004 ,(or number '(gnus-summary-article-number))))))
3006 (defmacro gnus-summary-article-mark (&optional number)
3007 "Return the mark of article NUMBER."
3008 `(gnus-data-mark (gnus-data-find
3009 ,(or number '(gnus-summary-article-number)))))
3011 (defmacro gnus-summary-article-pos (&optional number)
3012 "Return the position of the line of article NUMBER."
3013 `(gnus-data-pos (gnus-data-find
3014 ,(or number '(gnus-summary-article-number)))))
3016 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3017 (defmacro gnus-summary-article-subject (&optional number)
3018 "Return current subject string or nil if nothing."
3021 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3022 '(gnus-data-header (assq (gnus-summary-article-number)
3023 gnus-newsgroup-data)))))
3026 (mail-header-subject headers))))
3028 (defmacro gnus-summary-article-score (&optional number)
3029 "Return current article score."
3030 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3031 gnus-newsgroup-scored))
3032 gnus-summary-default-score 0))
3034 (defun gnus-summary-article-children (&optional number)
3035 "Return a list of article numbers that are children of article NUMBER."
3036 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3037 (level (gnus-data-level (car data)))
3039 (while (and (setq data (cdr data))
3040 (> (setq l (gnus-data-level (car data))) level))
3041 (and (= (1+ level) l)
3042 (push (gnus-data-number (car data))
3044 (nreverse children)))
3046 (defun gnus-summary-article-parent (&optional number)
3047 "Return the article number of the parent of article NUMBER."
3048 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3049 (gnus-data-list t)))
3050 (level (gnus-data-level (car data))))
3052 () ; This is a root.
3053 ;; We search until we find an article with a level less than
3054 ;; this one. That function has to be the parent.
3055 (while (and (setq data (cdr data))
3056 (not (< (gnus-data-level (car data)) level))))
3057 (and data (gnus-data-number (car data))))))
3059 (defun gnus-unread-mark-p (mark)
3060 "Say whether MARK is the unread mark."
3061 (= mark gnus-unread-mark))
3063 (defun gnus-read-mark-p (mark)
3064 "Say whether MARK is one of the marks that mark as read.
3065 This is all marks except unread, ticked, dormant, and expirable."
3066 (not (or (= mark gnus-unread-mark)
3067 (= mark gnus-ticked-mark)
3068 (= mark gnus-spam-mark)
3069 (= mark gnus-dormant-mark)
3070 (= mark gnus-expirable-mark))))
3072 (defmacro gnus-article-mark (number)
3073 "Return the MARK of article NUMBER.
3074 This macro should only be used when computing the mark the \"first\"
3075 time; i.e., when generating the summary lines. After that,
3076 `gnus-summary-article-mark' should be used to examine the
3079 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3080 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3081 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3082 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3083 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3084 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3085 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3086 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3087 gnus-ancient-mark))))
3089 ;; Saving hidden threads.
3091 (defmacro gnus-save-hidden-threads (&rest forms)
3092 "Save hidden threads, eval FORMS, and restore the hidden threads."
3093 (let ((config (make-symbol "config")))
3094 `(let ((,config (gnus-hidden-threads-configuration)))
3098 (gnus-restore-hidden-threads-configuration ,config)))))
3099 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3100 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3102 (defun gnus-data-compute-positions ()
3103 "Compute the positions of all articles."
3104 (setq gnus-newsgroup-data-reverse nil)
3105 (let ((data gnus-newsgroup-data))
3107 (gnus-save-hidden-threads
3108 (gnus-summary-show-all-threads)
3109 (goto-char (point-min))
3111 (while (get-text-property (point) 'gnus-intangible)
3113 (gnus-data-set-pos (car data) (+ (point) 3))
3114 (setq data (cdr data))
3115 (forward-line 1))))))
3117 (defun gnus-hidden-threads-configuration ()
3118 "Return the current hidden threads configuration."
3121 (goto-char (point-min))
3122 (while (search-forward "\r" nil t)
3123 (push (1- (point)) config))
3126 (defun gnus-restore-hidden-threads-configuration (config)
3127 "Restore hidden threads configuration from CONFIG."
3129 (let (point buffer-read-only)
3130 (while (setq point (pop config))
3131 (when (and (< point (point-max))
3133 (eq (char-after) ?\n))
3134 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3136 ;; Various summary mode internalish functions.
3138 (defun gnus-mouse-pick-article (e)
3141 (gnus-summary-next-page nil t))
3143 (defun gnus-summary-set-display-table ()
3144 "Change the display table.
3145 Odd characters have a tendency to mess
3146 up nicely formatted displays - we make all possible glyphs
3147 display only a single character."
3149 ;; We start from the standard display table, if any.
3150 (let ((table (or (copy-sequence standard-display-table)
3151 (make-display-table)))
3153 ;; Nix out all the control chars...
3154 (while (>= (setq i (1- i)) 0)
3155 (aset table i [??]))
3156 ;; ... but not newline and cr, of course. (cr is necessary for the
3157 ;; selective display).
3158 (aset table ?\n nil)
3159 (aset table ?\r nil)
3160 ;; We keep TAB as well.
3161 (aset table ?\t nil)
3162 ;; We nix out any glyphs over 126 that are not set already.
3164 (while (>= (setq i (1- i)) 127)
3165 ;; Only modify if the entry is nil.
3166 (unless (aref table i)
3167 (aset table i [??]))))
3168 (setq buffer-display-table table)))
3170 (defun gnus-summary-set-article-display-arrow (pos)
3171 "Update the overlay arrow to point to line at position POS."
3172 (when (and gnus-summary-display-arrow
3173 (boundp 'overlay-arrow-position)
3174 (boundp 'overlay-arrow-string))
3178 (unless overlay-arrow-position
3179 (setq overlay-arrow-position (make-marker)))
3180 (setq overlay-arrow-string "=>"
3181 overlay-arrow-position (set-marker overlay-arrow-position
3183 (current-buffer))))))
3185 (defun gnus-summary-setup-buffer (group)
3186 "Initialize summary buffer."
3187 (let ((buffer (gnus-summary-buffer-name group))
3188 (dead-name (concat "*Dead Summary "
3189 (gnus-group-decoded-name group) "*")))
3190 ;; If a dead summary buffer exists, we kill it.
3191 (when (gnus-buffer-live-p dead-name)
3192 (gnus-kill-buffer dead-name))
3193 (if (get-buffer buffer)
3196 (setq gnus-summary-buffer (current-buffer))
3197 (not gnus-newsgroup-prepared))
3198 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3199 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3200 (gnus-summary-mode group)
3202 (gnus-carpal-setup-buffer 'summary))
3203 (unless gnus-single-article-buffer
3204 (make-local-variable 'gnus-article-buffer)
3205 (make-local-variable 'gnus-article-current)
3206 (make-local-variable 'gnus-original-article-buffer))
3207 (setq gnus-newsgroup-name group)
3208 ;; Set any local variables in the group parameters.
3209 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3212 (defun gnus-set-global-variables ()
3213 "Set the global equivalents of the buffer-local variables.
3214 They are set to the latest values they had. These reflect the summary
3215 buffer that was in action when the last article was fetched."
3216 (when (eq major-mode 'gnus-summary-mode)
3217 (setq gnus-summary-buffer (current-buffer))
3218 (let ((name gnus-newsgroup-name)
3219 (marked gnus-newsgroup-marked)
3220 (spam gnus-newsgroup-spam-marked)
3221 (unread gnus-newsgroup-unreads)
3222 (headers gnus-current-headers)
3223 (data gnus-newsgroup-data)
3224 (summary gnus-summary-buffer)
3225 (article-buffer gnus-article-buffer)
3226 (original gnus-original-article-buffer)
3227 (gac gnus-article-current)
3228 (reffed gnus-reffed-article-number)
3229 (score-file gnus-current-score-file)
3230 (default-charset gnus-newsgroup-charset)
3232 (let ((locals gnus-newsgroup-variables))
3234 (if (consp (car locals))
3235 (push (eval (caar locals)) vlist)
3236 (push (eval (car locals)) vlist))
3237 (setq locals (cdr locals)))
3238 (setq vlist (nreverse vlist)))
3239 (with-current-buffer gnus-group-buffer
3240 (setq gnus-newsgroup-name name
3241 gnus-newsgroup-marked marked
3242 gnus-newsgroup-spam-marked spam
3243 gnus-newsgroup-unreads unread
3244 gnus-current-headers headers
3245 gnus-newsgroup-data data
3246 gnus-article-current gac
3247 gnus-summary-buffer summary
3248 gnus-article-buffer article-buffer
3249 gnus-original-article-buffer original
3250 gnus-reffed-article-number reffed
3251 gnus-current-score-file score-file
3252 gnus-newsgroup-charset default-charset)
3253 (let ((locals gnus-newsgroup-variables))
3255 (if (consp (car locals))
3256 (set (caar locals) (pop vlist))
3257 (set (car locals) (pop vlist)))
3258 (setq locals (cdr locals))))
3259 ;; The article buffer also has local variables.
3260 (when (gnus-buffer-live-p gnus-article-buffer)
3261 (set-buffer gnus-article-buffer)
3262 (setq gnus-summary-buffer summary))))))
3264 (defun gnus-summary-article-unread-p (article)
3265 "Say whether ARTICLE is unread or not."
3266 (memq article gnus-newsgroup-unreads))
3268 (defun gnus-summary-first-article-p (&optional article)
3269 "Return whether ARTICLE is the first article in the buffer."
3270 (if (not (setq article (or article (gnus-summary-article-number))))
3272 (eq article (caar gnus-newsgroup-data))))
3274 (defun gnus-summary-last-article-p (&optional article)
3275 "Return whether ARTICLE is the last article in the buffer."
3276 (if (not (setq article (or article (gnus-summary-article-number))))
3277 ;; All non-existent numbers are the last article. :-)
3279 (not (cdr (gnus-data-find-list article)))))
3281 (defun gnus-make-thread-indent-array ()
3283 (unless (and gnus-thread-indent-array
3284 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3285 (setq gnus-thread-indent-array (make-vector 201 "")
3286 gnus-thread-indent-array-level gnus-thread-indent-level)
3288 (aset gnus-thread-indent-array n
3289 (make-string (* n gnus-thread-indent-level) ? ))
3292 (defun gnus-update-summary-mark-positions ()
3293 "Compute where the summary marks are to go."
3295 (when (gnus-buffer-exists-p gnus-summary-buffer)
3296 (set-buffer gnus-summary-buffer))
3297 (let ((spec gnus-summary-line-format-spec)
3300 (gnus-set-work-buffer)
3301 (let ((gnus-tmp-unread ?Z)
3302 (gnus-replied-mark ?Z)
3303 (gnus-score-below-mark ?Z)
3304 (gnus-score-over-mark ?Z)
3305 (gnus-undownloaded-mark ?Z)
3306 (gnus-summary-line-format-spec spec)
3307 (gnus-newsgroup-downloadable '(0))
3308 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3309 case-fold-search ignores)
3310 ;; Here, all marks are bound to Z.
3311 (gnus-summary-insert-line header
3312 0 nil t gnus-tmp-unread t nil "" nil 1)
3313 (goto-char (point-min))
3314 ;; Memorize the positions of the same characters as dummy marks.
3315 (while (re-search-forward "[A-D]" nil t)
3316 (push (point) ignores))
3318 ;; We use A-D as dummy marks in order to know column positions
3319 ;; where marks should be inserted.
3320 (setq gnus-tmp-unread ?A
3321 gnus-replied-mark ?B
3322 gnus-score-below-mark ?C
3323 gnus-score-over-mark ?C
3324 gnus-undownloaded-mark ?D)
3325 (gnus-summary-insert-line header
3326 0 nil t gnus-tmp-unread t nil "" nil 1)
3327 ;; Ignore characters which aren't dummy marks.
3329 (delete-region (goto-char (1- p)) p)
3331 (goto-char (point-min))
3332 (setq pos (list (cons 'unread
3333 (and (search-forward "A" nil t)
3334 (- (point) (point-min) 1)))))
3335 (goto-char (point-min))
3336 (push (cons 'replied (and (search-forward "B" nil t)
3337 (- (point) (point-min) 1)))
3339 (goto-char (point-min))
3340 (push (cons 'score (and (search-forward "C" nil t)
3341 (- (point) (point-min) 1)))
3343 (goto-char (point-min))
3344 (push (cons 'download (and (search-forward "D" nil t)
3345 (- (point) (point-min) 1)))
3347 (setq gnus-summary-mark-positions pos))))
3349 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3350 "Insert a dummy root in the summary buffer."
3352 (gnus-add-text-properties
3353 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3354 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3356 (defun gnus-summary-extract-address-component (from)
3357 (or (car (funcall gnus-extract-address-components from))
3360 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3361 (let ((mail-parse-charset gnus-newsgroup-charset)
3362 ; Is it really necessary to do this next part for each summary line?
3363 ; Luckily, doesn't seem to slow things down much.
3364 (mail-parse-ignored-charsets
3365 (with-current-buffer gnus-summary-buffer
3366 gnus-newsgroup-ignored-charsets)))
3368 (and gnus-ignored-from-addresses
3369 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3370 (let ((extra-headers (mail-header-extra header))
3374 ((setq to (cdr (assq 'To extra-headers)))
3377 (gnus-summary-extract-address-component
3378 (funcall gnus-decode-encoded-word-function to)))))
3379 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3380 (concat "=> " newsgroups)))))
3381 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3383 (defun gnus-summary-insert-line (gnus-tmp-header
3384 gnus-tmp-level gnus-tmp-current
3385 undownloaded gnus-tmp-unread gnus-tmp-replied
3386 gnus-tmp-expirable gnus-tmp-subject-or-nil
3387 &optional gnus-tmp-dummy gnus-tmp-score
3389 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3390 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3391 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3392 (gnus-tmp-score-char
3393 (if (or (null gnus-summary-default-score)
3394 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3395 gnus-summary-zcore-fuzz))
3397 (if (< gnus-tmp-score gnus-summary-default-score)
3398 gnus-score-below-mark gnus-score-over-mark)))
3399 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3401 (cond (gnus-tmp-process gnus-process-mark)
3402 ((memq gnus-tmp-current gnus-newsgroup-cached)
3404 (gnus-tmp-replied gnus-replied-mark)
3405 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3406 gnus-forwarded-mark)
3407 ((memq gnus-tmp-current gnus-newsgroup-saved)
3409 ((memq gnus-tmp-number gnus-newsgroup-recent)
3411 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3414 (gnus-tmp-downloaded
3416 gnus-undownloaded-mark)
3417 (gnus-newsgroup-agentized
3418 gnus-downloaded-mark)
3421 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3424 ((string-match "<[^>]+> *$" gnus-tmp-from)
3425 (let ((beg (match-beginning 0)))
3426 (or (and (string-match "^\".+\"" gnus-tmp-from)
3427 (substring gnus-tmp-from 1 (1- (match-end 0))))
3428 (substring gnus-tmp-from 0 beg))))
3429 ((string-match "(.+)" gnus-tmp-from)
3430 (substring gnus-tmp-from
3431 (1+ (match-beginning 0)) (1- (match-end 0))))
3433 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3434 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3435 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3436 (buffer-read-only nil))
3437 (when (string= gnus-tmp-name "")
3438 (setq gnus-tmp-name gnus-tmp-from))
3439 (unless (numberp gnus-tmp-lines)
3440 (setq gnus-tmp-lines -1))
3441 (if (= gnus-tmp-lines -1)
3442 (setq gnus-tmp-lines "?")
3443 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3444 (gnus-put-text-property
3446 (progn (eval gnus-summary-line-format-spec) (point))
3447 'gnus-number gnus-tmp-number)
3448 (when (gnus-visual-p 'summary-highlight 'highlight)
3450 (gnus-run-hooks 'gnus-summary-update-hook)
3453 (defun gnus-summary-update-line (&optional dont-update)
3454 "Update summary line after change."
3455 (when (and gnus-summary-default-score
3456 (not gnus-summary-inhibit-highlight))
3457 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3458 (article (gnus-summary-article-number))
3459 (score (gnus-summary-article-score article)))
3461 (if (and gnus-summary-mark-below
3462 (< (gnus-summary-article-score)
3463 gnus-summary-mark-below))
3464 ;; This article has a low score, so we mark it as read.
3465 (when (memq article gnus-newsgroup-unreads)
3466 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3467 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3468 ;; This article was previously marked as read on account
3469 ;; of a low score, but now it has risen, so we mark it as
3471 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3472 (gnus-summary-update-mark
3473 (if (or (null gnus-summary-default-score)
3474 (<= (abs (- score gnus-summary-default-score))
3475 gnus-summary-zcore-fuzz))
3477 (if (< score gnus-summary-default-score)
3478 gnus-score-below-mark gnus-score-over-mark))
3480 ;; Do visual highlighting.
3481 (when (gnus-visual-p 'summary-highlight 'highlight)
3482 (gnus-run-hooks 'gnus-summary-update-hook)))))
3484 (defvar gnus-tmp-new-adopts nil)
3486 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3487 "Return the number of articles in THREAD.
3488 This may be 0 in some cases -- if none of the articles in
3489 the thread are to be displayed."
3491 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3493 ((not (listp thread))
3495 ((and (consp thread) (cdr thread))
3498 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3501 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3504 (when (and level (zerop level) gnus-tmp-new-adopts)
3507 'gnus-summary-number-of-articles-in-thread
3508 gnus-tmp-new-adopts))))
3510 (if (> number 1) gnus-not-empty-thread-mark
3511 gnus-empty-thread-mark)
3514 (defsubst gnus-summary-line-message-size (head)
3515 "Return pretty-printed version of message size.
3516 This function is intended to be used in
3517 `gnus-summary-line-format-alist'."
3518 (let ((c (or (mail-header-chars head) -1)))
3519 (cond ((< c 0) "n/a") ; chars not available
3520 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3521 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3522 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3523 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3526 (defun gnus-summary-set-local-parameters (group)
3527 "Go through the local params of GROUP and set all variable specs in that list."
3528 (let ((vars '(quit-config))) ; Ignore quit-config.
3529 (dolist (elem (gnus-group-find-parameter group))
3530 (and (consp elem) ; Has to be a cons.
3531 (consp (cdr elem)) ; The cdr has to be a list.
3532 (symbolp (car elem)) ; Has to be a symbol in there.
3533 (not (memq (car elem) vars))
3534 (ignore-errors ; So we set it.
3535 (push (car elem) vars)
3536 (make-local-variable (car elem))
3537 (set (car elem) (eval (nth 1 elem))))))))
3539 (defun gnus-summary-read-group (group &optional show-all no-article
3540 kill-buffer no-display backward
3542 "Start reading news in newsgroup GROUP.
3543 If SHOW-ALL is non-nil, already read articles are also listed.
3544 If NO-ARTICLE is non-nil, no article is selected initially.
3545 If NO-DISPLAY, don't generate a summary buffer."
3549 (let ((gnus-auto-select-next nil))
3550 (or (gnus-summary-read-group-1
3551 group show-all no-article
3552 kill-buffer no-display
3555 select-articles nil)))))
3556 (eq gnus-auto-select-next 'quietly))
3557 (set-buffer gnus-group-buffer)
3558 ;; The entry function called above goes to the next
3559 ;; group automatically, so we go two groups back
3560 ;; if we are searching for the previous group.
3562 (gnus-group-prev-unread-group 2))
3563 (if (not (equal group (gnus-group-group-name)))
3564 (setq group (gnus-group-group-name))
3568 (defun gnus-summary-read-group-1 (group show-all no-article
3569 kill-buffer no-display
3570 &optional select-articles)
3571 ;; Killed foreign groups can't be entered.
3572 ;; (when (and (not (gnus-group-native-p group))
3573 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3574 ;; (error "Dead non-native groups can't be entered"))
3575 (gnus-message 5 "Retrieving newsgroup: %s..."
3576 (gnus-group-decoded-name group))
3577 (let* ((new-group (gnus-summary-setup-buffer group))
3578 (quit-config (gnus-group-quit-config group))
3579 (did-select (and new-group (gnus-select-newsgroup
3580 group show-all select-articles))))
3582 ;; This summary buffer exists already, so we just select it.
3584 (gnus-set-global-variables)
3586 (gnus-kill-or-deaden-summary kill-buffer))
3587 (gnus-configure-windows 'summary 'force)
3588 (gnus-set-mode-line 'summary)
3589 (gnus-summary-position-point)
3592 ;; We couldn't select this group.
3594 (when (and (eq major-mode 'gnus-summary-mode)
3595 (not (equal (current-buffer) kill-buffer)))
3596 (kill-buffer (current-buffer))
3597 (if (not quit-config)
3599 ;; Update the info -- marks might need to be removed,
3601 (gnus-summary-update-info)
3602 (set-buffer gnus-group-buffer)
3603 (gnus-group-jump-to-group group)
3604 (gnus-group-next-unread-group 1))
3605 (gnus-handle-ephemeral-exit quit-config)))
3606 (let ((grpinfo (gnus-get-info group)))
3607 (if (null (gnus-info-read grpinfo))
3608 (gnus-message 3 "Group %s contains no messages"
3609 (gnus-group-decoded-name group))
3610 (gnus-message 3 "Can't select group")))
3612 ;; The user did a `C-g' while prompting for number of articles,
3613 ;; so we exit this group.
3614 ((eq did-select 'quit)
3615 (and (eq major-mode 'gnus-summary-mode)
3616 (not (equal (current-buffer) kill-buffer))
3617 (kill-buffer (current-buffer)))
3619 (gnus-kill-or-deaden-summary kill-buffer))
3620 (if (not quit-config)
3622 (set-buffer gnus-group-buffer)
3623 (gnus-group-jump-to-group group)
3624 (gnus-group-next-unread-group 1)
3625 (gnus-configure-windows 'group 'force))
3626 (gnus-handle-ephemeral-exit quit-config))
3627 ;; Finally signal the quit.
3629 ;; The group was successfully selected.
3631 (gnus-set-global-variables)
3632 ;; Save the active value in effect when the group was entered.
3633 (setq gnus-newsgroup-active
3635 (gnus-active gnus-newsgroup-name)))
3636 ;; You can change the summary buffer in some way with this hook.
3637 (gnus-run-hooks 'gnus-select-group-hook)
3638 (when (memq 'summary (gnus-update-format-specifications
3639 nil 'summary 'summary-mode 'summary-dummy))
3640 ;; The format specification for the summary line was updated,
3641 ;; so we need to update the mark positions as well.
3642 (gnus-update-summary-mark-positions))
3643 ;; Do score processing.
3644 (when gnus-use-scoring
3645 (gnus-possibly-score-headers))
3646 ;; Check whether to fill in the gaps in the threads.
3647 (when gnus-build-sparse-threads
3648 (gnus-build-sparse-threads))
3649 ;; Find the initial limit.
3651 (let ((gnus-newsgroup-dormant nil))
3652 (gnus-summary-initial-limit show-all))
3653 (gnus-summary-initial-limit show-all))
3654 ;; Generate the summary buffer.
3656 (gnus-summary-prepare))
3657 (when gnus-use-trees
3658 (gnus-tree-open group)
3659 (setq gnus-summary-highlight-line-function
3660 'gnus-tree-highlight-article))
3661 ;; If the summary buffer is empty, but there are some low-scored
3662 ;; articles or some excluded dormants, we include these in the
3664 (when (and (zerop (buffer-size))
3666 (cond (gnus-newsgroup-dormant
3667 (gnus-summary-limit-include-dormant))
3668 ((and gnus-newsgroup-scored show-all)
3669 (gnus-summary-limit-include-expunged t))))
3670 ;; Function `gnus-apply-kill-file' must be called in this hook.
3671 (gnus-run-hooks 'gnus-apply-kill-hook)
3672 (if (and (zerop (buffer-size))
3675 ;; This newsgroup is empty.
3676 (gnus-summary-catchup-and-exit nil t)
3677 (gnus-message 6 "No unread news")
3679 (gnus-kill-or-deaden-summary kill-buffer))
3680 ;; Return nil from this function.
3682 ;; Hide conversation thread subtrees. We cannot do this in
3683 ;; gnus-summary-prepare-hook since kill processing may not
3684 ;; work with hidden articles.
3685 (gnus-summary-maybe-hide-threads)
3687 (gnus-kill-or-deaden-summary kill-buffer))
3688 (gnus-summary-auto-select-subject)
3689 ;; Show first unread article if requested.
3690 (if (and (not no-article)
3692 gnus-newsgroup-unreads
3693 gnus-auto-select-first)
3695 (gnus-configure-windows 'summary)
3696 (let ((art (gnus-summary-article-number)))
3697 (unless (and (not gnus-plugged)
3698 (or (memq art gnus-newsgroup-undownloaded)
3699 (memq art gnus-newsgroup-downloadable)))
3700 (gnus-summary-goto-article art))))
3701 ;; Don't select any articles.
3702 (gnus-summary-position-point)
3703 (gnus-configure-windows 'summary 'force)
3704 (gnus-set-mode-line 'summary))
3705 (when (and gnus-auto-center-group
3706 (get-buffer-window gnus-group-buffer t))
3707 ;; Gotta use windows, because recenter does weird stuff if
3708 ;; the current buffer ain't the displayed window.
3709 (let ((owin (selected-window)))
3710 (select-window (get-buffer-window gnus-group-buffer t))
3711 (when (gnus-group-goto-group group)
3713 (select-window owin)))
3714 ;; Mark this buffer as "prepared".
3715 (setq gnus-newsgroup-prepared t)
3716 (gnus-run-hooks 'gnus-summary-prepared-hook)
3717 (unless (gnus-ephemeral-group-p group)
3718 (gnus-group-update-group group))
3721 (defun gnus-summary-auto-select-subject ()
3722 "Select the subject line on initial group entry."
3723 (goto-char (point-min))
3725 ((eq gnus-auto-select-subject 'best)
3726 (gnus-summary-best-unread-subject))
3727 ((eq gnus-auto-select-subject 'unread)
3728 (gnus-summary-first-unread-subject))
3729 ((eq gnus-auto-select-subject 'unseen)
3730 (gnus-summary-first-unseen-subject))
3731 ((eq gnus-auto-select-subject 'unseen-or-unread)
3732 (gnus-summary-first-unseen-or-unread-subject))
3733 ((eq gnus-auto-select-subject 'first)
3736 ((functionp gnus-auto-select-subject)
3737 (funcall gnus-auto-select-subject))))
3739 (defun gnus-summary-prepare ()
3740 "Generate the summary buffer."
3742 (let ((buffer-read-only nil))
3744 (setq gnus-newsgroup-data nil
3745 gnus-newsgroup-data-reverse nil)
3746 (gnus-run-hooks 'gnus-summary-generate-hook)
3747 ;; Generate the buffer, either with threads or without.
3748 (when gnus-newsgroup-headers
3749 (gnus-summary-prepare-threads
3750 (if gnus-show-threads
3751 (gnus-sort-gathered-threads
3752 (funcall gnus-summary-thread-gathering-function
3754 (gnus-cut-threads (gnus-make-threads)))))
3755 ;; Unthreaded display.
3756 (gnus-sort-articles gnus-newsgroup-headers))))
3757 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3758 ;; Call hooks for modifying summary buffer.
3759 (goto-char (point-min))
3760 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3762 (defsubst gnus-general-simplify-subject (subject)
3763 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3766 ;; Truncate the subject.
3767 (gnus-simplify-subject-functions
3768 (gnus-map-function gnus-simplify-subject-functions subject))
3769 ((numberp gnus-summary-gather-subject-limit)
3770 (setq subject (gnus-simplify-subject-re subject))
3771 (if (> (length subject) gnus-summary-gather-subject-limit)
3772 (substring subject 0 gnus-summary-gather-subject-limit)
3774 ;; Fuzzily simplify it.
3775 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3776 (gnus-simplify-subject-fuzzy subject))
3777 ;; Just remove the leading "Re:".
3779 (gnus-simplify-subject-re subject))))
3781 (if (and gnus-summary-gather-exclude-subject
3782 (string-match gnus-summary-gather-exclude-subject subject))
3783 nil ; This article shouldn't be gathered
3786 (defun gnus-summary-simplify-subject-query ()
3787 "Query where the respool algorithm would put this article."
3789 (gnus-summary-select-article)
3790 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3792 (defun gnus-gather-threads-by-subject (threads)
3793 "Gather threads by looking at Subject headers."
3794 (if (not gnus-summary-make-false-root)
3796 (let ((hashtb (gnus-make-hashtable 1024))
3799 subject hthread whole-subject)
3801 (setq subject (gnus-general-simplify-subject
3802 (setq whole-subject (mail-header-subject
3805 (if (setq hthread (gnus-gethash subject hashtb))
3807 ;; We enter a dummy root into the thread, if we
3808 ;; haven't done that already.
3809 (unless (stringp (caar hthread))
3810 (setcar hthread (list whole-subject (car hthread))))
3811 ;; We add this new gathered thread to this gathered
3813 (setcdr (car hthread)
3814 (nconc (cdar hthread) (list (car threads))))
3815 ;; Remove it from the list of threads.
3816 (setcdr prev (cdr threads))
3817 (setq threads prev))
3818 ;; Enter this thread into the hash table.
3819 (gnus-sethash subject
3820 (if gnus-summary-make-false-root-always
3822 ;; If you want a dummy root above all
3824 (setcar threads (list whole-subject
3830 (setq threads (cdr threads)))
3833 (defun gnus-gather-threads-by-references (threads)
3834 "Gather threads by looking at References headers."
3835 (let ((idhashtb (gnus-make-hashtable 1024))
3836 (thhashtb (gnus-make-hashtable 1024))
3839 ids references id gthread gid entered ref)
3841 (when (setq references (mail-header-references (caar threads)))
3842 (setq id (mail-header-id (caar threads))
3843 ids (inline (gnus-split-references references))
3845 (while (setq ref (pop ids))
3846 (setq ids (delete ref ids))
3847 (if (not (setq gid (gnus-gethash ref idhashtb)))
3849 (gnus-sethash ref id idhashtb)
3850 (gnus-sethash id threads thhashtb))
3851 (setq gthread (gnus-gethash gid thhashtb))
3853 ;; We enter a dummy root into the thread, if we
3854 ;; haven't done that already.
3855 (unless (stringp (caar gthread))
3856 (setcar gthread (list (mail-header-subject (caar gthread))
3858 ;; We add this new gathered thread to this gathered
3860 (setcdr (car gthread)
3861 (nconc (cdar gthread) (list (car threads)))))
3862 ;; Add it into the thread hash table.
3863 (gnus-sethash id gthread thhashtb)
3865 ;; Remove it from the list of threads.
3866 (setcdr prev (cdr threads))
3867 (setq threads prev))))
3869 (setq threads (cdr threads)))
3872 (defun gnus-sort-gathered-threads (threads)
3873 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
3874 (let ((result threads))
3876 (when (stringp (caar threads))
3877 (setcdr (car threads)
3878 (sort (cdar threads) gnus-sort-gathered-threads-function)))
3879 (setq threads (cdr threads)))
3882 (defun gnus-thread-loop-p (root thread)
3883 "Say whether ROOT is in THREAD."
3884 (let ((stack (list thread))
3887 (while (setq thread (pop stack))
3888 (setq th (cdr thread))
3890 (not (eq (caar th) root)))
3893 ;; We have found a loop.
3895 (setcdr thread (delq (car th) (cdr thread)))
3896 (if (boundp (setq ref-dep (intern "none"
3897 gnus-newsgroup-dependencies)))
3898 (setcdr (symbol-value ref-dep)
3899 (nconc (cdr (symbol-value ref-dep))
3901 (set ref-dep (list nil (car th))))
3904 ;; Push all the subthreads onto the stack.
3905 (push (cdr thread) stack)))
3908 (defun gnus-make-threads ()
3909 "Go through the dependency hashtb and find the roots. Return all threads."
3911 (while (catch 'infloop
3914 ;; Deal with self-referencing References loops.
3915 (when (and (car (symbol-value refs))
3922 (car (symbol-value refs)) thread))
3923 (cdr (symbol-value refs)))))))
3926 (unless (car (symbol-value refs))
3927 ;; These threads do not refer back to any other
3928 ;; articles, so they're roots.
3929 (setq threads (append (cdr (symbol-value refs)) threads))))
3930 gnus-newsgroup-dependencies)))
3933 ;; Build the thread tree.
3934 (defsubst gnus-dependencies-add-header (header dependencies force-new)
3935 "Enter HEADER into the DEPENDENCIES table if it is not already there.
3937 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
3938 if it was already present.
3940 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
3941 will not be entered in the DEPENDENCIES table. Otherwise duplicate
3942 Message-IDs will be renamed to a unique Message-ID before being
3945 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
3946 (let* ((id (mail-header-id header))
3947 (id-dep (and id (intern id dependencies)))
3948 parent-id ref ref-dep ref-header replaced)
3949 ;; Enter this `header' in the `dependencies' table.
3953 ;; The first two cases do the normal part: enter a new `header'
3954 ;; in the `dependencies' table.
3955 ((not (boundp id-dep))
3956 (set id-dep (list header)))
3957 ((null (car (symbol-value id-dep)))
3958 (setcar (symbol-value id-dep) header))
3960 ;; From here the `header' was already present in the
3961 ;; `dependencies' table.
3963 ;; Overrides an existing entry;
3964 ;; just set the header part of the entry.
3965 (setcar (symbol-value id-dep) header)
3968 ;; Renames the existing `header' to a unique Message-ID.
3969 ((not gnus-summary-ignore-duplicates)
3970 ;; An article with this Message-ID has already been seen.
3971 ;; We rename the Message-ID.
3972 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
3974 (mail-header-set-id header id))
3976 ;; The last case ignores an existing entry, except it adds any
3977 ;; additional Xrefs (in case the two articles came from different
3979 ;; Also sets `header' to `nil' meaning that the `dependencies'
3980 ;; table was *not* modified.
3982 (mail-header-set-xref
3983 (car (symbol-value id-dep))
3984 (concat (or (mail-header-xref (car (symbol-value id-dep)))
3986 (or (mail-header-xref header) "")))
3989 (when (and header (not replaced))
3990 ;; First check that we are not creating a References loop.
3991 (setq parent-id (gnus-parent-id (mail-header-references header)))
3992 (setq ref parent-id)
3994 (setq ref-dep (intern-soft ref dependencies))
3996 (setq ref-header (car (symbol-value ref-dep))))
3997 (if (string= id ref)
3998 ;; Yuk! This is a reference loop. Make the article be a
4001 (mail-header-set-references (car (symbol-value id-dep)) "none")
4003 (setq parent-id nil))
4004 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4005 (setq ref-dep (intern (or parent-id "none") dependencies))
4006 (if (boundp ref-dep)
4007 (setcdr (symbol-value ref-dep)
4008 (nconc (cdr (symbol-value ref-dep))
4009 (list (symbol-value id-dep))))
4010 (set ref-dep (list nil (symbol-value id-dep)))))
4013 (defun gnus-extract-message-id-from-in-reply-to (string)
4014 (if (string-match "<[^>]+>" string)
4015 (substring string (match-beginning 0) (match-end 0))
4018 (defun gnus-build-sparse-threads ()
4019 (let ((headers gnus-newsgroup-headers)
4020 (mail-parse-charset gnus-newsgroup-charset)
4021 (gnus-summary-ignore-duplicates t)
4022 header references generation relations
4023 subject child end new-child date)
4024 ;; First we create an alist of generations/relations, where
4025 ;; generations is how much we trust the relation, and the relation
4027 (gnus-message 7 "Making sparse threads...")
4029 (nnheader-set-temp-buffer " *gnus sparse threads*")
4030 (while (setq header (pop headers))
4031 (when (and (setq references (mail-header-references header))
4032 (not (string= references "")))
4034 (setq child (mail-header-id header)
4035 subject (mail-header-subject header)
4036 date (mail-header-date header)
4038 (while (search-backward ">" nil t)
4039 (setq end (1+ (point)))
4040 (when (search-backward "<" nil t)
4041 (setq new-child (buffer-substring (point) end))
4042 (push (list (incf generation)
4043 child (setq child new-child)
4047 (push (list (1+ generation) child nil subject) relations))
4049 (kill-buffer (current-buffer)))
4050 ;; Sort over trustworthiness.
4053 (when (gnus-dependencies-add-header
4054 (make-full-mail-header
4055 gnus-reffed-article-number
4056 (nth 3 relation) "" (or (nth 4 relation) "")
4058 (or (nth 2 relation) "") 0 0 "")
4059 gnus-newsgroup-dependencies nil)
4060 (push gnus-reffed-article-number gnus-newsgroup-limit)
4061 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4062 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4063 gnus-newsgroup-reads)
4064 (decf gnus-reffed-article-number)))
4065 (sort relations 'car-less-than-car))
4066 (gnus-message 7 "Making sparse threads...done")))
4068 (defun gnus-build-old-threads ()
4069 ;; Look at all the articles that refer back to old articles, and
4070 ;; fetch the headers for the articles that aren't there. This will
4071 ;; build complete threads - if the roots haven't been expired by the
4073 (let ((mail-parse-charset gnus-newsgroup-charset)
4077 (when (not (car (symbol-value refs)))
4078 (setq heads (cdr (symbol-value refs)))
4080 (if (memq (mail-header-number (caar heads))
4081 gnus-newsgroup-dormant)
4082 (setq heads (cdr heads))
4083 (setq id (symbol-name refs))
4084 (while (and (setq id (gnus-build-get-header id))
4085 (not (car (gnus-id-to-thread id)))))
4086 (setq heads nil)))))
4087 gnus-newsgroup-dependencies)))
4089 (defsubst gnus-remove-odd-characters (string)
4090 "Translate STRING into something that doesn't contain weird characters."
4091 (mm-subst-char-in-string
4093 (mm-subst-char-in-string ?\n ?\- string t) t))
4095 ;; This function has to be called with point after the article number
4096 ;; on the beginning of the line.
4097 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4098 (let ((eol (point-at-eol))
4099 (buffer (current-buffer))
4100 header references in-reply-to)
4102 ;; overview: [num subject from date id refs chars lines misc]
4105 (narrow-to-region (point) eol)
4110 (make-full-mail-header
4112 (condition-case () ; subject
4113 (gnus-remove-odd-characters
4114 (funcall gnus-decode-encoded-word-function
4115 (setq x (nnheader-nov-field))))
4117 (condition-case () ; from
4118 (gnus-remove-odd-characters
4119 (funcall gnus-decode-encoded-word-function
4120 (setq x (nnheader-nov-field))))
4122 (nnheader-nov-field) ; date
4123 (nnheader-nov-read-message-id number) ; id
4124 (setq references (nnheader-nov-field)) ; refs
4125 (nnheader-nov-read-integer) ; chars
4126 (nnheader-nov-read-integer) ; lines
4128 (if (looking-at "Xref: ")
4129 (goto-char (match-end 0)))
4130 (nnheader-nov-field)) ; Xref
4131 (nnheader-nov-parse-extra)))) ; extra
4135 (when (and (string= references "")
4136 (setq in-reply-to (mail-header-extra header))
4137 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4138 (mail-header-set-references
4139 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4141 (when gnus-alter-header-function
4142 (funcall gnus-alter-header-function header))
4143 (gnus-dependencies-add-header header dependencies force-new)))
4145 (defun gnus-build-get-header (id)
4146 "Look through the buffer of NOV lines and find the header to ID.
4147 Enter this line into the dependencies hash table, and return
4148 the id of the parent article (if any)."
4149 (let ((deps gnus-newsgroup-dependencies)
4153 (set-buffer nntp-server-buffer)
4154 (let ((case-fold-search nil))
4155 (goto-char (point-min))
4156 (while (and (not found)
4157 (search-forward id nil t))
4159 (setq found (looking-at
4160 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4161 (regexp-quote id))))
4162 (or found (beginning-of-line 2)))
4166 (setq header (gnus-nov-parse-line
4167 (read (current-buffer)) deps))
4168 (gnus-parent-id (mail-header-references header))))))
4170 (let ((number (mail-header-number header)))
4171 (push number gnus-newsgroup-limit)
4172 (push header gnus-newsgroup-headers)
4173 (if (memq number gnus-newsgroup-unselected)
4175 (setq gnus-newsgroup-unreads
4176 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4178 (setq gnus-newsgroup-unselected
4179 (delq number gnus-newsgroup-unselected)))
4180 (push number gnus-newsgroup-ancient)))))))
4182 (defun gnus-build-all-threads ()
4183 "Read all the headers."
4184 (let ((gnus-summary-ignore-duplicates t)
4185 (mail-parse-charset gnus-newsgroup-charset)
4186 (dependencies gnus-newsgroup-dependencies)
4189 (set-buffer nntp-server-buffer)
4190 (let ((case-fold-search nil))
4191 (goto-char (point-min))
4194 (setq article (read (current-buffer))
4195 header (gnus-nov-parse-line article dependencies)))
4197 (with-current-buffer gnus-summary-buffer
4198 (push header gnus-newsgroup-headers)
4199 (if (memq (setq article (mail-header-number header))
4200 gnus-newsgroup-unselected)
4202 (setq gnus-newsgroup-unreads
4203 (gnus-add-to-sorted-list
4204 gnus-newsgroup-unreads article))
4205 (setq gnus-newsgroup-unselected
4206 (delq article gnus-newsgroup-unselected)))
4207 (push article gnus-newsgroup-ancient)))
4208 (forward-line 1)))))))
4210 (defun gnus-summary-update-article-line (article header)
4211 "Update the line for ARTICLE using HEADER."
4212 (let* ((id (mail-header-id header))
4213 (thread (gnus-id-to-thread id)))
4215 (error "Article in no thread"))
4216 ;; Update the thread.
4217 (setcar thread header)
4218 (gnus-summary-goto-subject article)
4219 (let* ((datal (gnus-data-find-list article))
4221 (buffer-read-only nil)
4222 (level (gnus-summary-thread-level)))
4224 (let ((inserted (- (point)
4226 (gnus-summary-insert-line
4228 (memq article gnus-newsgroup-undownloaded)
4229 (gnus-article-mark article)
4230 (memq article gnus-newsgroup-replied)
4231 (memq article gnus-newsgroup-expirable)
4232 ;; Only insert the Subject string when it's different
4233 ;; from the previous Subject string.
4238 (mail-header-subject
4241 (gnus-data-find-list
4243 (gnus-data-list t)))))
4244 ;; Error on the side of excessive subjects.
4246 (mail-header-subject header)))
4248 (mail-header-subject header))
4249 nil (cdr (assq article gnus-newsgroup-scored))
4250 (memq article gnus-newsgroup-processable))
4253 (gnus-data-update-list
4255 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4257 (defun gnus-summary-update-article (article &optional iheader)
4258 "Update ARTICLE in the summary buffer."
4259 (set-buffer gnus-summary-buffer)
4260 (let* ((header (gnus-summary-article-header article))
4261 (id (mail-header-id header))
4262 (data (gnus-data-find article))
4263 (thread (gnus-id-to-thread id))
4264 (references (mail-header-references header))
4268 (when (and references
4269 (not (equal "" references)))
4272 (buffer-read-only nil)
4278 (delq thread parent)))
4279 (if (gnus-summary-insert-subject id header)
4280 ;; Set the (possibly) new article number in the data structure.
4281 (gnus-data-set-number data (gnus-id-to-article id))
4285 (defun gnus-rebuild-thread (id &optional line)
4286 "Rebuild the thread containing ID.
4287 If LINE, insert the rebuilt thread starting on line LINE."
4288 (let ((buffer-read-only nil)
4289 old-pos current thread data)
4290 (if (not gnus-show-threads)
4291 (setq thread (list (car (gnus-id-to-thread id))))
4292 ;; Get the thread this article is part of.
4293 (setq thread (gnus-remove-thread id)))
4294 (setq old-pos (point-at-bol))
4295 (setq current (save-excursion
4296 (and (re-search-backward "[\r\n]" nil t)
4297 (gnus-summary-article-number))))
4298 ;; If this is a gathered thread, we have to go some re-gathering.
4299 (when (stringp (car thread))
4300 (let ((subject (car thread))
4302 (setq thread (cdr thread))
4304 (unless (memq (setq thr (gnus-id-to-thread
4306 (mail-header-id (caar thread)))))
4309 (setq thread (cdr thread)))
4310 ;; We now have all (unique) roots.
4311 (if (= (length roots) 1)
4312 ;; All the loose roots are now one solid root.
4313 (setq thread (car roots))
4314 (setq thread (cons subject (gnus-sort-threads roots))))))
4316 ;; We then insert this thread into the summary buffer.
4318 (goto-char (point-min))
4319 (forward-line (1- line)))
4320 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4321 (if gnus-show-threads
4322 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4323 (gnus-summary-prepare-unthreaded thread))
4324 (setq data (nreverse gnus-newsgroup-data))
4325 (setq threads gnus-newsgroup-threads))
4326 ;; We splice the new data into the data structure.
4327 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4328 ;;!!! then we want to insert at the beginning of the buffer.
4329 ;;!!! That happens to be true with Gnus now, but that may
4330 ;;!!! change in the future. Perhaps.
4331 (gnus-data-enter-list
4332 (if line nil current) data (- (point) old-pos))
4333 (setq gnus-newsgroup-threads
4334 (nconc threads gnus-newsgroup-threads))
4335 (gnus-data-compute-positions))))
4337 (defun gnus-number-to-header (number)
4338 "Return the header for article NUMBER."
4339 (let ((headers gnus-newsgroup-headers))
4341 (not (= number (mail-header-number (car headers)))))
4346 (defun gnus-parent-headers (in-headers &optional generation)
4347 "Return the headers of the GENERATIONeth parent of HEADERS."
4349 (setq generation 1))
4351 (headers in-headers)
4354 (not (zerop generation))
4355 (setq references (mail-header-references headers)))
4356 (setq headers (if (and references
4357 (setq parent (gnus-parent-id references)))
4358 (car (gnus-id-to-thread parent))
4361 (and (not (eq headers in-headers))
4364 (defun gnus-id-to-thread (id)
4365 "Return the (sub-)thread where ID appears."
4366 (gnus-gethash id gnus-newsgroup-dependencies))
4368 (defun gnus-id-to-article (id)
4369 "Return the article number of ID."
4370 (let ((thread (gnus-id-to-thread id)))
4373 (mail-header-number (car thread)))))
4375 (defun gnus-id-to-header (id)
4376 "Return the article headers of ID."
4377 (car (gnus-id-to-thread id)))
4379 (defun gnus-article-displayed-root-p (article)
4380 "Say whether ARTICLE is a root(ish) article."
4381 (let ((level (gnus-summary-thread-level article))
4382 (refs (mail-header-references (gnus-summary-article-header article)))
4388 ((null (gnus-parent-id refs)) t)
4390 (null (setq particle (gnus-id-to-article
4391 (gnus-parent-id refs))))
4392 (null (gnus-summary-thread-level particle)))))))
4394 (defun gnus-root-id (id)
4395 "Return the id of the root of the thread where ID appears."
4397 (while (and id (setq prev (car (gnus-id-to-thread id))))
4399 id (gnus-parent-id (mail-header-references prev))))
4402 (defun gnus-articles-in-thread (thread)
4403 "Return the list of articles in THREAD."
4404 (cons (mail-header-number (car thread))
4405 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4407 (defun gnus-remove-thread (id &optional dont-remove)
4408 "Remove the thread that has ID in it."
4409 (let (headers thread last-id)
4410 ;; First go up in this thread until we find the root.
4411 (setq last-id (gnus-root-id id)
4412 headers (message-flatten-list (gnus-id-to-thread last-id)))
4413 ;; We have now found the real root of this thread. It might have
4414 ;; been gathered into some loose thread, so we have to search
4415 ;; through the threads to find the thread we wanted.
4416 (let ((threads gnus-newsgroup-threads)
4419 (setq sub (car threads))
4420 (if (stringp (car sub))
4421 ;; This is a gathered thread, so we look at the roots
4422 ;; below it to find whether this article is in this
4425 (setq sub (cdr sub))
4427 (when (member (caar sub) headers)
4428 (setq thread (car threads)
4431 (setq sub (cdr sub))))
4432 ;; It's an ordinary thread, so we check it.
4433 (when (eq (car sub) (car headers))
4436 (setq threads (cdr threads)))
4437 ;; If this article is in no thread, then it's a root.
4440 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4441 (setq thread (gnus-id-to-thread last-id)))
4444 thread ; We return this thread.
4446 (if (stringp (car thread))
4448 ;; If we use dummy roots, then we have to remove the
4449 ;; dummy root as well.
4450 (when (eq gnus-summary-make-false-root 'dummy)
4451 ;; We go to the dummy root by going to
4452 ;; the first sub-"thread", and then one line up.
4453 (gnus-summary-goto-article
4454 (mail-header-number (caadr thread)))
4457 (gnus-data-compute-positions))
4458 (setq thread (cdr thread))
4460 (gnus-remove-thread-1 (car thread))
4461 (setq thread (cdr thread))))
4462 (gnus-remove-thread-1 thread))))))))
4464 (defun gnus-remove-thread-1 (thread)
4465 "Remove the thread THREAD recursively."
4466 (let ((number (mail-header-number (pop thread)))
4468 (setq thread (reverse thread))
4470 (gnus-remove-thread-1 (pop thread)))
4471 (when (setq d (gnus-data-find number))
4472 (goto-char (gnus-data-pos d))
4473 (gnus-summary-show-thread)
4479 (gnus-delete-line)))))))
4481 (defun gnus-sort-threads-1 (threads func)
4482 (sort (mapcar (lambda (thread)
4485 (gnus-sort-threads-1 (cdr thread) func))))
4488 (defun gnus-sort-threads (threads)
4490 (if (not gnus-thread-sort-functions)
4492 (gnus-message 8 "Sorting threads...")
4493 (let ((max-lisp-eval-depth 5000))
4494 (prog1 (gnus-sort-threads-1
4496 (gnus-make-sort-function gnus-thread-sort-functions))
4497 (gnus-message 8 "Sorting threads...done")))))
4499 (defun gnus-sort-articles (articles)
4501 (when gnus-article-sort-functions
4502 (gnus-message 7 "Sorting articles...")
4504 (setq gnus-newsgroup-headers
4505 (sort articles (gnus-make-sort-function
4506 gnus-article-sort-functions)))
4507 (gnus-message 7 "Sorting articles...done"))))
4509 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4510 (defmacro gnus-thread-header (thread)
4511 "Return header of first article in THREAD.
4512 Note that THREAD must never, ever be anything else than a variable -
4513 using some other form will lead to serious barfage."
4514 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4515 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4516 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4519 (defsubst gnus-article-sort-by-number (h1 h2)
4520 "Sort articles by article number."
4521 (< (mail-header-number h1)
4522 (mail-header-number h2)))
4524 (defun gnus-thread-sort-by-number (h1 h2)
4525 "Sort threads by root article number."
4526 (gnus-article-sort-by-number
4527 (gnus-thread-header h1) (gnus-thread-header h2)))
4529 (defsubst gnus-article-sort-by-random (h1 h2)
4530 "Sort articles by article number."
4533 (defun gnus-thread-sort-by-random (h1 h2)
4534 "Sort threads by root article number."
4535 (gnus-article-sort-by-random
4536 (gnus-thread-header h1) (gnus-thread-header h2)))
4538 (defsubst gnus-article-sort-by-lines (h1 h2)
4539 "Sort articles by article Lines header."
4540 (< (mail-header-lines h1)
4541 (mail-header-lines h2)))
4543 (defun gnus-thread-sort-by-lines (h1 h2)
4544 "Sort threads by root article Lines header."
4545 (gnus-article-sort-by-lines
4546 (gnus-thread-header h1) (gnus-thread-header h2)))
4548 (defsubst gnus-article-sort-by-chars (h1 h2)
4549 "Sort articles by octet length."
4550 (< (mail-header-chars h1)
4551 (mail-header-chars h2)))
4553 (defun gnus-thread-sort-by-chars (h1 h2)
4554 "Sort threads by root article octet length."
4555 (gnus-article-sort-by-chars
4556 (gnus-thread-header h1) (gnus-thread-header h2)))
4558 (defsubst gnus-article-sort-by-author (h1 h2)
4559 "Sort articles by root author."
4561 (let ((extract (funcall
4562 gnus-extract-address-components
4563 (mail-header-from h1))))
4564 (or (car extract) (cadr extract) ""))
4565 (let ((extract (funcall
4566 gnus-extract-address-components
4567 (mail-header-from h2))))
4568 (or (car extract) (cadr extract) ""))))
4570 (defun gnus-thread-sort-by-author (h1 h2)
4571 "Sort threads by root author."
4572 (gnus-article-sort-by-author
4573 (gnus-thread-header h1) (gnus-thread-header h2)))
4575 (defsubst gnus-article-sort-by-recipient (h1 h2)
4576 "Sort articles by recipient."
4578 (let ((extract (funcall
4579 gnus-extract-address-components
4580 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4581 (or (car extract) (cadr extract)))
4582 (let ((extract (funcall
4583 gnus-extract-address-components
4584 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4585 (or (car extract) (cadr extract)))))
4587 (defsubst gnus-article-sort-by-subject (h1 h2)
4588 "Sort articles by root subject."
4590 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4591 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4593 (defun gnus-thread-sort-by-subject (h1 h2)
4594 "Sort threads by root subject."
4595 (gnus-article-sort-by-subject
4596 (gnus-thread-header h1) (gnus-thread-header h2)))
4598 (defsubst gnus-article-sort-by-date (h1 h2)
4599 "Sort articles by root article date."
4601 (gnus-date-get-time (mail-header-date h1))
4602 (gnus-date-get-time (mail-header-date h2))))
4604 (defun gnus-thread-sort-by-date (h1 h2)
4605 "Sort threads by root article date."
4606 (gnus-article-sort-by-date
4607 (gnus-thread-header h1) (gnus-thread-header h2)))
4609 (defsubst gnus-article-sort-by-score (h1 h2)
4610 "Sort articles by root article score.
4611 Unscored articles will be counted as having a score of zero."
4612 (> (or (cdr (assq (mail-header-number h1)
4613 gnus-newsgroup-scored))
4614 gnus-summary-default-score 0)
4615 (or (cdr (assq (mail-header-number h2)
4616 gnus-newsgroup-scored))
4617 gnus-summary-default-score 0)))
4619 (defun gnus-thread-sort-by-score (h1 h2)
4620 "Sort threads by root article score."
4621 (gnus-article-sort-by-score
4622 (gnus-thread-header h1) (gnus-thread-header h2)))
4624 (defun gnus-thread-sort-by-total-score (h1 h2)
4625 "Sort threads by the sum of all scores in the thread.
4626 Unscored articles will be counted as having a score of zero."
4627 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4629 (defun gnus-thread-total-score (thread)
4630 ;; This function find the total score of THREAD.
4635 (if (stringp (car thread))
4636 (apply gnus-thread-score-function 0
4637 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4638 (gnus-thread-total-score-1 thread)))
4640 (gnus-thread-total-score-1 (list thread)))))
4642 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4643 "Sort threads such that the thread with the most recently arrived article comes first."
4644 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4646 (defun gnus-thread-highest-number (thread)
4647 "Return the highest article number in THREAD."
4648 (apply 'max (mapcar (lambda (header)
4649 (mail-header-number header))
4650 (message-flatten-list thread))))
4652 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4653 "Sort threads such that the thread with the most recently dated article comes first."
4654 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4656 (defun gnus-thread-latest-date (thread)
4657 "Return the highest article date in THREAD."
4658 (let ((previous-time 0))
4664 (time-to-seconds (mail-header-parse-date
4665 (mail-header-date header)))
4666 (error previous-time))))
4668 (message-flatten-list thread)
4670 (< (mail-header-number h1)
4671 (mail-header-number h2))))))))
4673 (defun gnus-thread-total-score-1 (root)
4674 ;; This function find the total score of the thread below ROOT.
4675 (setq root (car root))
4676 (apply gnus-thread-score-function
4678 (mapcar 'gnus-thread-total-score
4679 (cdr (gnus-id-to-thread (mail-header-id root))))
4680 (when (> (mail-header-number root) 0)
4681 (list (or (cdr (assq (mail-header-number root)
4682 gnus-newsgroup-scored))
4683 gnus-summary-default-score 0))))
4684 (list gnus-summary-default-score)
4687 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4688 (defvar gnus-tmp-prev-subject nil)
4689 (defvar gnus-tmp-false-parent nil)
4690 (defvar gnus-tmp-root-expunged nil)
4691 (defvar gnus-tmp-dummy-line nil)
4693 (eval-when-compile (defvar gnus-tmp-header))
4694 (defun gnus-extra-header (type &optional header)
4695 "Return the extra header of TYPE."
4696 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4699 (defvar gnus-tmp-thread-tree-header-string "")
4701 (defcustom gnus-sum-thread-tree-root "> "
4702 "With %B spec, used for the root of a thread.
4703 If nil, use subject instead."
4705 :type '(radio (const :format "%v " nil) string)
4706 :group 'gnus-thread)
4707 (defcustom gnus-sum-thread-tree-false-root "> "
4708 "With %B spec, used for a false root of a thread.
4709 If nil, use subject instead."
4711 :type '(radio (const :format "%v " nil) string)
4712 :group 'gnus-thread)
4713 (defcustom gnus-sum-thread-tree-single-indent ""
4714 "With %B spec, used for a thread with just one message.
4715 If nil, use subject instead."
4717 :type '(radio (const :format "%v " nil) string)
4718 :group 'gnus-thread)
4719 (defcustom gnus-sum-thread-tree-vertical "| "
4720 "With %B spec, used for drawing a vertical line."
4723 :group 'gnus-thread)
4724 (defcustom gnus-sum-thread-tree-indent " "
4725 "With %B spec, used for indenting."
4728 :group 'gnus-thread)
4729 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4730 "With %B spec, used for a leaf with brothers."
4733 :group 'gnus-thread)
4734 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4735 "With %B spec, used for a leaf without brothers."
4738 :group 'gnus-thread)
4740 (defun gnus-summary-prepare-threads (threads)
4741 "Prepare summary buffer from THREADS and indentation LEVEL.
4742 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4743 or a straight list of headers."
4744 (gnus-message 7 "Generating summary...")
4746 (setq gnus-newsgroup-threads threads)
4749 (let ((gnus-tmp-level 0)
4750 (default-score (or gnus-summary-default-score 0))
4751 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4752 (building-line-count gnus-summary-display-while-building)
4753 (building-count (integerp gnus-summary-display-while-building))
4754 thread number subject stack state gnus-tmp-gathered beg-match
4755 new-roots gnus-tmp-new-adopts thread-end simp-subject
4756 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4757 gnus-tmp-replied gnus-tmp-subject-or-nil
4758 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4759 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4760 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4763 (setq gnus-tmp-prev-subject nil
4764 gnus-tmp-thread-tree-header-string "")
4766 (if (vectorp (car threads))
4767 ;; If this is a straight (sic) list of headers, then a
4768 ;; threaded summary display isn't required, so we just create
4769 ;; an unthreaded one.
4770 (gnus-summary-prepare-unthreaded threads)
4772 ;; Do the threaded display.
4774 (if gnus-summary-display-while-building
4775 (switch-to-buffer (buffer-name)))
4776 (while (or threads stack gnus-tmp-new-adopts new-roots)
4778 (if (and (= gnus-tmp-level 0)
4781 (not gnus-tmp-false-parent)
4782 (or gnus-tmp-new-adopts new-roots))
4783 (if gnus-tmp-new-adopts
4784 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4785 thread (list (car gnus-tmp-new-adopts))
4786 gnus-tmp-header (caar thread)
4787 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4789 (setq thread (list (car new-roots))
4790 gnus-tmp-header (caar thread)
4791 new-roots (cdr new-roots))))
4794 ;; If there are some threads, we do them before the
4795 ;; threads on the stack.
4796 (setq thread threads
4797 gnus-tmp-header (caar thread))
4798 ;; There were no current threads, so we pop something off
4800 (setq state (car stack)
4801 gnus-tmp-level (car state)
4802 tree-stack (cadr state)
4803 thread (caddr state)
4805 gnus-tmp-header (caar thread))))
4807 (setq gnus-tmp-false-parent nil)
4808 (setq gnus-tmp-root-expunged nil)
4809 (setq thread-end nil)
4811 (if (stringp gnus-tmp-header)
4812 ;; The header is a dummy root.
4814 ((eq gnus-summary-make-false-root 'adopt)
4815 ;; We let the first article adopt the rest.
4816 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4818 (setq gnus-tmp-gathered
4820 (lambda (h) (mail-header-number (car h)))
4823 (setq thread (cons (list (caar thread)
4826 (setq gnus-tmp-level -1
4827 gnus-tmp-false-parent t))
4828 ((eq gnus-summary-make-false-root 'empty)
4829 ;; We print adopted articles with empty subject fields.
4830 (setq gnus-tmp-gathered
4832 (lambda (h) (mail-header-number (car h)))
4835 (setq gnus-tmp-level -1))
4836 ((eq gnus-summary-make-false-root 'dummy)
4837 ;; We remember that we probably want to output a dummy
4839 (setq gnus-tmp-dummy-line gnus-tmp-header)
4840 (setq gnus-tmp-prev-subject gnus-tmp-header))
4842 ;; We do not make a root for the gathered
4843 ;; sub-threads at all.
4844 (setq gnus-tmp-level -1)))
4846 (setq number (mail-header-number gnus-tmp-header)
4847 subject (mail-header-subject gnus-tmp-header)
4848 simp-subject (gnus-simplify-subject-fully subject))
4851 ;; If the thread has changed subject, we might want to make
4852 ;; this subthread into a root.
4853 ((and (null gnus-thread-ignore-subject)
4854 (not (zerop gnus-tmp-level))
4855 gnus-tmp-prev-subject
4856 (not (string= gnus-tmp-prev-subject simp-subject)))
4857 (setq new-roots (nconc new-roots (list (car thread)))
4859 gnus-tmp-header nil))
4860 ;; If the article lies outside the current limit,
4861 ;; then we do not display it.
4862 ((not (memq number gnus-newsgroup-limit))
4863 (setq gnus-tmp-gathered
4865 (lambda (h) (mail-header-number (car h)))
4868 (setq gnus-tmp-new-adopts (if (cdar thread)
4869 (append gnus-tmp-new-adopts
4871 gnus-tmp-new-adopts)
4873 gnus-tmp-header nil)
4874 (when (zerop gnus-tmp-level)
4875 (setq gnus-tmp-root-expunged t)))
4876 ;; Perhaps this article is to be marked as read?
4877 ((and gnus-summary-mark-below
4878 (< (or (cdr (assq number gnus-newsgroup-scored))
4880 gnus-summary-mark-below)
4881 ;; Don't touch sparse articles.
4882 (not (gnus-summary-article-sparse-p number))
4883 (not (gnus-summary-article-ancient-p number)))
4884 (setq gnus-newsgroup-unreads
4885 (delq number gnus-newsgroup-unreads))
4886 (if gnus-newsgroup-auto-expire
4887 (setq gnus-newsgroup-expirable
4888 (gnus-add-to-sorted-list
4889 gnus-newsgroup-expirable number))
4890 (push (cons number gnus-low-score-mark)
4891 gnus-newsgroup-reads))))
4893 (when gnus-tmp-header
4894 ;; We may have an old dummy line to output before this
4896 (when (and gnus-tmp-dummy-line
4899 (mail-header-subject gnus-tmp-header)))
4900 (gnus-summary-insert-dummy-line
4901 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
4902 (setq gnus-tmp-dummy-line nil))
4904 ;; Compute the mark.
4905 (setq gnus-tmp-unread (gnus-article-mark number))
4907 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
4908 gnus-tmp-header gnus-tmp-level)
4909 gnus-newsgroup-data)
4911 ;; Actually insert the line.
4913 gnus-tmp-subject-or-nil
4915 ((and gnus-thread-ignore-subject
4916 gnus-tmp-prev-subject
4917 (not (string= gnus-tmp-prev-subject simp-subject)))
4919 ((zerop gnus-tmp-level)
4920 (if (and (eq gnus-summary-make-false-root 'empty)
4921 (memq number gnus-tmp-gathered)
4922 gnus-tmp-prev-subject
4923 (string= gnus-tmp-prev-subject simp-subject))
4924 gnus-summary-same-subject
4926 (t gnus-summary-same-subject)))
4927 (if (and (eq gnus-summary-make-false-root 'adopt)
4928 (= gnus-tmp-level 1)
4929 (memq number gnus-tmp-gathered))
4930 (setq gnus-tmp-opening-bracket ?\<
4931 gnus-tmp-closing-bracket ?\>)
4932 (setq gnus-tmp-opening-bracket ?\[
4933 gnus-tmp-closing-bracket ?\]))
4935 gnus-tmp-indentation
4936 (aref gnus-thread-indent-array gnus-tmp-level)
4937 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
4938 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
4939 gnus-summary-default-score 0)
4941 (if (or (null gnus-summary-default-score)
4942 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
4943 gnus-summary-zcore-fuzz))
4945 (if (< gnus-tmp-score gnus-summary-default-score)
4946 gnus-score-below-mark gnus-score-over-mark))
4948 (cond ((memq number gnus-newsgroup-processable)
4950 ((memq number gnus-newsgroup-cached)
4952 ((memq number gnus-newsgroup-replied)
4954 ((memq number gnus-newsgroup-forwarded)
4955 gnus-forwarded-mark)
4956 ((memq number gnus-newsgroup-saved)
4958 ((memq number gnus-newsgroup-recent)
4960 ((memq number gnus-newsgroup-unseen)
4964 (cond ((memq number gnus-newsgroup-undownloaded)
4965 gnus-undownloaded-mark)
4966 (gnus-newsgroup-agentized
4967 gnus-downloaded-mark)
4970 gnus-tmp-from (mail-header-from gnus-tmp-header)
4973 ((string-match "<[^>]+> *$" gnus-tmp-from)
4974 (setq beg-match (match-beginning 0))
4975 (or (and (string-match "^\".+\"" gnus-tmp-from)
4976 (substring gnus-tmp-from 1 (1- (match-end 0))))
4977 (substring gnus-tmp-from 0 beg-match)))
4978 ((string-match "(.+)" gnus-tmp-from)
4979 (substring gnus-tmp-from
4980 (1+ (match-beginning 0)) (1- (match-end 0))))
4984 gnus-tmp-thread-tree-header-string
4986 ((not gnus-show-threads) "")
4987 ((zerop gnus-tmp-level)
4988 (cond ((cdar thread)
4989 (or gnus-sum-thread-tree-root subject))
4990 (gnus-tmp-new-adopts
4991 (or gnus-sum-thread-tree-false-root subject))
4993 (or gnus-sum-thread-tree-single-indent subject))))
4995 (concat (apply 'concat
4996 (mapcar (lambda (item)
4998 gnus-sum-thread-tree-vertical
4999 gnus-sum-thread-tree-indent))
5000 (cdr (reverse tree-stack))))
5002 gnus-sum-thread-tree-leaf-with-other
5003 gnus-sum-thread-tree-single-leaf)))))
5004 (when (string= gnus-tmp-name "")
5005 (setq gnus-tmp-name gnus-tmp-from))
5006 (unless (numberp gnus-tmp-lines)
5007 (setq gnus-tmp-lines -1))
5008 (if (= gnus-tmp-lines -1)
5009 (setq gnus-tmp-lines "?")
5010 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5011 (gnus-put-text-property
5013 (progn (eval gnus-summary-line-format-spec) (point))
5014 'gnus-number number)
5017 (gnus-run-hooks 'gnus-summary-update-hook)
5020 (setq gnus-tmp-prev-subject simp-subject)))
5022 (when (nth 1 thread)
5023 (push (list (max 0 gnus-tmp-level)
5024 (copy-sequence tree-stack)
5027 (push (if (nth 1 thread) 1 0) tree-stack)
5028 (incf gnus-tmp-level)
5029 (setq threads (if thread-end nil (cdar thread)))
5030 (if gnus-summary-display-while-building
5033 ;; use a set frequency
5034 (setq building-line-count (1- building-line-count))
5035 (when (= building-line-count 0)
5037 (setq building-line-count
5038 gnus-summary-display-while-building)))
5042 (setq gnus-tmp-level 0)))))
5043 (gnus-message 7 "Generating summary...done"))
5045 (defun gnus-summary-prepare-unthreaded (headers)
5046 "Generate an unthreaded summary buffer based on HEADERS."
5047 (let (header number mark)
5052 ;; We may have to root out some bad articles...
5053 (when (memq (setq number (mail-header-number
5054 (setq header (pop headers))))
5055 gnus-newsgroup-limit)
5056 ;; Mark article as read when it has a low score.
5057 (when (and gnus-summary-mark-below
5058 (< (or (cdr (assq number gnus-newsgroup-scored))
5059 gnus-summary-default-score 0)
5060 gnus-summary-mark-below)
5061 (not (gnus-summary-article-ancient-p number)))
5062 (setq gnus-newsgroup-unreads
5063 (delq number gnus-newsgroup-unreads))
5064 (if gnus-newsgroup-auto-expire
5065 (push number gnus-newsgroup-expirable)
5066 (push (cons number gnus-low-score-mark)
5067 gnus-newsgroup-reads)))
5069 (setq mark (gnus-article-mark number))
5070 (push (gnus-data-make number mark (1+ (point)) header 0)
5071 gnus-newsgroup-data)
5072 (gnus-summary-insert-line
5074 (memq number gnus-newsgroup-undownloaded)
5075 mark (memq number gnus-newsgroup-replied)
5076 (memq number gnus-newsgroup-expirable)
5077 (mail-header-subject header) nil
5078 (cdr (assq number gnus-newsgroup-scored))
5079 (memq number gnus-newsgroup-processable))))))
5081 (defun gnus-summary-remove-list-identifiers ()
5082 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5083 (let ((regexp (if (consp gnus-list-identifiers)
5084 (mapconcat 'identity gnus-list-identifiers " *\\|")
5085 gnus-list-identifiers))
5088 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5089 (dolist (header gnus-newsgroup-headers)
5090 (setq subject (mail-header-subject header)
5092 (while (string-match regexp subject)
5094 (concat (substring subject 0 (match-beginning 1))
5095 (substring subject (match-end 0)))
5098 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5100 (concat (substring subject 0 (match-beginning 1))
5101 (substring subject (match-end 1)))))
5102 (mail-header-set-subject header subject))))))
5104 (defun gnus-fetch-headers (articles)
5105 "Fetch headers of ARTICLES."
5106 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5107 (gnus-message 5 "Fetching headers for %s..." name)
5110 (setq gnus-headers-retrieved-by
5111 (gnus-retrieve-headers
5112 articles gnus-newsgroup-name
5113 ;; We might want to fetch old headers, but
5114 ;; not if there is only 1 article.
5116 (not (eq gnus-fetch-old-headers 'some))
5117 (not (numberp gnus-fetch-old-headers)))
5118 (> (length articles) 1))
5119 gnus-fetch-old-headers))))
5120 (gnus-get-newsgroup-headers-xover
5121 articles nil nil gnus-newsgroup-name t)
5122 (gnus-get-newsgroup-headers))
5123 (gnus-message 5 "Fetching headers for %s...done" name))))
5125 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5126 "Select newsgroup GROUP.
5127 If READ-ALL is non-nil, all articles in the group are selected.
5128 If SELECT-ARTICLES, only select those articles from GROUP."
5129 (let* ((entry (gnus-group-entry group))
5130 ;;!!! Dirty hack; should be removed.
5131 (gnus-summary-ignore-duplicates
5132 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5134 gnus-summary-ignore-duplicates))
5135 (info (nth 2 entry))
5136 articles fetched-articles cached)
5138 (unless (gnus-check-server
5139 (set (make-local-variable 'gnus-current-select-method)
5140 (gnus-find-method-for-group group)))
5141 (error "Couldn't open server"))
5143 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5144 (gnus-activate-group group) ; Or we can activate it...
5145 (progn ; Or we bug out.
5146 (when (equal major-mode 'gnus-summary-mode)
5147 (gnus-kill-buffer (current-buffer)))
5148 (error "Couldn't activate group %s: %s"
5149 group (gnus-status-message group))))
5151 (unless (gnus-request-group group t)
5152 (when (equal major-mode 'gnus-summary-mode)
5153 (gnus-kill-buffer (current-buffer)))
5154 (error "Couldn't request group %s: %s"
5155 group (gnus-status-message group)))
5158 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5160 (setq gnus-summary-use-undownloaded-faces
5161 (gnus-agent-find-parameter
5163 'agent-enable-undownloaded-faces)))
5165 (setq gnus-newsgroup-name group
5166 gnus-newsgroup-unselected nil
5167 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5169 (let ((display (gnus-group-find-parameter group 'display)))
5170 (setq gnus-newsgroup-display
5172 ((not (zerop (or (car-safe read-all) 0)))
5173 ;; The user entered the group with C-u SPC/RET, let's show
5179 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5181 ;; The following is probably the "correct" solution, but
5182 ;; it makes Gnus fetch all headers and then limit the
5183 ;; articles (which is slow), so instead we hack the
5184 ;; select-articles parameter instead. -- Simon Josefsson
5187 ;; (gnus-byte-compile
5188 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5190 (setq select-articles
5191 (gnus-uncompress-range
5192 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5196 (cdr (gnus-active group)))))
5201 (gnus-summary-setup-default-charset)
5203 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5204 (when (gnus-virtual-group-p group)
5205 (setq cached gnus-newsgroup-cached))
5207 (setq gnus-newsgroup-unreads
5208 (gnus-sorted-ndifference
5209 (gnus-sorted-ndifference gnus-newsgroup-unreads
5210 gnus-newsgroup-marked)
5211 gnus-newsgroup-dormant))
5213 (setq gnus-newsgroup-processable nil)
5215 (gnus-update-read-articles group gnus-newsgroup-unreads)
5217 ;; Adjust and set lists of article marks.
5219 (gnus-adjust-marked-articles info))
5220 (if (setq articles select-articles)
5221 (setq gnus-newsgroup-unselected
5222 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5223 (setq articles (gnus-articles-to-read group read-all)))
5227 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5229 ((eq articles 0) nil)
5231 ;; Init the dependencies hash table.
5232 (setq gnus-newsgroup-dependencies
5233 (gnus-make-hashtable (length articles)))
5234 (gnus-set-global-variables)
5235 ;; Retrieve the headers and read them in.
5237 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5239 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5241 (setq gnus-newsgroup-cached cached))
5243 ;; Suppress duplicates?
5244 (when gnus-suppress-duplicates
5245 (gnus-dup-suppress-articles))
5247 ;; Set the initial limit.
5248 (setq gnus-newsgroup-limit (copy-sequence articles))
5249 ;; Remove canceled articles from the list of unread articles.
5250 (setq fetched-articles
5251 (mapcar (lambda (headers) (mail-header-number headers))
5252 gnus-newsgroup-headers))
5253 (setq gnus-newsgroup-articles fetched-articles)
5254 (setq gnus-newsgroup-unreads
5255 (gnus-sorted-nintersection
5256 gnus-newsgroup-unreads fetched-articles))
5257 (gnus-compute-unseen-list)
5259 ;; Removed marked articles that do not exist.
5260 (gnus-update-missing-marks
5261 (gnus-sorted-difference articles fetched-articles))
5262 ;; We might want to build some more threads first.
5263 (when (and gnus-fetch-old-headers
5264 (eq gnus-headers-retrieved-by 'nov))
5265 (if (eq gnus-fetch-old-headers 'invisible)
5266 (gnus-build-all-threads)
5267 (gnus-build-old-threads)))
5268 ;; Let the Gnus agent mark articles as read.
5270 (gnus-agent-get-undownloaded-list))
5271 ;; Remove list identifiers from subject
5272 (when gnus-list-identifiers
5273 (gnus-summary-remove-list-identifiers))
5274 ;; Check whether auto-expire is to be done in this group.
5275 (setq gnus-newsgroup-auto-expire
5276 (gnus-group-auto-expirable-p group))
5277 ;; Set up the article buffer now, if necessary.
5278 (unless gnus-single-article-buffer
5279 (gnus-article-setup-buffer))
5280 ;; First and last article in this newsgroup.
5281 (when gnus-newsgroup-headers
5282 (setq gnus-newsgroup-begin
5283 (mail-header-number (car gnus-newsgroup-headers))
5286 (gnus-last-element gnus-newsgroup-headers))))
5287 ;; GROUP is successfully selected.
5288 (or gnus-newsgroup-headers t)))))
5290 (defun gnus-compute-unseen-list ()
5291 ;; The `seen' marks are treated specially.
5292 (if (not gnus-newsgroup-seen)
5293 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5294 (setq gnus-newsgroup-unseen
5295 (gnus-inverse-list-range-intersection
5296 gnus-newsgroup-articles gnus-newsgroup-seen))))
5298 (defun gnus-summary-display-make-predicate (display)
5299 (require 'gnus-agent)
5300 (when (= (length display) 1)
5301 (setq display (car display)))
5302 (unless gnus-summary-display-cache
5303 (dolist (elem (append '((unread . unread)
5306 gnus-article-mark-lists))
5307 (push (cons (cdr elem)
5309 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5310 gnus-summary-display-cache)))
5311 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5312 (gnus-category-predicate-cache gnus-summary-display-cache))
5313 (gnus-get-predicate display)))
5315 ;; Uses the dynamically bound `number' variable.
5318 (defun gnus-article-marked-p (type &optional article)
5319 (let ((article (or article number)))
5322 (memq article gnus-newsgroup-marked))
5324 (memq article gnus-newsgroup-spam-marked))
5326 (memq article gnus-newsgroup-unsendable))
5327 ((eq type 'undownload)
5328 (memq article gnus-newsgroup-undownloaded))
5329 ((eq type 'download)
5330 (memq article gnus-newsgroup-downloadable))
5332 (memq article gnus-newsgroup-unreads))
5334 (memq article gnus-newsgroup-reads))
5336 (memq article gnus-newsgroup-dormant) )
5338 (memq article gnus-newsgroup-expirable))
5340 (memq article gnus-newsgroup-replied))
5342 (memq article gnus-newsgroup-killed))
5343 ((eq type 'bookmark)
5344 (assq article gnus-newsgroup-bookmarks))
5346 (assq article gnus-newsgroup-scored))
5348 (memq article gnus-newsgroup-saved))
5350 (memq article gnus-newsgroup-cached))
5352 (memq article gnus-newsgroup-forwarded))
5354 (not (memq article gnus-newsgroup-unseen)))
5356 (memq article gnus-newsgroup-recent))
5359 (defun gnus-articles-to-read (group &optional read-all)
5360 "Find out what articles the user wants to read."
5362 ;; Select all articles if `read-all' is non-nil, or if there
5363 ;; are no unread articles.
5365 (and (zerop (length gnus-newsgroup-marked))
5366 (zerop (length gnus-newsgroup-unreads)))
5367 ;; Fetch all if the predicate is non-nil.
5368 gnus-newsgroup-display)
5369 ;; We want to select the headers for all the articles in
5370 ;; the group, so we select either all the active
5371 ;; articles in the group, or (if that's nil), the
5372 ;; articles in the cache.
5374 (gnus-uncompress-range (gnus-active group))
5375 (gnus-cache-articles-in-group group))
5376 ;; Select only the "normal" subset of articles.
5378 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5379 gnus-newsgroup-unreads)))
5380 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5381 (scored (length scored-list))
5382 (number (length articles))
5383 (marked (+ (length gnus-newsgroup-marked)
5384 (length gnus-newsgroup-dormant)))
5389 ((numberp gnus-newsgroup-display)
5390 gnus-newsgroup-display)
5394 ((and (or (<= scored marked) (= scored number))
5395 (numberp gnus-large-newsgroup)
5396 (> number gnus-large-newsgroup))
5397 (let* ((cursor-in-echo-area nil)
5398 (initial (gnus-parameter-large-newsgroup-initial
5399 gnus-newsgroup-name))
5403 "How many articles from %s (%s %d): "
5405 (gnus-group-decoded-name gnus-newsgroup-name)
5407 (if initial "max" "default")
5410 (cons (number-to-string initial)
5412 (if (string-match "^[ \t]*$" input) number input)))
5413 ((and (> scored marked) (< scored number)
5414 (> (- scored number) 20))
5417 (format "%s %s (%d scored, %d total): "
5418 "How many articles from"
5419 (gnus-group-decoded-name group)
5421 (if (string-match "^[ \t]*$" input)
5425 (message "Quit getting the articles to read")
5427 (setq select (if (stringp select) (string-to-number select) select))
5428 (if (or (null select) (zerop select))
5430 (if (and (not (zerop scored)) (<= (abs select) scored))
5432 (setq articles (sort scored-list '<))
5433 (setq number (length articles)))
5434 (setq articles (copy-sequence articles)))
5436 (when (< (abs select) number)
5438 ;; Select the N oldest articles.
5439 (setcdr (nthcdr (1- (abs select)) articles) nil)
5440 ;; Select the N most recent articles.
5441 (setq articles (nthcdr (- number select) articles))))
5442 (setq gnus-newsgroup-unselected
5443 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5444 (when gnus-alter-articles-to-read-function
5447 (funcall gnus-alter-articles-to-read-function
5448 gnus-newsgroup-name articles)
5452 (defun gnus-killed-articles (killed articles)
5455 (when (inline (gnus-member-of-range (car articles) killed))
5456 (push (car articles) out))
5457 (setq articles (cdr articles)))
5460 (defun gnus-uncompress-marks (marks)
5461 "Uncompress the mark ranges in MARKS."
5462 (let ((uncompressed '(score bookmark))
5465 (if (memq (caar marks) uncompressed)
5466 (push (car marks) out)
5467 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5468 (setq marks (cdr marks)))
5471 (defun gnus-article-mark-to-type (mark)
5472 "Return the type of MARK."
5473 (or (cadr (assq mark gnus-article-special-mark-lists))
5476 (defun gnus-article-unpropagatable-p (mark)
5477 "Return whether MARK should be propagated to back end."
5478 (memq mark gnus-article-unpropagated-mark-lists))
5480 (defun gnus-adjust-marked-articles (info)
5481 "Set all article lists and remove all marks that are no longer valid."
5482 (let* ((marked-lists (gnus-info-marks info))
5483 (active (gnus-active (gnus-info-group info)))
5486 (types gnus-article-mark-lists)
5487 marks var articles article mark mark-type
5490 (dolist (marks marked-lists)
5491 (setq mark (car marks)
5492 mark-type (gnus-article-mark-to-type mark)
5493 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5495 ;; We set the variable according to the type of the marks list,
5496 ;; and then adjust the marks to a subset of the active articles.
5498 ;; Adjust "simple" lists - compressed yet unsorted
5499 ((eq mark-type 'list)
5500 ;; Simultaneously uncompress and clip to active range
5501 ;; See gnus-uncompress-range for a description of possible marks
5503 (if (not (cadr marks))
5505 (setq articles (if (numberp (cddr marks))
5511 (while (setq article (pop articles))
5512 (cond ((consp article)
5513 (setq bgn (max (car article) min)
5514 end (min (cdr article) max))
5516 (setq l (setcdr l (cons bgn nil))
5518 ((and (<= min article)
5520 (setq l (setcdr l (cons article nil))))))
5521 (set var (cdr lh)))))
5523 ((eq mark-type 'tuple)
5524 (set var (setq articles (cdr marks)))
5525 (when (not (listp (cdr (symbol-value var))))
5526 (set var (list (symbol-value var))))
5527 (when (not (listp (cdr articles)))
5528 (setq articles (list articles)))
5530 (when (or (not (consp (setq article (pop articles))))
5531 (< (car article) min)
5532 (> (car article) max))
5533 (set var (delq article (symbol-value var))))))
5534 ;; Adjust ranges (sloppily).
5535 ((eq mark-type 'range)
5538 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5539 ;; It should be (seen (NUM1 . NUM2)).
5540 (when (numberp (cddr marks))
5541 (setcdr marks (list (cdr marks))))
5542 (setq articles (cdr marks))
5543 (while (and articles
5544 (or (and (consp (car articles))
5545 (> min (cdar articles)))
5546 (and (numberp (car articles))
5547 (> min (car articles)))))
5549 (set var articles))))))))
5551 (defun gnus-update-missing-marks (missing)
5552 "Go through the list of MISSING articles and remove them from the mark lists."
5555 ;; Go through all types.
5556 (dolist (elem gnus-article-mark-lists)
5557 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5558 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5559 (when (symbol-value var)
5560 ;; This list has articles. So we delete all missing
5561 ;; articles from it.
5564 (set var (delq (pop m) (symbol-value var))))))))))
5566 (defun gnus-update-marks ()
5567 "Enter the various lists of marked articles into the newsgroup info list."
5568 (let ((types gnus-article-mark-lists)
5569 (info (gnus-get-info gnus-newsgroup-name))
5570 type list newmarked symbol delta-marks)
5572 ;; Add all marks lists to the list of marks lists.
5573 (while (setq type (pop types))
5574 (setq list (symbol-value
5576 (intern (format "gnus-newsgroup-%s" (car type))))))
5579 ;; Get rid of the entries of the articles that have the
5581 (when (and (eq (cdr type) 'score)
5585 (prev (cons nil list))
5588 (if (or (not (consp (car arts)))
5589 (= (cdar arts) gnus-summary-default-score))
5590 (setcdr prev (cdr arts))
5592 (setq arts (cdr arts)))
5593 (setq list (cdr all)))))
5595 (when (eq (cdr type) 'seen)
5596 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5598 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5599 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5601 (when (and (gnus-check-backend-function
5602 'request-set-mark gnus-newsgroup-name)
5603 (not (gnus-article-unpropagatable-p (cdr type))))
5604 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5605 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5606 (add (gnus-remove-from-range
5607 (gnus-copy-sequence list) old)))
5609 (push (list add 'add (list (cdr type))) delta-marks))
5611 (push (list del 'del (list (cdr type))) delta-marks))))
5614 (push (cons (cdr type) list) newmarked)))
5617 (unless (gnus-check-group gnus-newsgroup-name)
5618 (error "Can't open server for %s" gnus-newsgroup-name))
5619 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5621 ;; Enter these new marks into the info of the group.
5623 (setcar (nthcdr 3 info) newmarked)
5624 ;; Add the marks lists to the end of the info.
5626 (setcdr (nthcdr 2 info) (list newmarked))))
5628 ;; Cut off the end of the info if there's nothing else there.
5632 (when (nthcdr (decf i) info)
5633 (setcdr (nthcdr i info) nil)))))))
5635 (defun gnus-set-mode-line (where)
5636 "Set the mode line of the article or summary buffers.
5637 If WHERE is `summary', the summary mode line format will be used."
5638 ;; Is this mode line one we keep updated?
5639 (when (and (memq where gnus-updated-mode-lines)
5641 (intern (format "gnus-%s-mode-line-format-spec" where))))
5644 ;; We evaluate this in the summary buffer since these
5645 ;; variables are buffer-local to that buffer.
5646 (set-buffer gnus-summary-buffer)
5647 ;; We bind all these variables that are used in the `eval' form
5649 (let* ((mformat (symbol-value
5651 (format "gnus-%s-mode-line-format-spec" where))))
5652 (gnus-tmp-group-name (gnus-group-decoded-name
5653 gnus-newsgroup-name))
5654 (gnus-tmp-article-number (or gnus-current-article 0))
5655 (gnus-tmp-unread gnus-newsgroup-unreads)
5656 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5657 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5658 (gnus-tmp-unread-and-unselected
5659 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5660 (zerop gnus-tmp-unselected))
5662 ((zerop gnus-tmp-unselected)
5663 (format "{%d more}" gnus-tmp-unread-and-unticked))
5664 (t (format "{%d(+%d) more}"
5665 gnus-tmp-unread-and-unticked
5666 gnus-tmp-unselected))))
5668 (if (and gnus-current-headers
5669 (vectorp gnus-current-headers))
5670 (gnus-mode-string-quote
5671 (mail-header-subject gnus-current-headers))
5673 bufname-length max-len
5674 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5675 (setq mode-string (eval mformat))
5676 (setq bufname-length (if (string-match "%b" mode-string)
5679 (if (eq where 'summary)
5681 (get-buffer gnus-article-buffer))))
5684 (setq max-len (max 4 (if gnus-mode-non-string-length
5686 gnus-mode-non-string-length
5688 (length mode-string))))
5689 ;; We might have to chop a bit of the string off...
5690 (when (> (length mode-string) max-len)
5692 (concat (truncate-string-to-width mode-string (- max-len 3))
5694 ;; Pad the mode string a bit.
5695 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5696 ;; Update the mode line.
5697 (setq mode-line-buffer-identification
5698 (gnus-mode-line-buffer-identification (list mode-string)))
5699 (set-buffer-modified-p t))))
5701 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5702 "Go through the HEADERS list and add all Xrefs to a hash table.
5703 The resulting hash table is returned, or nil if no Xrefs were found."
5704 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5705 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5706 (xref-hashtb (gnus-make-hashtable))
5707 start group entry number xrefs header)
5709 (setq header (pop headers))
5710 (when (and (setq xrefs (mail-header-xref header))
5711 (not (memq (setq number (mail-header-number header))
5714 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5715 (setq start (match-end 0))
5716 (setq group (if prefix
5717 (concat prefix (substring xrefs (match-beginning 1)
5719 (substring xrefs (match-beginning 1) (match-end 1))))
5721 (string-to-int (substring xrefs (match-beginning 2)
5723 (if (setq entry (gnus-gethash group xref-hashtb))
5724 (setcdr entry (cons number (cdr entry)))
5725 (gnus-sethash group (cons number nil) xref-hashtb)))))
5726 (and start xref-hashtb)))
5728 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5729 "Look through all the headers and mark the Xrefs as read."
5730 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5731 name info xref-hashtb idlist method nth4)
5733 (set-buffer gnus-group-buffer)
5734 (when (setq xref-hashtb
5735 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5738 (unless (string= from-newsgroup (setq name (symbol-name group)))
5739 (setq idlist (symbol-value group))
5740 ;; Dead groups are not updated.
5742 (setq info (gnus-get-info name))
5743 (when (stringp (setq nth4 (gnus-info-method info)))
5744 (setq nth4 (gnus-server-to-method nth4))))
5745 ;; Only do the xrefs if the group has the same
5746 ;; select method as the group we have just read.
5747 (or (gnus-methods-equal-p
5748 nth4 (gnus-find-method-for-group from-newsgroup))
5750 (equal nth4 (setq method (gnus-find-method-for-group
5752 (and (equal (car nth4) (car method))
5753 (equal (nth 1 nth4) (nth 1 method))))
5754 gnus-use-cross-reference
5755 (or (not (eq gnus-use-cross-reference t))
5757 ;; Only do cross-references on subscribed
5758 ;; groups, if that is what is wanted.
5759 (<= (gnus-info-level info) gnus-level-subscribed))
5760 (gnus-group-make-articles-read name idlist))))
5763 (defun gnus-compute-read-articles (group articles)
5764 (let* ((entry (gnus-group-entry group))
5765 (info (nth 2 entry))
5766 (active (gnus-active group))
5769 ;; First peel off all invalid article numbers.
5771 (let ((ids articles)
5773 (while (setq id (pop ids))
5774 (when (and first (> id (cdr active)))
5775 ;; We'll end up in this situation in one particular
5776 ;; obscure situation. If you re-scan a group and get
5777 ;; a new article that is cross-posted to a different
5778 ;; group that has not been re-scanned, you might get
5779 ;; crossposted article that has a higher number than
5780 ;; Gnus believes possible. So we re-activate this
5781 ;; group as well. This might mean doing the
5782 ;; crossposting thingy will *increase* the number
5783 ;; of articles in some groups. Tsk, tsk.
5784 (setq active (or (gnus-activate-group group) active)))
5785 (when (or (> id (cdr active))
5786 (< id (car active)))
5787 (setq articles (delq id articles))))))
5788 ;; If the read list is nil, we init it.
5790 (null (gnus-info-read info))
5792 (setq ninfo (cons 1 (1- (car active))))
5793 (setq ninfo (gnus-info-read info)))
5794 ;; Then we add the read articles to the range.
5796 ninfo (setq articles (sort articles '<))))))
5798 (defun gnus-group-make-articles-read (group articles)
5799 "Update the info of GROUP to say that ARTICLES are read."
5801 (entry (gnus-group-entry group))
5802 (info (nth 2 entry))
5803 (active (gnus-active group))
5806 (setq range (gnus-compute-read-articles group articles))
5807 (with-current-buffer gnus-group-buffer
5810 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5811 (gnus-info-set-read ',info ',(gnus-info-read info))
5812 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5813 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5814 (gnus-group-update-group ,group t))))
5815 ;; Add the read articles to the range.
5816 (gnus-info-set-read info range)
5817 (gnus-request-set-mark group (list (list range 'add '(read))))
5818 ;; Then we have to re-compute how many unread
5819 ;; articles there are in this group.
5823 (setq num (- (1+ (cdr active)) (car active))))
5824 ((not (listp (cdr range)))
5825 (setq num (- (cdr active) (- (1+ (cdr range))
5829 (if (numberp (car range))
5831 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5832 (setq range (cdr range)))
5833 (setq num (- (cdr active) num))))
5834 ;; Update the number of unread articles.
5836 ;; Update the group buffer.
5837 (unless (gnus-ephemeral-group-p group)
5838 (gnus-group-update-group group t))))))
5840 (defvar gnus-newsgroup-none-id 0)
5842 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5843 (let ((cur nntp-server-buffer)
5846 (with-current-buffer gnus-summary-buffer
5847 gnus-newsgroup-dependencies)))
5848 headers id end ref number
5849 (mail-parse-charset gnus-newsgroup-charset)
5850 (mail-parse-ignored-charsets
5851 (save-excursion (condition-case nil
5852 (set-buffer gnus-summary-buffer)
5854 gnus-newsgroup-ignored-charsets)))
5856 (set-buffer nntp-server-buffer)
5857 ;; Translate all TAB characters into SPACE characters.
5858 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5859 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5860 (ietf-drums-unfold-fws)
5861 (gnus-run-hooks 'gnus-parse-headers-hook)
5862 (let ((case-fold-search t)
5863 in-reply-to header p lines chars)
5864 (goto-char (point-min))
5865 ;; Search to the beginning of the next header. Error messages
5866 ;; do not begin with 2 or 3.
5867 (while (re-search-forward "^[23][0-9]+ " nil t)
5870 ;; This implementation of this function, with nine
5871 ;; search-forwards instead of the one re-search-forward and
5872 ;; a case (which basically was the old function) is actually
5873 ;; about twice as fast, even though it looks messier. You
5874 ;; can't have everything, I guess. Speed and elegance
5875 ;; doesn't always go hand in hand.
5881 (setq number (read cur))
5884 (narrow-to-region (point)
5885 (or (and (search-forward "\n.\n" nil t)
5891 (if (search-forward "\nsubject:" nil t)
5892 (funcall gnus-decode-encoded-word-function
5893 (nnheader-header-value))
5898 (if (search-forward "\nfrom:" nil t)
5899 (funcall gnus-decode-encoded-word-function
5900 (nnheader-header-value))
5905 (if (search-forward "\ndate:" nil t)
5906 (nnheader-header-value) ""))
5910 (setq id (if (re-search-forward
5911 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
5912 ;; We do it this way to make sure the Message-ID
5913 ;; is (somewhat) syntactically valid.
5914 (buffer-substring (match-beginning 1)
5916 ;; If there was no message-id, we just fake one
5917 ;; to make subsequent routines simpler.
5918 (nnheader-generate-fake-message-id number))))
5922 (if (search-forward "\nreferences:" nil t)
5926 (nnheader-header-value)
5931 (search-backward ">" end t)
5934 (search-backward "<" end t)
5936 ;; Get the references from the in-reply-to header if there
5937 ;; were no references and the in-reply-to header looks
5939 (if (and (search-forward "\nin-reply-to:" nil t)
5940 (setq in-reply-to (nnheader-header-value))
5941 (string-match "<[^>]+>" in-reply-to))
5943 (setq ref (substring in-reply-to (match-beginning 0)
5945 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
5946 (setq ref2 (substring in-reply-to (match-beginning 0)
5948 (when (> (length ref2) (length ref))
5955 (if (search-forward "\nchars: " nil t)
5956 (if (numberp (setq chars (ignore-errors (read cur))))
5962 (if (search-forward "\nlines: " nil t)
5963 (if (numberp (setq lines (ignore-errors (read cur))))
5969 (and (search-forward "\nxref:" nil t)
5970 (nnheader-header-value)))
5972 (when gnus-extra-headers
5973 (let ((extra gnus-extra-headers)
5977 (when (search-forward
5978 (concat "\n" (symbol-name (car extra)) ":") nil t)
5979 (push (cons (car extra) (nnheader-header-value))
5983 (when (equal id ref)
5986 (when gnus-alter-header-function
5987 (funcall gnus-alter-header-function header)
5988 (setq id (mail-header-id header)
5989 ref (gnus-parent-id (mail-header-references header))))
5992 (gnus-dependencies-add-header
5993 header dependencies force-new))
5994 (push header headers))
5995 (goto-char (point-max))
5997 (nreverse headers)))))
5999 ;; Goes through the xover lines and returns a list of vectors
6000 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6001 force-new dependencies
6002 group also-fetch-heads)
6003 "Parse the news overview data in the server buffer.
6004 Return a list of headers that match SEQUENCE (see
6005 `nntp-retrieve-headers')."
6006 ;; Get the Xref when the users reads the articles since most/some
6007 ;; NNTP servers do not include Xrefs when using XOVER.
6008 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6009 (let ((mail-parse-charset gnus-newsgroup-charset)
6010 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6011 (cur nntp-server-buffer)
6012 (dependencies (or dependencies gnus-newsgroup-dependencies))
6014 ((eq gnus-read-all-available-headers t)
6016 ((stringp gnus-read-all-available-headers)
6017 (string-match gnus-read-all-available-headers group))
6020 number headers header)
6022 (set-buffer nntp-server-buffer)
6023 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6024 ;; Allow the user to mangle the headers before parsing them.
6025 (gnus-run-hooks 'gnus-parse-headers-hook)
6026 (goto-char (point-min))
6027 (gnus-parse-without-error
6028 (while (and (or sequence allp)
6030 (setq number (read cur))
6032 (while (and sequence
6033 (< (car sequence) number))
6034 (setq sequence (cdr sequence))))
6037 (eq number (car sequence))))
6039 (setq sequence (cdr sequence))
6040 (setq header (inline
6041 (gnus-nov-parse-line
6042 number dependencies force-new)))))
6043 (push header headers))
6045 ;; A common bug in inn is that if you have posted an article and
6046 ;; then retrieves the active file, it will answer correctly --
6047 ;; the new article is included. However, a NOV entry for the
6048 ;; article may not have been generated yet, so this may fail.
6049 ;; We work around this problem by retrieving the last few
6050 ;; headers using HEAD.
6051 (if (or (not also-fetch-heads)
6053 ;; We (probably) got all the headers.
6055 (let ((gnus-nov-is-evil t))
6058 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6059 (gnus-get-newsgroup-headers))))))))
6061 (defun gnus-article-get-xrefs ()
6062 "Fill in the Xref value in `gnus-current-headers', if necessary.
6063 This is meant to be called in `gnus-article-internal-prepare-hook'."
6064 (let ((headers (with-current-buffer gnus-summary-buffer
6065 gnus-current-headers)))
6066 (or (not gnus-use-cross-reference)
6068 (and (mail-header-xref headers)
6069 (not (string= (mail-header-xref headers) "")))
6070 (let ((case-fold-search t)
6073 (nnheader-narrow-to-headers)
6074 (goto-char (point-min))
6075 (when (or (and (not (eobp))
6076 (eq (downcase (char-after)) ?x)
6077 (looking-at "Xref:"))
6078 (search-forward "\nXref:" nil t))
6079 (goto-char (1+ (match-end 0)))
6080 (setq xref (buffer-substring (point) (point-at-eol)))
6081 (mail-header-set-xref headers xref)))))))
6083 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6084 "Find article ID and insert the summary line for that article.
6085 OLD-HEADER can either be a header or a line number to insert
6086 the subject line on."
6087 (let* ((line (and (numberp old-header) old-header))
6088 (old-header (and (vectorp old-header) old-header))
6089 (header (cond ((and old-header use-old-header)
6092 (gnus-number-to-header id))
6093 (gnus-number-to-header id))
6095 (gnus-read-header id))))
6096 (number (and (numberp id) id))
6099 ;; Rebuild the thread that this article is part of and go to the
6100 ;; article we have fetched.
6101 (when (and (not gnus-show-threads)
6104 (setq d (gnus-data-find (mail-header-number old-header))))
6105 (goto-char (gnus-data-pos d))
6111 (gnus-delete-line))))))
6112 ;; Remove list identifiers from subject.
6113 (when gnus-list-identifiers
6114 (let ((gnus-newsgroup-headers (list header)))
6115 (gnus-summary-remove-list-identifiers)))
6117 (mail-header-set-number header (mail-header-number old-header)))
6118 (setq gnus-newsgroup-sparse
6119 (delq (setq number (mail-header-number header))
6120 gnus-newsgroup-sparse))
6121 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6122 (push number gnus-newsgroup-limit)
6123 (gnus-rebuild-thread (mail-header-id header) line)
6124 (gnus-summary-goto-subject number nil t))
6125 (when (and (numberp number)
6127 ;; We have to update the boundaries even if we can't fetch the
6128 ;; article if ID is a number -- so that the next `P' or `N'
6129 ;; command will fetch the previous (or next) article even
6130 ;; if the one we tried to fetch this time has been canceled.
6131 (when (> number gnus-newsgroup-end)
6132 (setq gnus-newsgroup-end number))
6133 (when (< number gnus-newsgroup-begin)
6134 (setq gnus-newsgroup-begin number))
6135 (setq gnus-newsgroup-unselected
6136 (delq number gnus-newsgroup-unselected)))
6137 ;; Report back a success?
6138 (and header (mail-header-number header))))
6140 ;;; Process/prefix in the summary buffer
6142 (defun gnus-summary-work-articles (n)
6143 "Return a list of articles to be worked upon.
6144 The prefix argument, the list of process marked articles, and the
6145 current article will be taken into consideration."
6147 (set-buffer gnus-summary-buffer)
6150 ;; A numerical prefix has been given.
6151 (setq n (prefix-numeric-value n))
6152 (let ((backward (< n 0))
6153 (n (abs (prefix-numeric-value n)))
6158 (push (setq article (gnus-summary-article-number))
6161 (gnus-summary-find-prev nil article)
6162 (gnus-summary-find-next nil article)))
6164 (nreverse articles)))
6165 ((and (gnus-region-active-p) (mark))
6166 (message "region active")
6167 ;; Work on the region between point and mark.
6168 (let ((max (max (point) (mark)))
6171 (goto-char (min (min (point) (mark))))
6174 (push (setq article (gnus-summary-article-number)) articles)
6175 (gnus-summary-find-next nil article)
6177 (nreverse articles))))
6178 (gnus-newsgroup-processable
6179 ;; There are process-marked articles present.
6180 ;; Save current state.
6181 (gnus-summary-save-process-mark)
6183 (reverse gnus-newsgroup-processable))
6185 ;; Just return the current article.
6186 (list (gnus-summary-article-number))))))
6188 (defmacro gnus-summary-iterate (arg &rest forms)
6189 "Iterate over the process/prefixed articles and do FORMS.
6190 ARG is the interactive prefix given to the command. FORMS will be
6191 executed with point over the summary line of the articles."
6192 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6193 `(let ((,articles (gnus-summary-work-articles ,arg)))
6195 (gnus-summary-goto-subject (car ,articles))
6199 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6200 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6202 (defun gnus-summary-save-process-mark ()
6203 "Push the current set of process marked articles on the stack."
6205 (push (copy-sequence gnus-newsgroup-processable)
6206 gnus-newsgroup-process-stack))
6208 (defun gnus-summary-kill-process-mark ()
6209 "Push the current set of process marked articles on the stack and unmark."
6211 (gnus-summary-save-process-mark)
6212 (gnus-summary-unmark-all-processable))
6214 (defun gnus-summary-yank-process-mark ()
6215 "Pop the last process mark state off the stack and restore it."
6217 (unless gnus-newsgroup-process-stack
6218 (error "Empty mark stack"))
6219 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6221 (defun gnus-summary-process-mark-set (set)
6222 "Make SET into the current process marked articles."
6223 (gnus-summary-unmark-all-processable)
6224 (mapc 'gnus-summary-set-process-mark set))
6226 ;;; Searching and stuff
6228 (defun gnus-summary-search-group (&optional backward use-level)
6229 "Search for next unread newsgroup.
6230 If optional argument BACKWARD is non-nil, search backward instead."
6232 (set-buffer gnus-group-buffer)
6233 (when (gnus-group-search-forward
6234 backward nil (if use-level (gnus-group-group-level) nil))
6235 (gnus-group-group-name))))
6237 (defun gnus-summary-best-group (&optional exclude-group)
6238 "Find the name of the best unread group.
6239 If EXCLUDE-GROUP, do not go to this group."
6240 (with-current-buffer gnus-group-buffer
6242 (gnus-group-best-unread-group exclude-group))))
6244 (defun gnus-summary-find-next (&optional unread article backward)
6246 (gnus-summary-find-prev unread article)
6247 (let* ((dummy (gnus-summary-article-intangible-p))
6248 (article (or article (gnus-summary-article-number)))
6249 (data (gnus-data-find-list article))
6251 (when (and (not dummy)
6252 (or (not gnus-summary-check-current)
6254 (not (gnus-data-unread-p (car data)))))
6255 (setq data (cdr data)))
6260 (unless (memq (gnus-data-number (car data))
6262 ((eq gnus-auto-goto-ignores
6263 'always-undownloaded)
6264 gnus-newsgroup-undownloaded)
6267 ((eq gnus-auto-goto-ignores
6269 gnus-newsgroup-unfetched)
6270 ((eq gnus-auto-goto-ignores
6272 gnus-newsgroup-undownloaded)))
6273 (when (gnus-data-unread-p (car data))
6274 (setq result (car data)
6276 (setq data (cdr data)))
6279 (goto-char (gnus-data-pos result))
6280 (gnus-data-number result)))))
6282 (defun gnus-summary-find-prev (&optional unread article)
6283 (let* ((eobp (eobp))
6284 (article (or article (gnus-summary-article-number)))
6285 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6287 (when (and (not eobp)
6288 (or (not gnus-summary-check-current)
6290 (not (gnus-data-unread-p (car data)))))
6291 (setq data (cdr data)))
6296 (unless (memq (gnus-data-number (car data))
6298 ((eq gnus-auto-goto-ignores
6299 'always-undownloaded)
6300 gnus-newsgroup-undownloaded)
6303 ((eq gnus-auto-goto-ignores
6305 gnus-newsgroup-unfetched)
6306 ((eq gnus-auto-goto-ignores
6308 gnus-newsgroup-undownloaded)))
6309 (when (gnus-data-unread-p (car data))
6310 (setq result (car data)
6312 (setq data (cdr data)))
6315 (goto-char (gnus-data-pos result))
6316 (gnus-data-number result))))
6318 (defun gnus-summary-find-subject (subject &optional unread backward article)
6319 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6320 (article (or article (gnus-summary-article-number)))
6321 (articles (gnus-data-list backward))
6322 (arts (gnus-data-find-list article articles))
6324 (when (or (not gnus-summary-check-current)
6326 (not (gnus-data-unread-p (car arts))))
6327 (setq arts (cdr arts)))
6329 (and (or (not unread)
6330 (gnus-data-unread-p (car arts)))
6331 (vectorp (gnus-data-header (car arts)))
6333 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6334 (setq result (car arts)
6336 (setq arts (cdr arts)))
6338 (goto-char (gnus-data-pos result))
6339 (gnus-data-number result))))
6341 (defun gnus-summary-search-forward (&optional unread subject backward)
6342 "Search forward for an article.
6343 If UNREAD, look for unread articles. If SUBJECT, look for
6344 articles with that subject. If BACKWARD, search backward instead."
6345 (cond (subject (gnus-summary-find-subject subject unread backward))
6346 (backward (gnus-summary-find-prev unread))
6347 (t (gnus-summary-find-next unread))))
6349 (defun gnus-recenter (&optional n)
6350 "Center point in window and redisplay frame.
6351 Also do horizontal recentering."
6353 (when (and gnus-auto-center-summary
6354 (not (eq gnus-auto-center-summary 'vertical)))
6355 (gnus-horizontal-recenter))
6358 (defun gnus-summary-recenter ()
6359 "Center point in the summary window.
6360 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6361 displayed, no centering will be performed."
6362 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6363 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6365 ;; The user has to want it.
6366 (when gnus-auto-center-summary
6367 (let* ((top (cond ((< (window-height) 4) 0)
6368 ((< (window-height) 7) 1)
6369 (t (if (numberp gnus-auto-center-summary)
6370 gnus-auto-center-summary
6371 (/ (1- (window-height)) 2)))))
6372 (height (1- (window-height)))
6373 (bottom (save-excursion (goto-char (point-max))
6374 (forward-line (- height))
6376 (window (get-buffer-window (current-buffer))))
6377 (when (get-buffer-window gnus-article-buffer)
6378 ;; Only do recentering when the article buffer is displayed,
6379 ;; Set the window start to either `bottom', which is the biggest
6380 ;; possible valid number, or the second line from the top,
6381 ;; whichever is the least.
6382 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6383 (if (> bottom top-pos)
6384 ;; Keep the second line from the top visible
6385 (set-window-start window top-pos t)
6386 ;; Try to keep the bottom line visible; if it's partially
6387 ;; obscured, either scroll one more line to make it fully
6388 ;; visible, or revert to using TOP-POS.
6390 (goto-char (point-max))
6392 (let ((last-line-start (point)))
6394 (set-window-start window (point) t)
6395 (when (not (pos-visible-in-window-p last-line-start window))
6397 (set-window-start window (min (point) top-pos) t)))))))
6398 ;; Do horizontal recentering while we're at it.
6399 (when (and (get-buffer-window (current-buffer) t)
6400 (not (eq gnus-auto-center-summary 'vertical)))
6401 (let ((selected (selected-window)))
6402 (select-window (get-buffer-window (current-buffer) t))
6403 (gnus-summary-position-point)
6404 (gnus-horizontal-recenter)
6405 (select-window selected))))))
6407 (defun gnus-summary-jump-to-group (newsgroup)
6408 "Move point to NEWSGROUP in group mode buffer."
6409 ;; Keep update point of group mode buffer if visible.
6410 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6411 (save-window-excursion
6412 ;; Take care of tree window mode.
6413 (when (get-buffer-window gnus-group-buffer)
6414 (pop-to-buffer gnus-group-buffer))
6415 (gnus-group-jump-to-group newsgroup))
6417 ;; Take care of tree window mode.
6418 (if (get-buffer-window gnus-group-buffer)
6419 (pop-to-buffer gnus-group-buffer)
6420 (set-buffer gnus-group-buffer))
6421 (gnus-group-jump-to-group newsgroup))))
6423 ;; This function returns a list of article numbers based on the
6424 ;; difference between the ranges of read articles in this group and
6425 ;; the range of active articles.
6426 (defun gnus-list-of-unread-articles (group)
6427 (let* ((read (gnus-info-read (gnus-get-info group)))
6428 (active (or (gnus-active group) (gnus-activate-group group)))
6431 ;; If none are read, then all are unread.
6433 (setq first (car active))
6434 ;; If the range of read articles is a single range, then the
6435 ;; first unread article is the article after the last read
6436 ;; article. Sounds logical, doesn't it?
6437 (if (and (not (listp (cdr read)))
6438 (or (< (car read) (car active))
6439 (progn (setq read (list read))
6441 (setq first (max (car active) (1+ (cdr read))))
6442 ;; `read' is a list of ranges.
6443 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6446 (setq first (car active)))
6449 (while (< first nlast)
6450 (setq unread (cons first unread)
6452 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6453 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6454 (setq read (cdr read)))))
6455 ;; And add the last unread articles.
6456 (while (<= first last)
6457 (setq unread (cons first unread)
6459 ;; Return the list of unread articles.
6460 (delq 0 (nreverse unread))))
6462 (defun gnus-list-of-read-articles (group)
6463 "Return a list of unread, unticked and non-dormant articles."
6464 (let* ((info (gnus-get-info group))
6465 (marked (gnus-info-marks info))
6466 (active (gnus-active group)))
6468 (gnus-list-range-difference
6469 (gnus-list-range-difference
6470 (gnus-sorted-complement
6471 (gnus-uncompress-range active)
6472 (gnus-list-of-unread-articles group))
6473 (cdr (assq 'dormant marked)))
6474 (cdr (assq 'tick marked))))))
6476 ;; This function returns a sequence of article numbers based on the
6477 ;; difference between the ranges of read articles in this group and
6478 ;; the range of active articles.
6479 (defun gnus-sequence-of-unread-articles (group)
6480 (let* ((read (gnus-info-read (gnus-get-info group)))
6481 (active (or (gnus-active group) (gnus-activate-group group)))
6484 ;; If none are read, then all are unread.
6486 (setq first (car active))
6487 ;; If the range of read articles is a single range, then the
6488 ;; first unread article is the article after the last read
6489 ;; article. Sounds logical, doesn't it?
6490 (if (and (not (listp (cdr read)))
6491 (or (< (car read) (car active))
6492 (progn (setq read (list read))
6494 (setq first (max (car active) (1+ (cdr read))))
6495 ;; `read' is a list of ranges.
6496 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6499 (setq first (car active)))
6502 (push (cons first nlast) unread))
6503 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6504 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6505 (setq read (cdr read)))))
6506 ;; And add the last unread articles.
6507 (cond ((< first last)
6508 (push (cons first last) unread))
6510 (push first unread)))
6511 ;; Return the sequence of unread articles.
6512 (delq 0 (nreverse unread))))
6514 ;; Various summary commands
6516 (defun gnus-summary-select-article-buffer ()
6517 "Reconfigure windows to show article buffer."
6519 (if (not (gnus-buffer-live-p gnus-article-buffer))
6520 (error "There is no article buffer for this summary buffer")
6521 (gnus-configure-windows 'article)
6522 (select-window (get-buffer-window gnus-article-buffer))))
6524 (defun gnus-summary-universal-argument (arg)
6525 "Perform any operation on all articles that are process/prefixed."
6527 (let ((articles (gnus-summary-work-articles arg))