1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
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 the article under point.
312 Which article this is is controlled by the `gnus-auto-select-subject'
315 If you want to prevent automatic selection of articles in some
316 newsgroups, set the variable to nil in `gnus-select-group-hook'."
317 :group 'gnus-group-select
318 :type '(choice (const :tag "none" nil)
319 (sexp :menu-tag "first" t)))
321 (defcustom gnus-auto-select-subject 'unread
322 "*Says what subject to place under point when entering a group.
324 This variable can either be the symbols `first' (place point on the
325 first subject), `unread' (place point on the subject line of the first
326 unread article), `best' (place point on the subject line of the
327 higest-scored article), `unseen' (place point on the subject line of
328 the first unseen article), `unseen-or-unread' (place point on the subject
329 line of the first unseen article or, if all article have been seen, on the
330 subject line of the first unread article), or a function to be called to
331 place point on some subject line."
333 :group 'gnus-group-select
334 :type '(choice (const best)
338 (const unseen-or-unread)))
340 (defcustom gnus-auto-select-next t
341 "*If non-nil, offer to go to the next group from the end of the previous.
342 If the value is t and the next newsgroup is empty, Gnus will exit
343 summary mode and go back to group mode. If the value is neither nil
344 nor t, Gnus will select the following unread newsgroup. In
345 particular, if the value is the symbol `quietly', the next unread
346 newsgroup will be selected without any confirmation, and if it is
347 `almost-quietly', the next group will be selected without any
348 confirmation if you are located on the last article in the group.
349 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
350 will go to the next group without confirmation."
351 :group 'gnus-summary-maneuvering
352 :type '(choice (const :tag "off" nil)
354 (const almost-quietly)
355 (const slightly-quietly)
356 (sexp :menu-tag "on" t)))
358 (defcustom gnus-auto-select-same nil
359 "*If non-nil, select the next article with the same subject.
360 If there are no more articles with the same subject, go to
361 the first unread article."
362 :group 'gnus-summary-maneuvering
365 (defcustom gnus-auto-goto-ignores 'unfetched
366 "*Says how to handle unfetched articles when maneuvering.
368 This variable can either be the symbols nil (maneuver to any
369 article), `undownloaded' (maneuvering while unplugged ignores articles
370 that have not been fetched), `always-undownloaded' (maneuvering always
371 ignores articles that have not been fetched), `unfetched' (maneuvering
372 ignores articles whose headers have not been fetched).
374 NOTE: The list of unfetched articles will always be nil when plugged
375 and, when unplugged, a subset of the undownloaded article list."
377 :group 'gnus-summary-maneuvering
378 :type '(choice (const :tag "None" nil)
379 (const :tag "Undownloaded when unplugged" undownloaded)
380 (const :tag "Undownloaded" always-undownloaded)
381 (const :tag "Unfetched" unfetched)))
383 (defcustom gnus-summary-check-current nil
384 "*If non-nil, consider the current article when moving.
385 The \"unread\" movement commands will stay on the same line if the
386 current article is unread."
387 :group 'gnus-summary-maneuvering
390 (defcustom gnus-auto-center-summary 2
391 "*If non-nil, always center the current summary buffer.
392 In particular, if `vertical' do only vertical recentering. If non-nil
393 and non-`vertical', do both horizontal and vertical recentering."
394 :group 'gnus-summary-maneuvering
395 :type '(choice (const :tag "none" nil)
397 (integer :tag "height")
398 (sexp :menu-tag "both" t)))
400 (defvar gnus-auto-center-group t
401 "*If non-nil, always center the group buffer.")
403 (defcustom gnus-show-all-headers nil
404 "*If non-nil, don't hide any headers."
405 :group 'gnus-article-hiding
406 :group 'gnus-article-headers
409 (defcustom gnus-summary-ignore-duplicates nil
410 "*If non-nil, ignore articles with identical Message-ID headers."
414 (defcustom gnus-single-article-buffer t
415 "*If non-nil, display all articles in the same buffer.
416 If nil, each group will get its own article buffer."
417 :group 'gnus-article-various
420 (defcustom gnus-break-pages t
421 "*If non-nil, do page breaking on articles.
422 The page delimiter is specified by the `gnus-page-delimiter'
424 :group 'gnus-article-various
427 (defcustom gnus-move-split-methods nil
428 "*Variable used to suggest where articles are to be moved to.
429 It uses the same syntax as the `gnus-split-methods' variable.
430 However, whereas `gnus-split-methods' specifies file names as targets,
431 this variable specifies group names."
432 :group 'gnus-summary-mail
433 :type '(repeat (choice (list :value (fun) function)
434 (cons :value ("" "") regexp (repeat string))
437 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
438 "Function used to compute default prefix for article move/copy/etc prompts.
439 The function should take one argument, a group name, and return a
440 string with the suggested prefix."
441 :group 'gnus-summary-mail
444 ;; FIXME: Although the custom type is `character' for the following variables,
445 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
447 (defcustom gnus-unread-mark ? ;Whitespace
448 "*Mark used for unread articles."
449 :group 'gnus-summary-marks
452 (defcustom gnus-ticked-mark ?!
453 "*Mark used for ticked articles."
454 :group 'gnus-summary-marks
457 (defcustom gnus-dormant-mark ??
458 "*Mark used for dormant articles."
459 :group 'gnus-summary-marks
462 (defcustom gnus-del-mark ?r
463 "*Mark used for del'd articles."
464 :group 'gnus-summary-marks
467 (defcustom gnus-read-mark ?R
468 "*Mark used for read articles."
469 :group 'gnus-summary-marks
472 (defcustom gnus-expirable-mark ?E
473 "*Mark used for expirable articles."
474 :group 'gnus-summary-marks
477 (defcustom gnus-killed-mark ?K
478 "*Mark used for killed articles."
479 :group 'gnus-summary-marks
482 (defcustom gnus-spam-mark ?$
483 "*Mark used for spam articles."
485 :group 'gnus-summary-marks
488 (defcustom gnus-souped-mark ?F
489 "*Mark used for souped articles."
490 :group 'gnus-summary-marks
493 (defcustom gnus-kill-file-mark ?X
494 "*Mark used for articles killed by kill files."
495 :group 'gnus-summary-marks
498 (defcustom gnus-low-score-mark ?Y
499 "*Mark used for articles with a low score."
500 :group 'gnus-summary-marks
503 (defcustom gnus-catchup-mark ?C
504 "*Mark used for articles that are caught up."
505 :group 'gnus-summary-marks
508 (defcustom gnus-replied-mark ?A
509 "*Mark used for articles that have been replied to."
510 :group 'gnus-summary-marks
513 (defcustom gnus-forwarded-mark ?F
514 "*Mark used for articles that have been forwarded."
516 :group 'gnus-summary-marks
519 (defcustom gnus-recent-mark ?N
520 "*Mark used for articles that are recent."
522 :group 'gnus-summary-marks
525 (defcustom gnus-cached-mark ?*
526 "*Mark used for articles that are in the cache."
527 :group 'gnus-summary-marks
530 (defcustom gnus-saved-mark ?S
531 "*Mark used for articles that have been saved."
532 :group 'gnus-summary-marks
535 (defcustom gnus-unseen-mark ?.
536 "*Mark used for articles that haven't been seen."
538 :group 'gnus-summary-marks
541 (defcustom gnus-no-mark ? ;Whitespace
542 "*Mark used for articles that have no other secondary mark."
544 :group 'gnus-summary-marks
547 (defcustom gnus-ancient-mark ?O
548 "*Mark used for ancient articles."
549 :group 'gnus-summary-marks
552 (defcustom gnus-sparse-mark ?Q
553 "*Mark used for sparsely reffed articles."
554 :group 'gnus-summary-marks
557 (defcustom gnus-canceled-mark ?G
558 "*Mark used for canceled articles."
559 :group 'gnus-summary-marks
562 (defcustom gnus-duplicate-mark ?M
563 "*Mark used for duplicate articles."
564 :group 'gnus-summary-marks
567 (defcustom gnus-undownloaded-mark ?-
568 "*Mark used for articles that weren't downloaded."
570 :group 'gnus-summary-marks
573 (defcustom gnus-downloaded-mark ?+
574 "*Mark used for articles that were downloaded."
575 :group 'gnus-summary-marks
578 (defcustom gnus-downloadable-mark ?%
579 "*Mark used for articles that are to be downloaded."
580 :group 'gnus-summary-marks
583 (defcustom gnus-unsendable-mark ?=
584 "*Mark used for articles that won't be sent."
585 :group 'gnus-summary-marks
588 (defcustom gnus-score-over-mark ?+
589 "*Score mark used for articles with high scores."
590 :group 'gnus-summary-marks
593 (defcustom gnus-score-below-mark ?-
594 "*Score mark used for articles with low scores."
595 :group 'gnus-summary-marks
598 (defcustom gnus-empty-thread-mark ? ;Whitespace
599 "*There is no thread under the article."
600 :group 'gnus-summary-marks
603 (defcustom gnus-not-empty-thread-mark ?=
604 "*There is a thread under the article."
605 :group 'gnus-summary-marks
608 (defcustom gnus-view-pseudo-asynchronously nil
609 "*If non-nil, Gnus will view pseudo-articles asynchronously."
610 :group 'gnus-extract-view
613 (defcustom gnus-auto-expirable-marks
614 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
615 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
616 gnus-souped-mark gnus-duplicate-mark)
617 "*The list of marks converted into expiration if a group is auto-expirable."
620 :type '(repeat character))
622 (defcustom gnus-inhibit-user-auto-expire t
623 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
628 (defcustom gnus-view-pseudos nil
629 "*If `automatic', pseudo-articles will be viewed automatically.
630 If `not-confirm', pseudos will be viewed automatically, and the user
631 will not be asked to confirm the command."
632 :group 'gnus-extract-view
633 :type '(choice (const :tag "off" nil)
635 (const not-confirm)))
637 (defcustom gnus-view-pseudos-separately t
638 "*If non-nil, one pseudo-article will be created for each file to be viewed.
639 If nil, all files that use the same viewing command will be given as a
640 list of parameters to that command."
641 :group 'gnus-extract-view
644 (defcustom gnus-insert-pseudo-articles t
645 "*If non-nil, insert pseudo-articles when decoding articles."
646 :group 'gnus-extract-view
649 (defcustom gnus-summary-dummy-line-format
651 "*The format specification for the dummy roots in the summary buffer.
652 It works along the same lines as a normal formatting string,
653 with some simple extensions.
657 General format specifiers can also be used.
658 See `(gnus)Formatting Variables'."
659 :link '(custom-manual "(gnus)Formatting Variables")
660 :group 'gnus-threading
663 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
664 "*The format specification for the summary mode line.
665 It works along the same lines as a normal formatting string,
666 with some simple extensions:
669 %p Unprefixed group name
670 %A Current article number
671 %z Current article score
673 %U Number of unread articles in the group
674 %e Number of unselected articles in the group
675 %Z A string with unread/unselected article counts
676 %g Shortish group name
677 %S Subject of the current article
679 %s Current score file name
680 %d Number of dormant articles
681 %r Number of articles that have been marked as read in this session
682 %E Number of articles expunged by the score files"
683 :group 'gnus-summary-format
686 (defcustom gnus-list-identifiers nil
687 "Regexp that matches list identifiers to be removed from subject.
688 This can also be a list of regexps."
690 :group 'gnus-summary-format
691 :group 'gnus-article-hiding
692 :type '(choice (const :tag "none" nil)
694 (repeat :value (".*") regexp)))
696 (defcustom gnus-summary-mark-below 0
697 "*Mark all articles with a score below this variable as read.
698 This variable is local to each summary buffer and usually set by the
700 :group 'gnus-score-default
703 (defun gnus-widget-reversible-match (widget value)
704 "Ignoring WIDGET, convert VALUE to internal form.
705 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
709 (eq (length value) 2)
710 (eq (nth 0 value) 'not)
711 (symbolp (nth 1 value)))))
713 (defun gnus-widget-reversible-to-internal (widget value)
714 "Ignoring WIDGET, convert VALUE to internal form.
715 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
716 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
720 (list (nth 1 value) t)))
722 (defun gnus-widget-reversible-to-external (widget value)
723 "Ignoring WIDGET, convert VALUE to external form.
724 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
725 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
728 (list 'not (nth 0 value))
731 (define-widget 'gnus-widget-reversible 'group
732 "A `group' that convert values."
733 :match 'gnus-widget-reversible-match
734 :value-to-internal 'gnus-widget-reversible-to-internal
735 :value-to-external 'gnus-widget-reversible-to-external)
737 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
738 "*List of functions used for sorting articles in the summary buffer.
740 Each function takes two articles and returns non-nil if the first
741 article should be sorted before the other. If you use more than one
742 function, the primary sort function should be the last. You should
743 probably always include `gnus-article-sort-by-number' in the list of
744 sorting functions -- preferably first. Also note that sorting by date
745 is often much slower than sorting by number, and the sorting order is
746 very similar. (Sorting by date means sorting by the time the message
747 was sent, sorting by number means sorting by arrival time.)
749 Each item can also be a list `(not F)' where F is a function;
750 this reverses the sort order.
752 Ready-made functions include `gnus-article-sort-by-number',
753 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
754 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
755 and `gnus-article-sort-by-score'.
757 When threading is turned on, the variable `gnus-thread-sort-functions'
758 controls how articles are sorted."
759 :group 'gnus-summary-sort
760 :type '(repeat (gnus-widget-reversible
761 (choice (function-item gnus-article-sort-by-number)
762 (function-item gnus-article-sort-by-author)
763 (function-item gnus-article-sort-by-subject)
764 (function-item gnus-article-sort-by-date)
765 (function-item gnus-article-sort-by-score)
766 (function-item gnus-article-sort-by-random)
767 (function :tag "other"))
768 (boolean :tag "Reverse order"))))
771 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
772 "*List of functions used for sorting threads in the summary buffer.
773 By default, threads are sorted by article number.
775 Each function takes two threads and returns non-nil if the first
776 thread should be sorted before the other. If you use more than one
777 function, the primary sort function should be the last. You should
778 probably always include `gnus-thread-sort-by-number' in the list of
779 sorting functions -- preferably first. Also note that sorting by date
780 is often much slower than sorting by number, and the sorting order is
781 very similar. (Sorting by date means sorting by the time the message
782 was sent, sorting by number means sorting by arrival time.)
784 Each list item can also be a list `(not F)' where F is a
785 function; this specifies reversed sort order.
787 Ready-made functions include `gnus-thread-sort-by-number',
788 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
789 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
790 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
791 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
792 and `gnus-thread-sort-by-total-score' (see
793 `gnus-thread-score-function').
795 When threading is turned off, the variable
796 `gnus-article-sort-functions' controls how articles are sorted."
797 :group 'gnus-summary-sort
799 (gnus-widget-reversible
800 (choice (function-item gnus-thread-sort-by-number)
801 (function-item gnus-thread-sort-by-author)
802 (function-item gnus-thread-sort-by-recipient)
803 (function-item gnus-thread-sort-by-subject)
804 (function-item gnus-thread-sort-by-date)
805 (function-item gnus-thread-sort-by-score)
806 (function-item gnus-thread-sort-by-most-recent-number)
807 (function-item gnus-thread-sort-by-most-recent-date)
808 (function-item gnus-thread-sort-by-random)
809 (function-item gnus-thread-sort-by-total-score)
810 (function :tag "other"))
811 (boolean :tag "Reverse order"))))
813 (defcustom gnus-thread-score-function '+
814 "*Function used for calculating the total score of a thread.
816 The function is called with the scores of the article and each
817 subthread and should then return the score of the thread.
819 Some functions you can use are `+', `max', or `min'."
820 :group 'gnus-summary-sort
823 (defcustom gnus-summary-expunge-below nil
824 "All articles that have a score less than this variable will be expunged.
825 This variable is local to the summary buffers."
826 :group 'gnus-score-default
827 :type '(choice (const :tag "off" nil)
830 (defcustom gnus-thread-expunge-below nil
831 "All threads that have a total score less than this variable will be expunged.
832 See `gnus-thread-score-function' for en explanation of what a
835 This variable is local to the summary buffers."
836 :group 'gnus-threading
837 :group 'gnus-score-default
838 :type '(choice (const :tag "off" nil)
841 (defcustom gnus-summary-mode-hook nil
842 "*A hook for Gnus summary mode.
843 This hook is run before any variables are set in the summary buffer."
844 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
845 :group 'gnus-summary-various
848 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
849 (when (featurep 'xemacs)
850 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
851 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
852 (add-hook 'gnus-summary-mode-hook
853 'gnus-xmas-switch-horizontal-scrollbar-off))
855 (defcustom gnus-summary-menu-hook nil
856 "*Hook run after the creation of the summary mode menu."
857 :group 'gnus-summary-visual
860 (defcustom gnus-summary-exit-hook nil
861 "*A hook called on exit from the summary buffer.
862 It will be called with point in the group buffer."
863 :group 'gnus-summary-exit
866 (defcustom gnus-summary-prepare-hook nil
867 "*A hook called after the summary buffer has been generated.
868 If you want to modify the summary buffer, you can use this hook."
869 :group 'gnus-summary-various
872 (defcustom gnus-summary-prepared-hook nil
873 "*A hook called as the last thing after the summary buffer has been generated."
874 :group 'gnus-summary-various
877 (defcustom gnus-summary-generate-hook nil
878 "*A hook run just before generating the summary buffer.
879 This hook is commonly used to customize threading variables and the
881 :group 'gnus-summary-various
884 (defcustom gnus-select-group-hook nil
885 "*A hook called when a newsgroup is selected.
887 If you'd like to simplify subjects like the
888 `gnus-summary-next-same-subject' command does, you can use the
891 (add-hook gnus-select-group-hook
893 (mapcar (lambda (header)
894 (mail-header-set-subject
896 (gnus-simplify-subject
897 (mail-header-subject header) 're-only)))
898 gnus-newsgroup-headers)))"
899 :group 'gnus-group-select
902 (defcustom gnus-select-article-hook nil
903 "*A hook called when an article is selected."
904 :group 'gnus-summary-choose
905 :options '(gnus-agent-fetch-selected-article)
908 (defcustom gnus-visual-mark-article-hook
909 (list 'gnus-highlight-selected-summary)
910 "*Hook run after selecting an article in the summary buffer.
911 It is meant to be used for highlighting the article in some way. It
912 is not run if `gnus-visual' is nil."
913 :group 'gnus-summary-visual
916 (defcustom gnus-parse-headers-hook nil
917 "*A hook called before parsing the headers."
921 (defcustom gnus-exit-group-hook nil
922 "*A hook called when exiting summary mode.
923 This hook is not called from the non-updating exit commands like `Q'."
927 (defcustom gnus-summary-update-hook
928 (list 'gnus-summary-highlight-line)
929 "*A hook called when a summary line is changed.
930 The hook will not be called if `gnus-visual' is nil.
932 The default function `gnus-summary-highlight-line' will
933 highlight the line according to the `gnus-summary-highlight'
935 :group 'gnus-summary-visual
938 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
939 "*A hook called when an article is selected for the first time.
940 The hook is intended to mark an article as read (or unread)
941 automatically when it is selected."
942 :group 'gnus-summary-choose
945 (defcustom gnus-group-no-more-groups-hook nil
946 "*A hook run when returning to group mode having no more (unread) groups."
947 :group 'gnus-group-select
950 (defcustom gnus-ps-print-hook nil
951 "*A hook run before ps-printing something from Gnus."
955 (defcustom gnus-summary-article-move-hook nil
956 "*A hook called after an article is moved, copied, respooled, or crossposted."
961 (defcustom gnus-summary-article-delete-hook nil
962 "*A hook called after an article is deleted."
967 (defcustom gnus-summary-article-expire-hook nil
968 "*A hook called after an article is expired."
973 (defcustom gnus-summary-display-arrow
974 (and (fboundp 'display-graphic-p)
976 "*If non-nil, display an arrow highlighting the current article."
981 (defcustom gnus-summary-selected-face 'gnus-summary-selected
982 "Face used for highlighting the current article in the summary buffer."
983 :group 'gnus-summary-visual
986 (defvar gnus-tmp-downloaded nil)
988 (defcustom gnus-summary-highlight
989 '(((eq mark gnus-canceled-mark)
990 . gnus-summary-cancelled)
991 ((and uncached (> score default-high))
992 . gnus-summary-high-undownloaded)
993 ((and uncached (< score default-low))
994 . gnus-summary-low-undownloaded)
996 . gnus-summary-normal-undownloaded)
997 ((and (> score default-high)
998 (or (eq mark gnus-dormant-mark)
999 (eq mark gnus-ticked-mark)))
1000 . gnus-summary-high-ticked)
1001 ((and (< score default-low)
1002 (or (eq mark gnus-dormant-mark)
1003 (eq mark gnus-ticked-mark)))
1004 . gnus-summary-low-ticked)
1005 ((or (eq mark gnus-dormant-mark)
1006 (eq mark gnus-ticked-mark))
1007 . gnus-summary-normal-ticked)
1008 ((and (> score default-high) (eq mark gnus-ancient-mark))
1009 . gnus-summary-high-ancient)
1010 ((and (< score default-low) (eq mark gnus-ancient-mark))
1011 . gnus-summary-low-ancient)
1012 ((eq mark gnus-ancient-mark)
1013 . gnus-summary-normal-ancient)
1014 ((and (> score default-high) (eq mark gnus-unread-mark))
1015 . gnus-summary-high-unread)
1016 ((and (< score default-low) (eq mark gnus-unread-mark))
1017 . gnus-summary-low-unread)
1018 ((eq mark gnus-unread-mark)
1019 . gnus-summary-normal-unread)
1020 ((> score default-high)
1021 . gnus-summary-high-read)
1022 ((< score default-low)
1023 . gnus-summary-low-read)
1025 . gnus-summary-normal-read))
1026 "*Controls the highlighting of summary buffer lines.
1028 A list of (FORM . FACE) pairs. When deciding how a a particular
1029 summary line should be displayed, each form is evaluated. The content
1030 of the face field after the first true form is used. You can change
1031 how those summary lines are displayed, by editing the face field.
1033 You can use the following variables in the FORM field.
1035 score: The article's score
1036 default: The default article score.
1037 default-high: The default score for high scored articles.
1038 default-low: The default score for low scored articles.
1039 below: The score below which articles are automatically marked as read.
1040 mark: The article's mark.
1041 uncached: Non-nil if the article is uncached."
1042 :group 'gnus-summary-visual
1043 :type '(repeat (cons (sexp :tag "Form" nil)
1046 (defcustom gnus-alter-header-function nil
1047 "Function called to allow alteration of article header structures.
1048 The function is called with one parameter, the article header vector,
1049 which it may alter in any way."
1050 :type '(choice (const :tag "None" nil)
1052 :group 'gnus-summary)
1054 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1055 "Variable that says which function should be used to decode a string with encoded words.")
1057 (defcustom gnus-extra-headers '(To Newsgroups)
1058 "*Extra headers to parse."
1060 :group 'gnus-summary
1061 :type '(repeat symbol))
1063 (defcustom gnus-ignored-from-addresses
1064 (and user-mail-address
1065 (not (string= user-mail-address ""))
1066 (regexp-quote user-mail-address))
1067 "*Regexp of From headers that may be suppressed in favor of To headers."
1069 :group 'gnus-summary
1072 (defcustom gnus-summary-to-prefix "-> "
1073 "*String prefixed to the To field in the summary line when
1074 using `gnus-ignored-from-addresses'."
1076 :group 'gnus-summary
1079 (defcustom gnus-summary-newsgroup-prefix "=> "
1080 "*String prefixed to the Newsgroup field in the summary
1081 line when using `gnus-ignored-from-addresses'."
1083 :group 'gnus-summary
1086 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1087 "List of charsets that should be ignored.
1088 When these charsets are used in the \"charset\" parameter, the
1089 default charset will be used instead."
1091 :type '(repeat symbol)
1092 :group 'gnus-charset)
1094 (gnus-define-group-parameter
1098 "Return the ignored charsets of GROUP."
1099 :variable gnus-group-ignored-charsets-alist
1101 '(("alt\\.chinese\\.text" iso-8859-1))
1103 "Alist of regexps (to match group names) and charsets that should be ignored.
1104 When these charsets are used in the \"charset\" parameter, the
1105 default charset will be used instead."
1106 :variable-group gnus-charset
1107 :variable-type '(repeat (cons (regexp :tag "Group")
1109 :parameter-type '(choice :tag "Ignored charsets"
1112 :parameter-document "\
1113 List of charsets that should be ignored.
1115 When these charsets are used in the \"charset\" parameter, the
1116 default charset will be used instead.")
1118 (defcustom gnus-group-highlight-words-alist nil
1119 "Alist of group regexps and highlight regexps.
1120 This variable uses the same syntax as `gnus-emphasis-alist'."
1122 :type '(repeat (cons (regexp :tag "Group")
1123 (repeat (list (regexp :tag "Highlight regexp")
1124 (number :tag "Group for entire word" 0)
1125 (number :tag "Group for displayed part" 0)
1127 gnus-emphasis-highlight-words)))))
1128 :group 'gnus-summary-visual)
1130 (defcustom gnus-summary-show-article-charset-alist
1132 "Alist of number and charset.
1133 The article will be shown with the charset corresponding to the
1135 For example: ((1 . cn-gb-2312) (2 . big5))."
1137 :type '(repeat (cons (number :tag "Argument" 1)
1138 (symbol :tag "Charset")))
1139 :group 'gnus-charset)
1141 (defcustom gnus-preserve-marks t
1142 "Whether marks are preserved when moving, copying and respooling messages."
1145 :group 'gnus-summary-marks)
1147 (defcustom gnus-alter-articles-to-read-function nil
1148 "Function to be called to alter the list of articles to be selected."
1149 :type '(choice (const nil) function)
1150 :group 'gnus-summary)
1152 (defcustom gnus-orphan-score nil
1153 "*All orphans get this score added. Set in the score file."
1154 :group 'gnus-score-default
1155 :type '(choice (const nil)
1158 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1159 "*A regexp to match MIME parts when saving multiple parts of a
1160 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1161 This regexp will be used by default when prompting the user for which
1162 type of files to save."
1163 :group 'gnus-summary
1166 (defcustom gnus-read-all-available-headers nil
1167 "Whether Gnus should parse all headers made available to it.
1168 This is mostly relevant for slow back ends where the user may
1169 wish to widen the summary buffer to include all headers
1170 that were fetched. Say, for nnultimate groups."
1172 :group 'gnus-summary
1173 :type '(choice boolean regexp))
1175 (defcustom gnus-summary-muttprint-program "muttprint"
1176 "Command (and optional arguments) used to run Muttprint."
1178 :group 'gnus-summary
1181 (defcustom gnus-article-loose-mime t
1182 "If non-nil, don't require MIME-Version header.
1183 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1184 supply the MIME-Version header or deliberately strip it from the mail.
1185 If non-nil (the default), Gnus will treat some articles as MIME
1186 even if the MIME-Version header is missing."
1189 :group 'gnus-article-mime)
1191 (defcustom gnus-article-emulate-mime t
1192 "If non-nil, use MIME emulation for uuencode and the like.
1193 This means that Gnus will search message bodies for text that look
1194 like uuencoded bits, yEncoded bits, and so on, and present that using
1195 the normal Gnus MIME machinery."
1198 :group 'gnus-article-mime)
1200 ;;; Internal variables
1202 (defvar gnus-summary-display-cache nil)
1203 (defvar gnus-article-mime-handles nil)
1204 (defvar gnus-article-decoded-p nil)
1205 (defvar gnus-article-charset nil)
1206 (defvar gnus-article-ignored-charsets nil)
1207 (defvar gnus-scores-exclude-files nil)
1208 (defvar gnus-page-broken nil)
1210 (defvar gnus-original-article nil)
1211 (defvar gnus-article-internal-prepare-hook nil)
1212 (defvar gnus-newsgroup-process-stack nil)
1214 (defvar gnus-thread-indent-array nil)
1215 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1216 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1217 "Function called to sort the articles within a thread after it has been gathered together.")
1219 (defvar gnus-summary-save-parts-type-history nil)
1220 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1222 ;; Avoid highlighting in kill files.
1223 (defvar gnus-summary-inhibit-highlight nil)
1224 (defvar gnus-newsgroup-selected-overlay nil)
1225 (defvar gnus-inhibit-limiting nil)
1226 (defvar gnus-newsgroup-adaptive-score-file nil)
1227 (defvar gnus-current-score-file nil)
1228 (defvar gnus-current-move-group nil)
1229 (defvar gnus-current-copy-group nil)
1230 (defvar gnus-current-crosspost-group nil)
1231 (defvar gnus-newsgroup-display nil)
1233 (defvar gnus-newsgroup-dependencies nil)
1234 (defvar gnus-newsgroup-adaptive nil)
1235 (defvar gnus-summary-display-article-function nil)
1236 (defvar gnus-summary-highlight-line-function nil
1237 "Function called after highlighting a summary line.")
1239 (defvar gnus-summary-line-format-alist
1240 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1241 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1242 (?s gnus-tmp-subject-or-nil ?s)
1243 (?n gnus-tmp-name ?s)
1244 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1246 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1248 (?F gnus-tmp-from ?s)
1249 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1250 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1251 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1252 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1253 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1254 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1255 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1256 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1257 (?L gnus-tmp-lines ?s)
1258 (?O gnus-tmp-downloaded ?c)
1259 (?I gnus-tmp-indentation ?s)
1260 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1261 (?R gnus-tmp-replied ?c)
1262 (?\[ gnus-tmp-opening-bracket ?c)
1263 (?\] gnus-tmp-closing-bracket ?c)
1264 (?\> (make-string gnus-tmp-level ? ) ?s)
1265 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1266 (?i gnus-tmp-score ?d)
1267 (?z gnus-tmp-score-char ?c)
1268 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1269 (?U gnus-tmp-unread ?c)
1270 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1272 (?t (gnus-summary-number-of-articles-in-thread
1273 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1275 (?e (gnus-summary-number-of-articles-in-thread
1276 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1278 (?u gnus-tmp-user-defined ?s)
1279 (?P (gnus-pick-line-number) ?d)
1280 (?B gnus-tmp-thread-tree-header-string ?s)
1281 (user-date (gnus-user-date
1282 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1283 "An alist of format specifications that can appear in summary lines.
1284 These are paired with what variables they correspond with, along with
1285 the type of the variable (string, integer, character, etc).")
1287 (defvar gnus-summary-dummy-line-format-alist
1288 `((?S gnus-tmp-subject ?s)
1289 (?N gnus-tmp-number ?d)
1290 (?u gnus-tmp-user-defined ?s)))
1292 (defvar gnus-summary-mode-line-format-alist
1293 `((?G gnus-tmp-group-name ?s)
1294 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1295 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1296 (?A gnus-tmp-article-number ?d)
1297 (?Z gnus-tmp-unread-and-unselected ?s)
1298 (?V gnus-version ?s)
1299 (?U gnus-tmp-unread-and-unticked ?d)
1300 (?S gnus-tmp-subject ?s)
1301 (?e gnus-tmp-unselected ?d)
1302 (?u gnus-tmp-user-defined ?s)
1303 (?d (length gnus-newsgroup-dormant) ?d)
1304 (?t (length gnus-newsgroup-marked) ?d)
1305 (?h (length gnus-newsgroup-spam-marked) ?d)
1306 (?r (length gnus-newsgroup-reads) ?d)
1307 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1308 (?E gnus-newsgroup-expunged-tally ?d)
1309 (?s (gnus-current-score-file-nondirectory) ?s)))
1311 (defvar gnus-last-search-regexp nil
1312 "Default regexp for article search command.")
1314 (defvar gnus-last-shell-command nil
1315 "Default shell command on article.")
1317 (defvar gnus-newsgroup-agentized nil
1318 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1319 (defvar gnus-newsgroup-begin nil)
1320 (defvar gnus-newsgroup-end nil)
1321 (defvar gnus-newsgroup-last-rmail nil)
1322 (defvar gnus-newsgroup-last-mail nil)
1323 (defvar gnus-newsgroup-last-folder nil)
1324 (defvar gnus-newsgroup-last-file nil)
1325 (defvar gnus-newsgroup-auto-expire nil)
1326 (defvar gnus-newsgroup-active nil)
1328 (defvar gnus-newsgroup-data nil)
1329 (defvar gnus-newsgroup-data-reverse nil)
1330 (defvar gnus-newsgroup-limit nil)
1331 (defvar gnus-newsgroup-limits nil)
1332 (defvar gnus-summary-use-undownloaded-faces nil)
1334 (defvar gnus-newsgroup-unreads nil
1335 "Sorted list of unread articles in the current newsgroup.")
1337 (defvar gnus-newsgroup-unselected nil
1338 "Sorted list of unselected unread articles in the current newsgroup.")
1340 (defvar gnus-newsgroup-reads nil
1341 "Alist of read articles and article marks in the current newsgroup.")
1343 (defvar gnus-newsgroup-expunged-tally nil)
1345 (defvar gnus-newsgroup-marked nil
1346 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1348 (defvar gnus-newsgroup-spam-marked nil
1349 "List of ranges of articles that have been marked as spam.")
1351 (defvar gnus-newsgroup-killed nil
1352 "List of ranges of articles that have been through the scoring process.")
1354 (defvar gnus-newsgroup-cached nil
1355 "Sorted list of articles that come from the article cache.")
1357 (defvar gnus-newsgroup-saved nil
1358 "List of articles that have been saved.")
1360 (defvar gnus-newsgroup-kill-headers nil)
1362 (defvar gnus-newsgroup-replied nil
1363 "List of articles that have been replied to in the current newsgroup.")
1365 (defvar gnus-newsgroup-forwarded nil
1366 "List of articles that have been forwarded in the current newsgroup.")
1368 (defvar gnus-newsgroup-recent nil
1369 "List of articles that have are recent in the current newsgroup.")
1371 (defvar gnus-newsgroup-expirable nil
1372 "Sorted list of articles in the current newsgroup that can be expired.")
1374 (defvar gnus-newsgroup-processable nil
1375 "List of articles in the current newsgroup that can be processed.")
1377 (defvar gnus-newsgroup-downloadable nil
1378 "Sorted list of articles in the current newsgroup that can be processed.")
1380 (defvar gnus-newsgroup-unfetched nil
1381 "Sorted list of articles in the current newsgroup whose headers have
1382 not been fetched into the agent.
1384 This list will always be a subset of gnus-newsgroup-undownloaded.")
1386 (defvar gnus-newsgroup-undownloaded nil
1387 "List of articles in the current newsgroup that haven't been downloaded.")
1389 (defvar gnus-newsgroup-unsendable nil
1390 "List of articles in the current newsgroup that won't be sent.")
1392 (defvar gnus-newsgroup-bookmarks nil
1393 "List of articles in the current newsgroup that have bookmarks.")
1395 (defvar gnus-newsgroup-dormant nil
1396 "Sorted list of dormant articles in the current newsgroup.")
1398 (defvar gnus-newsgroup-unseen nil
1399 "List of unseen articles in the current newsgroup.")
1401 (defvar gnus-newsgroup-seen nil
1402 "Range of seen articles in the current newsgroup.")
1404 (defvar gnus-newsgroup-articles nil
1405 "List of articles in the current newsgroup.")
1407 (defvar gnus-newsgroup-scored nil
1408 "List of scored articles in the current newsgroup.")
1410 (defvar gnus-newsgroup-headers nil
1411 "List of article headers in the current newsgroup.")
1413 (defvar gnus-newsgroup-threads nil)
1415 (defvar gnus-newsgroup-prepared nil
1416 "Whether the current group has been prepared properly.")
1418 (defvar gnus-newsgroup-ancient nil
1419 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1421 (defvar gnus-newsgroup-sparse nil)
1423 (defvar gnus-current-article nil)
1424 (defvar gnus-article-current nil)
1425 (defvar gnus-current-headers nil)
1426 (defvar gnus-have-all-headers nil)
1427 (defvar gnus-last-article nil)
1428 (defvar gnus-newsgroup-history nil)
1429 (defvar gnus-newsgroup-charset nil)
1430 (defvar gnus-newsgroup-ephemeral-charset nil)
1431 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1433 (defvar gnus-article-before-search nil)
1435 (defvar gnus-summary-local-variables
1436 '(gnus-newsgroup-name
1437 gnus-newsgroup-begin gnus-newsgroup-end
1438 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1439 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1440 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1441 gnus-newsgroup-unselected gnus-newsgroup-marked
1442 gnus-newsgroup-spam-marked
1443 gnus-newsgroup-reads gnus-newsgroup-saved
1444 gnus-newsgroup-replied gnus-newsgroup-forwarded
1445 gnus-newsgroup-recent
1446 gnus-newsgroup-expirable
1447 gnus-newsgroup-processable gnus-newsgroup-killed
1448 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1449 gnus-newsgroup-unfetched
1450 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1451 gnus-newsgroup-seen gnus-newsgroup-articles
1452 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1453 gnus-newsgroup-headers gnus-newsgroup-threads
1454 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1455 gnus-current-article gnus-current-headers gnus-have-all-headers
1456 gnus-last-article gnus-article-internal-prepare-hook
1457 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1458 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1459 gnus-thread-expunge-below
1460 gnus-score-alist gnus-current-score-file
1461 (gnus-summary-expunge-below . global)
1462 (gnus-summary-mark-below . global)
1463 (gnus-orphan-score . global)
1464 gnus-newsgroup-active gnus-scores-exclude-files
1465 gnus-newsgroup-history gnus-newsgroup-ancient
1466 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1467 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1468 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1469 (gnus-newsgroup-expunged-tally . 0)
1470 gnus-cache-removable-articles gnus-newsgroup-cached
1471 gnus-newsgroup-data gnus-newsgroup-data-reverse
1472 gnus-newsgroup-limit gnus-newsgroup-limits
1473 gnus-newsgroup-charset gnus-newsgroup-display
1474 gnus-summary-use-undownloaded-faces)
1475 "Variables that are buffer-local to the summary buffers.")
1477 (defvar gnus-newsgroup-variables nil
1478 "A list of variables that have separate values in different newsgroups.
1479 A list of newsgroup (summary buffer) local variables, or cons of
1480 variables and their default expressions to be evalled (when the default
1481 values are not nil), that should be made global while the summary buffer
1484 Note: The default expressions will be evaluated (using function `eval')
1485 before assignment to the local variable rather than just assigned to it.
1486 If the default expression is the symbol `global', that symbol will not
1487 be evaluated but the global value of the local variable will be used
1490 These variables can be used to set variables in the group parameters
1491 while still allowing them to affect operations done in other buffers.
1494 \(setq gnus-newsgroup-variables
1495 '(message-use-followup-to
1496 (gnus-visible-headers .
1497 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1500 ;; Byte-compiler warning.
1502 ;; Bind features so that require will believe that gnus-sum has
1503 ;; already been loaded (avoids infinite recursion)
1504 (let ((features (cons 'gnus-sum features)))
1505 ;; Several of the declarations in gnus-sum are needed to load the
1506 ;; following files. Right now, these definitions have been
1507 ;; compiled but not defined (evaluated). We could either do a
1508 ;; eval-and-compile about all of the declarations or evaluate the
1510 (if (boundp 'gnus-newsgroup-variables)
1512 (load "gnus-sum.el" t t t))
1514 (require 'gnus-art)))
1518 (defvar gnus-decode-encoded-word-methods
1519 '(mail-decode-encoded-word-string)
1520 "List of methods used to decode encoded words.
1522 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1523 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1524 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1525 whose names match REGEXP.
1528 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1529 mail-decode-encoded-word-string
1530 (\"chinese\" . rfc1843-decode-string))")
1532 (defvar gnus-decode-encoded-word-methods-cache nil)
1534 (defun gnus-multi-decode-encoded-word-string (string)
1535 "Apply the functions from `gnus-encoded-word-methods' that match."
1536 (unless (and gnus-decode-encoded-word-methods-cache
1537 (eq gnus-newsgroup-name
1538 (car gnus-decode-encoded-word-methods-cache)))
1539 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1542 (nconc gnus-decode-encoded-word-methods-cache (list x))
1543 (if (and gnus-newsgroup-name
1544 (string-match (car x) gnus-newsgroup-name))
1545 (nconc gnus-decode-encoded-word-methods-cache
1547 gnus-decode-encoded-word-methods))
1548 (let ((xlist gnus-decode-encoded-word-methods-cache))
1551 (setq string (funcall (pop xlist) string))))
1554 ;; Subject simplification.
1556 (defun gnus-simplify-whitespace (str)
1557 "Remove excessive whitespace from STR."
1559 (while (string-match "[ \t][ \t]+" str)
1560 (setq str (concat (substring str 0 (match-beginning 0))
1562 (substring str (match-end 0)))))
1564 (when (string-match "^[ \t]+" str)
1565 (setq str (substring str (match-end 0))))
1567 (when (string-match "[ \t]+$" str)
1568 (setq str (substring str 0 (match-beginning 0))))
1571 (defun gnus-simplify-all-whitespace (str)
1572 "Remove all whitespace from STR."
1573 (while (string-match "[ \t\n]+" str)
1574 (setq str (replace-match "" nil nil str)))
1577 (defsubst gnus-simplify-subject-re (subject)
1578 "Remove \"Re:\" from subject lines."
1579 (if (string-match message-subject-re-regexp subject)
1580 (substring subject (match-end 0))
1583 (defun gnus-simplify-subject (subject &optional re-only)
1584 "Remove `Re:' and words in parentheses.
1585 If RE-ONLY is non-nil, strip leading `Re:'s only."
1586 (let ((case-fold-search t)) ;Ignore case.
1587 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1588 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1589 (setq subject (substring subject (match-end 0))))
1590 ;; Remove uninteresting prefixes.
1591 (when (and (not re-only)
1592 gnus-simplify-ignored-prefixes
1593 (string-match gnus-simplify-ignored-prefixes subject))
1594 (setq subject (substring subject (match-end 0))))
1595 ;; Remove words in parentheses from end.
1597 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1598 (setq subject (substring subject 0 (match-beginning 0)))))
1599 ;; Return subject string.
1602 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1604 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1605 (goto-char (point-min))
1606 (while (re-search-forward regexp nil t)
1607 (replace-match (or newtext ""))))
1609 (defun gnus-simplify-buffer-fuzzy ()
1610 "Simplify string in the buffer fuzzily.
1611 The string in the accessible portion of the current buffer is simplified.
1612 It is assumed to be a single-line subject.
1613 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1614 matter is removed. Additional things can be deleted by setting
1615 `gnus-simplify-subject-fuzzy-regexp'."
1616 (let ((case-fold-search t)
1618 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1620 (while (not (eq modified-tick (buffer-modified-tick)))
1621 (setq modified-tick (buffer-modified-tick))
1623 ((listp gnus-simplify-subject-fuzzy-regexp)
1624 (mapcar 'gnus-simplify-buffer-fuzzy-step
1625 gnus-simplify-subject-fuzzy-regexp))
1626 (gnus-simplify-subject-fuzzy-regexp
1627 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1628 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1629 (gnus-simplify-buffer-fuzzy-step
1630 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1631 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1633 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1634 (gnus-simplify-buffer-fuzzy-step " +" " ")
1635 (gnus-simplify-buffer-fuzzy-step " $")
1636 (gnus-simplify-buffer-fuzzy-step "^ +")))
1638 (defun gnus-simplify-subject-fuzzy (subject)
1639 "Simplify a subject string fuzzily.
1640 See `gnus-simplify-buffer-fuzzy' for details."
1642 (gnus-set-work-buffer)
1643 (let ((case-fold-search t))
1644 ;; Remove uninteresting prefixes.
1645 (when (and gnus-simplify-ignored-prefixes
1646 (string-match gnus-simplify-ignored-prefixes subject))
1647 (setq subject (substring subject (match-end 0))))
1649 (inline (gnus-simplify-buffer-fuzzy))
1652 (defsubst gnus-simplify-subject-fully (subject)
1653 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1655 (gnus-simplify-subject-functions
1656 (gnus-map-function gnus-simplify-subject-functions subject))
1657 ((null gnus-summary-gather-subject-limit)
1658 (gnus-simplify-subject-re subject))
1659 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1660 (gnus-simplify-subject-fuzzy subject))
1661 ((numberp gnus-summary-gather-subject-limit)
1662 (gnus-limit-string (gnus-simplify-subject-re subject)
1663 gnus-summary-gather-subject-limit))
1667 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1668 "Check whether two subjects are equal.
1669 If optional argument SIMPLE-FIRST is t, first argument is already
1672 ((null simple-first)
1673 (equal (gnus-simplify-subject-fully s1)
1674 (gnus-simplify-subject-fully s2)))
1677 (gnus-simplify-subject-fully s2)))))
1679 (defun gnus-summary-bubble-group ()
1680 "Increase the score of the current group.
1681 This is a handy function to add to `gnus-summary-exit-hook' to
1682 increase the score of each group you read."
1683 (gnus-group-add-score gnus-newsgroup-name))
1687 ;;; Gnus summary mode
1690 (put 'gnus-summary-mode 'mode-class 'special)
1692 (defvar gnus-article-commands-menu)
1694 ;; Non-orthogonal keys
1696 (gnus-define-keys gnus-summary-mode-map
1697 " " gnus-summary-next-page
1698 "\177" gnus-summary-prev-page
1699 [delete] gnus-summary-prev-page
1700 [backspace] gnus-summary-prev-page
1701 "\r" gnus-summary-scroll-up
1702 "\M-\r" gnus-summary-scroll-down
1703 "n" gnus-summary-next-unread-article
1704 "p" gnus-summary-prev-unread-article
1705 "N" gnus-summary-next-article
1706 "P" gnus-summary-prev-article
1707 "\M-\C-n" gnus-summary-next-same-subject
1708 "\M-\C-p" gnus-summary-prev-same-subject
1709 "\M-n" gnus-summary-next-unread-subject
1710 "\M-p" gnus-summary-prev-unread-subject
1711 "." gnus-summary-first-unread-article
1712 "," gnus-summary-best-unread-article
1713 "\M-s" gnus-summary-search-article-forward
1714 "\M-r" gnus-summary-search-article-backward
1715 "\M-S" gnus-summary-repeat-search-article-forward
1716 "\M-R" gnus-summary-repeat-search-article-backward
1717 "<" gnus-summary-beginning-of-article
1718 ">" gnus-summary-end-of-article
1719 "j" gnus-summary-goto-article
1720 "^" gnus-summary-refer-parent-article
1721 "\M-^" gnus-summary-refer-article
1722 "u" gnus-summary-tick-article-forward
1723 "!" gnus-summary-tick-article-forward
1724 "U" gnus-summary-tick-article-backward
1725 "d" gnus-summary-mark-as-read-forward
1726 "D" gnus-summary-mark-as-read-backward
1727 "E" gnus-summary-mark-as-expirable
1728 "\M-u" gnus-summary-clear-mark-forward
1729 "\M-U" gnus-summary-clear-mark-backward
1730 "k" gnus-summary-kill-same-subject-and-select
1731 "\C-k" gnus-summary-kill-same-subject
1732 "\M-\C-k" gnus-summary-kill-thread
1733 "\M-\C-l" gnus-summary-lower-thread
1734 "e" gnus-summary-edit-article
1735 "#" gnus-summary-mark-as-processable
1736 "\M-#" gnus-summary-unmark-as-processable
1737 "\M-\C-t" gnus-summary-toggle-threads
1738 "\M-\C-s" gnus-summary-show-thread
1739 "\M-\C-h" gnus-summary-hide-thread
1740 "\M-\C-f" gnus-summary-next-thread
1741 "\M-\C-b" gnus-summary-prev-thread
1742 [(meta down)] gnus-summary-next-thread
1743 [(meta up)] gnus-summary-prev-thread
1744 "\M-\C-u" gnus-summary-up-thread
1745 "\M-\C-d" gnus-summary-down-thread
1746 "&" gnus-summary-execute-command
1747 "c" gnus-summary-catchup-and-exit
1748 "\C-w" gnus-summary-mark-region-as-read
1749 "\C-t" gnus-summary-toggle-truncation
1750 "?" gnus-summary-mark-as-dormant
1751 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1752 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1753 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1754 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1755 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1756 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1757 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1758 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1759 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1760 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1761 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1762 "=" gnus-summary-expand-window
1763 "\C-x\C-s" gnus-summary-reselect-current-group
1764 "\M-g" gnus-summary-rescan-group
1765 "w" gnus-summary-stop-page-breaking
1766 "\C-c\C-r" gnus-summary-caesar-message
1767 "f" gnus-summary-followup
1768 "F" gnus-summary-followup-with-original
1769 "C" gnus-summary-cancel-article
1770 "r" gnus-summary-reply
1771 "R" gnus-summary-reply-with-original
1772 "\C-c\C-f" gnus-summary-mail-forward
1773 "o" gnus-summary-save-article
1774 "\C-o" gnus-summary-save-article-mail
1775 "|" gnus-summary-pipe-output
1776 "\M-k" gnus-summary-edit-local-kill
1777 "\M-K" gnus-summary-edit-global-kill
1779 "\C-c\C-d" gnus-summary-describe-group
1780 "q" gnus-summary-exit
1781 "Q" gnus-summary-exit-no-update
1782 "\C-c\C-i" gnus-info-find-node
1783 gnus-mouse-2 gnus-mouse-pick-article
1784 [follow-link] mouse-face
1785 "m" gnus-summary-mail-other-window
1786 "a" gnus-summary-post-news
1787 "i" gnus-summary-news-other-window
1788 "x" gnus-summary-limit-to-unread
1789 "s" gnus-summary-isearch-article
1790 "t" gnus-summary-toggle-header
1791 "g" gnus-summary-show-article
1792 "l" gnus-summary-goto-last-article
1793 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1794 "\C-d" gnus-summary-enter-digest-group
1795 "\M-\C-d" gnus-summary-read-document
1796 "\M-\C-e" gnus-summary-edit-parameters
1797 "\M-\C-a" gnus-summary-customize-parameters
1799 "*" gnus-cache-enter-article
1800 "\M-*" gnus-cache-remove-article
1801 "\M-&" gnus-summary-universal-argument
1802 "\C-l" gnus-recenter
1803 "I" gnus-summary-increase-score
1804 "L" gnus-summary-lower-score
1805 "\M-i" gnus-symbolic-argument
1806 "h" gnus-summary-select-article-buffer
1808 "b" gnus-article-view-part
1809 "\M-t" gnus-summary-toggle-display-buttonized
1811 "V" gnus-summary-score-map
1812 "X" gnus-uu-extract-map
1813 "S" gnus-summary-send-map)
1815 ;; Sort of orthogonal keymap
1816 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1817 "t" gnus-summary-tick-article-forward
1818 "!" gnus-summary-tick-article-forward
1819 "d" gnus-summary-mark-as-read-forward
1820 "r" gnus-summary-mark-as-read-forward
1821 "c" gnus-summary-clear-mark-forward
1822 " " gnus-summary-clear-mark-forward
1823 "e" gnus-summary-mark-as-expirable
1824 "x" gnus-summary-mark-as-expirable
1825 "?" gnus-summary-mark-as-dormant
1826 "b" gnus-summary-set-bookmark
1827 "B" gnus-summary-remove-bookmark
1828 "#" gnus-summary-mark-as-processable
1829 "\M-#" gnus-summary-unmark-as-processable
1830 "S" gnus-summary-limit-include-expunged
1831 "C" gnus-summary-catchup
1832 "H" gnus-summary-catchup-to-here
1833 "h" gnus-summary-catchup-from-here
1834 "\C-c" gnus-summary-catchup-all
1835 "k" gnus-summary-kill-same-subject-and-select
1836 "K" gnus-summary-kill-same-subject
1837 "P" gnus-uu-mark-map)
1839 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1840 "c" gnus-summary-clear-above
1841 "u" gnus-summary-tick-above
1842 "m" gnus-summary-mark-above
1843 "k" gnus-summary-kill-below)
1845 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1846 "/" gnus-summary-limit-to-subject
1847 "n" gnus-summary-limit-to-articles
1848 "b" gnus-summary-limit-to-bodies
1849 "w" gnus-summary-pop-limit
1850 "s" gnus-summary-limit-to-subject
1851 "a" gnus-summary-limit-to-author
1852 "u" gnus-summary-limit-to-unread
1853 "m" gnus-summary-limit-to-marks
1854 "M" gnus-summary-limit-exclude-marks
1855 "v" gnus-summary-limit-to-score
1856 "*" gnus-summary-limit-include-cached
1857 "D" gnus-summary-limit-include-dormant
1858 "T" gnus-summary-limit-include-thread
1859 "d" gnus-summary-limit-exclude-dormant
1860 "t" gnus-summary-limit-to-age
1861 "." gnus-summary-limit-to-unseen
1862 "x" gnus-summary-limit-to-extra
1863 "p" gnus-summary-limit-to-display-predicate
1864 "E" gnus-summary-limit-include-expunged
1865 "c" gnus-summary-limit-exclude-childless-dormant
1866 "C" gnus-summary-limit-mark-excluded-as-read
1867 "o" gnus-summary-insert-old-articles
1868 "N" gnus-summary-insert-new-articles
1869 "r" gnus-summary-limit-to-replied
1870 "R" gnus-summary-limit-to-recipient)
1872 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1873 "n" gnus-summary-next-unread-article
1874 "p" gnus-summary-prev-unread-article
1875 "N" gnus-summary-next-article
1876 "P" gnus-summary-prev-article
1877 "\C-n" gnus-summary-next-same-subject
1878 "\C-p" gnus-summary-prev-same-subject
1879 "\M-n" gnus-summary-next-unread-subject
1880 "\M-p" gnus-summary-prev-unread-subject
1881 "f" gnus-summary-first-unread-article
1882 "b" gnus-summary-best-unread-article
1883 "j" gnus-summary-goto-article
1884 "g" gnus-summary-goto-subject
1885 "l" gnus-summary-goto-last-article
1886 "o" gnus-summary-pop-article)
1888 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1889 "k" gnus-summary-kill-thread
1890 "l" gnus-summary-lower-thread
1891 "i" gnus-summary-raise-thread
1892 "T" gnus-summary-toggle-threads
1893 "t" gnus-summary-rethread-current
1894 "^" gnus-summary-reparent-thread
1895 "\M-^" gnus-summary-reparent-children
1896 "s" gnus-summary-show-thread
1897 "S" gnus-summary-show-all-threads
1898 "h" gnus-summary-hide-thread
1899 "H" gnus-summary-hide-all-threads
1900 "n" gnus-summary-next-thread
1901 "p" gnus-summary-prev-thread
1902 "u" gnus-summary-up-thread
1903 "o" gnus-summary-top-thread
1904 "d" gnus-summary-down-thread
1905 "#" gnus-uu-mark-thread
1906 "\M-#" gnus-uu-unmark-thread)
1908 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1909 "g" gnus-summary-prepare
1910 "c" gnus-summary-insert-cached-articles
1911 "d" gnus-summary-insert-dormant-articles)
1913 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1914 "c" gnus-summary-catchup-and-exit
1915 "C" gnus-summary-catchup-all-and-exit
1916 "E" gnus-summary-exit-no-update
1917 "Q" gnus-summary-exit
1918 "Z" gnus-summary-exit
1919 "n" gnus-summary-catchup-and-goto-next-group
1920 "p" gnus-summary-catchup-and-goto-prev-group
1921 "R" gnus-summary-reselect-current-group
1922 "G" gnus-summary-rescan-group
1923 "N" gnus-summary-next-group
1924 "s" gnus-summary-save-newsrc
1925 "P" gnus-summary-prev-group)
1927 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1928 " " gnus-summary-next-page
1929 "n" gnus-summary-next-page
1930 "\177" gnus-summary-prev-page
1931 [delete] gnus-summary-prev-page
1932 "p" gnus-summary-prev-page
1933 "\r" gnus-summary-scroll-up
1934 "\M-\r" gnus-summary-scroll-down
1935 "<" gnus-summary-beginning-of-article
1936 ">" gnus-summary-end-of-article
1937 "b" gnus-summary-beginning-of-article
1938 "e" gnus-summary-end-of-article
1939 "^" gnus-summary-refer-parent-article
1940 "r" gnus-summary-refer-parent-article
1941 "D" gnus-summary-enter-digest-group
1942 "R" gnus-summary-refer-references
1943 "T" gnus-summary-refer-thread
1944 "g" gnus-summary-show-article
1945 "s" gnus-summary-isearch-article
1946 "P" gnus-summary-print-article
1947 "M" gnus-mailing-list-insinuate
1948 "t" gnus-article-babel)
1950 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
1951 "b" gnus-article-add-buttons
1952 "B" gnus-article-add-buttons-to-head
1953 "o" gnus-article-treat-overstrike
1954 "e" gnus-article-emphasize
1955 "w" gnus-article-fill-cited-article
1956 "Q" gnus-article-fill-long-lines
1957 "C" gnus-article-capitalize-sentences
1958 "c" gnus-article-remove-cr
1959 "q" gnus-article-de-quoted-unreadable
1960 "6" gnus-article-de-base64-unreadable
1961 "Z" gnus-article-decode-HZ
1962 "A" gnus-article-treat-ansi-sequences
1963 "h" gnus-article-wash-html
1964 "u" gnus-article-unsplit-urls
1965 "s" gnus-summary-force-verify-and-decrypt
1966 "f" gnus-article-display-x-face
1967 "l" gnus-summary-stop-page-breaking
1968 "r" gnus-summary-caesar-message
1969 "m" gnus-summary-morse-message
1970 "t" gnus-summary-toggle-header
1971 "g" gnus-treat-smiley
1972 "v" gnus-summary-verbose-headers
1973 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
1974 "p" gnus-article-verify-x-pgp-sig
1975 "d" gnus-article-treat-dumbquotes
1976 "i" gnus-summary-idna-message)
1978 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
1979 ;; mnemonic: deuglif*Y*
1980 "u" gnus-article-outlook-unwrap-lines
1981 "a" gnus-article-outlook-repair-attribution
1982 "c" gnus-article-outlook-rearrange-citation
1983 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
1985 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
1986 "a" gnus-article-hide
1987 "h" gnus-article-hide-headers
1988 "b" gnus-article-hide-boring-headers
1989 "s" gnus-article-hide-signature
1990 "c" gnus-article-hide-citation
1991 "C" gnus-article-hide-citation-in-followups
1992 "l" gnus-article-hide-list-identifiers
1993 "B" gnus-article-strip-banner
1994 "P" gnus-article-hide-pem
1995 "\C-c" gnus-article-hide-citation-maybe)
1997 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
1998 "a" gnus-article-highlight
1999 "h" gnus-article-highlight-headers
2000 "c" gnus-article-highlight-citation
2001 "s" gnus-article-highlight-signature)
2003 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2004 "f" gnus-article-treat-fold-headers
2005 "u" gnus-article-treat-unfold-headers
2006 "n" gnus-article-treat-fold-newsgroups)
2008 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2009 "x" gnus-article-display-x-face
2010 "d" gnus-article-display-face
2011 "s" gnus-treat-smiley
2012 "D" gnus-article-remove-images
2013 "f" gnus-treat-from-picon
2014 "m" gnus-treat-mail-picon
2015 "n" gnus-treat-newsgroups-picon)
2017 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2018 "w" gnus-article-decode-mime-words
2019 "c" gnus-article-decode-charset
2020 "v" gnus-mime-view-all-parts
2021 "b" gnus-article-view-part)
2023 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2024 "z" gnus-article-date-ut
2025 "u" gnus-article-date-ut
2026 "l" gnus-article-date-local
2027 "p" gnus-article-date-english
2028 "e" gnus-article-date-lapsed
2029 "o" gnus-article-date-original
2030 "i" gnus-article-date-iso8601
2031 "s" gnus-article-date-user)
2033 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2034 "t" gnus-article-remove-trailing-blank-lines
2035 "l" gnus-article-strip-leading-blank-lines
2036 "m" gnus-article-strip-multiple-blank-lines
2037 "a" gnus-article-strip-blank-lines
2038 "A" gnus-article-strip-all-blank-lines
2039 "s" gnus-article-strip-leading-space
2040 "e" gnus-article-strip-trailing-space
2041 "w" gnus-article-remove-leading-whitespace)
2043 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2045 "f" gnus-summary-fetch-faq
2046 "d" gnus-summary-describe-group
2047 "h" gnus-summary-describe-briefly
2048 "i" gnus-info-find-node
2049 "c" gnus-group-fetch-charter
2050 "C" gnus-group-fetch-control)
2052 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2053 "e" gnus-summary-expire-articles
2054 "\M-\C-e" gnus-summary-expire-articles-now
2055 "\177" gnus-summary-delete-article
2056 [delete] gnus-summary-delete-article
2057 [backspace] gnus-summary-delete-article
2058 "m" gnus-summary-move-article
2059 "r" gnus-summary-respool-article
2060 "w" gnus-summary-edit-article
2061 "c" gnus-summary-copy-article
2062 "B" gnus-summary-crosspost-article
2063 "q" gnus-summary-respool-query
2064 "t" gnus-summary-respool-trace
2065 "i" gnus-summary-import-article
2066 "I" gnus-summary-create-article
2067 "p" gnus-summary-article-posted-p)
2069 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2070 "o" gnus-summary-save-article
2071 "m" gnus-summary-save-article-mail
2072 "F" gnus-summary-write-article-file
2073 "r" gnus-summary-save-article-rmail
2074 "f" gnus-summary-save-article-file
2075 "b" gnus-summary-save-article-body-file
2076 "h" gnus-summary-save-article-folder
2077 "v" gnus-summary-save-article-vm
2078 "p" gnus-summary-pipe-output
2079 "P" gnus-summary-muttprint
2080 "s" gnus-soup-add-article)
2082 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2083 "b" gnus-summary-display-buttonized
2084 "m" gnus-summary-repair-multipart
2085 "v" gnus-article-view-part
2086 "o" gnus-article-save-part
2087 "O" gnus-article-save-part-and-strip
2088 "r" gnus-article-replace-part
2089 "d" gnus-article-delete-part
2090 "t" gnus-article-view-part-as-type
2091 "j" gnus-article-jump-to-part
2092 "c" gnus-article-copy-part
2093 "C" gnus-article-view-part-as-charset
2094 "e" gnus-article-view-part-externally
2095 "E" gnus-article-encrypt-body
2096 "i" gnus-article-inline-part
2097 "|" gnus-article-pipe-part)
2099 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2100 "p" gnus-summary-mark-as-processable
2101 "u" gnus-summary-unmark-as-processable
2102 "U" gnus-summary-unmark-all-processable
2103 "v" gnus-uu-mark-over
2104 "s" gnus-uu-mark-series
2105 "r" gnus-uu-mark-region
2106 "g" gnus-uu-unmark-region
2107 "R" gnus-uu-mark-by-regexp
2108 "G" gnus-uu-unmark-by-regexp
2109 "t" gnus-uu-mark-thread
2110 "T" gnus-uu-unmark-thread
2111 "a" gnus-uu-mark-all
2112 "b" gnus-uu-mark-buffer
2113 "S" gnus-uu-mark-sparse
2114 "k" gnus-summary-kill-process-mark
2115 "y" gnus-summary-yank-process-mark
2116 "w" gnus-summary-save-process-mark
2117 "i" gnus-uu-invert-processable)
2119 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2120 ;;"x" gnus-uu-extract-any
2121 "m" gnus-summary-save-parts
2122 "u" gnus-uu-decode-uu
2123 "U" gnus-uu-decode-uu-and-save
2124 "s" gnus-uu-decode-unshar
2125 "S" gnus-uu-decode-unshar-and-save
2126 "o" gnus-uu-decode-save
2127 "O" gnus-uu-decode-save
2128 "b" gnus-uu-decode-binhex
2129 "B" gnus-uu-decode-binhex
2130 "p" gnus-uu-decode-postscript
2131 "P" gnus-uu-decode-postscript-and-save)
2134 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2135 "u" gnus-uu-decode-uu-view
2136 "U" gnus-uu-decode-uu-and-save-view
2137 "s" gnus-uu-decode-unshar-view
2138 "S" gnus-uu-decode-unshar-and-save-view
2139 "o" gnus-uu-decode-save-view
2140 "O" gnus-uu-decode-save-view
2141 "b" gnus-uu-decode-binhex-view
2142 "B" gnus-uu-decode-binhex-view
2143 "p" gnus-uu-decode-postscript-view
2144 "P" gnus-uu-decode-postscript-and-save-view)
2146 (defvar gnus-article-post-menu nil)
2148 (defconst gnus-summary-menu-maxlen 20)
2150 (defun gnus-summary-menu-split (menu)
2151 ;; If we have lots of elements, divide them into groups of 20
2152 ;; and make a pane (or submenu) for each one.
2153 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2154 (let ((menu menu) sublists next
2157 ;; Pull off the next gnus-summary-menu-maxlen elements
2158 ;; and make them the next element of sublist.
2159 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2161 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2163 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2164 (aref (car (last menu)) 0)) menu)
2168 (nreverse sublists))
2169 ;; Few elements--put them all in one pane.
2172 (defun gnus-summary-make-menu-bar ()
2173 (gnus-turn-off-edit-menu 'summary)
2175 (unless (boundp 'gnus-summary-misc-menu)
2178 gnus-summary-kill-menu gnus-summary-mode-map ""
2183 ["Customize" gnus-score-customize t])
2184 (gnus-make-score-map 'increase)
2185 (gnus-make-score-map 'lower)
2187 ["Kill below" gnus-summary-kill-below t]
2188 ["Mark above" gnus-summary-mark-above t]
2189 ["Tick above" gnus-summary-tick-above t]
2190 ["Clear above" gnus-summary-clear-above t])
2191 ["Current score" gnus-summary-current-score t]
2192 ["Set score" gnus-summary-set-score t]
2193 ["Switch current score file..." gnus-score-change-score-file t]
2194 ["Set mark below..." gnus-score-set-mark-below t]
2195 ["Set expunge below..." gnus-score-set-expunge-below t]
2196 ["Edit current score file" gnus-score-edit-current-scores t]
2197 ["Edit score file" gnus-score-edit-file t]
2198 ["Trace score" gnus-score-find-trace t]
2199 ["Find words" gnus-score-find-favourite-words t]
2200 ["Rescore buffer" gnus-summary-rescore t]
2201 ["Increase score..." gnus-summary-increase-score t]
2202 ["Lower score..." gnus-summary-lower-score t]))))
2204 ;; Define both the Article menu in the summary buffer and the
2205 ;; equivalent Commands menu in the article buffer here for
2209 ["All" gnus-article-hide t]
2210 ["Headers" gnus-article-hide-headers t]
2211 ["Signature" gnus-article-hide-signature t]
2212 ["Citation" gnus-article-hide-citation t]
2213 ["List identifiers" gnus-article-hide-list-identifiers t]
2214 ["Banner" gnus-article-strip-banner t]
2215 ["Boring headers" gnus-article-hide-boring-headers t])
2217 ["All" gnus-article-highlight t]
2218 ["Headers" gnus-article-highlight-headers t]
2219 ["Signature" gnus-article-highlight-signature t]
2220 ["Citation" gnus-article-highlight-citation t])
2222 ["Words" gnus-article-decode-mime-words t]
2223 ["Charset" gnus-article-decode-charset t]
2224 ["QP" gnus-article-de-quoted-unreadable t]
2225 ["Base64" gnus-article-de-base64-unreadable t]
2226 ["View MIME buttons" gnus-summary-display-buttonized t]
2227 ["View all" gnus-mime-view-all-parts t]
2228 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2229 ["Encrypt body" gnus-article-encrypt-body
2230 :active (not (gnus-group-read-only-p))
2231 ,@(if (featurep 'xemacs) nil
2232 '(:help "Encrypt the message body on disk"))]
2233 ["Extract all parts..." gnus-summary-save-parts t]
2235 ["Repair multipart" gnus-summary-repair-multipart t]
2236 ["Pipe part..." gnus-article-pipe-part t]
2237 ["Inline part" gnus-article-inline-part t]
2238 ["View part as type..." gnus-article-view-part-as-type t]
2239 ["Encrypt body" gnus-article-encrypt-body
2240 :active (not (gnus-group-read-only-p))
2241 ,@(if (featurep 'xemacs) nil
2242 '(:help "Encrypt the message body on disk"))]
2243 ["View part externally" gnus-article-view-part-externally t]
2244 ["View part with charset..." gnus-article-view-part-as-charset t]
2245 ["Copy part" gnus-article-copy-part t]
2246 ["Save part..." gnus-article-save-part t]
2247 ["View part" gnus-article-view-part t]))
2249 ["Local" gnus-article-date-local t]
2250 ["ISO8601" gnus-article-date-iso8601 t]
2251 ["UT" gnus-article-date-ut t]
2252 ["Original" gnus-article-date-original t]
2253 ["Lapsed" gnus-article-date-lapsed t]
2254 ["User-defined" gnus-article-date-user t])
2256 ["Remove images" gnus-article-remove-images t]
2257 ["Toggle smiley" gnus-treat-smiley t]
2258 ["Show X-Face" gnus-article-display-x-face t]
2259 ["Show picons in From" gnus-treat-from-picon t]
2260 ["Show picons in mail headers" gnus-treat-mail-picon t]
2261 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2262 ("View as different encoding"
2263 ,@(gnus-summary-menu-split
2266 ;; Since easymenu under Emacs doesn't allow
2267 ;; lambda forms for menu commands, we should
2268 ;; provide intern'ed function symbols.
2269 (let ((command (intern (format "\
2270 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2274 (let ((gnus-summary-show-article-charset-alist
2276 (gnus-summary-show-article 1))))
2277 `[,(symbol-name cs) ,command t]))
2278 (sort (if (fboundp 'coding-system-list)
2279 (coding-system-list)
2280 (mapcar 'car mm-mime-mule-charset-alist))
2284 ["Leading" gnus-article-strip-leading-blank-lines t]
2285 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2286 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2287 ["All of the above" gnus-article-strip-blank-lines t]
2288 ["All" gnus-article-strip-all-blank-lines t]
2289 ["Leading space" gnus-article-strip-leading-space t]
2290 ["Trailing space" gnus-article-strip-trailing-space t]
2291 ["Leading space in headers"
2292 gnus-article-remove-leading-whitespace t])
2293 ["Overstrike" gnus-article-treat-overstrike t]
2294 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2295 ["Emphasis" gnus-article-emphasize t]
2296 ["Word wrap" gnus-article-fill-cited-article t]
2297 ["Fill long lines" gnus-article-fill-long-lines t]
2298 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2299 ["Remove CR" gnus-article-remove-cr t]
2300 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2301 ["Base64" gnus-article-de-base64-unreadable t]
2302 ["Rot 13" gnus-summary-caesar-message
2303 ,@(if (featurep 'xemacs) '(t)
2304 '(:help "\"Caesar rotate\" article by 13"))]
2305 ["De-IDNA" gnus-summary-idna-message t]
2306 ["Morse decode" gnus-summary-morse-message t]
2307 ["Unix pipe..." gnus-summary-pipe-message t]
2308 ["Add buttons" gnus-article-add-buttons t]
2309 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2310 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2311 ["Verbose header" gnus-summary-verbose-headers t]
2312 ["Toggle header" gnus-summary-toggle-header t]
2313 ["Unfold headers" gnus-article-treat-unfold-headers t]
2314 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2315 ["Html" gnus-article-wash-html t]
2316 ["Unsplit URLs" gnus-article-unsplit-urls t]
2317 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2318 ["Decode HZ" gnus-article-decode-HZ t]
2319 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2320 ("(Outlook) Deuglify"
2321 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2322 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2323 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2324 ["Full (Outlook) deuglify"
2325 gnus-article-outlook-deuglify-article t])
2328 ["Save in default format..." gnus-summary-save-article
2329 ,@(if (featurep 'xemacs) '(t)
2330 '(:help "Save article using default method"))]
2331 ["Save in file..." gnus-summary-save-article-file
2332 ,@(if (featurep 'xemacs) '(t)
2333 '(:help "Save article in file"))]
2334 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2335 ["Save in MH folder..." gnus-summary-save-article-folder t]
2336 ["Save in VM folder..." gnus-summary-save-article-vm t]
2337 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2338 ["Save body in file..." gnus-summary-save-article-body-file t]
2339 ["Pipe through a filter..." gnus-summary-pipe-output t]
2340 ["Add to SOUP packet" gnus-soup-add-article t]
2341 ["Print with Muttprint..." gnus-summary-muttprint t]
2342 ["Print" gnus-summary-print-article
2343 ,@(if (featurep 'xemacs) '(t)
2344 '(:help "Generate and print a PostScript image"))])
2345 ("Copy, move,... (Backend)"
2346 ,@(if (featurep 'xemacs) nil
2347 '(:help "Copying, moving, expiring articles..."))
2348 ["Respool article..." gnus-summary-respool-article t]
2349 ["Move article..." gnus-summary-move-article
2350 (gnus-check-backend-function
2351 'request-move-article gnus-newsgroup-name)]
2352 ["Copy article..." gnus-summary-copy-article t]
2353 ["Crosspost article..." gnus-summary-crosspost-article
2354 (gnus-check-backend-function
2355 'request-replace-article gnus-newsgroup-name)]
2356 ["Import file..." gnus-summary-import-article
2357 (gnus-check-backend-function
2358 'request-accept-article gnus-newsgroup-name)]
2359 ["Create article..." gnus-summary-create-article
2360 (gnus-check-backend-function
2361 'request-accept-article gnus-newsgroup-name)]
2362 ["Check if posted" gnus-summary-article-posted-p t]
2363 ["Edit article" gnus-summary-edit-article
2364 (not (gnus-group-read-only-p))]
2365 ["Delete article" gnus-summary-delete-article
2366 (gnus-check-backend-function
2367 'request-expire-articles gnus-newsgroup-name)]
2368 ["Query respool" gnus-summary-respool-query t]
2369 ["Trace respool" gnus-summary-respool-trace t]
2370 ["Delete expirable articles" gnus-summary-expire-articles-now
2371 (gnus-check-backend-function
2372 'request-expire-articles gnus-newsgroup-name)])
2374 ["Uudecode" gnus-uu-decode-uu
2375 ,@(if (featurep 'xemacs) '(t)
2376 '(:help "Decode uuencoded article(s)"))]
2377 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2378 ["Unshar" gnus-uu-decode-unshar t]
2379 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2380 ["Save" gnus-uu-decode-save t]
2381 ["Binhex" gnus-uu-decode-binhex t]
2382 ["Postscript" gnus-uu-decode-postscript t]
2383 ["All MIME parts" gnus-summary-save-parts t])
2385 ["Enter article" gnus-cache-enter-article t]
2386 ["Remove article" gnus-cache-remove-article t])
2387 ["Translate" gnus-article-babel t]
2388 ["Select article buffer" gnus-summary-select-article-buffer t]
2389 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2390 ["Isearch article..." gnus-summary-isearch-article t]
2391 ["Beginning of the article" gnus-summary-beginning-of-article t]
2392 ["End of the article" gnus-summary-end-of-article t]
2393 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2394 ["Fetch referenced articles" gnus-summary-refer-references t]
2395 ["Fetch current thread" gnus-summary-refer-thread t]
2396 ["Fetch article with id..." gnus-summary-refer-article t]
2397 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2398 ["Redisplay" gnus-summary-show-article t]
2399 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2401 gnus-summary-article-menu gnus-summary-mode-map ""
2402 (cons "Article" innards))
2404 (if (not (keymapp gnus-summary-article-menu))
2406 gnus-article-commands-menu gnus-article-mode-map ""
2407 (cons "Commands" innards))
2408 ;; in Emacs, don't share menu.
2409 (setq gnus-article-commands-menu
2410 (copy-keymap gnus-summary-article-menu))
2411 (define-key gnus-article-mode-map [menu-bar commands]
2412 (cons "Commands" gnus-article-commands-menu))))
2415 gnus-summary-thread-menu gnus-summary-mode-map ""
2417 ["Find all messages in thread" gnus-summary-refer-thread t]
2418 ["Toggle threading" gnus-summary-toggle-threads t]
2419 ["Hide threads" gnus-summary-hide-all-threads t]
2420 ["Show threads" gnus-summary-show-all-threads t]
2421 ["Hide thread" gnus-summary-hide-thread t]
2422 ["Show thread" gnus-summary-show-thread t]
2423 ["Go to next thread" gnus-summary-next-thread t]
2424 ["Go to previous thread" gnus-summary-prev-thread t]
2425 ["Go down thread" gnus-summary-down-thread t]
2426 ["Go up thread" gnus-summary-up-thread t]
2427 ["Top of thread" gnus-summary-top-thread t]
2428 ["Mark thread as read" gnus-summary-kill-thread t]
2429 ["Lower thread score" gnus-summary-lower-thread t]
2430 ["Raise thread score" gnus-summary-raise-thread t]
2431 ["Rethread current" gnus-summary-rethread-current t]))
2434 gnus-summary-post-menu gnus-summary-mode-map ""
2436 ["Send a message (mail or news)" gnus-summary-post-news
2437 ,@(if (featurep 'xemacs) '(t)
2438 '(:help "Compose a new message (mail or news)"))]
2439 ["Followup" gnus-summary-followup
2440 ,@(if (featurep 'xemacs) '(t)
2441 '(:help "Post followup to this article"))]
2442 ["Followup and yank" gnus-summary-followup-with-original
2443 ,@(if (featurep 'xemacs) '(t)
2444 '(:help "Post followup to this article, quoting its contents"))]
2445 ["Supersede article" gnus-summary-supersede-article t]
2446 ["Cancel article" gnus-summary-cancel-article
2447 ,@(if (featurep 'xemacs) '(t)
2448 '(:help "Cancel an article you posted"))]
2449 ["Reply" gnus-summary-reply t]
2450 ["Reply and yank" gnus-summary-reply-with-original t]
2451 ["Wide reply" gnus-summary-wide-reply t]
2452 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2453 ,@(if (featurep 'xemacs) '(t)
2454 '(:help "Mail a reply, quoting this article"))]
2455 ["Very wide reply" gnus-summary-very-wide-reply t]
2456 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2457 ,@(if (featurep 'xemacs) '(t)
2458 '(:help "Mail a very wide reply, quoting this article"))]
2459 ["Mail forward" gnus-summary-mail-forward t]
2460 ["Post forward" gnus-summary-post-forward t]
2461 ["Digest and mail" gnus-uu-digest-mail-forward t]
2462 ["Digest and post" gnus-uu-digest-post-forward t]
2463 ["Resend message" gnus-summary-resend-message t]
2464 ["Resend message edit" gnus-summary-resend-message-edit t]
2465 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2466 ["Send a mail" gnus-summary-mail-other-window t]
2467 ["Create a local message" gnus-summary-news-other-window t]
2468 ["Uuencode and post" gnus-uu-post-news
2469 ,@(if (featurep 'xemacs) '(t)
2470 '(:help "Post a uuencoded article"))]
2471 ["Followup via news" gnus-summary-followup-to-mail t]
2472 ["Followup via news and yank"
2473 gnus-summary-followup-to-mail-with-original t]
2475 ;;["Send" gnus-summary-send-draft t]
2476 ;;["Send bounced" gnus-resend-bounced-mail t])
2480 ((not (keymapp gnus-summary-post-menu))
2481 (setq gnus-article-post-menu gnus-summary-post-menu))
2482 ((not gnus-article-post-menu)
2483 ;; Don't share post menu.
2484 (setq gnus-article-post-menu
2485 (copy-keymap gnus-summary-post-menu))))
2486 (define-key gnus-article-mode-map [menu-bar post]
2487 (cons "Post" gnus-article-post-menu))
2490 gnus-summary-misc-menu gnus-summary-mode-map ""
2493 ["Mark as read" gnus-summary-mark-as-read-forward t]
2494 ["Mark same subject and select"
2495 gnus-summary-kill-same-subject-and-select t]
2496 ["Mark same subject" gnus-summary-kill-same-subject t]
2497 ["Catchup" gnus-summary-catchup
2498 ,@(if (featurep 'xemacs) '(t)
2499 '(:help "Mark unread articles in this group as read"))]
2500 ["Catchup all" gnus-summary-catchup-all t]
2501 ["Catchup to here" gnus-summary-catchup-to-here t]
2502 ["Catchup from here" gnus-summary-catchup-from-here t]
2503 ["Catchup region" gnus-summary-mark-region-as-read
2504 (gnus-mark-active-p)]
2505 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2507 ["Tick" gnus-summary-tick-article-forward t]
2508 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2509 ["Remove marks" gnus-summary-clear-mark-forward t]
2510 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2511 ["Set bookmark" gnus-summary-set-bookmark t]
2512 ["Remove bookmark" gnus-summary-remove-bookmark t])
2514 ["Marks..." gnus-summary-limit-to-marks t]
2515 ["Subject..." gnus-summary-limit-to-subject t]
2516 ["Author..." gnus-summary-limit-to-author t]
2517 ["Recipient..." gnus-summary-limit-to-recipient t]
2518 ["Age..." gnus-summary-limit-to-age t]
2519 ["Extra..." gnus-summary-limit-to-extra t]
2520 ["Score..." gnus-summary-limit-to-score t]
2521 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2522 ["Unread" gnus-summary-limit-to-unread t]
2523 ["Unseen" gnus-summary-limit-to-unseen t]
2524 ["Replied" gnus-summary-limit-to-replied t]
2525 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2526 ["Next articles" gnus-summary-limit-to-articles t]
2527 ["Pop limit" gnus-summary-pop-limit t]
2528 ["Show dormant" gnus-summary-limit-include-dormant t]
2529 ["Hide childless dormant"
2530 gnus-summary-limit-exclude-childless-dormant t]
2531 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2532 ["Hide marked" gnus-summary-limit-exclude-marks t]
2533 ["Show expunged" gnus-summary-limit-include-expunged t])
2535 ["Set mark" gnus-summary-mark-as-processable t]
2536 ["Remove mark" gnus-summary-unmark-as-processable t]
2537 ["Remove all marks" gnus-summary-unmark-all-processable t]
2538 ["Invert marks" gnus-uu-invert-processable t]
2539 ["Mark above" gnus-uu-mark-over t]
2540 ["Mark series" gnus-uu-mark-series t]
2541 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2542 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2543 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2544 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2545 ["Mark all" gnus-uu-mark-all t]
2546 ["Mark buffer" gnus-uu-mark-buffer t]
2547 ["Mark sparse" gnus-uu-mark-sparse t]
2548 ["Mark thread" gnus-uu-mark-thread t]
2549 ["Unmark thread" gnus-uu-unmark-thread t]
2550 ("Process Mark Sets"
2551 ["Kill" gnus-summary-kill-process-mark t]
2552 ["Yank" gnus-summary-yank-process-mark
2553 gnus-newsgroup-process-stack]
2554 ["Save" gnus-summary-save-process-mark t]
2555 ["Run command on marked..." gnus-summary-universal-argument t]))
2557 ["Page forward" gnus-summary-next-page
2558 ,@(if (featurep 'xemacs) '(t)
2559 '(:help "Show next page of article"))]
2560 ["Page backward" gnus-summary-prev-page
2561 ,@(if (featurep 'xemacs) '(t)
2562 '(:help "Show previous page of article"))]
2563 ["Line forward" gnus-summary-scroll-up t])
2565 ["Next unread article" gnus-summary-next-unread-article t]
2566 ["Previous unread article" gnus-summary-prev-unread-article t]
2567 ["Next article" gnus-summary-next-article t]
2568 ["Previous article" gnus-summary-prev-article t]
2569 ["Next unread subject" gnus-summary-next-unread-subject t]
2570 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2571 ["Next article same subject" gnus-summary-next-same-subject t]
2572 ["Previous article same subject" gnus-summary-prev-same-subject t]
2573 ["First unread article" gnus-summary-first-unread-article t]
2574 ["Best unread article" gnus-summary-best-unread-article t]
2575 ["Go to subject number..." gnus-summary-goto-subject t]
2576 ["Go to article number..." gnus-summary-goto-article t]
2577 ["Go to the last article" gnus-summary-goto-last-article t]
2578 ["Pop article off history" gnus-summary-pop-article t])
2580 ["Sort by number" gnus-summary-sort-by-number t]
2581 ["Sort by author" gnus-summary-sort-by-author t]
2582 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2583 ["Sort by subject" gnus-summary-sort-by-subject t]
2584 ["Sort by date" gnus-summary-sort-by-date t]
2585 ["Sort by score" gnus-summary-sort-by-score t]
2586 ["Sort by lines" gnus-summary-sort-by-lines t]
2587 ["Sort by characters" gnus-summary-sort-by-chars t]
2588 ["Randomize" gnus-summary-sort-by-random t]
2589 ["Original sort" gnus-summary-sort-by-original t])
2591 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2592 ["Describe group" gnus-summary-describe-group t]
2593 ["Fetch charter" gnus-group-fetch-charter
2594 ,@(if (featurep 'xemacs) nil
2595 '(:help "Display the charter of the current group"))]
2596 ["Fetch control message" gnus-group-fetch-control
2597 ,@(if (featurep 'xemacs) nil
2598 '(:help "Display the archived control message for the current group"))]
2599 ["Read manual" gnus-info-find-node t])
2601 ["Pick and read" gnus-pick-mode t]
2602 ["Binary" gnus-binary-mode t])
2604 ["Regenerate" gnus-summary-prepare t]
2605 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2606 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2607 ["Toggle threading" gnus-summary-toggle-threads t])
2608 ["See old articles" gnus-summary-insert-old-articles t]
2609 ["See new articles" gnus-summary-insert-new-articles t]
2610 ["Filter articles..." gnus-summary-execute-command t]
2611 ["Run command on articles..." gnus-summary-universal-argument t]
2612 ["Search articles forward..." gnus-summary-search-article-forward t]
2613 ["Search articles backward..." gnus-summary-search-article-backward t]
2614 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2615 ["Expand window" gnus-summary-expand-window t]
2616 ["Expire expirable articles" gnus-summary-expire-articles
2617 (gnus-check-backend-function
2618 'request-expire-articles gnus-newsgroup-name)]
2619 ["Edit local kill file" gnus-summary-edit-local-kill t]
2620 ["Edit main kill file" gnus-summary-edit-global-kill t]
2621 ["Edit group parameters" gnus-summary-edit-parameters t]
2622 ["Customize group parameters" gnus-summary-customize-parameters t]
2623 ["Send a bug report" gnus-bug t]
2625 ["Catchup and exit" gnus-summary-catchup-and-exit
2626 ,@(if (featurep 'xemacs) '(t)
2627 '(:help "Mark unread articles in this group as read, then exit"))]
2628 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2629 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2630 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2631 ["Exit group" gnus-summary-exit
2632 ,@(if (featurep 'xemacs) '(t)
2633 '(:help "Exit current group, return to group selection mode"))]
2634 ["Exit group without updating" gnus-summary-exit-no-update t]
2635 ["Exit and goto next group" gnus-summary-next-group t]
2636 ["Exit and goto prev group" gnus-summary-prev-group t]
2637 ["Reselect group" gnus-summary-reselect-current-group t]
2638 ["Rescan group" gnus-summary-rescan-group t]
2639 ["Update dribble" gnus-summary-save-newsrc t])))
2641 (gnus-run-hooks 'gnus-summary-menu-hook)))
2643 (defvar gnus-summary-tool-bar-map nil)
2645 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2646 ;; affect _new_ message buffers. We might add a function that walks thru all
2647 ;; summary-mode buffers and force the update.
2648 (defun gnus-summary-tool-bar-update (&optional symbol value)
2649 "Update summary mode toolbar.
2650 Setter function for custom variables."
2651 (setq-default gnus-summary-tool-bar-map nil)
2653 ;; When used as ":set" function:
2654 (set-default symbol value))
2655 (when (gnus-buffer-live-p gnus-summary-buffer)
2656 (with-current-buffer gnus-summary-buffer
2657 (gnus-summary-make-tool-bar))))
2659 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2660 'gnus-summary-tool-bar-gnome
2661 'gnus-summary-tool-bar-retro)
2662 "Specifies the Gnus summary tool bar.
2664 It can be either a list or a symbol refering to a list. See
2665 `gmm-tool-bar-from-list' for the format of the list. The
2666 default key map is `gnus-summary-mode-map'.
2668 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2669 `gnus-summary-tool-bar-retro'."
2670 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2671 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2672 (repeat :tag "User defined list" gmm-tool-bar-item)
2674 :version "23.0" ;; No Gnus
2675 :initialize 'custom-initialize-default
2676 :set 'gnus-summary-tool-bar-update
2677 :group 'gnus-summary)
2679 (defcustom gnus-summary-tool-bar-gnome
2680 '((gnus-summary-post-news "mail/compose" nil)
2681 (gnus-summary-insert-new-articles "mail/inbox" nil
2682 :visible (or (not gnus-agent)
2684 (gnus-summary-reply-with-original "mail/reply")
2685 (gnus-summary-reply "mail/reply" nil :visible nil)
2686 (gnus-summary-followup-with-original "mail/reply-all")
2687 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2688 (gnus-summary-mail-forward "mail/forward")
2689 (gnus-summary-save-article "mail/save")
2690 (gnus-summary-search-article-forward "search" nil :visible nil)
2691 (gnus-summary-print-article "print")
2692 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2693 ;; Some new commands that may need more suitable icons:
2694 (gnus-summary-save-newsrc "save" nil :visible nil)
2695 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2696 (gnus-summary-prev-article "left-arrow")
2697 (gnus-summary-next-article "right-arrow")
2698 (gnus-summary-next-page "next-page")
2699 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2701 ;; Maybe some sort-by-... could be added:
2702 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2703 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2704 (gnus-summary-mark-as-expirable
2706 :visible (gnus-check-backend-function 'request-expire-articles
2707 gnus-newsgroup-name))
2708 (gnus-summary-mark-as-spam
2710 :visible (and (fboundp 'spam-group-ham-contents-p)
2711 (spam-group-ham-contents-p gnus-newsgroup-name))
2712 :help "Mark as spam")
2713 (gnus-summary-mark-as-read-forward
2715 :visible (and (fboundp 'spam-group-spam-contents-p)
2716 (spam-group-spam-contents-p gnus-newsgroup-name)))
2718 (gnus-summary-exit "exit")
2719 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2720 (gnus-info-find-node "help"))
2721 "List of functions for the summary tool bar (GNOME style).
2723 See `gmm-tool-bar-from-list' for the format of the list."
2724 :type '(repeat gmm-tool-bar-item)
2725 :version "23.0" ;; No Gnus
2726 :initialize 'custom-initialize-default
2727 :set 'gnus-summary-tool-bar-update
2728 :group 'gnus-summary)
2730 (defcustom gnus-summary-tool-bar-retro
2731 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2732 (gnus-summary-next-unread-article "gnus/next-ur")
2733 (gnus-summary-post-news "gnus/post")
2734 (gnus-summary-followup-with-original "gnus/fuwo")
2735 (gnus-summary-followup "gnus/followup")
2736 (gnus-summary-reply-with-original "gnus/reply-wo")
2737 (gnus-summary-reply "gnus/reply")
2738 (gnus-summary-caesar-message "gnus/rot13")
2739 (gnus-uu-decode-uu "gnus/uu-decode")
2740 (gnus-summary-save-article-file "gnus/save-aif")
2741 (gnus-summary-save-article "gnus/save-art")
2742 (gnus-uu-post-news "gnus/uu-post")
2743 (gnus-summary-catchup "gnus/catchup")
2744 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2745 (gnus-summary-exit "gnus/exit-summ")
2746 ;; Some new command that may need more suitable icons:
2747 (gnus-summary-print-article "gnus/print" nil :visible nil)
2748 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2749 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2750 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2751 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2752 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2753 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2755 (gnus-info-find-node "gnus/help" nil :visible nil))
2756 "List of functions for the summary tool bar (retro look).
2758 See `gmm-tool-bar-from-list' for the format of the list."
2759 :type '(repeat gmm-tool-bar-item)
2760 :version "23.0" ;; No Gnus
2761 :initialize 'custom-initialize-default
2762 :set 'gnus-summary-tool-bar-update
2763 :group 'gnus-summary)
2765 (defcustom gnus-summary-tool-bar-zap-list t
2766 "List of icon items from the global tool bar.
2767 These items are not displayed in the Gnus summary mode tool bar.
2769 See `gmm-tool-bar-from-list' for the format of the list."
2770 :type 'gmm-tool-bar-zap-list
2771 :version "23.0" ;; No Gnus
2772 :initialize 'custom-initialize-default
2773 :set 'gnus-summary-tool-bar-update
2774 :group 'gnus-summary)
2776 (defvar image-load-path)
2778 (defun gnus-summary-make-tool-bar (&optional force)
2779 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2780 When FORCE, rebuild the tool bar."
2781 (when (and (not (featurep 'xemacs))
2782 (boundp 'tool-bar-mode)
2784 (or (not gnus-summary-tool-bar-map) force))
2786 (gmm-image-load-path-for-library "gnus"
2789 (image-load-path (cons (car load-path)
2790 (when (boundp 'image-load-path)
2792 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2793 gnus-summary-tool-bar-zap-list
2794 'gnus-summary-mode-map)))
2796 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2798 (setq gnus-summary-tool-bar-map map))))
2799 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2801 (defun gnus-score-set-default (var value)
2802 "A version of set that updates the GNU Emacs menu-bar."
2804 ;; It is the message that forces the active status to be updated.
2807 (defun gnus-make-score-map (type)
2808 "Make a summary score map of type TYPE."
2811 (let ((headers '(("author" "from" string)
2812 ("subject" "subject" string)
2813 ("article body" "body" string)
2814 ("article head" "head" string)
2815 ("xref" "xref" string)
2816 ("extra header" "extra" string)
2817 ("lines" "lines" number)
2818 ("followups to author" "followup" string)))
2819 (types '((number ("less than" <)
2822 (string ("substring" s)
2826 (perms '(("temporary" (current-time-string))
2834 (if (eq type 'lower)
2839 (setq header (car headers))
2845 (let ((ts (cdr (assoc (nth 2 header) types)))
2861 'gnus-summary-score-entry
2863 (if (or (string= (nth 1 header)
2865 (string= (nth 1 header)
2868 (list 'gnus-summary-header
2870 (list 'quote (nth 1 (car ts)))
2871 (list 'gnus-score-delta-default
2878 (list (nreverse outp))))
2881 (list (nreverse outt))))
2883 (setq headers (cdr headers)))
2884 (list (nreverse outh))))))))
2888 (defun gnus-summary-mode (&optional group)
2889 "Major mode for reading articles.
2891 All normal editing commands are switched off.
2892 \\<gnus-summary-mode-map>
2893 Each line in this buffer represents one article. To read an
2894 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2895 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2898 You can also post articles and send mail from this buffer. To
2899 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2900 of an article, type `\\[gnus-summary-reply]'.
2902 There are approx. one gazillion commands you can execute in this
2903 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2905 The following commands are available:
2907 \\{gnus-summary-mode-map}"
2909 (kill-all-local-variables)
2910 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2911 (gnus-summary-make-local-variables))
2912 (gnus-summary-make-local-variables)
2913 (setq gnus-newsgroup-name group)
2914 (when (gnus-visual-p 'summary-menu 'menu)
2915 (gnus-summary-make-menu-bar)
2916 (gnus-summary-make-tool-bar))
2917 (gnus-make-thread-indent-array)
2918 (gnus-simplify-mode-line)
2919 (setq major-mode 'gnus-summary-mode)
2920 (setq mode-name "Summary")
2921 (make-local-variable 'minor-mode-alist)
2922 (use-local-map gnus-summary-mode-map)
2923 (buffer-disable-undo)
2924 (setq buffer-read-only t ;Disable modification
2925 show-trailing-whitespace nil)
2926 (setq truncate-lines t)
2927 (setq selective-display t)
2928 (setq selective-display-ellipses t) ;Display `...'
2929 (gnus-summary-set-display-table)
2930 (gnus-set-default-directory)
2931 (make-local-variable 'gnus-summary-line-format)
2932 (make-local-variable 'gnus-summary-line-format-spec)
2933 (make-local-variable 'gnus-summary-dummy-line-format)
2934 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2935 (make-local-variable 'gnus-summary-mark-positions)
2936 (gnus-make-local-hook 'pre-command-hook)
2937 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2938 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2939 (turn-on-gnus-mailing-list-mode)
2940 (mm-enable-multibyte)
2941 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
2942 (gnus-update-summary-mark-positions))
2944 (defun gnus-summary-make-local-variables ()
2945 "Make all the local summary buffer variables."
2947 (dolist (local gnus-summary-local-variables)
2950 (if (eq (cdr local) 'global)
2951 ;; Copy the global value of the variable.
2952 (setq global (symbol-value (car local)))
2953 ;; Use the value from the list.
2954 (setq global (eval (cdr local))))
2955 (set (make-local-variable (car local)) global))
2956 ;; Simple nil-valued local variable.
2957 (set (make-local-variable local) nil)))))
2959 (defun gnus-summary-clear-local-variables ()
2960 (let ((locals gnus-summary-local-variables))
2962 (if (consp (car locals))
2963 (and (symbolp (caar locals))
2964 (set (caar locals) nil))
2965 (and (symbolp (car locals))
2966 (set (car locals) nil)))
2967 (setq locals (cdr locals)))))
2969 ;; Summary data functions.
2971 (defmacro gnus-data-number (data)
2974 (defmacro gnus-data-set-number (data number)
2975 `(setcar ,data ,number))
2977 (defmacro gnus-data-mark (data)
2980 (defmacro gnus-data-set-mark (data mark)
2981 `(setcar (nthcdr 1 ,data) ,mark))
2983 (defmacro gnus-data-pos (data)
2986 (defmacro gnus-data-set-pos (data pos)
2987 `(setcar (nthcdr 2 ,data) ,pos))
2989 (defmacro gnus-data-header (data)
2992 (defmacro gnus-data-set-header (data header)
2993 `(setf (nth 3 ,data) ,header))
2995 (defmacro gnus-data-level (data)
2998 (defmacro gnus-data-unread-p (data)
2999 `(= (nth 1 ,data) gnus-unread-mark))
3001 (defmacro gnus-data-read-p (data)
3002 `(/= (nth 1 ,data) gnus-unread-mark))
3004 (defmacro gnus-data-pseudo-p (data)
3005 `(consp (nth 3 ,data)))
3007 (defmacro gnus-data-find (number)
3008 `(assq ,number gnus-newsgroup-data))
3010 (defmacro gnus-data-find-list (number &optional data)
3011 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3012 (memq (assq ,number bdata)
3015 (defmacro gnus-data-make (number mark pos header level)
3016 `(list ,number ,mark ,pos ,header ,level))
3018 (defun gnus-data-enter (after-article number mark pos header level offset)
3019 (let ((data (gnus-data-find-list after-article)))
3021 (error "No such article: %d" after-article))
3022 (setcdr data (cons (gnus-data-make number mark pos header level)
3024 (setq gnus-newsgroup-data-reverse nil)
3025 (gnus-data-update-list (cddr data) offset)))
3027 (defun gnus-data-enter-list (after-article list &optional offset)
3029 (let ((data (and after-article (gnus-data-find-list after-article)))
3033 (let ((odata gnus-newsgroup-data))
3034 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3036 (gnus-data-update-list odata offset)))
3037 ;; Find the last element in the list to be spliced into the main
3039 (setq list (last list))
3042 (setcdr list gnus-newsgroup-data)
3043 (setq gnus-newsgroup-data ilist)
3045 (gnus-data-update-list (cdr list) offset)))
3046 (setcdr list (cdr data))
3049 (gnus-data-update-list (cdr list) offset))))
3050 (setq gnus-newsgroup-data-reverse nil))))
3052 (defun gnus-data-remove (article &optional offset)
3053 (let ((data gnus-newsgroup-data))
3054 (if (= (gnus-data-number (car data)) article)
3056 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3057 gnus-newsgroup-data-reverse nil)
3059 (gnus-data-update-list gnus-newsgroup-data offset)))
3061 (when (= (gnus-data-number (cadr data)) article)
3062 (setcdr data (cddr data))
3064 (gnus-data-update-list (cdr data) offset))
3066 gnus-newsgroup-data-reverse nil))
3067 (setq data (cdr data))))))
3069 (defmacro gnus-data-list (backward)
3071 (or gnus-newsgroup-data-reverse
3072 (setq gnus-newsgroup-data-reverse
3073 (reverse gnus-newsgroup-data)))
3074 gnus-newsgroup-data))
3076 (defun gnus-data-update-list (data offset)
3077 "Add OFFSET to the POS of all data entries in DATA."
3078 (setq gnus-newsgroup-data-reverse nil)
3080 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3081 (setq data (cdr data))))
3083 (defun gnus-summary-article-pseudo-p (article)
3084 "Say whether this article is a pseudo article or not."
3085 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3087 (defmacro gnus-summary-article-sparse-p (article)
3088 "Say whether this article is a sparse article or not."
3089 `(memq ,article gnus-newsgroup-sparse))
3091 (defmacro gnus-summary-article-ancient-p (article)
3092 "Say whether this article is a sparse article or not."
3093 `(memq ,article gnus-newsgroup-ancient))
3095 (defun gnus-article-parent-p (number)
3096 "Say whether this article is a parent or not."
3097 (let ((data (gnus-data-find-list number)))
3098 (and (cdr data) ; There has to be an article after...
3099 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3100 (gnus-data-level (nth 1 data))))))
3102 (defun gnus-article-children (number)
3103 "Return a list of all children to NUMBER."
3104 (let* ((data (gnus-data-find-list number))
3105 (level (gnus-data-level (car data)))
3107 (setq data (cdr data))
3109 (= (gnus-data-level (car data)) (1+ level)))
3110 (push (gnus-data-number (car data)) children)
3111 (setq data (cdr data)))
3114 (defmacro gnus-summary-skip-intangible ()
3115 "If the current article is intangible, then jump to a different article."
3116 '(let ((to (get-text-property (point) 'gnus-intangible)))
3117 (and to (gnus-summary-goto-subject to))))
3119 (defmacro gnus-summary-article-intangible-p ()
3120 "Say whether this article is intangible or not."
3121 '(get-text-property (point) 'gnus-intangible))
3123 (defun gnus-article-read-p (article)
3124 "Say whether ARTICLE is read or not."
3125 (not (or (memq article gnus-newsgroup-marked)
3126 (memq article gnus-newsgroup-spam-marked)
3127 (memq article gnus-newsgroup-unreads)
3128 (memq article gnus-newsgroup-unselected)
3129 (memq article gnus-newsgroup-dormant))))
3131 ;; Some summary mode macros.
3133 (defmacro gnus-summary-article-number ()
3134 "The article number of the article on the current line.
3135 If there isn't an article number here, then we return the current
3138 (gnus-summary-skip-intangible)
3139 (or (get-text-property (point) 'gnus-number)
3140 (gnus-summary-last-subject))))
3142 (defmacro gnus-summary-article-header (&optional number)
3143 "Return the header of article NUMBER."
3144 `(gnus-data-header (gnus-data-find
3145 ,(or number '(gnus-summary-article-number)))))
3147 (defmacro gnus-summary-thread-level (&optional number)
3148 "Return the level of thread that starts with article NUMBER."
3149 `(if (and (eq gnus-summary-make-false-root 'dummy)
3150 (get-text-property (point) 'gnus-intangible))
3152 (gnus-data-level (gnus-data-find
3153 ,(or number '(gnus-summary-article-number))))))
3155 (defmacro gnus-summary-article-mark (&optional number)
3156 "Return the mark of article NUMBER."
3157 `(gnus-data-mark (gnus-data-find
3158 ,(or number '(gnus-summary-article-number)))))
3160 (defmacro gnus-summary-article-pos (&optional number)
3161 "Return the position of the line of article NUMBER."
3162 `(gnus-data-pos (gnus-data-find
3163 ,(or number '(gnus-summary-article-number)))))
3165 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3166 (defmacro gnus-summary-article-subject (&optional number)
3167 "Return current subject string or nil if nothing."
3170 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3171 '(gnus-data-header (assq (gnus-summary-article-number)
3172 gnus-newsgroup-data)))))
3175 (mail-header-subject headers))))
3177 (defmacro gnus-summary-article-score (&optional number)
3178 "Return current article score."
3179 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3180 gnus-newsgroup-scored))
3181 gnus-summary-default-score 0))
3183 (defun gnus-summary-article-children (&optional number)
3184 "Return a list of article numbers that are children of article NUMBER."
3185 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3186 (level (gnus-data-level (car data)))
3188 (while (and (setq data (cdr data))
3189 (> (setq l (gnus-data-level (car data))) level))
3190 (and (= (1+ level) l)
3191 (push (gnus-data-number (car data))
3193 (nreverse children)))
3195 (defun gnus-summary-article-parent (&optional number)
3196 "Return the article number of the parent of article NUMBER."
3197 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3198 (gnus-data-list t)))
3199 (level (gnus-data-level (car data))))
3201 () ; This is a root.
3202 ;; We search until we find an article with a level less than
3203 ;; this one. That function has to be the parent.
3204 (while (and (setq data (cdr data))
3205 (not (< (gnus-data-level (car data)) level))))
3206 (and data (gnus-data-number (car data))))))
3208 (defun gnus-unread-mark-p (mark)
3209 "Say whether MARK is the unread mark."
3210 (= mark gnus-unread-mark))
3212 (defun gnus-read-mark-p (mark)
3213 "Say whether MARK is one of the marks that mark as read.
3214 This is all marks except unread, ticked, dormant, and expirable."
3215 (not (or (= mark gnus-unread-mark)
3216 (= mark gnus-ticked-mark)
3217 (= mark gnus-spam-mark)
3218 (= mark gnus-dormant-mark)
3219 (= mark gnus-expirable-mark))))
3221 (defmacro gnus-article-mark (number)
3222 "Return the MARK of article NUMBER.
3223 This macro should only be used when computing the mark the \"first\"
3224 time; i.e., when generating the summary lines. After that,
3225 `gnus-summary-article-mark' should be used to examine the
3228 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3229 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3230 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3231 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3232 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3233 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3234 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3235 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3236 gnus-ancient-mark))))
3238 ;; Saving hidden threads.
3240 (defmacro gnus-save-hidden-threads (&rest forms)
3241 "Save hidden threads, eval FORMS, and restore the hidden threads."
3242 (let ((config (make-symbol "config")))
3243 `(let ((,config (gnus-hidden-threads-configuration)))
3247 (gnus-restore-hidden-threads-configuration ,config)))))
3248 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3249 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3251 (defun gnus-data-compute-positions ()
3252 "Compute the positions of all articles."
3253 (setq gnus-newsgroup-data-reverse nil)
3254 (let ((data gnus-newsgroup-data))
3256 (gnus-save-hidden-threads
3257 (gnus-summary-show-all-threads)
3258 (goto-char (point-min))
3260 (while (get-text-property (point) 'gnus-intangible)
3262 (gnus-data-set-pos (car data) (+ (point) 3))
3263 (setq data (cdr data))
3264 (forward-line 1))))))
3266 (defun gnus-hidden-threads-configuration ()
3267 "Return the current hidden threads configuration."
3270 (goto-char (point-min))
3271 (while (search-forward "\r" nil t)
3272 (push (1- (point)) config))
3275 (defun gnus-restore-hidden-threads-configuration (config)
3276 "Restore hidden threads configuration from CONFIG."
3278 (let (point buffer-read-only)
3279 (while (setq point (pop config))
3280 (when (and (< point (point-max))
3282 (eq (char-after) ?\n))
3283 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3285 ;; Various summary mode internalish functions.
3287 (defun gnus-mouse-pick-article (e)
3290 (gnus-summary-next-page nil t))
3292 (defun gnus-summary-set-display-table ()
3293 "Change the display table.
3294 Odd characters have a tendency to mess
3295 up nicely formatted displays - we make all possible glyphs
3296 display only a single character."
3298 ;; We start from the standard display table, if any.
3299 (let ((table (or (copy-sequence standard-display-table)
3300 (make-display-table)))
3302 ;; Nix out all the control chars...
3303 (while (>= (setq i (1- i)) 0)
3304 (aset table i [??]))
3305 ;; ... but not newline and cr, of course. (cr is necessary for the
3306 ;; selective display).
3307 (aset table ?\n nil)
3308 (aset table ?\r nil)
3309 ;; We keep TAB as well.
3310 (aset table ?\t nil)
3311 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3312 ;; Emacs 23 (unicode), that are not set already.
3313 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3316 (while (>= (setq i (1- i)) 127)
3317 ;; Only modify if the entry is nil.
3318 (unless (aref table i)
3319 (aset table i [??]))))
3320 (setq buffer-display-table table)))
3322 (defun gnus-summary-set-article-display-arrow (pos)
3323 "Update the overlay arrow to point to line at position POS."
3324 (when (and gnus-summary-display-arrow
3325 (boundp 'overlay-arrow-position)
3326 (boundp 'overlay-arrow-string))
3330 (unless overlay-arrow-position
3331 (setq overlay-arrow-position (make-marker)))
3332 (setq overlay-arrow-string "=>"
3333 overlay-arrow-position (set-marker overlay-arrow-position
3335 (current-buffer))))))
3337 (defun gnus-summary-setup-buffer (group)
3338 "Initialize summary buffer."
3339 (let ((buffer (gnus-summary-buffer-name group))
3340 (dead-name (concat "*Dead Summary "
3341 (gnus-group-decoded-name group) "*")))
3342 ;; If a dead summary buffer exists, we kill it.
3343 (when (gnus-buffer-live-p dead-name)
3344 (gnus-kill-buffer dead-name))
3345 (if (get-buffer buffer)
3348 (setq gnus-summary-buffer (current-buffer))
3349 (not gnus-newsgroup-prepared))
3350 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3351 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3352 (gnus-summary-mode group)
3354 (gnus-carpal-setup-buffer 'summary))
3355 (when (gnus-group-quit-config group)
3356 (set (make-local-variable 'gnus-single-article-buffer) nil))
3357 (make-local-variable 'gnus-article-buffer)
3358 (make-local-variable 'gnus-article-current)
3359 (make-local-variable 'gnus-original-article-buffer)
3360 (setq gnus-newsgroup-name group)
3361 ;; Set any local variables in the group parameters.
3362 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3365 (defun gnus-set-global-variables ()
3366 "Set the global equivalents of the buffer-local variables.
3367 They are set to the latest values they had. These reflect the summary
3368 buffer that was in action when the last article was fetched."
3369 (when (eq major-mode 'gnus-summary-mode)
3370 (setq gnus-summary-buffer (current-buffer))
3371 (let ((name gnus-newsgroup-name)
3372 (marked gnus-newsgroup-marked)
3373 (spam gnus-newsgroup-spam-marked)
3374 (unread gnus-newsgroup-unreads)
3375 (headers gnus-current-headers)
3376 (data gnus-newsgroup-data)
3377 (summary gnus-summary-buffer)
3378 (article-buffer gnus-article-buffer)
3379 (original gnus-original-article-buffer)
3380 (gac gnus-article-current)
3381 (reffed gnus-reffed-article-number)
3382 (score-file gnus-current-score-file)
3383 (default-charset gnus-newsgroup-charset)
3385 (let ((locals gnus-newsgroup-variables))
3387 (if (consp (car locals))
3388 (push (eval (caar locals)) vlist)
3389 (push (eval (car locals)) vlist))
3390 (setq locals (cdr locals)))
3391 (setq vlist (nreverse vlist)))
3392 (with-current-buffer gnus-group-buffer
3393 (setq gnus-newsgroup-name name
3394 gnus-newsgroup-marked marked
3395 gnus-newsgroup-spam-marked spam
3396 gnus-newsgroup-unreads unread
3397 gnus-current-headers headers
3398 gnus-newsgroup-data data
3399 gnus-article-current gac
3400 gnus-summary-buffer summary
3401 gnus-article-buffer article-buffer
3402 gnus-original-article-buffer original
3403 gnus-reffed-article-number reffed
3404 gnus-current-score-file score-file
3405 gnus-newsgroup-charset default-charset)
3406 (let ((locals gnus-newsgroup-variables))
3408 (if (consp (car locals))
3409 (set (caar locals) (pop vlist))
3410 (set (car locals) (pop vlist)))
3411 (setq locals (cdr locals))))
3412 ;; The article buffer also has local variables.
3413 (when (gnus-buffer-live-p gnus-article-buffer)
3414 (set-buffer gnus-article-buffer)
3415 (setq gnus-summary-buffer summary))))))
3417 (defun gnus-summary-article-unread-p (article)
3418 "Say whether ARTICLE is unread or not."
3419 (memq article gnus-newsgroup-unreads))
3421 (defun gnus-summary-first-article-p (&optional article)
3422 "Return whether ARTICLE is the first article in the buffer."
3423 (if (not (setq article (or article (gnus-summary-article-number))))
3425 (eq article (caar gnus-newsgroup-data))))
3427 (defun gnus-summary-last-article-p (&optional article)
3428 "Return whether ARTICLE is the last article in the buffer."
3429 (if (not (setq article (or article (gnus-summary-article-number))))
3430 ;; All non-existent numbers are the last article. :-)
3432 (not (cdr (gnus-data-find-list article)))))
3434 (defun gnus-make-thread-indent-array ()
3436 (unless (and gnus-thread-indent-array
3437 (= gnus-thread-indent-level gnus-thread-indent-array-level))
3438 (setq gnus-thread-indent-array (make-vector 201 "")
3439 gnus-thread-indent-array-level gnus-thread-indent-level)
3441 (aset gnus-thread-indent-array n
3442 (make-string (* n gnus-thread-indent-level) ? ))
3445 (defun gnus-update-summary-mark-positions ()
3446 "Compute where the summary marks are to go."
3448 (when (gnus-buffer-exists-p gnus-summary-buffer)
3449 (set-buffer gnus-summary-buffer))
3450 (let ((spec gnus-summary-line-format-spec)
3453 (gnus-set-work-buffer)
3454 (let ((gnus-tmp-unread ?Z)
3455 (gnus-replied-mark ?Z)
3456 (gnus-score-below-mark ?Z)
3457 (gnus-score-over-mark ?Z)
3458 (gnus-undownloaded-mark ?Z)
3459 (gnus-summary-line-format-spec spec)
3460 (gnus-newsgroup-downloadable '(0))
3461 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3462 case-fold-search ignores)
3463 ;; Here, all marks are bound to Z.
3464 (gnus-summary-insert-line header
3465 0 nil t gnus-tmp-unread t nil "" nil 1)
3466 (goto-char (point-min))
3467 ;; Memorize the positions of the same characters as dummy marks.
3468 (while (re-search-forward "[A-D]" nil t)
3469 (push (point) ignores))
3471 ;; We use A-D as dummy marks in order to know column positions
3472 ;; where marks should be inserted.
3473 (setq gnus-tmp-unread ?A
3474 gnus-replied-mark ?B
3475 gnus-score-below-mark ?C
3476 gnus-score-over-mark ?C
3477 gnus-undownloaded-mark ?D)
3478 (gnus-summary-insert-line header
3479 0 nil t gnus-tmp-unread t nil "" nil 1)
3480 ;; Ignore characters which aren't dummy marks.
3482 (delete-region (goto-char (1- p)) p)
3484 (goto-char (point-min))
3485 (setq pos (list (cons 'unread
3486 (and (search-forward "A" nil t)
3487 (- (point) (point-min) 1)))))
3488 (goto-char (point-min))
3489 (push (cons 'replied (and (search-forward "B" nil t)
3490 (- (point) (point-min) 1)))
3492 (goto-char (point-min))
3493 (push (cons 'score (and (search-forward "C" nil t)
3494 (- (point) (point-min) 1)))
3496 (goto-char (point-min))
3497 (push (cons 'download (and (search-forward "D" nil t)
3498 (- (point) (point-min) 1)))
3500 (setq gnus-summary-mark-positions pos))))
3502 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3503 "Insert a dummy root in the summary buffer."
3505 (gnus-add-text-properties
3506 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3507 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3509 (defun gnus-summary-extract-address-component (from)
3510 (or (car (funcall gnus-extract-address-components from))
3513 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3514 (let ((mail-parse-charset gnus-newsgroup-charset)
3515 ; Is it really necessary to do this next part for each summary line?
3516 ; Luckily, doesn't seem to slow things down much.
3517 (mail-parse-ignored-charsets
3518 (with-current-buffer gnus-summary-buffer
3519 gnus-newsgroup-ignored-charsets)))
3521 (and gnus-ignored-from-addresses
3522 (string-match gnus-ignored-from-addresses gnus-tmp-from)
3523 (let ((extra-headers (mail-header-extra header))
3527 ((setq to (cdr (assq 'To extra-headers)))
3528 (concat gnus-summary-to-prefix
3530 (gnus-summary-extract-address-component
3531 (funcall gnus-decode-encoded-word-function to)))))
3534 (cdr (assq 'Newsgroups extra-headers))
3536 (memq 'Newsgroups gnus-extra-headers)
3537 (eq (car (gnus-find-method-for-group
3538 gnus-newsgroup-name)) 'nntp)
3539 (gnus-group-real-name gnus-newsgroup-name))))
3540 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3541 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3543 (defun gnus-summary-insert-line (gnus-tmp-header
3544 gnus-tmp-level gnus-tmp-current
3545 undownloaded gnus-tmp-unread gnus-tmp-replied
3546 gnus-tmp-expirable gnus-tmp-subject-or-nil
3547 &optional gnus-tmp-dummy gnus-tmp-score
3549 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3550 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3551 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3552 (gnus-tmp-score-char
3553 (if (or (null gnus-summary-default-score)
3554 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3555 gnus-summary-zcore-fuzz))
3557 (if (< gnus-tmp-score gnus-summary-default-score)
3558 gnus-score-below-mark gnus-score-over-mark)))
3559 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3561 (cond (gnus-tmp-process gnus-process-mark)
3562 ((memq gnus-tmp-current gnus-newsgroup-cached)
3564 (gnus-tmp-replied gnus-replied-mark)
3565 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3566 gnus-forwarded-mark)
3567 ((memq gnus-tmp-current gnus-newsgroup-saved)
3569 ((memq gnus-tmp-number gnus-newsgroup-recent)
3571 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3574 (gnus-tmp-downloaded
3576 gnus-undownloaded-mark)
3577 (gnus-newsgroup-agentized
3578 gnus-downloaded-mark)
3581 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3584 ((string-match "<[^>]+> *$" gnus-tmp-from)
3585 (let ((beg (match-beginning 0)))
3586 (or (and (string-match "^\".+\"" gnus-tmp-from)
3587 (substring gnus-tmp-from 1 (1- (match-end 0))))
3588 (substring gnus-tmp-from 0 beg))))
3589 ((string-match "(.+)" gnus-tmp-from)
3590 (substring gnus-tmp-from
3591 (1+ (match-beginning 0)) (1- (match-end 0))))
3593 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3594 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3595 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3596 (buffer-read-only nil))
3597 (when (string= gnus-tmp-name "")
3598 (setq gnus-tmp-name gnus-tmp-from))
3599 (unless (numberp gnus-tmp-lines)
3600 (setq gnus-tmp-lines -1))
3601 (if (= gnus-tmp-lines -1)
3602 (setq gnus-tmp-lines "?")
3603 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3604 (gnus-put-text-property
3606 (progn (eval gnus-summary-line-format-spec) (point))
3607 'gnus-number gnus-tmp-number)
3608 (when (gnus-visual-p 'summary-highlight 'highlight)
3610 (gnus-run-hooks 'gnus-summary-update-hook)
3613 (defun gnus-summary-update-line (&optional dont-update)
3614 "Update summary line after change."
3615 (when (and gnus-summary-default-score
3616 (not gnus-summary-inhibit-highlight))
3617 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3618 (article (gnus-summary-article-number))
3619 (score (gnus-summary-article-score article)))
3621 (if (and gnus-summary-mark-below
3622 (< (gnus-summary-article-score)
3623 gnus-summary-mark-below))
3624 ;; This article has a low score, so we mark it as read.
3625 (when (memq article gnus-newsgroup-unreads)
3626 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3627 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3628 ;; This article was previously marked as read on account
3629 ;; of a low score, but now it has risen, so we mark it as
3631 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3632 (gnus-summary-update-mark
3633 (if (or (null gnus-summary-default-score)
3634 (<= (abs (- score gnus-summary-default-score))
3635 gnus-summary-zcore-fuzz))
3637 (if (< score gnus-summary-default-score)
3638 gnus-score-below-mark gnus-score-over-mark))
3640 ;; Do visual highlighting.
3641 (when (gnus-visual-p 'summary-highlight 'highlight)
3642 (gnus-run-hooks 'gnus-summary-update-hook)))))
3644 (defvar gnus-tmp-new-adopts nil)
3646 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3647 "Return the number of articles in THREAD.
3648 This may be 0 in some cases -- if none of the articles in
3649 the thread are to be displayed."
3651 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3653 ((not (listp thread))
3655 ((and (consp thread) (cdr thread))
3658 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3661 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3664 (when (and level (zerop level) gnus-tmp-new-adopts)
3667 'gnus-summary-number-of-articles-in-thread
3668 gnus-tmp-new-adopts))))
3670 (if (> number 1) gnus-not-empty-thread-mark
3671 gnus-empty-thread-mark)
3674 (defsubst gnus-summary-line-message-size (head)
3675 "Return pretty-printed version of message size.
3676 This function is intended to be used in
3677 `gnus-summary-line-format-alist'."
3678 (let ((c (or (mail-header-chars head) -1)))
3679 (cond ((< c 0) "n/a") ; chars not available
3680 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3681 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3682 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3683 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3686 (defun gnus-summary-set-local-parameters (group)
3687 "Go through the local params of GROUP and set all variable specs in that list."
3688 (let ((vars '(quit-config))) ; Ignore quit-config.
3689 (dolist (elem (gnus-group-find-parameter group))
3690 (and (consp elem) ; Has to be a cons.
3691 (consp (cdr elem)) ; The cdr has to be a list.
3692 (symbolp (car elem)) ; Has to be a symbol in there.
3693 (not (memq (car elem) vars))
3694 (ignore-errors ; So we set it.
3695 (push (car elem) vars)
3696 (make-local-variable (car elem))
3697 (set (car elem) (eval (nth 1 elem))))))))
3699 (defun gnus-summary-read-group (group &optional show-all no-article
3700 kill-buffer no-display backward
3702 "Start reading news in newsgroup GROUP.
3703 If SHOW-ALL is non-nil, already read articles are also listed.
3704 If NO-ARTICLE is non-nil, no article is selected initially.
3705 If NO-DISPLAY, don't generate a summary buffer."
3709 (let ((gnus-auto-select-next nil))
3710 (or (gnus-summary-read-group-1
3711 group show-all no-article
3712 kill-buffer no-display
3715 select-articles nil)))))
3716 (eq gnus-auto-select-next 'quietly))
3717 (set-buffer gnus-group-buffer)
3718 ;; The entry function called above goes to the next
3719 ;; group automatically, so we go two groups back
3720 ;; if we are searching for the previous group.
3722 (gnus-group-prev-unread-group 2))
3723 (if (not (equal group (gnus-group-group-name)))
3724 (setq group (gnus-group-group-name))
3728 (defun gnus-summary-read-group-1 (group show-all no-article
3729 kill-buffer no-display
3730 &optional select-articles)
3731 ;; Killed foreign groups can't be entered.
3732 ;; (when (and (not (gnus-group-native-p group))
3733 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3734 ;; (error "Dead non-native groups can't be entered"))
3735 (gnus-message 5 "Retrieving newsgroup: %s..."
3736 (gnus-group-decoded-name group))
3737 (let* ((new-group (gnus-summary-setup-buffer group))
3738 (quit-config (gnus-group-quit-config group))
3739 (did-select (and new-group (gnus-select-newsgroup
3740 group show-all select-articles))))
3742 ;; This summary buffer exists already, so we just select it.
3744 (gnus-set-global-variables)
3746 (gnus-kill-or-deaden-summary kill-buffer))
3747 (gnus-configure-windows 'summary 'force)
3748 (gnus-set-mode-line 'summary)
3749 (gnus-summary-position-point)
3752 ;; We couldn't select this group.
3754 (when (and (eq major-mode 'gnus-summary-mode)
3755 (not (equal (current-buffer) kill-buffer)))
3756 (kill-buffer (current-buffer))
3757 (if (not quit-config)
3759 ;; Update the info -- marks might need to be removed,
3761 (gnus-summary-update-info)
3762 (set-buffer gnus-group-buffer)
3763 (gnus-group-jump-to-group group)
3764 (gnus-group-next-unread-group 1))
3765 (gnus-handle-ephemeral-exit quit-config)))
3766 (let ((grpinfo (gnus-get-info group)))
3767 (if (null (gnus-info-read grpinfo))
3768 (gnus-message 3 "Group %s contains no messages"
3769 (gnus-group-decoded-name group))
3770 (gnus-message 3 "Can't select group")))
3772 ;; The user did a `C-g' while prompting for number of articles,
3773 ;; so we exit this group.
3774 ((eq did-select 'quit)
3775 (and (eq major-mode 'gnus-summary-mode)
3776 (not (equal (current-buffer) kill-buffer))
3777 (kill-buffer (current-buffer)))
3779 (gnus-kill-or-deaden-summary kill-buffer))
3780 (if (not quit-config)
3782 (set-buffer gnus-group-buffer)
3783 (gnus-group-jump-to-group group)
3784 (gnus-group-next-unread-group 1)
3785 (gnus-configure-windows 'group 'force))
3786 (gnus-handle-ephemeral-exit quit-config))
3787 ;; Finally signal the quit.
3789 ;; The group was successfully selected.
3791 (gnus-set-global-variables)
3792 ;; Save the active value in effect when the group was entered.
3793 (setq gnus-newsgroup-active
3795 (gnus-active gnus-newsgroup-name)))
3796 ;; You can change the summary buffer in some way with this hook.
3797 (gnus-run-hooks 'gnus-select-group-hook)
3798 (when (memq 'summary (gnus-update-format-specifications
3799 nil 'summary 'summary-mode 'summary-dummy))
3800 ;; The format specification for the summary line was updated,
3801 ;; so we need to update the mark positions as well.
3802 (gnus-update-summary-mark-positions))
3803 ;; Do score processing.
3804 (when gnus-use-scoring
3805 (gnus-possibly-score-headers))
3806 ;; Check whether to fill in the gaps in the threads.
3807 (when gnus-build-sparse-threads
3808 (gnus-build-sparse-threads))
3809 ;; Find the initial limit.
3811 (let ((gnus-newsgroup-dormant nil))
3812 (gnus-summary-initial-limit show-all))
3813 (gnus-summary-initial-limit show-all))
3814 ;; Generate the summary buffer.
3816 (gnus-summary-prepare))
3817 (when gnus-use-trees
3818 (gnus-tree-open group)
3819 (setq gnus-summary-highlight-line-function
3820 'gnus-tree-highlight-article))
3821 ;; If the summary buffer is empty, but there are some low-scored
3822 ;; articles or some excluded dormants, we include these in the
3824 (when (and (zerop (buffer-size))
3826 (cond (gnus-newsgroup-dormant
3827 (gnus-summary-limit-include-dormant))
3828 ((and gnus-newsgroup-scored show-all)
3829 (gnus-summary-limit-include-expunged t))))
3830 ;; Function `gnus-apply-kill-file' must be called in this hook.
3831 (gnus-run-hooks 'gnus-apply-kill-hook)
3832 (if (and (zerop (buffer-size))
3835 ;; This newsgroup is empty.
3836 (gnus-summary-catchup-and-exit nil t)
3837 (gnus-message 6 "No unread news")
3839 (gnus-kill-or-deaden-summary kill-buffer))
3840 ;; Return nil from this function.
3842 ;; Hide conversation thread subtrees. We cannot do this in
3843 ;; gnus-summary-prepare-hook since kill processing may not
3844 ;; work with hidden articles.
3845 (gnus-summary-maybe-hide-threads)
3847 (gnus-kill-or-deaden-summary kill-buffer))
3848 (gnus-summary-auto-select-subject)
3849 ;; Show first unread article if requested.
3850 (if (and (not no-article)
3852 gnus-newsgroup-unreads
3853 gnus-auto-select-first)
3855 (gnus-configure-windows 'summary)
3856 (let ((art (gnus-summary-article-number)))
3857 (unless (and (not gnus-plugged)
3858 (or (memq art gnus-newsgroup-undownloaded)
3859 (memq art gnus-newsgroup-downloadable)))
3860 (gnus-summary-goto-article art))))
3861 ;; Don't select any articles.
3862 (gnus-summary-position-point)
3863 (gnus-configure-windows 'summary 'force)
3864 (gnus-set-mode-line 'summary))
3865 (when (and gnus-auto-center-group
3866 (get-buffer-window gnus-group-buffer t))
3867 ;; Gotta use windows, because recenter does weird stuff if
3868 ;; the current buffer ain't the displayed window.
3869 (let ((owin (selected-window)))
3870 (select-window (get-buffer-window gnus-group-buffer t))
3871 (when (gnus-group-goto-group group)
3873 (select-window owin)))
3874 ;; Mark this buffer as "prepared".
3875 (setq gnus-newsgroup-prepared t)
3876 (gnus-run-hooks 'gnus-summary-prepared-hook)
3877 (unless (gnus-ephemeral-group-p group)
3878 (gnus-group-update-group group))
3881 (defun gnus-summary-auto-select-subject ()
3882 "Select the subject line on initial group entry."
3883 (goto-char (point-min))
3885 ((eq gnus-auto-select-subject 'best)
3886 (gnus-summary-best-unread-subject))
3887 ((eq gnus-auto-select-subject 'unread)
3888 (gnus-summary-first-unread-subject))
3889 ((eq gnus-auto-select-subject 'unseen)
3890 (gnus-summary-first-unseen-subject))
3891 ((eq gnus-auto-select-subject 'unseen-or-unread)
3892 (gnus-summary-first-unseen-or-unread-subject))
3893 ((eq gnus-auto-select-subject 'first)
3896 ((functionp gnus-auto-select-subject)
3897 (funcall gnus-auto-select-subject))))
3899 (defun gnus-summary-prepare ()
3900 "Generate the summary buffer."
3902 (let ((buffer-read-only nil))
3904 (setq gnus-newsgroup-data nil
3905 gnus-newsgroup-data-reverse nil)
3906 (gnus-run-hooks 'gnus-summary-generate-hook)
3907 ;; Generate the buffer, either with threads or without.
3908 (when gnus-newsgroup-headers
3909 (gnus-summary-prepare-threads
3910 (if gnus-show-threads
3911 (gnus-sort-gathered-threads
3912 (funcall gnus-summary-thread-gathering-function
3914 (gnus-cut-threads (gnus-make-threads)))))
3915 ;; Unthreaded display.
3916 (gnus-sort-articles gnus-newsgroup-headers))))
3917 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3918 ;; Call hooks for modifying summary buffer.
3919 (goto-char (point-min))
3920 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3922 (defsubst gnus-general-simplify-subject (subject)
3923 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3926 ;; Truncate the subject.
3927 (gnus-simplify-subject-functions
3928 (gnus-map-function gnus-simplify-subject-functions subject))
3929 ((numberp gnus-summary-gather-subject-limit)
3930 (setq subject (gnus-simplify-subject-re subject))
3931 (if (> (length subject) gnus-summary-gather-subject-limit)
3932 (substring subject 0 gnus-summary-gather-subject-limit)
3934 ;; Fuzzily simplify it.
3935 ((eq 'fuzzy gnus-summary-gather-subject-limit)
3936 (gnus-simplify-subject-fuzzy subject))
3937 ;; Just remove the leading "Re:".
3939 (gnus-simplify-subject-re subject))))
3941 (if (and gnus-summary-gather-exclude-subject
3942 (string-match gnus-summary-gather-exclude-subject subject))
3943 nil ; This article shouldn't be gathered
3946 (defun gnus-summary-simplify-subject-query ()
3947 "Query where the respool algorithm would put this article."
3949 (gnus-summary-select-article)
3950 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
3952 (defun gnus-gather-threads-by-subject (threads)
3953 "Gather threads by looking at Subject headers."
3954 (if (not gnus-summary-make-false-root)
3956 (let ((hashtb (gnus-make-hashtable 1024))
3959 subject hthread whole-subject)
3961 (setq subject (gnus-general-simplify-subject
3962 (setq whole-subject (mail-header-subject
3965 (if (setq hthread (gnus-gethash subject hashtb))
3967 ;; We enter a dummy root into the thread, if we
3968 ;; haven't done that already.
3969 (unless (stringp (caar hthread))
3970 (setcar hthread (list whole-subject (car hthread))))
3971 ;; We add this new gathered thread to this gathered
3973 (setcdr (car hthread)
3974 (nconc (cdar hthread) (list (car threads))))
3975 ;; Remove it from the list of threads.
3976 (setcdr prev (cdr threads))
3977 (setq threads prev))
3978 ;; Enter this thread into the hash table.
3979 (gnus-sethash subject
3980 (if gnus-summary-make-false-root-always
3982 ;; If you want a dummy root above all
3984 (setcar threads (list whole-subject
3990 (setq threads (cdr threads)))
3993 (defun gnus-gather-threads-by-references (threads)
3994 "Gather threads by looking at References headers."
3995 (let ((idhashtb (gnus-make-hashtable 1024))
3996 (thhashtb (gnus-make-hashtable 1024))
3999 ids references id gthread gid entered ref)
4001 (when (setq references (mail-header-references (caar threads)))
4002 (setq id (mail-header-id (caar threads))
4003 ids (inline (gnus-split-references references))
4005 (while (setq ref (pop ids))
4006 (setq ids (delete ref ids))
4007 (if (not (setq gid (gnus-gethash ref idhashtb)))
4009 (gnus-sethash ref id idhashtb)
4010 (gnus-sethash id threads thhashtb))
4011 (setq gthread (gnus-gethash gid thhashtb))
4013 ;; We enter a dummy root into the thread, if we
4014 ;; haven't done that already.
4015 (unless (stringp (caar gthread))
4016 (setcar gthread (list (mail-header-subject (caar gthread))
4018 ;; We add this new gathered thread to this gathered
4020 (setcdr (car gthread)
4021 (nconc (cdar gthread) (list (car threads)))))
4022 ;; Add it into the thread hash table.
4023 (gnus-sethash id gthread thhashtb)
4025 ;; Remove it from the list of threads.
4026 (setcdr prev (cdr threads))
4027 (setq threads prev))))
4029 (setq threads (cdr threads)))
4032 (defun gnus-sort-gathered-threads (threads)
4033 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4034 (let ((result threads))
4036 (when (stringp (caar threads))
4037 (setcdr (car threads)
4038 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4039 (setq threads (cdr threads)))
4042 (defun gnus-thread-loop-p (root thread)
4043 "Say whether ROOT is in THREAD."
4044 (let ((stack (list thread))
4047 (while (setq thread (pop stack))
4048 (setq th (cdr thread))
4050 (not (eq (caar th) root)))
4053 ;; We have found a loop.
4055 (setcdr thread (delq (car th) (cdr thread)))
4056 (if (boundp (setq ref-dep (intern "none"
4057 gnus-newsgroup-dependencies)))
4058 (setcdr (symbol-value ref-dep)
4059 (nconc (cdr (symbol-value ref-dep))
4061 (set ref-dep (list nil (car th))))
4064 ;; Push all the subthreads onto the stack.
4065 (push (cdr thread) stack)))
4068 (defun gnus-make-threads ()
4069 "Go through the dependency hashtb and find the roots. Return all threads."
4071 (while (catch 'infloop
4074 ;; Deal with self-referencing References loops.
4075 (when (and (car (symbol-value refs))
4082 (car (symbol-value refs)) thread))
4083 (cdr (symbol-value refs)))))))
4086 (unless (car (symbol-value refs))
4087 ;; These threads do not refer back to any other
4088 ;; articles, so they're roots.
4089 (setq threads (append (cdr (symbol-value refs)) threads))))
4090 gnus-newsgroup-dependencies)))
4093 ;; Build the thread tree.
4094 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4095 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4097 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4098 if it was already present.
4100 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4101 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4102 Message-IDs will be renamed to a unique Message-ID before being
4105 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4106 (let* ((id (mail-header-id header))
4107 (id-dep (and id (intern id dependencies)))
4108 parent-id ref ref-dep ref-header replaced)
4109 ;; Enter this `header' in the `dependencies' table.
4113 ;; The first two cases do the normal part: enter a new `header'
4114 ;; in the `dependencies' table.
4115 ((not (boundp id-dep))
4116 (set id-dep (list header)))
4117 ((null (car (symbol-value id-dep)))
4118 (setcar (symbol-value id-dep) header))
4120 ;; From here the `header' was already present in the
4121 ;; `dependencies' table.
4123 ;; Overrides an existing entry;
4124 ;; just set the header part of the entry.
4125 (setcar (symbol-value id-dep) header)
4128 ;; Renames the existing `header' to a unique Message-ID.
4129 ((not gnus-summary-ignore-duplicates)
4130 ;; An article with this Message-ID has already been seen.
4131 ;; We rename the Message-ID.
4132 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4134 (mail-header-set-id header id))
4136 ;; The last case ignores an existing entry, except it adds any
4137 ;; additional Xrefs (in case the two articles came from different
4139 ;; Also sets `header' to `nil' meaning that the `dependencies'
4140 ;; table was *not* modified.
4142 (mail-header-set-xref
4143 (car (symbol-value id-dep))
4144 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4146 (or (mail-header-xref header) "")))
4149 (when (and header (not replaced))
4150 ;; First check that we are not creating a References loop.
4151 (setq parent-id (gnus-parent-id (mail-header-references header)))
4152 (setq ref parent-id)
4154 (setq ref-dep (intern-soft ref dependencies))
4156 (setq ref-header (car (symbol-value ref-dep))))
4157 (if (string= id ref)
4158 ;; Yuk! This is a reference loop. Make the article be a
4161 (mail-header-set-references (car (symbol-value id-dep)) "none")
4163 (setq parent-id nil))
4164 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4165 (setq ref-dep (intern (or parent-id "none") dependencies))
4166 (if (boundp ref-dep)
4167 (setcdr (symbol-value ref-dep)
4168 (nconc (cdr (symbol-value ref-dep))
4169 (list (symbol-value id-dep))))
4170 (set ref-dep (list nil (symbol-value id-dep)))))
4173 (defun gnus-extract-message-id-from-in-reply-to (string)
4174 (if (string-match "<[^>]+>" string)
4175 (substring string (match-beginning 0) (match-end 0))
4178 (defun gnus-build-sparse-threads ()
4179 (let ((headers gnus-newsgroup-headers)
4180 (mail-parse-charset gnus-newsgroup-charset)
4181 (gnus-summary-ignore-duplicates t)
4182 header references generation relations
4183 subject child end new-child date)
4184 ;; First we create an alist of generations/relations, where
4185 ;; generations is how much we trust the relation, and the relation
4187 (gnus-message 7 "Making sparse threads...")
4189 (nnheader-set-temp-buffer " *gnus sparse threads*")
4190 (while (setq header (pop headers))
4191 (when (and (setq references (mail-header-references header))
4192 (not (string= references "")))
4194 (setq child (mail-header-id header)
4195 subject (mail-header-subject header)
4196 date (mail-header-date header)
4198 (while (search-backward ">" nil t)
4199 (setq end (1+ (point)))
4200 (when (search-backward "<" nil t)
4201 (setq new-child (buffer-substring (point) end))
4202 (push (list (incf generation)
4203 child (setq child new-child)
4207 (push (list (1+ generation) child nil subject) relations))
4209 (kill-buffer (current-buffer)))
4210 ;; Sort over trustworthiness.
4213 (when (gnus-dependencies-add-header
4214 (make-full-mail-header
4215 gnus-reffed-article-number
4216 (nth 3 relation) "" (or (nth 4 relation) "")
4218 (or (nth 2 relation) "") 0 0 "")
4219 gnus-newsgroup-dependencies nil)
4220 (push gnus-reffed-article-number gnus-newsgroup-limit)
4221 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4222 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4223 gnus-newsgroup-reads)
4224 (decf gnus-reffed-article-number)))
4225 (sort relations 'car-less-than-car))
4226 (gnus-message 7 "Making sparse threads...done")))
4228 (defun gnus-build-old-threads ()
4229 ;; Look at all the articles that refer back to old articles, and
4230 ;; fetch the headers for the articles that aren't there. This will
4231 ;; build complete threads - if the roots haven't been expired by the
4233 (let ((mail-parse-charset gnus-newsgroup-charset)
4237 (when (not (car (symbol-value refs)))
4238 (setq heads (cdr (symbol-value refs)))
4240 (if (memq (mail-header-number (caar heads))
4241 gnus-newsgroup-dormant)
4242 (setq heads (cdr heads))
4243 (setq id (symbol-name refs))
4244 (while (and (setq id (gnus-build-get-header id))
4245 (not (car (gnus-id-to-thread id)))))
4246 (setq heads nil)))))
4247 gnus-newsgroup-dependencies)))
4249 (defsubst gnus-remove-odd-characters (string)
4250 "Translate STRING into something that doesn't contain weird characters."
4251 (mm-subst-char-in-string
4253 (mm-subst-char-in-string ?\n ?\- string t) t))
4255 ;; This function has to be called with point after the article number
4256 ;; on the beginning of the line.
4257 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4258 (let ((eol (point-at-eol))
4259 (buffer (current-buffer))
4260 header references in-reply-to)
4262 ;; overview: [num subject from date id refs chars lines misc]
4265 (narrow-to-region (point) eol)
4270 (make-full-mail-header
4272 (condition-case () ; subject
4273 (gnus-remove-odd-characters
4274 (funcall gnus-decode-encoded-word-function
4275 (setq x (nnheader-nov-field))))
4277 (condition-case () ; from
4278 (gnus-remove-odd-characters
4279 (funcall gnus-decode-encoded-word-function
4280 (setq x (nnheader-nov-field))))
4282 (nnheader-nov-field) ; date
4283 (nnheader-nov-read-message-id number) ; id
4284 (setq references (nnheader-nov-field)) ; refs
4285 (nnheader-nov-read-integer) ; chars
4286 (nnheader-nov-read-integer) ; lines
4288 (if (looking-at "Xref: ")
4289 (goto-char (match-end 0)))
4290 (nnheader-nov-field)) ; Xref
4291 (nnheader-nov-parse-extra)))) ; extra
4295 (when (and (string= references "")
4296 (setq in-reply-to (mail-header-extra header))
4297 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4298 (mail-header-set-references
4299 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4301 (when gnus-alter-header-function
4302 (funcall gnus-alter-header-function header))
4303 (gnus-dependencies-add-header header dependencies force-new)))
4305 (defun gnus-build-get-header (id)
4306 "Look through the buffer of NOV lines and find the header to ID.
4307 Enter this line into the dependencies hash table, and return
4308 the id of the parent article (if any)."
4309 (let ((deps gnus-newsgroup-dependencies)
4313 (set-buffer nntp-server-buffer)
4314 (let ((case-fold-search nil))
4315 (goto-char (point-min))
4316 (while (and (not found)
4317 (search-forward id nil t))
4319 (setq found (looking-at
4320 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4321 (regexp-quote id))))
4322 (or found (beginning-of-line 2)))
4326 (setq header (gnus-nov-parse-line
4327 (read (current-buffer)) deps))
4328 (gnus-parent-id (mail-header-references header))))))
4330 (let ((number (mail-header-number header)))
4331 (push number gnus-newsgroup-limit)
4332 (push header gnus-newsgroup-headers)
4333 (if (memq number gnus-newsgroup-unselected)
4335 (setq gnus-newsgroup-unreads
4336 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4338 (setq gnus-newsgroup-unselected
4339 (delq number gnus-newsgroup-unselected)))
4340 (push number gnus-newsgroup-ancient)))))))
4342 (defun gnus-build-all-threads ()
4343 "Read all the headers."
4344 (let ((gnus-summary-ignore-duplicates t)
4345 (mail-parse-charset gnus-newsgroup-charset)
4346 (dependencies gnus-newsgroup-dependencies)
4349 (set-buffer nntp-server-buffer)
4350 (let ((case-fold-search nil))
4351 (goto-char (point-min))
4354 (setq article (read (current-buffer))
4355 header (gnus-nov-parse-line article dependencies)))
4357 (with-current-buffer gnus-summary-buffer
4358 (push header gnus-newsgroup-headers)
4359 (if (memq (setq article (mail-header-number header))
4360 gnus-newsgroup-unselected)
4362 (setq gnus-newsgroup-unreads
4363 (gnus-add-to-sorted-list
4364 gnus-newsgroup-unreads article))
4365 (setq gnus-newsgroup-unselected
4366 (delq article gnus-newsgroup-unselected)))
4367 (push article gnus-newsgroup-ancient)))
4368 (forward-line 1)))))))
4370 (defun gnus-summary-update-article-line (article header)
4371 "Update the line for ARTICLE using HEADER."
4372 (let* ((id (mail-header-id header))
4373 (thread (gnus-id-to-thread id)))
4375 (error "Article in no thread"))
4376 ;; Update the thread.
4377 (setcar thread header)
4378 (gnus-summary-goto-subject article)
4379 (let* ((datal (gnus-data-find-list article))
4381 (buffer-read-only nil)
4382 (level (gnus-summary-thread-level)))
4384 (let ((inserted (- (point)
4386 (gnus-summary-insert-line
4388 (memq article gnus-newsgroup-undownloaded)
4389 (gnus-article-mark article)
4390 (memq article gnus-newsgroup-replied)
4391 (memq article gnus-newsgroup-expirable)
4392 ;; Only insert the Subject string when it's different
4393 ;; from the previous Subject string.
4398 (mail-header-subject
4401 (gnus-data-find-list
4403 (gnus-data-list t)))))
4404 ;; Error on the side of excessive subjects.
4406 (mail-header-subject header)))
4408 (mail-header-subject header))
4409 nil (cdr (assq article gnus-newsgroup-scored))
4410 (memq article gnus-newsgroup-processable))
4413 (gnus-data-update-list
4415 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4417 (defun gnus-summary-update-article (article &optional iheader)
4418 "Update ARTICLE in the summary buffer."
4419 (set-buffer gnus-summary-buffer)
4420 (let* ((header (gnus-summary-article-header article))
4421 (id (mail-header-id header))
4422 (data (gnus-data-find article))
4423 (thread (gnus-id-to-thread id))
4424 (references (mail-header-references header))
4428 (when (and references
4429 (not (equal "" references)))
4432 (buffer-read-only nil)
4438 (delq thread parent)))
4439 (if (gnus-summary-insert-subject id header)
4440 ;; Set the (possibly) new article number in the data structure.
4441 (gnus-data-set-number data (gnus-id-to-article id))
4445 (defun gnus-rebuild-thread (id &optional line)
4446 "Rebuild the thread containing ID.
4447 If LINE, insert the rebuilt thread starting on line LINE."
4448 (let ((buffer-read-only nil)
4449 old-pos current thread data)
4450 (if (not gnus-show-threads)
4451 (setq thread (list (car (gnus-id-to-thread id))))
4452 ;; Get the thread this article is part of.
4453 (setq thread (gnus-remove-thread id)))
4454 (setq old-pos (point-at-bol))
4455 (setq current (save-excursion
4456 (and (re-search-backward "[\r\n]" nil t)
4457 (gnus-summary-article-number))))
4458 ;; If this is a gathered thread, we have to go some re-gathering.
4459 (when (stringp (car thread))
4460 (let ((subject (car thread))
4462 (setq thread (cdr thread))
4464 (unless (memq (setq thr (gnus-id-to-thread
4466 (mail-header-id (caar thread)))))
4469 (setq thread (cdr thread)))
4470 ;; We now have all (unique) roots.
4471 (if (= (length roots) 1)
4472 ;; All the loose roots are now one solid root.
4473 (setq thread (car roots))
4474 (setq thread (cons subject (gnus-sort-threads roots))))))
4476 ;; We then insert this thread into the summary buffer.
4478 (goto-char (point-min))
4479 (forward-line (1- line)))
4480 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4481 (if gnus-show-threads
4482 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4483 (gnus-summary-prepare-unthreaded thread))
4484 (setq data (nreverse gnus-newsgroup-data))
4485 (setq threads gnus-newsgroup-threads))
4486 ;; We splice the new data into the data structure.
4487 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4488 ;;!!! then we want to insert at the beginning of the buffer.
4489 ;;!!! That happens to be true with Gnus now, but that may
4490 ;;!!! change in the future. Perhaps.
4491 (gnus-data-enter-list
4492 (if line nil current) data (- (point) old-pos))
4493 (setq gnus-newsgroup-threads
4494 (nconc threads gnus-newsgroup-threads))
4495 (gnus-data-compute-positions))))
4497 (defun gnus-number-to-header (number)
4498 "Return the header for article NUMBER."
4499 (let ((headers gnus-newsgroup-headers))
4501 (not (= number (mail-header-number (car headers)))))
4506 (defun gnus-parent-headers (in-headers &optional generation)
4507 "Return the headers of the GENERATIONeth parent of HEADERS."
4509 (setq generation 1))
4511 (headers in-headers)
4514 (not (zerop generation))
4515 (setq references (mail-header-references headers)))
4516 (setq headers (if (and references
4517 (setq parent (gnus-parent-id references)))
4518 (car (gnus-id-to-thread parent))
4521 (and (not (eq headers in-headers))
4524 (defun gnus-id-to-thread (id)
4525 "Return the (sub-)thread where ID appears."
4526 (gnus-gethash id gnus-newsgroup-dependencies))
4528 (defun gnus-id-to-article (id)
4529 "Return the article number of ID."
4530 (let ((thread (gnus-id-to-thread id)))
4533 (mail-header-number (car thread)))))
4535 (defun gnus-id-to-header (id)
4536 "Return the article headers of ID."
4537 (car (gnus-id-to-thread id)))
4539 (defun gnus-article-displayed-root-p (article)
4540 "Say whether ARTICLE is a root(ish) article."
4541 (let ((level (gnus-summary-thread-level article))
4542 (refs (mail-header-references (gnus-summary-article-header article)))
4548 ((null (gnus-parent-id refs)) t)
4550 (null (setq particle (gnus-id-to-article
4551 (gnus-parent-id refs))))
4552 (null (gnus-summary-thread-level particle)))))))
4554 (defun gnus-root-id (id)
4555 "Return the id of the root of the thread where ID appears."
4557 (while (and id (setq prev (car (gnus-id-to-thread id))))
4559 id (gnus-parent-id (mail-header-references prev))))
4562 (defun gnus-articles-in-thread (thread)
4563 "Return the list of articles in THREAD."
4564 (cons (mail-header-number (car thread))
4565 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4567 (defun gnus-remove-thread (id &optional dont-remove)
4568 "Remove the thread that has ID in it."
4569 (let (headers thread last-id)
4570 ;; First go up in this thread until we find the root.
4571 (setq last-id (gnus-root-id id)
4572 headers (message-flatten-list (gnus-id-to-thread last-id)))
4573 ;; We have now found the real root of this thread. It might have
4574 ;; been gathered into some loose thread, so we have to search
4575 ;; through the threads to find the thread we wanted.
4576 (let ((threads gnus-newsgroup-threads)
4579 (setq sub (car threads))
4580 (if (stringp (car sub))
4581 ;; This is a gathered thread, so we look at the roots
4582 ;; below it to find whether this article is in this
4585 (setq sub (cdr sub))
4587 (when (member (caar sub) headers)
4588 (setq thread (car threads)
4591 (setq sub (cdr sub))))
4592 ;; It's an ordinary thread, so we check it.
4593 (when (eq (car sub) (car headers))
4596 (setq threads (cdr threads)))
4597 ;; If this article is in no thread, then it's a root.
4600 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4601 (setq thread (gnus-id-to-thread last-id)))
4604 thread ; We return this thread.
4606 (if (stringp (car thread))
4608 ;; If we use dummy roots, then we have to remove the
4609 ;; dummy root as well.
4610 (when (eq gnus-summary-make-false-root 'dummy)
4611 ;; We go to the dummy root by going to
4612 ;; the first sub-"thread", and then one line up.
4613 (gnus-summary-goto-article
4614 (mail-header-number (caadr thread)))
4617 (gnus-data-compute-positions))
4618 (setq thread (cdr thread))
4620 (gnus-remove-thread-1 (car thread))
4621 (setq thread (cdr thread))))
4622 (gnus-remove-thread-1 thread))))))))
4624 (defun gnus-remove-thread-1 (thread)
4625 "Remove the thread THREAD recursively."
4626 (let ((number (mail-header-number (pop thread)))
4628 (setq thread (reverse thread))
4630 (gnus-remove-thread-1 (pop thread)))
4631 (when (setq d (gnus-data-find number))
4632 (goto-char (gnus-data-pos d))
4633 (gnus-summary-show-thread)
4639 (gnus-delete-line)))))))
4641 (defun gnus-sort-threads-1 (threads func)
4642 (sort (mapcar (lambda (thread)
4645 (gnus-sort-threads-1 (cdr thread) func))))
4648 (defun gnus-sort-threads (threads)
4650 (if (not gnus-thread-sort-functions)
4652 (gnus-message 8 "Sorting threads...")
4653 (let ((max-lisp-eval-depth 5000))
4654 (prog1 (gnus-sort-threads-1
4656 (gnus-make-sort-function gnus-thread-sort-functions))
4657 (gnus-message 8 "Sorting threads...done")))))
4659 (defun gnus-sort-articles (articles)
4661 (when gnus-article-sort-functions
4662 (gnus-message 7 "Sorting articles...")
4664 (setq gnus-newsgroup-headers
4665 (sort articles (gnus-make-sort-function
4666 gnus-article-sort-functions)))
4667 (gnus-message 7 "Sorting articles...done"))))
4669 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4670 (defmacro gnus-thread-header (thread)
4671 "Return header of first article in THREAD.
4672 Note that THREAD must never, ever be anything else than a variable -
4673 using some other form will lead to serious barfage."
4674 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4675 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4676 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4679 (defsubst gnus-article-sort-by-number (h1 h2)
4680 "Sort articles by article number."
4681 (< (mail-header-number h1)
4682 (mail-header-number h2)))
4684 (defun gnus-thread-sort-by-number (h1 h2)
4685 "Sort threads by root article number."
4686 (gnus-article-sort-by-number
4687 (gnus-thread-header h1) (gnus-thread-header h2)))
4689 (defsubst gnus-article-sort-by-random (h1 h2)
4690 "Sort articles by article number."
4693 (defun gnus-thread-sort-by-random (h1 h2)
4694 "Sort threads by root article number."
4695 (gnus-article-sort-by-random
4696 (gnus-thread-header h1) (gnus-thread-header h2)))
4698 (defsubst gnus-article-sort-by-lines (h1 h2)
4699 "Sort articles by article Lines header."
4700 (< (mail-header-lines h1)
4701 (mail-header-lines h2)))
4703 (defun gnus-thread-sort-by-lines (h1 h2)
4704 "Sort threads by root article Lines header."
4705 (gnus-article-sort-by-lines
4706 (gnus-thread-header h1) (gnus-thread-header h2)))
4708 (defsubst gnus-article-sort-by-chars (h1 h2)
4709 "Sort articles by octet length."
4710 (< (mail-header-chars h1)
4711 (mail-header-chars h2)))
4713 (defun gnus-thread-sort-by-chars (h1 h2)
4714 "Sort threads by root article octet length."
4715 (gnus-article-sort-by-chars
4716 (gnus-thread-header h1) (gnus-thread-header h2)))
4718 (defsubst gnus-article-sort-by-author (h1 h2)
4719 "Sort articles by root author."
4721 (let ((extract (funcall
4722 gnus-extract-address-components
4723 (mail-header-from h1))))
4724 (or (car extract) (cadr extract) ""))
4725 (let ((extract (funcall
4726 gnus-extract-address-components
4727 (mail-header-from h2))))
4728 (or (car extract) (cadr extract) ""))))
4730 (defun gnus-thread-sort-by-author (h1 h2)
4731 "Sort threads by root author."
4732 (gnus-article-sort-by-author
4733 (gnus-thread-header h1) (gnus-thread-header h2)))
4735 (defsubst gnus-article-sort-by-recipient (h1 h2)
4736 "Sort articles by recipient."
4738 (let ((extract (funcall
4739 gnus-extract-address-components
4740 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4741 (or (car extract) (cadr extract)))
4742 (let ((extract (funcall
4743 gnus-extract-address-components
4744 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4745 (or (car extract) (cadr extract)))))
4747 (defun gnus-thread-sort-by-recipient (h1 h2)
4748 "Sort threads by root recipient."
4749 (gnus-article-sort-by-recipient
4750 (gnus-thread-header h1) (gnus-thread-header h2)))
4752 (defsubst gnus-article-sort-by-subject (h1 h2)
4753 "Sort articles by root subject."
4755 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4756 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4758 (defun gnus-thread-sort-by-subject (h1 h2)
4759 "Sort threads by root subject."
4760 (gnus-article-sort-by-subject
4761 (gnus-thread-header h1) (gnus-thread-header h2)))
4763 (defsubst gnus-article-sort-by-date (h1 h2)
4764 "Sort articles by root article date."
4766 (gnus-date-get-time (mail-header-date h1))
4767 (gnus-date-get-time (mail-header-date h2))))
4769 (defun gnus-thread-sort-by-date (h1 h2)
4770 "Sort threads by root article date."
4771 (gnus-article-sort-by-date
4772 (gnus-thread-header h1) (gnus-thread-header h2)))
4774 (defsubst gnus-article-sort-by-score (h1 h2)
4775 "Sort articles by root article score.
4776 Unscored articles will be counted as having a score of zero."
4777 (> (or (cdr (assq (mail-header-number h1)
4778 gnus-newsgroup-scored))
4779 gnus-summary-default-score 0)
4780 (or (cdr (assq (mail-header-number h2)
4781 gnus-newsgroup-scored))
4782 gnus-summary-default-score 0)))
4784 (defun gnus-thread-sort-by-score (h1 h2)
4785 "Sort threads by root article score."
4786 (gnus-article-sort-by-score
4787 (gnus-thread-header h1) (gnus-thread-header h2)))
4789 (defun gnus-thread-sort-by-total-score (h1 h2)
4790 "Sort threads by the sum of all scores in the thread.
4791 Unscored articles will be counted as having a score of zero."
4792 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4794 (defun gnus-thread-total-score (thread)
4795 ;; This function find the total score of THREAD.
4800 (if (stringp (car thread))
4801 (apply gnus-thread-score-function 0
4802 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4803 (gnus-thread-total-score-1 thread)))
4805 (gnus-thread-total-score-1 (list thread)))))
4807 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4808 "Sort threads such that the thread with the most recently arrived article comes first."
4809 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4811 (defun gnus-thread-highest-number (thread)
4812 "Return the highest article number in THREAD."
4813 (apply 'max (mapcar (lambda (header)
4814 (mail-header-number header))
4815 (message-flatten-list thread))))
4817 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4818 "Sort threads such that the thread with the most recently dated article comes first."
4819 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4821 (defun gnus-thread-latest-date (thread)
4822 "Return the highest article date in THREAD."
4823 (let ((previous-time 0))
4829 (time-to-seconds (mail-header-parse-date
4830 (mail-header-date header)))
4831 (error previous-time))))
4833 (message-flatten-list thread)
4835 (< (mail-header-number h1)
4836 (mail-header-number h2))))))))
4838 (defun gnus-thread-total-score-1 (root)
4839 ;; This function find the total score of the thread below ROOT.
4840 (setq root (car root))
4841 (apply gnus-thread-score-function
4843 (mapcar 'gnus-thread-total-score
4844 (cdr (gnus-id-to-thread (mail-header-id root))))
4845 (when (> (mail-header-number root) 0)
4846 (list (or (cdr (assq (mail-header-number root)
4847 gnus-newsgroup-scored))
4848 gnus-summary-default-score 0))))
4849 (list gnus-summary-default-score)
4852 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4853 (defvar gnus-tmp-prev-subject nil)
4854 (defvar gnus-tmp-false-parent nil)
4855 (defvar gnus-tmp-root-expunged nil)
4856 (defvar gnus-tmp-dummy-line nil)
4858 (eval-when-compile (defvar gnus-tmp-header))
4859 (defun gnus-extra-header (type &optional header)
4860 "Return the extra header of TYPE."
4861 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4864 (defvar gnus-tmp-thread-tree-header-string "")
4866 (defcustom gnus-sum-thread-tree-root "> "
4867 "With %B spec, used for the root of a thread.
4868 If nil, use subject instead."
4870 :type '(radio (const :format "%v " nil) string)
4871 :group 'gnus-thread)
4873 (defcustom gnus-sum-thread-tree-false-root "> "
4874 "With %B spec, used for a false root of a thread.
4875 If nil, use subject instead."
4877 :type '(radio (const :format "%v " nil) string)
4878 :group 'gnus-thread)
4880 (defcustom gnus-sum-thread-tree-single-indent ""
4881 "With %B spec, used for a thread with just one message.
4882 If nil, use subject instead."
4884 :type '(radio (const :format "%v " nil) string)
4885 :group 'gnus-thread)
4887 (defcustom gnus-sum-thread-tree-vertical "| "
4888 "With %B spec, used for drawing a vertical line."
4891 :group 'gnus-thread)
4893 (defcustom gnus-sum-thread-tree-indent " "
4894 "With %B spec, used for indenting."
4897 :group 'gnus-thread)
4899 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4900 "With %B spec, used for a leaf with brothers."
4903 :group 'gnus-thread)
4905 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4906 "With %B spec, used for a leaf without brothers."
4909 :group 'gnus-thread)
4911 (defun gnus-summary-prepare-threads (threads)
4912 "Prepare summary buffer from THREADS and indentation LEVEL.
4913 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
4914 or a straight list of headers."
4915 (gnus-message 7 "Generating summary...")
4917 (setq gnus-newsgroup-threads threads)
4920 (let ((gnus-tmp-level 0)
4921 (default-score (or gnus-summary-default-score 0))
4922 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
4923 (building-line-count gnus-summary-display-while-building)
4924 (building-count (integerp gnus-summary-display-while-building))
4925 thread number subject stack state gnus-tmp-gathered beg-match
4926 new-roots gnus-tmp-new-adopts thread-end simp-subject
4927 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
4928 gnus-tmp-replied gnus-tmp-subject-or-nil
4929 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
4930 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
4931 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
4934 (setq gnus-tmp-prev-subject nil
4935 gnus-tmp-thread-tree-header-string "")
4937 (if (vectorp (car threads))
4938 ;; If this is a straight (sic) list of headers, then a
4939 ;; threaded summary display isn't required, so we just create
4940 ;; an unthreaded one.
4941 (gnus-summary-prepare-unthreaded threads)
4943 ;; Do the threaded display.
4945 (if gnus-summary-display-while-building
4946 (switch-to-buffer (buffer-name)))
4947 (while (or threads stack gnus-tmp-new-adopts new-roots)
4949 (if (and (= gnus-tmp-level 0)
4952 (not gnus-tmp-false-parent)
4953 (or gnus-tmp-new-adopts new-roots))
4954 (if gnus-tmp-new-adopts
4955 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
4956 thread (list (car gnus-tmp-new-adopts))
4957 gnus-tmp-header (caar thread)
4958 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
4960 (setq thread (list (car new-roots))
4961 gnus-tmp-header (caar thread)
4962 new-roots (cdr new-roots))))
4965 ;; If there are some threads, we do them before the
4966 ;; threads on the stack.
4967 (setq thread threads
4968 gnus-tmp-header (caar thread))
4969 ;; There were no current threads, so we pop something off
4971 (setq state (car stack)
4972 gnus-tmp-level (car state)
4973 tree-stack (cadr state)
4974 thread (caddr state)
4976 gnus-tmp-header (caar thread))))
4978 (setq gnus-tmp-false-parent nil)
4979 (setq gnus-tmp-root-expunged nil)
4980 (setq thread-end nil)
4982 (if (stringp gnus-tmp-header)
4983 ;; The header is a dummy root.
4985 ((eq gnus-summary-make-false-root 'adopt)
4986 ;; We let the first article adopt the rest.
4987 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
4989 (setq gnus-tmp-gathered
4991 (lambda (h) (mail-header-number (car h)))
4994 (setq thread (cons (list (caar thread)
4997 (setq gnus-tmp-level -1
4998 gnus-tmp-false-parent t))
4999 ((eq gnus-summary-make-false-root 'empty)
5000 ;; We print adopted articles with empty subject fields.
5001 (setq gnus-tmp-gathered
5003 (lambda (h) (mail-header-number (car h)))
5006 (setq gnus-tmp-level -1))
5007 ((eq gnus-summary-make-false-root 'dummy)
5008 ;; We remember that we probably want to output a dummy
5010 (setq gnus-tmp-dummy-line gnus-tmp-header)
5011 (setq gnus-tmp-prev-subject gnus-tmp-header))
5013 ;; We do not make a root for the gathered
5014 ;; sub-threads at all.
5015 (setq gnus-tmp-level -1)))
5017 (setq number (mail-header-number gnus-tmp-header)
5018 subject (mail-header-subject gnus-tmp-header)
5019 simp-subject (gnus-simplify-subject-fully subject))
5022 ;; If the thread has changed subject, we might want to make
5023 ;; this subthread into a root.
5024 ((and (null gnus-thread-ignore-subject)
5025 (not (zerop gnus-tmp-level))
5026 gnus-tmp-prev-subject
5027 (not (string= gnus-tmp-prev-subject simp-subject)))
5028 (setq new-roots (nconc new-roots (list (car thread)))
5030 gnus-tmp-header nil))
5031 ;; If the article lies outside the current limit,
5032 ;; then we do not display it.
5033 ((not (memq number gnus-newsgroup-limit))
5034 (setq gnus-tmp-gathered
5036 (lambda (h) (mail-header-number (car h)))
5039 (setq gnus-tmp-new-adopts (if (cdar thread)
5040 (append gnus-tmp-new-adopts
5042 gnus-tmp-new-adopts)
5044 gnus-tmp-header nil)
5045 (when (zerop gnus-tmp-level)
5046 (setq gnus-tmp-root-expunged t)))
5047 ;; Perhaps this article is to be marked as read?
5048 ((and gnus-summary-mark-below
5049 (< (or (cdr (assq number gnus-newsgroup-scored))
5051 gnus-summary-mark-below)
5052 ;; Don't touch sparse articles.
5053 (not (gnus-summary-article-sparse-p number))
5054 (not (gnus-summary-article-ancient-p number)))
5055 (setq gnus-newsgroup-unreads
5056 (delq number gnus-newsgroup-unreads))
5057 (if gnus-newsgroup-auto-expire
5058 (setq gnus-newsgroup-expirable
5059 (gnus-add-to-sorted-list
5060 gnus-newsgroup-expirable number))
5061 (push (cons number gnus-low-score-mark)
5062 gnus-newsgroup-reads))))
5064 (when gnus-tmp-header
5065 ;; We may have an old dummy line to output before this
5067 (when (and gnus-tmp-dummy-line
5070 (mail-header-subject gnus-tmp-header)))
5071 (gnus-summary-insert-dummy-line
5072 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5073 (setq gnus-tmp-dummy-line nil))
5075 ;; Compute the mark.
5076 (setq gnus-tmp-unread (gnus-article-mark number))
5078 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5079 gnus-tmp-header gnus-tmp-level)
5080 gnus-newsgroup-data)
5082 ;; Actually insert the line.
5084 gnus-tmp-subject-or-nil
5086 ((and gnus-thread-ignore-subject
5087 gnus-tmp-prev-subject
5088 (not (string= gnus-tmp-prev-subject simp-subject)))
5090 ((zerop gnus-tmp-level)
5091 (if (and (eq gnus-summary-make-false-root 'empty)
5092 (memq number gnus-tmp-gathered)
5093 gnus-tmp-prev-subject
5094 (string= gnus-tmp-prev-subject simp-subject))
5095 gnus-summary-same-subject
5097 (t gnus-summary-same-subject)))
5098 (if (and (eq gnus-summary-make-false-root 'adopt)
5099 (= gnus-tmp-level 1)
5100 (memq number gnus-tmp-gathered))
5101 (setq gnus-tmp-opening-bracket ?\<
5102 gnus-tmp-closing-bracket ?\>)
5103 (setq gnus-tmp-opening-bracket ?\[
5104 gnus-tmp-closing-bracket ?\]))
5106 gnus-tmp-indentation
5107 (aref gnus-thread-indent-array gnus-tmp-level)
5108 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5109 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5110 gnus-summary-default-score 0)
5112 (if (or (null gnus-summary-default-score)
5113 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5114 gnus-summary-zcore-fuzz))
5116 (if (< gnus-tmp-score gnus-summary-default-score)
5117 gnus-score-below-mark gnus-score-over-mark))
5119 (cond ((memq number gnus-newsgroup-processable)
5121 ((memq number gnus-newsgroup-cached)
5123 ((memq number gnus-newsgroup-replied)
5125 ((memq number gnus-newsgroup-forwarded)
5126 gnus-forwarded-mark)
5127 ((memq number gnus-newsgroup-saved)
5129 ((memq number gnus-newsgroup-recent)
5131 ((memq number gnus-newsgroup-unseen)
5135 (cond ((memq number gnus-newsgroup-undownloaded)
5136 gnus-undownloaded-mark)
5137 (gnus-newsgroup-agentized
5138 gnus-downloaded-mark)
5141 gnus-tmp-from (mail-header-from gnus-tmp-header)
5144 ((string-match "<[^>]+> *$" gnus-tmp-from)
5145 (setq beg-match (match-beginning 0))
5146 (or (and (string-match "^\".+\"" gnus-tmp-from)
5147 (substring gnus-tmp-from 1 (1- (match-end 0))))
5148 (substring gnus-tmp-from 0 beg-match)))
5149 ((string-match "(.+)" gnus-tmp-from)
5150 (substring gnus-tmp-from
5151 (1+ (match-beginning 0)) (1- (match-end 0))))
5155 gnus-tmp-thread-tree-header-string
5157 ((not gnus-show-threads) "")
5158 ((zerop gnus-tmp-level)
5159 (cond ((cdar thread)
5160 (or gnus-sum-thread-tree-root subject))
5161 (gnus-tmp-new-adopts
5162 (or gnus-sum-thread-tree-false-root subject))
5164 (or gnus-sum-thread-tree-single-indent subject))))
5166 (concat (apply 'concat
5167 (mapcar (lambda (item)
5169 gnus-sum-thread-tree-vertical
5170 gnus-sum-thread-tree-indent))
5171 (cdr (reverse tree-stack))))
5173 gnus-sum-thread-tree-leaf-with-other
5174 gnus-sum-thread-tree-single-leaf)))))
5175 (when (string= gnus-tmp-name "")
5176 (setq gnus-tmp-name gnus-tmp-from))
5177 (unless (numberp gnus-tmp-lines)
5178 (setq gnus-tmp-lines -1))
5179 (if (= gnus-tmp-lines -1)
5180 (setq gnus-tmp-lines "?")
5181 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5182 (gnus-put-text-property
5184 (progn (eval gnus-summary-line-format-spec) (point))
5185 'gnus-number number)
5188 (gnus-run-hooks 'gnus-summary-update-hook)
5191 (setq gnus-tmp-prev-subject simp-subject)))
5193 (when (nth 1 thread)
5194 (push (list (max 0 gnus-tmp-level)
5195 (copy-sequence tree-stack)
5198 (push (if (nth 1 thread) 1 0) tree-stack)
5199 (incf gnus-tmp-level)
5200 (setq threads (if thread-end nil (cdar thread)))
5201 (if gnus-summary-display-while-building
5204 ;; use a set frequency
5205 (setq building-line-count (1- building-line-count))
5206 (when (= building-line-count 0)
5208 (setq building-line-count
5209 gnus-summary-display-while-building)))
5213 (setq gnus-tmp-level 0)))))
5214 (gnus-message 7 "Generating summary...done"))
5216 (defun gnus-summary-prepare-unthreaded (headers)
5217 "Generate an unthreaded summary buffer based on HEADERS."
5218 (let (header number mark)
5223 ;; We may have to root out some bad articles...
5224 (when (memq (setq number (mail-header-number
5225 (setq header (pop headers))))
5226 gnus-newsgroup-limit)
5227 ;; Mark article as read when it has a low score.
5228 (when (and gnus-summary-mark-below
5229 (< (or (cdr (assq number gnus-newsgroup-scored))
5230 gnus-summary-default-score 0)
5231 gnus-summary-mark-below)
5232 (not (gnus-summary-article-ancient-p number)))
5233 (setq gnus-newsgroup-unreads
5234 (delq number gnus-newsgroup-unreads))
5235 (if gnus-newsgroup-auto-expire
5236 (push number gnus-newsgroup-expirable)
5237 (push (cons number gnus-low-score-mark)
5238 gnus-newsgroup-reads)))
5240 (setq mark (gnus-article-mark number))
5241 (push (gnus-data-make number mark (1+ (point)) header 0)
5242 gnus-newsgroup-data)
5243 (gnus-summary-insert-line
5245 (memq number gnus-newsgroup-undownloaded)
5246 mark (memq number gnus-newsgroup-replied)
5247 (memq number gnus-newsgroup-expirable)
5248 (mail-header-subject header) nil
5249 (cdr (assq number gnus-newsgroup-scored))
5250 (memq number gnus-newsgroup-processable))))))
5252 (defun gnus-summary-remove-list-identifiers ()
5253 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5254 (let ((regexp (if (consp gnus-list-identifiers)
5255 (mapconcat 'identity gnus-list-identifiers " *\\|")
5256 gnus-list-identifiers))
5259 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5260 (dolist (header gnus-newsgroup-headers)
5261 (setq subject (mail-header-subject header)
5263 (while (string-match regexp subject)
5265 (concat (substring subject 0 (match-beginning 1))
5266 (substring subject (match-end 0)))
5269 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5271 (concat (substring subject 0 (match-beginning 1))
5272 (substring subject (match-end 1)))))
5273 (mail-header-set-subject header subject))))))
5275 (defun gnus-fetch-headers (articles)
5276 "Fetch headers of ARTICLES."
5277 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5278 (gnus-message 5 "Fetching headers for %s..." name)
5281 (setq gnus-headers-retrieved-by
5282 (gnus-retrieve-headers
5283 articles gnus-newsgroup-name
5284 ;; We might want to fetch old headers, but
5285 ;; not if there is only 1 article.
5287 (not (eq gnus-fetch-old-headers 'some))
5288 (not (numberp gnus-fetch-old-headers)))
5289 (> (length articles) 1))
5290 gnus-fetch-old-headers))))
5291 (gnus-get-newsgroup-headers-xover
5292 articles nil nil gnus-newsgroup-name t)
5293 (gnus-get-newsgroup-headers))
5294 (gnus-message 5 "Fetching headers for %s...done" name))))
5296 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5297 "Select newsgroup GROUP.
5298 If READ-ALL is non-nil, all articles in the group are selected.
5299 If SELECT-ARTICLES, only select those articles from GROUP."
5300 (let* ((entry (gnus-group-entry group))
5301 ;;!!! Dirty hack; should be removed.
5302 (gnus-summary-ignore-duplicates
5303 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5305 gnus-summary-ignore-duplicates))
5306 (info (nth 2 entry))
5307 articles fetched-articles cached)
5309 (unless (gnus-check-server
5310 (set (make-local-variable 'gnus-current-select-method)
5311 (gnus-find-method-for-group group)))
5312 (error "Couldn't open server"))
5314 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5315 (gnus-activate-group group) ; Or we can activate it...
5316 (progn ; Or we bug out.
5317 (when (equal major-mode 'gnus-summary-mode)
5318 (gnus-kill-buffer (current-buffer)))
5319 (error "Couldn't activate group %s: %s"
5320 group (gnus-status-message group))))
5322 (unless (gnus-request-group group t)
5323 (when (equal major-mode 'gnus-summary-mode)
5324 (gnus-kill-buffer (current-buffer)))
5325 (error "Couldn't request group %s: %s"
5326 group (gnus-status-message group)))
5329 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5331 (setq gnus-summary-use-undownloaded-faces
5332 (gnus-agent-find-parameter
5334 'agent-enable-undownloaded-faces)))
5336 (setq gnus-newsgroup-name group
5337 gnus-newsgroup-unselected nil
5338 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5340 (let ((display (gnus-group-find-parameter group 'display)))
5341 (setq gnus-newsgroup-display
5343 ((not (zerop (or (car-safe read-all) 0)))
5344 ;; The user entered the group with C-u SPC/RET, let's show
5350 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5352 ;; The following is probably the "correct" solution, but
5353 ;; it makes Gnus fetch all headers and then limit the
5354 ;; articles (which is slow), so instead we hack the
5355 ;; select-articles parameter instead. -- Simon Josefsson
5358 ;; (gnus-byte-compile
5359 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5361 (setq select-articles
5362 (gnus-uncompress-range
5363 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5367 (cdr (gnus-active group)))))
5372 (gnus-summary-setup-default-charset)
5374 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5375 (when (gnus-virtual-group-p group)
5376 (setq cached gnus-newsgroup-cached))
5378 (setq gnus-newsgroup-unreads
5379 (gnus-sorted-ndifference
5380 (gnus-sorted-ndifference gnus-newsgroup-unreads
5381 gnus-newsgroup-marked)
5382 gnus-newsgroup-dormant))
5384 (setq gnus-newsgroup-processable nil)
5386 (gnus-update-read-articles group gnus-newsgroup-unreads)
5388 ;; Adjust and set lists of article marks.
5390 (gnus-adjust-marked-articles info))
5391 (if (setq articles select-articles)
5392 (setq gnus-newsgroup-unselected
5393 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5394 (setq articles (gnus-articles-to-read group read-all)))
5398 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5400 ((eq articles 0) nil)
5402 ;; Init the dependencies hash table.
5403 (setq gnus-newsgroup-dependencies
5404 (gnus-make-hashtable (length articles)))
5405 (gnus-set-global-variables)
5406 ;; Retrieve the headers and read them in.
5408 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5410 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5412 (setq gnus-newsgroup-cached cached))
5414 ;; Suppress duplicates?
5415 (when gnus-suppress-duplicates
5416 (gnus-dup-suppress-articles))
5418 ;; Set the initial limit.
5419 (setq gnus-newsgroup-limit (copy-sequence articles))
5420 ;; Remove canceled articles from the list of unread articles.
5421 (setq fetched-articles
5422 (mapcar (lambda (headers) (mail-header-number headers))
5423 gnus-newsgroup-headers))
5424 (setq gnus-newsgroup-articles fetched-articles)
5425 (setq gnus-newsgroup-unreads
5426 (gnus-sorted-nintersection
5427 gnus-newsgroup-unreads fetched-articles))
5428 (gnus-compute-unseen-list)
5430 ;; Removed marked articles that do not exist.
5431 (gnus-update-missing-marks
5432 (gnus-sorted-difference articles fetched-articles))
5433 ;; We might want to build some more threads first.
5434 (when (and gnus-fetch-old-headers
5435 (eq gnus-headers-retrieved-by 'nov))
5436 (if (eq gnus-fetch-old-headers 'invisible)
5437 (gnus-build-all-threads)
5438 (gnus-build-old-threads)))
5439 ;; Let the Gnus agent mark articles as read.
5441 (gnus-agent-get-undownloaded-list))
5442 ;; Remove list identifiers from subject
5443 (when gnus-list-identifiers
5444 (gnus-summary-remove-list-identifiers))
5445 ;; Check whether auto-expire is to be done in this group.
5446 (setq gnus-newsgroup-auto-expire
5447 (gnus-group-auto-expirable-p group))
5448 ;; Set up the article buffer now, if necessary.
5449 (unless gnus-single-article-buffer
5450 (gnus-article-setup-buffer))
5451 ;; First and last article in this newsgroup.
5452 (when gnus-newsgroup-headers
5453 (setq gnus-newsgroup-begin
5454 (mail-header-number (car gnus-newsgroup-headers))
5457 (gnus-last-element gnus-newsgroup-headers))))
5458 ;; GROUP is successfully selected.
5459 (or gnus-newsgroup-headers t)))))
5461 (defun gnus-compute-unseen-list ()
5462 ;; The `seen' marks are treated specially.
5463 (if (not gnus-newsgroup-seen)
5464 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5465 (setq gnus-newsgroup-unseen
5466 (gnus-inverse-list-range-intersection
5467 gnus-newsgroup-articles gnus-newsgroup-seen))))
5469 (defun gnus-summary-display-make-predicate (display)
5470 (require 'gnus-agent)
5471 (when (= (length display) 1)
5472 (setq display (car display)))
5473 (unless gnus-summary-display-cache
5474 (dolist (elem (append '((unread . unread)
5477 gnus-article-mark-lists))
5478 (push (cons (cdr elem)
5480 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5481 gnus-summary-display-cache)))
5482 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5483 (gnus-category-predicate-cache gnus-summary-display-cache))
5484 (gnus-get-predicate display)))
5486 ;; Uses the dynamically bound `number' variable.
5489 (defun gnus-article-marked-p (type &optional article)
5490 (let ((article (or article number)))
5493 (memq article gnus-newsgroup-marked))
5495 (memq article gnus-newsgroup-spam-marked))
5497 (memq article gnus-newsgroup-unsendable))
5498 ((eq type 'undownload)
5499 (memq article gnus-newsgroup-undownloaded))
5500 ((eq type 'download)
5501 (memq article gnus-newsgroup-downloadable))
5503 (memq article gnus-newsgroup-unreads))
5505 (memq article gnus-newsgroup-reads))
5507 (memq article gnus-newsgroup-dormant) )
5509 (memq article gnus-newsgroup-expirable))
5511 (memq article gnus-newsgroup-replied))
5513 (memq article gnus-newsgroup-killed))
5514 ((eq type 'bookmark)
5515 (assq article gnus-newsgroup-bookmarks))
5517 (assq article gnus-newsgroup-scored))
5519 (memq article gnus-newsgroup-saved))
5521 (memq article gnus-newsgroup-cached))
5523 (memq article gnus-newsgroup-forwarded))
5525 (not (memq article gnus-newsgroup-unseen)))
5527 (memq article gnus-newsgroup-recent))
5530 (defun gnus-articles-to-read (group &optional read-all)
5531 "Find out what articles the user wants to read."
5533 ;; Select all articles if `read-all' is non-nil, or if there
5534 ;; are no unread articles.
5536 (and (zerop (length gnus-newsgroup-marked))
5537 (zerop (length gnus-newsgroup-unreads)))
5538 ;; Fetch all if the predicate is non-nil.
5539 gnus-newsgroup-display)
5540 ;; We want to select the headers for all the articles in
5541 ;; the group, so we select either all the active
5542 ;; articles in the group, or (if that's nil), the
5543 ;; articles in the cache.
5545 (gnus-uncompress-range (gnus-active group))
5546 (gnus-cache-articles-in-group group))
5547 ;; Select only the "normal" subset of articles.
5549 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5550 gnus-newsgroup-unreads)))
5551 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5552 (scored (length scored-list))
5553 (number (length articles))
5554 (marked (+ (length gnus-newsgroup-marked)
5555 (length gnus-newsgroup-dormant)))
5560 ((numberp gnus-newsgroup-display)
5561 gnus-newsgroup-display)
5565 ((and (or (<= scored marked) (= scored number))
5566 (numberp gnus-large-newsgroup)
5567 (> number gnus-large-newsgroup))
5568 (let* ((cursor-in-echo-area nil)
5569 (initial (gnus-parameter-large-newsgroup-initial
5570 gnus-newsgroup-name))
5574 "How many articles from %s (%s %d): "
5576 (gnus-group-decoded-name gnus-newsgroup-name)
5578 (if initial "max" "default")
5581 (cons (number-to-string initial)
5583 (if (string-match "^[ \t]*$" input) number input)))
5584 ((and (> scored marked) (< scored number)
5585 (> (- scored number) 20))
5588 (format "%s %s (%d scored, %d total): "
5589 "How many articles from"
5590 (gnus-group-decoded-name group)
5592 (if (string-match "^[ \t]*$" input)
5596 (message "Quit getting the articles to read")
5598 (setq select (if (stringp select) (string-to-number select) select))
5599 (if (or (null select) (zerop select))
5601 (if (and (not (zerop scored)) (<= (abs select) scored))
5603 (setq articles (sort scored-list '<))
5604 (setq number (length articles)))
5605 (setq articles (copy-sequence articles)))
5607 (when (< (abs select) number)
5609 ;; Select the N oldest articles.
5610 (setcdr (nthcdr (1- (abs select)) articles) nil)
5611 ;; Select the N most recent articles.
5612 (setq articles (nthcdr (- number select) articles))))
5613 (setq gnus-newsgroup-unselected
5614 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5615 (when gnus-alter-articles-to-read-function
5618 (funcall gnus-alter-articles-to-read-function
5619 gnus-newsgroup-name articles)
5623 (defun gnus-killed-articles (killed articles)
5626 (when (inline (gnus-member-of-range (car articles) killed))
5627 (push (car articles) out))
5628 (setq articles (cdr articles)))
5631 (defun gnus-uncompress-marks (marks)
5632 "Uncompress the mark ranges in MARKS."
5633 (let ((uncompressed '(score bookmark))
5636 (if (memq (caar marks) uncompressed)
5637 (push (car marks) out)
5638 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5639 (setq marks (cdr marks)))
5642 (defun gnus-article-mark-to-type (mark)
5643 "Return the type of MARK."
5644 (or (cadr (assq mark gnus-article-special-mark-lists))
5647 (defun gnus-article-unpropagatable-p (mark)
5648 "Return whether MARK should be propagated to back end."
5649 (memq mark gnus-article-unpropagated-mark-lists))
5651 (defun gnus-adjust-marked-articles (info)
5652 "Set all article lists and remove all marks that are no longer valid."
5653 (let* ((marked-lists (gnus-info-marks info))
5654 (active (gnus-active (gnus-info-group info)))
5657 (types gnus-article-mark-lists)
5658 marks var articles article mark mark-type
5661 (dolist (marks marked-lists)
5662 (setq mark (car marks)
5663 mark-type (gnus-article-mark-to-type mark)
5664 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5666 ;; We set the variable according to the type of the marks list,
5667 ;; and then adjust the marks to a subset of the active articles.
5669 ;; Adjust "simple" lists - compressed yet unsorted
5670 ((eq mark-type 'list)
5671 ;; Simultaneously uncompress and clip to active range
5672 ;; See gnus-uncompress-range for a description of possible marks
5674 (if (not (cadr marks))
5676 (setq articles (if (numberp (cddr marks))
5682 (while (setq article (pop articles))
5683 (cond ((consp article)
5684 (setq bgn (max (car article) min)
5685 end (min (cdr article) max))
5687 (setq l (setcdr l (cons bgn nil))
5689 ((and (<= min article)
5691 (setq l (setcdr l (cons article nil))))))
5692 (set var (cdr lh)))))
5694 ((eq mark-type 'tuple)
5695 (set var (setq articles (cdr marks)))
5696 (when (not (listp (cdr (symbol-value var))))
5697 (set var (list (symbol-value var))))
5698 (when (not (listp (cdr articles)))
5699 (setq articles (list articles)))
5701 (when (or (not (consp (setq article (pop articles))))
5702 (< (car article) min)
5703 (> (car article) max))
5704 (set var (delq article (symbol-value var))))))
5705 ;; Adjust ranges (sloppily).
5706 ((eq mark-type 'range)
5709 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5710 ;; It should be (seen (NUM1 . NUM2)).
5711 (when (numberp (cddr marks))
5712 (setcdr marks (list (cdr marks))))
5713 (setq articles (cdr marks))
5714 (while (and articles
5715 (or (and (consp (car articles))
5716 (> min (cdar articles)))
5717 (and (numberp (car articles))
5718 (> min (car articles)))))
5720 (set var articles))))))))
5722 (defun gnus-update-missing-marks (missing)
5723 "Go through the list of MISSING articles and remove them from the mark lists."
5726 ;; Go through all types.
5727 (dolist (elem gnus-article-mark-lists)
5728 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5729 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5730 (when (symbol-value var)
5731 ;; This list has articles. So we delete all missing
5732 ;; articles from it.
5735 (set var (delq (pop m) (symbol-value var))))))))))
5737 (defun gnus-update-marks ()
5738 "Enter the various lists of marked articles into the newsgroup info list."
5739 (let ((types gnus-article-mark-lists)
5740 (info (gnus-get-info gnus-newsgroup-name))
5741 type list newmarked symbol delta-marks)
5743 ;; Add all marks lists to the list of marks lists.
5744 (while (setq type (pop types))
5745 (setq list (symbol-value
5747 (intern (format "gnus-newsgroup-%s" (car type))))))
5750 ;; Get rid of the entries of the articles that have the
5752 (when (and (eq (cdr type) 'score)
5756 (prev (cons nil list))
5759 (if (or (not (consp (car arts)))
5760 (= (cdar arts) gnus-summary-default-score))
5761 (setcdr prev (cdr arts))
5763 (setq arts (cdr arts)))
5764 (setq list (cdr all)))))
5766 (when (eq (cdr type) 'seen)
5767 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5769 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5770 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5772 (when (and (gnus-check-backend-function
5773 'request-set-mark gnus-newsgroup-name)
5774 (not (gnus-article-unpropagatable-p (cdr type))))
5775 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5776 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5777 (add (gnus-remove-from-range
5778 (gnus-copy-sequence list) old)))
5780 (push (list add 'add (list (cdr type))) delta-marks))
5782 (push (list del 'del (list (cdr type))) delta-marks))))
5785 (push (cons (cdr type) list) newmarked)))
5788 (unless (gnus-check-group gnus-newsgroup-name)
5789 (error "Can't open server for %s" gnus-newsgroup-name))
5790 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5792 ;; Enter these new marks into the info of the group.
5794 (setcar (nthcdr 3 info) newmarked)
5795 ;; Add the marks lists to the end of the info.
5797 (setcdr (nthcdr 2 info) (list newmarked))))
5799 ;; Cut off the end of the info if there's nothing else there.
5803 (when (nthcdr (decf i) info)
5804 (setcdr (nthcdr i info) nil)))))))
5806 (defun gnus-set-mode-line (where)
5807 "Set the mode line of the article or summary buffers.
5808 If WHERE is `summary', the summary mode line format will be used."
5809 ;; Is this mode line one we keep updated?
5810 (when (and (memq where gnus-updated-mode-lines)
5812 (intern (format "gnus-%s-mode-line-format-spec" where))))
5815 ;; We evaluate this in the summary buffer since these
5816 ;; variables are buffer-local to that buffer.
5817 (set-buffer gnus-summary-buffer)
5818 ;; We bind all these variables that are used in the `eval' form
5820 (let* ((mformat (symbol-value
5822 (format "gnus-%s-mode-line-format-spec" where))))
5823 (gnus-tmp-group-name (gnus-group-decoded-name
5824 gnus-newsgroup-name))
5825 (gnus-tmp-article-number (or gnus-current-article 0))
5826 (gnus-tmp-unread gnus-newsgroup-unreads)
5827 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5828 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5829 (gnus-tmp-unread-and-unselected
5830 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5831 (zerop gnus-tmp-unselected))
5833 ((zerop gnus-tmp-unselected)
5834 (format "{%d more}" gnus-tmp-unread-and-unticked))
5835 (t (format "{%d(+%d) more}"
5836 gnus-tmp-unread-and-unticked
5837 gnus-tmp-unselected))))
5839 (if (and gnus-current-headers
5840 (vectorp gnus-current-headers))
5841 (gnus-mode-string-quote
5842 (mail-header-subject gnus-current-headers))
5844 bufname-length max-len
5845 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5846 (setq mode-string (eval mformat))
5847 (setq bufname-length (if (string-match "%b" mode-string)
5850 (if (eq where 'summary)
5852 (get-buffer gnus-article-buffer))))
5855 (setq max-len (max 4 (if gnus-mode-non-string-length
5857 gnus-mode-non-string-length
5859 (length mode-string))))
5860 ;; We might have to chop a bit of the string off...
5861 (when (> (length mode-string) max-len)
5863 (concat (truncate-string-to-width mode-string (- max-len 3))
5865 ;; Pad the mode string a bit.
5866 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5867 ;; Update the mode line.
5868 (setq mode-line-buffer-identification
5869 (gnus-mode-line-buffer-identification (list mode-string)))
5870 (set-buffer-modified-p t))))
5872 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5873 "Go through the HEADERS list and add all Xrefs to a hash table.
5874 The resulting hash table is returned, or nil if no Xrefs were found."
5875 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5876 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5877 (xref-hashtb (gnus-make-hashtable))
5878 start group entry number xrefs header)
5880 (setq header (pop headers))
5881 (when (and (setq xrefs (mail-header-xref header))
5882 (not (memq (setq number (mail-header-number header))
5885 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5886 (setq start (match-end 0))
5887 (setq group (if prefix
5888 (concat prefix (substring xrefs (match-beginning 1)
5890 (substring xrefs (match-beginning 1) (match-end 1))))
5892 (string-to-number (substring xrefs (match-beginning 2)
5894 (if (setq entry (gnus-gethash group xref-hashtb))
5895 (setcdr entry (cons number (cdr entry)))
5896 (gnus-sethash group (cons number nil) xref-hashtb)))))
5897 (and start xref-hashtb)))
5899 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5900 "Look through all the headers and mark the Xrefs as read."
5901 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5902 name info xref-hashtb idlist method nth4)
5904 (set-buffer gnus-group-buffer)
5905 (when (setq xref-hashtb
5906 (gnus-create-xref-hashtb from-newsgroup headers unreads))
5909 (unless (string= from-newsgroup (setq name (symbol-name group)))
5910 (setq idlist (symbol-value group))
5911 ;; Dead groups are not updated.
5913 (setq info (gnus-get-info name))
5914 (when (stringp (setq nth4 (gnus-info-method info)))
5915 (setq nth4 (gnus-server-to-method nth4))))
5916 ;; Only do the xrefs if the group has the same
5917 ;; select method as the group we have just read.
5918 (or (gnus-methods-equal-p
5919 nth4 (gnus-find-method-for-group from-newsgroup))
5921 (equal nth4 (setq method (gnus-find-method-for-group
5923 (and (equal (car nth4) (car method))
5924 (equal (nth 1 nth4) (nth 1 method))))
5925 gnus-use-cross-reference
5926 (or (not (eq gnus-use-cross-reference t))
5928 ;; Only do cross-references on subscribed
5929 ;; groups, if that is what is wanted.
5930 (<= (gnus-info-level info) gnus-level-subscribed))
5931 (gnus-group-make-articles-read name idlist))))
5934 (defun gnus-compute-read-articles (group articles)
5935 (let* ((entry (gnus-group-entry group))
5936 (info (nth 2 entry))
5937 (active (gnus-active group))
5940 ;; First peel off all invalid article numbers.
5942 (let ((ids articles)
5944 (while (setq id (pop ids))
5945 (when (and first (> id (cdr active)))
5946 ;; We'll end up in this situation in one particular
5947 ;; obscure situation. If you re-scan a group and get
5948 ;; a new article that is cross-posted to a different
5949 ;; group that has not been re-scanned, you might get
5950 ;; crossposted article that has a higher number than
5951 ;; Gnus believes possible. So we re-activate this
5952 ;; group as well. This might mean doing the
5953 ;; crossposting thingy will *increase* the number
5954 ;; of articles in some groups. Tsk, tsk.
5955 (setq active (or (gnus-activate-group group) active)))
5956 (when (or (> id (cdr active))
5957 (< id (car active)))
5958 (setq articles (delq id articles))))))
5959 ;; If the read list is nil, we init it.
5961 (null (gnus-info-read info))
5963 (setq ninfo (cons 1 (1- (car active))))
5964 (setq ninfo (gnus-info-read info)))
5965 ;; Then we add the read articles to the range.
5967 ninfo (setq articles (sort articles '<))))))
5969 (defun gnus-group-make-articles-read (group articles)
5970 "Update the info of GROUP to say that ARTICLES are read."
5972 (entry (gnus-group-entry group))
5973 (info (nth 2 entry))
5974 (active (gnus-active group))
5977 (setq range (gnus-compute-read-articles group articles))
5978 (with-current-buffer gnus-group-buffer
5981 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
5982 (gnus-info-set-read ',info ',(gnus-info-read info))
5983 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
5984 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
5985 (gnus-group-update-group ,group t))))
5986 ;; Add the read articles to the range.
5987 (gnus-info-set-read info range)
5988 (gnus-request-set-mark group (list (list range 'add '(read))))
5989 ;; Then we have to re-compute how many unread
5990 ;; articles there are in this group.
5994 (setq num (- (1+ (cdr active)) (car active))))
5995 ((not (listp (cdr range)))
5996 (setq num (- (cdr active) (- (1+ (cdr range))
6000 (if (numberp (car range))
6002 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6003 (setq range (cdr range)))
6004 (setq num (- (cdr active) num))))
6005 ;; Update the number of unread articles.
6007 ;; Update the group buffer.
6008 (unless (gnus-ephemeral-group-p group)
6009 (gnus-group-update-group group t))))))
6011 (defvar gnus-newsgroup-none-id 0)
6013 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6014 (let ((cur nntp-server-buffer)
6017 (with-current-buffer gnus-summary-buffer
6018 gnus-newsgroup-dependencies)))
6019 headers id end ref number
6020 (mail-parse-charset gnus-newsgroup-charset)
6021 (mail-parse-ignored-charsets
6022 (save-excursion (condition-case nil
6023 (set-buffer gnus-summary-buffer)
6025 gnus-newsgroup-ignored-charsets)))
6027 (set-buffer nntp-server-buffer)
6028 ;; Translate all TAB characters into SPACE characters.
6029 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6030 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6031 (ietf-drums-unfold-fws)
6032 (gnus-run-hooks 'gnus-parse-headers-hook)
6033 (let ((case-fold-search t)
6034 in-reply-to header p lines chars)
6035 (goto-char (point-min))
6036 ;; Search to the beginning of the next header. Error messages
6037 ;; do not begin with 2 or 3.
6038 (while (re-search-forward "^[23][0-9]+ " nil t)
6041 ;; This implementation of this function, with nine
6042 ;; search-forwards instead of the one re-search-forward and
6043 ;; a case (which basically was the old function) is actually
6044 ;; about twice as fast, even though it looks messier. You
6045 ;; can't have everything, I guess. Speed and elegance
6046 ;; doesn't always go hand in hand.
6052 (setq number (read cur))
6055 (narrow-to-region (point)
6056 (or (and (search-forward "\n.\n" nil t)
6062 (if (search-forward "\nsubject:" nil t)
6063 (funcall gnus-decode-encoded-word-function
6064 (nnheader-header-value))
6069 (if (search-forward "\nfrom:" nil t)
6070 (funcall gnus-decode-encoded-word-function
6071 (nnheader-header-value))
6076 (if (search-forward "\ndate:" nil t)
6077 (nnheader-header-value) ""))
6081 (setq id (if (re-search-forward
6082 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6083 ;; We do it this way to make sure the Message-ID
6084 ;; is (somewhat) syntactically valid.
6085 (buffer-substring (match-beginning 1)
6087 ;; If there was no message-id, we just fake one
6088 ;; to make subsequent routines simpler.
6089 (nnheader-generate-fake-message-id number))))
6093 (if (search-forward "\nreferences:" nil t)
6097 (nnheader-header-value)
6102 (search-backward ">" end t)
6105 (search-backward "<" end t)
6107 ;; Get the references from the in-reply-to header if there
6108 ;; were no references and the in-reply-to header looks
6110 (if (and (search-forward "\nin-reply-to:" nil t)
6111 (setq in-reply-to (nnheader-header-value))
6112 (string-match "<[^>]+>" in-reply-to))
6114 (setq ref (substring in-reply-to (match-beginning 0)
6116 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6117 (setq ref2 (substring in-reply-to (match-beginning 0)
6119 (when (> (length ref2) (length ref))
6126 (if (search-forward "\nchars: " nil t)
6127 (if (numberp (setq chars (ignore-errors (read cur))))
6133 (if (search-forward "\nlines: " nil t)
6134 (if (numberp (setq lines (ignore-errors (read cur))))
6140 (and (search-forward "\nxref:" nil t)
6141 (nnheader-header-value)))
6143 (when gnus-extra-headers
6144 (let ((extra gnus-extra-headers)
6148 (when (search-forward
6149 (concat "\n" (symbol-name (car extra)) ":") nil t)
6150 (push (cons (car extra) (nnheader-header-value))
6154 (when (equal id ref)
6157 (when gnus-alter-header-function
6158 (funcall gnus-alter-header-function header)
6159 (setq id (mail-header-id header)
6160 ref (gnus-parent-id (mail-header-references header))))
6163 (gnus-dependencies-add-header
6164 header dependencies force-new))
6165 (push header headers))
6166 (goto-char (point-max))
6168 (nreverse headers)))))
6170 ;; Goes through the xover lines and returns a list of vectors
6171 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6172 force-new dependencies
6173 group also-fetch-heads)
6174 "Parse the news overview data in the server buffer.
6175 Return a list of headers that match SEQUENCE (see
6176 `nntp-retrieve-headers')."
6177 ;; Get the Xref when the users reads the articles since most/some
6178 ;; NNTP servers do not include Xrefs when using XOVER.
6179 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6180 (let ((mail-parse-charset gnus-newsgroup-charset)
6181 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6182 (cur nntp-server-buffer)
6183 (dependencies (or dependencies gnus-newsgroup-dependencies))
6185 ((eq gnus-read-all-available-headers t)
6187 ((and (stringp gnus-read-all-available-headers)
6189 (string-match gnus-read-all-available-headers group))
6192 number headers header)
6194 (set-buffer nntp-server-buffer)
6195 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6196 ;; Allow the user to mangle the headers before parsing them.
6197 (gnus-run-hooks 'gnus-parse-headers-hook)
6198 (goto-char (point-min))
6199 (gnus-parse-without-error
6200 (while (and (or sequence allp)
6202 (setq number (read cur))
6204 (while (and sequence
6205 (< (car sequence) number))
6206 (setq sequence (cdr sequence))))
6209 (eq number (car sequence))))
6211 (setq sequence (cdr sequence))
6212 (setq header (inline
6213 (gnus-nov-parse-line
6214 number dependencies force-new)))))
6215 (push header headers))
6217 ;; A common bug in inn is that if you have posted an article and
6218 ;; then retrieves the active file, it will answer correctly --
6219 ;; the new article is included. However, a NOV entry for the
6220 ;; article may not have been generated yet, so this may fail.
6221 ;; We work around this problem by retrieving the last few
6222 ;; headers using HEAD.
6223 (if (or (not also-fetch-heads)
6225 ;; We (probably) got all the headers.
6227 (let ((gnus-nov-is-evil t))
6230 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6231 (gnus-get-newsgroup-headers))))))))
6233 (defun gnus-article-get-xrefs ()
6234 "Fill in the Xref value in `gnus-current-headers', if necessary.
6235 This is meant to be called in `gnus-article-internal-prepare-hook'."
6236 (let ((headers (with-current-buffer gnus-summary-buffer
6237 gnus-current-headers)))
6238 (or (not gnus-use-cross-reference)
6240 (and (mail-header-xref headers)
6241 (not (string= (mail-header-xref headers) "")))
6242 (let ((case-fold-search t)
6245 (nnheader-narrow-to-headers)
6246 (goto-char (point-min))
6247 (when (or (and (not (eobp))
6248 (eq (downcase (char-after)) ?x)
6249 (looking-at "Xref:"))
6250 (search-forward "\nXref:" nil t))
6251 (goto-char (1+ (match-end 0)))
6252 (setq xref (buffer-substring (point) (point-at-eol)))
6253 (mail-header-set-xref headers xref)))))))
6255 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6256 "Find article ID and insert the summary line for that article.
6257 OLD-HEADER can either be a header or a line number to insert
6258 the subject line on."
6259 (let* ((line (and (numberp old-header) old-header))
6260 (old-header (and (vectorp old-header) old-header))
6261 (header (cond ((and old-header use-old-header)
6264 (gnus-number-to-header id))
6265 (gnus-number-to-header id))
6267 (gnus-read-header id))))
6268 (number (and (numberp id) id))
6271 ;; Rebuild the thread that this article is part of and go to the
6272 ;; article we have fetched.
6273 (when (and (not gnus-show-threads)
6276 (setq d (gnus-data-find (mail-header-number old-header))))
6277 (goto-char (gnus-data-pos d))
6283 (gnus-delete-line))))))
6284 ;; Remove list identifiers from subject.
6285 (when gnus-list-identifiers
6286 (let ((gnus-newsgroup-headers (list header)))
6287 (gnus-summary-remove-list-identifiers)))
6289 (mail-header-set-number header (mail-header-number old-header)))
6290 (setq gnus-newsgroup-sparse
6291 (delq (setq number (mail-header-number header))
6292 gnus-newsgroup-sparse))
6293 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6294 (push number gnus-newsgroup-limit)
6295 (gnus-rebuild-thread (mail-header-id header) line)
6296 (gnus-summary-goto-subject number nil t))
6297 (when (and (numberp number)
6299 ;; We have to update the boundaries even if we can't fetch the
6300 ;; article if ID is a number -- so that the next `P' or `N'
6301 ;; command will fetch the previous (or next) article even
6302 ;; if the one we tried to fetch this time has been canceled.
6303 (when (> number gnus-newsgroup-end)
6304 (setq gnus-newsgroup-end number))
6305 (when (< number gnus-newsgroup-begin)
6306 (setq gnus-newsgroup-begin number))
6307 (setq gnus-newsgroup-unselected
6308 (delq number gnus-newsgroup-unselected)))
6309 ;; Report back a success?
6310 (and header (mail-header-number header))))
6312 ;;; Process/prefix in the summary buffer
6314 (defun gnus-summary-work-articles (n)
6315 "Return a list of articles to be worked upon.
6316 The prefix argument, the list of process marked articles, and the
6317 current article will be taken into consideration."
6319 (set-buffer gnus-summary-buffer)
6322 ;; A numerical prefix has been given.
6323 (setq n (prefix-numeric-value n))
6324 (let ((backward (< n 0))
6325 (n (abs (prefix-numeric-value n)))
6330 (push (setq article (gnus-summary-article-number))
6333 (gnus-summary-find-prev nil article)
6334 (gnus-summary-find-next nil article)))
6336 (nreverse articles)))
6337 ((and (gnus-region-active-p) (mark))
6338 (message "region active")
6339 ;; Work on the region between point and mark.
6340 (let ((max (max (point) (mark)))
6343 (goto-char (min (point) (mark)))
6346 (push (setq article (gnus-summary-article-number)) articles)
6347 (gnus-summary-find-next nil article)
6349 (nreverse articles))))
6350 (gnus-newsgroup-processable
6351 ;; There are process-marked articles present.
6352 ;; Save current state.
6353 (gnus-summary-save-process-mark)
6355 (reverse gnus-newsgroup-processable))
6357 ;; Just return the current article.
6358 (list (gnus-summary-article-number))))))
6360 (defmacro gnus-summary-iterate (arg &rest forms)
6361 "Iterate over the process/prefixed articles and do FORMS.
6362 ARG is the interactive prefix given to the command. FORMS will be
6363 executed with point over the summary line of the articles."
6364 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6365 `(let ((,articles (gnus-summary-work-articles ,arg)))
6367 (gnus-summary-goto-subject (car ,articles))
6371 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6372 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6374 (defun gnus-summary-save-process-mark ()
6375 "Push the current set of process marked articles on the stack."
6377 (push (copy-sequence gnus-newsgroup-processable)
6378 gnus-newsgroup-process-stack))
6380 (defun gnus-summary-kill-process-mark ()
6381 "Push the current set of process marked articles on the stack and unmark."
6383 (gnus-summary-save-process-mark)
6384 (gnus-summary-unmark-all-processable))
6386 (defun gnus-summary-yank-process-mark ()
6387 "Pop the last process mark state off the stack and restore it."
6389 (unless gnus-newsgroup-process-stack
6390 (error "Empty mark stack"))
6391 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6393 (defun gnus-summary-process-mark-set (set)
6394 "Make SET into the current process marked articles."
6395 (gnus-summary-unmark-all-processable)
6396 (mapc 'gnus-summary-set-process-mark set))
6398 ;;; Searching and stuff
6400 (defun gnus-summary-search-group (&optional backward use-level)
6401 "Search for next unread newsgroup.
6402 If optional argument BACKWARD is non-nil, search backward instead."
6404 (set-buffer gnus-group-buffer)
6405 (when (gnus-group-search-forward
6406 backward nil (if use-level (gnus-group-group-level) nil))
6407 (gnus-group-group-name))))
6409 (defun gnus-summary-best-group (&optional exclude-group)
6410 "Find the name of the best unread group.
6411 If EXCLUDE-GROUP, do not go to this group."
6412 (with-current-buffer gnus-group-buffer
6414 (gnus-group-best-unread-group exclude-group))))
6416 (defun gnus-summary-find-next (&optional unread article backward)
6418 (gnus-summary-find-prev unread article)
6419 (let* ((dummy (gnus-summary-article-intangible-p))
6420 (article (or article (gnus-summary-article-number)))
6421 (data (gnus-data-find-list article))
6423 (when (and (not dummy)
6424 (or (not gnus-summary-check-current)
6426 (not (gnus-data-unread-p (car data)))))
6427 (setq data (cdr data)))
6432 (unless (memq (gnus-data-number (car data))
6434 ((eq gnus-auto-goto-ignores
6435 'always-undownloaded)
6436 gnus-newsgroup-undownloaded)
6439 ((eq gnus-auto-goto-ignores
6441 gnus-newsgroup-unfetched)
6442 ((eq gnus-auto-goto-ignores
6444 gnus-newsgroup-undownloaded)))
6445 (when (gnus-data-unread-p (car data))
6446 (setq result (car data)
6448 (setq data (cdr data)))
6451 (goto-char (gnus-data-pos result))
6452 (gnus-data-number result)))))
6454 (defun gnus-summary-find-prev (&optional unread article)
6455 (let* ((eobp (eobp))
6456 (article (or article (gnus-summary-article-number)))
6457 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6459 (when (and (not eobp)
6460 (or (not gnus-summary-check-current)
6462 (not (gnus-data-unread-p (car data)))))
6463 (setq data (cdr data)))
6468 (unless (memq (gnus-data-number (car data))
6470 ((eq gnus-auto-goto-ignores
6471 'always-undownloaded)
6472 gnus-newsgroup-undownloaded)
6475 ((eq gnus-auto-goto-ignores
6477 gnus-newsgroup-unfetched)
6478 ((eq gnus-auto-goto-ignores
6480 gnus-newsgroup-undownloaded)))
6481 (when (gnus-data-unread-p (car data))
6482 (setq result (car data)
6484 (setq data (cdr data)))
6487 (goto-char (gnus-data-pos result))
6488 (gnus-data-number result))))
6490 (defun gnus-summary-find-subject (subject &optional unread backward article)
6491 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6492 (article (or article (gnus-summary-article-number)))
6493 (articles (gnus-data-list backward))
6494 (arts (gnus-data-find-list article articles))
6496 (when (or (not gnus-summary-check-current)
6498 (not (gnus-data-unread-p (car arts))))
6499 (setq arts (cdr arts)))
6501 (and (or (not unread)
6502 (gnus-data-unread-p (car arts)))
6503 (vectorp (gnus-data-header (car arts)))
6505 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6506 (setq result (car arts)
6508 (setq arts (cdr arts)))
6510 (goto-char (gnus-data-pos result))
6511 (gnus-data-number result))))
6513 (defun gnus-summary-search-forward (&optional unread subject backward)
6514 "Search forward for an article.
6515 If UNREAD, look for unread articles. If SUBJECT, look for
6516 articles with that subject. If BACKWARD, search backward instead."
6517 (cond (subject (gnus-summary-find-subject subject unread backward))
6518 (backward (gnus-summary-find-prev unread))
6519 (t (gnus-summary-find-next unread))))
6521 (defun gnus-recenter (&optional n)
6522 "Center point in window and redisplay frame.
6523 Also do horizontal recentering."
6525 (when (and gnus-auto-center-summary
6526 (not (eq gnus-auto-center-summary 'vertical)))
6527 (gnus-horizontal-recenter))
6530 (defun gnus-summary-recenter ()
6531 "Center point in the summary window.
6532 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6533 displayed, no centering will be performed."
6534 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6535 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6537 ;; The user has to want it.
6538 (when gnus-auto-center-summary
6539 (let* ((top (cond ((< (window-height) 4) 0)
6540 ((< (window-height) 7) 1)
6541 (t (if (numberp gnus-auto-center-summary)
6542 gnus-auto-center-summary
6543 (/ (1- (window-height)) 2)))))
6544 (height (1- (window-height)))
6545 (bottom (save-excursion (goto-char (point-max))
6546 (forward-line (- height))
6548 (window (get-buffer-window (current-buffer))))
6549 (when (get-buffer-window gnus-article-buffer)
6550 ;; Only do recentering when the article buffer is displayed,
6551 ;; Set the window start to either `bottom', which is the biggest
6552 ;; possible valid number, or the second line from the top,
6553 ;; whichever is the least.
6554 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6555 (if (> bottom top-pos)
6556 ;; Keep the second line from the top visible
6557 (set-window-start window top-pos t)
6558 ;; Try to keep the bottom line visible; if it's partially
6559 ;; obscured, either scroll one more line to make it fully
6560 ;; visible, or revert to using TOP-POS.
6562 (goto-char (point-max))
6564 (let ((last-line-start (point)))
6566 (set-window-start window (point) t)
6567 (when (not (pos-visible-in-window-p last-line-start window))
6569 (set-window-start window (min (point) top-pos) t)))))))
6570 ;; Do horizontal recentering while we're at it.
6571 (when (and (get-buffer-window (current-buffer) t)
6572 (not (eq gnus-auto-center-summary 'vertical)))
6573 (let ((selected (selected-window)))
6574 (select-window (get-buffer-window (current-buffer) t))
6575 (gnus-summary-position-point)
6576 (gnus-horizontal-recenter)
6577 (select-window selected))))))
6579 (defun gnus-summary-jump-to-group (newsgroup)
6580 "Move point to NEWSGROUP in group mode buffer."
6581 ;; Keep update point of group mode buffer if visible.
6582 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6583 (save-window-excursion
6584 ;; Take care of tree window mode.
6585 (when (get-buffer-window gnus-group-buffer)
6586 (pop-to-buffer gnus-group-buffer))
6587 (gnus-group-jump-to-group newsgroup))
6589 ;; Take care of tree window mode.
6590 (if (get-buffer-window gnus-group-buffer)
6591 (pop-to-buffer gnus-group-buffer)
6592 (set-buffer gnus-group-buffer))
6593 (gnus-group-jump-to-group newsgroup))))
6595 ;; This function returns a list of article numbers based on the
6596 ;; difference between the ranges of read articles in this group and
6597 ;; the range of active articles.
6598 (defun gnus-list-of-unread-articles (group)
6599 (let* ((read (gnus-info-read (gnus-get-info group)))
6600 (active (or (gnus-active group) (gnus-activate-group group)))
6601 (last (or (cdr active)
6602 (error "Group %s couldn't be activated " group)))
6604 ;; If none are read, then all are unread.
6606 (setq first (car active))
6607 ;; If the range of read articles is a single range, then the
6608 ;; first unread article is the article after the last read
6609 ;; article. Sounds logical, doesn't it?
6610 (if (and (not (listp (cdr read)))
6611 (or (< (car read) (car active))
6612 (progn (setq read (list read))
6614 (setq first (max (car active) (1+ (cdr read))))
6615 ;; `read' is a list of ranges.
6616 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6619 (setq first (car active)))
6622 (while (< first nlast)
6623 (setq unread (cons first unread)
6625 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6626 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6627 (setq read (cdr read)))))
6628 ;; And add the last unread articles.
6629 (while (<= first last)
6630 (setq unread (cons first unread)
6632 ;; Return the list of unread articles.
6633 (delq 0 (nreverse unread))))
6635 (defun gnus-list-of-read-articles (group)
6636 "Return a list of unread, unticked and non-dormant articles."
6637 (let* ((info (gnus-get-info group))
6638 (marked (gnus-info-marks info))
6639 (active (gnus-active group)))
6641 (gnus-list-range-difference
6642 (gnus-list-range-difference
6643 (gnus-sorted-complement
6644 (gnus-uncompress-range active)
6645 (gnus-list-of-unread-articles group))
6646 (cdr (assq 'dormant marked)))
6647 (cdr (assq 'tick marked))))))
6649 ;; This function returns a sequence of article numbers based on the
6650 ;; difference between the ranges of read articles in this group and
6651 ;; the range of active articles.
6652 (defun gnus-sequence-of-unread-articles (group)
6653 (let* ((read (gnus-info-read (gnus-get-info group)))
6654 (active (or (gnus-active group) (gnus-activate-group group)))
6657 ;; If none are read, then all are unread.
6659 (setq first (car active))
6660 ;; If the range of read articles is a single range, then the
6661 ;; first unread article is the article after the last read
6662 ;; article. Sounds logical, doesn't it?
6663 (if (and (not (listp (cdr read)))
6664 (or (< (car read) (car active))
6665 (progn (setq read (list read))
6667 (setq first (max (car active) (1+ (cdr read))))
6668 ;; `read' is a list of ranges.
6669 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6672 (setq first (car active)))
6675 (push (cons first nlast) unread))
6676 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6677 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6678 (setq read (cdr read)))))
6679 ;; And add the last unread articles.
6680 (cond ((not (and first last))
6683 (push (cons first last) unread))
6685 (push first unread)))
6686 ;; Return the sequence of unread articles.
6687 (delq 0 (nreverse unread))))
6689 ;; Various summary commands
6691 (defun gnus-summary-select-article-buffer ()
6692 "Reconfigure windows to show article buffer."
6694 (if (not (gnus-buffer-live-p gnus-article-buffer))
6695 (error "There is no article buffer for this summary buffer")
6696 (gnus-configure-windows 'article)
6697 (select-window (get-buffer-window gnus-article-buffer))))
6699 (defun gnus-summary-universal-argument (arg)
6700 "Perform any operation on all articles that are process/prefixed."
6702 (let ((articles (gnus-summary-work-articles arg))
6709 (substitute-command-keys
6710 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6712 (gnus-error 1 "Undefined key")
6715 (gnus-summary-goto-subject (setq article (pop articles)))
6716 (let (gnus-newsgroup-processable)
6717 (command-execute func))
6718 (gnus-summary-remove-process-mark article)))))
6719 (gnus-summary-position-point))
6721 (defun gnus-summary-toggle-truncation (&optional arg)
6722 "Toggle truncation of summary lines.
6723 With ARG, turn line truncation on if ARG is positive."
6725 (setq truncate-lines
6726 (if (null arg) (not truncate-lines)
6727 (> (prefix-numeric-value arg) 0)))
6730 (defun gnus-summary-find-for-reselect ()
6731 "Return the number of an article to stay on across a reselect.
6732 The current article is considered, then following articles, then previous
6733 articles. An article is sought which is not cancelled and isn't a temporary
6734 insertion from another group. If there's no such then return a dummy 0."
6736 (dolist (rev '(nil t))
6737 (unless found ; don't demand the reverse list if we don't need it
6738 (let ((data (gnus-data-find-list
6739 (gnus-summary-article-number) (gnus-data-list rev))))
6740 (while (and data (not found))
6741 (if (and (< 0 (gnus-data-number (car data)))
6742 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6743 (setq found (gnus-data-number (car data))))
6744 (setq data (cdr data))))))
6747 (defun gnus-summary-reselect-current-group (&optional all rescan)
6748 "Exit and then reselect the current newsgroup.
6749 The prefix argument ALL means to select all articles."
6751 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6752 (error "Ephemeral groups can't be reselected"))
6753 (let ((current-subject (gnus-summary-find-for-reselect))
6754 (group gnus-newsgroup-name))
6755 (setq gnus-newsgroup-begin nil)
6756 (gnus-summary-exit nil 'leave-hidden)
6757 ;; We have to adjust the point of group mode buffer because
6758 ;; point was moved to the next unread newsgroup by exiting.
6759 (gnus-summary-jump-to-group group)
6762 (gnus-group-get-new-news-this-group 1)))
6763 (gnus-group-read-group all t)
6764 (gnus-summary-goto-subject current-subject nil t)))
6766 (defun gnus-summary-rescan-group (&optional all)
6767 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6769 (gnus-summary-reselect-current-group all t))
6771 (defun gnus-summary-update-info (&optional non-destructive)
6773 (let ((group gnus-newsgroup-name))
6775 (when gnus-newsgroup-kill-headers
6776 (setq gnus-newsgroup-killed
6777 (gnus-compress-sequence
6779 (gnus-list-range-intersection
6780 gnus-newsgroup-unselected gnus-newsgroup-killed)
6781 gnus-newsgroup-unreads)
6783 (unless (listp (cdr gnus-newsgroup-killed))
6784 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6785 (let ((headers gnus-newsgroup-headers))
6786 ;; Set the new ranges of read articles.
6787 (with-current-buffer gnus-group-buffer
6788 (gnus-undo-force-boundary))
6789 (gnus-update-read-articles
6790 group (gnus-sorted-union
6791 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6792 ;; Set the current article marks.
6793 (let ((gnus-newsgroup-scored
6794 (if (and (not gnus-save-score)
6795 (not non-destructive))
6797 gnus-newsgroup-scored)))
6799 (gnus-update-marks)))
6800 ;; Do the cross-ref thing.
6801 (when gnus-use-cross-reference
6802 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6803 ;; Do not switch windows but change the buffer to work.
6804 (set-buffer gnus-group-buffer)
6805 (unless (gnus-ephemeral-group-p group)
6806 (gnus-group-update-group group)))))))
6808 (defun gnus-summary-save-newsrc (&optional force)
6809 "Save the current number of read/marked articles in the dribble buffer.
6810 The dribble buffer will then be saved.
6811 If FORCE (the prefix), also save the .newsrc file(s)."
6813 (gnus-summary-update-info t)
6815 (gnus-save-newsrc-file)
6816 (gnus-dribble-save)))
6818 (defun gnus-summary-exit (&optional temporary leave-hidden)
6819 "Exit reading current newsgroup, and then return to group selection mode.
6820 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6822 (gnus-set-global-variables)
6823 (when (gnus-buffer-live-p gnus-article-buffer)
6825 (set-buffer gnus-article-buffer)
6826 (mm-destroy-parts gnus-article-mime-handles)
6827 ;; Set it to nil for safety reason.
6828 (setq gnus-article-mime-handle-alist nil)
6829 (setq gnus-article-mime-handles nil)))
6830 (gnus-kill-save-kill-buffer)
6831 (gnus-async-halt-prefetch)
6832 (let* ((group gnus-newsgroup-name)
6833 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6834 (gnus-group-is-exiting-p t)
6837 (buf (current-buffer)))
6839 ;; Do adaptive scoring, and possibly save score files.
6840 (when gnus-newsgroup-adaptive
6841 (gnus-score-adaptive))
6842 (when gnus-use-scoring
6844 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6845 ;; If we have several article buffers, we kill them at exit.
6846 (unless gnus-single-article-buffer
6847 (gnus-kill-buffer gnus-article-buffer)
6848 (gnus-kill-buffer gnus-original-article-buffer)
6849 (setq gnus-article-current nil))
6850 (when gnus-use-cache
6851 (gnus-cache-possibly-remove-articles)
6852 (gnus-cache-save-buffers))
6853 (gnus-async-prefetch-remove-group group)
6854 (when gnus-suppress-duplicates
6855 (gnus-dup-enter-articles))
6856 (when gnus-use-trees
6857 (gnus-tree-close group))
6858 (when gnus-use-cache
6859 (gnus-cache-write-active))
6860 ;; Remove entries for this group.
6861 (nnmail-purge-split-history (gnus-group-real-name group))
6862 ;; Make all changes in this group permanent.
6864 (gnus-run-hooks 'gnus-exit-group-hook)
6865 (gnus-summary-update-info))
6866 (gnus-close-group group)
6867 ;; Make sure where we were, and go to next newsgroup.
6868 (set-buffer gnus-group-buffer)
6870 (gnus-group-jump-to-group group))
6871 (gnus-run-hooks 'gnus-summary-exit-hook)
6872 (unless (or quit-config
6873 ;; If this group has disappeared from the summary
6874 ;; buffer, don't skip forwards.
6875 (not (string= group (gnus-group-group-name))))
6876 (gnus-group-next-unread-group 1))
6877 (setq group-point (point))
6880 ;; If we have several article buffers, we kill them at exit.
6881 (unless gnus-single-article-buffer
6882 (gnus-kill-buffer gnus-article-buffer)
6883 (gnus-kill-buffer gnus-original-article-buffer)
6884 (setq gnus-article-current nil))
6886 (if (not gnus-kill-summary-on-exit)
6888 (gnus-deaden-summary)
6890 ;; We set all buffer-local variables to nil. It is unclear why
6891 ;; this is needed, but if we don't, buffer-local variables are
6892 ;; not garbage-collected, it seems. This would the lead to en
6893 ;; ever-growing Emacs.
6894 (gnus-summary-clear-local-variables)
6895 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6896 (gnus-summary-clear-local-variables))
6897 (when (get-buffer gnus-article-buffer)
6898 (bury-buffer gnus-article-buffer))
6899 ;; Return to group mode buffer.
6900 (when (eq mode 'gnus-summary-mode)
6901 (gnus-kill-buffer buf)))
6902 (setq gnus-current-select-method gnus-select-method)
6903 (set-buffer gnus-group-buffer)
6905 (gnus-handle-ephemeral-exit quit-config)
6906 (goto-char group-point)
6907 ;; If gnus-group-buffer is already displayed, make sure we also move
6908 ;; the cursor in the window that displays it.
6909 (let ((win (get-buffer-window (current-buffer) 0)))
6910 (if win (set-window-point win (point))))
6911 (unless leave-hidden
6912 (gnus-configure-windows 'group 'force)))
6913 ;; Clear the current group name.
6915 (setq gnus-newsgroup-name nil)))))
6917 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
6918 (defun gnus-summary-exit-no-update (&optional no-questions)
6919 "Quit reading current newsgroup without updating read article info."
6921 (let* ((group gnus-newsgroup-name)
6922 (gnus-group-is-exiting-p t)
6923 (gnus-group-is-exiting-without-update-p t)
6924 (quit-config (gnus-group-quit-config group)))
6925 (when (or no-questions
6927 (gnus-y-or-n-p "Discard changes to this group and exit? "))
6928 (gnus-async-halt-prefetch)
6929 (run-hooks 'gnus-summary-prepare-exit-hook)
6930 (when (gnus-buffer-live-p gnus-article-buffer)
6932 (set-buffer gnus-article-buffer)
6933 (mm-destroy-parts gnus-article-mime-handles)
6934 ;; Set it to nil for safety reason.
6935 (setq gnus-article-mime-handle-alist nil)
6936 (setq gnus-article-mime-handles nil)))
6937 ;; If we have several article buffers, we kill them at exit.
6938 (unless gnus-single-article-buffer
6939 (gnus-kill-buffer gnus-article-buffer)
6940 (gnus-kill-buffer gnus-original-article-buffer)
6941 (setq gnus-article-current nil))
6942 (if (not gnus-kill-summary-on-exit)
6943 (gnus-deaden-summary)
6944 (gnus-close-group group)
6945 (gnus-summary-clear-local-variables)
6946 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6947 (gnus-summary-clear-local-variables))
6948 (gnus-kill-buffer gnus-summary-buffer))
6949 (unless gnus-single-article-buffer
6950 (setq gnus-article-current nil))
6951 (when gnus-use-trees
6952 (gnus-tree-close group))
6953 (gnus-async-prefetch-remove-group group)
6954 (when (get-buffer gnus-article-buffer)
6955 (bury-buffer gnus-article-buffer))
6956 ;; Return to the group buffer.
6957 (gnus-configure-windows 'group 'force)
6958 ;; Clear the current group name.
6959 (setq gnus-newsgroup-name nil)
6960 (unless (gnus-ephemeral-group-p group)
6961 (gnus-group-update-group group))
6962 (when (equal (gnus-group-group-name) group)
6963 (gnus-group-next-unread-group 1))
6965 (gnus-handle-ephemeral-exit quit-config)))))
6967 (defun gnus-handle-ephemeral-exit (quit-config)
6968 "Handle movement when leaving an ephemeral group.
6969 The state which existed when entering the ephemeral is reset."
6970 (if (not (buffer-name (car quit-config)))
6971 (gnus-configure-windows 'group 'force)
6972 (set-buffer (car quit-config))
6973 (cond ((eq major-mode 'gnus-summary-mode)
6974 (gnus-set-global-variables))
6975 ((eq major-mode 'gnus-article-mode)
6977 ;; The `gnus-summary-buffer' variable may point
6978 ;; to the old summary buffer when using a single
6980 (unless (gnus-buffer-live-p gnus-summary-buffer)
6981 (set-buffer gnus-group-buffer))
6982 (set-buffer gnus-summary-buffer)
6983 (gnus-set-global-variables))))
6984 (if (or (eq (cdr quit-config) 'article)
6985 (eq (cdr quit-config) 'pick))
6986 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
6987 (gnus-configure-windows 'pick 'force)
6988 (gnus-configure-windows (cdr quit-config) 'force))
6989 (gnus-configure-windows (cdr quit-config) 'force))
6990 (when (eq major-mode 'gnus-summary-mode)
6991 (gnus-summary-recenter)
6992 (gnus-summary-position-point))))
6996 (defvar gnus-dead-summary-mode-map nil)
6998 (unless gnus-dead-summary-mode-map
6999 (setq gnus-dead-summary-mode-map (make-keymap))
7000 (suppress-keymap gnus-dead-summary-mode-map)
7001 (substitute-key-definition
7002 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7003 (dolist (key '("\C-d" "\r" "\177" [delete]))
7004 (define-key gnus-dead-summary-mode-map
7005 key 'gnus-summary-wake-up-the-dead))
7006 (dolist (key '("q" "Q"))
7007 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
7009 (defvar gnus-dead-summary-mode nil
7010 "Minor mode for Gnus summary buffers.")
7012 (defun gnus-dead-summary-mode (&optional arg)
7013 "Minor mode for Gnus summary buffers."
7015 (when (eq major-mode 'gnus-summary-mode)
7016 (make-local-variable 'gnus-dead-summary-mode)
7017 (setq gnus-dead-summary-mode
7018 (if (null arg) (not gnus-dead-summary-mode)
7019 (> (prefix-numeric-value arg) 0)))
7020 (when gnus-dead-summary-mode
7022 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7024 (defun gnus-deaden-summary ()
7025 "Make the current summary buffer into a dead summary buffer."
7026 ;; Kill any previous dead summary buffer.
7027 (when (and gnus-dead-summary
7028 (buffer-name gnus-dead-summary))
7029 (with-current-buffer gnus-dead-summary
7030 (when gnus-dead-summary-mode
7031 (kill-buffer (current-buffer)))))
7032 ;; Make this the current dead summary.
7033 (setq gnus-dead-summary (current-buffer))
7034 (gnus-dead-summary-mode 1)
7035 (let ((name (buffer-name)))
7036 (when (string-match "Summary" name)
7038 (concat (substring name 0 (match-beginning 0)) "Dead "
7039 (substring name (match-beginning 0)))
7043 (defun gnus-kill-or-deaden-summary (buffer)
7044 "Kill or deaden the summary BUFFER."
7046 (when (and (buffer-name buffer)
7047 (not gnus-single-article-buffer))
7048 (with-current-buffer buffer
7049 (gnus-kill-buffer gnus-article-buffer)
7050 (gnus-kill-buffer gnus-original-article-buffer)))
7053 (gnus-kill-summary-on-exit
7054 (when (and gnus-use-trees
7055 (gnus-buffer-exists-p buffer))
7058 (gnus-tree-close gnus-newsgroup-name)))
7059 (gnus-kill-buffer buffer))
7060 ;; Deaden the buffer.
7061 ((gnus-buffer-exists-p buffer)
7064 (gnus-deaden-summary))))))
7066 (defun gnus-summary-wake-up-the-dead (&rest args)
7067 "Wake up the dead summary buffer."
7069 (gnus-dead-summary-mode -1)
7070 (let ((name (buffer-name)))
7071 (when (string-match "Dead " name)
7073 (concat (substring name 0 (match-beginning 0))
7074 (substring name (match-end 0)))
7076 (gnus-message 3 "This dead summary is now alive again"))
7078 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7079 (defun gnus-summary-fetch-faq (&optional faq-dir)
7080 "Fetch the FAQ for the current group.
7081 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7085 (when current-prefix-arg
7087 "FAQ dir: " (and (listp gnus-group-faq-directory)
7089 gnus-group-faq-directory))))))
7090 (let (gnus-faq-buffer)
7091 (when (setq gnus-faq-buffer
7092 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7093 (gnus-configure-windows 'summary-faq))))
7095 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7096 (defun gnus-summary-describe-group (&optional force)
7097 "Describe the current newsgroup."
7099 (gnus-group-describe-group force gnus-newsgroup-name))
7101 (defun gnus-summary-describe-briefly ()
7102 "Describe summary mode commands briefly."
7104 (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")))
7106 ;; Walking around group mode buffer from summary mode.
7108 (defun gnus-summary-next-group (&optional no-article target-group backward)
7109 "Exit current newsgroup and then select next unread newsgroup.
7110 If prefix argument NO-ARTICLE is non-nil, no article is selected
7111 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7112 previous group instead."
7114 ;; Stop pre-fetching.
7115 (gnus-async-halt-prefetch)
7116 (let ((current-group gnus-newsgroup-name)
7117 (current-buffer (current-buffer))
7119 ;; First we semi-exit this group to update Xrefs and all variables.
7120 ;; We can't do a real exit, because the window conf must remain
7121 ;; the same in case the user is prompted for info, and we don't
7122 ;; want the window conf to change before that...
7123 (gnus-summary-exit t)
7124 (while (not entered)
7125 ;; Then we find what group we are supposed to enter.
7126 (set-buffer gnus-group-buffer)
7127 (gnus-group-jump-to-group current-group)
7130 (if (eq gnus-keep-same-level 'best)
7131 (gnus-summary-best-group gnus-newsgroup-name)
7132 (gnus-summary-search-group backward gnus-keep-same-level))))
7133 (if (not target-group)
7134 ;; There are no further groups, so we return to the group
7137 (gnus-message 5 "Returning to the group buffer")
7139 (when (gnus-buffer-live-p current-buffer)
7140 (set-buffer current-buffer)
7141 (gnus-summary-exit))
7142 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7143 ;; We try to enter the target group.
7144 (gnus-group-jump-to-group target-group)
7145 (let ((unreads (gnus-group-group-unread)))
7146 (if (and (or (eq t unreads)
7147 (and unreads (not (zerop unreads))))
7148 (gnus-summary-read-group
7149 target-group nil no-article
7150 (and (buffer-name current-buffer) current-buffer)
7153 (setq current-group target-group
7154 target-group nil)))))))
7156 (defun gnus-summary-prev-group (&optional no-article)
7157 "Exit current newsgroup and then select previous unread newsgroup.
7158 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7160 (gnus-summary-next-group no-article nil t))
7162 ;; Walking around summary lines.
7164 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7165 "Go to the first subject satisfying any non-nil constraint.
7166 If UNREAD is non-nil, the article should be unread.
7167 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7168 If UNSEEN is non-nil, the article should be unseen.
7169 Returns the article selected or nil if there are no matching articles."
7173 ((null gnus-newsgroup-data)
7174 (gnus-message 3 "No articles in the group")
7176 ;; Pick the first article.
7177 ((not (or unread undownloaded unseen))
7178 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7179 (gnus-data-number (car gnus-newsgroup-data)))
7180 ;; Find the first unread article.
7182 (let ((data gnus-newsgroup-data))
7184 (let ((num (gnus-data-number (car data))))
7185 (or (memq num gnus-newsgroup-unfetched)
7186 (not (or (and unread
7187 (memq num gnus-newsgroup-unreads))
7189 (memq num gnus-newsgroup-undownloaded))
7191 (memq num gnus-newsgroup-unseen)))))))
7192 (setq data (cdr data)))
7196 (goto-char (gnus-data-pos (car data)))
7197 (gnus-data-number (car data)))
7198 (gnus-message 3 "No more%s articles"
7199 (let* ((r (when unread " unread"))
7200 (d (when undownloaded " undownloaded"))
7201 (s (when unseen " unseen"))
7202 (l (delq nil (list r d s))))
7203 (cond ((= 3 (length l))
7204 (concat r "," d ", or" s))
7206 (concat (car l) ", or" (cadr l)))
7213 (gnus-summary-position-point))))))
7215 (defun gnus-summary-next-subject (n &optional unread dont-display)
7216 "Go to next N'th summary line.
7217 If N is negative, go to the previous N'th subject line.
7218 If UNREAD is non-nil, only unread articles are selected.
7219 The difference between N and the actual number of steps taken is
7222 (let ((backward (< n 0))
7226 (gnus-summary-find-prev unread)
7227 (gnus-summary-find-next unread)))
7228 (unless (zerop (setq n (1- n)))
7229 (gnus-summary-show-thread)))
7231 (gnus-message 7 "No more%s articles"
7232 (if unread " unread" "")))
7233 (unless dont-display
7234 (gnus-summary-recenter)
7235 (gnus-summary-position-point))
7238 (defun gnus-summary-next-unread-subject (n)
7239 "Go to next N'th unread summary line."
7241 (gnus-summary-next-subject n t))
7243 (defun gnus-summary-prev-subject (n &optional unread)
7244 "Go to previous N'th summary line.
7245 If optional argument UNREAD is non-nil, only unread article is selected."
7247 (gnus-summary-next-subject (- n) unread))
7249 (defun gnus-summary-prev-unread-subject (n)
7250 "Go to previous N'th unread summary line."
7252 (gnus-summary-next-subject (- n) t))
7254 (defun gnus-summary-goto-subjects (articles)
7255 "Insert the subject header for ARTICLES in the current buffer."
7257 (dolist (article articles)
7258 (gnus-summary-goto-subject article t)))
7259 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7260 (gnus-summary-position-point))
7262 (defun gnus-summary-goto-subject (article &optional force silent)
7263 "Go the subject line of ARTICLE.
7264 If FORCE, also allow jumping to articles not currently shown."
7265 (interactive "nArticle number: ")
7266 (unless (numberp article)
7267 (error "Article %s is not a number" article))
7269 (data (gnus-data-find article)))
7270 ;; We read in the article if we have to.
7273 (gnus-summary-insert-subject
7275 (if (or (numberp force) (vectorp force)) force)
7277 (setq data (gnus-data-find article)))
7282 (gnus-message 3 "Can't find article %d" article))
7284 (let ((pt (gnus-data-pos data)))
7286 (gnus-summary-set-article-display-arrow pt))
7287 (gnus-summary-position-point)
7290 ;; Walking around summary lines with displaying articles.
7292 (defun gnus-summary-expand-window (&optional arg)
7293 "Make the summary buffer take up the entire Emacs frame.
7294 Given a prefix, will force an `article' buffer configuration."
7297 (gnus-configure-windows 'article 'force)
7298 (gnus-configure-windows 'summary 'force)))
7300 (defun gnus-summary-display-article (article &optional all-header)
7301 "Display ARTICLE in article buffer."
7302 (when (gnus-buffer-live-p gnus-article-buffer)
7303 (with-current-buffer gnus-article-buffer
7304 (mm-enable-multibyte)))
7305 (gnus-set-global-variables)
7306 (when (gnus-buffer-live-p gnus-article-buffer)
7307 (with-current-buffer gnus-article-buffer
7308 (setq gnus-article-charset gnus-newsgroup-charset)
7309 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7310 (mm-enable-multibyte)))
7314 (if gnus-summary-display-article-function
7315 (funcall gnus-summary-display-article-function article all-header)
7316 (gnus-article-prepare article all-header))
7317 (gnus-run-hooks 'gnus-select-article-hook)
7318 (when (and gnus-current-article
7319 (not (zerop gnus-current-article)))
7320 (gnus-summary-goto-subject gnus-current-article))
7321 (gnus-summary-recenter)
7322 (when (and gnus-use-trees gnus-show-threads)
7323 (gnus-possibly-generate-tree article)
7324 (gnus-highlight-selected-tree article))
7325 ;; Successfully display article.
7326 (gnus-article-set-window-start
7327 (cdr (assq article gnus-newsgroup-bookmarks))))))
7329 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7330 "Select the current article.
7331 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7332 non-nil, the article will be re-fetched even if it already present in
7333 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7335 ;; Make sure we are in the summary buffer to work around bbdb bug.
7336 (unless (eq major-mode 'gnus-summary-mode)
7337 (set-buffer gnus-summary-buffer))
7338 (let ((article (or article (gnus-summary-article-number)))
7339 (all-headers (not (not all-headers))) ;Must be t or nil.
7340 gnus-summary-display-article-function)
7342 (gnus-summary-article-pseudo-p article)
7343 (error "This is a pseudo-article"))
7345 (set-buffer gnus-summary-buffer)
7346 (if (or (and gnus-single-article-buffer
7347 (or (null gnus-current-article)
7348 (null gnus-article-current)
7349 (null (get-buffer gnus-article-buffer))
7350 (not (eq article (cdr gnus-article-current)))
7351 (not (equal (car gnus-article-current)
7352 gnus-newsgroup-name))))
7353 (and (not gnus-single-article-buffer)
7354 (or (null gnus-current-article)
7355 (not (eq gnus-current-article article))))
7357 ;; The requested article is different from the current article.
7359 (gnus-summary-display-article article all-headers)
7360 (when (gnus-buffer-live-p gnus-article-buffer)
7361 (with-current-buffer gnus-article-buffer
7362 (if (not gnus-article-decoded-p) ;; a local variable
7363 (mm-disable-multibyte))))
7364 (gnus-article-set-window-start
7365 (cdr (assq article gnus-newsgroup-bookmarks)))
7369 (defun gnus-summary-force-verify-and-decrypt ()
7370 "Display buttons for signed/encrypted parts and verify/decrypt them."
7372 (let ((mm-verify-option 'known)
7373 (mm-decrypt-option 'known)
7374 (gnus-article-emulate-mime t)
7375 (gnus-buttonized-mime-types (append (list "multipart/signed"
7376 "multipart/encrypted")
7377 gnus-buttonized-mime-types)))
7378 (gnus-summary-select-article nil 'force)))
7380 (defun gnus-summary-set-current-mark (&optional current-mark)
7381 "Obsolete function."
7384 (defun gnus-summary-next-article (&optional unread subject backward push)
7385 "Select the next article.
7386 If UNREAD, only unread articles are selected.
7387 If SUBJECT, only articles with SUBJECT are selected.
7388 If BACKWARD, the previous article is selected instead of the next."
7391 ;; Is there such an article?
7392 ((and (gnus-summary-search-forward unread subject backward)
7393 (or (gnus-summary-display-article (gnus-summary-article-number))
7394 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7395 (gnus-summary-position-point))
7396 ;; If not, we try the first unread, if that is wanted.
7398 gnus-auto-select-same
7399 (gnus-summary-first-unread-article))
7400 (gnus-summary-position-point)
7401 (gnus-message 6 "Wrapped"))
7402 ;; Try to get next/previous article not displayed in this group.
7403 ((and gnus-auto-extend-newsgroup
7404 (not unread) (not subject))
7405 (gnus-summary-goto-article
7406 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7407 nil (count-lines (point-min) (point))))
7408 ;; Go to next/previous group.
7410 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7411 (gnus-summary-jump-to-group gnus-newsgroup-name))
7412 (let ((cmd last-command-char)
7414 (with-current-buffer gnus-group-buffer
7417 (if (eq gnus-keep-same-level 'best)
7418 (gnus-summary-best-group gnus-newsgroup-name)
7419 (gnus-summary-search-group backward gnus-keep-same-level))))
7420 ;; For some reason, the group window gets selected. We change
7422 (select-window (get-buffer-window (current-buffer)))
7423 ;; Select next unread newsgroup automagically.
7425 ((or (not gnus-auto-select-next)
7427 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7428 ((or (eq gnus-auto-select-next 'quietly)
7429 (and (eq gnus-auto-select-next 'slightly-quietly)
7431 (and (eq gnus-auto-select-next 'almost-quietly)
7432 (gnus-summary-last-article-p)))
7434 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7436 (gnus-message 7 "No more%s articles (%s)..."
7437 (if unread " unread" "")
7438 (if group (concat "selecting " group)
7440 (gnus-summary-next-group nil group backward)))
7442 (when (gnus-key-press-event-p last-input-event)
7443 (gnus-summary-walk-group-buffer
7444 gnus-newsgroup-name cmd unread backward point))))))))
7446 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7447 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7448 (?\C-p (gnus-group-prev-unread-group 1))))
7449 (cursor-in-echo-area t)
7450 keve key group ended prompt)
7452 (set-buffer gnus-group-buffer)
7455 (if (eq gnus-keep-same-level 'best)
7456 (gnus-summary-best-group gnus-newsgroup-name)
7457 (gnus-summary-search-group backward gnus-keep-same-level))))
7461 "No more%s articles%s " (if unread " unread" "")
7463 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7464 (format " (Type %s for %s [%s])"
7465 (single-key-description cmd)
7466 (gnus-group-decoded-name group)
7467 (gnus-group-unread group))
7468 (format " (Type %s to exit %s)"
7469 (single-key-description cmd)
7470 (gnus-group-decoded-name gnus-newsgroup-name)))))
7471 ;; Confirm auto selection.
7472 (setq key (car (setq keve (gnus-read-event-char prompt)))
7475 ((assq key keystrokes)
7476 (let ((obuf (current-buffer)))
7477 (switch-to-buffer gnus-group-buffer)
7479 (gnus-group-jump-to-group group))
7480 (eval (cadr (assq key keystrokes)))
7481 (setq group (gnus-group-group-name))
7482 (switch-to-buffer obuf))
7486 (gnus-ephemeral-group-p gnus-newsgroup-name))
7488 (gnus-summary-next-group nil group backward)))
7490 (push (cdr keve) unread-command-events))))))
7492 (defun gnus-summary-next-unread-article ()
7493 "Select unread article after current one."
7495 (gnus-summary-next-article
7496 (or (not (eq gnus-summary-goto-unread 'never))
7497 (gnus-summary-last-article-p (gnus-summary-article-number)))
7498 (and gnus-auto-select-same
7499 (gnus-summary-article-subject))))
7501 (defun gnus-summary-prev-article (&optional unread subject)
7502 "Select the article after the current one.
7503 If UNREAD is non-nil, only unread articles are selected."
7505 (gnus-summary-next-article unread subject t))
7507 (defun gnus-summary-prev-unread-article ()
7508 "Select unread article before current one."
7510 (gnus-summary-prev-article
7511 (or (not (eq gnus-summary-goto-unread 'never))
7512 (gnus-summary-first-article-p (gnus-summary-article-number)))
7513 (and gnus-auto-select-same
7514 (gnus-summary-article-subject))))
7516 (defun gnus-summary-next-page (&optional lines circular stop)
7517 "Show next page of the selected article.
7518 If at the end of the current article, select the next article.
7519 LINES says how many lines should be scrolled up.
7521 If CIRCULAR is non-nil, go to the start of the article instead of
7522 selecting the next article when reaching the end of the current
7525 If STOP is non-nil, just stop when reaching the end of the message.
7527 Also see the variable `gnus-article-skip-boring'."
7529 (setq gnus-summary-buffer (current-buffer))
7530 (gnus-set-global-variables)
7531 (let ((article (gnus-summary-article-number))
7532 (article-window (get-buffer-window gnus-article-buffer t))
7534 ;; If the buffer is empty, we have no article.
7536 (error "No article to select"))
7537 (gnus-configure-windows 'article)
7538 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7539 (if (and (eq gnus-summary-goto-unread 'never)
7540 (not (gnus-summary-last-article-p article)))
7541 (gnus-summary-next-article)
7542 (gnus-summary-next-unread-article))
7543 (if (or (null gnus-current-article)
7544 (null gnus-article-current)
7545 (/= article (cdr gnus-article-current))
7546 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7547 ;; Selected subject is different from current article's.
7548 (gnus-summary-display-article article)
7549 (when article-window
7550 (gnus-eval-in-buffer-window gnus-article-buffer
7551 (setq endp (or (gnus-article-next-page lines)
7552 (gnus-article-only-boring-p))))
7555 (gnus-message 3 "End of message"))
7557 (gnus-summary-beginning-of-article))
7559 (gnus-message 3 "End of message"))
7561 (if (and (eq gnus-summary-goto-unread 'never)
7562 (not (gnus-summary-last-article-p article)))
7563 (gnus-summary-next-article)
7564 (gnus-summary-next-unread-article))))))))
7565 (gnus-summary-recenter)
7566 (gnus-summary-position-point)))
7568 (defun gnus-summary-prev-page (&optional lines move)
7569 "Show previous page of selected article.
7570 Argument LINES specifies lines to be scrolled down.
7571 If MOVE, move to the previous unread article if point is at
7572 the beginning of the buffer."
7574 (let ((article (gnus-summary-article-number))
7575 (article-window (get-buffer-window gnus-article-buffer t))
7577 (gnus-configure-windows 'article)
7578 (if (or (null gnus-current-article)
7579 (null gnus-article-current)
7580 (/= article (cdr gnus-article-current))
7581 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7582 ;; Selected subject is different from current article's.
7583 (gnus-summary-display-article article)
7584 (gnus-summary-recenter)
7585 (when article-window
7586 (gnus-eval-in-buffer-window gnus-article-buffer
7587 (setq endp (gnus-article-prev-page lines)))
7588 (when (and move endp)
7590 (gnus-message 3 "Beginning of message"))
7592 (if (and (eq gnus-summary-goto-unread 'never)
7593 (not (gnus-summary-first-article-p article)))
7594 (gnus-summary-prev-article)
7595 (gnus-summary-prev-unread-article))))))))
7596 (gnus-summary-position-point))
7598 (defun gnus-summary-prev-page-or-article (&optional lines)
7599 "Show previous page of selected article.
7600 Argument LINES specifies lines to be scrolled down.
7601 If at the beginning of the article, go to the next article."
7603 (gnus-summary-prev-page lines t))
7605 (defun gnus-summary-scroll-up (lines)
7606 "Scroll up (or down) one line current article.
7607 Argument LINES specifies lines to be scrolled up (or down if negative)."
7609 (gnus-configure-windows 'article)
7610 (gnus-summary-show-thread)
7611 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7612 (gnus-eval-in-buffer-window gnus-article-buffer
7614 (when (gnus-article-next-page lines)
7615 (gnus-message 3 "End of message")))
7617 (gnus-article-prev-page (- lines))))))
7618 (gnus-summary-recenter)
7619 (gnus-summary-position-point))
7621 (defun gnus-summary-scroll-down (lines)
7622 "Scroll down (or up) one line current article.
7623 Argument LINES specifies lines to be scrolled down (or up if negative)."
7625 (gnus-summary-scroll-up (- lines)))
7627 (defun gnus-summary-next-same-subject ()
7628 "Select next article which has the same subject as current one."
7630 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7632 (defun gnus-summary-prev-same-subject ()
7633 "Select previous article which has the same subject as current one."
7635 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7637 (defun gnus-summary-next-unread-same-subject ()
7638 "Select next unread article which has the same subject as current one."
7640 (gnus-summary-next-article t (gnus-summary-article-subject)))
7642 (defun gnus-summary-prev-unread-same-subject ()
7643 "Select previous unread article which has the same subject as current one."
7645 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7647 (defun gnus-summary-first-unread-article ()
7648 "Select the first unread article.
7649 Return nil if there are no unread articles."
7652 (when (gnus-summary-first-subject t)
7653 (gnus-summary-show-thread)
7654 (gnus-summary-first-subject t)
7655 (gnus-summary-display-article (gnus-summary-article-number)))
7656 (gnus-summary-position-point)))
7658 (defun gnus-summary-first-unread-subject ()
7659 "Place the point on the subject line of the first unread article.
7660 Return nil if there are no unread articles."
7663 (when (gnus-summary-first-subject t)
7664 (gnus-summary-show-thread)
7665 (gnus-summary-first-subject t))
7666 (gnus-summary-position-point)))
7668 (defun gnus-summary-first-unseen-subject ()
7669 "Place the point on the subject line of the first unseen article.
7670 Return nil if there are no unseen articles."
7673 (when (gnus-summary-first-subject nil nil t)
7674 (gnus-summary-show-thread)
7675 (gnus-summary-first-subject nil nil t))
7676 (gnus-summary-position-point)))
7678 (defun gnus-summary-first-unseen-or-unread-subject ()
7679 "Place the point on the subject line of the first unseen article or,
7680 if all article have been seen, on the subject line of the first unread
7684 (unless (when (gnus-summary-first-subject nil nil t)
7685 (gnus-summary-show-thread)
7686 (gnus-summary-first-subject nil nil t))
7687 (when (gnus-summary-first-subject t)
7688 (gnus-summary-show-thread)
7689 (gnus-summary-first-subject t)))
7690 (gnus-summary-position-point)))
7692 (defun gnus-summary-first-article ()
7693 "Select the first article.
7694 Return nil if there are no articles."
7697 (when (gnus-summary-first-subject)
7698 (gnus-summary-show-thread)
7699 (gnus-summary-first-subject)
7700 (gnus-summary-display-article (gnus-summary-article-number)))
7701 (gnus-summary-position-point)))
7703 (defun gnus-summary-best-unread-article (&optional arg)
7704 "Select the unread article with the highest score.
7705 If given a prefix argument, select the next unread article that has a
7706 score higher than the default score."
7708 (let ((article (if arg
7709 (gnus-summary-better-unread-subject)
7710 (gnus-summary-best-unread-subject))))
7712 (gnus-summary-goto-article article)
7713 (error "No unread articles"))))
7715 (defun gnus-summary-best-unread-subject ()
7716 "Select the unread subject with the highest score."
7718 (let ((best -1000000)
7719 (data gnus-newsgroup-data)
7722 (and (gnus-data-unread-p (car data))
7724 (gnus-summary-article-score (gnus-data-number (car data))))
7727 article (gnus-data-number (car data))))
7728 (setq data (cdr data)))
7730 (gnus-summary-goto-subject article))
7731 (gnus-summary-position-point)
7734 (defun gnus-summary-better-unread-subject ()
7735 "Select the first unread subject that has a score over the default score."
7737 (let ((data gnus-newsgroup-data)
7739 (while (and (setq article (gnus-data-number (car data)))
7740 (or (gnus-data-read-p (car data))
7741 (not (> (gnus-summary-article-score article)
7742 gnus-summary-default-score))))
7743 (setq data (cdr data)))
7745 (gnus-summary-goto-subject article))
7746 (gnus-summary-position-point)
7749 (defun gnus-summary-last-subject ()
7750 "Go to the last displayed subject line in the group."
7751 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7753 (gnus-summary-goto-subject article))))
7755 (defun gnus-summary-goto-article (article &optional all-headers force)
7756 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7757 If ALL-HEADERS is non-nil, no header lines are hidden.
7758 If FORCE, go to the article even if it isn't displayed. If FORCE
7759 is a number, it is the line the article is to be displayed on."
7763 "Article number or Message-ID: "
7764 (mapcar (lambda (number) (list (int-to-string number)))
7765 gnus-newsgroup-limit))
7769 (if (and (stringp article)
7770 (string-match "@\\|%40" article))
7771 (gnus-summary-refer-article article)
7772 (when (stringp article)
7773 (setq article (string-to-number article)))
7774 (if (gnus-summary-goto-subject article force)
7775 (gnus-summary-display-article article all-headers)
7776 (gnus-message 4 "Couldn't go to article %s" article) nil))
7777 (gnus-summary-position-point)))
7779 (defun gnus-summary-goto-last-article ()
7780 "Go to the previously read article."
7783 (when gnus-last-article
7784 (gnus-summary-goto-article gnus-last-article nil t))
7785 (gnus-summary-position-point)))
7787 (defun gnus-summary-pop-article (number)
7788 "Pop one article off the history and go to the previous.
7789 NUMBER articles will be popped off."
7792 (setq gnus-newsgroup-history
7793 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7795 (gnus-summary-goto-article (car to) nil t)
7796 (error "Article history empty")))
7797 (gnus-summary-position-point))
7799 ;; Summary commands and functions for limiting the summary buffer.
7801 (defun gnus-summary-limit-to-articles (n)
7802 "Limit the summary buffer to the next N articles.
7803 If not given a prefix, use the process marked articles instead."
7806 (let ((articles (gnus-summary-work-articles n)))
7807 (setq gnus-newsgroup-processable nil)
7808 (gnus-summary-limit articles))
7809 (gnus-summary-position-point)))
7811 (defun gnus-summary-pop-limit (&optional total)
7812 "Restore the previous limit.
7813 If given a prefix, remove all limits."
7816 (setq gnus-newsgroup-limits
7817 (list (mapcar (lambda (h) (mail-header-number h))
7818 gnus-newsgroup-headers))))
7819 (unless gnus-newsgroup-limits
7820 (error "No limit to pop"))
7822 (gnus-summary-limit nil 'pop)
7823 (gnus-summary-position-point)))
7825 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7826 "Limit the summary buffer to articles that have subjects that match a regexp.
7827 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7829 (list (read-string (if current-prefix-arg
7830 "Exclude subject (regexp): "
7831 "Limit to subject (regexp): "))
7832 nil current-prefix-arg))
7834 (setq header "subject"))
7835 (when (not (equal "" subject))
7837 (let ((articles (gnus-summary-find-matching
7838 (or header "subject") subject 'all nil nil
7841 (error "Found no matches for \"%s\"" subject))
7842 (gnus-summary-limit articles))
7843 (gnus-summary-position-point))))
7845 (defun gnus-summary-limit-to-author (from &optional not-matching)
7846 "Limit the summary buffer to articles that have authors that match a regexp.
7847 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7849 (list (read-string (if current-prefix-arg
7850 "Exclude author (regexp): "
7851 "Limit to author (regexp): "))
7852 current-prefix-arg))
7853 (gnus-summary-limit-to-subject from "from" not-matching))
7855 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7856 "Limit the summary buffer to articles with the given RECIPIENT.
7858 If NOT-MATCHING, exclude RECIPIENT.
7860 To and Cc headers are checked. You need to include them in
7861 `nnmail-extra-headers'."
7862 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7864 (list (read-string (format "%s recipient (regexp): "
7865 (if current-prefix-arg "Exclude" "Limit to")))
7866 current-prefix-arg))
7867 (when (not (equal "" recipient))
7869 (if (memq 'To nnmail-extra-headers)
7870 (gnus-summary-find-matching
7871 (cons 'extra 'To) recipient 'all nil nil
7874 1 "`To' isn't present in `nnmail-extra-headers'")
7878 (if (memq 'Cc nnmail-extra-headers)
7879 (gnus-summary-find-matching
7880 (cons 'extra 'Cc) recipient 'all nil nil
7883 1 "`Cc' isn't present in `nnmail-extra-headers'")
7888 ;; We need the numbers that are in both lists:
7890 (and (memq a to) a))
7894 (error "Found no matches for \"%s\"" recipient))
7895 (gnus-summary-limit articles))
7896 (gnus-summary-position-point))))
7898 (defun gnus-summary-limit-to-age (age &optional younger-p)
7899 "Limit the summary buffer to articles that are older than (or equal) AGE days.
7900 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
7901 articles that are younger than AGE days."
7903 (let ((younger current-prefix-arg)
7906 (while (not days-got)
7907 (setq days (if younger
7908 (read-string "Limit to articles younger than (in days, older when negative): ")
7910 "Limit to articles older than (in days, younger when negative): ")))
7911 (when (> (length days) 0)
7912 (setq days (read days)))
7917 (setq younger (not younger))
7918 (setq days (* days -1))))
7919 (message "Please enter a number.")
7921 (list days younger)))
7923 (let ((data gnus-newsgroup-data)
7924 (cutoff (days-to-time age))
7925 articles d date is-younger)
7926 (while (setq d (pop data))
7927 (when (and (vectorp (gnus-data-header d))
7928 (setq date (mail-header-date (gnus-data-header d))))
7929 (setq is-younger (time-less-p
7930 (time-since (condition-case ()
7937 (push (gnus-data-number d) articles))))
7938 (gnus-summary-limit (nreverse articles)))
7939 (gnus-summary-position-point)))
7941 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
7942 "Limit the summary buffer to articles that match an 'extra' header."
7946 (gnus-completing-read-with-default
7947 (symbol-name (car gnus-extra-headers))
7948 (if current-prefix-arg
7949 "Exclude extra header"
7950 "Limit extra header")
7952 (cons (symbol-name x) x))
7957 (read-string (format "%s header %s (regexp): "
7958 (if current-prefix-arg "Exclude" "Limit to")
7960 current-prefix-arg)))
7961 (when (not (equal "" regexp))
7963 (let ((articles (gnus-summary-find-matching
7964 (cons 'extra header) regexp 'all nil nil
7967 (error "Found no matches for \"%s\"" regexp))
7968 (gnus-summary-limit articles))
7969 (gnus-summary-position-point))))
7971 (defun gnus-summary-limit-to-display-predicate ()
7972 "Limit the summary buffer to the predicated in the `display' group parameter."
7974 (unless gnus-newsgroup-display
7975 (error "There is no `display' group parameter"))
7977 (dolist (number gnus-newsgroup-articles)
7978 (when (funcall gnus-newsgroup-display)
7979 (push number articles)))
7980 (gnus-summary-limit articles))
7981 (gnus-summary-position-point))
7983 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7985 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
7987 (defun gnus-summary-limit-to-unread (&optional all)
7988 "Limit the summary buffer to articles that are not marked as read.
7989 If ALL is non-nil, limit strictly to unread articles."
7992 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
7993 (gnus-summary-limit-to-marks
7994 ;; Concat all the marks that say that an article is read and have
7996 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
7997 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
7998 gnus-low-score-mark gnus-expirable-mark
7999 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8000 gnus-duplicate-mark gnus-souped-mark)
8003 (defun gnus-summary-limit-to-bodies (match &optional reverse)
8004 "Limit the summary buffer to articles that have bodies that match MATCH.
8005 If REVERSE (the prefix), limit to articles that don't match."
8006 (interactive "sMatch body (regexp): \nP")
8007 (let ((articles nil)
8008 (gnus-select-article-hook nil) ;Disable hook.
8009 (gnus-article-prepare-hook nil)
8010 (gnus-use-article-prefetch nil)
8011 (gnus-keep-backlog nil)
8012 (gnus-break-pages nil)
8013 (gnus-summary-display-arrow nil)
8014 (gnus-updated-mode-lines nil)
8015 (gnus-auto-center-summary nil)
8016 (gnus-display-mime-function nil))
8017 (dolist (data gnus-newsgroup-data)
8018 (let (gnus-mark-article-hook)
8019 (gnus-summary-select-article t t nil (gnus-data-number data)))
8021 (set-buffer gnus-article-buffer)
8023 (let* ((case-fold-search t)
8024 (found (re-search-forward match nil t)))
8025 (when (or (and found
8029 (push (gnus-data-number data) articles)))))
8031 (message "No messages matched")
8032 (gnus-summary-limit articles)))
8033 (gnus-summary-position-point))
8035 (defun gnus-summary-limit-to-replied (&optional unreplied)
8036 "Limit the summary buffer to replied articles.
8037 If UNREPLIED (the prefix), limit to unreplied articles."
8041 (gnus-set-difference gnus-newsgroup-articles
8042 gnus-newsgroup-replied))
8043 (gnus-summary-limit gnus-newsgroup-replied))
8044 (gnus-summary-position-point))
8046 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8047 (make-obsolete 'gnus-summary-delete-marked-with
8048 'gnus-summary-limit-exclude-marks)
8050 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8051 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8052 If REVERSE, limit the summary buffer to articles that are marked
8053 with MARKS. MARKS can either be a string of marks or a list of marks.
8054 Returns how many articles were removed."
8055 (interactive "sMarks: ")
8056 (gnus-summary-limit-to-marks marks t))
8058 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8059 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8060 If REVERSE (the prefix), limit the summary buffer to articles that are
8061 not marked with MARKS. MARKS can either be a string of marks or a
8063 Returns how many articles were removed."
8064 (interactive "sMarks: \nP")
8066 (let ((data gnus-newsgroup-data)
8067 (marks (if (listp marks) marks
8068 (append marks nil))) ; Transform to list.
8071 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8072 (memq (gnus-data-mark (car data)) marks))
8073 (push (gnus-data-number (car data)) articles))
8074 (setq data (cdr data)))
8075 (gnus-summary-limit articles))
8076 (gnus-summary-position-point)))
8078 (defun gnus-summary-limit-to-score (score)
8079 "Limit to articles with score at or above SCORE."
8080 (interactive "NLimit to articles with score of at least: ")
8081 (let ((data gnus-newsgroup-data)
8084 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8086 (push (gnus-data-number (car data)) articles))
8087 (setq data (cdr data)))
8089 (gnus-summary-limit articles)
8090 (gnus-summary-position-point))))
8092 (defun gnus-summary-limit-to-unseen ()
8093 "Limit to unseen articles."
8096 (gnus-summary-limit gnus-newsgroup-unseen)
8097 (gnus-summary-position-point)))
8099 (defun gnus-summary-limit-include-thread (id)
8100 "Display all the hidden articles that is in the thread with ID in it.
8101 When called interactively, ID is the Message-ID of the current
8103 (interactive (list (mail-header-id (gnus-summary-article-header))))
8104 (let ((articles (gnus-articles-in-thread
8105 (gnus-id-to-thread (gnus-root-id id)))))
8107 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8108 (gnus-summary-limit-include-matching-articles
8110 (regexp-quote (gnus-simplify-subject-re
8111 (mail-header-subject (gnus-id-to-header id)))))
8112 (gnus-summary-position-point))))
8114 (defun gnus-summary-limit-include-matching-articles (header regexp)
8115 "Display all the hidden articles that have HEADERs that match REGEXP."
8116 (interactive (list (read-string "Match on header: ")
8117 (read-string "Regexp: ")))
8118 (let ((articles (gnus-find-matching-articles header regexp)))
8120 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8121 (gnus-summary-position-point))))
8123 (defun gnus-summary-insert-dormant-articles ()
8124 "Insert all the dormant articles for this group into the current buffer."
8126 (let ((gnus-verbose (max 6 gnus-verbose)))
8127 (if (not gnus-newsgroup-dormant)
8128 (gnus-message 3 "No cached articles for this group")
8129 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8131 (defun gnus-summary-limit-include-dormant ()
8132 "Display all the hidden articles that are marked as dormant.
8133 Note that this command only works on a subset of the articles currently
8134 fetched for this group."
8136 (unless gnus-newsgroup-dormant
8137 (error "There are no dormant articles in this group"))
8139 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8140 (gnus-summary-position-point)))
8142 (defun gnus-summary-limit-exclude-dormant ()
8143 "Hide all dormant articles."
8146 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8147 (gnus-summary-position-point)))
8149 (defun gnus-summary-limit-exclude-childless-dormant ()
8150 "Hide all dormant articles that have no children."
8152 (let ((data (gnus-data-list t))
8153 articles d children)
8154 ;; Find all articles that are either not dormant or have
8156 (while (setq d (pop data))
8157 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8159 (gnus-article-children (gnus-data-number d)))
8162 (when (memq (car children) articles)
8167 (push (gnus-data-number d) articles)))
8170 (gnus-summary-limit articles)
8171 (gnus-summary-position-point))))
8173 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8174 "Mark all unread excluded articles as read.
8175 If ALL, mark even excluded ticked and dormants as read."
8177 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8178 (let ((articles (gnus-sorted-ndifference
8180 (mapcar (lambda (h) (mail-header-number h))
8181 gnus-newsgroup-headers)
8183 gnus-newsgroup-limit))
8185 (setq gnus-newsgroup-unreads
8186 (gnus-sorted-intersection gnus-newsgroup-unreads
8187 gnus-newsgroup-limit))
8189 (setq gnus-newsgroup-dormant nil
8190 gnus-newsgroup-marked nil
8191 gnus-newsgroup-reads
8193 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8194 gnus-newsgroup-reads))
8195 (while (setq article (pop articles))
8196 (unless (or (memq article gnus-newsgroup-dormant)
8197 (memq article gnus-newsgroup-marked))
8198 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8200 (defun gnus-summary-limit (articles &optional pop)
8202 ;; We pop the previous limit off the stack and use that.
8203 (setq articles (car gnus-newsgroup-limits)
8204 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8205 ;; We use the new limit, so we push the old limit on the stack.
8206 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8208 (setq gnus-newsgroup-limit articles)
8209 (let ((total (length gnus-newsgroup-data))
8210 (data (gnus-data-find-list (gnus-summary-article-number)))
8211 (gnus-summary-mark-below nil) ; Inhibit this.
8213 ;; This will do all the work of generating the new summary buffer
8214 ;; according to the new limit.
8215 (gnus-summary-prepare)
8216 ;; Hide any threads, possibly.
8217 (gnus-summary-maybe-hide-threads)
8218 ;; Try to return to the article you were at, or one in the
8221 ;; We try to find some article after the current one.
8223 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8226 (setq data (cdr data))))
8228 ;; If there is no data, that means that we were after the last
8229 ;; article. The same goes when we can't find any articles
8230 ;; after the current one.
8231 (goto-char (point-max))
8232 (gnus-summary-find-prev))
8233 (gnus-set-mode-line 'summary)
8234 ;; We return how many articles were removed from the summary
8235 ;; buffer as a result of the new limit.
8236 (- total (length gnus-newsgroup-data))))
8238 (defsubst gnus-invisible-cut-children (threads)
8241 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8246 (defsubst gnus-cut-thread (thread)
8247 "Go forwards in the thread until we find an article that we want to display."
8248 (when (or (eq gnus-fetch-old-headers 'some)
8249 (eq gnus-fetch-old-headers 'invisible)
8250 (numberp gnus-fetch-old-headers)
8251 (eq gnus-build-sparse-threads 'some)
8252 (eq gnus-build-sparse-threads 'more))
8253 ;; Deal with old-fetched headers and sparse threads.
8257 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8258 (gnus-summary-article-ancient-p
8259 (mail-header-number (car thread))))
8260 (if (or (<= (length (cdr thread)) 1)
8261 (eq gnus-fetch-old-headers 'invisible))
8262 (setq gnus-newsgroup-limit
8263 (delq (mail-header-number (car thread))
8264 gnus-newsgroup-limit)
8265 thread (cadr thread))
8266 (when (gnus-invisible-cut-children (cdr thread))
8267 (let ((th (cdr thread)))
8269 (if (memq (mail-header-number (caar th))
8270 gnus-newsgroup-limit)
8271 (setq thread (car th)
8273 (setq th (cdr th))))))))))
8276 (defun gnus-cut-threads (threads)
8277 "Cut off all uninteresting articles from the beginning of THREADS."
8278 (when (or (eq gnus-fetch-old-headers 'some)
8279 (eq gnus-fetch-old-headers 'invisible)
8280 (numberp gnus-fetch-old-headers)
8281 (eq gnus-build-sparse-threads 'some)
8282 (eq gnus-build-sparse-threads 'more))
8285 (setcar th (gnus-cut-thread (car th)))
8286 (setq th (cdr th)))))
8287 ;; Remove nixed out threads.
8290 (defun gnus-summary-initial-limit (&optional show-if-empty)
8291 "Figure out what the initial limit is supposed to be on group entry.
8292 This entails weeding out unwanted dormants, low-scored articles,
8293 fetch-old-headers verbiage, and so on."
8294 ;; Most groups have nothing to remove.
8295 (if (or gnus-inhibit-limiting
8296 (and (null gnus-newsgroup-dormant)
8297 (eq gnus-newsgroup-display 'gnus-not-ignore)
8298 (not (eq gnus-fetch-old-headers 'some))
8299 (not (numberp gnus-fetch-old-headers))
8300 (not (eq gnus-fetch-old-headers 'invisible))
8301 (null gnus-summary-expunge-below)
8302 (not (eq gnus-build-sparse-threads 'some))
8303 (not (eq gnus-build-sparse-threads 'more))
8304 (null gnus-thread-expunge-below)
8305 (not gnus-use-nocem)))
8307 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8308 (setq gnus-newsgroup-limit nil)
8311 (unless (car (symbol-value node))
8312 ;; These threads have no parents -- they are roots.
8313 (let ((nodes (cdr (symbol-value node)))
8316 (if (and gnus-thread-expunge-below
8317 (< (gnus-thread-total-score (car nodes))
8318 gnus-thread-expunge-below))
8319 (gnus-expunge-thread (pop nodes))
8320 (setq thread (pop nodes))
8321 (gnus-summary-limit-children thread))))))
8322 gnus-newsgroup-dependencies)
8323 ;; If this limitation resulted in an empty group, we might
8324 ;; pop the previous limit and use it instead.
8325 (when (and (not gnus-newsgroup-limit)
8327 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8328 gnus-newsgroup-limit))
8330 (defun gnus-summary-limit-children (thread)
8331 "Return 1 if this subthread is visible and 0 if it is not."
8332 ;; First we get the number of visible children to this thread. This
8333 ;; is done by recursing down the thread using this function, so this
8334 ;; will really go down to a leaf article first, before slowly
8335 ;; working its way up towards the root.
8337 (let* ((max-lisp-eval-depth 5000)
8340 (apply '+ (mapcar 'gnus-summary-limit-children
8343 (number (mail-header-number (car thread)))
8346 (not (memq number gnus-newsgroup-marked))
8348 ;; If this article is dormant and has absolutely no visible
8349 ;; children, then this article isn't visible.
8350 (and (memq number gnus-newsgroup-dormant)
8352 ;; If this is "fetch-old-headered" and there is no
8353 ;; visible children, then we don't want this article.
8354 (and (or (eq gnus-fetch-old-headers 'some)
8355 (numberp gnus-fetch-old-headers))
8356 (gnus-summary-article-ancient-p number)
8358 ;; If this is "fetch-old-headered" and `invisible', then
8359 ;; we don't want this article.
8360 (and (eq gnus-fetch-old-headers 'invisible)
8361 (gnus-summary-article-ancient-p number))
8362 ;; If this is a sparsely inserted article with no children,
8363 ;; we don't want it.
8364 (and (eq gnus-build-sparse-threads 'some)
8365 (gnus-summary-article-sparse-p number)
8367 ;; If we use expunging, and this article is really
8368 ;; low-scored, then we don't want this article.
8369 (when (and gnus-summary-expunge-below
8371 (or (cdr (assq number gnus-newsgroup-scored))
8372 gnus-summary-default-score))
8373 gnus-summary-expunge-below))
8374 ;; We increase the expunge-tally here, but that has
8375 ;; nothing to do with the limits, really.
8376 (incf gnus-newsgroup-expunged-tally)
8377 ;; We also mark as read here, if that's wanted.
8378 (when (and gnus-summary-mark-below
8379 (< score gnus-summary-mark-below))
8380 (setq gnus-newsgroup-unreads
8381 (delq number gnus-newsgroup-unreads))
8382 (if gnus-newsgroup-auto-expire
8383 (push number gnus-newsgroup-expirable)
8384 (push (cons number gnus-low-score-mark)
8385 gnus-newsgroup-reads)))
8387 ;; Do the `display' group parameter.
8388 (and gnus-newsgroup-display
8389 (not (funcall gnus-newsgroup-display)))
8390 ;; Check NoCeM things.
8391 (when (and gnus-use-nocem
8392 (gnus-nocem-unwanted-article-p
8393 (mail-header-id (car thread))))
8394 (setq gnus-newsgroup-unreads
8395 (delq number gnus-newsgroup-unreads))
8397 ;; Nope, invisible article.
8399 ;; Ok, this article is to be visible, so we add it to the limit
8401 (push number gnus-newsgroup-limit)
8404 (defun gnus-expunge-thread (thread)
8405 "Mark all articles in THREAD as read."
8406 (let* ((number (mail-header-number (car thread))))
8407 (incf gnus-newsgroup-expunged-tally)
8408 ;; We also mark as read here, if that's wanted.
8409 (setq gnus-newsgroup-unreads
8410 (delq number gnus-newsgroup-unreads))
8411 (if gnus-newsgroup-auto-expire
8412 (push number gnus-newsgroup-expirable)
8413 (push (cons number gnus-low-score-mark)
8414 gnus-newsgroup-reads)))
8415 ;; Go recursively through all subthreads.
8416 (mapcar 'gnus-expunge-thread (cdr thread)))
8418 ;; Summary article oriented commands
8420 (defun gnus-summary-refer-parent-article (n)
8421 "Refer parent article N times.
8422 If N is negative, go to ancestor -N instead.
8423 The difference between N and the number of articles fetched is returned."
8427 (when (not (natnump n))
8432 (setq header (gnus-summary-article-header))
8433 (if (and (eq (mail-header-number header)
8434 (cdr gnus-article-current))
8435 (equal gnus-newsgroup-name
8436 (car gnus-article-current)))
8437 ;; If we try to find the parent of the currently
8438 ;; displayed article, then we take a look at the actual
8439 ;; References header, since this is slightly more
8440 ;; reliable than the References field we got from the
8443 (set-buffer gnus-original-article-buffer)
8444 (nnheader-narrow-to-headers)
8445 (unless (setq ref (message-fetch-field "references"))
8446 (when (setq ref (message-fetch-field "in-reply-to"))
8447 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8450 ;; It's not the current article, so we take a bet on
8451 ;; the value we got from the server.
8452 (mail-header-references header)))
8454 (not (equal ref "")))
8455 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8456 (gnus-message 1 "Couldn't find parent"))
8457 (gnus-message 1 "No references in article %d"
8458 (gnus-summary-article-number))
8461 (gnus-summary-position-point)
8464 (defun gnus-summary-refer-references ()
8465 "Fetch all articles mentioned in the References header.
8466 Return the number of articles fetched."
8468 (let ((ref (mail-header-references (gnus-summary-article-header)))
8469 (current (gnus-summary-article-number))
8473 (error "No References in the current article")
8474 ;; For each Message-ID in the References header...
8475 (while (string-match "<[^>]*>" ref)
8477 ;; ... fetch that article.
8478 (gnus-summary-refer-article
8479 (prog1 (match-string 0 ref)
8480 (setq ref (substring ref (match-end 0))))))
8481 (gnus-summary-goto-subject current)
8482 (gnus-summary-position-point)
8485 (defun gnus-summary-refer-thread (&optional limit)
8486 "Fetch all articles in the current thread.
8487 If LIMIT (the numerical prefix), fetch that many old headers instead
8488 of what's specified by the `gnus-refer-thread-limit' variable."
8490 (let ((id (mail-header-id (gnus-summary-article-header)))
8491 (limit (if limit (prefix-numeric-value limit)
8492 gnus-refer-thread-limit)))
8493 (unless (eq gnus-fetch-old-headers 'invisible)
8494 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8495 ;; Retrieve the headers and read them in.
8496 (if (eq (if (numberp limit)
8497 (gnus-retrieve-headers
8499 (+ (mail-header-number
8500 (gnus-summary-article-header))
8502 gnus-newsgroup-end))
8503 gnus-newsgroup-name (* limit 2))
8504 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8506 (gnus-retrieve-headers (list gnus-newsgroup-end)
8507 gnus-newsgroup-name limit))
8509 (gnus-build-all-threads)
8510 (error "Can't fetch thread from back ends that don't support NOV"))
8511 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8512 (gnus-summary-limit-include-thread id)))
8514 (defun gnus-summary-refer-article (message-id)
8515 "Fetch an article specified by MESSAGE-ID."
8516 (interactive "sMessage-ID: ")
8517 (when (and (stringp message-id)
8518 (not (zerop (length message-id))))
8519 (setq message-id (gnus-replace-in-string message-id " " ""))
8520 ;; Construct the correct Message-ID if necessary.
8521 ;; Suggested by tale@pawl.rpi.edu.
8522 (unless (string-match "^<" message-id)
8523 (setq message-id (concat "<" message-id)))
8524 (unless (string-match ">$" message-id)
8525 (setq message-id (concat message-id ">")))
8526 ;; People often post MIDs from URLs, so unhex it:
8527 (unless (string-match "@" message-id)
8528 (setq message-id (gnus-url-unhex-string message-id)))
8529 (let* ((header (gnus-id-to-header message-id))
8531 (gnus-summary-article-sparse-p
8532 (mail-header-number header))
8533 (memq (mail-header-number header)
8534 gnus-newsgroup-limit)))
8537 ;; If the article is present in the buffer we just go to it.
8539 (or (not (gnus-summary-article-sparse-p
8540 (mail-header-number header)))
8543 (gnus-summary-goto-article
8544 (mail-header-number header) nil t)
8546 (gnus-summary-update-article (mail-header-number header)))))
8548 ;; We fetch the article.
8550 (dolist (gnus-override-method (gnus-refer-article-methods))
8551 (when (and (gnus-check-server gnus-override-method)
8552 ;; Fetch the header,
8553 (setq number (gnus-summary-insert-subject message-id)))
8554 ;; and display the article.
8555 (gnus-summary-select-article nil nil nil number)
8557 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8559 (defun gnus-refer-article-methods ()
8560 "Return a list of referable methods."
8562 ;; No method, so we default to current and native.
8563 ((null gnus-refer-article-method)
8564 (list gnus-current-select-method gnus-select-method))
8566 ((eq 'current gnus-refer-article-method)
8567 (list gnus-current-select-method))
8568 ;; List of select methods.
8569 ((not (and (symbolp (car gnus-refer-article-method))
8570 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8572 (dolist (method gnus-refer-article-method)
8573 (push (if (eq 'current method)
8574 gnus-current-select-method
8578 ;; One single select method.
8580 (list gnus-refer-article-method))))
8582 (defun gnus-summary-edit-parameters ()
8583 "Edit the group parameters of the current group."
8585 (gnus-group-edit-group gnus-newsgroup-name 'params))
8587 (defun gnus-summary-customize-parameters ()
8588 "Customize the group parameters of the current group."
8590 (gnus-group-customize gnus-newsgroup-name))
8592 (defun gnus-summary-enter-digest-group (&optional force)
8593 "Enter an nndoc group based on the current article.
8594 If FORCE, force a digest interpretation. If not, try
8595 to guess what the document format is."
8597 (let ((conf gnus-current-window-configuration))
8598 (save-window-excursion
8600 (let (gnus-article-prepare-hook
8601 gnus-display-mime-function
8603 (gnus-summary-select-article))))
8604 (setq gnus-current-window-configuration conf)
8605 (let* ((name (format "%s-%d"
8606 (gnus-group-prefixed-name
8607 gnus-newsgroup-name (list 'nndoc ""))
8608 (with-current-buffer gnus-summary-buffer
8609 gnus-current-article)))
8610 (ogroup gnus-newsgroup-name)
8611 (params (append (gnus-info-params (gnus-get-info ogroup))
8612 (list (cons 'to-group ogroup))
8613 (list (cons 'parent-group ogroup))
8614 (list (cons 'save-article-group ogroup))))
8615 (case-fold-search t)
8616 (buf (current-buffer))
8619 (set-buffer gnus-original-article-buffer)
8620 ;; Have the digest group inherit the main mail address of
8621 ;; the parent article.
8622 (when (setq to-address (or (gnus-fetch-field "reply-to")
8623 (gnus-fetch-field "from")))
8624 (setq params (append
8625 (list (cons 'to-address
8626 (funcall gnus-decode-encoded-word-function
8628 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8629 (insert-buffer-substring gnus-original-article-buffer)
8630 ;; Remove lines that may lead nndoc to misinterpret the
8633 (goto-char (point-min))
8634 (or (search-forward "\n\n" nil t) (point)))
8635 (goto-char (point-min))
8636 (delete-matching-lines "^Path:\\|^From ")
8639 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8640 (gnus-newsgroup-ephemeral-ignored-charsets
8641 gnus-newsgroup-ignored-charsets))
8642 (gnus-group-read-ephemeral-group
8643 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8645 ,(if force 'mbox 'guess)))
8647 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8649 ;; Make all postings to this group go to the parent group.
8650 (nconc (gnus-info-params (gnus-get-info name))
8652 ;; Couldn't select this doc group.
8653 (switch-to-buffer buf)
8654 (gnus-set-global-variables)
8655 (gnus-configure-windows 'summary)
8656 (gnus-message 3 "Article couldn't be entered?"))
8657 (kill-buffer dig)))))
8659 (defun gnus-summary-read-document (n)
8660 "Open a new group based on the current article(s).
8661 This will allow you to read digests and other similar
8662 documents as newsgroups.
8663 Obeys the standard process/prefix convention."
8665 (let* ((ogroup gnus-newsgroup-name)
8666 (params (append (gnus-info-params (gnus-get-info ogroup))
8667 (list (cons 'to-group ogroup))))
8668 group egroup groups vgroup)
8669 (dolist (article (gnus-summary-work-articles n))
8670 (setq group (format "%s-%d" gnus-newsgroup-name article))
8671 (gnus-summary-remove-process-mark article)
8672 (when (gnus-summary-display-article article)
8675 (insert-buffer-substring gnus-original-article-buffer)
8676 ;; Remove some headers that may lead nndoc to make
8678 (message-narrow-to-head)
8679 (goto-char (point-min))
8680 (delete-matching-lines "^Path:\\|^From ")
8683 (gnus-group-read-ephemeral-group
8684 group `(nndoc ,group (nndoc-address ,(current-buffer))
8685 (nndoc-article-type guess))
8688 ;; Make all postings to this group go to the parent group.
8689 (nconc (gnus-info-params (gnus-get-info egroup))
8691 (push egroup groups))
8692 ;; Couldn't select this doc group.
8693 (gnus-error 3 "Article couldn't be entered"))))))
8694 ;; Now we have selected all the documents.
8697 (error "None of the articles could be interpreted as documents"))
8698 ((gnus-group-read-ephemeral-group
8699 (setq vgroup (format
8700 "nnvirtual:%s-%s" gnus-newsgroup-name
8701 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8702 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8704 (cons (current-buffer) 'summary)))
8706 (error "Couldn't select virtual nndoc group")))))
8708 (defun gnus-summary-isearch-article (&optional regexp-p)
8709 "Do incremental search forward on the current article.
8710 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8712 (gnus-summary-select-article)
8713 (gnus-configure-windows 'article)
8714 (gnus-eval-in-buffer-window gnus-article-buffer
8717 (isearch-forward regexp-p))))
8719 (defun gnus-summary-repeat-search-article-forward ()
8720 "Repeat the previous search forwards."
8722 (unless gnus-last-search-regexp
8723 (error "No previous search"))
8724 (gnus-summary-search-article-forward gnus-last-search-regexp))
8726 (defun gnus-summary-repeat-search-article-backward ()
8727 "Repeat the previous search backwards."
8729 (unless gnus-last-search-regexp
8730 (error "No previous search"))
8731 (gnus-summary-search-article-forward gnus-last-search-regexp t))
8733 (defun gnus-summary-search-article-forward (regexp &optional backward)
8734 "Search for an article containing REGEXP forward.
8735 If BACKWARD, search backward instead."
8738 (format "Search article %s (regexp%s): "
8739 (if current-prefix-arg "backward" "forward")
8740 (if gnus-last-search-regexp
8741 (concat ", default " gnus-last-search-regexp)
8743 current-prefix-arg))
8744 (if (string-equal regexp "")
8745 (setq regexp (or gnus-last-search-regexp ""))
8746 (setq gnus-last-search-regexp regexp)
8747 (setq gnus-article-before-search gnus-current-article))
8748 ;; Intentionally set gnus-last-article.
8749 (setq gnus-last-article gnus-article-before-search)
8750 (let ((gnus-last-article gnus-last-article))
8751 (if (gnus-summary-search-article regexp backward)
8752 (gnus-summary-show-thread)
8753 (signal 'search-failed (list regexp)))))
8755 (defun gnus-summary-search-article-backward (regexp)
8756 "Search for an article containing REGEXP backward."
8759 (format "Search article backward (regexp%s): "
8760 (if gnus-last-search-regexp
8761 (concat ", default " gnus-last-search-regexp)
8763 (gnus-summary-search-article-forward regexp 'backward))
8765 (defun gnus-summary-search-article (regexp &optional backward)
8766 "Search for an article containing REGEXP.
8767 Optional argument BACKWARD means do search for backward.
8768 `gnus-select-article-hook' is not called during the search."
8769 ;; We have to require this here to make sure that the following
8770 ;; dynamic binding isn't shadowed by autoloading.
8771 (require 'gnus-async)
8773 (let ((gnus-select-article-hook nil) ;Disable hook.
8774 (gnus-article-prepare-hook nil)
8775 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8776 (gnus-use-article-prefetch nil)
8777 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8778 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8780 (gnus-keep-backlog nil)
8781 (gnus-break-pages nil)
8782 (gnus-summary-display-arrow nil)
8783 (gnus-updated-mode-lines nil)
8784 (gnus-auto-center-summary nil)
8785 (sum (current-buffer))
8786 (gnus-display-mime-function nil)
8789 (gnus-save-hidden-threads
8790 (gnus-summary-select-article)
8791 (set-buffer gnus-article-buffer)
8792 (goto-char (window-point (get-buffer-window (current-buffer))))
8796 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8798 (re-search-backward regexp nil t)
8799 (re-search-forward regexp nil t))
8800 ;; We found the regexp.
8805 (get-buffer-window (current-buffer))
8809 (get-buffer-window (current-buffer))
8812 (setq point (point)))
8813 ;; We didn't find it, so we go to the next article.
8816 (while (eq found 'not)
8817 (if (not (if backward (gnus-summary-find-prev)
8818 (gnus-summary-find-next)))
8819 ;; No more articles.
8821 ;; Select the next article and adjust point.
8822 (unless (gnus-summary-article-sparse-p
8823 (gnus-summary-article-number))
8825 (gnus-summary-select-article)
8826 (set-buffer gnus-article-buffer)
8828 (goto-char (if backward (point-max) (point-min))))))))
8829 (gnus-message 7 ""))
8830 ;; Return whether we found the regexp.
8831 (when (eq found 'found)
8833 (gnus-summary-show-thread)
8834 (gnus-summary-goto-subject gnus-current-article)
8835 (gnus-summary-position-point)
8838 (defun gnus-find-matching-articles (header regexp)
8839 "Return a list of all articles that match REGEXP on HEADER.
8840 This search includes all articles in the current group that Gnus has
8841 fetched headers for, whether they are displayed or not."
8842 (let ((articles nil)
8843 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
8844 (case-fold-search t))
8845 (dolist (header gnus-newsgroup-headers)
8846 (when (string-match regexp (funcall func header))
8847 (push (mail-header-number header) articles)))
8848 (nreverse articles)))
8850 (defun gnus-summary-find-matching (header regexp &optional backward unread
8851 not-case-fold not-matching)
8852 "Return a list of all articles that match REGEXP on HEADER.
8853 The search stars on the current article and goes forwards unless
8854 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
8855 If UNREAD is non-nil, only unread articles will
8856 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
8857 in the comparisons. If NOT-MATCHING, return a list of all articles that
8858 not match REGEXP on HEADER."
8859 (let ((case-fold-search (not not-case-fold))
8862 (if (eq (car header) 'extra)
8865 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
8867 (error "%s is an invalid header" header))
8868 (unless (fboundp (intern (concat "mail-header-" header)))
8869 (error "%s is not a valid header" header))
8870 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
8871 (dolist (d (if (eq backward 'all)
8873 (gnus-data-find-list
8874 (gnus-summary-article-number)
8875 (gnus-data-list backward))))
8876 (when (and (or (not unread) ; We want all articles...
8877 (gnus-data-unread-p d)) ; Or just unreads.
8878 (vectorp (gnus-data-header d)) ; It's not a pseudo.
8882 (funcall func (gnus-data-header d))))
8883 (string-match regexp
8884 (funcall func (gnus-data-header d)))))
8885 (push (gnus-data-number d) articles))) ; Success!
8886 (nreverse articles)))
8888 (defun gnus-summary-execute-command (header regexp command &optional backward)
8889 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
8890 If HEADER is an empty string (or nil), the match is done on the entire
8891 article. If BACKWARD (the prefix) is non-nil, search backward instead."
8893 (list (let ((completion-ignore-case t))
8896 (mapcar (lambda (header) (list (format "%s" header)))
8898 '("Number" "Subject" "From" "Lines" "Date"
8899 "Message-ID" "Xref" "References" "Body")
8900 gnus-extra-headers))
8901 nil 'require-match))
8902 (read-string "Regexp: ")
8903 (read-key-sequence "Command: ")
8904 current-prefix-arg))
8905 (when (equal header "Body")
8907 ;; Hidden thread subtrees must be searched as well.
8908 (gnus-summary-show-all-threads)
8909 ;; We don't want to change current point nor window configuration.
8911 (save-window-excursion
8913 gnus-treat-strip-trailing-blank-lines
8914 gnus-treat-strip-leading-blank-lines
8915 gnus-treat-strip-multiple-blank-lines
8916 gnus-treat-hide-boring-headers
8917 gnus-treat-fold-newsgroups
8918 gnus-article-prepare-hook)
8919 (gnus-message 6 "Executing %s..." (key-description command))
8920 ;; We'd like to execute COMMAND interactively so as to give arguments.
8921 (gnus-execute header regexp
8922 `(call-interactively ',(key-binding command))
8924 (gnus-message 6 "Executing %s...done" (key-description command))))))
8926 (defun gnus-summary-beginning-of-article ()
8927 "Scroll the article back to the beginning."
8929 (gnus-summary-select-article)
8930 (gnus-configure-windows 'article)
8931 (gnus-eval-in-buffer-window gnus-article-buffer
8933 (goto-char (point-min))
8934 (when gnus-break-pages
8935 (gnus-narrow-to-page))))
8937 (defun gnus-summary-end-of-article ()
8938 "Scroll to the end of the article."
8940 (gnus-summary-select-article)
8941 (gnus-configure-windows 'article)
8942 (gnus-eval-in-buffer-window gnus-article-buffer
8944 (goto-char (point-max))
8946 (when gnus-break-pages
8947 (when (re-search-backward page-delimiter nil t)
8948 (narrow-to-region (match-end 0) (point-max)))
8949 (gnus-narrow-to-page))))
8951 (defun gnus-summary-print-truncate-and-quote (string &optional len)
8952 "Truncate to LEN and quote all \"(\"'s in STRING."
8953 (gnus-replace-in-string (if (and len (> (length string) len))
8954 (substring string 0 len)
8958 (defun gnus-summary-print-article (&optional filename n)
8959 "Generate and print a PostScript image of the process-marked (mail) articles.
8961 If used interactively, print the current article if none are
8962 process-marked. With prefix arg, prompt the user for the name of the
8965 When used from Lisp, accept two optional args FILENAME and N. N means
8966 to print the next N articles. If N is negative, print the N previous
8967 articles. If N is nil and articles have been marked with the process
8968 mark, print these instead.
8970 If the optional first argument FILENAME is nil, send the image to the
8971 printer. If FILENAME is a string, save the PostScript image in a file with
8972 that name. If FILENAME is a number, prompt the user for the name of the file
8974 (interactive (list (ps-print-preprint current-prefix-arg)))
8975 (dolist (article (gnus-summary-work-articles n))
8976 (gnus-summary-select-article nil nil 'pseudo article)
8977 (gnus-eval-in-buffer-window gnus-article-buffer
8978 (gnus-print-buffer))
8979 (gnus-summary-remove-process-mark article))
8980 (ps-despool filename))
8982 (defun gnus-print-buffer ()
8983 (let ((buffer (generate-new-buffer " *print*")))
8986 (copy-to-buffer buffer (point-min) (point-max))
8988 (gnus-remove-text-with-property 'gnus-decoration)
8989 (when (gnus-visual-p 'article-highlight 'highlight)
8990 ;; Copy-to-buffer doesn't copy overlay. So redo
8992 (let ((gnus-article-buffer buffer))
8993 (gnus-article-highlight-citation t)
8994 (gnus-article-highlight-signature)
8995 (gnus-article-emphasize)
8996 (gnus-article-delete-invisible-text)))
8997 (let ((ps-left-header
9000 (gnus-summary-print-truncate-and-quote
9001 (mail-header-subject gnus-current-headers)
9004 (gnus-summary-print-truncate-and-quote
9005 (mail-header-from gnus-current-headers)
9009 "/pagenumberstring load"
9011 (mail-header-date gnus-current-headers) ")"))))
9012 (gnus-run-hooks 'gnus-ps-print-hook)
9015 (ps-spool-buffer-with-faces)
9016 (ps-spool-buffer)))))
9017 (kill-buffer buffer))))
9019 (defun gnus-summary-show-article (&optional arg)
9020 "Force redisplaying of the current article.
9021 If ARG (the prefix) is a number, show the article with the charset
9022 defined in `gnus-summary-show-article-charset-alist', or the charset
9024 If ARG (the prefix) is non-nil and not a number, show the raw article
9025 without any article massaging functions being run. Normally, the key
9026 strokes are `C-u g'."
9030 (gnus-summary-show-article t)
9031 (let ((gnus-newsgroup-charset
9032 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9033 (mm-read-coding-system
9034 "View as charset: " ;; actually it is coding system.
9035 (with-current-buffer gnus-article-buffer
9036 (mm-detect-coding-region (point) (point-max))))))
9037 (gnus-newsgroup-ignored-charsets 'gnus-all))
9038 (gnus-summary-select-article nil 'force)
9039 (let ((deps gnus-newsgroup-dependencies)
9042 (set-buffer gnus-original-article-buffer)
9044 (message-narrow-to-head)
9045 (setq head (buffer-string))
9046 (goto-char (point-min))
9047 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9048 (goto-char (point-max))
9050 (setq lines (1- (count-lines (point) (point-max))))))
9052 (insert (format "211 %d Article retrieved.\n"
9053 (cdr gnus-article-current)))
9055 (if lines (insert (format "Lines: %d\n" lines)))
9057 (let ((nntp-server-buffer (current-buffer)))
9058 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9059 (gnus-data-set-header
9060 (gnus-data-find (cdr gnus-article-current))
9062 (gnus-summary-update-article-line
9063 (cdr gnus-article-current) header)
9064 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9065 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9067 ;; Select the article the normal way.
9068 (gnus-summary-select-article nil 'force))
9070 ;; We have to require this here to make sure that the following
9071 ;; dynamic binding isn't shadowed by autoloading.
9072 (require 'gnus-async)
9074 ;; Bind the article treatment functions to nil.
9075 (let ((gnus-have-all-headers t)
9076 gnus-article-prepare-hook
9077 gnus-article-decode-hook
9078 gnus-display-mime-function
9080 ;; Destroy any MIME parts.
9081 (when (gnus-buffer-live-p gnus-article-buffer)
9083 (set-buffer gnus-article-buffer)
9084 (mm-destroy-parts gnus-article-mime-handles)
9085 ;; Set it to nil for safety reason.
9086 (setq gnus-article-mime-handle-alist nil)
9087 (setq gnus-article-mime-handles nil)))
9088 (gnus-summary-select-article nil 'force))))
9089 (gnus-summary-goto-subject gnus-current-article)
9090 (gnus-summary-position-point))
9092 (defun gnus-summary-show-raw-article ()
9093 "Show the raw article without any article massaging functions being run."
9095 (gnus-summary-show-article t))
9097 (defun gnus-summary-verbose-headers (&optional arg)
9098 "Toggle permanent full header display.
9099 If ARG is a positive number, turn header display on.
9100 If ARG is a negative number, turn header display off."
9102 (setq gnus-show-all-headers
9103 (cond ((or (not (numberp arg))
9105 (not gnus-show-all-headers))
9108 (gnus-summary-show-article))
9110 (defun gnus-summary-toggle-header (&optional arg)
9111 "Show the headers if they are hidden, or hide them if they are shown.
9112 If ARG is a positive number, show the entire header.
9113 If ARG is a negative number, hide the unwanted header lines."
9115 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9116 (get-buffer-window gnus-article-buffer t))))
9117 (with-current-buffer gnus-article-buffer
9119 (article-narrow-to-head)
9120 (let* ((buffer-read-only nil)
9121 (inhibit-point-motion-hooks t)
9122 (hidden (if (numberp arg)
9124 (or (not (looking-at "[^ \t\n]+:"))
9125 (gnus-article-hidden-text-p 'headers))))
9127 (delete-region (point-min) (point-max))
9128 (with-current-buffer gnus-original-article-buffer
9129 (goto-char (setq s (point-min)))
9130 (setq e (if (search-forward "\n\n" nil t)
9133 (insert-buffer-substring gnus-original-article-buffer s e)
9134 (run-hooks 'gnus-article-decode-hook)
9136 (let ((gnus-treat-hide-headers nil)
9137 (gnus-treat-hide-boring-headers nil))
9138 (gnus-delete-wash-type 'headers)
9139 (gnus-treat-article 'head))
9140 (gnus-treat-article 'head))
9143 (set-window-start window (goto-char (point-min))))
9144 (if gnus-break-pages
9145 (gnus-narrow-to-page)
9146 (when (gnus-visual-p 'page-marker)
9147 (let ((buffer-read-only nil))
9148 (gnus-remove-text-with-property 'gnus-prev)
9149 (gnus-remove-text-with-property 'gnus-next))))
9150 (gnus-set-mode-line 'article)))))
9152 (defun gnus-summary-show-all-headers ()
9153 "Make all header lines visible."
9155 (gnus-summary-toggle-header 1))
9157 (defun gnus-summary-caesar-message (&optional arg)
9158 "Caesar rotate the current article by 13.
9159 The numerical prefix specifies how many places to rotate each letter
9162 (gnus-summary-select-article)
9163 (let ((mail-header-separator ""))
9164 (gnus-eval-in-buffer-window gnus-article-buffer
9167 (let ((start (window-start))
9169 (message-caesar-buffer-body arg)
9170 (set-window-start (get-buffer-window (current-buffer)) start)))))
9171 ;; Create buttons and stuff...
9172 (gnus-treat-article nil))
9174 (defun gnus-summary-idna-message (&optional arg)
9175 "Decode IDNA encoded domain names in the current articles.
9176 IDNA encoded domain names looks like `xn--bar'. If a string
9177 remain unencoded after running this function, it is likely an
9178 invalid IDNA string (`xn--bar' is invalid).
9180 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9181 installed for this command to work."
9183 (if (not (and (condition-case nil (require 'idna)
9185 (mm-coding-system-p 'utf-8)
9186 (executable-find (symbol-value 'idna-program))))
9188 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9189 (gnus-summary-select-article)
9190 (let ((mail-header-separator ""))
9191 (gnus-eval-in-buffer-window gnus-article-buffer
9194 (let ((start (window-start))
9196 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9197 (replace-match (idna-to-unicode (match-string 1))))
9198 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9200 (defun gnus-summary-morse-message (&optional arg)
9201 "Morse decode the current article."
9203 (gnus-summary-select-article)
9204 (let ((mail-header-separator ""))
9205 (gnus-eval-in-buffer-window gnus-article-buffer
9209 (let ((pos (window-start))
9211 (goto-char (point-min))
9212 (when (message-goto-body)
9213 (gnus-narrow-to-body))
9214 (goto-char (point-min))
9215 (while (search-forward "·" (point-max) t)
9216 (replace-match "."))
9217 (unmorse-region (point-min) (point-max))
9219 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9221 (defun gnus-summary-stop-page-breaking ()
9222 "Stop page breaking in the current article."
9224 (gnus-summary-select-article)
9225 (gnus-eval-in-buffer-window gnus-article-buffer
9227 (when (gnus-visual-p 'page-marker)
9228 (let ((buffer-read-only nil))
9229 (gnus-remove-text-with-property 'gnus-prev)
9230 (gnus-remove-text-with-property 'gnus-next))
9231 (setq gnus-page-broken nil))))
9233 (defun gnus-summary-move-article (&optional n to-newsgroup
9234 select-method action)
9235 "Move the current article to a different newsgroup.
9236 If N is a positive number, move the N next articles.
9237 If N is a negative number, move the N previous articles.
9238 If N is nil and any articles have been marked with the process mark,
9239 move those articles instead.
9240 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9241 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9242 re-spool using this method.
9244 When called interactively with TO-NEWSGROUP being nil, the value of
9245 the variable `gnus-move-split-methods' is used for finding a default
9246 for the target newsgroup.
9248 For this function to work, both the current newsgroup and the
9249 newsgroup that you want to move to have to support the `request-move'
9250 and `request-accept' functions.
9252 ACTION can be either `move' (the default), `crosspost' or `copy'."
9255 (setq action 'move))
9256 ;; Check whether the source group supports the required functions.
9257 (cond ((and (eq action 'move)
9258 (not (gnus-check-backend-function
9259 'request-move-article gnus-newsgroup-name)))
9260 (error "The current group does not support article moving"))
9261 ((and (eq action 'crosspost)
9262 (not (gnus-check-backend-function
9263 'request-replace-article gnus-newsgroup-name)))
9264 (error "The current group does not support article editing")))
9265 (let ((articles (gnus-summary-work-articles n))
9266 (prefix (if (gnus-check-backend-function
9267 'request-move-article gnus-newsgroup-name)
9268 (funcall gnus-move-group-prefix-function
9269 gnus-newsgroup-name)
9271 (names '((move "Move" "Moving")
9272 (copy "Copy" "Copying")
9273 (crosspost "Crosspost" "Crossposting")))
9274 (copy-buf (save-excursion
9275 (nnheader-set-temp-buffer " *copy article*")))
9276 art-group to-method new-xref article to-groups articles-to-update-marks)
9277 (unless (assq action names)
9278 (error "Unknown action %s" action))
9279 ;; Read the newsgroup name.
9280 (when (and (not to-newsgroup)
9281 (not select-method))
9282 (if (and gnus-move-split-methods
9284 (and (memq gnus-current-article articles)
9285 (gnus-buffer-live-p gnus-original-article-buffer))))
9286 ;; When `gnus-move-split-methods' is non-nil, we have to
9287 ;; select an article to give `gnus-read-move-group-name' an
9288 ;; opportunity to suggest an appropriate default. However,
9289 ;; we needn't render or mark the article.
9290 (let ((gnus-display-mime-function nil)
9291 (gnus-article-prepare-hook nil)
9292 (gnus-mark-article-hook nil))
9293 (gnus-summary-select-article nil nil nil (car articles))))
9295 (gnus-read-move-group-name
9296 (cadr (assq action names))
9297 (symbol-value (intern (format "gnus-current-%s-group" action)))
9299 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9300 (setq to-method (or select-method
9301 (gnus-server-to-method
9302 (gnus-group-method to-newsgroup))))
9303 ;; Check the method we are to move this article to...
9304 (unless (gnus-check-backend-function
9305 'request-accept-article (car to-method))
9306 (error "%s does not support article copying" (car to-method)))
9307 (unless (gnus-check-server to-method)
9308 (error "Can't open server %s" (car to-method)))
9309 (gnus-message 6 "%s to %s: %s..."
9310 (caddr (assq action names))
9311 (or (car select-method) to-newsgroup) articles)
9313 (setq article (pop articles))
9317 ;; Move the article.
9319 ;; Remove this article from future suppression.
9320 (gnus-dup-unsuppress-article article)
9321 (let* ((from-method (gnus-find-method-for-group
9322 gnus-newsgroup-name))
9323 (to-method (gnus-find-method-for-group
9325 (move-is-internal (gnus-method-equal from-method to-method)))
9326 (gnus-request-move-article
9327 article ; Article to move
9328 gnus-newsgroup-name ; From newsgroup
9329 (nth 1 (gnus-find-method-for-group
9330 gnus-newsgroup-name)) ; Server
9331 (list 'gnus-request-accept-article
9332 to-newsgroup (list 'quote select-method)
9333 (not articles) t) ; Accept form
9334 (not articles) ; Only save nov last time
9335 move-is-internal))) ; is this move internal?
9336 ;; Copy the article.
9339 (set-buffer copy-buf)
9340 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9342 (nnheader-narrow-to-headers)
9343 (dolist (hdr gnus-copy-article-ignored-headers)
9344 (message-remove-header hdr t)))
9345 (gnus-request-accept-article
9346 to-newsgroup select-method (not articles) t))))
9347 ;; Crosspost the article.
9348 ((eq action 'crosspost)
9349 (let ((xref (message-tokenize-header
9350 (mail-header-xref (gnus-summary-article-header article))
9352 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9353 ":" (number-to-string article)))
9355 (setq xref (list (system-name))))
9358 (mapconcat 'identity
9359 (delete "Xref:" (delete new-xref xref))
9363 (set-buffer copy-buf)
9364 ;; First put the article in the destination group.
9365 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9366 (when (consp (setq art-group
9367 (gnus-request-accept-article
9368 to-newsgroup select-method (not articles))))
9369 (setq new-xref (concat new-xref " " (car art-group)
9371 (number-to-string (cdr art-group))))
9372 ;; Now we have the new Xrefs header, so we insert
9373 ;; it and replace the new article.
9374 (nnheader-replace-header "Xref" new-xref)
9375 (gnus-request-replace-article
9376 (cdr art-group) to-newsgroup (current-buffer))
9380 (gnus-message 1 "Couldn't %s article %s: %s"
9381 (cadr (assq action names)) article
9382 (nnheader-get-report (car to-method))))
9383 ((eq art-group 'junk)
9384 (when (eq action 'move)
9385 (gnus-summary-mark-article article gnus-canceled-mark)
9386 (gnus-message 4 "Deleted article %s" article)
9387 ;; run the delete hook
9388 (run-hook-with-args 'gnus-summary-article-delete-hook
9391 (assoc article (gnus-data-list nil)))
9392 gnus-newsgroup-name nil
9395 (let* ((pto-group (gnus-group-prefixed-name
9396 (car art-group) to-method))
9397 (info (gnus-get-info pto-group))
9398 (to-group (gnus-info-group info))
9400 ;; Update the group that has been moved to.
9402 (memq action '(move copy)))
9403 (unless (member to-group to-groups)
9404 (push to-group to-groups))
9406 (unless (memq article gnus-newsgroup-unreads)
9407 (push 'read to-marks)
9409 info (gnus-add-to-range (gnus-info-read info)
9410 (list (cdr art-group)))))
9412 ;; See whether the article is to be put in the cache.
9413 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9414 gnus-article-mark-lists
9415 (delete '(expirable . expire)
9416 (copy-sequence gnus-article-mark-lists))))
9417 (to-article (cdr art-group)))
9419 ;; Enter the article into the cache in the new group,
9420 ;; if that is required.
9421 (when gnus-use-cache
9422 (gnus-cache-possibly-enter-article
9424 (memq article gnus-newsgroup-marked)
9425 (memq article gnus-newsgroup-dormant)
9426 (memq article gnus-newsgroup-unreads)))
9428 (when gnus-preserve-marks
9429 ;; Copy any marks over to the new group.
9430 (when (and (equal to-group gnus-newsgroup-name)
9431 (not (memq article gnus-newsgroup-unreads)))
9432 ;; Mark this article as read in this group.
9433 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9434 (setcdr (gnus-active to-group) to-article)
9435 (setcdr gnus-newsgroup-active to-article))
9438 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9439 (when (memq article (symbol-value
9440 (intern (format "gnus-newsgroup-%s"
9442 (push (cdar marks) to-marks)
9443 ;; If the other group is the same as this group,
9444 ;; then we have to add the mark to the list.
9445 (when (equal to-group gnus-newsgroup-name)
9446 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9449 (intern (format "gnus-newsgroup-%s"
9451 ;; Copy the marks to other group.
9452 (gnus-add-marked-articles
9453 to-group (cdar marks) (list to-article) info)))
9454 (setq marks (cdr marks)))
9456 (gnus-request-set-mark
9457 to-group (list (list (list to-article) 'add to-marks))))
9460 (concat "(gnus-group-set-info '"
9461 (gnus-prin1-to-string (gnus-get-info to-group))
9464 ;; Update the Xref header in this article to point to
9465 ;; the new crossposted article we have just created.
9466 (when (eq action 'crosspost)
9468 (set-buffer copy-buf)
9469 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9470 (nnheader-replace-header "Xref" new-xref)
9471 (gnus-request-replace-article
9472 article gnus-newsgroup-name (current-buffer))))
9474 ;; run the move/copy/crosspost/respool hook
9475 (run-hook-with-args 'gnus-summary-article-move-hook
9478 (assoc article (gnus-data-list nil)))
9483 ;;;!!!Why is this necessary?
9484 (set-buffer gnus-summary-buffer)
9486 (gnus-summary-goto-subject article)
9487 (when (eq action 'move)
9488 (gnus-summary-mark-article article gnus-canceled-mark))))
9489 (push article articles-to-update-marks))
9491 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9492 ;; Re-activate all groups that have been moved to.
9494 (set-buffer gnus-group-buffer)
9495 (let ((gnus-group-marked to-groups))
9496 (gnus-group-get-new-news-this-group nil t)))
9498 (gnus-kill-buffer copy-buf)
9499 (gnus-summary-position-point)
9500 (gnus-set-mode-line 'summary)))
9502 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9503 "Copy the current article to some other group.
9504 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9505 When called interactively, if TO-NEWSGROUP is nil, use the value of
9506 the variable `gnus-move-split-methods' for finding a default target
9508 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9509 re-spool using this method."
9511 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9513 (defun gnus-summary-crosspost-article (&optional n)
9514 "Crosspost the current article to some other group."
9516 (gnus-summary-move-article n nil nil 'crosspost))
9518 (defcustom gnus-summary-respool-default-method nil
9519 "Default method type for respooling an article.
9520 If nil, use to the current newsgroup method."
9522 :group 'gnus-summary-mail)
9524 (defcustom gnus-summary-display-while-building nil
9525 "If non-nil, show and update the summary buffer as it's being built.
9526 If the value is t, update the buffer after every line is inserted. If
9527 the value is an integer (N), update the display every N lines."
9530 :type '(choice (const :tag "off" nil)
9532 (const :tag "frequently" t)))
9534 (defun gnus-summary-respool-article (&optional n method)
9535 "Respool the current article.
9536 The article will be squeezed through the mail spooling process again,
9537 which means that it will be put in some mail newsgroup or other
9538 depending on `nnmail-split-methods'.
9539 If N is a positive number, respool the N next articles.
9540 If N is a negative number, respool the N previous articles.
9541 If N is nil and any articles have been marked with the process mark,
9542 respool those articles instead.
9544 Respooling can be done both from mail groups and \"real\" newsgroups.
9545 In the former case, the articles in question will be moved from the
9546 current group into whatever groups they are destined to. In the
9547 latter case, they will be copied into the relevant groups."
9549 (list current-prefix-arg
9550 (let* ((methods (gnus-methods-using 'respool))
9552 (symbol-name (or gnus-summary-respool-default-method
9553 (car (gnus-find-method-for-group
9554 gnus-newsgroup-name)))))
9556 (gnus-completing-read-with-default
9557 methname "Backend to use when respooling"
9558 methods nil t nil 'gnus-mail-method-history))
9561 ((zerop (length (setq ms (gnus-servers-using-backend
9563 (list (intern method) ""))
9567 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9568 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9571 (error "No method given for respooling"))
9572 (if (assoc (symbol-name
9573 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9574 (gnus-methods-using 'respool))
9575 (gnus-summary-move-article n nil method)
9576 (gnus-summary-copy-article n nil method)))
9578 (defun gnus-summary-import-article (file &optional edit)
9579 "Import an arbitrary file into a mail newsgroup."
9580 (interactive "fImport file: \nP")
9581 (let ((group gnus-newsgroup-name)
9582 (now (current-time))
9583 atts lines group-art)
9584 (unless (gnus-check-backend-function 'request-accept-article group)
9585 (error "%s does not support article importing" group))
9586 (or (file-readable-p file)
9587 (not (file-regular-p file))
9588 (error "Can't read %s" file))
9590 (set-buffer (gnus-get-buffer-create " *import file*"))
9592 (nnheader-insert-file-contents file)
9593 (goto-char (point-min))
9594 (if (nnheader-article-p)
9596 (goto-char (point-min))
9597 (search-forward "\n\n" nil t)
9598 (narrow-to-region (point-min) (1- (point)))
9599 (goto-char (point-min))
9600 (unless (re-search-forward "^date:" nil t)
9601 (goto-char (point-max))
9602 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9603 ;; This doesn't look like an article, so we fudge some headers.
9604 (setq atts (file-attributes file)
9605 lines (count-lines (point-min) (point-max)))
9606 (insert "From: " (read-string "From: ") "\n"
9607 "Subject: " (read-string "Subject: ") "\n"
9608 "Date: " (message-make-date (nth 5 atts)) "\n"
9609 "Message-ID: " (message-make-message-id) "\n"
9610 "Lines: " (int-to-string lines) "\n"
9611 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9612 (setq group-art (gnus-request-accept-article group nil t))
9613 (kill-buffer (current-buffer)))
9614 (setq gnus-newsgroup-active (gnus-activate-group group))
9616 (gnus-summary-goto-article (cdr group-art) nil t)
9618 (gnus-summary-edit-article))))
9620 (defun gnus-summary-create-article ()
9621 "Create an article in a mail newsgroup."
9623 (let ((group gnus-newsgroup-name)
9624 (now (current-time))
9626 (unless (gnus-check-backend-function 'request-accept-article group)
9627 (error "%s does not support article importing" group))
9629 (set-buffer (gnus-get-buffer-create " *import file*"))
9631 (goto-char (point-min))
9632 ;; This doesn't look like an article, so we fudge some headers.
9633 (insert "From: " (read-string "From: ") "\n"
9634 "Subject: " (read-string "Subject: ") "\n"
9635 "Date: " (message-make-date now) "\n"
9636 "Message-ID: " (message-make-message-id) "\n")
9637 (setq group-art (gnus-request-accept-article group nil t))
9638 (kill-buffer (current-buffer)))
9639 (setq gnus-newsgroup-active (gnus-activate-group group))
9641 (gnus-summary-goto-article (cdr group-art) nil t)
9642 (gnus-summary-edit-article)))
9644 (defun gnus-summary-article-posted-p ()
9645 "Say whether the current (mail) article is available from news as well.
9646 This will be the case if the article has both been mailed and posted."
9648 (let ((id (mail-header-references (gnus-summary-article-header)))
9649 (gnus-override-method (car (gnus-refer-article-methods))))
9650 (if (gnus-request-head id "")
9651 (gnus-message 2 "The current message was found on %s"
9652 gnus-override-method)
9653 (gnus-message 2 "The current message couldn't be found on %s"
9654 gnus-override-method)
9657 (defun gnus-summary-expire-articles (&optional now)
9658 "Expire all articles that are marked as expirable in the current group."
9660 (when (and (not gnus-group-is-exiting-without-update-p)
9661 (gnus-check-backend-function
9662 'request-expire-articles gnus-newsgroup-name))
9663 ;; This backend supports expiry.
9664 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9665 (expirable (if total
9667 ;; We need to update the info for
9668 ;; this group for `gnus-list-of-read-articles'
9669 ;; to give us the right answer.
9670 (gnus-run-hooks 'gnus-exit-group-hook)
9671 (gnus-summary-update-info)
9672 (gnus-list-of-read-articles gnus-newsgroup-name))
9673 (setq gnus-newsgroup-expirable
9674 (sort gnus-newsgroup-expirable '<))))
9675 (expiry-wait (if now 'immediate
9676 (gnus-group-find-parameter
9677 gnus-newsgroup-name 'expiry-wait)))
9678 (nnmail-expiry-target
9679 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9680 nnmail-expiry-target))
9683 ;; There are expirable articles in this group, so we run them
9684 ;; through the expiry process.
9685 (gnus-message 6 "Expiring articles...")
9686 (unless (gnus-check-group gnus-newsgroup-name)
9687 (error "Can't open server for %s" gnus-newsgroup-name))
9688 ;; The list of articles that weren't expired is returned.
9691 (let ((nnmail-expiry-wait-function nil)
9692 (nnmail-expiry-wait expiry-wait))
9693 (setq es (gnus-request-expire-articles
9694 expirable gnus-newsgroup-name)))
9695 (setq es (gnus-request-expire-articles
9696 expirable gnus-newsgroup-name)))
9698 (setq gnus-newsgroup-expirable es))
9699 ;; We go through the old list of expirable, and mark all
9700 ;; really expired articles as nonexistent.
9701 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9702 (let ((gnus-use-cache nil))
9703 (dolist (article expirable)
9704 (when (and (not (memq article es))
9705 (gnus-data-find article))
9706 (gnus-summary-mark-article article gnus-canceled-mark)
9707 (run-hook-with-args 'gnus-summary-article-expire-hook
9710 (assoc article (gnus-data-list nil)))
9714 (gnus-message 6 "Expiring articles...done")))))
9716 (defun gnus-summary-expire-articles-now ()
9717 "Expunge all expirable articles in the current group.
9718 This means that *all* articles that are marked as expirable will be
9719 deleted forever, right now."
9721 (or gnus-expert-user
9723 "Are you really, really sure you want to delete all expirable messages? ")
9725 (gnus-summary-expire-articles t))
9727 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9728 (defun gnus-summary-delete-article (&optional n)
9729 "Delete the N next (mail) articles.
9730 This command actually deletes articles. This is not a marking
9731 command. The article will disappear forever from your life, never to
9734 If N is negative, delete backwards.
9735 If N is nil and articles have been marked with the process mark,
9736 delete these instead.
9738 If `gnus-novice-user' is non-nil you will be asked for
9739 confirmation before the articles are deleted."
9741 (unless (gnus-check-backend-function 'request-expire-articles
9742 gnus-newsgroup-name)
9743 (error "The current newsgroup does not support article deletion"))
9744 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9745 (error "Couldn't open server"))
9746 ;; Compute the list of articles to delete.
9747 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9748 (nnmail-expiry-target 'delete)
9750 (if (and gnus-novice-user
9751 (not (gnus-yes-or-no-p
9752 (format "Do you really want to delete %s forever? "
9753 (if (> (length articles) 1)
9754 (format "these %s articles" (length articles))
9757 ;; Delete the articles.
9758 (setq not-deleted (gnus-request-expire-articles
9759 articles gnus-newsgroup-name 'force))
9761 (gnus-summary-remove-process-mark (car articles))
9762 ;; The backend might not have been able to delete the article
9764 (unless (memq (car articles) not-deleted)
9765 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9766 (let* ((article (car articles))
9767 (ghead (gnus-data-header
9768 (assoc article (gnus-data-list nil)))))
9769 (run-hook-with-args 'gnus-summary-article-delete-hook
9770 'delete ghead gnus-newsgroup-name nil
9772 (setq articles (cdr articles)))
9774 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9775 (gnus-summary-position-point)
9776 (gnus-set-mode-line 'summary)
9779 (defun gnus-summary-edit-article (&optional arg)
9780 "Edit the current article.
9781 This will have permanent effect only in mail groups.
9782 If ARG is nil, edit the decoded articles.
9783 If ARG is 1, edit the raw articles.
9784 If ARG is 2, edit the raw articles even in read-only groups.
9785 If ARG is 3, edit the articles with the current handles.
9786 Otherwise, allow editing of articles even in read-only
9789 (let (force raw current-handles)
9798 (setq current-handles
9799 (and (gnus-buffer-live-p gnus-article-buffer)
9800 (with-current-buffer gnus-article-buffer
9802 gnus-article-mime-handles
9803 (setq gnus-article-mime-handles nil))))))
9806 (when (and raw (not force)
9807 (member gnus-newsgroup-name '("nndraft:delayed"
9810 (error "Can't edit the raw article in group %s"
9811 gnus-newsgroup-name))
9813 (set-buffer gnus-summary-buffer)
9814 (let ((mail-parse-charset gnus-newsgroup-charset)
9815 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9816 (gnus-set-global-variables)
9817 (when (and (not force)
9818 (gnus-group-read-only-p))
9819 (error "The current newsgroup does not support article editing"))
9820 (gnus-summary-show-article t)
9821 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9822 (with-current-buffer gnus-article-buffer
9823 (mm-enable-multibyte)))
9824 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
9826 (gnus-article-edit-article
9829 (let ((mbl mml-buffer-list))
9830 (setq mml-buffer-list nil)
9831 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
9832 (mime-to-mml ,'current-handles))
9833 (let ((mbl1 mml-buffer-list))
9834 (setq mml-buffer-list mbl)
9835 (set (make-local-variable 'mml-buffer-list) mbl1))
9836 (gnus-make-local-hook 'kill-buffer-hook)
9837 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
9838 `(lambda (no-highlight)
9839 (let ((mail-parse-charset ',gnus-newsgroup-charset)
9840 (message-options message-options)
9841 (message-options-set-recipient)
9842 (mail-parse-ignored-charsets
9843 ',gnus-newsgroup-ignored-charsets))
9844 ,(if (not raw) '(progn
9846 (mml-destroy-buffers)
9847 (remove-hook 'kill-buffer-hook
9848 'mml-destroy-buffers t)
9849 (kill-local-variable 'mml-buffer-list)))
9850 (gnus-summary-edit-article-done
9851 ,(or (mail-header-references gnus-current-headers) "")
9852 ,(gnus-group-read-only-p)
9853 ,gnus-summary-buffer no-highlight))))))))
9855 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
9857 (defun gnus-summary-edit-article-done (&optional references read-only buffer
9859 "Make edits to the current article permanent."
9862 ;; The buffer restriction contains the entire article if it exists.
9863 (when (article-goto-body)
9864 (let ((lines (count-lines (point) (point-max)))
9865 (length (- (point-max) (point)))
9866 (case-fold-search t)
9867 (body (copy-marker (point))))
9868 (goto-char (point-min))
9869 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
9870 (delete-region (match-beginning 1) (match-end 1))
9871 (insert (number-to-string length)))
9872 (goto-char (point-min))
9873 (when (re-search-forward
9874 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
9875 (delete-region (match-beginning 1) (match-end 1))
9876 (insert (number-to-string length)))
9877 (goto-char (point-min))
9878 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
9879 (delete-region (match-beginning 1) (match-end 1))
9880 (insert (number-to-string lines))))))
9881 ;; Replace the article.
9882 (let ((buf (current-buffer)))
9884 (insert-buffer-substring buf)
9886 (if (and (not read-only)
9887 (not (gnus-request-replace-article
9888 (cdr gnus-article-current) (car gnus-article-current)
9889 (current-buffer) t)))
9890 (error "Couldn't replace article")
9891 ;; Update the summary buffer.
9893 (equal (message-tokenize-header references " ")
9894 (message-tokenize-header
9895 (or (message-fetch-field "references") "") " ")))
9896 ;; We only have to update this line.
9899 (message-narrow-to-head)
9900 (let ((head (buffer-substring-no-properties
9901 (point-min) (point-max)))
9904 (insert (format "211 %d Article retrieved.\n"
9905 (cdr gnus-article-current)))
9908 (let ((nntp-server-buffer (current-buffer)))
9909 (setq header (car (gnus-get-newsgroup-headers
9912 (set-buffer gnus-summary-buffer)
9913 (gnus-data-set-header
9914 (gnus-data-find (cdr gnus-article-current))
9916 (gnus-summary-update-article-line
9917 (cdr gnus-article-current) header)
9918 (if (gnus-summary-goto-subject
9919 (cdr gnus-article-current) nil t)
9920 (gnus-summary-update-secondary-mark
9921 (cdr gnus-article-current))))))))
9923 (set-buffer (or buffer gnus-summary-buffer))
9924 (gnus-summary-update-article (cdr gnus-article-current))
9925 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9926 (gnus-summary-update-secondary-mark
9927 (cdr gnus-article-current))))
9928 ;; Prettify the article buffer again.
9929 (unless no-highlight
9931 (set-buffer gnus-article-buffer)
9932 ;;;!!! Fix this -- article should be rehighlighted.
9933 ;;;(gnus-run-hooks 'gnus-article-display-hook)
9934 (set-buffer gnus-original-article-buffer)
9935 (gnus-request-article
9936 (cdr gnus-article-current)
9937 (car gnus-article-current) (current-buffer))))
9938 ;; Prettify the summary buffer line.
9939 (when (gnus-visual-p 'summary-highlight 'highlight)
9940 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
9942 (defun gnus-summary-edit-wash (key)
9943 "Perform editing command KEY in the article buffer."
9947 (message "%s" (concat (this-command-keys) "- "))
9950 (gnus-summary-edit-article)
9951 (execute-kbd-macro (concat (this-command-keys) key))
9952 (gnus-article-edit-done))
9956 (defun gnus-summary-respool-query (&optional silent trace)
9957 "Query where the respool algorithm would put this article."
9959 (let (gnus-mark-article-hook)
9960 (gnus-summary-select-article)
9962 (set-buffer gnus-original-article-buffer)
9963 (let ((groups (nnmail-article-group 'identity trace)))
9966 (message "This message would go to %s"
9967 (mapconcat 'car groups ", "))
9968 (message "This message would go to no groups"))
9971 (defun gnus-summary-respool-trace ()
9972 "Trace where the respool algorithm would put this article.
9973 Display a buffer showing all fancy splitting patterns which matched."
9975 (gnus-summary-respool-query nil t))
9977 ;; Summary marking commands.
9979 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
9980 "Mark articles which has the same subject as read, and then select the next.
9981 If UNMARK is positive, remove any kind of mark.
9982 If UNMARK is negative, tick articles."
9985 (setq unmark (prefix-numeric-value unmark)))
9987 (gnus-summary-mark-same-subject
9988 (gnus-summary-article-subject) unmark)))
9989 ;; Select next unread article. If auto-select-same mode, should
9990 ;; select the first unread article.
9991 (gnus-summary-next-article t (and gnus-auto-select-same
9992 (gnus-summary-article-subject)))
9993 (gnus-message 7 "%d article%s marked as %s"
9994 count (if (= count 1) " is" "s are")
9995 (if unmark "unread" "read"))))
9997 (defun gnus-summary-kill-same-subject (&optional unmark)
9998 "Mark articles which has the same subject as read.
9999 If UNMARK is positive, remove any kind of mark.
10000 If UNMARK is negative, tick articles."
10003 (setq unmark (prefix-numeric-value unmark)))
10005 (gnus-summary-mark-same-subject
10006 (gnus-summary-article-subject) unmark)))
10007 ;; If marked as read, go to next unread subject.
10008 (when (null unmark)
10009 ;; Go to next unread subject.
10010 (gnus-summary-next-subject 1 t))
10011 (gnus-message 7 "%d articles are marked as %s"
10012 count (if unmark "unread" "read"))))
10014 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10015 "Mark articles with same SUBJECT as read, and return marked number.
10016 If optional argument UNMARK is positive, remove any kinds of marks.
10017 If optional argument UNMARK is negative, mark articles as unread instead."
10021 ((null unmark) ; Mark as read.
10024 (gnus-summary-mark-article-as-read gnus-killed-mark)
10025 (gnus-summary-show-thread) t)
10026 (gnus-summary-find-subject subject))
10027 (setq count (1+ count))))
10028 ((> unmark 0) ; Tick.
10031 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10032 (gnus-summary-show-thread) t)
10033 (gnus-summary-find-subject subject))
10034 (setq count (1+ count))))
10035 (t ; Mark as unread.
10038 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10039 (gnus-summary-show-thread) t)
10040 (gnus-summary-find-subject subject))
10041 (setq count (1+ count)))))
10042 (gnus-set-mode-line 'summary)
10043 ;; Return the number of marked articles.
10046 (defun gnus-summary-mark-as-processable (n &optional unmark)
10047 "Set the process mark on the next N articles.
10048 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10049 the process mark instead. The difference between N and the actual
10050 number of articles marked is returned."
10052 (if (and (null n) (gnus-region-active-p))
10053 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10054 (setq n (prefix-numeric-value n))
10055 (let ((backward (< n 0))
10060 (gnus-summary-remove-process-mark
10061 (gnus-summary-article-number))
10062 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10063 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10066 (gnus-message 7 "No more articles"))
10067 (gnus-summary-recenter)
10068 (gnus-summary-position-point)
10071 (defun gnus-summary-unmark-as-processable (n)
10072 "Remove the process mark from the next N articles.
10073 If N is negative, unmark backward instead. The difference between N and
10074 the actual number of articles unmarked is returned."
10076 (gnus-summary-mark-as-processable n t))
10078 (defun gnus-summary-unmark-all-processable ()
10079 "Remove the process mark from all articles."
10082 (while gnus-newsgroup-processable
10083 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10084 (gnus-summary-position-point))
10086 (defun gnus-summary-add-mark (article type)
10087 "Mark ARTICLE with a mark of TYPE."
10088 (let ((vtype (car (assq type gnus-article-mark-lists)))
10091 (error "No such mark type: %s" type)
10092 (setq var (intern (format "gnus-newsgroup-%s" type)))
10093 (set var (cons article (symbol-value var)))
10094 (if (memq type '(processable cached replied forwarded recent saved))
10095 (gnus-summary-update-secondary-mark article)
10096 ;;; !!! This is bogus. We should find out what primary
10097 ;;; !!! mark we want to set.
10098 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10100 (defun gnus-summary-mark-as-expirable (n)
10101 "Mark N articles forward as expirable.
10102 If N is negative, mark backward instead. The difference between N and
10103 the actual number of articles marked is returned."
10105 (gnus-summary-mark-forward n gnus-expirable-mark))
10107 (defun gnus-summary-mark-as-spam (n)
10108 "Mark N articles forward as spam.
10109 If N is negative, mark backward instead. The difference between N and
10110 the actual number of articles marked is returned."
10112 (gnus-summary-mark-forward n gnus-spam-mark))
10114 (defun gnus-summary-mark-article-as-replied (article)
10115 "Mark ARTICLE as replied to and update the summary line.
10116 ARTICLE can also be a list of articles."
10117 (interactive (list (gnus-summary-article-number)))
10118 (let ((articles (if (listp article) article (list article))))
10119 (dolist (article articles)
10120 (unless (numberp article)
10121 (error "%s is not a number" article))
10122 (push article gnus-newsgroup-replied)
10123 (let ((buffer-read-only nil))
10124 (when (gnus-summary-goto-subject article nil t)
10125 (gnus-summary-update-secondary-mark article))))))
10127 (defun gnus-summary-mark-article-as-forwarded (article)
10128 "Mark ARTICLE as forwarded and update the summary line.
10129 ARTICLE can also be a list of articles."
10130 (let ((articles (if (listp article) article (list article))))
10131 (dolist (article articles)
10132 (push article gnus-newsgroup-forwarded)
10133 (let ((buffer-read-only nil))
10134 (when (gnus-summary-goto-subject article nil t)
10135 (gnus-summary-update-secondary-mark article))))))
10137 (defun gnus-summary-set-bookmark (article)
10138 "Set a bookmark in current article."
10139 (interactive (list (gnus-summary-article-number)))
10140 (when (or (not (get-buffer gnus-article-buffer))
10141 (not gnus-current-article)
10142 (not gnus-article-current)
10143 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10144 (error "No current article selected"))
10145 ;; Remove old bookmark, if one exists.
10146 (gnus-pull article gnus-newsgroup-bookmarks)
10147 ;; Set the new bookmark, which is on the form
10148 ;; (article-number . line-number-in-body).
10151 (with-current-buffer gnus-article-buffer
10155 (article-goto-body)
10158 gnus-newsgroup-bookmarks)
10159 (gnus-message 6 "A bookmark has been added to the current article."))
10161 (defun gnus-summary-remove-bookmark (article)
10162 "Remove the bookmark from the current article."
10163 (interactive (list (gnus-summary-article-number)))
10164 ;; Remove old bookmark, if one exists.
10165 (if (not (assq article gnus-newsgroup-bookmarks))
10166 (gnus-message 6 "No bookmark in current article.")
10167 (gnus-pull article gnus-newsgroup-bookmarks)
10168 (gnus-message 6 "Removed bookmark.")))
10170 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10171 (defun gnus-summary-mark-as-dormant (n)
10172 "Mark N articles forward as dormant.
10173 If N is negative, mark backward instead. The difference between N and
10174 the actual number of articles marked is returned."
10176 (gnus-summary-mark-forward n gnus-dormant-mark))
10178 (defun gnus-summary-set-process-mark (article)
10179 "Set the process mark on ARTICLE and update the summary line."
10180 (setq gnus-newsgroup-processable
10182 (delq article gnus-newsgroup-processable)))
10183 (when (gnus-summary-goto-subject article)
10184 (gnus-summary-show-thread)
10185 (gnus-summary-goto-subject article)
10186 (gnus-summary-update-secondary-mark article)))
10188 (defun gnus-summary-remove-process-mark (&rest articles)
10189 "Remove the process mark from ARTICLES and update the summary line."
10190 (dolist (article articles)
10191 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10192 (when (gnus-summary-goto-subject article)
10193 (gnus-summary-show-thread)
10194 (gnus-summary-goto-subject article)
10195 (gnus-summary-update-secondary-mark article)))
10198 (defun gnus-summary-set-saved-mark (article)
10199 "Set the process mark on ARTICLE and update the summary line."
10200 (push article gnus-newsgroup-saved)
10201 (when (gnus-summary-goto-subject article)
10202 (gnus-summary-update-secondary-mark article)))
10204 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10205 "Mark N articles as read forwards.
10206 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10207 The difference between N and the actual number of articles marked is
10209 If NO-EXPIRE, auto-expiry will be inhibited."
10211 (gnus-summary-show-thread)
10212 (let ((backward (< n 0))
10213 (gnus-summary-goto-unread
10214 (and gnus-summary-goto-unread
10215 (not (eq gnus-summary-goto-unread 'never))
10216 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10217 gnus-ticked-mark gnus-dormant-mark)))))
10219 (mark (or mark gnus-del-mark)))
10220 (while (and (> n 0)
10221 (gnus-summary-mark-article nil mark no-expire)
10222 (zerop (gnus-summary-next-subject
10224 (and gnus-summary-goto-unread
10225 (not (eq gnus-summary-goto-unread 'never)))
10229 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10230 (gnus-summary-recenter)
10231 (gnus-summary-position-point)
10232 (gnus-set-mode-line 'summary)
10235 (defun gnus-summary-mark-article-as-read (mark)
10236 "Mark the current article quickly as read with MARK."
10237 (let ((article (gnus-summary-article-number)))
10238 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10239 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10240 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10241 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10242 (push (cons article mark) gnus-newsgroup-reads)
10243 ;; Possibly remove from cache, if that is used.
10244 (when gnus-use-cache
10245 (gnus-cache-enter-remove-article article))
10246 ;; Allow the backend to change the mark.
10247 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10248 ;; Check for auto-expiry.
10249 (when (and gnus-newsgroup-auto-expire
10250 (memq mark gnus-auto-expirable-marks))
10251 (setq mark gnus-expirable-mark)
10252 ;; Let the backend know about the mark change.
10253 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10254 (push article gnus-newsgroup-expirable))
10255 ;; Set the mark in the buffer.
10256 (gnus-summary-update-mark mark 'unread)
10259 (defun gnus-summary-mark-article-as-unread (mark)
10260 "Mark the current article quickly as unread with MARK."
10261 (let* ((article (gnus-summary-article-number))
10262 (old-mark (gnus-summary-article-mark article)))
10263 ;; Allow the backend to change the mark.
10264 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10265 (if (eq mark old-mark)
10269 (gnus-error 1 "Can't mark negative article numbers")
10271 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10272 (setq gnus-newsgroup-spam-marked
10273 (delq article gnus-newsgroup-spam-marked))
10274 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10275 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10276 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10277 (cond ((= mark gnus-ticked-mark)
10278 (setq gnus-newsgroup-marked
10279 (gnus-add-to-sorted-list gnus-newsgroup-marked
10281 ((= mark gnus-spam-mark)
10282 (setq gnus-newsgroup-spam-marked
10283 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10285 ((= mark gnus-dormant-mark)
10286 (setq gnus-newsgroup-dormant
10287 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10290 (setq gnus-newsgroup-unreads
10291 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10293 (gnus-pull article gnus-newsgroup-reads)
10295 ;; See whether the article is to be put in the cache.
10296 (and gnus-use-cache
10297 (vectorp (gnus-summary-article-header article))
10299 (gnus-cache-possibly-enter-article
10300 gnus-newsgroup-name article
10301 (= mark gnus-ticked-mark)
10302 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10305 (gnus-summary-update-mark mark 'unread)
10308 (defun gnus-summary-mark-article (&optional article mark no-expire)
10309 "Mark ARTICLE with MARK. MARK can be any character.
10310 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10311 `??' (dormant) and `?E' (expirable).
10312 If MARK is nil, then the default character `?r' is used.
10313 If ARTICLE is nil, then the article on the current line will be
10315 If NO-EXPIRE, auto-expiry will be inhibited."
10316 ;; The mark might be a string.
10317 (when (stringp mark)
10318 (setq mark (aref mark 0)))
10319 ;; If no mark is given, then we check auto-expiring.
10321 (setq mark gnus-del-mark))
10322 (when (and (not no-expire)
10323 gnus-newsgroup-auto-expire
10324 (memq mark gnus-auto-expirable-marks))
10325 (setq mark gnus-expirable-mark))
10326 (let ((article (or article (gnus-summary-article-number)))
10327 (old-mark (gnus-summary-article-mark article)))
10328 ;; Allow the backend to change the mark.
10329 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10330 (if (eq mark old-mark)
10333 (error "No article on current line"))
10334 (if (not (if (or (= mark gnus-unread-mark)
10335 (= mark gnus-ticked-mark)
10336 (= mark gnus-spam-mark)
10337 (= mark gnus-dormant-mark))
10338 (gnus-mark-article-as-unread article mark)
10339 (gnus-mark-article-as-read article mark)))
10341 ;; See whether the article is to be put in the cache.
10342 (and gnus-use-cache
10343 (not (= mark gnus-canceled-mark))
10344 (vectorp (gnus-summary-article-header article))
10346 (gnus-cache-possibly-enter-article
10347 gnus-newsgroup-name article
10348 (= mark gnus-ticked-mark)
10349 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10351 (when (gnus-summary-goto-subject article nil t)
10352 (let ((buffer-read-only nil))
10353 (gnus-summary-show-thread)
10355 (gnus-summary-update-mark mark 'unread)
10358 (defun gnus-summary-update-secondary-mark (article)
10359 "Update the secondary (read, process, cache) mark."
10360 (gnus-summary-update-mark
10361 (cond ((memq article gnus-newsgroup-processable)
10363 ((memq article gnus-newsgroup-cached)
10365 ((memq article gnus-newsgroup-replied)
10367 ((memq article gnus-newsgroup-forwarded)
10368 gnus-forwarded-mark)
10369 ((memq article gnus-newsgroup-saved)
10371 ((memq article gnus-newsgroup-recent)
10373 ((memq article gnus-newsgroup-unseen)
10377 (when (gnus-visual-p 'summary-highlight 'highlight)
10378 (gnus-run-hooks 'gnus-summary-update-hook))
10381 (defun gnus-summary-update-download-mark (article)
10382 "Update the download mark."
10383 (gnus-summary-update-mark
10384 (cond ((memq article gnus-newsgroup-undownloaded)
10385 gnus-undownloaded-mark)
10386 (gnus-newsgroup-agentized
10387 gnus-downloaded-mark)
10391 (gnus-summary-update-line t)
10394 (defun gnus-summary-update-mark (mark type)
10395 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10396 (buffer-read-only nil))
10397 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10399 (when (looking-at "\r")
10401 (when (<= (+ forward (point)) (point-max))
10402 ;; Go to the right position on the line.
10403 (goto-char (+ forward (point)))
10404 ;; Replace the old mark with the new mark.
10405 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10406 ;; Optionally update the marks by some user rule.
10407 (when (eq type 'unread)
10408 (gnus-data-set-mark
10409 (gnus-data-find (gnus-summary-article-number)) mark)
10410 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10412 (defun gnus-mark-article-as-read (article &optional mark)
10413 "Enter ARTICLE in the pertinent lists and remove it from others."
10414 ;; Make the article expirable.
10415 (let ((mark (or mark gnus-del-mark)))
10416 (setq gnus-newsgroup-expirable
10417 (if (= mark gnus-expirable-mark)
10418 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10419 (delq article gnus-newsgroup-expirable)))
10420 ;; Remove from unread and marked lists.
10421 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10422 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10423 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10424 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10425 (push (cons article mark) gnus-newsgroup-reads)
10426 ;; Possibly remove from cache, if that is used.
10427 (when gnus-use-cache
10428 (gnus-cache-enter-remove-article article))
10431 (defun gnus-mark-article-as-unread (article &optional mark)
10432 "Enter ARTICLE in the pertinent lists and remove it from others."
10433 (let ((mark (or mark gnus-ticked-mark)))
10436 (gnus-error 1 "Can't mark negative article numbers")
10438 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10439 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10440 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10441 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10442 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10444 ;; Unsuppress duplicates?
10445 (when gnus-suppress-duplicates
10446 (gnus-dup-unsuppress-article article))
10448 (cond ((= mark gnus-ticked-mark)
10449 (setq gnus-newsgroup-marked
10450 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10451 ((= mark gnus-spam-mark)
10452 (setq gnus-newsgroup-spam-marked
10453 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10455 ((= mark gnus-dormant-mark)
10456 (setq gnus-newsgroup-dormant
10457 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10459 (setq gnus-newsgroup-unreads
10460 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10461 (gnus-pull article gnus-newsgroup-reads)
10464 (defalias 'gnus-summary-mark-as-unread-forward
10465 'gnus-summary-tick-article-forward)
10466 (make-obsolete 'gnus-summary-mark-as-unread-forward
10467 'gnus-summary-tick-article-forward)
10468 (defun gnus-summary-tick-article-forward (n)
10469 "Tick N articles forwards.
10470 If N is negative, tick backwards instead.
10471 The difference between N and the number of articles ticked is returned."
10473 (gnus-summary-mark-forward n gnus-ticked-mark))
10475 (defalias 'gnus-summary-mark-as-unread-backward
10476 'gnus-summary-tick-article-backward)
10477 (make-obsolete 'gnus-summary-mark-as-unread-backward
10478 'gnus-summary-tick-article-backward)
10479 (defun gnus-summary-tick-article-backward (n)
10480 "Tick N articles backwards.
10481 The difference between N and the number of articles ticked is returned."
10483 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10485 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10486 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10487 (defun gnus-summary-tick-article (&optional article clear-mark)
10488 "Mark current article as unread.
10489 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10490 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10492 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10493 gnus-ticked-mark)))
10495 (defun gnus-summary-mark-as-read-forward (n)
10496 "Mark N articles as read forwards.
10497 If N is negative, mark backwards instead.
10498 The difference between N and the actual number of articles marked is
10501 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10503 (defun gnus-summary-mark-as-read-backward (n)
10504 "Mark the N articles as read backwards.
10505 The difference between N and the actual number of articles marked is
10508 (gnus-summary-mark-forward
10509 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10511 (defun gnus-summary-mark-as-read (&optional article mark)
10512 "Mark current article as read.
10513 ARTICLE specifies the article to be marked as read.
10514 MARK specifies a string to be inserted at the beginning of the line."
10515 (gnus-summary-mark-article article mark))
10517 (defun gnus-summary-clear-mark-forward (n)
10518 "Clear marks from N articles forward.
10519 If N is negative, clear backward instead.
10520 The difference between N and the number of marks cleared is returned."
10522 (gnus-summary-mark-forward n gnus-unread-mark))
10524 (defun gnus-summary-clear-mark-backward (n)
10525 "Clear marks from N articles backward.
10526 The difference between N and the number of marks cleared is returned."
10528 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10530 (defun gnus-summary-mark-unread-as-read ()
10531 "Intended to be used by `gnus-summary-mark-article-hook'."
10532 (when (memq gnus-current-article gnus-newsgroup-unreads)
10533 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10535 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10536 "Intended to be used by `gnus-summary-mark-article-hook'."
10537 (let ((mark (gnus-summary-article-mark)))
10538 (when (or (gnus-unread-mark-p mark)
10539 (gnus-read-mark-p mark))
10540 (gnus-summary-mark-article gnus-current-article
10541 (or new-mark gnus-read-mark)))))
10543 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10544 "Intended to be used by `gnus-summary-mark-article-hook'."
10545 (let ((mark (gnus-summary-article-mark)))
10546 (when (or (gnus-unread-mark-p mark)
10547 (gnus-read-mark-p mark))
10548 (gnus-summary-mark-article (gnus-summary-article-number)
10549 (or new-mark gnus-read-mark)))))
10551 (defun gnus-summary-mark-unread-as-ticked ()
10552 "Intended to be used by `gnus-summary-mark-article-hook'."
10553 (when (memq gnus-current-article gnus-newsgroup-unreads)
10554 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10556 (defun gnus-summary-mark-region-as-read (point mark all)
10557 "Mark all unread articles between point and mark as read.
10558 If given a prefix, mark all articles between point and mark as read,
10559 even ticked and dormant ones."
10560 (interactive "r\nP")
10564 (beginning-of-line)
10569 (memq (setq article (gnus-summary-article-number))
10570 gnus-newsgroup-unreads))
10571 (gnus-summary-mark-article article gnus-del-mark))
10573 (gnus-summary-find-next))))))
10575 (defun gnus-summary-mark-below (score mark)
10576 "Mark articles with score less than SCORE with MARK."
10577 (interactive "P\ncMark: ")
10578 (setq score (if score
10579 (prefix-numeric-value score)
10580 (or gnus-summary-default-score 0)))
10582 (set-buffer gnus-summary-buffer)
10583 (goto-char (point-min))
10586 (and (< (gnus-summary-article-score) score)
10587 (gnus-summary-mark-article nil mark))
10588 (gnus-summary-find-next)))))
10590 (defun gnus-summary-kill-below (&optional score)
10591 "Mark articles with score below SCORE as read."
10593 (gnus-summary-mark-below score gnus-killed-mark))
10595 (defun gnus-summary-clear-above (&optional score)
10596 "Clear all marks from articles with score above SCORE."
10598 (gnus-summary-mark-above score gnus-unread-mark))
10600 (defun gnus-summary-tick-above (&optional score)
10601 "Tick all articles with score above SCORE."
10603 (gnus-summary-mark-above score gnus-ticked-mark))
10605 (defun gnus-summary-mark-above (score mark)
10606 "Mark articles with score over SCORE with MARK."
10607 (interactive "P\ncMark: ")
10608 (setq score (if score
10609 (prefix-numeric-value score)
10610 (or gnus-summary-default-score 0)))
10612 (set-buffer gnus-summary-buffer)
10613 (goto-char (point-min))
10615 (when (> (gnus-summary-article-score) score)
10616 (gnus-summary-mark-article nil mark))
10618 (gnus-summary-find-next)))))
10620 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10621 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10622 (defun gnus-summary-limit-include-expunged (&optional no-error)
10623 "Display all the hidden articles that were expunged for low scores."
10625 (let ((buffer-read-only nil))
10626 (let ((scored gnus-newsgroup-scored)
10629 (unless (gnus-summary-article-header (caar scored))
10630 (and (setq h (gnus-number-to-header (caar scored)))
10631 (< (cdar scored) gnus-summary-expunge-below)
10633 (setq scored (cdr scored)))
10635 (when (not no-error)
10636 (error "No expunged articles hidden"))
10637 (goto-char (point-min))
10638 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10639 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10640 (mapcar (lambda (x) (push (mail-header-number x)
10641 gnus-newsgroup-limit))
10643 (gnus-summary-prepare-unthreaded (nreverse headers))
10644 (goto-char (point-min))
10645 (gnus-summary-position-point)
10648 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10649 "Mark all unread articles in this newsgroup as read.
10650 If prefix argument ALL is non-nil, ticked and dormant articles will
10651 also be marked as read.
10652 If QUIETLY is non-nil, no questions will be asked.
10654 If TO-HERE is non-nil, it should be a point in the buffer. All
10655 articles before (after, if REVERSE is set) this point will be marked
10658 Note that this function will only catch up the unread article
10659 in the current summary buffer limitation.
10661 The number of articles marked as read is returned."
10666 (not gnus-interactive-catchup) ;Without confirmation?
10670 "Mark absolutely all articles as read? "
10671 "Mark all unread articles as read? ")))
10673 (not gnus-newsgroup-adaptive)
10674 (not gnus-newsgroup-auto-expire)
10675 (not gnus-suppress-duplicates)
10676 (or (not gnus-use-cache)
10677 (eq gnus-use-cache 'passive)))
10680 (setq gnus-newsgroup-marked nil
10681 gnus-newsgroup-spam-marked nil
10682 gnus-newsgroup-dormant nil))
10683 (setq gnus-newsgroup-unreads
10684 (gnus-sorted-nunion
10685 (gnus-intersection gnus-newsgroup-unreads
10686 gnus-newsgroup-downloadable)
10687 gnus-newsgroup-unfetched)))
10688 ;; We actually mark all articles as canceled, which we
10689 ;; have to do when using auto-expiry or adaptive scoring.
10690 (gnus-summary-show-all-threads)
10691 (if (and to-here reverse)
10693 (goto-char to-here)
10694 (gnus-summary-mark-current-read-and-unread-as-read
10696 (while (gnus-summary-find-next (not all))
10697 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10698 (when (gnus-summary-first-subject (not all))
10700 (if to-here (< (point) to-here) t)
10701 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10702 (gnus-summary-find-next (not all))))))
10703 (gnus-set-mode-line 'summary))
10705 (gnus-summary-position-point)))
10707 (defun gnus-summary-catchup-to-here (&optional all)
10708 "Mark all unticked articles before the current one as read.
10709 If ALL is non-nil, also mark ticked and dormant articles as read."
10712 (gnus-save-hidden-threads
10713 (let ((beg (point)))
10714 ;; We check that there are unread articles.
10715 (when (or all (gnus-summary-find-prev))
10716 (gnus-summary-catchup all t beg)))))
10717 (gnus-summary-position-point))
10719 (defun gnus-summary-catchup-from-here (&optional all)
10720 "Mark all unticked articles after (and including) the current one as read.
10721 If ALL is non-nil, also mark ticked and dormant articles as read."
10724 (gnus-save-hidden-threads
10725 (let ((beg (point)))
10726 ;; We check that there are unread articles.
10727 (when (or all (gnus-summary-find-next))
10728 (gnus-summary-catchup all t beg nil t)))))
10729 (gnus-summary-position-point))
10731 (defun gnus-summary-catchup-all (&optional quietly)
10732 "Mark all articles in this newsgroup as read.
10733 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10734 instead, which marks only unread articles as read."
10736 (gnus-summary-catchup t quietly))
10738 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10739 "Mark all unread articles in this group as read, then exit.
10740 If prefix argument ALL is non-nil, all articles are marked as read.
10741 If QUIETLY is non-nil, no questions will be asked."
10743 (when (gnus-summary-catchup all quietly nil 'fast)
10744 ;; Select next newsgroup or exit.
10745 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10746 (eq gnus-auto-select-next 'quietly))
10747 (gnus-summary-next-group nil)
10748 (gnus-summary-exit))))
10750 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10751 "Mark all articles in this newsgroup as read, and then exit.
10752 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10753 instead, which marks only unread articles as read."
10755 (gnus-summary-catchup-and-exit t quietly))
10757 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10758 "Mark all articles in this group as read and select the next group.
10759 If given a prefix, mark all articles, unread as well as ticked, as
10763 (gnus-summary-catchup all))
10764 (gnus-summary-next-group))
10766 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10767 "Mark all articles in this group as read and select the previous group.
10768 If given a prefix, mark all articles, unread as well as ticked, as
10772 (gnus-summary-catchup all))
10773 (gnus-summary-next-group nil nil t))
10779 (defmacro gnus-with-article (article &rest forms)
10780 "Select ARTICLE and perform FORMS in the original article buffer.
10781 Then replace the article with the result."
10783 ;; We don't want the article to be marked as read.
10784 (let (gnus-mark-article-hook)
10785 (gnus-summary-select-article t t nil ,article))
10786 (set-buffer gnus-original-article-buffer)
10788 (if (not (gnus-check-backend-function
10789 'request-replace-article (car gnus-article-current)))
10790 (gnus-message 5 "Read-only group; not replacing")
10791 (unless (gnus-request-replace-article
10792 ,article (car gnus-article-current)
10793 (current-buffer) t)
10794 (error "Couldn't replace article")))
10795 ;; The cache and backlog have to be flushed somewhat.
10796 (when gnus-keep-backlog
10797 (gnus-backlog-remove-article
10798 (car gnus-article-current) (cdr gnus-article-current)))
10799 (when gnus-use-cache
10800 (gnus-cache-update-article
10801 (car gnus-article-current) (cdr gnus-article-current)))))
10803 (put 'gnus-with-article 'lisp-indent-function 1)
10804 (put 'gnus-with-article 'edebug-form-spec '(form body))
10806 ;; Thread-based commands.
10808 (defun gnus-summary-articles-in-thread (&optional article)
10809 "Return a list of all articles in the current thread.
10810 If ARTICLE is non-nil, return all articles in the thread that starts
10811 with that article."
10812 (let* ((article (or article (gnus-summary-article-number)))
10813 (data (gnus-data-find-list article))
10814 (top-level (gnus-data-level (car data)))
10816 (cond ((null gnus-thread-operation-ignore-subject)
10817 (gnus-simplify-subject-re
10818 (mail-header-subject (gnus-data-header (car data)))))
10819 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10820 (gnus-simplify-subject-fuzzy
10821 (mail-header-subject (gnus-data-header (car data)))))
10823 (end-point (save-excursion
10824 (if (gnus-summary-go-to-next-thread)
10825 (point) (point-max))))
10828 (< (gnus-data-pos (car data)) end-point))
10829 (when (or (not top-subject)
10830 (string= top-subject
10831 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
10832 (gnus-simplify-subject-fuzzy
10833 (mail-header-subject
10834 (gnus-data-header (car data))))
10835 (gnus-simplify-subject-re
10836 (mail-header-subject
10837 (gnus-data-header (car data)))))))
10838 (push (gnus-data-number (car data)) articles))
10839 (unless (and (setq data (cdr data))
10840 (> (gnus-data-level (car data)) top-level))
10842 ;; Return the list of articles.
10843 (nreverse articles)))
10845 (defun gnus-summary-rethread-current ()
10846 "Rethread the thread the current article is part of."
10848 (let* ((gnus-show-threads t)
10849 (article (gnus-summary-article-number))
10850 (id (mail-header-id (gnus-summary-article-header)))
10851 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
10853 (error "No article on the current line"))
10854 (gnus-rebuild-thread id)
10855 (gnus-summary-goto-subject article)))
10857 (defun gnus-summary-reparent-thread ()
10858 "Make the current article child of the marked (or previous) article.
10860 Note that the re-threading will only work if `gnus-thread-ignore-subject'
10861 is non-nil or the Subject: of both articles are the same."
10863 (unless (not (gnus-group-read-only-p))
10864 (error "The current newsgroup does not support article editing"))
10865 (unless (<= (length gnus-newsgroup-processable) 1)
10866 (error "No more than one article may be marked"))
10867 (let ((child (gnus-summary-article-number))
10868 ;; First grab the marked article, otherwise one line up.
10869 (parent (if (not (null gnus-newsgroup-processable))
10870 (car gnus-newsgroup-processable)
10872 (if (eq (forward-line -1) 0)
10873 (gnus-summary-article-number)
10874 (error "Beginning of summary buffer"))))))
10875 (gnus-summary-reparent-children parent (list child))))
10877 (defun gnus-summary-reparent-children (parent children)
10878 "Make PARENT the parent of CHILDREN.
10879 When called interactively, PARENT is is current article and
10880 CHILDREN are the process-marked articles."
10882 (list (gnus-summary-article-number)
10883 (gnus-summary-work-articles nil)))
10884 (dolist (child children)
10885 (save-window-excursion
10886 (let ((gnus-article-buffer " *reparent*"))
10887 (unless (not (eq parent child))
10888 (error "An article may not be self-referential"))
10889 (let ((message-id (mail-header-id
10890 (gnus-summary-article-header parent))))
10891 (unless (and message-id (not (equal message-id "")))
10892 (error "No message-id in desired parent"))
10893 (gnus-with-article child
10895 (goto-char (point-min))
10896 (message-narrow-to-head)
10897 (if (re-search-forward "^References: " nil t)
10899 (re-search-forward "^[^ \t]" nil t)
10902 (insert " " message-id))
10903 (insert "References: " message-id "\n"))))
10904 (set-buffer gnus-summary-buffer)
10905 (gnus-summary-unmark-all-processable)
10906 (gnus-summary-update-article child)
10907 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10908 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
10909 (gnus-summary-rethread-current)
10910 (gnus-message 3 "Article %d is now the child of article %d"
10913 (defun gnus-summary-toggle-threads (&optional arg)
10914 "Toggle showing conversation threads.
10915 If ARG is positive number, turn showing conversation threads on."
10917 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
10918 (setq gnus-show-threads
10919 (if (null arg) (not gnus-show-threads)
10920 (> (prefix-numeric-value arg) 0)))
10921 (gnus-summary-prepare)
10922 (gnus-summary-goto-subject current)
10923 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
10924 (gnus-summary-position-point)))
10926 (defun gnus-summary-show-all-threads ()
10927 "Show all threads."
10930 (let ((buffer-read-only nil))
10931 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
10932 (gnus-summary-position-point))
10934 (defun gnus-summary-show-thread ()
10935 "Show thread subtrees.
10936 Returns nil if no thread was there to be shown."
10938 (let ((buffer-read-only nil)
10940 (end (point-at-eol))
10941 ;; Leave point at bol
10942 (beg (progn (beginning-of-line) (point))))
10944 ;; Any hidden lines here?
10945 (search-forward "\r" end t)
10946 (subst-char-in-region beg end ?\^M ?\n t)
10948 (gnus-summary-position-point))))
10950 (defun gnus-summary-maybe-hide-threads ()
10951 "If requested, hide the threads that should be hidden."
10952 (when (and gnus-show-threads
10953 gnus-thread-hide-subtree)
10954 (gnus-summary-hide-all-threads
10955 (if (or (consp gnus-thread-hide-subtree)
10956 (functionp gnus-thread-hide-subtree))
10957 (gnus-make-predicate gnus-thread-hide-subtree)
10960 ;;; Hiding predicates.
10962 (defun gnus-article-unread-p (header)
10963 (memq (mail-header-number header) gnus-newsgroup-unreads))
10965 (defun gnus-article-unseen-p (header)
10966 (memq (mail-header-number header) gnus-newsgroup-unseen))
10968 (defun gnus-map-articles (predicate articles)
10969 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
10970 (apply 'gnus-or (mapcar predicate
10971 (mapcar (lambda (number)
10972 (gnus-summary-article-header number))
10975 (defun gnus-summary-hide-all-threads (&optional predicate)
10976 "Hide all thread subtrees.
10977 If PREDICATE is supplied, threads that satisfy this predicate
10978 will not be hidden."
10981 (goto-char (point-min))
10984 (when (or (not predicate)
10986 predicate (gnus-summary-article-children)))
10987 (gnus-summary-hide-thread))
10988 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
10989 (gnus-summary-position-point))
10991 (defun gnus-summary-hide-thread ()
10992 "Hide thread subtrees.
10993 If PREDICATE is supplied, threads that satisfy this predicate
10994 will not be hidden.
10995 Returns nil if no threads were there to be hidden."
10997 (let ((buffer-read-only nil)
10999 (article (gnus-summary-article-number)))
11001 ;; Go forward until either the buffer ends or the subthread
11003 (when (and (not (eobp))
11004 (or (zerop (gnus-summary-next-thread 1 t))
11005 (goto-char (point-max))))
11007 (if (and (> (point) start)
11008 (search-backward "\n" start t))
11010 (subst-char-in-region start (point) ?\n ?\^M)
11011 (gnus-summary-goto-subject article))
11015 (defun gnus-summary-go-to-next-thread (&optional previous)
11016 "Go to the same level (or less) next thread.
11017 If PREVIOUS is non-nil, go to previous thread instead.
11018 Return the article number moved to, or nil if moving was impossible."
11019 (let ((level (gnus-summary-thread-level))
11020 (way (if previous -1 1))
11023 (while (and (not (eobp))
11024 (< level (gnus-summary-thread-level)))
11025 (forward-line way))
11032 (gnus-summary-article-number)
11033 (goto-char beg)))))
11035 (defun gnus-summary-next-thread (n &optional silent)
11036 "Go to the same level next N'th thread.
11037 If N is negative, search backward instead.
11038 Returns the difference between N and the number of skips actually
11041 If SILENT, don't output messages."
11043 (let ((backward (< n 0))
11045 (while (and (> n 0)
11046 (gnus-summary-go-to-next-thread backward))
11049 (gnus-summary-position-point))
11050 (when (and (not silent) (/= 0 n))
11051 (gnus-message 7 "No more threads"))
11054 (defun gnus-summary-prev-thread (n)
11055 "Go to the same level previous N'th thread.
11056 Returns the difference between N and the number of skips actually
11059 (gnus-summary-next-thread (- n)))
11061 (defun gnus-summary-go-down-thread ()
11062 "Go down one level in the current thread."
11063 (let ((children (gnus-summary-article-children)))
11065 (gnus-summary-goto-subject (car children)))))
11067 (defun gnus-summary-go-up-thread ()
11068 "Go up one level in the current thread."
11069 (let ((parent (gnus-summary-article-parent)))
11071 (gnus-summary-goto-subject parent))))
11073 (defun gnus-summary-down-thread (n)
11074 "Go down thread N steps.
11075 If N is negative, go up instead.
11076 Returns the difference between N and how many steps down that were
11081 (while (and (> n 0)
11082 (if up (gnus-summary-go-up-thread)
11083 (gnus-summary-go-down-thread)))
11085 (gnus-summary-position-point)
11087 (gnus-message 7 "Can't go further"))
11090 (defun gnus-summary-up-thread (n)
11091 "Go up thread N steps.
11092 If N is negative, go down instead.
11093 Returns the difference between N and how many steps down that were
11096 (gnus-summary-down-thread (- n)))
11098 (defun gnus-summary-top-thread ()
11099 "Go to the top of the thread."
11101 (while (gnus-summary-go-up-thread))
11102 (gnus-summary-article-number))
11104 (defun gnus-summary-kill-thread (&optional unmark)
11105 "Mark articles under current thread as read.
11106 If the prefix argument is positive, remove any kinds of marks.
11107 If the prefix argument is negative, tick articles instead."
11110 (setq unmark (prefix-numeric-value unmark)))
11111 (let ((articles (gnus-summary-articles-in-thread)))
11113 ;; Expand the thread.
11114 (gnus-summary-show-thread)
11115 ;; Mark all the articles.
11117 (gnus-summary-goto-subject (car articles))
11118 (cond ((null unmark)
11119 (gnus-summary-mark-article-as-read gnus-killed-mark))
11121 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11123 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11124 (setq articles (cdr articles))))
11125 ;; Hide killed subtrees.
11127 gnus-thread-hide-killed
11128 (gnus-summary-hide-thread))
11129 ;; If marked as read, go to next unread subject.
11130 (when (null unmark)
11131 ;; Go to next unread subject.
11132 (gnus-summary-next-subject 1 t)))
11133 (gnus-set-mode-line 'summary))
11135 ;; Summary sorting commands
11137 (defun gnus-summary-sort-by-number (&optional reverse)
11138 "Sort the summary buffer by article number.
11139 Argument REVERSE means reverse order."
11141 (gnus-summary-sort 'number reverse))
11143 (defun gnus-summary-sort-by-random (&optional reverse)
11144 "Randomize the order in the summary buffer.
11145 Argument REVERSE means to randomize in reverse order."
11147 (gnus-summary-sort 'random reverse))
11149 (defun gnus-summary-sort-by-author (&optional reverse)
11150 "Sort the summary buffer by author name alphabetically.
11151 If `case-fold-search' is non-nil, case of letters is ignored.
11152 Argument REVERSE means reverse order."
11154 (gnus-summary-sort 'author reverse))
11156 (defun gnus-summary-sort-by-recipient (&optional reverse)
11157 "Sort the summary buffer by recipient name alphabetically.
11158 If `case-fold-search' is non-nil, case of letters is ignored.
11159 Argument REVERSE means reverse order."
11161 (gnus-summary-sort 'recipient reverse))
11163 (defun gnus-summary-sort-by-subject (&optional reverse)
11164 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11165 If `case-fold-search' is non-nil, case of letters is ignored.
11166 Argument REVERSE means reverse order."
11168 (gnus-summary-sort 'subject reverse))
11170 (defun gnus-summary-sort-by-date (&optional reverse)
11171 "Sort the summary buffer by date.
11172 Argument REVERSE means reverse order."
11174 (gnus-summary-sort 'date reverse))
11176 (defun gnus-summary-sort-by-score (&optional reverse)
11177 "Sort the summary buffer by score.
11178 Argument REVERSE means reverse order."
11180 (gnus-summary-sort 'score reverse))
11182 (defun gnus-summary-sort-by-lines (&optional reverse)
11183 "Sort the summary buffer by the number of lines.
11184 Argument REVERSE means reverse order."
11186 (gnus-summary-sort 'lines reverse))
11188 (defun gnus-summary-sort-by-chars (&optional reverse)
11189 "Sort the summary buffer by article length.
11190 Argument REVERSE means reverse order."
11192 (gnus-summary-sort 'chars reverse))
11194 (defun gnus-summary-sort-by-original (&optional reverse)
11195 "Sort the summary buffer using the default sorting method.
11196 Argument REVERSE means reverse order."
11198 (let* ((buffer-read-only)
11199 (gnus-summary-prepare-hook nil))
11200 ;; We do the sorting by regenerating the threads.
11201 (gnus-summary-prepare)
11202 ;; Hide subthreads if needed.
11203 (gnus-summary-maybe-hide-threads)))
11205 (defun gnus-summary-sort (predicate reverse)
11206 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11207 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11208 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11209 (gnus-thread-sort-functions
11214 (gnus-sort-gathered-threads-function
11215 gnus-thread-sort-functions)
11216 (gnus-article-sort-functions
11220 (,article t2 t1))))
11222 (gnus-summary-prepare-hook nil))
11223 ;; We do the sorting by regenerating the threads.
11224 (gnus-summary-prepare)
11225 ;; Hide subthreads if needed.
11226 (gnus-summary-maybe-hide-threads)))
11228 ;; Summary saving commands.
11230 (defcustom gnus-summary-save-article-coding-system nil
11231 "Coding system used to save a decoded article to a file.
11232 This is used when the `gnus-summary-write-article-file' command is run.
11233 The recommended coding systems include `utf-8', `iso-2022-7bit', and so
11234 forth. Note that buttonized MIME parts will be lost in a saved file.
11235 If it is nil, raw articles will be saved."
11236 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
11237 (const :tag "Save raw articles")
11238 (symbol :tag "Coding system"))
11239 :group 'gnus-article-saving)
11241 (defun gnus-summary-save-article (&optional n not-saved decode)
11242 "Save the current article using the default saver function.
11243 If N is a positive number, save the N next articles.
11244 If N is a negative number, save the N previous articles.
11245 If N is nil and any articles have been marked with the process mark,
11246 save those articles instead.
11247 The variable `gnus-default-article-saver' specifies the saver function."
11249 (unless gnus-summary-save-article-coding-system
11251 (let* ((articles (gnus-summary-work-articles n))
11252 (save-buffer (save-excursion
11253 (nnheader-set-temp-buffer " *Gnus Save*")))
11254 (num (length articles))
11256 (dolist (article articles)
11257 (setq header (gnus-summary-article-header article))
11258 (if (not (vectorp header))
11259 ;; This is a pseudo-article.
11260 (if (assq 'name header)
11261 (gnus-copy-file (cdr (assq 'name header)))
11262 (gnus-message 1 "Article %d is unsaveable" article))
11263 ;; This is a real article.
11264 (save-window-excursion
11265 (let ((gnus-display-mime-function (when decode
11266 gnus-display-mime-function))
11267 (gnus-article-prepare-hook (when decode
11268 gnus-article-prepare-hook)))
11269 (gnus-summary-select-article t nil nil article)))
11271 (set-buffer save-buffer)
11275 (insert "X-Coding-System: -*- coding: "
11276 (symbol-name gnus-summary-save-article-coding-system)
11278 (insert-buffer-substring gnus-article-buffer))
11279 (insert-buffer-substring gnus-original-article-buffer)))
11280 (let ((mm-text-coding-system-for-write
11282 gnus-summary-save-article-coding-system
11283 mm-text-coding-system-for-write)))
11284 (setq file (gnus-article-save save-buffer file num)))
11285 (gnus-summary-remove-process-mark article)
11287 (gnus-summary-set-saved-mark article))))
11288 (gnus-kill-buffer save-buffer)
11289 (gnus-summary-position-point)
11290 (gnus-set-mode-line 'summary)
11293 (defun gnus-summary-pipe-output (&optional arg headers)
11294 "Pipe the current article to a subprocess.
11295 If N is a positive number, pipe the N next articles.
11296 If N is a negative number, pipe the N previous articles.
11297 If N is nil and any articles have been marked with the process mark,
11298 pipe those articles instead.
11299 If HEADERS (the symbolic prefix), include the headers, too."
11300 (interactive (gnus-interactive "P\ny"))
11301 (require 'gnus-art)
11302 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11303 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11304 (gnus-summary-save-article arg t))
11305 (let ((buffer (get-buffer "*Shell Command Output*")))
11307 (not (zerop (buffer-size buffer))))
11308 (gnus-configure-windows 'pipe))))
11310 (defun gnus-summary-save-article-mail (&optional arg)
11311 "Append the current article to an mail file.
11312 If N is a positive number, save the N next articles.
11313 If N is a negative number, save the N previous articles.
11314 If N is nil and any articles have been marked with the process mark,
11315 save those articles instead."
11317 (require 'gnus-art)
11318 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11319 (gnus-summary-save-article arg)))
11321 (defun gnus-summary-save-article-rmail (&optional arg)
11322 "Append the current article to an rmail file.
11323 If N is a positive number, save the N next articles.
11324 If N is a negative number, save the N previous articles.
11325 If N is nil and any articles have been marked with the process mark,
11326 save those articles instead."
11328 (require 'gnus-art)
11329 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11330 (gnus-summary-save-article arg)))
11332 (defun gnus-summary-save-article-file (&optional arg)
11333 "Append the current article to a file.
11334 If N is a positive number, save the N next articles.
11335 If N is a negative number, save the N previous articles.
11336 If N is nil and any articles have been marked with the process mark,
11337 save those articles instead."
11339 (require 'gnus-art)
11340 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11341 (gnus-summary-save-article arg)))
11343 (defun gnus-summary-write-article-file (&optional arg)
11344 "Write the current article to a file, deleting the previous file.
11345 If N is a positive number, save the N next articles.
11346 If N is a negative number, save the N previous articles.
11347 If N is nil and any articles have been marked with the process mark,
11348 save those articles instead."
11350 (require 'gnus-art)
11351 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11352 (gnus-summary-save-article arg nil t)))
11354 (defun gnus-summary-save-article-body-file (&optional arg)
11355 "Append the current article body to a file.
11356 If N is a positive number, save the N next articles.
11357 If N is a negative number, save the N previous articles.
11358 If N is nil and any articles have been marked with the process mark,
11359 save those articles instead."
11361 (require 'gnus-art)
11362 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11363 (gnus-summary-save-article arg)))
11365 (defun gnus-summary-muttprint (&optional arg)
11366 "Print the current article using Muttprint.
11367 If N is a positive number, save the N next articles.
11368 If N is a negative number, save the N previous articles.
11369 If N is nil and any articles have been marked with the process mark,
11370 save those articles instead."
11372 (require 'gnus-art)
11373 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11374 (gnus-summary-save-article arg t)))
11376 (defun gnus-summary-pipe-message (program)
11377 "Pipe the current article through PROGRAM."
11378 (interactive "sProgram: ")
11379 (gnus-summary-select-article)
11380 (let ((mail-header-separator ""))
11381 (gnus-eval-in-buffer-window gnus-article-buffer
11384 (let ((start (window-start))
11386 (message-pipe-buffer-body program)
11387 (set-window-start (get-buffer-window (current-buffer)) start))))))
11389 (defun gnus-get-split-value (methods)
11390 "Return a value based on the split METHODS."
11391 (let (split-name method result match)
11394 (set-buffer gnus-original-article-buffer)
11396 (nnheader-narrow-to-headers)
11397 (while (and methods (not split-name))
11398 (goto-char (point-min))
11399 (setq method (pop methods))
11400 (setq match (car method))
11403 ;; Regular expression.
11405 (re-search-forward match nil t)))
11410 (setq result (funcall match gnus-newsgroup-name))))
11415 (setq result (eval match)))))
11416 (setq split-name (cdr method))
11417 (cond ((stringp result)
11418 (push (expand-file-name
11419 result gnus-article-save-directory)
11422 (setq split-name (append result split-name)))))))))
11423 (nreverse split-name)))
11425 (defun gnus-valid-move-group-p (group)
11426 (and (boundp group)
11427 (symbol-name group)
11428 (symbol-value group)
11429 (gnus-get-function (gnus-find-method-for-group
11430 (symbol-name group)) 'request-accept-article t)))
11432 (defun gnus-read-move-group-name (prompt default articles prefix)
11433 "Read a group name."
11434 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11435 (minibuffer-confirm-incomplete nil) ; XEmacs
11439 (if (> (length articles) 1)
11440 (format "these %d articles" (length articles))
11445 (gnus-completing-read-with-default
11448 'gnus-valid-move-group-p
11450 'gnus-group-history))
11451 ((= 1 (length split-name))
11452 (gnus-completing-read-with-default
11453 (car split-name) prom
11455 'gnus-valid-move-group-p
11457 'gnus-group-history))
11459 (gnus-completing-read-with-default
11461 (mapcar 'list (nreverse split-name))
11463 'gnus-group-history))))
11464 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11466 (if (or (string= to-newsgroup "")
11467 (string= to-newsgroup prefix))
11468 (setq to-newsgroup default))
11469 (unless to-newsgroup
11470 (error "No group name entered"))
11471 (or (gnus-active to-newsgroup)
11472 (gnus-activate-group to-newsgroup nil nil to-method)
11473 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11475 (or (and (gnus-request-create-group to-newsgroup to-method)
11476 (gnus-activate-group
11477 to-newsgroup nil nil to-method)
11478 (gnus-subscribe-group to-newsgroup))
11479 (error "Couldn't create group %s" to-newsgroup)))
11480 (error "No such group: %s" to-newsgroup)))
11483 (defvar gnus-summary-save-parts-counter)
11485 (defun gnus-summary-save-parts (type dir n &optional reverse)
11486 "Save parts matching TYPE to DIR.
11487 If REVERSE, save parts that do not match TYPE."
11489 (list (read-string "Save parts of type: "
11490 (or (car gnus-summary-save-parts-type-history)
11491 gnus-summary-save-parts-default-mime)
11492 'gnus-summary-save-parts-type-history)
11493 (setq gnus-summary-save-parts-last-directory
11494 (read-file-name "Save to directory: "
11495 gnus-summary-save-parts-last-directory
11497 current-prefix-arg))
11498 (gnus-summary-iterate n
11499 (let ((gnus-display-mime-function nil)
11500 (gnus-inhibit-treatment t))
11501 (gnus-summary-select-article))
11503 (set-buffer gnus-article-buffer)
11504 (let ((handles (or gnus-article-mime-handles
11505 (mm-dissect-buffer nil gnus-article-loose-mime)
11506 (and gnus-article-emulate-mime
11508 (gnus-summary-save-parts-counter 1))
11510 (gnus-summary-save-parts-1 type dir handles reverse)
11511 (unless gnus-article-mime-handles ;; Don't destroy this case.
11512 (mm-destroy-parts handles)))))))
11514 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11515 (if (stringp (car handle))
11516 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11519 (not (string-match type (mm-handle-media-type handle)))
11520 (string-match type (mm-handle-media-type handle)))
11521 (let ((file (expand-file-name
11523 mm-file-name-rewrite-functions
11524 (file-name-nondirectory
11526 (mail-content-type-get
11527 (mm-handle-disposition handle) 'filename)
11528 (mail-content-type-get
11529 (mm-handle-type handle) 'name)
11530 (format "%s.%d.%d" gnus-newsgroup-name
11531 (cdr gnus-article-current)
11532 gnus-summary-save-parts-counter))))
11534 (incf gnus-summary-save-parts-counter)
11535 (unless (file-exists-p file)
11536 (mm-save-part-to-file handle file))))))
11538 ;; Summary extract commands
11540 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11541 (let ((buffer-read-only nil)
11542 (article (gnus-summary-article-number))
11544 (unless (gnus-summary-goto-subject article)
11545 (error "No such article: %d" article))
11546 (gnus-summary-position-point)
11547 ;; If all commands are to be bunched up on one line, we collect
11549 (unless gnus-view-pseudos-separately
11550 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11553 (setq action (cdr (assq 'action (car ps))))
11554 (setq files (list (cdr (assq 'name (car ps)))))
11555 (while (and ps (cdr ps)
11556 (string= (or action "1")
11557 (or (cdr (assq 'action (cadr ps))) "2")))
11558 (push (cdr (assq 'name (cadr ps))) files)
11559 (setcdr ps (cddr ps)))
11561 (when (not (string-match "%s" action))
11564 (when (assq 'execute (car ps))
11565 (setcdr (assq 'execute (car ps))
11566 (funcall (if (string-match "%s" action)
11573 (shell-quote-argument f)))
11575 (setq ps (cdr ps)))))
11576 (if (and gnus-view-pseudos (not not-view))
11578 (when (assq 'execute (car pslist))
11579 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11580 (eq gnus-view-pseudos 'not-confirm)))
11581 (setq pslist (cdr pslist)))
11584 (setq after-article (or (cdr (assq 'article (car pslist)))
11585 (gnus-summary-article-number)))
11586 (gnus-summary-goto-subject after-article)
11589 (insert " " (file-name-nondirectory
11590 (cdr (assq 'name (car pslist))))
11591 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11593 (forward-line -1) ; back to `b'
11594 (gnus-add-text-properties
11595 b (1- e) (list 'gnus-number gnus-reffed-article-number
11596 gnus-mouse-face-prop gnus-mouse-face))
11598 after-article gnus-reffed-article-number
11599 gnus-unread-mark b (car pslist) 0 (- e b))
11600 (setq gnus-newsgroup-unreads
11601 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11602 gnus-reffed-article-number))
11603 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11604 (setq pslist (cdr pslist)))))))
11606 (defun gnus-pseudos< (p1 p2)
11607 (let ((c1 (cdr (assq 'action p1)))
11608 (c2 (cdr (assq 'action p2))))
11609 (and c1 c2 (string< c1 c2))))
11611 (defun gnus-request-pseudo-article (props)
11612 (cond ((assq 'execute props)
11613 (gnus-execute-command (cdr (assq 'execute props)))))
11614 (let ((gnus-current-article (gnus-summary-article-number)))
11615 (gnus-run-hooks 'gnus-mark-article-hook)))
11617 (defun gnus-execute-command (command &optional automatic)
11619 (gnus-article-setup-buffer)
11620 (set-buffer gnus-article-buffer)
11621 (setq buffer-read-only nil)
11622 (let ((command (if automatic command
11623 (read-string "Command: " (cons command 0)))))
11625 (insert "$ " command "\n\n")
11626 (if gnus-view-pseudo-asynchronously
11627 (start-process "gnus-execute" (current-buffer) shell-file-name
11628 shell-command-switch command)
11629 (call-process shell-file-name nil t nil
11630 shell-command-switch command)))))
11632 ;; Summary kill commands.
11634 (defun gnus-summary-edit-global-kill (article)
11635 "Edit the \"global\" kill file."
11636 (interactive (list (gnus-summary-article-number)))
11637 (gnus-group-edit-global-kill article))
11639 (defun gnus-summary-edit-local-kill ()
11640 "Edit a local kill file applied to the current newsgroup."
11642 (setq gnus-current-headers (gnus-summary-article-header))
11643 (gnus-group-edit-local-kill
11644 (gnus-summary-article-number) gnus-newsgroup-name))
11646 ;;; Header reading.
11648 (defun gnus-read-header (id &optional header)
11649 "Read the headers of article ID and enter them into the Gnus system."
11650 (let ((group gnus-newsgroup-name)
11651 (gnus-override-method
11653 gnus-override-method
11654 (and (gnus-news-group-p gnus-newsgroup-name)
11655 (car (gnus-refer-article-methods)))))
11657 ;; First we check to see whether the header in question is already
11660 ;; This is a Message-ID.
11661 (setq header (or header (gnus-id-to-header id)))
11662 ;; This is an article number.
11663 (setq header (or header (gnus-summary-article-header id))))
11665 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11666 ;; We have found the header.
11668 ;; We have to really fetch the header to this article.
11670 (set-buffer nntp-server-buffer)
11671 (when (setq where (gnus-request-head id group))
11672 (nnheader-fold-continuation-lines)
11673 (goto-char (point-max))
11675 (goto-char (point-min))
11679 ((cdr where) (cdr where))
11680 (header (mail-header-number header))
11681 (t gnus-reffed-article-number))
11683 (insert " Article retrieved.\n"))
11684 (if (or (not where)
11685 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11686 () ; Malformed head.
11687 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11688 (when (and (stringp id)
11690 (not (string= (gnus-group-real-name group)
11692 (not (gnus-server-equal gnus-override-method
11693 (gnus-group-method group)))))
11694 ;; If we fetched by Message-ID and the article came from
11695 ;; a different group (or server), we fudge some bogus
11696 ;; article numbers for this article.
11697 (mail-header-set-number header gnus-reffed-article-number))
11699 (set-buffer gnus-summary-buffer)
11700 (decf gnus-reffed-article-number)
11701 (gnus-remove-header (mail-header-number header))
11702 (push header gnus-newsgroup-headers)
11703 (setq gnus-current-headers header)
11704 (push (mail-header-number header) gnus-newsgroup-limit)))
11707 (defun gnus-remove-header (number)
11708 "Remove header NUMBER from `gnus-newsgroup-headers'."
11709 (if (and gnus-newsgroup-headers
11710 (= number (mail-header-number (car gnus-newsgroup-headers))))
11711 (pop gnus-newsgroup-headers)
11712 (let ((headers gnus-newsgroup-headers))
11713 (while (and (cdr headers)
11714 (not (= number (mail-header-number (cadr headers)))))
11716 (when (cdr headers)
11717 (setcdr headers (cddr headers))))))
11720 ;;; summary highlights
11723 (defun gnus-highlight-selected-summary ()
11724 "Highlight selected article in summary buffer."
11725 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11726 (when gnus-summary-selected-face
11728 (let* ((beg (point-at-bol))
11729 (end (point-at-eol))
11730 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11731 (from (if (get-text-property beg gnus-mouse-face-prop)
11733 (or (next-single-property-change
11734 beg gnus-mouse-face-prop nil end)
11739 (or (next-single-property-change
11740 from gnus-mouse-face-prop nil end)
11742 ;; If no mouse-face prop on line we will have to = from = end,
11743 ;; so we highlight the entire line instead.
11744 (when (= (+ to 2) from)
11747 (if gnus-newsgroup-selected-overlay
11748 ;; Move old overlay.
11750 gnus-newsgroup-selected-overlay from to (current-buffer))
11751 ;; Create new overlay.
11753 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11754 'face gnus-summary-selected-face))))))
11756 (defvar gnus-summary-highlight-line-cached nil)
11757 (defvar gnus-summary-highlight-line-trigger nil)
11759 (defun gnus-summary-highlight-line-0 ()
11760 (if (and (eq gnus-summary-highlight-line-trigger
11761 gnus-summary-highlight)
11762 gnus-summary-highlight-line-cached)
11763 gnus-summary-highlight-line-cached
11764 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11765 gnus-summary-highlight-line-cached
11766 (let* ((cond (list 'cond))
11768 (list gnus-summary-highlight))
11770 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11774 (gnus-byte-compile (list 'lambda nil cond))))))
11776 (defun gnus-summary-highlight-line ()
11777 "Highlight current line according to `gnus-summary-highlight'."
11778 (let* ((beg (point-at-bol))
11779 (article (or (gnus-summary-article-number) gnus-current-article))
11780 (score (or (cdr (assq article
11781 gnus-newsgroup-scored))
11782 gnus-summary-default-score 0))
11783 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11784 (inhibit-read-only t)
11785 (default gnus-summary-default-score)
11786 (default-high gnus-summary-default-high-score)
11787 (default-low gnus-summary-default-low-score)
11788 (uncached (and gnus-summary-use-undownloaded-faces
11789 (memq article gnus-newsgroup-undownloaded)
11790 (not (memq article gnus-newsgroup-cached)))))
11791 (let ((face (funcall (gnus-summary-highlight-line-0))))
11792 (unless (eq face (get-text-property beg 'face))
11793 (gnus-put-text-property-excluding-characters-with-faces
11794 beg (point-at-eol) 'face
11795 (setq face (if (boundp face) (symbol-value face) face)))
11796 (when gnus-summary-highlight-line-function
11797 (funcall gnus-summary-highlight-line-function article face))))))
11799 (defun gnus-update-read-articles (group unread &optional compute)
11800 "Update the list of read articles in GROUP.
11801 UNREAD is a sorted list."
11802 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11803 (info (gnus-get-info group))
11806 (if (or (not info) (not active))
11807 ;; There is no info on this group if it was, in fact,
11808 ;; killed. Gnus stores no information on killed groups, so
11809 ;; there's nothing to be done.
11810 ;; One could store the information somewhere temporarily,
11811 ;; perhaps... Hmmm...
11813 ;; Remove any negative articles numbers.
11814 (while (and unread (< (car unread) 0))
11815 (setq unread (cdr unread)))
11816 ;; Remove any expired article numbers
11817 (while (and unread (< (car unread) (car active)))
11818 (setq unread (cdr unread)))
11819 ;; Compute the ranges of read articles by looking at the list of
11820 ;; unread articles.
11822 (when (/= (car unread) prev)
11823 (push (if (= prev (1- (car unread))) prev
11824 (cons prev (1- (car unread))))
11826 (setq prev (1+ (car unread)))
11827 (setq unread (cdr unread)))
11828 (when (<= prev (cdr active))
11829 (push (cons prev (cdr active)) read))
11830 (setq read (if (> (length read) 1) (nreverse read) read))
11835 ;; Propagate the read marks to the backend.
11836 (when (gnus-check-backend-function 'request-set-mark group)
11837 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
11838 (add (gnus-remove-from-range read (gnus-info-read info))))
11840 (unless (gnus-check-group group)
11841 (error "Can't open server for %s" group))
11842 (gnus-request-set-mark
11843 group (delq nil (list (if add (list add 'add '(read)))
11844 (if del (list del 'del '(read))))))
11846 `(gnus-request-set-mark
11849 (if del (list del 'add '(read)))
11850 (if add (list add 'del '(read))))))))))
11851 (set-buffer gnus-group-buffer)
11852 (gnus-undo-register
11854 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
11855 (gnus-info-set-read ',info ',(gnus-info-read info))
11856 (gnus-get-unread-articles-in-group ',info
11857 (gnus-active ,group))
11858 (gnus-group-update-group ,group t)
11860 ;; Enter this list into the group info.
11861 (gnus-info-set-read info read)
11862 ;; Set the number of unread articles in gnus-newsrc-hashtb.
11863 (gnus-get-unread-articles-in-group info (gnus-active group))
11866 (defun gnus-offer-save-summaries ()
11867 "Offer to save all active summary buffers."
11869 ;; Go through all buffers and find all summaries.
11870 (dolist (buffer (buffer-list))
11871 (when (and (setq buffer (buffer-name buffer))
11872 (string-match "Summary" buffer)
11873 (with-current-buffer buffer
11874 ;; We check that this is, indeed, a summary buffer.
11875 (and (eq major-mode 'gnus-summary-mode)
11876 ;; Also make sure this isn't bogus.
11877 gnus-newsgroup-prepared
11878 ;; Also make sure that this isn't a
11879 ;; dead summary buffer.
11880 (not gnus-dead-summary-mode))))
11881 (push buffer buffers)))
11882 ;; Go through all these summary buffers and offer to save them.
11886 "Update summary buffer %s? "
11888 (switch-to-buffer buf)
11889 (gnus-summary-exit))
11892 (defun gnus-summary-setup-default-charset ()
11893 "Setup newsgroup default charset."
11894 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
11895 (setq gnus-newsgroup-charset nil)
11896 (let* ((ignored-charsets
11897 (or gnus-newsgroup-ephemeral-ignored-charsets
11899 (and gnus-newsgroup-name
11900 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
11901 gnus-newsgroup-ignored-charsets))))
11902 (setq gnus-newsgroup-charset
11903 (or gnus-newsgroup-ephemeral-charset
11904 (and gnus-newsgroup-name
11905 (gnus-parameter-charset gnus-newsgroup-name))
11906 gnus-default-charset))
11907 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
11908 ignored-charsets))))
11914 (defun gnus-summary-display-buttonized (&optional show-all-parts)
11915 "Display the current article buffer fully MIME-buttonized.
11916 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
11917 treated as multipart/mixed."
11919 (require 'gnus-art)
11920 (let ((gnus-unbuttonized-mime-types nil)
11921 (gnus-mime-display-multipart-as-mixed show-all-parts))
11922 (gnus-summary-show-article)))
11924 (defun gnus-summary-repair-multipart (article)
11925 "Add a Content-Type header to a multipart article without one."
11926 (interactive (list (gnus-summary-article-number)))
11927 (gnus-with-article article
11928 (message-narrow-to-head)
11929 (message-remove-header "Mime-Version")
11930 (goto-char (point-max))
11931 (insert "Mime-Version: 1.0\n")
11933 (when (search-forward "\n--" nil t)
11934 (let ((separator (buffer-substring (point) (point-at-eol))))
11935 (message-narrow-to-head)
11936 (message-remove-header "Content-Type")
11937 (goto-char (point-max))
11938 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
11941 (let (gnus-mark-article-hook)
11942 (gnus-summary-select-article t t nil article)))
11944 (defun gnus-summary-toggle-display-buttonized ()
11945 "Toggle the buttonizing of the article buffer."
11947 (require 'gnus-art)
11948 (if (setq gnus-inhibit-mime-unbuttonizing
11949 (not gnus-inhibit-mime-unbuttonizing))
11950 (let ((gnus-unbuttonized-mime-types nil))
11951 (gnus-summary-show-article))
11952 (gnus-summary-show-article)))
11955 ;;; Generic summary marking commands
11958 (defvar gnus-summary-marking-alist
11959 '((read gnus-del-mark "d")
11960 (unread gnus-unread-mark "u")
11961 (ticked gnus-ticked-mark "!")
11962 (dormant gnus-dormant-mark "?")
11963 (expirable gnus-expirable-mark "e"))
11964 "An alist of names/marks/keystrokes.")
11966 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
11967 (defvar gnus-summary-mark-map)
11969 (defun gnus-summary-make-all-marking-commands ()
11970 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
11971 (dolist (elem gnus-summary-marking-alist)
11972 (apply 'gnus-summary-make-marking-command elem)))
11974 (defun gnus-summary-make-marking-command (name mark keystroke)
11975 (let ((map (make-sparse-keymap)))
11976 (define-key gnus-summary-generic-mark-map keystroke map)
11977 (dolist (lway `((next "next" next nil "n")
11978 (next-unread "next unread" next t "N")
11979 (prev "previous" prev nil "p")
11980 (prev-unread "previous unread" prev t "P")
11981 (nomove "" nil nil ,keystroke)))
11982 (let ((func (gnus-summary-make-marking-command-1
11983 mark (car lway) lway name)))
11984 (setq func (eval func))
11985 (define-key map (nth 4 lway) func)))))
11987 (defun gnus-summary-make-marking-command-1 (mark way lway name)
11989 (format "gnus-summary-put-mark-as-%s%s"
11990 name (if (eq way 'nomove)
11992 (concat "-" (symbol-name way)))))
11995 "Mark the current article as %s%s.
11996 If N, the prefix, then repeat N times.
11997 If N is negative, move in reverse order.
11998 The difference between N and the actual number of articles marked is
12002 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12004 (defun gnus-summary-generic-mark (n mark move unread)
12005 "Mark N articles with MARK."
12006 (unless (eq major-mode 'gnus-summary-mode)
12007 (error "This command can only be used in the summary buffer"))
12008 (gnus-summary-show-thread)
12011 ((eq move 'next) 1)
12012 ((eq move 'prev) -1)
12014 (if (zerop nummove)
12018 nummove (* -1 nummove))))
12019 (while (and (> n 0)
12020 (gnus-summary-mark-article nil mark)
12021 (zerop (gnus-summary-next-subject nummove unread t)))
12024 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12025 (gnus-summary-recenter)
12026 (gnus-summary-position-point)
12027 (gnus-set-mode-line 'summary)
12030 (defun gnus-summary-insert-articles (articles)
12031 (when (setq articles
12032 (gnus-sorted-difference articles
12033 (mapcar (lambda (h)
12034 (mail-header-number h))
12035 gnus-newsgroup-headers)))
12036 (setq gnus-newsgroup-headers
12038 gnus-newsgroup-headers
12039 (gnus-fetch-headers articles)
12040 'gnus-article-sort-by-number))
12041 ;; Suppress duplicates?
12042 (when gnus-suppress-duplicates
12043 (gnus-dup-suppress-articles))
12045 ;; We might want to build some more threads first.
12046 (when (and gnus-fetch-old-headers
12047 (eq gnus-headers-retrieved-by 'nov))
12048 (if (eq gnus-fetch-old-headers 'invisible)
12049 (gnus-build-all-threads)
12050 (gnus-build-old-threads)))
12051 ;; Let the Gnus agent mark articles as read.
12053 (gnus-agent-get-undownloaded-list))
12054 ;; Remove list identifiers from subject
12055 (when gnus-list-identifiers
12056 (gnus-summary-remove-list-identifiers))
12057 ;; First and last article in this newsgroup.
12058 (when gnus-newsgroup-headers
12059 (setq gnus-newsgroup-begin
12060 (mail-header-number (car gnus-newsgroup-headers))
12062 (mail-header-number
12063 (gnus-last-element gnus-newsgroup-headers))))
12064 (when gnus-use-scoring
12065 (gnus-possibly-score-headers))))
12067 (defun gnus-summary-insert-old-articles (&optional all)
12068 "Insert all old articles in this group.
12069 If ALL is non-nil, already read articles become readable.
12070 If ALL is a number, fetch this number of articles."
12073 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12076 ;; Some nntp servers lie about their active range. When
12077 ;; this happens, the active range can be in the millions.
12078 ;; Use a compressed range to avoid creating a huge list.
12079 (gnus-range-difference (list gnus-newsgroup-active) old))
12080 (setq len (gnus-range-length older))
12085 (let ((older-range (nreverse older)))
12089 (let* ((r (pop older-range))
12090 (min (if (numberp r) r (car r)))
12091 (max (if (numberp r) r (cdr r))))
12092 (while (and (<= min max)
12097 (setq older (gnus-uncompress-range older))))
12099 (setq older (gnus-uncompress-range older)))
12101 (when (and (numberp gnus-large-newsgroup)
12102 (> len gnus-large-newsgroup))
12103 (let* ((cursor-in-echo-area nil)
12104 (initial (gnus-parameter-large-newsgroup-initial
12105 gnus-newsgroup-name))
12109 "How many articles from %s (%s %d): "
12111 (gnus-group-decoded-name gnus-newsgroup-name) 35)
12112 (if initial "max" "default")
12115 (cons (number-to-string initial)
12117 (unless (string-match "^[ \t]*$" input)
12118 (setq all (string-to-number input))
12120 (let ((older-range (nreverse older)))
12124 (let* ((r (pop older-range))
12125 (min (if (numberp r) r (car r)))
12126 (max (if (numberp r) r (cdr r))))
12127 (while (and (<= min max)
12131 max (1- max))))))))))
12132 (setq older (gnus-uncompress-range older))))
12134 (message "No old news.")
12135 (gnus-summary-insert-articles older)
12136 (gnus-summary-limit (gnus-sorted-nunion old older))))
12137 (gnus-summary-position-point)))
12139 (defun gnus-summary-insert-new-articles ()
12140 "Insert all new articles in this group."
12143 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12144 (old-active gnus-newsgroup-active)
12145 (nnmail-fetched-sources (list t))
12147 (setq gnus-newsgroup-active
12148 (gnus-activate-group gnus-newsgroup-name 'scan))
12149 (setq i (cdr gnus-newsgroup-active))
12150 (while (> i (cdr old-active))
12154 (message "No gnus is bad news")
12155 (gnus-summary-insert-articles new)
12156 (setq gnus-newsgroup-unreads
12157 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12158 (gnus-summary-limit (gnus-sorted-nunion old new))))
12159 (gnus-summary-position-point)))
12161 (gnus-summary-make-all-marking-commands)
12163 (gnus-ems-redefine)
12165 (provide 'gnus-sum)
12167 (run-hooks 'gnus-sum-load-hook)
12169 ;; Local Variables:
12170 ;; coding: iso-8859-1
12173 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12174 ;;; gnus-sum.el ends here