1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-mode))
45 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
46 (autoload 'gnus-cache-write-active "gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
48 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
49 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
50 (autoload 'mm-uu-dissect "mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
52 "Deuglify broken Outlook (Express) articles and redisplay."
54 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
55 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
56 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
58 (defcustom gnus-kill-summary-on-exit t
59 "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group 'gnus-summary-exit
65 (defcustom gnus-fetch-old-headers nil
66 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
67 If an unread article in the group refers to an older, already
68 read (or just marked as read) article, the old article will not
69 normally be displayed in the Summary buffer. If this variable is
70 t, Gnus will attempt to grab the headers to the old articles, and
71 thereby build complete threads. If it has the value `some', all
72 old headers will be fetched but only enough headers to connect
73 otherwise loose threads will be displayed. This variable can
74 also be a number. In that case, no more than that number of old
75 headers will be fetched. If it has the value `invisible', all
76 old headers will be fetched, but none will be displayed.
78 The server has to support NOV for any of this to work.
80 This feature can seriously impact performance it ignores all
81 locally cached header entries."
83 :type '(choice (const :tag "off" nil)
88 (sexp :menu-tag "other" t)))
90 (defcustom gnus-refer-thread-limit 500
91 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
92 If t, fetch all the available old headers."
95 (sexp :menu-tag "other" t)))
97 (defcustom gnus-summary-make-false-root 'adopt
98 "*nil means that Gnus won't gather loose threads.
99 If the root of a thread has expired or been read in a previous
100 session, the information necessary to build a complete thread has been
101 lost. Instead of having many small sub-threads from this original thread
102 scattered all over the summary buffer, Gnus can gather them.
104 If non-nil, Gnus will try to gather all loose sub-threads from an
105 original thread into one large thread.
107 If this variable is non-nil, it should be one of `none', `adopt',
110 If this variable is `none', Gnus will not make a false root, but just
111 present the sub-threads after another.
112 If this variable is `dummy', Gnus will create a dummy root that will
113 have all the sub-threads as children.
114 If this variable is `adopt', Gnus will make one of the \"children\"
115 the parent and mark all the step-children as such.
116 If this variable is `empty', the \"children\" are printed with empty
117 subject fields. (Or rather, they will be printed with a string
118 given by the `gnus-summary-same-subject' variable.)"
120 :type '(choice (const :tag "off" nil)
126 (defcustom gnus-summary-make-false-root-always nil
127 "Always make a false dummy root."
132 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
133 "*A regexp to match subjects to be excluded from loose thread gathering.
134 As loose thread gathering is done on subjects only, that means that
135 there can be many false gatherings performed. By rooting out certain
136 common subjects, gathering might become saner."
140 (defcustom gnus-summary-gather-subject-limit nil
141 "*Maximum length of subject comparisons when gathering loose threads.
142 Use nil to compare full subjects. Setting this variable to a low
143 number will help gather threads that have been corrupted by
144 newsreaders chopping off subject lines, but it might also mean that
145 unrelated articles that have subject that happen to begin with the
146 same few characters will be incorrectly gathered.
148 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
151 :type '(choice (const :tag "off" nil)
153 (sexp :menu-tag "on" t)))
155 (defcustom gnus-simplify-subject-functions nil
156 "List of functions taking a string argument that simplify subjects.
157 The functions are applied recursively.
159 Useful functions to put in this list include:
160 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
161 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
163 :type '(repeat function))
165 (defcustom gnus-simplify-ignored-prefixes nil
166 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
168 :type '(choice (const :tag "off" nil)
171 (defcustom gnus-build-sparse-threads nil
172 "*If non-nil, fill in the gaps in threads.
173 If `some', only fill in the gaps that are needed to tie loose threads
174 together. If `more', fill in all leaf nodes that Gnus can find. If
175 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
177 :type '(choice (const :tag "off" nil)
180 (sexp :menu-tag "all" t)))
182 (defcustom gnus-summary-thread-gathering-function
183 'gnus-gather-threads-by-subject
184 "*Function used for gathering loose threads.
185 There are two pre-defined functions: `gnus-gather-threads-by-subject',
186 which only takes Subjects into consideration; and
187 `gnus-gather-threads-by-references', which compared the References
188 headers of the articles to find matches."
190 :type '(radio (function-item gnus-gather-threads-by-subject)
191 (function-item gnus-gather-threads-by-references)
192 (function :tag "other")))
194 (defcustom gnus-summary-same-subject ""
195 "*String indicating that the current article has the same subject as the previous.
196 This variable will only be used if the value of
197 `gnus-summary-make-false-root' is `empty'."
198 :group 'gnus-summary-format
201 (defcustom gnus-summary-goto-unread t
202 "*If t, many commands will go to the next unread article.
203 This applies to marking commands as well as other commands that
204 \"naturally\" select the next article, like, for instance, `SPC' at
205 the end of an article.
207 If nil, the marking commands do NOT go to the next unread article
208 \(they go to the next article instead). If `never', commands that
209 usually go to the next unread article, will go to the next article,
210 whether it is read or not."
211 :group 'gnus-summary-marks
212 :link '(custom-manual "(gnus)Setting Marks")
213 :type '(choice (const :tag "off" nil)
215 (sexp :menu-tag "on" t)))
217 (defcustom gnus-summary-default-score 0
218 "*Default article score level.
219 All scores generated by the score files will be added to this score.
220 If this variable is nil, scoring will be disabled."
221 :group 'gnus-score-default
222 :type '(choice (const :tag "disable")
225 (defcustom gnus-summary-default-high-score 0
226 "*Default threshold for a high scored article.
227 An article will be highlighted as high scored if its score is greater
230 :group 'gnus-score-default
233 (defcustom gnus-summary-default-low-score 0
234 "*Default threshold for a low scored article.
235 An article will be highlighted as low scored if its score is smaller
238 :group 'gnus-score-default
241 (defcustom gnus-summary-zcore-fuzz 0
242 "*Fuzziness factor for the zcore in the summary buffer.
243 Articles with scores closer than this to `gnus-summary-default-score'
245 :group 'gnus-summary-format
248 (defcustom gnus-simplify-subject-fuzzy-regexp nil
249 "*Strings to be removed when doing fuzzy matches.
250 This can either be a regular expression or list of regular expressions
251 that will be removed from subject strings if fuzzy subject
252 simplification is selected."
254 :type '(repeat regexp))
256 (defcustom gnus-show-threads t
257 "*If non-nil, display threads in summary mode."
261 (defcustom gnus-thread-hide-subtree nil
262 "*If non-nil, hide all threads initially.
263 This can be a predicate specifier which says which threads to hide.
264 If threads are hidden, you have to run the command
265 `gnus-summary-show-thread' by hand or select an article."
267 :type '(radio (sexp :format "Non-nil\n"
268 :match (lambda (widget value)
269 (not (or (consp value) (functionp value))))
272 (sexp :tag "Predicate specifier")))
274 (defcustom gnus-thread-hide-killed t
275 "*If non-nil, hide killed threads automatically."
279 (defcustom gnus-thread-ignore-subject t
280 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
281 If nil, articles that have different subjects from their parents will
282 start separate threads."
286 (defcustom gnus-thread-operation-ignore-subject t
287 "*If non-nil, subjects will be ignored when doing thread commands.
288 This affects commands like `gnus-summary-kill-thread' and
289 `gnus-summary-lower-thread'.
291 If this variable is nil, articles in the same thread with different
292 subjects will not be included in the operation in question. If this
293 variable is `fuzzy', only articles that have subjects that are fuzzily
294 equal will be included."
296 :type '(choice (const :tag "off" nil)
300 (defcustom gnus-thread-indent-level 4
301 "*Number that says how much each sub-thread should be indented."
305 (defcustom gnus-auto-extend-newsgroup t
306 "*If non-nil, extend newsgroup forward and backward when requested."
307 :group 'gnus-summary-choose
310 (defcustom gnus-auto-select-first t
311 "If non-nil, select an article on group entry.
312 An article is selected automatically when entering a group
313 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
314 `gnus-summary-catchup-and-goto-next-group'.
316 Which article is selected is controlled by the variable
317 `gnus-auto-select-subject'.
319 If you want to prevent automatic selection of articles in some
320 newsgroups, set the variable to nil in `gnus-select-group-hook'."
321 ;; Commands include...
322 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
323 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
324 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
325 :group 'gnus-group-select
326 :type '(choice (const :tag "none" nil)
327 (sexp :menu-tag "first" t)))
329 (defcustom gnus-auto-select-subject 'unread
330 "*Says what subject to place under point when entering a group.
332 This variable can either be the symbols `first' (place point on the
333 first subject), `unread' (place point on the subject line of the first
334 unread article), `best' (place point on the subject line of the
335 higest-scored article), `unseen' (place point on the subject line of
336 the first unseen article), `unseen-or-unread' (place point on the subject
337 line of the first unseen article or, if all article have been seen, on the
338 subject line of the first unread article), or a function to be called to
339 place point on some subject line."
341 :group 'gnus-group-select
342 :type '(choice (const best)
346 (const unseen-or-unread)))
348 (defcustom gnus-auto-select-next t
349 "*If non-nil, offer to go to the next group from the end of the previous.
350 If the value is t and the next newsgroup is empty, Gnus will exit
351 summary mode and go back to group mode. If the value is neither nil
352 nor t, Gnus will select the following unread newsgroup. In
353 particular, if the value is the symbol `quietly', the next unread
354 newsgroup will be selected without any confirmation, and if it is
355 `almost-quietly', the next group will be selected without any
356 confirmation if you are located on the last article in the group.
357 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
358 will go to the next group without confirmation."
359 :group 'gnus-summary-maneuvering
360 :type '(choice (const :tag "off" nil)
362 (const almost-quietly)
363 (const slightly-quietly)
364 (sexp :menu-tag "on" t)))
366 (defcustom gnus-auto-select-same nil
367 "*If non-nil, select the next article with the same subject.
368 If there are no more articles with the same subject, go to
369 the first unread article."
370 :group 'gnus-summary-maneuvering
373 (defcustom gnus-auto-goto-ignores 'unfetched
374 "*Says how to handle unfetched articles when maneuvering.
376 This variable can either be the symbols nil (maneuver to any
377 article), `undownloaded' (maneuvering while unplugged ignores articles
378 that have not been fetched), `always-undownloaded' (maneuvering always
379 ignores articles that have not been fetched), `unfetched' (maneuvering
380 ignores articles whose headers have not been fetched).
382 NOTE: The list of unfetched articles will always be nil when plugged
383 and, when unplugged, a subset of the undownloaded article list."
385 :group 'gnus-summary-maneuvering
386 :type '(choice (const :tag "None" nil)
387 (const :tag "Undownloaded when unplugged" undownloaded)
388 (const :tag "Undownloaded" always-undownloaded)
389 (const :tag "Unfetched" unfetched)))
391 (defcustom gnus-summary-check-current nil
392 "*If non-nil, consider the current article when moving.
393 The \"unread\" movement commands will stay on the same line if the
394 current article is unread."
395 :group 'gnus-summary-maneuvering
398 (defcustom gnus-auto-center-summary 2
399 "*If non-nil, always center the current summary buffer.
400 In particular, if `vertical' do only vertical recentering. If non-nil
401 and non-`vertical', do both horizontal and vertical recentering."
402 :group 'gnus-summary-maneuvering
403 :type '(choice (const :tag "none" nil)
405 (integer :tag "height")
406 (sexp :menu-tag "both" t)))
408 (defvar gnus-auto-center-group t
409 "*If non-nil, always center the group buffer.")
411 (defcustom gnus-show-all-headers nil
412 "*If non-nil, don't hide any headers."
413 :group 'gnus-article-hiding
414 :group 'gnus-article-headers
417 (defcustom gnus-summary-ignore-duplicates nil
418 "*If non-nil, ignore articles with identical Message-ID headers."
422 (defcustom gnus-single-article-buffer t
423 "*If non-nil, display all articles in the same buffer.
424 If nil, each group will get its own article buffer."
425 :group 'gnus-article-various
428 (defcustom gnus-break-pages t
429 "*If non-nil, do page breaking on articles.
430 The page delimiter is specified by the `gnus-page-delimiter'
432 :group 'gnus-article-various
435 (defcustom gnus-move-split-methods nil
436 "*Variable used to suggest where articles are to be moved to.
437 It uses the same syntax as the `gnus-split-methods' variable.
438 However, whereas `gnus-split-methods' specifies file names as targets,
439 this variable specifies group names."
440 :group 'gnus-summary-mail
441 :type '(repeat (choice (list :value (fun) function)
442 (cons :value ("" "") regexp (repeat string))
445 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
446 "Function used to compute default prefix for article move/copy/etc prompts.
447 The function should take one argument, a group name, and return a
448 string with the suggested prefix."
449 :group 'gnus-summary-mail
452 ;; FIXME: Although the custom type is `character' for the following variables,
453 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
455 (defcustom gnus-unread-mark ? ;Whitespace
456 "*Mark used for unread articles."
457 :group 'gnus-summary-marks
460 (defcustom gnus-ticked-mark ?!
461 "*Mark used for ticked articles."
462 :group 'gnus-summary-marks
465 (defcustom gnus-dormant-mark ??
466 "*Mark used for dormant articles."
467 :group 'gnus-summary-marks
470 (defcustom gnus-del-mark ?r
471 "*Mark used for del'd articles."
472 :group 'gnus-summary-marks
475 (defcustom gnus-read-mark ?R
476 "*Mark used for read articles."
477 :group 'gnus-summary-marks
480 (defcustom gnus-expirable-mark ?E
481 "*Mark used for expirable articles."
482 :group 'gnus-summary-marks
485 (defcustom gnus-killed-mark ?K
486 "*Mark used for killed articles."
487 :group 'gnus-summary-marks
490 (defcustom gnus-spam-mark ?$
491 "*Mark used for spam articles."
493 :group 'gnus-summary-marks
496 (defcustom gnus-souped-mark ?F
497 "*Mark used for souped articles."
498 :group 'gnus-summary-marks
501 (defcustom gnus-kill-file-mark ?X
502 "*Mark used for articles killed by kill files."
503 :group 'gnus-summary-marks
506 (defcustom gnus-low-score-mark ?Y
507 "*Mark used for articles with a low score."
508 :group 'gnus-summary-marks
511 (defcustom gnus-catchup-mark ?C
512 "*Mark used for articles that are caught up."
513 :group 'gnus-summary-marks
516 (defcustom gnus-replied-mark ?A
517 "*Mark used for articles that have been replied to."
518 :group 'gnus-summary-marks
521 (defcustom gnus-forwarded-mark ?F
522 "*Mark used for articles that have been forwarded."
524 :group 'gnus-summary-marks
527 (defcustom gnus-recent-mark ?N
528 "*Mark used for articles that are recent."
530 :group 'gnus-summary-marks
533 (defcustom gnus-cached-mark ?*
534 "*Mark used for articles that are in the cache."
535 :group 'gnus-summary-marks
538 (defcustom gnus-saved-mark ?S
539 "*Mark used for articles that have been saved."
540 :group 'gnus-summary-marks
543 (defcustom gnus-unseen-mark ?.
544 "*Mark used for articles that haven't been seen."
546 :group 'gnus-summary-marks
549 (defcustom gnus-no-mark ? ;Whitespace
550 "*Mark used for articles that have no other secondary mark."
552 :group 'gnus-summary-marks
555 (defcustom gnus-ancient-mark ?O
556 "*Mark used for ancient articles."
557 :group 'gnus-summary-marks
560 (defcustom gnus-sparse-mark ?Q
561 "*Mark used for sparsely reffed articles."
562 :group 'gnus-summary-marks
565 (defcustom gnus-canceled-mark ?G
566 "*Mark used for canceled articles."
567 :group 'gnus-summary-marks
570 (defcustom gnus-duplicate-mark ?M
571 "*Mark used for duplicate articles."
572 :group 'gnus-summary-marks
575 (defcustom gnus-undownloaded-mark ?-
576 "*Mark used for articles that weren't downloaded."
578 :group 'gnus-summary-marks
581 (defcustom gnus-downloaded-mark ?+
582 "*Mark used for articles that were downloaded."
583 :group 'gnus-summary-marks
586 (defcustom gnus-downloadable-mark ?%
587 "*Mark used for articles that are to be downloaded."
588 :group 'gnus-summary-marks
591 (defcustom gnus-unsendable-mark ?=
592 "*Mark used for articles that won't be sent."
593 :group 'gnus-summary-marks
596 (defcustom gnus-score-over-mark ?+
597 "*Score mark used for articles with high scores."
598 :group 'gnus-summary-marks
601 (defcustom gnus-score-below-mark ?-
602 "*Score mark used for articles with low scores."
603 :group 'gnus-summary-marks
606 (defcustom gnus-empty-thread-mark ? ;Whitespace
607 "*There is no thread under the article."
608 :group 'gnus-summary-marks
611 (defcustom gnus-not-empty-thread-mark ?=
612 "*There is a thread under the article."
613 :group 'gnus-summary-marks
616 (defcustom gnus-view-pseudo-asynchronously nil
617 "*If non-nil, Gnus will view pseudo-articles asynchronously."
618 :group 'gnus-extract-view
621 (defcustom gnus-auto-expirable-marks
622 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
623 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
624 gnus-souped-mark gnus-duplicate-mark)
625 "*The list of marks converted into expiration if a group is auto-expirable."
628 :type '(repeat character))
630 (defcustom gnus-inhibit-user-auto-expire t
631 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
636 (defcustom gnus-view-pseudos nil
637 "*If `automatic', pseudo-articles will be viewed automatically.
638 If `not-confirm', pseudos will be viewed automatically, and the user
639 will not be asked to confirm the command."
640 :group 'gnus-extract-view
641 :type '(choice (const :tag "off" nil)
643 (const not-confirm)))
645 (defcustom gnus-view-pseudos-separately t
646 "*If non-nil, one pseudo-article will be created for each file to be viewed.
647 If nil, all files that use the same viewing command will be given as a
648 list of parameters to that command."
649 :group 'gnus-extract-view
652 (defcustom gnus-insert-pseudo-articles t
653 "*If non-nil, insert pseudo-articles when decoding articles."
654 :group 'gnus-extract-view
657 (defcustom gnus-summary-dummy-line-format
659 "*The format specification for the dummy roots in the summary buffer.
660 It works along the same lines as a normal formatting string,
661 with some simple extensions.
665 General format specifiers can also be used.
666 See `(gnus)Formatting Variables'."
667 :link '(custom-manual "(gnus)Formatting Variables")
668 :group 'gnus-threading
671 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
672 "*The format specification for the summary mode line.
673 It works along the same lines as a normal formatting string,
674 with some simple extensions:
677 %p Unprefixed group name
678 %A Current article number
679 %z Current article score
681 %U Number of unread articles in the group
682 %e Number of unselected articles in the group
683 %Z A string with unread/unselected article counts
684 %g Shortish group name
685 %S Subject of the current article
687 %s Current score file name
688 %d Number of dormant articles
689 %r Number of articles that have been marked as read in this session
690 %E Number of articles expunged by the score files"
691 :group 'gnus-summary-format
694 (defcustom gnus-list-identifiers nil
695 "Regexp that matches list identifiers to be removed from subject.
696 This can also be a list of regexps."
698 :group 'gnus-summary-format
699 :group 'gnus-article-hiding
700 :type '(choice (const :tag "none" nil)
702 (repeat :value (".*") regexp)))
704 (defcustom gnus-summary-mark-below 0
705 "*Mark all articles with a score below this variable as read.
706 This variable is local to each summary buffer and usually set by the
708 :group 'gnus-score-default
711 (defun gnus-widget-reversible-match (widget value)
712 "Ignoring WIDGET, convert VALUE to internal form.
713 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
717 (eq (length value) 2)
718 (eq (nth 0 value) 'not)
719 (symbolp (nth 1 value)))))
721 (defun gnus-widget-reversible-to-internal (widget value)
722 "Ignoring WIDGET, convert VALUE to internal form.
723 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
724 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
728 (list (nth 1 value) t)))
730 (defun gnus-widget-reversible-to-external (widget value)
731 "Ignoring WIDGET, convert VALUE to external form.
732 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
733 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
736 (list 'not (nth 0 value))
739 (define-widget 'gnus-widget-reversible 'group
740 "A `group' that convert values."
741 :match 'gnus-widget-reversible-match
742 :value-to-internal 'gnus-widget-reversible-to-internal
743 :value-to-external 'gnus-widget-reversible-to-external)
745 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
746 "*List of functions used for sorting articles in the summary buffer.
748 Each function takes two articles and returns non-nil if the first
749 article should be sorted before the other. If you use more than one
750 function, the primary sort function should be the last. You should
751 probably always include `gnus-article-sort-by-number' in the list of
752 sorting functions -- preferably first. Also note that sorting by date
753 is often much slower than sorting by number, and the sorting order is
754 very similar. (Sorting by date means sorting by the time the message
755 was sent, sorting by number means sorting by arrival time.)
757 Each item can also be a list `(not F)' where F is a function;
758 this reverses the sort order.
760 Ready-made functions include `gnus-article-sort-by-number',
761 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
762 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
763 and `gnus-article-sort-by-score'.
765 When threading is turned on, the variable `gnus-thread-sort-functions'
766 controls how articles are sorted."
767 :group 'gnus-summary-sort
768 :type '(repeat (gnus-widget-reversible
769 (choice (function-item gnus-article-sort-by-number)
770 (function-item gnus-article-sort-by-author)
771 (function-item gnus-article-sort-by-subject)
772 (function-item gnus-article-sort-by-date)
773 (function-item gnus-article-sort-by-score)
774 (function-item gnus-article-sort-by-random)
775 (function :tag "other"))
776 (boolean :tag "Reverse order"))))
779 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
780 "*List of functions used for sorting threads in the summary buffer.
781 By default, threads are sorted by article number.
783 Each function takes two threads and returns non-nil if the first
784 thread should be sorted before the other. If you use more than one
785 function, the primary sort function should be the last. You should
786 probably always include `gnus-thread-sort-by-number' in the list of
787 sorting functions -- preferably first. Also note that sorting by date
788 is often much slower than sorting by number, and the sorting order is
789 very similar. (Sorting by date means sorting by the time the message
790 was sent, sorting by number means sorting by arrival time.)
792 Each list item can also be a list `(not F)' where F is a
793 function; this specifies reversed sort order.
795 Ready-made functions include `gnus-thread-sort-by-number',
796 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
797 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
798 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
799 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
800 and `gnus-thread-sort-by-total-score' (see
801 `gnus-thread-score-function').
803 When threading is turned off, the variable
804 `gnus-article-sort-functions' controls how articles are sorted."
805 :group 'gnus-summary-sort
807 (gnus-widget-reversible
808 (choice (function-item gnus-thread-sort-by-number)
809 (function-item gnus-thread-sort-by-author)
810 (function-item gnus-thread-sort-by-recipient)
811 (function-item gnus-thread-sort-by-subject)
812 (function-item gnus-thread-sort-by-date)
813 (function-item gnus-thread-sort-by-score)
814 (function-item gnus-thread-sort-by-most-recent-number)
815 (function-item gnus-thread-sort-by-most-recent-date)
816 (function-item gnus-thread-sort-by-random)
817 (function-item gnus-thread-sort-by-total-score)
818 (function :tag "other"))
819 (boolean :tag "Reverse order"))))
821 (defcustom gnus-thread-score-function '+
822 "*Function used for calculating the total score of a thread.
824 The function is called with the scores of the article and each
825 subthread and should then return the score of the thread.
827 Some functions you can use are `+', `max', or `min'."
828 :group 'gnus-summary-sort
831 (defcustom gnus-summary-expunge-below nil
832 "All articles that have a score less than this variable will be expunged.
833 This variable is local to the summary buffers."
834 :group 'gnus-score-default
835 :type '(choice (const :tag "off" nil)
838 (defcustom gnus-thread-expunge-below nil
839 "All threads that have a total score less than this variable will be expunged.
840 See `gnus-thread-score-function' for en explanation of what a
843 This variable is local to the summary buffers."
844 :group 'gnus-threading
845 :group 'gnus-score-default
846 :type '(choice (const :tag "off" nil)
849 (defcustom gnus-summary-mode-hook nil
850 "*A hook for Gnus summary mode.
851 This hook is run before any variables are set in the summary buffer."
852 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
853 :group 'gnus-summary-various
856 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
857 (when (featurep 'xemacs)
858 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
859 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
860 (add-hook 'gnus-summary-mode-hook
861 'gnus-xmas-switch-horizontal-scrollbar-off))
863 (defcustom gnus-summary-menu-hook nil
864 "*Hook run after the creation of the summary mode menu."
865 :group 'gnus-summary-visual
868 (defcustom gnus-summary-exit-hook nil
869 "*A hook called on exit from the summary buffer.
870 It will be called with point in the group buffer."
871 :group 'gnus-summary-exit
874 (defcustom gnus-summary-prepare-hook nil
875 "*A hook called after the summary buffer has been generated.
876 If you want to modify the summary buffer, you can use this hook."
877 :group 'gnus-summary-various
880 (defcustom gnus-summary-prepared-hook nil
881 "*A hook called as the last thing after the summary buffer has been generated."
882 :group 'gnus-summary-various
885 (defcustom gnus-summary-generate-hook nil
886 "*A hook run just before generating the summary buffer.
887 This hook is commonly used to customize threading variables and the
889 :group 'gnus-summary-various
892 (defcustom gnus-select-group-hook nil
893 "*A hook called when a newsgroup is selected.
895 If you'd like to simplify subjects like the
896 `gnus-summary-next-same-subject' command does, you can use the
899 (add-hook gnus-select-group-hook
901 (mapcar (lambda (header)
902 (mail-header-set-subject
904 (gnus-simplify-subject
905 (mail-header-subject header) 're-only)))
906 gnus-newsgroup-headers)))"
907 :group 'gnus-group-select
910 (defcustom gnus-select-article-hook nil
911 "*A hook called when an article is selected."
912 :group 'gnus-summary-choose
913 :options '(gnus-agent-fetch-selected-article)
916 (defcustom gnus-visual-mark-article-hook
917 (list 'gnus-highlight-selected-summary)
918 "*Hook run after selecting an article in the summary buffer.
919 It is meant to be used for highlighting the article in some way. It
920 is not run if `gnus-visual' is nil."
921 :group 'gnus-summary-visual
924 (defcustom gnus-parse-headers-hook nil
925 "*A hook called before parsing the headers."
929 (defcustom gnus-exit-group-hook nil
930 "*A hook called when exiting summary mode.
931 This hook is not called from the non-updating exit commands like `Q'."
935 (defcustom gnus-summary-update-hook
936 (list 'gnus-summary-highlight-line)
937 "*A hook called when a summary line is changed.
938 The hook will not be called if `gnus-visual' is nil.
940 The default function `gnus-summary-highlight-line' will
941 highlight the line according to the `gnus-summary-highlight'
943 :group 'gnus-summary-visual
946 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
947 "*A hook called when an article is selected for the first time.
948 The hook is intended to mark an article as read (or unread)
949 automatically when it is selected."
950 :group 'gnus-summary-choose
953 (defcustom gnus-group-no-more-groups-hook nil
954 "*A hook run when returning to group mode having no more (unread) groups."
955 :group 'gnus-group-select
958 (defcustom gnus-ps-print-hook nil
959 "*A hook run before ps-printing something from Gnus."
963 (defcustom gnus-summary-article-move-hook nil
964 "*A hook called after an article is moved, copied, respooled, or crossposted."
969 (defcustom gnus-summary-article-delete-hook nil
970 "*A hook called after an article is deleted."
975 (defcustom gnus-summary-article-expire-hook nil
976 "*A hook called after an article is expired."
981 (defcustom gnus-summary-display-arrow
982 (and (fboundp 'display-graphic-p)
984 "*If non-nil, display an arrow highlighting the current article."
989 (defcustom gnus-summary-selected-face 'gnus-summary-selected
990 "Face used for highlighting the current article in the summary buffer."
991 :group 'gnus-summary-visual
994 (defvar gnus-tmp-downloaded nil)
996 (defcustom gnus-summary-highlight
997 '(((eq mark gnus-canceled-mark)
998 . gnus-summary-cancelled)
999 ((and uncached (> score default-high))
1000 . gnus-summary-high-undownloaded)
1001 ((and uncached (< score default-low))
1002 . gnus-summary-low-undownloaded)
1004 . gnus-summary-normal-undownloaded)
1005 ((and (> score default-high)
1006 (or (eq mark gnus-dormant-mark)
1007 (eq mark gnus-ticked-mark)))
1008 . gnus-summary-high-ticked)
1009 ((and (< score default-low)
1010 (or (eq mark gnus-dormant-mark)
1011 (eq mark gnus-ticked-mark)))
1012 . gnus-summary-low-ticked)
1013 ((or (eq mark gnus-dormant-mark)
1014 (eq mark gnus-ticked-mark))
1015 . gnus-summary-normal-ticked)
1016 ((and (> score default-high) (eq mark gnus-ancient-mark))
1017 . gnus-summary-high-ancient)
1018 ((and (< score default-low) (eq mark gnus-ancient-mark))
1019 . gnus-summary-low-ancient)
1020 ((eq mark gnus-ancient-mark)
1021 . gnus-summary-normal-ancient)
1022 ((and (> score default-high) (eq mark gnus-unread-mark))
1023 . gnus-summary-high-unread)
1024 ((and (< score default-low) (eq mark gnus-unread-mark))
1025 . gnus-summary-low-unread)
1026 ((eq mark gnus-unread-mark)
1027 . gnus-summary-normal-unread)
1028 ((> score default-high)
1029 . gnus-summary-high-read)
1030 ((< score default-low)
1031 . gnus-summary-low-read)
1033 . gnus-summary-normal-read))
1034 "*Controls the highlighting of summary buffer lines.
1036 A list of (FORM . FACE) pairs. When deciding how a a particular
1037 summary line should be displayed, each form is evaluated. The content
1038 of the face field after the first true form is used. You can change
1039 how those summary lines are displayed, by editing the face field.
1041 You can use the following variables in the FORM field.
1043 score: The article's score
1044 default: The default article score.
1045 default-high: The default score for high scored articles.
1046 default-low: The default score for low scored articles.
1047 below: The score below which articles are automatically marked as read.
1048 mark: The article's mark.
1049 uncached: Non-nil if the article is uncached."
1050 :group 'gnus-summary-visual
1051 :type '(repeat (cons (sexp :tag "Form" nil)
1054 (defcustom gnus-alter-header-function nil
1055 "Function called to allow alteration of article header structures.
1056 The function is called with one parameter, the article header vector,
1057 which it may alter in any way."
1058 :type '(choice (const :tag "None" nil)
1060 :group 'gnus-summary)
1062 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1063 "Function used to decode a string with encoded words.")
1065 (defvar gnus-decode-encoded-address-function
1066 'mail-decode-encoded-address-string
1067 "Function used to decode addresses with encoded words.")
1069 (defcustom gnus-extra-headers '(To Newsgroups)
1070 "*Extra headers to parse."
1072 :group 'gnus-summary
1073 :type '(repeat symbol))
1075 (defcustom gnus-ignored-from-addresses
1076 (and user-mail-address
1077 (not (string= user-mail-address ""))
1078 (regexp-quote user-mail-address))
1079 "*From headers that may be suppressed in favor of To headers.
1080 This can be a regexp or a list of regexps."
1082 :group 'gnus-summary
1083 :type '(choice regexp
1084 (repeat :tag "Regexp List" regexp)))
1086 (defsubst gnus-ignored-from-addresses ()
1087 (gnus-orify-regexp gnus-ignored-from-addresses))
1089 (defcustom gnus-summary-to-prefix "-> "
1090 "*String prefixed to the To field in the summary line when
1091 using `gnus-ignored-from-addresses'."
1093 :group 'gnus-summary
1096 (defcustom gnus-summary-newsgroup-prefix "=> "
1097 "*String prefixed to the Newsgroup field in the summary
1098 line when using `gnus-ignored-from-addresses'."
1100 :group 'gnus-summary
1103 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1104 "List of charsets that should be ignored.
1105 When these charsets are used in the \"charset\" parameter, the
1106 default charset will be used instead."
1108 :type '(repeat symbol)
1109 :group 'gnus-charset)
1111 (gnus-define-group-parameter
1115 "Return the ignored charsets of GROUP."
1116 :variable gnus-group-ignored-charsets-alist
1118 '(("alt\\.chinese\\.text" iso-8859-1))
1120 "Alist of regexps (to match group names) and charsets that should be ignored.
1121 When these charsets are used in the \"charset\" parameter, the
1122 default charset will be used instead."
1123 :variable-group gnus-charset
1124 :variable-type '(repeat (cons (regexp :tag "Group")
1126 :parameter-type '(choice :tag "Ignored charsets"
1129 :parameter-document "\
1130 List of charsets that should be ignored.
1132 When these charsets are used in the \"charset\" parameter, the
1133 default charset will be used instead.")
1135 (defcustom gnus-group-highlight-words-alist nil
1136 "Alist of group regexps and highlight regexps.
1137 This variable uses the same syntax as `gnus-emphasis-alist'."
1139 :type '(repeat (cons (regexp :tag "Group")
1140 (repeat (list (regexp :tag "Highlight regexp")
1141 (number :tag "Group for entire word" 0)
1142 (number :tag "Group for displayed part" 0)
1144 gnus-emphasis-highlight-words)))))
1145 :group 'gnus-summary-visual)
1147 (defcustom gnus-summary-show-article-charset-alist
1149 "Alist of number and charset.
1150 The article will be shown with the charset corresponding to the
1152 For example: ((1 . cn-gb-2312) (2 . big5))."
1154 :type '(repeat (cons (number :tag "Argument" 1)
1155 (symbol :tag "Charset")))
1156 :group 'gnus-charset)
1158 (defcustom gnus-preserve-marks t
1159 "Whether marks are preserved when moving, copying and respooling messages."
1162 :group 'gnus-summary-marks)
1164 (defcustom gnus-alter-articles-to-read-function nil
1165 "Function to be called to alter the list of articles to be selected."
1166 :type '(choice (const nil) function)
1167 :group 'gnus-summary)
1169 (defcustom gnus-orphan-score nil
1170 "*All orphans get this score added. Set in the score file."
1171 :group 'gnus-score-default
1172 :type '(choice (const nil)
1175 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1176 "*A regexp to match MIME parts when saving multiple parts of a
1177 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1178 This regexp will be used by default when prompting the user for which
1179 type of files to save."
1180 :group 'gnus-summary
1183 (defcustom gnus-read-all-available-headers nil
1184 "Whether Gnus should parse all headers made available to it.
1185 This is mostly relevant for slow back ends where the user may
1186 wish to widen the summary buffer to include all headers
1187 that were fetched. Say, for nnultimate groups."
1189 :group 'gnus-summary
1190 :type '(choice boolean regexp))
1192 (defcustom gnus-summary-muttprint-program "muttprint"
1193 "Command (and optional arguments) used to run Muttprint."
1195 :group 'gnus-summary
1198 (defcustom gnus-article-loose-mime t
1199 "If non-nil, don't require MIME-Version header.
1200 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1201 supply the MIME-Version header or deliberately strip it from the mail.
1202 If non-nil (the default), Gnus will treat some articles as MIME
1203 even if the MIME-Version header is missing."
1206 :group 'gnus-article-mime)
1208 (defcustom gnus-article-emulate-mime t
1209 "If non-nil, use MIME emulation for uuencode and the like.
1210 This means that Gnus will search message bodies for text that look
1211 like uuencoded bits, yEncoded bits, and so on, and present that using
1212 the normal Gnus MIME machinery."
1215 :group 'gnus-article-mime)
1217 ;;; Internal variables
1219 (defvar gnus-summary-display-cache nil)
1220 (defvar gnus-article-mime-handles nil)
1221 (defvar gnus-article-decoded-p nil)
1222 (defvar gnus-article-charset nil)
1223 (defvar gnus-article-ignored-charsets nil)
1224 (defvar gnus-scores-exclude-files nil)
1225 (defvar gnus-page-broken nil)
1227 (defvar gnus-original-article nil)
1228 (defvar gnus-article-internal-prepare-hook nil)
1229 (defvar gnus-newsgroup-process-stack nil)
1231 (defvar gnus-thread-indent-array nil)
1232 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1233 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1234 "Function called to sort the articles within a thread after it has been gathered together.")
1236 (defvar gnus-summary-save-parts-type-history nil)
1237 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1239 ;; Avoid highlighting in kill files.
1240 (defvar gnus-summary-inhibit-highlight nil)
1241 (defvar gnus-newsgroup-selected-overlay nil)
1242 (defvar gnus-inhibit-limiting nil)
1243 (defvar gnus-newsgroup-adaptive-score-file nil)
1244 (defvar gnus-current-score-file nil)
1245 (defvar gnus-current-move-group nil)
1246 (defvar gnus-current-copy-group nil)
1247 (defvar gnus-current-crosspost-group nil)
1248 (defvar gnus-newsgroup-display nil)
1250 (defvar gnus-newsgroup-dependencies nil)
1251 (defvar gnus-newsgroup-adaptive nil)
1252 (defvar gnus-summary-display-article-function nil)
1253 (defvar gnus-summary-highlight-line-function nil
1254 "Function called after highlighting a summary line.")
1256 (defvar gnus-summary-line-format-alist
1257 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1258 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1259 (?s gnus-tmp-subject-or-nil ?s)
1260 (?n gnus-tmp-name ?s)
1261 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1263 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1265 (?F gnus-tmp-from ?s)
1266 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1267 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1268 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1269 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1270 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1271 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1272 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1273 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1274 (?L gnus-tmp-lines ?s)
1275 (?O gnus-tmp-downloaded ?c)
1276 (?I gnus-tmp-indentation ?s)
1277 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1278 (?R gnus-tmp-replied ?c)
1279 (?\[ gnus-tmp-opening-bracket ?c)
1280 (?\] gnus-tmp-closing-bracket ?c)
1281 (?\> (make-string gnus-tmp-level ? ) ?s)
1282 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1283 (?i gnus-tmp-score ?d)
1284 (?z gnus-tmp-score-char ?c)
1285 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1286 (?U gnus-tmp-unread ?c)
1287 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1289 (?t (gnus-summary-number-of-articles-in-thread
1290 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1292 (?e (gnus-summary-number-of-articles-in-thread
1293 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1295 (?u gnus-tmp-user-defined ?s)
1296 (?P (gnus-pick-line-number) ?d)
1297 (?B gnus-tmp-thread-tree-header-string ?s)
1298 (user-date (gnus-user-date
1299 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1300 "An alist of format specifications that can appear in summary lines.
1301 These are paired with what variables they correspond with, along with
1302 the type of the variable (string, integer, character, etc).")
1304 (defvar gnus-summary-dummy-line-format-alist
1305 `((?S gnus-tmp-subject ?s)
1306 (?N gnus-tmp-number ?d)
1307 (?u gnus-tmp-user-defined ?s)))
1309 (defvar gnus-summary-mode-line-format-alist
1310 `((?G gnus-tmp-group-name ?s)
1311 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1312 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1313 (?A gnus-tmp-article-number ?d)
1314 (?Z gnus-tmp-unread-and-unselected ?s)
1315 (?V gnus-version ?s)
1316 (?U gnus-tmp-unread-and-unticked ?d)
1317 (?S gnus-tmp-subject ?s)
1318 (?e gnus-tmp-unselected ?d)
1319 (?u gnus-tmp-user-defined ?s)
1320 (?d (length gnus-newsgroup-dormant) ?d)
1321 (?t (length gnus-newsgroup-marked) ?d)
1322 (?h (length gnus-newsgroup-spam-marked) ?d)
1323 (?r (length gnus-newsgroup-reads) ?d)
1324 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1325 (?E gnus-newsgroup-expunged-tally ?d)
1326 (?s (gnus-current-score-file-nondirectory) ?s)))
1328 (defvar gnus-last-search-regexp nil
1329 "Default regexp for article search command.")
1331 (defvar gnus-last-shell-command nil
1332 "Default shell command on article.")
1334 (defvar gnus-newsgroup-agentized nil
1335 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1336 (defvar gnus-newsgroup-begin nil)
1337 (defvar gnus-newsgroup-end nil)
1338 (defvar gnus-newsgroup-last-rmail nil)
1339 (defvar gnus-newsgroup-last-mail nil)
1340 (defvar gnus-newsgroup-last-folder nil)
1341 (defvar gnus-newsgroup-last-file nil)
1342 (defvar gnus-newsgroup-last-directory nil)
1343 (defvar gnus-newsgroup-auto-expire nil)
1344 (defvar gnus-newsgroup-active nil)
1346 (defvar gnus-newsgroup-data nil)
1347 (defvar gnus-newsgroup-data-reverse nil)
1348 (defvar gnus-newsgroup-limit nil)
1349 (defvar gnus-newsgroup-limits nil)
1350 (defvar gnus-summary-use-undownloaded-faces nil)
1352 (defvar gnus-newsgroup-unreads nil
1353 "Sorted list of unread articles in the current newsgroup.")
1355 (defvar gnus-newsgroup-unselected nil
1356 "Sorted list of unselected unread articles in the current newsgroup.")
1358 (defvar gnus-newsgroup-reads nil
1359 "Alist of read articles and article marks in the current newsgroup.")
1361 (defvar gnus-newsgroup-expunged-tally nil)
1363 (defvar gnus-newsgroup-marked nil
1364 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1366 (defvar gnus-newsgroup-spam-marked nil
1367 "List of ranges of articles that have been marked as spam.")
1369 (defvar gnus-newsgroup-killed nil
1370 "List of ranges of articles that have been through the scoring process.")
1372 (defvar gnus-newsgroup-cached nil
1373 "Sorted list of articles that come from the article cache.")
1375 (defvar gnus-newsgroup-saved nil
1376 "List of articles that have been saved.")
1378 (defvar gnus-newsgroup-kill-headers nil)
1380 (defvar gnus-newsgroup-replied nil
1381 "List of articles that have been replied to in the current newsgroup.")
1383 (defvar gnus-newsgroup-forwarded nil
1384 "List of articles that have been forwarded in the current newsgroup.")
1386 (defvar gnus-newsgroup-recent nil
1387 "List of articles that have are recent in the current newsgroup.")
1389 (defvar gnus-newsgroup-expirable nil
1390 "Sorted list of articles in the current newsgroup that can be expired.")
1392 (defvar gnus-newsgroup-processable nil
1393 "List of articles in the current newsgroup that can be processed.")
1395 (defvar gnus-newsgroup-downloadable nil
1396 "Sorted list of articles in the current newsgroup that can be processed.")
1398 (defvar gnus-newsgroup-unfetched nil
1399 "Sorted list of articles in the current newsgroup whose headers have
1400 not been fetched into the agent.
1402 This list will always be a subset of gnus-newsgroup-undownloaded.")
1404 (defvar gnus-newsgroup-undownloaded nil
1405 "List of articles in the current newsgroup that haven't been downloaded.")
1407 (defvar gnus-newsgroup-unsendable nil
1408 "List of articles in the current newsgroup that won't be sent.")
1410 (defvar gnus-newsgroup-bookmarks nil
1411 "List of articles in the current newsgroup that have bookmarks.")
1413 (defvar gnus-newsgroup-dormant nil
1414 "Sorted list of dormant articles in the current newsgroup.")
1416 (defvar gnus-newsgroup-unseen nil
1417 "List of unseen articles in the current newsgroup.")
1419 (defvar gnus-newsgroup-seen nil
1420 "Range of seen articles in the current newsgroup.")
1422 (defvar gnus-newsgroup-articles nil
1423 "List of articles in the current newsgroup.")
1425 (defvar gnus-newsgroup-scored nil
1426 "List of scored articles in the current newsgroup.")
1428 (defvar gnus-newsgroup-headers nil
1429 "List of article headers in the current newsgroup.")
1431 (defvar gnus-newsgroup-threads nil)
1433 (defvar gnus-newsgroup-prepared nil
1434 "Whether the current group has been prepared properly.")
1436 (defvar gnus-newsgroup-ancient nil
1437 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1439 (defvar gnus-newsgroup-sparse nil)
1441 (defvar gnus-current-article nil)
1442 (defvar gnus-article-current nil)
1443 (defvar gnus-current-headers nil)
1444 (defvar gnus-have-all-headers nil)
1445 (defvar gnus-last-article nil)
1446 (defvar gnus-newsgroup-history nil)
1447 (defvar gnus-newsgroup-charset nil)
1448 (defvar gnus-newsgroup-ephemeral-charset nil)
1449 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1451 (defvar gnus-article-before-search nil)
1453 (defvar gnus-summary-local-variables
1454 '(gnus-newsgroup-name
1455 gnus-newsgroup-begin gnus-newsgroup-end
1456 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1457 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1458 gnus-newsgroup-last-directory
1459 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1460 gnus-newsgroup-unselected gnus-newsgroup-marked
1461 gnus-newsgroup-spam-marked
1462 gnus-newsgroup-reads gnus-newsgroup-saved
1463 gnus-newsgroup-replied gnus-newsgroup-forwarded
1464 gnus-newsgroup-recent
1465 gnus-newsgroup-expirable
1466 gnus-newsgroup-processable gnus-newsgroup-killed
1467 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1468 gnus-newsgroup-unfetched
1469 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1470 gnus-newsgroup-seen gnus-newsgroup-articles
1471 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1472 gnus-newsgroup-headers gnus-newsgroup-threads
1473 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1474 gnus-current-article gnus-current-headers gnus-have-all-headers
1475 gnus-last-article gnus-article-internal-prepare-hook
1476 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1477 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1478 gnus-thread-expunge-below
1479 gnus-score-alist gnus-current-score-file
1480 (gnus-summary-expunge-below . global)
1481 (gnus-summary-mark-below . global)
1482 (gnus-orphan-score . global)
1483 gnus-newsgroup-active gnus-scores-exclude-files
1484 gnus-newsgroup-history gnus-newsgroup-ancient
1485 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1486 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1487 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1488 (gnus-newsgroup-expunged-tally . 0)
1489 gnus-cache-removable-articles gnus-newsgroup-cached
1490 gnus-newsgroup-data gnus-newsgroup-data-reverse
1491 gnus-newsgroup-limit gnus-newsgroup-limits
1492 gnus-newsgroup-charset gnus-newsgroup-display
1493 gnus-summary-use-undownloaded-faces)
1494 "Variables that are buffer-local to the summary buffers.")
1496 (defvar gnus-newsgroup-variables nil
1497 "A list of variables that have separate values in different newsgroups.
1498 A list of newsgroup (summary buffer) local variables, or cons of
1499 variables and their default expressions to be evalled (when the default
1500 values are not nil), that should be made global while the summary buffer
1503 Note: The default expressions will be evaluated (using function `eval')
1504 before assignment to the local variable rather than just assigned to it.
1505 If the default expression is the symbol `global', that symbol will not
1506 be evaluated but the global value of the local variable will be used
1509 These variables can be used to set variables in the group parameters
1510 while still allowing them to affect operations done in other buffers.
1513 \(setq gnus-newsgroup-variables
1514 '(message-use-followup-to
1515 (gnus-visible-headers .
1516 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1519 ;; Byte-compiler warning.
1521 ;; Bind features so that require will believe that gnus-sum has
1522 ;; already been loaded (avoids infinite recursion)
1523 (let ((features (cons 'gnus-sum features)))
1524 ;; Several of the declarations in gnus-sum are needed to load the
1525 ;; following files. Right now, these definitions have been
1526 ;; compiled but not defined (evaluated). We could either do a
1527 ;; eval-and-compile about all of the declarations or evaluate the
1529 (if (boundp 'gnus-newsgroup-variables)
1531 (load "gnus-sum.el" t t t))
1533 (require 'gnus-art)))
1537 (defvar gnus-decode-encoded-word-methods
1538 '(mail-decode-encoded-word-string)
1539 "List of methods used to decode encoded words.
1541 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1542 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1543 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1544 whose names match REGEXP.
1547 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1548 mail-decode-encoded-word-string
1549 (\"chinese\" . rfc1843-decode-string))")
1551 (defvar gnus-decode-encoded-word-methods-cache nil)
1553 (defun gnus-multi-decode-encoded-word-string (string)
1554 "Apply the functions from `gnus-encoded-word-methods' that match."
1555 (unless (and gnus-decode-encoded-word-methods-cache
1556 (eq gnus-newsgroup-name
1557 (car gnus-decode-encoded-word-methods-cache)))
1558 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1561 (nconc gnus-decode-encoded-word-methods-cache (list x))
1562 (if (and gnus-newsgroup-name
1563 (string-match (car x) gnus-newsgroup-name))
1564 (nconc gnus-decode-encoded-word-methods-cache
1566 gnus-decode-encoded-word-methods))
1567 (let ((xlist gnus-decode-encoded-word-methods-cache))
1570 (setq string (funcall (pop xlist) string))))
1573 ;; Subject simplification.
1575 (defun gnus-simplify-whitespace (str)
1576 "Remove excessive whitespace from STR."
1578 (while (string-match "[ \t][ \t]+" str)
1579 (setq str (concat (substring str 0 (match-beginning 0))
1581 (substring str (match-end 0)))))
1583 (when (string-match "^[ \t]+" str)
1584 (setq str (substring str (match-end 0))))
1586 (when (string-match "[ \t]+$" str)
1587 (setq str (substring str 0 (match-beginning 0))))
1590 (defun gnus-simplify-all-whitespace (str)
1591 "Remove all whitespace from STR."
1592 (while (string-match "[ \t\n]+" str)
1593 (setq str (replace-match "" nil nil str)))
1596 (defsubst gnus-simplify-subject-re (subject)
1597 "Remove \"Re:\" from subject lines."
1598 (if (string-match message-subject-re-regexp subject)
1599 (substring subject (match-end 0))
1602 (defun gnus-simplify-subject (subject &optional re-only)
1603 "Remove `Re:' and words in parentheses.
1604 If RE-ONLY is non-nil, strip leading `Re:'s only."
1605 (let ((case-fold-search t)) ;Ignore case.
1606 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1607 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1608 (setq subject (substring subject (match-end 0))))
1609 ;; Remove uninteresting prefixes.
1610 (when (and (not re-only)
1611 gnus-simplify-ignored-prefixes
1612 (string-match gnus-simplify-ignored-prefixes subject))
1613 (setq subject (substring subject (match-end 0))))
1614 ;; Remove words in parentheses from end.
1616 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1617 (setq subject (substring subject 0 (match-beginning 0)))))
1618 ;; Return subject string.
1621 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1623 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1624 (goto-char (point-min))
1625 (while (re-search-forward regexp nil t)
1626 (replace-match (or newtext ""))))
1628 (defun gnus-simplify-buffer-fuzzy ()
1629 "Simplify string in the buffer fuzzily.
1630 The string in the accessible portion of the current buffer is simplified.
1631 It is assumed to be a single-line subject.
1632 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1633 matter is removed. Additional things can be deleted by setting
1634 `gnus-simplify-subject-fuzzy-regexp'."
1635 (let ((case-fold-search t)
1637 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1639 (while (not (eq modified-tick (buffer-modified-tick)))
1640 (setq modified-tick (buffer-modified-tick))
1642 ((listp gnus-simplify-subject-fuzzy-regexp)
1643 (mapcar 'gnus-simplify-buffer-fuzzy-step
1644 gnus-simplify-subject-fuzzy-regexp))
1645 (gnus-simplify-subject-fuzzy-regexp
1646 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1647 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1648 (gnus-simplify-buffer-fuzzy-step
1649 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1650 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1652 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1653 (gnus-simplify-buffer-fuzzy-step " +" " ")
1654 (gnus-simplify-buffer-fuzzy-step " $")
1655 (gnus-simplify-buffer-fuzzy-step "^ +")))
1657 (defun gnus-simplify-subject-fuzzy (subject)
1658 "Simplify a subject string fuzzily.
1659 See `gnus-simplify-buffer-fuzzy' for details."
1661 (gnus-set-work-buffer)
1662 (let ((case-fold-search t))
1663 ;; Remove uninteresting prefixes.
1664 (when (and gnus-simplify-ignored-prefixes
1665 (string-match gnus-simplify-ignored-prefixes subject))
1666 (setq subject (substring subject (match-end 0))))
1668 (inline (gnus-simplify-buffer-fuzzy))
1671 (defsubst gnus-simplify-subject-fully (subject)
1672 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1674 (gnus-simplify-subject-functions
1675 (gnus-map-function gnus-simplify-subject-functions subject))
1676 ((null gnus-summary-gather-subject-limit)
1677 (gnus-simplify-subject-re subject))
1678 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1679 (gnus-simplify-subject-fuzzy subject))
1680 ((numberp gnus-summary-gather-subject-limit)
1681 (gnus-limit-string (gnus-simplify-subject-re subject)
1682 gnus-summary-gather-subject-limit))
1686 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1687 "Check whether two subjects are equal.
1688 If optional argument SIMPLE-FIRST is t, first argument is already
1691 ((null simple-first)
1692 (equal (gnus-simplify-subject-fully s1)
1693 (gnus-simplify-subject-fully s2)))
1696 (gnus-simplify-subject-fully s2)))))
1698 (defun gnus-summary-bubble-group ()
1699 "Increase the score of the current group.
1700 This is a handy function to add to `gnus-summary-exit-hook' to
1701 increase the score of each group you read."
1702 (gnus-group-add-score gnus-newsgroup-name))
1706 ;;; Gnus summary mode
1709 (put 'gnus-summary-mode 'mode-class 'special)
1711 (defvar gnus-article-commands-menu)
1713 ;; Non-orthogonal keys
1715 (gnus-define-keys gnus-summary-mode-map
1716 " " gnus-summary-next-page
1717 "\177" gnus-summary-prev-page
1718 [delete] gnus-summary-prev-page
1719 [backspace] gnus-summary-prev-page
1720 "\r" gnus-summary-scroll-up
1721 "\M-\r" gnus-summary-scroll-down
1722 "n" gnus-summary-next-unread-article
1723 "p" gnus-summary-prev-unread-article
1724 "N" gnus-summary-next-article
1725 "P" gnus-summary-prev-article
1726 "\M-\C-n" gnus-summary-next-same-subject
1727 "\M-\C-p" gnus-summary-prev-same-subject
1728 "\M-n" gnus-summary-next-unread-subject
1729 "\M-p" gnus-summary-prev-unread-subject
1730 "." gnus-summary-first-unread-article
1731 "," gnus-summary-best-unread-article
1732 "\M-s" gnus-summary-search-article-forward
1733 "\M-r" gnus-summary-search-article-backward
1734 "\M-S" gnus-summary-repeat-search-article-forward
1735 "\M-R" gnus-summary-repeat-search-article-backward
1736 "<" gnus-summary-beginning-of-article
1737 ">" gnus-summary-end-of-article
1738 "j" gnus-summary-goto-article
1739 "^" gnus-summary-refer-parent-article
1740 "\M-^" gnus-summary-refer-article
1741 "u" gnus-summary-tick-article-forward
1742 "!" gnus-summary-tick-article-forward
1743 "U" gnus-summary-tick-article-backward
1744 "d" gnus-summary-mark-as-read-forward
1745 "D" gnus-summary-mark-as-read-backward
1746 "E" gnus-summary-mark-as-expirable
1747 "\M-u" gnus-summary-clear-mark-forward
1748 "\M-U" gnus-summary-clear-mark-backward
1749 "k" gnus-summary-kill-same-subject-and-select
1750 "\C-k" gnus-summary-kill-same-subject
1751 "\M-\C-k" gnus-summary-kill-thread
1752 "\M-\C-l" gnus-summary-lower-thread
1753 "e" gnus-summary-edit-article
1754 "#" gnus-summary-mark-as-processable
1755 "\M-#" gnus-summary-unmark-as-processable
1756 "\M-\C-t" gnus-summary-toggle-threads
1757 "\M-\C-s" gnus-summary-show-thread
1758 "\M-\C-h" gnus-summary-hide-thread
1759 "\M-\C-f" gnus-summary-next-thread
1760 "\M-\C-b" gnus-summary-prev-thread
1761 [(meta down)] gnus-summary-next-thread
1762 [(meta up)] gnus-summary-prev-thread
1763 "\M-\C-u" gnus-summary-up-thread
1764 "\M-\C-d" gnus-summary-down-thread
1765 "&" gnus-summary-execute-command
1766 "c" gnus-summary-catchup-and-exit
1767 "\C-w" gnus-summary-mark-region-as-read
1768 "\C-t" gnus-summary-toggle-truncation
1769 "?" gnus-summary-mark-as-dormant
1770 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1771 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1772 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1773 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1774 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1775 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1776 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1777 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1778 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1779 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1780 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1781 "=" gnus-summary-expand-window
1782 "\C-x\C-s" gnus-summary-reselect-current-group
1783 "\M-g" gnus-summary-rescan-group
1784 "w" gnus-summary-stop-page-breaking
1785 "\C-c\C-r" gnus-summary-caesar-message
1786 "f" gnus-summary-followup
1787 "F" gnus-summary-followup-with-original
1788 "C" gnus-summary-cancel-article
1789 "r" gnus-summary-reply
1790 "R" gnus-summary-reply-with-original
1791 "\C-c\C-f" gnus-summary-mail-forward
1792 "o" gnus-summary-save-article
1793 "\C-o" gnus-summary-save-article-mail
1794 "|" gnus-summary-pipe-output
1795 "\M-k" gnus-summary-edit-local-kill
1796 "\M-K" gnus-summary-edit-global-kill
1798 "\C-c\C-d" gnus-summary-describe-group
1799 "q" gnus-summary-exit
1800 "Q" gnus-summary-exit-no-update
1801 "\C-c\C-i" gnus-info-find-node
1802 gnus-mouse-2 gnus-mouse-pick-article
1803 [follow-link] mouse-face
1804 "m" gnus-summary-mail-other-window
1805 "a" gnus-summary-post-news
1806 "i" gnus-summary-news-other-window
1807 "x" gnus-summary-limit-to-unread
1808 "s" gnus-summary-isearch-article
1809 "t" gnus-summary-toggle-header
1810 "g" gnus-summary-show-article
1811 "l" gnus-summary-goto-last-article
1812 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1813 "\C-d" gnus-summary-enter-digest-group
1814 "\M-\C-d" gnus-summary-read-document
1815 "\M-\C-e" gnus-summary-edit-parameters
1816 "\M-\C-a" gnus-summary-customize-parameters
1818 "*" gnus-cache-enter-article
1819 "\M-*" gnus-cache-remove-article
1820 "\M-&" gnus-summary-universal-argument
1821 "\C-l" gnus-recenter
1822 "I" gnus-summary-increase-score
1823 "L" gnus-summary-lower-score
1824 "\M-i" gnus-symbolic-argument
1825 "h" gnus-summary-select-article-buffer
1827 "b" gnus-article-view-part
1828 "\M-t" gnus-summary-toggle-display-buttonized
1830 "V" gnus-summary-score-map
1831 "X" gnus-uu-extract-map
1832 "S" gnus-summary-send-map)
1834 ;; Sort of orthogonal keymap
1835 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1836 "t" gnus-summary-tick-article-forward
1837 "!" gnus-summary-tick-article-forward
1838 "d" gnus-summary-mark-as-read-forward
1839 "r" gnus-summary-mark-as-read-forward
1840 "c" gnus-summary-clear-mark-forward
1841 " " gnus-summary-clear-mark-forward
1842 "e" gnus-summary-mark-as-expirable
1843 "x" gnus-summary-mark-as-expirable
1844 "?" gnus-summary-mark-as-dormant
1845 "b" gnus-summary-set-bookmark
1846 "B" gnus-summary-remove-bookmark
1847 "#" gnus-summary-mark-as-processable
1848 "\M-#" gnus-summary-unmark-as-processable
1849 "S" gnus-summary-limit-include-expunged
1850 "C" gnus-summary-catchup
1851 "H" gnus-summary-catchup-to-here
1852 "h" gnus-summary-catchup-from-here
1853 "\C-c" gnus-summary-catchup-all
1854 "k" gnus-summary-kill-same-subject-and-select
1855 "K" gnus-summary-kill-same-subject
1856 "P" gnus-uu-mark-map)
1858 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1859 "c" gnus-summary-clear-above
1860 "u" gnus-summary-tick-above
1861 "m" gnus-summary-mark-above
1862 "k" gnus-summary-kill-below)
1864 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1865 "/" gnus-summary-limit-to-subject
1866 "n" gnus-summary-limit-to-articles
1867 "b" gnus-summary-limit-to-bodies
1868 "h" gnus-summary-limit-to-headers
1869 "w" gnus-summary-pop-limit
1870 "s" gnus-summary-limit-to-subject
1871 "a" gnus-summary-limit-to-author
1872 "u" gnus-summary-limit-to-unread
1873 "m" gnus-summary-limit-to-marks
1874 "M" gnus-summary-limit-exclude-marks
1875 "v" gnus-summary-limit-to-score
1876 "*" gnus-summary-limit-include-cached
1877 "D" gnus-summary-limit-include-dormant
1878 "T" gnus-summary-limit-include-thread
1879 "d" gnus-summary-limit-exclude-dormant
1880 "t" gnus-summary-limit-to-age
1881 "." gnus-summary-limit-to-unseen
1882 "x" gnus-summary-limit-to-extra
1883 "p" gnus-summary-limit-to-display-predicate
1884 "E" gnus-summary-limit-include-expunged
1885 "c" gnus-summary-limit-exclude-childless-dormant
1886 "C" gnus-summary-limit-mark-excluded-as-read
1887 "o" gnus-summary-insert-old-articles
1888 "N" gnus-summary-insert-new-articles
1889 "S" gnus-summary-limit-to-singletons
1890 "r" gnus-summary-limit-to-replied
1891 "R" gnus-summary-limit-to-recipient)
1893 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1894 "n" gnus-summary-next-unread-article
1895 "p" gnus-summary-prev-unread-article
1896 "N" gnus-summary-next-article
1897 "P" gnus-summary-prev-article
1898 "\C-n" gnus-summary-next-same-subject
1899 "\C-p" gnus-summary-prev-same-subject
1900 "\M-n" gnus-summary-next-unread-subject
1901 "\M-p" gnus-summary-prev-unread-subject
1902 "f" gnus-summary-first-unread-article
1903 "b" gnus-summary-best-unread-article
1904 "j" gnus-summary-goto-article
1905 "g" gnus-summary-goto-subject
1906 "l" gnus-summary-goto-last-article
1907 "o" gnus-summary-pop-article)
1909 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1910 "k" gnus-summary-kill-thread
1911 "l" gnus-summary-lower-thread
1912 "i" gnus-summary-raise-thread
1913 "T" gnus-summary-toggle-threads
1914 "t" gnus-summary-rethread-current
1915 "^" gnus-summary-reparent-thread
1916 "\M-^" gnus-summary-reparent-children
1917 "s" gnus-summary-show-thread
1918 "S" gnus-summary-show-all-threads
1919 "h" gnus-summary-hide-thread
1920 "H" gnus-summary-hide-all-threads
1921 "n" gnus-summary-next-thread
1922 "p" gnus-summary-prev-thread
1923 "u" gnus-summary-up-thread
1924 "o" gnus-summary-top-thread
1925 "d" gnus-summary-down-thread
1926 "#" gnus-uu-mark-thread
1927 "\M-#" gnus-uu-unmark-thread)
1929 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1930 "g" gnus-summary-prepare
1931 "c" gnus-summary-insert-cached-articles
1932 "d" gnus-summary-insert-dormant-articles
1933 "t" gnus-summary-insert-ticked-articles)
1935 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1936 "c" gnus-summary-catchup-and-exit
1937 "C" gnus-summary-catchup-all-and-exit
1938 "E" gnus-summary-exit-no-update
1939 "Q" gnus-summary-exit
1940 "Z" gnus-summary-exit
1941 "n" gnus-summary-catchup-and-goto-next-group
1942 "p" gnus-summary-catchup-and-goto-prev-group
1943 "R" gnus-summary-reselect-current-group
1944 "G" gnus-summary-rescan-group
1945 "N" gnus-summary-next-group
1946 "s" gnus-summary-save-newsrc
1947 "P" gnus-summary-prev-group)
1949 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1950 " " gnus-summary-next-page
1951 "n" gnus-summary-next-page
1952 "\177" gnus-summary-prev-page
1953 [delete] gnus-summary-prev-page
1954 "p" gnus-summary-prev-page
1955 "\r" gnus-summary-scroll-up
1956 "\M-\r" gnus-summary-scroll-down
1957 "<" gnus-summary-beginning-of-article
1958 ">" gnus-summary-end-of-article
1959 "b" gnus-summary-beginning-of-article
1960 "e" gnus-summary-end-of-article
1961 "^" gnus-summary-refer-parent-article
1962 "r" gnus-summary-refer-parent-article
1963 "D" gnus-summary-enter-digest-group
1964 "R" gnus-summary-refer-references
1965 "T" gnus-summary-refer-thread
1966 "g" gnus-summary-show-article
1967 "s" gnus-summary-isearch-article
1968 "P" gnus-summary-print-article
1969 "M" gnus-mailing-list-insinuate
1970 "t" gnus-article-babel)
1972 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1973 "b" gnus-article-add-buttons
1974 "B" gnus-article-add-buttons-to-head
1975 "o" gnus-article-treat-overstrike
1976 "e" gnus-article-emphasize
1977 "w" gnus-article-fill-cited-article
1978 "Q" gnus-article-fill-long-lines
1979 "L" gnus-article-toggle-truncate-lines
1980 "C" gnus-article-capitalize-sentences
1981 "c" gnus-article-remove-cr
1982 "q" gnus-article-de-quoted-unreadable
1983 "6" gnus-article-de-base64-unreadable
1984 "Z" gnus-article-decode-HZ
1985 "A" gnus-article-treat-ansi-sequences
1986 "h" gnus-article-wash-html
1987 "u" gnus-article-unsplit-urls
1988 "s" gnus-summary-force-verify-and-decrypt
1989 "f" gnus-article-display-x-face
1990 "l" gnus-summary-stop-page-breaking
1991 "r" gnus-summary-caesar-message
1992 "m" gnus-summary-morse-message
1993 "t" gnus-summary-toggle-header
1994 "g" gnus-treat-smiley
1995 "v" gnus-summary-verbose-headers
1996 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1997 "p" gnus-article-verify-x-pgp-sig
1998 "d" gnus-article-treat-dumbquotes
1999 "i" gnus-summary-idna-message)
2001 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2002 ;; mnemonic: deuglif*Y*
2003 "u" gnus-article-outlook-unwrap-lines
2004 "a" gnus-article-outlook-repair-attribution
2005 "c" gnus-article-outlook-rearrange-citation
2006 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2008 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2009 "a" gnus-article-hide
2010 "h" gnus-article-hide-headers
2011 "b" gnus-article-hide-boring-headers
2012 "s" gnus-article-hide-signature
2013 "c" gnus-article-hide-citation
2014 "C" gnus-article-hide-citation-in-followups
2015 "l" gnus-article-hide-list-identifiers
2016 "B" gnus-article-strip-banner
2017 "P" gnus-article-hide-pem
2018 "\C-c" gnus-article-hide-citation-maybe)
2020 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2021 "a" gnus-article-highlight
2022 "h" gnus-article-highlight-headers
2023 "c" gnus-article-highlight-citation
2024 "s" gnus-article-highlight-signature)
2026 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2027 "f" gnus-article-treat-fold-headers
2028 "u" gnus-article-treat-unfold-headers
2029 "n" gnus-article-treat-fold-newsgroups)
2031 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2032 "x" gnus-article-display-x-face
2033 "d" gnus-article-display-face
2034 "s" gnus-treat-smiley
2035 "D" gnus-article-remove-images
2036 "f" gnus-treat-from-picon
2037 "m" gnus-treat-mail-picon
2038 "n" gnus-treat-newsgroups-picon)
2040 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2041 "w" gnus-article-decode-mime-words
2042 "c" gnus-article-decode-charset
2043 "v" gnus-mime-view-all-parts
2044 "b" gnus-article-view-part)
2046 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2047 "z" gnus-article-date-ut
2048 "u" gnus-article-date-ut
2049 "l" gnus-article-date-local
2050 "p" gnus-article-date-english
2051 "e" gnus-article-date-lapsed
2052 "o" gnus-article-date-original
2053 "i" gnus-article-date-iso8601
2054 "s" gnus-article-date-user)
2056 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2057 "t" gnus-article-remove-trailing-blank-lines
2058 "l" gnus-article-strip-leading-blank-lines
2059 "m" gnus-article-strip-multiple-blank-lines
2060 "a" gnus-article-strip-blank-lines
2061 "A" gnus-article-strip-all-blank-lines
2062 "s" gnus-article-strip-leading-space
2063 "e" gnus-article-strip-trailing-space
2064 "w" gnus-article-remove-leading-whitespace)
2066 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2068 "f" gnus-summary-fetch-faq
2069 "d" gnus-summary-describe-group
2070 "h" gnus-summary-describe-briefly
2071 "i" gnus-info-find-node
2072 "c" gnus-group-fetch-charter
2073 "C" gnus-group-fetch-control)
2075 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2076 "e" gnus-summary-expire-articles
2077 "\M-\C-e" gnus-summary-expire-articles-now
2078 "\177" gnus-summary-delete-article
2079 [delete] gnus-summary-delete-article
2080 [backspace] gnus-summary-delete-article
2081 "m" gnus-summary-move-article
2082 "r" gnus-summary-respool-article
2083 "w" gnus-summary-edit-article
2084 "c" gnus-summary-copy-article
2085 "B" gnus-summary-crosspost-article
2086 "q" gnus-summary-respool-query
2087 "t" gnus-summary-respool-trace
2088 "i" gnus-summary-import-article
2089 "I" gnus-summary-create-article
2090 "p" gnus-summary-article-posted-p)
2092 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2093 "o" gnus-summary-save-article
2094 "m" gnus-summary-save-article-mail
2095 "F" gnus-summary-write-article-file
2096 "r" gnus-summary-save-article-rmail
2097 "f" gnus-summary-save-article-file
2098 "b" gnus-summary-save-article-body-file
2099 "B" gnus-summary-write-article-body-file
2100 "h" gnus-summary-save-article-folder
2101 "v" gnus-summary-save-article-vm
2102 "p" gnus-summary-pipe-output
2103 "P" gnus-summary-muttprint
2104 "s" gnus-soup-add-article)
2106 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2107 "b" gnus-summary-display-buttonized
2108 "m" gnus-summary-repair-multipart
2109 "v" gnus-article-view-part
2110 "o" gnus-article-save-part
2111 "O" gnus-article-save-part-and-strip
2112 "r" gnus-article-replace-part
2113 "d" gnus-article-delete-part
2114 "t" gnus-article-view-part-as-type
2115 "j" gnus-article-jump-to-part
2116 "c" gnus-article-copy-part
2117 "C" gnus-article-view-part-as-charset
2118 "e" gnus-article-view-part-externally
2119 "H" gnus-article-browse-html-article
2120 "E" gnus-article-encrypt-body
2121 "i" gnus-article-inline-part
2122 "|" gnus-article-pipe-part)
2124 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2125 "p" gnus-summary-mark-as-processable
2126 "u" gnus-summary-unmark-as-processable
2127 "U" gnus-summary-unmark-all-processable
2128 "v" gnus-uu-mark-over
2129 "s" gnus-uu-mark-series
2130 "r" gnus-uu-mark-region
2131 "g" gnus-uu-unmark-region
2132 "R" gnus-uu-mark-by-regexp
2133 "G" gnus-uu-unmark-by-regexp
2134 "t" gnus-uu-mark-thread
2135 "T" gnus-uu-unmark-thread
2136 "a" gnus-uu-mark-all
2137 "b" gnus-uu-mark-buffer
2138 "S" gnus-uu-mark-sparse
2139 "k" gnus-summary-kill-process-mark
2140 "y" gnus-summary-yank-process-mark
2141 "w" gnus-summary-save-process-mark
2142 "i" gnus-uu-invert-processable)
2144 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2145 ;;"x" gnus-uu-extract-any
2146 "m" gnus-summary-save-parts
2147 "u" gnus-uu-decode-uu
2148 "U" gnus-uu-decode-uu-and-save
2149 "s" gnus-uu-decode-unshar
2150 "S" gnus-uu-decode-unshar-and-save
2151 "o" gnus-uu-decode-save
2152 "O" gnus-uu-decode-save
2153 "b" gnus-uu-decode-binhex
2154 "B" gnus-uu-decode-binhex
2155 "p" gnus-uu-decode-postscript
2156 "P" gnus-uu-decode-postscript-and-save)
2159 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2160 "u" gnus-uu-decode-uu-view
2161 "U" gnus-uu-decode-uu-and-save-view
2162 "s" gnus-uu-decode-unshar-view
2163 "S" gnus-uu-decode-unshar-and-save-view
2164 "o" gnus-uu-decode-save-view
2165 "O" gnus-uu-decode-save-view
2166 "b" gnus-uu-decode-binhex-view
2167 "B" gnus-uu-decode-binhex-view
2168 "p" gnus-uu-decode-postscript-view
2169 "P" gnus-uu-decode-postscript-and-save-view)
2171 (defvar gnus-article-post-menu nil)
2173 (defconst gnus-summary-menu-maxlen 20)
2175 (defun gnus-summary-menu-split (menu)
2176 ;; If we have lots of elements, divide them into groups of 20
2177 ;; and make a pane (or submenu) for each one.
2178 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2179 (let ((menu menu) sublists next
2182 ;; Pull off the next gnus-summary-menu-maxlen elements
2183 ;; and make them the next element of sublist.
2184 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2186 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2188 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2189 (aref (car (last menu)) 0)) menu)
2193 (nreverse sublists))
2194 ;; Few elements--put them all in one pane.
2197 (defun gnus-summary-make-menu-bar ()
2198 (gnus-turn-off-edit-menu 'summary)
2200 (unless (boundp 'gnus-summary-misc-menu)
2203 gnus-summary-kill-menu gnus-summary-mode-map ""
2208 ["Customize" gnus-score-customize t])
2209 (gnus-make-score-map 'increase)
2210 (gnus-make-score-map 'lower)
2212 ["Kill below" gnus-summary-kill-below t]
2213 ["Mark above" gnus-summary-mark-above t]
2214 ["Tick above" gnus-summary-tick-above t]
2215 ["Clear above" gnus-summary-clear-above t])
2216 ["Current score" gnus-summary-current-score t]
2217 ["Set score" gnus-summary-set-score t]
2218 ["Switch current score file..." gnus-score-change-score-file t]
2219 ["Set mark below..." gnus-score-set-mark-below t]
2220 ["Set expunge below..." gnus-score-set-expunge-below t]
2221 ["Edit current score file" gnus-score-edit-current-scores t]
2222 ["Edit score file" gnus-score-edit-file t]
2223 ["Trace score" gnus-score-find-trace t]
2224 ["Find words" gnus-score-find-favourite-words t]
2225 ["Rescore buffer" gnus-summary-rescore t]
2226 ["Increase score..." gnus-summary-increase-score t]
2227 ["Lower score..." gnus-summary-lower-score t]))))
2229 ;; Define both the Article menu in the summary buffer and the
2230 ;; equivalent Commands menu in the article buffer here for
2234 ["All" gnus-article-hide t]
2235 ["Headers" gnus-article-hide-headers t]
2236 ["Signature" gnus-article-hide-signature t]
2237 ["Citation" gnus-article-hide-citation t]
2238 ["List identifiers" gnus-article-hide-list-identifiers t]
2239 ["Banner" gnus-article-strip-banner t]
2240 ["Boring headers" gnus-article-hide-boring-headers t])
2242 ["All" gnus-article-highlight t]
2243 ["Headers" gnus-article-highlight-headers t]
2244 ["Signature" gnus-article-highlight-signature t]
2245 ["Citation" gnus-article-highlight-citation t])
2247 ["Words" gnus-article-decode-mime-words t]
2248 ["Charset" gnus-article-decode-charset t]
2249 ["QP" gnus-article-de-quoted-unreadable t]
2250 ["Base64" gnus-article-de-base64-unreadable t]
2251 ["View MIME buttons" gnus-summary-display-buttonized t]
2252 ["View all" gnus-mime-view-all-parts t]
2253 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2254 ["Encrypt body" gnus-article-encrypt-body
2255 :active (not (gnus-group-read-only-p))
2256 ,@(if (featurep 'xemacs) nil
2257 '(:help "Encrypt the message body on disk"))]
2258 ["Extract all parts..." gnus-summary-save-parts t]
2260 ["Repair multipart" gnus-summary-repair-multipart t]
2261 ["Pipe part..." gnus-article-pipe-part t]
2262 ["Inline part" gnus-article-inline-part t]
2263 ["View part as type..." gnus-article-view-part-as-type t]
2264 ["Encrypt body" gnus-article-encrypt-body
2265 :active (not (gnus-group-read-only-p))
2266 ,@(if (featurep 'xemacs) nil
2267 '(:help "Encrypt the message body on disk"))]
2268 ["View part externally" gnus-article-view-part-externally t]
2269 ["View HTML parts in browser" gnus-article-browse-html-article t]
2270 ["View part with charset..." gnus-article-view-part-as-charset t]
2271 ["Copy part" gnus-article-copy-part t]
2272 ["Save part..." gnus-article-save-part t]
2273 ["View part" gnus-article-view-part t]))
2275 ["Local" gnus-article-date-local t]
2276 ["ISO8601" gnus-article-date-iso8601 t]
2277 ["UT" gnus-article-date-ut t]
2278 ["Original" gnus-article-date-original t]
2279 ["Lapsed" gnus-article-date-lapsed t]
2280 ["User-defined" gnus-article-date-user t])
2282 ["Remove images" gnus-article-remove-images t]
2283 ["Toggle smiley" gnus-treat-smiley t]
2284 ["Show X-Face" gnus-article-display-x-face t]
2285 ["Show picons in From" gnus-treat-from-picon t]
2286 ["Show picons in mail headers" gnus-treat-mail-picon t]
2287 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2288 ("View as different encoding"
2289 ,@(gnus-summary-menu-split
2292 ;; Since easymenu under Emacs doesn't allow
2293 ;; lambda forms for menu commands, we should
2294 ;; provide intern'ed function symbols.
2295 (let ((command (intern (format "\
2296 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2300 (let ((gnus-summary-show-article-charset-alist
2302 (gnus-summary-show-article 1))))
2303 `[,(symbol-name cs) ,command t]))
2304 (sort (if (fboundp 'coding-system-list)
2305 (coding-system-list)
2306 (mapcar 'car mm-mime-mule-charset-alist))
2310 ["Leading" gnus-article-strip-leading-blank-lines t]
2311 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2312 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2313 ["All of the above" gnus-article-strip-blank-lines t]
2314 ["All" gnus-article-strip-all-blank-lines t]
2315 ["Leading space" gnus-article-strip-leading-space t]
2316 ["Trailing space" gnus-article-strip-trailing-space t]
2317 ["Leading space in headers"
2318 gnus-article-remove-leading-whitespace t])
2319 ["Overstrike" gnus-article-treat-overstrike t]
2320 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2321 ["Emphasis" gnus-article-emphasize t]
2322 ["Word wrap" gnus-article-fill-cited-article t]
2323 ["Fill long lines" gnus-article-fill-long-lines t]
2324 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2325 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2326 ["Remove CR" gnus-article-remove-cr t]
2327 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2328 ["Base64" gnus-article-de-base64-unreadable t]
2329 ["Rot 13" gnus-summary-caesar-message
2330 ,@(if (featurep 'xemacs) '(t)
2331 '(:help "\"Caesar rotate\" article by 13"))]
2332 ["De-IDNA" gnus-summary-idna-message t]
2333 ["Morse decode" gnus-summary-morse-message t]
2334 ["Unix pipe..." gnus-summary-pipe-message t]
2335 ["Add buttons" gnus-article-add-buttons t]
2336 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2337 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2338 ["Verbose header" gnus-summary-verbose-headers t]
2339 ["Toggle header" gnus-summary-toggle-header t]
2340 ["Unfold headers" gnus-article-treat-unfold-headers t]
2341 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2342 ["Html" gnus-article-wash-html t]
2343 ["Unsplit URLs" gnus-article-unsplit-urls t]
2344 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2345 ["Decode HZ" gnus-article-decode-HZ t]
2346 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2347 ("(Outlook) Deuglify"
2348 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2349 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2350 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2351 ["Full (Outlook) deuglify"
2352 gnus-article-outlook-deuglify-article t])
2355 ["Save in default format..." gnus-summary-save-article
2356 ,@(if (featurep 'xemacs) '(t)
2357 '(:help "Save article using default method"))]
2358 ["Save in file..." gnus-summary-save-article-file
2359 ,@(if (featurep 'xemacs) '(t)
2360 '(:help "Save article in file"))]
2361 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2362 ["Save in MH folder..." gnus-summary-save-article-folder t]
2363 ["Save in VM folder..." gnus-summary-save-article-vm t]
2364 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2365 ["Save body in file..." gnus-summary-save-article-body-file t]
2366 ["Pipe through a filter..." gnus-summary-pipe-output t]
2367 ["Add to SOUP packet" gnus-soup-add-article t]
2368 ["Print with Muttprint..." gnus-summary-muttprint t]
2369 ["Print" gnus-summary-print-article
2370 ,@(if (featurep 'xemacs) '(t)
2371 '(:help "Generate and print a PostScript image"))])
2372 ("Copy, move,... (Backend)"
2373 ,@(if (featurep 'xemacs) nil
2374 '(:help "Copying, moving, expiring articles..."))
2375 ["Respool article..." gnus-summary-respool-article t]
2376 ["Move article..." gnus-summary-move-article
2377 (gnus-check-backend-function
2378 'request-move-article gnus-newsgroup-name)]
2379 ["Copy article..." gnus-summary-copy-article t]
2380 ["Crosspost article..." gnus-summary-crosspost-article
2381 (gnus-check-backend-function
2382 'request-replace-article gnus-newsgroup-name)]
2383 ["Import file..." gnus-summary-import-article
2384 (gnus-check-backend-function
2385 'request-accept-article gnus-newsgroup-name)]
2386 ["Create article..." gnus-summary-create-article
2387 (gnus-check-backend-function
2388 'request-accept-article gnus-newsgroup-name)]
2389 ["Check if posted" gnus-summary-article-posted-p t]
2390 ["Edit article" gnus-summary-edit-article
2391 (not (gnus-group-read-only-p))]
2392 ["Delete article" gnus-summary-delete-article
2393 (gnus-check-backend-function
2394 'request-expire-articles gnus-newsgroup-name)]
2395 ["Query respool" gnus-summary-respool-query t]
2396 ["Trace respool" gnus-summary-respool-trace t]
2397 ["Delete expirable articles" gnus-summary-expire-articles-now
2398 (gnus-check-backend-function
2399 'request-expire-articles gnus-newsgroup-name)])
2401 ["Uudecode" gnus-uu-decode-uu
2402 ,@(if (featurep 'xemacs) '(t)
2403 '(:help "Decode uuencoded article(s)"))]
2404 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2405 ["Unshar" gnus-uu-decode-unshar t]
2406 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2407 ["Save" gnus-uu-decode-save t]
2408 ["Binhex" gnus-uu-decode-binhex t]
2409 ["Postscript" gnus-uu-decode-postscript t]
2410 ["All MIME parts" gnus-summary-save-parts t])
2412 ["Enter article" gnus-cache-enter-article t]
2413 ["Remove article" gnus-cache-remove-article t])
2414 ["Translate" gnus-article-babel t]
2415 ["Select article buffer" gnus-summary-select-article-buffer t]
2416 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2417 ["Isearch article..." gnus-summary-isearch-article t]
2418 ["Beginning of the article" gnus-summary-beginning-of-article t]
2419 ["End of the article" gnus-summary-end-of-article t]
2420 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2421 ["Fetch referenced articles" gnus-summary-refer-references t]
2422 ["Fetch current thread" gnus-summary-refer-thread t]
2423 ["Fetch article with id..." gnus-summary-refer-article t]
2424 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2425 ["Redisplay" gnus-summary-show-article t]
2426 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2428 gnus-summary-article-menu gnus-summary-mode-map ""
2429 (cons "Article" innards))
2431 (if (not (keymapp gnus-summary-article-menu))
2433 gnus-article-commands-menu gnus-article-mode-map ""
2434 (cons "Commands" innards))
2435 ;; in Emacs, don't share menu.
2436 (setq gnus-article-commands-menu
2437 (copy-keymap gnus-summary-article-menu))
2438 (define-key gnus-article-mode-map [menu-bar commands]
2439 (cons "Commands" gnus-article-commands-menu))))
2442 gnus-summary-thread-menu gnus-summary-mode-map ""
2444 ["Find all messages in thread" gnus-summary-refer-thread t]
2445 ["Toggle threading" gnus-summary-toggle-threads t]
2446 ["Hide threads" gnus-summary-hide-all-threads t]
2447 ["Show threads" gnus-summary-show-all-threads t]
2448 ["Hide thread" gnus-summary-hide-thread t]
2449 ["Show thread" gnus-summary-show-thread t]
2450 ["Go to next thread" gnus-summary-next-thread t]
2451 ["Go to previous thread" gnus-summary-prev-thread t]
2452 ["Go down thread" gnus-summary-down-thread t]
2453 ["Go up thread" gnus-summary-up-thread t]
2454 ["Top of thread" gnus-summary-top-thread t]
2455 ["Mark thread as read" gnus-summary-kill-thread t]
2456 ["Lower thread score" gnus-summary-lower-thread t]
2457 ["Raise thread score" gnus-summary-raise-thread t]
2458 ["Rethread current" gnus-summary-rethread-current t]))
2461 gnus-summary-post-menu gnus-summary-mode-map ""
2463 ["Send a message (mail or news)" gnus-summary-post-news
2464 ,@(if (featurep 'xemacs) '(t)
2465 '(:help "Compose a new message (mail or news)"))]
2466 ["Followup" gnus-summary-followup
2467 ,@(if (featurep 'xemacs) '(t)
2468 '(:help "Post followup to this article"))]
2469 ["Followup and yank" gnus-summary-followup-with-original
2470 ,@(if (featurep 'xemacs) '(t)
2471 '(:help "Post followup to this article, quoting its contents"))]
2472 ["Supersede article" gnus-summary-supersede-article t]
2473 ["Cancel article" gnus-summary-cancel-article
2474 ,@(if (featurep 'xemacs) '(t)
2475 '(:help "Cancel an article you posted"))]
2476 ["Reply" gnus-summary-reply t]
2477 ["Reply and yank" gnus-summary-reply-with-original t]
2478 ["Wide reply" gnus-summary-wide-reply t]
2479 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2480 ,@(if (featurep 'xemacs) '(t)
2481 '(:help "Mail a reply, quoting this article"))]
2482 ["Very wide reply" gnus-summary-very-wide-reply t]
2483 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2484 ,@(if (featurep 'xemacs) '(t)
2485 '(:help "Mail a very wide reply, quoting this article"))]
2486 ["Mail forward" gnus-summary-mail-forward t]
2487 ["Post forward" gnus-summary-post-forward t]
2488 ["Digest and mail" gnus-uu-digest-mail-forward t]
2489 ["Digest and post" gnus-uu-digest-post-forward t]
2490 ["Resend message" gnus-summary-resend-message t]
2491 ["Resend message edit" gnus-summary-resend-message-edit t]
2492 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2493 ["Send a mail" gnus-summary-mail-other-window t]
2494 ["Create a local message" gnus-summary-news-other-window t]
2495 ["Uuencode and post" gnus-uu-post-news
2496 ,@(if (featurep 'xemacs) '(t)
2497 '(:help "Post a uuencoded article"))]
2498 ["Followup via news" gnus-summary-followup-to-mail t]
2499 ["Followup via news and yank"
2500 gnus-summary-followup-to-mail-with-original t]
2502 ;;["Send" gnus-summary-send-draft t]
2503 ;;["Send bounced" gnus-resend-bounced-mail t])
2507 ((not (keymapp gnus-summary-post-menu))
2508 (setq gnus-article-post-menu gnus-summary-post-menu))
2509 ((not gnus-article-post-menu)
2510 ;; Don't share post menu.
2511 (setq gnus-article-post-menu
2512 (copy-keymap gnus-summary-post-menu))))
2513 (define-key gnus-article-mode-map [menu-bar post]
2514 (cons "Post" gnus-article-post-menu))
2517 gnus-summary-misc-menu gnus-summary-mode-map ""
2520 ["Mark as read" gnus-summary-mark-as-read-forward t]
2521 ["Mark same subject and select"
2522 gnus-summary-kill-same-subject-and-select t]
2523 ["Mark same subject" gnus-summary-kill-same-subject t]
2524 ["Catchup" gnus-summary-catchup
2525 ,@(if (featurep 'xemacs) '(t)
2526 '(:help "Mark unread articles in this group as read"))]
2527 ["Catchup all" gnus-summary-catchup-all t]
2528 ["Catchup to here" gnus-summary-catchup-to-here t]
2529 ["Catchup from here" gnus-summary-catchup-from-here t]
2530 ["Catchup region" gnus-summary-mark-region-as-read
2531 (gnus-mark-active-p)]
2532 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2534 ["Tick" gnus-summary-tick-article-forward t]
2535 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2536 ["Remove marks" gnus-summary-clear-mark-forward t]
2537 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2538 ["Set bookmark" gnus-summary-set-bookmark t]
2539 ["Remove bookmark" gnus-summary-remove-bookmark t])
2541 ["Marks..." gnus-summary-limit-to-marks t]
2542 ["Subject..." gnus-summary-limit-to-subject t]
2543 ["Author..." gnus-summary-limit-to-author t]
2544 ["Recipient..." gnus-summary-limit-to-recipient t]
2545 ["Age..." gnus-summary-limit-to-age t]
2546 ["Extra..." gnus-summary-limit-to-extra t]
2547 ["Score..." gnus-summary-limit-to-score t]
2548 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2549 ["Unread" gnus-summary-limit-to-unread t]
2550 ["Unseen" gnus-summary-limit-to-unseen t]
2551 ["Singletons" gnus-summary-limit-to-singletons t]
2552 ["Replied" gnus-summary-limit-to-replied t]
2553 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2554 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2555 ["Pop limit" gnus-summary-pop-limit t]
2556 ["Show dormant" gnus-summary-limit-include-dormant t]
2557 ["Hide childless dormant"
2558 gnus-summary-limit-exclude-childless-dormant t]
2559 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2560 ["Hide marked" gnus-summary-limit-exclude-marks t]
2561 ["Show expunged" gnus-summary-limit-include-expunged t])
2563 ["Set mark" gnus-summary-mark-as-processable t]
2564 ["Remove mark" gnus-summary-unmark-as-processable t]
2565 ["Remove all marks" gnus-summary-unmark-all-processable t]
2566 ["Invert marks" gnus-uu-invert-processable t]
2567 ["Mark above" gnus-uu-mark-over t]
2568 ["Mark series" gnus-uu-mark-series t]
2569 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2570 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2571 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2572 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2573 ["Mark all" gnus-uu-mark-all t]
2574 ["Mark buffer" gnus-uu-mark-buffer t]
2575 ["Mark sparse" gnus-uu-mark-sparse t]
2576 ["Mark thread" gnus-uu-mark-thread t]
2577 ["Unmark thread" gnus-uu-unmark-thread t]
2578 ("Process Mark Sets"
2579 ["Kill" gnus-summary-kill-process-mark t]
2580 ["Yank" gnus-summary-yank-process-mark
2581 gnus-newsgroup-process-stack]
2582 ["Save" gnus-summary-save-process-mark t]
2583 ["Run command on marked..." gnus-summary-universal-argument t]))
2585 ["Page forward" gnus-summary-next-page
2586 ,@(if (featurep 'xemacs) '(t)
2587 '(:help "Show next page of article"))]
2588 ["Page backward" gnus-summary-prev-page
2589 ,@(if (featurep 'xemacs) '(t)
2590 '(:help "Show previous page of article"))]
2591 ["Line forward" gnus-summary-scroll-up t])
2593 ["Next unread article" gnus-summary-next-unread-article t]
2594 ["Previous unread article" gnus-summary-prev-unread-article t]
2595 ["Next article" gnus-summary-next-article t]
2596 ["Previous article" gnus-summary-prev-article t]
2597 ["Next unread subject" gnus-summary-next-unread-subject t]
2598 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2599 ["Next article same subject" gnus-summary-next-same-subject t]
2600 ["Previous article same subject" gnus-summary-prev-same-subject t]
2601 ["First unread article" gnus-summary-first-unread-article t]
2602 ["Best unread article" gnus-summary-best-unread-article t]
2603 ["Go to subject number..." gnus-summary-goto-subject t]
2604 ["Go to article number..." gnus-summary-goto-article t]
2605 ["Go to the last article" gnus-summary-goto-last-article t]
2606 ["Pop article off history" gnus-summary-pop-article t])
2608 ["Sort by number" gnus-summary-sort-by-number t]
2609 ["Sort by author" gnus-summary-sort-by-author t]
2610 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2611 ["Sort by subject" gnus-summary-sort-by-subject t]
2612 ["Sort by date" gnus-summary-sort-by-date t]
2613 ["Sort by score" gnus-summary-sort-by-score t]
2614 ["Sort by lines" gnus-summary-sort-by-lines t]
2615 ["Sort by characters" gnus-summary-sort-by-chars t]
2616 ["Randomize" gnus-summary-sort-by-random t]
2617 ["Original sort" gnus-summary-sort-by-original t])
2619 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2620 ["Describe group" gnus-summary-describe-group t]
2621 ["Fetch charter" gnus-group-fetch-charter
2622 ,@(if (featurep 'xemacs) nil
2623 '(:help "Display the charter of the current group"))]
2624 ["Fetch control message" gnus-group-fetch-control
2625 ,@(if (featurep 'xemacs) nil
2626 '(:help "Display the archived control message for the current group"))]
2627 ["Read manual" gnus-info-find-node t])
2629 ["Pick and read" gnus-pick-mode t]
2630 ["Binary" gnus-binary-mode t])
2632 ["Regenerate" gnus-summary-prepare t]
2633 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2634 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2635 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2636 ["Toggle threading" gnus-summary-toggle-threads t])
2637 ["See old articles" gnus-summary-insert-old-articles t]
2638 ["See new articles" gnus-summary-insert-new-articles t]
2639 ["Filter articles..." gnus-summary-execute-command t]
2640 ["Run command on articles..." gnus-summary-universal-argument t]
2641 ["Search articles forward..." gnus-summary-search-article-forward t]
2642 ["Search articles backward..." gnus-summary-search-article-backward t]
2643 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2644 ["Expand window" gnus-summary-expand-window t]
2645 ["Expire expirable articles" gnus-summary-expire-articles
2646 (gnus-check-backend-function
2647 'request-expire-articles gnus-newsgroup-name)]
2648 ["Edit local kill file" gnus-summary-edit-local-kill t]
2649 ["Edit main kill file" gnus-summary-edit-global-kill t]
2650 ["Edit group parameters" gnus-summary-edit-parameters t]
2651 ["Customize group parameters" gnus-summary-customize-parameters t]
2652 ["Send a bug report" gnus-bug t]
2654 ["Catchup and exit" gnus-summary-catchup-and-exit
2655 ,@(if (featurep 'xemacs) '(t)
2656 '(:help "Mark unread articles in this group as read, then exit"))]
2657 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2658 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2659 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2660 ["Exit group" gnus-summary-exit
2661 ,@(if (featurep 'xemacs) '(t)
2662 '(:help "Exit current group, return to group selection mode"))]
2663 ["Exit group without updating" gnus-summary-exit-no-update t]
2664 ["Exit and goto next group" gnus-summary-next-group t]
2665 ["Exit and goto prev group" gnus-summary-prev-group t]
2666 ["Reselect group" gnus-summary-reselect-current-group t]
2667 ["Rescan group" gnus-summary-rescan-group t]
2668 ["Update dribble" gnus-summary-save-newsrc t])))
2670 (gnus-run-hooks 'gnus-summary-menu-hook)))
2672 (defvar gnus-summary-tool-bar-map nil)
2674 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2675 ;; affect _new_ message buffers. We might add a function that walks thru all
2676 ;; summary-mode buffers and force the update.
2677 (defun gnus-summary-tool-bar-update (&optional symbol value)
2678 "Update summary mode toolbar.
2679 Setter function for custom variables."
2680 (setq-default gnus-summary-tool-bar-map nil)
2682 ;; When used as ":set" function:
2683 (set-default symbol value))
2684 (when (gnus-buffer-live-p gnus-summary-buffer)
2685 (with-current-buffer gnus-summary-buffer
2686 (gnus-summary-make-tool-bar))))
2688 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2689 'gnus-summary-tool-bar-gnome
2690 'gnus-summary-tool-bar-retro)
2691 "Specifies the Gnus summary tool bar.
2693 It can be either a list or a symbol refering to a list. See
2694 `gmm-tool-bar-from-list' for the format of the list. The
2695 default key map is `gnus-summary-mode-map'.
2697 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2698 `gnus-summary-tool-bar-retro'."
2699 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2700 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2701 (repeat :tag "User defined list" gmm-tool-bar-item)
2703 :version "23.0" ;; No Gnus
2704 :initialize 'custom-initialize-default
2705 :set 'gnus-summary-tool-bar-update
2706 :group 'gnus-summary)
2708 (defcustom gnus-summary-tool-bar-gnome
2709 '((gnus-summary-post-news "mail/compose" nil)
2710 (gnus-summary-insert-new-articles "mail/inbox" nil
2711 :visible (or (not gnus-agent)
2713 (gnus-summary-reply-with-original "mail/reply")
2714 (gnus-summary-reply "mail/reply" nil :visible nil)
2715 (gnus-summary-followup-with-original "mail/reply-all")
2716 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2717 (gnus-summary-mail-forward "mail/forward")
2718 (gnus-summary-save-article "mail/save")
2719 (gnus-summary-search-article-forward "search" nil :visible nil)
2720 (gnus-summary-print-article "print")
2721 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2722 ;; Some new commands that may need more suitable icons:
2723 (gnus-summary-save-newsrc "save" nil :visible nil)
2724 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2725 (gnus-summary-prev-article "left-arrow")
2726 (gnus-summary-next-article "right-arrow")
2727 (gnus-summary-next-page "next-page")
2728 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2730 ;; Maybe some sort-by-... could be added:
2731 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2732 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2733 (gnus-summary-mark-as-expirable
2735 :visible (gnus-check-backend-function 'request-expire-articles
2736 gnus-newsgroup-name))
2737 (gnus-summary-mark-as-spam
2739 :visible (and (fboundp 'spam-group-ham-contents-p)
2740 (spam-group-ham-contents-p gnus-newsgroup-name))
2741 :help "Mark as spam")
2742 (gnus-summary-mark-as-read-forward
2744 :visible (and (fboundp 'spam-group-spam-contents-p)
2745 (spam-group-spam-contents-p gnus-newsgroup-name)))
2747 (gnus-summary-exit "exit")
2748 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2749 (gnus-info-find-node "help"))
2750 "List of functions for the summary tool bar (GNOME style).
2752 See `gmm-tool-bar-from-list' for the format of the list."
2753 :type '(repeat gmm-tool-bar-item)
2754 :version "23.0" ;; No Gnus
2755 :initialize 'custom-initialize-default
2756 :set 'gnus-summary-tool-bar-update
2757 :group 'gnus-summary)
2759 (defcustom gnus-summary-tool-bar-retro
2760 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2761 (gnus-summary-next-unread-article "gnus/next-ur")
2762 (gnus-summary-post-news "gnus/post")
2763 (gnus-summary-followup-with-original "gnus/fuwo")
2764 (gnus-summary-followup "gnus/followup")
2765 (gnus-summary-reply-with-original "gnus/reply-wo")
2766 (gnus-summary-reply "gnus/reply")
2767 (gnus-summary-caesar-message "gnus/rot13")
2768 (gnus-uu-decode-uu "gnus/uu-decode")
2769 (gnus-summary-save-article-file "gnus/save-aif")
2770 (gnus-summary-save-article "gnus/save-art")
2771 (gnus-uu-post-news "gnus/uu-post")
2772 (gnus-summary-catchup "gnus/catchup")
2773 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2774 (gnus-summary-exit "gnus/exit-summ")
2775 ;; Some new command that may need more suitable icons:
2776 (gnus-summary-print-article "gnus/print" nil :visible nil)
2777 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2778 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2779 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2780 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2781 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2782 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2784 (gnus-info-find-node "gnus/help" nil :visible nil))
2785 "List of functions for the summary tool bar (retro look).
2787 See `gmm-tool-bar-from-list' for the format of the list."
2788 :type '(repeat gmm-tool-bar-item)
2789 :version "23.0" ;; No Gnus
2790 :initialize 'custom-initialize-default
2791 :set 'gnus-summary-tool-bar-update
2792 :group 'gnus-summary)
2794 (defcustom gnus-summary-tool-bar-zap-list t
2795 "List of icon items from the global tool bar.
2796 These items are not displayed in the Gnus summary mode tool bar.
2798 See `gmm-tool-bar-from-list' for the format of the list."
2799 :type 'gmm-tool-bar-zap-list
2800 :version "23.0" ;; No Gnus
2801 :initialize 'custom-initialize-default
2802 :set 'gnus-summary-tool-bar-update
2803 :group 'gnus-summary)
2805 (defvar image-load-path)
2807 (defun gnus-summary-make-tool-bar (&optional force)
2808 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2809 When FORCE, rebuild the tool bar."
2810 (when (and (not (featurep 'xemacs))
2811 (boundp 'tool-bar-mode)
2813 (or (not gnus-summary-tool-bar-map) force))
2815 (gmm-image-load-path-for-library "gnus"
2818 (image-load-path (cons (car load-path)
2819 (when (boundp 'image-load-path)
2821 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2822 gnus-summary-tool-bar-zap-list
2823 'gnus-summary-mode-map)))
2825 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2827 (setq gnus-summary-tool-bar-map map))))
2828 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2830 (defun gnus-score-set-default (var value)
2831 "A version of set that updates the GNU Emacs menu-bar."
2833 ;; It is the message that forces the active status to be updated.
2836 (defun gnus-make-score-map (type)
2837 "Make a summary score map of type TYPE."
2840 (let ((headers '(("author" "from" string)
2841 ("subject" "subject" string)
2842 ("article body" "body" string)
2843 ("article head" "head" string)
2844 ("xref" "xref" string)
2845 ("extra header" "extra" string)
2846 ("lines" "lines" number)
2847 ("followups to author" "followup" string)))
2848 (types '((number ("less than" <)
2851 (string ("substring" s)
2855 (perms '(("temporary" (current-time-string))
2863 (if (eq type 'lower)
2868 (setq header (car headers))
2874 (let ((ts (cdr (assoc (nth 2 header) types)))
2890 'gnus-summary-score-entry
2892 (if (or (string= (nth 1 header)
2894 (string= (nth 1 header)
2897 (list 'gnus-summary-header
2899 (list 'quote (nth 1 (car ts)))
2900 (list 'gnus-score-delta-default
2907 (list (nreverse outp))))
2910 (list (nreverse outt))))
2912 (setq headers (cdr headers)))
2913 (list (nreverse outh))))))))
2917 (defun gnus-summary-mode (&optional group)
2918 "Major mode for reading articles.
2920 All normal editing commands are switched off.
2921 \\<gnus-summary-mode-map>
2922 Each line in this buffer represents one article. To read an
2923 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2924 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2927 You can also post articles and send mail from this buffer. To
2928 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2929 of an article, type `\\[gnus-summary-reply]'.
2931 There are approx. one gazillion commands you can execute in this
2932 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2934 The following commands are available:
2936 \\{gnus-summary-mode-map}"
2938 (kill-all-local-variables)
2939 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2940 (gnus-summary-make-local-variables))
2941 (gnus-summary-make-local-variables)
2942 (setq gnus-newsgroup-name group)
2943 (when (gnus-visual-p 'summary-menu 'menu)
2944 (gnus-summary-make-menu-bar)
2945 (gnus-summary-make-tool-bar))
2946 (gnus-make-thread-indent-array)
2947 (gnus-simplify-mode-line)
2948 (setq major-mode 'gnus-summary-mode)
2949 (setq mode-name "Summary")
2950 (make-local-variable 'minor-mode-alist)
2951 (use-local-map gnus-summary-mode-map)
2952 (buffer-disable-undo)
2953 (setq buffer-read-only t ;Disable modification
2954 show-trailing-whitespace nil)
2955 (setq truncate-lines t)
2956 (setq selective-display t)
2957 (setq selective-display-ellipses t) ;Display `...'
2958 (gnus-summary-set-display-table)
2959 (gnus-set-default-directory)
2960 (make-local-variable 'gnus-summary-line-format)
2961 (make-local-variable 'gnus-summary-line-format-spec)
2962 (make-local-variable 'gnus-summary-dummy-line-format)
2963 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2964 (make-local-variable 'gnus-summary-mark-positions)
2965 (gnus-make-local-hook 'pre-command-hook)
2966 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2967 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2968 (turn-on-gnus-mailing-list-mode)
2969 (mm-enable-multibyte)
2970 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2971 (gnus-update-summary-mark-positions))
2973 (defun gnus-summary-make-local-variables ()
2974 "Make all the local summary buffer variables."
2976 (dolist (local gnus-summary-local-variables)
2979 (if (eq (cdr local) 'global)
2980 ;; Copy the global value of the variable.
2981 (setq global (symbol-value (car local)))
2982 ;; Use the value from the list.
2983 (setq global (eval (cdr local))))
2984 (set (make-local-variable (car local)) global))
2985 ;; Simple nil-valued local variable.
2986 (set (make-local-variable local) nil)))))
2988 (defun gnus-summary-clear-local-variables ()
2989 (let ((locals gnus-summary-local-variables))
2991 (if (consp (car locals))
2992 (and (symbolp (caar locals))
2993 (set (caar locals) nil))
2994 (and (symbolp (car locals))
2995 (set (car locals) nil)))
2996 (setq locals (cdr locals)))))
2998 ;; Summary data functions.
3000 (defmacro gnus-data-number (data)
3003 (defmacro gnus-data-set-number (data number)
3004 `(setcar ,data ,number))
3006 (defmacro gnus-data-mark (data)
3009 (defmacro gnus-data-set-mark (data mark)
3010 `(setcar (nthcdr 1 ,data) ,mark))
3012 (defmacro gnus-data-pos (data)
3015 (defmacro gnus-data-set-pos (data pos)
3016 `(setcar (nthcdr 2 ,data) ,pos))
3018 (defmacro gnus-data-header (data)
3021 (defmacro gnus-data-set-header (data header)
3022 `(setf (nth 3 ,data) ,header))
3024 (defmacro gnus-data-level (data)
3027 (defmacro gnus-data-unread-p (data)
3028 `(= (nth 1 ,data) gnus-unread-mark))
3030 (defmacro gnus-data-read-p (data)
3031 `(/= (nth 1 ,data) gnus-unread-mark))
3033 (defmacro gnus-data-pseudo-p (data)
3034 `(consp (nth 3 ,data)))
3036 (defmacro gnus-data-find (number)
3037 `(assq ,number gnus-newsgroup-data))
3039 (defmacro gnus-data-find-list (number &optional data)
3040 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3041 (memq (assq ,number bdata)
3044 (defmacro gnus-data-make (number mark pos header level)
3045 `(list ,number ,mark ,pos ,header ,level))
3047 (defun gnus-data-enter (after-article number mark pos header level offset)
3048 (let ((data (gnus-data-find-list after-article)))
3050 (error "No such article: %d" after-article))
3051 (setcdr data (cons (gnus-data-make number mark pos header level)
3053 (setq gnus-newsgroup-data-reverse nil)
3054 (gnus-data-update-list (cddr data) offset)))
3056 (defun gnus-data-enter-list (after-article list &optional offset)
3058 (let ((data (and after-article (gnus-data-find-list after-article)))
3062 (let ((odata gnus-newsgroup-data))
3063 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3065 (gnus-data-update-list odata offset)))
3066 ;; Find the last element in the list to be spliced into the main
3068 (setq list (last list))
3071 (setcdr list gnus-newsgroup-data)
3072 (setq gnus-newsgroup-data ilist)
3074 (gnus-data-update-list (cdr list) offset)))
3075 (setcdr list (cdr data))
3078 (gnus-data-update-list (cdr list) offset))))
3079 (setq gnus-newsgroup-data-reverse nil))))
3081 (defun gnus-data-remove (article &optional offset)
3082 (let ((data gnus-newsgroup-data))
3083 (if (= (gnus-data-number (car data)) article)
3085 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3086 gnus-newsgroup-data-reverse nil)
3088 (gnus-data-update-list gnus-newsgroup-data offset)))
3090 (when (= (gnus-data-number (cadr data)) article)
3091 (setcdr data (cddr data))
3093 (gnus-data-update-list (cdr data) offset))
3095 gnus-newsgroup-data-reverse nil))
3096 (setq data (cdr data))))))
3098 (defmacro gnus-data-list (backward)
3100 (or gnus-newsgroup-data-reverse
3101 (setq gnus-newsgroup-data-reverse
3102 (reverse gnus-newsgroup-data)))
3103 gnus-newsgroup-data))
3105 (defun gnus-data-update-list (data offset)
3106 "Add OFFSET to the POS of all data entries in DATA."
3107 (setq gnus-newsgroup-data-reverse nil)
3109 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3110 (setq data (cdr data))))
3112 (defun gnus-summary-article-pseudo-p (article)
3113 "Say whether this article is a pseudo article or not."
3114 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3116 (defmacro gnus-summary-article-sparse-p (article)
3117 "Say whether this article is a sparse article or not."
3118 `(memq ,article gnus-newsgroup-sparse))
3120 (defmacro gnus-summary-article-ancient-p (article)
3121 "Say whether this article is a sparse article or not."
3122 `(memq ,article gnus-newsgroup-ancient))
3124 (defun gnus-article-parent-p (number)
3125 "Say whether this article is a parent or not."
3126 (let ((data (gnus-data-find-list number)))
3127 (and (cdr data) ; There has to be an article after...
3128 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3129 (gnus-data-level (nth 1 data))))))
3131 (defun gnus-article-children (number)
3132 "Return a list of all children to NUMBER."
3133 (let* ((data (gnus-data-find-list number))
3134 (level (gnus-data-level (car data)))
3136 (setq data (cdr data))
3138 (= (gnus-data-level (car data)) (1+ level)))
3139 (push (gnus-data-number (car data)) children)
3140 (setq data (cdr data)))
3143 (defmacro gnus-summary-skip-intangible ()
3144 "If the current article is intangible, then jump to a different article."
3145 '(let ((to (get-text-property (point) 'gnus-intangible)))
3146 (and to (gnus-summary-goto-subject to))))
3148 (defmacro gnus-summary-article-intangible-p ()
3149 "Say whether this article is intangible or not."
3150 '(get-text-property (point) 'gnus-intangible))
3152 (defun gnus-article-read-p (article)
3153 "Say whether ARTICLE is read or not."
3154 (not (or (memq article gnus-newsgroup-marked)
3155 (memq article gnus-newsgroup-spam-marked)
3156 (memq article gnus-newsgroup-unreads)
3157 (memq article gnus-newsgroup-unselected)
3158 (memq article gnus-newsgroup-dormant))))
3160 ;; Some summary mode macros.
3162 (defmacro gnus-summary-article-number ()
3163 "The article number of the article on the current line.
3164 If there isn't an article number here, then we return the current
3167 (gnus-summary-skip-intangible)
3168 (or (get-text-property (point) 'gnus-number)
3169 (gnus-summary-last-subject))))
3171 (defmacro gnus-summary-article-header (&optional number)
3172 "Return the header of article NUMBER."
3173 `(gnus-data-header (gnus-data-find
3174 ,(or number '(gnus-summary-article-number)))))
3176 (defmacro gnus-summary-thread-level (&optional number)
3177 "Return the level of thread that starts with article NUMBER."
3178 `(if (and (eq gnus-summary-make-false-root 'dummy)
3179 (get-text-property (point) 'gnus-intangible))
3181 (gnus-data-level (gnus-data-find
3182 ,(or number '(gnus-summary-article-number))))))
3184 (defmacro gnus-summary-article-mark (&optional number)
3185 "Return the mark of article NUMBER."
3186 `(gnus-data-mark (gnus-data-find
3187 ,(or number '(gnus-summary-article-number)))))
3189 (defmacro gnus-summary-article-pos (&optional number)
3190 "Return the position of the line of article NUMBER."
3191 `(gnus-data-pos (gnus-data-find
3192 ,(or number '(gnus-summary-article-number)))))
3194 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3195 (defmacro gnus-summary-article-subject (&optional number)
3196 "Return current subject string or nil if nothing."
3199 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3200 '(gnus-data-header (assq (gnus-summary-article-number)
3201 gnus-newsgroup-data)))))
3204 (mail-header-subject headers))))
3206 (defmacro gnus-summary-article-score (&optional number)
3207 "Return current article score."
3208 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3209 gnus-newsgroup-scored))
3210 gnus-summary-default-score 0))
3212 (defun gnus-summary-article-children (&optional number)
3213 "Return a list of article numbers that are children of article NUMBER."
3214 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3215 (level (gnus-data-level (car data)))
3217 (while (and (setq data (cdr data))
3218 (> (setq l (gnus-data-level (car data))) level))
3219 (and (= (1+ level) l)
3220 (push (gnus-data-number (car data))
3222 (nreverse children)))
3224 (defun gnus-summary-article-parent (&optional number)
3225 "Return the article number of the parent of article NUMBER."
3226 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3227 (gnus-data-list t)))
3228 (level (gnus-data-level (car data))))
3230 () ; This is a root.
3231 ;; We search until we find an article with a level less than
3232 ;; this one. That function has to be the parent.
3233 (while (and (setq data (cdr data))
3234 (not (< (gnus-data-level (car data)) level))))
3235 (and data (gnus-data-number (car data))))))
3237 (defun gnus-unread-mark-p (mark)
3238 "Say whether MARK is the unread mark."
3239 (= mark gnus-unread-mark))
3241 (defun gnus-read-mark-p (mark)
3242 "Say whether MARK is one of the marks that mark as read.
3243 This is all marks except unread, ticked, dormant, and expirable."
3244 (not (or (= mark gnus-unread-mark)
3245 (= mark gnus-ticked-mark)
3246 (= mark gnus-spam-mark)
3247 (= mark gnus-dormant-mark)
3248 (= mark gnus-expirable-mark))))
3250 (defmacro gnus-article-mark (number)
3251 "Return the MARK of article NUMBER.
3252 This macro should only be used when computing the mark the \"first\"
3253 time; i.e., when generating the summary lines. After that,
3254 `gnus-summary-article-mark' should be used to examine the
3257 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3258 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3259 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3260 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3261 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3262 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3263 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3264 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3265 gnus-ancient-mark))))
3267 ;; Saving hidden threads.
3269 (defmacro gnus-save-hidden-threads (&rest forms)
3270 "Save hidden threads, eval FORMS, and restore the hidden threads."
3271 (let ((config (make-symbol "config")))
3272 `(let ((,config (gnus-hidden-threads-configuration)))
3276 (gnus-restore-hidden-threads-configuration ,config)))))
3277 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3278 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3280 (defun gnus-data-compute-positions ()
3281 "Compute the positions of all articles."
3282 (setq gnus-newsgroup-data-reverse nil)
3283 (let ((data gnus-newsgroup-data))
3285 (gnus-save-hidden-threads
3286 (gnus-summary-show-all-threads)
3287 (goto-char (point-min))
3289 (while (get-text-property (point) 'gnus-intangible)
3291 (gnus-data-set-pos (car data) (+ (point) 3))
3292 (setq data (cdr data))
3293 (forward-line 1))))))
3295 (defun gnus-hidden-threads-configuration ()
3296 "Return the current hidden threads configuration."
3299 (goto-char (point-min))
3300 (while (search-forward "\r" nil t)
3301 (push (1- (point)) config))
3304 (defun gnus-restore-hidden-threads-configuration (config)
3305 "Restore hidden threads configuration from CONFIG."
3307 (let (point buffer-read-only)
3308 (while (setq point (pop config))
3309 (when (and (< point (point-max))
3311 (eq (char-after) ?\n))
3312 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3314 ;; Various summary mode internalish functions.
3316 (defun gnus-mouse-pick-article (e)
3319 (gnus-summary-next-page nil t))
3321 (defun gnus-summary-set-display-table ()
3322 "Change the display table.
3323 Odd characters have a tendency to mess
3324 up nicely formatted displays - we make all possible glyphs
3325 display only a single character."
3327 ;; We start from the standard display table, if any.
3328 (let ((table (or (copy-sequence standard-display-table)
3329 (make-display-table)))
3331 ;; Nix out all the control chars...
3332 (while (>= (setq i (1- i)) 0)
3333 (aset table i [??]))
3334 ;; ... but not newline and cr, of course. (cr is necessary for the
3335 ;; selective display).
3336 (aset table ?\n nil)
3337 (aset table ?\r nil)
3338 ;; We keep TAB as well.
3339 (aset table ?\t nil)
3340 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3341 ;; Emacs 23 (unicode), that are not set already.
3342 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3345 (while (>= (setq i (1- i)) 127)
3346 ;; Only modify if the entry is nil.
3347 (unless (aref table i)
3348 (aset table i [??]))))
3349 (setq buffer-display-table table)))
3351 (defun gnus-summary-set-article-display-arrow (pos)
3352 "Update the overlay arrow to point to line at position POS."
3353 (when (and gnus-summary-display-arrow
3354 (boundp 'overlay-arrow-position)
3355 (boundp 'overlay-arrow-string))
3359 (unless overlay-arrow-position
3360 (setq overlay-arrow-position (make-marker)))
3361 (setq overlay-arrow-string "=>"
3362 overlay-arrow-position (set-marker overlay-arrow-position
3364 (current-buffer))))))
3366 (defun gnus-summary-setup-buffer (group)
3367 "Initialize summary buffer."
3368 (let ((buffer (gnus-summary-buffer-name group))
3369 (dead-name (concat "*Dead Summary "
3370 (gnus-group-decoded-name group) "*")))
3371 ;; If a dead summary buffer exists, we kill it.
3372 (when (gnus-buffer-live-p dead-name)
3373 (gnus-kill-buffer dead-name))
3374 (if (get-buffer buffer)
3377 (setq gnus-summary-buffer (current-buffer))
3378 (not gnus-newsgroup-prepared))
3379 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3380 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3381 (gnus-summary-mode group)
3383 (gnus-carpal-setup-buffer 'summary))
3384 (when (gnus-group-quit-config group)
3385 (set (make-local-variable 'gnus-single-article-buffer) nil))
3386 (make-local-variable 'gnus-article-buffer)
3387 (make-local-variable 'gnus-article-current)
3388 (make-local-variable 'gnus-original-article-buffer)
3389 (setq gnus-newsgroup-name group)
3390 ;; Set any local variables in the group parameters.
3391 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3394 (defun gnus-set-global-variables ()
3395 "Set the global equivalents of the buffer-local variables.
3396 They are set to the latest values they had. These reflect the summary
3397 buffer that was in action when the last article was fetched."
3398 (when (eq major-mode 'gnus-summary-mode)
3399 (setq gnus-summary-buffer (current-buffer))
3400 (let ((name gnus-newsgroup-name)
3401 (marked gnus-newsgroup-marked)
3402 (spam gnus-newsgroup-spam-marked)
3403 (unread gnus-newsgroup-unreads)
3404 (headers gnus-current-headers)
3405 (data gnus-newsgroup-data)
3406 (summary gnus-summary-buffer)
3407 (article-buffer gnus-article-buffer)
3408 (original gnus-original-article-buffer)
3409 (gac gnus-article-current)
3410 (reffed gnus-reffed-article-number)
3411 (score-file gnus-current-score-file)
3412 (default-charset gnus-newsgroup-charset)
3414 (let ((locals gnus-newsgroup-variables))
3416 (if (consp (car locals))
3417 (push (eval (caar locals)) vlist)
3418 (push (eval (car locals)) vlist))
3419 (setq locals (cdr locals)))
3420 (setq vlist (nreverse vlist)))
3421 (with-current-buffer gnus-group-buffer
3422 (setq gnus-newsgroup-name name
3423 gnus-newsgroup-marked marked
3424 gnus-newsgroup-spam-marked spam
3425 gnus-newsgroup-unreads unread
3426 gnus-current-headers headers
3427 gnus-newsgroup-data data
3428 gnus-article-current gac
3429 gnus-summary-buffer summary
3430 gnus-article-buffer article-buffer
3431 gnus-original-article-buffer original
3432 gnus-reffed-article-number reffed
3433 gnus-current-score-file score-file
3434 gnus-newsgroup-charset default-charset)
3435 (let ((locals gnus-newsgroup-variables))
3437 (if (consp (car locals))
3438 (set (caar locals) (pop vlist))
3439 (set (car locals) (pop vlist)))
3440 (setq locals (cdr locals))))
3441 ;; The article buffer also has local variables.
3442 (when (gnus-buffer-live-p gnus-article-buffer)
3443 (set-buffer gnus-article-buffer)
3444 (setq gnus-summary-buffer summary))))))
3446 (defun gnus-summary-article-unread-p (article)
3447 "Say whether ARTICLE is unread or not."
3448 (memq article gnus-newsgroup-unreads))
3450 (defun gnus-summary-first-article-p (&optional article)
3451 "Return whether ARTICLE is the first article in the buffer."
3452 (if (not (setq article (or article (gnus-summary-article-number))))
3454 (eq article (caar gnus-newsgroup-data))))
3456 (defun gnus-summary-last-article-p (&optional article)
3457 "Return whether ARTICLE is the last article in the buffer."
3458 (if (not (setq article (or article (gnus-summary-article-number))))
3459 ;; All non-existent numbers are the last article. :-)
3461 (not (cdr (gnus-data-find-list article)))))
3463 (defun gnus-make-thread-indent-array (&optional n)
3465 (progn (setq n 200) nil)
3466 (null gnus-thread-indent-array)
3467 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3468 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3469 gnus-thread-indent-array-level gnus-thread-indent-level)
3471 (aset gnus-thread-indent-array n
3472 (make-string (* n gnus-thread-indent-level) ? ))
3475 (defun gnus-update-summary-mark-positions ()
3476 "Compute where the summary marks are to go."
3478 (when (gnus-buffer-exists-p gnus-summary-buffer)
3479 (set-buffer gnus-summary-buffer))
3480 (let ((spec gnus-summary-line-format-spec)
3483 (gnus-set-work-buffer)
3484 (let ((gnus-tmp-unread ?Z)
3485 (gnus-replied-mark ?Z)
3486 (gnus-score-below-mark ?Z)
3487 (gnus-score-over-mark ?Z)
3488 (gnus-undownloaded-mark ?Z)
3489 (gnus-summary-line-format-spec spec)
3490 (gnus-newsgroup-downloadable '(0))
3491 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3492 case-fold-search ignores)
3493 ;; Here, all marks are bound to Z.
3494 (gnus-summary-insert-line header
3495 0 nil t gnus-tmp-unread t nil "" nil 1)
3496 (goto-char (point-min))
3497 ;; Memorize the positions of the same characters as dummy marks.
3498 (while (re-search-forward "[A-D]" nil t)
3499 (push (point) ignores))
3501 ;; We use A-D as dummy marks in order to know column positions
3502 ;; where marks should be inserted.
3503 (setq gnus-tmp-unread ?A
3504 gnus-replied-mark ?B
3505 gnus-score-below-mark ?C
3506 gnus-score-over-mark ?C
3507 gnus-undownloaded-mark ?D)
3508 (gnus-summary-insert-line header
3509 0 nil t gnus-tmp-unread t nil "" nil 1)
3510 ;; Ignore characters which aren't dummy marks.
3512 (delete-region (goto-char (1- p)) p)
3514 (goto-char (point-min))
3515 (setq pos (list (cons 'unread
3516 (and (search-forward "A" nil t)
3517 (- (point) (point-min) 1)))))
3518 (goto-char (point-min))
3519 (push (cons 'replied (and (search-forward "B" nil t)
3520 (- (point) (point-min) 1)))
3522 (goto-char (point-min))
3523 (push (cons 'score (and (search-forward "C" nil t)
3524 (- (point) (point-min) 1)))
3526 (goto-char (point-min))
3527 (push (cons 'download (and (search-forward "D" nil t)
3528 (- (point) (point-min) 1)))
3530 (setq gnus-summary-mark-positions pos))))
3532 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3533 "Insert a dummy root in the summary buffer."
3535 (gnus-add-text-properties
3536 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3537 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3539 (defun gnus-summary-extract-address-component (from)
3540 (or (car (funcall gnus-extract-address-components from))
3543 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3544 (let ((mail-parse-charset gnus-newsgroup-charset)
3545 (ignored-from-addresses (gnus-ignored-from-addresses))
3546 ; Is it really necessary to do this next part for each summary line?
3547 ; Luckily, doesn't seem to slow things down much.
3548 (mail-parse-ignored-charsets
3549 (with-current-buffer gnus-summary-buffer
3550 gnus-newsgroup-ignored-charsets)))
3552 (and ignored-from-addresses
3553 (string-match ignored-from-addresses gnus-tmp-from)
3554 (let ((extra-headers (mail-header-extra header))
3558 ((setq to (cdr (assq 'To extra-headers)))
3559 (concat gnus-summary-to-prefix
3561 (gnus-summary-extract-address-component
3562 (funcall gnus-decode-encoded-address-function to)))))
3565 (cdr (assq 'Newsgroups extra-headers))
3567 (memq 'Newsgroups gnus-extra-headers)
3568 (eq (car (gnus-find-method-for-group
3569 gnus-newsgroup-name)) 'nntp)
3570 (gnus-group-real-name gnus-newsgroup-name))))
3571 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3572 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3574 (defun gnus-summary-insert-line (gnus-tmp-header
3575 gnus-tmp-level gnus-tmp-current
3576 undownloaded gnus-tmp-unread gnus-tmp-replied
3577 gnus-tmp-expirable gnus-tmp-subject-or-nil
3578 &optional gnus-tmp-dummy gnus-tmp-score
3580 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3581 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3583 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3584 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3585 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3586 (gnus-tmp-score-char
3587 (if (or (null gnus-summary-default-score)
3588 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3589 gnus-summary-zcore-fuzz))
3591 (if (< gnus-tmp-score gnus-summary-default-score)
3592 gnus-score-below-mark gnus-score-over-mark)))
3593 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3595 (cond (gnus-tmp-process gnus-process-mark)
3596 ((memq gnus-tmp-current gnus-newsgroup-cached)
3598 (gnus-tmp-replied gnus-replied-mark)
3599 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3600 gnus-forwarded-mark)
3601 ((memq gnus-tmp-current gnus-newsgroup-saved)
3603 ((memq gnus-tmp-number gnus-newsgroup-recent)
3605 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3608 (gnus-tmp-downloaded
3610 gnus-undownloaded-mark)
3611 (gnus-newsgroup-agentized
3612 gnus-downloaded-mark)
3615 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3618 ((string-match "<[^>]+> *$" gnus-tmp-from)
3619 (let ((beg (match-beginning 0)))
3620 (or (and (string-match "^\".+\"" gnus-tmp-from)
3621 (substring gnus-tmp-from 1 (1- (match-end 0))))
3622 (substring gnus-tmp-from 0 beg))))
3623 ((string-match "(.+)" gnus-tmp-from)
3624 (substring gnus-tmp-from
3625 (1+ (match-beginning 0)) (1- (match-end 0))))
3627 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3628 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3629 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3630 (buffer-read-only nil))
3631 (when (string= gnus-tmp-name "")
3632 (setq gnus-tmp-name gnus-tmp-from))
3633 (unless (numberp gnus-tmp-lines)
3634 (setq gnus-tmp-lines -1))
3635 (if (= gnus-tmp-lines -1)
3636 (setq gnus-tmp-lines "?")
3637 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3638 (gnus-put-text-property
3640 (progn (eval gnus-summary-line-format-spec) (point))
3641 'gnus-number gnus-tmp-number)
3642 (when (gnus-visual-p 'summary-highlight 'highlight)
3644 (gnus-run-hooks 'gnus-summary-update-hook)
3647 (defun gnus-summary-update-line (&optional dont-update)
3648 "Update summary line after change."
3649 (when (and gnus-summary-default-score
3650 (not gnus-summary-inhibit-highlight))
3651 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3652 (article (gnus-summary-article-number))
3653 (score (gnus-summary-article-score article)))
3655 (if (and gnus-summary-mark-below
3656 (< (gnus-summary-article-score)
3657 gnus-summary-mark-below))
3658 ;; This article has a low score, so we mark it as read.
3659 (when (memq article gnus-newsgroup-unreads)
3660 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3661 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3662 ;; This article was previously marked as read on account
3663 ;; of a low score, but now it has risen, so we mark it as
3665 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3666 (gnus-summary-update-mark
3667 (if (or (null gnus-summary-default-score)
3668 (<= (abs (- score gnus-summary-default-score))
3669 gnus-summary-zcore-fuzz))
3671 (if (< score gnus-summary-default-score)
3672 gnus-score-below-mark gnus-score-over-mark))
3674 ;; Do visual highlighting.
3675 (when (gnus-visual-p 'summary-highlight 'highlight)
3676 (gnus-run-hooks 'gnus-summary-update-hook)))))
3678 (defvar gnus-tmp-new-adopts nil)
3680 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3681 "Return the number of articles in THREAD.
3682 This may be 0 in some cases -- if none of the articles in
3683 the thread are to be displayed."
3685 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3687 ((not (listp thread))
3689 ((and (consp thread) (cdr thread))
3692 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3695 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3698 (when (and level (zerop level) gnus-tmp-new-adopts)
3701 'gnus-summary-number-of-articles-in-thread
3702 gnus-tmp-new-adopts))))
3704 (if (> number 1) gnus-not-empty-thread-mark
3705 gnus-empty-thread-mark)
3708 (defsubst gnus-summary-line-message-size (head)
3709 "Return pretty-printed version of message size.
3710 This function is intended to be used in
3711 `gnus-summary-line-format-alist'."
3712 (let ((c (or (mail-header-chars head) -1)))
3713 (cond ((< c 0) "n/a") ; chars not available
3714 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3715 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3716 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3717 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3720 (defun gnus-summary-set-local-parameters (group)
3721 "Go through the local params of GROUP and set all variable specs in that list."
3722 (let ((vars '(quit-config))) ; Ignore quit-config.
3723 (dolist (elem (gnus-group-find-parameter group))
3724 (and (consp elem) ; Has to be a cons.
3725 (consp (cdr elem)) ; The cdr has to be a list.
3726 (symbolp (car elem)) ; Has to be a symbol in there.
3727 (not (memq (car elem) vars))
3728 (ignore-errors ; So we set it.
3729 (push (car elem) vars)
3730 (make-local-variable (car elem))
3731 (set (car elem) (eval (nth 1 elem))))))))
3733 (defun gnus-summary-read-group (group &optional show-all no-article
3734 kill-buffer no-display backward
3736 "Start reading news in newsgroup GROUP.
3737 If SHOW-ALL is non-nil, already read articles are also listed.
3738 If NO-ARTICLE is non-nil, no article is selected initially.
3739 If NO-DISPLAY, don't generate a summary buffer."
3743 (let ((gnus-auto-select-next nil))
3744 (or (gnus-summary-read-group-1
3745 group show-all no-article
3746 kill-buffer no-display
3749 select-articles nil)))))
3750 (eq gnus-auto-select-next 'quietly))
3751 (set-buffer gnus-group-buffer)
3752 ;; The entry function called above goes to the next
3753 ;; group automatically, so we go two groups back
3754 ;; if we are searching for the previous group.
3756 (gnus-group-prev-unread-group 2))
3757 (if (not (equal group (gnus-group-group-name)))
3758 (setq group (gnus-group-group-name))
3762 (defun gnus-summary-read-group-1 (group show-all no-article
3763 kill-buffer no-display
3764 &optional select-articles)
3765 ;; Killed foreign groups can't be entered.
3766 ;; (when (and (not (gnus-group-native-p group))
3767 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3768 ;; (error "Dead non-native groups can't be entered"))
3769 (gnus-message 5 "Retrieving newsgroup: %s..."
3770 (gnus-group-decoded-name group))
3771 (let* ((new-group (gnus-summary-setup-buffer group))
3772 (quit-config (gnus-group-quit-config group))
3773 (did-select (and new-group (gnus-select-newsgroup
3774 group show-all select-articles))))
3776 ;; This summary buffer exists already, so we just select it.
3778 (gnus-set-global-variables)
3780 (gnus-kill-or-deaden-summary kill-buffer))
3781 (gnus-configure-windows 'summary 'force)
3782 (gnus-set-mode-line 'summary)
3783 (gnus-summary-position-point)
3786 ;; We couldn't select this group.
3788 (when (and (eq major-mode 'gnus-summary-mode)
3789 (not (equal (current-buffer) kill-buffer)))
3790 (kill-buffer (current-buffer))
3791 (if (not quit-config)
3793 ;; Update the info -- marks might need to be removed,
3795 (gnus-summary-update-info)
3796 (set-buffer gnus-group-buffer)
3797 (gnus-group-jump-to-group group)
3798 (gnus-group-next-unread-group 1))
3799 (gnus-handle-ephemeral-exit quit-config)))
3800 (let ((grpinfo (gnus-get-info group)))
3801 (if (null (gnus-info-read grpinfo))
3802 (gnus-message 3 "Group %s contains no messages"
3803 (gnus-group-decoded-name group))
3804 (gnus-message 3 "Can't select group")))
3806 ;; The user did a `C-g' while prompting for number of articles,
3807 ;; so we exit this group.
3808 ((eq did-select 'quit)
3809 (and (eq major-mode 'gnus-summary-mode)
3810 (not (equal (current-buffer) kill-buffer))
3811 (kill-buffer (current-buffer)))
3813 (gnus-kill-or-deaden-summary kill-buffer))
3814 (if (not quit-config)
3816 (set-buffer gnus-group-buffer)
3817 (gnus-group-jump-to-group group)
3818 (gnus-group-next-unread-group 1)
3819 (gnus-configure-windows 'group 'force))
3820 (gnus-handle-ephemeral-exit quit-config))
3821 ;; Finally signal the quit.
3823 ;; The group was successfully selected.
3825 (gnus-set-global-variables)
3826 ;; Save the active value in effect when the group was entered.
3827 (setq gnus-newsgroup-active
3829 (gnus-active gnus-newsgroup-name)))
3830 ;; You can change the summary buffer in some way with this hook.
3831 (gnus-run-hooks 'gnus-select-group-hook)
3832 (when (memq 'summary (gnus-update-format-specifications
3833 nil 'summary 'summary-mode 'summary-dummy))
3834 ;; The format specification for the summary line was updated,
3835 ;; so we need to update the mark positions as well.
3836 (gnus-update-summary-mark-positions))
3837 ;; Do score processing.
3838 (when gnus-use-scoring
3839 (gnus-possibly-score-headers))
3840 ;; Check whether to fill in the gaps in the threads.
3841 (when gnus-build-sparse-threads
3842 (gnus-build-sparse-threads))
3843 ;; Find the initial limit.
3845 (let ((gnus-newsgroup-dormant nil))
3846 (gnus-summary-initial-limit show-all))
3847 (gnus-summary-initial-limit show-all))
3848 ;; Generate the summary buffer.
3850 (gnus-summary-prepare))
3851 (when gnus-use-trees
3852 (gnus-tree-open group)
3853 (setq gnus-summary-highlight-line-function
3854 'gnus-tree-highlight-article))
3855 ;; If the summary buffer is empty, but there are some low-scored
3856 ;; articles or some excluded dormants, we include these in the
3858 (when (and (zerop (buffer-size))
3860 (cond (gnus-newsgroup-dormant
3861 (gnus-summary-limit-include-dormant))
3862 ((and gnus-newsgroup-scored show-all)
3863 (gnus-summary-limit-include-expunged t))))
3864 ;; Function `gnus-apply-kill-file' must be called in this hook.
3865 (gnus-run-hooks 'gnus-apply-kill-hook)
3866 (if (and (zerop (buffer-size))
3869 ;; This newsgroup is empty.
3870 (gnus-summary-catchup-and-exit nil t)
3871 (gnus-message 6 "No unread news")
3873 (gnus-kill-or-deaden-summary kill-buffer))
3874 ;; Return nil from this function.
3876 ;; Hide conversation thread subtrees. We cannot do this in
3877 ;; gnus-summary-prepare-hook since kill processing may not
3878 ;; work with hidden articles.
3879 (gnus-summary-maybe-hide-threads)
3881 (gnus-kill-or-deaden-summary kill-buffer))
3882 (gnus-summary-auto-select-subject)
3883 ;; Show first unread article if requested.
3884 (if (and (not no-article)
3886 gnus-newsgroup-unreads
3887 gnus-auto-select-first)
3889 (gnus-configure-windows 'summary)
3890 (let ((art (gnus-summary-article-number)))
3891 (unless (and (not gnus-plugged)
3892 (or (memq art gnus-newsgroup-undownloaded)
3893 (memq art gnus-newsgroup-downloadable)))
3894 (gnus-summary-goto-article art))))
3895 ;; Don't select any articles.
3896 (gnus-summary-position-point)
3897 (gnus-configure-windows 'summary 'force)
3898 (gnus-set-mode-line 'summary))
3899 (when (and gnus-auto-center-group
3900 (get-buffer-window gnus-group-buffer t))
3901 ;; Gotta use windows, because recenter does weird stuff if
3902 ;; the current buffer ain't the displayed window.
3903 (let ((owin (selected-window)))
3904 (select-window (get-buffer-window gnus-group-buffer t))
3905 (when (gnus-group-goto-group group)
3907 (select-window owin)))
3908 ;; Mark this buffer as "prepared".
3909 (setq gnus-newsgroup-prepared t)
3910 (gnus-run-hooks 'gnus-summary-prepared-hook)
3911 (unless (gnus-ephemeral-group-p group)
3912 (gnus-group-update-group group))
3915 (defun gnus-summary-auto-select-subject ()
3916 "Select the subject line on initial group entry."
3917 (goto-char (point-min))
3919 ((eq gnus-auto-select-subject 'best)
3920 (gnus-summary-best-unread-subject))
3921 ((eq gnus-auto-select-subject 'unread)
3922 (gnus-summary-first-unread-subject))
3923 ((eq gnus-auto-select-subject 'unseen)
3924 (gnus-summary-first-unseen-subject))
3925 ((eq gnus-auto-select-subject 'unseen-or-unread)
3926 (gnus-summary-first-unseen-or-unread-subject))
3927 ((eq gnus-auto-select-subject 'first)
3930 ((functionp gnus-auto-select-subject)
3931 (funcall gnus-auto-select-subject))))
3933 (defun gnus-summary-prepare ()
3934 "Generate the summary buffer."
3936 (let ((buffer-read-only nil))
3938 (setq gnus-newsgroup-data nil
3939 gnus-newsgroup-data-reverse nil)
3940 (gnus-run-hooks 'gnus-summary-generate-hook)
3941 ;; Generate the buffer, either with threads or without.
3942 (when gnus-newsgroup-headers
3943 (gnus-summary-prepare-threads
3944 (if gnus-show-threads
3945 (gnus-sort-gathered-threads
3946 (funcall gnus-summary-thread-gathering-function
3948 (gnus-cut-threads (gnus-make-threads)))))
3949 ;; Unthreaded display.
3950 (gnus-sort-articles gnus-newsgroup-headers))))
3951 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3952 ;; Call hooks for modifying summary buffer.
3953 (goto-char (point-min))
3954 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3956 (defsubst gnus-general-simplify-subject (subject)
3957 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3960 ;; Truncate the subject.
3961 (gnus-simplify-subject-functions
3962 (gnus-map-function gnus-simplify-subject-functions subject))
3963 ((numberp gnus-summary-gather-subject-limit)
3964 (setq subject (gnus-simplify-subject-re subject))
3965 (if (> (length subject) gnus-summary-gather-subject-limit)
3966 (substring subject 0 gnus-summary-gather-subject-limit)
3968 ;; Fuzzily simplify it.
3969 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3970 (gnus-simplify-subject-fuzzy subject))
3971 ;; Just remove the leading "Re:".
3973 (gnus-simplify-subject-re subject))))
3975 (if (and gnus-summary-gather-exclude-subject
3976 (string-match gnus-summary-gather-exclude-subject subject))
3977 nil ; This article shouldn't be gathered
3980 (defun gnus-summary-simplify-subject-query ()
3981 "Query where the respool algorithm would put this article."
3983 (gnus-summary-select-article)
3984 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3986 (defun gnus-gather-threads-by-subject (threads)
3987 "Gather threads by looking at Subject headers."
3988 (if (not gnus-summary-make-false-root)
3990 (let ((hashtb (gnus-make-hashtable 1024))
3993 subject hthread whole-subject)
3995 (setq subject (gnus-general-simplify-subject
3996 (setq whole-subject (mail-header-subject
3999 (if (setq hthread (gnus-gethash subject hashtb))
4001 ;; We enter a dummy root into the thread, if we
4002 ;; haven't done that already.
4003 (unless (stringp (caar hthread))
4004 (setcar hthread (list whole-subject (car hthread))))
4005 ;; We add this new gathered thread to this gathered
4007 (setcdr (car hthread)
4008 (nconc (cdar hthread) (list (car threads))))
4009 ;; Remove it from the list of threads.
4010 (setcdr prev (cdr threads))
4011 (setq threads prev))
4012 ;; Enter this thread into the hash table.
4013 (gnus-sethash subject
4014 (if gnus-summary-make-false-root-always
4016 ;; If you want a dummy root above all
4018 (setcar threads (list whole-subject
4024 (setq threads (cdr threads)))
4027 (defun gnus-gather-threads-by-references (threads)
4028 "Gather threads by looking at References headers."
4029 (let ((idhashtb (gnus-make-hashtable 1024))
4030 (thhashtb (gnus-make-hashtable 1024))
4033 ids references id gthread gid entered ref)
4035 (when (setq references (mail-header-references (caar threads)))
4036 (setq id (mail-header-id (caar threads))
4037 ids (inline (gnus-split-references references))
4039 (while (setq ref (pop ids))
4040 (setq ids (delete ref ids))
4041 (if (not (setq gid (gnus-gethash ref idhashtb)))
4043 (gnus-sethash ref id idhashtb)
4044 (gnus-sethash id threads thhashtb))
4045 (setq gthread (gnus-gethash gid thhashtb))
4047 ;; We enter a dummy root into the thread, if we
4048 ;; haven't done that already.
4049 (unless (stringp (caar gthread))
4050 (setcar gthread (list (mail-header-subject (caar gthread))
4052 ;; We add this new gathered thread to this gathered
4054 (setcdr (car gthread)
4055 (nconc (cdar gthread) (list (car threads)))))
4056 ;; Add it into the thread hash table.
4057 (gnus-sethash id gthread thhashtb)
4059 ;; Remove it from the list of threads.
4060 (setcdr prev (cdr threads))
4061 (setq threads prev))))
4063 (setq threads (cdr threads)))
4066 (defun gnus-sort-gathered-threads (threads)
4067 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4068 (let ((result threads))
4070 (when (stringp (caar threads))
4071 (setcdr (car threads)
4072 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4073 (setq threads (cdr threads)))
4076 (defun gnus-thread-loop-p (root thread)
4077 "Say whether ROOT is in THREAD."
4078 (let ((stack (list thread))
4081 (while (setq thread (pop stack))
4082 (setq th (cdr thread))
4084 (not (eq (caar th) root)))
4087 ;; We have found a loop.
4089 (setcdr thread (delq (car th) (cdr thread)))
4090 (if (boundp (setq ref-dep (intern "none"
4091 gnus-newsgroup-dependencies)))
4092 (setcdr (symbol-value ref-dep)
4093 (nconc (cdr (symbol-value ref-dep))
4095 (set ref-dep (list nil (car th))))
4098 ;; Push all the subthreads onto the stack.
4099 (push (cdr thread) stack)))
4102 (defun gnus-make-threads ()
4103 "Go through the dependency hashtb and find the roots. Return all threads."
4105 (while (catch 'infloop
4108 ;; Deal with self-referencing References loops.
4109 (when (and (car (symbol-value refs))
4116 (car (symbol-value refs)) thread))
4117 (cdr (symbol-value refs)))))))
4120 (unless (car (symbol-value refs))
4121 ;; These threads do not refer back to any other
4122 ;; articles, so they're roots.
4123 (setq threads (append (cdr (symbol-value refs)) threads))))
4124 gnus-newsgroup-dependencies)))
4127 ;; Build the thread tree.
4128 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4129 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4131 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4132 if it was already present.
4134 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4135 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4136 Message-IDs will be renamed to a unique Message-ID before being
4139 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4140 (let* ((id (mail-header-id header))
4141 (id-dep (and id (intern id dependencies)))
4142 parent-id ref ref-dep ref-header replaced)
4143 ;; Enter this `header' in the `dependencies' table.
4147 ;; The first two cases do the normal part: enter a new `header'
4148 ;; in the `dependencies' table.
4149 ((not (boundp id-dep))
4150 (set id-dep (list header)))
4151 ((null (car (symbol-value id-dep)))
4152 (setcar (symbol-value id-dep) header))
4154 ;; From here the `header' was already present in the
4155 ;; `dependencies' table.
4157 ;; Overrides an existing entry;
4158 ;; just set the header part of the entry.
4159 (setcar (symbol-value id-dep) header)
4162 ;; Renames the existing `header' to a unique Message-ID.
4163 ((not gnus-summary-ignore-duplicates)
4164 ;; An article with this Message-ID has already been seen.
4165 ;; We rename the Message-ID.
4166 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4168 (mail-header-set-id header id))
4170 ;; The last case ignores an existing entry, except it adds any
4171 ;; additional Xrefs (in case the two articles came from different
4173 ;; Also sets `header' to `nil' meaning that the `dependencies'
4174 ;; table was *not* modified.
4176 (mail-header-set-xref
4177 (car (symbol-value id-dep))
4178 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4180 (or (mail-header-xref header) "")))
4183 (when (and header (not replaced))
4184 ;; First check that we are not creating a References loop.
4185 (setq parent-id (gnus-parent-id (mail-header-references header)))
4186 (setq ref parent-id)
4188 (setq ref-dep (intern-soft ref dependencies))
4190 (setq ref-header (car (symbol-value ref-dep))))
4191 (if (string= id ref)
4192 ;; Yuk! This is a reference loop. Make the article be a
4195 (mail-header-set-references (car (symbol-value id-dep)) "none")
4197 (setq parent-id nil))
4198 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4199 (setq ref-dep (intern (or parent-id "none") dependencies))
4200 (if (boundp ref-dep)
4201 (setcdr (symbol-value ref-dep)
4202 (nconc (cdr (symbol-value ref-dep))
4203 (list (symbol-value id-dep))))
4204 (set ref-dep (list nil (symbol-value id-dep)))))
4207 (defun gnus-extract-message-id-from-in-reply-to (string)
4208 (if (string-match "<[^>]+>" string)
4209 (substring string (match-beginning 0) (match-end 0))
4212 (defun gnus-build-sparse-threads ()
4213 (let ((headers gnus-newsgroup-headers)
4214 (mail-parse-charset gnus-newsgroup-charset)
4215 (gnus-summary-ignore-duplicates t)
4216 header references generation relations
4217 subject child end new-child date)
4218 ;; First we create an alist of generations/relations, where
4219 ;; generations is how much we trust the relation, and the relation
4221 (gnus-message 7 "Making sparse threads...")
4223 (nnheader-set-temp-buffer " *gnus sparse threads*")
4224 (while (setq header (pop headers))
4225 (when (and (setq references (mail-header-references header))
4226 (not (string= references "")))
4228 (setq child (mail-header-id header)
4229 subject (mail-header-subject header)
4230 date (mail-header-date header)
4232 (while (search-backward ">" nil t)
4233 (setq end (1+ (point)))
4234 (when (search-backward "<" nil t)
4235 (setq new-child (buffer-substring (point) end))
4236 (push (list (incf generation)
4237 child (setq child new-child)
4241 (push (list (1+ generation) child nil subject) relations))
4243 (kill-buffer (current-buffer)))
4244 ;; Sort over trustworthiness.
4247 (when (gnus-dependencies-add-header
4248 (make-full-mail-header
4249 gnus-reffed-article-number
4250 (nth 3 relation) "" (or (nth 4 relation) "")
4252 (or (nth 2 relation) "") 0 0 "")
4253 gnus-newsgroup-dependencies nil)
4254 (push gnus-reffed-article-number gnus-newsgroup-limit)
4255 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4256 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4257 gnus-newsgroup-reads)
4258 (decf gnus-reffed-article-number)))
4259 (sort relations 'car-less-than-car))
4260 (gnus-message 7 "Making sparse threads...done")))
4262 (defun gnus-build-old-threads ()
4263 ;; Look at all the articles that refer back to old articles, and
4264 ;; fetch the headers for the articles that aren't there. This will
4265 ;; build complete threads - if the roots haven't been expired by the
4267 (let ((mail-parse-charset gnus-newsgroup-charset)
4271 (when (not (car (symbol-value refs)))
4272 (setq heads (cdr (symbol-value refs)))
4274 (if (memq (mail-header-number (caar heads))
4275 gnus-newsgroup-dormant)
4276 (setq heads (cdr heads))
4277 (setq id (symbol-name refs))
4278 (while (and (setq id (gnus-build-get-header id))
4279 (not (car (gnus-id-to-thread id)))))
4280 (setq heads nil)))))
4281 gnus-newsgroup-dependencies)))
4283 (defsubst gnus-remove-odd-characters (string)
4284 "Translate STRING into something that doesn't contain weird characters."
4285 (mm-subst-char-in-string
4287 (mm-subst-char-in-string ?\n ?\- string t) t))
4289 ;; This function has to be called with point after the article number
4290 ;; on the beginning of the line.
4291 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4292 (let ((eol (point-at-eol))
4293 (buffer (current-buffer))
4294 header references in-reply-to)
4296 ;; overview: [num subject from date id refs chars lines misc]
4299 (narrow-to-region (point) eol)
4304 (make-full-mail-header
4306 (condition-case () ; subject
4307 (gnus-remove-odd-characters
4308 (funcall gnus-decode-encoded-word-function
4309 (setq x (nnheader-nov-field))))
4311 (condition-case () ; from
4312 (gnus-remove-odd-characters
4313 (funcall gnus-decode-encoded-address-function
4314 (setq x (nnheader-nov-field))))
4316 (nnheader-nov-field) ; date
4317 (nnheader-nov-read-message-id number) ; id
4318 (setq references (nnheader-nov-field)) ; refs
4319 (nnheader-nov-read-integer) ; chars
4320 (nnheader-nov-read-integer) ; lines
4322 (if (looking-at "Xref: ")
4323 (goto-char (match-end 0)))
4324 (nnheader-nov-field)) ; Xref
4325 (nnheader-nov-parse-extra)))) ; extra
4329 (when (and (string= references "")
4330 (setq in-reply-to (mail-header-extra header))
4331 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4332 (mail-header-set-references
4333 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4335 (when gnus-alter-header-function
4336 (funcall gnus-alter-header-function header))
4337 (gnus-dependencies-add-header header dependencies force-new)))
4339 (defun gnus-build-get-header (id)
4340 "Look through the buffer of NOV lines and find the header to ID.
4341 Enter this line into the dependencies hash table, and return
4342 the id of the parent article (if any)."
4343 (let ((deps gnus-newsgroup-dependencies)
4347 (set-buffer nntp-server-buffer)
4348 (let ((case-fold-search nil))
4349 (goto-char (point-min))
4350 (while (and (not found)
4351 (search-forward id nil t))
4353 (setq found (looking-at
4354 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4355 (regexp-quote id))))
4356 (or found (beginning-of-line 2)))
4360 (setq header (gnus-nov-parse-line
4361 (read (current-buffer)) deps))
4362 (gnus-parent-id (mail-header-references header))))))
4364 (let ((number (mail-header-number header)))
4365 (push number gnus-newsgroup-limit)
4366 (push header gnus-newsgroup-headers)
4367 (if (memq number gnus-newsgroup-unselected)
4369 (setq gnus-newsgroup-unreads
4370 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4372 (setq gnus-newsgroup-unselected
4373 (delq number gnus-newsgroup-unselected)))
4374 (push number gnus-newsgroup-ancient)))))))
4376 (defun gnus-build-all-threads ()
4377 "Read all the headers."
4378 (let ((gnus-summary-ignore-duplicates t)
4379 (mail-parse-charset gnus-newsgroup-charset)
4380 (dependencies gnus-newsgroup-dependencies)
4383 (set-buffer nntp-server-buffer)
4384 (let ((case-fold-search nil))
4385 (goto-char (point-min))
4388 (setq article (read (current-buffer))
4389 header (gnus-nov-parse-line article dependencies)))
4391 (with-current-buffer gnus-summary-buffer
4392 (push header gnus-newsgroup-headers)
4393 (if (memq (setq article (mail-header-number header))
4394 gnus-newsgroup-unselected)
4396 (setq gnus-newsgroup-unreads
4397 (gnus-add-to-sorted-list
4398 gnus-newsgroup-unreads article))
4399 (setq gnus-newsgroup-unselected
4400 (delq article gnus-newsgroup-unselected)))
4401 (push article gnus-newsgroup-ancient)))
4402 (forward-line 1)))))))
4404 (defun gnus-summary-update-article-line (article header)
4405 "Update the line for ARTICLE using HEADER."
4406 (let* ((id (mail-header-id header))
4407 (thread (gnus-id-to-thread id)))
4409 (error "Article in no thread"))
4410 ;; Update the thread.
4411 (setcar thread header)
4412 (gnus-summary-goto-subject article)
4413 (let* ((datal (gnus-data-find-list article))
4415 (buffer-read-only nil)
4416 (level (gnus-summary-thread-level)))
4418 (let ((inserted (- (point)
4420 (gnus-summary-insert-line
4422 (memq article gnus-newsgroup-undownloaded)
4423 (gnus-article-mark article)
4424 (memq article gnus-newsgroup-replied)
4425 (memq article gnus-newsgroup-expirable)
4426 ;; Only insert the Subject string when it's different
4427 ;; from the previous Subject string.
4432 (mail-header-subject
4435 (gnus-data-find-list
4437 (gnus-data-list t)))))
4438 ;; Error on the side of excessive subjects.
4440 (mail-header-subject header)))
4442 (mail-header-subject header))
4443 nil (cdr (assq article gnus-newsgroup-scored))
4444 (memq article gnus-newsgroup-processable))
4447 (gnus-data-update-list
4449 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4451 (defun gnus-summary-update-article (article &optional iheader)
4452 "Update ARTICLE in the summary buffer."
4453 (set-buffer gnus-summary-buffer)
4454 (let* ((header (gnus-summary-article-header article))
4455 (id (mail-header-id header))
4456 (data (gnus-data-find article))
4457 (thread (gnus-id-to-thread id))
4458 (references (mail-header-references header))
4462 (when (and references
4463 (not (equal "" references)))
4466 (buffer-read-only nil)
4472 (delq thread parent)))
4473 (if (gnus-summary-insert-subject id header)
4474 ;; Set the (possibly) new article number in the data structure.
4475 (gnus-data-set-number data (gnus-id-to-article id))
4479 (defun gnus-rebuild-thread (id &optional line)
4480 "Rebuild the thread containing ID.
4481 If LINE, insert the rebuilt thread starting on line LINE."
4482 (let ((buffer-read-only nil)
4483 old-pos current thread data)
4484 (if (not gnus-show-threads)
4485 (setq thread (list (car (gnus-id-to-thread id))))
4486 ;; Get the thread this article is part of.
4487 (setq thread (gnus-remove-thread id)))
4488 (setq old-pos (point-at-bol))
4489 (setq current (save-excursion
4490 (and (re-search-backward "[\r\n]" nil t)
4491 (gnus-summary-article-number))))
4492 ;; If this is a gathered thread, we have to go some re-gathering.
4493 (when (stringp (car thread))
4494 (let ((subject (car thread))
4496 (setq thread (cdr thread))
4498 (unless (memq (setq thr (gnus-id-to-thread
4500 (mail-header-id (caar thread)))))
4503 (setq thread (cdr thread)))
4504 ;; We now have all (unique) roots.
4505 (if (= (length roots) 1)
4506 ;; All the loose roots are now one solid root.
4507 (setq thread (car roots))
4508 (setq thread (cons subject (gnus-sort-threads roots))))))
4510 ;; We then insert this thread into the summary buffer.
4512 (goto-char (point-min))
4513 (forward-line (1- line)))
4514 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4515 (if gnus-show-threads
4516 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4517 (gnus-summary-prepare-unthreaded thread))
4518 (setq data (nreverse gnus-newsgroup-data))
4519 (setq threads gnus-newsgroup-threads))
4520 ;; We splice the new data into the data structure.
4521 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4522 ;;!!! then we want to insert at the beginning of the buffer.
4523 ;;!!! That happens to be true with Gnus now, but that may
4524 ;;!!! change in the future. Perhaps.
4525 (gnus-data-enter-list
4526 (if line nil current) data (- (point) old-pos))
4527 (setq gnus-newsgroup-threads
4528 (nconc threads gnus-newsgroup-threads))
4529 (gnus-data-compute-positions))))
4531 (defun gnus-number-to-header (number)
4532 "Return the header for article NUMBER."
4533 (let ((headers gnus-newsgroup-headers))
4535 (not (= number (mail-header-number (car headers)))))
4540 (defun gnus-parent-headers (in-headers &optional generation)
4541 "Return the headers of the GENERATIONeth parent of HEADERS."
4543 (setq generation 1))
4545 (headers in-headers)
4548 (not (zerop generation))
4549 (setq references (mail-header-references headers)))
4550 (setq headers (if (and references
4551 (setq parent (gnus-parent-id references)))
4552 (car (gnus-id-to-thread parent))
4555 (and (not (eq headers in-headers))
4558 (defun gnus-id-to-thread (id)
4559 "Return the (sub-)thread where ID appears."
4560 (gnus-gethash id gnus-newsgroup-dependencies))
4562 (defun gnus-id-to-article (id)
4563 "Return the article number of ID."
4564 (let ((thread (gnus-id-to-thread id)))
4567 (mail-header-number (car thread)))))
4569 (defun gnus-id-to-header (id)
4570 "Return the article headers of ID."
4571 (car (gnus-id-to-thread id)))
4573 (defun gnus-article-displayed-root-p (article)
4574 "Say whether ARTICLE is a root(ish) article."
4575 (let ((level (gnus-summary-thread-level article))
4576 (refs (mail-header-references (gnus-summary-article-header article)))
4582 ((null (gnus-parent-id refs)) t)
4584 (null (setq particle (gnus-id-to-article
4585 (gnus-parent-id refs))))
4586 (null (gnus-summary-thread-level particle)))))))
4588 (defun gnus-root-id (id)
4589 "Return the id of the root of the thread where ID appears."
4591 (while (and id (setq prev (car (gnus-id-to-thread id))))
4593 id (gnus-parent-id (mail-header-references prev))))
4596 (defun gnus-articles-in-thread (thread)
4597 "Return the list of articles in THREAD."
4598 (cons (mail-header-number (car thread))
4599 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4601 (defun gnus-remove-thread (id &optional dont-remove)
4602 "Remove the thread that has ID in it."
4603 (let (headers thread last-id)
4604 ;; First go up in this thread until we find the root.
4605 (setq last-id (gnus-root-id id)
4606 headers (message-flatten-list (gnus-id-to-thread last-id)))
4607 ;; We have now found the real root of this thread. It might have
4608 ;; been gathered into some loose thread, so we have to search
4609 ;; through the threads to find the thread we wanted.
4610 (let ((threads gnus-newsgroup-threads)
4613 (setq sub (car threads))
4614 (if (stringp (car sub))
4615 ;; This is a gathered thread, so we look at the roots
4616 ;; below it to find whether this article is in this
4619 (setq sub (cdr sub))
4621 (when (member (caar sub) headers)
4622 (setq thread (car threads)
4625 (setq sub (cdr sub))))
4626 ;; It's an ordinary thread, so we check it.
4627 (when (eq (car sub) (car headers))
4630 (setq threads (cdr threads)))
4631 ;; If this article is in no thread, then it's a root.
4634 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4635 (setq thread (gnus-id-to-thread last-id)))
4638 thread ; We return this thread.
4640 (if (stringp (car thread))
4642 ;; If we use dummy roots, then we have to remove the
4643 ;; dummy root as well.
4644 (when (eq gnus-summary-make-false-root 'dummy)
4645 ;; We go to the dummy root by going to
4646 ;; the first sub-"thread", and then one line up.
4647 (gnus-summary-goto-article
4648 (mail-header-number (caadr thread)))
4651 (gnus-data-compute-positions))
4652 (setq thread (cdr thread))
4654 (gnus-remove-thread-1 (car thread))
4655 (setq thread (cdr thread))))
4656 (gnus-remove-thread-1 thread))))))))
4658 (defun gnus-remove-thread-1 (thread)
4659 "Remove the thread THREAD recursively."
4660 (let ((number (mail-header-number (pop thread)))
4662 (setq thread (reverse thread))
4664 (gnus-remove-thread-1 (pop thread)))
4665 (when (setq d (gnus-data-find number))
4666 (goto-char (gnus-data-pos d))
4667 (gnus-summary-show-thread)
4673 (gnus-delete-line)))))))
4675 (defun gnus-sort-threads-recursive (threads func)
4676 (sort (mapcar (lambda (thread)
4679 (gnus-sort-threads-recursive (cdr thread) func))))
4682 (defun gnus-sort-threads-loop (threads func)
4683 (let* ((superthread (cons nil threads))
4684 (stack (list (cons superthread threads)))
4685 remaining-threads thread)
4687 (setq remaining-threads (cdr (car stack)))
4688 (if remaining-threads
4689 (progn (setq thread (car remaining-threads))
4690 (setcdr (car stack) (cdr remaining-threads))
4692 (push (cons thread (cdr thread)) stack)))
4693 (setq thread (caar stack))
4694 (setcdr thread (sort (cdr thread) func))
4698 (defun gnus-sort-threads (threads)
4700 (if (not gnus-thread-sort-functions)
4702 (gnus-message 8 "Sorting threads...")
4705 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4706 (gnus-sort-threads-recursive
4707 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4708 ;; Even after binding max-lisp-eval-depth, the recursive
4709 ;; sorter might fail for very long threads. In that case,
4710 ;; try using a (less well-tested) non-recursive sorter.
4711 (error (gnus-sort-threads-loop
4712 threads (gnus-make-sort-function
4713 gnus-thread-sort-functions))))
4714 (gnus-message 8 "Sorting threads...done"))))
4716 (defun gnus-sort-articles (articles)
4718 (when gnus-article-sort-functions
4719 (gnus-message 7 "Sorting articles...")
4721 (setq gnus-newsgroup-headers
4722 (sort articles (gnus-make-sort-function
4723 gnus-article-sort-functions)))
4724 (gnus-message 7 "Sorting articles...done"))))
4726 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4727 (defmacro gnus-thread-header (thread)
4728 "Return header of first article in THREAD.
4729 Note that THREAD must never, ever be anything else than a variable -
4730 using some other form will lead to serious barfage."
4731 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4732 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4733 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4736 (defsubst gnus-article-sort-by-number (h1 h2)
4737 "Sort articles by article number."
4738 (< (mail-header-number h1)
4739 (mail-header-number h2)))
4741 (defun gnus-thread-sort-by-number (h1 h2)
4742 "Sort threads by root article number."
4743 (gnus-article-sort-by-number
4744 (gnus-thread-header h1) (gnus-thread-header h2)))
4746 (defsubst gnus-article-sort-by-random (h1 h2)
4747 "Sort articles by article number."
4750 (defun gnus-thread-sort-by-random (h1 h2)
4751 "Sort threads by root article number."
4752 (gnus-article-sort-by-random
4753 (gnus-thread-header h1) (gnus-thread-header h2)))
4755 (defsubst gnus-article-sort-by-lines (h1 h2)
4756 "Sort articles by article Lines header."
4757 (< (mail-header-lines h1)
4758 (mail-header-lines h2)))
4760 (defun gnus-thread-sort-by-lines (h1 h2)
4761 "Sort threads by root article Lines header."
4762 (gnus-article-sort-by-lines
4763 (gnus-thread-header h1) (gnus-thread-header h2)))
4765 (defsubst gnus-article-sort-by-chars (h1 h2)
4766 "Sort articles by octet length."
4767 (< (mail-header-chars h1)
4768 (mail-header-chars h2)))
4770 (defun gnus-thread-sort-by-chars (h1 h2)
4771 "Sort threads by root article octet length."
4772 (gnus-article-sort-by-chars
4773 (gnus-thread-header h1) (gnus-thread-header h2)))
4775 (defsubst gnus-article-sort-by-author (h1 h2)
4776 "Sort articles by root author."
4778 (let ((extract (funcall
4779 gnus-extract-address-components
4780 (mail-header-from h1))))
4781 (or (car extract) (cadr extract) ""))
4782 (let ((extract (funcall
4783 gnus-extract-address-components
4784 (mail-header-from h2))))
4785 (or (car extract) (cadr extract) ""))))
4787 (defun gnus-thread-sort-by-author (h1 h2)
4788 "Sort threads by root author."
4789 (gnus-article-sort-by-author
4790 (gnus-thread-header h1) (gnus-thread-header h2)))
4792 (defsubst gnus-article-sort-by-recipient (h1 h2)
4793 "Sort articles by recipient."
4795 (let ((extract (funcall
4796 gnus-extract-address-components
4797 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4798 (or (car extract) (cadr extract)))
4799 (let ((extract (funcall
4800 gnus-extract-address-components
4801 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4802 (or (car extract) (cadr extract)))))
4804 (defun gnus-thread-sort-by-recipient (h1 h2)
4805 "Sort threads by root recipient."
4806 (gnus-article-sort-by-recipient
4807 (gnus-thread-header h1) (gnus-thread-header h2)))
4809 (defsubst gnus-article-sort-by-subject (h1 h2)
4810 "Sort articles by root subject."
4812 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4813 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4815 (defun gnus-thread-sort-by-subject (h1 h2)
4816 "Sort threads by root subject."
4817 (gnus-article-sort-by-subject
4818 (gnus-thread-header h1) (gnus-thread-header h2)))
4820 (defsubst gnus-article-sort-by-date (h1 h2)
4821 "Sort articles by root article date."
4823 (gnus-date-get-time (mail-header-date h1))
4824 (gnus-date-get-time (mail-header-date h2))))
4826 (defun gnus-thread-sort-by-date (h1 h2)
4827 "Sort threads by root article date."
4828 (gnus-article-sort-by-date
4829 (gnus-thread-header h1) (gnus-thread-header h2)))
4831 (defsubst gnus-article-sort-by-score (h1 h2)
4832 "Sort articles by root article score.
4833 Unscored articles will be counted as having a score of zero."
4834 (> (or (cdr (assq (mail-header-number h1)
4835 gnus-newsgroup-scored))
4836 gnus-summary-default-score 0)
4837 (or (cdr (assq (mail-header-number h2)
4838 gnus-newsgroup-scored))
4839 gnus-summary-default-score 0)))
4841 (defun gnus-thread-sort-by-score (h1 h2)
4842 "Sort threads by root article score."
4843 (gnus-article-sort-by-score
4844 (gnus-thread-header h1) (gnus-thread-header h2)))
4846 (defun gnus-thread-sort-by-total-score (h1 h2)
4847 "Sort threads by the sum of all scores in the thread.
4848 Unscored articles will be counted as having a score of zero."
4849 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4851 (defun gnus-thread-total-score (thread)
4852 ;; This function find the total score of THREAD.
4857 (if (stringp (car thread))
4858 (apply gnus-thread-score-function 0
4859 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4860 (gnus-thread-total-score-1 thread)))
4862 (gnus-thread-total-score-1 (list thread)))))
4864 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4865 "Sort threads such that the thread with the most recently arrived article comes first."
4866 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4868 (defun gnus-thread-highest-number (thread)
4869 "Return the highest article number in THREAD."
4870 (apply 'max (mapcar (lambda (header)
4871 (mail-header-number header))
4872 (message-flatten-list thread))))
4874 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4875 "Sort threads such that the thread with the most recently dated article comes first."
4876 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4878 (defun gnus-thread-latest-date (thread)
4879 "Return the highest article date in THREAD."
4880 (let ((previous-time 0))
4886 (time-to-seconds (mail-header-parse-date
4887 (mail-header-date header)))
4888 (error previous-time))))
4890 (message-flatten-list thread)
4892 (< (mail-header-number h1)
4893 (mail-header-number h2))))))))
4895 (defun gnus-thread-total-score-1 (root)
4896 ;; This function find the total score of the thread below ROOT.
4897 (setq root (car root))
4898 (apply gnus-thread-score-function
4900 (mapcar 'gnus-thread-total-score
4901 (cdr (gnus-id-to-thread (mail-header-id root))))
4902 (when (> (mail-header-number root) 0)
4903 (list (or (cdr (assq (mail-header-number root)
4904 gnus-newsgroup-scored))
4905 gnus-summary-default-score 0))))
4906 (list gnus-summary-default-score)
4909 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4910 (defvar gnus-tmp-prev-subject nil)
4911 (defvar gnus-tmp-false-parent nil)
4912 (defvar gnus-tmp-root-expunged nil)
4913 (defvar gnus-tmp-dummy-line nil)
4915 (eval-when-compile (defvar gnus-tmp-header))
4916 (defun gnus-extra-header (type &optional header)
4917 "Return the extra header of TYPE."
4918 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4921 (defvar gnus-tmp-thread-tree-header-string "")
4923 (defcustom gnus-sum-thread-tree-root "> "
4924 "With %B spec, used for the root of a thread.
4925 If nil, use subject instead."
4927 :type '(radio (const :format "%v " nil) string)
4928 :group 'gnus-thread)
4930 (defcustom gnus-sum-thread-tree-false-root "> "
4931 "With %B spec, used for a false root of a thread.
4932 If nil, use subject instead."
4934 :type '(radio (const :format "%v " nil) string)
4935 :group 'gnus-thread)
4937 (defcustom gnus-sum-thread-tree-single-indent ""
4938 "With %B spec, used for a thread with just one message.
4939 If nil, use subject instead."
4941 :type '(radio (const :format "%v " nil) string)
4942 :group 'gnus-thread)
4944 (defcustom gnus-sum-thread-tree-vertical "| "
4945 "With %B spec, used for drawing a vertical line."
4948 :group 'gnus-thread)
4950 (defcustom gnus-sum-thread-tree-indent " "
4951 "With %B spec, used for indenting."
4954 :group 'gnus-thread)
4956 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4957 "With %B spec, used for a leaf with brothers."
4960 :group 'gnus-thread)
4962 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4963 "With %B spec, used for a leaf without brothers."
4966 :group 'gnus-thread)
4968 (defun gnus-summary-prepare-threads (threads)
4969 "Prepare summary buffer from THREADS and indentation LEVEL.
4970 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4971 or a straight list of headers."
4972 (gnus-message 7 "Generating summary...")
4974 (setq gnus-newsgroup-threads threads)
4977 (let ((gnus-tmp-level 0)
4978 (default-score (or gnus-summary-default-score 0))
4979 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4980 (building-line-count gnus-summary-display-while-building)
4981 (building-count (integerp gnus-summary-display-while-building))
4982 thread number subject stack state gnus-tmp-gathered beg-match
4983 new-roots gnus-tmp-new-adopts thread-end simp-subject
4984 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4985 gnus-tmp-replied gnus-tmp-subject-or-nil
4986 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4987 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4988 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4991 (setq gnus-tmp-prev-subject nil
4992 gnus-tmp-thread-tree-header-string "")
4994 (if (vectorp (car threads))
4995 ;; If this is a straight (sic) list of headers, then a
4996 ;; threaded summary display isn't required, so we just create
4997 ;; an unthreaded one.
4998 (gnus-summary-prepare-unthreaded threads)
5000 ;; Do the threaded display.
5002 (if gnus-summary-display-while-building
5003 (switch-to-buffer (buffer-name)))
5004 (while (or threads stack gnus-tmp-new-adopts new-roots)
5006 (if (and (= gnus-tmp-level 0)
5009 (not gnus-tmp-false-parent)
5010 (or gnus-tmp-new-adopts new-roots))
5011 (if gnus-tmp-new-adopts
5012 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5013 thread (list (car gnus-tmp-new-adopts))
5014 gnus-tmp-header (caar thread)
5015 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5017 (setq thread (list (car new-roots))
5018 gnus-tmp-header (caar thread)
5019 new-roots (cdr new-roots))))
5022 ;; If there are some threads, we do them before the
5023 ;; threads on the stack.
5024 (setq thread threads
5025 gnus-tmp-header (caar thread))
5026 ;; There were no current threads, so we pop something off
5028 (setq state (car stack)
5029 gnus-tmp-level (car state)
5030 tree-stack (cadr state)
5031 thread (caddr state)
5033 gnus-tmp-header (caar thread))))
5035 (setq gnus-tmp-false-parent nil)
5036 (setq gnus-tmp-root-expunged nil)
5037 (setq thread-end nil)
5039 (if (stringp gnus-tmp-header)
5040 ;; The header is a dummy root.
5042 ((eq gnus-summary-make-false-root 'adopt)
5043 ;; We let the first article adopt the rest.
5044 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5046 (setq gnus-tmp-gathered
5048 (lambda (h) (mail-header-number (car h)))
5051 (setq thread (cons (list (caar thread)
5054 (setq gnus-tmp-level -1
5055 gnus-tmp-false-parent t))
5056 ((eq gnus-summary-make-false-root 'empty)
5057 ;; We print adopted articles with empty subject fields.
5058 (setq gnus-tmp-gathered
5060 (lambda (h) (mail-header-number (car h)))
5063 (setq gnus-tmp-level -1))
5064 ((eq gnus-summary-make-false-root 'dummy)
5065 ;; We remember that we probably want to output a dummy
5067 (setq gnus-tmp-dummy-line gnus-tmp-header)
5068 (setq gnus-tmp-prev-subject gnus-tmp-header))
5070 ;; We do not make a root for the gathered
5071 ;; sub-threads at all.
5072 (setq gnus-tmp-level -1)))
5074 (setq number (mail-header-number gnus-tmp-header)
5075 subject (mail-header-subject gnus-tmp-header)
5076 simp-subject (gnus-simplify-subject-fully subject))
5079 ;; If the thread has changed subject, we might want to make
5080 ;; this subthread into a root.
5081 ((and (null gnus-thread-ignore-subject)
5082 (not (zerop gnus-tmp-level))
5083 gnus-tmp-prev-subject
5084 (not (string= gnus-tmp-prev-subject simp-subject)))
5085 (setq new-roots (nconc new-roots (list (car thread)))
5087 gnus-tmp-header nil))
5088 ;; If the article lies outside the current limit,
5089 ;; then we do not display it.
5090 ((not (memq number gnus-newsgroup-limit))
5091 (setq gnus-tmp-gathered
5093 (lambda (h) (mail-header-number (car h)))
5096 (setq gnus-tmp-new-adopts (if (cdar thread)
5097 (append gnus-tmp-new-adopts
5099 gnus-tmp-new-adopts)
5101 gnus-tmp-header nil)
5102 (when (zerop gnus-tmp-level)
5103 (setq gnus-tmp-root-expunged t)))
5104 ;; Perhaps this article is to be marked as read?
5105 ((and gnus-summary-mark-below
5106 (< (or (cdr (assq number gnus-newsgroup-scored))
5108 gnus-summary-mark-below)
5109 ;; Don't touch sparse articles.
5110 (not (gnus-summary-article-sparse-p number))
5111 (not (gnus-summary-article-ancient-p number)))
5112 (setq gnus-newsgroup-unreads
5113 (delq number gnus-newsgroup-unreads))
5114 (if gnus-newsgroup-auto-expire
5115 (setq gnus-newsgroup-expirable
5116 (gnus-add-to-sorted-list
5117 gnus-newsgroup-expirable number))
5118 (push (cons number gnus-low-score-mark)
5119 gnus-newsgroup-reads))))
5121 (when gnus-tmp-header
5122 ;; We may have an old dummy line to output before this
5124 (when (and gnus-tmp-dummy-line
5127 (mail-header-subject gnus-tmp-header)))
5128 (gnus-summary-insert-dummy-line
5129 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5130 (setq gnus-tmp-dummy-line nil))
5132 ;; Compute the mark.
5133 (setq gnus-tmp-unread (gnus-article-mark number))
5135 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5136 gnus-tmp-header gnus-tmp-level)
5137 gnus-newsgroup-data)
5139 ;; Actually insert the line.
5141 gnus-tmp-subject-or-nil
5143 ((and gnus-thread-ignore-subject
5144 gnus-tmp-prev-subject
5145 (not (string= gnus-tmp-prev-subject simp-subject)))
5147 ((zerop gnus-tmp-level)
5148 (if (and (eq gnus-summary-make-false-root 'empty)
5149 (memq number gnus-tmp-gathered)
5150 gnus-tmp-prev-subject
5151 (string= gnus-tmp-prev-subject simp-subject))
5152 gnus-summary-same-subject
5154 (t gnus-summary-same-subject)))
5155 (if (and (eq gnus-summary-make-false-root 'adopt)
5156 (= gnus-tmp-level 1)
5157 (memq number gnus-tmp-gathered))
5158 (setq gnus-tmp-opening-bracket ?\<
5159 gnus-tmp-closing-bracket ?\>)
5160 (setq gnus-tmp-opening-bracket ?\[
5161 gnus-tmp-closing-bracket ?\]))
5162 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5163 (gnus-make-thread-indent-array
5164 (max (* 2 (length gnus-thread-indent-array))
5167 gnus-tmp-indentation
5168 (aref gnus-thread-indent-array gnus-tmp-level)
5169 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5170 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5171 gnus-summary-default-score 0)
5173 (if (or (null gnus-summary-default-score)
5174 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5175 gnus-summary-zcore-fuzz))
5177 (if (< gnus-tmp-score gnus-summary-default-score)
5178 gnus-score-below-mark gnus-score-over-mark))
5180 (cond ((memq number gnus-newsgroup-processable)
5182 ((memq number gnus-newsgroup-cached)
5184 ((memq number gnus-newsgroup-replied)
5186 ((memq number gnus-newsgroup-forwarded)
5187 gnus-forwarded-mark)
5188 ((memq number gnus-newsgroup-saved)
5190 ((memq number gnus-newsgroup-recent)
5192 ((memq number gnus-newsgroup-unseen)
5196 (cond ((memq number gnus-newsgroup-undownloaded)
5197 gnus-undownloaded-mark)
5198 (gnus-newsgroup-agentized
5199 gnus-downloaded-mark)
5202 gnus-tmp-from (mail-header-from gnus-tmp-header)
5205 ((string-match "<[^>]+> *$" gnus-tmp-from)
5206 (setq beg-match (match-beginning 0))
5207 (or (and (string-match "^\".+\"" gnus-tmp-from)
5208 (substring gnus-tmp-from 1 (1- (match-end 0))))
5209 (substring gnus-tmp-from 0 beg-match)))
5210 ((string-match "(.+)" gnus-tmp-from)
5211 (substring gnus-tmp-from
5212 (1+ (match-beginning 0)) (1- (match-end 0))))
5216 gnus-tmp-thread-tree-header-string
5218 ((not gnus-show-threads) "")
5219 ((zerop gnus-tmp-level)
5220 (cond ((cdar thread)
5221 (or gnus-sum-thread-tree-root subject))
5222 (gnus-tmp-new-adopts
5223 (or gnus-sum-thread-tree-false-root subject))
5225 (or gnus-sum-thread-tree-single-indent subject))))
5227 (concat (apply 'concat
5228 (mapcar (lambda (item)
5230 gnus-sum-thread-tree-vertical
5231 gnus-sum-thread-tree-indent))
5232 (cdr (reverse tree-stack))))
5234 gnus-sum-thread-tree-leaf-with-other
5235 gnus-sum-thread-tree-single-leaf)))))
5236 (when (string= gnus-tmp-name "")
5237 (setq gnus-tmp-name gnus-tmp-from))
5238 (unless (numberp gnus-tmp-lines)
5239 (setq gnus-tmp-lines -1))
5240 (if (= gnus-tmp-lines -1)
5241 (setq gnus-tmp-lines "?")
5242 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5243 (gnus-put-text-property
5245 (progn (eval gnus-summary-line-format-spec) (point))
5246 'gnus-number number)
5249 (gnus-run-hooks 'gnus-summary-update-hook)
5252 (setq gnus-tmp-prev-subject simp-subject)))
5254 (when (nth 1 thread)
5255 (push (list (max 0 gnus-tmp-level)
5256 (copy-sequence tree-stack)
5259 (push (if (nth 1 thread) 1 0) tree-stack)
5260 (incf gnus-tmp-level)
5261 (setq threads (if thread-end nil (cdar thread)))
5262 (if gnus-summary-display-while-building
5265 ;; use a set frequency
5266 (setq building-line-count (1- building-line-count))
5267 (when (= building-line-count 0)
5269 (setq building-line-count
5270 gnus-summary-display-while-building)))
5274 (setq gnus-tmp-level 0)))))
5275 (gnus-message 7 "Generating summary...done"))
5277 (defun gnus-summary-prepare-unthreaded (headers)
5278 "Generate an unthreaded summary buffer based on HEADERS."
5279 (let (header number mark)
5284 ;; We may have to root out some bad articles...
5285 (when (memq (setq number (mail-header-number
5286 (setq header (pop headers))))
5287 gnus-newsgroup-limit)
5288 ;; Mark article as read when it has a low score.
5289 (when (and gnus-summary-mark-below
5290 (< (or (cdr (assq number gnus-newsgroup-scored))
5291 gnus-summary-default-score 0)
5292 gnus-summary-mark-below)
5293 (not (gnus-summary-article-ancient-p number)))
5294 (setq gnus-newsgroup-unreads
5295 (delq number gnus-newsgroup-unreads))
5296 (if gnus-newsgroup-auto-expire
5297 (push number gnus-newsgroup-expirable)
5298 (push (cons number gnus-low-score-mark)
5299 gnus-newsgroup-reads)))
5301 (setq mark (gnus-article-mark number))
5302 (push (gnus-data-make number mark (1+ (point)) header 0)
5303 gnus-newsgroup-data)
5304 (gnus-summary-insert-line
5306 (memq number gnus-newsgroup-undownloaded)
5307 mark (memq number gnus-newsgroup-replied)
5308 (memq number gnus-newsgroup-expirable)
5309 (mail-header-subject header) nil
5310 (cdr (assq number gnus-newsgroup-scored))
5311 (memq number gnus-newsgroup-processable))))))
5313 (defun gnus-summary-remove-list-identifiers ()
5314 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5315 (let ((regexp (if (consp gnus-list-identifiers)
5316 (mapconcat 'identity gnus-list-identifiers " *\\|")
5317 gnus-list-identifiers))
5320 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5321 (dolist (header gnus-newsgroup-headers)
5322 (setq subject (mail-header-subject header)
5324 (while (string-match regexp subject)
5326 (concat (substring subject 0 (match-beginning 1))
5327 (substring subject (match-end 0)))
5330 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5332 (concat (substring subject 0 (match-beginning 1))
5333 (substring subject (match-end 1)))))
5334 (mail-header-set-subject header subject))))))
5336 (defun gnus-fetch-headers (articles)
5337 "Fetch headers of ARTICLES."
5338 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5339 (gnus-message 5 "Fetching headers for %s..." name)
5342 (setq gnus-headers-retrieved-by
5343 (gnus-retrieve-headers
5344 articles gnus-newsgroup-name
5345 ;; We might want to fetch old headers, but
5346 ;; not if there is only 1 article.
5348 (not (eq gnus-fetch-old-headers 'some))
5349 (not (numberp gnus-fetch-old-headers)))
5350 (> (length articles) 1))
5351 gnus-fetch-old-headers))))
5352 (gnus-get-newsgroup-headers-xover
5353 articles nil nil gnus-newsgroup-name t)
5354 (gnus-get-newsgroup-headers))
5355 (gnus-message 5 "Fetching headers for %s...done" name))))
5357 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5358 "Select newsgroup GROUP.
5359 If READ-ALL is non-nil, all articles in the group are selected.
5360 If SELECT-ARTICLES, only select those articles from GROUP."
5361 (let* ((entry (gnus-group-entry group))
5362 ;;!!! Dirty hack; should be removed.
5363 (gnus-summary-ignore-duplicates
5364 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5366 gnus-summary-ignore-duplicates))
5367 (info (nth 2 entry))
5368 articles fetched-articles cached)
5370 (unless (gnus-check-server
5371 (set (make-local-variable 'gnus-current-select-method)
5372 (gnus-find-method-for-group group)))
5373 (error "Couldn't open server"))
5375 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5376 (gnus-activate-group group) ; Or we can activate it...
5377 (progn ; Or we bug out.
5378 (when (equal major-mode 'gnus-summary-mode)
5379 (gnus-kill-buffer (current-buffer)))
5380 (error "Couldn't activate group %s: %s"
5381 (gnus-group-decoded-name group) (gnus-status-message group))))
5383 (unless (gnus-request-group group t)
5384 (when (equal major-mode 'gnus-summary-mode)
5385 (gnus-kill-buffer (current-buffer)))
5386 (error "Couldn't request group %s: %s"
5387 (gnus-group-decoded-name group) (gnus-status-message group)))
5390 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5392 (setq gnus-summary-use-undownloaded-faces
5393 (gnus-agent-find-parameter
5395 'agent-enable-undownloaded-faces)))
5397 (setq gnus-newsgroup-name group
5398 gnus-newsgroup-unselected nil
5399 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5401 (let ((display (gnus-group-find-parameter group 'display)))
5402 (setq gnus-newsgroup-display
5404 ((not (zerop (or (car-safe read-all) 0)))
5405 ;; The user entered the group with C-u SPC/RET, let's show
5411 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5413 ;; The following is probably the "correct" solution, but
5414 ;; it makes Gnus fetch all headers and then limit the
5415 ;; articles (which is slow), so instead we hack the
5416 ;; select-articles parameter instead. -- Simon Josefsson
5419 ;; (gnus-byte-compile
5420 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5422 (setq select-articles
5423 (gnus-uncompress-range
5424 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5428 (cdr (gnus-active group)))))
5433 (gnus-summary-setup-default-charset)
5435 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5436 (when (gnus-virtual-group-p group)
5437 (setq cached gnus-newsgroup-cached))
5439 (setq gnus-newsgroup-unreads
5440 (gnus-sorted-ndifference
5441 (gnus-sorted-ndifference gnus-newsgroup-unreads
5442 gnus-newsgroup-marked)
5443 gnus-newsgroup-dormant))
5445 (setq gnus-newsgroup-processable nil)
5447 (gnus-update-read-articles group gnus-newsgroup-unreads)
5449 ;; Adjust and set lists of article marks.
5451 (gnus-adjust-marked-articles info))
5452 (if (setq articles select-articles)
5453 (setq gnus-newsgroup-unselected
5454 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5455 (setq articles (gnus-articles-to-read group read-all)))
5459 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5461 ((eq articles 0) nil)
5463 ;; Init the dependencies hash table.
5464 (setq gnus-newsgroup-dependencies
5465 (gnus-make-hashtable (length articles)))
5466 (gnus-set-global-variables)
5467 ;; Retrieve the headers and read them in.
5469 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5471 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5473 (setq gnus-newsgroup-cached cached))
5475 ;; Suppress duplicates?
5476 (when gnus-suppress-duplicates
5477 (gnus-dup-suppress-articles))
5479 ;; Set the initial limit.
5480 (setq gnus-newsgroup-limit (copy-sequence articles))
5481 ;; Remove canceled articles from the list of unread articles.
5482 (setq fetched-articles
5483 (mapcar (lambda (headers) (mail-header-number headers))
5484 gnus-newsgroup-headers))
5485 (setq gnus-newsgroup-articles fetched-articles)
5486 (setq gnus-newsgroup-unreads
5487 (gnus-sorted-nintersection
5488 gnus-newsgroup-unreads fetched-articles))
5489 (gnus-compute-unseen-list)
5491 ;; Removed marked articles that do not exist.
5492 (gnus-update-missing-marks
5493 (gnus-sorted-difference articles fetched-articles))
5494 ;; We might want to build some more threads first.
5495 (when (and gnus-fetch-old-headers
5496 (eq gnus-headers-retrieved-by 'nov))
5497 (if (eq gnus-fetch-old-headers 'invisible)
5498 (gnus-build-all-threads)
5499 (gnus-build-old-threads)))
5500 ;; Let the Gnus agent mark articles as read.
5502 (gnus-agent-get-undownloaded-list))
5503 ;; Remove list identifiers from subject
5504 (when gnus-list-identifiers
5505 (gnus-summary-remove-list-identifiers))
5506 ;; Check whether auto-expire is to be done in this group.
5507 (setq gnus-newsgroup-auto-expire
5508 (gnus-group-auto-expirable-p group))
5509 ;; Set up the article buffer now, if necessary.
5510 (unless (and gnus-single-article-buffer
5511 (equal gnus-article-buffer "*Article*"))
5512 (gnus-article-setup-buffer))
5513 ;; First and last article in this newsgroup.
5514 (when gnus-newsgroup-headers
5515 (setq gnus-newsgroup-begin
5516 (mail-header-number (car gnus-newsgroup-headers))
5519 (gnus-last-element gnus-newsgroup-headers))))
5520 ;; GROUP is successfully selected.
5521 (or gnus-newsgroup-headers t)))))
5523 (defun gnus-compute-unseen-list ()
5524 ;; The `seen' marks are treated specially.
5525 (if (not gnus-newsgroup-seen)
5526 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5527 (setq gnus-newsgroup-unseen
5528 (gnus-inverse-list-range-intersection
5529 gnus-newsgroup-articles gnus-newsgroup-seen))))
5531 (defun gnus-summary-display-make-predicate (display)
5532 (require 'gnus-agent)
5533 (when (= (length display) 1)
5534 (setq display (car display)))
5535 (unless gnus-summary-display-cache
5536 (dolist (elem (append '((unread . unread)
5539 gnus-article-mark-lists))
5540 (push (cons (cdr elem)
5542 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5543 gnus-summary-display-cache)))
5544 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5545 (gnus-category-predicate-cache gnus-summary-display-cache))
5546 (gnus-get-predicate display)))
5548 ;; Uses the dynamically bound `number' variable.
5551 (defun gnus-article-marked-p (type &optional article)
5552 (let ((article (or article number)))
5555 (memq article gnus-newsgroup-marked))
5557 (memq article gnus-newsgroup-spam-marked))
5559 (memq article gnus-newsgroup-unsendable))
5560 ((eq type 'undownload)
5561 (memq article gnus-newsgroup-undownloaded))
5562 ((eq type 'download)
5563 (memq article gnus-newsgroup-downloadable))
5565 (memq article gnus-newsgroup-unreads))
5567 (memq article gnus-newsgroup-reads))
5569 (memq article gnus-newsgroup-dormant) )
5571 (memq article gnus-newsgroup-expirable))
5573 (memq article gnus-newsgroup-replied))
5575 (memq article gnus-newsgroup-killed))
5576 ((eq type 'bookmark)
5577 (assq article gnus-newsgroup-bookmarks))
5579 (assq article gnus-newsgroup-scored))
5581 (memq article gnus-newsgroup-saved))
5583 (memq article gnus-newsgroup-cached))
5585 (memq article gnus-newsgroup-forwarded))
5587 (not (memq article gnus-newsgroup-unseen)))
5589 (memq article gnus-newsgroup-recent))
5592 (defun gnus-articles-to-read (group &optional read-all)
5593 "Find out what articles the user wants to read."
5595 ;; Select all articles if `read-all' is non-nil, or if there
5596 ;; are no unread articles.
5598 (and (zerop (length gnus-newsgroup-marked))
5599 (zerop (length gnus-newsgroup-unreads)))
5600 ;; Fetch all if the predicate is non-nil.
5601 gnus-newsgroup-display)
5602 ;; We want to select the headers for all the articles in
5603 ;; the group, so we select either all the active
5604 ;; articles in the group, or (if that's nil), the
5605 ;; articles in the cache.
5607 (gnus-uncompress-range (gnus-active group))
5608 (gnus-cache-articles-in-group group))
5609 ;; Select only the "normal" subset of articles.
5611 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5612 gnus-newsgroup-unreads)))
5613 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5614 (scored (length scored-list))
5615 (number (length articles))
5616 (marked (+ (length gnus-newsgroup-marked)
5617 (length gnus-newsgroup-dormant)))
5622 ((numberp gnus-newsgroup-display)
5623 gnus-newsgroup-display)
5627 ((and (or (<= scored marked) (= scored number))
5628 (numberp gnus-large-newsgroup)
5629 (> number gnus-large-newsgroup))
5630 (let* ((cursor-in-echo-area nil)
5631 (initial (gnus-parameter-large-newsgroup-initial
5632 gnus-newsgroup-name))
5636 "How many articles from %s (%s %d): "
5638 (gnus-group-decoded-name gnus-newsgroup-name)
5640 (if initial "max" "default")
5643 (cons (number-to-string initial)
5645 (if (string-match "^[ \t]*$" input) number input)))
5646 ((and (> scored marked) (< scored number)
5647 (> (- scored number) 20))
5650 (format "%s %s (%d scored, %d total): "
5651 "How many articles from"
5652 (gnus-group-decoded-name group)
5654 (if (string-match "^[ \t]*$" input)
5658 (message "Quit getting the articles to read")
5660 (setq select (if (stringp select) (string-to-number select) select))
5661 (if (or (null select) (zerop select))
5663 (if (and (not (zerop scored)) (<= (abs select) scored))
5665 (setq articles (sort scored-list '<))
5666 (setq number (length articles)))
5667 (setq articles (copy-sequence articles)))
5669 (when (< (abs select) number)
5671 ;; Select the N oldest articles.
5672 (setcdr (nthcdr (1- (abs select)) articles) nil)
5673 ;; Select the N most recent articles.
5674 (setq articles (nthcdr (- number select) articles))))
5675 (setq gnus-newsgroup-unselected
5676 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5677 (when gnus-alter-articles-to-read-function
5680 (funcall gnus-alter-articles-to-read-function
5681 gnus-newsgroup-name articles)
5685 (defun gnus-killed-articles (killed articles)
5688 (when (inline (gnus-member-of-range (car articles) killed))
5689 (push (car articles) out))
5690 (setq articles (cdr articles)))
5693 (defun gnus-uncompress-marks (marks)
5694 "Uncompress the mark ranges in MARKS."
5695 (let ((uncompressed '(score bookmark))
5698 (if (memq (caar marks) uncompressed)
5699 (push (car marks) out)
5700 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5701 (setq marks (cdr marks)))
5704 (defun gnus-article-mark-to-type (mark)
5705 "Return the type of MARK."
5706 (or (cadr (assq mark gnus-article-special-mark-lists))
5709 (defun gnus-article-unpropagatable-p (mark)
5710 "Return whether MARK should be propagated to back end."
5711 (memq mark gnus-article-unpropagated-mark-lists))
5713 (defun gnus-adjust-marked-articles (info)
5714 "Set all article lists and remove all marks that are no longer valid."
5715 (let* ((marked-lists (gnus-info-marks info))
5716 (active (gnus-active (gnus-info-group info)))
5719 (types gnus-article-mark-lists)
5720 marks var articles article mark mark-type
5723 (dolist (marks marked-lists)
5724 (setq mark (car marks)
5725 mark-type (gnus-article-mark-to-type mark)
5726 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5728 ;; We set the variable according to the type of the marks list,
5729 ;; and then adjust the marks to a subset of the active articles.
5731 ;; Adjust "simple" lists - compressed yet unsorted
5732 ((eq mark-type 'list)
5733 ;; Simultaneously uncompress and clip to active range
5734 ;; See gnus-uncompress-range for a description of possible marks
5736 (if (not (cadr marks))
5738 (setq articles (if (numberp (cddr marks))
5744 (while (setq article (pop articles))
5745 (cond ((consp article)
5746 (setq bgn (max (car article) min)
5747 end (min (cdr article) max))
5749 (setq l (setcdr l (cons bgn nil))
5751 ((and (<= min article)
5753 (setq l (setcdr l (cons article nil))))))
5754 (set var (cdr lh)))))
5756 ((eq mark-type 'tuple)
5757 (set var (setq articles (cdr marks)))
5758 (when (not (listp (cdr (symbol-value var))))
5759 (set var (list (symbol-value var))))
5760 (when (not (listp (cdr articles)))
5761 (setq articles (list articles)))
5763 (when (or (not (consp (setq article (pop articles))))
5764 (< (car article) min)
5765 (> (car article) max))
5766 (set var (delq article (symbol-value var))))))
5767 ;; Adjust ranges (sloppily).
5768 ((eq mark-type 'range)
5771 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5772 ;; It should be (seen (NUM1 . NUM2)).
5773 (when (numberp (cddr marks))
5774 (setcdr marks (list (cdr marks))))
5775 (setq articles (cdr marks))
5776 (while (and articles
5777 (or (and (consp (car articles))
5778 (> min (cdar articles)))
5779 (and (numberp (car articles))
5780 (> min (car articles)))))
5782 (set var articles))))))))
5784 (defun gnus-update-missing-marks (missing)
5785 "Go through the list of MISSING articles and remove them from the mark lists."
5788 ;; Go through all types.
5789 (dolist (elem gnus-article-mark-lists)
5790 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5791 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5792 (when (symbol-value var)
5793 ;; This list has articles. So we delete all missing
5794 ;; articles from it.
5797 (set var (delq (pop m) (symbol-value var))))))))))
5799 (defun gnus-update-marks ()
5800 "Enter the various lists of marked articles into the newsgroup info list."
5801 (let ((types gnus-article-mark-lists)
5802 (info (gnus-get-info gnus-newsgroup-name))
5803 type list newmarked symbol delta-marks)
5805 ;; Add all marks lists to the list of marks lists.
5806 (while (setq type (pop types))
5807 (setq list (symbol-value
5809 (intern (format "gnus-newsgroup-%s" (car type))))))
5812 ;; Get rid of the entries of the articles that have the
5814 (when (and (eq (cdr type) 'score)
5818 (prev (cons nil list))
5821 (if (or (not (consp (car arts)))
5822 (= (cdar arts) gnus-summary-default-score))
5823 (setcdr prev (cdr arts))
5825 (setq arts (cdr arts)))
5826 (setq list (cdr all)))))
5828 (when (eq (cdr type) 'seen)
5829 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5831 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5832 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5834 (when (and (gnus-check-backend-function
5835 'request-set-mark gnus-newsgroup-name)
5836 (not (gnus-article-unpropagatable-p (cdr type))))
5837 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5838 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5839 (add (gnus-remove-from-range
5840 (gnus-copy-sequence list) old)))
5842 (push (list add 'add (list (cdr type))) delta-marks))
5844 (push (list del 'del (list (cdr type))) delta-marks))))
5847 (push (cons (cdr type) list) newmarked)))
5850 (unless (gnus-check-group gnus-newsgroup-name)
5851 (error "Can't open server for %s" gnus-newsgroup-name))
5852 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5854 ;; Enter these new marks into the info of the group.
5856 (setcar (nthcdr 3 info) newmarked)
5857 ;; Add the marks lists to the end of the info.
5859 (setcdr (nthcdr 2 info) (list newmarked))))
5861 ;; Cut off the end of the info if there's nothing else there.
5865 (when (nthcdr (decf i) info)
5866 (setcdr (nthcdr i info) nil)))))))
5868 (defun gnus-set-mode-line (where)
5869 "Set the mode line of the article or summary buffers.
5870 If WHERE is `summary', the summary mode line format will be used."
5871 ;; Is this mode line one we keep updated?
5872 (when (and (memq where gnus-updated-mode-lines)
5874 (intern (format "gnus-%s-mode-line-format-spec" where))))
5877 ;; We evaluate this in the summary buffer since these
5878 ;; variables are buffer-local to that buffer.
5879 (set-buffer gnus-summary-buffer)
5880 ;; We bind all these variables that are used in the `eval' form
5882 (let* ((mformat (symbol-value
5884 (format "gnus-%s-mode-line-format-spec" where))))
5885 (gnus-tmp-group-name (gnus-mode-string-quote
5886 (gnus-group-decoded-name
5887 gnus-newsgroup-name)))
5888 (gnus-tmp-article-number (or gnus-current-article 0))
5889 (gnus-tmp-unread gnus-newsgroup-unreads)
5890 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5891 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5892 (gnus-tmp-unread-and-unselected
5893 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5894 (zerop gnus-tmp-unselected))
5896 ((zerop gnus-tmp-unselected)
5897 (format "{%d more}" gnus-tmp-unread-and-unticked))
5898 (t (format "{%d(+%d) more}"
5899 gnus-tmp-unread-and-unticked
5900 gnus-tmp-unselected))))
5902 (if (and gnus-current-headers
5903 (vectorp gnus-current-headers))
5904 (gnus-mode-string-quote
5905 (mail-header-subject gnus-current-headers))
5907 bufname-length max-len
5908 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5909 (setq mode-string (eval mformat))
5910 (setq bufname-length (if (string-match "%b" mode-string)
5913 (if (eq where 'summary)
5915 (get-buffer gnus-article-buffer))))
5918 (setq max-len (max 4 (if gnus-mode-non-string-length
5920 gnus-mode-non-string-length
5922 (length mode-string))))
5923 ;; We might have to chop a bit of the string off...
5924 (when (> (length mode-string) max-len)
5926 (concat (truncate-string-to-width mode-string (- max-len 3))
5928 ;; Pad the mode string a bit.
5929 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5930 ;; Update the mode line.
5931 (setq mode-line-buffer-identification
5932 (gnus-mode-line-buffer-identification (list mode-string)))
5933 (set-buffer-modified-p t))))
5935 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5936 "Go through the HEADERS list and add all Xrefs to a hash table.
5937 The resulting hash table is returned, or nil if no Xrefs were found."
5938 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5939 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5940 (xref-hashtb (gnus-make-hashtable))
5941 start group entry number xrefs header)
5943 (setq header (pop headers))
5944 (when (and (setq xrefs (mail-header-xref header))
5945 (not (memq (setq number (mail-header-number header))
5948 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5949 (setq start (match-end 0))
5950 (setq group (if prefix
5951 (concat prefix (substring xrefs (match-beginning 1)
5953 (substring xrefs (match-beginning 1) (match-end 1))))
5955 (string-to-number (substring xrefs (match-beginning 2)
5957 (if (setq entry (gnus-gethash group xref-hashtb))
5958 (setcdr entry (cons number (cdr entry)))
5959 (gnus-sethash group (cons number nil) xref-hashtb)))))
5960 (and start xref-hashtb)))
5962 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5963 "Look through all the headers and mark the Xrefs as read."
5964 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5965 name info xref-hashtb idlist method nth4)
5967 (set-buffer gnus-group-buffer)
5968 (when (setq xref-hashtb
5969 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5972 (unless (string= from-newsgroup (setq name (symbol-name group)))
5973 (setq idlist (symbol-value group))
5974 ;; Dead groups are not updated.
5976 (setq info (gnus-get-info name))
5977 (when (stringp (setq nth4 (gnus-info-method info)))
5978 (setq nth4 (gnus-server-to-method nth4))))
5979 ;; Only do the xrefs if the group has the same
5980 ;; select method as the group we have just read.
5981 (or (gnus-methods-equal-p
5982 nth4 (gnus-find-method-for-group from-newsgroup))
5984 (equal nth4 (setq method (gnus-find-method-for-group
5986 (and (equal (car nth4) (car method))
5987 (equal (nth 1 nth4) (nth 1 method))))
5988 gnus-use-cross-reference
5989 (or (not (eq gnus-use-cross-reference t))
5991 ;; Only do cross-references on subscribed
5992 ;; groups, if that is what is wanted.
5993 (<= (gnus-info-level info) gnus-level-subscribed))
5994 (gnus-group-make-articles-read name idlist))))
5997 (defun gnus-compute-read-articles (group articles)
5998 (let* ((entry (gnus-group-entry group))
5999 (info (nth 2 entry))
6000 (active (gnus-active group))
6003 ;; First peel off all invalid article numbers.
6005 (let ((ids articles)
6007 (while (setq id (pop ids))
6008 (when (and first (> id (cdr active)))
6009 ;; We'll end up in this situation in one particular
6010 ;; obscure situation. If you re-scan a group and get
6011 ;; a new article that is cross-posted to a different
6012 ;; group that has not been re-scanned, you might get
6013 ;; crossposted article that has a higher number than
6014 ;; Gnus believes possible. So we re-activate this
6015 ;; group as well. This might mean doing the
6016 ;; crossposting thingy will *increase* the number
6017 ;; of articles in some groups. Tsk, tsk.
6018 (setq active (or (gnus-activate-group group) active)))
6019 (when (or (> id (cdr active))
6020 (< id (car active)))
6021 (setq articles (delq id articles))))))
6022 ;; If the read list is nil, we init it.
6024 (null (gnus-info-read info))
6026 (setq ninfo (cons 1 (1- (car active))))
6027 (setq ninfo (gnus-info-read info)))
6028 ;; Then we add the read articles to the range.
6030 ninfo (setq articles (sort articles '<))))))
6032 (defun gnus-group-make-articles-read (group articles)
6033 "Update the info of GROUP to say that ARTICLES are read."
6035 (entry (gnus-group-entry group))
6036 (info (nth 2 entry))
6037 (active (gnus-active group))
6040 (setq range (gnus-compute-read-articles group articles))
6041 (with-current-buffer gnus-group-buffer
6044 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6045 (gnus-info-set-read ',info ',(gnus-info-read info))
6046 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6047 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6048 (gnus-group-update-group ,group t))))
6049 ;; Add the read articles to the range.
6050 (gnus-info-set-read info range)
6051 (gnus-request-set-mark group (list (list range 'add '(read))))
6052 ;; Then we have to re-compute how many unread
6053 ;; articles there are in this group.
6057 (setq num (- (1+ (cdr active)) (car active))))
6058 ((not (listp (cdr range)))
6059 (setq num (- (cdr active) (- (1+ (cdr range))
6063 (if (numberp (car range))
6065 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6066 (setq range (cdr range)))
6067 (setq num (- (cdr active) num))))
6068 ;; Update the number of unread articles.
6070 ;; Update the group buffer.
6071 (unless (gnus-ephemeral-group-p group)
6072 (gnus-group-update-group group t))))))
6074 (defvar gnus-newsgroup-none-id 0)
6076 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6077 (let ((cur nntp-server-buffer)
6080 (with-current-buffer gnus-summary-buffer
6081 gnus-newsgroup-dependencies)))
6082 headers id end ref number
6083 (mail-parse-charset gnus-newsgroup-charset)
6084 (mail-parse-ignored-charsets
6085 (save-excursion (condition-case nil
6086 (set-buffer gnus-summary-buffer)
6088 gnus-newsgroup-ignored-charsets)))
6090 (set-buffer nntp-server-buffer)
6091 ;; Translate all TAB characters into SPACE characters.
6092 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6093 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6094 (ietf-drums-unfold-fws)
6095 (gnus-run-hooks 'gnus-parse-headers-hook)
6096 (let ((case-fold-search t)
6097 in-reply-to header p lines chars)
6098 (goto-char (point-min))
6099 ;; Search to the beginning of the next header. Error messages
6100 ;; do not begin with 2 or 3.
6101 (while (re-search-forward "^[23][0-9]+ " nil t)
6104 ;; This implementation of this function, with nine
6105 ;; search-forwards instead of the one re-search-forward and
6106 ;; a case (which basically was the old function) is actually
6107 ;; about twice as fast, even though it looks messier. You
6108 ;; can't have everything, I guess. Speed and elegance
6109 ;; doesn't always go hand in hand.
6115 (setq number (read cur))
6118 (narrow-to-region (point)
6119 (or (and (search-forward "\n.\n" nil t)
6125 (if (search-forward "\nsubject:" nil t)
6126 (funcall gnus-decode-encoded-word-function
6127 (nnheader-header-value))
6132 (if (search-forward "\nfrom:" nil t)
6133 (funcall gnus-decode-encoded-address-function
6134 (nnheader-header-value))
6139 (if (search-forward "\ndate:" nil t)
6140 (nnheader-header-value) ""))
6144 (setq id (if (re-search-forward
6145 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6146 ;; We do it this way to make sure the Message-ID
6147 ;; is (somewhat) syntactically valid.
6148 (buffer-substring (match-beginning 1)
6150 ;; If there was no message-id, we just fake one
6151 ;; to make subsequent routines simpler.
6152 (nnheader-generate-fake-message-id number))))
6156 (if (search-forward "\nreferences:" nil t)
6160 (nnheader-header-value)
6165 (search-backward ">" end t)
6168 (search-backward "<" end t)
6170 ;; Get the references from the in-reply-to header if there
6171 ;; were no references and the in-reply-to header looks
6173 (if (and (search-forward "\nin-reply-to:" nil t)
6174 (setq in-reply-to (nnheader-header-value))
6175 (string-match "<[^>]+>" in-reply-to))
6177 (setq ref (substring in-reply-to (match-beginning 0)
6179 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6180 (setq ref2 (substring in-reply-to (match-beginning 0)
6182 (when (> (length ref2) (length ref))
6189 (if (search-forward "\nchars: " nil t)
6190 (if (numberp (setq chars (ignore-errors (read cur))))
6196 (if (search-forward "\nlines: " nil t)
6197 (if (numberp (setq lines (ignore-errors (read cur))))
6203 (and (search-forward "\nxref:" nil t)
6204 (nnheader-header-value)))
6206 (when gnus-extra-headers
6207 (let ((extra gnus-extra-headers)
6211 (when (search-forward
6212 (concat "\n" (symbol-name (car extra)) ":") nil t)
6213 (push (cons (car extra) (nnheader-header-value))
6217 (when (equal id ref)
6220 (when gnus-alter-header-function
6221 (funcall gnus-alter-header-function header)
6222 (setq id (mail-header-id header)
6223 ref (gnus-parent-id (mail-header-references header))))
6226 (gnus-dependencies-add-header
6227 header dependencies force-new))
6228 (push header headers))
6229 (goto-char (point-max))
6231 (nreverse headers)))))
6233 ;; Goes through the xover lines and returns a list of vectors
6234 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6235 force-new dependencies
6236 group also-fetch-heads)
6237 "Parse the news overview data in the server buffer.
6238 Return a list of headers that match SEQUENCE (see
6239 `nntp-retrieve-headers')."
6240 ;; Get the Xref when the users reads the articles since most/some
6241 ;; NNTP servers do not include Xrefs when using XOVER.
6242 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6243 (let ((mail-parse-charset gnus-newsgroup-charset)
6244 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6245 (cur nntp-server-buffer)
6246 (dependencies (or dependencies gnus-newsgroup-dependencies))
6248 ((eq gnus-read-all-available-headers t)
6250 ((and (stringp gnus-read-all-available-headers)
6252 (string-match gnus-read-all-available-headers group))
6255 number headers header)
6257 (set-buffer nntp-server-buffer)
6258 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6259 ;; Allow the user to mangle the headers before parsing them.
6260 (gnus-run-hooks 'gnus-parse-headers-hook)
6261 (goto-char (point-min))
6262 (gnus-parse-without-error
6263 (while (and (or sequence allp)
6265 (setq number (read cur))
6267 (while (and sequence
6268 (< (car sequence) number))
6269 (setq sequence (cdr sequence))))
6272 (eq number (car sequence))))
6274 (setq sequence (cdr sequence))
6275 (setq header (inline
6276 (gnus-nov-parse-line
6277 number dependencies force-new)))))
6278 (push header headers))
6280 ;; A common bug in inn is that if you have posted an article and
6281 ;; then retrieves the active file, it will answer correctly --
6282 ;; the new article is included. However, a NOV entry for the
6283 ;; article may not have been generated yet, so this may fail.
6284 ;; We work around this problem by retrieving the last few
6285 ;; headers using HEAD.
6286 (if (or (not also-fetch-heads)
6288 ;; We (probably) got all the headers.
6290 (let ((gnus-nov-is-evil t))
6293 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6294 (gnus-get-newsgroup-headers))))))))
6296 (defun gnus-article-get-xrefs ()
6297 "Fill in the Xref value in `gnus-current-headers', if necessary.
6298 This is meant to be called in `gnus-article-internal-prepare-hook'."
6299 (let ((headers (with-current-buffer gnus-summary-buffer
6300 gnus-current-headers)))
6301 (or (not gnus-use-cross-reference)
6303 (and (mail-header-xref headers)
6304 (not (string= (mail-header-xref headers) "")))
6305 (let ((case-fold-search t)
6308 (nnheader-narrow-to-headers)
6309 (goto-char (point-min))
6310 (when (or (and (not (eobp))
6311 (eq (downcase (char-after)) ?x)
6312 (looking-at "Xref:"))
6313 (search-forward "\nXref:" nil t))
6314 (goto-char (1+ (match-end 0)))
6315 (setq xref (buffer-substring (point) (point-at-eol)))
6316 (mail-header-set-xref headers xref)))))))
6318 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6319 "Find article ID and insert the summary line for that article.
6320 OLD-HEADER can either be a header or a line number to insert
6321 the subject line on."
6322 (let* ((line (and (numberp old-header) old-header))
6323 (old-header (and (vectorp old-header) old-header))
6324 (header (cond ((and old-header use-old-header)
6327 (gnus-number-to-header id))
6328 (gnus-number-to-header id))
6330 (gnus-read-header id))))
6331 (number (and (numberp id) id))
6334 ;; Rebuild the thread that this article is part of and go to the
6335 ;; article we have fetched.
6336 (when (and (not gnus-show-threads)
6339 (setq d (gnus-data-find (mail-header-number old-header))))
6340 (goto-char (gnus-data-pos d))
6346 (gnus-delete-line))))))
6347 ;; Remove list identifiers from subject.
6348 (when gnus-list-identifiers
6349 (let ((gnus-newsgroup-headers (list header)))
6350 (gnus-summary-remove-list-identifiers)))
6352 (mail-header-set-number header (mail-header-number old-header)))
6353 (setq gnus-newsgroup-sparse
6354 (delq (setq number (mail-header-number header))
6355 gnus-newsgroup-sparse))
6356 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6357 (push number gnus-newsgroup-limit)
6358 (gnus-rebuild-thread (mail-header-id header) line)
6359 (gnus-summary-goto-subject number nil t))
6360 (when (and (numberp number)
6362 ;; We have to update the boundaries even if we can't fetch the
6363 ;; article if ID is a number -- so that the next `P' or `N'
6364 ;; command will fetch the previous (or next) article even
6365 ;; if the one we tried to fetch this time has been canceled.
6366 (when (> number gnus-newsgroup-end)
6367 (setq gnus-newsgroup-end number))
6368 (when (< number gnus-newsgroup-begin)
6369 (setq gnus-newsgroup-begin number))
6370 (setq gnus-newsgroup-unselected
6371 (delq number gnus-newsgroup-unselected)))
6372 ;; Report back a success?
6373 (and header (mail-header-number header))))
6375 ;;; Process/prefix in the summary buffer
6377 (defun gnus-summary-work-articles (n)
6378 "Return a list of articles to be worked upon.
6379 The prefix argument, the list of process marked articles, and the
6380 current article will be taken into consideration."
6382 (set-buffer gnus-summary-buffer)
6385 ;; A numerical prefix has been given.
6386 (setq n (prefix-numeric-value n))
6387 (let ((backward (< n 0))
6388 (n (abs (prefix-numeric-value n)))
6393 (push (setq article (gnus-summary-article-number))
6396 (gnus-summary-find-prev nil article)
6397 (gnus-summary-find-next nil article)))
6399 (nreverse articles)))
6400 ((and (gnus-region-active-p) (mark))
6401 (message "region active")
6402 ;; Work on the region between point and mark.
6403 (let ((max (max (point) (mark)))
6406 (goto-char (min (point) (mark)))
6409 (push (setq article (gnus-summary-article-number)) articles)
6410 (gnus-summary-find-next nil article)
6412 (nreverse articles))))
6413 (gnus-newsgroup-processable
6414 ;; There are process-marked articles present.
6415 ;; Save current state.
6416 (gnus-summary-save-process-mark)
6418 (reverse gnus-newsgroup-processable))
6420 ;; Just return the current article.
6421 (list (gnus-summary-article-number))))))
6423 (defmacro gnus-summary-iterate (arg &rest forms)
6424 "Iterate over the process/prefixed articles and do FORMS.
6425 ARG is the interactive prefix given to the command. FORMS will be
6426 executed with point over the summary line of the articles."
6427 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6428 `(let ((,articles (gnus-summary-work-articles ,arg)))
6430 (gnus-summary-goto-subject (car ,articles))
6434 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6435 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6437 (defun gnus-summary-save-process-mark ()
6438 "Push the current set of process marked articles on the stack."
6440 (push (copy-sequence gnus-newsgroup-processable)
6441 gnus-newsgroup-process-stack))
6443 (defun gnus-summary-kill-process-mark ()
6444 "Push the current set of process marked articles on the stack and unmark."
6446 (gnus-summary-save-process-mark)
6447 (gnus-summary-unmark-all-processable))
6449 (defun gnus-summary-yank-process-mark ()
6450 "Pop the last process mark state off the stack and restore it."
6452 (unless gnus-newsgroup-process-stack
6453 (error "Empty mark stack"))
6454 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6456 (defun gnus-summary-process-mark-set (set)
6457 "Make SET into the current process marked articles."
6458 (gnus-summary-unmark-all-processable)
6459 (mapc 'gnus-summary-set-process-mark set))
6461 ;;; Searching and stuff
6463 (defun gnus-summary-search-group (&optional backward use-level)
6464 "Search for next unread newsgroup.
6465 If optional argument BACKWARD is non-nil, search backward instead."
6467 (set-buffer gnus-group-buffer)
6468 (when (gnus-group-search-forward
6469 backward nil (if use-level (gnus-group-group-level) nil))
6470 (gnus-group-group-name))))
6472 (defun gnus-summary-best-group (&optional exclude-group)
6473 "Find the name of the best unread group.
6474 If EXCLUDE-GROUP, do not go to this group."
6475 (with-current-buffer gnus-group-buffer
6477 (gnus-group-best-unread-group exclude-group))))
6479 (defun gnus-summary-find-next (&optional unread article backward)
6481 (gnus-summary-find-prev unread article)
6482 (let* ((dummy (gnus-summary-article-intangible-p))
6483 (article (or article (gnus-summary-article-number)))
6484 (data (gnus-data-find-list article))
6486 (when (and (not dummy)
6487 (or (not gnus-summary-check-current)
6489 (not (gnus-data-unread-p (car data)))))
6490 (setq data (cdr data)))
6495 (unless (memq (gnus-data-number (car data))
6497 ((eq gnus-auto-goto-ignores
6498 'always-undownloaded)
6499 gnus-newsgroup-undownloaded)
6502 ((eq gnus-auto-goto-ignores
6504 gnus-newsgroup-unfetched)
6505 ((eq gnus-auto-goto-ignores
6507 gnus-newsgroup-undownloaded)))
6508 (when (gnus-data-unread-p (car data))
6509 (setq result (car data)
6511 (setq data (cdr data)))
6514 (goto-char (gnus-data-pos result))
6515 (gnus-data-number result)))))
6517 (defun gnus-summary-find-prev (&optional unread article)
6518 (let* ((eobp (eobp))
6519 (article (or article (gnus-summary-article-number)))
6520 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6522 (when (and (not eobp)
6523 (or (not gnus-summary-check-current)
6525 (not (gnus-data-unread-p (car data)))))
6526 (setq data (cdr data)))
6531 (unless (memq (gnus-data-number (car data))
6533 ((eq gnus-auto-goto-ignores
6534 'always-undownloaded)
6535 gnus-newsgroup-undownloaded)
6538 ((eq gnus-auto-goto-ignores
6540 gnus-newsgroup-unfetched)
6541 ((eq gnus-auto-goto-ignores
6543 gnus-newsgroup-undownloaded)))
6544 (when (gnus-data-unread-p (car data))
6545 (setq result (car data)
6547 (setq data (cdr data)))
6550 (goto-char (gnus-data-pos result))
6551 (gnus-data-number result))))
6553 (defun gnus-summary-find-subject (subject &optional unread backward article)
6554 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6555 (article (or article (gnus-summary-article-number)))
6556 (articles (gnus-data-list backward))
6557 (arts (gnus-data-find-list article articles))
6559 (when (or (not gnus-summary-check-current)
6561 (not (gnus-data-unread-p (car arts))))
6562 (setq arts (cdr arts)))
6564 (and (or (not unread)
6565 (gnus-data-unread-p (car arts)))
6566 (vectorp (gnus-data-header (car arts)))
6568 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6569 (setq result (car arts)
6571 (setq arts (cdr arts)))
6573 (goto-char (gnus-data-pos result))
6574 (gnus-data-number result))))
6576 (defun gnus-summary-search-forward (&optional unread subject backward)
6577 "Search forward for an article.
6578 If UNREAD, look for unread articles. If SUBJECT, look for
6579 articles with that subject. If BACKWARD, search backward instead."
6580 (cond (subject (gnus-summary-find-subject subject unread backward))
6581 (backward (gnus-summary-find-prev unread))
6582 (t (gnus-summary-find-next unread))))
6584 (defun gnus-recenter (&optional n)
6585 "Center point in window and redisplay frame.
6586 Also do horizontal recentering."
6588 (when (and gnus-auto-center-summary
6589 (not (eq gnus-auto-center-summary 'vertical)))
6590 (gnus-horizontal-recenter))
6593 (defun gnus-summary-recenter ()
6594 "Center point in the summary window.
6595 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6596 displayed, no centering will be performed."
6597 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6598 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6600 ;; The user has to want it.
6601 (when gnus-auto-center-summary
6602 (let* ((top (cond ((< (window-height) 4) 0)
6603 ((< (window-height) 7) 1)
6604 (t (if (numberp gnus-auto-center-summary)
6605 gnus-auto-center-summary
6606 (/ (1- (window-height)) 2)))))
6607 (height (1- (window-height)))
6608 (bottom (save-excursion (goto-char (point-max))
6609 (forward-line (- height))
6611 (window (get-buffer-window (current-buffer))))
6612 (when (get-buffer-window gnus-article-buffer)
6613 ;; Only do recentering when the article buffer is displayed,
6614 ;; Set the window start to either `bottom', which is the biggest
6615 ;; possible valid number, or the second line from the top,
6616 ;; whichever is the least.
6617 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6618 (if (> bottom top-pos)
6619 ;; Keep the second line from the top visible
6620 (set-window-start window top-pos)
6621 ;; Try to keep the bottom line visible; if it's partially
6622 ;; obscured, either scroll one more line to make it fully
6623 ;; visible, or revert to using TOP-POS.
6625 (goto-char (point-max))
6627 (let ((last-line-start (point)))
6629 (set-window-start window (point) t)
6630 (when (not (pos-visible-in-window-p last-line-start window))
6632 (set-window-start window (min (point) top-pos) t)))))))
6633 ;; Do horizontal recentering while we're at it.
6634 (when (and (get-buffer-window (current-buffer) t)
6635 (not (eq gnus-auto-center-summary 'vertical)))
6636 (let ((selected (selected-window)))
6637 (select-window (get-buffer-window (current-buffer) t))
6638 (gnus-summary-position-point)
6639 (gnus-horizontal-recenter)
6640 (select-window selected))))))
6642 (defun gnus-summary-jump-to-group (newsgroup)
6643 "Move point to NEWSGROUP in group mode buffer."
6644 ;; Keep update point of group mode buffer if visible.
6645 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6646 (save-window-excursion
6647 ;; Take care of tree window mode.
6648 (when (get-buffer-window gnus-group-buffer)
6649 (pop-to-buffer gnus-group-buffer))
6650 (gnus-group-jump-to-group newsgroup))
6652 ;; Take care of tree window mode.
6653 (if (get-buffer-window gnus-group-buffer)
6654 (pop-to-buffer gnus-group-buffer)
6655 (set-buffer gnus-group-buffer))
6656 (gnus-group-jump-to-group newsgroup))))
6658 ;; This function returns a list of article numbers based on the
6659 ;; difference between the ranges of read articles in this group and
6660 ;; the range of active articles.
6661 (defun gnus-list-of-unread-articles (group)
6662 (let* ((read (gnus-info-read (gnus-get-info group)))
6663 (active (or (gnus-active group) (gnus-activate-group group)))
6664 (last (or (cdr active)
6665 (error "Group %s couldn't be activated " group)))
6667 ;; If none are read, then all are unread.
6669 (setq first (car active))
6670 ;; If the range of read articles is a single range, then the
6671 ;; first unread article is the article after the last read
6672 ;; article. Sounds logical, doesn't it?
6673 (if (and (not (listp (cdr read)))
6674 (or (< (car read) (car active))
6675 (progn (setq read (list read))
6677 (setq first (max (car active) (1+ (cdr read))))
6678 ;; `read' is a list of ranges.
6679 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6682 (setq first (car active)))
6685 (while (< first nlast)
6686 (setq unread (cons first unread)
6688 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6689 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6690 (setq read (cdr read)))))
6691 ;; And add the last unread articles.
6692 (while (<= first last)
6693 (setq unread (cons first unread)
6695 ;; Return the list of unread articles.
6696 (delq 0 (nreverse unread))))
6698 (defun gnus-list-of-read-articles (group)
6699 "Return a list of unread, unticked and non-dormant articles."
6700 (let* ((info (gnus-get-info group))
6701 (marked (gnus-info-marks info))
6702 (active (gnus-active group)))
6704 (gnus-list-range-difference
6705 (gnus-list-range-difference
6706 (gnus-sorted-complement
6707 (gnus-uncompress-range active)
6708 (gnus-list-of-unread-articles group))
6709 (cdr (assq 'dormant marked)))
6710 (cdr (assq 'tick marked))))))
6712 ;; This function returns a sequence of article numbers based on the
6713 ;; difference between the ranges of read articles in this group and
6714 ;; the range of active articles.
6715 (defun gnus-sequence-of-unread-articles (group)
6716 (let* ((read (gnus-info-read (gnus-get-info group)))
6717 (active (or (gnus-active group) (gnus-activate-group group)))
6720 ;; If none are read, then all are unread.
6722 (setq first (car active))
6723 ;; If the range of read articles is a single range, then the
6724 ;; first unread article is the article after the last read
6725 ;; article. Sounds logical, doesn't it?
6726 (if (and (not (listp (cdr read)))
6727 (or (< (car read) (car active))
6728 (progn (setq read (list read))
6730 (setq first (max (car active) (1+ (cdr read))))
6731 ;; `read' is a list of ranges.
6732 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6735 (setq first (car active)))
6738 (push (cons first nlast) unread))
6739 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6740 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6741 (setq read (cdr read)))))
6742 ;; And add the last unread articles.
6743 (cond ((not (and first last))
6746 (push (cons first last) unread))
6748 (push first unread)))
6749 ;; Return the sequence of unread articles.
6750 (delq 0 (nreverse unread))))
6752 ;; Various summary commands
6754 (defun gnus-summary-select-article-buffer ()
6755 "Reconfigure windows to show article buffer."
6757 (if (not (gnus-buffer-live-p gnus-article-buffer))
6758 (error "There is no article buffer for this summary buffer")
6759 (gnus-configure-windows 'article)
6760 (select-window (get-buffer-window gnus-article-buffer))))
6762 (defun gnus-summary-universal-argument (arg)
6763 "Perform any operation on all articles that are process/prefixed."
6765 (let ((articles (gnus-summary-work-articles arg))
6772 (substitute-command-keys
6773 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6775 (gnus-error 1 "Undefined key")
6778 (gnus-summary-goto-subject (setq article (pop articles)))
6779 (let (gnus-newsgroup-processable)
6780 (command-execute func))
6781 (gnus-summary-remove-process-mark article)))))
6782 (gnus-summary-position-point))
6784 (defun gnus-summary-toggle-truncation (&optional arg)
6785 "Toggle truncation of summary lines.
6786 With ARG, turn line truncation on if ARG is positive."
6788 (setq truncate-lines
6789 (if (null arg) (not truncate-lines)
6790 (> (prefix-numeric-value arg) 0)))
6793 (defun gnus-summary-find-for-reselect ()
6794 "Return the number of an article to stay on across a reselect.
6795 The current article is considered, then following articles, then previous
6796 articles. An article is sought which is not cancelled and isn't a temporary
6797 insertion from another group. If there's no such then return a dummy 0."
6799 (dolist (rev '(nil t))
6800 (unless found ; don't demand the reverse list if we don't need it
6801 (let ((data (gnus-data-find-list
6802 (gnus-summary-article-number) (gnus-data-list rev))))
6803 (while (and data (not found))
6804 (if (and (< 0 (gnus-data-number (car data)))
6805 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6806 (setq found (gnus-data-number (car data))))
6807 (setq data (cdr data))))))
6810 (defun gnus-summary-reselect-current-group (&optional all rescan)
6811 "Exit and then reselect the current newsgroup.
6812 The prefix argument ALL means to select all articles."
6814 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6815 (error "Ephemeral groups can't be reselected"))
6816 (let ((current-subject (gnus-summary-find-for-reselect))
6817 (group gnus-newsgroup-name))
6818 (setq gnus-newsgroup-begin nil)
6819 (gnus-summary-exit nil 'leave-hidden)
6820 ;; We have to adjust the point of group mode buffer because
6821 ;; point was moved to the next unread newsgroup by exiting.
6822 (gnus-summary-jump-to-group group)
6825 (gnus-group-get-new-news-this-group 1)))
6826 (gnus-group-read-group all t)
6827 (gnus-summary-goto-subject current-subject nil t)))
6829 (defun gnus-summary-rescan-group (&optional all)
6830 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6832 (gnus-summary-reselect-current-group all t))
6834 (defun gnus-summary-update-info (&optional non-destructive)
6836 (let ((group gnus-newsgroup-name))
6838 (when gnus-newsgroup-kill-headers
6839 (setq gnus-newsgroup-killed
6840 (gnus-compress-sequence
6842 (gnus-list-range-intersection
6843 gnus-newsgroup-unselected gnus-newsgroup-killed)
6844 gnus-newsgroup-unreads)
6846 (unless (listp (cdr gnus-newsgroup-killed))
6847 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6848 (let ((headers gnus-newsgroup-headers))
6849 ;; Set the new ranges of read articles.
6850 (with-current-buffer gnus-group-buffer
6851 (gnus-undo-force-boundary))
6852 (gnus-update-read-articles
6853 group (gnus-sorted-union
6854 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6855 ;; Set the current article marks.
6856 (let ((gnus-newsgroup-scored
6857 (if (and (not gnus-save-score)
6858 (not non-destructive))
6860 gnus-newsgroup-scored)))
6862 (gnus-update-marks)))
6863 ;; Do the cross-ref thing.
6864 (when gnus-use-cross-reference
6865 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6866 ;; Do not switch windows but change the buffer to work.
6867 (set-buffer gnus-group-buffer)
6868 (unless (gnus-ephemeral-group-p group)
6869 (gnus-group-update-group group)))))))
6871 (defun gnus-summary-save-newsrc (&optional force)
6872 "Save the current number of read/marked articles in the dribble buffer.
6873 The dribble buffer will then be saved.
6874 If FORCE (the prefix), also save the .newsrc file(s)."
6876 (gnus-summary-update-info t)
6878 (gnus-save-newsrc-file)
6879 (gnus-dribble-save)))
6881 (defun gnus-summary-exit (&optional temporary leave-hidden)
6882 "Exit reading current newsgroup, and then return to group selection mode.
6883 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6885 (gnus-set-global-variables)
6886 (when (gnus-buffer-live-p gnus-article-buffer)
6888 (set-buffer gnus-article-buffer)
6889 (mm-destroy-parts gnus-article-mime-handles)
6890 ;; Set it to nil for safety reason.
6891 (setq gnus-article-mime-handle-alist nil)
6892 (setq gnus-article-mime-handles nil)))
6893 (gnus-kill-save-kill-buffer)
6894 (gnus-async-halt-prefetch)
6895 (let* ((group gnus-newsgroup-name)
6896 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6897 (gnus-group-is-exiting-p t)
6900 (buf (current-buffer)))
6902 ;; Do adaptive scoring, and possibly save score files.
6903 (when gnus-newsgroup-adaptive
6904 (gnus-score-adaptive))
6905 (when gnus-use-scoring
6907 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6908 ;; If we have several article buffers, we kill them at exit.
6909 (unless gnus-single-article-buffer
6910 (gnus-kill-buffer gnus-article-buffer)
6911 (gnus-kill-buffer gnus-original-article-buffer)
6912 (setq gnus-article-current nil))
6913 (when gnus-use-cache
6914 (gnus-cache-possibly-remove-articles)
6915 (gnus-cache-save-buffers))
6916 (gnus-async-prefetch-remove-group group)
6917 (when gnus-suppress-duplicates
6918 (gnus-dup-enter-articles))
6919 (when gnus-use-trees
6920 (gnus-tree-close group))
6921 (when gnus-use-cache
6922 (gnus-cache-write-active))
6923 ;; Remove entries for this group.
6924 (nnmail-purge-split-history (gnus-group-real-name group))
6925 ;; Make all changes in this group permanent.
6927 (gnus-run-hooks 'gnus-exit-group-hook)
6928 (gnus-summary-update-info))
6929 (gnus-close-group group)
6930 ;; Make sure where we were, and go to next newsgroup.
6931 (set-buffer gnus-group-buffer)
6933 (gnus-group-jump-to-group group))
6934 (gnus-run-hooks 'gnus-summary-exit-hook)
6935 (unless (or quit-config
6936 ;; If this group has disappeared from the summary
6937 ;; buffer, don't skip forwards.
6938 (not (string= group (gnus-group-group-name))))
6939 (gnus-group-next-unread-group 1))
6940 (setq group-point (point))
6943 ;; If we have several article buffers, we kill them at exit.
6944 (unless gnus-single-article-buffer
6945 (gnus-kill-buffer gnus-article-buffer)
6946 (gnus-kill-buffer gnus-original-article-buffer)
6947 (setq gnus-article-current nil))
6949 (if (not gnus-kill-summary-on-exit)
6951 (gnus-deaden-summary)
6953 ;; We set all buffer-local variables to nil. It is unclear why
6954 ;; this is needed, but if we don't, buffer-local variables are
6955 ;; not garbage-collected, it seems. This would the lead to en
6956 ;; ever-growing Emacs.
6957 (gnus-summary-clear-local-variables)
6958 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6959 (gnus-summary-clear-local-variables))
6960 (when (get-buffer gnus-article-buffer)
6961 (bury-buffer gnus-article-buffer))
6962 ;; Return to group mode buffer.
6963 (when (eq mode 'gnus-summary-mode)
6964 (gnus-kill-buffer buf)))
6965 (setq gnus-current-select-method gnus-select-method)
6966 (set-buffer gnus-group-buffer)
6968 (gnus-handle-ephemeral-exit quit-config)
6969 (goto-char group-point)
6970 ;; If gnus-group-buffer is already displayed, make sure we also move
6971 ;; the cursor in the window that displays it.
6972 (let ((win (get-buffer-window (current-buffer) 0)))
6973 (if win (set-window-point win (point))))
6974 (unless leave-hidden
6975 (gnus-configure-windows 'group 'force)))
6976 ;; Clear the current group name.
6978 (setq gnus-newsgroup-name nil)))))
6980 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6981 (defun gnus-summary-exit-no-update (&optional no-questions)
6982 "Quit reading current newsgroup without updating read article info."
6984 (let* ((group gnus-newsgroup-name)
6985 (gnus-group-is-exiting-p t)
6986 (gnus-group-is-exiting-without-update-p t)
6987 (quit-config (gnus-group-quit-config group)))
6988 (when (or no-questions
6990 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6991 (gnus-async-halt-prefetch)
6992 (run-hooks 'gnus-summary-prepare-exit-hook)
6993 (when (gnus-buffer-live-p gnus-article-buffer)
6995 (set-buffer gnus-article-buffer)
6996 (mm-destroy-parts gnus-article-mime-handles)
6997 ;; Set it to nil for safety reason.
6998 (setq gnus-article-mime-handle-alist nil)
6999 (setq gnus-article-mime-handles nil)))
7000 ;; If we have several article buffers, we kill them at exit.
7001 (unless gnus-single-article-buffer
7002 (gnus-kill-buffer gnus-article-buffer)
7003 (gnus-kill-buffer gnus-original-article-buffer)
7004 (setq gnus-article-current nil))
7005 (if (not gnus-kill-summary-on-exit)
7006 (gnus-deaden-summary)
7007 (gnus-close-group group)
7008 (gnus-summary-clear-local-variables)
7009 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7010 (gnus-summary-clear-local-variables))
7011 (gnus-kill-buffer gnus-summary-buffer))
7012 (unless gnus-single-article-buffer
7013 (setq gnus-article-current nil))
7014 (when gnus-use-trees
7015 (gnus-tree-close group))
7016 (gnus-async-prefetch-remove-group group)
7017 (when (get-buffer gnus-article-buffer)
7018 (bury-buffer gnus-article-buffer))
7019 ;; Return to the group buffer.
7020 (gnus-configure-windows 'group 'force)
7021 ;; Clear the current group name.
7022 (setq gnus-newsgroup-name nil)
7023 (unless (gnus-ephemeral-group-p group)
7024 (gnus-group-update-group group))
7025 (when (equal (gnus-group-group-name) group)
7026 (gnus-group-next-unread-group 1))
7028 (gnus-handle-ephemeral-exit quit-config)))))
7030 (defun gnus-handle-ephemeral-exit (quit-config)
7031 "Handle movement when leaving an ephemeral group.
7032 The state which existed when entering the ephemeral is reset."
7033 (if (not (buffer-name (car quit-config)))
7034 (gnus-configure-windows 'group 'force)
7035 (set-buffer (car quit-config))
7036 (cond ((eq major-mode 'gnus-summary-mode)
7037 (gnus-set-global-variables))
7038 ((eq major-mode 'gnus-article-mode)
7040 ;; The `gnus-summary-buffer' variable may point
7041 ;; to the old summary buffer when using a single
7043 (unless (gnus-buffer-live-p gnus-summary-buffer)
7044 (set-buffer gnus-group-buffer))
7045 (set-buffer gnus-summary-buffer)
7046 (gnus-set-global-variables))))
7047 (if (or (eq (cdr quit-config) 'article)
7048 (eq (cdr quit-config) 'pick))
7049 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7050 (gnus-configure-windows 'pick 'force)
7051 (gnus-configure-windows (cdr quit-config) 'force))
7052 (gnus-configure-windows (cdr quit-config) 'force))
7053 (when (eq major-mode 'gnus-summary-mode)
7054 (gnus-summary-recenter)
7055 (gnus-summary-position-point))))
7059 (defvar gnus-dead-summary-mode-map nil)
7061 (unless gnus-dead-summary-mode-map
7062 (setq gnus-dead-summary-mode-map (make-keymap))
7063 (suppress-keymap gnus-dead-summary-mode-map)
7064 (substitute-key-definition
7065 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7066 (dolist (key '("\C-d" "\r" "\177" [delete]))
7067 (define-key gnus-dead-summary-mode-map
7068 key 'gnus-summary-wake-up-the-dead))
7069 (dolist (key '("q" "Q"))
7070 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
7072 (defvar gnus-dead-summary-mode nil
7073 "Minor mode for Gnus summary buffers.")
7075 (defun gnus-dead-summary-mode (&optional arg)
7076 "Minor mode for Gnus summary buffers."
7078 (when (eq major-mode 'gnus-summary-mode)
7079 (make-local-variable 'gnus-dead-summary-mode)
7080 (setq gnus-dead-summary-mode
7081 (if (null arg) (not gnus-dead-summary-mode)
7082 (> (prefix-numeric-value arg) 0)))
7083 (when gnus-dead-summary-mode
7085 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7087 (defun gnus-deaden-summary ()
7088 "Make the current summary buffer into a dead summary buffer."
7089 ;; Kill any previous dead summary buffer.
7090 (when (and gnus-dead-summary
7091 (buffer-name gnus-dead-summary))
7092 (with-current-buffer gnus-dead-summary
7093 (when gnus-dead-summary-mode
7094 (kill-buffer (current-buffer)))))
7095 ;; Make this the current dead summary.
7096 (setq gnus-dead-summary (current-buffer))
7097 (gnus-dead-summary-mode 1)
7098 (let ((name (buffer-name)))
7099 (when (string-match "Summary" name)
7101 (concat (substring name 0 (match-beginning 0)) "Dead "
7102 (substring name (match-beginning 0)))
7106 (defun gnus-kill-or-deaden-summary (buffer)
7107 "Kill or deaden the summary BUFFER."
7109 (when (and (buffer-name buffer)
7110 (not gnus-single-article-buffer))
7111 (with-current-buffer buffer
7112 (gnus-kill-buffer gnus-article-buffer)
7113 (gnus-kill-buffer gnus-original-article-buffer)))
7116 (gnus-kill-summary-on-exit
7117 (when (and gnus-use-trees
7118 (gnus-buffer-exists-p buffer))
7121 (gnus-tree-close gnus-newsgroup-name)))
7122 (gnus-kill-buffer buffer))
7123 ;; Deaden the buffer.
7124 ((gnus-buffer-exists-p buffer)
7127 (gnus-deaden-summary))))))
7129 (defun gnus-summary-wake-up-the-dead (&rest args)
7130 "Wake up the dead summary buffer."
7132 (gnus-dead-summary-mode -1)
7133 (let ((name (buffer-name)))
7134 (when (string-match "Dead " name)
7136 (concat (substring name 0 (match-beginning 0))
7137 (substring name (match-end 0)))
7139 (gnus-message 3 "This dead summary is now alive again"))
7141 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7142 (defun gnus-summary-fetch-faq (&optional faq-dir)
7143 "Fetch the FAQ for the current group.
7144 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7148 (when current-prefix-arg
7150 "FAQ dir: " (and (listp gnus-group-faq-directory)
7152 gnus-group-faq-directory))))))
7153 (let (gnus-faq-buffer)
7154 (when (setq gnus-faq-buffer
7155 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7156 (gnus-configure-windows 'summary-faq))))
7158 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7159 (defun gnus-summary-describe-group (&optional force)
7160 "Describe the current newsgroup."
7162 (gnus-group-describe-group force gnus-newsgroup-name))
7164 (defun gnus-summary-describe-briefly ()
7165 "Describe summary mode commands briefly."
7167 (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")))
7169 ;; Walking around group mode buffer from summary mode.
7171 (defun gnus-summary-next-group (&optional no-article target-group backward)
7172 "Exit current newsgroup and then select next unread newsgroup.
7173 If prefix argument NO-ARTICLE is non-nil, no article is selected
7174 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7175 previous group instead."
7177 ;; Stop pre-fetching.
7178 (gnus-async-halt-prefetch)
7179 (let ((current-group gnus-newsgroup-name)
7180 (current-buffer (current-buffer))
7182 ;; First we semi-exit this group to update Xrefs and all variables.
7183 ;; We can't do a real exit, because the window conf must remain
7184 ;; the same in case the user is prompted for info, and we don't
7185 ;; want the window conf to change before that...
7186 (gnus-summary-exit t)
7187 (while (not entered)
7188 ;; Then we find what group we are supposed to enter.
7189 (set-buffer gnus-group-buffer)
7190 (gnus-group-jump-to-group current-group)
7193 (if (eq gnus-keep-same-level 'best)
7194 (gnus-summary-best-group gnus-newsgroup-name)
7195 (gnus-summary-search-group backward gnus-keep-same-level))))
7196 (if (not target-group)
7197 ;; There are no further groups, so we return to the group
7200 (gnus-message 5 "Returning to the group buffer")
7202 (when (gnus-buffer-live-p current-buffer)
7203 (set-buffer current-buffer)
7204 (gnus-summary-exit))
7205 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7206 ;; We try to enter the target group.
7207 (gnus-group-jump-to-group target-group)
7208 (let ((unreads (gnus-group-group-unread)))
7209 (if (and (or (eq t unreads)
7210 (and unreads (not (zerop unreads))))
7211 (gnus-summary-read-group
7212 target-group nil no-article
7213 (and (buffer-name current-buffer) current-buffer)
7216 (setq current-group target-group
7217 target-group nil)))))))
7219 (defun gnus-summary-prev-group (&optional no-article)
7220 "Exit current newsgroup and then select previous unread newsgroup.
7221 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7223 (gnus-summary-next-group no-article nil t))
7225 ;; Walking around summary lines.
7227 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7228 "Go to the first subject satisfying any non-nil constraint.
7229 If UNREAD is non-nil, the article should be unread.
7230 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7231 If UNSEEN is non-nil, the article should be unseen.
7232 Returns the article selected or nil if there are no matching articles."
7236 ((null gnus-newsgroup-data)
7237 (gnus-message 3 "No articles in the group")
7239 ;; Pick the first article.
7240 ((not (or unread undownloaded unseen))
7241 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7242 (gnus-data-number (car gnus-newsgroup-data)))
7243 ;; Find the first unread article.
7245 (let ((data gnus-newsgroup-data))
7247 (let ((num (gnus-data-number (car data))))
7248 (or (memq num gnus-newsgroup-unfetched)
7249 (not (or (and unread
7250 (memq num gnus-newsgroup-unreads))
7252 (memq num gnus-newsgroup-undownloaded))
7254 (memq num gnus-newsgroup-unseen)))))))
7255 (setq data (cdr data)))
7259 (goto-char (gnus-data-pos (car data)))
7260 (gnus-data-number (car data)))
7261 (gnus-message 3 "No more%s articles"
7262 (let* ((r (when unread " unread"))
7263 (d (when undownloaded " undownloaded"))
7264 (s (when unseen " unseen"))
7265 (l (delq nil (list r d s))))
7266 (cond ((= 3 (length l))
7267 (concat r "," d ", or" s))
7269 (concat (car l) ", or" (cadr l)))
7276 (gnus-summary-position-point))))))
7278 (defun gnus-summary-next-subject (n &optional unread dont-display)
7279 "Go to next N'th summary line.
7280 If N is negative, go to the previous N'th subject line.
7281 If UNREAD is non-nil, only unread articles are selected.
7282 The difference between N and the actual number of steps taken is
7285 (let ((backward (< n 0))
7289 (gnus-summary-find-prev unread)
7290 (gnus-summary-find-next unread)))
7291 (unless (zerop (setq n (1- n)))
7292 (gnus-summary-show-thread)))
7294 (gnus-message 7 "No more%s articles"
7295 (if unread " unread" "")))
7296 (unless dont-display
7297 (gnus-summary-recenter)
7298 (gnus-summary-position-point))
7301 (defun gnus-summary-next-unread-subject (n)
7302 "Go to next N'th unread summary line."
7304 (gnus-summary-next-subject n t))
7306 (defun gnus-summary-prev-subject (n &optional unread)
7307 "Go to previous N'th summary line.
7308 If optional argument UNREAD is non-nil, only unread article is selected."
7310 (gnus-summary-next-subject (- n) unread))
7312 (defun gnus-summary-prev-unread-subject (n)
7313 "Go to previous N'th unread summary line."
7315 (gnus-summary-next-subject (- n) t))
7317 (defun gnus-summary-goto-subjects (articles)
7318 "Insert the subject header for ARTICLES in the current buffer."
7320 (dolist (article articles)
7321 (gnus-summary-goto-subject article t)))
7322 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7323 (gnus-summary-position-point))
7325 (defun gnus-summary-goto-subject (article &optional force silent)
7326 "Go the subject line of ARTICLE.
7327 If FORCE, also allow jumping to articles not currently shown."
7328 (interactive "nArticle number: ")
7329 (unless (numberp article)
7330 (error "Article %s is not a number" article))
7332 (data (gnus-data-find article)))
7333 ;; We read in the article if we have to.
7336 (gnus-summary-insert-subject
7338 (if (or (numberp force) (vectorp force)) force)
7340 (setq data (gnus-data-find article)))
7345 (gnus-message 3 "Can't find article %d" article))
7347 (let ((pt (gnus-data-pos data)))
7349 (gnus-summary-set-article-display-arrow pt))
7350 (gnus-summary-position-point)
7353 ;; Walking around summary lines with displaying articles.
7355 (defun gnus-summary-expand-window (&optional arg)
7356 "Make the summary buffer take up the entire Emacs frame.
7357 Given a prefix, will force an `article' buffer configuration."
7360 (gnus-configure-windows 'article 'force)
7361 (gnus-configure-windows 'summary 'force)))
7363 (defun gnus-summary-display-article (article &optional all-header)
7364 "Display ARTICLE in article buffer."
7365 (when (gnus-buffer-live-p gnus-article-buffer)
7366 (with-current-buffer gnus-article-buffer
7367 (mm-enable-multibyte)))
7368 (gnus-set-global-variables)
7369 (when (gnus-buffer-live-p gnus-article-buffer)
7370 (with-current-buffer gnus-article-buffer
7371 (setq gnus-article-charset gnus-newsgroup-charset)
7372 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7373 (mm-enable-multibyte)))
7377 (if gnus-summary-display-article-function
7378 (funcall gnus-summary-display-article-function article all-header)
7379 (gnus-article-prepare article all-header))
7380 (gnus-run-hooks 'gnus-select-article-hook)
7381 (when (and gnus-current-article
7382 (not (zerop gnus-current-article)))
7383 (gnus-summary-goto-subject gnus-current-article))
7384 (gnus-summary-recenter)
7385 (when (and gnus-use-trees gnus-show-threads)
7386 (gnus-possibly-generate-tree article)
7387 (gnus-highlight-selected-tree article))
7388 ;; Successfully display article.
7389 (gnus-article-set-window-start
7390 (cdr (assq article gnus-newsgroup-bookmarks))))))
7392 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7393 "Select the current article.
7394 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7395 non-nil, the article will be re-fetched even if it already present in
7396 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7398 ;; Make sure we are in the summary buffer to work around bbdb bug.
7399 (unless (eq major-mode 'gnus-summary-mode)
7400 (set-buffer gnus-summary-buffer))
7401 (let ((article (or article (gnus-summary-article-number)))
7402 (all-headers (not (not all-headers))) ;Must be t or nil.
7403 gnus-summary-display-article-function)
7405 (gnus-summary-article-pseudo-p article)
7406 (error "This is a pseudo-article"))
7408 (set-buffer gnus-summary-buffer)
7409 (if (or (and gnus-single-article-buffer
7410 (or (null gnus-current-article)
7411 (null gnus-article-current)
7412 (null (get-buffer gnus-article-buffer))
7413 (not (eq article (cdr gnus-article-current)))
7414 (not (equal (car gnus-article-current)
7415 gnus-newsgroup-name))))
7416 (and (not gnus-single-article-buffer)
7417 (or (null gnus-current-article)
7418 (not (eq gnus-current-article article))))
7420 ;; The requested article is different from the current article.
7422 (gnus-summary-display-article article all-headers)
7423 (when (gnus-buffer-live-p gnus-article-buffer)
7424 (with-current-buffer gnus-article-buffer
7425 (if (not gnus-article-decoded-p) ;; a local variable
7426 (mm-disable-multibyte))))
7427 (gnus-article-set-window-start
7428 (cdr (assq article gnus-newsgroup-bookmarks)))
7432 (defun gnus-summary-force-verify-and-decrypt ()
7433 "Display buttons for signed/encrypted parts and verify/decrypt them."
7435 (let ((mm-verify-option 'known)
7436 (mm-decrypt-option 'known)
7437 (gnus-article-emulate-mime t)
7438 (gnus-buttonized-mime-types (append (list "multipart/signed"
7439 "multipart/encrypted")
7440 gnus-buttonized-mime-types)))
7441 (gnus-summary-select-article nil 'force)))
7443 (defun gnus-summary-set-current-mark (&optional current-mark)
7444 "Obsolete function."
7447 (defun gnus-summary-next-article (&optional unread subject backward push)
7448 "Select the next article.
7449 If UNREAD, only unread articles are selected.
7450 If SUBJECT, only articles with SUBJECT are selected.
7451 If BACKWARD, the previous article is selected instead of the next."
7453 ;; Make sure we are in the summary buffer.
7454 (unless (eq major-mode 'gnus-summary-mode)
7455 (set-buffer gnus-summary-buffer))
7457 ;; Is there such an article?
7458 ((and (gnus-summary-search-forward unread subject backward)
7459 (or (gnus-summary-display-article (gnus-summary-article-number))
7460 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7461 (gnus-summary-position-point))
7462 ;; If not, we try the first unread, if that is wanted.
7464 gnus-auto-select-same
7465 (gnus-summary-first-unread-article))
7466 (gnus-summary-position-point)
7467 (gnus-message 6 "Wrapped"))
7468 ;; Try to get next/previous article not displayed in this group.
7469 ((and gnus-auto-extend-newsgroup
7470 (not unread) (not subject))
7471 (gnus-summary-goto-article
7472 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7473 nil (count-lines (point-min) (point))))
7474 ;; Go to next/previous group.
7476 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7477 (gnus-summary-jump-to-group gnus-newsgroup-name))
7478 (let ((cmd last-command-char)
7480 (with-current-buffer gnus-group-buffer
7483 (if (eq gnus-keep-same-level 'best)
7484 (gnus-summary-best-group gnus-newsgroup-name)
7485 (gnus-summary-search-group backward gnus-keep-same-level))))
7486 ;; For some reason, the group window gets selected. We change
7488 (select-window (get-buffer-window (current-buffer)))
7489 ;; Select next unread newsgroup automagically.
7491 ((or (not gnus-auto-select-next)
7493 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7494 ((or (eq gnus-auto-select-next 'quietly)
7495 (and (eq gnus-auto-select-next 'slightly-quietly)
7497 (and (eq gnus-auto-select-next 'almost-quietly)
7498 (gnus-summary-last-article-p)))
7500 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7502 (gnus-message 7 "No more%s articles (%s)..."
7503 (if unread " unread" "")
7504 (if group (concat "selecting " group)
7506 (gnus-summary-next-group nil group backward)))
7508 (when (gnus-key-press-event-p last-input-event)
7509 (gnus-summary-walk-group-buffer
7510 gnus-newsgroup-name cmd unread backward point))))))))
7512 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7513 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7514 (?\C-p (gnus-group-prev-unread-group 1))))
7515 (cursor-in-echo-area t)
7516 keve key group ended prompt)
7518 (set-buffer gnus-group-buffer)
7521 (if (eq gnus-keep-same-level 'best)
7522 (gnus-summary-best-group gnus-newsgroup-name)
7523 (gnus-summary-search-group backward gnus-keep-same-level))))
7527 "No more%s articles%s " (if unread " unread" "")
7529 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7530 (format " (Type %s for %s [%s])"
7531 (single-key-description cmd)
7532 (gnus-group-decoded-name group)
7533 (gnus-group-unread group))
7534 (format " (Type %s to exit %s)"
7535 (single-key-description cmd)
7536 (gnus-group-decoded-name gnus-newsgroup-name)))))
7537 ;; Confirm auto selection.
7538 (setq key (car (setq keve (gnus-read-event-char prompt)))
7541 ((assq key keystrokes)
7542 (let ((obuf (current-buffer)))
7543 (switch-to-buffer gnus-group-buffer)
7545 (gnus-group-jump-to-group group))
7546 (eval (cadr (assq key keystrokes)))
7547 (setq group (gnus-group-group-name))
7548 (switch-to-buffer obuf))
7552 (gnus-ephemeral-group-p gnus-newsgroup-name))
7554 (gnus-summary-next-group nil group backward)))
7556 (push (cdr keve) unread-command-events))))))
7558 (defun gnus-summary-next-unread-article ()
7559 "Select unread article after current one."
7561 (gnus-summary-next-article
7562 (or (not (eq gnus-summary-goto-unread 'never))
7563 (gnus-summary-last-article-p (gnus-summary-article-number)))
7564 (and gnus-auto-select-same
7565 (gnus-summary-article-subject))))
7567 (defun gnus-summary-prev-article (&optional unread subject)
7568 "Select the article after the current one.
7569 If UNREAD is non-nil, only unread articles are selected."
7571 (gnus-summary-next-article unread subject t))
7573 (defun gnus-summary-prev-unread-article ()
7574 "Select unread article before current one."
7576 (gnus-summary-prev-article
7577 (or (not (eq gnus-summary-goto-unread 'never))
7578 (gnus-summary-first-article-p (gnus-summary-article-number)))
7579 (and gnus-auto-select-same
7580 (gnus-summary-article-subject))))
7582 (defun gnus-summary-next-page (&optional lines circular stop)
7583 "Show next page of the selected article.
7584 If at the end of the current article, select the next article.
7585 LINES says how many lines should be scrolled up.
7587 If CIRCULAR is non-nil, go to the start of the article instead of
7588 selecting the next article when reaching the end of the current
7591 If STOP is non-nil, just stop when reaching the end of the message.
7593 Also see the variable `gnus-article-skip-boring'."
7595 (setq gnus-summary-buffer (current-buffer))
7596 (gnus-set-global-variables)
7597 (let ((article (gnus-summary-article-number))
7598 (article-window (get-buffer-window gnus-article-buffer t))
7600 ;; If the buffer is empty, we have no article.
7602 (error "No article to select"))
7603 (gnus-configure-windows 'article)
7604 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7605 (if (and (eq gnus-summary-goto-unread 'never)
7606 (not (gnus-summary-last-article-p article)))
7607 (gnus-summary-next-article)
7608 (gnus-summary-next-unread-article))
7609 (if (or (null gnus-current-article)
7610 (null gnus-article-current)
7611 (/= article (cdr gnus-article-current))
7612 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7613 ;; Selected subject is different from current article's.
7614 (gnus-summary-display-article article)
7615 (when article-window
7616 (gnus-eval-in-buffer-window gnus-article-buffer
7617 (setq endp (or (gnus-article-next-page lines)
7618 (gnus-article-only-boring-p))))
7621 (gnus-message 3 "End of message"))
7623 (gnus-summary-beginning-of-article))
7625 (gnus-message 3 "End of message"))
7627 (if (and (eq gnus-summary-goto-unread 'never)
7628 (not (gnus-summary-last-article-p article)))
7629 (gnus-summary-next-article)
7630 (gnus-summary-next-unread-article))))))))
7631 (gnus-summary-recenter)
7632 (gnus-summary-position-point)))
7634 (defun gnus-summary-prev-page (&optional lines move)
7635 "Show previous page of selected article.
7636 Argument LINES specifies lines to be scrolled down.
7637 If MOVE, move to the previous unread article if point is at
7638 the beginning of the buffer."
7640 (let ((article (gnus-summary-article-number))
7641 (article-window (get-buffer-window gnus-article-buffer t))
7643 (gnus-configure-windows 'article)
7644 (if (or (null gnus-current-article)
7645 (null gnus-article-current)
7646 (/= article (cdr gnus-article-current))
7647 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7648 ;; Selected subject is different from current article's.
7649 (gnus-summary-display-article article)
7650 (gnus-summary-recenter)
7651 (when article-window
7652 (gnus-eval-in-buffer-window gnus-article-buffer
7653 (setq endp (gnus-article-prev-page lines)))
7654 (when (and move endp)
7656 (gnus-message 3 "Beginning of message"))
7658 (if (and (eq gnus-summary-goto-unread 'never)
7659 (not (gnus-summary-first-article-p article)))
7660 (gnus-summary-prev-article)
7661 (gnus-summary-prev-unread-article))))))))
7662 (gnus-summary-position-point))
7664 (defun gnus-summary-prev-page-or-article (&optional lines)
7665 "Show previous page of selected article.
7666 Argument LINES specifies lines to be scrolled down.
7667 If at the beginning of the article, go to the next article."
7669 (gnus-summary-prev-page lines t))
7671 (defun gnus-summary-scroll-up (lines)
7672 "Scroll up (or down) one line current article.
7673 Argument LINES specifies lines to be scrolled up (or down if negative)."
7675 (gnus-configure-windows 'article)
7676 (gnus-summary-show-thread)
7677 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7678 (gnus-eval-in-buffer-window gnus-article-buffer
7680 (when (gnus-article-next-page lines)
7681 (gnus-message 3 "End of message")))
7683 (gnus-article-prev-page (- lines))))))
7684 (gnus-summary-recenter)
7685 (gnus-summary-position-point))
7687 (defun gnus-summary-scroll-down (lines)
7688 "Scroll down (or up) one line current article.
7689 Argument LINES specifies lines to be scrolled down (or up if negative)."
7691 (gnus-summary-scroll-up (- lines)))
7693 (defun gnus-summary-next-same-subject ()
7694 "Select next article which has the same subject as current one."
7696 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7698 (defun gnus-summary-prev-same-subject ()
7699 "Select previous article which has the same subject as current one."
7701 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7703 (defun gnus-summary-next-unread-same-subject ()
7704 "Select next unread article which has the same subject as current one."
7706 (gnus-summary-next-article t (gnus-summary-article-subject)))
7708 (defun gnus-summary-prev-unread-same-subject ()
7709 "Select previous unread article which has the same subject as current one."
7711 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7713 (defun gnus-summary-first-unread-article ()
7714 "Select the first unread article.
7715 Return nil if there are no unread articles."
7718 (when (gnus-summary-first-subject t)
7719 (gnus-summary-show-thread)
7720 (gnus-summary-first-subject t)
7721 (gnus-summary-display-article (gnus-summary-article-number)))
7722 (gnus-summary-position-point)))
7724 (defun gnus-summary-first-unread-subject ()
7725 "Place the point on the subject line of the first unread article.
7726 Return nil if there are no unread articles."
7729 (when (gnus-summary-first-subject t)
7730 (gnus-summary-show-thread)
7731 (gnus-summary-first-subject t))
7732 (gnus-summary-position-point)))
7734 (defun gnus-summary-first-unseen-subject ()
7735 "Place the point on the subject line of the first unseen article.
7736 Return nil if there are no unseen articles."
7739 (when (gnus-summary-first-subject nil nil t)
7740 (gnus-summary-show-thread)
7741 (gnus-summary-first-subject nil nil t))
7742 (gnus-summary-position-point)))
7744 (defun gnus-summary-first-unseen-or-unread-subject ()
7745 "Place the point on the subject line of the first unseen article or,
7746 if all article have been seen, on the subject line of the first unread
7750 (unless (when (gnus-summary-first-subject nil nil t)
7751 (gnus-summary-show-thread)
7752 (gnus-summary-first-subject nil nil t))
7753 (when (gnus-summary-first-subject t)
7754 (gnus-summary-show-thread)
7755 (gnus-summary-first-subject t)))
7756 (gnus-summary-position-point)))
7758 (defun gnus-summary-first-article ()
7759 "Select the first article.
7760 Return nil if there are no articles."
7763 (when (gnus-summary-first-subject)
7764 (gnus-summary-show-thread)
7765 (gnus-summary-first-subject)
7766 (gnus-summary-display-article (gnus-summary-article-number)))
7767 (gnus-summary-position-point)))
7769 (defun gnus-summary-best-unread-article (&optional arg)
7770 "Select the unread article with the highest score.
7771 If given a prefix argument, select the next unread article that has a
7772 score higher than the default score."
7774 (let ((article (if arg
7775 (gnus-summary-better-unread-subject)
7776 (gnus-summary-best-unread-subject))))
7778 (gnus-summary-goto-article article)
7779 (error "No unread articles"))))
7781 (defun gnus-summary-best-unread-subject ()
7782 "Select the unread subject with the highest score."
7784 (let ((best -1000000)
7785 (data gnus-newsgroup-data)
7788 (and (gnus-data-unread-p (car data))
7790 (gnus-summary-article-score (gnus-data-number (car data))))
7793 article (gnus-data-number (car data))))
7794 (setq data (cdr data)))
7796 (gnus-summary-goto-subject article))
7797 (gnus-summary-position-point)
7800 (defun gnus-summary-better-unread-subject ()
7801 "Select the first unread subject that has a score over the default score."
7803 (let ((data gnus-newsgroup-data)
7805 (while (and (setq article (gnus-data-number (car data)))
7806 (or (gnus-data-read-p (car data))
7807 (not (> (gnus-summary-article-score article)
7808 gnus-summary-default-score))))
7809 (setq data (cdr data)))
7811 (gnus-summary-goto-subject article))
7812 (gnus-summary-position-point)
7815 (defun gnus-summary-last-subject ()
7816 "Go to the last displayed subject line in the group."
7817 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7819 (gnus-summary-goto-subject article))))
7821 (defun gnus-summary-goto-article (article &optional all-headers force)
7822 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7823 If ALL-HEADERS is non-nil, no header lines are hidden.
7824 If FORCE, go to the article even if it isn't displayed. If FORCE
7825 is a number, it is the line the article is to be displayed on."
7829 "Article number or Message-ID: "
7830 (mapcar (lambda (number) (list (int-to-string number)))
7831 gnus-newsgroup-limit))
7835 (if (and (stringp article)
7836 (string-match "@\\|%40" article))
7837 (gnus-summary-refer-article article)
7838 (when (stringp article)
7839 (setq article (string-to-number article)))
7840 (if (gnus-summary-goto-subject article force)
7841 (gnus-summary-display-article article all-headers)
7842 (gnus-message 4 "Couldn't go to article %s" article) nil))
7843 (gnus-summary-position-point)))
7845 (defun gnus-summary-goto-last-article ()
7846 "Go to the previously read article."
7849 (when gnus-last-article
7850 (gnus-summary-goto-article gnus-last-article nil t))
7851 (gnus-summary-position-point)))
7853 (defun gnus-summary-pop-article (number)
7854 "Pop one article off the history and go to the previous.
7855 NUMBER articles will be popped off."
7858 (setq gnus-newsgroup-history
7859 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7861 (gnus-summary-goto-article (car to) nil t)
7862 (error "Article history empty")))
7863 (gnus-summary-position-point))
7865 ;; Summary commands and functions for limiting the summary buffer.
7867 (defun gnus-summary-limit-to-articles (n)
7868 "Limit the summary buffer to the next N articles.
7869 If not given a prefix, use the process marked articles instead."
7872 (let ((articles (gnus-summary-work-articles n)))
7873 (setq gnus-newsgroup-processable nil)
7874 (gnus-summary-limit articles))
7875 (gnus-summary-position-point)))
7877 (defun gnus-summary-pop-limit (&optional total)
7878 "Restore the previous limit.
7879 If given a prefix, remove all limits."
7882 (setq gnus-newsgroup-limits
7883 (list (mapcar (lambda (h) (mail-header-number h))
7884 gnus-newsgroup-headers))))
7885 (unless gnus-newsgroup-limits
7886 (error "No limit to pop"))
7888 (gnus-summary-limit nil 'pop)
7889 (gnus-summary-position-point)))
7891 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7892 "Limit the summary buffer to articles that have subjects that match a regexp.
7893 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7895 (list (read-string (if current-prefix-arg
7896 "Exclude subject (regexp): "
7897 "Limit to subject (regexp): "))
7898 nil current-prefix-arg))
7900 (setq header "subject"))
7901 (when (not (equal "" subject))
7903 (let ((articles (gnus-summary-find-matching
7904 (or header "subject") subject 'all nil nil
7907 (error "Found no matches for \"%s\"" subject))
7908 (gnus-summary-limit articles))
7909 (gnus-summary-position-point))))
7911 (defun gnus-summary-limit-to-author (from &optional not-matching)
7912 "Limit the summary buffer to articles that have authors that match a regexp.
7913 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7915 (list (read-string (if current-prefix-arg
7916 "Exclude author (regexp): "
7917 "Limit to author (regexp): "))
7918 current-prefix-arg))
7919 (gnus-summary-limit-to-subject from "from" not-matching))
7921 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7922 "Limit the summary buffer to articles with the given RECIPIENT.
7924 If NOT-MATCHING, exclude RECIPIENT.
7926 To and Cc headers are checked. You need to include them in
7927 `nnmail-extra-headers'."
7928 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7930 (list (read-string (format "%s recipient (regexp): "
7931 (if current-prefix-arg "Exclude" "Limit to")))
7932 current-prefix-arg))
7933 (when (not (equal "" recipient))
7935 (if (memq 'To nnmail-extra-headers)
7936 (gnus-summary-find-matching
7937 (cons 'extra 'To) recipient 'all nil nil
7940 1 "`To' isn't present in `nnmail-extra-headers'")
7944 (if (memq 'Cc nnmail-extra-headers)
7945 (gnus-summary-find-matching
7946 (cons 'extra 'Cc) recipient 'all nil nil
7949 1 "`Cc' isn't present in `nnmail-extra-headers'")
7954 ;; We need the numbers that are in both lists:
7956 (and (memq a to) a))
7960 (error "Found no matches for \"%s\"" recipient))
7961 (gnus-summary-limit articles))
7962 (gnus-summary-position-point))))
7964 (defun gnus-summary-limit-strange-charsets-predicate (header)
7965 (let ((string (concat (mail-header-subject header)
7966 (mail-header-from header)))
7968 (dotimes (i (1- (length string)))
7969 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
7970 (when (string-match "unicode\\|big\\|japanese" charset)
7974 (defun gnus-summary-limit-to-predicate (predicate)
7975 "Limit to articles where PREDICATE returns non-nil.
7976 PREDICATE will be called with the header structures of the
7978 (let ((articles nil)
7979 (case-fold-search t))
7980 (dolist (header gnus-newsgroup-headers)
7981 (when (funcall predicate header)
7982 (push (mail-header-number header) articles)))
7983 (gnus-summary-limit (nreverse articles))))
7985 (defun gnus-summary-limit-to-age (age &optional younger-p)
7986 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7987 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7988 articles that are younger than AGE days."
7990 (let ((younger current-prefix-arg)
7993 (while (not days-got)
7994 (setq days (if younger
7995 (read-string "Limit to articles younger than (in days, older when negative): ")
7997 "Limit to articles older than (in days, younger when negative): ")))
7998 (when (> (length days) 0)
7999 (setq days (read days)))
8004 (setq younger (not younger))
8005 (setq days (* days -1))))
8006 (message "Please enter a number.")
8008 (list days younger)))
8010 (let ((data gnus-newsgroup-data)
8011 (cutoff (days-to-time age))
8012 articles d date is-younger)
8013 (while (setq d (pop data))
8014 (when (and (vectorp (gnus-data-header d))
8015 (setq date (mail-header-date (gnus-data-header d))))
8016 (setq is-younger (time-less-p
8017 (time-since (condition-case ()
8024 (push (gnus-data-number d) articles))))
8025 (gnus-summary-limit (nreverse articles)))
8026 (gnus-summary-position-point)))
8028 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8029 "Limit the summary buffer to articles that match an 'extra' header."
8033 (gnus-completing-read-with-default
8034 (symbol-name (car gnus-extra-headers))
8035 (if current-prefix-arg
8036 "Exclude extra header"
8037 "Limit extra header")
8039 (cons (symbol-name x) x))
8044 (read-string (format "%s header %s (regexp): "
8045 (if current-prefix-arg "Exclude" "Limit to")
8047 current-prefix-arg)))
8048 (when (not (equal "" regexp))
8050 (let ((articles (gnus-summary-find-matching
8051 (cons 'extra header) regexp 'all nil nil
8054 (error "Found no matches for \"%s\"" regexp))
8055 (gnus-summary-limit articles))
8056 (gnus-summary-position-point))))
8058 (defun gnus-summary-limit-to-display-predicate ()
8059 "Limit the summary buffer to the predicated in the `display' group parameter."
8061 (unless gnus-newsgroup-display
8062 (error "There is no `display' group parameter"))
8064 (dolist (number gnus-newsgroup-articles)
8065 (when (funcall gnus-newsgroup-display)
8066 (push number articles)))
8067 (gnus-summary-limit articles))
8068 (gnus-summary-position-point))
8070 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8072 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8074 (defun gnus-summary-limit-to-unread (&optional all)
8075 "Limit the summary buffer to articles that are not marked as read.
8076 If ALL is non-nil, limit strictly to unread articles."
8079 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8080 (gnus-summary-limit-to-marks
8081 ;; Concat all the marks that say that an article is read and have
8083 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8084 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8085 gnus-low-score-mark gnus-expirable-mark
8086 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8087 gnus-duplicate-mark gnus-souped-mark)
8090 (defun gnus-summary-limit-to-headers (match &optional reverse)
8091 "Limit the summary buffer to articles that have headers that match MATCH.
8092 If REVERSE (the prefix), limit to articles that don't match."
8093 (interactive "sMatch headers (regexp): \nP")
8094 (gnus-summary-limit-to-bodies match reverse t))
8096 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8097 "Limit the summary buffer to articles that have bodies that match MATCH.
8098 If REVERSE (the prefix), limit to articles that don't match."
8099 (interactive "sMatch body (regexp): \nP")
8100 (let ((articles nil)
8101 (gnus-select-article-hook nil) ;Disable hook.
8102 (gnus-article-prepare-hook nil)
8103 (gnus-use-article-prefetch nil)
8104 (gnus-keep-backlog nil)
8105 (gnus-break-pages nil)
8106 (gnus-summary-display-arrow nil)
8107 (gnus-updated-mode-lines nil)
8108 (gnus-auto-center-summary nil)
8109 (gnus-display-mime-function nil))
8110 (dolist (data gnus-newsgroup-data)
8111 (let (gnus-mark-article-hook)
8112 (gnus-summary-select-article t t nil (gnus-data-number data)))
8114 (set-buffer gnus-article-buffer)
8116 (let* ((case-fold-search t)
8118 (re-search-backward match nil t)
8119 (re-search-forward match nil t))))
8120 (when (or (and found
8124 (push (gnus-data-number data) articles)))))
8126 (message "No messages matched")
8127 (gnus-summary-limit articles)))
8128 (gnus-summary-position-point))
8130 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8131 "Limit the summary buffer to articles that aren't part on any thread.
8132 If THREADSP (the prefix), limit to articles that are in threads."
8134 (let ((articles nil)
8137 (dolist (thread gnus-newsgroup-threads)
8138 (if (stringp (car thread))
8139 (dolist (thread (cdr thread))
8140 (push thread threads))
8141 (push thread threads)))
8142 (dolist (thread threads)
8143 (setq thread-articles (gnus-articles-in-thread thread))
8144 (when (or (and threadsp
8145 (> (length thread-articles) 1))
8147 (= (length thread-articles) 1)))
8148 (setq articles (nconc thread-articles articles))))
8150 (message "No messages matched")
8151 (gnus-summary-limit articles))
8152 (gnus-summary-position-point)))
8154 (defun gnus-summary-limit-to-replied (&optional unreplied)
8155 "Limit the summary buffer to replied articles.
8156 If UNREPLIED (the prefix), limit to unreplied articles."
8160 (gnus-set-difference gnus-newsgroup-articles
8161 gnus-newsgroup-replied))
8162 (gnus-summary-limit gnus-newsgroup-replied))
8163 (gnus-summary-position-point))
8165 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8166 (make-obsolete 'gnus-summary-delete-marked-with
8167 'gnus-summary-limit-exclude-marks)
8169 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8170 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8171 If REVERSE, limit the summary buffer to articles that are marked
8172 with MARKS. MARKS can either be a string of marks or a list of marks.
8173 Returns how many articles were removed."
8174 (interactive "sMarks: ")
8175 (gnus-summary-limit-to-marks marks t))
8177 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8178 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8179 If REVERSE (the prefix), limit the summary buffer to articles that are
8180 not marked with MARKS. MARKS can either be a string of marks or a
8182 Returns how many articles were removed."
8183 (interactive "sMarks: \nP")
8185 (let ((data gnus-newsgroup-data)
8186 (marks (if (listp marks) marks
8187 (append marks nil))) ; Transform to list.
8190 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8191 (memq (gnus-data-mark (car data)) marks))
8192 (push (gnus-data-number (car data)) articles))
8193 (setq data (cdr data)))
8194 (gnus-summary-limit articles))
8195 (gnus-summary-position-point)))
8197 (defun gnus-summary-limit-to-score (score)
8198 "Limit to articles with score at or above SCORE."
8199 (interactive "NLimit to articles with score of at least: ")
8200 (let ((data gnus-newsgroup-data)
8203 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8205 (push (gnus-data-number (car data)) articles))
8206 (setq data (cdr data)))
8208 (gnus-summary-limit articles)
8209 (gnus-summary-position-point))))
8211 (defun gnus-summary-limit-to-unseen ()
8212 "Limit to unseen articles."
8215 (gnus-summary-limit gnus-newsgroup-unseen)
8216 (gnus-summary-position-point)))
8218 (defun gnus-summary-limit-include-thread (id)
8219 "Display all the hidden articles that is in the thread with ID in it.
8220 When called interactively, ID is the Message-ID of the current
8222 (interactive (list (mail-header-id (gnus-summary-article-header))))
8223 (let ((articles (gnus-articles-in-thread
8224 (gnus-id-to-thread (gnus-root-id id)))))
8226 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8227 (gnus-summary-limit-include-matching-articles
8229 (regexp-quote (gnus-simplify-subject-re
8230 (mail-header-subject (gnus-id-to-header id)))))
8231 (gnus-summary-position-point))))
8233 (defun gnus-summary-limit-include-matching-articles (header regexp)
8234 "Display all the hidden articles that have HEADERs that match REGEXP."
8235 (interactive (list (read-string "Match on header: ")
8236 (read-string "Regexp: ")))
8237 (let ((articles (gnus-find-matching-articles header regexp)))
8239 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8240 (gnus-summary-position-point))))
8242 (defun gnus-summary-insert-dormant-articles ()
8243 "Insert all the dormant articles for this group into the current buffer."
8245 (let ((gnus-verbose (max 6 gnus-verbose)))
8246 (if (not gnus-newsgroup-dormant)
8247 (gnus-message 3 "No dormant articles for this group")
8248 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8250 (defun gnus-summary-insert-ticked-articles ()
8251 "Insert ticked articles for this group into the current buffer."
8253 (let ((gnus-verbose (max 6 gnus-verbose)))
8254 (if (not gnus-newsgroup-marked)
8255 (gnus-message 3 "No ticked articles for this group")
8256 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8258 (defun gnus-summary-limit-include-dormant ()
8259 "Display all the hidden articles that are marked as dormant.
8260 Note that this command only works on a subset of the articles currently
8261 fetched for this group."
8263 (unless gnus-newsgroup-dormant
8264 (error "There are no dormant articles in this group"))
8266 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8267 (gnus-summary-position-point)))
8269 (defun gnus-summary-limit-exclude-dormant ()
8270 "Hide all dormant articles."
8273 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8274 (gnus-summary-position-point)))
8276 (defun gnus-summary-limit-exclude-childless-dormant ()
8277 "Hide all dormant articles that have no children."
8279 (let ((data (gnus-data-list t))
8280 articles d children)
8281 ;; Find all articles that are either not dormant or have
8283 (while (setq d (pop data))
8284 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8286 (gnus-article-children (gnus-data-number d)))
8289 (when (memq (car children) articles)
8294 (push (gnus-data-number d) articles)))
8297 (gnus-summary-limit articles)
8298 (gnus-summary-position-point))))
8300 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8301 "Mark all unread excluded articles as read.
8302 If ALL, mark even excluded ticked and dormants as read."
8304 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8305 (let ((articles (gnus-sorted-ndifference
8307 (mapcar (lambda (h) (mail-header-number h))
8308 gnus-newsgroup-headers)
8310 gnus-newsgroup-limit))
8312 (setq gnus-newsgroup-unreads
8313 (gnus-sorted-intersection gnus-newsgroup-unreads
8314 gnus-newsgroup-limit))
8316 (setq gnus-newsgroup-dormant nil
8317 gnus-newsgroup-marked nil
8318 gnus-newsgroup-reads
8320 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8321 gnus-newsgroup-reads))
8322 (while (setq article (pop articles))
8323 (unless (or (memq article gnus-newsgroup-dormant)
8324 (memq article gnus-newsgroup-marked))
8325 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8327 (defun gnus-summary-limit (articles &optional pop)
8329 ;; We pop the previous limit off the stack and use that.
8330 (setq articles (car gnus-newsgroup-limits)
8331 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8332 ;; We use the new limit, so we push the old limit on the stack.
8333 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8335 (setq gnus-newsgroup-limit articles)
8336 (let ((total (length gnus-newsgroup-data))
8337 (data (gnus-data-find-list (gnus-summary-article-number)))
8338 (gnus-summary-mark-below nil) ; Inhibit this.
8340 ;; This will do all the work of generating the new summary buffer
8341 ;; according to the new limit.
8342 (gnus-summary-prepare)
8343 ;; Hide any threads, possibly.
8344 (gnus-summary-maybe-hide-threads)
8345 ;; Try to return to the article you were at, or one in the
8348 ;; We try to find some article after the current one.
8350 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8353 (setq data (cdr data))))
8355 ;; If there is no data, that means that we were after the last
8356 ;; article. The same goes when we can't find any articles
8357 ;; after the current one.
8358 (goto-char (point-max))
8359 (gnus-summary-find-prev))
8360 (gnus-set-mode-line 'summary)
8361 ;; We return how many articles were removed from the summary
8362 ;; buffer as a result of the new limit.
8363 (- total (length gnus-newsgroup-data))))
8365 (defsubst gnus-invisible-cut-children (threads)
8368 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8373 (defsubst gnus-cut-thread (thread)
8374 "Go forwards in the thread until we find an article that we want to display."
8375 (when (or (eq gnus-fetch-old-headers 'some)
8376 (eq gnus-fetch-old-headers 'invisible)
8377 (numberp gnus-fetch-old-headers)
8378 (eq gnus-build-sparse-threads 'some)
8379 (eq gnus-build-sparse-threads 'more))
8380 ;; Deal with old-fetched headers and sparse threads.
8384 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8385 (gnus-summary-article-ancient-p
8386 (mail-header-number (car thread))))
8387 (if (or (<= (length (cdr thread)) 1)
8388 (eq gnus-fetch-old-headers 'invisible))
8389 (setq gnus-newsgroup-limit
8390 (delq (mail-header-number (car thread))
8391 gnus-newsgroup-limit)
8392 thread (cadr thread))
8393 (when (gnus-invisible-cut-children (cdr thread))
8394 (let ((th (cdr thread)))
8396 (if (memq (mail-header-number (caar th))
8397 gnus-newsgroup-limit)
8398 (setq thread (car th)
8400 (setq th (cdr th))))))))))
8403 (defun gnus-cut-threads (threads)
8404 "Cut off all uninteresting articles from the beginning of THREADS."
8405 (when (or (eq gnus-fetch-old-headers 'some)
8406 (eq gnus-fetch-old-headers 'invisible)
8407 (numberp gnus-fetch-old-headers)
8408 (eq gnus-build-sparse-threads 'some)
8409 (eq gnus-build-sparse-threads 'more))
8412 (setcar th (gnus-cut-thread (car th)))
8413 (setq th (cdr th)))))
8414 ;; Remove nixed out threads.
8417 (defun gnus-summary-initial-limit (&optional show-if-empty)
8418 "Figure out what the initial limit is supposed to be on group entry.
8419 This entails weeding out unwanted dormants, low-scored articles,
8420 fetch-old-headers verbiage, and so on."
8421 ;; Most groups have nothing to remove.
8422 (if (or gnus-inhibit-limiting
8423 (and (null gnus-newsgroup-dormant)
8424 (eq gnus-newsgroup-display 'gnus-not-ignore)
8425 (not (eq gnus-fetch-old-headers 'some))
8426 (not (numberp gnus-fetch-old-headers))
8427 (not (eq gnus-fetch-old-headers 'invisible))
8428 (null gnus-summary-expunge-below)
8429 (not (eq gnus-build-sparse-threads 'some))
8430 (not (eq gnus-build-sparse-threads 'more))
8431 (null gnus-thread-expunge-below)
8432 (not gnus-use-nocem)))
8434 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8435 (setq gnus-newsgroup-limit nil)
8438 (unless (car (symbol-value node))
8439 ;; These threads have no parents -- they are roots.
8440 (let ((nodes (cdr (symbol-value node)))
8443 (if (and gnus-thread-expunge-below
8444 (< (gnus-thread-total-score (car nodes))
8445 gnus-thread-expunge-below))
8446 (gnus-expunge-thread (pop nodes))
8447 (setq thread (pop nodes))
8448 (gnus-summary-limit-children thread))))))
8449 gnus-newsgroup-dependencies)
8450 ;; If this limitation resulted in an empty group, we might
8451 ;; pop the previous limit and use it instead.
8452 (when (and (not gnus-newsgroup-limit)
8454 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8455 gnus-newsgroup-limit))
8457 (defun gnus-summary-limit-children (thread)
8458 "Return 1 if this subthread is visible and 0 if it is not."
8459 ;; First we get the number of visible children to this thread. This
8460 ;; is done by recursing down the thread using this function, so this
8461 ;; will really go down to a leaf article first, before slowly
8462 ;; working its way up towards the root.
8464 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8467 (apply '+ (mapcar 'gnus-summary-limit-children
8470 (number (mail-header-number (car thread)))
8473 (not (memq number gnus-newsgroup-marked))
8475 ;; If this article is dormant and has absolutely no visible
8476 ;; children, then this article isn't visible.
8477 (and (memq number gnus-newsgroup-dormant)
8479 ;; If this is "fetch-old-headered" and there is no
8480 ;; visible children, then we don't want this article.
8481 (and (or (eq gnus-fetch-old-headers 'some)
8482 (numberp gnus-fetch-old-headers))
8483 (gnus-summary-article-ancient-p number)
8485 ;; If this is "fetch-old-headered" and `invisible', then
8486 ;; we don't want this article.
8487 (and (eq gnus-fetch-old-headers 'invisible)
8488 (gnus-summary-article-ancient-p number))
8489 ;; If this is a sparsely inserted article with no children,
8490 ;; we don't want it.
8491 (and (eq gnus-build-sparse-threads 'some)
8492 (gnus-summary-article-sparse-p number)
8494 ;; If we use expunging, and this article is really
8495 ;; low-scored, then we don't want this article.
8496 (when (and gnus-summary-expunge-below
8498 (or (cdr (assq number gnus-newsgroup-scored))
8499 gnus-summary-default-score))
8500 gnus-summary-expunge-below))
8501 ;; We increase the expunge-tally here, but that has
8502 ;; nothing to do with the limits, really.
8503 (incf gnus-newsgroup-expunged-tally)
8504 ;; We also mark as read here, if that's wanted.
8505 (when (and gnus-summary-mark-below
8506 (< score gnus-summary-mark-below))
8507 (setq gnus-newsgroup-unreads
8508 (delq number gnus-newsgroup-unreads))
8509 (if gnus-newsgroup-auto-expire
8510 (push number gnus-newsgroup-expirable)
8511 (push (cons number gnus-low-score-mark)
8512 gnus-newsgroup-reads)))
8514 ;; Do the `display' group parameter.
8515 (and gnus-newsgroup-display
8516 (not (funcall gnus-newsgroup-display)))
8517 ;; Check NoCeM things.
8518 (when (and gnus-use-nocem
8519 (gnus-nocem-unwanted-article-p
8520 (mail-header-id (car thread))))
8521 (setq gnus-newsgroup-unreads
8522 (delq number gnus-newsgroup-unreads))
8524 ;; Nope, invisible article.
8526 ;; Ok, this article is to be visible, so we add it to the limit
8528 (push number gnus-newsgroup-limit)
8531 (defun gnus-expunge-thread (thread)
8532 "Mark all articles in THREAD as read."
8533 (let* ((number (mail-header-number (car thread))))
8534 (incf gnus-newsgroup-expunged-tally)
8535 ;; We also mark as read here, if that's wanted.
8536 (setq gnus-newsgroup-unreads
8537 (delq number gnus-newsgroup-unreads))
8538 (if gnus-newsgroup-auto-expire
8539 (push number gnus-newsgroup-expirable)
8540 (push (cons number gnus-low-score-mark)
8541 gnus-newsgroup-reads)))
8542 ;; Go recursively through all subthreads.
8543 (mapcar 'gnus-expunge-thread (cdr thread)))
8545 ;; Summary article oriented commands
8547 (defun gnus-summary-refer-parent-article (n)
8548 "Refer parent article N times.
8549 If N is negative, go to ancestor -N instead.
8550 The difference between N and the number of articles fetched is returned."
8554 (when (not (natnump n))
8559 (setq header (gnus-summary-article-header))
8560 (if (and (eq (mail-header-number header)
8561 (cdr gnus-article-current))
8562 (equal gnus-newsgroup-name
8563 (car gnus-article-current)))
8564 ;; If we try to find the parent of the currently
8565 ;; displayed article, then we take a look at the actual
8566 ;; References header, since this is slightly more
8567 ;; reliable than the References field we got from the
8570 (set-buffer gnus-original-article-buffer)
8571 (nnheader-narrow-to-headers)
8572 (unless (setq ref (message-fetch-field "references"))
8573 (when (setq ref (message-fetch-field "in-reply-to"))
8574 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8577 ;; It's not the current article, so we take a bet on
8578 ;; the value we got from the server.
8579 (mail-header-references header)))
8581 (not (equal ref "")))
8582 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8583 (gnus-message 1 "Couldn't find parent"))
8584 (gnus-message 1 "No references in article %d"
8585 (gnus-summary-article-number))
8588 (gnus-summary-position-point)
8591 (defun gnus-summary-refer-references ()
8592 "Fetch all articles mentioned in the References header.
8593 Return the number of articles fetched."
8595 (let ((ref (mail-header-references (gnus-summary-article-header)))
8596 (current (gnus-summary-article-number))
8600 (error "No References in the current article")
8601 ;; For each Message-ID in the References header...
8602 (while (string-match "<[^>]*>" ref)
8604 ;; ... fetch that article.
8605 (gnus-summary-refer-article
8606 (prog1 (match-string 0 ref)
8607 (setq ref (substring ref (match-end 0))))))
8608 (gnus-summary-goto-subject current)
8609 (gnus-summary-position-point)
8612 (defun gnus-summary-refer-thread (&optional limit)
8613 "Fetch all articles in the current thread.
8614 If LIMIT (the numerical prefix), fetch that many old headers instead
8615 of what's specified by the `gnus-refer-thread-limit' variable."
8617 (let ((id (mail-header-id (gnus-summary-article-header)))
8618 (limit (if limit (prefix-numeric-value limit)
8619 gnus-refer-thread-limit)))
8620 (unless (eq gnus-fetch-old-headers 'invisible)
8621 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8622 ;; Retrieve the headers and read them in.
8623 (if (eq (if (numberp limit)
8624 (gnus-retrieve-headers
8626 (+ (mail-header-number
8627 (gnus-summary-article-header))
8629 gnus-newsgroup-end))
8630 gnus-newsgroup-name (* limit 2))
8631 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8633 (gnus-retrieve-headers (list gnus-newsgroup-end)
8634 gnus-newsgroup-name limit))
8636 (gnus-build-all-threads)
8637 (error "Can't fetch thread from back ends that don't support NOV"))
8638 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8639 (gnus-summary-limit-include-thread id)))
8641 (defun gnus-summary-refer-article (message-id)
8642 "Fetch an article specified by MESSAGE-ID."
8643 (interactive "sMessage-ID: ")
8644 (when (and (stringp message-id)
8645 (not (zerop (length message-id))))
8646 (setq message-id (gnus-replace-in-string message-id " " ""))
8647 ;; Construct the correct Message-ID if necessary.
8648 ;; Suggested by tale@pawl.rpi.edu.
8649 (unless (string-match "^<" message-id)
8650 (setq message-id (concat "<" message-id)))
8651 (unless (string-match ">$" message-id)
8652 (setq message-id (concat message-id ">")))
8653 ;; People often post MIDs from URLs, so unhex it:
8654 (unless (string-match "@" message-id)
8655 (setq message-id (gnus-url-unhex-string message-id)))
8656 (let* ((header (gnus-id-to-header message-id))
8658 (gnus-summary-article-sparse-p
8659 (mail-header-number header))
8660 (memq (mail-header-number header)
8661 gnus-newsgroup-limit)))
8664 ;; If the article is present in the buffer we just go to it.
8666 (or (not (gnus-summary-article-sparse-p
8667 (mail-header-number header)))
8670 (gnus-summary-goto-article
8671 (mail-header-number header) nil t)
8673 (gnus-summary-update-article (mail-header-number header)))))
8675 ;; We fetch the article.
8677 (dolist (gnus-override-method (gnus-refer-article-methods))
8678 (when (and (gnus-check-server gnus-override-method)
8679 ;; Fetch the header,
8680 (setq number (gnus-summary-insert-subject message-id)))
8681 ;; and display the article.
8682 (gnus-summary-select-article nil nil nil number)
8684 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8686 (defun gnus-refer-article-methods ()
8687 "Return a list of referable methods."
8689 ;; No method, so we default to current and native.
8690 ((null gnus-refer-article-method)
8691 (list gnus-current-select-method gnus-select-method))
8693 ((eq 'current gnus-refer-article-method)
8694 (list gnus-current-select-method))
8695 ;; List of select methods.
8696 ((not (and (symbolp (car gnus-refer-article-method))
8697 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8699 (dolist (method gnus-refer-article-method)
8700 (push (if (eq 'current method)
8701 gnus-current-select-method
8705 ;; One single select method.
8707 (list gnus-refer-article-method))))
8709 (defun gnus-summary-edit-parameters ()
8710 "Edit the group parameters of the current group."
8712 (gnus-group-edit-group gnus-newsgroup-name 'params))
8714 (defun gnus-summary-customize-parameters ()
8715 "Customize the group parameters of the current group."
8717 (gnus-group-customize gnus-newsgroup-name))
8719 (defun gnus-summary-enter-digest-group (&optional force)
8720 "Enter an nndoc group based on the current article.
8721 If FORCE, force a digest interpretation. If not, try
8722 to guess what the document format is."
8724 (let ((conf gnus-current-window-configuration))
8725 (save-window-excursion
8727 (let (gnus-article-prepare-hook
8728 gnus-display-mime-function
8730 (gnus-summary-select-article))))
8731 (setq gnus-current-window-configuration conf)
8732 (let* ((name (format "%s-%d"
8733 (gnus-group-prefixed-name
8734 gnus-newsgroup-name (list 'nndoc ""))
8735 (with-current-buffer gnus-summary-buffer
8736 gnus-current-article)))
8737 (ogroup gnus-newsgroup-name)
8738 (params (append (gnus-info-params (gnus-get-info ogroup))
8739 (list (cons 'to-group ogroup))
8740 (list (cons 'parent-group ogroup))
8741 (list (cons 'save-article-group ogroup))))
8742 (case-fold-search t)
8743 (buf (current-buffer))
8746 (set-buffer gnus-original-article-buffer)
8747 ;; Have the digest group inherit the main mail address of
8748 ;; the parent article.
8749 (when (setq to-address (or (gnus-fetch-field "reply-to")
8750 (gnus-fetch-field "from")))
8753 (list (cons 'to-address
8754 (funcall gnus-decode-encoded-address-function
8756 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8757 (insert-buffer-substring gnus-original-article-buffer)
8758 ;; Remove lines that may lead nndoc to misinterpret the
8761 (goto-char (point-min))
8762 (or (search-forward "\n\n" nil t) (point)))
8763 (goto-char (point-min))
8764 (delete-matching-lines "^Path:\\|^From ")
8767 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8768 (gnus-newsgroup-ephemeral-ignored-charsets
8769 gnus-newsgroup-ignored-charsets))
8770 (gnus-group-read-ephemeral-group
8771 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8773 ,(if force 'mbox 'guess)))
8775 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8777 ;; Make all postings to this group go to the parent group.
8778 (nconc (gnus-info-params (gnus-get-info name))
8780 ;; Couldn't select this doc group.
8781 (switch-to-buffer buf)
8782 (gnus-set-global-variables)
8783 (gnus-configure-windows 'summary)
8784 (gnus-message 3 "Article couldn't be entered?"))
8785 (kill-buffer dig)))))
8787 (defun gnus-summary-read-document (n)
8788 "Open a new group based on the current article(s).
8789 This will allow you to read digests and other similar
8790 documents as newsgroups.
8791 Obeys the standard process/prefix convention."
8793 (let* ((ogroup gnus-newsgroup-name)
8794 (params (append (gnus-info-params (gnus-get-info ogroup))
8795 (list (cons 'to-group ogroup))))
8796 group egroup groups vgroup)
8797 (dolist (article (gnus-summary-work-articles n))
8798 (setq group (format "%s-%d" gnus-newsgroup-name article))
8799 (gnus-summary-remove-process-mark article)
8800 (when (gnus-summary-display-article article)
8803 (insert-buffer-substring gnus-original-article-buffer)
8804 ;; Remove some headers that may lead nndoc to make
8806 (message-narrow-to-head)
8807 (goto-char (point-min))
8808 (delete-matching-lines "^Path:\\|^From ")
8811 (gnus-group-read-ephemeral-group
8812 group `(nndoc ,group (nndoc-address ,(current-buffer))
8813 (nndoc-article-type guess))
8816 ;; Make all postings to this group go to the parent group.
8817 (nconc (gnus-info-params (gnus-get-info egroup))
8819 (push egroup groups))
8820 ;; Couldn't select this doc group.
8821 (gnus-error 3 "Article couldn't be entered"))))))
8822 ;; Now we have selected all the documents.
8825 (error "None of the articles could be interpreted as documents"))
8826 ((gnus-group-read-ephemeral-group
8827 (setq vgroup (format
8828 "nnvirtual:%s-%s" gnus-newsgroup-name
8829 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8830 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8832 (cons (current-buffer) 'summary)))
8834 (error "Couldn't select virtual nndoc group")))))
8836 (defun gnus-summary-isearch-article (&optional regexp-p)
8837 "Do incremental search forward on the current article.
8838 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8840 (gnus-summary-select-article)
8841 (gnus-configure-windows 'article)
8842 (gnus-eval-in-buffer-window gnus-article-buffer
8845 (isearch-forward regexp-p))))
8847 (defun gnus-summary-repeat-search-article-forward ()
8848 "Repeat the previous search forwards."
8850 (unless gnus-last-search-regexp
8851 (error "No previous search"))
8852 (gnus-summary-search-article-forward gnus-last-search-regexp))
8854 (defun gnus-summary-repeat-search-article-backward ()
8855 "Repeat the previous search backwards."
8857 (unless gnus-last-search-regexp
8858 (error "No previous search"))
8859 (gnus-summary-search-article-forward gnus-last-search-regexp t))
8861 (defun gnus-summary-search-article-forward (regexp &optional backward)
8862 "Search for an article containing REGEXP forward.
8863 If BACKWARD, search backward instead."
8866 (format "Search article %s (regexp%s): "
8867 (if current-prefix-arg "backward" "forward")
8868 (if gnus-last-search-regexp
8869 (concat ", default " gnus-last-search-regexp)
8871 current-prefix-arg))
8872 (if (string-equal regexp "")
8873 (setq regexp (or gnus-last-search-regexp ""))
8874 (setq gnus-last-search-regexp regexp)
8875 (setq gnus-article-before-search gnus-current-article))
8876 ;; Intentionally set gnus-last-article.
8877 (setq gnus-last-article gnus-article-before-search)
8878 (let ((gnus-last-article gnus-last-article))
8879 (if (gnus-summary-search-article regexp backward)
8880 (gnus-summary-show-thread)
8881 (signal 'search-failed (list regexp)))))
8883 (defun gnus-summary-search-article-backward (regexp)
8884 "Search for an article containing REGEXP backward."
8887 (format "Search article backward (regexp%s): "
8888 (if gnus-last-search-regexp
8889 (concat ", default " gnus-last-search-regexp)
8891 (gnus-summary-search-article-forward regexp 'backward))
8893 (defun gnus-summary-search-article (regexp &optional backward)
8894 "Search for an article containing REGEXP.
8895 Optional argument BACKWARD means do search for backward.
8896 `gnus-select-article-hook' is not called during the search."
8897 ;; We have to require this here to make sure that the following
8898 ;; dynamic binding isn't shadowed by autoloading.
8899 (require 'gnus-async)
8901 (let ((gnus-select-article-hook nil) ;Disable hook.
8902 (gnus-article-prepare-hook nil)
8903 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8904 (gnus-use-article-prefetch nil)
8905 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8906 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8908 (gnus-keep-backlog nil)
8909 (gnus-break-pages nil)
8910 (gnus-summary-display-arrow nil)
8911 (gnus-updated-mode-lines nil)
8912 (gnus-auto-center-summary nil)
8913 (sum (current-buffer))
8914 (gnus-display-mime-function nil)
8917 (gnus-save-hidden-threads
8918 (gnus-summary-select-article)
8919 (set-buffer gnus-article-buffer)
8920 (goto-char (window-point (get-buffer-window (current-buffer))))
8924 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8926 (re-search-backward regexp nil t)
8927 (re-search-forward regexp nil t))
8928 ;; We found the regexp.
8933 (get-buffer-window (current-buffer))
8937 (get-buffer-window (current-buffer))
8940 (setq point (point)))
8941 ;; We didn't find it, so we go to the next article.
8944 (while (eq found 'not)
8945 (if (not (if backward (gnus-summary-find-prev)
8946 (gnus-summary-find-next)))
8947 ;; No more articles.
8949 ;; Select the next article and adjust point.
8950 (unless (gnus-summary-article-sparse-p
8951 (gnus-summary-article-number))
8953 (gnus-summary-select-article)
8954 (set-buffer gnus-article-buffer)
8956 (goto-char (if backward (point-max) (point-min))))))))
8957 (gnus-message 7 ""))
8958 ;; Return whether we found the regexp.
8959 (when (eq found 'found)
8961 (gnus-summary-show-thread)
8962 (gnus-summary-goto-subject gnus-current-article)
8963 (gnus-summary-position-point)
8966 (defun gnus-find-matching-articles (header regexp)
8967 "Return a list of all articles that match REGEXP on HEADER.
8968 This search includes all articles in the current group that Gnus has
8969 fetched headers for, whether they are displayed or not."
8970 (let ((articles nil)
8971 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8972 (case-fold-search t))
8973 (dolist (header gnus-newsgroup-headers)
8974 (when (string-match regexp (funcall func header))
8975 (push (mail-header-number header) articles)))
8976 (nreverse articles)))
8978 (defun gnus-summary-find-matching (header regexp &optional backward unread
8979 not-case-fold not-matching)
8980 "Return a list of all articles that match REGEXP on HEADER.
8981 The search stars on the current article and goes forwards unless
8982 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8983 If UNREAD is non-nil, only unread articles will
8984 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8985 in the comparisons. If NOT-MATCHING, return a list of all articles that
8986 not match REGEXP on HEADER."
8987 (let ((case-fold-search (not not-case-fold))
8990 (if (eq (car header) 'extra)
8993 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8995 (error "%s is an invalid header" header))
8996 (unless (fboundp (intern (concat "mail-header-" header)))
8997 (error "%s is not a valid header" header))
8998 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8999 (dolist (d (if (eq backward 'all)
9001 (gnus-data-find-list
9002 (gnus-summary-article-number)
9003 (gnus-data-list backward))))
9004 (when (and (or (not unread) ; We want all articles...
9005 (gnus-data-unread-p d)) ; Or just unreads.
9006 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9010 (funcall func (gnus-data-header d))))
9011 (string-match regexp
9012 (funcall func (gnus-data-header d)))))
9013 (push (gnus-data-number d) articles))) ; Success!
9014 (nreverse articles)))
9016 (defun gnus-summary-execute-command (header regexp command &optional backward)
9017 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9018 If HEADER is an empty string (or nil), the match is done on the entire
9019 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9021 (list (let ((completion-ignore-case t))
9024 (mapcar (lambda (header) (list (format "%s" header)))
9026 '("Number" "Subject" "From" "Lines" "Date"
9027 "Message-ID" "Xref" "References" "Body")
9028 gnus-extra-headers))
9029 nil 'require-match))
9030 (read-string "Regexp: ")
9031 (read-key-sequence "Command: ")
9032 current-prefix-arg))
9033 (when (equal header "Body")
9035 ;; Hidden thread subtrees must be searched as well.
9036 (gnus-summary-show-all-threads)
9037 ;; We don't want to change current point nor window configuration.
9039 (save-window-excursion
9041 gnus-treat-strip-trailing-blank-lines
9042 gnus-treat-strip-leading-blank-lines
9043 gnus-treat-strip-multiple-blank-lines
9044 gnus-treat-hide-boring-headers
9045 gnus-treat-fold-newsgroups
9046 gnus-article-prepare-hook)
9047 (gnus-message 6 "Executing %s..." (key-description command))
9048 ;; We'd like to execute COMMAND interactively so as to give arguments.
9049 (gnus-execute header regexp
9050 `(call-interactively ',(key-binding command))
9052 (gnus-message 6 "Executing %s...done" (key-description command))))))
9054 (defun gnus-summary-beginning-of-article ()
9055 "Scroll the article back to the beginning."
9057 (gnus-summary-select-article)
9058 (gnus-configure-windows 'article)
9059 (gnus-eval-in-buffer-window gnus-article-buffer
9061 (goto-char (point-min))
9062 (when gnus-break-pages
9063 (gnus-narrow-to-page))))
9065 (defun gnus-summary-end-of-article ()
9066 "Scroll to the end of the article."
9068 (gnus-summary-select-article)
9069 (gnus-configure-windows 'article)
9070 (gnus-eval-in-buffer-window gnus-article-buffer
9072 (goto-char (point-max))
9074 (when gnus-break-pages
9075 (when (re-search-backward page-delimiter nil t)
9076 (narrow-to-region (match-end 0) (point-max)))
9077 (gnus-narrow-to-page))))
9079 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9080 "Truncate to LEN and quote all \"(\"'s in STRING."
9081 (gnus-replace-in-string (if (and len (> (length string) len))
9082 (substring string 0 len)
9086 (defun gnus-summary-print-article (&optional filename n)
9087 "Generate and print a PostScript image of the process-marked (mail) articles.
9089 If used interactively, print the current article if none are
9090 process-marked. With prefix arg, prompt the user for the name of the
9093 When used from Lisp, accept two optional args FILENAME and N. N means
9094 to print the next N articles. If N is negative, print the N previous
9095 articles. If N is nil and articles have been marked with the process
9096 mark, print these instead.
9098 If the optional first argument FILENAME is nil, send the image to the
9099 printer. If FILENAME is a string, save the PostScript image in a file with
9100 that name. If FILENAME is a number, prompt the user for the name of the file
9102 (interactive (list (ps-print-preprint current-prefix-arg)))
9103 (dolist (article (gnus-summary-work-articles n))
9104 (gnus-summary-select-article nil nil 'pseudo article)
9105 (gnus-eval-in-buffer-window gnus-article-buffer
9106 (gnus-print-buffer))
9107 (gnus-summary-remove-process-mark article))
9108 (ps-despool filename))
9110 (defun gnus-print-buffer ()
9111 (let ((buffer (generate-new-buffer " *print*")))
9114 (copy-to-buffer buffer (point-min) (point-max))
9116 (gnus-remove-text-with-property 'gnus-decoration)
9117 (when (gnus-visual-p 'article-highlight 'highlight)
9118 ;; Copy-to-buffer doesn't copy overlay. So redo
9120 (let ((gnus-article-buffer buffer))
9121 (gnus-article-highlight-citation t)
9122 (gnus-article-highlight-signature)
9123 (gnus-article-emphasize)
9124 (gnus-article-delete-invisible-text)))
9125 (let ((ps-left-header
9128 (gnus-summary-print-truncate-and-quote
9129 (mail-header-subject gnus-current-headers)
9132 (gnus-summary-print-truncate-and-quote
9133 (mail-header-from gnus-current-headers)
9137 "/pagenumberstring load"
9139 (mail-header-date gnus-current-headers) ")"))))
9140 (gnus-run-hooks 'gnus-ps-print-hook)
9143 (ps-spool-buffer-with-faces)
9144 (ps-spool-buffer)))))
9145 (kill-buffer buffer))))
9147 (defun gnus-summary-show-article (&optional arg)
9148 "Force redisplaying of the current article.
9149 If ARG (the prefix) is a number, show the article with the charset
9150 defined in `gnus-summary-show-article-charset-alist', or the charset
9152 If ARG (the prefix) is non-nil and not a number, show the raw article
9153 without any article massaging functions being run. Normally, the key
9154 strokes are `C-u g'."
9158 (gnus-summary-show-article t)
9159 (let ((gnus-newsgroup-charset
9160 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9161 (mm-read-coding-system
9162 "View as charset: " ;; actually it is coding system.
9163 (with-current-buffer gnus-article-buffer
9164 (mm-detect-coding-region (point) (point-max))))))
9165 (gnus-newsgroup-ignored-charsets 'gnus-all))
9166 (gnus-summary-select-article nil 'force)
9167 (let ((deps gnus-newsgroup-dependencies)
9170 (set-buffer gnus-original-article-buffer)
9172 (message-narrow-to-head)
9173 (setq head (buffer-string))
9174 (goto-char (point-min))
9175 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9176 (goto-char (point-max))
9178 (setq lines (1- (count-lines (point) (point-max))))))
9180 (insert (format "211 %d Article retrieved.\n"
9181 (cdr gnus-article-current)))
9183 (if lines (insert (format "Lines: %d\n" lines)))
9185 (let ((nntp-server-buffer (current-buffer)))
9186 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9187 (gnus-data-set-header
9188 (gnus-data-find (cdr gnus-article-current))
9190 (gnus-summary-update-article-line
9191 (cdr gnus-article-current) header)
9192 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9193 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9195 ;; Select the article the normal way.
9196 (gnus-summary-select-article nil 'force))
9198 ;; We have to require this here to make sure that the following
9199 ;; dynamic binding isn't shadowed by autoloading.
9200 (require 'gnus-async)
9202 ;; Bind the article treatment functions to nil.
9203 (let ((gnus-have-all-headers t)
9204 gnus-article-prepare-hook
9205 gnus-article-decode-hook
9206 gnus-display-mime-function
9208 ;; Destroy any MIME parts.
9209 (when (gnus-buffer-live-p gnus-article-buffer)
9211 (set-buffer gnus-article-buffer)
9212 (mm-destroy-parts gnus-article-mime-handles)
9213 ;; Set it to nil for safety reason.
9214 (setq gnus-article-mime-handle-alist nil)
9215 (setq gnus-article-mime-handles nil)))
9216 (gnus-summary-select-article nil 'force))))
9217 (gnus-summary-goto-subject gnus-current-article)
9218 (gnus-summary-position-point))
9220 (defun gnus-summary-show-raw-article ()
9221 "Show the raw article without any article massaging functions being run."
9223 (gnus-summary-show-article t))
9225 (defun gnus-summary-verbose-headers (&optional arg)
9226 "Toggle permanent full header display.
9227 If ARG is a positive number, turn header display on.
9228 If ARG is a negative number, turn header display off."
9230 (setq gnus-show-all-headers
9231 (cond ((or (not (numberp arg))
9233 (not gnus-show-all-headers))
9236 (gnus-summary-show-article))
9238 (defun gnus-summary-toggle-header (&optional arg)
9239 "Show the headers if they are hidden, or hide them if they are shown.
9240 If ARG is a positive number, show the entire header.
9241 If ARG is a negative number, hide the unwanted header lines."
9243 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9244 (get-buffer-window gnus-article-buffer t))))
9245 (with-current-buffer gnus-article-buffer
9247 (article-narrow-to-head)
9248 (let* ((buffer-read-only nil)
9249 (inhibit-point-motion-hooks t)
9250 (hidden (if (numberp arg)
9252 (or (not (looking-at "[^ \t\n]+:"))
9253 (gnus-article-hidden-text-p 'headers))))
9255 (delete-region (point-min) (point-max))
9256 (with-current-buffer gnus-original-article-buffer
9257 (goto-char (setq s (point-min)))
9258 (setq e (if (search-forward "\n\n" nil t)
9261 (insert-buffer-substring gnus-original-article-buffer s e)
9262 (run-hooks 'gnus-article-decode-hook)
9264 (let ((gnus-treat-hide-headers nil)
9265 (gnus-treat-hide-boring-headers nil))
9266 (gnus-delete-wash-type 'headers)
9267 (gnus-treat-article 'head))
9268 (gnus-treat-article 'head))
9271 (set-window-start window (goto-char (point-min))))
9272 (if gnus-break-pages
9273 (gnus-narrow-to-page)
9274 (when (gnus-visual-p 'page-marker)
9275 (let ((buffer-read-only nil))
9276 (gnus-remove-text-with-property 'gnus-prev)
9277 (gnus-remove-text-with-property 'gnus-next))))
9278 (gnus-set-mode-line 'article)))))
9280 (defun gnus-summary-show-all-headers ()
9281 "Make all header lines visible."
9283 (gnus-summary-toggle-header 1))
9285 (defun gnus-summary-caesar-message (&optional arg)
9286 "Caesar rotate the current article by 13.
9287 With a non-numerical prefix, also rotate headers. A numerical
9288 prefix specifies how many places to rotate each letter forward."
9290 (gnus-summary-select-article)
9291 (let ((mail-header-separator ""))
9292 (gnus-eval-in-buffer-window gnus-article-buffer
9295 (let ((start (window-start))
9297 (if (equal arg '(4))
9298 (message-caesar-buffer-body nil t)
9299 (message-caesar-buffer-body arg))
9300 (set-window-start (get-buffer-window (current-buffer)) start)))))
9301 ;; Create buttons and stuff...
9302 (gnus-treat-article nil))
9304 (defun gnus-summary-idna-message (&optional arg)
9305 "Decode IDNA encoded domain names in the current articles.
9306 IDNA encoded domain names looks like `xn--bar'. If a string
9307 remain unencoded after running this function, it is likely an
9308 invalid IDNA string (`xn--bar' is invalid).
9310 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9311 installed for this command to work."
9313 (if (not (and (condition-case nil (require 'idna)
9315 (mm-coding-system-p 'utf-8)
9316 (executable-find (symbol-value 'idna-program))))
9318 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9319 (gnus-summary-select-article)
9320 (let ((mail-header-separator ""))
9321 (gnus-eval-in-buffer-window gnus-article-buffer
9324 (let ((start (window-start))
9326 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9327 (replace-match (idna-to-unicode (match-string 1))))
9328 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9330 (defun gnus-summary-morse-message (&optional arg)
9331 "Morse decode the current article."
9333 (gnus-summary-select-article)
9334 (let ((mail-header-separator ""))
9335 (gnus-eval-in-buffer-window gnus-article-buffer
9339 (let ((pos (window-start))
9341 (goto-char (point-min))
9342 (when (message-goto-body)
9343 (gnus-narrow-to-body))
9344 (goto-char (point-min))
9345 (while (search-forward "·" (point-max) t)
9346 (replace-match "."))
9347 (unmorse-region (point-min) (point-max))
9349 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9351 (defun gnus-summary-stop-page-breaking ()
9352 "Stop page breaking in the current article."
9354 (gnus-summary-select-article)
9355 (gnus-eval-in-buffer-window gnus-article-buffer
9357 (when (gnus-visual-p 'page-marker)
9358 (let ((buffer-read-only nil))
9359 (gnus-remove-text-with-property 'gnus-prev)
9360 (gnus-remove-text-with-property 'gnus-next))
9361 (setq gnus-page-broken nil))))
9363 (defun gnus-summary-move-article (&optional n to-newsgroup
9364 select-method action)
9365 "Move the current article to a different newsgroup.
9366 If N is a positive number, move the N next articles.
9367 If N is a negative number, move the N previous articles.
9368 If N is nil and any articles have been marked with the process mark,
9369 move those articles instead.
9370 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9371 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9372 re-spool using this method.
9374 When called interactively with TO-NEWSGROUP being nil, the value of
9375 the variable `gnus-move-split-methods' is used for finding a default
9376 for the target newsgroup.
9378 For this function to work, both the current newsgroup and the
9379 newsgroup that you want to move to have to support the `request-move'
9380 and `request-accept' functions.
9382 ACTION can be either `move' (the default), `crosspost' or `copy'."
9385 (setq action 'move))
9386 ;; Check whether the source group supports the required functions.
9387 (cond ((and (eq action 'move)
9388 (not (gnus-check-backend-function
9389 'request-move-article gnus-newsgroup-name)))
9390 (error "The current group does not support article moving"))
9391 ((and (eq action 'crosspost)
9392 (not (gnus-check-backend-function
9393 'request-replace-article gnus-newsgroup-name)))
9394 (error "The current group does not support article editing")))
9395 (let ((articles (gnus-summary-work-articles n))
9396 (prefix (if (gnus-check-backend-function
9397 'request-move-article gnus-newsgroup-name)
9398 (funcall gnus-move-group-prefix-function
9399 gnus-newsgroup-name)
9401 (names '((move "Move" "Moving")
9402 (copy "Copy" "Copying")
9403 (crosspost "Crosspost" "Crossposting")))
9404 (copy-buf (save-excursion
9405 (nnheader-set-temp-buffer " *copy article*")))
9406 art-group to-method new-xref article to-groups articles-to-update-marks)
9407 (unless (assq action names)
9408 (error "Unknown action %s" action))
9409 ;; Read the newsgroup name.
9410 (when (and (not to-newsgroup)
9411 (not select-method))
9412 (if (and gnus-move-split-methods
9414 (and (memq gnus-current-article articles)
9415 (gnus-buffer-live-p gnus-original-article-buffer))))
9416 ;; When `gnus-move-split-methods' is non-nil, we have to
9417 ;; select an article to give `gnus-read-move-group-name' an
9418 ;; opportunity to suggest an appropriate default. However,
9419 ;; we needn't render or mark the article.
9420 (let ((gnus-display-mime-function nil)
9421 (gnus-article-prepare-hook nil)
9422 (gnus-mark-article-hook nil))
9423 (gnus-summary-select-article nil nil nil (car articles))))
9425 (gnus-read-move-group-name
9426 (cadr (assq action names))
9427 (symbol-value (intern (format "gnus-current-%s-group" action)))
9429 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9430 (setq to-method (or select-method
9431 (gnus-server-to-method
9432 (gnus-group-method to-newsgroup))))
9433 ;; Check the method we are to move this article to...
9434 (unless (gnus-check-backend-function
9435 'request-accept-article (car to-method))
9436 (error "%s does not support article copying" (car to-method)))
9437 (unless (gnus-check-server to-method)
9438 (error "Can't open server %s" (car to-method)))
9439 (gnus-message 6 "%s to %s: %s..."
9440 (caddr (assq action names))
9441 (or (car select-method) to-newsgroup) articles)
9443 (setq article (pop articles))
9447 ;; Move the article.
9449 ;; Remove this article from future suppression.
9450 (gnus-dup-unsuppress-article article)
9451 (let* ((from-method (gnus-find-method-for-group
9452 gnus-newsgroup-name))
9453 (to-method (gnus-find-method-for-group
9455 (move-is-internal (gnus-method-equal from-method to-method)))
9456 (gnus-request-move-article
9457 article ; Article to move
9458 gnus-newsgroup-name ; From newsgroup
9459 (nth 1 (gnus-find-method-for-group
9460 gnus-newsgroup-name)) ; Server
9461 (list 'gnus-request-accept-article
9462 to-newsgroup (list 'quote select-method)
9463 (not articles) t) ; Accept form
9464 (not articles) ; Only save nov last time
9465 move-is-internal))) ; is this move internal?
9466 ;; Copy the article.
9469 (set-buffer copy-buf)
9470 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9472 (nnheader-narrow-to-headers)
9473 (dolist (hdr gnus-copy-article-ignored-headers)
9474 (message-remove-header hdr t)))
9475 (gnus-request-accept-article
9476 to-newsgroup select-method (not articles) t))))
9477 ;; Crosspost the article.
9478 ((eq action 'crosspost)
9479 (let ((xref (message-tokenize-header
9480 (mail-header-xref (gnus-summary-article-header article))
9482 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9483 ":" (number-to-string article)))
9485 (setq xref (list (system-name))))
9488 (mapconcat 'identity
9489 (delete "Xref:" (delete new-xref xref))
9493 (set-buffer copy-buf)
9494 ;; First put the article in the destination group.
9495 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9496 (when (consp (setq art-group
9497 (gnus-request-accept-article
9498 to-newsgroup select-method (not articles) t)))
9499 (setq new-xref (concat new-xref " " (car art-group)
9501 (number-to-string (cdr art-group))))
9502 ;; Now we have the new Xrefs header, so we insert
9503 ;; it and replace the new article.
9504 (nnheader-replace-header "Xref" new-xref)
9505 (gnus-request-replace-article
9506 (cdr art-group) to-newsgroup (current-buffer) t)
9510 (gnus-message 1 "Couldn't %s article %s: %s"
9511 (cadr (assq action names)) article
9512 (nnheader-get-report (car to-method))))
9513 ((eq art-group 'junk)
9514 (when (eq action 'move)
9515 (gnus-summary-mark-article article gnus-canceled-mark)
9516 (gnus-message 4 "Deleted article %s" article)
9517 ;; run the delete hook
9518 (run-hook-with-args 'gnus-summary-article-delete-hook
9521 (assoc article (gnus-data-list nil)))
9522 gnus-newsgroup-name nil
9525 (let* ((pto-group (gnus-group-prefixed-name
9526 (car art-group) to-method))
9527 (info (gnus-get-info pto-group))
9528 (to-group (gnus-info-group info))
9530 ;; Update the group that has been moved to.
9532 (memq action '(move copy)))
9533 (unless (member to-group to-groups)
9534 (push to-group to-groups))
9536 (unless (memq article gnus-newsgroup-unreads)
9537 (push 'read to-marks)
9539 info (gnus-add-to-range (gnus-info-read info)
9540 (list (cdr art-group)))))
9542 ;; See whether the article is to be put in the cache.
9543 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9544 gnus-article-mark-lists
9545 (delete '(expirable . expire)
9546 (copy-sequence gnus-article-mark-lists))))
9547 (to-article (cdr art-group)))
9549 ;; Enter the article into the cache in the new group,
9550 ;; if that is required.
9551 (when gnus-use-cache
9552 (gnus-cache-possibly-enter-article
9554 (memq article gnus-newsgroup-marked)
9555 (memq article gnus-newsgroup-dormant)
9556 (memq article gnus-newsgroup-unreads)))
9558 (when gnus-preserve-marks
9559 ;; Copy any marks over to the new group.
9560 (when (and (equal to-group gnus-newsgroup-name)
9561 (not (memq article gnus-newsgroup-unreads)))
9562 ;; Mark this article as read in this group.
9563 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9564 (setcdr (gnus-active to-group) to-article)
9565 (setcdr gnus-newsgroup-active to-article))
9568 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9569 (when (memq article (symbol-value
9570 (intern (format "gnus-newsgroup-%s"
9572 (push (cdar marks) to-marks)
9573 ;; If the other group is the same as this group,
9574 ;; then we have to add the mark to the list.
9575 (when (equal to-group gnus-newsgroup-name)
9576 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9579 (intern (format "gnus-newsgroup-%s"
9581 ;; Copy the marks to other group.
9582 (gnus-add-marked-articles
9583 to-group (cdar marks) (list to-article) info)))
9584 (setq marks (cdr marks)))
9586 (gnus-request-set-mark
9587 to-group (list (list (list to-article) 'add to-marks))))
9590 (concat "(gnus-group-set-info '"
9591 (gnus-prin1-to-string (gnus-get-info to-group))
9594 ;; Update the Xref header in this article to point to
9595 ;; the new crossposted article we have just created.
9596 (when (eq action 'crosspost)
9598 (set-buffer copy-buf)
9599 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9600 (nnheader-replace-header "Xref" new-xref)
9601 (gnus-request-replace-article
9602 article gnus-newsgroup-name (current-buffer) t)))
9604 ;; run the move/copy/crosspost/respool hook
9605 (run-hook-with-args 'gnus-summary-article-move-hook
9608 (assoc article (gnus-data-list nil)))
9613 ;;;!!!Why is this necessary?
9614 (set-buffer gnus-summary-buffer)
9616 (gnus-summary-goto-subject article)
9617 (when (eq action 'move)
9618 (gnus-summary-mark-article article gnus-canceled-mark))))
9619 (push article articles-to-update-marks))
9621 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9622 ;; Re-activate all groups that have been moved to.
9624 (set-buffer gnus-group-buffer)
9625 (let ((gnus-group-marked to-groups))
9626 (gnus-group-get-new-news-this-group nil t)))
9628 (gnus-kill-buffer copy-buf)
9629 (gnus-summary-position-point)
9630 (gnus-set-mode-line 'summary)))
9632 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9633 "Copy the current article to some other group.
9634 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9635 When called interactively, if TO-NEWSGROUP is nil, use the value of
9636 the variable `gnus-move-split-methods' for finding a default target
9638 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9639 re-spool using this method."
9641 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9643 (defun gnus-summary-crosspost-article (&optional n)
9644 "Crosspost the current article to some other group."
9646 (gnus-summary-move-article n nil nil 'crosspost))
9648 (defcustom gnus-summary-respool-default-method nil
9649 "Default method type for respooling an article.
9650 If nil, use to the current newsgroup method."
9652 :group 'gnus-summary-mail)
9654 (defcustom gnus-summary-display-while-building nil
9655 "If non-nil, show and update the summary buffer as it's being built.
9656 If the value is t, update the buffer after every line is inserted. If
9657 the value is an integer (N), update the display every N lines."
9660 :type '(choice (const :tag "off" nil)
9662 (const :tag "frequently" t)))
9664 (defun gnus-summary-respool-article (&optional n method)
9665 "Respool the current article.
9666 The article will be squeezed through the mail spooling process again,
9667 which means that it will be put in some mail newsgroup or other
9668 depending on `nnmail-split-methods'.
9669 If N is a positive number, respool the N next articles.
9670 If N is a negative number, respool the N previous articles.
9671 If N is nil and any articles have been marked with the process mark,
9672 respool those articles instead.
9674 Respooling can be done both from mail groups and \"real\" newsgroups.
9675 In the former case, the articles in question will be moved from the
9676 current group into whatever groups they are destined to. In the
9677 latter case, they will be copied into the relevant groups."
9679 (list current-prefix-arg
9680 (let* ((methods (gnus-methods-using 'respool))
9682 (symbol-name (or gnus-summary-respool-default-method
9683 (car (gnus-find-method-for-group
9684 gnus-newsgroup-name)))))
9686 (gnus-completing-read-with-default
9687 methname "Backend to use when respooling"
9688 methods nil t nil 'gnus-mail-method-history))
9691 ((zerop (length (setq ms (gnus-servers-using-backend
9693 (list (intern method) ""))
9697 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9698 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9701 (error "No method given for respooling"))
9702 (if (assoc (symbol-name
9703 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9704 (gnus-methods-using 'respool))
9705 (gnus-summary-move-article n nil method)
9706 (gnus-summary-copy-article n nil method)))
9708 (defun gnus-summary-import-article (file &optional edit)
9709 "Import an arbitrary file into a mail newsgroup."
9710 (interactive "fImport file: \nP")
9711 (let ((group gnus-newsgroup-name)
9712 (now (current-time))
9713 atts lines group-art)
9714 (unless (gnus-check-backend-function 'request-accept-article group)
9715 (error "%s does not support article importing" group))
9716 (or (file-readable-p file)
9717 (not (file-regular-p file))
9718 (error "Can't read %s" file))
9720 (set-buffer (gnus-get-buffer-create " *import file*"))
9722 (nnheader-insert-file-contents file)
9723 (goto-char (point-min))
9724 (if (nnheader-article-p)
9726 (goto-char (point-min))
9727 (search-forward "\n\n" nil t)
9728 (narrow-to-region (point-min) (1- (point)))
9729 (goto-char (point-min))
9730 (unless (re-search-forward "^date:" nil t)
9731 (goto-char (point-max))
9732 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9733 ;; This doesn't look like an article, so we fudge some headers.
9734 (setq atts (file-attributes file)
9735 lines (count-lines (point-min) (point-max)))
9736 (insert "From: " (read-string "From: ") "\n"
9737 "Subject: " (read-string "Subject: ") "\n"
9738 "Date: " (message-make-date (nth 5 atts)) "\n"
9739 "Message-ID: " (message-make-message-id) "\n"
9740 "Lines: " (int-to-string lines) "\n"
9741 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9742 (setq group-art (gnus-request-accept-article group nil t))
9743 (kill-buffer (current-buffer)))
9744 (setq gnus-newsgroup-active (gnus-activate-group group))
9746 (gnus-summary-goto-article (cdr group-art) nil t)
9748 (gnus-summary-edit-article))))
9750 (defun gnus-summary-create-article ()
9751 "Create an article in a mail newsgroup."
9753 (let ((group gnus-newsgroup-name)
9754 (now (current-time))
9756 (unless (gnus-check-backend-function 'request-accept-article group)
9757 (error "%s does not support article importing" group))
9759 (set-buffer (gnus-get-buffer-create " *import file*"))
9761 (goto-char (point-min))
9762 ;; This doesn't look like an article, so we fudge some headers.
9763 (insert "From: " (read-string "From: ") "\n"
9764 "Subject: " (read-string "Subject: ") "\n"
9765 "Date: " (message-make-date now) "\n"
9766 "Message-ID: " (message-make-message-id) "\n")
9767 (setq group-art (gnus-request-accept-article group nil t))
9768 (kill-buffer (current-buffer)))
9769 (setq gnus-newsgroup-active (gnus-activate-group group))
9771 (gnus-summary-goto-article (cdr group-art) nil t)
9772 (gnus-summary-edit-article)))
9774 (defun gnus-summary-article-posted-p ()
9775 "Say whether the current (mail) article is available from news as well.
9776 This will be the case if the article has both been mailed and posted."
9778 (let ((id (mail-header-references (gnus-summary-article-header)))
9779 (gnus-override-method (car (gnus-refer-article-methods))))
9780 (if (gnus-request-head id "")
9781 (gnus-message 2 "The current message was found on %s"
9782 gnus-override-method)
9783 (gnus-message 2 "The current message couldn't be found on %s"
9784 gnus-override-method)
9787 (defun gnus-summary-expire-articles (&optional now)
9788 "Expire all articles that are marked as expirable in the current group."
9790 (when (and (not gnus-group-is-exiting-without-update-p)
9791 (gnus-check-backend-function
9792 'request-expire-articles gnus-newsgroup-name))
9793 ;; This backend supports expiry.
9794 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9795 (expirable (if total
9797 ;; We need to update the info for
9798 ;; this group for `gnus-list-of-read-articles'
9799 ;; to give us the right answer.
9800 (gnus-run-hooks 'gnus-exit-group-hook)
9801 (gnus-summary-update-info)
9802 (gnus-list-of-read-articles gnus-newsgroup-name))
9803 (setq gnus-newsgroup-expirable
9804 (sort gnus-newsgroup-expirable '<))))
9805 (expiry-wait (if now 'immediate
9806 (gnus-group-find-parameter
9807 gnus-newsgroup-name 'expiry-wait)))
9808 (nnmail-expiry-target
9809 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9810 nnmail-expiry-target))
9813 ;; There are expirable articles in this group, so we run them
9814 ;; through the expiry process.
9815 (gnus-message 6 "Expiring articles...")
9816 (unless (gnus-check-group gnus-newsgroup-name)
9817 (error "Can't open server for %s" gnus-newsgroup-name))
9818 ;; The list of articles that weren't expired is returned.
9821 (let ((nnmail-expiry-wait-function nil)
9822 (nnmail-expiry-wait expiry-wait))
9823 (setq es (gnus-request-expire-articles
9824 expirable gnus-newsgroup-name)))
9825 (setq es (gnus-request-expire-articles
9826 expirable gnus-newsgroup-name)))
9828 (setq gnus-newsgroup-expirable es))
9829 ;; We go through the old list of expirable, and mark all
9830 ;; really expired articles as nonexistent.
9831 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9832 (let ((gnus-use-cache nil))
9833 (dolist (article expirable)
9834 (when (and (not (memq article es))
9835 (gnus-data-find article))
9836 (gnus-summary-mark-article article gnus-canceled-mark)
9837 (run-hook-with-args 'gnus-summary-article-expire-hook
9840 (assoc article (gnus-data-list nil)))
9844 (gnus-message 6 "Expiring articles...done")))))
9846 (defun gnus-summary-expire-articles-now ()
9847 "Expunge all expirable articles in the current group.
9848 This means that *all* articles that are marked as expirable will be
9849 deleted forever, right now."
9851 (or gnus-expert-user
9853 "Are you really, really sure you want to delete all expirable messages? ")
9855 (gnus-summary-expire-articles t))
9857 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9858 (defun gnus-summary-delete-article (&optional n)
9859 "Delete the N next (mail) articles.
9860 This command actually deletes articles. This is not a marking
9861 command. The article will disappear forever from your life, never to
9864 If N is negative, delete backwards.
9865 If N is nil and articles have been marked with the process mark,
9866 delete these instead.
9868 If `gnus-novice-user' is non-nil you will be asked for
9869 confirmation before the articles are deleted."
9871 (unless (gnus-check-backend-function 'request-expire-articles
9872 gnus-newsgroup-name)
9873 (error "The current newsgroup does not support article deletion"))
9874 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9875 (error "Couldn't open server"))
9876 ;; Compute the list of articles to delete.
9877 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9878 (nnmail-expiry-target 'delete)
9880 (if (and gnus-novice-user
9881 (not (gnus-yes-or-no-p
9882 (format "Do you really want to delete %s forever? "
9883 (if (> (length articles) 1)
9884 (format "these %s articles" (length articles))
9887 ;; Delete the articles.
9888 (setq not-deleted (gnus-request-expire-articles
9889 articles gnus-newsgroup-name 'force))
9891 (gnus-summary-remove-process-mark (car articles))
9892 ;; The backend might not have been able to delete the article
9894 (unless (memq (car articles) not-deleted)
9895 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9896 (let* ((article (car articles))
9897 (ghead (gnus-data-header
9898 (assoc article (gnus-data-list nil)))))
9899 (run-hook-with-args 'gnus-summary-article-delete-hook
9900 'delete ghead gnus-newsgroup-name nil
9902 (setq articles (cdr articles)))
9904 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9905 (gnus-summary-position-point)
9906 (gnus-set-mode-line 'summary)
9909 (defun gnus-summary-edit-article (&optional arg)
9910 "Edit the current article.
9911 This will have permanent effect only in mail groups.
9912 If ARG is nil, edit the decoded articles.
9913 If ARG is 1, edit the raw articles.
9914 If ARG is 2, edit the raw articles even in read-only groups.
9915 If ARG is 3, edit the articles with the current handles.
9916 Otherwise, allow editing of articles even in read-only
9919 (let (force raw current-handles)
9928 (setq current-handles
9929 (and (gnus-buffer-live-p gnus-article-buffer)
9930 (with-current-buffer gnus-article-buffer
9932 gnus-article-mime-handles
9933 (setq gnus-article-mime-handles nil))))))
9936 (when (and raw (not force)
9937 (member gnus-newsgroup-name '("nndraft:delayed"
9940 (error "Can't edit the raw article in group %s"
9941 gnus-newsgroup-name))
9943 (set-buffer gnus-summary-buffer)
9944 (let ((mail-parse-charset gnus-newsgroup-charset)
9945 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9946 (gnus-set-global-variables)
9947 (when (and (not force)
9948 (gnus-group-read-only-p))
9949 (error "The current newsgroup does not support article editing"))
9950 (gnus-summary-show-article t)
9951 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9952 (with-current-buffer gnus-article-buffer
9953 (mm-enable-multibyte)))
9954 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9956 (gnus-article-edit-article
9959 (let ((mbl mml-buffer-list))
9960 (setq mml-buffer-list nil)
9961 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
9962 (mime-to-mml ,'current-handles))
9963 (let ((mbl1 mml-buffer-list))
9964 (setq mml-buffer-list mbl)
9965 (set (make-local-variable 'mml-buffer-list) mbl1))
9966 (gnus-make-local-hook 'kill-buffer-hook)
9967 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9968 `(lambda (no-highlight)
9969 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9970 (message-options message-options)
9971 (message-options-set-recipient)
9972 (mail-parse-ignored-charsets
9973 ',gnus-newsgroup-ignored-charsets))
9974 ,(if (not raw) '(progn
9976 (mml-destroy-buffers)
9977 (remove-hook 'kill-buffer-hook
9978 'mml-destroy-buffers t)
9979 (kill-local-variable 'mml-buffer-list)))
9980 (gnus-summary-edit-article-done
9981 ,(or (mail-header-references gnus-current-headers) "")
9982 ,(gnus-group-read-only-p)
9983 ,gnus-summary-buffer no-highlight))))))))
9985 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9987 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9989 "Make edits to the current article permanent."
9992 ;; The buffer restriction contains the entire article if it exists.
9993 (when (article-goto-body)
9994 (let ((lines (count-lines (point) (point-max)))
9995 (length (- (point-max) (point)))
9996 (case-fold-search t)
9997 (body (copy-marker (point))))
9998 (goto-char (point-min))
9999 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10000 (delete-region (match-beginning 1) (match-end 1))
10001 (insert (number-to-string length)))
10002 (goto-char (point-min))
10003 (when (re-search-forward
10004 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10005 (delete-region (match-beginning 1) (match-end 1))
10006 (insert (number-to-string length)))
10007 (goto-char (point-min))
10008 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10009 (delete-region (match-beginning 1) (match-end 1))
10010 (insert (number-to-string lines))))))
10011 ;; Replace the article.
10012 (let ((buf (current-buffer)))
10014 (insert-buffer-substring buf)
10016 (if (and (not read-only)
10017 (not (gnus-request-replace-article
10018 (cdr gnus-article-current) (car gnus-article-current)
10019 (current-buffer) t)))
10020 (error "Couldn't replace article")
10021 ;; Update the summary buffer.
10022 (if (and references
10023 (equal (message-tokenize-header references " ")
10024 (message-tokenize-header
10025 (or (message-fetch-field "references") "") " ")))
10026 ;; We only have to update this line.
10029 (message-narrow-to-head)
10030 (let ((head (buffer-substring-no-properties
10031 (point-min) (point-max)))
10034 (insert (format "211 %d Article retrieved.\n"
10035 (cdr gnus-article-current)))
10038 (let ((nntp-server-buffer (current-buffer)))
10039 (setq header (car (gnus-get-newsgroup-headers
10042 (set-buffer gnus-summary-buffer)
10043 (gnus-data-set-header
10044 (gnus-data-find (cdr gnus-article-current))
10046 (gnus-summary-update-article-line
10047 (cdr gnus-article-current) header)
10048 (if (gnus-summary-goto-subject
10049 (cdr gnus-article-current) nil t)
10050 (gnus-summary-update-secondary-mark
10051 (cdr gnus-article-current))))))))
10053 (set-buffer (or buffer gnus-summary-buffer))
10054 (gnus-summary-update-article (cdr gnus-article-current))
10055 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10056 (gnus-summary-update-secondary-mark
10057 (cdr gnus-article-current))))
10058 ;; Prettify the article buffer again.
10059 (unless no-highlight
10061 (set-buffer gnus-article-buffer)
10062 ;;;!!! Fix this -- article should be rehighlighted.
10063 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10064 (set-buffer gnus-original-article-buffer)
10065 (gnus-request-article
10066 (cdr gnus-article-current)
10067 (car gnus-article-current) (current-buffer))))
10068 ;; Prettify the summary buffer line.
10069 (when (gnus-visual-p 'summary-highlight 'highlight)
10070 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10072 (defun gnus-summary-edit-wash (key)
10073 "Perform editing command KEY in the article buffer."
10077 (message "%s" (concat (this-command-keys) "- "))
10080 (gnus-summary-edit-article)
10081 (execute-kbd-macro (concat (this-command-keys) key))
10082 (gnus-article-edit-done))
10086 (defun gnus-summary-respool-query (&optional silent trace)
10087 "Query where the respool algorithm would put this article."
10089 (let (gnus-mark-article-hook)
10090 (gnus-summary-select-article)
10092 (set-buffer gnus-original-article-buffer)
10093 (let ((groups (nnmail-article-group 'identity trace)))
10096 (message "This message would go to %s"
10097 (mapconcat 'car groups ", "))
10098 (message "This message would go to no groups"))
10101 (defun gnus-summary-respool-trace ()
10102 "Trace where the respool algorithm would put this article.
10103 Display a buffer showing all fancy splitting patterns which matched."
10105 (gnus-summary-respool-query nil t))
10107 ;; Summary marking commands.
10109 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10110 "Mark articles which has the same subject as read, and then select the next.
10111 If UNMARK is positive, remove any kind of mark.
10112 If UNMARK is negative, tick articles."
10115 (setq unmark (prefix-numeric-value unmark)))
10117 (gnus-summary-mark-same-subject
10118 (gnus-summary-article-subject) unmark)))
10119 ;; Select next unread article. If auto-select-same mode, should
10120 ;; select the first unread article.
10121 (gnus-summary-next-article t (and gnus-auto-select-same
10122 (gnus-summary-article-subject)))
10123 (gnus-message 7 "%d article%s marked as %s"
10124 count (if (= count 1) " is" "s are")
10125 (if unmark "unread" "read"))))
10127 (defun gnus-summary-kill-same-subject (&optional unmark)
10128 "Mark articles which has the same subject as read.
10129 If UNMARK is positive, remove any kind of mark.
10130 If UNMARK is negative, tick articles."
10133 (setq unmark (prefix-numeric-value unmark)))
10135 (gnus-summary-mark-same-subject
10136 (gnus-summary-article-subject) unmark)))
10137 ;; If marked as read, go to next unread subject.
10138 (when (null unmark)
10139 ;; Go to next unread subject.
10140 (gnus-summary-next-subject 1 t))
10141 (gnus-message 7 "%d articles are marked as %s"
10142 count (if unmark "unread" "read"))))
10144 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10145 "Mark articles with same SUBJECT as read, and return marked number.
10146 If optional argument UNMARK is positive, remove any kinds of marks.
10147 If optional argument UNMARK is negative, mark articles as unread instead."
10151 ((null unmark) ; Mark as read.
10154 (gnus-summary-mark-article-as-read gnus-killed-mark)
10155 (gnus-summary-show-thread) t)
10156 (gnus-summary-find-subject subject))
10157 (setq count (1+ count))))
10158 ((> unmark 0) ; Tick.
10161 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10162 (gnus-summary-show-thread) t)
10163 (gnus-summary-find-subject subject))
10164 (setq count (1+ count))))
10165 (t ; Mark as unread.
10168 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10169 (gnus-summary-show-thread) t)
10170 (gnus-summary-find-subject subject))
10171 (setq count (1+ count)))))
10172 (gnus-set-mode-line 'summary)
10173 ;; Return the number of marked articles.
10176 (defun gnus-summary-mark-as-processable (n &optional unmark)
10177 "Set the process mark on the next N articles.
10178 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10179 the process mark instead. The difference between N and the actual
10180 number of articles marked is returned."
10182 (if (and (null n) (gnus-region-active-p))
10183 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10184 (setq n (prefix-numeric-value n))
10185 (let ((backward (< n 0))
10190 (gnus-summary-remove-process-mark
10191 (gnus-summary-article-number))
10192 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10193 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10196 (gnus-message 7 "No more articles"))
10197 (gnus-summary-recenter)
10198 (gnus-summary-position-point)
10201 (defun gnus-summary-unmark-as-processable (n)
10202 "Remove the process mark from the next N articles.
10203 If N is negative, unmark backward instead. The difference between N and
10204 the actual number of articles unmarked is returned."
10206 (gnus-summary-mark-as-processable n t))
10208 (defun gnus-summary-unmark-all-processable ()
10209 "Remove the process mark from all articles."
10212 (while gnus-newsgroup-processable
10213 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10214 (gnus-summary-position-point))
10216 (defun gnus-summary-add-mark (article type)
10217 "Mark ARTICLE with a mark of TYPE."
10218 (let ((vtype (car (assq type gnus-article-mark-lists)))
10221 (error "No such mark type: %s" type)
10222 (setq var (intern (format "gnus-newsgroup-%s" type)))
10223 (set var (cons article (symbol-value var)))
10224 (if (memq type '(processable cached replied forwarded recent saved))
10225 (gnus-summary-update-secondary-mark article)
10226 ;;; !!! This is bogus. We should find out what primary
10227 ;;; !!! mark we want to set.
10228 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10230 (defun gnus-summary-mark-as-expirable (n)
10231 "Mark N articles forward as expirable.
10232 If N is negative, mark backward instead. The difference between N and
10233 the actual number of articles marked is returned."
10235 (gnus-summary-mark-forward n gnus-expirable-mark))
10237 (defun gnus-summary-mark-as-spam (n)
10238 "Mark N articles forward as spam.
10239 If N is negative, mark backward instead. The difference between N and
10240 the actual number of articles marked is returned."
10242 (gnus-summary-mark-forward n gnus-spam-mark))
10244 (defun gnus-summary-mark-article-as-replied (article)
10245 "Mark ARTICLE as replied to and update the summary line.
10246 ARTICLE can also be a list of articles."
10247 (interactive (list (gnus-summary-article-number)))
10248 (let ((articles (if (listp article) article (list article))))
10249 (dolist (article articles)
10250 (unless (numberp article)
10251 (error "%s is not a number" article))
10252 (push article gnus-newsgroup-replied)
10253 (let ((buffer-read-only nil))
10254 (when (gnus-summary-goto-subject article nil t)
10255 (gnus-summary-update-secondary-mark article))))))
10257 (defun gnus-summary-mark-article-as-forwarded (article)
10258 "Mark ARTICLE as forwarded and update the summary line.
10259 ARTICLE can also be a list of articles."
10260 (let ((articles (if (listp article) article (list article))))
10261 (dolist (article articles)
10262 (push article gnus-newsgroup-forwarded)
10263 (let ((buffer-read-only nil))
10264 (when (gnus-summary-goto-subject article nil t)
10265 (gnus-summary-update-secondary-mark article))))))
10267 (defun gnus-summary-set-bookmark (article)
10268 "Set a bookmark in current article."
10269 (interactive (list (gnus-summary-article-number)))
10270 (when (or (not (get-buffer gnus-article-buffer))
10271 (not gnus-current-article)
10272 (not gnus-article-current)
10273 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10274 (error "No current article selected"))
10275 ;; Remove old bookmark, if one exists.
10276 (gnus-pull article gnus-newsgroup-bookmarks)
10277 ;; Set the new bookmark, which is on the form
10278 ;; (article-number . line-number-in-body).
10281 (with-current-buffer gnus-article-buffer
10285 (article-goto-body)
10288 gnus-newsgroup-bookmarks)
10289 (gnus-message 6 "A bookmark has been added to the current article."))
10291 (defun gnus-summary-remove-bookmark (article)
10292 "Remove the bookmark from the current article."
10293 (interactive (list (gnus-summary-article-number)))
10294 ;; Remove old bookmark, if one exists.
10295 (if (not (assq article gnus-newsgroup-bookmarks))
10296 (gnus-message 6 "No bookmark in current article.")
10297 (gnus-pull article gnus-newsgroup-bookmarks)
10298 (gnus-message 6 "Removed bookmark.")))
10300 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10301 (defun gnus-summary-mark-as-dormant (n)
10302 "Mark N articles forward as dormant.
10303 If N is negative, mark backward instead. The difference between N and
10304 the actual number of articles marked is returned."
10306 (gnus-summary-mark-forward n gnus-dormant-mark))
10308 (defun gnus-summary-set-process-mark (article)
10309 "Set the process mark on ARTICLE and update the summary line."
10310 (setq gnus-newsgroup-processable
10312 (delq article gnus-newsgroup-processable)))
10313 (when (gnus-summary-goto-subject article)
10314 (gnus-summary-show-thread)
10315 (gnus-summary-goto-subject article)
10316 (gnus-summary-update-secondary-mark article)))
10318 (defun gnus-summary-remove-process-mark (&rest articles)
10319 "Remove the process mark from ARTICLES and update the summary line."
10320 (dolist (article articles)
10321 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10322 (when (gnus-summary-goto-subject article)
10323 (gnus-summary-show-thread)
10324 (gnus-summary-goto-subject article)
10325 (gnus-summary-update-secondary-mark article)))
10328 (defun gnus-summary-set-saved-mark (article)
10329 "Set the process mark on ARTICLE and update the summary line."
10330 (push article gnus-newsgroup-saved)
10331 (when (gnus-summary-goto-subject article)
10332 (gnus-summary-update-secondary-mark article)))
10334 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10335 "Mark N articles as read forwards.
10336 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10337 The difference between N and the actual number of articles marked is
10339 If NO-EXPIRE, auto-expiry will be inhibited."
10341 (gnus-summary-show-thread)
10342 (let ((backward (< n 0))
10343 (gnus-summary-goto-unread
10344 (and gnus-summary-goto-unread
10345 (not (eq gnus-summary-goto-unread 'never))
10346 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10347 gnus-ticked-mark gnus-dormant-mark)))))
10349 (mark (or mark gnus-del-mark)))
10350 (while (and (> n 0)
10351 (gnus-summary-mark-article nil mark no-expire)
10352 (zerop (gnus-summary-next-subject
10354 (and gnus-summary-goto-unread
10355 (not (eq gnus-summary-goto-unread 'never)))
10359 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10360 (gnus-summary-recenter)
10361 (gnus-summary-position-point)
10362 (gnus-set-mode-line 'summary)
10365 (defun gnus-summary-mark-article-as-read (mark)
10366 "Mark the current article quickly as read with MARK."
10367 (let ((article (gnus-summary-article-number)))
10368 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10369 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10370 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10371 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10372 (push (cons article mark) gnus-newsgroup-reads)
10373 ;; Possibly remove from cache, if that is used.
10374 (when gnus-use-cache
10375 (gnus-cache-enter-remove-article article))
10376 ;; Allow the backend to change the mark.
10377 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10378 ;; Check for auto-expiry.
10379 (when (and gnus-newsgroup-auto-expire
10380 (memq mark gnus-auto-expirable-marks))
10381 (setq mark gnus-expirable-mark)
10382 ;; Let the backend know about the mark change.
10383 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10384 (push article gnus-newsgroup-expirable))
10385 ;; Set the mark in the buffer.
10386 (gnus-summary-update-mark mark 'unread)
10389 (defun gnus-summary-mark-article-as-unread (mark)
10390 "Mark the current article quickly as unread with MARK."
10391 (let* ((article (gnus-summary-article-number))
10392 (old-mark (gnus-summary-article-mark article)))
10393 ;; Allow the backend to change the mark.
10394 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10395 (if (eq mark old-mark)
10399 (gnus-error 1 "Can't mark negative article numbers")
10401 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10402 (setq gnus-newsgroup-spam-marked
10403 (delq article gnus-newsgroup-spam-marked))
10404 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10405 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10406 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10407 (cond ((= mark gnus-ticked-mark)
10408 (setq gnus-newsgroup-marked
10409 (gnus-add-to-sorted-list gnus-newsgroup-marked
10411 ((= mark gnus-spam-mark)
10412 (setq gnus-newsgroup-spam-marked
10413 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10415 ((= mark gnus-dormant-mark)
10416 (setq gnus-newsgroup-dormant
10417 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10420 (setq gnus-newsgroup-unreads
10421 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10423 (gnus-pull article gnus-newsgroup-reads)
10425 ;; See whether the article is to be put in the cache.
10426 (and gnus-use-cache
10427 (vectorp (gnus-summary-article-header article))
10429 (gnus-cache-possibly-enter-article
10430 gnus-newsgroup-name article
10431 (= mark gnus-ticked-mark)
10432 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10435 (gnus-summary-update-mark mark 'unread)
10438 (defun gnus-summary-mark-article (&optional article mark no-expire)
10439 "Mark ARTICLE with MARK. MARK can be any character.
10440 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10441 `??' (dormant) and `?E' (expirable).
10442 If MARK is nil, then the default character `?r' is used.
10443 If ARTICLE is nil, then the article on the current line will be
10445 If NO-EXPIRE, auto-expiry will be inhibited."
10446 ;; The mark might be a string.
10447 (when (stringp mark)
10448 (setq mark (aref mark 0)))
10449 ;; If no mark is given, then we check auto-expiring.
10451 (setq mark gnus-del-mark))
10452 (when (and (not no-expire)
10453 gnus-newsgroup-auto-expire
10454 (memq mark gnus-auto-expirable-marks))
10455 (setq mark gnus-expirable-mark))
10456 (let ((article (or article (gnus-summary-article-number)))
10457 (old-mark (gnus-summary-article-mark article)))
10458 ;; Allow the backend to change the mark.
10459 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10460 (if (eq mark old-mark)
10463 (error "No article on current line"))
10464 (if (not (if (or (= mark gnus-unread-mark)
10465 (= mark gnus-ticked-mark)
10466 (= mark gnus-spam-mark)
10467 (= mark gnus-dormant-mark))
10468 (gnus-mark-article-as-unread article mark)
10469 (gnus-mark-article-as-read article mark)))
10471 ;; See whether the article is to be put in the cache.
10472 (and gnus-use-cache
10473 (not (= mark gnus-canceled-mark))
10474 (vectorp (gnus-summary-article-header article))
10476 (gnus-cache-possibly-enter-article
10477 gnus-newsgroup-name article
10478 (= mark gnus-ticked-mark)
10479 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10481 (when (gnus-summary-goto-subject article nil t)
10482 (let ((buffer-read-only nil))
10483 (gnus-summary-show-thread)
10485 (gnus-summary-update-mark mark 'unread)
10488 (defun gnus-summary-update-secondary-mark (article)
10489 "Update the secondary (read, process, cache) mark."
10490 (gnus-summary-update-mark
10491 (cond ((memq article gnus-newsgroup-processable)
10493 ((memq article gnus-newsgroup-cached)
10495 ((memq article gnus-newsgroup-replied)
10497 ((memq article gnus-newsgroup-forwarded)
10498 gnus-forwarded-mark)
10499 ((memq article gnus-newsgroup-saved)
10501 ((memq article gnus-newsgroup-recent)
10503 ((memq article gnus-newsgroup-unseen)
10507 (when (gnus-visual-p 'summary-highlight 'highlight)
10508 (gnus-run-hooks 'gnus-summary-update-hook))
10511 (defun gnus-summary-update-download-mark (article)
10512 "Update the download mark."
10513 (gnus-summary-update-mark
10514 (cond ((memq article gnus-newsgroup-undownloaded)
10515 gnus-undownloaded-mark)
10516 (gnus-newsgroup-agentized
10517 gnus-downloaded-mark)
10521 (gnus-summary-update-line t)
10524 (defun gnus-summary-update-mark (mark type)
10525 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10526 (buffer-read-only nil))
10527 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10529 (when (looking-at "\r")
10531 (when (<= (+ forward (point)) (point-max))
10532 ;; Go to the right position on the line.
10533 (goto-char (+ forward (point)))
10534 ;; Replace the old mark with the new mark.
10535 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10536 ;; Optionally update the marks by some user rule.
10537 (when (eq type 'unread)
10538 (gnus-data-set-mark
10539 (gnus-data-find (gnus-summary-article-number)) mark)
10540 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10542 (defun gnus-mark-article-as-read (article &optional mark)
10543 "Enter ARTICLE in the pertinent lists and remove it from others."
10544 ;; Make the article expirable.
10545 (let ((mark (or mark gnus-del-mark)))
10546 (setq gnus-newsgroup-expirable
10547 (if (= mark gnus-expirable-mark)
10548 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10549 (delq article gnus-newsgroup-expirable)))
10550 ;; Remove from unread and marked lists.
10551 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10552 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10553 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10554 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10555 (push (cons article mark) gnus-newsgroup-reads)
10556 ;; Possibly remove from cache, if that is used.
10557 (when gnus-use-cache
10558 (gnus-cache-enter-remove-article article))
10561 (defun gnus-mark-article-as-unread (article &optional mark)
10562 "Enter ARTICLE in the pertinent lists and remove it from others."
10563 (let ((mark (or mark gnus-ticked-mark)))
10566 (gnus-error 1 "Can't mark negative article numbers")
10568 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10569 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10570 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10571 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10572 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10574 ;; Unsuppress duplicates?
10575 (when gnus-suppress-duplicates
10576 (gnus-dup-unsuppress-article article))
10578 (cond ((= mark gnus-ticked-mark)
10579 (setq gnus-newsgroup-marked
10580 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10581 ((= mark gnus-spam-mark)
10582 (setq gnus-newsgroup-spam-marked
10583 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10585 ((= mark gnus-dormant-mark)
10586 (setq gnus-newsgroup-dormant
10587 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10589 (setq gnus-newsgroup-unreads
10590 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10591 (gnus-pull article gnus-newsgroup-reads)
10594 (defalias 'gnus-summary-mark-as-unread-forward
10595 'gnus-summary-tick-article-forward)
10596 (make-obsolete 'gnus-summary-mark-as-unread-forward
10597 'gnus-summary-tick-article-forward)
10598 (defun gnus-summary-tick-article-forward (n)
10599 "Tick N articles forwards.
10600 If N is negative, tick backwards instead.
10601 The difference between N and the number of articles ticked is returned."
10603 (gnus-summary-mark-forward n gnus-ticked-mark))
10605 (defalias 'gnus-summary-mark-as-unread-backward
10606 'gnus-summary-tick-article-backward)
10607 (make-obsolete 'gnus-summary-mark-as-unread-backward
10608 'gnus-summary-tick-article-backward)
10609 (defun gnus-summary-tick-article-backward (n)
10610 "Tick N articles backwards.
10611 The difference between N and the number of articles ticked is returned."
10613 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10615 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10616 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10617 (defun gnus-summary-tick-article (&optional article clear-mark)
10618 "Mark current article as unread.
10619 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10620 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10622 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10623 gnus-ticked-mark)))
10625 (defun gnus-summary-mark-as-read-forward (n)
10626 "Mark N articles as read forwards.
10627 If N is negative, mark backwards instead.
10628 The difference between N and the actual number of articles marked is
10631 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10633 (defun gnus-summary-mark-as-read-backward (n)
10634 "Mark the N articles as read backwards.
10635 The difference between N and the actual number of articles marked is
10638 (gnus-summary-mark-forward
10639 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10641 (defun gnus-summary-mark-as-read (&optional article mark)
10642 "Mark current article as read.
10643 ARTICLE specifies the article to be marked as read.
10644 MARK specifies a string to be inserted at the beginning of the line."
10645 (gnus-summary-mark-article article mark))
10647 (defun gnus-summary-clear-mark-forward (n)
10648 "Clear marks from N articles forward.
10649 If N is negative, clear backward instead.
10650 The difference between N and the number of marks cleared is returned."
10652 (gnus-summary-mark-forward n gnus-unread-mark))
10654 (defun gnus-summary-clear-mark-backward (n)
10655 "Clear marks from N articles backward.
10656 The difference between N and the number of marks cleared is returned."
10658 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10660 (defun gnus-summary-mark-unread-as-read ()
10661 "Intended to be used by `gnus-summary-mark-article-hook'."
10662 (when (memq gnus-current-article gnus-newsgroup-unreads)
10663 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10665 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10666 "Intended to be used by `gnus-summary-mark-article-hook'."
10667 (let ((mark (gnus-summary-article-mark)))
10668 (when (or (gnus-unread-mark-p mark)
10669 (gnus-read-mark-p mark))
10670 (gnus-summary-mark-article gnus-current-article
10671 (or new-mark gnus-read-mark)))))
10673 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10674 "Intended to be used by `gnus-summary-mark-article-hook'."
10675 (let ((mark (gnus-summary-article-mark)))
10676 (when (or (gnus-unread-mark-p mark)
10677 (gnus-read-mark-p mark))
10678 (gnus-summary-mark-article (gnus-summary-article-number)
10679 (or new-mark gnus-read-mark)))))
10681 (defun gnus-summary-mark-unread-as-ticked ()
10682 "Intended to be used by `gnus-summary-mark-article-hook'."
10683 (when (memq gnus-current-article gnus-newsgroup-unreads)
10684 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10686 (defun gnus-summary-mark-region-as-read (point mark all)
10687 "Mark all unread articles between point and mark as read.
10688 If given a prefix, mark all articles between point and mark as read,
10689 even ticked and dormant ones."
10690 (interactive "r\nP")
10694 (beginning-of-line)
10699 (memq (setq article (gnus-summary-article-number))
10700 gnus-newsgroup-unreads))
10701 (gnus-summary-mark-article article gnus-del-mark))
10703 (gnus-summary-find-next))))))
10705 (defun gnus-summary-mark-below (score mark)
10706 "Mark articles with score less than SCORE with MARK."
10707 (interactive "P\ncMark: ")
10708 (setq score (if score
10709 (prefix-numeric-value score)
10710 (or gnus-summary-default-score 0)))
10712 (set-buffer gnus-summary-buffer)
10713 (goto-char (point-min))
10716 (and (< (gnus-summary-article-score) score)
10717 (gnus-summary-mark-article nil mark))
10718 (gnus-summary-find-next)))))
10720 (defun gnus-summary-kill-below (&optional score)
10721 "Mark articles with score below SCORE as read."
10723 (gnus-summary-mark-below score gnus-killed-mark))
10725 (defun gnus-summary-clear-above (&optional score)
10726 "Clear all marks from articles with score above SCORE."
10728 (gnus-summary-mark-above score gnus-unread-mark))
10730 (defun gnus-summary-tick-above (&optional score)
10731 "Tick all articles with score above SCORE."
10733 (gnus-summary-mark-above score gnus-ticked-mark))
10735 (defun gnus-summary-mark-above (score mark)
10736 "Mark articles with score over SCORE with MARK."
10737 (interactive "P\ncMark: ")
10738 (setq score (if score
10739 (prefix-numeric-value score)
10740 (or gnus-summary-default-score 0)))
10742 (set-buffer gnus-summary-buffer)
10743 (goto-char (point-min))
10745 (when (> (gnus-summary-article-score) score)
10746 (gnus-summary-mark-article nil mark))
10748 (gnus-summary-find-next)))))
10750 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10751 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10752 (defun gnus-summary-limit-include-expunged (&optional no-error)
10753 "Display all the hidden articles that were expunged for low scores."
10755 (let ((buffer-read-only nil))
10756 (let ((scored gnus-newsgroup-scored)
10759 (unless (gnus-summary-article-header (caar scored))
10760 (and (setq h (gnus-number-to-header (caar scored)))
10761 (< (cdar scored) gnus-summary-expunge-below)
10763 (setq scored (cdr scored)))
10765 (when (not no-error)
10766 (error "No expunged articles hidden"))
10767 (goto-char (point-min))
10768 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10769 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10770 (mapcar (lambda (x) (push (mail-header-number x)
10771 gnus-newsgroup-limit))
10773 (gnus-summary-prepare-unthreaded (nreverse headers))
10774 (goto-char (point-min))
10775 (gnus-summary-position-point)
10778 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10779 "Mark all unread articles in this newsgroup as read.
10780 If prefix argument ALL is non-nil, ticked and dormant articles will
10781 also be marked as read.
10782 If QUIETLY is non-nil, no questions will be asked.
10784 If TO-HERE is non-nil, it should be a point in the buffer. All
10785 articles before (after, if REVERSE is set) this point will be marked
10788 Note that this function will only catch up the unread article
10789 in the current summary buffer limitation.
10791 The number of articles marked as read is returned."
10796 (not gnus-interactive-catchup) ;Without confirmation?
10800 "Mark absolutely all articles as read? "
10801 "Mark all unread articles as read? ")))
10803 (not gnus-newsgroup-adaptive)
10804 (not gnus-newsgroup-auto-expire)
10805 (not gnus-suppress-duplicates)
10806 (or (not gnus-use-cache)
10807 (eq gnus-use-cache 'passive)))
10810 (setq gnus-newsgroup-marked nil
10811 gnus-newsgroup-spam-marked nil
10812 gnus-newsgroup-dormant nil))
10813 (setq gnus-newsgroup-unreads
10814 (gnus-sorted-nunion
10815 (gnus-sorted-intersection gnus-newsgroup-unreads
10816 gnus-newsgroup-downloadable)
10817 gnus-newsgroup-unfetched)))
10818 ;; We actually mark all articles as canceled, which we
10819 ;; have to do when using auto-expiry or adaptive scoring.
10820 (gnus-summary-show-all-threads)
10821 (if (and to-here reverse)
10823 (goto-char to-here)
10824 (gnus-summary-mark-current-read-and-unread-as-read
10826 (while (gnus-summary-find-next (not all))
10827 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10828 (when (gnus-summary-first-subject (not all))
10830 (if to-here (< (point) to-here) t)
10831 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10832 (gnus-summary-find-next (not all))))))
10833 (gnus-set-mode-line 'summary))
10835 (gnus-summary-position-point)))
10837 (defun gnus-summary-catchup-to-here (&optional all)
10838 "Mark all unticked articles before the current one as read.
10839 If ALL is non-nil, also mark ticked and dormant articles as read."
10842 (gnus-save-hidden-threads
10843 (let ((beg (point)))
10844 ;; We check that there are unread articles.
10845 (when (or all (gnus-summary-find-prev))
10846 (gnus-summary-catchup all t beg)))))
10847 (gnus-summary-position-point))
10849 (defun gnus-summary-catchup-from-here (&optional all)
10850 "Mark all unticked articles after (and including) the current one as read.
10851 If ALL is non-nil, also mark ticked and dormant articles as read."
10854 (gnus-save-hidden-threads
10855 (let ((beg (point)))
10856 ;; We check that there are unread articles.
10857 (when (or all (gnus-summary-find-next))
10858 (gnus-summary-catchup all t beg nil t)))))
10859 (gnus-summary-position-point))
10861 (defun gnus-summary-catchup-all (&optional quietly)
10862 "Mark all articles in this newsgroup as read.
10863 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10864 instead, which marks only unread articles as read."
10866 (gnus-summary-catchup t quietly))
10868 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10869 "Mark all unread articles in this group as read, then exit.
10870 If prefix argument ALL is non-nil, all articles are marked as read.
10871 If QUIETLY is non-nil, no questions will be asked."
10873 (when (gnus-summary-catchup all quietly nil 'fast)
10874 ;; Select next newsgroup or exit.
10875 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10876 (eq gnus-auto-select-next 'quietly))
10877 (gnus-summary-next-group nil)
10878 (gnus-summary-exit))))
10880 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10881 "Mark all articles in this newsgroup as read, and then exit.
10882 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10883 instead, which marks only unread articles as read."
10885 (gnus-summary-catchup-and-exit t quietly))
10887 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10888 "Mark all articles in this group as read and select the next group.
10889 If given a prefix, mark all articles, unread as well as ticked, as
10893 (gnus-summary-catchup all))
10894 (gnus-summary-next-group))
10896 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10897 "Mark all articles in this group as read and select the previous group.
10898 If given a prefix, mark all articles, unread as well as ticked, as
10902 (gnus-summary-catchup all))
10903 (gnus-summary-next-group nil nil t))
10909 (defmacro gnus-with-article (article &rest forms)
10910 "Select ARTICLE and perform FORMS in the original article buffer.
10911 Then replace the article with the result."
10913 ;; We don't want the article to be marked as read.
10914 (let (gnus-mark-article-hook)
10915 (gnus-summary-select-article t t nil ,article))
10916 (set-buffer gnus-original-article-buffer)
10918 (if (not (gnus-check-backend-function
10919 'request-replace-article (car gnus-article-current)))
10920 (gnus-message 5 "Read-only group; not replacing")
10921 (unless (gnus-request-replace-article
10922 ,article (car gnus-article-current)
10923 (current-buffer) t)
10924 (error "Couldn't replace article")))
10925 ;; The cache and backlog have to be flushed somewhat.
10926 (when gnus-keep-backlog
10927 (gnus-backlog-remove-article
10928 (car gnus-article-current) (cdr gnus-article-current)))
10929 (when gnus-use-cache
10930 (gnus-cache-update-article
10931 (car gnus-article-current) (cdr gnus-article-current)))))
10933 (put 'gnus-with-article 'lisp-indent-function 1)
10934 (put 'gnus-with-article 'edebug-form-spec '(form body))
10936 ;; Thread-based commands.
10938 (defun gnus-summary-articles-in-thread (&optional article)
10939 "Return a list of all articles in the current thread.
10940 If ARTICLE is non-nil, return all articles in the thread that starts
10941 with that article."
10942 (let* ((article (or article (gnus-summary-article-number)))
10943 (data (gnus-data-find-list article))
10944 (top-level (gnus-data-level (car data)))
10946 (cond ((null gnus-thread-operation-ignore-subject)
10947 (gnus-simplify-subject-re
10948 (mail-header-subject (gnus-data-header (car data)))))
10949 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10950 (gnus-simplify-subject-fuzzy
10951 (mail-header-subject (gnus-data-header (car data)))))
10953 (end-point (save-excursion
10954 (if (gnus-summary-go-to-next-thread)
10955 (point) (point-max))))
10958 (< (gnus-data-pos (car data)) end-point))
10959 (when (or (not top-subject)
10960 (string= top-subject
10961 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10962 (gnus-simplify-subject-fuzzy
10963 (mail-header-subject
10964 (gnus-data-header (car data))))
10965 (gnus-simplify-subject-re
10966 (mail-header-subject
10967 (gnus-data-header (car data)))))))
10968 (push (gnus-data-number (car data)) articles))
10969 (unless (and (setq data (cdr data))
10970 (> (gnus-data-level (car data)) top-level))
10972 ;; Return the list of articles.
10973 (nreverse articles)))
10975 (defun gnus-summary-rethread-current ()
10976 "Rethread the thread the current article is part of."
10978 (let* ((gnus-show-threads t)
10979 (article (gnus-summary-article-number))
10980 (id (mail-header-id (gnus-summary-article-header)))
10981 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10983 (error "No article on the current line"))
10984 (gnus-rebuild-thread id)
10985 (gnus-summary-goto-subject article)))
10987 (defun gnus-summary-reparent-thread ()
10988 "Make the current article child of the marked (or previous) article.
10990 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10991 is non-nil or the Subject: of both articles are the same."
10993 (unless (not (gnus-group-read-only-p))
10994 (error "The current newsgroup does not support article editing"))
10995 (unless (<= (length gnus-newsgroup-processable) 1)
10996 (error "No more than one article may be marked"))
10997 (let ((child (gnus-summary-article-number))
10998 ;; First grab the marked article, otherwise one line up.
10999 (parent (if (not (null gnus-newsgroup-processable))
11000 (car gnus-newsgroup-processable)
11002 (if (eq (forward-line -1) 0)
11003 (gnus-summary-article-number)
11004 (error "Beginning of summary buffer"))))))
11005 (gnus-summary-reparent-children parent (list child))))
11007 (defun gnus-summary-reparent-children (parent children)
11008 "Make PARENT the parent of CHILDREN.
11009 When called interactively, PARENT is the current article and CHILDREN
11010 are the process-marked articles."
11012 (list (gnus-summary-article-number)
11013 (gnus-summary-work-articles nil)))
11014 (dolist (child children)
11015 (save-window-excursion
11016 (let ((gnus-article-buffer " *reparent*"))
11017 (unless (not (eq parent child))
11018 (error "An article may not be self-referential"))
11019 (let ((message-id (mail-header-id
11020 (gnus-summary-article-header parent))))
11021 (unless (and message-id (not (equal message-id "")))
11022 (error "No message-id in desired parent"))
11023 (gnus-with-article child
11025 (goto-char (point-min))
11026 (message-narrow-to-head)
11027 (if (re-search-forward "^References: " nil t)
11029 (re-search-forward "^[^ \t]" nil t)
11032 (insert " " message-id))
11033 (insert "References: " message-id "\n"))))
11034 (set-buffer gnus-summary-buffer)
11035 (gnus-summary-unmark-all-processable)
11036 (gnus-summary-update-article child)
11037 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11038 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11039 (gnus-summary-rethread-current)
11040 (gnus-message 3 "Article %d is now the child of article %d"
11043 (defun gnus-summary-toggle-threads (&optional arg)
11044 "Toggle showing conversation threads.
11045 If ARG is positive number, turn showing conversation threads on."
11047 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11048 (setq gnus-show-threads
11049 (if (null arg) (not gnus-show-threads)
11050 (> (prefix-numeric-value arg) 0)))
11051 (gnus-summary-prepare)
11052 (gnus-summary-goto-subject current)
11053 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11054 (gnus-summary-position-point)))
11056 (defun gnus-summary-show-all-threads ()
11057 "Show all threads."
11060 (let ((buffer-read-only nil))
11061 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
11062 (gnus-summary-position-point))
11064 (defun gnus-summary-show-thread ()
11065 "Show thread subtrees.
11066 Returns nil if no thread was there to be shown."
11068 (let ((buffer-read-only nil)
11070 (end (point-at-eol))
11071 ;; Leave point at bol
11072 (beg (progn (beginning-of-line) (point))))
11074 ;; Any hidden lines here?
11075 (search-forward "\r" end t)
11076 (subst-char-in-region beg end ?\^M ?\n t)
11078 (gnus-summary-position-point))))
11080 (defun gnus-summary-maybe-hide-threads ()
11081 "If requested, hide the threads that should be hidden."
11082 (when (and gnus-show-threads
11083 gnus-thread-hide-subtree)
11084 (gnus-summary-hide-all-threads
11085 (if (or (consp gnus-thread-hide-subtree)
11086 (functionp gnus-thread-hide-subtree))
11087 (gnus-make-predicate gnus-thread-hide-subtree)
11090 ;;; Hiding predicates.
11092 (defun gnus-article-unread-p (header)
11093 (memq (mail-header-number header) gnus-newsgroup-unreads))
11095 (defun gnus-article-unseen-p (header)
11096 (memq (mail-header-number header) gnus-newsgroup-unseen))
11098 (defun gnus-map-articles (predicate articles)
11099 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11100 (apply 'gnus-or (mapcar predicate
11101 (mapcar (lambda (number)
11102 (gnus-summary-article-header number))
11105 (defun gnus-summary-hide-all-threads (&optional predicate)
11106 "Hide all thread subtrees.
11107 If PREDICATE is supplied, threads that satisfy this predicate
11108 will not be hidden."
11111 (goto-char (point-min))
11114 (when (or (not predicate)
11116 predicate (gnus-summary-article-children)))
11117 (gnus-summary-hide-thread))
11118 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11119 (gnus-summary-position-point))
11121 (defun gnus-summary-hide-thread ()
11122 "Hide thread subtrees.
11123 If PREDICATE is supplied, threads that satisfy this predicate
11124 will not be hidden.
11125 Returns nil if no threads were there to be hidden."
11127 (let ((buffer-read-only nil)
11129 (article (gnus-summary-article-number)))
11131 ;; Go forward until either the buffer ends or the subthread
11133 (when (and (not (eobp))
11134 (or (zerop (gnus-summary-next-thread 1 t))
11135 (goto-char (point-max))))
11137 (if (and (> (point) start)
11138 (search-backward "\n" start t))
11140 (subst-char-in-region start (point) ?\n ?\^M)
11141 (gnus-summary-goto-subject article))
11145 (defun gnus-summary-go-to-next-thread (&optional previous)
11146 "Go to the same level (or less) next thread.
11147 If PREVIOUS is non-nil, go to previous thread instead.
11148 Return the article number moved to, or nil if moving was impossible."
11149 (let ((level (gnus-summary-thread-level))
11150 (way (if previous -1 1))
11153 (while (and (not (eobp))
11154 (< level (gnus-summary-thread-level)))
11155 (forward-line way))
11162 (gnus-summary-article-number)
11163 (goto-char beg)))))
11165 (defun gnus-summary-next-thread (n &optional silent)
11166 "Go to the same level next N'th thread.
11167 If N is negative, search backward instead.
11168 Returns the difference between N and the number of skips actually
11171 If SILENT, don't output messages."
11173 (let ((backward (< n 0))
11175 (while (and (> n 0)
11176 (gnus-summary-go-to-next-thread backward))
11179 (gnus-summary-position-point))
11180 (when (and (not silent) (/= 0 n))
11181 (gnus-message 7 "No more threads"))
11184 (defun gnus-summary-prev-thread (n)
11185 "Go to the same level previous N'th thread.
11186 Returns the difference between N and the number of skips actually
11189 (gnus-summary-next-thread (- n)))
11191 (defun gnus-summary-go-down-thread ()
11192 "Go down one level in the current thread."
11193 (let ((children (gnus-summary-article-children)))
11195 (gnus-summary-goto-subject (car children)))))
11197 (defun gnus-summary-go-up-thread ()
11198 "Go up one level in the current thread."
11199 (let ((parent (gnus-summary-article-parent)))
11201 (gnus-summary-goto-subject parent))))
11203 (defun gnus-summary-down-thread (n)
11204 "Go down thread N steps.
11205 If N is negative, go up instead.
11206 Returns the difference between N and how many steps down that were
11211 (while (and (> n 0)
11212 (if up (gnus-summary-go-up-thread)
11213 (gnus-summary-go-down-thread)))
11215 (gnus-summary-position-point)
11217 (gnus-message 7 "Can't go further"))
11220 (defun gnus-summary-up-thread (n)
11221 "Go up thread N steps.
11222 If N is negative, go down instead.
11223 Returns the difference between N and how many steps down that were
11226 (gnus-summary-down-thread (- n)))
11228 (defun gnus-summary-top-thread ()
11229 "Go to the top of the thread."
11231 (while (gnus-summary-go-up-thread))
11232 (gnus-summary-article-number))
11234 (defun gnus-summary-kill-thread (&optional unmark)
11235 "Mark articles under current thread as read.
11236 If the prefix argument is positive, remove any kinds of marks.
11237 If the prefix argument is negative, tick articles instead."
11240 (setq unmark (prefix-numeric-value unmark)))
11241 (let ((articles (gnus-summary-articles-in-thread)))
11243 ;; Expand the thread.
11244 (gnus-summary-show-thread)
11245 ;; Mark all the articles.
11247 (gnus-summary-goto-subject (car articles))
11248 (cond ((null unmark)
11249 (gnus-summary-mark-article-as-read gnus-killed-mark))
11251 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11253 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11254 (setq articles (cdr articles))))
11255 ;; Hide killed subtrees.
11257 gnus-thread-hide-killed
11258 (gnus-summary-hide-thread))
11259 ;; If marked as read, go to next unread subject.
11260 (when (null unmark)
11261 ;; Go to next unread subject.
11262 (gnus-summary-next-subject 1 t)))
11263 (gnus-set-mode-line 'summary))
11265 ;; Summary sorting commands
11267 (defun gnus-summary-sort-by-number (&optional reverse)
11268 "Sort the summary buffer by article number.
11269 Argument REVERSE means reverse order."
11271 (gnus-summary-sort 'number reverse))
11273 (defun gnus-summary-sort-by-random (&optional reverse)
11274 "Randomize the order in the summary buffer.
11275 Argument REVERSE means to randomize in reverse order."
11277 (gnus-summary-sort 'random reverse))
11279 (defun gnus-summary-sort-by-author (&optional reverse)
11280 "Sort the summary buffer by author name alphabetically.
11281 If `case-fold-search' is non-nil, case of letters is ignored.
11282 Argument REVERSE means reverse order."
11284 (gnus-summary-sort 'author reverse))
11286 (defun gnus-summary-sort-by-recipient (&optional reverse)
11287 "Sort the summary buffer by recipient name alphabetically.
11288 If `case-fold-search' is non-nil, case of letters is ignored.
11289 Argument REVERSE means reverse order."
11291 (gnus-summary-sort 'recipient reverse))
11293 (defun gnus-summary-sort-by-subject (&optional reverse)
11294 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11295 If `case-fold-search' is non-nil, case of letters is ignored.
11296 Argument REVERSE means reverse order."
11298 (gnus-summary-sort 'subject reverse))
11300 (defun gnus-summary-sort-by-date (&optional reverse)
11301 "Sort the summary buffer by date.
11302 Argument REVERSE means reverse order."
11304 (gnus-summary-sort 'date reverse))
11306 (defun gnus-summary-sort-by-score (&optional reverse)
11307 "Sort the summary buffer by score.
11308 Argument REVERSE means reverse order."
11310 (gnus-summary-sort 'score reverse))
11312 (defun gnus-summary-sort-by-lines (&optional reverse)
11313 "Sort the summary buffer by the number of lines.
11314 Argument REVERSE means reverse order."
11316 (gnus-summary-sort 'lines reverse))
11318 (defun gnus-summary-sort-by-chars (&optional reverse)
11319 "Sort the summary buffer by article length.
11320 Argument REVERSE means reverse order."
11322 (gnus-summary-sort 'chars reverse))
11324 (defun gnus-summary-sort-by-original (&optional reverse)
11325 "Sort the summary buffer using the default sorting method.
11326 Argument REVERSE means reverse order."
11328 (let* ((buffer-read-only)
11329 (gnus-summary-prepare-hook nil))
11330 ;; We do the sorting by regenerating the threads.
11331 (gnus-summary-prepare)
11332 ;; Hide subthreads if needed.
11333 (gnus-summary-maybe-hide-threads)))
11335 (defun gnus-summary-sort (predicate reverse)
11336 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11337 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11338 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11339 (gnus-thread-sort-functions
11344 (gnus-sort-gathered-threads-function
11345 gnus-thread-sort-functions)
11346 (gnus-article-sort-functions
11350 (,article t2 t1))))
11352 (gnus-summary-prepare-hook nil))
11353 ;; We do the sorting by regenerating the threads.
11354 (gnus-summary-prepare)
11355 ;; Hide subthreads if needed.
11356 (gnus-summary-maybe-hide-threads)))
11358 ;; Summary saving commands.
11360 (defun gnus-summary-save-article (&optional n not-saved)
11361 "Save the current article using the default saver function.
11362 If N is a positive number, save the N next articles.
11363 If N is a negative number, save the N previous articles.
11364 If N is nil and any articles have been marked with the process mark,
11365 save those articles instead.
11366 The variable `gnus-default-article-saver' specifies the saver function.
11368 If the optional second argument NOT-SAVED is non-nil, articles saved
11369 will not be marked as saved."
11371 (require 'gnus-art)
11372 (let* ((articles (gnus-summary-work-articles n))
11373 (save-buffer (save-excursion
11374 (nnheader-set-temp-buffer " *Gnus Save*")))
11375 (num (length articles))
11376 ;; Whether to save decoded articles or raw articles.
11377 (decode (when gnus-article-save-coding-system
11378 (get gnus-default-article-saver :decode)))
11379 ;; When saving many articles in a single file, use the other
11380 ;; function to save articles other than the first one.
11381 (saver2 (get gnus-default-article-saver :function))
11382 (gnus-prompt-before-saving (if saver2
11384 gnus-prompt-before-saving))
11385 (gnus-default-article-saver gnus-default-article-saver)
11387 (dolist (article articles)
11388 (setq header (gnus-summary-article-header article))
11389 (if (not (vectorp header))
11390 ;; This is a pseudo-article.
11391 (if (assq 'name header)
11392 (gnus-copy-file (cdr (assq 'name header)))
11393 (gnus-message 1 "Article %d is unsaveable" article))
11394 ;; This is a real article.
11395 (save-window-excursion
11396 (let ((gnus-display-mime-function (when decode
11397 gnus-display-mime-function))
11398 (gnus-article-prepare-hook (when decode
11399 gnus-article-prepare-hook)))
11400 (gnus-summary-select-article t nil nil article)
11401 (gnus-summary-goto-subject article)))
11403 (set-buffer save-buffer)
11405 (insert-buffer-substring (if decode
11406 gnus-article-buffer
11407 gnus-original-article-buffer)))
11408 (setq file (gnus-article-save save-buffer file num))
11409 (gnus-summary-remove-process-mark article)
11411 (gnus-summary-set-saved-mark article)))
11413 (setq gnus-default-article-saver saver2
11415 (gnus-kill-buffer save-buffer)
11416 (gnus-summary-position-point)
11417 (gnus-set-mode-line 'summary)
11420 (defun gnus-summary-pipe-output (&optional arg headers)
11421 "Pipe the current article to a subprocess.
11422 If N is a positive number, pipe the N next articles.
11423 If N is a negative number, pipe the N previous articles.
11424 If N is nil and any articles have been marked with the process mark,
11425 pipe those articles instead.
11426 If HEADERS (the symbolic prefix), include the headers, too."
11427 (interactive (gnus-interactive "P\ny"))
11428 (require 'gnus-art)
11429 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11430 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11431 (gnus-summary-save-article arg t))
11432 (let ((buffer (get-buffer "*Shell Command Output*")))
11434 (not (zerop (buffer-size buffer))))
11435 (gnus-configure-windows 'pipe))))
11437 (defun gnus-summary-save-article-mail (&optional arg)
11438 "Append the current article to a Unix mail box file.
11439 If N is a positive number, save the N next articles.
11440 If N is a negative number, save the N previous articles.
11441 If N is nil and any articles have been marked with the process mark,
11442 save those articles instead."
11444 (require 'gnus-art)
11445 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11446 (gnus-summary-save-article arg)))
11448 (defun gnus-summary-save-article-rmail (&optional arg)
11449 "Append the current article to an rmail file.
11450 If N is a positive number, save the N next articles.
11451 If N is a negative number, save the N previous articles.
11452 If N is nil and any articles have been marked with the process mark,
11453 save those articles instead."
11455 (require 'gnus-art)
11456 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11457 (gnus-summary-save-article arg)))
11459 (defun gnus-summary-save-article-file (&optional arg)
11460 "Append the current article to a file.
11461 If N is a positive number, save the N next articles.
11462 If N is a negative number, save the N previous articles.
11463 If N is nil and any articles have been marked with the process mark,
11464 save those articles instead."
11466 (require 'gnus-art)
11467 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11468 (gnus-summary-save-article arg)))
11470 (defun gnus-summary-write-article-file (&optional arg)
11471 "Write the current article to a file, deleting the previous file.
11472 If N is a positive number, save the N next articles.
11473 If N is a negative number, save the N previous articles.
11474 If N is nil and any articles have been marked with the process mark,
11475 save those articles instead."
11477 (require 'gnus-art)
11478 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11479 (gnus-summary-save-article arg)))
11481 (defun gnus-summary-save-article-body-file (&optional arg)
11482 "Append the current article body to a file.
11483 If N is a positive number, save the N next articles.
11484 If N is a negative number, save the N previous articles.
11485 If N is nil and any articles have been marked with the process mark,
11486 save those articles instead."
11488 (require 'gnus-art)
11489 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11490 (gnus-summary-save-article arg)))
11492 (defun gnus-summary-write-article-body-file (&optional arg)
11493 "Write the current article body to a file, deleting the previous file.
11494 If N is a positive number, save the N next articles.
11495 If N is a negative number, save the N previous articles.
11496 If N is nil and any articles have been marked with the process mark,
11497 save those articles instead."
11499 (require 'gnus-art)
11500 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
11501 (gnus-summary-save-article arg)))
11503 (defun gnus-summary-muttprint (&optional arg)
11504 "Print the current article using Muttprint.
11505 If N is a positive number, save the N next articles.
11506 If N is a negative number, save the N previous articles.
11507 If N is nil and any articles have been marked with the process mark,
11508 save those articles instead."
11510 (require 'gnus-art)
11511 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11512 (gnus-summary-save-article arg t)))
11514 (defun gnus-summary-pipe-message (program)
11515 "Pipe the current article through PROGRAM."
11516 (interactive "sProgram: ")
11517 (gnus-summary-select-article)
11518 (let ((mail-header-separator ""))
11519 (gnus-eval-in-buffer-window gnus-article-buffer
11522 (let ((start (window-start))
11524 (message-pipe-buffer-body program)
11525 (set-window-start (get-buffer-window (current-buffer)) start))))))
11527 (defun gnus-get-split-value (methods)
11528 "Return a value based on the split METHODS."
11529 (let (split-name method result match)
11532 (set-buffer gnus-original-article-buffer)
11534 (nnheader-narrow-to-headers)
11535 (while (and methods (not split-name))
11536 (goto-char (point-min))
11537 (setq method (pop methods))
11538 (setq match (car method))
11541 ;; Regular expression.
11543 (re-search-forward match nil t)))
11548 (setq result (funcall match gnus-newsgroup-name))))
11553 (setq result (eval match)))))
11554 (setq split-name (cdr method))
11555 (cond ((stringp result)
11556 (push (expand-file-name
11557 result gnus-article-save-directory)
11560 (setq split-name (append result split-name)))))))))
11561 (nreverse split-name)))
11563 (defun gnus-valid-move-group-p (group)
11564 (and (boundp group)
11565 (symbol-name group)
11566 (symbol-value group)
11567 (gnus-get-function (gnus-find-method-for-group
11568 (symbol-name group)) 'request-accept-article t)))
11570 (defun gnus-read-move-group-name (prompt default articles prefix)
11571 "Read a group name."
11572 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11573 (minibuffer-confirm-incomplete nil) ; XEmacs
11577 (if (> (length articles) 1)
11578 (format "these %d articles" (length articles))
11583 (gnus-completing-read-with-default
11586 'gnus-valid-move-group-p
11588 'gnus-group-history))
11589 ((= 1 (length split-name))
11590 (gnus-completing-read-with-default
11591 (car split-name) prom
11593 'gnus-valid-move-group-p
11595 'gnus-group-history))
11597 (gnus-completing-read-with-default
11599 (mapcar 'list (nreverse split-name))
11601 'gnus-group-history))))
11602 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11604 (if (or (string= to-newsgroup "")
11605 (string= to-newsgroup prefix))
11606 (setq to-newsgroup default))
11607 (unless to-newsgroup
11608 (error "No group name entered"))
11609 (or (gnus-active to-newsgroup)
11610 (gnus-activate-group to-newsgroup nil nil to-method)
11611 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11613 (or (and (gnus-request-create-group to-newsgroup to-method)
11614 (gnus-activate-group
11615 to-newsgroup nil nil to-method)
11616 (gnus-subscribe-group to-newsgroup))
11617 (error "Couldn't create group %s" to-newsgroup)))
11618 (error "No such group: %s" to-newsgroup)))
11621 (defvar gnus-summary-save-parts-counter)
11623 (defun gnus-summary-save-parts (type dir n &optional reverse)
11624 "Save parts matching TYPE to DIR.
11625 If REVERSE, save parts that do not match TYPE."
11627 (list (read-string "Save parts of type: "
11628 (or (car gnus-summary-save-parts-type-history)
11629 gnus-summary-save-parts-default-mime)
11630 'gnus-summary-save-parts-type-history)
11631 (setq gnus-summary-save-parts-last-directory
11632 (read-file-name "Save to directory: "
11633 gnus-summary-save-parts-last-directory
11635 current-prefix-arg))
11636 (gnus-summary-iterate n
11637 (let ((gnus-display-mime-function nil)
11638 (gnus-inhibit-treatment t))
11639 (gnus-summary-select-article))
11641 (set-buffer gnus-article-buffer)
11642 (let ((handles (or gnus-article-mime-handles
11643 (mm-dissect-buffer nil gnus-article-loose-mime)
11644 (and gnus-article-emulate-mime
11646 (gnus-summary-save-parts-counter 1))
11648 (gnus-summary-save-parts-1 type dir handles reverse)
11649 (unless gnus-article-mime-handles ;; Don't destroy this case.
11650 (mm-destroy-parts handles)))))))
11652 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11653 (if (stringp (car handle))
11654 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11657 (not (string-match type (mm-handle-media-type handle)))
11658 (string-match type (mm-handle-media-type handle)))
11659 (let ((file (expand-file-name
11661 mm-file-name-rewrite-functions
11662 (file-name-nondirectory
11664 (mail-content-type-get
11665 (mm-handle-disposition handle) 'filename)
11666 (mail-content-type-get
11667 (mm-handle-type handle) 'name)
11668 (format "%s.%d.%d" gnus-newsgroup-name
11669 (cdr gnus-article-current)
11670 gnus-summary-save-parts-counter))))
11672 (incf gnus-summary-save-parts-counter)
11673 (unless (file-exists-p file)
11674 (mm-save-part-to-file handle file))))))
11676 ;; Summary extract commands
11678 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11679 (let ((buffer-read-only nil)
11680 (article (gnus-summary-article-number))
11682 (unless (gnus-summary-goto-subject article)
11683 (error "No such article: %d" article))
11684 (gnus-summary-position-point)
11685 ;; If all commands are to be bunched up on one line, we collect
11687 (unless gnus-view-pseudos-separately
11688 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11691 (setq action (cdr (assq 'action (car ps))))
11692 (setq files (list (cdr (assq 'name (car ps)))))
11693 (while (and ps (cdr ps)
11694 (string= (or action "1")
11695 (or (cdr (assq 'action (cadr ps))) "2")))
11696 (push (cdr (assq 'name (cadr ps))) files)
11697 (setcdr ps (cddr ps)))
11699 (when (not (string-match "%s" action))
11702 (when (assq 'execute (car ps))
11703 (setcdr (assq 'execute (car ps))
11704 (funcall (if (string-match "%s" action)
11711 (shell-quote-argument f)))
11713 (setq ps (cdr ps)))))
11714 (if (and gnus-view-pseudos (not not-view))
11716 (when (assq 'execute (car pslist))
11717 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11718 (eq gnus-view-pseudos 'not-confirm)))
11719 (setq pslist (cdr pslist)))
11722 (setq after-article (or (cdr (assq 'article (car pslist)))
11723 (gnus-summary-article-number)))
11724 (gnus-summary-goto-subject after-article)
11727 (insert " " (file-name-nondirectory
11728 (cdr (assq 'name (car pslist))))
11729 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11731 (forward-line -1) ; back to `b'
11732 (gnus-add-text-properties
11733 b (1- e) (list 'gnus-number gnus-reffed-article-number
11734 gnus-mouse-face-prop gnus-mouse-face))
11736 after-article gnus-reffed-article-number
11737 gnus-unread-mark b (car pslist) 0 (- e b))
11738 (setq gnus-newsgroup-unreads
11739 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11740 gnus-reffed-article-number))
11741 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11742 (setq pslist (cdr pslist)))))))
11744 (defun gnus-pseudos< (p1 p2)
11745 (let ((c1 (cdr (assq 'action p1)))
11746 (c2 (cdr (assq 'action p2))))
11747 (and c1 c2 (string< c1 c2))))
11749 (defun gnus-request-pseudo-article (props)
11750 (cond ((assq 'execute props)
11751 (gnus-execute-command (cdr (assq 'execute props)))))
11752 (let ((gnus-current-article (gnus-summary-article-number)))
11753 (gnus-run-hooks 'gnus-mark-article-hook)))
11755 (defun gnus-execute-command (command &optional automatic)
11757 (gnus-article-setup-buffer)
11758 (set-buffer gnus-article-buffer)
11759 (setq buffer-read-only nil)
11760 (let ((command (if automatic command
11761 (read-string "Command: " (cons command 0)))))
11763 (insert "$ " command "\n\n")
11764 (if gnus-view-pseudo-asynchronously
11765 (start-process "gnus-execute" (current-buffer) shell-file-name
11766 shell-command-switch command)
11767 (call-process shell-file-name nil t nil
11768 shell-command-switch command)))))
11770 ;; Summary kill commands.
11772 (defun gnus-summary-edit-global-kill (article)
11773 "Edit the \"global\" kill file."
11774 (interactive (list (gnus-summary-article-number)))
11775 (gnus-group-edit-global-kill article))
11777 (defun gnus-summary-edit-local-kill ()
11778 "Edit a local kill file applied to the current newsgroup."
11780 (setq gnus-current-headers (gnus-summary-article-header))
11781 (gnus-group-edit-local-kill
11782 (gnus-summary-article-number) gnus-newsgroup-name))
11784 ;;; Header reading.
11786 (defun gnus-read-header (id &optional header)
11787 "Read the headers of article ID and enter them into the Gnus system."
11788 (let ((group gnus-newsgroup-name)
11789 (gnus-override-method
11791 gnus-override-method
11792 (and (gnus-news-group-p gnus-newsgroup-name)
11793 (car (gnus-refer-article-methods)))))
11795 ;; First we check to see whether the header in question is already
11798 ;; This is a Message-ID.
11799 (setq header (or header (gnus-id-to-header id)))
11800 ;; This is an article number.
11801 (setq header (or header (gnus-summary-article-header id))))
11803 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11804 ;; We have found the header.
11806 ;; We have to really fetch the header to this article.
11808 (set-buffer nntp-server-buffer)
11809 (when (setq where (gnus-request-head id group))
11810 (nnheader-fold-continuation-lines)
11811 (goto-char (point-max))
11813 (goto-char (point-min))
11817 ((cdr where) (cdr where))
11818 (header (mail-header-number header))
11819 (t gnus-reffed-article-number))
11821 (insert " Article retrieved.\n"))
11822 (if (or (not where)
11823 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11824 () ; Malformed head.
11825 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11826 (when (and (stringp id)
11828 (not (string= (gnus-group-real-name group)
11830 (not (gnus-server-equal gnus-override-method
11831 (gnus-group-method group)))))
11832 ;; If we fetched by Message-ID and the article came from
11833 ;; a different group (or server), we fudge some bogus
11834 ;; article numbers for this article.
11835 (mail-header-set-number header gnus-reffed-article-number))
11837 (set-buffer gnus-summary-buffer)
11838 (decf gnus-reffed-article-number)
11839 (gnus-remove-header (mail-header-number header))
11840 (push header gnus-newsgroup-headers)
11841 (setq gnus-current-headers header)
11842 (push (mail-header-number header) gnus-newsgroup-limit)))
11845 (defun gnus-remove-header (number)
11846 "Remove header NUMBER from `gnus-newsgroup-headers'."
11847 (if (and gnus-newsgroup-headers
11848 (= number (mail-header-number (car gnus-newsgroup-headers))))
11849 (pop gnus-newsgroup-headers)
11850 (let ((headers gnus-newsgroup-headers))
11851 (while (and (cdr headers)
11852 (not (= number (mail-header-number (cadr headers)))))
11854 (when (cdr headers)
11855 (setcdr headers (cddr headers))))))
11858 ;;; summary highlights
11861 (defun gnus-highlight-selected-summary ()
11862 "Highlight selected article in summary buffer."
11863 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11864 (when gnus-summary-selected-face
11866 (let* ((beg (point-at-bol))
11867 (end (point-at-eol))
11868 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11869 (from (if (get-text-property beg gnus-mouse-face-prop)
11871 (or (next-single-property-change
11872 beg gnus-mouse-face-prop nil end)
11877 (or (next-single-property-change
11878 from gnus-mouse-face-prop nil end)
11880 ;; If no mouse-face prop on line we will have to = from = end,
11881 ;; so we highlight the entire line instead.
11882 (when (= (+ to 2) from)
11885 (if gnus-newsgroup-selected-overlay
11886 ;; Move old overlay.
11888 gnus-newsgroup-selected-overlay from to (current-buffer))
11889 ;; Create new overlay.
11891 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11892 'face gnus-summary-selected-face))))))
11894 (defvar gnus-summary-highlight-line-cached nil)
11895 (defvar gnus-summary-highlight-line-trigger nil)
11897 (defun gnus-summary-highlight-line-0 ()
11898 (if (and (eq gnus-summary-highlight-line-trigger
11899 gnus-summary-highlight)
11900 gnus-summary-highlight-line-cached)
11901 gnus-summary-highlight-line-cached
11902 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11903 gnus-summary-highlight-line-cached
11904 (let* ((cond (list 'cond))
11906 (list gnus-summary-highlight))
11908 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11912 (gnus-byte-compile (list 'lambda nil cond))))))
11914 (defun gnus-summary-highlight-line ()
11915 "Highlight current line according to `gnus-summary-highlight'."
11916 (let* ((beg (point-at-bol))
11917 (article (or (gnus-summary-article-number) gnus-current-article))
11918 (score (or (cdr (assq article
11919 gnus-newsgroup-scored))
11920 gnus-summary-default-score 0))
11921 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11922 (inhibit-read-only t)
11923 (default gnus-summary-default-score)
11924 (default-high gnus-summary-default-high-score)
11925 (default-low gnus-summary-default-low-score)
11926 (uncached (and gnus-summary-use-undownloaded-faces
11927 (memq article gnus-newsgroup-undownloaded)
11928 (not (memq article gnus-newsgroup-cached)))))
11929 (let ((face (funcall (gnus-summary-highlight-line-0))))
11930 (unless (eq face (get-text-property beg 'face))
11931 (gnus-put-text-property-excluding-characters-with-faces
11932 beg (point-at-eol) 'face
11933 (setq face (if (boundp face) (symbol-value face) face)))
11934 (when gnus-summary-highlight-line-function
11935 (funcall gnus-summary-highlight-line-function article face))))))
11937 (defun gnus-update-read-articles (group unread &optional compute)
11938 "Update the list of read articles in GROUP.
11939 UNREAD is a sorted list."
11940 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11941 (info (gnus-get-info group))
11944 (if (or (not info) (not active))
11945 ;; There is no info on this group if it was, in fact,
11946 ;; killed. Gnus stores no information on killed groups, so
11947 ;; there's nothing to be done.
11948 ;; One could store the information somewhere temporarily,
11949 ;; perhaps... Hmmm...
11951 ;; Remove any negative articles numbers.
11952 (while (and unread (< (car unread) 0))
11953 (setq unread (cdr unread)))
11954 ;; Remove any expired article numbers
11955 (while (and unread (< (car unread) (car active)))
11956 (setq unread (cdr unread)))
11957 ;; Compute the ranges of read articles by looking at the list of
11958 ;; unread articles.
11960 (when (/= (car unread) prev)
11961 (push (if (= prev (1- (car unread))) prev
11962 (cons prev (1- (car unread))))
11964 (setq prev (1+ (car unread)))
11965 (setq unread (cdr unread)))
11966 (when (<= prev (cdr active))
11967 (push (cons prev (cdr active)) read))
11968 (setq read (if (> (length read) 1) (nreverse read) read))
11973 ;; Propagate the read marks to the backend.
11974 (when (gnus-check-backend-function 'request-set-mark group)
11975 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11976 (add (gnus-remove-from-range read (gnus-info-read info))))
11978 (unless (gnus-check-group group)
11979 (error "Can't open server for %s" group))
11980 (gnus-request-set-mark
11981 group (delq nil (list (if add (list add 'add '(read)))
11982 (if del (list del 'del '(read))))))
11984 `(gnus-request-set-mark
11987 (if del (list del 'add '(read)))
11988 (if add (list add 'del '(read))))))))))
11989 (set-buffer gnus-group-buffer)
11990 (gnus-undo-register
11992 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11993 (gnus-info-set-read ',info ',(gnus-info-read info))
11994 (gnus-get-unread-articles-in-group ',info
11995 (gnus-active ,group))
11996 (gnus-group-update-group ,group t)
11998 ;; Enter this list into the group info.
11999 (gnus-info-set-read info read)
12000 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12001 (gnus-get-unread-articles-in-group info (gnus-active group))
12004 (defun gnus-offer-save-summaries ()
12005 "Offer to save all active summary buffers."
12007 ;; Go through all buffers and find all summaries.
12008 (dolist (buffer (buffer-list))
12009 (when (and (setq buffer (buffer-name buffer))
12010 (string-match "Summary" buffer)
12011 (with-current-buffer buffer
12012 ;; We check that this is, indeed, a summary buffer.
12013 (and (eq major-mode 'gnus-summary-mode)
12014 ;; Also make sure this isn't bogus.
12015 gnus-newsgroup-prepared
12016 ;; Also make sure that this isn't a
12017 ;; dead summary buffer.
12018 (not gnus-dead-summary-mode))))
12019 (push buffer buffers)))
12020 ;; Go through all these summary buffers and offer to save them.
12024 "Update summary buffer %s? "
12026 (switch-to-buffer buf)
12027 (gnus-summary-exit))
12030 (defun gnus-summary-setup-default-charset ()
12031 "Setup newsgroup default charset."
12032 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12033 (setq gnus-newsgroup-charset nil)
12034 (let* ((ignored-charsets
12035 (or gnus-newsgroup-ephemeral-ignored-charsets
12037 (and gnus-newsgroup-name
12038 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12039 gnus-newsgroup-ignored-charsets))))
12040 (setq gnus-newsgroup-charset
12041 (or gnus-newsgroup-ephemeral-charset
12042 (and gnus-newsgroup-name
12043 (gnus-parameter-charset gnus-newsgroup-name))
12044 gnus-default-charset))
12045 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12046 ignored-charsets))))
12052 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12053 "Display the current article buffer fully MIME-buttonized.
12054 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12055 treated as multipart/mixed."
12057 (require 'gnus-art)
12058 (let ((gnus-unbuttonized-mime-types nil)
12059 (gnus-mime-display-multipart-as-mixed show-all-parts))
12060 (gnus-summary-show-article)))
12062 (defun gnus-summary-repair-multipart (article)
12063 "Add a Content-Type header to a multipart article without one."
12064 (interactive (list (gnus-summary-article-number)))
12065 (gnus-with-article article
12066 (message-narrow-to-head)
12067 (message-remove-header "Mime-Version")
12068 (goto-char (point-max))
12069 (insert "Mime-Version: 1.0\n")
12071 (when (search-forward "\n--" nil t)
12072 (let ((separator (buffer-substring (point) (point-at-eol))))
12073 (message-narrow-to-head)
12074 (message-remove-header "Content-Type")
12075 (goto-char (point-max))
12076 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12079 (let (gnus-mark-article-hook)
12080 (gnus-summary-select-article t t nil article)))
12082 (defun gnus-summary-toggle-display-buttonized ()
12083 "Toggle the buttonizing of the article buffer."
12085 (require 'gnus-art)
12086 (if (setq gnus-inhibit-mime-unbuttonizing
12087 (not gnus-inhibit-mime-unbuttonizing))
12088 (let ((gnus-unbuttonized-mime-types nil))
12089 (gnus-summary-show-article))
12090 (gnus-summary-show-article)))
12093 ;;; Generic summary marking commands
12096 (defvar gnus-summary-marking-alist
12097 '((read gnus-del-mark "d")
12098 (unread gnus-unread-mark "u")
12099 (ticked gnus-ticked-mark "!")
12100 (dormant gnus-dormant-mark "?")
12101 (expirable gnus-expirable-mark "e"))
12102 "An alist of names/marks/keystrokes.")
12104 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12105 (defvar gnus-summary-mark-map)
12107 (defun gnus-summary-make-all-marking-commands ()
12108 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12109 (dolist (elem gnus-summary-marking-alist)
12110 (apply 'gnus-summary-make-marking-command elem)))
12112 (defun gnus-summary-make-marking-command (name mark keystroke)
12113 (let ((map (make-sparse-keymap)))
12114 (define-key gnus-summary-generic-mark-map keystroke map)
12115 (dolist (lway `((next "next" next nil "n")
12116 (next-unread "next unread" next t "N")
12117 (prev "previous" prev nil "p")
12118 (prev-unread "previous unread" prev t "P")
12119 (nomove "" nil nil ,keystroke)))
12120 (let ((func (gnus-summary-make-marking-command-1
12121 mark (car lway) lway name)))
12122 (setq func (eval func))
12123 (define-key map (nth 4 lway) func)))))
12125 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12127 (format "gnus-summary-put-mark-as-%s%s"
12128 name (if (eq way 'nomove)
12130 (concat "-" (symbol-name way)))))
12133 "Mark the current article as %s%s.
12134 If N, the prefix, then repeat N times.
12135 If N is negative, move in reverse order.
12136 The difference between N and the actual number of articles marked is
12140 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12142 (defun gnus-summary-generic-mark (n mark move unread)
12143 "Mark N articles with MARK."
12144 (unless (eq major-mode 'gnus-summary-mode)
12145 (error "This command can only be used in the summary buffer"))
12146 (gnus-summary-show-thread)
12149 ((eq move 'next) 1)
12150 ((eq move 'prev) -1)
12152 (if (zerop nummove)
12156 nummove (* -1 nummove))))
12157 (while (and (> n 0)
12158 (gnus-summary-mark-article nil mark)
12159 (zerop (gnus-summary-next-subject nummove unread t)))
12162 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12163 (gnus-summary-recenter)
12164 (gnus-summary-position-point)
12165 (gnus-set-mode-line 'summary)
12168 (defun gnus-summary-insert-articles (articles)
12169 (when (setq articles
12170 (gnus-sorted-difference articles
12171 (mapcar (lambda (h)
12172 (mail-header-number h))
12173 gnus-newsgroup-headers)))
12174 (setq gnus-newsgroup-headers
12176 gnus-newsgroup-headers
12177 (gnus-fetch-headers articles)
12178 'gnus-article-sort-by-number))
12179 ;; Suppress duplicates?
12180 (when gnus-suppress-duplicates
12181 (gnus-dup-suppress-articles))
12183 ;; We might want to build some more threads first.
12184 (when (and gnus-fetch-old-headers
12185 (eq gnus-headers-retrieved-by 'nov))
12186 (if (eq gnus-fetch-old-headers 'invisible)
12187 (gnus-build-all-threads)
12188 (gnus-build-old-threads)))
12189 ;; Let the Gnus agent mark articles as read.
12191 (gnus-agent-get-undownloaded-list))
12192 ;; Remove list identifiers from subject
12193 (when gnus-list-identifiers
12194 (gnus-summary-remove-list-identifiers))
12195 ;; First and last article in this newsgroup.
12196 (when gnus-newsgroup-headers
12197 (setq gnus-newsgroup-begin
12198 (mail-header-number (car gnus-newsgroup-headers))
12200 (mail-header-number
12201 (gnus-last-element gnus-newsgroup-headers))))
12202 (when gnus-use-scoring
12203 (gnus-possibly-score-headers))))
12205 (defun gnus-summary-insert-old-articles (&optional all)
12206 "Insert all old articles in this group.
12207 If ALL is non-nil, already read articles become readable.
12208 If ALL is a number, fetch this number of articles."
12211 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12214 ;; Some nntp servers lie about their active range. When
12215 ;; this happens, the active range can be in the millions.
12216 ;; Use a compressed range to avoid creating a huge list.
12217 (gnus-range-difference (list gnus-newsgroup-active) old))
12218 (setq len (gnus-range-length older))
12223 (let ((older-range (nreverse older)))
12227 (let* ((r (pop older-range))
12228 (min (if (numberp r) r (car r)))
12229 (max (if (numberp r) r (cdr r))))
12230 (while (and (<= min max)
12235 (setq older (gnus-uncompress-range older))))
12237 (setq older (gnus-uncompress-range older)))
12239 (when (and (numberp gnus-large-newsgroup)
12240 (> len gnus-large-newsgroup))
12241 (let* ((cursor-in-echo-area nil)
12242 (initial (gnus-parameter-large-newsgroup-initial
12243 gnus-newsgroup-name))
12247 "How many articles from %s (%s %d): "
12249 (gnus-group-decoded-name gnus-newsgroup-name) 35)
12250 (if initial "max" "default")
12253 (cons (number-to-string initial)
12255 (unless (string-match "^[ \t]*$" input)
12256 (setq all (string-to-number input))
12258 (let ((older-range (nreverse older)))
12262 (let* ((r (pop older-range))
12263 (min (if (numberp r) r (car r)))
12264 (max (if (numberp r) r (cdr r))))
12265 (while (and (<= min max)
12269 max (1- max))))))))))
12270 (setq older (gnus-uncompress-range older))))
12272 (message "No old news.")
12273 (gnus-summary-insert-articles older)
12274 (gnus-summary-limit (gnus-sorted-nunion old older))))
12275 (gnus-summary-position-point)))
12277 (defun gnus-summary-insert-new-articles ()
12278 "Insert all new articles in this group."
12281 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12282 (old-active gnus-newsgroup-active)
12283 (nnmail-fetched-sources (list t))
12285 (setq gnus-newsgroup-active
12286 (gnus-activate-group gnus-newsgroup-name 'scan))
12287 (setq i (cdr gnus-newsgroup-active))
12288 (while (> i (cdr old-active))
12292 (message "No gnus is bad news")
12293 (gnus-summary-insert-articles new)
12294 (setq gnus-newsgroup-unreads
12295 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12296 (gnus-summary-limit (gnus-sorted-nunion old new))))
12297 (gnus-summary-position-point)))
12299 (gnus-summary-make-all-marking-commands)
12301 (gnus-ems-redefine)
12303 (provide 'gnus-sum)
12305 (run-hooks 'gnus-sum-load-hook)
12307 ;; Local Variables:
12308 ;; coding: iso-8859-1
12311 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12312 ;;; gnus-sum.el ends here