1 ;;; gnus-sum.el --- summary mode commands for gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
7 ;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; Katsumi Yamaoka <yamaoka@jpl.org>
9 ;; Keywords: mail, news, MIME
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA.
34 (defvar tool-bar-mode))
51 (autoload 'pgg-decrypt-region "pgg" nil t)
52 (autoload 'pgg-verify-region "pgg" nil t))
54 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
55 (autoload 'gnus-cache-write-active "gnus-cache")
56 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
57 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
58 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
59 (autoload 'mm-uu-dissect "mm-uu")
60 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
61 "Deuglify broken Outlook (Express) articles and redisplay."
63 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
64 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
65 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
67 (defcustom gnus-kill-summary-on-exit t
68 "*If non-nil, kill the summary buffer when you exit from it.
69 If nil, the summary will become a \"*Dead Summary*\" buffer, and
70 it will be killed sometime later."
71 :group 'gnus-summary-exit
74 (defcustom gnus-fetch-old-headers nil
75 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
76 If an unread article in the group refers to an older, already
77 read (or just marked as read) article, the old article will not
78 normally be displayed in the Summary buffer. If this variable is
79 t, Gnus will attempt to grab the headers to the old articles, and
80 thereby build complete threads. If it has the value `some', all
81 old headers will be fetched but only enough headers to connect
82 otherwise loose threads will be displayed. This variable can
83 also be a number. In that case, no more than that number of old
84 headers will be fetched. If it has the value `invisible', all
85 old headers will be fetched, but none will be displayed.
87 The server has to support NOV for any of this to work.
89 This feature can seriously impact performance it ignores all
90 locally cached header entries."
92 :type '(choice (const :tag "off" nil)
97 (sexp :menu-tag "other" t)))
99 (defcustom gnus-refer-thread-limit 200
100 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
101 If t, fetch all the available old headers."
103 :type '(choice number
104 (sexp :menu-tag "other" t)))
106 (defcustom gnus-summary-make-false-root 'adopt
107 "*nil means that Gnus won't gather loose threads.
108 If the root of a thread has expired or been read in a previous
109 session, the information necessary to build a complete thread has been
110 lost. Instead of having many small sub-threads from this original thread
111 scattered all over the summary buffer, Gnus can gather them.
113 If non-nil, Gnus will try to gather all loose sub-threads from an
114 original thread into one large thread.
116 If this variable is non-nil, it should be one of `none', `adopt',
119 If this variable is `none', Gnus will not make a false root, but just
120 present the sub-threads after another.
121 If this variable is `dummy', Gnus will create a dummy root that will
122 have all the sub-threads as children.
123 If this variable is `adopt', Gnus will make one of the \"children\"
124 the parent and mark all the step-children as such.
125 If this variable is `empty', the \"children\" are printed with empty
126 subject fields. (Or rather, they will be printed with a string
127 given by the `gnus-summary-same-subject' variable.)"
129 :type '(choice (const :tag "off" nil)
135 (defcustom gnus-summary-make-false-root-always nil
136 "Always make a false dummy root."
141 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
142 "*A regexp to match subjects to be excluded from loose thread gathering.
143 As loose thread gathering is done on subjects only, that means that
144 there can be many false gatherings performed. By rooting out certain
145 common subjects, gathering might become saner."
149 (defcustom gnus-summary-gather-subject-limit nil
150 "*Maximum length of subject comparisons when gathering loose threads.
151 Use nil to compare full subjects. Setting this variable to a low
152 number will help gather threads that have been corrupted by
153 newsreaders chopping off subject lines, but it might also mean that
154 unrelated articles that have subject that happen to begin with the
155 same few characters will be incorrectly gathered.
157 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
160 :type '(choice (const :tag "off" nil)
162 (sexp :menu-tag "on" t)))
164 (defcustom gnus-simplify-subject-functions nil
165 "List of functions taking a string argument that simplify subjects.
166 The functions are applied recursively.
168 Useful functions to put in this list include:
169 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
170 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
172 :type '(repeat function))
174 (defcustom gnus-simplify-ignored-prefixes nil
175 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
177 :type '(choice (const :tag "off" nil)
180 (defcustom gnus-build-sparse-threads nil
181 "*If non-nil, fill in the gaps in threads.
182 If `some', only fill in the gaps that are needed to tie loose threads
183 together. If `more', fill in all leaf nodes that Gnus can find. If
184 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
186 :type '(choice (const :tag "off" nil)
189 (sexp :menu-tag "all" t)))
191 (defcustom gnus-summary-thread-gathering-function
192 'gnus-gather-threads-by-subject
193 "*Function used for gathering loose threads.
194 There are two pre-defined functions: `gnus-gather-threads-by-subject',
195 which only takes Subjects into consideration; and
196 `gnus-gather-threads-by-references', which compared the References
197 headers of the articles to find matches."
199 :type '(radio (function-item gnus-gather-threads-by-subject)
200 (function-item gnus-gather-threads-by-references)
201 (function :tag "other")))
203 (defcustom gnus-summary-same-subject ""
204 "*String indicating that the current article has the same subject as the previous.
205 This variable will only be used if the value of
206 `gnus-summary-make-false-root' is `empty'."
207 :group 'gnus-summary-format
210 (defcustom gnus-summary-goto-unread t
211 "*If t, many commands will go to the next unread article.
212 This applies to marking commands as well as other commands that
213 \"naturally\" select the next article, like, for instance, `SPC' at
214 the end of an article.
216 If nil, the marking commands do NOT go to the next unread article
217 \(they go to the next article instead). If `never', commands that
218 usually go to the next unread article, will go to the next article,
219 whether it is read or not."
220 :group 'gnus-summary-marks
221 :link '(custom-manual "(gnus)Setting Marks")
222 :type '(choice (const :tag "off" nil)
224 (sexp :menu-tag "on" t)))
226 (defcustom gnus-summary-default-score 0
227 "*Default article score level.
228 All scores generated by the score files will be added to this score.
229 If this variable is nil, scoring will be disabled."
230 :group 'gnus-score-default
231 :type '(choice (const :tag "disable")
234 (defcustom gnus-summary-default-high-score 0
235 "*Default threshold for a high scored article.
236 An article will be highlighted as high scored if its score is greater
239 :group 'gnus-score-default
242 (defcustom gnus-summary-default-low-score 0
243 "*Default threshold for a low scored article.
244 An article will be highlighted as low scored if its score is smaller
247 :group 'gnus-score-default
250 (defcustom gnus-summary-zcore-fuzz 0
251 "*Fuzziness factor for the zcore in the summary buffer.
252 Articles with scores closer than this to `gnus-summary-default-score'
254 :group 'gnus-summary-format
257 (defcustom gnus-simplify-subject-fuzzy-regexp nil
258 "*Strings to be removed when doing fuzzy matches.
259 This can either be a regular expression or list of regular expressions
260 that will be removed from subject strings if fuzzy subject
261 simplification is selected."
263 :type '(repeat regexp))
265 (defcustom gnus-show-threads t
266 "*If non-nil, display threads in summary mode."
270 (defcustom gnus-thread-hide-subtree nil
271 "*If non-nil, hide all threads initially.
272 This can be a predicate specifier which says which threads to hide.
273 If threads are hidden, you have to run the command
274 `gnus-summary-show-thread' by hand or or select an article."
276 :type '(radio (sexp :format "Non-nil\n"
277 :match (lambda (widget value)
278 (not (or (consp value) (functionp value))))
281 (sexp :tag "Predicate specifier")))
283 (defcustom gnus-thread-hide-killed t
284 "*If non-nil, hide killed threads automatically."
288 (defcustom gnus-thread-ignore-subject t
289 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
290 If nil, articles that have different subjects from their parents will
291 start separate threads."
295 (defcustom gnus-thread-operation-ignore-subject t
296 "*If non-nil, subjects will be ignored when doing thread commands.
297 This affects commands like `gnus-summary-kill-thread' and
298 `gnus-summary-lower-thread'.
300 If this variable is nil, articles in the same thread with different
301 subjects will not be included in the operation in question. If this
302 variable is `fuzzy', only articles that have subjects that are fuzzily
303 equal will be included."
305 :type '(choice (const :tag "off" nil)
309 (defcustom gnus-thread-indent-level 4
310 "*Number that says how much each sub-thread should be indented."
314 (defcustom gnus-auto-extend-newsgroup t
315 "*If non-nil, extend newsgroup forward and backward when requested."
316 :group 'gnus-summary-choose
319 (defcustom gnus-auto-select-first t
320 "*If non-nil, select the article under point.
321 Which article this is is controlled by the `gnus-auto-select-subject'
324 If you want to prevent automatic selection of articles in some
325 newsgroups, set the variable to nil in `gnus-select-group-hook'."
326 :group 'gnus-group-select
327 :type '(choice (const :tag "none" nil)
328 (sexp :menu-tag "first" t)))
330 (defcustom gnus-auto-select-subject 'unread
331 "*Says what subject to place under point when entering a group.
333 This variable can either be the symbols `first' (place point on the
334 first subject), `unread' (place point on the subject line of the first
335 unread article), `best' (place point on the subject line of the
336 higest-scored article), `unseen' (place point on the subject line of
337 the first unseen article), `unseen-or-unread' (place point on the subject
338 line of the first unseen article or, if all article have been seen, on the
339 subject line of the first unread article), or a function to be called to
340 place point on some subject line."
342 :group 'gnus-group-select
343 :type '(choice (const best)
347 (const unseen-or-unread)))
349 (defcustom gnus-dont-select-after-jump-to-other-group nil
350 "If non-nil, don't select the first unread article after entering the
351 other group by the command `gnus-summary-jump-to-other-group'. If nil,
352 it is depend on the value of `gnus-auto-select-first' whether to select
354 :group 'gnus-group-select
357 (defcustom gnus-auto-select-next t
358 "*If non-nil, offer to go to the next group from the end of the previous.
359 If the value is t and the next newsgroup is empty, Gnus will exit
360 summary mode and go back to group mode. If the value is neither nil
361 nor t, Gnus will select the following unread newsgroup. In
362 particular, if the value is the symbol `quietly', the next unread
363 newsgroup will be selected without any confirmation, and if it is
364 `almost-quietly', the next group will be selected without any
365 confirmation if you are located on the last article in the group.
366 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
367 will go to the next group without confirmation."
368 :group 'gnus-summary-maneuvering
369 :type '(choice (const :tag "off" nil)
371 (const almost-quietly)
372 (const slightly-quietly)
373 (sexp :menu-tag "on" t)))
375 (defcustom gnus-auto-select-same nil
376 "*If non-nil, select the next article with the same subject.
377 If there are no more articles with the same subject, go to
378 the first unread article."
379 :group 'gnus-summary-maneuvering
382 (defcustom gnus-auto-goto-ignores 'unfetched
383 "*Says how to handle unfetched articles when maneuvering.
385 This variable can either be the symbols nil (maneuver to any
386 article), `undownloaded' (maneuvering while unplugged ignores articles
387 that have not been fetched), `always-undownloaded' (maneuvering always
388 ignores articles that have not been fetched), `unfetched' (maneuvering
389 ignores articles whose headers have not been fetched).
391 NOTE: The list of unfetched articles will always be nil when plugged
392 and, when unplugged, a subset of the undownloaded article list."
394 :group 'gnus-summary-maneuvering
395 :type '(choice (const :tag "None" nil)
396 (const :tag "Undownloaded when unplugged" undownloaded)
397 (const :tag "Undownloaded" always-undownloaded)
398 (const :tag "Unfetched" unfetched)))
400 (defcustom gnus-summary-check-current nil
401 "*If non-nil, consider the current article when moving.
402 The \"unread\" movement commands will stay on the same line if the
403 current article is unread."
404 :group 'gnus-summary-maneuvering
407 (defcustom gnus-auto-center-summary 2
408 "*If non-nil, always center the current summary buffer.
409 In particular, if `vertical' do only vertical recentering. If non-nil
410 and non-`vertical', do both horizontal and vertical recentering."
411 :group 'gnus-summary-maneuvering
412 :type '(choice (const :tag "none" nil)
414 (integer :tag "height")
415 (sexp :menu-tag "both" t)))
417 (defvar gnus-auto-center-group t
418 "*If non-nil, always center the group buffer.")
420 (defcustom gnus-show-all-headers nil
421 "*If non-nil, don't hide any headers."
422 :group 'gnus-article-hiding
423 :group 'gnus-article-headers
426 (defcustom gnus-summary-ignore-duplicates nil
427 "*If non-nil, ignore articles with identical Message-ID headers."
431 (defcustom gnus-single-article-buffer t
432 "*If non-nil, display all articles in the same buffer.
433 If nil, each group will get its own article buffer."
434 :group 'gnus-article-various
437 (defcustom gnus-break-pages t
438 "*If non-nil, do page breaking on articles.
439 The page delimiter is specified by the `gnus-page-delimiter'
441 :group 'gnus-article-various
444 (defcustom gnus-show-mime t
445 "*If non-nil, do mime processing of articles.
446 The articles will simply be fed to the function given by
447 `gnus-article-display-method-for-mime'."
448 :group 'gnus-article-mime
451 (defcustom gnus-move-split-methods nil
452 "*Variable used to suggest where articles are to be moved to.
453 It uses the same syntax as the `gnus-split-methods' variable.
454 However, whereas `gnus-split-methods' specifies file names as targets,
455 this variable specifies group names."
456 :group 'gnus-summary-mail
457 :type '(repeat (choice (list :value (fun) function)
458 (cons :value ("" "") regexp (repeat string))
461 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
462 "Function used to compute default prefix for article move/copy/etc prompts.
463 The function should take one argument, a group name, and return a
464 string with the suggested prefix."
465 :group 'gnus-summary-mail
468 ;; FIXME: Although the custom type is `character' for the following variables,
469 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
471 (defcustom gnus-unread-mark ?\ ;;;Whitespace
472 "*Mark used for unread articles."
473 :group 'gnus-summary-marks
476 (defcustom gnus-ticked-mark ?!
477 "*Mark used for ticked articles."
478 :group 'gnus-summary-marks
481 (defcustom gnus-dormant-mark ??
482 "*Mark used for dormant articles."
483 :group 'gnus-summary-marks
486 (defcustom gnus-del-mark ?r
487 "*Mark used for del'd articles."
488 :group 'gnus-summary-marks
491 (defcustom gnus-read-mark ?R
492 "*Mark used for read articles."
493 :group 'gnus-summary-marks
496 (defcustom gnus-expirable-mark ?E
497 "*Mark used for expirable articles."
498 :group 'gnus-summary-marks
501 (defcustom gnus-killed-mark ?K
502 "*Mark used for killed articles."
503 :group 'gnus-summary-marks
506 (defcustom gnus-spam-mark ?$
507 "*Mark used for spam articles."
509 :group 'gnus-summary-marks
512 (defcustom gnus-souped-mark ?F
513 "*Mark used for souped articles."
514 :group 'gnus-summary-marks
517 (defcustom gnus-kill-file-mark ?X
518 "*Mark used for articles killed by kill files."
519 :group 'gnus-summary-marks
522 (defcustom gnus-low-score-mark ?Y
523 "*Mark used for articles with a low score."
524 :group 'gnus-summary-marks
527 (defcustom gnus-catchup-mark ?C
528 "*Mark used for articles that are caught up."
529 :group 'gnus-summary-marks
532 (defcustom gnus-replied-mark ?A
533 "*Mark used for articles that have been replied to."
534 :group 'gnus-summary-marks
537 (defcustom gnus-forwarded-mark ?F
538 "*Mark used for articles that have been forwarded."
540 :group 'gnus-summary-marks
543 (defcustom gnus-recent-mark ?N
544 "*Mark used for articles that are recent."
546 :group 'gnus-summary-marks
549 (defcustom gnus-cached-mark ?*
550 "*Mark used for articles that are in the cache."
551 :group 'gnus-summary-marks
554 (defcustom gnus-saved-mark ?S
555 "*Mark used for articles that have been saved."
556 :group 'gnus-summary-marks
559 (defcustom gnus-unseen-mark ?.
560 "*Mark used for articles that haven't been seen."
562 :group 'gnus-summary-marks
565 (defcustom gnus-no-mark ?\ ;;;Whitespace
566 "*Mark used for articles that have no other secondary mark."
568 :group 'gnus-summary-marks
571 (defcustom gnus-ancient-mark ?O
572 "*Mark used for ancient articles."
573 :group 'gnus-summary-marks
576 (defcustom gnus-sparse-mark ?Q
577 "*Mark used for sparsely reffed articles."
578 :group 'gnus-summary-marks
581 (defcustom gnus-canceled-mark ?G
582 "*Mark used for canceled articles."
583 :group 'gnus-summary-marks
586 (defcustom gnus-duplicate-mark ?M
587 "*Mark used for duplicate articles."
588 :group 'gnus-summary-marks
591 (defcustom gnus-undownloaded-mark ?-
592 "*Mark used for articles that weren't downloaded."
594 :group 'gnus-summary-marks
597 (defcustom gnus-downloaded-mark ?+
598 "*Mark used for articles that were downloaded."
599 :group 'gnus-summary-marks
602 (defcustom gnus-downloadable-mark ?%
603 "*Mark used for articles that are to be downloaded."
604 :group 'gnus-summary-marks
607 (defcustom gnus-unsendable-mark ?=
608 "*Mark used for articles that won't be sent."
609 :group 'gnus-summary-marks
612 (defcustom gnus-score-over-mark ?+
613 "*Score mark used for articles with high scores."
614 :group 'gnus-summary-marks
617 (defcustom gnus-score-below-mark ?-
618 "*Score mark used for articles with low scores."
619 :group 'gnus-summary-marks
622 (defcustom gnus-empty-thread-mark ?\ ;;;Whitespace
623 "*There is no thread under the article."
624 :group 'gnus-summary-marks
627 (defcustom gnus-not-empty-thread-mark ?=
628 "*There is a thread under the article."
629 :group 'gnus-summary-marks
632 (defcustom gnus-view-pseudo-asynchronously nil
633 "*If non-nil, Gnus will view pseudo-articles asynchronously."
634 :group 'gnus-extract-view
637 (defcustom gnus-auto-expirable-marks
638 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
639 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
640 gnus-souped-mark gnus-duplicate-mark)
641 "*The list of marks converted into expiration if a group is auto-expirable."
644 :type '(repeat character))
646 (defcustom gnus-inhibit-user-auto-expire t
647 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
652 (defcustom gnus-view-pseudos nil
653 "*If `automatic', pseudo-articles will be viewed automatically.
654 If `not-confirm', pseudos will be viewed automatically, and the user
655 will not be asked to confirm the command."
656 :group 'gnus-extract-view
657 :type '(choice (const :tag "off" nil)
659 (const not-confirm)))
661 (defcustom gnus-view-pseudos-separately t
662 "*If non-nil, one pseudo-article will be created for each file to be viewed.
663 If nil, all files that use the same viewing command will be given as a
664 list of parameters to that command."
665 :group 'gnus-extract-view
668 (defcustom gnus-insert-pseudo-articles t
669 "*If non-nil, insert pseudo-articles when decoding articles."
670 :group 'gnus-extract-view
673 (defcustom gnus-summary-dummy-line-format
675 "*The format specification for the dummy roots in the summary buffer.
676 It works along the same lines as a normal formatting string,
677 with some simple extensions.
681 General format specifiers can also be used.
682 See `(gnus)Formatting Variables'."
683 :link '(custom-manual "(gnus)Formatting Variables")
684 :group 'gnus-threading
687 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
688 "*The format specification for the summary mode line.
689 It works along the same lines as a normal formatting string,
690 with some simple extensions:
693 %p Unprefixed group name
694 %A Current article number
695 %z Current article score
697 %U Number of unread articles in the group
698 %e Number of unselected articles in the group
699 %Z A string with unread/unselected article counts
700 %g Shortish group name
701 %S Subject of the current article
703 %s Current score file name
704 %d Number of dormant articles
705 %r Number of articles that have been marked as read in this session
706 %E Number of articles expunged by the score files"
707 :group 'gnus-summary-format
710 (defcustom gnus-list-identifiers nil
711 "Regexp that matches list identifiers to be removed from subject.
712 This can also be a list of regexps."
714 :group 'gnus-summary-format
715 :group 'gnus-article-hiding
716 :type '(choice (const :tag "none" nil)
718 (repeat :value (".*") regexp)))
720 (defcustom gnus-summary-mark-below 0
721 "*Mark all articles with a score below this variable as read.
722 This variable is local to each summary buffer and usually set by the
724 :group 'gnus-score-default
727 (defun gnus-widget-reversible-match (widget value)
728 "Ignoring WIDGET, convert VALUE to internal form.
729 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
733 (eq (length value) 2)
734 (eq (nth 0 value) 'not)
735 (symbolp (nth 1 value)))))
737 (defun gnus-widget-reversible-to-internal (widget value)
738 "Ignoring WIDGET, convert VALUE to internal form.
739 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
740 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
744 (list (nth 1 value) t)))
746 (defun gnus-widget-reversible-to-external (widget value)
747 "Ignoring WIDGET, convert VALUE to external form.
748 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
749 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
752 (list 'not (nth 0 value))
755 (define-widget 'gnus-widget-reversible 'group
756 "A `group' that convert values."
757 :match 'gnus-widget-reversible-match
758 :value-to-internal 'gnus-widget-reversible-to-internal
759 :value-to-external 'gnus-widget-reversible-to-external)
761 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
762 "*List of functions used for sorting articles in the summary buffer.
764 Each function takes two articles and returns non-nil if the first
765 article should be sorted before the other. If you use more than one
766 function, the primary sort function should be the last. You should
767 probably always include `gnus-article-sort-by-number' in the list of
768 sorting functions -- preferably first. Also note that sorting by date
769 is often much slower than sorting by number, and the sorting order is
770 very similar. (Sorting by date means sorting by the time the message
771 was sent, sorting by number means sorting by arrival time.)
773 Each item can also be a list `(not F)' where F is a function;
774 this reverses the sort order.
776 Ready-made functions include `gnus-article-sort-by-number',
777 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
778 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
779 and `gnus-article-sort-by-score'.
781 When threading is turned on, the variable `gnus-thread-sort-functions'
782 controls how articles are sorted."
783 :group 'gnus-summary-sort
784 :type '(repeat (gnus-widget-reversible
785 (choice (function-item gnus-article-sort-by-number)
786 (function-item gnus-article-sort-by-author)
787 (function-item gnus-article-sort-by-subject)
788 (function-item gnus-article-sort-by-date)
789 (function-item gnus-article-sort-by-score)
790 (function-item gnus-article-sort-by-random)
791 (function :tag "other"))
792 (boolean :tag "Reverse order"))))
795 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
796 "*List of functions used for sorting threads in the summary buffer.
797 By default, threads are sorted by article number.
799 Each function takes two threads and returns non-nil if the first
800 thread should be sorted before the other. If you use more than one
801 function, the primary sort function should be the last. You should
802 probably always include `gnus-thread-sort-by-number' in the list of
803 sorting functions -- preferably first. Also note that sorting by date
804 is often much slower than sorting by number, and the sorting order is
805 very similar. (Sorting by date means sorting by the time the message
806 was sent, sorting by number means sorting by arrival time.)
808 Each list item can also be a list `(not F)' where F is a
809 function; this specifies reversed sort order.
811 Ready-made functions include `gnus-thread-sort-by-number',
812 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
813 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
814 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
815 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
816 and `gnus-thread-sort-by-total-score' (see
817 `gnus-thread-score-function').
819 When threading is turned off, the variable
820 `gnus-article-sort-functions' controls how articles are sorted."
821 :group 'gnus-summary-sort
823 (gnus-widget-reversible
824 (choice (function-item gnus-thread-sort-by-number)
825 (function-item gnus-thread-sort-by-author)
826 (function-item gnus-thread-sort-by-recipient)
827 (function-item gnus-thread-sort-by-subject)
828 (function-item gnus-thread-sort-by-date)
829 (function-item gnus-thread-sort-by-score)
830 (function-item gnus-thread-sort-by-most-recent-number)
831 (function-item gnus-thread-sort-by-most-recent-date)
832 (function-item gnus-thread-sort-by-random)
833 (function-item gnus-thread-sort-by-total-score)
834 (function :tag "other"))
835 (boolean :tag "Reverse order"))))
837 (defcustom gnus-thread-score-function '+
838 "*Function used for calculating the total score of a thread.
840 The function is called with the scores of the article and each
841 subthread and should then return the score of the thread.
843 Some functions you can use are `+', `max', or `min'."
844 :group 'gnus-summary-sort
847 (defcustom gnus-summary-expunge-below nil
848 "All articles that have a score less than this variable will be expunged.
849 This variable is local to the summary buffers."
850 :group 'gnus-score-default
851 :type '(choice (const :tag "off" nil)
854 (defcustom gnus-thread-expunge-below nil
855 "All threads that have a total score less than this variable will be expunged.
856 See `gnus-thread-score-function' for en explanation of what a
859 This variable is local to the summary buffers."
860 :group 'gnus-threading
861 :group 'gnus-score-default
862 :type '(choice (const :tag "off" nil)
865 (defcustom gnus-summary-mode-hook nil
866 "*A hook for Gnus summary mode.
867 This hook is run before any variables are set in the summary buffer."
868 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
869 :group 'gnus-summary-various
872 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
873 (when (featurep 'xemacs)
874 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
875 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
876 (add-hook 'gnus-summary-mode-hook
877 'gnus-xmas-switch-horizontal-scrollbar-off))
879 (defcustom gnus-summary-menu-hook nil
880 "*Hook run after the creation of the summary mode menu."
881 :group 'gnus-summary-visual
884 (defcustom gnus-summary-exit-hook nil
885 "*A hook called on exit from the summary buffer.
886 It will be called with point in the group buffer."
887 :group 'gnus-summary-exit
890 (defcustom gnus-summary-prepare-hook nil
891 "*A hook called after the summary buffer has been generated.
892 If you want to modify the summary buffer, you can use this hook."
893 :group 'gnus-summary-various
896 (defcustom gnus-summary-prepared-hook nil
897 "*A hook called as the last thing after the summary buffer has been generated."
898 :group 'gnus-summary-various
901 (defcustom gnus-summary-generate-hook nil
902 "*A hook run just before generating the summary buffer.
903 This hook is commonly used to customize threading variables and the
905 :group 'gnus-summary-various
908 (defcustom gnus-select-group-hook nil
909 "*A hook called when a newsgroup is selected.
911 If you'd like to simplify subjects like the
912 `gnus-summary-next-same-subject' command does, you can use the
915 (add-hook gnus-select-group-hook
917 (mapcar (lambda (header)
918 (mail-header-set-subject
920 (gnus-simplify-subject
921 (mail-header-subject header) 're-only)))
922 gnus-newsgroup-headers)))"
923 :group 'gnus-group-select
926 (defcustom gnus-select-article-hook nil
927 "*A hook called when an article is selected."
928 :group 'gnus-summary-choose
929 :options '(gnus-agent-fetch-selected-article)
932 (defcustom gnus-visual-mark-article-hook
933 (list 'gnus-highlight-selected-summary)
934 "*Hook run after selecting an article in the summary buffer.
935 It is meant to be used for highlighting the article in some way. It
936 is not run if `gnus-visual' is nil."
937 :group 'gnus-summary-visual
940 (defcustom gnus-parse-headers-hook '(gnus-summary-inherit-default-charset)
941 "*A hook called before parsing the headers."
945 (defcustom gnus-exit-group-hook nil
946 "*A hook called when exiting summary mode.
947 This hook is not called from the non-updating exit commands like `Q'."
951 (defcustom gnus-summary-update-hook
952 (list 'gnus-summary-highlight-line)
953 "*A hook called when a summary line is changed.
954 The hook will not be called if `gnus-visual' is nil.
956 The default function `gnus-summary-highlight-line' will
957 highlight the line according to the `gnus-summary-highlight'
959 :group 'gnus-summary-visual
962 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
963 "*A hook called when an article is selected for the first time.
964 The hook is intended to mark an article as read (or unread)
965 automatically when it is selected."
966 :group 'gnus-summary-choose
969 (defcustom gnus-group-no-more-groups-hook nil
970 "*A hook run when returning to group mode having no more (unread) groups."
971 :group 'gnus-group-select
974 (defcustom gnus-ps-print-hook nil
975 "*A hook run before ps-printing something from Gnus."
979 (defcustom gnus-summary-article-move-hook nil
980 "*A hook called after an article is moved, copied, respooled, or crossposted."
985 (defcustom gnus-summary-article-delete-hook nil
986 "*A hook called after an article is deleted."
991 (defcustom gnus-summary-article-expire-hook nil
992 "*A hook called after an article is expired."
997 (defcustom gnus-summary-display-arrow
998 (and (fboundp 'display-graphic-p)
1000 "*If non-nil, display an arrow highlighting the current article."
1002 :group 'gnus-summary
1005 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1006 "Face used for highlighting the current article in the summary buffer."
1007 :group 'gnus-summary-visual
1010 (defvar gnus-tmp-downloaded nil)
1012 (defcustom gnus-summary-highlight
1013 '(((eq mark gnus-canceled-mark)
1014 . gnus-summary-cancelled)
1015 ((and uncached (> score default-high))
1016 . gnus-summary-high-undownloaded)
1017 ((and uncached (< score default-low))
1018 . gnus-summary-low-undownloaded)
1020 . gnus-summary-normal-undownloaded)
1021 ((and (> score default-high)
1022 (or (eq mark gnus-dormant-mark)
1023 (eq mark gnus-ticked-mark)))
1024 . gnus-summary-high-ticked)
1025 ((and (< score default-low)
1026 (or (eq mark gnus-dormant-mark)
1027 (eq mark gnus-ticked-mark)))
1028 . gnus-summary-low-ticked)
1029 ((or (eq mark gnus-dormant-mark)
1030 (eq mark gnus-ticked-mark))
1031 . gnus-summary-normal-ticked)
1032 ((and (> score default-high) (eq mark gnus-ancient-mark))
1033 . gnus-summary-high-ancient)
1034 ((and (< score default-low) (eq mark gnus-ancient-mark))
1035 . gnus-summary-low-ancient)
1036 ((eq mark gnus-ancient-mark)
1037 . gnus-summary-normal-ancient)
1038 ((and (> score default-high) (eq mark gnus-unread-mark))
1039 . gnus-summary-high-unread)
1040 ((and (< score default-low) (eq mark gnus-unread-mark))
1041 . gnus-summary-low-unread)
1042 ((eq mark gnus-unread-mark)
1043 . gnus-summary-normal-unread)
1044 ((> score default-high)
1045 . gnus-summary-high-read)
1046 ((< score default-low)
1047 . gnus-summary-low-read)
1049 . gnus-summary-normal-read))
1050 "*Controls the highlighting of summary buffer lines.
1052 A list of (FORM . FACE) pairs. When deciding how a a particular
1053 summary line should be displayed, each form is evaluated. The content
1054 of the face field after the first true form is used. You can change
1055 how those summary lines are displayed, by editing the face field.
1057 You can use the following variables in the FORM field.
1059 score: The article's score
1060 default: The default article score.
1061 default-high: The default score for high scored articles.
1062 default-low: The default score for low scored articles.
1063 below: The score below which articles are automatically marked as read.
1064 mark: The article's mark.
1065 uncached: Non-nil if the article is uncached."
1066 :group 'gnus-summary-visual
1067 :type '(repeat (cons (sexp :tag "Form" nil)
1070 (defcustom gnus-alter-header-function nil
1071 "Function called to allow alteration of article header structures.
1072 The function is called with one parameter, the article header vector,
1073 which it may alter in any way."
1074 :type '(choice (const :tag "None" nil)
1076 :group 'gnus-summary)
1078 (defvar gnus-decode-encoded-word-function
1079 (mime-find-field-decoder 'From 'nov)
1080 "Variable that says which function should be used to decode a string with encoded words.")
1082 (defcustom gnus-extra-headers '(To Newsgroups)
1083 "*Extra headers to parse."
1085 :group 'gnus-summary
1086 :type '(repeat symbol))
1088 (defcustom gnus-ignored-from-addresses
1089 (and user-mail-address
1090 (not (string= user-mail-address ""))
1091 (regexp-quote user-mail-address))
1092 "*Regexp of From headers that may be suppressed in favor of To headers."
1094 :group 'gnus-summary
1097 (defcustom gnus-summary-to-prefix "-> "
1098 "*String prefixed to the To field in the summary line when
1099 using `gnus-ignored-from-addresses'."
1101 :group 'gnus-summary
1104 (defcustom gnus-summary-newsgroup-prefix "=> "
1105 "*String prefixed to the Newsgroup field in the summary
1106 line when using `gnus-ignored-from-addresses'."
1108 :group 'gnus-summary
1111 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1112 "List of charsets that should be ignored.
1113 When these charsets are used in the \"charset\" parameter, the
1114 default charset will be used instead."
1116 :type '(repeat symbol)
1117 :group 'gnus-charset)
1119 (gnus-define-group-parameter
1123 "Return the ignored charsets of GROUP."
1124 :variable gnus-group-ignored-charsets-alist
1126 '(("alt\\.chinese\\.text" iso-8859-1))
1128 "Alist of regexps (to match group names) and charsets that should be ignored.
1129 When these charsets are used in the \"charset\" parameter, the
1130 default charset will be used instead."
1131 :variable-group gnus-charset
1132 :variable-type '(repeat (cons (regexp :tag "Group")
1134 :parameter-type '(choice :tag "Ignored charsets"
1137 :parameter-document "\
1138 List of charsets that should be ignored.
1140 When these charsets are used in the \"charset\" parameter, the
1141 default charset will be used instead.")
1143 (defcustom gnus-group-highlight-words-alist nil
1144 "Alist of group regexps and highlight regexps.
1145 This variable uses the same syntax as `gnus-emphasis-alist'."
1147 :type '(repeat (cons (regexp :tag "Group")
1148 (repeat (list (regexp :tag "Highlight regexp")
1149 (number :tag "Group for entire word" 0)
1150 (number :tag "Group for displayed part" 0)
1152 gnus-emphasis-highlight-words)))))
1153 :group 'gnus-summary-visual)
1155 (defcustom gnus-use-wheel nil
1156 "Use Intelli-mouse on summary movement"
1158 :group 'gnus-summary-maneuvering)
1160 (defcustom gnus-wheel-scroll-amount '(5 . 1)
1161 "Amount to scroll messages by spinning the mouse wheel.
1162 This is actually a cons cell, where the first item is the amount to scroll
1163 on a normal wheel event, and the second is the amount to scroll when the
1164 wheel is moved with the shift key depressed."
1165 :type '(cons (integer :tag "Shift") integer)
1166 :group 'gnus-summary-maneuvering)
1168 (defcustom gnus-wheel-edge-resistance 2
1169 "How hard it should be to change the current article
1170 by moving the mouse over the edge of the article window."
1172 :group 'gnus-summary-maneuvering)
1174 (defcustom gnus-summary-show-article-charset-alist
1176 "Alist of number and charset.
1177 The article will be shown with the charset corresponding to the
1179 For example: ((1 . cn-gb-2312) (2 . big5))."
1181 :type '(repeat (cons (number :tag "Argument" 1)
1182 (symbol :tag "Charset")))
1183 :group 'gnus-charset)
1185 (defcustom gnus-preserve-marks t
1186 "Whether marks are preserved when moving, copying and respooling messages."
1189 :group 'gnus-summary-marks)
1191 (defcustom gnus-alter-articles-to-read-function nil
1192 "Function to be called to alter the list of articles to be selected."
1193 :type '(choice (const nil) function)
1194 :group 'gnus-summary)
1196 (defcustom gnus-orphan-score nil
1197 "*All orphans get this score added. Set in the score file."
1198 :group 'gnus-score-default
1199 :type '(choice (const nil)
1202 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1203 "*A regexp to match MIME parts when saving multiple parts of a
1204 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1205 This regexp will be used by default when prompting the user for which
1206 type of files to save."
1207 :group 'gnus-summary
1210 (defcustom gnus-read-all-available-headers nil
1211 "Whether Gnus should parse all headers made available to it.
1212 This is mostly relevant for slow back ends where the user may
1213 wish to widen the summary buffer to include all headers
1214 that were fetched. Say, for nnultimate groups."
1216 :group 'gnus-summary
1217 :type '(choice boolean regexp))
1219 (defcustom gnus-summary-muttprint-program "muttprint"
1220 "Command (and optional arguments) used to run Muttprint."
1222 :group 'gnus-summary
1225 (defcustom gnus-article-loose-mime t
1226 "If non-nil, don't require MIME-Version header.
1227 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1228 supply the MIME-Version header or deliberately strip it from the mail.
1229 If non-nil (the default), Gnus will treat some articles as MIME
1230 even if the MIME-Version header is missing."
1233 :group 'gnus-article-mime)
1235 (defcustom gnus-article-emulate-mime t
1236 "If non-nil, use MIME emulation for uuencode and the like.
1237 This means that Gnus will search message bodies for text that look
1238 like uuencoded bits, yEncoded bits, and so on, and present that using
1239 the normal Gnus MIME machinery."
1242 :group 'gnus-article-mime)
1244 ;;; Internal variables
1246 (defvar gnus-summary-display-cache nil)
1247 (defvar gnus-article-mime-handles nil)
1248 (defvar gnus-article-decoded-p nil)
1249 (defvar gnus-article-charset nil)
1250 (defvar gnus-article-ignored-charsets nil)
1251 (defvar gnus-scores-exclude-files nil)
1252 (defvar gnus-page-broken nil)
1254 (defvar gnus-original-article nil)
1255 (defvar gnus-article-internal-prepare-hook nil)
1256 (defvar gnus-newsgroup-process-stack nil)
1258 (defvar gnus-thread-indent-array nil)
1259 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1260 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1261 "Function called to sort the articles within a thread after it has been gathered together.")
1263 (defvar gnus-summary-save-parts-type-history nil)
1264 (defvar gnus-summary-save-parts-last-directory nil)
1266 ;; Avoid highlighting in kill files.
1267 (defvar gnus-summary-inhibit-highlight nil)
1268 (defvar gnus-newsgroup-selected-overlay nil)
1269 (defvar gnus-inhibit-limiting nil)
1270 (defvar gnus-newsgroup-adaptive-score-file nil)
1271 (defvar gnus-current-score-file nil)
1272 (defvar gnus-current-move-group nil)
1273 (defvar gnus-current-copy-group nil)
1274 (defvar gnus-current-crosspost-group nil)
1275 (defvar gnus-newsgroup-display nil)
1277 (defvar gnus-newsgroup-dependencies nil)
1278 (defvar gnus-newsgroup-adaptive nil)
1279 (defvar gnus-summary-display-article-function nil)
1280 (defvar gnus-summary-highlight-line-function nil
1281 "Function called after highlighting a summary line.")
1283 (defvar gnus-summary-line-format-alist
1284 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1285 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1286 (?s gnus-tmp-subject-or-nil ?s)
1287 (?n gnus-tmp-name ?s)
1288 (?A (std11-address-string
1289 (car (mime-entity-read-field gnus-tmp-header 'From))) ?s)
1290 (?a (or (std11-full-name-string
1291 (car (mime-entity-read-field gnus-tmp-header 'From)))
1293 (?F gnus-tmp-from ?s)
1294 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1295 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1296 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1297 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1298 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1299 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1300 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1301 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1302 (?L gnus-tmp-lines ?s)
1303 (?O gnus-tmp-downloaded ?c)
1304 (?I gnus-tmp-indentation ?s)
1305 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1306 (?R gnus-tmp-replied ?c)
1307 (?\[ gnus-tmp-opening-bracket ?c)
1308 (?\] gnus-tmp-closing-bracket ?c)
1309 (?\> (make-string gnus-tmp-level ? ) ?s)
1310 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1311 (?i gnus-tmp-score ?d)
1312 (?z gnus-tmp-score-char ?c)
1313 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1314 (?U gnus-tmp-unread ?c)
1315 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1317 (?t (gnus-summary-number-of-articles-in-thread
1318 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1320 (?e (gnus-summary-number-of-articles-in-thread
1321 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1323 (?u gnus-tmp-user-defined ?s)
1324 (?P (gnus-pick-line-number) ?d)
1325 (?B gnus-tmp-thread-tree-header-string ?s)
1326 (user-date (gnus-user-date
1327 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1328 "An alist of format specifications that can appear in summary lines.
1329 These are paired with what variables they correspond with, along with
1330 the type of the variable (string, integer, character, etc).")
1332 (defvar gnus-summary-dummy-line-format-alist
1333 `((?S gnus-tmp-subject ?s)
1334 (?N gnus-tmp-number ?d)
1335 (?u gnus-tmp-user-defined ?s)))
1337 (defvar gnus-summary-mode-line-format-alist
1338 `((?G gnus-tmp-group-name ?s)
1339 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1340 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1341 (?A gnus-tmp-article-number ?d)
1342 (?Z gnus-tmp-unread-and-unselected ?s)
1343 (?V gnus-version ?s)
1344 (?U gnus-tmp-unread-and-unticked ?d)
1345 (?S gnus-tmp-subject ?s)
1346 (?e gnus-tmp-unselected ?d)
1347 (?u gnus-tmp-user-defined ?s)
1348 (?d (length gnus-newsgroup-dormant) ?d)
1349 (?t (length gnus-newsgroup-marked) ?d)
1350 (?h (length gnus-newsgroup-spam-marked) ?d)
1351 (?r (length gnus-newsgroup-reads) ?d)
1352 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1353 (?E gnus-newsgroup-expunged-tally ?d)
1354 (?s (gnus-current-score-file-nondirectory) ?s)))
1356 (defvar gnus-last-search-regexp nil
1357 "Default regexp for article search command.")
1359 (defvar gnus-summary-search-article-matched-data nil
1360 "Last matched data of article search command. It is the local variable
1361 in `gnus-article-buffer' which consists of the list of start position,
1362 end position and text.")
1364 (defvar gnus-last-shell-command nil
1365 "Default shell command on article.")
1367 (defvar gnus-newsgroup-agentized nil
1368 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1369 (defvar gnus-newsgroup-begin nil)
1370 (defvar gnus-newsgroup-end nil)
1371 (defvar gnus-newsgroup-last-rmail nil)
1372 (defvar gnus-newsgroup-last-mail nil)
1373 (defvar gnus-newsgroup-last-folder nil)
1374 (defvar gnus-newsgroup-last-file nil)
1375 (defvar gnus-newsgroup-auto-expire nil)
1376 (defvar gnus-newsgroup-active nil)
1378 (defvar gnus-newsgroup-data nil)
1379 (defvar gnus-newsgroup-data-reverse nil)
1380 (defvar gnus-newsgroup-limit nil)
1381 (defvar gnus-newsgroup-limits nil)
1382 (defvar gnus-summary-use-undownloaded-faces nil)
1384 (defvar gnus-newsgroup-unreads nil
1385 "Sorted list of unread articles in the current newsgroup.")
1387 (defvar gnus-newsgroup-unselected nil
1388 "Sorted list of unselected unread articles in the current newsgroup.")
1390 (defvar gnus-newsgroup-reads nil
1391 "Alist of read articles and article marks in the current newsgroup.")
1393 (defvar gnus-newsgroup-expunged-tally nil)
1395 (defvar gnus-newsgroup-marked nil
1396 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1398 (defvar gnus-newsgroup-spam-marked nil
1399 "List of ranges of articles that have been marked as spam.")
1401 (defvar gnus-newsgroup-killed nil
1402 "List of ranges of articles that have been through the scoring process.")
1404 (defvar gnus-newsgroup-cached nil
1405 "Sorted list of articles that come from the article cache.")
1407 (defvar gnus-newsgroup-saved nil
1408 "List of articles that have been saved.")
1410 (defvar gnus-newsgroup-kill-headers nil)
1412 (defvar gnus-newsgroup-replied nil
1413 "List of articles that have been replied to in the current newsgroup.")
1415 (defvar gnus-newsgroup-forwarded nil
1416 "List of articles that have been forwarded in the current newsgroup.")
1418 (defvar gnus-newsgroup-recent nil
1419 "List of articles that have are recent in the current newsgroup.")
1421 (defvar gnus-newsgroup-expirable nil
1422 "Sorted list of articles in the current newsgroup that can be expired.")
1424 (defvar gnus-newsgroup-processable nil
1425 "List of articles in the current newsgroup that can be processed.")
1427 (defvar gnus-newsgroup-downloadable nil
1428 "Sorted list of articles in the current newsgroup that can be processed.")
1430 (defvar gnus-newsgroup-unfetched nil
1431 "Sorted list of articles in the current newsgroup whose headers have
1432 not been fetched into the agent.
1434 This list will always be a subset of gnus-newsgroup-undownloaded.")
1436 (defvar gnus-newsgroup-undownloaded nil
1437 "List of articles in the current newsgroup that haven't been downloaded.")
1439 (defvar gnus-newsgroup-unsendable nil
1440 "List of articles in the current newsgroup that won't be sent.")
1442 (defvar gnus-newsgroup-bookmarks nil
1443 "List of articles in the current newsgroup that have bookmarks.")
1445 (defvar gnus-newsgroup-dormant nil
1446 "Sorted list of dormant articles in the current newsgroup.")
1448 (defvar gnus-newsgroup-unseen nil
1449 "List of unseen articles in the current newsgroup.")
1451 (defvar gnus-newsgroup-seen nil
1452 "Range of seen articles in the current newsgroup.")
1454 (defvar gnus-newsgroup-articles nil
1455 "List of articles in the current newsgroup.")
1457 (defvar gnus-newsgroup-scored nil
1458 "List of scored articles in the current newsgroup.")
1460 (defvar gnus-newsgroup-incorporated nil
1461 "List of incorporated articles in the current newsgroup.")
1463 (defvar gnus-newsgroup-headers nil
1464 "List of article headers in the current newsgroup.")
1466 (defvar gnus-newsgroup-threads nil)
1468 (defvar gnus-newsgroup-prepared nil
1469 "Whether the current group has been prepared properly.")
1471 (defvar gnus-newsgroup-ancient nil
1472 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1474 (defvar gnus-newsgroup-sparse nil)
1476 (defvar gnus-current-article nil)
1477 (defvar gnus-article-current nil)
1478 (defvar gnus-current-headers nil)
1479 (defvar gnus-have-all-headers nil)
1480 (defvar gnus-last-article nil)
1481 (defvar gnus-newsgroup-history nil)
1482 (defvar gnus-newsgroup-charset nil)
1483 (defvar gnus-newsgroup-ephemeral-charset nil)
1484 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1486 (defvar gnus-article-before-search nil)
1488 (defvar gnus-summary-local-variables
1489 '(gnus-newsgroup-name
1490 gnus-newsgroup-begin gnus-newsgroup-end
1491 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1492 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1493 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1494 gnus-newsgroup-unselected gnus-newsgroup-marked
1495 gnus-newsgroup-spam-marked
1496 gnus-newsgroup-reads gnus-newsgroup-saved
1497 gnus-newsgroup-replied gnus-newsgroup-forwarded
1498 gnus-newsgroup-recent
1499 gnus-newsgroup-expirable
1500 gnus-newsgroup-processable gnus-newsgroup-killed
1501 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1502 gnus-newsgroup-unfetched
1503 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1504 gnus-newsgroup-seen gnus-newsgroup-articles
1505 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1506 gnus-newsgroup-headers gnus-newsgroup-threads
1507 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1508 gnus-current-article gnus-current-headers gnus-have-all-headers
1509 gnus-last-article gnus-article-internal-prepare-hook
1510 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1511 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1512 gnus-thread-expunge-below
1513 gnus-score-alist gnus-current-score-file
1514 (gnus-summary-expunge-below . global)
1515 (gnus-summary-mark-below . global)
1516 (gnus-orphan-score . global)
1517 gnus-newsgroup-active gnus-scores-exclude-files
1518 gnus-newsgroup-history gnus-newsgroup-ancient
1519 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1520 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1521 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1522 (gnus-newsgroup-expunged-tally . 0)
1523 gnus-cache-removable-articles gnus-newsgroup-cached
1524 gnus-newsgroup-data gnus-newsgroup-data-reverse
1525 gnus-newsgroup-limit gnus-newsgroup-limits
1526 gnus-newsgroup-charset gnus-newsgroup-display
1527 gnus-summary-use-undownloaded-faces
1528 gnus-newsgroup-incorporated)
1529 "Variables that are buffer-local to the summary buffers.")
1531 (defvar gnus-newsgroup-variables nil
1532 "A list of variables that have separate values in different newsgroups.
1533 A list of newsgroup (summary buffer) local variables, or cons of
1534 variables and their default expressions to be evalled (when the default
1535 values are not nil), that should be made global while the summary buffer
1538 Note: The default expressions will be evaluated (using function `eval')
1539 before assignment to the local variable rather than just assigned to it.
1540 If the default expression is the symbol `global', that symbol will not
1541 be evaluated but the global value of the local variable will be used
1544 These variables can be used to set variables in the group parameters
1545 while still allowing them to affect operations done in other buffers.
1548 \(setq gnus-newsgroup-variables
1549 '(message-use-followup-to
1550 (gnus-visible-headers .
1551 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1554 ;; Byte-compiler warning.
1556 ;; Bind features so that require will believe that gnus-sum has
1557 ;; already been loaded (avoids infinite recursion)
1558 (let ((features (cons 'gnus-sum features)))
1559 ;; Several of the declarations in gnus-sum are needed to load the
1560 ;; following files. Right now, these definitions have been
1561 ;; compiled but not defined (evaluated). We could either do a
1562 ;; eval-and-compile about all of the declarations or evaluate the
1564 (if (boundp 'gnus-newsgroup-variables)
1566 (load "gnus-sum.el" t t t))
1568 (require 'gnus-art)))
1570 ;; Subject simplification.
1572 (defun gnus-simplify-whitespace (str)
1573 "Remove excessive whitespace from STR."
1575 (while (string-match "[ \t][ \t]+" str)
1576 (setq str (concat (substring str 0 (match-beginning 0))
1578 (substring str (match-end 0)))))
1580 (when (string-match "^[ \t]+" str)
1581 (setq str (substring str (match-end 0))))
1583 (when (string-match "[ \t]+$" str)
1584 (setq str (substring str 0 (match-beginning 0))))
1587 (defun gnus-simplify-all-whitespace (str)
1588 "Remove all whitespace from STR."
1589 (while (string-match "[ \t\n]+" str)
1590 (setq str (replace-match "" nil nil str)))
1593 (defsubst gnus-simplify-subject-re (subject)
1594 "Remove \"Re:\" from subject lines."
1595 (if (string-match message-subject-re-regexp subject)
1596 (substring subject (match-end 0))
1599 (defun gnus-simplify-subject (subject &optional re-only)
1600 "Remove `Re:' and words in parentheses.
1601 If RE-ONLY is non-nil, strip leading `Re:'s only."
1602 (let ((case-fold-search t)) ;Ignore case.
1603 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1604 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1605 (setq subject (substring subject (match-end 0))))
1606 ;; Remove uninteresting prefixes.
1607 (when (and (not re-only)
1608 gnus-simplify-ignored-prefixes
1609 (string-match gnus-simplify-ignored-prefixes subject))
1610 (setq subject (substring subject (match-end 0))))
1611 ;; Remove words in parentheses from end.
1613 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1614 (setq subject (substring subject 0 (match-beginning 0)))))
1615 ;; Return subject string.
1618 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1620 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1621 (goto-char (point-min))
1622 (while (re-search-forward regexp nil t)
1623 (replace-match (or newtext ""))))
1625 (defun gnus-simplify-buffer-fuzzy ()
1626 "Simplify string in the buffer fuzzily.
1627 The string in the accessible portion of the current buffer is simplified.
1628 It is assumed to be a single-line subject.
1629 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1630 matter is removed. Additional things can be deleted by setting
1631 `gnus-simplify-subject-fuzzy-regexp'."
1632 (let ((case-fold-search t)
1634 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1636 (while (not (eq modified-tick (buffer-modified-tick)))
1637 (setq modified-tick (buffer-modified-tick))
1639 ((listp gnus-simplify-subject-fuzzy-regexp)
1640 (mapcar 'gnus-simplify-buffer-fuzzy-step
1641 gnus-simplify-subject-fuzzy-regexp))
1642 (gnus-simplify-subject-fuzzy-regexp
1643 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1644 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1645 (gnus-simplify-buffer-fuzzy-step
1646 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1647 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1649 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1650 (gnus-simplify-buffer-fuzzy-step " +" " ")
1651 (gnus-simplify-buffer-fuzzy-step " $")
1652 (gnus-simplify-buffer-fuzzy-step "^ +")))
1654 (defun gnus-simplify-subject-fuzzy (subject)
1655 "Simplify a subject string fuzzily.
1656 See `gnus-simplify-buffer-fuzzy' for details."
1658 (gnus-set-work-buffer)
1659 (let ((case-fold-search t))
1660 ;; Remove uninteresting prefixes.
1661 (when (and gnus-simplify-ignored-prefixes
1662 (string-match gnus-simplify-ignored-prefixes subject))
1663 (setq subject (substring subject (match-end 0))))
1665 (inline (gnus-simplify-buffer-fuzzy))
1668 (defsubst gnus-simplify-subject-fully (subject)
1669 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1671 (gnus-simplify-subject-functions
1672 (gnus-map-function gnus-simplify-subject-functions subject))
1673 ((null gnus-summary-gather-subject-limit)
1674 (gnus-simplify-subject-re subject))
1675 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1676 (gnus-simplify-subject-fuzzy subject))
1677 ((numberp gnus-summary-gather-subject-limit)
1678 (gnus-limit-string (gnus-simplify-subject-re subject)
1679 gnus-summary-gather-subject-limit))
1683 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1684 "Check whether two subjects are equal.
1685 If optional argument SIMPLE-FIRST is t, first argument is already
1688 ((null simple-first)
1689 (equal (gnus-simplify-subject-fully s1)
1690 (gnus-simplify-subject-fully s2)))
1693 (gnus-simplify-subject-fully s2)))))
1695 (defun gnus-summary-bubble-group ()
1696 "Increase the score of the current group.
1697 This is a handy function to add to `gnus-summary-exit-hook' to
1698 increase the score of each group you read."
1699 (gnus-group-add-score gnus-newsgroup-name))
1703 ;;; Gnus summary mode
1706 (put 'gnus-summary-mode 'mode-class 'special)
1708 (defvar gnus-article-commands-menu)
1710 ;; Non-orthogonal keys
1712 (gnus-define-keys gnus-summary-mode-map
1713 " " gnus-summary-next-page
1714 "\177" gnus-summary-prev-page
1715 [delete] gnus-summary-prev-page
1716 [backspace] gnus-summary-prev-page
1717 "\r" gnus-summary-scroll-up
1718 "\M-\r" gnus-summary-scroll-down
1719 "n" gnus-summary-next-unread-article
1720 "p" gnus-summary-prev-unread-article
1721 "N" gnus-summary-next-article
1722 "P" gnus-summary-prev-article
1723 "\M-\C-n" gnus-summary-next-same-subject
1724 "\M-\C-p" gnus-summary-prev-same-subject
1725 "\M-n" gnus-summary-next-unread-subject
1726 "\M-p" gnus-summary-prev-unread-subject
1727 "." gnus-summary-first-unread-article
1728 "," gnus-summary-best-unread-article
1729 "\M-s" gnus-summary-search-article-forward
1730 "\M-r" gnus-summary-search-article-backward
1731 "<" gnus-summary-beginning-of-article
1732 ">" gnus-summary-end-of-article
1733 "j" gnus-summary-goto-article
1734 "^" gnus-summary-refer-parent-article
1735 "\M-^" gnus-summary-refer-article
1736 "u" gnus-summary-tick-article-forward
1737 "!" gnus-summary-tick-article-forward
1738 "U" gnus-summary-tick-article-backward
1739 "d" gnus-summary-mark-as-read-forward
1740 "D" gnus-summary-mark-as-read-backward
1741 "E" gnus-summary-mark-as-expirable
1742 "\M-u" gnus-summary-clear-mark-forward
1743 "\M-U" gnus-summary-clear-mark-backward
1744 "k" gnus-summary-kill-same-subject-and-select
1745 "\C-k" gnus-summary-kill-same-subject
1746 "\M-\C-k" gnus-summary-kill-thread
1747 "\M-\C-l" gnus-summary-lower-thread
1748 "e" gnus-summary-edit-article
1749 "#" gnus-summary-mark-as-processable
1750 "\M-#" gnus-summary-unmark-as-processable
1751 "\M-\C-t" gnus-summary-toggle-threads
1752 "\M-\C-s" gnus-summary-show-thread
1753 "\M-\C-h" gnus-summary-hide-thread
1754 "\M-\C-f" gnus-summary-next-thread
1755 "\M-\C-b" gnus-summary-prev-thread
1756 [(meta down)] gnus-summary-next-thread
1757 [(meta up)] gnus-summary-prev-thread
1758 "\M-\C-u" gnus-summary-up-thread
1759 "\M-\C-d" gnus-summary-down-thread
1760 "&" gnus-summary-execute-command
1761 "c" gnus-summary-catchup-and-exit
1762 "\C-w" gnus-summary-mark-region-as-read
1763 "\C-t" gnus-summary-toggle-truncation
1764 "?" gnus-summary-mark-as-dormant
1765 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1766 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1767 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1768 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1769 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1770 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1771 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1772 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1773 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1774 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1775 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1776 "=" gnus-summary-expand-window
1777 "\C-x\C-s" gnus-summary-reselect-current-group
1778 "\M-g" gnus-summary-rescan-group
1779 "w" gnus-summary-stop-page-breaking
1780 "\C-c\C-r" gnus-summary-caesar-message
1781 "\M-t" gnus-summary-toggle-mime
1782 "f" gnus-summary-followup
1783 "F" gnus-summary-followup-with-original
1784 "C" gnus-summary-cancel-article
1785 "r" gnus-summary-reply
1786 "R" gnus-summary-reply-with-original
1787 "\C-c\C-f" gnus-summary-mail-forward
1788 "o" gnus-summary-save-article
1789 "\C-o" gnus-summary-save-article-mail
1790 "|" gnus-summary-pipe-output
1791 "\M-k" gnus-summary-edit-local-kill
1792 "\M-K" gnus-summary-edit-global-kill
1794 "\C-c\C-d" gnus-summary-describe-group
1795 "q" gnus-summary-exit
1796 "Q" gnus-summary-exit-no-update
1797 "\C-c\C-i" gnus-info-find-node
1798 gnus-mouse-2 gnus-mouse-pick-article
1799 [follow-link] mouse-face
1800 "m" gnus-summary-mail-other-window
1801 "a" gnus-summary-post-news
1802 "i" gnus-summary-news-other-window
1803 "x" gnus-summary-limit-to-unread
1804 "s" gnus-summary-isearch-article
1805 "t" gnus-summary-toggle-header
1806 "g" gnus-summary-show-article
1807 "l" gnus-summary-goto-last-article
1808 "v" gnus-summary-preview-mime-message
1809 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1810 "\C-d" gnus-summary-enter-digest-group
1811 "\M-\C-d" gnus-summary-read-document
1812 "\M-\C-e" gnus-summary-edit-parameters
1813 "\M-\C-a" gnus-summary-customize-parameters
1815 "\C-c\C-n" gnus-namazu-search
1816 "*" gnus-cache-enter-article
1817 "\M-*" gnus-cache-remove-article
1818 "\M-&" gnus-summary-universal-argument
1819 "\C-l" gnus-recenter
1820 "I" gnus-summary-increase-score
1821 "L" gnus-summary-lower-score
1822 "\M-i" gnus-symbolic-argument
1823 "h" gnus-summary-select-article-buffer
1825 "V" gnus-summary-score-map
1826 "X" gnus-uu-extract-map
1827 "S" gnus-summary-send-map)
1829 ;; Sort of orthogonal keymap
1830 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1831 "t" gnus-summary-tick-article-forward
1832 "!" gnus-summary-tick-article-forward
1833 "d" gnus-summary-mark-as-read-forward
1834 "r" gnus-summary-mark-as-read-forward
1835 "c" gnus-summary-clear-mark-forward
1836 " " gnus-summary-clear-mark-forward
1837 "e" gnus-summary-mark-as-expirable
1838 "x" gnus-summary-mark-as-expirable
1839 "?" gnus-summary-mark-as-dormant
1840 "b" gnus-summary-set-bookmark
1841 "B" gnus-summary-remove-bookmark
1842 "#" gnus-summary-mark-as-processable
1843 "\M-#" gnus-summary-unmark-as-processable
1844 "S" gnus-summary-limit-include-expunged
1845 "C" gnus-summary-catchup
1846 "H" gnus-summary-catchup-to-here
1847 "h" gnus-summary-catchup-from-here
1848 "\C-c" gnus-summary-catchup-all
1849 "k" gnus-summary-kill-same-subject-and-select
1850 "K" gnus-summary-kill-same-subject
1851 "P" gnus-uu-mark-map)
1853 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1854 "c" gnus-summary-clear-above
1855 "u" gnus-summary-tick-above
1856 "m" gnus-summary-mark-above
1857 "k" gnus-summary-kill-below)
1859 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1860 "/" gnus-summary-limit-to-subject
1861 "n" gnus-summary-limit-to-articles
1862 "w" gnus-summary-pop-limit
1863 "s" gnus-summary-limit-to-subject
1864 "a" gnus-summary-limit-to-author
1865 "u" gnus-summary-limit-to-unread
1866 "m" gnus-summary-limit-to-marks
1867 "M" gnus-summary-limit-exclude-marks
1868 "v" gnus-summary-limit-to-score
1869 "*" gnus-summary-limit-include-cached
1870 "D" gnus-summary-limit-include-dormant
1871 "T" gnus-summary-limit-include-thread
1872 "d" gnus-summary-limit-exclude-dormant
1873 "t" gnus-summary-limit-to-age
1874 "." gnus-summary-limit-to-unseen
1875 "x" gnus-summary-limit-to-extra
1876 "p" gnus-summary-limit-to-display-predicate
1877 "E" gnus-summary-limit-include-expunged
1878 "c" gnus-summary-limit-exclude-childless-dormant
1879 "C" gnus-summary-limit-mark-excluded-as-read
1880 "o" gnus-summary-insert-old-articles
1881 "N" gnus-summary-insert-new-articles
1882 "r" gnus-summary-limit-to-replied
1883 "R" gnus-summary-limit-to-recipient)
1885 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1886 "n" gnus-summary-next-unread-article
1887 "p" gnus-summary-prev-unread-article
1888 "N" gnus-summary-next-article
1889 "P" gnus-summary-prev-article
1890 "\C-n" gnus-summary-next-same-subject
1891 "\C-p" gnus-summary-prev-same-subject
1892 "\M-n" gnus-summary-next-unread-subject
1893 "\M-p" gnus-summary-prev-unread-subject
1894 "f" gnus-summary-first-unread-article
1895 "b" gnus-summary-best-unread-article
1896 "j" gnus-summary-goto-article
1897 "g" gnus-summary-goto-subject
1898 "l" gnus-summary-goto-last-article
1899 "o" gnus-summary-pop-article)
1901 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1902 "k" gnus-summary-kill-thread
1903 "l" gnus-summary-lower-thread
1904 "i" gnus-summary-raise-thread
1905 "T" gnus-summary-toggle-threads
1906 "t" gnus-summary-rethread-current
1907 "^" gnus-summary-reparent-thread
1908 "s" gnus-summary-show-thread
1909 "S" gnus-summary-show-all-threads
1910 "h" gnus-summary-hide-thread
1911 "H" gnus-summary-hide-all-threads
1912 "n" gnus-summary-next-thread
1913 "p" gnus-summary-prev-thread
1914 "u" gnus-summary-up-thread
1915 "o" gnus-summary-top-thread
1916 "d" gnus-summary-down-thread
1917 "#" gnus-uu-mark-thread
1918 "\M-#" gnus-uu-unmark-thread)
1920 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1921 "g" gnus-summary-prepare
1922 "c" gnus-summary-insert-cached-articles
1923 "d" gnus-summary-insert-dormant-articles)
1925 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1926 "c" gnus-summary-catchup-and-exit
1927 "C" gnus-summary-catchup-all-and-exit
1928 "E" gnus-summary-exit-no-update
1929 "J" gnus-summary-jump-to-other-group
1930 "Q" gnus-summary-exit
1931 "Z" gnus-summary-exit
1932 "n" gnus-summary-catchup-and-goto-next-group
1933 "p" gnus-summary-catchup-and-goto-prev-group
1934 "R" gnus-summary-reselect-current-group
1935 "G" gnus-summary-rescan-group
1936 "N" gnus-summary-next-group
1937 "s" gnus-summary-save-newsrc
1938 "P" gnus-summary-prev-group)
1940 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1941 " " gnus-summary-next-page
1942 "n" gnus-summary-next-page
1943 "\177" gnus-summary-prev-page
1944 [delete] gnus-summary-prev-page
1945 "p" gnus-summary-prev-page
1946 "\r" gnus-summary-scroll-up
1947 "\M-\r" gnus-summary-scroll-down
1948 "<" gnus-summary-beginning-of-article
1949 ">" gnus-summary-end-of-article
1950 "b" gnus-summary-beginning-of-article
1951 "e" gnus-summary-end-of-article
1952 "^" gnus-summary-refer-parent-article
1953 "r" gnus-summary-refer-parent-article
1954 "D" gnus-summary-enter-digest-group
1955 "R" gnus-summary-refer-references
1956 "T" gnus-summary-refer-thread
1957 "g" gnus-summary-show-article
1958 "s" gnus-summary-isearch-article
1959 "P" gnus-summary-print-article
1960 "M" gnus-mailing-list-insinuate
1961 "t" gnus-article-babel)
1963 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1964 "b" gnus-article-add-buttons
1965 "B" gnus-article-add-buttons-to-head
1966 "o" gnus-article-treat-overstrike
1967 "e" gnus-article-emphasize
1968 "w" gnus-article-fill-cited-article
1969 "Q" gnus-article-fill-long-lines
1970 "C" gnus-article-capitalize-sentences
1971 "c" gnus-article-remove-cr
1972 "Z" gnus-article-decode-HZ
1973 "A" gnus-article-treat-ansi-sequences
1974 "h" gnus-article-wash-html
1975 "u" gnus-article-unsplit-urls
1976 "f" gnus-article-display-x-face
1977 "l" gnus-summary-stop-page-breaking
1978 "r" gnus-summary-caesar-message
1979 "m" gnus-summary-morse-message
1980 "t" gnus-summary-toggle-header
1981 "g" gnus-treat-smiley
1982 "v" gnus-summary-verbose-headers
1983 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1984 "p" gnus-article-verify-x-pgp-sig
1985 "d" gnus-article-treat-dumbquotes
1986 "i" gnus-summary-idna-message)
1988 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1989 ;; mnemonic: deuglif*Y*
1990 "u" gnus-article-outlook-unwrap-lines
1991 "a" gnus-article-outlook-repair-attribution
1992 "c" gnus-article-outlook-rearrange-citation
1993 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1995 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1996 "a" gnus-article-hide
1997 "h" gnus-article-hide-headers
1998 "b" gnus-article-hide-boring-headers
1999 "s" gnus-article-hide-signature
2000 "c" gnus-article-hide-citation
2001 "C" gnus-article-hide-citation-in-followups
2002 "l" gnus-article-hide-list-identifiers
2003 "B" gnus-article-strip-banner
2004 "P" gnus-article-hide-pem
2005 "\C-c" gnus-article-hide-citation-maybe)
2007 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2008 "a" gnus-article-highlight
2009 "h" gnus-article-highlight-headers
2010 "c" gnus-article-highlight-citation
2011 "s" gnus-article-highlight-signature)
2013 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2014 "f" gnus-article-treat-fold-headers
2015 "u" gnus-article-treat-unfold-headers
2016 "n" gnus-article-treat-fold-newsgroups)
2018 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2019 "x" gnus-article-display-x-face
2020 "d" gnus-article-display-face
2021 "s" gnus-treat-smiley
2022 "D" gnus-article-remove-images
2023 "f" gnus-treat-from-picon
2024 "m" gnus-treat-mail-picon
2025 "n" gnus-treat-newsgroups-picon)
2027 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2028 "z" gnus-article-date-ut
2029 "u" gnus-article-date-ut
2030 "l" gnus-article-date-local
2031 "p" gnus-article-date-english
2032 "e" gnus-article-date-lapsed
2033 "o" gnus-article-date-original
2034 "i" gnus-article-date-iso8601
2035 "s" gnus-article-date-user)
2037 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2038 "t" gnus-article-remove-trailing-blank-lines
2039 "l" gnus-article-strip-leading-blank-lines
2040 "m" gnus-article-strip-multiple-blank-lines
2041 "a" gnus-article-strip-blank-lines
2042 "A" gnus-article-strip-all-blank-lines
2043 "s" gnus-article-strip-leading-space
2044 "e" gnus-article-strip-trailing-space
2045 "w" gnus-article-remove-leading-whitespace)
2047 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2049 "f" gnus-summary-fetch-faq
2050 "d" gnus-summary-describe-group
2051 "h" gnus-summary-describe-briefly
2052 "i" gnus-info-find-node
2053 "c" gnus-group-fetch-charter
2054 "C" gnus-group-fetch-control)
2056 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2057 "e" gnus-summary-expire-articles
2058 "\M-\C-e" gnus-summary-expire-articles-now
2059 "\177" gnus-summary-delete-article
2060 [delete] gnus-summary-delete-article
2061 [backspace] gnus-summary-delete-article
2062 "m" gnus-summary-move-article
2063 "r" gnus-summary-respool-article
2064 "w" gnus-summary-edit-article
2065 "c" gnus-summary-copy-article
2066 "B" gnus-summary-crosspost-article
2067 "q" gnus-summary-respool-query
2068 "t" gnus-summary-respool-trace
2069 "i" gnus-summary-import-article
2070 "I" gnus-summary-create-article
2071 "p" gnus-summary-article-posted-p)
2073 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2074 "o" gnus-summary-save-article
2075 "m" gnus-summary-save-article-mail
2076 "F" gnus-summary-write-article-file
2077 "r" gnus-summary-save-article-rmail
2078 "f" gnus-summary-save-article-file
2079 "b" gnus-summary-save-article-body-file
2080 "h" gnus-summary-save-article-folder
2081 "v" gnus-summary-save-article-vm
2082 "p" gnus-summary-pipe-output
2083 "P" gnus-summary-muttprint
2084 "s" gnus-soup-add-article)
2086 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2087 "b" gnus-summary-display-buttonized
2088 "m" gnus-summary-repair-multipart
2089 "v" gnus-article-view-part
2090 "o" gnus-article-save-part
2091 "O" gnus-article-save-part-and-strip
2092 "r" gnus-article-replace-part
2093 "d" gnus-article-delete-part
2094 "j" gnus-article-jump-to-part
2095 "c" gnus-article-copy-part
2096 "C" gnus-article-view-part-as-charset
2097 "e" gnus-article-view-part-externally
2098 "E" gnus-article-encrypt-body
2099 "i" gnus-article-inline-part
2100 "|" gnus-article-pipe-part)
2102 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2103 "p" gnus-summary-mark-as-processable
2104 "u" gnus-summary-unmark-as-processable
2105 "U" gnus-summary-unmark-all-processable
2106 "v" gnus-uu-mark-over
2107 "s" gnus-uu-mark-series
2108 "r" gnus-uu-mark-region
2109 "g" gnus-uu-unmark-region
2110 "R" gnus-uu-mark-by-regexp
2111 "G" gnus-uu-unmark-by-regexp
2112 "t" gnus-uu-mark-thread
2113 "T" gnus-uu-unmark-thread
2114 "a" gnus-uu-mark-all
2115 "b" gnus-uu-mark-buffer
2116 "S" gnus-uu-mark-sparse
2117 "k" gnus-summary-kill-process-mark
2118 "y" gnus-summary-yank-process-mark
2119 "w" gnus-summary-save-process-mark
2120 "i" gnus-uu-invert-processable)
2122 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2123 ;;"x" gnus-uu-extract-any
2124 "m" gnus-summary-save-parts
2125 "u" gnus-uu-decode-uu
2126 "U" gnus-uu-decode-uu-and-save
2127 "s" gnus-uu-decode-unshar
2128 "S" gnus-uu-decode-unshar-and-save
2129 "o" gnus-uu-decode-save
2130 "O" gnus-uu-decode-save
2131 "b" gnus-uu-decode-binhex
2132 "B" gnus-uu-decode-binhex
2133 "p" gnus-uu-decode-postscript
2134 "P" gnus-uu-decode-postscript-and-save)
2137 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2138 "u" gnus-uu-decode-uu-view
2139 "U" gnus-uu-decode-uu-and-save-view
2140 "s" gnus-uu-decode-unshar-view
2141 "S" gnus-uu-decode-unshar-and-save-view
2142 "o" gnus-uu-decode-save-view
2143 "O" gnus-uu-decode-save-view
2144 "b" gnus-uu-decode-binhex-view
2145 "B" gnus-uu-decode-binhex-view
2146 "p" gnus-uu-decode-postscript-view
2147 "P" gnus-uu-decode-postscript-and-save-view)
2149 (defvar gnus-article-post-menu nil)
2151 (defconst gnus-summary-menu-maxlen 20)
2153 (defun gnus-summary-menu-split (menu)
2154 ;; If we have lots of elements, divide them into groups of 20
2155 ;; and make a pane (or submenu) for each one.
2156 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2157 (let ((menu menu) sublists next
2160 ;; Pull off the next gnus-summary-menu-maxlen elements
2161 ;; and make them the next element of sublist.
2162 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2164 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2166 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2167 (aref (car (last menu)) 0)) menu)
2171 (nreverse sublists))
2172 ;; Few elements--put them all in one pane.
2175 (defun gnus-summary-make-menu-bar ()
2176 (gnus-turn-off-edit-menu 'summary)
2178 (unless (boundp 'gnus-summary-misc-menu)
2181 gnus-summary-kill-menu gnus-summary-mode-map ""
2186 ["Customize" gnus-score-customize t])
2187 (gnus-make-score-map 'increase)
2188 (gnus-make-score-map 'lower)
2190 ["Kill below" gnus-summary-kill-below t]
2191 ["Mark above" gnus-summary-mark-above t]
2192 ["Tick above" gnus-summary-tick-above t]
2193 ["Clear above" gnus-summary-clear-above t])
2194 ["Current score" gnus-summary-current-score t]
2195 ["Set score" gnus-summary-set-score t]
2196 ["Switch current score file..." gnus-score-change-score-file t]
2197 ["Set mark below..." gnus-score-set-mark-below t]
2198 ["Set expunge below..." gnus-score-set-expunge-below t]
2199 ["Edit current score file" gnus-score-edit-current-scores t]
2200 ["Edit score file" gnus-score-edit-file t]
2201 ["Trace score" gnus-score-find-trace t]
2202 ["Find words" gnus-score-find-favourite-words t]
2203 ["Rescore buffer" gnus-summary-rescore t]
2204 ["Increase score..." gnus-summary-increase-score t]
2205 ["Lower score..." gnus-summary-lower-score t]))))
2207 ;; Define both the Article menu in the summary buffer and the
2208 ;; equivalent Commands menu in the article buffer here for
2212 ["All" gnus-article-hide t]
2213 ["Headers" gnus-article-hide-headers t]
2214 ["Signature" gnus-article-hide-signature t]
2215 ["Citation" gnus-article-hide-citation t]
2216 ["List identifiers" gnus-article-hide-list-identifiers t]
2217 ["Banner" gnus-article-strip-banner t]
2218 ["Boring headers" gnus-article-hide-boring-headers t])
2220 ["All" gnus-article-highlight t]
2221 ["Headers" gnus-article-highlight-headers t]
2222 ["Signature" gnus-article-highlight-signature t]
2223 ["Citation" gnus-article-highlight-citation t])
2225 ["Local" gnus-article-date-local t]
2226 ["ISO8601" gnus-article-date-iso8601 t]
2227 ["UT" gnus-article-date-ut t]
2228 ["Original" gnus-article-date-original t]
2229 ["Lapsed" gnus-article-date-lapsed t]
2230 ["User-defined" gnus-article-date-user t])
2232 ["Remove images" gnus-article-remove-images t]
2233 ["Toggle smiley" gnus-treat-smiley t]
2234 ["Show X-Face" gnus-article-display-x-face t]
2235 ["Show picons in From" gnus-treat-from-picon t]
2236 ["Show picons in mail headers" gnus-treat-mail-picon t]
2237 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2238 ("View as different encoding"
2239 ,@(gnus-summary-menu-split
2242 ;; Since easymenu under Emacs doesn't allow
2243 ;; lambda forms for menu commands, we should
2244 ;; provide intern'ed function symbols.
2245 (let ((command (intern (format "\
2246 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2250 (let ((gnus-summary-show-article-charset-alist
2252 (gnus-summary-show-article 1))))
2253 `[,(symbol-name cs) ,command t]))
2254 (sort (if (fboundp 'coding-system-list)
2255 (coding-system-list)
2256 ;;(mapcar 'car mm-mime-mule-charset-alist)
2261 ["Leading" gnus-article-strip-leading-blank-lines t]
2262 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2263 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2264 ["All of the above" gnus-article-strip-blank-lines t]
2265 ["All" gnus-article-strip-all-blank-lines t]
2266 ["Leading space" gnus-article-strip-leading-space t]
2267 ["Trailing space" gnus-article-strip-trailing-space t]
2268 ["Leading space in headers"
2269 gnus-article-remove-leading-whitespace t])
2270 ["Overstrike" gnus-article-treat-overstrike t]
2271 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2272 ["Emphasis" gnus-article-emphasize t]
2273 ["Word wrap" gnus-article-fill-cited-article t]
2274 ["Fill long lines" gnus-article-fill-long-lines t]
2275 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2276 ["Remove CR" gnus-article-remove-cr t]
2277 ["Rot 13" gnus-summary-caesar-message
2278 ,@(if (featurep 'xemacs) '(t)
2279 '(:help "\"Caesar rotate\" article by 13"))]
2280 ["De-IDNA" gnus-summary-idna-message t]
2281 ["Morse decode" gnus-summary-morse-message t]
2282 ["Unix pipe..." gnus-summary-pipe-message t]
2283 ["Add buttons" gnus-article-add-buttons t]
2284 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2285 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2286 ["Toggle MIME" gnus-summary-toggle-mime t]
2287 ["Verbose header" gnus-summary-verbose-headers t]
2288 ["Toggle header" gnus-summary-toggle-header t]
2289 ["Unfold headers" gnus-article-treat-unfold-headers t]
2290 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2291 ["Html" gnus-article-wash-html t]
2292 ["Unsplit URLs" gnus-article-unsplit-urls t]
2293 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2294 ["Decode HZ" gnus-article-decode-HZ t]
2295 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2296 ("(Outlook) Deuglify"
2297 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2298 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2299 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2300 ["Full (Outlook) deuglify"
2301 gnus-article-outlook-deuglify-article t])
2304 ["Save in default format..." gnus-summary-save-article
2305 ,@(if (featurep 'xemacs) '(t)
2306 '(:help "Save article using default method"))]
2307 ["Save in file..." gnus-summary-save-article-file
2308 ,@(if (featurep 'xemacs) '(t)
2309 '(:help "Save article in file"))]
2310 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2311 ["Save in MH folder..." gnus-summary-save-article-folder t]
2312 ["Save in VM folder..." gnus-summary-save-article-vm t]
2313 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2314 ["Save body in file..." gnus-summary-save-article-body-file t]
2315 ["Pipe through a filter..." gnus-summary-pipe-output t]
2316 ["Add to SOUP packet" gnus-soup-add-article t]
2317 ["Print with Muttprint..." gnus-summary-muttprint t]
2318 ["Print" gnus-summary-print-article
2319 ,@(if (featurep 'xemacs) '(t)
2320 '(:help "Generate and print a PostScript image"))])
2321 ("Copy, move,... (Backend)"
2322 ,@(if (featurep 'xemacs) nil
2323 '(:help "Copying, moving, expiring articles..."))
2324 ["Respool article..." gnus-summary-respool-article t]
2325 ["Move article..." gnus-summary-move-article
2326 (gnus-check-backend-function
2327 'request-move-article gnus-newsgroup-name)]
2328 ["Copy article..." gnus-summary-copy-article t]
2329 ["Crosspost article..." gnus-summary-crosspost-article
2330 (gnus-check-backend-function
2331 'request-replace-article gnus-newsgroup-name)]
2332 ["Import file..." gnus-summary-import-article
2333 (gnus-check-backend-function
2334 'request-accept-article gnus-newsgroup-name)]
2335 ["Create article..." gnus-summary-create-article
2336 (gnus-check-backend-function
2337 'request-accept-article gnus-newsgroup-name)]
2338 ["Check if posted" gnus-summary-article-posted-p t]
2339 ["Edit article" gnus-summary-edit-article
2340 (not (gnus-group-read-only-p))]
2341 ["Delete article" gnus-summary-delete-article
2342 (gnus-check-backend-function
2343 'request-expire-articles gnus-newsgroup-name)]
2344 ["Query respool" gnus-summary-respool-query t]
2345 ["Trace respool" gnus-summary-respool-trace t]
2346 ["Delete expirable articles" gnus-summary-expire-articles-now
2347 (gnus-check-backend-function
2348 'request-expire-articles gnus-newsgroup-name)])
2350 ["Uudecode" gnus-uu-decode-uu
2351 ,@(if (featurep 'xemacs) '(t)
2352 '(:help "Decode uuencoded article(s)"))]
2353 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2354 ["Unshar" gnus-uu-decode-unshar t]
2355 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2356 ["Save" gnus-uu-decode-save t]
2357 ["Binhex" gnus-uu-decode-binhex t]
2358 ["Postscript" gnus-uu-decode-postscript t])
2360 ["Enter article" gnus-cache-enter-article t]
2361 ["Remove article" gnus-cache-remove-article t])
2362 ["Translate" gnus-article-babel t]
2363 ["Select article buffer" gnus-summary-select-article-buffer t]
2364 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2365 ["Isearch article..." gnus-summary-isearch-article t]
2366 ["Beginning of the article" gnus-summary-beginning-of-article t]
2367 ["End of the article" gnus-summary-end-of-article t]
2368 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2369 ["Fetch referenced articles" gnus-summary-refer-references t]
2370 ["Fetch current thread" gnus-summary-refer-thread t]
2371 ["Fetch article with id..." gnus-summary-refer-article t]
2372 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2373 ["Redisplay" gnus-summary-show-article t]
2374 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2376 gnus-summary-article-menu gnus-summary-mode-map ""
2377 (cons "Article" innards))
2379 (if (not (keymapp gnus-summary-article-menu))
2381 gnus-article-commands-menu gnus-article-mode-map ""
2382 (cons "Commands" innards))
2383 ;; in Emacs, don't share menu.
2384 (setq gnus-article-commands-menu
2385 (copy-keymap gnus-summary-article-menu))
2386 (define-key gnus-article-mode-map [menu-bar commands]
2387 (cons "Commands" gnus-article-commands-menu))))
2390 gnus-summary-thread-menu gnus-summary-mode-map ""
2392 ["Find all messages in thread" gnus-summary-refer-thread t]
2393 ["Toggle threading" gnus-summary-toggle-threads t]
2394 ["Hide threads" gnus-summary-hide-all-threads t]
2395 ["Show threads" gnus-summary-show-all-threads t]
2396 ["Hide thread" gnus-summary-hide-thread t]
2397 ["Show thread" gnus-summary-show-thread t]
2398 ["Go to next thread" gnus-summary-next-thread t]
2399 ["Go to previous thread" gnus-summary-prev-thread t]
2400 ["Go down thread" gnus-summary-down-thread t]
2401 ["Go up thread" gnus-summary-up-thread t]
2402 ["Top of thread" gnus-summary-top-thread t]
2403 ["Mark thread as read" gnus-summary-kill-thread t]
2404 ["Lower thread score" gnus-summary-lower-thread t]
2405 ["Raise thread score" gnus-summary-raise-thread t]
2406 ["Rethread current" gnus-summary-rethread-current t]))
2409 gnus-summary-post-menu gnus-summary-mode-map ""
2411 ["Send a message (mail or news)" gnus-summary-post-news
2412 ,@(if (featurep 'xemacs) '(t)
2413 '(:help "Compose a new message (mail or news)"))]
2414 ["Followup" gnus-summary-followup
2415 ,@(if (featurep 'xemacs) '(t)
2416 '(:help "Post followup to this article"))]
2417 ["Followup and yank" gnus-summary-followup-with-original
2418 ,@(if (featurep 'xemacs) '(t)
2419 '(:help "Post followup to this article, quoting its contents"))]
2420 ["Supersede article" gnus-summary-supersede-article t]
2421 ["Cancel article" gnus-summary-cancel-article
2422 ,@(if (featurep 'xemacs) '(t)
2423 '(:help "Cancel an article you posted"))]
2424 ["Reply" gnus-summary-reply t]
2425 ["Reply and yank" gnus-summary-reply-with-original t]
2426 ["Wide reply" gnus-summary-wide-reply t]
2427 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2428 ,@(if (featurep 'xemacs) '(t)
2429 '(:help "Mail a reply, quoting this article"))]
2430 ["Very wide reply" gnus-summary-very-wide-reply t]
2431 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2432 ,@(if (featurep 'xemacs) '(t)
2433 '(:help "Mail a very wide reply, quoting this article"))]
2434 ["Mail forward" gnus-summary-mail-forward t]
2435 ["Post forward" gnus-summary-post-forward t]
2436 ["Digest and mail" gnus-summary-digest-mail-forward t]
2437 ["Digest and post" gnus-summary-digest-post-forward t]
2438 ["Resend message" gnus-summary-resend-message t]
2439 ["Resend message edit" gnus-summary-resend-message-edit t]
2440 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2441 ["Send a mail" gnus-summary-mail-other-window t]
2442 ["Create a local message" gnus-summary-news-other-window t]
2443 ["Uuencode and post" gnus-uu-post-news
2444 ,@(if (featurep 'xemacs) '(t)
2445 '(:help "Post a uuencoded article"))]
2446 ["Followup via news" gnus-summary-followup-to-mail t]
2447 ["Followup via news and yank"
2448 gnus-summary-followup-to-mail-with-original t]
2450 ;;["Send" gnus-summary-send-draft t]
2451 ;;["Send bounced" gnus-resend-bounced-mail t])
2455 ((not (keymapp gnus-summary-post-menu))
2456 (setq gnus-article-post-menu gnus-summary-post-menu))
2457 ((not gnus-article-post-menu)
2458 ;; Don't share post menu.
2459 (setq gnus-article-post-menu
2460 (copy-keymap gnus-summary-post-menu))))
2461 (define-key gnus-article-mode-map [menu-bar post]
2462 (cons "Post" gnus-article-post-menu))
2465 gnus-summary-misc-menu gnus-summary-mode-map ""
2468 ["Mark as read" gnus-summary-mark-as-read-forward t]
2469 ["Mark same subject and select"
2470 gnus-summary-kill-same-subject-and-select t]
2471 ["Mark same subject" gnus-summary-kill-same-subject t]
2472 ["Catchup" gnus-summary-catchup
2473 ,@(if (featurep 'xemacs) '(t)
2474 '(:help "Mark unread articles in this group as read"))]
2475 ["Catchup all" gnus-summary-catchup-all t]
2476 ["Catchup to here" gnus-summary-catchup-to-here t]
2477 ["Catchup from here" gnus-summary-catchup-from-here t]
2478 ["Catchup region" gnus-summary-mark-region-as-read
2479 (gnus-mark-active-p)]
2480 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2482 ["Tick" gnus-summary-tick-article-forward t]
2483 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2484 ["Remove marks" gnus-summary-clear-mark-forward t]
2485 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2486 ["Set bookmark" gnus-summary-set-bookmark t]
2487 ["Remove bookmark" gnus-summary-remove-bookmark t])
2489 ["Marks..." gnus-summary-limit-to-marks t]
2490 ["Subject..." gnus-summary-limit-to-subject t]
2491 ["Author..." gnus-summary-limit-to-author t]
2492 ["Recipient..." gnus-summary-limit-to-recipient t]
2493 ["Age..." gnus-summary-limit-to-age t]
2494 ["Extra..." gnus-summary-limit-to-extra t]
2495 ["Score..." gnus-summary-limit-to-score t]
2496 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2497 ["Unread" gnus-summary-limit-to-unread t]
2498 ["Unseen" gnus-summary-limit-to-unseen t]
2499 ["Replied" gnus-summary-limit-to-replied t]
2500 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2501 ["Next articles" gnus-summary-limit-to-articles t]
2502 ["Pop limit" gnus-summary-pop-limit t]
2503 ["Show dormant" gnus-summary-limit-include-dormant t]
2504 ["Hide childless dormant"
2505 gnus-summary-limit-exclude-childless-dormant t]
2506 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2507 ["Hide marked" gnus-summary-limit-exclude-marks t]
2508 ["Show expunged" gnus-summary-limit-include-expunged t])
2510 ["Set mark" gnus-summary-mark-as-processable t]
2511 ["Remove mark" gnus-summary-unmark-as-processable t]
2512 ["Remove all marks" gnus-summary-unmark-all-processable t]
2513 ["Invert marks" gnus-uu-invert-processable t]
2514 ["Mark above" gnus-uu-mark-over t]
2515 ["Mark series" gnus-uu-mark-series t]
2516 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2517 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2518 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2519 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2520 ["Mark all" gnus-uu-mark-all t]
2521 ["Mark buffer" gnus-uu-mark-buffer t]
2522 ["Mark sparse" gnus-uu-mark-sparse t]
2523 ["Mark thread" gnus-uu-mark-thread t]
2524 ["Unmark thread" gnus-uu-unmark-thread t]
2525 ("Process Mark Sets"
2526 ["Kill" gnus-summary-kill-process-mark t]
2527 ["Yank" gnus-summary-yank-process-mark
2528 gnus-newsgroup-process-stack]
2529 ["Save" gnus-summary-save-process-mark t]
2530 ["Run command on marked..." gnus-summary-universal-argument t]))
2532 ["Page forward" gnus-summary-next-page
2533 ,@(if (featurep 'xemacs) '(t)
2534 '(:help "Show next page of article"))]
2535 ["Page backward" gnus-summary-prev-page
2536 ,@(if (featurep 'xemacs) '(t)
2537 '(:help "Show previous page of article"))]
2538 ["Line forward" gnus-summary-scroll-up t])
2540 ["Next unread article" gnus-summary-next-unread-article t]
2541 ["Previous unread article" gnus-summary-prev-unread-article t]
2542 ["Next article" gnus-summary-next-article t]
2543 ["Previous article" gnus-summary-prev-article t]
2544 ["Next unread subject" gnus-summary-next-unread-subject t]
2545 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2546 ["Next article same subject" gnus-summary-next-same-subject t]
2547 ["Previous article same subject" gnus-summary-prev-same-subject t]
2548 ["First unread article" gnus-summary-first-unread-article t]
2549 ["Best unread article" gnus-summary-best-unread-article t]
2550 ["Go to subject number..." gnus-summary-goto-subject t]
2551 ["Go to article number..." gnus-summary-goto-article t]
2552 ["Go to the last article" gnus-summary-goto-last-article t]
2553 ["Pop article off history" gnus-summary-pop-article t])
2555 ["Sort by number" gnus-summary-sort-by-number t]
2556 ["Sort by author" gnus-summary-sort-by-author t]
2557 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2558 ["Sort by subject" gnus-summary-sort-by-subject t]
2559 ["Sort by date" gnus-summary-sort-by-date t]
2560 ["Sort by score" gnus-summary-sort-by-score t]
2561 ["Sort by lines" gnus-summary-sort-by-lines t]
2562 ["Sort by characters" gnus-summary-sort-by-chars t]
2563 ["Randomize" gnus-summary-sort-by-random t]
2564 ["Original sort" gnus-summary-sort-by-original t])
2566 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2567 ["Describe group" gnus-summary-describe-group t]
2568 ["Fetch charter" gnus-group-fetch-charter
2569 ,@(if (featurep 'xemacs) nil
2570 '(:help "Display the charter of the current group"))]
2571 ["Fetch control message" gnus-group-fetch-control
2572 ,@(if (featurep 'xemacs) nil
2573 '(:help "Display the archived control message for the current group"))]
2574 ["Read manual" gnus-info-find-node t])
2576 ["Pick and read" gnus-pick-mode t]
2577 ["Binary" gnus-binary-mode t])
2579 ["Regenerate" gnus-summary-prepare t]
2580 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2581 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2582 ["Toggle threading" gnus-summary-toggle-threads t])
2583 ["See old articles" gnus-summary-insert-old-articles t]
2584 ["See new articles" gnus-summary-insert-new-articles t]
2585 ["Filter articles..." gnus-summary-execute-command t]
2586 ["Run command on articles..." gnus-summary-universal-argument t]
2587 ["Search articles forward..." gnus-summary-search-article-forward t]
2588 ["Search articles backward..." gnus-summary-search-article-backward t]
2589 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2590 ["Expand window" gnus-summary-expand-window t]
2591 ["Expire expirable articles" gnus-summary-expire-articles
2592 (gnus-check-backend-function
2593 'request-expire-articles gnus-newsgroup-name)]
2594 ["Edit local kill file" gnus-summary-edit-local-kill t]
2595 ["Edit main kill file" gnus-summary-edit-global-kill t]
2596 ["Edit group parameters" gnus-summary-edit-parameters t]
2597 ["Customize group parameters" gnus-summary-customize-parameters t]
2598 ["Send a bug report" gnus-bug t]
2600 ["Catchup and exit" gnus-summary-catchup-and-exit
2601 ,@(if (featurep 'xemacs) '(t)
2602 '(:help "Mark unread articles in this group as read, then exit"))]
2603 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2604 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2605 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2606 ["Exit group" gnus-summary-exit
2607 ,@(if (featurep 'xemacs) '(t)
2608 '(:help "Exit current group, return to group selection mode"))]
2609 ["Exit group without updating" gnus-summary-exit-no-update t]
2610 ["Exit and goto next group" gnus-summary-next-group t]
2611 ["Exit and goto prev group" gnus-summary-prev-group t]
2612 ["Reselect group" gnus-summary-reselect-current-group t]
2613 ["Rescan group" gnus-summary-rescan-group t]
2614 ["Update dribble" gnus-summary-save-newsrc t])))
2616 (gnus-run-hooks 'gnus-summary-menu-hook)))
2618 (defvar gnus-summary-tool-bar-map nil)
2620 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2621 ;; affect _new_ message buffers. We might add a function that walks thru all
2622 ;; summary-mode buffers and force the update.
2623 (defun gnus-summary-tool-bar-update (&optional symbol value)
2624 "Update summary mode toolbar.
2625 Setter function for custom variables."
2626 (setq-default gnus-summary-tool-bar-map nil)
2628 ;; When used as ":set" function:
2629 (set-default symbol value))
2630 (when (gnus-buffer-live-p gnus-summary-buffer)
2631 (with-current-buffer gnus-summary-buffer
2632 (gnus-summary-make-tool-bar))))
2634 ;; The default will be changed when the new icons have been checked in:
2635 (defcustom gnus-summary-tool-bar 'gnus-summary-tool-bar-retro
2636 "Specifies the Gnus summary tool bar.
2638 It can be either a list or a symbol refering to a list. See
2639 `gmm-tool-bar-from-list' for the format of the list. The
2640 default key map is `gnus-summary-mode-map'.
2642 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2643 `gnus-summary-tool-bar-retro'."
2644 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2645 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2646 (repeat :tag "User defined list" gmm-tool-bar-item)
2648 :version "23.0" ;; No Gnus
2649 :initialize 'custom-initialize-default
2650 :set 'gnus-summary-tool-bar-update
2651 :group 'gnus-summary)
2653 (defcustom gnus-summary-tool-bar-gnome
2654 '((gnus-summary-post-news "compose" nil)
2655 (gnus-summary-reply-with-original "reply-author")
2656 (gnus-summary-reply "reply-author" nil :visible nil)
2657 (gnus-summary-followup-with-original "reply-all")
2658 (gnus-summary-followup "reply-all" nil :visible nil)
2659 (gnus-summary-mail-forward "forward")
2660 (gnus-summary-save-article "save") ;; stock_mail-copy
2661 (gnus-summary-search-article-forward "search")
2662 (gnus-summary-print-article "print")
2663 (gnus-summary-mark-as-expirable
2665 :visible (gnus-check-backend-function 'request-expire-articles
2666 gnus-newsgroup-name))
2667 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2668 (gnus-summary-mark-as-spam
2669 "spam" t :visible (spam-group-ham-contents-p gnus-newsgroup-name)
2670 :help "Mark as spam")
2671 (gnus-summary-mark-as-read-forward
2672 "not-spam" nil :visible (spam-group-spam-contents-p gnus-newsgroup-name))
2673 ;; Some new commands that may need more suitable icons:
2674 (gnus-summary-save-newsrc "save" nil :visible nil)
2675 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2676 (gnus-summary-prev-article "left-arrow" nil :visible nil) ;; Emacs 22
2677 (gnus-summary-next-article "right-arrow" nil :visible nil) ;; Emacs 22
2678 (gnus-summary-prev-unread-article "prev-node") ;; Emacs 22
2679 (gnus-summary-next-unread-article "next-node") ;; Emacs 22
2680 (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2682 ;; Maybe some sort-by-... could be added:
2683 (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2684 (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2686 (gnus-summary-insert-new-articles "inbox")
2688 (gnus-summary-exit "exit-mode")
2690 (gnus-info-find-node "help"))
2691 "List of functions for the summary tool bar (GNOME style).
2693 See `gmm-tool-bar-from-list' for the format of the list."
2694 :type '(repeat gmm-tool-bar-item)
2695 :version "23.0" ;; No Gnus
2696 :initialize 'custom-initialize-default
2697 :set 'gnus-summary-tool-bar-update
2698 :group 'gnus-summary)
2700 (defcustom gnus-summary-tool-bar-retro
2701 '((gnus-summary-prev-unread-article "prev-ur")
2702 (gnus-summary-next-unread-article "next-ur")
2703 (gnus-summary-post-news "post")
2704 (gnus-summary-followup-with-original "fuwo")
2705 (gnus-summary-followup "followup")
2706 (gnus-summary-reply-with-original "reply-wo")
2707 (gnus-summary-reply "reply")
2708 (gnus-summary-caesar-message "rot13")
2709 (gnus-uu-decode-uu "uu-decode")
2710 (gnus-summary-save-article-file "save-aif")
2711 (gnus-summary-save-article "save-art")
2712 (gnus-uu-post-news "uu-post")
2713 (gnus-summary-catchup "catchup")
2714 (gnus-summary-catchup-and-exit "cu-exit")
2715 (gnus-summary-exit "exit-summ")
2716 ;; Some new command that may need more suitable icons:
2717 (gnus-summary-print-article "print" nil :visible nil)
2718 (gnus-summary-mark-as-expirable "close" nil :visible nil)
2719 (gnus-summary-save-newsrc "save" nil :visible nil)
2720 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2721 (gnus-summary-search-article-forward "search" nil :visible nil)
2722 ;; (gnus-summary-insert-new-articles "paste" nil :visible nil)
2723 ;; (gnus-summary-toggle-threads "open" nil :visible nil)
2725 (gnus-info-find-node "help" nil :visible nil))
2726 "List of functions for the summary tool bar (retro look).
2728 See `gmm-tool-bar-from-list' for the format of the list."
2729 :type '(repeat gmm-tool-bar-item)
2730 :version "23.0" ;; No Gnus
2731 :initialize 'custom-initialize-default
2732 :set 'gnus-summary-tool-bar-update
2733 :group 'gnus-summary)
2735 (defcustom gnus-summary-tool-bar-zap-list t
2736 "List of icon items from the global tool bar.
2737 These items are not displayed in the Gnus summary mode tool bar.
2739 See `gmm-tool-bar-from-list' for the format of the list."
2740 :type 'gmm-tool-bar-zap-list
2741 :version "23.0" ;; No Gnus
2742 :initialize 'custom-initialize-default
2743 :set 'gnus-summary-tool-bar-update
2744 :group 'gnus-summary)
2746 (defun gnus-summary-make-tool-bar (&optional force)
2747 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2748 When FORCE, rebuild the tool bar."
2749 (when (and (not (featurep 'xemacs))
2750 (boundp 'tool-bar-mode)
2752 (or (not gnus-summary-tool-bar-map) force))
2753 (let ((map (when (default-value 'tool-bar-mode)
2754 (let ((load-path (mm-image-load-path)))
2755 (gmm-tool-bar-from-list gnus-summary-tool-bar
2756 gnus-summary-tool-bar-zap-list
2757 'gnus-summary-mode-map)))))
2759 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2761 (setq gnus-summary-tool-bar-map map))))
2762 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2764 (defun gnus-score-set-default (var value)
2765 "A version of set that updates the GNU Emacs menu-bar."
2767 ;; It is the message that forces the active status to be updated.
2770 (defun gnus-make-score-map (type)
2771 "Make a summary score map of type TYPE."
2774 (let ((headers '(("author" "from" string)
2775 ("subject" "subject" string)
2776 ("article body" "body" string)
2777 ("article head" "head" string)
2778 ("xref" "xref" string)
2779 ("extra header" "extra" string)
2780 ("lines" "lines" number)
2781 ("followups to author" "followup" string)))
2782 (types '((number ("less than" <)
2785 (string ("substring" s)
2789 (perms '(("temporary" (current-time-string))
2797 (if (eq type 'lower)
2802 (setq header (car headers))
2808 (let ((ts (cdr (assoc (nth 2 header) types)))
2824 'gnus-summary-score-entry
2826 (if (or (string= (nth 1 header)
2828 (string= (nth 1 header)
2831 (list 'gnus-summary-header
2833 (list 'quote (nth 1 (car ts)))
2834 (list 'gnus-score-delta-default
2841 (list (nreverse outp))))
2844 (list (nreverse outt))))
2846 (setq headers (cdr headers)))
2847 (list (nreverse outh))))))))
2851 (defun gnus-summary-mode (&optional group)
2852 "Major mode for reading articles.
2854 All normal editing commands are switched off.
2855 \\<gnus-summary-mode-map>
2856 Each line in this buffer represents one article. To read an
2857 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2858 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2861 You can also post articles and send mail from this buffer. To
2862 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2863 of an article, type `\\[gnus-summary-reply]'.
2865 There are approx. one gazillion commands you can execute in this
2866 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2868 The following commands are available:
2870 \\{gnus-summary-mode-map}"
2872 (kill-all-local-variables)
2873 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2874 (gnus-summary-make-local-variables))
2875 (gnus-summary-make-local-variables)
2876 (setq gnus-newsgroup-name group)
2877 (when (gnus-visual-p 'summary-menu 'menu)
2878 (gnus-summary-make-menu-bar)
2879 (gnus-summary-make-tool-bar))
2880 (gnus-make-thread-indent-array)
2881 (gnus-simplify-mode-line)
2882 (setq major-mode 'gnus-summary-mode)
2883 (setq mode-name "Summary")
2884 (make-local-variable 'minor-mode-alist)
2885 (use-local-map gnus-summary-mode-map)
2886 (buffer-disable-undo)
2887 (setq buffer-read-only t ;Disable modification
2888 show-trailing-whitespace nil)
2889 (setq truncate-lines t)
2890 (setq selective-display t)
2891 (setq selective-display-ellipses t) ;Display `...'
2892 (gnus-summary-set-display-table)
2893 (gnus-set-default-directory)
2894 (unless (gnus-news-group-p group)
2895 (setq gnus-newsgroup-incorporated
2896 (nnmail-new-mail-numbers (gnus-group-real-name group))))
2897 (make-local-variable 'gnus-summary-line-format)
2898 (make-local-variable 'gnus-summary-line-format-spec)
2899 (make-local-variable 'gnus-summary-dummy-line-format)
2900 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2901 (make-local-variable 'gnus-summary-mark-positions)
2902 (gnus-make-local-hook 'pre-command-hook)
2903 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2904 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2905 (turn-on-gnus-mailing-list-mode)
2906 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2907 (gnus-update-summary-mark-positions))
2909 (defun gnus-summary-make-local-variables ()
2910 "Make all the local summary buffer variables."
2912 (dolist (local gnus-summary-local-variables)
2915 (if (eq (cdr local) 'global)
2916 ;; Copy the global value of the variable.
2917 (setq global (symbol-value (car local)))
2918 ;; Use the value from the list.
2919 (setq global (eval (cdr local))))
2920 (set (make-local-variable (car local)) global))
2921 ;; Simple nil-valued local variable.
2922 (set (make-local-variable local) nil)))))
2924 (defun gnus-summary-clear-local-variables ()
2925 (let ((locals gnus-summary-local-variables))
2927 (if (consp (car locals))
2928 (and (symbolp (caar locals))
2929 (set (caar locals) nil))
2930 (and (symbolp (car locals))
2931 (set (car locals) nil)))
2932 (setq locals (cdr locals)))))
2934 ;; Summary data functions.
2936 (defmacro gnus-data-number (data)
2939 (defmacro gnus-data-set-number (data number)
2940 `(setcar ,data ,number))
2942 (defmacro gnus-data-mark (data)
2945 (defmacro gnus-data-set-mark (data mark)
2946 `(setcar (nthcdr 1 ,data) ,mark))
2948 (defmacro gnus-data-pos (data)
2951 (defmacro gnus-data-set-pos (data pos)
2952 `(setcar (nthcdr 2 ,data) ,pos))
2954 (defmacro gnus-data-header (data)
2957 (defmacro gnus-data-set-header (data header)
2958 `(setcar (nthcdr 3 ,data) ,header))
2960 (defmacro gnus-data-level (data)
2963 (defmacro gnus-data-unread-p (data)
2964 `(= (nth 1 ,data) gnus-unread-mark))
2966 (defmacro gnus-data-read-p (data)
2967 `(/= (nth 1 ,data) gnus-unread-mark))
2969 (defmacro gnus-data-pseudo-p (data)
2970 `(consp (nth 3 ,data)))
2972 (defmacro gnus-data-find (number)
2973 `(assq ,number gnus-newsgroup-data))
2975 (defmacro gnus-data-find-list (number &optional data)
2976 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
2977 (memq (assq ,number bdata)
2980 (defmacro gnus-data-make (number mark pos header level)
2981 `(list ,number ,mark ,pos ,header ,level))
2983 (defun gnus-data-enter (after-article number mark pos header level offset)
2984 (let ((data (gnus-data-find-list after-article)))
2986 (error "No such article: %d" after-article))
2987 (setcdr data (cons (gnus-data-make number mark pos header level)
2989 (setq gnus-newsgroup-data-reverse nil)
2990 (gnus-data-update-list (cddr data) offset)))
2992 (defun gnus-data-enter-list (after-article list &optional offset)
2994 (let ((data (and after-article (gnus-data-find-list after-article)))
2998 (let ((odata gnus-newsgroup-data))
2999 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3001 (gnus-data-update-list odata offset)))
3002 ;; Find the last element in the list to be spliced into the main
3004 (setq list (last list))
3007 (setcdr list gnus-newsgroup-data)
3008 (setq gnus-newsgroup-data ilist)
3010 (gnus-data-update-list (cdr list) offset)))
3011 (setcdr list (cdr data))
3014 (gnus-data-update-list (cdr list) offset))))
3015 (setq gnus-newsgroup-data-reverse nil))))
3017 (defun gnus-data-remove (article &optional offset)
3018 (let ((data gnus-newsgroup-data))
3019 (if (= (gnus-data-number (car data)) article)
3021 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3022 gnus-newsgroup-data-reverse nil)
3024 (gnus-data-update-list gnus-newsgroup-data offset)))
3026 (when (= (gnus-data-number (cadr data)) article)
3027 (setcdr data (cddr data))
3029 (gnus-data-update-list (cdr data) offset))
3031 gnus-newsgroup-data-reverse nil))
3032 (setq data (cdr data))))))
3034 (defmacro gnus-data-list (backward)
3036 (or gnus-newsgroup-data-reverse
3037 (setq gnus-newsgroup-data-reverse
3038 (reverse gnus-newsgroup-data)))
3039 gnus-newsgroup-data))
3041 (defun gnus-data-update-list (data offset)
3042 "Add OFFSET to the POS of all data entries in DATA."
3043 (setq gnus-newsgroup-data-reverse nil)
3045 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3046 (setq data (cdr data))))
3048 (defun gnus-summary-article-pseudo-p (article)
3049 "Say whether this article is a pseudo article or not."
3050 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3052 (defmacro gnus-summary-article-sparse-p (article)
3053 "Say whether this article is a sparse article or not."
3054 `(memq ,article gnus-newsgroup-sparse))
3056 (defmacro gnus-summary-article-ancient-p (article)
3057 "Say whether this article is a sparse article or not."
3058 `(memq ,article gnus-newsgroup-ancient))
3060 (defun gnus-article-parent-p (number)
3061 "Say whether this article is a parent or not."
3062 (let ((data (gnus-data-find-list number)))
3063 (and (cdr data) ; There has to be an article after...
3064 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3065 (gnus-data-level (nth 1 data))))))
3067 (defun gnus-article-children (number)
3068 "Return a list of all children to NUMBER."
3069 (let* ((data (gnus-data-find-list number))
3070 (level (gnus-data-level (car data)))
3072 (setq data (cdr data))
3074 (= (gnus-data-level (car data)) (1+ level)))
3075 (push (gnus-data-number (car data)) children)
3076 (setq data (cdr data)))
3079 (defmacro gnus-summary-skip-intangible ()
3080 "If the current article is intangible, then jump to a different article."
3081 '(let ((to (get-text-property (point) 'gnus-intangible)))
3082 (and to (gnus-summary-goto-subject to))))
3084 (defmacro gnus-summary-article-intangible-p ()
3085 "Say whether this article is intangible or not."
3086 '(get-text-property (point) 'gnus-intangible))
3088 (defun gnus-article-read-p (article)
3089 "Say whether ARTICLE is read or not."
3090 (not (or (memq article gnus-newsgroup-marked)
3091 (memq article gnus-newsgroup-spam-marked)
3092 (memq article gnus-newsgroup-unreads)
3093 (memq article gnus-newsgroup-unselected)
3094 (memq article gnus-newsgroup-dormant))))
3096 ;; Some summary mode macros.
3098 (defmacro gnus-summary-article-number ()
3099 "The article number of the article on the current line.
3100 If there isn't an article number here, then we return the current
3103 (gnus-summary-skip-intangible)
3104 (or (get-text-property (point) 'gnus-number)
3105 (gnus-summary-last-subject))))
3107 (defmacro gnus-summary-article-header (&optional number)
3108 "Return the header of article NUMBER."
3109 `(gnus-data-header (gnus-data-find
3110 ,(or number '(gnus-summary-article-number)))))
3112 (defmacro gnus-summary-thread-level (&optional number)
3113 "Return the level of thread that starts with article NUMBER."
3114 `(if (and (eq gnus-summary-make-false-root 'dummy)
3115 (get-text-property (point) 'gnus-intangible))
3117 (gnus-data-level (gnus-data-find
3118 ,(or number '(gnus-summary-article-number))))))
3120 (defmacro gnus-summary-article-mark (&optional number)
3121 "Return the mark of article NUMBER."
3122 `(gnus-data-mark (gnus-data-find
3123 ,(or number '(gnus-summary-article-number)))))
3125 (defmacro gnus-summary-article-pos (&optional number)
3126 "Return the position of the line of article NUMBER."
3127 `(gnus-data-pos (gnus-data-find
3128 ,(or number '(gnus-summary-article-number)))))
3130 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3131 (defmacro gnus-summary-article-subject (&optional number)
3132 "Return current subject string or nil if nothing."
3135 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3136 '(gnus-data-header (assq (gnus-summary-article-number)
3137 gnus-newsgroup-data)))))
3140 (mail-header-subject headers))))
3142 (defmacro gnus-summary-article-score (&optional number)
3143 "Return current article score."
3144 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3145 gnus-newsgroup-scored))
3146 gnus-summary-default-score 0))
3148 (defun gnus-summary-article-children (&optional number)
3149 "Return a list of article numbers that are children of article NUMBER."
3150 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3151 (level (gnus-data-level (car data)))
3153 (while (and (setq data (cdr data))
3154 (> (setq l (gnus-data-level (car data))) level))
3155 (and (= (1+ level) l)
3156 (push (gnus-data-number (car data))
3158 (nreverse children)))
3160 (defun gnus-summary-article-parent (&optional number)
3161 "Return the article number of the parent of article NUMBER."
3162 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3163 (gnus-data-list t)))
3164 (level (gnus-data-level (car data))))
3166 () ; This is a root.
3167 ;; We search until we find an article with a level less than
3168 ;; this one. That function has to be the parent.
3169 (while (and (setq data (cdr data))
3170 (not (< (gnus-data-level (car data)) level))))
3171 (and data (gnus-data-number (car data))))))
3173 (defun gnus-unread-mark-p (mark)
3174 "Say whether MARK is the unread mark."
3175 (= mark gnus-unread-mark))
3177 (defun gnus-read-mark-p (mark)
3178 "Say whether MARK is one of the marks that mark as read.
3179 This is all marks except unread, ticked, dormant, and expirable."
3180 (not (or (= mark gnus-unread-mark)
3181 (= mark gnus-ticked-mark)
3182 (= mark gnus-spam-mark)
3183 (= mark gnus-dormant-mark)
3184 (= mark gnus-expirable-mark))))
3186 (defmacro gnus-article-mark (number)
3187 "Return the MARK of article NUMBER.
3188 This macro should only be used when computing the mark the \"first\"
3189 time; i.e., when generating the summary lines. After that,
3190 `gnus-summary-article-mark' should be used to examine the
3193 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3194 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3195 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3196 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3197 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3198 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3199 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3200 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3201 gnus-ancient-mark))))
3203 ;; Saving hidden threads.
3205 (defmacro gnus-save-hidden-threads (&rest forms)
3206 "Save hidden threads, eval FORMS, and restore the hidden threads."
3207 (let ((config (make-symbol "config")))
3208 `(let ((,config (gnus-hidden-threads-configuration)))
3212 (gnus-restore-hidden-threads-configuration ,config)))))
3213 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3214 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3216 (defun gnus-data-compute-positions ()
3217 "Compute the positions of all articles."
3218 (setq gnus-newsgroup-data-reverse nil)
3219 (let ((data gnus-newsgroup-data))
3221 (gnus-save-hidden-threads
3222 (gnus-summary-show-all-threads)
3223 (goto-char (point-min))
3225 (while (get-text-property (point) 'gnus-intangible)
3227 (gnus-data-set-pos (car data) (+ (point) 3))
3228 (setq data (cdr data))
3229 (forward-line 1))))))
3231 (defun gnus-hidden-threads-configuration ()
3232 "Return the current hidden threads configuration."
3235 (goto-char (point-min))
3236 (while (search-forward "\r" nil t)
3237 (push (1- (point)) config))
3240 (defun gnus-restore-hidden-threads-configuration (config)
3241 "Restore hidden threads configuration from CONFIG."
3243 (let (point buffer-read-only)
3244 (while (setq point (pop config))
3245 (when (and (< point (point-max))
3247 (eq (char-after) ?\n))
3248 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3250 ;; Various summary mode internalish functions.
3252 (defun gnus-mouse-pick-article (e)
3255 (gnus-summary-next-page nil t))
3257 (defun gnus-summary-set-display-table ()
3258 "Change the display table.
3259 Odd characters have a tendency to mess
3260 up nicely formatted displays - we make all possible glyphs
3261 display only a single character."
3263 ;; We start from the standard display table, if any.
3264 (let ((table (or (copy-sequence standard-display-table)
3265 (make-display-table)))
3267 ;; Nix out all the control chars...
3268 (while (>= (setq i (1- i)) 0)
3269 (aset table i [??]))
3270 ;; ... but not newline and cr, of course. (cr is necessary for the
3271 ;; selective display).
3272 (aset table ?\n nil)
3273 (aset table ?\r nil)
3274 ;; We keep TAB as well.
3275 (aset table ?\t nil)
3276 ;; We nix out any glyphs over 126 that are not set already.
3278 (while (>= (setq i (1- i)) 127)
3279 ;; Only modify if the entry is nil.
3280 (unless (aref table i)
3281 (aset table i [??]))))
3282 (setq buffer-display-table table)))
3284 (defun gnus-summary-set-article-display-arrow (pos)
3285 "Update the overlay arrow to point to line at position POS."
3286 (when (and gnus-summary-display-arrow
3287 (boundp 'overlay-arrow-position)
3288 (boundp 'overlay-arrow-string))
3292 (unless overlay-arrow-position
3293 (setq overlay-arrow-position (make-marker)))
3294 (setq overlay-arrow-string "=>"
3295 overlay-arrow-position (set-marker overlay-arrow-position
3297 (current-buffer))))))
3299 (defun gnus-summary-setup-buffer (group)
3300 "Initialize summary buffer."
3301 (let ((buffer (gnus-summary-buffer-name group))
3302 (dead-name (concat "*Dead Summary "
3303 (gnus-group-decoded-name group) "*")))
3304 ;; If a dead summary buffer exists, we kill it.
3305 (when (gnus-buffer-live-p dead-name)
3306 (gnus-kill-buffer dead-name))
3307 (if (get-buffer buffer)
3310 (setq gnus-summary-buffer (current-buffer))
3311 (not gnus-newsgroup-prepared))
3312 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3313 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3314 (gnus-summary-mode group)
3316 (gnus-carpal-setup-buffer 'summary))
3317 (unless gnus-single-article-buffer
3318 (make-local-variable 'gnus-article-buffer)
3319 (make-local-variable 'gnus-article-current)
3320 (make-local-variable 'gnus-original-article-buffer))
3321 (setq gnus-newsgroup-name group)
3322 ;; Set any local variables in the group parameters.
3323 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3326 (defun gnus-set-global-variables ()
3327 "Set the global equivalents of the buffer-local variables.
3328 They are set to the latest values they had. These reflect the summary
3329 buffer that was in action when the last article was fetched."
3330 (when (eq major-mode 'gnus-summary-mode)
3331 (setq gnus-summary-buffer (current-buffer))
3332 (let ((name gnus-newsgroup-name)
3333 (marked gnus-newsgroup-marked)
3334 (spam gnus-newsgroup-spam-marked)
3335 (unread gnus-newsgroup-unreads)
3336 (headers gnus-current-headers)
3337 (data gnus-newsgroup-data)
3338 (summary gnus-summary-buffer)
3339 (article-buffer gnus-article-buffer)
3340 (original gnus-original-article-buffer)
3341 (gac gnus-article-current)
3342 (reffed gnus-reffed-article-number)
3343 (score-file gnus-current-score-file)
3344 (default-charset gnus-newsgroup-charset)
3346 (let ((locals gnus-newsgroup-variables))
3348 (if (consp (car locals))
3349 (push (eval (caar locals)) vlist)
3350 (push (eval (car locals)) vlist))
3351 (setq locals (cdr locals)))
3352 (setq vlist (nreverse vlist)))
3353 (with-current-buffer gnus-group-buffer
3354 (setq gnus-newsgroup-name name
3355 gnus-newsgroup-marked marked
3356 gnus-newsgroup-spam-marked spam
3357 gnus-newsgroup-unreads unread
3358 gnus-current-headers headers
3359 gnus-newsgroup-data data
3360 gnus-article-current gac
3361 gnus-summary-buffer summary
3362 gnus-article-buffer article-buffer
3363 gnus-original-article-buffer original
3364 gnus-reffed-article-number reffed
3365 gnus-current-score-file score-file
3366 gnus-newsgroup-charset default-charset)
3367 (let ((locals gnus-newsgroup-variables))
3369 (if (consp (car locals))
3370 (set (caar locals) (pop vlist))
3371 (set (car locals) (pop vlist)))
3372 (setq locals (cdr locals))))
3373 ;; The article buffer also has local variables.
3374 (when (gnus-buffer-live-p gnus-article-buffer)
3375 (set-buffer gnus-article-buffer)
3376 (setq gnus-summary-buffer summary))))))
3378 (defun gnus-summary-article-unread-p (article)
3379 "Say whether ARTICLE is unread or not."
3380 (memq article gnus-newsgroup-unreads))
3382 (defun gnus-summary-first-article-p (&optional article)
3383 "Return whether ARTICLE is the first article in the buffer."
3384 (if (not (setq article (or article (gnus-summary-article-number))))
3386 (eq article (caar gnus-newsgroup-data))))
3388 (defun gnus-summary-last-article-p (&optional article)
3389 "Return whether ARTICLE is the last article in the buffer."
3390 (if (not (setq article (or article (gnus-summary-article-number))))
3391 ;; All non-existent numbers are the last article. :-)
3393 (not (cdr (gnus-data-find-list article)))))
3395 (defun gnus-make-thread-indent-array ()
3397 (unless (and gnus-thread-indent-array
3398 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3399 (setq gnus-thread-indent-array (make-vector 201 "")
3400 gnus-thread-indent-array-level gnus-thread-indent-level)
3402 (aset gnus-thread-indent-array n
3403 (make-string (* n gnus-thread-indent-level) ? ))
3406 (defun gnus-update-summary-mark-positions ()
3407 "Compute where the summary marks are to go."
3409 (when (gnus-buffer-exists-p gnus-summary-buffer)
3410 (set-buffer gnus-summary-buffer))
3411 (let ((spec gnus-summary-line-format-spec)
3414 (gnus-set-work-buffer)
3415 (let ((gnus-tmp-unread ?Z)
3416 (gnus-replied-mark ?Z)
3417 (gnus-score-below-mark ?Z)
3418 (gnus-score-over-mark ?Z)
3419 (gnus-undownloaded-mark ?Z)
3420 (gnus-summary-line-format-spec spec)
3421 (gnus-newsgroup-downloadable '(0))
3423 (make-full-mail-header
3424 0 "" "nobody" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil))
3425 case-fold-search ignores)
3426 ;; Here, all marks are bound to Z.
3427 (gnus-summary-insert-line header
3428 0 nil t gnus-tmp-unread t nil "" nil 1)
3429 (goto-char (point-min))
3430 ;; Memorize the positions of the same characters as dummy marks.
3431 (while (re-search-forward "[A-D]" nil t)
3432 (push (point) ignores))
3434 ;; We use A-D as dummy marks in order to know column positions
3435 ;; where marks should be inserted.
3436 (setq gnus-tmp-unread ?A
3437 gnus-replied-mark ?B
3438 gnus-score-below-mark ?C
3439 gnus-score-over-mark ?C
3440 gnus-undownloaded-mark ?D)
3441 (gnus-summary-insert-line header
3442 0 nil t gnus-tmp-unread t nil "" nil 1)
3443 ;; Ignore characters which aren't dummy marks.
3445 (delete-region (goto-char (1- p)) p)
3447 (goto-char (point-min))
3448 (setq pos (list (cons 'unread
3449 (and (search-forward "A" nil t)
3450 (- (point) (point-min) 1)))))
3451 (goto-char (point-min))
3452 (push (cons 'replied (and (search-forward "B" nil t)
3453 (- (point) (point-min) 1)))
3455 (goto-char (point-min))
3456 (push (cons 'score (and (search-forward "C" nil t)
3457 (- (point) (point-min) 1)))
3459 (goto-char (point-min))
3460 (push (cons 'download (and (search-forward "D" nil t)
3461 (- (point) (point-min) 1)))
3463 (setq gnus-summary-mark-positions pos))))
3465 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3466 "Insert a dummy root in the summary buffer."
3468 (gnus-add-text-properties
3469 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3470 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3472 (defun gnus-summary-extract-address-component (from)
3473 (or (car (funcall gnus-extract-address-components from))
3476 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3477 (let ((default-mime-charset (with-current-buffer gnus-summary-buffer
3478 default-mime-charset)))
3479 ;; Is it really necessary to do this next part for each summary line?
3480 ;; Luckily, doesn't seem to slow things down much.
3482 (and gnus-ignored-from-addresses
3483 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3484 (let ((extra-headers (mail-header-extra header))
3488 ((setq to (cdr (assq 'To extra-headers)))
3489 (concat gnus-summary-to-prefix
3491 (gnus-summary-extract-address-component
3492 (funcall gnus-decode-encoded-word-function to)))))
3493 ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
3494 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3495 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3497 (defun gnus-summary-insert-line (gnus-tmp-header
3498 gnus-tmp-level gnus-tmp-current
3499 undownloaded gnus-tmp-unread gnus-tmp-replied
3500 gnus-tmp-expirable gnus-tmp-subject-or-nil
3501 &optional gnus-tmp-dummy gnus-tmp-score
3503 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3504 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3505 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3506 (gnus-tmp-score-char
3507 (if (or (null gnus-summary-default-score)
3508 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3509 gnus-summary-zcore-fuzz))
3511 (if (< gnus-tmp-score gnus-summary-default-score)
3512 gnus-score-below-mark gnus-score-over-mark)))
3513 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3515 (cond (gnus-tmp-process gnus-process-mark)
3516 ((memq gnus-tmp-current gnus-newsgroup-cached)
3518 (gnus-tmp-replied gnus-replied-mark)
3519 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3520 gnus-forwarded-mark)
3521 ((memq gnus-tmp-current gnus-newsgroup-saved)
3523 ((memq gnus-tmp-number gnus-newsgroup-recent)
3525 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3528 (gnus-tmp-downloaded
3530 gnus-undownloaded-mark)
3531 (gnus-newsgroup-agentized
3532 gnus-downloaded-mark)
3535 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3538 ((string-match "<[^>]+> *$" gnus-tmp-from)
3539 (let ((beg (match-beginning 0)))
3540 (or (and (string-match "^\".+\"" gnus-tmp-from)
3541 (substring gnus-tmp-from 1 (1- (match-end 0))))
3542 (substring gnus-tmp-from 0 beg))))
3543 ((string-match "(.+)" gnus-tmp-from)
3544 (substring gnus-tmp-from
3545 (1+ (match-beginning 0)) (1- (match-end 0))))
3547 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3548 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3549 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3550 (buffer-read-only nil))
3551 (when (string= gnus-tmp-name "")
3552 (setq gnus-tmp-name gnus-tmp-from))
3553 (unless (numberp gnus-tmp-lines)
3554 (setq gnus-tmp-lines -1))
3555 (if (= gnus-tmp-lines -1)
3556 (setq gnus-tmp-lines "?")
3557 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3558 (gnus-put-text-property-excluding-characters-with-faces
3560 (progn (eval gnus-summary-line-format-spec) (point))
3561 'gnus-number gnus-tmp-number)
3562 (when (gnus-visual-p 'summary-highlight 'highlight)
3564 (gnus-run-hooks 'gnus-summary-update-hook)
3567 (defun gnus-summary-update-line (&optional dont-update)
3568 "Update summary line after change."
3569 (when (and gnus-summary-default-score
3570 (not gnus-summary-inhibit-highlight))
3571 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3572 (article (gnus-summary-article-number))
3573 (score (gnus-summary-article-score article)))
3575 (if (and gnus-summary-mark-below
3576 (< (gnus-summary-article-score)
3577 gnus-summary-mark-below))
3578 ;; This article has a low score, so we mark it as read.
3579 (when (memq article gnus-newsgroup-unreads)
3580 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3581 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3582 ;; This article was previously marked as read on account
3583 ;; of a low score, but now it has risen, so we mark it as
3585 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3586 (gnus-summary-update-mark
3587 (if (or (null gnus-summary-default-score)
3588 (<= (abs (- score gnus-summary-default-score))
3589 gnus-summary-zcore-fuzz))
3591 (if (< score gnus-summary-default-score)
3592 gnus-score-below-mark gnus-score-over-mark))
3594 ;; Do visual highlighting.
3595 (when (gnus-visual-p 'summary-highlight 'highlight)
3596 (gnus-run-hooks 'gnus-summary-update-hook)))))
3598 (defvar gnus-tmp-new-adopts nil)
3600 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3601 "Return the number of articles in THREAD.
3602 This may be 0 in some cases -- if none of the articles in
3603 the thread are to be displayed."
3605 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3607 ((not (listp thread))
3609 ((and (consp thread) (cdr thread))
3612 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3615 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3618 (when (and level (zerop level) gnus-tmp-new-adopts)
3621 'gnus-summary-number-of-articles-in-thread
3622 gnus-tmp-new-adopts))))
3624 (if (> number 1) gnus-not-empty-thread-mark
3625 gnus-empty-thread-mark)
3628 (defsubst gnus-summary-line-message-size (head)
3629 "Return pretty-printed version of message size.
3630 This function is intended to be used in
3631 `gnus-summary-line-format-alist'."
3632 (let ((c (or (mail-header-chars head) -1)))
3633 (cond ((< c 0) "n/a") ; chars not available
3634 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3635 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3636 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3637 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3640 (defun gnus-summary-set-local-parameters (group)
3641 "Go through the local params of GROUP and set all variable specs in that list."
3642 (let ((vars '(quit-config))) ; Ignore quit-config.
3643 (dolist (elem (gnus-group-find-parameter group))
3644 (and (consp elem) ; Has to be a cons.
3645 (consp (cdr elem)) ; The cdr has to be a list.
3646 (symbolp (car elem)) ; Has to be a symbol in there.
3647 (not (memq (car elem) vars))
3648 (ignore-errors ; So we set it.
3649 (push (car elem) vars)
3650 (make-local-variable (car elem))
3651 (set (car elem) (eval (nth 1 elem))))))))
3653 (defun gnus-summary-read-group (group &optional show-all no-article
3654 kill-buffer no-display backward
3656 "Start reading news in newsgroup GROUP.
3657 If SHOW-ALL is non-nil, already read articles are also listed.
3658 If NO-ARTICLE is non-nil, no article is selected initially.
3659 If NO-DISPLAY, don't generate a summary buffer."
3663 (let ((gnus-auto-select-next nil))
3664 (or (gnus-summary-read-group-1
3665 group show-all no-article
3666 kill-buffer no-display
3669 select-articles nil)))))
3670 (eq gnus-auto-select-next 'quietly))
3671 (set-buffer gnus-group-buffer)
3672 ;; The entry function called above goes to the next
3673 ;; group automatically, so we go two groups back
3674 ;; if we are searching for the previous group.
3676 (gnus-group-prev-unread-group 2))
3677 (if (not (equal group (gnus-group-group-name)))
3678 (setq group (gnus-group-group-name))
3682 (defun gnus-summary-jump-to-other-group (group &optional show-all)
3683 "Directly jump to the other GROUP from summary buffer.
3684 If SHOW-ALL is non-nil, already read articles are also listed."
3686 (if (eq gnus-summary-buffer (current-buffer))
3687 (list (completing-read
3688 "Group: " gnus-active-hashtb nil t
3689 (when (and gnus-newsgroup-name
3690 (string-match "[.:][^.:]+$" gnus-newsgroup-name))
3691 (substring gnus-newsgroup-name 0 (1+ (match-beginning 0))))
3692 'gnus-group-history)
3694 (error "%s must be invoked from a gnus summary buffer." this-command)))
3695 (unless (or (zerop (length group))
3696 (and gnus-newsgroup-name
3697 (string-equal gnus-newsgroup-name group)))
3699 (gnus-summary-read-group group show-all
3700 gnus-dont-select-after-jump-to-other-group)))
3702 (defun gnus-summary-read-group-1 (group show-all no-article
3703 kill-buffer no-display
3704 &optional select-articles)
3705 ;; Killed foreign groups can't be entered.
3706 ;; (when (and (not (gnus-group-native-p group))
3707 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3708 ;; (error "Dead non-native groups can't be entered"))
3709 (gnus-message 5 "Retrieving newsgroup: %s..."
3710 (gnus-group-decoded-name group))
3711 (let* ((new-group (gnus-summary-setup-buffer group))
3712 (quit-config (gnus-group-quit-config group))
3713 (did-select (and new-group (gnus-select-newsgroup
3714 group show-all select-articles))))
3716 ;; This summary buffer exists already, so we just select it.
3718 (gnus-set-global-variables)
3720 (gnus-kill-or-deaden-summary kill-buffer))
3721 (gnus-configure-windows 'summary 'force)
3722 (gnus-set-mode-line 'summary)
3723 (gnus-summary-position-point)
3726 ;; We couldn't select this group.
3728 (when (and (eq major-mode 'gnus-summary-mode)
3729 (not (equal (current-buffer) kill-buffer)))
3730 (kill-buffer (current-buffer))
3731 (if (not quit-config)
3733 ;; Update the info -- marks might need to be removed,
3735 (gnus-summary-update-info)
3736 (set-buffer gnus-group-buffer)
3737 (gnus-group-jump-to-group group)
3738 (gnus-group-next-unread-group 1))
3739 (gnus-handle-ephemeral-exit quit-config)))
3740 (let ((grpinfo (gnus-get-info group)))
3741 (if (null (gnus-info-read grpinfo))
3742 (gnus-message 3 "Group %s contains no messages"
3743 (gnus-group-decoded-name group))
3744 (gnus-message 3 "Can't select group")))
3746 ;; The user did a `C-g' while prompting for number of articles,
3747 ;; so we exit this group.
3748 ((eq did-select 'quit)
3749 (and (eq major-mode 'gnus-summary-mode)
3750 (not (equal (current-buffer) kill-buffer))
3751 (kill-buffer (current-buffer)))
3753 (gnus-kill-or-deaden-summary kill-buffer))
3754 (if (not quit-config)
3756 (set-buffer gnus-group-buffer)
3757 (gnus-group-jump-to-group group)
3758 (gnus-group-next-unread-group 1)
3759 (gnus-configure-windows 'group 'force))
3760 (gnus-handle-ephemeral-exit quit-config))
3761 ;; Finally signal the quit.
3763 ;; The group was successfully selected.
3765 (gnus-set-global-variables)
3766 ;; Save the active value in effect when the group was entered.
3767 (setq gnus-newsgroup-active
3769 (gnus-active gnus-newsgroup-name)))
3770 ;; You can change the summary buffer in some way with this hook.
3771 (gnus-run-hooks 'gnus-select-group-hook)
3772 (when (memq 'summary (gnus-update-format-specifications
3773 nil 'summary 'summary-mode 'summary-dummy))
3774 ;; The format specification for the summary line was updated,
3775 ;; so we need to update the mark positions as well.
3776 (gnus-update-summary-mark-positions))
3777 ;; Do score processing.
3778 (when gnus-use-scoring
3779 (gnus-possibly-score-headers))
3780 ;; Check whether to fill in the gaps in the threads.
3781 (when gnus-build-sparse-threads
3782 (gnus-build-sparse-threads))
3783 ;; Find the initial limit.
3785 (let ((gnus-newsgroup-dormant nil))
3786 (gnus-summary-initial-limit show-all))
3787 (gnus-summary-initial-limit show-all))
3788 ;; Generate the summary buffer.
3790 (gnus-summary-prepare))
3791 (when gnus-use-trees
3792 (gnus-tree-open group)
3793 (setq gnus-summary-highlight-line-function
3794 'gnus-tree-highlight-article))
3795 ;; If the summary buffer is empty, but there are some low-scored
3796 ;; articles or some excluded dormants, we include these in the
3798 (when (and (zerop (buffer-size))
3800 (cond (gnus-newsgroup-dormant
3801 (gnus-summary-limit-include-dormant))
3802 ((and gnus-newsgroup-scored show-all)
3803 (gnus-summary-limit-include-expunged t))))
3804 ;; Function `gnus-apply-kill-file' must be called in this hook.
3805 (gnus-run-hooks 'gnus-apply-kill-hook)
3806 (if (and (zerop (buffer-size))
3809 ;; This newsgroup is empty.
3810 (gnus-summary-catchup-and-exit nil t)
3811 (gnus-message 6 "No unread news")
3813 (gnus-kill-or-deaden-summary kill-buffer))
3814 ;; Return nil from this function.
3816 ;; Hide conversation thread subtrees. We cannot do this in
3817 ;; gnus-summary-prepare-hook since kill processing may not
3818 ;; work with hidden articles.
3819 (gnus-summary-maybe-hide-threads)
3821 (gnus-kill-or-deaden-summary kill-buffer))
3822 (gnus-summary-auto-select-subject)
3823 ;; Show first unread article if requested.
3824 (if (and (not no-article)
3826 gnus-newsgroup-unreads
3827 gnus-auto-select-first)
3829 (gnus-configure-windows 'summary)
3830 (let ((art (gnus-summary-article-number)))
3831 (unless (and (not gnus-plugged)
3832 (or (memq art gnus-newsgroup-undownloaded)
3833 (memq art gnus-newsgroup-downloadable)))
3834 (gnus-summary-goto-article art))))
3835 ;; Don't select any articles.
3836 (gnus-summary-position-point)
3837 (gnus-configure-windows 'summary 'force)
3838 (gnus-set-mode-line 'summary))
3839 (when (and gnus-auto-center-group
3840 (get-buffer-window gnus-group-buffer t))
3841 ;; Gotta use windows, because recenter does weird stuff if
3842 ;; the current buffer ain't the displayed window.
3843 (let ((owin (selected-window)))
3844 (select-window (get-buffer-window gnus-group-buffer t))
3845 (when (gnus-group-goto-group group)
3847 (select-window owin)))
3848 ;; Mark this buffer as "prepared".
3849 (setq gnus-newsgroup-prepared t)
3850 (gnus-run-hooks 'gnus-summary-prepared-hook)
3851 (unless (gnus-ephemeral-group-p group)
3852 (gnus-group-update-group group))
3855 (defun gnus-summary-auto-select-subject ()
3856 "Select the subject line on initial group entry."
3857 (goto-char (point-min))
3859 ((eq gnus-auto-select-subject 'best)
3860 (gnus-summary-best-unread-subject))
3861 ((eq gnus-auto-select-subject 'unread)
3862 (gnus-summary-first-unread-subject))
3863 ((eq gnus-auto-select-subject 'unseen)
3864 (gnus-summary-first-unseen-subject))
3865 ((eq gnus-auto-select-subject 'unseen-or-unread)
3866 (gnus-summary-first-unseen-or-unread-subject))
3867 ((eq gnus-auto-select-subject 'first)
3870 ((functionp gnus-auto-select-subject)
3871 (funcall gnus-auto-select-subject))))
3873 (defun gnus-summary-prepare ()
3874 "Generate the summary buffer."
3876 (let ((buffer-read-only nil))
3878 (setq gnus-newsgroup-data nil
3879 gnus-newsgroup-data-reverse nil)
3880 (gnus-run-hooks 'gnus-summary-generate-hook)
3881 ;; Generate the buffer, either with threads or without.
3882 (when gnus-newsgroup-headers
3883 (gnus-summary-prepare-threads
3884 (if gnus-show-threads
3885 (gnus-sort-gathered-threads
3886 (funcall gnus-summary-thread-gathering-function
3888 (gnus-cut-threads (gnus-make-threads)))))
3889 ;; Unthreaded display.
3890 (gnus-sort-articles gnus-newsgroup-headers))))
3891 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3892 ;; Call hooks for modifying summary buffer.
3893 (goto-char (point-min))
3894 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3896 (defsubst gnus-general-simplify-subject (subject)
3897 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3900 ;; Truncate the subject.
3901 (gnus-simplify-subject-functions
3902 (gnus-map-function gnus-simplify-subject-functions subject))
3903 ((numberp gnus-summary-gather-subject-limit)
3904 (setq subject (gnus-simplify-subject-re subject))
3905 (if (> (length subject) gnus-summary-gather-subject-limit)
3906 (substring subject 0 gnus-summary-gather-subject-limit)
3908 ;; Fuzzily simplify it.
3909 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3910 (gnus-simplify-subject-fuzzy subject))
3911 ;; Just remove the leading "Re:".
3913 (gnus-simplify-subject-re subject))))
3915 (if (and gnus-summary-gather-exclude-subject
3916 (string-match gnus-summary-gather-exclude-subject subject))
3917 nil ; This article shouldn't be gathered
3920 (defun gnus-summary-simplify-subject-query ()
3921 "Query where the respool algorithm would put this article."
3923 (gnus-summary-select-article)
3925 (gnus-general-simplify-subject (gnus-summary-article-subject))))
3927 (defun gnus-gather-threads-by-subject (threads)
3928 "Gather threads by looking at Subject headers."
3929 (if (not gnus-summary-make-false-root)
3931 (let ((hashtb (gnus-make-hashtable 1024))
3934 subject hthread whole-subject)
3936 (setq subject (gnus-general-simplify-subject
3937 (setq whole-subject (mail-header-subject
3940 (if (setq hthread (gnus-gethash subject hashtb))
3942 ;; We enter a dummy root into the thread, if we
3943 ;; haven't done that already.
3944 (unless (stringp (caar hthread))
3945 (setcar hthread (list whole-subject (car hthread))))
3946 ;; We add this new gathered thread to this gathered
3948 (setcdr (car hthread)
3949 (nconc (cdar hthread) (list (car threads))))
3950 ;; Remove it from the list of threads.
3951 (setcdr prev (cdr threads))
3952 (setq threads prev))
3953 ;; Enter this thread into the hash table.
3954 (gnus-sethash subject
3955 (if gnus-summary-make-false-root-always
3957 ;; If you want a dummy root above all
3959 (setcar threads (list whole-subject
3965 (setq threads (cdr threads)))
3968 (defun gnus-gather-threads-by-references (threads)
3969 "Gather threads by looking at References headers."
3970 (let ((idhashtb (gnus-make-hashtable 1024))
3971 (thhashtb (gnus-make-hashtable 1024))
3974 ids references id gthread gid entered ref)
3976 (when (setq references (mail-header-references (caar threads)))
3977 (setq id (mail-header-id (caar threads))
3978 ids (inline (gnus-split-references references))
3980 (while (setq ref (pop ids))
3981 (setq ids (delete ref ids))
3982 (if (not (setq gid (gnus-gethash ref idhashtb)))
3984 (gnus-sethash ref id idhashtb)
3985 (gnus-sethash id threads thhashtb))
3986 (setq gthread (gnus-gethash gid thhashtb))
3988 ;; We enter a dummy root into the thread, if we
3989 ;; haven't done that already.
3990 (unless (stringp (caar gthread))
3991 (setcar gthread (list (mail-header-subject (caar gthread))
3993 ;; We add this new gathered thread to this gathered
3995 (setcdr (car gthread)
3996 (nconc (cdar gthread) (list (car threads)))))
3997 ;; Add it into the thread hash table.
3998 (gnus-sethash id gthread thhashtb)
4000 ;; Remove it from the list of threads.
4001 (setcdr prev (cdr threads))
4002 (setq threads prev))))
4004 (setq threads (cdr threads)))
4007 (defun gnus-sort-gathered-threads (threads)
4008 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4009 (let ((result threads))
4011 (when (stringp (caar threads))
4012 (setcdr (car threads)
4013 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4014 (setq threads (cdr threads)))
4017 (defun gnus-thread-loop-p (root thread)
4018 "Say whether ROOT is in THREAD."
4019 (let ((stack (list thread))
4022 (while (setq thread (pop stack))
4023 (setq th (cdr thread))
4025 (not (eq (caar th) root)))
4028 ;; We have found a loop.
4030 (setcdr thread (delq (car th) (cdr thread)))
4031 (if (boundp (setq ref-dep (intern "none"
4032 gnus-newsgroup-dependencies)))
4033 (setcdr (symbol-value ref-dep)
4034 (nconc (cdr (symbol-value ref-dep))
4036 (set ref-dep (list nil (car th))))
4039 ;; Push all the subthreads onto the stack.
4040 (push (cdr thread) stack)))
4043 (defun gnus-make-threads ()
4044 "Go through the dependency hashtb and find the roots. Return all threads."
4046 (while (catch 'infloop
4049 ;; Deal with self-referencing References loops.
4050 (when (and (car (symbol-value refs))
4057 (car (symbol-value refs)) thread))
4058 (cdr (symbol-value refs)))))))
4061 (unless (car (symbol-value refs))
4062 ;; These threads do not refer back to any other articles,
4063 ;; so they're roots.
4064 (setq threads (append (cdr (symbol-value refs)) threads))))
4065 gnus-newsgroup-dependencies)))
4068 ;; Build the thread tree.
4069 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4070 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4072 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4073 if it was already present.
4075 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4076 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4077 Message-IDs will be renamed to a unique Message-ID before being
4080 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4081 (let* ((id (mail-header-id header))
4082 (id-dep (and id (intern id dependencies)))
4083 parent-id ref ref-dep ref-header replaced)
4084 ;; Enter this `header' in the `dependencies' table.
4088 ;; The first two cases do the normal part: enter a new `header'
4089 ;; in the `dependencies' table.
4090 ((not (boundp id-dep))
4091 (set id-dep (list header)))
4092 ((null (car (symbol-value id-dep)))
4093 (setcar (symbol-value id-dep) header))
4095 ;; From here the `header' was already present in the
4096 ;; `dependencies' table.
4098 ;; Overrides an existing entry;
4099 ;; just set the header part of the entry.
4100 (setcar (symbol-value id-dep) header)
4103 ;; Renames the existing `header' to a unique Message-ID.
4104 ((not gnus-summary-ignore-duplicates)
4105 ;; An article with this Message-ID has already been seen.
4106 ;; We rename the Message-ID.
4107 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4109 (mail-header-set-id header id))
4111 ;; The last case ignores an existing entry, except it adds any
4112 ;; additional Xrefs (in case the two articles came from different
4114 ;; Also sets `header' to `nil' meaning that the `dependencies'
4115 ;; table was *not* modified.
4117 (mail-header-set-xref
4118 (car (symbol-value id-dep))
4119 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4121 (or (mail-header-xref header) "")))
4124 (when (and header (not replaced))
4125 ;; First check that we are not creating a References loop.
4126 (setq parent-id (gnus-parent-id (mail-header-references header)))
4127 (setq ref parent-id)
4129 (setq ref-dep (intern-soft ref dependencies))
4131 (setq ref-header (car (symbol-value ref-dep))))
4132 (if (string= id ref)
4133 ;; Yuk! This is a reference loop. Make the article be a
4136 (mail-header-set-references (car (symbol-value id-dep)) "none")
4138 (setq parent-id nil))
4139 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4140 (setq ref-dep (intern (or parent-id "none") dependencies))
4141 (if (boundp ref-dep)
4142 (setcdr (symbol-value ref-dep)
4143 (nconc (cdr (symbol-value ref-dep))
4144 (list (symbol-value id-dep))))
4145 (set ref-dep (list nil (symbol-value id-dep)))))
4148 (defun gnus-extract-message-id-from-in-reply-to (string)
4149 (if (string-match "<[^>]+>" string)
4150 (substring string (match-beginning 0) (match-end 0))
4153 (defun gnus-build-sparse-threads ()
4154 (let ((headers gnus-newsgroup-headers)
4155 (mail-parse-charset gnus-newsgroup-charset)
4156 (gnus-summary-ignore-duplicates t)
4157 header references generation relations
4158 subject child end new-child date)
4159 ;; First we create an alist of generations/relations, where
4160 ;; generations is how much we trust the relation, and the relation
4162 (gnus-message 7 "Making sparse threads...")
4164 (nnheader-set-temp-buffer " *gnus sparse threads*")
4165 (while (setq header (pop headers))
4166 (when (and (setq references (mail-header-references header))
4167 (not (string= references "")))
4169 (setq child (mail-header-id header)
4170 subject (mail-header-subject header)
4171 date (mail-header-date header)
4173 (while (search-backward ">" nil t)
4174 (setq end (1+ (point)))
4175 (when (search-backward "<" nil t)
4176 (setq new-child (buffer-substring (point) end))
4177 (push (list (incf generation)
4178 child (setq child new-child)
4182 (push (list (1+ generation) child nil subject) relations))
4184 (kill-buffer (current-buffer)))
4185 ;; Sort over trustworthiness.
4188 (when (gnus-dependencies-add-header
4189 (make-full-mail-header-from-decoded-header
4190 gnus-reffed-article-number
4191 (nth 3 relation) "" (or (nth 4 relation) "")
4193 (or (nth 2 relation) "") 0 0 "")
4194 gnus-newsgroup-dependencies nil)
4195 (push gnus-reffed-article-number gnus-newsgroup-limit)
4196 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4197 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4198 gnus-newsgroup-reads)
4199 (decf gnus-reffed-article-number)))
4200 (sort relations 'car-less-than-car))
4201 (gnus-message 7 "Making sparse threads...done")))
4203 (defun gnus-build-old-threads ()
4204 ;; Look at all the articles that refer back to old articles, and
4205 ;; fetch the headers for the articles that aren't there. This will
4206 ;; build complete threads - if the roots haven't been expired by the
4208 (let ((mail-parse-charset gnus-newsgroup-charset)
4212 (when (not (car (symbol-value refs)))
4213 (setq heads (cdr (symbol-value refs)))
4215 (if (memq (mail-header-number (caar heads))
4216 gnus-newsgroup-dormant)
4217 (setq heads (cdr heads))
4218 (setq id (symbol-name refs))
4219 (while (and (setq id (gnus-build-get-header id))
4220 (not (car (gnus-id-to-thread id)))))
4221 (setq heads nil)))))
4222 gnus-newsgroup-dependencies)))
4224 (defsubst gnus-remove-odd-characters (string)
4225 "Translate STRING into something that doesn't contain weird characters."
4226 (mm-subst-char-in-string
4228 (mm-subst-char-in-string ?\n ?\- string t) t))
4230 ;; This function has to be called with point after the article number
4231 ;; on the beginning of the line.
4232 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4233 (let ((eol (point-at-eol))
4234 (buffer (current-buffer))
4235 header references in-reply-to)
4237 ;; overview: [num subject from date id refs chars lines misc]
4240 (narrow-to-region (point) eol)
4245 (make-full-mail-header
4247 (nnheader-nov-field) ; subject
4248 (nnheader-nov-field) ; from
4249 (nnheader-nov-field) ; date
4250 (nnheader-nov-read-message-id number) ; id
4251 (setq references (nnheader-nov-field)) ; refs
4252 (nnheader-nov-read-integer) ; chars
4253 (nnheader-nov-read-integer) ; lines
4255 (if (looking-at "Xref: ")
4256 (goto-char (match-end 0)))
4257 (nnheader-nov-field)) ; Xref
4258 (nnheader-nov-parse-extra)))) ; extra
4262 (when (and (string= references "")
4263 (setq in-reply-to (mail-header-extra header))
4264 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4265 (mail-header-set-references
4266 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4268 (when gnus-alter-header-function
4269 (funcall gnus-alter-header-function header))
4270 (gnus-dependencies-add-header header dependencies force-new)))
4272 (defun gnus-build-get-header (id)
4273 "Look through the buffer of NOV lines and find the header to ID.
4274 Enter this line into the dependencies hash table, and return
4275 the id of the parent article (if any)."
4276 (let ((deps gnus-newsgroup-dependencies)
4280 (set-buffer nntp-server-buffer)
4281 (let ((case-fold-search nil))
4282 (goto-char (point-min))
4283 (while (and (not found)
4284 (search-forward id nil t))
4286 (setq found (looking-at
4287 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4288 (regexp-quote id))))
4289 (or found (beginning-of-line 2)))
4293 (setq header (gnus-nov-parse-line
4294 (read (current-buffer)) deps))
4295 (gnus-parent-id (mail-header-references header))))))
4297 (let ((number (mail-header-number header)))
4298 (push number gnus-newsgroup-limit)
4299 (push header gnus-newsgroup-headers)
4300 (if (memq number gnus-newsgroup-unselected)
4302 (setq gnus-newsgroup-unreads
4303 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4305 (setq gnus-newsgroup-unselected
4306 (delq number gnus-newsgroup-unselected)))
4307 (push number gnus-newsgroup-ancient)))))))
4309 (defun gnus-build-all-threads ()
4310 "Read all the headers."
4311 (let ((gnus-summary-ignore-duplicates t)
4312 (mail-parse-charset gnus-newsgroup-charset)
4313 (dependencies gnus-newsgroup-dependencies)
4316 (set-buffer nntp-server-buffer)
4317 (let ((case-fold-search nil))
4318 (goto-char (point-min))
4321 (setq article (read (current-buffer))
4322 header (gnus-nov-parse-line article dependencies)))
4324 (with-current-buffer gnus-summary-buffer
4325 (push header gnus-newsgroup-headers)
4326 (if (memq (setq article (mail-header-number header))
4327 gnus-newsgroup-unselected)
4329 (setq gnus-newsgroup-unreads
4330 (gnus-add-to-sorted-list
4331 gnus-newsgroup-unreads article))
4332 (setq gnus-newsgroup-unselected
4333 (delq article gnus-newsgroup-unselected)))
4334 (push article gnus-newsgroup-ancient)))
4335 (forward-line 1)))))))
4337 (defun gnus-summary-update-article-line (article header)
4338 "Update the line for ARTICLE using HEADER."
4339 (let* ((id (mail-header-id header))
4340 (thread (gnus-id-to-thread id)))
4342 (error "Article in no thread"))
4343 ;; Update the thread.
4344 (setcar thread header)
4345 (gnus-summary-goto-subject article)
4346 (let* ((datal (gnus-data-find-list article))
4348 (buffer-read-only nil)
4349 (level (gnus-summary-thread-level)))
4351 (let ((inserted (- (point)
4353 (gnus-summary-insert-line
4355 (memq article gnus-newsgroup-undownloaded)
4356 (gnus-article-mark article)
4357 (memq article gnus-newsgroup-replied)
4358 (memq article gnus-newsgroup-expirable)
4359 ;; Only insert the Subject string when it's different
4360 ;; from the previous Subject string.
4365 (mail-header-subject
4368 (gnus-data-find-list
4370 (gnus-data-list t)))))
4371 ;; Error on the side of excessive subjects.
4373 (mail-header-subject header)))
4375 (mail-header-subject header))
4376 nil (cdr (assq article gnus-newsgroup-scored))
4377 (memq article gnus-newsgroup-processable))
4380 (gnus-data-update-list
4382 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4384 (defun gnus-summary-update-article (article &optional iheader)
4385 "Update ARTICLE in the summary buffer."
4386 (set-buffer gnus-summary-buffer)
4387 (let* ((header (gnus-summary-article-header article))
4388 (id (mail-header-id header))
4389 (data (gnus-data-find article))
4390 (thread (gnus-id-to-thread id))
4391 (references (mail-header-references header))
4395 (when (and references
4396 (not (equal "" references)))
4399 (buffer-read-only nil)
4405 (delq thread parent)))
4406 (if (gnus-summary-insert-subject id header)
4407 ;; Set the (possibly) new article number in the data structure.
4408 (gnus-data-set-number data (gnus-id-to-article id))
4412 (defun gnus-rebuild-thread (id &optional line)
4413 "Rebuild the thread containing ID.
4414 If LINE, insert the rebuilt thread starting on line LINE."
4415 (let ((buffer-read-only nil)
4416 old-pos current thread data)
4417 (if (not gnus-show-threads)
4418 (setq thread (list (car (gnus-id-to-thread id))))
4419 ;; Get the thread this article is part of.
4420 (setq thread (gnus-remove-thread id)))
4421 (setq old-pos (point-at-bol))
4422 (setq current (save-excursion
4423 (and (re-search-backward "[\r\n]" nil t)
4424 (gnus-summary-article-number))))
4425 ;; If this is a gathered thread, we have to go some re-gathering.
4426 (when (stringp (car thread))
4427 (let ((subject (car thread))
4429 (setq thread (cdr thread))
4431 (unless (memq (setq thr (gnus-id-to-thread
4433 (mail-header-id (caar thread)))))
4436 (setq thread (cdr thread)))
4437 ;; We now have all (unique) roots.
4438 (if (= (length roots) 1)
4439 ;; All the loose roots are now one solid root.
4440 (setq thread (car roots))
4441 (setq thread (cons subject (gnus-sort-threads roots))))))
4443 ;; We then insert this thread into the summary buffer.
4445 (goto-char (point-min))
4446 (forward-line (1- line)))
4447 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4448 (if gnus-show-threads
4449 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4450 (gnus-summary-prepare-unthreaded thread))
4451 (setq data (nreverse gnus-newsgroup-data))
4452 (setq threads gnus-newsgroup-threads))
4453 ;; We splice the new data into the data structure.
4454 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4455 ;;!!! then we want to insert at the beginning of the buffer.
4456 ;;!!! That happens to be true with Gnus now, but that may
4457 ;;!!! change in the future. Perhaps.
4458 (gnus-data-enter-list
4459 (if line nil current) data (- (point) old-pos))
4460 (setq gnus-newsgroup-threads
4461 (nconc threads gnus-newsgroup-threads))
4462 (gnus-data-compute-positions))))
4464 (defun gnus-number-to-header (number)
4465 "Return the header for article NUMBER."
4466 (let ((headers gnus-newsgroup-headers))
4468 (not (= number (mail-header-number (car headers)))))
4473 (defun gnus-parent-headers (in-headers &optional generation)
4474 "Return the headers of the GENERATIONeth parent of HEADERS."
4476 (setq generation 1))
4478 (headers in-headers)
4481 (not (zerop generation))
4482 (setq references (mail-header-references headers)))
4483 (setq headers (if (and references
4484 (setq parent (gnus-parent-id references)))
4485 (car (gnus-id-to-thread parent))
4488 (and (not (eq headers in-headers))
4491 (defun gnus-id-to-thread (id)
4492 "Return the (sub-)thread where ID appears."
4493 (gnus-gethash id gnus-newsgroup-dependencies))
4495 (defun gnus-id-to-article (id)
4496 "Return the article number of ID."
4497 (let ((thread (gnus-id-to-thread id)))
4500 (mail-header-number (car thread)))))
4502 (defun gnus-id-to-header (id)
4503 "Return the article headers of ID."
4504 (car (gnus-id-to-thread id)))
4506 (defun gnus-article-displayed-root-p (article)
4507 "Say whether ARTICLE is a root(ish) article."
4508 (let ((level (gnus-summary-thread-level article))
4509 (refs (mail-header-references (gnus-summary-article-header article)))
4515 ((null (gnus-parent-id refs)) t)
4517 (null (setq particle (gnus-id-to-article
4518 (gnus-parent-id refs))))
4519 (null (gnus-summary-thread-level particle)))))))
4521 (defun gnus-root-id (id)
4522 "Return the id of the root of the thread where ID appears."
4524 (while (and id (setq prev (car (gnus-id-to-thread id))))
4526 id (gnus-parent-id (mail-header-references prev))))
4529 (defun gnus-articles-in-thread (thread)
4530 "Return the list of articles in THREAD."
4531 (cons (mail-header-number (car thread))
4532 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4534 (defun gnus-remove-thread (id &optional dont-remove)
4535 "Remove the thread that has ID in it."
4536 (let (headers thread last-id)
4537 ;; First go up in this thread until we find the root.
4538 (setq last-id (gnus-root-id id)
4539 headers (message-flatten-list (gnus-id-to-thread last-id)))
4540 ;; We have now found the real root of this thread. It might have
4541 ;; been gathered into some loose thread, so we have to search
4542 ;; through the threads to find the thread we wanted.
4543 (let ((threads gnus-newsgroup-threads)
4546 (setq sub (car threads))
4547 (if (stringp (car sub))
4548 ;; This is a gathered thread, so we look at the roots
4549 ;; below it to find whether this article is in this
4552 (setq sub (cdr sub))
4554 (when (member (caar sub) headers)
4555 (setq thread (car threads)
4558 (setq sub (cdr sub))))
4559 ;; It's an ordinary thread, so we check it.
4560 (when (eq (car sub) (car headers))
4563 (setq threads (cdr threads)))
4564 ;; If this article is in no thread, then it's a root.
4567 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4568 (setq thread (gnus-id-to-thread last-id)))
4571 thread ; We return this thread.
4573 (if (stringp (car thread))
4575 ;; If we use dummy roots, then we have to remove the
4576 ;; dummy root as well.
4577 (when (eq gnus-summary-make-false-root 'dummy)
4578 ;; We go to the dummy root by going to
4579 ;; the first sub-"thread", and then one line up.
4580 (gnus-summary-goto-article
4581 (mail-header-number (caadr thread)))
4584 (gnus-data-compute-positions))
4585 (setq thread (cdr thread))
4587 (gnus-remove-thread-1 (car thread))
4588 (setq thread (cdr thread))))
4589 (gnus-remove-thread-1 thread))))))))
4591 (defun gnus-remove-thread-1 (thread)
4592 "Remove the thread THREAD recursively."
4593 (let ((number (mail-header-number (pop thread)))
4595 (setq thread (reverse thread))
4597 (gnus-remove-thread-1 (pop thread)))
4598 (when (setq d (gnus-data-find number))
4599 (goto-char (gnus-data-pos d))
4600 (gnus-summary-show-thread)
4606 (gnus-delete-line)))))))
4608 (defun gnus-sort-threads-1 (threads func)
4609 (sort (mapcar (lambda (thread)
4612 (gnus-sort-threads-1 (cdr thread) func))))
4615 (defun gnus-sort-threads (threads)
4617 (if (not gnus-thread-sort-functions)
4619 (gnus-message 8 "Sorting threads...")
4620 (let ((max-lisp-eval-depth 5000))
4621 (prog1 (gnus-sort-threads-1
4623 (gnus-make-sort-function gnus-thread-sort-functions))
4624 (gnus-message 8 "Sorting threads...done")))))
4626 (defun gnus-sort-articles (articles)
4628 (when gnus-article-sort-functions
4629 (gnus-message 7 "Sorting articles...")
4631 (setq gnus-newsgroup-headers
4632 (sort articles (gnus-make-sort-function
4633 gnus-article-sort-functions)))
4634 (gnus-message 7 "Sorting articles...done"))))
4636 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4637 (defmacro gnus-thread-header (thread)
4638 "Return header of first article in THREAD.
4639 Note that THREAD must never, ever be anything else than a variable -
4640 using some other form will lead to serious barfage."
4641 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4642 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4643 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4646 (defsubst gnus-article-sort-by-number (h1 h2)
4647 "Sort articles by article number."
4648 (< (mail-header-number h1)
4649 (mail-header-number h2)))
4651 (defun gnus-thread-sort-by-number (h1 h2)
4652 "Sort threads by root article number."
4653 (gnus-article-sort-by-number
4654 (gnus-thread-header h1) (gnus-thread-header h2)))
4656 (defsubst gnus-article-sort-by-random (h1 h2)
4657 "Sort articles by article number."
4660 (defun gnus-thread-sort-by-random (h1 h2)
4661 "Sort threads by root article number."
4662 (gnus-article-sort-by-random
4663 (gnus-thread-header h1) (gnus-thread-header h2)))
4665 (defsubst gnus-article-sort-by-lines (h1 h2)
4666 "Sort articles by article Lines header."
4667 (< (mail-header-lines h1)
4668 (mail-header-lines h2)))
4670 (defun gnus-thread-sort-by-lines (h1 h2)
4671 "Sort threads by root article Lines header."
4672 (gnus-article-sort-by-lines
4673 (gnus-thread-header h1) (gnus-thread-header h2)))
4675 (defsubst gnus-article-sort-by-chars (h1 h2)
4676 "Sort articles by octet length."
4677 (< (mail-header-chars h1)
4678 (mail-header-chars h2)))
4680 (defun gnus-thread-sort-by-chars (h1 h2)
4681 "Sort threads by root article octet length."
4682 (gnus-article-sort-by-chars
4683 (gnus-thread-header h1) (gnus-thread-header h2)))
4685 (defsubst gnus-article-sort-by-author (h1 h2)
4686 "Sort articles by root author."
4688 (let ((addr (car (mime-entity-read-field h1 'From))))
4689 (or (std11-full-name-string addr)
4690 (std11-address-string addr)
4692 (let ((addr (car (mime-entity-read-field h2 'From))))
4693 (or (std11-full-name-string addr)
4694 (std11-address-string addr)
4698 (defun gnus-thread-sort-by-author (h1 h2)
4699 "Sort threads by root author."
4700 (gnus-article-sort-by-author
4701 (gnus-thread-header h1) (gnus-thread-header h2)))
4703 (defsubst gnus-article-sort-by-recipient (h1 h2)
4704 "Sort articles by recipient."
4706 (let ((extract (funcall
4707 gnus-extract-address-components
4708 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4709 (or (car extract) (cadr extract)))
4710 (let ((extract (funcall
4711 gnus-extract-address-components
4712 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4713 (or (car extract) (cadr extract)))))
4715 (defun gnus-thread-sort-by-recipient (h1 h2)
4716 "Sort threads by root recipient."
4717 (gnus-article-sort-by-recipient
4718 (gnus-thread-header h1) (gnus-thread-header h2)))
4720 (defsubst gnus-article-sort-by-subject (h1 h2)
4721 "Sort articles by root subject."
4723 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4724 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4726 (defun gnus-thread-sort-by-subject (h1 h2)
4727 "Sort threads by root subject."
4728 (gnus-article-sort-by-subject
4729 (gnus-thread-header h1) (gnus-thread-header h2)))
4731 (defsubst gnus-article-sort-by-date (h1 h2)
4732 "Sort articles by root article date."
4734 (gnus-date-get-time (mail-header-date h1))
4735 (gnus-date-get-time (mail-header-date h2))))
4737 (defun gnus-thread-sort-by-date (h1 h2)
4738 "Sort threads by root article date."
4739 (gnus-article-sort-by-date
4740 (gnus-thread-header h1) (gnus-thread-header h2)))
4742 (defsubst gnus-article-sort-by-score (h1 h2)
4743 "Sort articles by root article score.
4744 Unscored articles will be counted as having a score of zero."
4745 (> (or (cdr (assq (mail-header-number h1)
4746 gnus-newsgroup-scored))
4747 gnus-summary-default-score 0)
4748 (or (cdr (assq (mail-header-number h2)
4749 gnus-newsgroup-scored))
4750 gnus-summary-default-score 0)))
4752 (defun gnus-thread-sort-by-score (h1 h2)
4753 "Sort threads by root article score."
4754 (gnus-article-sort-by-score
4755 (gnus-thread-header h1) (gnus-thread-header h2)))
4757 (defun gnus-thread-sort-by-total-score (h1 h2)
4758 "Sort threads by the sum of all scores in the thread.
4759 Unscored articles will be counted as having a score of zero."
4760 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4762 (defun gnus-thread-total-score (thread)
4763 ;; This function find the total score of THREAD.
4768 (if (stringp (car thread))
4769 (apply gnus-thread-score-function 0
4770 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4771 (gnus-thread-total-score-1 thread)))
4773 (gnus-thread-total-score-1 (list thread)))))
4775 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4776 "Sort threads such that the thread with the most recently arrived article comes first."
4777 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4779 (defun gnus-thread-highest-number (thread)
4780 "Return the highest article number in THREAD."
4781 (apply 'max (mapcar (lambda (header)
4782 (mail-header-number header))
4783 (message-flatten-list thread))))
4785 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4786 "Sort threads such that the thread with the most recently dated article comes first."
4787 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4789 (defun gnus-thread-latest-date (thread)
4790 "Return the highest article date in THREAD."
4791 (let ((previous-time 0))
4797 (time-to-seconds (mail-header-parse-date
4798 (mail-header-date header)))
4799 (error previous-time))))
4801 (message-flatten-list thread)
4803 (< (mail-header-number h1)
4804 (mail-header-number h2))))))))
4806 (defun gnus-thread-total-score-1 (root)
4807 ;; This function find the total score of the thread below ROOT.
4808 (setq root (car root))
4809 (apply gnus-thread-score-function
4811 (mapcar 'gnus-thread-total-score
4812 (cdr (gnus-id-to-thread (mail-header-id root))))
4813 (when (> (mail-header-number root) 0)
4814 (list (or (cdr (assq (mail-header-number root)
4815 gnus-newsgroup-scored))
4816 gnus-summary-default-score 0))))
4817 (list gnus-summary-default-score)
4820 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4821 (defvar gnus-tmp-prev-subject nil)
4822 (defvar gnus-tmp-false-parent nil)
4823 (defvar gnus-tmp-root-expunged nil)
4824 (defvar gnus-tmp-dummy-line nil)
4826 (eval-when-compile (defvar gnus-tmp-header))
4827 (defun gnus-extra-header (type &optional header)
4828 "Return the extra header of TYPE."
4829 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4832 (defvar gnus-tmp-thread-tree-header-string "")
4834 (defcustom gnus-sum-thread-tree-root "> "
4835 "With %B spec, used for the root of a thread.
4836 If nil, use subject instead."
4838 :type '(radio (const :format "%v " nil) string)
4839 :group 'gnus-thread)
4841 (defcustom gnus-sum-thread-tree-false-root "> "
4842 "With %B spec, used for a false root of a thread.
4843 If nil, use subject instead."
4845 :type '(radio (const :format "%v " nil) string)
4846 :group 'gnus-thread)
4848 (defcustom gnus-sum-thread-tree-single-indent ""
4849 "With %B spec, used for a thread with just one message.
4850 If nil, use subject instead."
4852 :type '(radio (const :format "%v " nil) string)
4853 :group 'gnus-thread)
4855 (defcustom gnus-sum-thread-tree-vertical "| "
4856 "With %B spec, used for drawing a vertical line."
4859 :group 'gnus-thread)
4861 (defcustom gnus-sum-thread-tree-indent " "
4862 "With %B spec, used for indenting."
4865 :group 'gnus-thread)
4867 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4868 "With %B spec, used for a leaf with brothers."
4871 :group 'gnus-thread)
4873 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4874 "With %B spec, used for a leaf without brothers."
4877 :group 'gnus-thread)
4879 (defun gnus-summary-prepare-threads (threads)
4880 "Prepare summary buffer from THREADS and indentation LEVEL.
4881 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4882 or a straight list of headers."
4883 (gnus-message 7 "Generating summary...")
4885 (setq gnus-newsgroup-threads threads)
4888 (let ((gnus-tmp-level 0)
4889 (default-score (or gnus-summary-default-score 0))
4890 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4891 (building-line-count gnus-summary-display-while-building)
4892 (building-count (integerp gnus-summary-display-while-building))
4893 thread number subject stack state gnus-tmp-gathered beg-match
4894 new-roots gnus-tmp-new-adopts thread-end simp-subject
4895 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4896 gnus-tmp-replied gnus-tmp-subject-or-nil
4897 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4898 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4899 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4902 (setq gnus-tmp-prev-subject nil
4903 gnus-tmp-thread-tree-header-string "")
4905 (if (vectorp (car threads))
4906 ;; If this is a straight (sic) list of headers, then a
4907 ;; threaded summary display isn't required, so we just create
4908 ;; an unthreaded one.
4909 (gnus-summary-prepare-unthreaded threads)
4911 ;; Do the threaded display.
4913 (if gnus-summary-display-while-building
4914 (switch-to-buffer (buffer-name)))
4915 (while (or threads stack gnus-tmp-new-adopts new-roots)
4917 (if (and (= gnus-tmp-level 0)
4920 (not gnus-tmp-false-parent)
4921 (or gnus-tmp-new-adopts new-roots))
4922 (if gnus-tmp-new-adopts
4923 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4924 thread (list (car gnus-tmp-new-adopts))
4925 gnus-tmp-header (caar thread)
4926 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4928 (setq thread (list (car new-roots))
4929 gnus-tmp-header (caar thread)
4930 new-roots (cdr new-roots))))
4933 ;; If there are some threads, we do them before the
4934 ;; threads on the stack.
4935 (setq thread threads
4936 gnus-tmp-header (caar thread))
4937 ;; There were no current threads, so we pop something off
4939 (setq state (car stack)
4940 gnus-tmp-level (car state)
4941 tree-stack (cadr state)
4942 thread (caddr state)
4944 gnus-tmp-header (caar thread))))
4946 (setq gnus-tmp-false-parent nil)
4947 (setq gnus-tmp-root-expunged nil)
4948 (setq thread-end nil)
4950 (if (stringp gnus-tmp-header)
4951 ;; The header is a dummy root.
4953 ((eq gnus-summary-make-false-root 'adopt)
4954 ;; We let the first article adopt the rest.
4955 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4957 (setq gnus-tmp-gathered
4959 (lambda (h) (mail-header-number (car h)))
4962 (setq thread (cons (list (caar thread)
4965 (setq gnus-tmp-level -1
4966 gnus-tmp-false-parent t))
4967 ((eq gnus-summary-make-false-root 'empty)
4968 ;; We print adopted articles with empty subject fields.
4969 (setq gnus-tmp-gathered
4971 (lambda (h) (mail-header-number (car h)))
4974 (setq gnus-tmp-level -1))
4975 ((eq gnus-summary-make-false-root 'dummy)
4976 ;; We remember that we probably want to output a dummy
4978 (setq gnus-tmp-dummy-line gnus-tmp-header)
4979 (setq gnus-tmp-prev-subject gnus-tmp-header))
4981 ;; We do not make a root for the gathered
4982 ;; sub-threads at all.
4983 (setq gnus-tmp-level -1)))
4985 (setq number (mail-header-number gnus-tmp-header)
4986 subject (mail-header-subject gnus-tmp-header)
4987 simp-subject (gnus-simplify-subject-fully subject))
4990 ;; If the thread has changed subject, we might want to make
4991 ;; this subthread into a root.
4992 ((and (null gnus-thread-ignore-subject)
4993 (not (zerop gnus-tmp-level))
4994 gnus-tmp-prev-subject
4995 (not (string= gnus-tmp-prev-subject simp-subject)))
4996 (setq new-roots (nconc new-roots (list (car thread)))
4998 gnus-tmp-header nil))
4999 ;; If the article lies outside the current limit,
5000 ;; then we do not display it.
5001 ((not (memq number gnus-newsgroup-limit))
5002 (setq gnus-tmp-gathered
5004 (lambda (h) (mail-header-number (car h)))
5007 (setq gnus-tmp-new-adopts (if (cdar thread)
5008 (append gnus-tmp-new-adopts
5010 gnus-tmp-new-adopts)
5012 gnus-tmp-header nil)
5013 (when (zerop gnus-tmp-level)
5014 (setq gnus-tmp-root-expunged t)))
5015 ;; Perhaps this article is to be marked as read?
5016 ((and gnus-summary-mark-below
5017 (< (or (cdr (assq number gnus-newsgroup-scored))
5019 gnus-summary-mark-below)
5020 ;; Don't touch sparse articles.
5021 (not (gnus-summary-article-sparse-p number))
5022 (not (gnus-summary-article-ancient-p number)))
5023 (setq gnus-newsgroup-unreads
5024 (delq number gnus-newsgroup-unreads))
5025 (if gnus-newsgroup-auto-expire
5026 (setq gnus-newsgroup-expirable
5027 (gnus-add-to-sorted-list
5028 gnus-newsgroup-expirable number))
5029 (push (cons number gnus-low-score-mark)
5030 gnus-newsgroup-reads))))
5032 (when gnus-tmp-header
5033 ;; We may have an old dummy line to output before this
5035 (when (and gnus-tmp-dummy-line
5038 (mail-header-subject gnus-tmp-header)))
5039 (gnus-summary-insert-dummy-line
5040 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5041 (setq gnus-tmp-dummy-line nil))
5043 ;; Compute the mark.
5044 (setq gnus-tmp-unread (gnus-article-mark number))
5046 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5047 gnus-tmp-header gnus-tmp-level)
5048 gnus-newsgroup-data)
5050 ;; Actually insert the line.
5052 gnus-tmp-subject-or-nil
5054 ((and gnus-thread-ignore-subject
5055 gnus-tmp-prev-subject
5056 (not (string= gnus-tmp-prev-subject simp-subject)))
5058 ((zerop gnus-tmp-level)
5059 (if (and (eq gnus-summary-make-false-root 'empty)
5060 (memq number gnus-tmp-gathered)
5061 gnus-tmp-prev-subject
5062 (string= gnus-tmp-prev-subject simp-subject))
5063 gnus-summary-same-subject
5065 (t gnus-summary-same-subject)))
5066 (if (and (eq gnus-summary-make-false-root 'adopt)
5067 (= gnus-tmp-level 1)
5068 (memq number gnus-tmp-gathered))
5069 (setq gnus-tmp-opening-bracket ?\<
5070 gnus-tmp-closing-bracket ?\>)
5071 (setq gnus-tmp-opening-bracket ?\[
5072 gnus-tmp-closing-bracket ?\]))
5074 gnus-tmp-indentation
5075 (aref gnus-thread-indent-array gnus-tmp-level)
5076 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5077 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5078 gnus-summary-default-score 0)
5080 (if (or (null gnus-summary-default-score)
5081 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5082 gnus-summary-zcore-fuzz))
5084 (if (< gnus-tmp-score gnus-summary-default-score)
5085 gnus-score-below-mark gnus-score-over-mark))
5087 (cond ((memq number gnus-newsgroup-processable)
5089 ((memq number gnus-newsgroup-cached)
5091 ((memq number gnus-newsgroup-replied)
5093 ((memq number gnus-newsgroup-forwarded)
5094 gnus-forwarded-mark)
5095 ((memq number gnus-newsgroup-saved)
5097 ((memq number gnus-newsgroup-recent)
5099 ((memq number gnus-newsgroup-unseen)
5103 (cond ((memq number gnus-newsgroup-undownloaded)
5104 gnus-undownloaded-mark)
5105 (gnus-newsgroup-agentized
5106 gnus-downloaded-mark)
5109 gnus-tmp-from (mail-header-from gnus-tmp-header)
5112 ((string-match "<[^>]+> *$" gnus-tmp-from)
5113 (setq beg-match (match-beginning 0))
5114 (or (and (string-match "^\".+\"" gnus-tmp-from)
5115 (substring gnus-tmp-from 1 (1- (match-end 0))))
5116 (substring gnus-tmp-from 0 beg-match)))
5117 ((string-match "(.+)" gnus-tmp-from)
5118 (substring gnus-tmp-from
5119 (1+ (match-beginning 0)) (1- (match-end 0))))
5123 gnus-tmp-thread-tree-header-string
5125 ((not gnus-show-threads) "")
5126 ((zerop gnus-tmp-level)
5127 (cond ((cdar thread)
5128 (or gnus-sum-thread-tree-root subject))
5129 (gnus-tmp-new-adopts
5130 (or gnus-sum-thread-tree-false-root subject))
5132 (or gnus-sum-thread-tree-single-indent subject))))
5134 (concat (apply 'concat
5135 (mapcar (lambda (item)
5137 gnus-sum-thread-tree-vertical
5138 gnus-sum-thread-tree-indent))
5139 (cdr (reverse tree-stack))))
5141 gnus-sum-thread-tree-leaf-with-other
5142 gnus-sum-thread-tree-single-leaf)))))
5143 (when (string= gnus-tmp-name "")
5144 (setq gnus-tmp-name gnus-tmp-from))
5145 (unless (numberp gnus-tmp-lines)
5146 (setq gnus-tmp-lines -1))
5147 (if (= gnus-tmp-lines -1)
5148 (setq gnus-tmp-lines "?")
5149 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5150 (gnus-put-text-property
5152 (progn (eval gnus-summary-line-format-spec) (point))
5153 'gnus-number number)
5156 (gnus-run-hooks 'gnus-summary-update-hook)
5159 (setq gnus-tmp-prev-subject simp-subject)))
5161 (when (nth 1 thread)
5162 (push (list (max 0 gnus-tmp-level)
5163 (copy-sequence tree-stack)
5166 (push (if (nth 1 thread) 1 0) tree-stack)
5167 (incf gnus-tmp-level)
5168 (setq threads (if thread-end nil (cdar thread)))
5169 (if gnus-summary-display-while-building
5172 ;; use a set frequency
5173 (setq building-line-count (1- building-line-count))
5174 (when (= building-line-count 0)
5176 (setq building-line-count
5177 gnus-summary-display-while-building)))
5181 (setq gnus-tmp-level 0)))))
5182 (gnus-message 7 "Generating summary...done"))
5184 (defun gnus-summary-prepare-unthreaded (headers)
5185 "Generate an unthreaded summary buffer based on HEADERS."
5186 (let (header number mark)
5191 ;; We may have to root out some bad articles...
5192 (when (memq (setq number (mail-header-number
5193 (setq header (pop headers))))
5194 gnus-newsgroup-limit)
5195 ;; Mark article as read when it has a low score.
5196 (when (and gnus-summary-mark-below
5197 (< (or (cdr (assq number gnus-newsgroup-scored))
5198 gnus-summary-default-score 0)
5199 gnus-summary-mark-below)
5200 (not (gnus-summary-article-ancient-p number)))
5201 (setq gnus-newsgroup-unreads
5202 (delq number gnus-newsgroup-unreads))
5203 (if gnus-newsgroup-auto-expire
5204 (push number gnus-newsgroup-expirable)
5205 (push (cons number gnus-low-score-mark)
5206 gnus-newsgroup-reads)))
5208 (setq mark (gnus-article-mark number))
5209 (push (gnus-data-make number mark (1+ (point)) header 0)
5210 gnus-newsgroup-data)
5211 (gnus-summary-insert-line
5213 (memq number gnus-newsgroup-undownloaded)
5214 mark (memq number gnus-newsgroup-replied)
5215 (memq number gnus-newsgroup-expirable)
5216 (mail-header-subject header) nil
5217 (cdr (assq number gnus-newsgroup-scored))
5218 (memq number gnus-newsgroup-processable))))))
5220 (defun gnus-summary-remove-list-identifiers ()
5221 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5222 (let ((regexp (if (consp gnus-list-identifiers)
5223 (mapconcat 'identity gnus-list-identifiers " *\\|")
5224 gnus-list-identifiers))
5227 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5228 (dolist (header gnus-newsgroup-headers)
5229 (setq subject (mail-header-subject header)
5231 (while (string-match regexp subject)
5233 (concat (substring subject 0 (match-beginning 1))
5234 (substring subject (match-end 0)))
5237 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5239 (concat (substring subject 0 (match-beginning 1))
5240 (substring subject (match-end 1)))))
5241 (mail-header-set-subject header subject))))))
5243 (defun gnus-fetch-headers (articles)
5244 "Fetch headers of ARTICLES."
5245 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5246 (gnus-message 5 "Fetching headers for %s..." name)
5249 (setq gnus-headers-retrieved-by
5250 (gnus-retrieve-headers
5251 articles gnus-newsgroup-name
5252 ;; We might want to fetch old headers, but
5253 ;; not if there is only 1 article.
5255 (not (eq gnus-fetch-old-headers 'some))
5256 (not (numberp gnus-fetch-old-headers)))
5257 (> (length articles) 1))
5258 gnus-fetch-old-headers))))
5259 (gnus-get-newsgroup-headers-xover
5260 articles nil nil gnus-newsgroup-name t)
5261 (gnus-get-newsgroup-headers))
5262 (gnus-message 5 "Fetching headers for %s...done" name))))
5264 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5265 "Select newsgroup GROUP.
5266 If READ-ALL is non-nil, all articles in the group are selected.
5267 If SELECT-ARTICLES, only select those articles from GROUP."
5268 (let* ((entry (gnus-group-entry group))
5269 ;;!!! Dirty hack; should be removed.
5270 (gnus-summary-ignore-duplicates
5271 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5273 gnus-summary-ignore-duplicates))
5274 (info (nth 2 entry))
5275 articles fetched-articles cached)
5277 (unless (gnus-check-server
5278 (set (make-local-variable 'gnus-current-select-method)
5279 (gnus-find-method-for-group group)))
5280 (error "Couldn't open server"))
5282 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5283 (gnus-activate-group group) ; Or we can activate it...
5284 (progn ; Or we bug out.
5285 (when (equal major-mode 'gnus-summary-mode)
5286 (gnus-kill-buffer (current-buffer)))
5287 (error "Couldn't activate group %s: %s"
5288 group (gnus-status-message group))))
5290 (unless (gnus-request-group group t)
5291 (when (equal major-mode 'gnus-summary-mode)
5292 (gnus-kill-buffer (current-buffer)))
5293 (error "Couldn't request group %s: %s"
5294 group (gnus-status-message group)))
5297 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5299 (setq gnus-summary-use-undownloaded-faces
5300 (gnus-agent-find-parameter
5302 'agent-enable-undownloaded-faces)))
5304 (setq gnus-newsgroup-name group
5305 gnus-newsgroup-unselected nil
5306 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5308 (let ((display (gnus-group-find-parameter group 'display)))
5309 (setq gnus-newsgroup-display
5311 ((not (zerop (or (car-safe read-all) 0)))
5312 ;; The user entered the group with C-u SPC/RET, let's show
5318 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5320 ;; The following is probably the "correct" solution, but
5321 ;; it makes Gnus fetch all headers and then limit the
5322 ;; articles (which is slow), so instead we hack the
5323 ;; select-articles parameter instead. -- Simon Josefsson
5326 ;; (gnus-byte-compile
5327 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5329 (setq select-articles
5330 (gnus-uncompress-range
5331 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5335 (cdr (gnus-active group)))))
5340 (gnus-summary-setup-default-charset)
5342 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5343 (when (gnus-virtual-group-p group)
5344 (setq cached gnus-newsgroup-cached))
5346 (setq gnus-newsgroup-unreads
5347 (gnus-sorted-ndifference
5348 (gnus-sorted-ndifference gnus-newsgroup-unreads
5349 gnus-newsgroup-marked)
5350 gnus-newsgroup-dormant))
5352 (setq gnus-newsgroup-processable nil)
5354 (gnus-update-read-articles group gnus-newsgroup-unreads)
5356 ;; Adjust and set lists of article marks.
5358 (gnus-adjust-marked-articles info))
5359 (if (setq articles select-articles)
5360 (setq gnus-newsgroup-unselected
5361 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5362 (setq articles (gnus-articles-to-read group read-all)))
5366 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5368 ((eq articles 0) nil)
5370 ;; Init the dependencies hash table.
5371 (setq gnus-newsgroup-dependencies
5372 (gnus-make-hashtable (length articles)))
5373 (gnus-set-global-variables)
5374 ;; Retrieve the headers and read them in.
5376 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5378 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5380 (setq gnus-newsgroup-cached cached))
5382 ;; Suppress duplicates?
5383 (when gnus-suppress-duplicates
5384 (gnus-dup-suppress-articles))
5386 ;; Set the initial limit.
5387 (setq gnus-newsgroup-limit (copy-sequence articles))
5388 ;; Remove canceled articles from the list of unread articles.
5389 (setq fetched-articles
5390 (mapcar (lambda (headers) (mail-header-number headers))
5391 gnus-newsgroup-headers))
5392 (setq gnus-newsgroup-articles fetched-articles)
5393 (setq gnus-newsgroup-unreads
5394 (gnus-sorted-nintersection
5395 gnus-newsgroup-unreads fetched-articles))
5396 (gnus-compute-unseen-list)
5398 ;; Removed marked articles that do not exist.
5399 (gnus-update-missing-marks
5400 (gnus-sorted-difference articles fetched-articles))
5401 ;; We might want to build some more threads first.
5402 (when (and gnus-fetch-old-headers
5403 (eq gnus-headers-retrieved-by 'nov))
5404 (if (eq gnus-fetch-old-headers 'invisible)
5405 (gnus-build-all-threads)
5406 (gnus-build-old-threads)))
5407 ;; Let the Gnus agent mark articles as read.
5409 (gnus-agent-get-undownloaded-list))
5410 ;; Remove list identifiers from subject
5411 (when gnus-list-identifiers
5412 (gnus-summary-remove-list-identifiers))
5413 ;; Check whether auto-expire is to be done in this group.
5414 (setq gnus-newsgroup-auto-expire
5415 (gnus-group-auto-expirable-p group))
5416 ;; Set up the article buffer now, if necessary.
5417 (unless gnus-single-article-buffer
5418 (gnus-article-setup-buffer))
5419 ;; First and last article in this newsgroup.
5420 (when gnus-newsgroup-headers
5421 (setq gnus-newsgroup-begin
5422 (mail-header-number (car gnus-newsgroup-headers))
5425 (gnus-last-element gnus-newsgroup-headers))))
5426 ;; GROUP is successfully selected.
5427 (or gnus-newsgroup-headers t)))))
5429 (defun gnus-compute-unseen-list ()
5430 ;; The `seen' marks are treated specially.
5431 (if (not gnus-newsgroup-seen)
5432 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5433 (setq gnus-newsgroup-unseen
5434 (gnus-inverse-list-range-intersection
5435 gnus-newsgroup-articles gnus-newsgroup-seen))))
5437 (defun gnus-summary-display-make-predicate (display)
5438 (require 'gnus-agent)
5439 (when (= (length display) 1)
5440 (setq display (car display)))
5441 (unless gnus-summary-display-cache
5442 (dolist (elem (append '((unread . unread)
5445 gnus-article-mark-lists))
5446 (push (cons (cdr elem)
5448 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5449 gnus-summary-display-cache)))
5450 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5451 (gnus-category-predicate-cache gnus-summary-display-cache))
5452 (gnus-get-predicate display)))
5454 ;; Uses the dynamically bound `number' variable.
5457 (defun gnus-article-marked-p (type &optional article)
5458 (let ((article (or article number)))
5461 (memq article gnus-newsgroup-marked))
5463 (memq article gnus-newsgroup-spam-marked))
5465 (memq article gnus-newsgroup-unsendable))
5466 ((eq type 'undownload)
5467 (memq article gnus-newsgroup-undownloaded))
5468 ((eq type 'download)
5469 (memq article gnus-newsgroup-downloadable))
5471 (memq article gnus-newsgroup-unreads))
5473 (memq article gnus-newsgroup-reads))
5475 (memq article gnus-newsgroup-dormant) )
5477 (memq article gnus-newsgroup-expirable))
5479 (memq article gnus-newsgroup-replied))
5481 (memq article gnus-newsgroup-killed))
5482 ((eq type 'bookmark)
5483 (assq article gnus-newsgroup-bookmarks))
5485 (assq article gnus-newsgroup-scored))
5487 (memq article gnus-newsgroup-saved))
5489 (memq article gnus-newsgroup-cached))
5491 (memq article gnus-newsgroup-forwarded))
5493 (not (memq article gnus-newsgroup-unseen)))
5495 (memq article gnus-newsgroup-recent))
5498 (defun gnus-articles-to-read (group &optional read-all)
5499 "Find out what articles the user wants to read."
5501 ;; Select all articles if `read-all' is non-nil, or if there
5502 ;; are no unread articles.
5504 (and (zerop (length gnus-newsgroup-marked))
5505 (zerop (length gnus-newsgroup-unreads)))
5506 ;; Fetch all if the predicate is non-nil.
5507 gnus-newsgroup-display)
5508 ;; We want to select the headers for all the articles in
5509 ;; the group, so we select either all the active
5510 ;; articles in the group, or (if that's nil), the
5511 ;; articles in the cache.
5513 (gnus-uncompress-range (gnus-active group))
5514 (gnus-cache-articles-in-group group))
5515 ;; Select only the "normal" subset of articles.
5517 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5518 gnus-newsgroup-unreads)))
5519 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5520 (scored (length scored-list))
5521 (number (length articles))
5522 (marked (+ (length gnus-newsgroup-marked)
5523 (length gnus-newsgroup-dormant)))
5528 ((numberp gnus-newsgroup-display)
5529 gnus-newsgroup-display)
5533 ((and (or (<= scored marked) (= scored number))
5534 (numberp gnus-large-newsgroup)
5535 (> number gnus-large-newsgroup))
5536 (let* ((cursor-in-echo-area nil)
5537 (initial (gnus-parameter-large-newsgroup-initial
5538 gnus-newsgroup-name))
5542 "How many articles from %s (%s %d): "
5544 (gnus-group-decoded-name gnus-newsgroup-name)
5546 (if initial "max" "default")
5549 (cons (number-to-string initial)
5551 (if (string-match "^[ \t]*$" input) number input)))
5552 ((and (> scored marked) (< scored number)
5553 (> (- scored number) 20))
5556 (format "%s %s (%d scored, %d total): "
5557 "How many articles from"
5558 (gnus-group-decoded-name group)
5560 (if (string-match "^[ \t]*$" input)
5564 (message "Quit getting the articles to read")
5566 (setq select (if (stringp select) (string-to-number select) select))
5567 (if (or (null select) (zerop select))
5569 (if (and (not (zerop scored)) (<= (abs select) scored))
5571 (setq articles (sort scored-list '<))
5572 (setq number (length articles)))
5573 (setq articles (copy-sequence articles)))
5575 (when (< (abs select) number)
5577 ;; Select the N oldest articles.
5578 (setcdr (nthcdr (1- (abs select)) articles) nil)
5579 ;; Select the N most recent articles.
5580 (setq articles (nthcdr (- number select) articles))))
5581 (setq gnus-newsgroup-unselected
5582 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5583 (when gnus-alter-articles-to-read-function
5586 (funcall gnus-alter-articles-to-read-function
5587 gnus-newsgroup-name articles)
5591 (defun gnus-killed-articles (killed articles)
5594 (when (inline (gnus-member-of-range (car articles) killed))
5595 (push (car articles) out))
5596 (setq articles (cdr articles)))
5599 (defun gnus-uncompress-marks (marks)
5600 "Uncompress the mark ranges in MARKS."
5601 (let ((uncompressed '(score bookmark))
5604 (if (memq (caar marks) uncompressed)
5605 (push (car marks) out)
5606 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5607 (setq marks (cdr marks)))
5610 (defun gnus-article-mark-to-type (mark)
5611 "Return the type of MARK."
5612 (or (cadr (assq mark gnus-article-special-mark-lists))
5615 (defun gnus-article-unpropagatable-p (mark)
5616 "Return whether MARK should be propagated to back end."
5617 (memq mark gnus-article-unpropagated-mark-lists))
5619 (defun gnus-adjust-marked-articles (info)
5620 "Set all article lists and remove all marks that are no longer valid."
5621 (let* ((marked-lists (gnus-info-marks info))
5622 (active (gnus-active (gnus-info-group info)))
5625 (types gnus-article-mark-lists)
5626 marks var articles article mark mark-type
5629 (dolist (marks marked-lists)
5630 (setq mark (car marks)
5631 mark-type (gnus-article-mark-to-type mark)
5632 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5634 ;; We set the variable according to the type of the marks list,
5635 ;; and then adjust the marks to a subset of the active articles.
5637 ;; Adjust "simple" lists - compressed yet unsorted
5638 ((eq mark-type 'list)
5639 ;; Simultaneously uncompress and clip to active range
5640 ;; See gnus-uncompress-range for a description of possible marks
5642 (if (not (cadr marks))
5644 (setq articles (if (numberp (cddr marks))
5650 (while (setq article (pop articles))
5651 (cond ((consp article)
5652 (setq bgn (max (car article) min)
5653 end (min (cdr article) max))
5655 (setq l (setcdr l (cons bgn nil))
5657 ((and (<= min article)
5659 (setq l (setcdr l (cons article nil))))))
5660 (set var (cdr lh)))))
5662 ((eq mark-type 'tuple)
5663 (set var (setq articles (cdr marks)))
5664 (when (not (listp (cdr (symbol-value var))))
5665 (set var (list (symbol-value var))))
5666 (when (not (listp (cdr articles)))
5667 (setq articles (list articles)))
5669 (when (or (not (consp (setq article (pop articles))))
5670 (< (car article) min)
5671 (> (car article) max))
5672 (set var (delq article (symbol-value var))))))
5673 ;; Adjust ranges (sloppily).
5674 ((eq mark-type 'range)
5677 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5678 ;; It should be (seen (NUM1 . NUM2)).
5679 (when (numberp (cddr marks))
5680 (setcdr marks (list (cdr marks))))
5681 (setq articles (cdr marks))
5682 (while (and articles
5683 (or (and (consp (car articles))
5684 (> min (cdar articles)))
5685 (and (numberp (car articles))
5686 (> min (car articles)))))
5688 (set var articles))))))))
5690 (defun gnus-update-missing-marks (missing)
5691 "Go through the list of MISSING articles and remove them from the mark lists."
5694 ;; Go through all types.
5695 (dolist (elem gnus-article-mark-lists)
5696 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5697 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5698 (when (symbol-value var)
5699 ;; This list has articles. So we delete all missing
5700 ;; articles from it.
5703 (set var (delq (pop m) (symbol-value var))))))))))
5705 (defun gnus-update-marks ()
5706 "Enter the various lists of marked articles into the newsgroup info list."
5707 (let ((types gnus-article-mark-lists)
5708 (info (gnus-get-info gnus-newsgroup-name))
5709 type list newmarked symbol delta-marks)
5711 ;; Add all marks lists to the list of marks lists.
5712 (while (setq type (pop types))
5713 (setq list (symbol-value
5715 (intern (format "gnus-newsgroup-%s" (car type))))))
5718 ;; Get rid of the entries of the articles that have the
5720 (when (and (eq (cdr type) 'score)
5724 (prev (cons nil list))
5727 (if (or (not (consp (car arts)))
5728 (= (cdar arts) gnus-summary-default-score))
5729 (setcdr prev (cdr arts))
5731 (setq arts (cdr arts)))
5732 (setq list (cdr all)))))
5734 (when (eq (cdr type) 'seen)
5735 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5737 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5738 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5740 (when (and (gnus-check-backend-function
5741 'request-set-mark gnus-newsgroup-name)
5742 (not (gnus-article-unpropagatable-p (cdr type))))
5743 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5744 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5745 (add (gnus-remove-from-range
5746 (gnus-copy-sequence list) old)))
5748 (push (list add 'add (list (cdr type))) delta-marks))
5750 (push (list del 'del (list (cdr type))) delta-marks))))
5753 (push (cons (cdr type) list) newmarked)))
5756 (unless (gnus-check-group gnus-newsgroup-name)
5757 (error "Can't open server for %s" gnus-newsgroup-name))
5758 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5760 ;; Enter these new marks into the info of the group.
5762 (setcar (nthcdr 3 info) newmarked)
5763 ;; Add the marks lists to the end of the info.
5765 (setcdr (nthcdr 2 info) (list newmarked))))
5767 ;; Cut off the end of the info if there's nothing else there.
5771 (when (nthcdr (decf i) info)
5772 (setcdr (nthcdr i info) nil)))))))
5774 (defun gnus-set-mode-line (where)
5775 "Set the mode line of the article or summary buffers.
5776 If WHERE is `summary', the summary mode line format will be used."
5777 ;; Is this mode line one we keep updated?
5778 (when (and (memq where gnus-updated-mode-lines)
5780 (intern (format "gnus-%s-mode-line-format-spec" where))))
5783 ;; We evaluate this in the summary buffer since these
5784 ;; variables are buffer-local to that buffer.
5785 (set-buffer gnus-summary-buffer)
5786 ;; We bind all these variables that are used in the `eval' form
5788 (let* ((mformat (symbol-value
5790 (format "gnus-%s-mode-line-format-spec" where))))
5791 (gnus-tmp-group-name (gnus-group-decoded-name
5792 gnus-newsgroup-name))
5793 (gnus-tmp-article-number (or gnus-current-article 0))
5794 (gnus-tmp-unread gnus-newsgroup-unreads)
5795 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5796 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5797 (gnus-tmp-unread-and-unselected
5798 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5799 (zerop gnus-tmp-unselected))
5801 ((zerop gnus-tmp-unselected)
5802 (format "{%d more}" gnus-tmp-unread-and-unticked))
5803 (t (format "{%d(+%d) more}"
5804 gnus-tmp-unread-and-unticked
5805 gnus-tmp-unselected))))
5807 (if (and gnus-current-headers
5808 (vectorp gnus-current-headers))
5809 (gnus-mode-string-quote
5810 (mail-header-subject gnus-current-headers))
5812 bufname-length max-len
5813 gnus-tmp-header);; passed as argument to any user-format-funcs
5814 (setq mode-string (eval mformat))
5815 (setq bufname-length (if (string-match "%b" mode-string)
5818 (if (eq where 'summary)
5820 (get-buffer gnus-article-buffer))))
5823 (setq max-len (max 4 (if gnus-mode-non-string-length
5825 gnus-mode-non-string-length
5827 (length mode-string))))
5828 ;; We might have to chop a bit of the string off...
5829 (when (> (length mode-string) max-len)
5831 (concat (gnus-truncate-string mode-string (- max-len 3))
5833 ;; Pad the mode string a bit.
5834 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5835 ;; Update the mode line.
5836 (setq mode-line-buffer-identification
5837 (gnus-mode-line-buffer-identification (list mode-string)))
5838 (set-buffer-modified-p t))))
5840 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5841 "Go through the HEADERS list and add all Xrefs to a hash table.
5842 The resulting hash table is returned, or nil if no Xrefs were found."
5843 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5844 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5845 (xref-hashtb (gnus-make-hashtable))
5846 start group entry number xrefs header)
5848 (setq header (pop headers))
5849 (when (and (setq xrefs (mail-header-xref header))
5850 (not (memq (setq number (mail-header-number header))
5853 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5854 (setq start (match-end 0))
5855 (setq group (if prefix
5856 (concat prefix (substring xrefs (match-beginning 1)
5858 (substring xrefs (match-beginning 1) (match-end 1))))
5860 (string-to-number (substring xrefs (match-beginning 2)
5862 (if (setq entry (gnus-gethash group xref-hashtb))
5863 (setcdr entry (cons number (cdr entry)))
5864 (gnus-sethash group (cons number nil) xref-hashtb)))))
5865 (and start xref-hashtb)))
5867 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5868 "Look through all the headers and mark the Xrefs as read."
5869 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5870 name info xref-hashtb idlist method nth4)
5872 (set-buffer gnus-group-buffer)
5873 (when (setq xref-hashtb
5874 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5877 (unless (string= from-newsgroup (setq name (symbol-name group)))
5878 (setq idlist (symbol-value group))
5879 ;; Dead groups are not updated.
5881 (setq info (gnus-get-info name))
5882 (when (stringp (setq nth4 (gnus-info-method info)))
5883 (setq nth4 (gnus-server-to-method nth4))))
5884 ;; Only do the xrefs if the group has the same
5885 ;; select method as the group we have just read.
5886 (or (gnus-methods-equal-p
5887 nth4 (gnus-find-method-for-group from-newsgroup))
5889 (equal nth4 (setq method (gnus-find-method-for-group
5891 (and (equal (car nth4) (car method))
5892 (equal (nth 1 nth4) (nth 1 method))))
5893 gnus-use-cross-reference
5894 (or (not (eq gnus-use-cross-reference t))
5896 ;; Only do cross-references on subscribed
5897 ;; groups, if that is what is wanted.
5898 (<= (gnus-info-level info) gnus-level-subscribed))
5899 (gnus-group-make-articles-read name idlist))))
5902 (defun gnus-compute-read-articles (group articles)
5903 (let* ((entry (gnus-group-entry group))
5904 (info (nth 2 entry))
5905 (active (gnus-active group))
5908 ;; First peel off all invalid article numbers.
5910 (let ((ids articles)
5912 (while (setq id (pop ids))
5913 (when (and first (> id (cdr active)))
5914 ;; We'll end up in this situation in one particular
5915 ;; obscure situation. If you re-scan a group and get
5916 ;; a new article that is cross-posted to a different
5917 ;; group that has not been re-scanned, you might get
5918 ;; crossposted article that has a higher number than
5919 ;; Gnus believes possible. So we re-activate this
5920 ;; group as well. This might mean doing the
5921 ;; crossposting thingy will *increase* the number
5922 ;; of articles in some groups. Tsk, tsk.
5923 (setq active (or (gnus-activate-group group) active)))
5924 (when (or (> id (cdr active))
5925 (< id (car active)))
5926 (setq articles (delq id articles))))))
5927 ;; If the read list is nil, we init it.
5929 (null (gnus-info-read info))
5931 (setq ninfo (cons 1 (1- (car active))))
5932 (setq ninfo (gnus-info-read info)))
5933 ;; Then we add the read articles to the range.
5935 ninfo (setq articles (sort articles '<))))))
5937 (defun gnus-group-make-articles-read (group articles)
5938 "Update the info of GROUP to say that ARTICLES are read."
5940 (entry (gnus-group-entry group))
5941 (info (nth 2 entry))
5942 (active (gnus-active group))
5945 (setq range (gnus-compute-read-articles group articles))
5946 (with-current-buffer gnus-group-buffer
5949 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5950 (gnus-info-set-read ',info ',(gnus-info-read info))
5951 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5952 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5953 (gnus-group-update-group ,group t))))
5954 ;; Add the read articles to the range.
5955 (gnus-info-set-read info range)
5956 (gnus-request-set-mark group (list (list range 'add '(read))))
5957 ;; Then we have to re-compute how many unread
5958 ;; articles there are in this group.
5962 (setq num (- (1+ (cdr active)) (car active))))
5963 ((not (listp (cdr range)))
5964 (setq num (- (cdr active) (- (1+ (cdr range))
5968 (if (numberp (car range))
5970 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
5971 (setq range (cdr range)))
5972 (setq num (- (cdr active) num))))
5973 ;; Update the number of unread articles.
5975 ;; Update the group buffer.
5976 (unless (gnus-ephemeral-group-p group)
5977 (gnus-group-update-group group t))))))
5979 (defvar gnus-newsgroup-none-id 0)
5981 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
5982 (let ((cur nntp-server-buffer)
5985 (with-current-buffer gnus-summary-buffer
5986 gnus-newsgroup-dependencies)))
5987 headers id end ref number
5988 (mail-parse-charset gnus-newsgroup-charset)
5989 (mail-parse-ignored-charsets
5990 (save-excursion (condition-case nil
5991 (set-buffer gnus-summary-buffer)
5993 gnus-newsgroup-ignored-charsets)))
5995 (set-buffer nntp-server-buffer)
5996 ;; Translate all TAB characters into SPACE characters.
5997 (subst-char-in-region (point-min) (point-max) ?\t ? t)
5998 (subst-char-in-region (point-min) (point-max) ?\r ? t)
5999 (ietf-drums-unfold-fws)
6000 (gnus-run-hooks 'gnus-parse-headers-hook)
6001 (let ((case-fold-search t)
6002 in-reply-to header p lines chars ctype)
6003 (goto-char (point-min))
6004 ;; Search to the beginning of the next header. Error messages
6005 ;; do not begin with 2 or 3.
6006 (while (re-search-forward "^[23][0-9]+ " nil t)
6009 ;; This implementation of this function, with nine
6010 ;; search-forwards instead of the one re-search-forward and
6011 ;; a case (which basically was the old function) is actually
6012 ;; about twice as fast, even though it looks messier. You
6013 ;; can't have everything, I guess. Speed and elegance
6014 ;; doesn't always go hand in hand.
6017 (make-full-mail-header
6020 (setq number (read cur))
6023 (narrow-to-region (point)
6024 (or (and (search-forward "\n.\n" nil t)
6030 (if (search-forward "\nsubject:" nil t)
6031 (nnheader-header-value)
6036 (if (search-forward "\nfrom:" nil t)
6037 (nnheader-header-value)
6042 (if (search-forward "\ndate:" nil t)
6043 (nnheader-header-value) ""))
6047 (setq id (if (re-search-forward
6048 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6049 ;; We do it this way to make sure the Message-ID
6050 ;; is (somewhat) syntactically valid.
6051 (buffer-substring (match-beginning 1)
6053 ;; If there was no message-id, we just fake one
6054 ;; to make subsequent routines simpler.
6055 (nnheader-generate-fake-message-id number))))
6059 (if (search-forward "\nreferences:" nil t)
6063 (nnheader-header-value)
6068 (search-backward ">" end t)
6071 (search-backward "<" end t)
6073 ;; Get the references from the in-reply-to header if there
6074 ;; were no references and the in-reply-to header looks
6076 (if (and (search-forward "\nin-reply-to:" nil t)
6077 (setq in-reply-to (nnheader-header-value))
6078 (string-match "<[^>]+>" in-reply-to))
6080 (setq ref (substring in-reply-to (match-beginning 0)
6082 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6083 (setq ref2 (substring in-reply-to (match-beginning 0)
6085 (when (> (length ref2) (length ref))
6092 (if (search-forward "\nchars: " nil t)
6093 (if (numberp (setq chars (ignore-errors (read cur))))
6099 (if (search-forward "\nlines: " nil t)
6100 (if (numberp (setq lines (ignore-errors (read cur))))
6106 (and (search-forward "\nxref:" nil t)
6107 (nnheader-header-value)))
6109 (when gnus-extra-headers
6110 (let ((extra gnus-extra-headers)
6114 (when (search-forward
6115 (concat "\n" (symbol-name (car extra)) ":") nil t)
6116 (push (cons (car extra) (nnheader-header-value)) out))
6120 (if (and (search-forward "\ncontent-type: " nil t)
6121 (setq ctype (nnheader-header-value)))
6122 (mime-entity-set-content-type-internal
6123 header (mime-parse-Content-Type ctype)))
6124 (when (equal id ref)
6127 (when gnus-alter-header-function
6128 (funcall gnus-alter-header-function header)
6129 (setq id (mail-header-id header)
6130 ref (gnus-parent-id (mail-header-references header))))
6133 (gnus-dependencies-add-header
6134 header dependencies force-new))
6135 (push header headers))
6136 (goto-char (point-max))
6138 (nreverse headers)))))
6140 ;; Goes through the xover lines and returns a list of vectors
6141 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6142 force-new dependencies
6143 group also-fetch-heads)
6144 "Parse the news overview data in the server buffer.
6145 Return a list of headers that match SEQUENCE (see
6146 `nntp-retrieve-headers')."
6147 ;; Get the Xref when the users reads the articles since most/some
6148 ;; NNTP servers do not include Xrefs when using XOVER.
6149 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6150 (let ((mail-parse-charset gnus-newsgroup-charset)
6151 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6152 (cur nntp-server-buffer)
6153 (dependencies (or dependencies gnus-newsgroup-dependencies))
6155 ((eq gnus-read-all-available-headers t)
6157 ((stringp gnus-read-all-available-headers)
6158 (string-match gnus-read-all-available-headers group))
6161 number headers header)
6163 (set-buffer nntp-server-buffer)
6164 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6165 ;; Allow the user to mangle the headers before parsing them.
6166 (gnus-run-hooks 'gnus-parse-headers-hook)
6167 (goto-char (point-min))
6168 (gnus-parse-without-error
6169 (while (and (or sequence allp)
6171 (setq number (read cur))
6173 (while (and sequence
6174 (< (car sequence) number))
6175 (setq sequence (cdr sequence))))
6178 (eq number (car sequence))))
6180 (setq sequence (cdr sequence))
6181 (setq header (inline
6182 (gnus-nov-parse-line
6183 number dependencies force-new)))))
6184 (push header headers))
6186 ;; A common bug in inn is that if you have posted an article and
6187 ;; then retrieves the active file, it will answer correctly --
6188 ;; the new article is included. However, a NOV entry for the
6189 ;; article may not have been generated yet, so this may fail.
6190 ;; We work around this problem by retrieving the last few
6191 ;; headers using HEAD.
6192 (if (or (not also-fetch-heads)
6194 ;; We (probably) got all the headers.
6196 (let ((gnus-nov-is-evil t))
6199 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6200 (gnus-get-newsgroup-headers))))))))
6202 (defun gnus-article-get-xrefs ()
6203 "Fill in the Xref value in `gnus-current-headers', if necessary.
6204 This is meant to be called in `gnus-article-internal-prepare-hook'."
6205 (let ((headers (with-current-buffer gnus-summary-buffer
6206 gnus-current-headers)))
6207 (or (not gnus-use-cross-reference)
6209 (and (mail-header-xref headers)
6210 (not (string= (mail-header-xref headers) "")))
6211 (let ((case-fold-search t)
6214 (nnheader-narrow-to-headers)
6215 (goto-char (point-min))
6216 (when (or (and (not (eobp))
6217 (eq (downcase (char-after)) ?x)
6218 (looking-at "Xref:"))
6219 (search-forward "\nXref:" nil t))
6220 (goto-char (1+ (match-end 0)))
6221 (setq xref (buffer-substring (point) (point-at-eol)))
6222 (mail-header-set-xref headers xref)))))))
6224 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6225 "Find article ID and insert the summary line for that article.
6226 OLD-HEADER can either be a header or a line number to insert
6227 the subject line on."
6228 (let* ((line (and (numberp old-header) old-header))
6229 (old-header (and (vectorp old-header) old-header))
6230 (header (cond ((and old-header use-old-header)
6233 (gnus-number-to-header id))
6234 (gnus-number-to-header id))
6236 (gnus-read-header id))))
6237 (number (and (numberp id) id))
6240 ;; Rebuild the thread that this article is part of and go to the
6241 ;; article we have fetched.
6242 (when (and (not gnus-show-threads)
6245 (setq d (gnus-data-find (mail-header-number old-header))))
6246 (goto-char (gnus-data-pos d))
6252 (gnus-delete-line))))))
6253 ;; Remove list identifiers from subject.
6254 (when gnus-list-identifiers
6255 (let ((gnus-newsgroup-headers (list header)))
6256 (gnus-summary-remove-list-identifiers)))
6258 (mail-header-set-number header (mail-header-number old-header)))
6259 (setq gnus-newsgroup-sparse
6260 (delq (setq number (mail-header-number header))
6261 gnus-newsgroup-sparse))
6262 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6263 (push number gnus-newsgroup-limit)
6264 (gnus-rebuild-thread (mail-header-id header) line)
6265 (gnus-summary-goto-subject number nil t))
6266 (when (and (numberp number)
6268 ;; We have to update the boundaries even if we can't fetch the
6269 ;; article if ID is a number -- so that the next `P' or `N'
6270 ;; command will fetch the previous (or next) article even
6271 ;; if the one we tried to fetch this time has been canceled.
6272 (when (> number gnus-newsgroup-end)
6273 (setq gnus-newsgroup-end number))
6274 (when (< number gnus-newsgroup-begin)
6275 (setq gnus-newsgroup-begin number))
6276 (setq gnus-newsgroup-unselected
6277 (delq number gnus-newsgroup-unselected)))
6278 ;; Report back a success?
6279 (and header (mail-header-number header))))
6281 ;;; Process/prefix in the summary buffer
6283 (defun gnus-summary-work-articles (n)
6284 "Return a list of articles to be worked upon.
6285 The prefix argument, the list of process marked articles, and the
6286 current article will be taken into consideration."
6288 (set-buffer gnus-summary-buffer)
6291 ;; A numerical prefix has been given.
6292 (setq n (prefix-numeric-value n))
6293 (let ((backward (< n 0))
6294 (n (abs (prefix-numeric-value n)))
6299 (push (setq article (gnus-summary-article-number))
6302 (gnus-summary-find-prev nil article)
6303 (gnus-summary-find-next nil article)))
6305 (nreverse articles)))
6306 ((and (gnus-region-active-p) (mark))
6307 (message "region active")
6308 ;; Work on the region between point and mark.
6309 (let ((max (max (point) (mark)))
6312 (goto-char (min (point) (mark)))
6315 (push (setq article (gnus-summary-article-number)) articles)
6316 (gnus-summary-find-next nil article)
6318 (nreverse articles))))
6319 (gnus-newsgroup-processable
6320 ;; There are process-marked articles present.
6321 ;; Save current state.
6322 (gnus-summary-save-process-mark)
6324 (reverse gnus-newsgroup-processable))
6326 ;; Just return the current article.
6327 (list (gnus-summary-article-number))))))
6329 (defmacro gnus-summary-iterate (arg &rest forms)
6330 "Iterate over the process/prefixed articles and do FORMS.
6331 ARG is the interactive prefix given to the command. FORMS will be
6332 executed with point over the summary line of the articles."
6333 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6334 `(let ((,articles (gnus-summary-work-articles ,arg)))
6336 (gnus-summary-goto-subject (car ,articles))
6340 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6341 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6343 (defun gnus-summary-save-process-mark ()
6344 "Push the current set of process marked articles on the stack."
6346 (push (copy-sequence gnus-newsgroup-processable)
6347 gnus-newsgroup-process-stack))
6349 (defun gnus-summary-kill-process-mark ()
6350 "Push the current set of process marked articles on the stack and unmark."
6352 (gnus-summary-save-process-mark)
6353 (gnus-summary-unmark-all-processable))
6355 (defun gnus-summary-yank-process-mark ()
6356 "Pop the last process mark state off the stack and restore it."
6358 (unless gnus-newsgroup-process-stack
6359 (error "Empty mark stack"))
6360 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6362 (defun gnus-summary-process-mark-set (set)
6363 "Make SET into the current process marked articles."
6364 (gnus-summary-unmark-all-processable)
6365 (mapc 'gnus-summary-set-process-mark set))
6367 ;;; Searching and stuff
6369 (defun gnus-summary-search-group (&optional backward use-level)
6370 "Search for next unread newsgroup.
6371 If optional argument BACKWARD is non-nil, search backward instead."
6373 (set-buffer gnus-group-buffer)
6374 (when (gnus-group-search-forward
6375 backward nil (if use-level (gnus-group-group-level) nil))
6376 (gnus-group-group-name))))
6378 (defun gnus-summary-best-group (&optional exclude-group)
6379 "Find the name of the best unread group.
6380 If EXCLUDE-GROUP, do not go to this group."
6381 (with-current-buffer gnus-group-buffer
6383 (gnus-group-best-unread-group exclude-group))))
6385 (defun gnus-summary-find-next (&optional unread article backward)
6387 (gnus-summary-find-prev unread article)
6388 (let* ((dummy (gnus-summary-article-intangible-p))
6389 (article (or article (gnus-summary-article-number)))
6390 (data (gnus-data-find-list article))
6392 (when (and (not dummy)
6393 (or (not gnus-summary-check-current)
6395 (not (gnus-data-unread-p (car data)))))
6396 (setq data (cdr data)))
6401 (unless (memq (gnus-data-number (car data))
6403 ((eq gnus-auto-goto-ignores
6404 'always-undownloaded)
6405 gnus-newsgroup-undownloaded)
6408 ((eq gnus-auto-goto-ignores
6410 gnus-newsgroup-unfetched)
6411 ((eq gnus-auto-goto-ignores
6413 gnus-newsgroup-undownloaded)))
6414 (when (gnus-data-unread-p (car data))
6415 (setq result (car data)
6417 (setq data (cdr data)))
6420 (goto-char (gnus-data-pos result))
6421 (gnus-data-number result)))))
6423 (defun gnus-summary-find-prev (&optional unread article)
6424 (let* ((eobp (eobp))
6425 (article (or article (gnus-summary-article-number)))
6426 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6428 (when (and (not eobp)
6429 (or (not gnus-summary-check-current)
6431 (not (gnus-data-unread-p (car data)))))
6432 (setq data (cdr data)))
6437 (unless (memq (gnus-data-number (car data))
6439 ((eq gnus-auto-goto-ignores
6440 'always-undownloaded)
6441 gnus-newsgroup-undownloaded)
6444 ((eq gnus-auto-goto-ignores
6446 gnus-newsgroup-unfetched)
6447 ((eq gnus-auto-goto-ignores
6449 gnus-newsgroup-undownloaded)))
6450 (when (gnus-data-unread-p (car data))
6451 (setq result (car data)
6453 (setq data (cdr data)))
6456 (goto-char (gnus-data-pos result))
6457 (gnus-data-number result))))
6459 (defun gnus-summary-find-subject (subject &optional unread backward article)
6460 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6461 (article (or article (gnus-summary-article-number)))
6462 (articles (gnus-data-list backward))
6463 (arts (gnus-data-find-list article articles))
6465 (when (or (not gnus-summary-check-current)
6467 (not (gnus-data-unread-p (car arts))))
6468 (setq arts (cdr arts)))
6470 (and (or (not unread)
6471 (gnus-data-unread-p (car arts)))
6472 (vectorp (gnus-data-header (car arts)))
6474 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6475 (setq result (car arts)
6477 (setq arts (cdr arts)))
6479 (goto-char (gnus-data-pos result))
6480 (gnus-data-number result))))
6482 (defun gnus-summary-search-forward (&optional unread subject backward)
6483 "Search forward for an article.
6484 If UNREAD, look for unread articles. If SUBJECT, look for
6485 articles with that subject. If BACKWARD, search backward instead."
6486 (cond (subject (gnus-summary-find-subject subject unread backward))
6487 (backward (gnus-summary-find-prev unread))
6488 (t (gnus-summary-find-next unread))))
6490 (defun gnus-recenter (&optional n)
6491 "Center point in window and redisplay frame.
6492 Also do horizontal recentering."
6494 (when (and gnus-auto-center-summary
6495 (not (eq gnus-auto-center-summary 'vertical)))
6496 (gnus-horizontal-recenter))
6499 (defun gnus-summary-recenter ()
6500 "Center point in the summary window.
6501 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6502 displayed, no centering will be performed."
6503 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6504 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6506 ;; The user has to want it.
6507 (when gnus-auto-center-summary
6508 (let* ((top (cond ((< (window-height) 4) 0)
6509 ((< (window-height) 7) 1)
6510 (t (if (numberp gnus-auto-center-summary)
6511 gnus-auto-center-summary
6512 (/ (1- (window-height)) 2)))))
6513 (height (1- (window-height)))
6514 (bottom (save-excursion (goto-char (point-max))
6515 (forward-line (- height))
6517 (window (get-buffer-window (current-buffer))))
6518 (when (get-buffer-window gnus-article-buffer)
6519 ;; Only do recentering when the article buffer is displayed,
6520 ;; Set the window start to either `bottom', which is the biggest
6521 ;; possible valid number, or the second line from the top,
6522 ;; whichever is the least.
6523 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6524 (if (> bottom top-pos)
6525 ;; Keep the second line from the top visible
6526 (set-window-start window top-pos t)
6527 ;; Try to keep the bottom line visible; if it's partially
6528 ;; obscured, either scroll one more line to make it fully
6529 ;; visible, or revert to using TOP-POS.
6531 (goto-char (point-max))
6533 (let ((last-line-start (point)))
6535 (set-window-start window (point) t)
6536 (when (not (pos-visible-in-window-p last-line-start window))
6538 (set-window-start window (min (point) top-pos) t)))))))
6539 ;; Do horizontal recentering while we're at it.
6540 (when (and (get-buffer-window (current-buffer) t)
6541 (not (eq gnus-auto-center-summary 'vertical)))
6542 (let ((selected (selected-window)))
6543 (select-window (get-buffer-window (current-buffer) t))
6544 (gnus-summary-position-point)
6545 (gnus-horizontal-recenter)
6546 (select-window selected))))))
6548 (defun gnus-summary-jump-to-group (newsgroup)
6549 "Move point to NEWSGROUP in group mode buffer."
6550 ;; Keep update point of group mode buffer if visible.
6551 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6552 (save-window-excursion
6553 ;; Take care of tree window mode.
6554 (when (get-buffer-window gnus-group-buffer)
6555 (pop-to-buffer gnus-group-buffer))
6556 (gnus-group-jump-to-group newsgroup))
6558 ;; Take care of tree window mode.
6559 (if (get-buffer-window gnus-group-buffer)
6560 (pop-to-buffer gnus-group-buffer)
6561 (set-buffer gnus-group-buffer))
6562 (gnus-group-jump-to-group newsgroup))))
6564 ;; This function returns a list of article numbers based on the
6565 ;; difference between the ranges of read articles in this group and
6566 ;; the range of active articles.
6567 (defun gnus-list-of-unread-articles (group)
6568 (let* ((read (gnus-info-read (gnus-get-info group)))
6569 (active (or (gnus-active group) (gnus-activate-group group)))
6570 (last (or (cdr active)
6571 (error "Group %s couldn't be activated " group)))
6573 ;; If none are read, then all are unread.
6575 (setq first (car active))
6576 ;; If the range of read articles is a single range, then the
6577 ;; first unread article is the article after the last read
6578 ;; article. Sounds logical, doesn't it?
6579 (if (and (not (listp (cdr read)))
6580 (or (< (car read) (car active))
6581 (progn (setq read (list read))
6583 (setq first (max (car active) (1+ (cdr read))))
6584 ;; `read' is a list of ranges.
6585 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6588 (setq first (car active)))
6591 (while (< first nlast)
6592 (setq unread (cons first unread)
6594 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6595 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6596 (setq read (cdr read)))))
6597 ;; And add the last unread articles.
6598 (while (<= first last)
6599 (setq unread (cons first unread)
6601 ;; Return the list of unread articles.
6602 (delq 0 (nreverse unread))))
6604 (defun gnus-list-of-read-articles (group)
6605 "Return a list of unread, unticked and non-dormant articles."
6606 (let* ((info (gnus-get-info group))
6607 (marked (gnus-info-marks info))
6608 (active (gnus-active group)))
6610 (gnus-list-range-difference
6611 (gnus-list-range-difference
6612 (gnus-sorted-complement
6613 (gnus-uncompress-range active)
6614 (gnus-list-of-unread-articles group))
6615 (cdr (assq 'dormant marked)))
6616 (cdr (assq 'tick marked))))))
6618 ;; This function returns a sequence of article numbers based on the
6619 ;; difference between the ranges of read articles in this group and
6620 ;; the range of active articles.
6621 (defun gnus-sequence-of-unread-articles (group)
6622 (let* ((read (gnus-info-read (gnus-get-info group)))
6623 (active (or (gnus-active group) (gnus-activate-group group)))
6626 ;; If none are read, then all are unread.
6628 (setq first (car active))
6629 ;; If the range of read articles is a single range, then the
6630 ;; first unread article is the article after the last read
6631 ;; article. Sounds logical, doesn't it?
6632 (if (and (not (listp (cdr read)))
6633 (or (< (car read) (car active))
6634 (progn (setq read (list read))
6636 (setq first (max (car active) (1+ (cdr read))))
6637 ;; `read' is a list of ranges.
6638 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6641 (setq first (car active)))
6644 (push (cons first nlast) unread))
6645 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6646 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6647 (setq read (cdr read)))))
6648 ;; And add the last unread articles.
6649 (cond ((< first last)
6650 (push (cons first last) unread))
6652 (push first unread)))
6653 ;; Return the sequence of unread articles.
6654 (delq 0 (nreverse unread))))
6656 ;; Various summary commands
6658 (defun gnus-summary-select-article-buffer ()
6659 "Reconfigure windows to show article buffer."
6661 (if (not (gnus-buffer-live-p gnus-article-buffer))
6662 (error "There is no article buffer for this summary buffer")
6663 (gnus-configure-windows 'article)
6664 (select-window (get-buffer-window gnus-article-buffer))))
6666 (defun gnus-summary-universal-argument (arg)
6667 "Perform any operation on all articles that are process/prefixed."
6669 (let ((articles (gnus-summary-work-articles arg))
6676 (substitute-command-keys
6677 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6679 (gnus-error 1 "Undefined key")
6682 (gnus-summary-goto-subject (setq article (pop articles)))
6683 (let (gnus-newsgroup-processable)
6684 (command-execute func))
6685 (gnus-summary-remove-process-mark article)))))
6686 (gnus-summary-position-point))
6688 (defun gnus-summary-toggle-truncation (&optional arg)
6689 "Toggle truncation of summary lines.
6690 With ARG, turn line truncation on if ARG is positive."
6692 (setq truncate-lines
6693 (if (null arg) (not truncate-lines)
6694 (> (prefix-numeric-value arg) 0)))
6697 (defun gnus-summary-find-for-reselect ()
6698 "Return the number of an article to stay on across a reselect.
6699 The current article is considered, then following articles, then previous
6700 articles. An article is sought which is not cancelled and isn't a temporary
6701 insertion from another group. If there's no such then return a dummy 0."
6703 (dolist (rev '(nil t))
6704 (unless found ; don't demand the reverse list if we don't need it
6705 (let ((data (gnus-data-find-list
6706 (gnus-summary-article-number) (gnus-data-list rev))))
6707 (while (and data (not found))
6708 (if (and (< 0 (gnus-data-number (car data)))
6709 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6710 (setq found (gnus-data-number (car data))))
6711 (setq data (cdr data))))))
6714 (defun gnus-summary-reselect-current-group (&optional all rescan)
6715 "Exit and then reselect the current newsgroup.
6716 The prefix argument ALL means to select all articles."
6718 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6719 (error "Ephemeral groups can't be reselected"))
6720 (let ((current-subject (gnus-summary-find-for-reselect))
6721 (group gnus-newsgroup-name))
6722 (setq gnus-newsgroup-begin nil)
6723 (gnus-summary-exit nil 'leave-hidden)
6724 ;; We have to adjust the point of group mode buffer because
6725 ;; point was moved to the next unread newsgroup by exiting.
6726 (gnus-summary-jump-to-group group)
6729 (save-window-excursion
6730 ;; Don't show group contents.
6731 (set-window-start (selected-window) (point-max))
6732 (gnus-group-get-new-news-this-group 1))))
6733 (gnus-group-read-group all t)
6734 (gnus-summary-goto-subject current-subject nil t)))
6736 (defun gnus-summary-rescan-group (&optional all)
6737 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6739 (gnus-summary-reselect-current-group all t))
6741 (defun gnus-summary-update-info (&optional non-destructive)
6743 (let ((group gnus-newsgroup-name))
6745 (when gnus-newsgroup-kill-headers
6746 (setq gnus-newsgroup-killed
6747 (gnus-compress-sequence
6749 (gnus-list-range-intersection
6750 gnus-newsgroup-unselected gnus-newsgroup-killed)
6751 gnus-newsgroup-unreads)
6753 (unless (listp (cdr gnus-newsgroup-killed))
6754 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6755 (let ((headers gnus-newsgroup-headers))
6756 ;; Set the new ranges of read articles.
6757 (with-current-buffer gnus-group-buffer
6758 (gnus-undo-force-boundary))
6759 (gnus-update-read-articles
6760 group (gnus-sorted-union
6761 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6762 ;; Set the current article marks.
6763 (let ((gnus-newsgroup-scored
6764 (if (and (not gnus-save-score)
6765 (not non-destructive))
6767 gnus-newsgroup-scored)))
6769 (gnus-update-marks)))
6770 ;; Do the cross-ref thing.
6771 (when gnus-use-cross-reference
6772 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6773 ;; Do not switch windows but change the buffer to work.
6774 (set-buffer gnus-group-buffer)
6775 (unless (gnus-ephemeral-group-p group)
6776 (gnus-group-update-group group)))))))
6778 (defun gnus-summary-save-newsrc (&optional force)
6779 "Save the current number of read/marked articles in the dribble buffer.
6780 The dribble buffer will then be saved.
6781 If FORCE (the prefix), also save the .newsrc file(s)."
6783 (gnus-summary-update-info t)
6785 (gnus-save-newsrc-file)
6786 (gnus-dribble-save)))
6788 (defun gnus-summary-exit (&optional temporary leave-hidden)
6789 "Exit reading current newsgroup, and then return to group selection mode.
6790 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6792 (gnus-set-global-variables)
6793 (gnus-kill-save-kill-buffer)
6794 (gnus-async-halt-prefetch)
6795 (let* ((group gnus-newsgroup-name)
6796 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6797 (gnus-group-is-exiting-p t)
6800 (buf (current-buffer)))
6802 ;; Do adaptive scoring, and possibly save score files.
6803 (when gnus-newsgroup-adaptive
6804 (gnus-score-adaptive))
6805 (when gnus-use-scoring
6807 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6808 ;; If we have several article buffers, we kill them at exit.
6809 (unless gnus-single-article-buffer
6810 (gnus-kill-buffer gnus-original-article-buffer)
6811 (setq gnus-article-current nil))
6812 (when gnus-use-cache
6813 (gnus-cache-possibly-remove-articles)
6814 (gnus-cache-save-buffers))
6815 (gnus-async-prefetch-remove-group group)
6816 (when gnus-suppress-duplicates
6817 (gnus-dup-enter-articles))
6818 (when gnus-use-trees
6819 (gnus-tree-close group))
6820 (when gnus-use-cache
6821 (gnus-cache-write-active))
6822 ;; Remove entries for this group.
6823 (nnmail-purge-split-history (gnus-group-real-name group))
6824 ;; Make all changes in this group permanent.
6826 (gnus-run-hooks 'gnus-exit-group-hook)
6827 (gnus-summary-update-info))
6828 (gnus-close-group group)
6829 ;; Make sure where we were, and go to next newsgroup.
6830 (set-buffer gnus-group-buffer)
6832 (gnus-group-jump-to-group group))
6833 (gnus-run-hooks 'gnus-summary-exit-hook)
6834 (unless (or quit-config
6835 ;; If this group has disappeared from the summary
6836 ;; buffer, don't skip forwards.
6837 (not (string= group (gnus-group-group-name))))
6838 (gnus-group-next-unread-group 1))
6839 (setq group-point (point))
6842 ;; If we have several article buffers, we kill them at exit.
6843 (unless gnus-single-article-buffer
6844 (gnus-kill-buffer gnus-article-buffer)
6845 (gnus-kill-buffer gnus-original-article-buffer)
6846 (setq gnus-article-current nil))
6848 (if (not gnus-kill-summary-on-exit)
6850 (gnus-deaden-summary)
6852 ;; We set all buffer-local variables to nil. It is unclear why
6853 ;; this is needed, but if we don't, buffer-local variables are
6854 ;; not garbage-collected, it seems. This would the lead to en
6855 ;; ever-growing Emacs.
6856 (gnus-summary-clear-local-variables)
6857 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6858 (gnus-summary-clear-local-variables))
6859 (when (get-buffer gnus-article-buffer)
6860 (bury-buffer gnus-article-buffer))
6861 ;; Return to group mode buffer.
6862 (when (eq mode 'gnus-summary-mode)
6863 (gnus-kill-buffer buf)))
6864 (setq gnus-current-select-method gnus-select-method)
6865 (set-buffer gnus-group-buffer)
6867 (gnus-handle-ephemeral-exit quit-config)
6868 (goto-char group-point)
6869 ;; If gnus-group-buffer is already displayed, make sure we also move
6870 ;; the cursor in the window that displays it.
6871 (let ((win (get-buffer-window (current-buffer) 0)))
6872 (if win (set-window-point win (point))))
6873 (unless leave-hidden
6874 (gnus-configure-windows 'group 'force))
6875 (unless (pos-visible-in-window-p)
6876 (forward-line (/ (static-if (featurep 'xemacs)
6877 (window-displayed-height)
6878 (1- (window-height)))
6880 (set-window-start (selected-window) (point))
6881 (goto-char group-point)))
6882 ;; Clear the current group name.
6884 (setq gnus-newsgroup-name nil)))))
6886 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6887 (defun gnus-summary-exit-no-update (&optional no-questions)
6888 "Quit reading current newsgroup without updating read article info."
6890 (let* ((group gnus-newsgroup-name)
6891 (gnus-group-is-exiting-p t)
6892 (gnus-group-is-exiting-without-update-p t)
6893 (quit-config (gnus-group-quit-config group)))
6894 (when (or no-questions
6896 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6897 (gnus-async-halt-prefetch)
6898 (run-hooks 'gnus-summary-prepare-exit-hook)
6899 ;; If we have several article buffers, we kill them at exit.
6900 (unless gnus-single-article-buffer
6901 (gnus-kill-buffer gnus-article-buffer)
6902 (gnus-kill-buffer gnus-original-article-buffer)
6903 (setq gnus-article-current nil))
6904 (if (not gnus-kill-summary-on-exit)
6905 (gnus-deaden-summary)
6906 (gnus-close-group group)
6907 (gnus-summary-clear-local-variables)
6908 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6909 (gnus-summary-clear-local-variables))
6910 (gnus-kill-buffer gnus-summary-buffer))
6911 (unless gnus-single-article-buffer
6912 (setq gnus-article-current nil))
6913 (when gnus-use-trees
6914 (gnus-tree-close group))
6915 (gnus-async-prefetch-remove-group group)
6916 (when (get-buffer gnus-article-buffer)
6917 (bury-buffer gnus-article-buffer))
6918 ;; Return to the group buffer.
6919 (gnus-configure-windows 'group 'force)
6920 ;; Clear the current group name.
6921 (setq gnus-newsgroup-name nil)
6922 (unless (gnus-ephemeral-group-p group)
6923 (gnus-group-update-group group))
6924 (when (equal (gnus-group-group-name) group)
6925 (gnus-group-next-unread-group 1))
6927 (gnus-handle-ephemeral-exit quit-config)))))
6929 (defun gnus-handle-ephemeral-exit (quit-config)
6930 "Handle movement when leaving an ephemeral group.
6931 The state which existed when entering the ephemeral is reset."
6932 (if (not (buffer-name (car quit-config)))
6933 (gnus-configure-windows 'group 'force)
6934 (set-buffer (car quit-config))
6935 (cond ((eq major-mode 'gnus-summary-mode)
6936 (gnus-set-global-variables))
6937 ((eq major-mode 'gnus-article-mode)
6939 ;; The `gnus-summary-buffer' variable may point
6940 ;; to the old summary buffer when using a single
6942 (unless (gnus-buffer-live-p gnus-summary-buffer)
6943 (set-buffer gnus-group-buffer))
6944 (set-buffer gnus-summary-buffer)
6945 (gnus-set-global-variables))))
6946 (if (or (eq (cdr quit-config) 'article)
6947 (eq (cdr quit-config) 'pick))
6949 ;; The current article may be from the ephemeral group
6950 ;; thus it is best that we reload this article
6952 ;; If we're exiting from a large digest, this can be
6953 ;; extremely slow. So, it's better not to reload it. -- jh.
6954 ;;(gnus-summary-show-article)
6955 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6956 (gnus-configure-windows 'pick 'force)
6957 (gnus-configure-windows (cdr quit-config) 'force)))
6958 (gnus-configure-windows (cdr quit-config) 'force))
6959 (when (eq major-mode 'gnus-summary-mode)
6960 (gnus-summary-next-subject 1 nil t)
6961 (gnus-summary-recenter)
6962 (gnus-summary-position-point))))
6964 (defun gnus-summary-preview-mime-message ()
6965 "MIME decode and play this message."
6967 (let ((gnus-break-pages nil)
6969 (gnus-summary-select-article gnus-show-all-headers t))
6970 (let ((w (get-buffer-window gnus-article-buffer)))
6972 (select-window (get-buffer-window gnus-article-buffer)))))
6976 (defvar gnus-dead-summary-mode-map nil)
6978 (unless gnus-dead-summary-mode-map
6979 (setq gnus-dead-summary-mode-map (make-keymap))
6980 (suppress-keymap gnus-dead-summary-mode-map)
6981 (substitute-key-definition
6982 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
6983 (dolist (key '("\C-d" "\r" "\177" [delete]))
6984 (define-key gnus-dead-summary-mode-map
6985 key 'gnus-summary-wake-up-the-dead))
6986 (dolist (key '("q" "Q"))
6987 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
6989 (defvar gnus-dead-summary-mode nil
6990 "Minor mode for Gnus summary buffers.")
6992 (defun gnus-dead-summary-mode (&optional arg)
6993 "Minor mode for Gnus summary buffers."
6995 (when (eq major-mode 'gnus-summary-mode)
6996 (make-local-variable 'gnus-dead-summary-mode)
6997 (setq gnus-dead-summary-mode
6998 (if (null arg) (not gnus-dead-summary-mode)
6999 (> (prefix-numeric-value arg) 0)))
7000 (when gnus-dead-summary-mode
7002 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7004 (defun gnus-deaden-summary ()
7005 "Make the current summary buffer into a dead summary buffer."
7006 ;; Kill any previous dead summary buffer.
7007 (when (and gnus-dead-summary
7008 (buffer-name gnus-dead-summary))
7009 (with-current-buffer gnus-dead-summary
7010 (when gnus-dead-summary-mode
7011 (kill-buffer (current-buffer)))))
7012 ;; Make this the current dead summary.
7013 (setq gnus-dead-summary (current-buffer))
7014 (gnus-dead-summary-mode 1)
7015 (let ((name (buffer-name)))
7016 (when (string-match "Summary" name)
7018 (concat (substring name 0 (match-beginning 0)) "Dead "
7019 (substring name (match-beginning 0)))
7023 (defun gnus-kill-or-deaden-summary (buffer)
7024 "Kill or deaden the summary BUFFER."
7026 (when (and (buffer-name buffer)
7027 (not gnus-single-article-buffer))
7028 (with-current-buffer buffer
7029 (gnus-kill-buffer gnus-article-buffer)
7030 (gnus-kill-buffer gnus-original-article-buffer)))
7033 (gnus-kill-summary-on-exit
7034 (when (and gnus-use-trees
7035 (gnus-buffer-exists-p buffer))
7038 (gnus-tree-close gnus-newsgroup-name)))
7039 (gnus-kill-buffer buffer))
7040 ;; Deaden the buffer.
7041 ((gnus-buffer-exists-p buffer)
7044 (gnus-deaden-summary))))))
7046 (defun gnus-summary-wake-up-the-dead (&rest args)
7047 "Wake up the dead summary buffer."
7049 (gnus-dead-summary-mode -1)
7050 (let ((name (buffer-name)))
7051 (when (string-match "Dead " name)
7053 (concat (substring name 0 (match-beginning 0))
7054 (substring name (match-end 0)))
7056 (gnus-message 3 "This dead summary is now alive again"))
7058 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7059 (defun gnus-summary-fetch-faq (&optional faq-dir)
7060 "Fetch the FAQ for the current group.
7061 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7065 (when current-prefix-arg
7067 "FAQ dir: " (and (listp gnus-group-faq-directory)
7069 gnus-group-faq-directory))))))
7070 (let (gnus-faq-buffer)
7071 (when (setq gnus-faq-buffer
7072 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7073 (gnus-configure-windows 'summary-faq))))
7075 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7076 (defun gnus-summary-describe-group (&optional force)
7077 "Describe the current newsgroup."
7079 (gnus-group-describe-group force gnus-newsgroup-name))
7081 (defun gnus-summary-describe-briefly ()
7082 "Describe summary mode commands briefly."
7084 (gnus-message 6 (substitute-command-keys "\\<gnus-summary-mode-map>\\[gnus-summary-next-page]:Select \\[gnus-summary-next-unread-article]:Forward \\[gnus-summary-prev-unread-article]:Backward \\[gnus-summary-exit]:Exit \\[gnus-info-find-node]:Run Info \\[gnus-summary-describe-briefly]:This help")))
7086 ;; Walking around group mode buffer from summary mode.
7088 (defun gnus-summary-next-group (&optional no-article target-group backward)
7089 "Exit current newsgroup and then select next unread newsgroup.
7090 If prefix argument NO-ARTICLE is non-nil, no article is selected
7091 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7092 previous group instead."
7094 ;; Stop pre-fetching.
7095 (gnus-async-halt-prefetch)
7096 (let ((current-group gnus-newsgroup-name)
7097 (current-buffer (current-buffer))
7099 ;; First we semi-exit this group to update Xrefs and all variables.
7100 ;; We can't do a real exit, because the window conf must remain
7101 ;; the same in case the user is prompted for info, and we don't
7102 ;; want the window conf to change before that...
7103 (gnus-summary-exit t)
7104 (while (not entered)
7105 ;; Then we find what group we are supposed to enter.
7106 (set-buffer gnus-group-buffer)
7107 (gnus-group-jump-to-group current-group)
7110 (if (eq gnus-keep-same-level 'best)
7111 (gnus-summary-best-group gnus-newsgroup-name)
7112 (gnus-summary-search-group backward gnus-keep-same-level))))
7113 (if (not target-group)
7114 ;; There are no further groups, so we return to the group
7117 (gnus-message 5 "Returning to the group buffer")
7119 (when (gnus-buffer-live-p current-buffer)
7120 (set-buffer current-buffer)
7121 (gnus-summary-exit))
7122 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7123 ;; We try to enter the target group.
7124 (gnus-group-jump-to-group target-group)
7125 (let ((unreads (gnus-group-group-unread)))
7126 (if (and (or (eq t unreads)
7127 (and unreads (not (zerop unreads))))
7128 (gnus-summary-read-group
7129 target-group nil no-article
7130 (and (buffer-name current-buffer) current-buffer)
7133 (setq current-group target-group
7134 target-group nil)))))))
7136 (defun gnus-summary-prev-group (&optional no-article)
7137 "Exit current newsgroup and then select previous unread newsgroup.
7138 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7140 (gnus-summary-next-group no-article nil t))
7142 ;; Walking around summary lines.
7144 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7145 "Go to the first subject satisfying any non-nil constraint.
7146 If UNREAD is non-nil, the article should be unread.
7147 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7148 If UNSEEN is non-nil, the article should be unseen.
7149 Returns the article selected or nil if there are no matching articles."
7153 ((null gnus-newsgroup-data)
7154 (gnus-message 3 "No articles in the group")
7156 ;; Pick the first article.
7157 ((not (or unread undownloaded unseen))
7158 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7159 (gnus-data-number (car gnus-newsgroup-data)))
7160 ;; Find the first unread article.
7162 (let ((data gnus-newsgroup-data))
7164 (let ((num (gnus-data-number (car data))))
7165 (or (memq num gnus-newsgroup-unfetched)
7166 (not (or (and unread
7167 (memq num gnus-newsgroup-unreads))
7169 (memq num gnus-newsgroup-undownloaded))
7171 (memq num gnus-newsgroup-unseen)))))))
7172 (setq data (cdr data)))
7176 (goto-char (gnus-data-pos (car data)))
7177 (gnus-data-number (car data)))
7178 (gnus-message 3 "No more%s articles"
7179 (let* ((r (when unread " unread"))
7180 (d (when undownloaded " undownloaded"))
7181 (s (when unseen " unseen"))
7182 (l (delq nil (list r d s))))
7183 (cond ((= 3 (length l))
7184 (concat r "," d ", or" s))
7186 (concat (car l) ", or" (cadr l)))
7193 (gnus-summary-position-point))))))
7195 (defun gnus-summary-next-subject (n &optional unread dont-display)
7196 "Go to next N'th summary line.
7197 If N is negative, go to the previous N'th subject line.
7198 If UNREAD is non-nil, only unread articles are selected.
7199 The difference between N and the actual number of steps taken is
7202 (let ((backward (< n 0))
7206 (gnus-summary-find-prev unread)
7207 (gnus-summary-find-next unread)))
7208 (unless (zerop (setq n (1- n)))
7209 (gnus-summary-show-thread)))
7211 (gnus-message 7 "No more%s articles"
7212 (if unread " unread" "")))
7213 (unless dont-display
7214 (gnus-summary-recenter)
7215 (gnus-summary-position-point))
7218 (defun gnus-summary-next-unread-subject (n)
7219 "Go to next N'th unread summary line."
7221 (gnus-summary-next-subject n t))
7223 (defun gnus-summary-prev-subject (n &optional unread)
7224 "Go to previous N'th summary line.
7225 If optional argument UNREAD is non-nil, only unread article is selected."
7227 (gnus-summary-next-subject (- n) unread))
7229 (defun gnus-summary-prev-unread-subject (n)
7230 "Go to previous N'th unread summary line."
7232 (gnus-summary-next-subject (- n) t))
7234 (defun gnus-summary-goto-subjects (articles)
7235 "Insert the subject header for ARTICLES in the current buffer."
7237 (dolist (article articles)
7238 (gnus-summary-goto-subject article t)))
7239 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7240 (gnus-summary-position-point))
7242 (defun gnus-summary-goto-subject (article &optional force silent)
7243 "Go the subject line of ARTICLE.
7244 If FORCE, also allow jumping to articles not currently shown."
7245 (interactive "nArticle number: ")
7246 (unless (numberp article)
7247 (error "Article %s is not a number" article))
7249 (data (gnus-data-find article)))
7250 ;; We read in the article if we have to.
7253 (gnus-summary-insert-subject
7255 (if (or (numberp force) (vectorp force)) force)
7257 (setq data (gnus-data-find article)))
7262 (gnus-message 3 "Can't find article %d" article))
7264 (let ((pt (gnus-data-pos data)))
7266 (gnus-summary-set-article-display-arrow pt))
7267 (gnus-summary-position-point)
7270 ;; Walking around summary lines with displaying articles.
7272 (defun gnus-summary-expand-window (&optional arg)
7273 "Make the summary buffer take up the entire Emacs frame.
7274 Given a prefix, will force an `article' buffer configuration."
7277 (gnus-configure-windows 'article 'force)
7278 (gnus-configure-windows 'summary 'force)))
7280 (defun gnus-summary-display-article (article &optional all-header)
7281 "Display ARTICLE in article buffer."
7282 (when (gnus-buffer-live-p gnus-article-buffer)
7283 (with-current-buffer gnus-article-buffer
7284 (set-buffer-multibyte t)))
7285 (gnus-set-global-variables)
7286 (when (gnus-buffer-live-p gnus-article-buffer)
7287 (with-current-buffer gnus-article-buffer
7288 (setq gnus-article-charset gnus-newsgroup-charset)
7289 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7290 (set-buffer-multibyte t)))
7294 (if gnus-summary-display-article-function
7295 (funcall gnus-summary-display-article-function article all-header)
7296 (gnus-article-prepare article all-header))
7297 (with-current-buffer gnus-article-buffer
7298 (set (make-local-variable 'gnus-summary-search-article-matched-data)
7300 (gnus-run-hooks 'gnus-select-article-hook)
7301 (when (and gnus-current-article
7302 (not (zerop gnus-current-article)))
7303 (gnus-summary-goto-subject gnus-current-article))
7304 (gnus-summary-recenter)
7305 (when (and gnus-use-trees gnus-show-threads)
7306 (gnus-possibly-generate-tree article)
7307 (gnus-highlight-selected-tree article))
7308 ;; Successfully display article.
7309 (gnus-article-set-window-start
7310 (cdr (assq article gnus-newsgroup-bookmarks))))))
7312 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7313 "Select the current article.
7314 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7315 non-nil, the article will be re-fetched even if it already present in
7316 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7318 ;; Make sure we are in the summary buffer to work around bbdb bug.
7319 (unless (eq major-mode 'gnus-summary-mode)
7320 (set-buffer gnus-summary-buffer))
7321 (let ((article (or article (gnus-summary-article-number)))
7322 (all-headers (not (not all-headers))) ;Must be T or NIL.
7323 gnus-summary-display-article-function)
7325 (gnus-summary-article-pseudo-p article)
7326 (error "This is a pseudo-article"))
7328 (set-buffer gnus-summary-buffer)
7329 (if (or (and gnus-single-article-buffer
7330 (or (null gnus-current-article)
7331 (null gnus-article-current)
7332 (null (get-buffer gnus-article-buffer))
7333 (not (eq article (cdr gnus-article-current)))
7334 (not (equal (car gnus-article-current)
7335 gnus-newsgroup-name))))
7336 (and (not gnus-single-article-buffer)
7337 (or (null gnus-current-article)
7338 (not (eq gnus-current-article article))))
7340 ;; The requested article is different from the current article.
7342 (gnus-summary-display-article article all-headers)
7343 (gnus-article-set-window-start
7344 (cdr (assq article gnus-newsgroup-bookmarks)))
7348 (defun gnus-summary-force-verify-and-decrypt ()
7349 "Display buttons for signed/encrypted parts and verify/decrypt them."
7351 (let ((mm-verify-option 'known)
7352 (mm-decrypt-option 'known)
7353 (gnus-article-emulate-mime t)
7354 (gnus-buttonized-mime-types (append (list "multipart/signed"
7355 "multipart/encrypted")
7356 gnus-buttonized-mime-types)))
7357 (gnus-summary-select-article nil 'force)))
7359 (defun gnus-summary-set-current-mark (&optional current-mark)
7360 "Obsolete function."
7363 (defun gnus-summary-next-article (&optional unread subject backward push)
7364 "Select the next article.
7365 If UNREAD, only unread articles are selected.
7366 If SUBJECT, only articles with SUBJECT are selected.
7367 If BACKWARD, the previous article is selected instead of the next."
7370 ;; Is there such an article?
7371 ((and (gnus-summary-search-forward unread subject backward)
7372 (or (gnus-summary-display-article (gnus-summary-article-number))
7373 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7374 (gnus-summary-position-point))
7375 ;; If not, we try the first unread, if that is wanted.
7377 gnus-auto-select-same
7378 (gnus-summary-first-unread-article))
7379 (gnus-summary-position-point)
7380 (gnus-message 6 "Wrapped"))
7381 ;; Try to get next/previous article not displayed in this group.
7382 ((and gnus-auto-extend-newsgroup
7383 (not unread) (not subject))
7384 (gnus-summary-goto-article
7385 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7386 nil (count-lines (point-min) (point))))
7387 ;; Go to next/previous group.
7389 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7390 (gnus-summary-jump-to-group gnus-newsgroup-name))
7391 (let ((cmd last-command-char)
7393 (with-current-buffer gnus-group-buffer
7396 (if (eq gnus-keep-same-level 'best)
7397 (gnus-summary-best-group gnus-newsgroup-name)
7398 (gnus-summary-search-group backward gnus-keep-same-level))))
7399 ;; For some reason, the group window gets selected. We change
7401 (select-window (get-buffer-window (current-buffer)))
7402 ;; Select next unread newsgroup automagically.
7404 ((or (not gnus-auto-select-next)
7406 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7407 ((or (eq gnus-auto-select-next 'quietly)
7408 (and (eq gnus-auto-select-next 'slightly-quietly)
7410 (and (eq gnus-auto-select-next 'almost-quietly)
7411 (gnus-summary-last-article-p)))
7413 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7415 (gnus-message 7 "No more%s articles (%s)..."
7416 (if unread " unread" "")
7417 (if group (concat "selecting " group)
7419 (gnus-summary-next-group nil group backward)))
7421 (when (gnus-key-press-event-p last-input-event)
7422 (gnus-summary-walk-group-buffer
7423 gnus-newsgroup-name cmd unread backward point))))))))
7425 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7426 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7427 (?\C-p (gnus-group-prev-unread-group 1))))
7428 (cursor-in-echo-area t)
7429 keve key group ended prompt)
7431 (set-buffer gnus-group-buffer)
7434 (if (eq gnus-keep-same-level 'best)
7435 (gnus-summary-best-group gnus-newsgroup-name)
7436 (gnus-summary-search-group backward gnus-keep-same-level))))
7440 "No more%s articles%s " (if unread " unread" "")
7442 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7443 (format " (Type %s for %s [%s])"
7444 (single-key-description cmd)
7445 (gnus-group-decoded-name group)
7446 (gnus-group-unread group))
7447 (format " (Type %s to exit %s)"
7448 (single-key-description cmd)
7449 (gnus-group-decoded-name gnus-newsgroup-name)))))
7450 ;; Confirm auto selection.
7451 (setq key (car (setq keve (gnus-read-event-char prompt)))
7454 ((assq key keystrokes)
7455 (let ((obuf (current-buffer)))
7456 (switch-to-buffer gnus-group-buffer)
7458 (gnus-group-jump-to-group group))
7459 (eval (cadr (assq key keystrokes)))
7460 (setq group (gnus-group-group-name))
7461 (switch-to-buffer obuf))
7465 (gnus-ephemeral-group-p gnus-newsgroup-name))
7467 (gnus-summary-next-group nil group backward)))
7469 (push (cdr keve) unread-command-events))))))
7471 (defun gnus-summary-next-unread-article ()
7472 "Select unread article after current one."
7474 (gnus-summary-next-article
7475 (or (not (eq gnus-summary-goto-unread 'never))
7476 (gnus-summary-last-article-p (gnus-summary-article-number)))
7477 (and gnus-auto-select-same
7478 (gnus-summary-article-subject))))
7480 (defun gnus-summary-prev-article (&optional unread subject)
7481 "Select the article after the current one.
7482 If UNREAD is non-nil, only unread articles are selected."
7484 (gnus-summary-next-article unread subject t))
7486 (defun gnus-summary-prev-unread-article ()
7487 "Select unread article before current one."
7489 (gnus-summary-prev-article
7490 (or (not (eq gnus-summary-goto-unread 'never))
7491 (gnus-summary-first-article-p (gnus-summary-article-number)))
7492 (and gnus-auto-select-same
7493 (gnus-summary-article-subject))))
7495 (defun gnus-summary-next-page (&optional lines circular stop)
7496 "Show next page of the selected article.
7497 If at the end of the current article, select the next article.
7498 LINES says how many lines should be scrolled up.
7500 If CIRCULAR is non-nil, go to the start of the article instead of
7501 selecting the next article when reaching the end of the current
7504 If STOP is non-nil, just stop when reaching the end of the message.
7506 Also see the variable `gnus-article-skip-boring'."
7508 (setq gnus-summary-buffer (current-buffer))
7509 (gnus-set-global-variables)
7510 (let ((article (gnus-summary-article-number))
7511 (article-window (get-buffer-window gnus-article-buffer t))
7513 ;; If the buffer is empty, we have no article.
7515 (error "No article to select"))
7516 (gnus-configure-windows 'article)
7517 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7518 (if (and (eq gnus-summary-goto-unread 'never)
7519 (not (gnus-summary-last-article-p article)))
7520 (gnus-summary-next-article)
7521 (gnus-summary-next-unread-article))
7522 (if (or (null gnus-current-article)
7523 (null gnus-article-current)
7524 (/= article (cdr gnus-article-current))
7525 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7526 ;; Selected subject is different from current article's.
7527 (gnus-summary-display-article article)
7528 (when article-window
7529 (gnus-eval-in-buffer-window gnus-article-buffer
7530 (setq endp (or (gnus-article-next-page lines)
7531 (gnus-article-only-boring-p))))
7534 (gnus-message 3 "End of message"))
7536 (gnus-summary-beginning-of-article))
7538 (gnus-message 3 "End of message"))
7540 (if (and (eq gnus-summary-goto-unread 'never)
7541 (not (gnus-summary-last-article-p article)))
7542 (gnus-summary-next-article)
7543 (gnus-summary-next-unread-article))))))))
7544 (gnus-summary-recenter)
7545 (gnus-summary-position-point)))
7547 (defun gnus-summary-prev-page (&optional lines move)
7548 "Show previous page of selected article.
7549 Argument LINES specifies lines to be scrolled down.
7550 If MOVE, move to the previous unread article if point is at
7551 the beginning of the buffer."
7553 (let ((article (gnus-summary-article-number))
7554 (article-window (get-buffer-window gnus-article-buffer t))
7556 (gnus-configure-windows 'article)
7557 (if (or (null gnus-current-article)
7558 (null gnus-article-current)
7559 (/= article (cdr gnus-article-current))
7560 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7561 ;; Selected subject is different from current article's.
7562 (gnus-summary-display-article article)
7563 (gnus-summary-recenter)
7564 (when article-window
7565 (gnus-eval-in-buffer-window gnus-article-buffer
7566 (setq endp (gnus-article-prev-page lines)))
7567 (when (and move endp)
7569 (gnus-message 3 "Beginning of message"))
7571 (if (and (eq gnus-summary-goto-unread 'never)
7572 (not (gnus-summary-first-article-p article)))
7573 (gnus-summary-prev-article)
7574 (gnus-summary-prev-unread-article))))))))
7575 (gnus-summary-position-point))
7577 (defun gnus-summary-prev-page-or-article (&optional lines)
7578 "Show previous page of selected article.
7579 Argument LINES specifies lines to be scrolled down.
7580 If at the beginning of the article, go to the next article."
7582 (gnus-summary-prev-page lines t))
7584 (defun gnus-summary-scroll-up (lines)
7585 "Scroll up (or down) one line current article.
7586 Argument LINES specifies lines to be scrolled up (or down if negative)."
7588 (gnus-configure-windows 'article)
7589 (gnus-summary-show-thread)
7590 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7591 (gnus-eval-in-buffer-window gnus-article-buffer
7593 (when (gnus-article-next-page lines)
7594 (gnus-message 3 "End of message")))
7596 (gnus-article-prev-page (- lines))))))
7597 (gnus-summary-recenter)
7598 (gnus-summary-position-point))
7600 (defun gnus-summary-scroll-down (lines)
7601 "Scroll down (or up) one line current article.
7602 Argument LINES specifies lines to be scrolled down (or up if negative)."
7604 (gnus-summary-scroll-up (- lines)))
7606 (defun gnus-summary-next-same-subject ()
7607 "Select next article which has the same subject as current one."
7609 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7611 (defun gnus-summary-prev-same-subject ()
7612 "Select previous article which has the same subject as current one."
7614 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7616 (defun gnus-summary-next-unread-same-subject ()
7617 "Select next unread article which has the same subject as current one."
7619 (gnus-summary-next-article t (gnus-summary-article-subject)))
7621 (defun gnus-summary-prev-unread-same-subject ()
7622 "Select previous unread article which has the same subject as current one."
7624 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7626 (defun gnus-summary-first-unread-article ()
7627 "Select the first unread article.
7628 Return nil if there are no unread articles."
7631 (when (gnus-summary-first-subject t)
7632 (gnus-summary-show-thread)
7633 (gnus-summary-first-subject t)
7634 (gnus-summary-display-article (gnus-summary-article-number)))
7635 (gnus-summary-position-point)))
7637 (defun gnus-summary-first-unread-subject ()
7638 "Place the point on the subject line of the first unread article.
7639 Return nil if there are no unread articles."
7642 (when (gnus-summary-first-subject t)
7643 (gnus-summary-show-thread)
7644 (gnus-summary-first-subject t))
7645 (gnus-summary-position-point)))
7647 (defun gnus-summary-first-unseen-subject ()
7648 "Place the point on the subject line of the first unseen article.
7649 Return nil if there are no unseen articles."
7652 (when (gnus-summary-first-subject nil nil t)
7653 (gnus-summary-show-thread)
7654 (gnus-summary-first-subject nil nil t))
7655 (gnus-summary-position-point)))
7657 (defun gnus-summary-first-unseen-or-unread-subject ()
7658 "Place the point on the subject line of the first unseen article or,
7659 if all article have been seen, on the subject line of the first unread
7663 (unless (when (gnus-summary-first-subject nil nil t)
7664 (gnus-summary-show-thread)
7665 (gnus-summary-first-subject nil nil t))
7666 (when (gnus-summary-first-subject t)
7667 (gnus-summary-show-thread)
7668 (gnus-summary-first-subject t)))
7669 (gnus-summary-position-point)))
7671 (defun gnus-summary-first-article ()
7672 "Select the first article.
7673 Return nil if there are no articles."
7676 (when (gnus-summary-first-subject)
7677 (gnus-summary-show-thread)
7678 (gnus-summary-first-subject)
7679 (gnus-summary-display-article (gnus-summary-article-number)))
7680 (gnus-summary-position-point)))
7682 (defun gnus-summary-best-unread-article (&optional arg)
7683 "Select the unread article with the highest score.
7684 If given a prefix argument, select the next unread article that has a
7685 score higher than the default score."
7687 (let ((article (if arg
7688 (gnus-summary-better-unread-subject)
7689 (gnus-summary-best-unread-subject))))
7691 (gnus-summary-goto-article article)
7692 (error "No unread articles"))))
7694 (defun gnus-summary-best-unread-subject ()
7695 "Select the unread subject with the highest score."
7697 (let ((best -1000000)
7698 (data gnus-newsgroup-data)
7701 (and (gnus-data-unread-p (car data))
7703 (gnus-summary-article-score (gnus-data-number (car data))))
7706 article (gnus-data-number (car data))))
7707 (setq data (cdr data)))
7709 (gnus-summary-goto-subject article))
7710 (gnus-summary-position-point)
7713 (defun gnus-summary-better-unread-subject ()
7714 "Select the first unread subject that has a score over the default score."
7716 (let ((data gnus-newsgroup-data)
7718 (while (and (setq article (gnus-data-number (car data)))
7719 (or (gnus-data-read-p (car data))
7720 (not (> (gnus-summary-article-score article)
7721 gnus-summary-default-score))))
7722 (setq data (cdr data)))
7724 (gnus-summary-goto-subject article))
7725 (gnus-summary-position-point)
7728 (defun gnus-summary-last-subject ()
7729 "Go to the last displayed subject line in the group."
7730 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7732 (gnus-summary-goto-subject article))))
7734 (defun gnus-summary-goto-article (article &optional all-headers force)
7735 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7736 If ALL-HEADERS is non-nil, no header lines are hidden.
7737 If FORCE, go to the article even if it isn't displayed. If FORCE
7738 is a number, it is the line the article is to be displayed on."
7742 "Article number or Message-ID: "
7743 (mapcar (lambda (number) (list (int-to-string number)))
7744 gnus-newsgroup-limit))
7748 (if (and (stringp article)
7749 (string-match "@\\|%40" article))
7750 (gnus-summary-refer-article article)
7751 (when (stringp article)
7752 (setq article (string-to-number article)))
7753 (if (gnus-summary-goto-subject article force)
7754 (gnus-summary-display-article article all-headers)
7755 (gnus-message 4 "Couldn't go to article %s" article) nil))
7756 (gnus-summary-position-point)))
7758 (defun gnus-summary-goto-last-article ()
7759 "Go to the previously read article."
7762 (when gnus-last-article
7763 (gnus-summary-goto-article gnus-last-article nil t))
7764 (gnus-summary-position-point)))
7766 (defun gnus-summary-pop-article (number)
7767 "Pop one article off the history and go to the previous.
7768 NUMBER articles will be popped off."
7771 (setq gnus-newsgroup-history
7772 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7774 (gnus-summary-goto-article (car to) nil t)
7775 (error "Article history empty")))
7776 (gnus-summary-position-point))
7778 ;; Summary commands and functions for limiting the summary buffer.
7780 (defun gnus-summary-limit-to-articles (n)
7781 "Limit the summary buffer to the next N articles.
7782 If not given a prefix, use the process marked articles instead."
7785 (let ((articles (gnus-summary-work-articles n)))
7786 (setq gnus-newsgroup-processable nil)
7787 (gnus-summary-limit articles))
7788 (gnus-summary-position-point)))
7790 (defun gnus-summary-pop-limit (&optional total)
7791 "Restore the previous limit.
7792 If given a prefix, remove all limits."
7795 (setq gnus-newsgroup-limits
7796 (list (mapcar (lambda (h) (mail-header-number h))
7797 gnus-newsgroup-headers))))
7798 (unless gnus-newsgroup-limits
7799 (error "No limit to pop"))
7801 (gnus-summary-limit nil 'pop)
7802 (gnus-summary-position-point)))
7804 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7805 "Limit the summary buffer to articles that have subjects that match a regexp.
7806 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7808 (list (read-string (if current-prefix-arg
7809 "Exclude subject (regexp): "
7810 "Limit to subject (regexp): "))
7811 nil current-prefix-arg))
7813 (setq header "subject"))
7814 (when (not (equal "" subject))
7816 (let ((articles (gnus-summary-find-matching
7817 (or header "subject") subject 'all nil nil
7820 (error "Found no matches for \"%s\"" subject))
7821 (gnus-summary-limit articles))
7822 (gnus-summary-position-point))))
7824 (defun gnus-summary-limit-to-author (from &optional not-matching)
7825 "Limit the summary buffer to articles that have authors that match a regexp.
7826 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7828 (list (read-string (if current-prefix-arg
7829 "Exclude author (regexp): "
7830 "Limit to author (regexp): "))
7831 current-prefix-arg))
7832 (gnus-summary-limit-to-subject from "from" not-matching))
7834 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7835 "Limit the summary buffer to articles with the given RECIPIENT.
7837 If NOT-MATCHING, exclude RECIPIENT.
7839 To and Cc headers are checked. You need to include them in
7840 `nnmail-extra-headers'."
7841 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7843 (list (read-string (format "%s recipient (regexp): "
7844 (if current-prefix-arg "Exclude" "Limit to")))
7845 current-prefix-arg))
7846 (when (not (equal "" recipient))
7848 (if (memq 'To nnmail-extra-headers)
7849 (gnus-summary-find-matching
7850 (cons 'extra 'To) recipient 'all nil nil
7853 1 "`To' isn't present in `nnmail-extra-headers'")
7857 (if (memq 'Cc nnmail-extra-headers)
7858 (gnus-summary-find-matching
7859 (cons 'extra 'Cc) recipient 'all nil nil
7862 1 "`Cc' isn't present in `nnmail-extra-headers'")
7867 ;; We need the numbers that are in both lists:
7869 (and (memq a to) a))
7873 (error "Found no matches for \"%s\"" recipient))
7874 (gnus-summary-limit articles))
7875 (gnus-summary-position-point))))
7877 (defun gnus-summary-limit-to-age (age &optional younger-p)
7878 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7879 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7880 articles that are younger than AGE days."
7882 (let ((younger current-prefix-arg)
7885 (while (not days-got)
7886 (setq days (if younger
7887 (read-string "Limit to articles younger than (in days, older when negative): ")
7889 "Limit to articles older than (in days, younger when negative): ")))
7890 (when (> (length days) 0)
7891 (setq days (read days)))
7896 (setq younger (not younger))
7897 (setq days (* days -1))))
7898 (message "Please enter a number.")
7900 (list days younger)))
7902 (let ((data gnus-newsgroup-data)
7903 (cutoff (days-to-time age))
7904 articles d date is-younger)
7905 (while (setq d (pop data))
7906 (when (and (vectorp (gnus-data-header d))
7907 (setq date (mail-header-date (gnus-data-header d))))
7908 (setq is-younger (time-less-p
7909 (time-since (condition-case ()
7916 (push (gnus-data-number d) articles))))
7917 (gnus-summary-limit (nreverse articles)))
7918 (gnus-summary-position-point)))
7920 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7921 "Limit the summary buffer to articles that match an 'extra' header."
7925 (gnus-completing-read-with-default
7926 (symbol-name (car gnus-extra-headers))
7927 (if current-prefix-arg
7928 "Exclude extra header"
7929 "Limit extra header")
7931 (cons (symbol-name x) x))
7936 (read-string (format "%s header %s (regexp): "
7937 (if current-prefix-arg "Exclude" "Limit to")
7939 current-prefix-arg)))
7940 (when (not (equal "" regexp))
7942 (let ((articles (gnus-summary-find-matching
7943 (cons 'extra header) regexp 'all nil nil
7946 (error "Found no matches for \"%s\"" regexp))
7947 (gnus-summary-limit articles))
7948 (gnus-summary-position-point))))
7950 (defun gnus-summary-limit-to-display-predicate ()
7951 "Limit the summary buffer to the predicated in the `display' group parameter."
7953 (unless gnus-newsgroup-display
7954 (error "There is no `display' group parameter"))
7956 (dolist (number gnus-newsgroup-articles)
7957 (when (funcall gnus-newsgroup-display)
7958 (push number articles)))
7959 (gnus-summary-limit articles))
7960 (gnus-summary-position-point))
7962 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7964 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7966 (defun gnus-summary-limit-to-unread (&optional all)
7967 "Limit the summary buffer to articles that are not marked as read.
7968 If ALL is non-nil, limit strictly to unread articles."
7971 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7972 (gnus-summary-limit-to-marks
7973 ;; Concat all the marks that say that an article is read and have
7975 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7976 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7977 gnus-low-score-mark gnus-expirable-mark
7978 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
7979 gnus-duplicate-mark gnus-souped-mark)
7982 (defun gnus-summary-limit-to-replied (&optional unreplied)
7983 "Limit the summary buffer to replied articles.
7984 If UNREPLIED (the prefix), limit to unreplied articles."
7988 (gnus-set-difference gnus-newsgroup-articles
7989 gnus-newsgroup-replied))
7990 (gnus-summary-limit gnus-newsgroup-replied))
7991 (gnus-summary-position-point))
7993 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
7994 (make-obsolete 'gnus-summary-delete-marked-with
7995 'gnus-summary-limit-exclude-marks)
7997 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
7998 "Exclude articles that are marked with MARKS (e.g. \"DK\").
7999 If REVERSE, limit the summary buffer to articles that are marked
8000 with MARKS. MARKS can either be a string of marks or a list of marks.
8001 Returns how many articles were removed."
8002 (interactive "sMarks: ")
8003 (gnus-summary-limit-to-marks marks t))
8005 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8006 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8007 If REVERSE (the prefix), limit the summary buffer to articles that are
8008 not marked with MARKS. MARKS can either be a string of marks or a
8010 Returns how many articles were removed."
8011 (interactive "sMarks: \nP")
8013 (let ((data gnus-newsgroup-data)
8014 (marks (if (listp marks) marks
8015 (append marks nil))) ; Transform to list.
8018 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8019 (memq (gnus-data-mark (car data)) marks))
8020 (push (gnus-data-number (car data)) articles))
8021 (setq data (cdr data)))
8022 (gnus-summary-limit articles))
8023 (gnus-summary-position-point)))
8025 (defun gnus-summary-limit-to-score (score)
8026 "Limit to articles with score at or above SCORE."
8027 (interactive "NLimit to articles with score of at least: ")
8028 (let ((data gnus-newsgroup-data)
8031 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8033 (push (gnus-data-number (car data)) articles))
8034 (setq data (cdr data)))
8036 (gnus-summary-limit articles)
8037 (gnus-summary-position-point))))
8039 (defun gnus-summary-limit-to-unseen ()
8040 "Limit to unseen articles."
8043 (gnus-summary-limit gnus-newsgroup-unseen)
8044 (gnus-summary-position-point)))
8046 (defun gnus-summary-limit-include-thread (id)
8047 "Display all the hidden articles that is in the thread with ID in it.
8048 When called interactively, ID is the Message-ID of the current
8050 (interactive (list (mail-header-id (gnus-summary-article-header))))
8051 (let ((articles (gnus-articles-in-thread
8052 (gnus-id-to-thread (gnus-root-id id)))))
8054 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8055 (gnus-summary-limit-include-matching-articles
8057 (regexp-quote (gnus-simplify-subject-re
8058 (mail-header-subject (gnus-id-to-header id)))))
8059 (gnus-summary-position-point))))
8061 (defun gnus-summary-limit-include-matching-articles (header regexp)
8062 "Display all the hidden articles that have HEADERs that match REGEXP."
8063 (interactive (list (read-string "Match on header: ")
8064 (read-string "Regexp: ")))
8065 (let ((articles (gnus-find-matching-articles header regexp)))
8067 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8068 (gnus-summary-position-point))))
8070 (defun gnus-summary-insert-dormant-articles ()
8071 "Insert all the dormant articles for this group into the current buffer."
8073 (let ((gnus-verbose (max 6 gnus-verbose)))
8074 (if (not gnus-newsgroup-dormant)
8075 (gnus-message 3 "No cached articles for this group")
8076 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8078 (defun gnus-summary-limit-include-dormant ()
8079 "Display all the hidden articles that are marked as dormant.
8080 Note that this command only works on a subset of the articles currently
8081 fetched for this group."
8083 (unless gnus-newsgroup-dormant
8084 (error "There are no dormant articles in this group"))
8086 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8087 (gnus-summary-position-point)))
8089 (defun gnus-summary-limit-exclude-dormant ()
8090 "Hide all dormant articles."
8093 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8094 (gnus-summary-position-point)))
8096 (defun gnus-summary-limit-exclude-childless-dormant ()
8097 "Hide all dormant articles that have no children."
8099 (let ((data (gnus-data-list t))
8100 articles d children)
8101 ;; Find all articles that are either not dormant or have
8103 (while (setq d (pop data))
8104 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8106 (gnus-article-children (gnus-data-number d)))
8109 (when (memq (car children) articles)
8114 (push (gnus-data-number d) articles)))
8117 (gnus-summary-limit articles)
8118 (gnus-summary-position-point))))
8120 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8121 "Mark all unread excluded articles as read.
8122 If ALL, mark even excluded ticked and dormants as read."
8124 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8125 (let ((articles (gnus-sorted-ndifference
8127 (mapcar (lambda (h) (mail-header-number h))
8128 gnus-newsgroup-headers)
8130 gnus-newsgroup-limit))
8132 (setq gnus-newsgroup-unreads
8133 (gnus-sorted-intersection gnus-newsgroup-unreads
8134 gnus-newsgroup-limit))
8136 (setq gnus-newsgroup-dormant nil
8137 gnus-newsgroup-marked nil
8138 gnus-newsgroup-reads
8140 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8141 gnus-newsgroup-reads))
8142 (while (setq article (pop articles))
8143 (unless (or (memq article gnus-newsgroup-dormant)
8144 (memq article gnus-newsgroup-marked))
8145 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8147 (defun gnus-summary-limit (articles &optional pop)
8149 ;; We pop the previous limit off the stack and use that.
8150 (setq articles (car gnus-newsgroup-limits)
8151 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8152 ;; We use the new limit, so we push the old limit on the stack.
8153 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8155 (setq gnus-newsgroup-limit articles)
8156 (let ((total (length gnus-newsgroup-data))
8157 (data (gnus-data-find-list (gnus-summary-article-number)))
8158 (gnus-summary-mark-below nil) ; Inhibit this.
8160 ;; This will do all the work of generating the new summary buffer
8161 ;; according to the new limit.
8162 (gnus-summary-prepare)
8163 ;; Hide any threads, possibly.
8164 (gnus-summary-maybe-hide-threads)
8165 ;; Try to return to the article you were at, or one in the
8168 ;; We try to find some article after the current one.
8170 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8173 (setq data (cdr data))))
8175 ;; If there is no data, that means that we were after the last
8176 ;; article. The same goes when we can't find any articles
8177 ;; after the current one.
8178 (goto-char (point-max))
8179 (gnus-summary-find-prev))
8180 (gnus-set-mode-line 'summary)
8181 ;; We return how many articles were removed from the summary
8182 ;; buffer as a result of the new limit.
8183 (- total (length gnus-newsgroup-data))))
8185 (defsubst gnus-invisible-cut-children (threads)
8188 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8193 (defsubst gnus-cut-thread (thread)
8194 "Go forwards in the thread until we find an article that we want to display."
8195 (when (or (eq gnus-fetch-old-headers 'some)
8196 (eq gnus-fetch-old-headers 'invisible)
8197 (numberp gnus-fetch-old-headers)
8198 (eq gnus-build-sparse-threads 'some)
8199 (eq gnus-build-sparse-threads 'more))
8200 ;; Deal with old-fetched headers and sparse threads.
8204 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8205 (gnus-summary-article-ancient-p
8206 (mail-header-number (car thread))))
8207 (if (or (<= (length (cdr thread)) 1)
8208 (eq gnus-fetch-old-headers 'invisible))
8209 (setq gnus-newsgroup-limit
8210 (delq (mail-header-number (car thread))
8211 gnus-newsgroup-limit)
8212 thread (cadr thread))
8213 (when (gnus-invisible-cut-children (cdr thread))
8214 (let ((th (cdr thread)))
8216 (if (memq (mail-header-number (caar th))
8217 gnus-newsgroup-limit)
8218 (setq thread (car th)
8220 (setq th (cdr th))))))))))
8223 (defun gnus-cut-threads (threads)
8224 "Cut off all uninteresting articles from the beginning of THREADS."
8225 (when (or (eq gnus-fetch-old-headers 'some)
8226 (eq gnus-fetch-old-headers 'invisible)
8227 (numberp gnus-fetch-old-headers)
8228 (eq gnus-build-sparse-threads 'some)
8229 (eq gnus-build-sparse-threads 'more))
8232 (setcar th (gnus-cut-thread (car th)))
8233 (setq th (cdr th)))))
8234 ;; Remove nixed out threads.
8237 (defun gnus-summary-initial-limit (&optional show-if-empty)
8238 "Figure out what the initial limit is supposed to be on group entry.
8239 This entails weeding out unwanted dormants, low-scored articles,
8240 fetch-old-headers verbiage, and so on."
8241 ;; Most groups have nothing to remove.
8242 (if (or gnus-inhibit-limiting
8243 (and (null gnus-newsgroup-dormant)
8244 (eq gnus-newsgroup-display 'gnus-not-ignore)
8245 (not (eq gnus-fetch-old-headers 'some))
8246 (not (numberp gnus-fetch-old-headers))
8247 (not (eq gnus-fetch-old-headers 'invisible))
8248 (null gnus-summary-expunge-below)
8249 (not (eq gnus-build-sparse-threads 'some))
8250 (not (eq gnus-build-sparse-threads 'more))
8251 (null gnus-thread-expunge-below)
8252 (not gnus-use-nocem)))
8254 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8255 (setq gnus-newsgroup-limit nil)
8258 (unless (car (symbol-value node))
8259 ;; These threads have no parents -- they are roots.
8260 (let ((nodes (cdr (symbol-value node)))
8263 (if (and gnus-thread-expunge-below
8264 (< (gnus-thread-total-score (car nodes))
8265 gnus-thread-expunge-below))
8266 (gnus-expunge-thread (pop nodes))
8267 (setq thread (pop nodes))
8268 (gnus-summary-limit-children thread))))))
8269 gnus-newsgroup-dependencies)
8270 ;; If this limitation resulted in an empty group, we might
8271 ;; pop the previous limit and use it instead.
8272 (when (and (not gnus-newsgroup-limit)
8274 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8275 gnus-newsgroup-limit))
8277 (defun gnus-summary-limit-children (thread)
8278 "Return 1 if this subthread is visible and 0 if it is not."
8279 ;; First we get the number of visible children to this thread. This
8280 ;; is done by recursing down the thread using this function, so this
8281 ;; will really go down to a leaf article first, before slowly
8282 ;; working its way up towards the root.
8284 (let* ((max-lisp-eval-depth 5000)
8287 (apply '+ (mapcar 'gnus-summary-limit-children
8290 (number (mail-header-number (car thread)))
8293 (not (memq number gnus-newsgroup-marked))
8295 ;; If this article is dormant and has absolutely no visible
8296 ;; children, then this article isn't visible.
8297 (and (memq number gnus-newsgroup-dormant)
8299 ;; If this is "fetch-old-headered" and there is no
8300 ;; visible children, then we don't want this article.
8301 (and (or (eq gnus-fetch-old-headers 'some)
8302 (numberp gnus-fetch-old-headers))
8303 (gnus-summary-article-ancient-p number)
8305 ;; If this is "fetch-old-headered" and `invisible', then
8306 ;; we don't want this article.
8307 (and (eq gnus-fetch-old-headers 'invisible)
8308 (gnus-summary-article-ancient-p number))
8309 ;; If this is a sparsely inserted article with no children,
8310 ;; we don't want it.
8311 (and (eq gnus-build-sparse-threads 'some)
8312 (gnus-summary-article-sparse-p number)
8314 ;; If we use expunging, and this article is really
8315 ;; low-scored, then we don't want this article.
8316 (when (and gnus-summary-expunge-below
8318 (or (cdr (assq number gnus-newsgroup-scored))
8319 gnus-summary-default-score))
8320 gnus-summary-expunge-below))
8321 ;; We increase the expunge-tally here, but that has
8322 ;; nothing to do with the limits, really.
8323 (incf gnus-newsgroup-expunged-tally)
8324 ;; We also mark as read here, if that's wanted.
8325 (when (and gnus-summary-mark-below
8326 (< score gnus-summary-mark-below))
8327 (setq gnus-newsgroup-unreads
8328 (delq number gnus-newsgroup-unreads))
8329 (if gnus-newsgroup-auto-expire
8330 (push number gnus-newsgroup-expirable)
8331 (push (cons number gnus-low-score-mark)
8332 gnus-newsgroup-reads)))
8334 ;; Do the `display' group parameter.
8335 (and gnus-newsgroup-display
8336 (not (funcall gnus-newsgroup-display)))
8337 ;; Check NoCeM things.
8338 (when (and gnus-use-nocem
8339 (gnus-nocem-unwanted-article-p
8340 (mail-header-id (car thread))))
8341 (setq gnus-newsgroup-unreads
8342 (delq number gnus-newsgroup-unreads))
8344 ;; Nope, invisible article.
8346 ;; Ok, this article is to be visible, so we add it to the limit
8348 (push number gnus-newsgroup-limit)
8351 (defun gnus-expunge-thread (thread)
8352 "Mark all articles in THREAD as read."
8353 (let* ((number (mail-header-number (car thread))))
8354 (incf gnus-newsgroup-expunged-tally)
8355 ;; We also mark as read here, if that's wanted.
8356 (setq gnus-newsgroup-unreads
8357 (delq number gnus-newsgroup-unreads))
8358 (if gnus-newsgroup-auto-expire
8359 (push number gnus-newsgroup-expirable)
8360 (push (cons number gnus-low-score-mark)
8361 gnus-newsgroup-reads)))
8362 ;; Go recursively through all subthreads.
8363 (mapcar 'gnus-expunge-thread (cdr thread)))
8365 ;; Summary article oriented commands
8367 (defun gnus-summary-refer-parent-article (n)
8368 "Refer parent article N times.
8369 If N is negative, go to ancestor -N instead.
8370 The difference between N and the number of articles fetched is returned."
8374 (when (not (natnump n))
8379 (setq header (gnus-summary-article-header))
8380 (if (and (eq (mail-header-number header)
8381 (cdr gnus-article-current))
8382 (equal gnus-newsgroup-name
8383 (car gnus-article-current)))
8384 ;; If we try to find the parent of the currently
8385 ;; displayed article, then we take a look at the actual
8386 ;; References header, since this is slightly more
8387 ;; reliable than the References field we got from the
8390 (set-buffer gnus-original-article-buffer)
8391 (nnheader-narrow-to-headers)
8392 (unless (setq ref (message-fetch-field "references"))
8393 (when (setq ref (message-fetch-field "in-reply-to"))
8394 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8397 ;; It's not the current article, so we take a bet on
8398 ;; the value we got from the server.
8399 (mail-header-references header)))
8401 (not (equal ref "")))
8402 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8403 (gnus-message 1 "Couldn't find parent"))
8404 (gnus-message 1 "No references in article %d"
8405 (gnus-summary-article-number))
8408 (gnus-summary-position-point)
8411 (defun gnus-summary-refer-references ()
8412 "Fetch all articles mentioned in the References header.
8413 Return the number of articles fetched."
8415 (let ((ref (mail-header-references (gnus-summary-article-header)))
8416 (current (gnus-summary-article-number))
8420 (error "No References in the current article")
8421 ;; For each Message-ID in the References header...
8422 (while (string-match "<[^>]*>" ref)
8424 ;; ... fetch that article.
8425 (gnus-summary-refer-article
8426 (prog1 (match-string 0 ref)
8427 (setq ref (substring ref (match-end 0))))))
8428 (gnus-summary-goto-subject current)
8429 (gnus-summary-position-point)
8432 (defun gnus-summary-refer-thread (&optional limit)
8433 "Fetch all articles in the current thread.
8434 If LIMIT (the numerical prefix), fetch that many old headers instead
8435 of what's specified by the `gnus-refer-thread-limit' variable."
8437 (let ((id (mail-header-id (gnus-summary-article-header)))
8438 (limit (if limit (prefix-numeric-value limit)
8439 gnus-refer-thread-limit)))
8440 (unless (eq gnus-fetch-old-headers 'invisible)
8441 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8442 ;; Retrieve the headers and read them in.
8443 (if (eq (if (numberp limit)
8444 (gnus-retrieve-headers
8446 (+ (mail-header-number
8447 (gnus-summary-article-header))
8449 gnus-newsgroup-end))
8450 gnus-newsgroup-name (* limit 2))
8451 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8453 (gnus-retrieve-headers (list gnus-newsgroup-end)
8454 gnus-newsgroup-name limit))
8456 (gnus-build-all-threads)
8457 (error "Can't fetch thread from back ends that don't support NOV"))
8458 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8459 (gnus-summary-limit-include-thread id)))
8461 (defun gnus-summary-refer-article (message-id)
8462 "Fetch an article specified by MESSAGE-ID."
8463 (interactive "sMessage-ID: ")
8464 (when (and (stringp message-id)
8465 (not (zerop (length message-id))))
8466 (setq message-id (gnus-replace-in-string message-id " " ""))
8467 ;; Construct the correct Message-ID if necessary.
8468 ;; Suggested by tale@pawl.rpi.edu.
8469 (unless (string-match "^<" message-id)
8470 (setq message-id (concat "<" message-id)))
8471 (unless (string-match ">$" message-id)
8472 (setq message-id (concat message-id ">")))
8473 ;; People often post MIDs from URLs, so unhex it:
8474 (unless (string-match "@" message-id)
8475 (setq message-id (gnus-url-unhex-string message-id)))
8476 (let* ((header (gnus-id-to-header message-id))
8478 (gnus-summary-article-sparse-p
8479 (mail-header-number header))
8480 (memq (mail-header-number header)
8481 gnus-newsgroup-limit)))
8484 ;; If the article is present in the buffer we just go to it.
8486 (or (not (gnus-summary-article-sparse-p
8487 (mail-header-number header)))
8490 (gnus-summary-goto-article
8491 (mail-header-number header) nil t)
8493 (gnus-summary-update-article (mail-header-number header)))))
8495 ;; We fetch the article.
8497 (dolist (gnus-override-method (gnus-refer-article-methods))
8498 (when (and (gnus-check-server gnus-override-method)
8499 ;; Fetch the header,
8500 (setq number (gnus-summary-insert-subject message-id)))
8501 ;; and display the article.
8502 (gnus-summary-select-article nil nil nil number)
8504 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8506 (defun gnus-refer-article-methods ()
8507 "Return a list of referable methods."
8509 ;; No method, so we default to current and native.
8510 ((null gnus-refer-article-method)
8511 (list gnus-current-select-method gnus-select-method))
8513 ((eq 'current gnus-refer-article-method)
8514 (list gnus-current-select-method))
8515 ;; List of select methods.
8516 ((not (and (symbolp (car gnus-refer-article-method))
8517 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8519 (dolist (method gnus-refer-article-method)
8520 (push (if (eq 'current method)
8521 gnus-current-select-method
8525 ;; One single select method.
8527 (list gnus-refer-article-method))))
8529 (defun gnus-summary-edit-parameters ()
8530 "Edit the group parameters of the current group."
8532 (gnus-group-edit-group gnus-newsgroup-name 'params))
8534 (defun gnus-summary-customize-parameters ()
8535 "Customize the group parameters of the current group."
8537 (gnus-group-customize gnus-newsgroup-name))
8539 (defun gnus-summary-enter-digest-group (&optional force)
8540 "Enter an nndoc group based on the current article.
8541 If FORCE, force a digest interpretation. If not, try
8542 to guess what the document format is."
8544 (let ((conf gnus-current-window-configuration))
8545 (save-window-excursion
8547 (let (gnus-article-prepare-hook
8548 gnus-display-mime-function
8550 (gnus-summary-select-article))))
8551 (setq gnus-current-window-configuration conf)
8552 (let* ((name (format "%s-%d"
8553 (gnus-group-prefixed-name
8554 gnus-newsgroup-name (list 'nndoc ""))
8555 (with-current-buffer gnus-summary-buffer
8556 gnus-current-article)))
8557 (ogroup gnus-newsgroup-name)
8558 (params (append (gnus-info-params (gnus-get-info ogroup))
8559 (list (cons 'to-group ogroup))
8560 (list (cons 'parent-group ogroup))
8561 (list (cons 'save-article-group ogroup))))
8562 (case-fold-search t)
8563 (buf (current-buffer))
8566 (set-buffer gnus-original-article-buffer)
8567 ;; Have the digest group inherit the main mail address of
8568 ;; the parent article.
8569 (when (setq to-address (or (gnus-fetch-field "reply-to")
8570 (gnus-fetch-field "from")))
8571 (setq params (append
8572 (list (cons 'to-address
8573 (funcall gnus-decode-encoded-word-function
8575 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8576 (insert-buffer-substring gnus-original-article-buffer)
8577 ;; Remove lines that may lead nndoc to misinterpret the
8580 (goto-char (point-min))
8581 (or (search-forward "\n\n" nil t) (point)))
8582 (goto-char (point-min))
8583 (delete-matching-lines "^Path:\\|^From ")
8586 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8587 (gnus-newsgroup-ephemeral-ignored-charsets
8588 gnus-newsgroup-ignored-charsets))
8589 (gnus-group-read-ephemeral-group
8590 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8592 ,(if force 'mbox 'guess)))
8594 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8596 ;; Make all postings to this group go to the parent group.
8597 (nconc (gnus-info-params (gnus-get-info name))
8599 ;; Couldn't select this doc group.
8600 (switch-to-buffer buf)
8601 (gnus-set-global-variables)
8602 (gnus-configure-windows 'summary)
8603 (gnus-message 3 "Article couldn't be entered?"))
8604 (kill-buffer dig)))))
8606 (defun gnus-summary-read-document (n)
8607 "Open a new group based on the current article(s).
8608 This will allow you to read digests and other similar
8609 documents as newsgroups.
8610 Obeys the standard process/prefix convention."
8612 (let* ((ogroup gnus-newsgroup-name)
8613 (params (append (gnus-info-params (gnus-get-info ogroup))
8614 (list (cons 'to-group ogroup))))
8615 group egroup groups vgroup)
8616 (dolist (article (gnus-summary-work-articles n))
8617 (setq group (format "%s-%d" gnus-newsgroup-name article))
8618 (gnus-summary-remove-process-mark article)
8619 (when (gnus-summary-display-article article)
8622 (insert-buffer-substring gnus-original-article-buffer)
8623 ;; Remove some headers that may lead nndoc to make
8625 (message-narrow-to-head)
8626 (goto-char (point-min))
8627 (delete-matching-lines "^Path:\\|^From ")
8630 (gnus-group-read-ephemeral-group
8631 group `(nndoc ,group (nndoc-address ,(current-buffer))
8632 (nndoc-article-type guess))
8635 ;; Make all postings to this group go to the parent group.
8636 (nconc (gnus-info-params (gnus-get-info egroup))
8638 (push egroup groups))
8639 ;; Couldn't select this doc group.
8640 (gnus-error 3 "Article couldn't be entered"))))))
8641 ;; Now we have selected all the documents.
8644 (error "None of the articles could be interpreted as documents"))
8645 ((gnus-group-read-ephemeral-group
8646 (setq vgroup (format
8647 "nnvirtual:%s-%s" gnus-newsgroup-name
8648 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8649 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8651 (cons (current-buffer) 'summary)))
8653 (error "Couldn't select virtual nndoc group")))))
8655 (defun gnus-summary-isearch-article (&optional regexp-p)
8656 "Do incremental search forward on the current article.
8657 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8659 (let* ((gnus-inhibit-treatment t)
8660 (old (gnus-summary-select-article)))
8661 (gnus-configure-windows 'article)
8662 (gnus-eval-in-buffer-window gnus-article-buffer
8666 (gnus-article-show-all-headers))
8667 (goto-char (point-min))
8668 (isearch-forward regexp-p)))))
8670 (defun gnus-summary-search-article-forward (regexp &optional backward)
8671 "Search for an article containing REGEXP forward.
8672 If BACKWARD, search backward instead."
8675 (format "Search article %s (regexp%s): "
8676 (if current-prefix-arg "backward" "forward")
8677 (if gnus-last-search-regexp
8678 (concat ", default " gnus-last-search-regexp)
8680 current-prefix-arg))
8681 (if (string-equal regexp "")
8682 (setq regexp (or gnus-last-search-regexp ""))
8683 (setq gnus-last-search-regexp regexp)
8684 (setq gnus-article-before-search gnus-current-article))
8685 ;; Intentionally set gnus-last-article.
8686 (setq gnus-last-article gnus-article-before-search)
8687 (let ((gnus-last-article gnus-last-article))
8688 (if (gnus-summary-search-article regexp backward)
8689 (gnus-summary-show-thread)
8690 (signal 'search-failed (list regexp)))))
8692 (defun gnus-summary-search-article-backward (regexp)
8693 "Search for an article containing REGEXP backward."
8696 (format "Search article backward (regexp%s): "
8697 (if gnus-last-search-regexp
8698 (concat ", default " gnus-last-search-regexp)
8700 (gnus-summary-search-article-forward regexp 'backward))
8703 (defmacro gnus-summary-search-article-position-point (regexp backward)
8704 "Dehighlight the last matched text and goto the beginning position."
8705 (` (if (and gnus-summary-search-article-matched-data
8706 (let ((text (caddr gnus-summary-search-article-matched-data))
8707 (inhibit-read-only t)
8710 (goto-char (car gnus-summary-search-article-matched-data))
8711 (cadr gnus-summary-search-article-matched-data))
8713 (string-match (, regexp) text)))
8714 (if (, backward) (beginning-of-line) (end-of-line))
8715 (goto-char (if (, backward) (point-max) (point-min))))))
8717 (defmacro gnus-summary-search-article-highlight-goto-x-face (opoint)
8718 "Place point where X-Face image is displayed."
8719 (if (featurep 'xemacs)
8720 (` (let ((end (if (search-forward "\n\n" nil t)
8721 (goto-char (1- (point)))
8724 (or (search-backward "\n\n" nil t) (goto-char (point-min)))
8725 (unless (and (re-search-forward "^From:" end t)
8726 (setq extent (extent-at (point)))
8727 (extent-begin-glyph extent))
8728 (goto-char (, opoint)))))
8729 (` (let ((end (if (search-forward "\n\n" nil t)
8730 (goto-char (1- (point)))
8732 (start (or (search-backward "\n\n" nil t) (point-min))))
8734 (or (text-property-any start end 'x-face-image t);; x-face-e21
8737 (defmacro gnus-summary-search-article-highlight-matched-text
8738 (backward treated x-face)
8739 "Highlight matched text in the function `gnus-summary-search-article'."
8740 (` (let ((start (set-marker (make-marker) (match-beginning 0)))
8741 (end (set-marker (make-marker) (match-end 0)))
8742 (inhibit-read-only t)
8746 (let ((items (mapcar 'car gnus-treatment-function-alist)))
8748 (lambda (item) (setq items (delq item items)))
8749 '(gnus-treat-buttonize
8750 gnus-treat-fill-article
8751 gnus-treat-fill-long-lines
8752 gnus-treat-emphasize
8753 gnus-treat-highlight-headers
8754 gnus-treat-highlight-citation
8755 gnus-treat-highlight-signature
8756 gnus-treat-overstrike
8757 gnus-treat-display-x-face
8758 gnus-treat-buttonize-head
8759 gnus-treat-decode-article-as-default-mime-charset))
8761 (gnus-treat-display-x-face
8762 (when (, x-face) gnus-treat-display-x-face)))
8763 (gnus-article-prepare-mime-display)))
8764 (goto-char (if (, backward) start end))
8766 (gnus-summary-search-article-highlight-goto-x-face (point)))
8767 (setq gnus-summary-search-article-matched-data
8768 (list start end (buffer-substring start end)))
8769 (unless (eq start end);; matched text has been deleted. :-<
8770 (put-text-property start end 'face
8771 (or (find-face 'isearch)
8772 'secondary-selection))))))
8775 (defun gnus-summary-search-article (regexp &optional backward)
8776 "Search for an article containing REGEXP.
8777 Optional argument BACKWARD means do search for backward.
8778 `gnus-select-article-hook' is not called during the search."
8779 ;; We have to require this here to make sure that the following
8780 ;; dynamic binding isn't shadowed by autoloading.
8781 (require 'gnus-async)
8783 (let ((gnus-select-article-hook nil) ;Disable hook.
8784 (gnus-article-prepare-hook nil)
8785 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8786 (gnus-use-article-prefetch nil)
8787 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8788 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8790 (gnus-keep-backlog nil)
8791 (gnus-break-pages nil)
8792 (gnus-summary-display-arrow nil)
8793 (gnus-updated-mode-lines nil)
8794 (gnus-auto-center-summary nil)
8795 (sum (current-buffer))
8798 (gnus-save-hidden-threads
8799 (static-if (featurep 'xemacs)
8800 (let ((gnus-inhibit-treatment t))
8801 (setq treated (eq 'old (gnus-summary-select-article)))
8803 (not (and (gnus-buffer-live-p gnus-article-buffer)
8804 (window-live-p (get-buffer-window
8805 gnus-article-buffer t)))))
8806 (gnus-summary-select-article nil t)
8807 (setq treated nil)))
8808 (let ((gnus-inhibit-treatment t))
8809 (setq treated (eq 'old (gnus-summary-select-article)))
8812 (and (gnus-buffer-live-p gnus-article-buffer)
8813 (window-live-p (get-buffer-window
8814 gnus-article-buffer t))
8815 (or (not (string-match "^\\^X-Face:" regexp))
8816 (with-current-buffer gnus-article-buffer
8817 gnus-summary-search-article-matched-data)))))
8818 (gnus-summary-select-article nil t)
8819 (setq treated nil))))
8820 (set-buffer gnus-article-buffer)
8824 (gnus-article-show-all-headers)
8825 (gnus-summary-search-article-position-point regexp backward))
8826 (goto-char (if backward (point-max) (point-min))))
8828 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8830 (re-search-backward regexp nil t)
8831 (re-search-forward regexp nil t))
8832 ;; We found the regexp.
8834 (gnus-summary-search-article-highlight-matched-text
8835 backward treated (string-match "^\\^X-Face:" regexp))
8838 (/ (- 2 (window-height
8839 (get-buffer-window gnus-article-buffer t)))
8842 (get-buffer-window (current-buffer))
8845 (setq point (point)))
8846 ;; We didn't find it, so we go to the next article.
8849 (while (eq found 'not)
8850 (if (not (if backward (gnus-summary-find-prev)
8851 (gnus-summary-find-next)))
8852 ;; No more articles.
8854 ;; Select the next article and adjust point.
8855 (unless (gnus-summary-article-sparse-p
8856 (gnus-summary-article-number))
8858 (let ((gnus-inhibit-treatment t))
8859 (gnus-summary-select-article))
8861 (set-buffer gnus-article-buffer)
8863 (goto-char (if backward (point-max) (point-min))))))))
8864 (gnus-message 7 ""))
8865 ;; Return whether we found the regexp.
8866 (when (eq found 'found)
8868 (gnus-summary-show-thread)
8869 (gnus-summary-goto-subject gnus-current-article)
8870 (gnus-summary-position-point)
8873 (defun gnus-find-matching-articles (header regexp)
8874 "Return a list of all articles that match REGEXP on HEADER.
8875 This search includes all articles in the current group that Gnus has
8876 fetched headers for, whether they are displayed or not."
8877 (let ((articles nil)
8878 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8879 (case-fold-search t))
8880 (dolist (header gnus-newsgroup-headers)
8881 (when (string-match regexp (funcall func header))
8882 (push (mail-header-number header) articles)))
8883 (nreverse articles)))
8885 (defun gnus-summary-find-matching (header regexp &optional backward unread
8886 not-case-fold not-matching)
8887 "Return a list of all articles that match REGEXP on HEADER.
8888 The search stars on the current article and goes forwards unless
8889 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8890 If UNREAD is non-nil, only unread articles will
8891 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8892 in the comparisons. If NOT-MATCHING, return a list of all articles that
8893 not match REGEXP on HEADER."
8894 (let ((case-fold-search (not not-case-fold))
8897 (if (eq (car header) 'extra)
8900 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8902 (error "%s is an invalid header" header))
8903 (unless (fboundp (intern (concat "mail-header-" header)))
8904 (error "%s is not a valid header" header))
8905 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8906 (dolist (d (if (eq backward 'all)
8908 (gnus-data-find-list
8909 (gnus-summary-article-number)
8910 (gnus-data-list backward))))
8911 (when (and (or (not unread) ; We want all articles...
8912 (gnus-data-unread-p d)) ; Or just unreads.
8913 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8917 (funcall func (gnus-data-header d))))
8918 (string-match regexp
8919 (funcall func (gnus-data-header d)))))
8920 (push (gnus-data-number d) articles))) ; Success!
8921 (nreverse articles)))
8923 (defun gnus-summary-execute-command (header regexp command &optional backward)
8924 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8925 If HEADER is an empty string (or nil), the match is done on the entire
8926 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8928 (list (let ((completion-ignore-case t))
8931 (mapcar (lambda (header) (list (format "%s" header)))
8933 '("Number" "Subject" "From" "Lines" "Date"
8934 "Message-ID" "Xref" "References" "Body")
8935 gnus-extra-headers))
8936 nil 'require-match))
8937 (read-string "Regexp: ")
8938 (read-key-sequence "Command: ")
8939 current-prefix-arg))
8940 (when (equal header "Body")
8942 ;; Hidden thread subtrees must be searched as well.
8943 (gnus-summary-show-all-threads)
8944 ;; We don't want to change current point nor window configuration.
8946 (save-window-excursion
8948 gnus-treat-strip-trailing-blank-lines
8949 gnus-treat-strip-leading-blank-lines
8950 gnus-treat-strip-multiple-blank-lines
8951 gnus-treat-hide-boring-headers
8952 gnus-treat-fold-newsgroups
8953 gnus-article-prepare-hook)
8954 (gnus-message 6 "Executing %s..." (key-description command))
8955 ;; We'd like to execute COMMAND interactively so as to give arguments.
8956 (gnus-execute header regexp
8957 `(call-interactively ',(key-binding command))
8959 (gnus-message 6 "Executing %s...done" (key-description command))))))
8961 (defun gnus-summary-beginning-of-article ()
8962 "Scroll the article back to the beginning."
8964 (gnus-summary-select-article)
8965 (gnus-configure-windows 'article)
8966 (gnus-eval-in-buffer-window gnus-article-buffer
8968 (goto-char (point-min))
8969 (when gnus-break-pages
8970 (gnus-narrow-to-page))))
8972 (defun gnus-summary-end-of-article ()
8973 "Scroll to the end of the article."
8975 (gnus-summary-select-article)
8976 (gnus-configure-windows 'article)
8977 (gnus-eval-in-buffer-window gnus-article-buffer
8979 (goto-char (point-max))
8981 (when gnus-break-pages
8982 (when (re-search-backward page-delimiter nil t)
8983 (narrow-to-region (match-end 0) (point-max)))
8984 (gnus-narrow-to-page))))
8986 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8987 "Truncate to LEN and quote all \"(\"'s in STRING."
8988 (gnus-replace-in-string (if (and len (> (length string) len))
8989 (substring string 0 len)
8993 (defun gnus-summary-print-article (&optional filename n)
8994 "Generate and print a PostScript image of the process-marked (mail) articles.
8996 If used interactively, print the current article if none are
8997 process-marked. With prefix arg, prompt the user for the name of the
9000 When used from Lisp, accept two optional args FILENAME and N. N means
9001 to print the next N articles. If N is negative, print the N previous
9002 articles. If N is nil and articles have been marked with the process
9003 mark, print these instead.
9005 If the optional first argument FILENAME is nil, send the image to the
9006 printer. If FILENAME is a string, save the PostScript image in a file with
9007 that name. If FILENAME is a number, prompt the user for the name of the file
9009 (interactive (list (ps-print-preprint current-prefix-arg)))
9010 (dolist (article (gnus-summary-work-articles n))
9011 (gnus-summary-select-article nil nil 'pseudo article)
9012 (gnus-eval-in-buffer-window gnus-article-buffer
9013 (gnus-print-buffer))
9014 (gnus-summary-remove-process-mark article))
9015 (ps-despool filename))
9017 (defun gnus-print-buffer ()
9018 (let ((buffer (generate-new-buffer " *print*")))
9021 (copy-to-buffer buffer (point-min) (point-max))
9023 (gnus-remove-text-with-property 'gnus-decoration)
9024 (when (gnus-visual-p 'article-highlight 'highlight)
9025 ;; Copy-to-buffer doesn't copy overlay. So redo
9027 (let ((gnus-article-buffer buffer))
9028 (gnus-article-highlight-citation t)
9029 (gnus-article-highlight-signature)
9030 (gnus-article-emphasize)
9031 (gnus-article-delete-invisible-text)))
9032 (let ((ps-left-header
9035 (gnus-summary-print-truncate-and-quote
9036 (mail-header-subject gnus-current-headers)
9039 (gnus-summary-print-truncate-and-quote
9040 (mail-header-from gnus-current-headers)
9044 "/pagenumberstring load"
9046 (mail-header-date gnus-current-headers) ")"))))
9047 (gnus-run-hooks 'gnus-ps-print-hook)
9050 (ps-spool-buffer-with-faces)
9051 (ps-spool-buffer)))))
9052 (kill-buffer buffer))))
9054 (defun gnus-summary-show-article (&optional arg)
9055 "Force redisplaying of the current article.
9056 If ARG (the prefix) is a number, show the article with the charset
9057 defined in `gnus-summary-show-article-charset-alist', or the charset
9059 If ARG (the prefix) is non-nil and not a number, show the raw article
9060 without any article massaging functions being run. Normally, the key
9061 strokes are `C-u g'."
9065 (gnus-summary-show-article t)
9066 (let* ((gnus-newsgroup-charset
9067 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9068 (mm-read-coding-system
9069 "View as charset: " ;; actually it is coding system.
9070 (with-current-buffer gnus-article-buffer
9071 (mm-detect-coding-region (point) (point-max))))))
9072 (default-mime-charset gnus-newsgroup-charset)
9073 (gnus-newsgroup-ignored-charsets 'gnus-all))
9074 (gnus-summary-select-article nil 'force)
9075 (let ((deps gnus-newsgroup-dependencies)
9078 (set-buffer gnus-original-article-buffer)
9080 (message-narrow-to-head)
9081 (setq head (buffer-string))
9082 (goto-char (point-min))
9083 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9084 (goto-char (point-max))
9086 (setq lines (1- (count-lines (point) (point-max))))))
9088 (insert (format "211 %d Article retrieved.\n"
9089 (cdr gnus-article-current)))
9091 (if lines (insert (format "Lines: %d\n" lines)))
9093 (let ((nntp-server-buffer (current-buffer)))
9094 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9095 (gnus-data-set-header
9096 (gnus-data-find (cdr gnus-article-current))
9098 (gnus-summary-update-article-line
9099 (cdr gnus-article-current) header)
9100 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9101 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9103 ;; Select the article the normal way.
9104 (gnus-summary-select-article nil 'force))
9106 ;; We have to require this here to make sure that the following
9107 ;; dynamic binding isn't shadowed by autoloading.
9108 (require 'gnus-async)
9110 ;; Bind the article treatment functions to nil.
9111 (let ((gnus-have-all-headers t)
9112 gnus-article-prepare-hook
9113 gnus-article-decode-hook
9116 (gnus-inhibit-treatment t))
9117 (gnus-summary-select-article nil 'force))))
9118 (gnus-summary-goto-subject gnus-current-article)
9119 (gnus-summary-position-point))
9121 (defun gnus-summary-show-raw-article ()
9122 "Show the raw article without any article massaging functions being run."
9124 (gnus-summary-show-article t))
9126 (defun gnus-summary-verbose-headers (&optional arg)
9127 "Toggle permanent full header display.
9128 If ARG is a positive number, turn header display on.
9129 If ARG is a negative number, turn header display off."
9131 (setq gnus-show-all-headers
9132 (cond ((or (not (numberp arg))
9134 (not gnus-show-all-headers))
9137 (gnus-summary-show-article))
9139 (defun gnus-summary-toggle-header (&optional arg)
9140 "Show the headers if they are hidden, or hide them if they are shown.
9141 If ARG is a positive number, show the entire header.
9142 If ARG is a negative number, hide the unwanted header lines."
9144 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9145 (get-buffer-window gnus-article-buffer t))))
9146 (with-current-buffer gnus-article-buffer
9148 (article-narrow-to-head)
9149 (let* ((buffer-read-only nil)
9150 (inhibit-point-motion-hooks t)
9151 (hidden (if (numberp arg)
9153 (or (not (looking-at "[^ \t\n]+:"))
9154 (gnus-article-hidden-text-p 'headers))))
9156 (delete-region (point-min) (point-max))
9157 (with-current-buffer gnus-original-article-buffer
9158 (goto-char (setq s (point-min)))
9159 (setq e (if (search-forward "\n\n" nil t)
9162 (insert-buffer-substring gnus-original-article-buffer s e)
9163 ;; In T-gnus, gnus-article-decode-hook doesn't contain
9164 ;; article-decode-encoded-words by default.
9165 (article-decode-encoded-words)
9166 (run-hooks 'gnus-article-decode-hook)
9168 (let ((gnus-treat-hide-headers nil)
9169 (gnus-treat-hide-boring-headers nil))
9170 (gnus-delete-wash-type 'headers)
9171 (gnus-treat-article 'head))
9172 (gnus-treat-article 'head))
9175 (set-window-start window (goto-char (point-min))))
9176 (if gnus-break-pages
9177 (gnus-narrow-to-page)
9178 (when (gnus-visual-p 'page-marker)
9179 (let ((buffer-read-only nil))
9180 (gnus-remove-text-with-property 'gnus-prev)
9181 (gnus-remove-text-with-property 'gnus-next))))
9182 (gnus-set-mode-line 'article)))))
9184 (defun gnus-summary-show-all-headers ()
9185 "Make all header lines visible."
9187 (gnus-summary-toggle-header 1))
9189 (defun gnus-summary-toggle-mime (&optional arg)
9190 "Toggle MIME processing.
9191 If ARG is a positive number, turn MIME processing on."
9193 (setq gnus-show-mime
9195 (not gnus-show-mime)
9196 (> (prefix-numeric-value arg) 0)))
9197 (gnus-summary-select-article t 'force))
9199 (defun gnus-summary-caesar-message (&optional arg)
9200 "Caesar rotate the current article by 13.
9201 The numerical prefix specifies how many places to rotate each letter
9204 (gnus-summary-select-article)
9205 (let ((mail-header-separator ""))
9206 (gnus-eval-in-buffer-window gnus-article-buffer
9209 (let ((start (window-start))
9211 (message-caesar-buffer-body arg)
9212 (set-window-start (get-buffer-window (current-buffer)) start)))))
9213 ;; Create buttons and stuff...
9214 (gnus-treat-article nil))
9216 (defun gnus-summary-idna-message (&optional arg)
9217 "Decode IDNA encoded domain names in the current articles.
9218 IDNA encoded domain names looks like `xn--bar'. If a string
9219 remain unencoded after running this function, it is likely an
9220 invalid IDNA string (`xn--bar' is invalid).
9222 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9223 installed for this command to work."
9225 (if (not (and (condition-case nil (require 'idna)
9227 (mm-coding-system-p 'utf-8)
9228 (executable-find (symbol-value 'idna-program))))
9230 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9231 (gnus-summary-select-article)
9232 (let ((mail-header-separator ""))
9233 (gnus-eval-in-buffer-window gnus-article-buffer
9236 (let ((start (window-start))
9238 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9239 (replace-match (idna-to-unicode (match-string 1))))
9240 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9242 (autoload 'unmorse-region "morse"
9243 "Convert morse coded text in region to ordinary ASCII text."
9246 (defun gnus-summary-morse-message (&optional arg)
9247 "Morse decode the current article."
9249 (gnus-summary-select-article)
9250 (let ((mail-header-separator ""))
9251 (gnus-eval-in-buffer-window gnus-article-buffer
9255 (let ((pos (window-start))
9257 (goto-char (point-min))
9258 (when (message-goto-body)
9259 (gnus-narrow-to-body))
9260 (goto-char (point-min))
9261 (while (search-forward "·" (point-max) t)
9262 (replace-match "."))
9263 (unmorse-region (point-min) (point-max))
9265 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9267 (defun gnus-summary-stop-page-breaking ()
9268 "Stop page breaking in the current article."
9270 (gnus-summary-select-article)
9271 (gnus-eval-in-buffer-window gnus-article-buffer
9273 (when (gnus-visual-p 'page-marker)
9274 (let ((buffer-read-only nil))
9275 (gnus-remove-text-with-property 'gnus-prev)
9276 (gnus-remove-text-with-property 'gnus-next))
9277 (setq gnus-page-broken nil))))
9279 (defun gnus-summary-move-article (&optional n to-newsgroup
9280 select-method action)
9281 "Move the current article to a different newsgroup.
9282 If N is a positive number, move the N next articles.
9283 If N is a negative number, move the N previous articles.
9284 If N is nil and any articles have been marked with the process mark,
9285 move those articles instead.
9286 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9287 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9288 re-spool using this method.
9290 When called interactively with TO-NEWSGROUP being nil, the value of
9291 the variable `gnus-move-split-methods' is used for finding a default
9292 for the target newsgroup.
9294 For this function to work, both the current newsgroup and the
9295 newsgroup that you want to move to have to support the `request-move'
9296 and `request-accept' functions.
9298 ACTION can be either `move' (the default), `crosspost' or `copy'."
9301 (setq action 'move))
9302 ;; Check whether the source group supports the required functions.
9303 (cond ((and (eq action 'move)
9304 (not (gnus-check-backend-function
9305 'request-move-article gnus-newsgroup-name)))
9306 (error "The current group does not support article moving"))
9307 ((and (eq action 'crosspost)
9308 (not (gnus-check-backend-function
9309 'request-replace-article gnus-newsgroup-name)))
9310 (error "The current group does not support article editing")))
9311 (let ((articles (gnus-summary-work-articles n))
9312 (prefix (if (gnus-check-backend-function
9313 'request-move-article gnus-newsgroup-name)
9314 (funcall gnus-move-group-prefix-function
9315 gnus-newsgroup-name)
9317 (names '((move "Move" "Moving")
9318 (copy "Copy" "Copying")
9319 (crosspost "Crosspost" "Crossposting")))
9320 (copy-buf (save-excursion
9321 (nnheader-set-temp-buffer " *copy article*")))
9322 art-group to-method new-xref article to-groups articles-to-update-marks)
9323 (unless (assq action names)
9324 (error "Unknown action %s" action))
9325 ;; Read the newsgroup name.
9326 (when (and (not to-newsgroup)
9327 (not select-method))
9328 (if (and gnus-move-split-methods
9330 (and (memq gnus-current-article articles)
9331 (gnus-buffer-live-p gnus-original-article-buffer))))
9332 ;; When `gnus-move-split-methods' is non-nil, we have to
9333 ;; select an article to give `gnus-read-move-group-name' an
9334 ;; opportunity to suggest an appropriate default. However,
9335 ;; we needn't render or mark the article.
9336 (let ((gnus-display-mime-function nil)
9337 (gnus-article-prepare-hook nil)
9338 (gnus-mark-article-hook nil))
9339 (gnus-summary-select-article nil nil nil (car articles))))
9341 (gnus-read-move-group-name
9342 (cadr (assq action names))
9343 (symbol-value (intern (format "gnus-current-%s-group" action)))
9345 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9346 (setq to-method (or select-method
9347 (gnus-server-to-method
9348 (gnus-group-method to-newsgroup))))
9349 ;; Check the method we are to move this article to...
9350 (unless (gnus-check-backend-function
9351 'request-accept-article (car to-method))
9352 (error "%s does not support article copying" (car to-method)))
9353 (unless (gnus-check-server to-method)
9354 (error "Can't open server %s" (car to-method)))
9355 (gnus-message 6 "%s to %s: %s..."
9356 (caddr (assq action names))
9357 (or (car select-method) to-newsgroup) articles)
9359 (setq article (pop articles))
9363 ;; Move the article.
9365 ;; Remove this article from future suppression.
9366 (gnus-dup-unsuppress-article article)
9367 (let* ((from-method (gnus-find-method-for-group
9368 gnus-newsgroup-name))
9369 (to-method (gnus-find-method-for-group
9371 (move-is-internal (gnus-method-equal from-method to-method)))
9372 (gnus-request-move-article
9373 article ; Article to move
9374 gnus-newsgroup-name ; From newsgroup
9375 (nth 1 (gnus-find-method-for-group
9376 gnus-newsgroup-name)) ; Server
9377 (list 'gnus-request-accept-article
9378 to-newsgroup (list 'quote select-method)
9379 (not articles) t) ; Accept form
9380 (not articles) ; Only save nov last time
9381 move-is-internal))) ; is this move internal?
9382 ;; Copy the article.
9385 (set-buffer copy-buf)
9386 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9388 (nnheader-narrow-to-headers)
9389 (dolist (hdr gnus-copy-article-ignored-headers)
9390 (message-remove-header hdr t)))
9391 (gnus-request-accept-article
9392 to-newsgroup select-method (not articles) t))))
9393 ;; Crosspost the article.
9394 ((eq action 'crosspost)
9395 (let ((xref (message-tokenize-header
9396 (mail-header-xref (gnus-summary-article-header article))
9398 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9399 ":" (number-to-string article)))
9401 (setq xref (list (system-name))))
9404 (mapconcat 'identity
9405 (delete "Xref:" (delete new-xref xref))
9409 (set-buffer copy-buf)
9410 ;; First put the article in the destination group.
9411 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9412 (when (consp (setq art-group
9413 (gnus-request-accept-article
9414 to-newsgroup select-method (not articles))))
9415 (setq new-xref (concat new-xref " " (car art-group)
9417 (number-to-string (cdr art-group))))
9418 ;; Now we have the new Xrefs header, so we insert
9419 ;; it and replace the new article.
9420 (nnheader-replace-header "Xref" new-xref)
9421 (gnus-request-replace-article
9422 (cdr art-group) to-newsgroup (current-buffer))
9426 (gnus-message 1 "Couldn't %s article %s: %s"
9427 (cadr (assq action names)) article
9428 (nnheader-get-report (car to-method))))
9429 ((eq art-group 'junk)
9430 (when (eq action 'move)
9431 (gnus-summary-mark-article article gnus-canceled-mark)
9432 (gnus-message 4 "Deleted article %s" article)
9433 ;; run the delete hook
9434 (run-hook-with-args 'gnus-summary-article-delete-hook
9437 (assoc article (gnus-data-list nil)))
9438 gnus-newsgroup-name nil
9441 (let* ((pto-group (gnus-group-prefixed-name
9442 (car art-group) to-method))
9443 (info (gnus-get-info pto-group))
9444 (to-group (gnus-info-group info))
9446 ;; Update the group that has been moved to.
9448 (memq action '(move copy)))
9449 (unless (member to-group to-groups)
9450 (push to-group to-groups))
9452 (unless (memq article gnus-newsgroup-unreads)
9453 (push 'read to-marks)
9455 info (gnus-add-to-range (gnus-info-read info)
9456 (list (cdr art-group)))))
9458 ;; See whether the article is to be put in the cache.
9459 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9460 gnus-article-mark-lists
9461 (delete '(expirable . expire)
9462 (copy-sequence gnus-article-mark-lists))))
9463 (to-article (cdr art-group)))
9465 ;; Enter the article into the cache in the new group,
9466 ;; if that is required.
9467 (when gnus-use-cache
9468 (gnus-cache-possibly-enter-article
9470 (let ((header (copy-sequence
9471 (gnus-summary-article-header article))))
9472 (mail-header-set-number header to-article)
9474 (memq article gnus-newsgroup-marked)
9475 (memq article gnus-newsgroup-dormant)
9476 (memq article gnus-newsgroup-unreads)))
9478 (when gnus-preserve-marks
9479 ;; Copy any marks over to the new group.
9480 (when (and (equal to-group gnus-newsgroup-name)
9481 (not (memq article gnus-newsgroup-unreads)))
9482 ;; Mark this article as read in this group.
9483 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9484 (setcdr (gnus-active to-group) to-article)
9485 (setcdr gnus-newsgroup-active to-article))
9488 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9489 (when (memq article (symbol-value
9490 (intern (format "gnus-newsgroup-%s"
9492 (push (cdar marks) to-marks)
9493 ;; If the other group is the same as this group,
9494 ;; then we have to add the mark to the list.
9495 (when (equal to-group gnus-newsgroup-name)
9496 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9499 (intern (format "gnus-newsgroup-%s"
9501 ;; Copy the marks to other group.
9502 (gnus-add-marked-articles
9503 to-group (cdar marks) (list to-article) info)))
9504 (setq marks (cdr marks)))
9506 (gnus-request-set-mark
9507 to-group (list (list (list to-article) 'add to-marks))))
9510 (concat "(gnus-group-set-info '"
9511 (gnus-prin1-to-string (gnus-get-info to-group))
9514 ;; Update the Xref header in this article to point to
9515 ;; the new crossposted article we have just created.
9516 (when (eq action 'crosspost)
9518 (set-buffer copy-buf)
9519 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9520 (nnheader-replace-header "Xref" new-xref)
9521 (gnus-request-replace-article
9522 article gnus-newsgroup-name (current-buffer))))
9524 ;; run the move/copy/crosspost/respool hook
9525 (run-hook-with-args 'gnus-summary-article-move-hook
9528 (assoc article (gnus-data-list nil)))
9533 ;;;!!!Why is this necessary?
9534 (set-buffer gnus-summary-buffer)
9536 (gnus-summary-goto-subject article)
9537 (when (eq action 'move)
9538 (gnus-summary-mark-article article gnus-canceled-mark))))
9539 (push article articles-to-update-marks))
9541 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9542 ;; Re-activate all groups that have been moved to.
9544 (set-buffer gnus-group-buffer)
9545 (let ((gnus-group-marked to-groups))
9546 (gnus-group-get-new-news-this-group nil t)))
9548 (gnus-kill-buffer copy-buf)
9549 (gnus-summary-position-point)
9550 (gnus-set-mode-line 'summary)))
9552 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9553 "Copy the current article to some other group.
9554 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9555 When called interactively, if TO-NEWSGROUP is nil, use the value of
9556 the variable `gnus-move-split-methods' for finding a default target
9558 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9559 re-spool using this method."
9561 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9563 (defun gnus-summary-crosspost-article (&optional n)
9564 "Crosspost the current article to some other group."
9566 (gnus-summary-move-article n nil nil 'crosspost))
9568 (defcustom gnus-summary-respool-default-method nil
9569 "Default method type for respooling an article.
9570 If nil, use to the current newsgroup method."
9572 :group 'gnus-summary-mail)
9574 (defcustom gnus-summary-display-while-building nil
9575 "If non-nil, show and update the summary buffer as it's being built.
9576 If the value is t, update the buffer after every line is inserted. If
9577 the value is an integer (N), update the display every N lines."
9580 :type '(choice (const :tag "off" nil)
9582 (const :tag "frequently" t)))
9584 (defun gnus-summary-respool-article (&optional n method)
9585 "Respool the current article.
9586 The article will be squeezed through the mail spooling process again,
9587 which means that it will be put in some mail newsgroup or other
9588 depending on `nnmail-split-methods'.
9589 If N is a positive number, respool the N next articles.
9590 If N is a negative number, respool the N previous articles.
9591 If N is nil and any articles have been marked with the process mark,
9592 respool those articles instead.
9594 Respooling can be done both from mail groups and \"real\" newsgroups.
9595 In the former case, the articles in question will be moved from the
9596 current group into whatever groups they are destined to. In the
9597 latter case, they will be copied into the relevant groups."
9599 (list current-prefix-arg
9600 (let* ((methods (gnus-methods-using 'respool))
9602 (symbol-name (or gnus-summary-respool-default-method
9603 (car (gnus-find-method-for-group
9604 gnus-newsgroup-name)))))
9606 (gnus-completing-read-with-default
9607 methname "Backend to use when respooling"
9608 methods nil t nil 'gnus-mail-method-history))
9611 ((zerop (length (setq ms (gnus-servers-using-backend
9613 (list (intern method) ""))
9617 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9618 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9621 (error "No method given for respooling"))
9622 (if (assoc (symbol-name
9623 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9624 (gnus-methods-using 'respool))
9625 (gnus-summary-move-article n nil method)
9626 (gnus-summary-copy-article n nil method)))
9628 (defun gnus-summary-import-article (file &optional edit)
9629 "Import an arbitrary file into a mail newsgroup."
9630 (interactive "fImport file: \nP")
9631 (let ((group gnus-newsgroup-name)
9632 (now (current-time))
9633 atts lines group-art)
9634 (unless (gnus-check-backend-function 'request-accept-article group)
9635 (error "%s does not support article importing" group))
9636 (or (file-readable-p file)
9637 (not (file-regular-p file))
9638 (error "Can't read %s" file))
9640 (set-buffer (gnus-get-buffer-create " *import file*"))
9642 (nnheader-insert-file-contents file)
9643 (goto-char (point-min))
9644 (if (nnheader-article-p)
9646 (goto-char (point-min))
9647 (search-forward "\n\n" nil t)
9648 (narrow-to-region (point-min) (1- (point)))
9649 (goto-char (point-min))
9650 (unless (re-search-forward "^date:" nil t)
9651 (goto-char (point-max))
9652 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9653 ;; This doesn't look like an article, so we fudge some headers.
9654 (setq atts (file-attributes file)
9655 lines (count-lines (point-min) (point-max)))
9656 (insert "From: " (read-string "From: ") "\n"
9657 "Subject: " (read-string "Subject: ") "\n"
9658 "Date: " (message-make-date (nth 5 atts)) "\n"
9659 "Message-ID: " (message-make-message-id) "\n"
9660 "Lines: " (int-to-string lines) "\n"
9661 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9662 (setq group-art (gnus-request-accept-article group nil t))
9663 (kill-buffer (current-buffer)))
9664 (setq gnus-newsgroup-active (gnus-activate-group group))
9666 (gnus-summary-goto-article (cdr group-art) nil t)
9668 (gnus-summary-edit-article))))
9670 (defun gnus-summary-create-article ()
9671 "Create an article in a mail newsgroup."
9673 (let ((group gnus-newsgroup-name)
9674 (now (current-time))
9676 (unless (gnus-check-backend-function 'request-accept-article group)
9677 (error "%s does not support article importing" group))
9679 (set-buffer (gnus-get-buffer-create " *import file*"))
9681 (goto-char (point-min))
9682 ;; This doesn't look like an article, so we fudge some headers.
9683 (insert "From: " (read-string "From: ") "\n"
9684 "Subject: " (read-string "Subject: ") "\n"
9685 "Date: " (message-make-date now) "\n"
9686 "Message-ID: " (message-make-message-id) "\n")
9687 (setq group-art (gnus-request-accept-article group nil t))
9688 (kill-buffer (current-buffer)))
9689 (setq gnus-newsgroup-active (gnus-activate-group group))
9691 (gnus-summary-goto-article (cdr group-art) nil t)
9692 (gnus-summary-edit-article)))
9694 (defun gnus-summary-article-posted-p ()
9695 "Say whether the current (mail) article is available from news as well.
9696 This will be the case if the article has both been mailed and posted."
9698 (let ((id (mail-header-references (gnus-summary-article-header)))
9699 (gnus-override-method (car (gnus-refer-article-methods))))
9700 (if (gnus-request-head id "")
9701 (gnus-message 2 "The current message was found on %s"
9702 gnus-override-method)
9703 (gnus-message 2 "The current message couldn't be found on %s"
9704 gnus-override-method)
9707 (defun gnus-summary-expire-articles (&optional now)
9708 "Expire all articles that are marked as expirable in the current group."
9710 (when (and (not gnus-group-is-exiting-without-update-p)
9711 (gnus-check-backend-function
9712 'request-expire-articles gnus-newsgroup-name))
9713 ;; This backend supports expiry.
9714 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9715 (expirable (if total
9717 ;; We need to update the info for
9718 ;; this group for `gnus-list-of-read-articles'
9719 ;; to give us the right answer.
9720 (gnus-run-hooks 'gnus-exit-group-hook)
9721 (gnus-summary-update-info)
9722 (gnus-list-of-read-articles gnus-newsgroup-name))
9723 (setq gnus-newsgroup-expirable
9724 (sort gnus-newsgroup-expirable '<))))
9725 (expiry-wait (if now 'immediate
9726 (gnus-group-find-parameter
9727 gnus-newsgroup-name 'expiry-wait)))
9728 (nnmail-expiry-target
9729 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9730 nnmail-expiry-target))
9733 ;; There are expirable articles in this group, so we run them
9734 ;; through the expiry process.
9735 (gnus-message 6 "Expiring articles...")
9736 (unless (gnus-check-group gnus-newsgroup-name)
9737 (error "Can't open server for %s" gnus-newsgroup-name))
9738 ;; The list of articles that weren't expired is returned.
9741 (let ((nnmail-expiry-wait-function nil)
9742 (nnmail-expiry-wait expiry-wait))
9743 (setq es (gnus-request-expire-articles
9744 expirable gnus-newsgroup-name)))
9745 (setq es (gnus-request-expire-articles
9746 expirable gnus-newsgroup-name)))
9748 (setq gnus-newsgroup-expirable es))
9749 ;; We go through the old list of expirable, and mark all
9750 ;; really expired articles as nonexistent.
9751 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9752 (let ((gnus-use-cache nil))
9753 (dolist (article expirable)
9754 (when (and (not (memq article es))
9755 (gnus-data-find article))
9756 (gnus-summary-mark-article article gnus-canceled-mark)
9757 (run-hook-with-args 'gnus-summary-article-expire-hook
9760 (assoc article (gnus-data-list nil)))
9764 (gnus-message 6 "Expiring articles...done")))))
9766 (defun gnus-summary-expire-articles-now ()
9767 "Expunge all expirable articles in the current group.
9768 This means that *all* articles that are marked as expirable will be
9769 deleted forever, right now."
9771 (or gnus-expert-user
9773 "Are you really, really, really sure you want to delete all these messages? ")
9775 (gnus-summary-expire-articles t))
9777 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9778 (defun gnus-summary-delete-article (&optional n)
9779 "Delete the N next (mail) articles.
9780 This command actually deletes articles. This is not a marking
9781 command. The article will disappear forever from your life, never to
9784 If N is negative, delete backwards.
9785 If N is nil and articles have been marked with the process mark,
9786 delete these instead.
9788 If `gnus-novice-user' is non-nil you will be asked for
9789 confirmation before the articles are deleted."
9791 (unless (gnus-check-backend-function 'request-expire-articles
9792 gnus-newsgroup-name)
9793 (error "The current newsgroup does not support article deletion"))
9794 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9795 (error "Couldn't open server"))
9796 ;; Compute the list of articles to delete.
9797 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9798 (nnmail-expiry-target 'delete)
9800 (if (and gnus-novice-user
9801 (not (gnus-yes-or-no-p
9802 (format "Do you really want to delete %s forever? "
9803 (if (> (length articles) 1)
9804 (format "these %s articles" (length articles))
9807 ;; Delete the articles.
9808 (setq not-deleted (gnus-request-expire-articles
9809 articles gnus-newsgroup-name 'force))
9811 (gnus-summary-remove-process-mark (car articles))
9812 ;; The backend might not have been able to delete the article
9814 (unless (memq (car articles) not-deleted)
9815 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9816 (let* ((article (car articles))
9817 (ghead (gnus-data-header
9818 (assoc article (gnus-data-list nil)))))
9819 (run-hook-with-args 'gnus-summary-article-delete-hook
9820 'delete ghead gnus-newsgroup-name nil
9822 (setq articles (cdr articles)))
9824 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9825 (gnus-summary-position-point)
9826 (gnus-set-mode-line 'summary)
9829 (defun gnus-summary-edit-article (&optional force)
9830 "Edit the current article.
9831 This will have permanent effect only in mail groups.
9832 If FORCE is non-nil, allow editing of articles even in read-only
9836 (set-buffer gnus-summary-buffer)
9837 (let ((mail-parse-charset gnus-newsgroup-charset)
9838 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9839 (gnus-set-global-variables)
9840 (when (and (not force)
9841 (gnus-group-read-only-p))
9842 (error "The current newsgroup does not support article editing"))
9843 (gnus-summary-show-article t)
9844 (gnus-article-edit-article
9846 `(lambda (no-highlight)
9847 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9848 (message-options message-options)
9849 (message-options-set-recipient)
9850 (mail-parse-ignored-charsets
9851 ',gnus-newsgroup-ignored-charsets))
9852 (gnus-summary-edit-article-done
9853 ,(or (mail-header-references gnus-current-headers) "")
9854 ,(gnus-group-read-only-p) ,gnus-summary-buffer no-highlight)))))))
9856 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9858 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9860 "Make edits to the current article permanent."
9863 ;; The buffer restriction contains the entire article if it exists.
9864 (when (article-goto-body)
9865 (let ((lines (count-lines (point) (point-max)))
9866 (length (- (point-max) (point)))
9867 (case-fold-search t)
9868 (body (copy-marker (point))))
9869 (goto-char (point-min))
9870 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9871 (delete-region (match-beginning 1) (match-end 1))
9872 (insert (number-to-string length)))
9873 (goto-char (point-min))
9874 (when (re-search-forward
9875 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9876 (delete-region (match-beginning 1) (match-end 1))
9877 (insert (number-to-string length)))
9878 (goto-char (point-min))
9879 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9880 (delete-region (match-beginning 1) (match-end 1))
9881 (insert (number-to-string lines))))))
9882 ;; Replace the article.
9883 (let ((buf (current-buffer)))
9885 (insert-buffer-substring buf)
9887 (if (and (not read-only)
9888 (not (gnus-request-replace-article
9889 (cdr gnus-article-current) (car gnus-article-current)
9890 (current-buffer) t)))
9891 (error "Couldn't replace article")
9892 ;; Update the summary buffer.
9894 (equal (message-tokenize-header references " ")
9895 (message-tokenize-header
9896 (or (message-fetch-field "references") "") " ")))
9897 ;; We only have to update this line.
9900 (message-narrow-to-head)
9901 (let ((head (buffer-substring-no-properties
9902 (point-min) (point-max)))
9905 (insert (format "211 %d Article retrieved.\n"
9906 (cdr gnus-article-current)))
9909 (let ((nntp-server-buffer (current-buffer)))
9910 (setq header (car (gnus-get-newsgroup-headers
9913 (set-buffer gnus-summary-buffer)
9914 (gnus-data-set-header
9915 (gnus-data-find (cdr gnus-article-current))
9917 (gnus-summary-update-article-line
9918 (cdr gnus-article-current) header)
9919 (if (gnus-summary-goto-subject
9920 (cdr gnus-article-current) nil t)
9921 (gnus-summary-update-secondary-mark
9922 (cdr gnus-article-current))))))))
9924 (set-buffer (or buffer gnus-summary-buffer))
9925 (gnus-summary-update-article (cdr gnus-article-current))
9926 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9927 (gnus-summary-update-secondary-mark
9928 (cdr gnus-article-current))))
9929 ;; Prettify the article buffer again.
9930 (unless no-highlight
9932 (set-buffer gnus-article-buffer)
9933 ;;;!!! Fix this -- article should be rehighlighted.
9934 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9935 (set-buffer gnus-original-article-buffer)
9936 (gnus-request-article
9937 (cdr gnus-article-current)
9938 (car gnus-article-current) (current-buffer))))
9939 ;; Prettify the summary buffer line.
9940 (when (gnus-visual-p 'summary-highlight 'highlight)
9941 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9943 (defun gnus-summary-edit-wash (key)
9944 "Perform editing command KEY in the article buffer."
9948 (message "%s" (concat (this-command-keys) "- "))
9951 (gnus-summary-edit-article)
9952 (execute-kbd-macro (concat (this-command-keys) key))
9953 (gnus-article-edit-done))
9957 (defun gnus-summary-respool-query (&optional silent trace)
9958 "Query where the respool algorithm would put this article."
9960 (let (gnus-mark-article-hook)
9961 (gnus-summary-select-article)
9963 (set-buffer gnus-original-article-buffer)
9964 (let ((groups (nnmail-article-group 'identity trace)))
9967 (message "This message would go to %s"
9968 (mapconcat 'car groups ", "))
9969 (message "This message would go to no groups"))
9972 (defun gnus-summary-respool-trace ()
9973 "Trace where the respool algorithm would put this article.
9974 Display a buffer showing all fancy splitting patterns which matched."
9976 (gnus-summary-respool-query nil t))
9978 ;; Summary marking commands.
9980 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9981 "Mark articles which has the same subject as read, and then select the next.
9982 If UNMARK is positive, remove any kind of mark.
9983 If UNMARK is negative, tick articles."
9986 (setq unmark (prefix-numeric-value unmark)))
9988 (gnus-summary-mark-same-subject
9989 (gnus-summary-article-subject) unmark)))
9990 ;; Select next unread article. If auto-select-same mode, should
9991 ;; select the first unread article.
9992 (gnus-summary-next-article t (and gnus-auto-select-same
9993 (gnus-summary-article-subject)))
9994 (gnus-message 7 "%d article%s marked as %s"
9995 count (if (= count 1) " is" "s are")
9996 (if unmark "unread" "read"))))
9998 (defun gnus-summary-kill-same-subject (&optional unmark)
9999 "Mark articles which has the same subject as read.
10000 If UNMARK is positive, remove any kind of mark.
10001 If UNMARK is negative, tick articles."
10004 (setq unmark (prefix-numeric-value unmark)))
10006 (gnus-summary-mark-same-subject
10007 (gnus-summary-article-subject) unmark)))
10008 ;; If marked as read, go to next unread subject.
10009 (when (null unmark)
10010 ;; Go to next unread subject.
10011 (gnus-summary-next-subject 1 t))
10012 (gnus-message 7 "%d articles are marked as %s"
10013 count (if unmark "unread" "read"))))
10015 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10016 "Mark articles with same SUBJECT as read, and return marked number.
10017 If optional argument UNMARK is positive, remove any kinds of marks.
10018 If optional argument UNMARK is negative, mark articles as unread instead."
10022 ((null unmark) ; Mark as read.
10025 (gnus-summary-mark-article-as-read gnus-killed-mark)
10026 (gnus-summary-show-thread) t)
10027 (gnus-summary-find-subject subject))
10028 (setq count (1+ count))))
10029 ((> unmark 0) ; Tick.
10032 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10033 (gnus-summary-show-thread) t)
10034 (gnus-summary-find-subject subject))
10035 (setq count (1+ count))))
10036 (t ; Mark as unread.
10039 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10040 (gnus-summary-show-thread) t)
10041 (gnus-summary-find-subject subject))
10042 (setq count (1+ count)))))
10043 (gnus-set-mode-line 'summary)
10044 ;; Return the number of marked articles.
10047 (defun gnus-summary-mark-as-processable (n &optional unmark)
10048 "Set the process mark on the next N articles.
10049 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10050 the process mark instead. The difference between N and the actual
10051 number of articles marked is returned."
10053 (if (and (null n) (gnus-region-active-p))
10054 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10055 (setq n (prefix-numeric-value n))
10056 (let ((backward (< n 0))
10061 (gnus-summary-remove-process-mark
10062 (gnus-summary-article-number))
10063 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10064 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10067 (gnus-message 7 "No more articles"))
10068 (gnus-summary-recenter)
10069 (gnus-summary-position-point)
10072 (defun gnus-summary-unmark-as-processable (n)
10073 "Remove the process mark from the next N articles.
10074 If N is negative, unmark backward instead. The difference between N and
10075 the actual number of articles unmarked is returned."
10077 (gnus-summary-mark-as-processable n t))
10079 (defun gnus-summary-unmark-all-processable ()
10080 "Remove the process mark from all articles."
10083 (while gnus-newsgroup-processable
10084 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10085 (gnus-summary-position-point))
10087 (defun gnus-summary-add-mark (article type)
10088 "Mark ARTICLE with a mark of TYPE."
10089 (let ((vtype (car (assq type gnus-article-mark-lists)))
10092 (error "No such mark type: %s" type)
10093 (setq var (intern (format "gnus-newsgroup-%s" type)))
10094 (set var (cons article (symbol-value var)))
10095 (if (memq type '(processable cached replied forwarded recent saved))
10096 (gnus-summary-update-secondary-mark article)
10097 ;;; !!! This is bogus. We should find out what primary
10098 ;;; !!! mark we want to set.
10099 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10101 (defun gnus-summary-mark-as-expirable (n)
10102 "Mark N articles forward as expirable.
10103 If N is negative, mark backward instead. The difference between N and
10104 the actual number of articles marked is returned."
10106 (gnus-summary-mark-forward n gnus-expirable-mark))
10108 (defun gnus-summary-mark-as-spam (n)
10109 "Mark N articles forward as spam.
10110 If N is negative, mark backward instead. The difference between N and
10111 the actual number of articles marked is returned."
10113 (gnus-summary-mark-forward n gnus-spam-mark))
10115 (defun gnus-summary-mark-article-as-replied (article)
10116 "Mark ARTICLE as replied to and update the summary line.
10117 ARTICLE can also be a list of articles."
10118 (interactive (list (gnus-summary-article-number)))
10119 (let ((articles (if (listp article) article (list article))))
10120 (dolist (article articles)
10121 (unless (numberp article)
10122 (error "%s is not a number" article))
10123 (push article gnus-newsgroup-replied)
10124 (let ((buffer-read-only nil))
10125 (when (gnus-summary-goto-subject article nil t)
10126 (gnus-summary-update-secondary-mark article))))))
10128 (defun gnus-summary-mark-article-as-forwarded (article)
10129 "Mark ARTICLE as forwarded and update the summary line.
10130 ARTICLE can also be a list of articles."
10131 (let ((articles (if (listp article) article (list article))))
10132 (dolist (article articles)
10133 (push article gnus-newsgroup-forwarded)
10134 (let ((buffer-read-only nil))
10135 (when (gnus-summary-goto-subject article nil t)
10136 (gnus-summary-update-secondary-mark article))))))
10138 (defun gnus-summary-set-bookmark (article)
10139 "Set a bookmark in current article."
10140 (interactive (list (gnus-summary-article-number)))
10141 (when (or (not (get-buffer gnus-article-buffer))
10142 (not gnus-current-article)
10143 (not gnus-article-current)
10144 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10145 (error "No current article selected"))
10146 ;; Remove old bookmark, if one exists.
10147 (gnus-pull article gnus-newsgroup-bookmarks)
10148 ;; Set the new bookmark, which is on the form
10149 ;; (article-number . line-number-in-body).
10152 (with-current-buffer gnus-article-buffer
10156 (article-goto-body)
10159 gnus-newsgroup-bookmarks)
10160 (gnus-message 6 "A bookmark has been added to the current article."))
10162 (defun gnus-summary-remove-bookmark (article)
10163 "Remove the bookmark from the current article."
10164 (interactive (list (gnus-summary-article-number)))
10165 ;; Remove old bookmark, if one exists.
10166 (if (not (assq article gnus-newsgroup-bookmarks))
10167 (gnus-message 6 "No bookmark in current article.")
10168 (gnus-pull article gnus-newsgroup-bookmarks)
10169 (gnus-message 6 "Removed bookmark.")))
10171 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10172 (defun gnus-summary-mark-as-dormant (n)
10173 "Mark N articles forward as dormant.
10174 If N is negative, mark backward instead. The difference between N and
10175 the actual number of articles marked is returned."
10177 (gnus-summary-mark-forward n gnus-dormant-mark))
10179 (defun gnus-summary-set-process-mark (article)
10180 "Set the process mark on ARTICLE and update the summary line."
10181 (setq gnus-newsgroup-processable
10183 (delq article gnus-newsgroup-processable)))
10184 (when (gnus-summary-goto-subject article)
10185 (gnus-summary-show-thread)
10186 (gnus-summary-goto-subject article)
10187 (gnus-summary-update-secondary-mark article)))
10189 (defun gnus-summary-remove-process-mark (&rest articles)
10190 "Remove the process mark from ARTICLES and update the summary line."
10191 (dolist (article articles)
10192 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10193 (when (gnus-summary-goto-subject article)
10194 (gnus-summary-show-thread)
10195 (gnus-summary-goto-subject article)
10196 (gnus-summary-update-secondary-mark article)))
10199 (defun gnus-summary-set-saved-mark (article)
10200 "Set the process mark on ARTICLE and update the summary line."
10201 (push article gnus-newsgroup-saved)
10202 (when (gnus-summary-goto-subject article)
10203 (gnus-summary-update-secondary-mark article)))
10205 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10206 "Mark N articles as read forwards.
10207 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10208 The difference between N and the actual number of articles marked is
10210 If NO-EXPIRE, auto-expiry will be inhibited."
10212 (gnus-summary-show-thread)
10213 (let ((backward (< n 0))
10214 (gnus-summary-goto-unread
10215 (and gnus-summary-goto-unread
10216 (not (eq gnus-summary-goto-unread 'never))
10217 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10218 gnus-ticked-mark gnus-dormant-mark)))))
10220 (mark (or mark gnus-del-mark)))
10221 (while (and (> n 0)
10222 (gnus-summary-mark-article nil mark no-expire)
10223 (zerop (gnus-summary-next-subject
10225 (and gnus-summary-goto-unread
10226 (not (eq gnus-summary-goto-unread 'never)))
10230 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10231 (gnus-summary-recenter)
10232 (gnus-summary-position-point)
10233 (gnus-set-mode-line 'summary)
10236 (defun gnus-summary-mark-article-as-read (mark)
10237 "Mark the current article quickly as read with MARK."
10238 (let ((article (gnus-summary-article-number)))
10239 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10240 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10241 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10242 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10243 (push (cons article mark) gnus-newsgroup-reads)
10244 ;; Possibly remove from cache, if that is used.
10245 (when gnus-use-cache
10246 (gnus-cache-enter-remove-article article))
10247 ;; Allow the backend to change the mark.
10248 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10249 ;; Check for auto-expiry.
10250 (when (and gnus-newsgroup-auto-expire
10251 (memq mark gnus-auto-expirable-marks))
10252 (setq mark gnus-expirable-mark)
10253 ;; Let the backend know about the mark change.
10254 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10255 (push article gnus-newsgroup-expirable))
10256 ;; Set the mark in the buffer.
10257 (gnus-summary-update-mark mark 'unread)
10260 (defun gnus-summary-mark-article-as-unread (mark)
10261 "Mark the current article quickly as unread with MARK."
10262 (let* ((article (gnus-summary-article-number))
10263 (old-mark (gnus-summary-article-mark article)))
10264 ;; Allow the backend to change the mark.
10265 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10266 (if (eq mark old-mark)
10270 (gnus-error 1 "Can't mark negative article numbers")
10272 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10273 (setq gnus-newsgroup-spam-marked
10274 (delq article gnus-newsgroup-spam-marked))
10275 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10276 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10277 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10278 (cond ((= mark gnus-ticked-mark)
10279 (setq gnus-newsgroup-marked
10280 (gnus-add-to-sorted-list gnus-newsgroup-marked
10282 ((= mark gnus-spam-mark)
10283 (setq gnus-newsgroup-spam-marked
10284 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10286 ((= mark gnus-dormant-mark)
10287 (setq gnus-newsgroup-dormant
10288 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10291 (setq gnus-newsgroup-unreads
10292 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10294 (gnus-pull article gnus-newsgroup-reads)
10296 ;; See whether the article is to be put in the cache.
10297 (and gnus-use-cache
10298 (vectorp (gnus-summary-article-header article))
10300 (gnus-cache-possibly-enter-article
10301 gnus-newsgroup-name article
10302 (gnus-summary-article-header article)
10303 (= mark gnus-ticked-mark)
10304 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10307 (gnus-summary-update-mark mark 'unread)
10310 (defun gnus-summary-mark-article (&optional article mark no-expire)
10311 "Mark ARTICLE with MARK. MARK can be any character.
10312 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10313 `??' (dormant) and `?E' (expirable).
10314 If MARK is nil, then the default character `?r' is used.
10315 If ARTICLE is nil, then the article on the current line will be
10317 If NO-EXPIRE, auto-expiry will be inhibited."
10318 ;; The mark might be a string.
10319 (when (stringp mark)
10320 (setq mark (aref mark 0)))
10321 ;; If no mark is given, then we check auto-expiring.
10323 (setq mark gnus-del-mark))
10324 (when (and (not no-expire)
10325 gnus-newsgroup-auto-expire
10326 (memq mark gnus-auto-expirable-marks))
10327 (setq mark gnus-expirable-mark))
10328 (let ((article (or article (gnus-summary-article-number)))
10329 (old-mark (gnus-summary-article-mark article)))
10330 ;; Allow the backend to change the mark.
10331 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10332 (if (eq mark old-mark)
10335 (error "No article on current line"))
10336 (if (not (if (or (= mark gnus-unread-mark)
10337 (= mark gnus-ticked-mark)
10338 (= mark gnus-spam-mark)
10339 (= mark gnus-dormant-mark))
10340 (gnus-mark-article-as-unread article mark)
10341 (gnus-mark-article-as-read article mark)))
10343 ;; See whether the article is to be put in the cache.
10344 (and gnus-use-cache
10345 (not (= mark gnus-canceled-mark))
10346 (vectorp (gnus-summary-article-header article))
10348 (gnus-cache-possibly-enter-article
10349 gnus-newsgroup-name article
10350 (gnus-summary-article-header article)
10351 (= mark gnus-ticked-mark)
10352 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10354 (when (gnus-summary-goto-subject article nil t)
10355 (let ((buffer-read-only nil))
10356 (gnus-summary-show-thread)
10358 (gnus-summary-update-mark mark 'unread)
10361 (defun gnus-summary-update-secondary-mark (article)
10362 "Update the secondary (read, process, cache) mark."
10363 (gnus-summary-update-mark
10364 (cond ((memq article gnus-newsgroup-processable)
10366 ((memq article gnus-newsgroup-cached)
10368 ((memq article gnus-newsgroup-replied)
10370 ((memq article gnus-newsgroup-forwarded)
10371 gnus-forwarded-mark)
10372 ((memq article gnus-newsgroup-saved)
10374 ((memq article gnus-newsgroup-recent)
10376 ((memq article gnus-newsgroup-unseen)
10380 (when (gnus-visual-p 'summary-highlight 'highlight)
10381 (gnus-run-hooks 'gnus-summary-update-hook))
10384 (defun gnus-summary-update-download-mark (article)
10385 "Update the download mark."
10386 (gnus-summary-update-mark
10387 (cond ((memq article gnus-newsgroup-undownloaded)
10388 gnus-undownloaded-mark)
10389 (gnus-newsgroup-agentized
10390 gnus-downloaded-mark)
10394 (gnus-summary-update-line t)
10397 (defun gnus-summary-update-mark (mark type)
10398 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10399 (buffer-read-only nil))
10400 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10402 (when (looking-at "\r")
10404 (when (<= (+ forward (point)) (point-max))
10405 ;; Go to the right position on the line.
10406 (goto-char (+ forward (point)))
10407 ;; Replace the old mark with the new mark.
10408 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10409 ;; Optionally update the marks by some user rule.
10410 (when (eq type 'unread)
10411 (gnus-data-set-mark
10412 (gnus-data-find (gnus-summary-article-number)) mark)
10413 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10415 (defun gnus-mark-article-as-read (article &optional mark)
10416 "Enter ARTICLE in the pertinent lists and remove it from others."
10417 ;; Make the article expirable.
10418 (let ((mark (or mark gnus-del-mark)))
10419 (setq gnus-newsgroup-expirable
10420 (if (= mark gnus-expirable-mark)
10421 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10422 (delq article gnus-newsgroup-expirable)))
10423 ;; Remove from unread and marked lists.
10424 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10425 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10426 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10427 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10428 (push (cons article mark) gnus-newsgroup-reads)
10429 ;; Possibly remove from cache, if that is used.
10430 (when gnus-use-cache
10431 (gnus-cache-enter-remove-article article))
10434 (defun gnus-mark-article-as-unread (article &optional mark)
10435 "Enter ARTICLE in the pertinent lists and remove it from others."
10436 (let ((mark (or mark gnus-ticked-mark)))
10439 (gnus-error 1 "Can't mark negative article numbers")
10441 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10442 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10443 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10444 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10445 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10447 ;; Unsuppress duplicates?
10448 (when gnus-suppress-duplicates
10449 (gnus-dup-unsuppress-article article))
10451 (cond ((= mark gnus-ticked-mark)
10452 (setq gnus-newsgroup-marked
10453 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10454 ((= mark gnus-spam-mark)
10455 (setq gnus-newsgroup-spam-marked
10456 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10458 ((= mark gnus-dormant-mark)
10459 (setq gnus-newsgroup-dormant
10460 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10462 (setq gnus-newsgroup-unreads
10463 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10464 (gnus-pull article gnus-newsgroup-reads)
10467 (defalias 'gnus-summary-mark-as-unread-forward
10468 'gnus-summary-tick-article-forward)
10469 (make-obsolete 'gnus-summary-mark-as-unread-forward
10470 'gnus-summary-tick-article-forward)
10471 (defun gnus-summary-tick-article-forward (n)
10472 "Tick N articles forwards.
10473 If N is negative, tick backwards instead.
10474 The difference between N and the number of articles ticked is returned."
10476 (gnus-summary-mark-forward n gnus-ticked-mark))
10478 (defalias 'gnus-summary-mark-as-unread-backward
10479 'gnus-summary-tick-article-backward)
10480 (make-obsolete 'gnus-summary-mark-as-unread-backward
10481 'gnus-summary-tick-article-backward)
10482 (defun gnus-summary-tick-article-backward (n)
10483 "Tick N articles backwards.
10484 The difference between N and the number of articles ticked is returned."
10486 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10488 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10489 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10490 (defun gnus-summary-tick-article (&optional article clear-mark)
10491 "Mark current article as unread.
10492 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10493 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10495 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10496 gnus-ticked-mark)))
10498 (defun gnus-summary-mark-as-read-forward (n)
10499 "Mark N articles as read forwards.
10500 If N is negative, mark backwards instead.
10501 The difference between N and the actual number of articles marked is
10504 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10506 (defun gnus-summary-mark-as-read-backward (n)
10507 "Mark the N articles as read backwards.
10508 The difference between N and the actual number of articles marked is
10511 (gnus-summary-mark-forward
10512 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10514 (defun gnus-summary-mark-as-read (&optional article mark)
10515 "Mark current article as read.
10516 ARTICLE specifies the article to be marked as read.
10517 MARK specifies a string to be inserted at the beginning of the line."
10518 (gnus-summary-mark-article article mark))
10520 (defun gnus-summary-clear-mark-forward (n)
10521 "Clear marks from N articles forward.
10522 If N is negative, clear backward instead.
10523 The difference between N and the number of marks cleared is returned."
10525 (gnus-summary-mark-forward n gnus-unread-mark))
10527 (defun gnus-summary-clear-mark-backward (n)
10528 "Clear marks from N articles backward.
10529 The difference between N and the number of marks cleared is returned."
10531 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10533 (defun gnus-summary-mark-unread-as-read ()
10534 "Intended to be used by `gnus-summary-mark-article-hook'."
10535 (when (memq gnus-current-article gnus-newsgroup-unreads)
10536 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10538 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10539 "Intended to be used by `gnus-summary-mark-article-hook'."
10540 (let ((mark (gnus-summary-article-mark)))
10541 (when (or (gnus-unread-mark-p mark)
10542 (gnus-read-mark-p mark))
10543 (gnus-summary-mark-article gnus-current-article
10544 (or new-mark gnus-read-mark)))))
10546 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10547 "Intended to be used by `gnus-summary-mark-article-hook'."
10548 (let ((mark (gnus-summary-article-mark)))
10549 (when (or (gnus-unread-mark-p mark)
10550 (gnus-read-mark-p mark))
10551 (gnus-summary-mark-article (gnus-summary-article-number)
10552 (or new-mark gnus-read-mark)))))
10554 (defun gnus-summary-mark-unread-as-ticked ()
10555 "Intended to be used by `gnus-summary-mark-article-hook'."
10556 (when (memq gnus-current-article gnus-newsgroup-unreads)
10557 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10559 (defun gnus-summary-mark-region-as-read (point mark all)
10560 "Mark all unread articles between point and mark as read.
10561 If given a prefix, mark all articles between point and mark as read,
10562 even ticked and dormant ones."
10563 (interactive "r\nP")
10567 (beginning-of-line)
10572 (memq (setq article (gnus-summary-article-number))
10573 gnus-newsgroup-unreads))
10574 (gnus-summary-mark-article article gnus-del-mark))
10576 (gnus-summary-find-next))))))
10578 (defun gnus-summary-mark-below (score mark)
10579 "Mark articles with score less than SCORE with MARK."
10580 (interactive "P\ncMark: ")
10581 (setq score (if score
10582 (prefix-numeric-value score)
10583 (or gnus-summary-default-score 0)))
10585 (set-buffer gnus-summary-buffer)
10586 (goto-char (point-min))
10589 (and (< (gnus-summary-article-score) score)
10590 (gnus-summary-mark-article nil mark))
10591 (gnus-summary-find-next)))))
10593 (defun gnus-summary-kill-below (&optional score)
10594 "Mark articles with score below SCORE as read."
10596 (gnus-summary-mark-below score gnus-killed-mark))
10598 (defun gnus-summary-clear-above (&optional score)
10599 "Clear all marks from articles with score above SCORE."
10601 (gnus-summary-mark-above score gnus-unread-mark))
10603 (defun gnus-summary-tick-above (&optional score)
10604 "Tick all articles with score above SCORE."
10606 (gnus-summary-mark-above score gnus-ticked-mark))
10608 (defun gnus-summary-mark-above (score mark)
10609 "Mark articles with score over SCORE with MARK."
10610 (interactive "P\ncMark: ")
10611 (setq score (if score
10612 (prefix-numeric-value score)
10613 (or gnus-summary-default-score 0)))
10615 (set-buffer gnus-summary-buffer)
10616 (goto-char (point-min))
10618 (when (> (gnus-summary-article-score) score)
10619 (gnus-summary-mark-article nil mark))
10621 (gnus-summary-find-next)))))
10623 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10624 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10625 (defun gnus-summary-limit-include-expunged (&optional no-error)
10626 "Display all the hidden articles that were expunged for low scores."
10628 (let ((buffer-read-only nil))
10629 (let ((scored gnus-newsgroup-scored)
10632 (unless (gnus-summary-article-header (caar scored))
10633 (and (setq h (gnus-number-to-header (caar scored)))
10634 (< (cdar scored) gnus-summary-expunge-below)
10636 (setq scored (cdr scored)))
10638 (when (not no-error)
10639 (error "No expunged articles hidden"))
10640 (goto-char (point-min))
10641 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10642 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10643 (mapcar (lambda (x) (push (mail-header-number x)
10644 gnus-newsgroup-limit))
10646 (gnus-summary-prepare-unthreaded (nreverse headers))
10647 (goto-char (point-min))
10648 (gnus-summary-position-point)
10651 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10652 "Mark all unread articles in this newsgroup as read.
10653 If prefix argument ALL is non-nil, ticked and dormant articles will
10654 also be marked as read.
10655 If QUIETLY is non-nil, no questions will be asked.
10657 If TO-HERE is non-nil, it should be a point in the buffer. All
10658 articles before (after, if REVERSE is set) this point will be marked
10661 Note that this function will only catch up the unread article
10662 in the current summary buffer limitation.
10664 The number of articles marked as read is returned."
10669 (not gnus-interactive-catchup) ;Without confirmation?
10673 "Mark absolutely all articles as read? "
10674 "Mark all unread articles as read? ")))
10676 (not gnus-newsgroup-adaptive)
10677 (not gnus-newsgroup-auto-expire)
10678 (not gnus-suppress-duplicates)
10679 (or (not gnus-use-cache)
10680 (eq gnus-use-cache 'passive)))
10683 (setq gnus-newsgroup-marked nil
10684 gnus-newsgroup-spam-marked nil
10685 gnus-newsgroup-dormant nil))
10686 (setq gnus-newsgroup-unreads
10687 (gnus-sorted-nunion
10688 (gnus-intersection gnus-newsgroup-unreads
10689 gnus-newsgroup-downloadable)
10690 gnus-newsgroup-unfetched)))
10691 ;; We actually mark all articles as canceled, which we
10692 ;; have to do when using auto-expiry or adaptive scoring.
10693 (gnus-summary-show-all-threads)
10694 (if (and to-here reverse)
10696 (goto-char to-here)
10697 (gnus-summary-mark-current-read-and-unread-as-read
10699 (while (gnus-summary-find-next (not all))
10700 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10701 (when (gnus-summary-first-subject (not all))
10703 (if to-here (< (point) to-here) t)
10704 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10705 (gnus-summary-find-next (not all))))))
10706 (gnus-set-mode-line 'summary))
10708 (gnus-summary-position-point)))
10710 (defun gnus-summary-catchup-to-here (&optional all)
10711 "Mark all unticked articles before the current one as read.
10712 If ALL is non-nil, also mark ticked and dormant articles as read."
10715 (gnus-save-hidden-threads
10716 (let ((beg (point)))
10717 ;; We check that there are unread articles.
10718 (when (or all (gnus-summary-find-prev))
10719 (gnus-summary-catchup all t beg)))))
10720 (gnus-summary-position-point))
10722 (defun gnus-summary-catchup-from-here (&optional all)
10723 "Mark all unticked articles after (and including) the current one as read.
10724 If ALL is non-nil, also mark ticked and dormant articles as read."
10727 (gnus-save-hidden-threads
10728 (let ((beg (point)))
10729 ;; We check that there are unread articles.
10730 (when (or all (gnus-summary-find-next))
10731 (gnus-summary-catchup all t beg nil t)))))
10732 (gnus-summary-position-point))
10734 (defun gnus-summary-catchup-all (&optional quietly)
10735 "Mark all articles in this newsgroup as read.
10736 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10737 instead, which marks only unread articles as read."
10739 (gnus-summary-catchup t quietly))
10741 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10742 "Mark all unread articles in this group as read, then exit.
10743 If prefix argument ALL is non-nil, all articles are marked as read.
10744 If QUIETLY is non-nil, no questions will be asked."
10746 (when (gnus-summary-catchup all quietly nil 'fast)
10747 ;; Select next newsgroup or exit.
10748 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10749 (eq gnus-auto-select-next 'quietly))
10750 (gnus-summary-next-group nil)
10751 (gnus-summary-exit))))
10753 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10754 "Mark all articles in this newsgroup as read, and then exit.
10755 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10756 instead, which marks only unread articles as read."
10758 (gnus-summary-catchup-and-exit t quietly))
10760 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10761 "Mark all articles in this group as read and select the next group.
10762 If given a prefix, mark all articles, unread as well as ticked, as
10766 (gnus-summary-catchup all))
10767 (gnus-summary-next-group))
10769 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10770 "Mark all articles in this group as read and select the previous group.
10771 If given a prefix, mark all articles, unread as well as ticked, as
10775 (gnus-summary-catchup all))
10776 (gnus-summary-next-group nil nil t))
10782 (defmacro gnus-with-article (article &rest forms)
10783 "Select ARTICLE and perform FORMS in the original article buffer.
10784 Then replace the article with the result."
10786 ;; We don't want the article to be marked as read.
10787 (let (gnus-mark-article-hook)
10788 (gnus-summary-select-article t t nil ,article))
10789 (set-buffer gnus-original-article-buffer)
10791 (if (not (gnus-check-backend-function
10792 'request-replace-article (car gnus-article-current)))
10793 (gnus-message 5 "Read-only group; not replacing")
10794 (unless (gnus-request-replace-article
10795 ,article (car gnus-article-current)
10796 (current-buffer) t)
10797 (error "Couldn't replace article")))
10798 ;; The cache and backlog have to be flushed somewhat.
10799 (when gnus-keep-backlog
10800 (gnus-backlog-remove-article
10801 (car gnus-article-current) (cdr gnus-article-current)))
10802 (when gnus-use-cache
10803 (gnus-cache-update-article
10804 (car gnus-article-current) (cdr gnus-article-current)))))
10806 (put 'gnus-with-article 'lisp-indent-function 1)
10807 (put 'gnus-with-article 'edebug-form-spec '(form body))
10809 ;; Thread-based commands.
10811 (defun gnus-summary-articles-in-thread (&optional article)
10812 "Return a list of all articles in the current thread.
10813 If ARTICLE is non-nil, return all articles in the thread that starts
10814 with that article."
10815 (let* ((article (or article (gnus-summary-article-number)))
10816 (data (gnus-data-find-list article))
10817 (top-level (gnus-data-level (car data)))
10819 (cond ((null gnus-thread-operation-ignore-subject)
10820 (gnus-simplify-subject-re
10821 (mail-header-subject (gnus-data-header (car data)))))
10822 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10823 (gnus-simplify-subject-fuzzy
10824 (mail-header-subject (gnus-data-header (car data)))))
10826 (end-point (save-excursion
10827 (if (gnus-summary-go-to-next-thread)
10828 (point) (point-max))))
10831 (< (gnus-data-pos (car data)) end-point))
10832 (when (or (not top-subject)
10833 (string= top-subject
10834 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10835 (gnus-simplify-subject-fuzzy
10836 (mail-header-subject
10837 (gnus-data-header (car data))))
10838 (gnus-simplify-subject-re
10839 (mail-header-subject
10840 (gnus-data-header (car data)))))))
10841 (push (gnus-data-number (car data)) articles))
10842 (unless (and (setq data (cdr data))
10843 (> (gnus-data-level (car data)) top-level))
10845 ;; Return the list of articles.
10846 (nreverse articles)))
10848 (defun gnus-summary-rethread-current ()
10849 "Rethread the thread the current article is part of."
10851 (let* ((gnus-show-threads t)
10852 (article (gnus-summary-article-number))
10853 (id (mail-header-id (gnus-summary-article-header)))
10854 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10856 (error "No article on the current line"))
10857 (gnus-rebuild-thread id)
10858 (gnus-summary-goto-subject article)))
10860 (defun gnus-summary-reparent-thread ()
10861 "Make the current article child of the marked (or previous) article.
10863 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10864 is non-nil or the Subject: of both articles are the same."
10866 (unless (not (gnus-group-read-only-p))
10867 (error "The current newsgroup does not support article editing"))
10868 (unless (<= (length gnus-newsgroup-processable) 1)
10869 (error "No more than one article may be marked"))
10870 (save-window-excursion
10871 (let ((gnus-article-buffer " *reparent*")
10872 (current-article (gnus-summary-article-number))
10873 ;; First grab the marked article, otherwise one line up.
10874 (parent-article (if (not (null gnus-newsgroup-processable))
10875 (car gnus-newsgroup-processable)
10877 (if (eq (forward-line -1) 0)
10878 (gnus-summary-article-number)
10879 (error "Beginning of summary buffer"))))))
10880 (unless (not (eq current-article parent-article))
10881 (error "An article may not be self-referential"))
10882 (let ((message-id (mail-header-id
10883 (gnus-summary-article-header parent-article))))
10884 (unless (and message-id (not (equal message-id "")))
10885 (error "No message-id in desired parent"))
10886 (gnus-with-article current-article
10888 (goto-char (point-min))
10889 (message-narrow-to-head)
10890 (if (re-search-forward "^References: " nil t)
10892 (re-search-forward "^[^ \t]" nil t)
10895 (insert " " message-id))
10896 (insert "References: " message-id "\n"))))
10897 (set-buffer gnus-summary-buffer)
10898 (gnus-summary-unmark-all-processable)
10899 (gnus-summary-update-article current-article)
10900 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10901 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10902 (gnus-summary-rethread-current)
10903 (gnus-message 3 "Article %d is now the child of article %d"
10904 current-article parent-article)))))
10906 (defun gnus-summary-toggle-threads (&optional arg)
10907 "Toggle showing conversation threads.
10908 If ARG is positive number, turn showing conversation threads on."
10910 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10911 (setq gnus-show-threads
10912 (if (null arg) (not gnus-show-threads)
10913 (> (prefix-numeric-value arg) 0)))
10914 (gnus-summary-prepare)
10915 (gnus-summary-goto-subject current)
10916 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10917 (gnus-summary-position-point)))
10919 (defun gnus-summary-show-all-threads ()
10920 "Show all threads."
10923 (let ((buffer-read-only nil))
10924 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10925 (gnus-summary-position-point))
10927 (defun gnus-summary-show-thread ()
10928 "Show thread subtrees.
10929 Returns nil if no thread was there to be shown."
10931 (let ((buffer-read-only nil)
10933 (end (point-at-eol))
10934 ;; Leave point at bol
10935 (beg (progn (beginning-of-line) (point))))
10937 ;; Any hidden lines here?
10938 (search-forward "\r" end t)
10939 (subst-char-in-region beg end ?\^M ?\n t)
10941 (gnus-summary-position-point))))
10943 (defun gnus-summary-maybe-hide-threads ()
10944 "If requested, hide the threads that should be hidden."
10945 (when (and gnus-show-threads
10946 gnus-thread-hide-subtree)
10947 (gnus-summary-hide-all-threads
10948 (if (or (consp gnus-thread-hide-subtree)
10949 (functionp gnus-thread-hide-subtree))
10950 (gnus-make-predicate gnus-thread-hide-subtree)
10953 ;;; Hiding predicates.
10955 (defun gnus-article-unread-p (header)
10956 (memq (mail-header-number header) gnus-newsgroup-unreads))
10958 (defun gnus-article-unseen-p (header)
10959 (memq (mail-header-number header) gnus-newsgroup-unseen))
10961 (defun gnus-map-articles (predicate articles)
10962 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10963 (apply 'gnus-or (mapcar predicate
10964 (mapcar 'gnus-summary-article-header articles))))
10966 (defun gnus-summary-hide-all-threads (&optional predicate)
10967 "Hide all thread subtrees.
10968 If PREDICATE is supplied, threads that satisfy this predicate
10969 will not be hidden."
10972 (goto-char (point-min))
10975 (when (or (not predicate)
10977 predicate (gnus-summary-article-children)))
10978 (gnus-summary-hide-thread))
10979 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10980 (gnus-summary-position-point))
10982 (defun gnus-summary-hide-thread ()
10983 "Hide thread subtrees.
10984 If PREDICATE is supplied, threads that satisfy this predicate
10985 will not be hidden.
10986 Returns nil if no threads were there to be hidden."
10988 (let ((buffer-read-only nil)
10990 (article (gnus-summary-article-number)))
10992 ;; Go forward until either the buffer ends or the subthread
10994 (when (and (not (eobp))
10995 (or (zerop (gnus-summary-next-thread 1 t))
10996 (goto-char (point-max))))
10998 (if (and (> (point) start)
10999 (search-backward "\n" start t))
11001 (subst-char-in-region start (point) ?\n ?\^M)
11002 (gnus-summary-goto-subject article))
11006 (defun gnus-summary-go-to-next-thread (&optional previous)
11007 "Go to the same level (or less) next thread.
11008 If PREVIOUS is non-nil, go to previous thread instead.
11009 Return the article number moved to, or nil if moving was impossible."
11010 (let ((level (gnus-summary-thread-level))
11011 (way (if previous -1 1))
11014 (while (and (not (eobp))
11015 (< level (gnus-summary-thread-level)))
11016 (forward-line way))
11023 (gnus-summary-article-number)
11024 (goto-char beg)))))
11026 (defun gnus-summary-next-thread (n &optional silent)
11027 "Go to the same level next N'th thread.
11028 If N is negative, search backward instead.
11029 Returns the difference between N and the number of skips actually
11032 If SILENT, don't output messages."
11034 (let ((backward (< n 0))
11036 (while (and (> n 0)
11037 (gnus-summary-go-to-next-thread backward))
11040 (gnus-summary-position-point))
11041 (when (and (not silent) (/= 0 n))
11042 (gnus-message 7 "No more threads"))
11045 (defun gnus-summary-prev-thread (n)
11046 "Go to the same level previous N'th thread.
11047 Returns the difference between N and the number of skips actually
11050 (gnus-summary-next-thread (- n)))
11052 (defun gnus-summary-go-down-thread ()
11053 "Go down one level in the current thread."
11054 (let ((children (gnus-summary-article-children)))
11056 (gnus-summary-goto-subject (car children)))))
11058 (defun gnus-summary-go-up-thread ()
11059 "Go up one level in the current thread."
11060 (let ((parent (gnus-summary-article-parent)))
11062 (gnus-summary-goto-subject parent))))
11064 (defun gnus-summary-down-thread (n)
11065 "Go down thread N steps.
11066 If N is negative, go up instead.
11067 Returns the difference between N and how many steps down that were
11072 (while (and (> n 0)
11073 (if up (gnus-summary-go-up-thread)
11074 (gnus-summary-go-down-thread)))
11076 (gnus-summary-position-point)
11078 (gnus-message 7 "Can't go further"))
11081 (defun gnus-summary-up-thread (n)
11082 "Go up thread N steps.
11083 If N is negative, go down instead.
11084 Returns the difference between N and how many steps down that were
11087 (gnus-summary-down-thread (- n)))
11089 (defun gnus-summary-top-thread ()
11090 "Go to the top of the thread."
11092 (while (gnus-summary-go-up-thread))
11093 (gnus-summary-article-number))
11095 (defun gnus-summary-kill-thread (&optional unmark)
11096 "Mark articles under current thread as read.
11097 If the prefix argument is positive, remove any kinds of marks.
11098 If the prefix argument is negative, tick articles instead."
11101 (setq unmark (prefix-numeric-value unmark)))
11102 (let ((articles (gnus-summary-articles-in-thread)))
11104 ;; Expand the thread.
11105 (gnus-summary-show-thread)
11106 ;; Mark all the articles.
11108 (gnus-summary-goto-subject (car articles))
11109 (cond ((null unmark)
11110 (gnus-summary-mark-article-as-read gnus-killed-mark))
11112 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11114 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11115 (setq articles (cdr articles))))
11116 ;; Hide killed subtrees.
11118 gnus-thread-hide-killed
11119 (gnus-summary-hide-thread))
11120 ;; If marked as read, go to next unread subject.
11121 (when (null unmark)
11122 ;; Go to next unread subject.
11123 (gnus-summary-next-subject 1 t)))
11124 (gnus-set-mode-line 'summary))
11126 ;; Summary sorting commands
11128 (defun gnus-summary-sort-by-number (&optional reverse)
11129 "Sort the summary buffer by article number.
11130 Argument REVERSE means reverse order."
11132 (gnus-summary-sort 'number reverse))
11134 (defun gnus-summary-sort-by-random (&optional reverse)
11135 "Randomize the order in the summary buffer.
11136 Argument REVERSE means to randomize in reverse order."
11138 (gnus-summary-sort 'random reverse))
11140 (defun gnus-summary-sort-by-author (&optional reverse)
11141 "Sort the summary buffer by author name alphabetically.
11142 If `case-fold-search' is non-nil, case of letters is ignored.
11143 Argument REVERSE means reverse order."
11145 (gnus-summary-sort 'author reverse))
11147 (defun gnus-summary-sort-by-recipient (&optional reverse)
11148 "Sort the summary buffer by recipient name alphabetically.
11149 If `case-fold-search' is non-nil, case of letters is ignored.
11150 Argument REVERSE means reverse order."
11152 (gnus-summary-sort 'recipient reverse))
11154 (defun gnus-summary-sort-by-subject (&optional reverse)
11155 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11156 If `case-fold-search' is non-nil, case of letters is ignored.
11157 Argument REVERSE means reverse order."
11159 (gnus-summary-sort 'subject reverse))
11161 (defun gnus-summary-sort-by-date (&optional reverse)
11162 "Sort the summary buffer by date.
11163 Argument REVERSE means reverse order."
11165 (gnus-summary-sort 'date reverse))
11167 (defun gnus-summary-sort-by-score (&optional reverse)
11168 "Sort the summary buffer by score.
11169 Argument REVERSE means reverse order."
11171 (gnus-summary-sort 'score reverse))
11173 (defun gnus-summary-sort-by-lines (&optional reverse)
11174 "Sort the summary buffer by the number of lines.
11175 Argument REVERSE means reverse order."
11177 (gnus-summary-sort 'lines reverse))
11179 (defun gnus-summary-sort-by-chars (&optional reverse)
11180 "Sort the summary buffer by article length.
11181 Argument REVERSE means reverse order."
11183 (gnus-summary-sort 'chars reverse))
11185 (defun gnus-summary-sort-by-original (&optional reverse)
11186 "Sort the summary buffer using the default sorting method.
11187 Argument REVERSE means reverse order."
11189 (let* ((buffer-read-only)
11190 (gnus-summary-prepare-hook nil))
11191 ;; We do the sorting by regenerating the threads.
11192 (gnus-summary-prepare)
11193 ;; Hide subthreads if needed.
11194 (gnus-summary-maybe-hide-threads)))
11196 (defun gnus-summary-sort (predicate reverse)
11197 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11198 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11199 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11200 (gnus-thread-sort-functions
11205 (gnus-sort-gathered-threads-function
11206 gnus-thread-sort-functions)
11207 (gnus-article-sort-functions
11211 (,article t2 t1))))
11213 (gnus-summary-prepare-hook nil))
11214 ;; We do the sorting by regenerating the threads.
11215 (gnus-summary-prepare)
11216 ;; Hide subthreads if needed.
11217 (gnus-summary-maybe-hide-threads)))
11219 ;; Summary saving commands.
11221 (defun gnus-summary-save-article (&optional n not-saved)
11222 "Save the current article using the default saver function.
11223 If N is a positive number, save the N next articles.
11224 If N is a negative number, save the N previous articles.
11225 If N is nil and any articles have been marked with the process mark,
11226 save those articles instead.
11227 The variable `gnus-default-article-saver' specifies the saver function."
11229 (let* ((articles (gnus-summary-work-articles n))
11230 (save-buffer (save-excursion
11231 (nnheader-set-temp-buffer " *Gnus Save*")))
11232 (num (length articles))
11234 (dolist (article articles)
11235 (setq header (gnus-summary-article-header article))
11236 (if (not (vectorp header))
11237 ;; This is a pseudo-article.
11238 (if (assq 'name header)
11239 (gnus-copy-file (cdr (assq 'name header)))
11240 (gnus-message 1 "Article %d is unsaveable" article))
11241 ;; This is a real article.
11242 (save-window-excursion
11243 (let ((gnus-display-mime-function nil)
11244 (gnus-article-prepare-hook nil))
11245 (gnus-summary-select-article t nil nil article)))
11247 (set-buffer save-buffer)
11249 (insert-buffer-substring gnus-original-article-buffer))
11250 (setq file (gnus-article-save save-buffer file num))
11251 (gnus-summary-remove-process-mark article)
11253 (gnus-summary-set-saved-mark article))))
11254 (gnus-kill-buffer save-buffer)
11255 (gnus-summary-position-point)
11256 (gnus-set-mode-line 'summary)
11259 (defun gnus-summary-pipe-output (&optional arg headers)
11260 "Pipe the current article to a subprocess.
11261 If N is a positive number, pipe the N next articles.
11262 If N is a negative number, pipe the N previous articles.
11263 If N is nil and any articles have been marked with the process mark,
11264 pipe those articles instead.
11265 If HEADERS (the symbolic prefix), include the headers, too."
11266 (interactive (gnus-interactive "P\ny"))
11267 (require 'gnus-art)
11268 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11269 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11270 (gnus-summary-save-article arg t))
11271 (let ((buffer (get-buffer "*Shell Command Output*")))
11273 (not (zerop (buffer-size buffer))))
11274 (gnus-configure-windows 'pipe))))
11276 (defun gnus-summary-save-article-mail (&optional arg)
11277 "Append the current article to an mail file.
11278 If N is a positive number, save the N next articles.
11279 If N is a negative number, save the N previous articles.
11280 If N is nil and any articles have been marked with the process mark,
11281 save those articles instead."
11283 (require 'gnus-art)
11284 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11285 (gnus-summary-save-article arg)))
11287 (defun gnus-summary-save-article-rmail (&optional arg)
11288 "Append the current article to an rmail file.
11289 If N is a positive number, save the N next articles.
11290 If N is a negative number, save the N previous articles.
11291 If N is nil and any articles have been marked with the process mark,
11292 save those articles instead."
11294 (require 'gnus-art)
11295 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11296 (gnus-summary-save-article arg)))
11298 (defun gnus-summary-save-article-file (&optional arg)
11299 "Append the current article to a file.
11300 If N is a positive number, save the N next articles.
11301 If N is a negative number, save the N previous articles.
11302 If N is nil and any articles have been marked with the process mark,
11303 save those articles instead."
11305 (require 'gnus-art)
11306 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11307 (gnus-summary-save-article arg)))
11309 (defun gnus-summary-write-article-file (&optional arg)
11310 "Write the current article to a file, deleting the previous file.
11311 If N is a positive number, save the N next articles.
11312 If N is a negative number, save the N previous articles.
11313 If N is nil and any articles have been marked with the process mark,
11314 save those articles instead."
11316 (require 'gnus-art)
11317 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11318 (gnus-summary-save-article arg)))
11320 (defun gnus-summary-save-article-body-file (&optional arg)
11321 "Append the current article body to a file.
11322 If N is a positive number, save the N next articles.
11323 If N is a negative number, save the N previous articles.
11324 If N is nil and any articles have been marked with the process mark,
11325 save those articles instead."
11327 (require 'gnus-art)
11328 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11329 (gnus-summary-save-article arg)))
11331 (defun gnus-summary-muttprint (&optional arg)
11332 "Print the current article using Muttprint.
11333 If N is a positive number, save the N next articles.
11334 If N is a negative number, save the N previous articles.
11335 If N is nil and any articles have been marked with the process mark,
11336 save those articles instead."
11338 (require 'gnus-art)
11339 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11340 (gnus-summary-save-article arg t)))
11342 (defun gnus-summary-pipe-message (program)
11343 "Pipe the current article through PROGRAM."
11344 (interactive "sProgram: ")
11345 (gnus-summary-select-article)
11346 (let ((mail-header-separator ""))
11347 (gnus-eval-in-buffer-window gnus-article-buffer
11350 (let ((start (window-start))
11352 (message-pipe-buffer-body program)
11353 (set-window-start (get-buffer-window (current-buffer)) start))))))
11355 (defun gnus-get-split-value (methods)
11356 "Return a value based on the split METHODS."
11357 (let (split-name method result match)
11360 (set-buffer gnus-original-article-buffer)
11362 (nnheader-narrow-to-headers)
11363 (while (and methods (not split-name))
11364 (goto-char (point-min))
11365 (setq method (pop methods))
11366 (setq match (car method))
11369 ;; Regular expression.
11371 (re-search-forward match nil t)))
11376 (setq result (funcall match gnus-newsgroup-name))))
11381 (setq result (eval match)))))
11382 (setq split-name (cdr method))
11383 (cond ((stringp result)
11384 (push (expand-file-name
11385 result gnus-article-save-directory)
11388 (setq split-name (append result split-name)))))))))
11389 (nreverse split-name)))
11391 (defun gnus-valid-move-group-p (group)
11392 (and (boundp group)
11393 (symbol-name group)
11394 (symbol-value group)
11395 (gnus-get-function (gnus-find-method-for-group
11396 (symbol-name group)) 'request-accept-article t)))
11398 (defun gnus-read-move-group-name (prompt default articles prefix)
11399 "Read a group name."
11400 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11401 (minibuffer-confirm-incomplete nil) ; XEmacs
11405 (if (> (length articles) 1)
11406 (format "these %d articles" (length articles))
11411 (gnus-completing-read-with-default
11414 'gnus-valid-move-group-p
11416 'gnus-group-history))
11417 ((= 1 (length split-name))
11418 (gnus-completing-read-with-default
11419 (car split-name) prom
11421 'gnus-valid-move-group-p
11423 'gnus-group-history))
11425 (gnus-completing-read-with-default
11427 (mapcar 'list (nreverse split-name))
11429 'gnus-group-history))))
11430 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11432 (if (or (string= to-newsgroup "")
11433 (string= to-newsgroup prefix))
11434 (setq to-newsgroup default))
11435 (unless to-newsgroup
11436 (error "No group name entered"))
11437 (or (gnus-active to-newsgroup)
11438 (gnus-activate-group to-newsgroup nil nil to-method)
11439 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11441 (or (and (gnus-request-create-group to-newsgroup to-method)
11442 (gnus-activate-group
11443 to-newsgroup nil nil to-method)
11444 (gnus-subscribe-group to-newsgroup))
11445 (error "Couldn't create group %s" to-newsgroup)))
11446 (error "No such group: %s" to-newsgroup)))
11449 (defun gnus-summary-save-parts (type dir n &optional reverse)
11450 "Save parts matching TYPE to DIR.
11451 If REVERSE, save parts that do not match TYPE."
11453 (list (read-string "Save parts of type: "
11454 (or (car gnus-summary-save-parts-type-history)
11455 gnus-summary-save-parts-default-mime)
11456 'gnus-summary-save-parts-type-history)
11457 (setq gnus-summary-save-parts-last-directory
11458 (read-file-name "Save to directory: "
11459 gnus-summary-save-parts-last-directory
11461 current-prefix-arg))
11462 (gnus-summary-iterate n
11463 (let ((gnus-display-mime-function nil)
11464 (gnus-inhibit-treatment t))
11465 (gnus-summary-select-article))
11467 (set-buffer gnus-article-buffer)
11468 (let ((handles (or gnus-article-mime-handles
11469 (mm-dissect-buffer nil gnus-article-loose-mime)
11470 (and gnus-article-emulate-mime
11471 (mm-uu-dissect)))))
11473 (gnus-summary-save-parts-1 type dir handles reverse)
11474 (unless gnus-article-mime-handles ;; Don't destroy this case.
11475 (mm-destroy-parts handles)))))))
11477 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11478 (if (stringp (car handle))
11479 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11482 (not (string-match type (mm-handle-media-type handle)))
11483 (string-match type (mm-handle-media-type handle)))
11484 (let ((file (expand-file-name
11486 mm-file-name-rewrite-functions
11487 (file-name-nondirectory
11489 (mail-content-type-get
11490 (mm-handle-disposition handle) 'filename)
11491 (mail-content-type-get
11492 (mm-handle-type handle) 'name)
11493 (concat gnus-newsgroup-name
11494 "." (number-to-string
11495 (cdr gnus-article-current))))))
11497 (unless (file-exists-p file)
11498 (mm-save-part-to-file handle file))))))
11500 ;; Summary extract commands
11502 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11503 (let ((buffer-read-only nil)
11504 (article (gnus-summary-article-number))
11506 (unless (gnus-summary-goto-subject article)
11507 (error "No such article: %d" article))
11508 (gnus-summary-position-point)
11509 ;; If all commands are to be bunched up on one line, we collect
11511 (unless gnus-view-pseudos-separately
11512 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11515 (setq action (cdr (assq 'action (car ps))))
11516 (setq files (list (cdr (assq 'name (car ps)))))
11517 (while (and ps (cdr ps)
11518 (string= (or action "1")
11519 (or (cdr (assq 'action (cadr ps))) "2")))
11520 (push (cdr (assq 'name (cadr ps))) files)
11521 (setcdr ps (cddr ps)))
11523 (when (not (string-match "%s" action))
11526 (when (assq 'execute (car ps))
11527 (setcdr (assq 'execute (car ps))
11528 (funcall (if (string-match "%s" action)
11535 (shell-quote-argument f)))
11537 (setq ps (cdr ps)))))
11538 (if (and gnus-view-pseudos (not not-view))
11540 (when (assq 'execute (car pslist))
11541 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11542 (eq gnus-view-pseudos 'not-confirm)))
11543 (setq pslist (cdr pslist)))
11546 (setq after-article (or (cdr (assq 'article (car pslist)))
11547 (gnus-summary-article-number)))
11548 (gnus-summary-goto-subject after-article)
11551 (insert " " (file-name-nondirectory
11552 (cdr (assq 'name (car pslist))))
11553 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11555 (forward-line -1) ; back to `b'
11556 (gnus-add-text-properties
11557 b (1- e) (list 'gnus-number gnus-reffed-article-number
11558 gnus-mouse-face-prop gnus-mouse-face))
11560 after-article gnus-reffed-article-number
11561 gnus-unread-mark b (car pslist) 0 (- e b))
11562 (setq gnus-newsgroup-unreads
11563 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11564 gnus-reffed-article-number))
11565 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11566 (setq pslist (cdr pslist)))))))
11568 (defun gnus-pseudos< (p1 p2)
11569 (let ((c1 (cdr (assq 'action p1)))
11570 (c2 (cdr (assq 'action p2))))
11571 (and c1 c2 (string< c1 c2))))
11573 (defun gnus-request-pseudo-article (props)
11574 (cond ((assq 'execute props)
11575 (gnus-execute-command (cdr (assq 'execute props)))))
11576 (let ((gnus-current-article (gnus-summary-article-number)))
11577 (gnus-run-hooks 'gnus-mark-article-hook)))
11579 (defun gnus-execute-command (command &optional automatic)
11581 (gnus-article-setup-buffer)
11582 (set-buffer gnus-article-buffer)
11583 (setq buffer-read-only nil)
11584 (let ((command (if automatic command
11585 (read-string "Command: " (cons command 0)))))
11587 (insert "$ " command "\n\n")
11588 (if gnus-view-pseudo-asynchronously
11589 (start-process "gnus-execute" (current-buffer) shell-file-name
11590 shell-command-switch command)
11591 (call-process shell-file-name nil t nil
11592 shell-command-switch command)))))
11594 ;; Summary kill commands.
11596 (defun gnus-summary-edit-global-kill (article)
11597 "Edit the \"global\" kill file."
11598 (interactive (list (gnus-summary-article-number)))
11599 (gnus-group-edit-global-kill article))
11601 (defun gnus-summary-edit-local-kill ()
11602 "Edit a local kill file applied to the current newsgroup."
11604 (setq gnus-current-headers (gnus-summary-article-header))
11605 (gnus-group-edit-local-kill
11606 (gnus-summary-article-number) gnus-newsgroup-name))
11608 ;;; Header reading.
11610 (defun gnus-read-header (id &optional header)
11611 "Read the headers of article ID and enter them into the Gnus system."
11612 (let ((group gnus-newsgroup-name)
11613 (gnus-override-method
11615 gnus-override-method
11616 (and (gnus-news-group-p gnus-newsgroup-name)
11617 (car (gnus-refer-article-methods)))))
11619 ;; First we check to see whether the header in question is already
11622 ;; This is a Message-ID.
11623 (setq header (or header (gnus-id-to-header id)))
11624 ;; This is an article number.
11625 (setq header (or header (gnus-summary-article-header id))))
11627 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11628 ;; We have found the header.
11630 ;; We have to really fetch the header to this article.
11632 (set-buffer nntp-server-buffer)
11633 (when (setq where (gnus-request-head id group))
11634 (nnheader-fold-continuation-lines)
11635 (goto-char (point-max))
11637 (goto-char (point-min))
11641 ((cdr where) (cdr where))
11642 (header (mail-header-number header))
11643 (t gnus-reffed-article-number))
11645 (insert " Article retrieved.\n"))
11646 (if (or (not where)
11647 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11648 () ; Malformed head.
11649 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11650 (when (and (stringp id)
11651 (not (string= (gnus-group-real-name group)
11653 ;; If we fetched by Message-ID and the article came
11654 ;; from a different group, we fudge some bogus article
11655 ;; numbers for this article.
11656 (mail-header-set-number header gnus-reffed-article-number))
11658 (set-buffer gnus-summary-buffer)
11659 (decf gnus-reffed-article-number)
11660 (gnus-remove-header (mail-header-number header))
11661 (push header gnus-newsgroup-headers)
11662 (setq gnus-current-headers header)
11663 (push (mail-header-number header) gnus-newsgroup-limit)))
11666 (defun gnus-remove-header (number)
11667 "Remove header NUMBER from `gnus-newsgroup-headers'."
11668 (if (and gnus-newsgroup-headers
11669 (= number (mail-header-number (car gnus-newsgroup-headers))))
11670 (pop gnus-newsgroup-headers)
11671 (let ((headers gnus-newsgroup-headers))
11672 (while (and (cdr headers)
11673 (not (= number (mail-header-number (cadr headers)))))
11675 (when (cdr headers)
11676 (setcdr headers (cddr headers))))))
11679 ;;; summary highlights
11682 (defun gnus-highlight-selected-summary ()
11683 "Highlight selected article in summary buffer."
11684 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11685 (when gnus-summary-selected-face
11687 (let* ((beg (point-at-bol))
11688 (end (point-at-eol))
11689 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11690 (from (if (get-text-property beg gnus-mouse-face-prop)
11692 (or (next-single-property-change
11693 beg gnus-mouse-face-prop nil end)
11698 (or (next-single-property-change
11699 from gnus-mouse-face-prop nil end)
11701 ;; If no mouse-face prop on line we will have to = from = end,
11702 ;; so we highlight the entire line instead.
11703 (when (= (+ to 2) from)
11706 (if gnus-newsgroup-selected-overlay
11707 ;; Move old overlay.
11709 gnus-newsgroup-selected-overlay from to (current-buffer))
11710 ;; Create new overlay.
11712 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11713 'face gnus-summary-selected-face))))))
11715 (defvar gnus-summary-highlight-line-cached nil)
11716 (defvar gnus-summary-highlight-line-trigger nil)
11718 (defun gnus-summary-highlight-line-0 ()
11719 (if (and (eq gnus-summary-highlight-line-trigger
11720 gnus-summary-highlight)
11721 gnus-summary-highlight-line-cached)
11722 gnus-summary-highlight-line-cached
11723 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11724 gnus-summary-highlight-line-cached
11725 (let* ((cond (list 'cond))
11727 (list gnus-summary-highlight))
11729 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11733 (gnus-byte-compile (list 'lambda nil cond))))))
11735 (defun gnus-summary-highlight-line ()
11736 "Highlight current line according to `gnus-summary-highlight'."
11737 (let* ((beg (point-at-bol))
11738 (article (or (gnus-summary-article-number) gnus-current-article))
11739 (score (or (cdr (assq article
11740 gnus-newsgroup-scored))
11741 gnus-summary-default-score 0))
11742 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11743 (inhibit-read-only t)
11744 (default gnus-summary-default-score)
11745 (default-high gnus-summary-default-high-score)
11746 (default-low gnus-summary-default-low-score)
11747 (uncached (and gnus-summary-use-undownloaded-faces
11748 (memq article gnus-newsgroup-undownloaded)
11749 (not (memq article gnus-newsgroup-cached)))))
11750 (let ((face (funcall (gnus-summary-highlight-line-0))))
11751 (unless (eq face (get-text-property beg 'face))
11752 (gnus-put-text-property-excluding-characters-with-faces
11753 beg (point-at-eol) 'face
11754 (setq face (if (boundp face) (symbol-value face) face)))
11755 (when gnus-summary-highlight-line-function
11756 (funcall gnus-summary-highlight-line-function article face))))))
11758 (defun gnus-update-read-articles (group unread &optional compute)
11759 "Update the list of read articles in GROUP.
11760 UNREAD is a sorted list."
11761 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11762 (info (gnus-get-info group))
11765 (if (or (not info) (not active))
11766 ;; There is no info on this group if it was, in fact,
11767 ;; killed. Gnus stores no information on killed groups, so
11768 ;; there's nothing to be done.
11769 ;; One could store the information somewhere temporarily,
11770 ;; perhaps... Hmmm...
11772 ;; Remove any negative articles numbers.
11773 (while (and unread (< (car unread) 0))
11774 (setq unread (cdr unread)))
11775 ;; Remove any expired article numbers
11776 (while (and unread (< (car unread) (car active)))
11777 (setq unread (cdr unread)))
11778 ;; Compute the ranges of read articles by looking at the list of
11779 ;; unread articles.
11781 (when (/= (car unread) prev)
11782 (push (if (= prev (1- (car unread))) prev
11783 (cons prev (1- (car unread))))
11785 (setq prev (1+ (car unread)))
11786 (setq unread (cdr unread)))
11787 (when (<= prev (cdr active))
11788 (push (cons prev (cdr active)) read))
11789 (setq read (if (> (length read) 1) (nreverse read) read))
11794 ;; Propagate the read marks to the backend.
11795 (when (gnus-check-backend-function 'request-set-mark group)
11796 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11797 (add (gnus-remove-from-range read (gnus-info-read info))))
11799 (unless (gnus-check-group group)
11800 (error "Can't open server for %s" group))
11801 (gnus-request-set-mark
11802 group (delq nil (list (if add (list add 'add '(read)))
11803 (if del (list del 'del '(read))))))
11805 `(gnus-request-set-mark
11808 (if del (list del 'add '(read)))
11809 (if add (list add 'del '(read))))))))))
11810 (set-buffer gnus-group-buffer)
11811 (gnus-undo-register
11813 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11814 (gnus-info-set-read ',info ',(gnus-info-read info))
11815 (gnus-get-unread-articles-in-group ',info
11816 (gnus-active ,group))
11817 (gnus-group-update-group ,group t)
11819 ;; Enter this list into the group info.
11820 (gnus-info-set-read info read)
11821 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11822 (gnus-get-unread-articles-in-group info (gnus-active group))
11825 (defun gnus-offer-save-summaries ()
11826 "Offer to save all active summary buffers."
11828 ;; Go through all buffers and find all summaries.
11829 (dolist (buffer (buffer-list))
11830 (when (and (setq buffer (buffer-name buffer))
11831 (string-match "Summary" buffer)
11832 (with-current-buffer buffer
11833 ;; We check that this is, indeed, a summary buffer.
11834 (and (eq major-mode 'gnus-summary-mode)
11835 ;; Also make sure this isn't bogus.
11836 gnus-newsgroup-prepared
11837 ;; Also make sure that this isn't a
11838 ;; dead summary buffer.
11839 (not gnus-dead-summary-mode))))
11840 (push buffer buffers)))
11841 ;; Go through all these summary buffers and offer to save them.
11845 "Update summary buffer %s? "
11847 (switch-to-buffer buf)
11848 (gnus-summary-exit))
11852 ;;; @ for mime-partial
11855 (defun gnus-request-partial-message ()
11857 (let ((number (gnus-summary-article-number))
11858 (group gnus-newsgroup-name)
11859 (mother gnus-article-buffer))
11860 (set-buffer (get-buffer-create " *Partial Article*"))
11862 (setq mime-preview-buffer mother)
11863 (gnus-request-article-this-buffer number group)
11864 (mime-parse-buffer)
11867 (autoload 'mime-combine-message/partial-pieces-automatically
11869 "Internal method to combine message/partial messages automatically.")
11871 (mime-add-condition
11872 'action '((type . message)(subtype . partial)
11873 (major-mode . gnus-original-article-mode)
11874 (method . mime-combine-message/partial-pieces-automatically)
11875 (summary-buffer-exp . gnus-summary-buffer)
11876 (request-partial-message-method . gnus-request-partial-message)
11880 ;;; @ for message/rfc822
11883 (defun gnus-mime-extract-message/rfc822 (entity situation)
11884 "Burst a forwarded article."
11886 (set-buffer gnus-summary-buffer)
11887 (let* ((group (completing-read "Group: " gnus-active-hashtb nil t
11888 gnus-newsgroup-name 'gnus-group-history))
11889 (gnus-group-marked (list group))
11892 (mime-insert-entity-content entity)
11893 (setq article (gnus-request-accept-article group)))
11894 (when (and (consp article)
11895 (numberp (setq article (cdr article))))
11896 (setq info (gnus-get-info group))
11897 (gnus-info-set-read info
11898 (gnus-remove-from-range (gnus-info-read info)
11900 (when (string-equal group gnus-newsgroup-name)
11902 (let (gnus-show-threads)
11903 (gnus-summary-goto-subject article t))
11904 (gnus-summary-clear-mark-forward 1))
11905 (set-buffer gnus-group-buffer)
11906 (gnus-group-get-new-news-this-group nil t)))))
11908 (mime-add-condition
11909 'action '((type . message)(subtype . rfc822)
11910 (major-mode . gnus-original-article-mode)
11911 (method . gnus-mime-extract-message/rfc822)
11915 (mime-add-condition
11916 'action '((type . message)(subtype . news)
11917 (major-mode . gnus-original-article-mode)
11918 (method . gnus-mime-extract-message/rfc822)
11922 (defun gnus-mime-extract-multipart (entity situation)
11923 (let ((children (mime-entity-children entity))
11924 mime-acting-situation-to-override
11927 (mime-play-entity (car children)
11928 (cons (assq 'mode situation)
11929 mime-acting-situation-to-override))
11930 (setq children (cdr children)))
11931 (if (setq f (cdr (assq 'after-method
11932 mime-acting-situation-to-override)))
11936 (mime-add-condition
11937 'action '((type . multipart)
11938 (method . gnus-mime-extract-multipart)
11947 (defun gnus-summary-inherit-default-charset ()
11948 "Import `default-mime-charset' from summary buffer.
11949 Also take care of `default-mime-charset-unlimited' if the LIMIT version
11951 (if (buffer-live-p gnus-summary-buffer)
11952 (let (d-m-c d-m-c-u)
11953 (with-current-buffer gnus-summary-buffer
11954 (setq d-m-c (if (local-variable-p 'default-mime-charset
11955 gnus-summary-buffer)
11956 default-mime-charset
11959 d-m-c-u (if (local-variable-p 'default-mime-charset-unlimited
11960 gnus-summary-buffer)
11961 (symbol-value 'default-mime-charset-unlimited)
11964 (kill-local-variable 'default-mime-charset)
11965 (set (make-local-variable 'default-mime-charset) d-m-c))
11967 (kill-local-variable 'default-mime-charset-unlimited)
11968 (set (make-local-variable 'default-mime-charset-unlimited)
11971 (defun gnus-summary-setup-default-charset ()
11972 "Setup newsgroup default charset."
11973 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11975 (setq gnus-newsgroup-charset nil)
11976 (set (make-local-variable 'default-mime-charset) nil)
11977 (when (boundp 'default-mime-charset-unlimited);; LIMIT
11978 (set (make-local-variable 'default-mime-charset-unlimited) nil)))
11979 (let ((ignored-charsets
11980 (or gnus-newsgroup-ephemeral-ignored-charsets
11982 (and gnus-newsgroup-name
11983 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11984 gnus-newsgroup-ignored-charsets)))
11986 (setq gnus-newsgroup-charset
11987 (or gnus-newsgroup-ephemeral-charset
11988 (when (and gnus-newsgroup-name
11989 (setq charset (gnus-parameter-charset
11990 gnus-newsgroup-name)))
11991 (make-local-variable 'default-mime-charset)
11992 (setq default-mime-charset charset))
11993 gnus-default-charset))
11994 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11995 ignored-charsets))))
12001 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12002 "Display the current article buffer fully MIME-buttonized.
12003 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12004 treated as multipart/mixed."
12006 (require 'gnus-art)
12007 (let ((gnus-unbuttonized-mime-types nil)
12008 (gnus-mime-display-multipart-as-mixed show-all-parts))
12009 (gnus-summary-show-article)))
12011 (defun gnus-summary-repair-multipart (article)
12012 "Add a Content-Type header to a multipart article without one."
12013 (interactive (list (gnus-summary-article-number)))
12014 (gnus-with-article article
12015 (message-narrow-to-head)
12016 (message-remove-header "Mime-Version")
12017 (goto-char (point-max))
12018 (insert "Mime-Version: 1.0\n")
12020 (when (search-forward "\n--" nil t)
12021 (let ((separator (buffer-substring (point) (point-at-eol))))
12022 (message-narrow-to-head)
12023 (message-remove-header "Content-Type")
12024 (goto-char (point-max))
12025 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12028 (let (gnus-mark-article-hook)
12029 (gnus-summary-select-article t t nil article)))
12031 (defun gnus-summary-toggle-display-buttonized ()
12032 "Toggle the buttonizing of the article buffer."
12034 (require 'gnus-art)
12035 (if (setq gnus-inhibit-mime-unbuttonizing
12036 (not gnus-inhibit-mime-unbuttonizing))
12037 (let ((gnus-unbuttonized-mime-types nil))
12038 (gnus-summary-show-article))
12039 (gnus-summary-show-article)))
12042 ;;; Intelli-mouse commmands
12045 (defun gnus-wheel-summary-scroll (event)
12047 (let ((amount (if (memq 'shift (event-modifiers event))
12048 (car gnus-wheel-scroll-amount)
12049 (cdr gnus-wheel-scroll-amount)))
12050 (direction (- (* (static-if (featurep 'xemacs)
12051 (event-button event)
12052 (cond ((eq 'mouse-4 (event-basic-type event))
12054 ((eq 'mouse-5 (event-basic-type event))
12058 (gnus-summary-scroll-up (* amount direction))
12059 (when (gnus-eval-in-buffer-window gnus-article-buffer
12062 (and (if (< 0 direction)
12063 (gnus-article-next-page 0)
12064 (gnus-article-prev-page 0)
12066 (if (setq edge (get-text-property
12067 (point-min) 'gnus-wheel-edge))
12068 (setq edge (* edge direction))
12071 (let ((buffer-read-only nil)
12072 (inhibit-read-only t))
12073 (put-text-property (point-min) (point-max)
12074 'gnus-wheel-edge direction)
12076 (or (> edge gnus-wheel-edge-resistance)
12077 (let ((buffer-read-only nil)
12078 (inhibit-read-only t))
12079 (put-text-property (point-min) (point-max)
12081 (* (1+ edge) direction))
12083 (eq last-command 'gnus-wheel-summary-scroll))))
12084 (gnus-summary-next-article nil nil (minusp direction)))))
12086 (defun gnus-wheel-install ()
12087 "Enable mouse wheel support on summary window."
12088 (when gnus-use-wheel
12090 '([(mouse-4)] [(shift mouse-4)] [(mouse-5)] [(shift mouse-5)])))
12092 (define-key gnus-summary-mode-map key
12093 'gnus-wheel-summary-scroll)))))
12095 (add-hook 'gnus-summary-mode-hook 'gnus-wheel-install)
12098 ;;; Traditional PGP commmands
12101 (defun gnus-summary-decrypt-article (&optional force)
12102 "Decrypt the current article in traditional PGP way.
12103 This will have permanent effect only in mail groups.
12104 If FORCE is non-nil, allow editing of articles even in read-only
12107 (gnus-summary-select-article t)
12108 (gnus-eval-in-buffer-window gnus-article-buffer
12112 (goto-char (point-min))
12113 (unless (re-search-forward (car pgg-armor-header-lines) nil t)
12114 (error "Not a traditional PGP message!"))
12115 (let ((armor-start (match-beginning 0)))
12116 (if (and (pgg-decrypt-region armor-start (point-max))
12117 (or force (not (gnus-group-read-only-p))))
12118 (let ((inhibit-read-only t)
12120 (delete-region armor-start
12122 (re-search-forward "^-+END PGP" nil t)
12123 (beginning-of-line 2)
12125 (insert-buffer-substring pgg-output-buffer))))))))
12127 (defun gnus-summary-verify-article ()
12128 "Verify the current article in traditional PGP way."
12131 (set-buffer gnus-original-article-buffer)
12132 (goto-char (point-min))
12133 (unless (re-search-forward "^-+BEGIN PGP SIGNED MESSAGE" nil t)
12134 (error "Not a traditional PGP message!"))
12135 (re-search-forward "^-+END PGP" nil t)
12136 (beginning-of-line 2)
12137 (call-interactively (function pgg-verify-region))))
12140 ;;; Generic summary marking commands
12143 (defvar gnus-summary-marking-alist
12144 '((read gnus-del-mark "d")
12145 (unread gnus-unread-mark "u")
12146 (ticked gnus-ticked-mark "!")
12147 (dormant gnus-dormant-mark "?")
12148 (expirable gnus-expirable-mark "e"))
12149 "An alist of names/marks/keystrokes.")
12151 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12152 (defvar gnus-summary-mark-map)
12154 (defun gnus-summary-make-all-marking-commands ()
12155 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12156 (dolist (elem gnus-summary-marking-alist)
12157 (apply 'gnus-summary-make-marking-command elem)))
12159 (defun gnus-summary-make-marking-command (name mark keystroke)
12160 (let ((map (make-sparse-keymap)))
12161 (define-key gnus-summary-generic-mark-map keystroke map)
12162 (dolist (lway `((next "next" next nil "n")
12163 (next-unread "next unread" next t "N")
12164 (prev "previous" prev nil "p")
12165 (prev-unread "previous unread" prev t "P")
12166 (nomove "" nil nil ,keystroke)))
12167 (let ((func (gnus-summary-make-marking-command-1
12168 mark (car lway) lway name)))
12169 (setq func (eval func))
12170 (define-key map (nth 4 lway) func)))))
12172 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12174 (format "gnus-summary-put-mark-as-%s%s"
12175 name (if (eq way 'nomove)
12177 (concat "-" (symbol-name way)))))
12180 "Mark the current article as %s%s.
12181 If N, the prefix, then repeat N times.
12182 If N is negative, move in reverse order.
12183 The difference between N and the actual number of articles marked is
12185 name (car (cdr lway)))
12187 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12189 (defun gnus-summary-generic-mark (n mark move unread)
12190 "Mark N articles with MARK."
12191 (unless (eq major-mode 'gnus-summary-mode)
12192 (error "This command can only be used in the summary buffer"))
12193 (gnus-summary-show-thread)
12196 ((eq move 'next) 1)
12197 ((eq move 'prev) -1)
12199 (if (zerop nummove)
12203 nummove (* -1 nummove))))
12204 (while (and (> n 0)
12205 (gnus-summary-mark-article nil mark)
12206 (zerop (gnus-summary-next-subject nummove unread t)))
12209 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12210 (gnus-summary-recenter)
12211 (gnus-summary-position-point)
12212 (gnus-set-mode-line 'summary)
12215 (defun gnus-summary-insert-articles (articles)
12216 (when (setq articles
12217 (gnus-sorted-difference articles
12218 (mapcar (lambda (h)
12219 (mail-header-number h))
12220 gnus-newsgroup-headers)))
12221 (setq gnus-newsgroup-headers
12223 gnus-newsgroup-headers
12224 (gnus-fetch-headers articles)
12225 'gnus-article-sort-by-number))
12226 ;; Suppress duplicates?
12227 (when gnus-suppress-duplicates
12228 (gnus-dup-suppress-articles))
12230 ;; We might want to build some more threads first.
12231 (when (and gnus-fetch-old-headers
12232 (eq gnus-headers-retrieved-by 'nov))
12233 (if (eq gnus-fetch-old-headers 'invisible)
12234 (gnus-build-all-threads)
12235 (gnus-build-old-threads)))
12236 ;; Let the Gnus agent mark articles as read.
12238 (gnus-agent-get-undownloaded-list))
12239 ;; Remove list identifiers from subject
12240 (when gnus-list-identifiers
12241 (gnus-summary-remove-list-identifiers))
12242 ;; First and last article in this newsgroup.
12243 (when gnus-newsgroup-headers
12244 (setq gnus-newsgroup-begin
12245 (mail-header-number (car gnus-newsgroup-headers))
12247 (mail-header-number
12248 (gnus-last-element gnus-newsgroup-headers))))
12249 (when gnus-use-scoring
12250 (gnus-possibly-score-headers))))
12252 (defun gnus-summary-insert-old-articles (&optional all)
12253 "Insert all old articles in this group.
12254 If ALL is non-nil, already read articles become readable.
12255 If ALL is a number, fetch this number of articles."
12258 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12261 ;; Some nntp servers lie about their active range. When
12262 ;; this happens, the active range can be in the millions.
12263 ;; Use a compressed range to avoid creating a huge list.
12264 (gnus-range-difference (list gnus-newsgroup-active) old))
12265 (setq len (gnus-range-length older))
12270 (let ((older-range (nreverse older)))
12274 (let* ((r (pop older-range))
12275 (min (if (numberp r) r (car r)))
12276 (max (if (numberp r) r (cdr r))))
12277 (while (and (<= min max)
12282 (setq older (gnus-uncompress-range older))))
12284 (setq older (gnus-uncompress-range older)))
12286 (when (and (numberp gnus-large-newsgroup)
12287 (> len gnus-large-newsgroup))
12288 (let* ((cursor-in-echo-area nil)
12289 (initial (gnus-parameter-large-newsgroup-initial
12290 gnus-newsgroup-name))
12294 "How many articles from %s (%s %d): "
12296 (gnus-group-decoded-name gnus-newsgroup-name) 35)
12297 (if initial "max" "default")
12300 (cons (number-to-string initial)
12302 (unless (string-match "^[ \t]*$" input)
12303 (setq all (string-to-number input))
12305 (let ((older-range (nreverse older)))
12309 (let* ((r (pop older-range))
12310 (min (if (numberp r) r (car r)))
12311 (max (if (numberp r) r (cdr r))))
12312 (while (and (<= min max)
12316 max (1- max))))))))))
12317 (setq older (gnus-uncompress-range older))))
12319 (message "No old news.")
12320 (gnus-summary-insert-articles older)
12321 (gnus-summary-limit (gnus-sorted-nunion old older))))
12322 (gnus-summary-position-point)))
12324 (defun gnus-summary-insert-new-articles ()
12325 "Insert all new articles in this group."
12328 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12329 (old-active gnus-newsgroup-active)
12330 (nnmail-fetched-sources (list t))
12332 (setq gnus-newsgroup-active
12333 (gnus-activate-group gnus-newsgroup-name 'scan))
12334 (setq i (cdr gnus-newsgroup-active))
12335 (while (> i (cdr old-active))
12339 (message "No gnus is bad news")
12340 (gnus-summary-insert-articles new)
12341 (setq gnus-newsgroup-unreads
12342 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12343 (gnus-summary-limit (gnus-sorted-nunion old new))))
12344 (gnus-summary-position-point)))
12346 (gnus-summary-make-all-marking-commands)
12348 (gnus-ems-redefine)
12350 (provide 'gnus-sum)
12352 (run-hooks 'gnus-sum-load-hook)
12354 ;; Local Variables:
12355 ;; coding: iso-8859-1
12358 ;;; gnus-sum.el ends here