1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (defvar tool-bar-mode))
45 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
46 (autoload 'gnus-cache-write-active "gnus-cache")
47 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
48 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
49 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
50 (autoload 'mm-uu-dissect "mm-uu")
51 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
52 "Deuglify broken Outlook (Express) articles and redisplay."
54 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
55 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
56 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
58 (defcustom gnus-kill-summary-on-exit t
59 "*If non-nil, kill the summary buffer when you exit from it.
60 If nil, the summary will become a \"*Dead Summary*\" buffer, and
61 it will be killed sometime later."
62 :group 'gnus-summary-exit
65 (defcustom gnus-summary-next-group-on-exit t
66 "If non-nil, go to the next unread newsgroup on summary exit.
67 See `gnus-group-goto-unread'."
68 :link '(custom-manual "(gnus)Group Maneuvering")
69 :group 'gnus-summary-exit
70 :version "23.0" ;; No Gnus
73 (defcustom gnus-fetch-old-headers nil
74 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
75 If an unread article in the group refers to an older, already
76 read (or just marked as read) article, the old article will not
77 normally be displayed in the Summary buffer. If this variable is
78 t, Gnus will attempt to grab the headers to the old articles, and
79 thereby build complete threads. If it has the value `some', all
80 old headers will be fetched but only enough headers to connect
81 otherwise loose threads will be displayed. This variable can
82 also be a number. In that case, no more than that number of old
83 headers will be fetched. If it has the value `invisible', all
84 old headers will be fetched, but none will be displayed.
86 The server has to support NOV for any of this to work.
88 This feature can seriously impact performance it ignores all
89 locally cached header entries."
91 :type '(choice (const :tag "off" nil)
96 (sexp :menu-tag "other" t)))
98 (defcustom gnus-refer-thread-limit 500
99 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
100 If t, fetch all the available old headers."
102 :type '(choice number
103 (sexp :menu-tag "other" t)))
105 (defcustom gnus-summary-make-false-root 'adopt
106 "*nil means that Gnus won't gather loose threads.
107 If the root of a thread has expired or been read in a previous
108 session, the information necessary to build a complete thread has been
109 lost. Instead of having many small sub-threads from this original thread
110 scattered all over the summary buffer, Gnus can gather them.
112 If non-nil, Gnus will try to gather all loose sub-threads from an
113 original thread into one large thread.
115 If this variable is non-nil, it should be one of `none', `adopt',
118 If this variable is `none', Gnus will not make a false root, but just
119 present the sub-threads after another.
120 If this variable is `dummy', Gnus will create a dummy root that will
121 have all the sub-threads as children.
122 If this variable is `adopt', Gnus will make one of the \"children\"
123 the parent and mark all the step-children as such.
124 If this variable is `empty', the \"children\" are printed with empty
125 subject fields. (Or rather, they will be printed with a string
126 given by the `gnus-summary-same-subject' variable.)"
128 :type '(choice (const :tag "off" nil)
134 (defcustom gnus-summary-make-false-root-always nil
135 "Always make a false dummy root."
140 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
141 "*A regexp to match subjects to be excluded from loose thread gathering.
142 As loose thread gathering is done on subjects only, that means that
143 there can be many false gatherings performed. By rooting out certain
144 common subjects, gathering might become saner."
148 (defcustom gnus-summary-gather-subject-limit nil
149 "*Maximum length of subject comparisons when gathering loose threads.
150 Use nil to compare full subjects. Setting this variable to a low
151 number will help gather threads that have been corrupted by
152 newsreaders chopping off subject lines, but it might also mean that
153 unrelated articles that have subject that happen to begin with the
154 same few characters will be incorrectly gathered.
156 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
159 :type '(choice (const :tag "off" nil)
161 (sexp :menu-tag "on" t)))
163 (defcustom gnus-simplify-subject-functions nil
164 "List of functions taking a string argument that simplify subjects.
165 The functions are applied recursively.
167 Useful functions to put in this list include:
168 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
169 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
171 :type '(repeat function))
173 (defcustom gnus-simplify-ignored-prefixes nil
174 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
176 :type '(choice (const :tag "off" nil)
179 (defcustom gnus-build-sparse-threads nil
180 "*If non-nil, fill in the gaps in threads.
181 If `some', only fill in the gaps that are needed to tie loose threads
182 together. If `more', fill in all leaf nodes that Gnus can find. If
183 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
185 :type '(choice (const :tag "off" nil)
188 (sexp :menu-tag "all" t)))
190 (defcustom gnus-summary-thread-gathering-function
191 'gnus-gather-threads-by-subject
192 "*Function used for gathering loose threads.
193 There are two pre-defined functions: `gnus-gather-threads-by-subject',
194 which only takes Subjects into consideration; and
195 `gnus-gather-threads-by-references', which compared the References
196 headers of the articles to find matches."
198 :type '(radio (function-item gnus-gather-threads-by-subject)
199 (function-item gnus-gather-threads-by-references)
200 (function :tag "other")))
202 (defcustom gnus-summary-same-subject ""
203 "*String indicating that the current article has the same subject as the previous.
204 This variable will only be used if the value of
205 `gnus-summary-make-false-root' is `empty'."
206 :group 'gnus-summary-format
209 (defcustom gnus-summary-goto-unread t
210 "*If t, many commands will go to the next unread article.
211 This applies to marking commands as well as other commands that
212 \"naturally\" select the next article, like, for instance, `SPC' at
213 the end of an article.
215 If nil, the marking commands do NOT go to the next unread article
216 \(they go to the next article instead). If `never', commands that
217 usually go to the next unread article, will go to the next article,
218 whether it is read or not."
219 :group 'gnus-summary-marks
220 :link '(custom-manual "(gnus)Setting Marks")
221 :type '(choice (const :tag "off" nil)
223 (sexp :menu-tag "on" t)))
225 (defcustom gnus-summary-default-score 0
226 "*Default article score level.
227 All scores generated by the score files will be added to this score.
228 If this variable is nil, scoring will be disabled."
229 :group 'gnus-score-default
230 :type '(choice (const :tag "disable")
233 (defcustom gnus-summary-default-high-score 0
234 "*Default threshold for a high scored article.
235 An article will be highlighted as high scored if its score is greater
238 :group 'gnus-score-default
241 (defcustom gnus-summary-default-low-score 0
242 "*Default threshold for a low scored article.
243 An article will be highlighted as low scored if its score is smaller
246 :group 'gnus-score-default
249 (defcustom gnus-summary-zcore-fuzz 0
250 "*Fuzziness factor for the zcore in the summary buffer.
251 Articles with scores closer than this to `gnus-summary-default-score'
253 :group 'gnus-summary-format
256 (defcustom gnus-simplify-subject-fuzzy-regexp nil
257 "*Strings to be removed when doing fuzzy matches.
258 This can either be a regular expression or list of regular expressions
259 that will be removed from subject strings if fuzzy subject
260 simplification is selected."
262 :type '(repeat regexp))
264 (defcustom gnus-show-threads t
265 "*If non-nil, display threads in summary mode."
269 (defcustom gnus-thread-hide-subtree nil
270 "*If non-nil, hide all threads initially.
271 This can be a predicate specifier which says which threads to hide.
272 If threads are hidden, you have to run the command
273 `gnus-summary-show-thread' by hand or select an article."
275 :type '(radio (sexp :format "Non-nil\n"
276 :match (lambda (widget value)
277 (not (or (consp value) (functionp value))))
280 (sexp :tag "Predicate specifier")))
282 (defcustom gnus-thread-hide-killed t
283 "*If non-nil, hide killed threads automatically."
287 (defcustom gnus-thread-ignore-subject t
288 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
289 If nil, articles that have different subjects from their parents will
290 start separate threads."
294 (defcustom gnus-thread-operation-ignore-subject t
295 "*If non-nil, subjects will be ignored when doing thread commands.
296 This affects commands like `gnus-summary-kill-thread' and
297 `gnus-summary-lower-thread'.
299 If this variable is nil, articles in the same thread with different
300 subjects will not be included in the operation in question. If this
301 variable is `fuzzy', only articles that have subjects that are fuzzily
302 equal will be included."
304 :type '(choice (const :tag "off" nil)
308 (defcustom gnus-thread-indent-level 4
309 "*Number that says how much each sub-thread should be indented."
313 (defcustom gnus-auto-extend-newsgroup t
314 "*If non-nil, extend newsgroup forward and backward when requested."
315 :group 'gnus-summary-choose
318 (defcustom gnus-auto-select-first t
319 "If non-nil, select an article on group entry.
320 An article is selected automatically when entering a group
321 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
322 `gnus-summary-catchup-and-goto-next-group'.
324 Which article is selected is controlled by the variable
325 `gnus-auto-select-subject'.
327 If you want to prevent automatic selection of articles in some
328 newsgroups, set the variable to nil in `gnus-select-group-hook'."
329 ;; Commands include...
330 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
331 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
332 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
333 :group 'gnus-group-select
334 :type '(choice (const :tag "none" nil)
335 (sexp :menu-tag "first" t)))
337 (defcustom gnus-auto-select-subject 'unread
338 "*Says what subject to place under point when entering a group.
340 This variable can either be the symbols `first' (place point on the
341 first subject), `unread' (place point on the subject line of the first
342 unread article), `best' (place point on the subject line of the
343 higest-scored article), `unseen' (place point on the subject line of
344 the first unseen article), `unseen-or-unread' (place point on the subject
345 line of the first unseen article or, if all article have been seen, on the
346 subject line of the first unread article), or a function to be called to
347 place point on some subject line."
349 :group 'gnus-group-select
350 :type '(choice (const best)
354 (const unseen-or-unread)))
356 (defcustom gnus-auto-select-next t
357 "*If non-nil, offer to go to the next group from the end of the previous.
358 If the value is t and the next newsgroup is empty, Gnus will exit
359 summary mode and go back to group mode. If the value is neither nil
360 nor t, Gnus will select the following unread newsgroup. In
361 particular, if the value is the symbol `quietly', the next unread
362 newsgroup will be selected without any confirmation, and if it is
363 `almost-quietly', the next group will be selected without any
364 confirmation if you are located on the last article in the group.
365 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
366 will go to the next group without confirmation."
367 :group 'gnus-summary-maneuvering
368 :type '(choice (const :tag "off" nil)
370 (const almost-quietly)
371 (const slightly-quietly)
372 (sexp :menu-tag "on" t)))
374 (defcustom gnus-auto-select-same nil
375 "*If non-nil, select the next article with the same subject.
376 If there are no more articles with the same subject, go to
377 the first unread article."
378 :group 'gnus-summary-maneuvering
381 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
382 "What article should be selected after exiting an ephemeral group.
383 Valid values include:
386 Select the next article.
388 Select the next unread article.
390 Move the cursor to the next article. This is the default.
391 `next-unread-noselect'
392 Move the cursor to the next unread article.
394 If it has any other value or there is no next (unread) article, the
395 article selected before entering to the ephemeral group will appear."
396 :version "23.0" ;; No Gnus
397 :group 'gnus-summary-maneuvering
398 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
399 (const next) (const next-unread)
400 (const next-noselect) (const next-unread-noselect)
401 (sexp :tag "other" :value nil)))
403 (defcustom gnus-auto-goto-ignores 'unfetched
404 "*Says how to handle unfetched articles when maneuvering.
406 This variable can either be the symbols nil (maneuver to any
407 article), `undownloaded' (maneuvering while unplugged ignores articles
408 that have not been fetched), `always-undownloaded' (maneuvering always
409 ignores articles that have not been fetched), `unfetched' (maneuvering
410 ignores articles whose headers have not been fetched).
412 NOTE: The list of unfetched articles will always be nil when plugged
413 and, when unplugged, a subset of the undownloaded article list."
415 :group 'gnus-summary-maneuvering
416 :type '(choice (const :tag "None" nil)
417 (const :tag "Undownloaded when unplugged" undownloaded)
418 (const :tag "Undownloaded" always-undownloaded)
419 (const :tag "Unfetched" unfetched)))
421 (defcustom gnus-summary-check-current nil
422 "*If non-nil, consider the current article when moving.
423 The \"unread\" movement commands will stay on the same line if the
424 current article is unread."
425 :group 'gnus-summary-maneuvering
428 (defcustom gnus-auto-center-summary 2
429 "*If non-nil, always center the current summary buffer.
430 In particular, if `vertical' do only vertical recentering. If non-nil
431 and non-`vertical', do both horizontal and vertical recentering."
432 :group 'gnus-summary-maneuvering
433 :type '(choice (const :tag "none" nil)
435 (integer :tag "height")
436 (sexp :menu-tag "both" t)))
438 (defvar gnus-auto-center-group t
439 "*If non-nil, always center the group buffer.")
441 (defcustom gnus-show-all-headers nil
442 "*If non-nil, don't hide any headers."
443 :group 'gnus-article-hiding
444 :group 'gnus-article-headers
447 (defcustom gnus-summary-ignore-duplicates nil
448 "*If non-nil, ignore articles with identical Message-ID headers."
452 (defcustom gnus-single-article-buffer t
453 "*If non-nil, display all articles in the same buffer.
454 If nil, each group will get its own article buffer."
455 :group 'gnus-article-various
458 (defcustom gnus-break-pages t
459 "*If non-nil, do page breaking on articles.
460 The page delimiter is specified by the `gnus-page-delimiter'
462 :group 'gnus-article-various
465 (defcustom gnus-move-split-methods nil
466 "*Variable used to suggest where articles are to be moved to.
467 It uses the same syntax as the `gnus-split-methods' variable.
468 However, whereas `gnus-split-methods' specifies file names as targets,
469 this variable specifies group names."
470 :group 'gnus-summary-mail
471 :type '(repeat (choice (list :value (fun) function)
472 (cons :value ("" "") regexp (repeat string))
475 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
476 "Function used to compute default prefix for article move/copy/etc prompts.
477 The function should take one argument, a group name, and return a
478 string with the suggested prefix."
479 :group 'gnus-summary-mail
482 ;; FIXME: Although the custom type is `character' for the following variables,
483 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
485 (defcustom gnus-unread-mark ? ;Whitespace
486 "*Mark used for unread articles."
487 :group 'gnus-summary-marks
490 (defcustom gnus-ticked-mark ?!
491 "*Mark used for ticked articles."
492 :group 'gnus-summary-marks
495 (defcustom gnus-dormant-mark ??
496 "*Mark used for dormant articles."
497 :group 'gnus-summary-marks
500 (defcustom gnus-del-mark ?r
501 "*Mark used for del'd articles."
502 :group 'gnus-summary-marks
505 (defcustom gnus-read-mark ?R
506 "*Mark used for read articles."
507 :group 'gnus-summary-marks
510 (defcustom gnus-expirable-mark ?E
511 "*Mark used for expirable articles."
512 :group 'gnus-summary-marks
515 (defcustom gnus-killed-mark ?K
516 "*Mark used for killed articles."
517 :group 'gnus-summary-marks
520 (defcustom gnus-spam-mark ?$
521 "*Mark used for spam articles."
523 :group 'gnus-summary-marks
526 (defcustom gnus-souped-mark ?F
527 "*Mark used for souped articles."
528 :group 'gnus-summary-marks
531 (defcustom gnus-kill-file-mark ?X
532 "*Mark used for articles killed by kill files."
533 :group 'gnus-summary-marks
536 (defcustom gnus-low-score-mark ?Y
537 "*Mark used for articles with a low score."
538 :group 'gnus-summary-marks
541 (defcustom gnus-catchup-mark ?C
542 "*Mark used for articles that are caught up."
543 :group 'gnus-summary-marks
546 (defcustom gnus-replied-mark ?A
547 "*Mark used for articles that have been replied to."
548 :group 'gnus-summary-marks
551 (defcustom gnus-forwarded-mark ?F
552 "*Mark used for articles that have been forwarded."
554 :group 'gnus-summary-marks
557 (defcustom gnus-recent-mark ?N
558 "*Mark used for articles that are recent."
560 :group 'gnus-summary-marks
563 (defcustom gnus-cached-mark ?*
564 "*Mark used for articles that are in the cache."
565 :group 'gnus-summary-marks
568 (defcustom gnus-saved-mark ?S
569 "*Mark used for articles that have been saved."
570 :group 'gnus-summary-marks
573 (defcustom gnus-unseen-mark ?.
574 "*Mark used for articles that haven't been seen."
576 :group 'gnus-summary-marks
579 (defcustom gnus-no-mark ? ;Whitespace
580 "*Mark used for articles that have no other secondary mark."
582 :group 'gnus-summary-marks
585 (defcustom gnus-ancient-mark ?O
586 "*Mark used for ancient articles."
587 :group 'gnus-summary-marks
590 (defcustom gnus-sparse-mark ?Q
591 "*Mark used for sparsely reffed articles."
592 :group 'gnus-summary-marks
595 (defcustom gnus-canceled-mark ?G
596 "*Mark used for canceled articles."
597 :group 'gnus-summary-marks
600 (defcustom gnus-duplicate-mark ?M
601 "*Mark used for duplicate articles."
602 :group 'gnus-summary-marks
605 (defcustom gnus-undownloaded-mark ?-
606 "*Mark used for articles that weren't downloaded."
608 :group 'gnus-summary-marks
611 (defcustom gnus-downloaded-mark ?+
612 "*Mark used for articles that were downloaded."
613 :group 'gnus-summary-marks
616 (defcustom gnus-downloadable-mark ?%
617 "*Mark used for articles that are to be downloaded."
618 :group 'gnus-summary-marks
621 (defcustom gnus-unsendable-mark ?=
622 "*Mark used for articles that won't be sent."
623 :group 'gnus-summary-marks
626 (defcustom gnus-score-over-mark ?+
627 "*Score mark used for articles with high scores."
628 :group 'gnus-summary-marks
631 (defcustom gnus-score-below-mark ?-
632 "*Score mark used for articles with low scores."
633 :group 'gnus-summary-marks
636 (defcustom gnus-empty-thread-mark ? ;Whitespace
637 "*There is no thread under the article."
638 :group 'gnus-summary-marks
641 (defcustom gnus-not-empty-thread-mark ?=
642 "*There is a thread under the article."
643 :group 'gnus-summary-marks
646 (defcustom gnus-view-pseudo-asynchronously nil
647 "*If non-nil, Gnus will view pseudo-articles asynchronously."
648 :group 'gnus-extract-view
651 (defcustom gnus-auto-expirable-marks
652 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
653 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
654 gnus-souped-mark gnus-duplicate-mark)
655 "*The list of marks converted into expiration if a group is auto-expirable."
658 :type '(repeat character))
660 (defcustom gnus-inhibit-user-auto-expire t
661 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
666 (defcustom gnus-view-pseudos nil
667 "*If `automatic', pseudo-articles will be viewed automatically.
668 If `not-confirm', pseudos will be viewed automatically, and the user
669 will not be asked to confirm the command."
670 :group 'gnus-extract-view
671 :type '(choice (const :tag "off" nil)
673 (const not-confirm)))
675 (defcustom gnus-view-pseudos-separately t
676 "*If non-nil, one pseudo-article will be created for each file to be viewed.
677 If nil, all files that use the same viewing command will be given as a
678 list of parameters to that command."
679 :group 'gnus-extract-view
682 (defcustom gnus-insert-pseudo-articles t
683 "*If non-nil, insert pseudo-articles when decoding articles."
684 :group 'gnus-extract-view
687 (defcustom gnus-summary-dummy-line-format
689 "*The format specification for the dummy roots in the summary buffer.
690 It works along the same lines as a normal formatting string,
691 with some simple extensions.
695 General format specifiers can also be used.
696 See `(gnus)Formatting Variables'."
697 :link '(custom-manual "(gnus)Formatting Variables")
698 :group 'gnus-threading
701 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
702 "*The format specification for the summary mode line.
703 It works along the same lines as a normal formatting string,
704 with some simple extensions:
707 %p Unprefixed group name
708 %A Current article number
709 %z Current article score
711 %U Number of unread articles in the group
712 %e Number of unselected articles in the group
713 %Z A string with unread/unselected article counts
714 %g Shortish group name
715 %S Subject of the current article
717 %s Current score file name
718 %d Number of dormant articles
719 %r Number of articles that have been marked as read in this session
720 %E Number of articles expunged by the score files"
721 :group 'gnus-summary-format
724 (defcustom gnus-list-identifiers nil
725 "Regexp that matches list identifiers to be removed from subject.
726 This can also be a list of regexps."
728 :group 'gnus-summary-format
729 :group 'gnus-article-hiding
730 :type '(choice (const :tag "none" nil)
732 (repeat :value (".*") regexp)))
734 (defcustom gnus-summary-mark-below 0
735 "*Mark all articles with a score below this variable as read.
736 This variable is local to each summary buffer and usually set by the
738 :group 'gnus-score-default
741 (defun gnus-widget-reversible-match (widget value)
742 "Ignoring WIDGET, convert VALUE to internal form.
743 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
747 (eq (length value) 2)
748 (eq (nth 0 value) 'not)
749 (symbolp (nth 1 value)))))
751 (defun gnus-widget-reversible-to-internal (widget value)
752 "Ignoring WIDGET, convert VALUE to internal form.
753 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
754 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
758 (list (nth 1 value) t)))
760 (defun gnus-widget-reversible-to-external (widget value)
761 "Ignoring WIDGET, convert VALUE to external form.
762 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
763 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
766 (list 'not (nth 0 value))
769 (define-widget 'gnus-widget-reversible 'group
770 "A `group' that convert values."
771 :match 'gnus-widget-reversible-match
772 :value-to-internal 'gnus-widget-reversible-to-internal
773 :value-to-external 'gnus-widget-reversible-to-external)
775 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
776 "*List of functions used for sorting articles in the summary buffer.
778 Each function takes two articles and returns non-nil if the first
779 article should be sorted before the other. If you use more than one
780 function, the primary sort function should be the last. You should
781 probably always include `gnus-article-sort-by-number' in the list of
782 sorting functions -- preferably first. Also note that sorting by date
783 is often much slower than sorting by number, and the sorting order is
784 very similar. (Sorting by date means sorting by the time the message
785 was sent, sorting by number means sorting by arrival time.)
787 Each item can also be a list `(not F)' where F is a function;
788 this reverses the sort order.
790 Ready-made functions include `gnus-article-sort-by-number',
791 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
792 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
793 and `gnus-article-sort-by-score'.
795 When threading is turned on, the variable `gnus-thread-sort-functions'
796 controls how articles are sorted."
797 :group 'gnus-summary-sort
798 :type '(repeat (gnus-widget-reversible
799 (choice (function-item gnus-article-sort-by-number)
800 (function-item gnus-article-sort-by-author)
801 (function-item gnus-article-sort-by-subject)
802 (function-item gnus-article-sort-by-date)
803 (function-item gnus-article-sort-by-score)
804 (function-item gnus-article-sort-by-random)
805 (function :tag "other"))
806 (boolean :tag "Reverse order"))))
809 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
810 "*List of functions used for sorting threads in the summary buffer.
811 By default, threads are sorted by article number.
813 Each function takes two threads and returns non-nil if the first
814 thread should be sorted before the other. If you use more than one
815 function, the primary sort function should be the last. You should
816 probably always include `gnus-thread-sort-by-number' in the list of
817 sorting functions -- preferably first. Also note that sorting by date
818 is often much slower than sorting by number, and the sorting order is
819 very similar. (Sorting by date means sorting by the time the message
820 was sent, sorting by number means sorting by arrival time.)
822 Each list item can also be a list `(not F)' where F is a
823 function; this specifies reversed sort order.
825 Ready-made functions include `gnus-thread-sort-by-number',
826 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
827 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
828 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
829 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
830 and `gnus-thread-sort-by-total-score' (see
831 `gnus-thread-score-function').
833 When threading is turned off, the variable
834 `gnus-article-sort-functions' controls how articles are sorted."
835 :group 'gnus-summary-sort
837 (gnus-widget-reversible
838 (choice (function-item gnus-thread-sort-by-number)
839 (function-item gnus-thread-sort-by-author)
840 (function-item gnus-thread-sort-by-recipient)
841 (function-item gnus-thread-sort-by-subject)
842 (function-item gnus-thread-sort-by-date)
843 (function-item gnus-thread-sort-by-score)
844 (function-item gnus-thread-sort-by-most-recent-number)
845 (function-item gnus-thread-sort-by-most-recent-date)
846 (function-item gnus-thread-sort-by-random)
847 (function-item gnus-thread-sort-by-total-score)
848 (function :tag "other"))
849 (boolean :tag "Reverse order"))))
851 (defcustom gnus-thread-score-function '+
852 "*Function used for calculating the total score of a thread.
854 The function is called with the scores of the article and each
855 subthread and should then return the score of the thread.
857 Some functions you can use are `+', `max', or `min'."
858 :group 'gnus-summary-sort
861 (defcustom gnus-summary-expunge-below nil
862 "All articles that have a score less than this variable will be expunged.
863 This variable is local to the summary buffers."
864 :group 'gnus-score-default
865 :type '(choice (const :tag "off" nil)
868 (defcustom gnus-thread-expunge-below nil
869 "All threads that have a total score less than this variable will be expunged.
870 See `gnus-thread-score-function' for en explanation of what a
873 This variable is local to the summary buffers."
874 :group 'gnus-threading
875 :group 'gnus-score-default
876 :type '(choice (const :tag "off" nil)
879 (defcustom gnus-summary-mode-hook nil
880 "*A hook for Gnus summary mode.
881 This hook is run before any variables are set in the summary buffer."
882 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
883 :group 'gnus-summary-various
886 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
887 (when (featurep 'xemacs)
888 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
889 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
890 (add-hook 'gnus-summary-mode-hook
891 'gnus-xmas-switch-horizontal-scrollbar-off))
893 (defcustom gnus-summary-menu-hook nil
894 "*Hook run after the creation of the summary mode menu."
895 :group 'gnus-summary-visual
898 (defcustom gnus-summary-exit-hook nil
899 "*A hook called on exit from the summary buffer.
900 It will be called with point in the group buffer."
901 :group 'gnus-summary-exit
904 (defcustom gnus-summary-prepare-hook nil
905 "*A hook called after the summary buffer has been generated.
906 If you want to modify the summary buffer, you can use this hook."
907 :group 'gnus-summary-various
910 (defcustom gnus-summary-prepared-hook nil
911 "*A hook called as the last thing after the summary buffer has been generated."
912 :group 'gnus-summary-various
915 (defcustom gnus-summary-generate-hook nil
916 "*A hook run just before generating the summary buffer.
917 This hook is commonly used to customize threading variables and the
919 :group 'gnus-summary-various
922 (defcustom gnus-select-group-hook nil
923 "*A hook called when a newsgroup is selected.
925 If you'd like to simplify subjects like the
926 `gnus-summary-next-same-subject' command does, you can use the
929 (add-hook gnus-select-group-hook
931 (mapcar (lambda (header)
932 (mail-header-set-subject
934 (gnus-simplify-subject
935 (mail-header-subject header) 're-only)))
936 gnus-newsgroup-headers)))"
937 :group 'gnus-group-select
940 (defcustom gnus-select-article-hook nil
941 "*A hook called when an article is selected."
942 :group 'gnus-summary-choose
943 :options '(gnus-agent-fetch-selected-article)
946 (defcustom gnus-visual-mark-article-hook
947 (list 'gnus-highlight-selected-summary)
948 "*Hook run after selecting an article in the summary buffer.
949 It is meant to be used for highlighting the article in some way. It
950 is not run if `gnus-visual' is nil."
951 :group 'gnus-summary-visual
954 (defcustom gnus-parse-headers-hook nil
955 "*A hook called before parsing the headers."
959 (defcustom gnus-exit-group-hook nil
960 "*A hook called when exiting summary mode.
961 This hook is not called from the non-updating exit commands like `Q'."
965 (defcustom gnus-summary-update-hook
966 (list 'gnus-summary-highlight-line)
967 "*A hook called when a summary line is changed.
968 The hook will not be called if `gnus-visual' is nil.
970 The default function `gnus-summary-highlight-line' will
971 highlight the line according to the `gnus-summary-highlight'
973 :group 'gnus-summary-visual
976 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
977 "*A hook called when an article is selected for the first time.
978 The hook is intended to mark an article as read (or unread)
979 automatically when it is selected."
980 :group 'gnus-summary-choose
983 (defcustom gnus-group-no-more-groups-hook nil
984 "*A hook run when returning to group mode having no more (unread) groups."
985 :group 'gnus-group-select
988 (defcustom gnus-ps-print-hook nil
989 "*A hook run before ps-printing something from Gnus."
993 (defcustom gnus-summary-article-move-hook nil
994 "*A hook called after an article is moved, copied, respooled, or crossposted."
999 (defcustom gnus-summary-article-delete-hook nil
1000 "*A hook called after an article is deleted."
1002 :group 'gnus-summary
1005 (defcustom gnus-summary-article-expire-hook nil
1006 "*A hook called after an article is expired."
1008 :group 'gnus-summary
1011 (defcustom gnus-summary-display-arrow
1012 (and (fboundp 'display-graphic-p)
1013 (display-graphic-p))
1014 "*If non-nil, display an arrow highlighting the current article."
1016 :group 'gnus-summary
1019 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1020 "Face used for highlighting the current article in the summary buffer."
1021 :group 'gnus-summary-visual
1024 (defvar gnus-tmp-downloaded nil)
1026 (defcustom gnus-summary-highlight
1027 '(((eq mark gnus-canceled-mark)
1028 . gnus-summary-cancelled)
1029 ((and uncached (> score default-high))
1030 . gnus-summary-high-undownloaded)
1031 ((and uncached (< score default-low))
1032 . gnus-summary-low-undownloaded)
1034 . gnus-summary-normal-undownloaded)
1035 ((and (> score default-high)
1036 (or (eq mark gnus-dormant-mark)
1037 (eq mark gnus-ticked-mark)))
1038 . gnus-summary-high-ticked)
1039 ((and (< score default-low)
1040 (or (eq mark gnus-dormant-mark)
1041 (eq mark gnus-ticked-mark)))
1042 . gnus-summary-low-ticked)
1043 ((or (eq mark gnus-dormant-mark)
1044 (eq mark gnus-ticked-mark))
1045 . gnus-summary-normal-ticked)
1046 ((and (> score default-high) (eq mark gnus-ancient-mark))
1047 . gnus-summary-high-ancient)
1048 ((and (< score default-low) (eq mark gnus-ancient-mark))
1049 . gnus-summary-low-ancient)
1050 ((eq mark gnus-ancient-mark)
1051 . gnus-summary-normal-ancient)
1052 ((and (> score default-high) (eq mark gnus-unread-mark))
1053 . gnus-summary-high-unread)
1054 ((and (< score default-low) (eq mark gnus-unread-mark))
1055 . gnus-summary-low-unread)
1056 ((eq mark gnus-unread-mark)
1057 . gnus-summary-normal-unread)
1058 ((> score default-high)
1059 . gnus-summary-high-read)
1060 ((< score default-low)
1061 . gnus-summary-low-read)
1063 . gnus-summary-normal-read))
1064 "*Controls the highlighting of summary buffer lines.
1066 A list of (FORM . FACE) pairs. When deciding how a a particular
1067 summary line should be displayed, each form is evaluated. The content
1068 of the face field after the first true form is used. You can change
1069 how those summary lines are displayed, by editing the face field.
1071 You can use the following variables in the FORM field.
1073 score: The article's score
1074 default: The default article score.
1075 default-high: The default score for high scored articles.
1076 default-low: The default score for low scored articles.
1077 below: The score below which articles are automatically marked as read.
1078 mark: The article's mark.
1079 uncached: Non-nil if the article is uncached."
1080 :group 'gnus-summary-visual
1081 :type '(repeat (cons (sexp :tag "Form" nil)
1084 (defcustom gnus-alter-header-function nil
1085 "Function called to allow alteration of article header structures.
1086 The function is called with one parameter, the article header vector,
1087 which it may alter in any way."
1088 :type '(choice (const :tag "None" nil)
1090 :group 'gnus-summary)
1092 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1093 "Function used to decode a string with encoded words.")
1095 (defvar gnus-decode-encoded-address-function
1096 'mail-decode-encoded-address-string
1097 "Function used to decode addresses with encoded words.")
1099 (defcustom gnus-extra-headers '(To Newsgroups)
1100 "*Extra headers to parse."
1102 :group 'gnus-summary
1103 :type '(repeat symbol))
1105 (defcustom gnus-ignored-from-addresses
1106 (and user-mail-address
1107 (not (string= user-mail-address ""))
1108 (regexp-quote user-mail-address))
1109 "*From headers that may be suppressed in favor of To headers.
1110 This can be a regexp or a list of regexps."
1112 :group 'gnus-summary
1113 :type '(choice regexp
1114 (repeat :tag "Regexp List" regexp)))
1116 (defsubst gnus-ignored-from-addresses ()
1117 (gmm-regexp-concat gnus-ignored-from-addresses))
1119 (defcustom gnus-summary-to-prefix "-> "
1120 "*String prefixed to the To field in the summary line when
1121 using `gnus-ignored-from-addresses'."
1123 :group 'gnus-summary
1126 (defcustom gnus-summary-newsgroup-prefix "=> "
1127 "*String prefixed to the Newsgroup field in the summary
1128 line when using `gnus-ignored-from-addresses'."
1130 :group 'gnus-summary
1133 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1134 "List of charsets that should be ignored.
1135 When these charsets are used in the \"charset\" parameter, the
1136 default charset will be used instead."
1138 :type '(repeat symbol)
1139 :group 'gnus-charset)
1141 (gnus-define-group-parameter
1145 "Return the ignored charsets of GROUP."
1146 :variable gnus-group-ignored-charsets-alist
1148 '(("alt\\.chinese\\.text" iso-8859-1))
1150 "Alist of regexps (to match group names) and charsets that should be ignored.
1151 When these charsets are used in the \"charset\" parameter, the
1152 default charset will be used instead."
1153 :variable-group gnus-charset
1154 :variable-type '(repeat (cons (regexp :tag "Group")
1156 :parameter-type '(choice :tag "Ignored charsets"
1159 :parameter-document "\
1160 List of charsets that should be ignored.
1162 When these charsets are used in the \"charset\" parameter, the
1163 default charset will be used instead.")
1165 (defcustom gnus-group-highlight-words-alist nil
1166 "Alist of group regexps and highlight regexps.
1167 This variable uses the same syntax as `gnus-emphasis-alist'."
1169 :type '(repeat (cons (regexp :tag "Group")
1170 (repeat (list (regexp :tag "Highlight regexp")
1171 (number :tag "Group for entire word" 0)
1172 (number :tag "Group for displayed part" 0)
1174 gnus-emphasis-highlight-words)))))
1175 :group 'gnus-summary-visual)
1177 (defcustom gnus-summary-show-article-charset-alist
1179 "Alist of number and charset.
1180 The article will be shown with the charset corresponding to the
1182 For example: ((1 . cn-gb-2312) (2 . big5))."
1184 :type '(repeat (cons (number :tag "Argument" 1)
1185 (symbol :tag "Charset")))
1186 :group 'gnus-charset)
1188 (defcustom gnus-preserve-marks t
1189 "Whether marks are preserved when moving, copying and respooling messages."
1192 :group 'gnus-summary-marks)
1194 (defcustom gnus-alter-articles-to-read-function nil
1195 "Function to be called to alter the list of articles to be selected."
1196 :type '(choice (const nil) function)
1197 :group 'gnus-summary)
1199 (defcustom gnus-orphan-score nil
1200 "*All orphans get this score added. Set in the score file."
1201 :group 'gnus-score-default
1202 :type '(choice (const nil)
1205 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1206 "*A regexp to match MIME parts when saving multiple parts of a
1207 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1208 This regexp will be used by default when prompting the user for which
1209 type of files to save."
1210 :group 'gnus-summary
1213 (defcustom gnus-read-all-available-headers nil
1214 "Whether Gnus should parse all headers made available to it.
1215 This is mostly relevant for slow back ends where the user may
1216 wish to widen the summary buffer to include all headers
1217 that were fetched. Say, for nnultimate groups."
1219 :group 'gnus-summary
1220 :type '(choice boolean regexp))
1222 (defcustom gnus-summary-muttprint-program "muttprint"
1223 "Command (and optional arguments) used to run Muttprint."
1225 :group 'gnus-summary
1228 (defcustom gnus-article-loose-mime t
1229 "If non-nil, don't require MIME-Version header.
1230 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1231 supply the MIME-Version header or deliberately strip it from the mail.
1232 If non-nil (the default), Gnus will treat some articles as MIME
1233 even if the MIME-Version header is missing."
1236 :group 'gnus-article-mime)
1238 (defcustom gnus-article-emulate-mime t
1239 "If non-nil, use MIME emulation for uuencode and the like.
1240 This means that Gnus will search message bodies for text that look
1241 like uuencoded bits, yEncoded bits, and so on, and present that using
1242 the normal Gnus MIME machinery."
1245 :group 'gnus-article-mime)
1247 ;;; Internal variables
1249 (defvar gnus-summary-display-cache nil)
1250 (defvar gnus-article-mime-handles nil)
1251 (defvar gnus-article-decoded-p nil)
1252 (defvar gnus-article-charset nil)
1253 (defvar gnus-article-ignored-charsets nil)
1254 (defvar gnus-scores-exclude-files nil)
1255 (defvar gnus-page-broken nil)
1257 (defvar gnus-original-article nil)
1258 (defvar gnus-article-internal-prepare-hook nil)
1259 (defvar gnus-newsgroup-process-stack nil)
1261 (defvar gnus-thread-indent-array nil)
1262 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1263 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1264 "Function called to sort the articles within a thread after it has been gathered together.")
1266 (defvar gnus-summary-save-parts-type-history nil)
1267 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1269 ;; Avoid highlighting in kill files.
1270 (defvar gnus-summary-inhibit-highlight nil)
1271 (defvar gnus-newsgroup-selected-overlay nil)
1272 (defvar gnus-inhibit-limiting nil)
1273 (defvar gnus-newsgroup-adaptive-score-file nil)
1274 (defvar gnus-current-score-file nil)
1275 (defvar gnus-current-move-group nil)
1276 (defvar gnus-current-copy-group nil)
1277 (defvar gnus-current-crosspost-group nil)
1278 (defvar gnus-newsgroup-display nil)
1280 (defvar gnus-newsgroup-dependencies nil)
1281 (defvar gnus-newsgroup-adaptive nil)
1282 (defvar gnus-summary-display-article-function nil)
1283 (defvar gnus-summary-highlight-line-function nil
1284 "Function called after highlighting a summary line.")
1286 (defvar gnus-summary-line-format-alist
1287 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1288 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1289 (?s gnus-tmp-subject-or-nil ?s)
1290 (?n gnus-tmp-name ?s)
1291 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1293 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1295 (?F gnus-tmp-from ?s)
1296 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1297 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1298 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1299 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1300 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1301 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1302 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1303 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1304 (?L gnus-tmp-lines ?s)
1305 (?O gnus-tmp-downloaded ?c)
1306 (?I gnus-tmp-indentation ?s)
1307 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1308 (?R gnus-tmp-replied ?c)
1309 (?\[ gnus-tmp-opening-bracket ?c)
1310 (?\] gnus-tmp-closing-bracket ?c)
1311 (?\> (make-string gnus-tmp-level ? ) ?s)
1312 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1313 (?i gnus-tmp-score ?d)
1314 (?z gnus-tmp-score-char ?c)
1315 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1316 (?U gnus-tmp-unread ?c)
1317 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1319 (?t (gnus-summary-number-of-articles-in-thread
1320 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1322 (?e (gnus-summary-number-of-articles-in-thread
1323 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1325 (?u gnus-tmp-user-defined ?s)
1326 (?P (gnus-pick-line-number) ?d)
1327 (?B gnus-tmp-thread-tree-header-string ?s)
1328 (user-date (gnus-user-date
1329 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1330 "An alist of format specifications that can appear in summary lines.
1331 These are paired with what variables they correspond with, along with
1332 the type of the variable (string, integer, character, etc).")
1334 (defvar gnus-summary-dummy-line-format-alist
1335 `((?S gnus-tmp-subject ?s)
1336 (?N gnus-tmp-number ?d)
1337 (?u gnus-tmp-user-defined ?s)))
1339 (defvar gnus-summary-mode-line-format-alist
1340 `((?G gnus-tmp-group-name ?s)
1341 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1342 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1343 (?A gnus-tmp-article-number ?d)
1344 (?Z gnus-tmp-unread-and-unselected ?s)
1345 (?V gnus-version ?s)
1346 (?U gnus-tmp-unread-and-unticked ?d)
1347 (?S gnus-tmp-subject ?s)
1348 (?e gnus-tmp-unselected ?d)
1349 (?u gnus-tmp-user-defined ?s)
1350 (?d (length gnus-newsgroup-dormant) ?d)
1351 (?t (length gnus-newsgroup-marked) ?d)
1352 (?h (length gnus-newsgroup-spam-marked) ?d)
1353 (?r (length gnus-newsgroup-reads) ?d)
1354 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1355 (?E gnus-newsgroup-expunged-tally ?d)
1356 (?s (gnus-current-score-file-nondirectory) ?s)))
1358 (defvar gnus-last-search-regexp nil
1359 "Default regexp for article search command.")
1361 (defvar gnus-last-shell-command nil
1362 "Default shell command on article.")
1364 (defvar gnus-newsgroup-agentized nil
1365 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1366 (defvar gnus-newsgroup-begin nil)
1367 (defvar gnus-newsgroup-end nil)
1368 (defvar gnus-newsgroup-last-rmail nil)
1369 (defvar gnus-newsgroup-last-mail nil)
1370 (defvar gnus-newsgroup-last-folder nil)
1371 (defvar gnus-newsgroup-last-file nil)
1372 (defvar gnus-newsgroup-last-directory nil)
1373 (defvar gnus-newsgroup-auto-expire nil)
1374 (defvar gnus-newsgroup-active nil)
1376 (defvar gnus-newsgroup-data nil)
1377 (defvar gnus-newsgroup-data-reverse nil)
1378 (defvar gnus-newsgroup-limit nil)
1379 (defvar gnus-newsgroup-limits nil)
1380 (defvar gnus-summary-use-undownloaded-faces nil)
1382 (defvar gnus-newsgroup-unreads nil
1383 "Sorted list of unread articles in the current newsgroup.")
1385 (defvar gnus-newsgroup-unselected nil
1386 "Sorted list of unselected unread articles in the current newsgroup.")
1388 (defvar gnus-newsgroup-reads nil
1389 "Alist of read articles and article marks in the current newsgroup.")
1391 (defvar gnus-newsgroup-expunged-tally nil)
1393 (defvar gnus-newsgroup-marked nil
1394 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1396 (defvar gnus-newsgroup-spam-marked nil
1397 "List of ranges of articles that have been marked as spam.")
1399 (defvar gnus-newsgroup-killed nil
1400 "List of ranges of articles that have been through the scoring process.")
1402 (defvar gnus-newsgroup-cached nil
1403 "Sorted list of articles that come from the article cache.")
1405 (defvar gnus-newsgroup-saved nil
1406 "List of articles that have been saved.")
1408 (defvar gnus-newsgroup-kill-headers nil)
1410 (defvar gnus-newsgroup-replied nil
1411 "List of articles that have been replied to in the current newsgroup.")
1413 (defvar gnus-newsgroup-forwarded nil
1414 "List of articles that have been forwarded in the current newsgroup.")
1416 (defvar gnus-newsgroup-recent nil
1417 "List of articles that have are recent in the current newsgroup.")
1419 (defvar gnus-newsgroup-expirable nil
1420 "Sorted list of articles in the current newsgroup that can be expired.")
1422 (defvar gnus-newsgroup-processable nil
1423 "List of articles in the current newsgroup that can be processed.")
1425 (defvar gnus-newsgroup-downloadable nil
1426 "Sorted list of articles in the current newsgroup that can be processed.")
1428 (defvar gnus-newsgroup-unfetched nil
1429 "Sorted list of articles in the current newsgroup whose headers have
1430 not been fetched into the agent.
1432 This list will always be a subset of gnus-newsgroup-undownloaded.")
1434 (defvar gnus-newsgroup-undownloaded nil
1435 "List of articles in the current newsgroup that haven't been downloaded.")
1437 (defvar gnus-newsgroup-unsendable nil
1438 "List of articles in the current newsgroup that won't be sent.")
1440 (defvar gnus-newsgroup-bookmarks nil
1441 "List of articles in the current newsgroup that have bookmarks.")
1443 (defvar gnus-newsgroup-dormant nil
1444 "Sorted list of dormant articles in the current newsgroup.")
1446 (defvar gnus-newsgroup-unseen nil
1447 "List of unseen articles in the current newsgroup.")
1449 (defvar gnus-newsgroup-seen nil
1450 "Range of seen articles in the current newsgroup.")
1452 (defvar gnus-newsgroup-articles nil
1453 "List of articles in the current newsgroup.")
1455 (defvar gnus-newsgroup-scored nil
1456 "List of scored articles in the current newsgroup.")
1458 (defvar gnus-newsgroup-headers nil
1459 "List of article headers in the current newsgroup.")
1461 (defvar gnus-newsgroup-threads nil)
1463 (defvar gnus-newsgroup-prepared nil
1464 "Whether the current group has been prepared properly.")
1466 (defvar gnus-newsgroup-ancient nil
1467 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1469 (defvar gnus-newsgroup-sparse nil)
1471 (defvar gnus-current-article nil)
1472 (defvar gnus-article-current nil)
1473 (defvar gnus-current-headers nil)
1474 (defvar gnus-have-all-headers nil)
1475 (defvar gnus-last-article nil)
1476 (defvar gnus-newsgroup-history nil)
1477 (defvar gnus-newsgroup-charset nil)
1478 (defvar gnus-newsgroup-ephemeral-charset nil)
1479 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1481 (defvar gnus-article-before-search nil)
1483 (defvar gnus-summary-local-variables
1484 '(gnus-newsgroup-name
1485 gnus-newsgroup-begin gnus-newsgroup-end
1486 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1487 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1488 gnus-newsgroup-last-directory
1489 gnus-newsgroup-auto-expire gnus-newsgroup-unreads
1490 gnus-newsgroup-unselected gnus-newsgroup-marked
1491 gnus-newsgroup-spam-marked
1492 gnus-newsgroup-reads gnus-newsgroup-saved
1493 gnus-newsgroup-replied gnus-newsgroup-forwarded
1494 gnus-newsgroup-recent
1495 gnus-newsgroup-expirable
1496 gnus-newsgroup-processable gnus-newsgroup-killed
1497 gnus-newsgroup-downloadable gnus-newsgroup-undownloaded
1498 gnus-newsgroup-unfetched
1499 gnus-newsgroup-unsendable gnus-newsgroup-unseen
1500 gnus-newsgroup-seen gnus-newsgroup-articles
1501 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1502 gnus-newsgroup-headers gnus-newsgroup-threads
1503 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1504 gnus-current-article gnus-current-headers gnus-have-all-headers
1505 gnus-last-article gnus-article-internal-prepare-hook
1506 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1507 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1508 gnus-thread-expunge-below
1509 gnus-score-alist gnus-current-score-file
1510 (gnus-summary-expunge-below . global)
1511 (gnus-summary-mark-below . global)
1512 (gnus-orphan-score . global)
1513 gnus-newsgroup-active gnus-scores-exclude-files
1514 gnus-newsgroup-history gnus-newsgroup-ancient
1515 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1516 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1517 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1518 (gnus-newsgroup-expunged-tally . 0)
1519 gnus-cache-removable-articles gnus-newsgroup-cached
1520 gnus-newsgroup-data gnus-newsgroup-data-reverse
1521 gnus-newsgroup-limit gnus-newsgroup-limits
1522 gnus-newsgroup-charset gnus-newsgroup-display
1523 gnus-summary-use-undownloaded-faces)
1524 "Variables that are buffer-local to the summary buffers.")
1526 (defvar gnus-newsgroup-variables nil
1527 "A list of variables that have separate values in different newsgroups.
1528 A list of newsgroup (summary buffer) local variables, or cons of
1529 variables and their default expressions to be evalled (when the default
1530 values are not nil), that should be made global while the summary buffer
1533 Note: The default expressions will be evaluated (using function `eval')
1534 before assignment to the local variable rather than just assigned to it.
1535 If the default expression is the symbol `global', that symbol will not
1536 be evaluated but the global value of the local variable will be used
1539 These variables can be used to set variables in the group parameters
1540 while still allowing them to affect operations done in other buffers.
1543 \(setq gnus-newsgroup-variables
1544 '(message-use-followup-to
1545 (gnus-visible-headers .
1546 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1549 ;; Byte-compiler warning.
1551 ;; Bind features so that require will believe that gnus-sum has
1552 ;; already been loaded (avoids infinite recursion)
1553 (let ((features (cons 'gnus-sum features)))
1554 ;; Several of the declarations in gnus-sum are needed to load the
1555 ;; following files. Right now, these definitions have been
1556 ;; compiled but not defined (evaluated). We could either do a
1557 ;; eval-and-compile about all of the declarations or evaluate the
1559 (if (boundp 'gnus-newsgroup-variables)
1561 (load "gnus-sum.el" t t t))
1563 (require 'gnus-art)))
1567 (defvar gnus-decode-encoded-word-methods
1568 '(mail-decode-encoded-word-string)
1569 "List of methods used to decode encoded words.
1571 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1572 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1573 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1574 whose names match REGEXP.
1577 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1578 mail-decode-encoded-word-string
1579 (\"chinese\" . rfc1843-decode-string))")
1581 (defvar gnus-decode-encoded-word-methods-cache nil)
1583 (defun gnus-multi-decode-encoded-word-string (string)
1584 "Apply the functions from `gnus-encoded-word-methods' that match."
1585 (unless (and gnus-decode-encoded-word-methods-cache
1586 (eq gnus-newsgroup-name
1587 (car gnus-decode-encoded-word-methods-cache)))
1588 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1591 (nconc gnus-decode-encoded-word-methods-cache (list x))
1592 (if (and gnus-newsgroup-name
1593 (string-match (car x) gnus-newsgroup-name))
1594 (nconc gnus-decode-encoded-word-methods-cache
1596 gnus-decode-encoded-word-methods))
1597 (let ((xlist gnus-decode-encoded-word-methods-cache))
1600 (setq string (funcall (pop xlist) string))))
1603 ;; Subject simplification.
1605 (defun gnus-simplify-whitespace (str)
1606 "Remove excessive whitespace from STR."
1608 (while (string-match "[ \t][ \t]+" str)
1609 (setq str (concat (substring str 0 (match-beginning 0))
1611 (substring str (match-end 0)))))
1613 (when (string-match "^[ \t]+" str)
1614 (setq str (substring str (match-end 0))))
1616 (when (string-match "[ \t]+$" str)
1617 (setq str (substring str 0 (match-beginning 0))))
1620 (defun gnus-simplify-all-whitespace (str)
1621 "Remove all whitespace from STR."
1622 (while (string-match "[ \t\n]+" str)
1623 (setq str (replace-match "" nil nil str)))
1626 (defsubst gnus-simplify-subject-re (subject)
1627 "Remove \"Re:\" from subject lines."
1628 (if (string-match message-subject-re-regexp subject)
1629 (substring subject (match-end 0))
1632 (defun gnus-simplify-subject (subject &optional re-only)
1633 "Remove `Re:' and words in parentheses.
1634 If RE-ONLY is non-nil, strip leading `Re:'s only."
1635 (let ((case-fold-search t)) ;Ignore case.
1636 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1637 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1638 (setq subject (substring subject (match-end 0))))
1639 ;; Remove uninteresting prefixes.
1640 (when (and (not re-only)
1641 gnus-simplify-ignored-prefixes
1642 (string-match gnus-simplify-ignored-prefixes subject))
1643 (setq subject (substring subject (match-end 0))))
1644 ;; Remove words in parentheses from end.
1646 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1647 (setq subject (substring subject 0 (match-beginning 0)))))
1648 ;; Return subject string.
1651 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1653 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1654 (goto-char (point-min))
1655 (while (re-search-forward regexp nil t)
1656 (replace-match (or newtext ""))))
1658 (defun gnus-simplify-buffer-fuzzy ()
1659 "Simplify string in the buffer fuzzily.
1660 The string in the accessible portion of the current buffer is simplified.
1661 It is assumed to be a single-line subject.
1662 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1663 matter is removed. Additional things can be deleted by setting
1664 `gnus-simplify-subject-fuzzy-regexp'."
1665 (let ((case-fold-search t)
1667 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1669 (while (not (eq modified-tick (buffer-modified-tick)))
1670 (setq modified-tick (buffer-modified-tick))
1672 ((listp gnus-simplify-subject-fuzzy-regexp)
1673 (mapcar 'gnus-simplify-buffer-fuzzy-step
1674 gnus-simplify-subject-fuzzy-regexp))
1675 (gnus-simplify-subject-fuzzy-regexp
1676 (gnus-simplify-buffer-fuzzy-step gnus-simplify-subject-fuzzy-regexp)))
1677 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1678 (gnus-simplify-buffer-fuzzy-step
1679 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1680 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1682 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1683 (gnus-simplify-buffer-fuzzy-step " +" " ")
1684 (gnus-simplify-buffer-fuzzy-step " $")
1685 (gnus-simplify-buffer-fuzzy-step "^ +")))
1687 (defun gnus-simplify-subject-fuzzy (subject)
1688 "Simplify a subject string fuzzily.
1689 See `gnus-simplify-buffer-fuzzy' for details."
1691 (gnus-set-work-buffer)
1692 (let ((case-fold-search t))
1693 ;; Remove uninteresting prefixes.
1694 (when (and gnus-simplify-ignored-prefixes
1695 (string-match gnus-simplify-ignored-prefixes subject))
1696 (setq subject (substring subject (match-end 0))))
1698 (inline (gnus-simplify-buffer-fuzzy))
1701 (defsubst gnus-simplify-subject-fully (subject)
1702 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1704 (gnus-simplify-subject-functions
1705 (gnus-map-function gnus-simplify-subject-functions subject))
1706 ((null gnus-summary-gather-subject-limit)
1707 (gnus-simplify-subject-re subject))
1708 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1709 (gnus-simplify-subject-fuzzy subject))
1710 ((numberp gnus-summary-gather-subject-limit)
1711 (gnus-limit-string (gnus-simplify-subject-re subject)
1712 gnus-summary-gather-subject-limit))
1716 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1717 "Check whether two subjects are equal.
1718 If optional argument SIMPLE-FIRST is t, first argument is already
1721 ((null simple-first)
1722 (equal (gnus-simplify-subject-fully s1)
1723 (gnus-simplify-subject-fully s2)))
1726 (gnus-simplify-subject-fully s2)))))
1728 (defun gnus-summary-bubble-group ()
1729 "Increase the score of the current group.
1730 This is a handy function to add to `gnus-summary-exit-hook' to
1731 increase the score of each group you read."
1732 (gnus-group-add-score gnus-newsgroup-name))
1736 ;;; Gnus summary mode
1739 (put 'gnus-summary-mode 'mode-class 'special)
1741 (defvar gnus-article-commands-menu)
1743 ;; Non-orthogonal keys
1745 (gnus-define-keys gnus-summary-mode-map
1746 " " gnus-summary-next-page
1747 "\177" gnus-summary-prev-page
1748 [delete] gnus-summary-prev-page
1749 [backspace] gnus-summary-prev-page
1750 "\r" gnus-summary-scroll-up
1751 "\M-\r" gnus-summary-scroll-down
1752 "n" gnus-summary-next-unread-article
1753 "p" gnus-summary-prev-unread-article
1754 "N" gnus-summary-next-article
1755 "P" gnus-summary-prev-article
1756 "\M-\C-n" gnus-summary-next-same-subject
1757 "\M-\C-p" gnus-summary-prev-same-subject
1758 "\M-n" gnus-summary-next-unread-subject
1759 "\M-p" gnus-summary-prev-unread-subject
1760 "." gnus-summary-first-unread-article
1761 "," gnus-summary-best-unread-article
1762 "\M-s" gnus-summary-search-article-forward
1763 "\M-r" gnus-summary-search-article-backward
1764 "\M-S" gnus-summary-repeat-search-article-forward
1765 "\M-R" gnus-summary-repeat-search-article-backward
1766 "<" gnus-summary-beginning-of-article
1767 ">" gnus-summary-end-of-article
1768 "j" gnus-summary-goto-article
1769 "^" gnus-summary-refer-parent-article
1770 "\M-^" gnus-summary-refer-article
1771 "u" gnus-summary-tick-article-forward
1772 "!" gnus-summary-tick-article-forward
1773 "U" gnus-summary-tick-article-backward
1774 "d" gnus-summary-mark-as-read-forward
1775 "D" gnus-summary-mark-as-read-backward
1776 "E" gnus-summary-mark-as-expirable
1777 "\M-u" gnus-summary-clear-mark-forward
1778 "\M-U" gnus-summary-clear-mark-backward
1779 "k" gnus-summary-kill-same-subject-and-select
1780 "\C-k" gnus-summary-kill-same-subject
1781 "\M-\C-k" gnus-summary-kill-thread
1782 "\M-\C-l" gnus-summary-lower-thread
1783 "e" gnus-summary-edit-article
1784 "#" gnus-summary-mark-as-processable
1785 "\M-#" gnus-summary-unmark-as-processable
1786 "\M-\C-t" gnus-summary-toggle-threads
1787 "\M-\C-s" gnus-summary-show-thread
1788 "\M-\C-h" gnus-summary-hide-thread
1789 "\M-\C-f" gnus-summary-next-thread
1790 "\M-\C-b" gnus-summary-prev-thread
1791 [(meta down)] gnus-summary-next-thread
1792 [(meta up)] gnus-summary-prev-thread
1793 "\M-\C-u" gnus-summary-up-thread
1794 "\M-\C-d" gnus-summary-down-thread
1795 "&" gnus-summary-execute-command
1796 "c" gnus-summary-catchup-and-exit
1797 "\C-w" gnus-summary-mark-region-as-read
1798 "\C-t" gnus-summary-toggle-truncation
1799 "?" gnus-summary-mark-as-dormant
1800 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1801 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1802 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1803 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1804 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1805 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1806 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1807 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1808 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1809 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1810 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1811 "=" gnus-summary-expand-window
1812 "\C-x\C-s" gnus-summary-reselect-current-group
1813 "\M-g" gnus-summary-rescan-group
1814 "w" gnus-summary-stop-page-breaking
1815 "\C-c\C-r" gnus-summary-caesar-message
1816 "f" gnus-summary-followup
1817 "F" gnus-summary-followup-with-original
1818 "C" gnus-summary-cancel-article
1819 "r" gnus-summary-reply
1820 "R" gnus-summary-reply-with-original
1821 "\C-c\C-f" gnus-summary-mail-forward
1822 "o" gnus-summary-save-article
1823 "\C-o" gnus-summary-save-article-mail
1824 "|" gnus-summary-pipe-output
1825 "\M-k" gnus-summary-edit-local-kill
1826 "\M-K" gnus-summary-edit-global-kill
1828 "\C-c\C-d" gnus-summary-describe-group
1829 "q" gnus-summary-exit
1830 "Q" gnus-summary-exit-no-update
1831 "\C-c\C-i" gnus-info-find-node
1832 gnus-mouse-2 gnus-mouse-pick-article
1833 [follow-link] mouse-face
1834 "m" gnus-summary-mail-other-window
1835 "a" gnus-summary-post-news
1836 "i" gnus-summary-news-other-window
1837 "x" gnus-summary-limit-to-unread
1838 "s" gnus-summary-isearch-article
1839 "t" gnus-summary-toggle-header
1840 "g" gnus-summary-show-article
1841 "l" gnus-summary-goto-last-article
1842 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1843 "\C-d" gnus-summary-enter-digest-group
1844 "\M-\C-d" gnus-summary-read-document
1845 "\M-\C-e" gnus-summary-edit-parameters
1846 "\M-\C-a" gnus-summary-customize-parameters
1848 "*" gnus-cache-enter-article
1849 "\M-*" gnus-cache-remove-article
1850 "\M-&" gnus-summary-universal-argument
1851 "\C-l" gnus-recenter
1852 "I" gnus-summary-increase-score
1853 "L" gnus-summary-lower-score
1854 "\M-i" gnus-symbolic-argument
1855 "h" gnus-summary-select-article-buffer
1857 "b" gnus-article-view-part
1858 "\M-t" gnus-summary-toggle-display-buttonized
1860 "V" gnus-summary-score-map
1861 "X" gnus-uu-extract-map
1862 "S" gnus-summary-send-map)
1864 ;; Sort of orthogonal keymap
1865 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1866 "t" gnus-summary-tick-article-forward
1867 "!" gnus-summary-tick-article-forward
1868 "d" gnus-summary-mark-as-read-forward
1869 "r" gnus-summary-mark-as-read-forward
1870 "c" gnus-summary-clear-mark-forward
1871 " " gnus-summary-clear-mark-forward
1872 "e" gnus-summary-mark-as-expirable
1873 "x" gnus-summary-mark-as-expirable
1874 "?" gnus-summary-mark-as-dormant
1875 "b" gnus-summary-set-bookmark
1876 "B" gnus-summary-remove-bookmark
1877 "#" gnus-summary-mark-as-processable
1878 "\M-#" gnus-summary-unmark-as-processable
1879 "S" gnus-summary-limit-include-expunged
1880 "C" gnus-summary-catchup
1881 "H" gnus-summary-catchup-to-here
1882 "h" gnus-summary-catchup-from-here
1883 "\C-c" gnus-summary-catchup-all
1884 "k" gnus-summary-kill-same-subject-and-select
1885 "K" gnus-summary-kill-same-subject
1886 "P" gnus-uu-mark-map)
1888 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1889 "c" gnus-summary-clear-above
1890 "u" gnus-summary-tick-above
1891 "m" gnus-summary-mark-above
1892 "k" gnus-summary-kill-below)
1894 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1895 "/" gnus-summary-limit-to-subject
1896 "n" gnus-summary-limit-to-articles
1897 "b" gnus-summary-limit-to-bodies
1898 "h" gnus-summary-limit-to-headers
1899 "w" gnus-summary-pop-limit
1900 "s" gnus-summary-limit-to-subject
1901 "a" gnus-summary-limit-to-author
1902 "u" gnus-summary-limit-to-unread
1903 "m" gnus-summary-limit-to-marks
1904 "M" gnus-summary-limit-exclude-marks
1905 "v" gnus-summary-limit-to-score
1906 "*" gnus-summary-limit-include-cached
1907 "D" gnus-summary-limit-include-dormant
1908 "T" gnus-summary-limit-include-thread
1909 "d" gnus-summary-limit-exclude-dormant
1910 "t" gnus-summary-limit-to-age
1911 "." gnus-summary-limit-to-unseen
1912 "x" gnus-summary-limit-to-extra
1913 "p" gnus-summary-limit-to-display-predicate
1914 "E" gnus-summary-limit-include-expunged
1915 "c" gnus-summary-limit-exclude-childless-dormant
1916 "C" gnus-summary-limit-mark-excluded-as-read
1917 "o" gnus-summary-insert-old-articles
1918 "N" gnus-summary-insert-new-articles
1919 "S" gnus-summary-limit-to-singletons
1920 "r" gnus-summary-limit-to-replied
1921 "R" gnus-summary-limit-to-recipient)
1923 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
1924 "n" gnus-summary-next-unread-article
1925 "p" gnus-summary-prev-unread-article
1926 "N" gnus-summary-next-article
1927 "P" gnus-summary-prev-article
1928 "\C-n" gnus-summary-next-same-subject
1929 "\C-p" gnus-summary-prev-same-subject
1930 "\M-n" gnus-summary-next-unread-subject
1931 "\M-p" gnus-summary-prev-unread-subject
1932 "f" gnus-summary-first-unread-article
1933 "b" gnus-summary-best-unread-article
1934 "j" gnus-summary-goto-article
1935 "g" gnus-summary-goto-subject
1936 "l" gnus-summary-goto-last-article
1937 "o" gnus-summary-pop-article)
1939 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
1940 "k" gnus-summary-kill-thread
1941 "l" gnus-summary-lower-thread
1942 "i" gnus-summary-raise-thread
1943 "T" gnus-summary-toggle-threads
1944 "t" gnus-summary-rethread-current
1945 "^" gnus-summary-reparent-thread
1946 "\M-^" gnus-summary-reparent-children
1947 "s" gnus-summary-show-thread
1948 "S" gnus-summary-show-all-threads
1949 "h" gnus-summary-hide-thread
1950 "H" gnus-summary-hide-all-threads
1951 "n" gnus-summary-next-thread
1952 "p" gnus-summary-prev-thread
1953 "u" gnus-summary-up-thread
1954 "o" gnus-summary-top-thread
1955 "d" gnus-summary-down-thread
1956 "#" gnus-uu-mark-thread
1957 "\M-#" gnus-uu-unmark-thread)
1959 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
1960 "g" gnus-summary-prepare
1961 "c" gnus-summary-insert-cached-articles
1962 "d" gnus-summary-insert-dormant-articles
1963 "t" gnus-summary-insert-ticked-articles)
1965 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
1966 "c" gnus-summary-catchup-and-exit
1967 "C" gnus-summary-catchup-all-and-exit
1968 "E" gnus-summary-exit-no-update
1969 "Q" gnus-summary-exit
1970 "Z" gnus-summary-exit
1971 "n" gnus-summary-catchup-and-goto-next-group
1972 "p" gnus-summary-catchup-and-goto-prev-group
1973 "R" gnus-summary-reselect-current-group
1974 "G" gnus-summary-rescan-group
1975 "N" gnus-summary-next-group
1976 "s" gnus-summary-save-newsrc
1977 "P" gnus-summary-prev-group)
1979 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
1980 " " gnus-summary-next-page
1981 "n" gnus-summary-next-page
1982 "\177" gnus-summary-prev-page
1983 [delete] gnus-summary-prev-page
1984 "p" gnus-summary-prev-page
1985 "\r" gnus-summary-scroll-up
1986 "\M-\r" gnus-summary-scroll-down
1987 "<" gnus-summary-beginning-of-article
1988 ">" gnus-summary-end-of-article
1989 "b" gnus-summary-beginning-of-article
1990 "e" gnus-summary-end-of-article
1991 "^" gnus-summary-refer-parent-article
1992 "r" gnus-summary-refer-parent-article
1993 "D" gnus-summary-enter-digest-group
1994 "R" gnus-summary-refer-references
1995 "T" gnus-summary-refer-thread
1996 "g" gnus-summary-show-article
1997 "s" gnus-summary-isearch-article
1998 "P" gnus-summary-print-article
1999 "M" gnus-mailing-list-insinuate
2000 "t" gnus-article-babel)
2002 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2003 "b" gnus-article-add-buttons
2004 "B" gnus-article-add-buttons-to-head
2005 "o" gnus-article-treat-overstrike
2006 "e" gnus-article-emphasize
2007 "w" gnus-article-fill-cited-article
2008 "Q" gnus-article-fill-long-lines
2009 "L" gnus-article-toggle-truncate-lines
2010 "C" gnus-article-capitalize-sentences
2011 "c" gnus-article-remove-cr
2012 "q" gnus-article-de-quoted-unreadable
2013 "6" gnus-article-de-base64-unreadable
2014 "Z" gnus-article-decode-HZ
2015 "A" gnus-article-treat-ansi-sequences
2016 "h" gnus-article-wash-html
2017 "u" gnus-article-unsplit-urls
2018 "s" gnus-summary-force-verify-and-decrypt
2019 "f" gnus-article-display-x-face
2020 "l" gnus-summary-stop-page-breaking
2021 "r" gnus-summary-caesar-message
2022 "m" gnus-summary-morse-message
2023 "t" gnus-summary-toggle-header
2024 "g" gnus-treat-smiley
2025 "v" gnus-summary-verbose-headers
2026 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2027 "p" gnus-article-verify-x-pgp-sig
2028 "d" gnus-article-treat-dumbquotes
2029 "i" gnus-summary-idna-message)
2031 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2032 ;; mnemonic: deuglif*Y*
2033 "u" gnus-article-outlook-unwrap-lines
2034 "a" gnus-article-outlook-repair-attribution
2035 "c" gnus-article-outlook-rearrange-citation
2036 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2038 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2039 "a" gnus-article-hide
2040 "h" gnus-article-hide-headers
2041 "b" gnus-article-hide-boring-headers
2042 "s" gnus-article-hide-signature
2043 "c" gnus-article-hide-citation
2044 "C" gnus-article-hide-citation-in-followups
2045 "l" gnus-article-hide-list-identifiers
2046 "B" gnus-article-strip-banner
2047 "P" gnus-article-hide-pem
2048 "\C-c" gnus-article-hide-citation-maybe)
2050 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2051 "a" gnus-article-highlight
2052 "h" gnus-article-highlight-headers
2053 "c" gnus-article-highlight-citation
2054 "s" gnus-article-highlight-signature)
2056 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2057 "f" gnus-article-treat-fold-headers
2058 "u" gnus-article-treat-unfold-headers
2059 "n" gnus-article-treat-fold-newsgroups)
2061 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2062 "x" gnus-article-display-x-face
2063 "d" gnus-article-display-face
2064 "s" gnus-treat-smiley
2065 "D" gnus-article-remove-images
2066 "f" gnus-treat-from-picon
2067 "m" gnus-treat-mail-picon
2068 "n" gnus-treat-newsgroups-picon)
2070 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2071 "w" gnus-article-decode-mime-words
2072 "c" gnus-article-decode-charset
2073 "v" gnus-mime-view-all-parts
2074 "b" gnus-article-view-part)
2076 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2077 "z" gnus-article-date-ut
2078 "u" gnus-article-date-ut
2079 "l" gnus-article-date-local
2080 "p" gnus-article-date-english
2081 "e" gnus-article-date-lapsed
2082 "o" gnus-article-date-original
2083 "i" gnus-article-date-iso8601
2084 "s" gnus-article-date-user)
2086 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2087 "t" gnus-article-remove-trailing-blank-lines
2088 "l" gnus-article-strip-leading-blank-lines
2089 "m" gnus-article-strip-multiple-blank-lines
2090 "a" gnus-article-strip-blank-lines
2091 "A" gnus-article-strip-all-blank-lines
2092 "s" gnus-article-strip-leading-space
2093 "e" gnus-article-strip-trailing-space
2094 "w" gnus-article-remove-leading-whitespace)
2096 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2098 "f" gnus-summary-fetch-faq
2099 "d" gnus-summary-describe-group
2100 "h" gnus-summary-describe-briefly
2101 "i" gnus-info-find-node
2102 "c" gnus-group-fetch-charter
2103 "C" gnus-group-fetch-control)
2105 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2106 "e" gnus-summary-expire-articles
2107 "\M-\C-e" gnus-summary-expire-articles-now
2108 "\177" gnus-summary-delete-article
2109 [delete] gnus-summary-delete-article
2110 [backspace] gnus-summary-delete-article
2111 "m" gnus-summary-move-article
2112 "r" gnus-summary-respool-article
2113 "w" gnus-summary-edit-article
2114 "c" gnus-summary-copy-article
2115 "B" gnus-summary-crosspost-article
2116 "q" gnus-summary-respool-query
2117 "t" gnus-summary-respool-trace
2118 "i" gnus-summary-import-article
2119 "I" gnus-summary-create-article
2120 "p" gnus-summary-article-posted-p)
2122 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2123 "o" gnus-summary-save-article
2124 "m" gnus-summary-save-article-mail
2125 "F" gnus-summary-write-article-file
2126 "r" gnus-summary-save-article-rmail
2127 "f" gnus-summary-save-article-file
2128 "b" gnus-summary-save-article-body-file
2129 "B" gnus-summary-write-article-body-file
2130 "h" gnus-summary-save-article-folder
2131 "v" gnus-summary-save-article-vm
2132 "p" gnus-summary-pipe-output
2133 "P" gnus-summary-muttprint
2134 "s" gnus-soup-add-article)
2136 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2137 "b" gnus-summary-display-buttonized
2138 "m" gnus-summary-repair-multipart
2139 "v" gnus-article-view-part
2140 "o" gnus-article-save-part
2141 "O" gnus-article-save-part-and-strip
2142 "r" gnus-article-replace-part
2143 "d" gnus-article-delete-part
2144 "t" gnus-article-view-part-as-type
2145 "j" gnus-article-jump-to-part
2146 "c" gnus-article-copy-part
2147 "C" gnus-article-view-part-as-charset
2148 "e" gnus-article-view-part-externally
2149 "H" gnus-article-browse-html-article
2150 "E" gnus-article-encrypt-body
2151 "i" gnus-article-inline-part
2152 "|" gnus-article-pipe-part)
2154 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2155 "p" gnus-summary-mark-as-processable
2156 "u" gnus-summary-unmark-as-processable
2157 "U" gnus-summary-unmark-all-processable
2158 "v" gnus-uu-mark-over
2159 "s" gnus-uu-mark-series
2160 "r" gnus-uu-mark-region
2161 "g" gnus-uu-unmark-region
2162 "R" gnus-uu-mark-by-regexp
2163 "G" gnus-uu-unmark-by-regexp
2164 "t" gnus-uu-mark-thread
2165 "T" gnus-uu-unmark-thread
2166 "a" gnus-uu-mark-all
2167 "b" gnus-uu-mark-buffer
2168 "S" gnus-uu-mark-sparse
2169 "k" gnus-summary-kill-process-mark
2170 "y" gnus-summary-yank-process-mark
2171 "w" gnus-summary-save-process-mark
2172 "i" gnus-uu-invert-processable)
2174 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2175 ;;"x" gnus-uu-extract-any
2176 "m" gnus-summary-save-parts
2177 "u" gnus-uu-decode-uu
2178 "U" gnus-uu-decode-uu-and-save
2179 "s" gnus-uu-decode-unshar
2180 "S" gnus-uu-decode-unshar-and-save
2181 "o" gnus-uu-decode-save
2182 "O" gnus-uu-decode-save
2183 "b" gnus-uu-decode-binhex
2184 "B" gnus-uu-decode-binhex
2185 "p" gnus-uu-decode-postscript
2186 "P" gnus-uu-decode-postscript-and-save)
2189 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2190 "u" gnus-uu-decode-uu-view
2191 "U" gnus-uu-decode-uu-and-save-view
2192 "s" gnus-uu-decode-unshar-view
2193 "S" gnus-uu-decode-unshar-and-save-view
2194 "o" gnus-uu-decode-save-view
2195 "O" gnus-uu-decode-save-view
2196 "b" gnus-uu-decode-binhex-view
2197 "B" gnus-uu-decode-binhex-view
2198 "p" gnus-uu-decode-postscript-view
2199 "P" gnus-uu-decode-postscript-and-save-view)
2201 (defvar gnus-article-post-menu nil)
2203 (defconst gnus-summary-menu-maxlen 20)
2205 (defun gnus-summary-menu-split (menu)
2206 ;; If we have lots of elements, divide them into groups of 20
2207 ;; and make a pane (or submenu) for each one.
2208 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2209 (let ((menu menu) sublists next
2212 ;; Pull off the next gnus-summary-menu-maxlen elements
2213 ;; and make them the next element of sublist.
2214 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2216 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2218 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2219 (aref (car (last menu)) 0)) menu)
2223 (nreverse sublists))
2224 ;; Few elements--put them all in one pane.
2227 (defun gnus-summary-make-menu-bar ()
2228 (gnus-turn-off-edit-menu 'summary)
2230 (unless (boundp 'gnus-summary-misc-menu)
2233 gnus-summary-kill-menu gnus-summary-mode-map ""
2238 ["Customize" gnus-score-customize t])
2239 (gnus-make-score-map 'increase)
2240 (gnus-make-score-map 'lower)
2242 ["Kill below" gnus-summary-kill-below t]
2243 ["Mark above" gnus-summary-mark-above t]
2244 ["Tick above" gnus-summary-tick-above t]
2245 ["Clear above" gnus-summary-clear-above t])
2246 ["Current score" gnus-summary-current-score t]
2247 ["Set score" gnus-summary-set-score t]
2248 ["Switch current score file..." gnus-score-change-score-file t]
2249 ["Set mark below..." gnus-score-set-mark-below t]
2250 ["Set expunge below..." gnus-score-set-expunge-below t]
2251 ["Edit current score file" gnus-score-edit-current-scores t]
2252 ["Edit score file" gnus-score-edit-file t]
2253 ["Trace score" gnus-score-find-trace t]
2254 ["Find words" gnus-score-find-favourite-words t]
2255 ["Rescore buffer" gnus-summary-rescore t]
2256 ["Increase score..." gnus-summary-increase-score t]
2257 ["Lower score..." gnus-summary-lower-score t]))))
2259 ;; Define both the Article menu in the summary buffer and the
2260 ;; equivalent Commands menu in the article buffer here for
2264 ["All" gnus-article-hide t]
2265 ["Headers" gnus-article-hide-headers t]
2266 ["Signature" gnus-article-hide-signature t]
2267 ["Citation" gnus-article-hide-citation t]
2268 ["List identifiers" gnus-article-hide-list-identifiers t]
2269 ["Banner" gnus-article-strip-banner t]
2270 ["Boring headers" gnus-article-hide-boring-headers t])
2272 ["All" gnus-article-highlight t]
2273 ["Headers" gnus-article-highlight-headers t]
2274 ["Signature" gnus-article-highlight-signature t]
2275 ["Citation" gnus-article-highlight-citation t])
2277 ["Words" gnus-article-decode-mime-words t]
2278 ["Charset" gnus-article-decode-charset t]
2279 ["QP" gnus-article-de-quoted-unreadable t]
2280 ["Base64" gnus-article-de-base64-unreadable t]
2281 ["View MIME buttons" gnus-summary-display-buttonized t]
2282 ["View all" gnus-mime-view-all-parts t]
2283 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2284 ["Encrypt body" gnus-article-encrypt-body
2285 :active (not (gnus-group-read-only-p))
2286 ,@(if (featurep 'xemacs) nil
2287 '(:help "Encrypt the message body on disk"))]
2288 ["Extract all parts..." gnus-summary-save-parts t]
2290 ["Repair multipart" gnus-summary-repair-multipart t]
2291 ["Pipe part..." gnus-article-pipe-part t]
2292 ["Inline part" gnus-article-inline-part t]
2293 ["View part as type..." gnus-article-view-part-as-type t]
2294 ["Encrypt body" gnus-article-encrypt-body
2295 :active (not (gnus-group-read-only-p))
2296 ,@(if (featurep 'xemacs) nil
2297 '(:help "Encrypt the message body on disk"))]
2298 ["View part externally" gnus-article-view-part-externally t]
2299 ["View HTML parts in browser" gnus-article-browse-html-article t]
2300 ["View part with charset..." gnus-article-view-part-as-charset t]
2301 ["Copy part" gnus-article-copy-part t]
2302 ["Save part..." gnus-article-save-part t]
2303 ["View part" gnus-article-view-part t]))
2305 ["Local" gnus-article-date-local t]
2306 ["ISO8601" gnus-article-date-iso8601 t]
2307 ["UT" gnus-article-date-ut t]
2308 ["Original" gnus-article-date-original t]
2309 ["Lapsed" gnus-article-date-lapsed t]
2310 ["User-defined" gnus-article-date-user t])
2312 ["Remove images" gnus-article-remove-images t]
2313 ["Toggle smiley" gnus-treat-smiley t]
2314 ["Show X-Face" gnus-article-display-x-face t]
2315 ["Show picons in From" gnus-treat-from-picon t]
2316 ["Show picons in mail headers" gnus-treat-mail-picon t]
2317 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2318 ("View as different encoding"
2319 ,@(gnus-summary-menu-split
2322 ;; Since easymenu under Emacs doesn't allow
2323 ;; lambda forms for menu commands, we should
2324 ;; provide intern'ed function symbols.
2325 (let ((command (intern (format "\
2326 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2330 (let ((gnus-summary-show-article-charset-alist
2332 (gnus-summary-show-article 1))))
2333 `[,(symbol-name cs) ,command t]))
2334 (sort (if (fboundp 'coding-system-list)
2335 (coding-system-list)
2336 (mapcar 'car mm-mime-mule-charset-alist))
2340 ["Leading" gnus-article-strip-leading-blank-lines t]
2341 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2342 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2343 ["All of the above" gnus-article-strip-blank-lines t]
2344 ["All" gnus-article-strip-all-blank-lines t]
2345 ["Leading space" gnus-article-strip-leading-space t]
2346 ["Trailing space" gnus-article-strip-trailing-space t]
2347 ["Leading space in headers"
2348 gnus-article-remove-leading-whitespace t])
2349 ["Overstrike" gnus-article-treat-overstrike t]
2350 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2351 ["Emphasis" gnus-article-emphasize t]
2352 ["Word wrap" gnus-article-fill-cited-article t]
2353 ["Fill long lines" gnus-article-fill-long-lines t]
2354 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2355 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2356 ["Remove CR" gnus-article-remove-cr t]
2357 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2358 ["Base64" gnus-article-de-base64-unreadable t]
2359 ["Rot 13" gnus-summary-caesar-message
2360 ,@(if (featurep 'xemacs) '(t)
2361 '(:help "\"Caesar rotate\" article by 13"))]
2362 ["De-IDNA" gnus-summary-idna-message t]
2363 ["Morse decode" gnus-summary-morse-message t]
2364 ["Unix pipe..." gnus-summary-pipe-message t]
2365 ["Add buttons" gnus-article-add-buttons t]
2366 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2367 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2368 ["Verbose header" gnus-summary-verbose-headers t]
2369 ["Toggle header" gnus-summary-toggle-header t]
2370 ["Unfold headers" gnus-article-treat-unfold-headers t]
2371 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2372 ["Html" gnus-article-wash-html t]
2373 ["Unsplit URLs" gnus-article-unsplit-urls t]
2374 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2375 ["Decode HZ" gnus-article-decode-HZ t]
2376 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2377 ("(Outlook) Deuglify"
2378 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2379 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2380 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2381 ["Full (Outlook) deuglify"
2382 gnus-article-outlook-deuglify-article t])
2385 ["Save in default format..." gnus-summary-save-article
2386 ,@(if (featurep 'xemacs) '(t)
2387 '(:help "Save article using default method"))]
2388 ["Save in file..." gnus-summary-save-article-file
2389 ,@(if (featurep 'xemacs) '(t)
2390 '(:help "Save article in file"))]
2391 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2392 ["Save in MH folder..." gnus-summary-save-article-folder t]
2393 ["Save in VM folder..." gnus-summary-save-article-vm t]
2394 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2395 ["Save body in file..." gnus-summary-save-article-body-file t]
2396 ["Pipe through a filter..." gnus-summary-pipe-output t]
2397 ["Add to SOUP packet" gnus-soup-add-article t]
2398 ["Print with Muttprint..." gnus-summary-muttprint t]
2399 ["Print" gnus-summary-print-article
2400 ,@(if (featurep 'xemacs) '(t)
2401 '(:help "Generate and print a PostScript image"))])
2402 ("Copy, move,... (Backend)"
2403 ,@(if (featurep 'xemacs) nil
2404 '(:help "Copying, moving, expiring articles..."))
2405 ["Respool article..." gnus-summary-respool-article t]
2406 ["Move article..." gnus-summary-move-article
2407 (gnus-check-backend-function
2408 'request-move-article gnus-newsgroup-name)]
2409 ["Copy article..." gnus-summary-copy-article t]
2410 ["Crosspost article..." gnus-summary-crosspost-article
2411 (gnus-check-backend-function
2412 'request-replace-article gnus-newsgroup-name)]
2413 ["Import file..." gnus-summary-import-article
2414 (gnus-check-backend-function
2415 'request-accept-article gnus-newsgroup-name)]
2416 ["Create article..." gnus-summary-create-article
2417 (gnus-check-backend-function
2418 'request-accept-article gnus-newsgroup-name)]
2419 ["Check if posted" gnus-summary-article-posted-p t]
2420 ["Edit article" gnus-summary-edit-article
2421 (not (gnus-group-read-only-p))]
2422 ["Delete article" gnus-summary-delete-article
2423 (gnus-check-backend-function
2424 'request-expire-articles gnus-newsgroup-name)]
2425 ["Query respool" gnus-summary-respool-query t]
2426 ["Trace respool" gnus-summary-respool-trace t]
2427 ["Delete expirable articles" gnus-summary-expire-articles-now
2428 (gnus-check-backend-function
2429 'request-expire-articles gnus-newsgroup-name)])
2431 ["Uudecode" gnus-uu-decode-uu
2432 ,@(if (featurep 'xemacs) '(t)
2433 '(:help "Decode uuencoded article(s)"))]
2434 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2435 ["Unshar" gnus-uu-decode-unshar t]
2436 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2437 ["Save" gnus-uu-decode-save t]
2438 ["Binhex" gnus-uu-decode-binhex t]
2439 ["Postscript" gnus-uu-decode-postscript t]
2440 ["All MIME parts" gnus-summary-save-parts t])
2442 ["Enter article" gnus-cache-enter-article t]
2443 ["Remove article" gnus-cache-remove-article t])
2444 ["Translate" gnus-article-babel t]
2445 ["Select article buffer" gnus-summary-select-article-buffer t]
2446 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2447 ["Isearch article..." gnus-summary-isearch-article t]
2448 ["Beginning of the article" gnus-summary-beginning-of-article t]
2449 ["End of the article" gnus-summary-end-of-article t]
2450 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2451 ["Fetch referenced articles" gnus-summary-refer-references t]
2452 ["Fetch current thread" gnus-summary-refer-thread t]
2453 ["Fetch article with id..." gnus-summary-refer-article t]
2454 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2455 ["Redisplay" gnus-summary-show-article t]
2456 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2458 gnus-summary-article-menu gnus-summary-mode-map ""
2459 (cons "Article" innards))
2461 (if (not (keymapp gnus-summary-article-menu))
2463 gnus-article-commands-menu gnus-article-mode-map ""
2464 (cons "Commands" innards))
2465 ;; in Emacs, don't share menu.
2466 (setq gnus-article-commands-menu
2467 (copy-keymap gnus-summary-article-menu))
2468 (define-key gnus-article-mode-map [menu-bar commands]
2469 (cons "Commands" gnus-article-commands-menu))))
2472 gnus-summary-thread-menu gnus-summary-mode-map ""
2474 ["Find all messages in thread" gnus-summary-refer-thread t]
2475 ["Toggle threading" gnus-summary-toggle-threads t]
2476 ["Hide threads" gnus-summary-hide-all-threads t]
2477 ["Show threads" gnus-summary-show-all-threads t]
2478 ["Hide thread" gnus-summary-hide-thread t]
2479 ["Show thread" gnus-summary-show-thread t]
2480 ["Go to next thread" gnus-summary-next-thread t]
2481 ["Go to previous thread" gnus-summary-prev-thread t]
2482 ["Go down thread" gnus-summary-down-thread t]
2483 ["Go up thread" gnus-summary-up-thread t]
2484 ["Top of thread" gnus-summary-top-thread t]
2485 ["Mark thread as read" gnus-summary-kill-thread t]
2486 ["Lower thread score" gnus-summary-lower-thread t]
2487 ["Raise thread score" gnus-summary-raise-thread t]
2488 ["Rethread current" gnus-summary-rethread-current t]))
2491 gnus-summary-post-menu gnus-summary-mode-map ""
2493 ["Send a message (mail or news)" gnus-summary-post-news
2494 ,@(if (featurep 'xemacs) '(t)
2495 '(:help "Compose a new message (mail or news)"))]
2496 ["Followup" gnus-summary-followup
2497 ,@(if (featurep 'xemacs) '(t)
2498 '(:help "Post followup to this article"))]
2499 ["Followup and yank" gnus-summary-followup-with-original
2500 ,@(if (featurep 'xemacs) '(t)
2501 '(:help "Post followup to this article, quoting its contents"))]
2502 ["Supersede article" gnus-summary-supersede-article t]
2503 ["Cancel article" gnus-summary-cancel-article
2504 ,@(if (featurep 'xemacs) '(t)
2505 '(:help "Cancel an article you posted"))]
2506 ["Reply" gnus-summary-reply t]
2507 ["Reply and yank" gnus-summary-reply-with-original t]
2508 ["Wide reply" gnus-summary-wide-reply t]
2509 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2510 ,@(if (featurep 'xemacs) '(t)
2511 '(:help "Mail a reply, quoting this article"))]
2512 ["Very wide reply" gnus-summary-very-wide-reply t]
2513 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2514 ,@(if (featurep 'xemacs) '(t)
2515 '(:help "Mail a very wide reply, quoting this article"))]
2516 ["Mail forward" gnus-summary-mail-forward t]
2517 ["Post forward" gnus-summary-post-forward t]
2518 ["Digest and mail" gnus-uu-digest-mail-forward t]
2519 ["Digest and post" gnus-uu-digest-post-forward t]
2520 ["Resend message" gnus-summary-resend-message t]
2521 ["Resend message edit" gnus-summary-resend-message-edit t]
2522 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2523 ["Send a mail" gnus-summary-mail-other-window t]
2524 ["Create a local message" gnus-summary-news-other-window t]
2525 ["Uuencode and post" gnus-uu-post-news
2526 ,@(if (featurep 'xemacs) '(t)
2527 '(:help "Post a uuencoded article"))]
2528 ["Followup via news" gnus-summary-followup-to-mail t]
2529 ["Followup via news and yank"
2530 gnus-summary-followup-to-mail-with-original t]
2532 ;;["Send" gnus-summary-send-draft t]
2533 ;;["Send bounced" gnus-resend-bounced-mail t])
2537 ((not (keymapp gnus-summary-post-menu))
2538 (setq gnus-article-post-menu gnus-summary-post-menu))
2539 ((not gnus-article-post-menu)
2540 ;; Don't share post menu.
2541 (setq gnus-article-post-menu
2542 (copy-keymap gnus-summary-post-menu))))
2543 (define-key gnus-article-mode-map [menu-bar post]
2544 (cons "Post" gnus-article-post-menu))
2547 gnus-summary-misc-menu gnus-summary-mode-map ""
2550 ["Mark as read" gnus-summary-mark-as-read-forward t]
2551 ["Mark same subject and select"
2552 gnus-summary-kill-same-subject-and-select t]
2553 ["Mark same subject" gnus-summary-kill-same-subject t]
2554 ["Catchup" gnus-summary-catchup
2555 ,@(if (featurep 'xemacs) '(t)
2556 '(:help "Mark unread articles in this group as read"))]
2557 ["Catchup all" gnus-summary-catchup-all t]
2558 ["Catchup to here" gnus-summary-catchup-to-here t]
2559 ["Catchup from here" gnus-summary-catchup-from-here t]
2560 ["Catchup region" gnus-summary-mark-region-as-read
2561 (gnus-mark-active-p)]
2562 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2564 ["Tick" gnus-summary-tick-article-forward t]
2565 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2566 ["Remove marks" gnus-summary-clear-mark-forward t]
2567 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2568 ["Set bookmark" gnus-summary-set-bookmark t]
2569 ["Remove bookmark" gnus-summary-remove-bookmark t])
2571 ["Marks..." gnus-summary-limit-to-marks t]
2572 ["Subject..." gnus-summary-limit-to-subject t]
2573 ["Author..." gnus-summary-limit-to-author t]
2574 ["Recipient..." gnus-summary-limit-to-recipient t]
2575 ["Age..." gnus-summary-limit-to-age t]
2576 ["Extra..." gnus-summary-limit-to-extra t]
2577 ["Score..." gnus-summary-limit-to-score t]
2578 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2579 ["Unread" gnus-summary-limit-to-unread t]
2580 ["Unseen" gnus-summary-limit-to-unseen t]
2581 ["Singletons" gnus-summary-limit-to-singletons t]
2582 ["Replied" gnus-summary-limit-to-replied t]
2583 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2584 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2585 ["Pop limit" gnus-summary-pop-limit t]
2586 ["Show dormant" gnus-summary-limit-include-dormant t]
2587 ["Hide childless dormant"
2588 gnus-summary-limit-exclude-childless-dormant t]
2589 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2590 ["Hide marked" gnus-summary-limit-exclude-marks t]
2591 ["Show expunged" gnus-summary-limit-include-expunged t])
2593 ["Set mark" gnus-summary-mark-as-processable t]
2594 ["Remove mark" gnus-summary-unmark-as-processable t]
2595 ["Remove all marks" gnus-summary-unmark-all-processable t]
2596 ["Invert marks" gnus-uu-invert-processable t]
2597 ["Mark above" gnus-uu-mark-over t]
2598 ["Mark series" gnus-uu-mark-series t]
2599 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2600 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2601 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2602 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2603 ["Mark all" gnus-uu-mark-all t]
2604 ["Mark buffer" gnus-uu-mark-buffer t]
2605 ["Mark sparse" gnus-uu-mark-sparse t]
2606 ["Mark thread" gnus-uu-mark-thread t]
2607 ["Unmark thread" gnus-uu-unmark-thread t]
2608 ("Process Mark Sets"
2609 ["Kill" gnus-summary-kill-process-mark t]
2610 ["Yank" gnus-summary-yank-process-mark
2611 gnus-newsgroup-process-stack]
2612 ["Save" gnus-summary-save-process-mark t]
2613 ["Run command on marked..." gnus-summary-universal-argument t]))
2615 ["Page forward" gnus-summary-next-page
2616 ,@(if (featurep 'xemacs) '(t)
2617 '(:help "Show next page of article"))]
2618 ["Page backward" gnus-summary-prev-page
2619 ,@(if (featurep 'xemacs) '(t)
2620 '(:help "Show previous page of article"))]
2621 ["Line forward" gnus-summary-scroll-up t])
2623 ["Next unread article" gnus-summary-next-unread-article t]
2624 ["Previous unread article" gnus-summary-prev-unread-article t]
2625 ["Next article" gnus-summary-next-article t]
2626 ["Previous article" gnus-summary-prev-article t]
2627 ["Next unread subject" gnus-summary-next-unread-subject t]
2628 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2629 ["Next article same subject" gnus-summary-next-same-subject t]
2630 ["Previous article same subject" gnus-summary-prev-same-subject t]
2631 ["First unread article" gnus-summary-first-unread-article t]
2632 ["Best unread article" gnus-summary-best-unread-article t]
2633 ["Go to subject number..." gnus-summary-goto-subject t]
2634 ["Go to article number..." gnus-summary-goto-article t]
2635 ["Go to the last article" gnus-summary-goto-last-article t]
2636 ["Pop article off history" gnus-summary-pop-article t])
2638 ["Sort by number" gnus-summary-sort-by-number t]
2639 ["Sort by author" gnus-summary-sort-by-author t]
2640 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2641 ["Sort by subject" gnus-summary-sort-by-subject t]
2642 ["Sort by date" gnus-summary-sort-by-date t]
2643 ["Sort by score" gnus-summary-sort-by-score t]
2644 ["Sort by lines" gnus-summary-sort-by-lines t]
2645 ["Sort by characters" gnus-summary-sort-by-chars t]
2646 ["Randomize" gnus-summary-sort-by-random t]
2647 ["Original sort" gnus-summary-sort-by-original t])
2649 ["Fetch group FAQ" gnus-summary-fetch-faq t]
2650 ["Describe group" gnus-summary-describe-group t]
2651 ["Fetch charter" gnus-group-fetch-charter
2652 ,@(if (featurep 'xemacs) nil
2653 '(:help "Display the charter of the current group"))]
2654 ["Fetch control message" gnus-group-fetch-control
2655 ,@(if (featurep 'xemacs) nil
2656 '(:help "Display the archived control message for the current group"))]
2657 ["Read manual" gnus-info-find-node t])
2659 ["Pick and read" gnus-pick-mode t]
2660 ["Binary" gnus-binary-mode t])
2662 ["Regenerate" gnus-summary-prepare t]
2663 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2664 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2665 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2666 ["Toggle threading" gnus-summary-toggle-threads t])
2667 ["See old articles" gnus-summary-insert-old-articles t]
2668 ["See new articles" gnus-summary-insert-new-articles t]
2669 ["Filter articles..." gnus-summary-execute-command t]
2670 ["Run command on articles..." gnus-summary-universal-argument t]
2671 ["Search articles forward..." gnus-summary-search-article-forward t]
2672 ["Search articles backward..." gnus-summary-search-article-backward t]
2673 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2674 ["Expand window" gnus-summary-expand-window t]
2675 ["Expire expirable articles" gnus-summary-expire-articles
2676 (gnus-check-backend-function
2677 'request-expire-articles gnus-newsgroup-name)]
2678 ["Edit local kill file" gnus-summary-edit-local-kill t]
2679 ["Edit main kill file" gnus-summary-edit-global-kill t]
2680 ["Edit group parameters" gnus-summary-edit-parameters t]
2681 ["Customize group parameters" gnus-summary-customize-parameters t]
2682 ["Send a bug report" gnus-bug t]
2684 ["Catchup and exit" gnus-summary-catchup-and-exit
2685 ,@(if (featurep 'xemacs) '(t)
2686 '(:help "Mark unread articles in this group as read, then exit"))]
2687 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2688 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2689 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2690 ["Exit group" gnus-summary-exit
2691 ,@(if (featurep 'xemacs) '(t)
2692 '(:help "Exit current group, return to group selection mode"))]
2693 ["Exit group without updating" gnus-summary-exit-no-update t]
2694 ["Exit and goto next group" gnus-summary-next-group t]
2695 ["Exit and goto prev group" gnus-summary-prev-group t]
2696 ["Reselect group" gnus-summary-reselect-current-group t]
2697 ["Rescan group" gnus-summary-rescan-group t]
2698 ["Update dribble" gnus-summary-save-newsrc t])))
2700 (gnus-run-hooks 'gnus-summary-menu-hook)))
2702 (defvar gnus-summary-tool-bar-map nil)
2704 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2705 ;; affect _new_ message buffers. We might add a function that walks thru all
2706 ;; summary-mode buffers and force the update.
2707 (defun gnus-summary-tool-bar-update (&optional symbol value)
2708 "Update summary mode toolbar.
2709 Setter function for custom variables."
2710 (setq-default gnus-summary-tool-bar-map nil)
2712 ;; When used as ":set" function:
2713 (set-default symbol value))
2714 (when (gnus-buffer-live-p gnus-summary-buffer)
2715 (with-current-buffer gnus-summary-buffer
2716 (gnus-summary-make-tool-bar))))
2718 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2719 'gnus-summary-tool-bar-gnome
2720 'gnus-summary-tool-bar-retro)
2721 "Specifies the Gnus summary tool bar.
2723 It can be either a list or a symbol refering to a list. See
2724 `gmm-tool-bar-from-list' for the format of the list. The
2725 default key map is `gnus-summary-mode-map'.
2727 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2728 `gnus-summary-tool-bar-retro'."
2729 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2730 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2731 (repeat :tag "User defined list" gmm-tool-bar-item)
2733 :version "23.0" ;; No Gnus
2734 :initialize 'custom-initialize-default
2735 :set 'gnus-summary-tool-bar-update
2736 :group 'gnus-summary)
2738 (defcustom gnus-summary-tool-bar-gnome
2739 '((gnus-summary-post-news "mail/compose" nil)
2740 (gnus-summary-insert-new-articles "mail/inbox" nil
2741 :visible (or (not gnus-agent)
2743 (gnus-summary-reply-with-original "mail/reply")
2744 (gnus-summary-reply "mail/reply" nil :visible nil)
2745 (gnus-summary-followup-with-original "mail/reply-all")
2746 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2747 (gnus-summary-mail-forward "mail/forward")
2748 (gnus-summary-save-article "mail/save")
2749 (gnus-summary-search-article-forward "search" nil :visible nil)
2750 (gnus-summary-print-article "print")
2751 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2752 ;; Some new commands that may need more suitable icons:
2753 (gnus-summary-save-newsrc "save" nil :visible nil)
2754 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2755 (gnus-summary-prev-article "left-arrow")
2756 (gnus-summary-next-article "right-arrow")
2757 (gnus-summary-next-page "next-page")
2758 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2760 ;; Maybe some sort-by-... could be added:
2761 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2762 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2763 (gnus-summary-mark-as-expirable
2765 :visible (gnus-check-backend-function 'request-expire-articles
2766 gnus-newsgroup-name))
2767 (gnus-summary-mark-as-spam
2769 :visible (and (fboundp 'spam-group-ham-contents-p)
2770 (spam-group-ham-contents-p gnus-newsgroup-name))
2771 :help "Mark as spam")
2772 (gnus-summary-mark-as-read-forward
2774 :visible (and (fboundp 'spam-group-spam-contents-p)
2775 (spam-group-spam-contents-p gnus-newsgroup-name)))
2777 (gnus-summary-exit "exit")
2778 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2779 (gnus-info-find-node "help"))
2780 "List of functions for the summary tool bar (GNOME style).
2782 See `gmm-tool-bar-from-list' for the format of the list."
2783 :type '(repeat gmm-tool-bar-item)
2784 :version "23.0" ;; No Gnus
2785 :initialize 'custom-initialize-default
2786 :set 'gnus-summary-tool-bar-update
2787 :group 'gnus-summary)
2789 (defcustom gnus-summary-tool-bar-retro
2790 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2791 (gnus-summary-next-unread-article "gnus/next-ur")
2792 (gnus-summary-post-news "gnus/post")
2793 (gnus-summary-followup-with-original "gnus/fuwo")
2794 (gnus-summary-followup "gnus/followup")
2795 (gnus-summary-reply-with-original "gnus/reply-wo")
2796 (gnus-summary-reply "gnus/reply")
2797 (gnus-summary-caesar-message "gnus/rot13")
2798 (gnus-uu-decode-uu "gnus/uu-decode")
2799 (gnus-summary-save-article-file "gnus/save-aif")
2800 (gnus-summary-save-article "gnus/save-art")
2801 (gnus-uu-post-news "gnus/uu-post")
2802 (gnus-summary-catchup "gnus/catchup")
2803 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2804 (gnus-summary-exit "gnus/exit-summ")
2805 ;; Some new command that may need more suitable icons:
2806 (gnus-summary-print-article "gnus/print" nil :visible nil)
2807 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2808 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2809 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2810 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2811 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2812 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2814 (gnus-info-find-node "gnus/help" nil :visible nil))
2815 "List of functions for the summary tool bar (retro look).
2817 See `gmm-tool-bar-from-list' for the format of the list."
2818 :type '(repeat gmm-tool-bar-item)
2819 :version "23.0" ;; No Gnus
2820 :initialize 'custom-initialize-default
2821 :set 'gnus-summary-tool-bar-update
2822 :group 'gnus-summary)
2824 (defcustom gnus-summary-tool-bar-zap-list t
2825 "List of icon items from the global tool bar.
2826 These items are not displayed in the Gnus summary mode tool bar.
2828 See `gmm-tool-bar-from-list' for the format of the list."
2829 :type 'gmm-tool-bar-zap-list
2830 :version "23.0" ;; No Gnus
2831 :initialize 'custom-initialize-default
2832 :set 'gnus-summary-tool-bar-update
2833 :group 'gnus-summary)
2835 (defvar image-load-path)
2837 (defun gnus-summary-make-tool-bar (&optional force)
2838 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2839 When FORCE, rebuild the tool bar."
2840 (when (and (not (featurep 'xemacs))
2841 (boundp 'tool-bar-mode)
2843 (or (not gnus-summary-tool-bar-map) force))
2845 (gmm-image-load-path-for-library "gnus"
2848 (image-load-path (cons (car load-path)
2849 (when (boundp 'image-load-path)
2851 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2852 gnus-summary-tool-bar-zap-list
2853 'gnus-summary-mode-map)))
2855 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2857 (setq gnus-summary-tool-bar-map map))))
2858 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2860 (defun gnus-score-set-default (var value)
2861 "A version of set that updates the GNU Emacs menu-bar."
2863 ;; It is the message that forces the active status to be updated.
2866 (defun gnus-make-score-map (type)
2867 "Make a summary score map of type TYPE."
2870 (let ((headers '(("author" "from" string)
2871 ("subject" "subject" string)
2872 ("article body" "body" string)
2873 ("article head" "head" string)
2874 ("xref" "xref" string)
2875 ("extra header" "extra" string)
2876 ("lines" "lines" number)
2877 ("followups to author" "followup" string)))
2878 (types '((number ("less than" <)
2881 (string ("substring" s)
2885 (perms '(("temporary" (current-time-string))
2893 (if (eq type 'lower)
2898 (setq header (car headers))
2904 (let ((ts (cdr (assoc (nth 2 header) types)))
2920 'gnus-summary-score-entry
2922 (if (or (string= (nth 1 header)
2924 (string= (nth 1 header)
2927 (list 'gnus-summary-header
2929 (list 'quote (nth 1 (car ts)))
2930 (list 'gnus-score-delta-default
2937 (list (nreverse outp))))
2940 (list (nreverse outt))))
2942 (setq headers (cdr headers)))
2943 (list (nreverse outh))))))))
2947 (defun gnus-summary-mode (&optional group)
2948 "Major mode for reading articles.
2950 All normal editing commands are switched off.
2951 \\<gnus-summary-mode-map>
2952 Each line in this buffer represents one article. To read an
2953 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
2954 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
2957 You can also post articles and send mail from this buffer. To
2958 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
2959 of an article, type `\\[gnus-summary-reply]'.
2961 There are approx. one gazillion commands you can execute in this
2962 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
2964 The following commands are available:
2966 \\{gnus-summary-mode-map}"
2968 (kill-all-local-variables)
2969 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
2970 (gnus-summary-make-local-variables))
2971 (gnus-summary-make-local-variables)
2972 (setq gnus-newsgroup-name group)
2973 (when (gnus-visual-p 'summary-menu 'menu)
2974 (gnus-summary-make-menu-bar)
2975 (gnus-summary-make-tool-bar))
2976 (gnus-make-thread-indent-array)
2977 (gnus-simplify-mode-line)
2978 (setq major-mode 'gnus-summary-mode)
2979 (setq mode-name "Summary")
2980 (make-local-variable 'minor-mode-alist)
2981 (use-local-map gnus-summary-mode-map)
2982 (buffer-disable-undo)
2983 (setq buffer-read-only t ;Disable modification
2984 show-trailing-whitespace nil)
2985 (setq truncate-lines t)
2986 (setq selective-display t)
2987 (setq selective-display-ellipses t) ;Display `...'
2988 (gnus-summary-set-display-table)
2989 (gnus-set-default-directory)
2990 (make-local-variable 'gnus-summary-line-format)
2991 (make-local-variable 'gnus-summary-line-format-spec)
2992 (make-local-variable 'gnus-summary-dummy-line-format)
2993 (make-local-variable 'gnus-summary-dummy-line-format-spec)
2994 (make-local-variable 'gnus-summary-mark-positions)
2995 (gnus-make-local-hook 'pre-command-hook)
2996 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
2997 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
2998 (turn-on-gnus-mailing-list-mode)
2999 (mm-enable-multibyte)
3000 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3001 (gnus-update-summary-mark-positions))
3003 (defun gnus-summary-make-local-variables ()
3004 "Make all the local summary buffer variables."
3006 (dolist (local gnus-summary-local-variables)
3009 (if (eq (cdr local) 'global)
3010 ;; Copy the global value of the variable.
3011 (setq global (symbol-value (car local)))
3012 ;; Use the value from the list.
3013 (setq global (eval (cdr local))))
3014 (set (make-local-variable (car local)) global))
3015 ;; Simple nil-valued local variable.
3016 (set (make-local-variable local) nil)))))
3018 (defun gnus-summary-clear-local-variables ()
3019 (let ((locals gnus-summary-local-variables))
3021 (if (consp (car locals))
3022 (and (symbolp (caar locals))
3023 (set (caar locals) nil))
3024 (and (symbolp (car locals))
3025 (set (car locals) nil)))
3026 (setq locals (cdr locals)))))
3028 ;; Summary data functions.
3030 (defmacro gnus-data-number (data)
3033 (defmacro gnus-data-set-number (data number)
3034 `(setcar ,data ,number))
3036 (defmacro gnus-data-mark (data)
3039 (defmacro gnus-data-set-mark (data mark)
3040 `(setcar (nthcdr 1 ,data) ,mark))
3042 (defmacro gnus-data-pos (data)
3045 (defmacro gnus-data-set-pos (data pos)
3046 `(setcar (nthcdr 2 ,data) ,pos))
3048 (defmacro gnus-data-header (data)
3051 (defmacro gnus-data-set-header (data header)
3052 `(setf (nth 3 ,data) ,header))
3054 (defmacro gnus-data-level (data)
3057 (defmacro gnus-data-unread-p (data)
3058 `(= (nth 1 ,data) gnus-unread-mark))
3060 (defmacro gnus-data-read-p (data)
3061 `(/= (nth 1 ,data) gnus-unread-mark))
3063 (defmacro gnus-data-pseudo-p (data)
3064 `(consp (nth 3 ,data)))
3066 (defmacro gnus-data-find (number)
3067 `(assq ,number gnus-newsgroup-data))
3069 (defmacro gnus-data-find-list (number &optional data)
3070 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3071 (memq (assq ,number bdata)
3074 (defmacro gnus-data-make (number mark pos header level)
3075 `(list ,number ,mark ,pos ,header ,level))
3077 (defun gnus-data-enter (after-article number mark pos header level offset)
3078 (let ((data (gnus-data-find-list after-article)))
3080 (error "No such article: %d" after-article))
3081 (setcdr data (cons (gnus-data-make number mark pos header level)
3083 (setq gnus-newsgroup-data-reverse nil)
3084 (gnus-data-update-list (cddr data) offset)))
3086 (defun gnus-data-enter-list (after-article list &optional offset)
3088 (let ((data (and after-article (gnus-data-find-list after-article)))
3092 (let ((odata gnus-newsgroup-data))
3093 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3095 (gnus-data-update-list odata offset)))
3096 ;; Find the last element in the list to be spliced into the main
3098 (setq list (last list))
3101 (setcdr list gnus-newsgroup-data)
3102 (setq gnus-newsgroup-data ilist)
3104 (gnus-data-update-list (cdr list) offset)))
3105 (setcdr list (cdr data))
3108 (gnus-data-update-list (cdr list) offset))))
3109 (setq gnus-newsgroup-data-reverse nil))))
3111 (defun gnus-data-remove (article &optional offset)
3112 (let ((data gnus-newsgroup-data))
3113 (if (= (gnus-data-number (car data)) article)
3115 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3116 gnus-newsgroup-data-reverse nil)
3118 (gnus-data-update-list gnus-newsgroup-data offset)))
3120 (when (= (gnus-data-number (cadr data)) article)
3121 (setcdr data (cddr data))
3123 (gnus-data-update-list (cdr data) offset))
3125 gnus-newsgroup-data-reverse nil))
3126 (setq data (cdr data))))))
3128 (defmacro gnus-data-list (backward)
3130 (or gnus-newsgroup-data-reverse
3131 (setq gnus-newsgroup-data-reverse
3132 (reverse gnus-newsgroup-data)))
3133 gnus-newsgroup-data))
3135 (defun gnus-data-update-list (data offset)
3136 "Add OFFSET to the POS of all data entries in DATA."
3137 (setq gnus-newsgroup-data-reverse nil)
3139 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3140 (setq data (cdr data))))
3142 (defun gnus-summary-article-pseudo-p (article)
3143 "Say whether this article is a pseudo article or not."
3144 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3146 (defmacro gnus-summary-article-sparse-p (article)
3147 "Say whether this article is a sparse article or not."
3148 `(memq ,article gnus-newsgroup-sparse))
3150 (defmacro gnus-summary-article-ancient-p (article)
3151 "Say whether this article is a sparse article or not."
3152 `(memq ,article gnus-newsgroup-ancient))
3154 (defun gnus-article-parent-p (number)
3155 "Say whether this article is a parent or not."
3156 (let ((data (gnus-data-find-list number)))
3157 (and (cdr data) ; There has to be an article after...
3158 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3159 (gnus-data-level (nth 1 data))))))
3161 (defun gnus-article-children (number)
3162 "Return a list of all children to NUMBER."
3163 (let* ((data (gnus-data-find-list number))
3164 (level (gnus-data-level (car data)))
3166 (setq data (cdr data))
3168 (= (gnus-data-level (car data)) (1+ level)))
3169 (push (gnus-data-number (car data)) children)
3170 (setq data (cdr data)))
3173 (defmacro gnus-summary-skip-intangible ()
3174 "If the current article is intangible, then jump to a different article."
3175 '(let ((to (get-text-property (point) 'gnus-intangible)))
3176 (and to (gnus-summary-goto-subject to))))
3178 (defmacro gnus-summary-article-intangible-p ()
3179 "Say whether this article is intangible or not."
3180 '(get-text-property (point) 'gnus-intangible))
3182 (defun gnus-article-read-p (article)
3183 "Say whether ARTICLE is read or not."
3184 (not (or (memq article gnus-newsgroup-marked)
3185 (memq article gnus-newsgroup-spam-marked)
3186 (memq article gnus-newsgroup-unreads)
3187 (memq article gnus-newsgroup-unselected)
3188 (memq article gnus-newsgroup-dormant))))
3190 ;; Some summary mode macros.
3192 (defmacro gnus-summary-article-number ()
3193 "The article number of the article on the current line.
3194 If there isn't an article number here, then we return the current
3197 (gnus-summary-skip-intangible)
3198 (or (get-text-property (point) 'gnus-number)
3199 (gnus-summary-last-subject))))
3201 (defmacro gnus-summary-article-header (&optional number)
3202 "Return the header of article NUMBER."
3203 `(gnus-data-header (gnus-data-find
3204 ,(or number '(gnus-summary-article-number)))))
3206 (defmacro gnus-summary-thread-level (&optional number)
3207 "Return the level of thread that starts with article NUMBER."
3208 `(if (and (eq gnus-summary-make-false-root 'dummy)
3209 (get-text-property (point) 'gnus-intangible))
3211 (gnus-data-level (gnus-data-find
3212 ,(or number '(gnus-summary-article-number))))))
3214 (defmacro gnus-summary-article-mark (&optional number)
3215 "Return the mark of article NUMBER."
3216 `(gnus-data-mark (gnus-data-find
3217 ,(or number '(gnus-summary-article-number)))))
3219 (defmacro gnus-summary-article-pos (&optional number)
3220 "Return the position of the line of article NUMBER."
3221 `(gnus-data-pos (gnus-data-find
3222 ,(or number '(gnus-summary-article-number)))))
3224 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3225 (defmacro gnus-summary-article-subject (&optional number)
3226 "Return current subject string or nil if nothing."
3229 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3230 '(gnus-data-header (assq (gnus-summary-article-number)
3231 gnus-newsgroup-data)))))
3234 (mail-header-subject headers))))
3236 (defmacro gnus-summary-article-score (&optional number)
3237 "Return current article score."
3238 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3239 gnus-newsgroup-scored))
3240 gnus-summary-default-score 0))
3242 (defun gnus-summary-article-children (&optional number)
3243 "Return a list of article numbers that are children of article NUMBER."
3244 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3245 (level (gnus-data-level (car data)))
3247 (while (and (setq data (cdr data))
3248 (> (setq l (gnus-data-level (car data))) level))
3249 (and (= (1+ level) l)
3250 (push (gnus-data-number (car data))
3252 (nreverse children)))
3254 (defun gnus-summary-article-parent (&optional number)
3255 "Return the article number of the parent of article NUMBER."
3256 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3257 (gnus-data-list t)))
3258 (level (gnus-data-level (car data))))
3260 () ; This is a root.
3261 ;; We search until we find an article with a level less than
3262 ;; this one. That function has to be the parent.
3263 (while (and (setq data (cdr data))
3264 (not (< (gnus-data-level (car data)) level))))
3265 (and data (gnus-data-number (car data))))))
3267 (defun gnus-unread-mark-p (mark)
3268 "Say whether MARK is the unread mark."
3269 (= mark gnus-unread-mark))
3271 (defun gnus-read-mark-p (mark)
3272 "Say whether MARK is one of the marks that mark as read.
3273 This is all marks except unread, ticked, dormant, and expirable."
3274 (not (or (= mark gnus-unread-mark)
3275 (= mark gnus-ticked-mark)
3276 (= mark gnus-spam-mark)
3277 (= mark gnus-dormant-mark)
3278 (= mark gnus-expirable-mark))))
3280 (defmacro gnus-article-mark (number)
3281 "Return the MARK of article NUMBER.
3282 This macro should only be used when computing the mark the \"first\"
3283 time; i.e., when generating the summary lines. After that,
3284 `gnus-summary-article-mark' should be used to examine the
3287 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3288 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3289 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3290 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3291 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3292 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3293 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3294 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3295 gnus-ancient-mark))))
3297 ;; Saving hidden threads.
3299 (defmacro gnus-save-hidden-threads (&rest forms)
3300 "Save hidden threads, eval FORMS, and restore the hidden threads."
3301 (let ((config (make-symbol "config")))
3302 `(let ((,config (gnus-hidden-threads-configuration)))
3306 (gnus-restore-hidden-threads-configuration ,config)))))
3307 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3308 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3310 (defun gnus-data-compute-positions ()
3311 "Compute the positions of all articles."
3312 (setq gnus-newsgroup-data-reverse nil)
3313 (let ((data gnus-newsgroup-data))
3315 (gnus-save-hidden-threads
3316 (gnus-summary-show-all-threads)
3317 (goto-char (point-min))
3319 (while (get-text-property (point) 'gnus-intangible)
3321 (gnus-data-set-pos (car data) (+ (point) 3))
3322 (setq data (cdr data))
3323 (forward-line 1))))))
3325 (defun gnus-hidden-threads-configuration ()
3326 "Return the current hidden threads configuration."
3329 (goto-char (point-min))
3330 (while (search-forward "\r" nil t)
3331 (push (1- (point)) config))
3334 (defun gnus-restore-hidden-threads-configuration (config)
3335 "Restore hidden threads configuration from CONFIG."
3337 (let (point buffer-read-only)
3338 (while (setq point (pop config))
3339 (when (and (< point (point-max))
3341 (eq (char-after) ?\n))
3342 (subst-char-in-region point (1+ point) ?\n ?\r))))))
3344 ;; Various summary mode internalish functions.
3346 (defun gnus-mouse-pick-article (e)
3349 (gnus-summary-next-page nil t))
3351 (defun gnus-summary-set-display-table ()
3352 "Change the display table.
3353 Odd characters have a tendency to mess
3354 up nicely formatted displays - we make all possible glyphs
3355 display only a single character."
3357 ;; We start from the standard display table, if any.
3358 (let ((table (or (copy-sequence standard-display-table)
3359 (make-display-table)))
3361 ;; Nix out all the control chars...
3362 (while (>= (setq i (1- i)) 0)
3363 (aset table i [??]))
3364 ;; ... but not newline and cr, of course. (cr is necessary for the
3365 ;; selective display).
3366 (aset table ?\n nil)
3367 (aset table ?\r nil)
3368 ;; We keep TAB as well.
3369 (aset table ?\t nil)
3370 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3371 ;; Emacs 23 (unicode), that are not set already.
3372 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3375 (while (>= (setq i (1- i)) 127)
3376 ;; Only modify if the entry is nil.
3377 (unless (aref table i)
3378 (aset table i [??]))))
3379 (setq buffer-display-table table)))
3381 (defun gnus-summary-set-article-display-arrow (pos)
3382 "Update the overlay arrow to point to line at position POS."
3383 (when (and gnus-summary-display-arrow
3384 (boundp 'overlay-arrow-position)
3385 (boundp 'overlay-arrow-string))
3389 (unless overlay-arrow-position
3390 (setq overlay-arrow-position (make-marker)))
3391 (setq overlay-arrow-string "=>"
3392 overlay-arrow-position (set-marker overlay-arrow-position
3394 (current-buffer))))))
3396 (defun gnus-summary-setup-buffer (group)
3397 "Initialize summary buffer."
3398 (let ((buffer (gnus-summary-buffer-name group))
3399 (dead-name (concat "*Dead Summary "
3400 (gnus-group-decoded-name group) "*")))
3401 ;; If a dead summary buffer exists, we kill it.
3402 (when (gnus-buffer-live-p dead-name)
3403 (gnus-kill-buffer dead-name))
3404 (if (get-buffer buffer)
3407 (setq gnus-summary-buffer (current-buffer))
3408 (not gnus-newsgroup-prepared))
3409 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3410 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3411 (gnus-summary-mode group)
3413 (gnus-carpal-setup-buffer 'summary))
3414 (when (gnus-group-quit-config group)
3415 (set (make-local-variable 'gnus-single-article-buffer) nil))
3416 (make-local-variable 'gnus-article-buffer)
3417 (make-local-variable 'gnus-article-current)
3418 (make-local-variable 'gnus-original-article-buffer)
3419 (setq gnus-newsgroup-name group)
3420 ;; Set any local variables in the group parameters.
3421 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3424 (defun gnus-set-global-variables ()
3425 "Set the global equivalents of the buffer-local variables.
3426 They are set to the latest values they had. These reflect the summary
3427 buffer that was in action when the last article was fetched."
3428 (when (eq major-mode 'gnus-summary-mode)
3429 (setq gnus-summary-buffer (current-buffer))
3430 (let ((name gnus-newsgroup-name)
3431 (marked gnus-newsgroup-marked)
3432 (spam gnus-newsgroup-spam-marked)
3433 (unread gnus-newsgroup-unreads)
3434 (headers gnus-current-headers)
3435 (data gnus-newsgroup-data)
3436 (summary gnus-summary-buffer)
3437 (article-buffer gnus-article-buffer)
3438 (original gnus-original-article-buffer)
3439 (gac gnus-article-current)
3440 (reffed gnus-reffed-article-number)
3441 (score-file gnus-current-score-file)
3442 (default-charset gnus-newsgroup-charset)
3444 (let ((locals gnus-newsgroup-variables))
3446 (if (consp (car locals))
3447 (push (eval (caar locals)) vlist)
3448 (push (eval (car locals)) vlist))
3449 (setq locals (cdr locals)))
3450 (setq vlist (nreverse vlist)))
3451 (with-current-buffer gnus-group-buffer
3452 (setq gnus-newsgroup-name name
3453 gnus-newsgroup-marked marked
3454 gnus-newsgroup-spam-marked spam
3455 gnus-newsgroup-unreads unread
3456 gnus-current-headers headers
3457 gnus-newsgroup-data data
3458 gnus-article-current gac
3459 gnus-summary-buffer summary
3460 gnus-article-buffer article-buffer
3461 gnus-original-article-buffer original
3462 gnus-reffed-article-number reffed
3463 gnus-current-score-file score-file
3464 gnus-newsgroup-charset default-charset)
3465 (let ((locals gnus-newsgroup-variables))
3467 (if (consp (car locals))
3468 (set (caar locals) (pop vlist))
3469 (set (car locals) (pop vlist)))
3470 (setq locals (cdr locals))))
3471 ;; The article buffer also has local variables.
3472 (when (gnus-buffer-live-p gnus-article-buffer)
3473 (set-buffer gnus-article-buffer)
3474 (setq gnus-summary-buffer summary))))))
3476 (defun gnus-summary-article-unread-p (article)
3477 "Say whether ARTICLE is unread or not."
3478 (memq article gnus-newsgroup-unreads))
3480 (defun gnus-summary-first-article-p (&optional article)
3481 "Return whether ARTICLE is the first article in the buffer."
3482 (if (not (setq article (or article (gnus-summary-article-number))))
3484 (eq article (caar gnus-newsgroup-data))))
3486 (defun gnus-summary-last-article-p (&optional article)
3487 "Return whether ARTICLE is the last article in the buffer."
3488 (if (not (setq article (or article (gnus-summary-article-number))))
3489 ;; All non-existent numbers are the last article. :-)
3491 (not (cdr (gnus-data-find-list article)))))
3493 (defun gnus-make-thread-indent-array (&optional n)
3495 (progn (setq n 200) nil)
3496 (null gnus-thread-indent-array)
3497 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3498 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3499 gnus-thread-indent-array-level gnus-thread-indent-level)
3501 (aset gnus-thread-indent-array n
3502 (make-string (* n gnus-thread-indent-level) ? ))
3505 (defun gnus-update-summary-mark-positions ()
3506 "Compute where the summary marks are to go."
3508 (when (gnus-buffer-exists-p gnus-summary-buffer)
3509 (set-buffer gnus-summary-buffer))
3510 (let ((spec gnus-summary-line-format-spec)
3513 (gnus-set-work-buffer)
3514 (let ((gnus-tmp-unread ?Z)
3515 (gnus-replied-mark ?Z)
3516 (gnus-score-below-mark ?Z)
3517 (gnus-score-over-mark ?Z)
3518 (gnus-undownloaded-mark ?Z)
3519 (gnus-summary-line-format-spec spec)
3520 (gnus-newsgroup-downloadable '(0))
3521 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3522 case-fold-search ignores)
3523 ;; Here, all marks are bound to Z.
3524 (gnus-summary-insert-line header
3525 0 nil t gnus-tmp-unread t nil "" nil 1)
3526 (goto-char (point-min))
3527 ;; Memorize the positions of the same characters as dummy marks.
3528 (while (re-search-forward "[A-D]" nil t)
3529 (push (point) ignores))
3531 ;; We use A-D as dummy marks in order to know column positions
3532 ;; where marks should be inserted.
3533 (setq gnus-tmp-unread ?A
3534 gnus-replied-mark ?B
3535 gnus-score-below-mark ?C
3536 gnus-score-over-mark ?C
3537 gnus-undownloaded-mark ?D)
3538 (gnus-summary-insert-line header
3539 0 nil t gnus-tmp-unread t nil "" nil 1)
3540 ;; Ignore characters which aren't dummy marks.
3542 (delete-region (goto-char (1- p)) p)
3544 (goto-char (point-min))
3545 (setq pos (list (cons 'unread
3546 (and (search-forward "A" nil t)
3547 (- (point) (point-min) 1)))))
3548 (goto-char (point-min))
3549 (push (cons 'replied (and (search-forward "B" nil t)
3550 (- (point) (point-min) 1)))
3552 (goto-char (point-min))
3553 (push (cons 'score (and (search-forward "C" nil t)
3554 (- (point) (point-min) 1)))
3556 (goto-char (point-min))
3557 (push (cons 'download (and (search-forward "D" nil t)
3558 (- (point) (point-min) 1)))
3560 (setq gnus-summary-mark-positions pos))))
3562 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3563 "Insert a dummy root in the summary buffer."
3565 (gnus-add-text-properties
3566 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3567 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3569 (defun gnus-summary-extract-address-component (from)
3570 (or (car (funcall gnus-extract-address-components from))
3573 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3574 (let ((mail-parse-charset gnus-newsgroup-charset)
3575 (ignored-from-addresses (gnus-ignored-from-addresses))
3576 ; Is it really necessary to do this next part for each summary line?
3577 ; Luckily, doesn't seem to slow things down much.
3578 (mail-parse-ignored-charsets
3579 (with-current-buffer gnus-summary-buffer
3580 gnus-newsgroup-ignored-charsets)))
3582 (and ignored-from-addresses
3583 (string-match ignored-from-addresses gnus-tmp-from)
3584 (let ((extra-headers (mail-header-extra header))
3588 ((setq to (cdr (assq 'To extra-headers)))
3589 (concat gnus-summary-to-prefix
3591 (gnus-summary-extract-address-component
3592 (funcall gnus-decode-encoded-address-function to)))))
3595 (cdr (assq 'Newsgroups extra-headers))
3597 (memq 'Newsgroups gnus-extra-headers)
3598 (eq (car (gnus-find-method-for-group
3599 gnus-newsgroup-name)) 'nntp)
3600 (gnus-group-real-name gnus-newsgroup-name))))
3601 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3602 (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
3604 (defun gnus-summary-insert-line (gnus-tmp-header
3605 gnus-tmp-level gnus-tmp-current
3606 undownloaded gnus-tmp-unread gnus-tmp-replied
3607 gnus-tmp-expirable gnus-tmp-subject-or-nil
3608 &optional gnus-tmp-dummy gnus-tmp-score
3610 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3611 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3613 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3614 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3615 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3616 (gnus-tmp-score-char
3617 (if (or (null gnus-summary-default-score)
3618 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3619 gnus-summary-zcore-fuzz))
3621 (if (< gnus-tmp-score gnus-summary-default-score)
3622 gnus-score-below-mark gnus-score-over-mark)))
3623 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3625 (cond (gnus-tmp-process gnus-process-mark)
3626 ((memq gnus-tmp-current gnus-newsgroup-cached)
3628 (gnus-tmp-replied gnus-replied-mark)
3629 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3630 gnus-forwarded-mark)
3631 ((memq gnus-tmp-current gnus-newsgroup-saved)
3633 ((memq gnus-tmp-number gnus-newsgroup-recent)
3635 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3638 (gnus-tmp-downloaded
3640 gnus-undownloaded-mark)
3641 (gnus-newsgroup-agentized
3642 gnus-downloaded-mark)
3645 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3648 ((string-match "<[^>]+> *$" gnus-tmp-from)
3649 (let ((beg (match-beginning 0)))
3650 (or (and (string-match "^\".+\"" gnus-tmp-from)
3651 (substring gnus-tmp-from 1 (1- (match-end 0))))
3652 (substring gnus-tmp-from 0 beg))))
3653 ((string-match "(.+)" gnus-tmp-from)
3654 (substring gnus-tmp-from
3655 (1+ (match-beginning 0)) (1- (match-end 0))))
3657 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3658 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3659 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3660 (buffer-read-only nil))
3661 (when (string= gnus-tmp-name "")
3662 (setq gnus-tmp-name gnus-tmp-from))
3663 (unless (numberp gnus-tmp-lines)
3664 (setq gnus-tmp-lines -1))
3665 (if (= gnus-tmp-lines -1)
3666 (setq gnus-tmp-lines "?")
3667 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3668 (gnus-put-text-property
3670 (progn (eval gnus-summary-line-format-spec) (point))
3671 'gnus-number gnus-tmp-number)
3672 (when (gnus-visual-p 'summary-highlight 'highlight)
3674 (gnus-run-hooks 'gnus-summary-update-hook)
3677 (defun gnus-summary-update-line (&optional dont-update)
3678 "Update summary line after change."
3679 (when (and gnus-summary-default-score
3680 (not gnus-summary-inhibit-highlight))
3681 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3682 (article (gnus-summary-article-number))
3683 (score (gnus-summary-article-score article)))
3685 (if (and gnus-summary-mark-below
3686 (< (gnus-summary-article-score)
3687 gnus-summary-mark-below))
3688 ;; This article has a low score, so we mark it as read.
3689 (when (memq article gnus-newsgroup-unreads)
3690 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3691 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3692 ;; This article was previously marked as read on account
3693 ;; of a low score, but now it has risen, so we mark it as
3695 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3696 (gnus-summary-update-mark
3697 (if (or (null gnus-summary-default-score)
3698 (<= (abs (- score gnus-summary-default-score))
3699 gnus-summary-zcore-fuzz))
3701 (if (< score gnus-summary-default-score)
3702 gnus-score-below-mark gnus-score-over-mark))
3704 ;; Do visual highlighting.
3705 (when (gnus-visual-p 'summary-highlight 'highlight)
3706 (gnus-run-hooks 'gnus-summary-update-hook)))))
3708 (defvar gnus-tmp-new-adopts nil)
3710 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3711 "Return the number of articles in THREAD.
3712 This may be 0 in some cases -- if none of the articles in
3713 the thread are to be displayed."
3715 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3717 ((not (listp thread))
3719 ((and (consp thread) (cdr thread))
3722 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3725 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3728 (when (and level (zerop level) gnus-tmp-new-adopts)
3731 'gnus-summary-number-of-articles-in-thread
3732 gnus-tmp-new-adopts))))
3734 (if (> number 1) gnus-not-empty-thread-mark
3735 gnus-empty-thread-mark)
3738 (defsubst gnus-summary-line-message-size (head)
3739 "Return pretty-printed version of message size.
3740 This function is intended to be used in
3741 `gnus-summary-line-format-alist'."
3742 (let ((c (or (mail-header-chars head) -1)))
3743 (cond ((< c 0) "n/a") ; chars not available
3744 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3745 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3746 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3747 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3750 (defun gnus-summary-set-local-parameters (group)
3751 "Go through the local params of GROUP and set all variable specs in that list."
3752 (let ((vars '(quit-config))) ; Ignore quit-config.
3753 (dolist (elem (gnus-group-find-parameter group))
3754 (and (consp elem) ; Has to be a cons.
3755 (consp (cdr elem)) ; The cdr has to be a list.
3756 (symbolp (car elem)) ; Has to be a symbol in there.
3757 (not (memq (car elem) vars))
3758 (ignore-errors ; So we set it.
3759 (push (car elem) vars)
3760 (make-local-variable (car elem))
3761 (set (car elem) (eval (nth 1 elem))))))))
3763 (defun gnus-summary-read-group (group &optional show-all no-article
3764 kill-buffer no-display backward
3766 "Start reading news in newsgroup GROUP.
3767 If SHOW-ALL is non-nil, already read articles are also listed.
3768 If NO-ARTICLE is non-nil, no article is selected initially.
3769 If NO-DISPLAY, don't generate a summary buffer."
3773 (let ((gnus-auto-select-next nil))
3774 (or (gnus-summary-read-group-1
3775 group show-all no-article
3776 kill-buffer no-display
3779 select-articles nil)))))
3780 (eq gnus-auto-select-next 'quietly))
3781 (set-buffer gnus-group-buffer)
3782 ;; The entry function called above goes to the next
3783 ;; group automatically, so we go two groups back
3784 ;; if we are searching for the previous group.
3786 (gnus-group-prev-unread-group 2))
3787 (if (not (equal group (gnus-group-group-name)))
3788 (setq group (gnus-group-group-name))
3792 (defun gnus-summary-read-group-1 (group show-all no-article
3793 kill-buffer no-display
3794 &optional select-articles)
3795 ;; Killed foreign groups can't be entered.
3796 ;; (when (and (not (gnus-group-native-p group))
3797 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3798 ;; (error "Dead non-native groups can't be entered"))
3799 (gnus-message 5 "Retrieving newsgroup: %s..."
3800 (gnus-group-decoded-name group))
3801 (let* ((new-group (gnus-summary-setup-buffer group))
3802 (quit-config (gnus-group-quit-config group))
3803 (did-select (and new-group (gnus-select-newsgroup
3804 group show-all select-articles))))
3806 ;; This summary buffer exists already, so we just select it.
3808 (gnus-set-global-variables)
3810 (gnus-kill-or-deaden-summary kill-buffer))
3811 (gnus-configure-windows 'summary 'force)
3812 (gnus-set-mode-line 'summary)
3813 (gnus-summary-position-point)
3816 ;; We couldn't select this group.
3818 (when (and (eq major-mode 'gnus-summary-mode)
3819 (not (equal (current-buffer) kill-buffer)))
3820 (kill-buffer (current-buffer))
3821 (if (not quit-config)
3823 ;; Update the info -- marks might need to be removed,
3825 (gnus-summary-update-info)
3826 (set-buffer gnus-group-buffer)
3827 (gnus-group-jump-to-group group)
3828 (gnus-group-next-unread-group 1))
3829 (gnus-handle-ephemeral-exit quit-config)))
3830 (let ((grpinfo (gnus-get-info group)))
3831 (if (null (gnus-info-read grpinfo))
3832 (gnus-message 3 "Group %s contains no messages"
3833 (gnus-group-decoded-name group))
3834 (gnus-message 3 "Can't select group")))
3836 ;; The user did a `C-g' while prompting for number of articles,
3837 ;; so we exit this group.
3838 ((eq did-select 'quit)
3839 (and (eq major-mode 'gnus-summary-mode)
3840 (not (equal (current-buffer) kill-buffer))
3841 (kill-buffer (current-buffer)))
3843 (gnus-kill-or-deaden-summary kill-buffer))
3844 (if (not quit-config)
3846 (set-buffer gnus-group-buffer)
3847 (gnus-group-jump-to-group group)
3848 (gnus-group-next-unread-group 1)
3849 (gnus-configure-windows 'group 'force))
3850 (gnus-handle-ephemeral-exit quit-config))
3851 ;; Finally signal the quit.
3853 ;; The group was successfully selected.
3855 (gnus-set-global-variables)
3856 ;; Save the active value in effect when the group was entered.
3857 (setq gnus-newsgroup-active
3859 (gnus-active gnus-newsgroup-name)))
3860 ;; You can change the summary buffer in some way with this hook.
3861 (gnus-run-hooks 'gnus-select-group-hook)
3862 (when (memq 'summary (gnus-update-format-specifications
3863 nil 'summary 'summary-mode 'summary-dummy))
3864 ;; The format specification for the summary line was updated,
3865 ;; so we need to update the mark positions as well.
3866 (gnus-update-summary-mark-positions))
3867 ;; Do score processing.
3868 (when gnus-use-scoring
3869 (gnus-possibly-score-headers))
3870 ;; Check whether to fill in the gaps in the threads.
3871 (when gnus-build-sparse-threads
3872 (gnus-build-sparse-threads))
3873 ;; Find the initial limit.
3875 (let ((gnus-newsgroup-dormant nil))
3876 (gnus-summary-initial-limit show-all))
3877 (gnus-summary-initial-limit show-all))
3878 ;; Generate the summary buffer.
3880 (gnus-summary-prepare))
3881 (when gnus-use-trees
3882 (gnus-tree-open group)
3883 (setq gnus-summary-highlight-line-function
3884 'gnus-tree-highlight-article))
3885 ;; If the summary buffer is empty, but there are some low-scored
3886 ;; articles or some excluded dormants, we include these in the
3888 (when (and (zerop (buffer-size))
3890 (cond (gnus-newsgroup-dormant
3891 (gnus-summary-limit-include-dormant))
3892 ((and gnus-newsgroup-scored show-all)
3893 (gnus-summary-limit-include-expunged t))))
3894 ;; Function `gnus-apply-kill-file' must be called in this hook.
3895 (gnus-run-hooks 'gnus-apply-kill-hook)
3896 (if (and (zerop (buffer-size))
3899 ;; This newsgroup is empty.
3900 (gnus-summary-catchup-and-exit nil t)
3901 (gnus-message 6 "No unread news")
3903 (gnus-kill-or-deaden-summary kill-buffer))
3904 ;; Return nil from this function.
3906 ;; Hide conversation thread subtrees. We cannot do this in
3907 ;; gnus-summary-prepare-hook since kill processing may not
3908 ;; work with hidden articles.
3909 (gnus-summary-maybe-hide-threads)
3911 (gnus-kill-or-deaden-summary kill-buffer))
3912 (gnus-summary-auto-select-subject)
3913 ;; Show first unread article if requested.
3914 (if (and (not no-article)
3916 gnus-newsgroup-unreads
3917 gnus-auto-select-first)
3919 (gnus-configure-windows 'summary)
3920 (let ((art (gnus-summary-article-number)))
3921 (unless (and (not gnus-plugged)
3922 (or (memq art gnus-newsgroup-undownloaded)
3923 (memq art gnus-newsgroup-downloadable)))
3924 (gnus-summary-goto-article art))))
3925 ;; Don't select any articles.
3926 (gnus-summary-position-point)
3927 (gnus-configure-windows 'summary 'force)
3928 (gnus-set-mode-line 'summary))
3929 (when (and gnus-auto-center-group
3930 (get-buffer-window gnus-group-buffer t))
3931 ;; Gotta use windows, because recenter does weird stuff if
3932 ;; the current buffer ain't the displayed window.
3933 (let ((owin (selected-window)))
3934 (select-window (get-buffer-window gnus-group-buffer t))
3935 (when (gnus-group-goto-group group)
3937 (select-window owin)))
3938 ;; Mark this buffer as "prepared".
3939 (setq gnus-newsgroup-prepared t)
3940 (gnus-run-hooks 'gnus-summary-prepared-hook)
3941 (unless (gnus-ephemeral-group-p group)
3942 (gnus-group-update-group group))
3945 (defun gnus-summary-auto-select-subject ()
3946 "Select the subject line on initial group entry."
3947 (goto-char (point-min))
3949 ((eq gnus-auto-select-subject 'best)
3950 (gnus-summary-best-unread-subject))
3951 ((eq gnus-auto-select-subject 'unread)
3952 (gnus-summary-first-unread-subject))
3953 ((eq gnus-auto-select-subject 'unseen)
3954 (gnus-summary-first-unseen-subject))
3955 ((eq gnus-auto-select-subject 'unseen-or-unread)
3956 (gnus-summary-first-unseen-or-unread-subject))
3957 ((eq gnus-auto-select-subject 'first)
3960 ((functionp gnus-auto-select-subject)
3961 (funcall gnus-auto-select-subject))))
3963 (defun gnus-summary-prepare ()
3964 "Generate the summary buffer."
3966 (let ((buffer-read-only nil))
3968 (setq gnus-newsgroup-data nil
3969 gnus-newsgroup-data-reverse nil)
3970 (gnus-run-hooks 'gnus-summary-generate-hook)
3971 ;; Generate the buffer, either with threads or without.
3972 (when gnus-newsgroup-headers
3973 (gnus-summary-prepare-threads
3974 (if gnus-show-threads
3975 (gnus-sort-gathered-threads
3976 (funcall gnus-summary-thread-gathering-function
3978 (gnus-cut-threads (gnus-make-threads)))))
3979 ;; Unthreaded display.
3980 (gnus-sort-articles gnus-newsgroup-headers))))
3981 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
3982 ;; Call hooks for modifying summary buffer.
3983 (goto-char (point-min))
3984 (gnus-run-hooks 'gnus-summary-prepare-hook)))
3986 (defsubst gnus-general-simplify-subject (subject)
3987 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
3990 ;; Truncate the subject.
3991 (gnus-simplify-subject-functions
3992 (gnus-map-function gnus-simplify-subject-functions subject))
3993 ((numberp gnus-summary-gather-subject-limit)
3994 (setq subject (gnus-simplify-subject-re subject))
3995 (if (> (length subject) gnus-summary-gather-subject-limit)
3996 (substring subject 0 gnus-summary-gather-subject-limit)
3998 ;; Fuzzily simplify it.
3999 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4000 (gnus-simplify-subject-fuzzy subject))
4001 ;; Just remove the leading "Re:".
4003 (gnus-simplify-subject-re subject))))
4005 (if (and gnus-summary-gather-exclude-subject
4006 (string-match gnus-summary-gather-exclude-subject subject))
4007 nil ; This article shouldn't be gathered
4010 (defun gnus-summary-simplify-subject-query ()
4011 "Query where the respool algorithm would put this article."
4013 (gnus-summary-select-article)
4014 (message (gnus-general-simplify-subject (gnus-summary-article-subject))))
4016 (defun gnus-gather-threads-by-subject (threads)
4017 "Gather threads by looking at Subject headers."
4018 (if (not gnus-summary-make-false-root)
4020 (let ((hashtb (gnus-make-hashtable 1024))
4023 subject hthread whole-subject)
4025 (setq subject (gnus-general-simplify-subject
4026 (setq whole-subject (mail-header-subject
4029 (if (setq hthread (gnus-gethash subject hashtb))
4031 ;; We enter a dummy root into the thread, if we
4032 ;; haven't done that already.
4033 (unless (stringp (caar hthread))
4034 (setcar hthread (list whole-subject (car hthread))))
4035 ;; We add this new gathered thread to this gathered
4037 (setcdr (car hthread)
4038 (nconc (cdar hthread) (list (car threads))))
4039 ;; Remove it from the list of threads.
4040 (setcdr prev (cdr threads))
4041 (setq threads prev))
4042 ;; Enter this thread into the hash table.
4043 (gnus-sethash subject
4044 (if gnus-summary-make-false-root-always
4046 ;; If you want a dummy root above all
4048 (setcar threads (list whole-subject
4054 (setq threads (cdr threads)))
4057 (defun gnus-gather-threads-by-references (threads)
4058 "Gather threads by looking at References headers."
4059 (let ((idhashtb (gnus-make-hashtable 1024))
4060 (thhashtb (gnus-make-hashtable 1024))
4063 ids references id gthread gid entered ref)
4065 (when (setq references (mail-header-references (caar threads)))
4066 (setq id (mail-header-id (caar threads))
4067 ids (inline (gnus-split-references references))
4069 (while (setq ref (pop ids))
4070 (setq ids (delete ref ids))
4071 (if (not (setq gid (gnus-gethash ref idhashtb)))
4073 (gnus-sethash ref id idhashtb)
4074 (gnus-sethash id threads thhashtb))
4075 (setq gthread (gnus-gethash gid thhashtb))
4077 ;; We enter a dummy root into the thread, if we
4078 ;; haven't done that already.
4079 (unless (stringp (caar gthread))
4080 (setcar gthread (list (mail-header-subject (caar gthread))
4082 ;; We add this new gathered thread to this gathered
4084 (setcdr (car gthread)
4085 (nconc (cdar gthread) (list (car threads)))))
4086 ;; Add it into the thread hash table.
4087 (gnus-sethash id gthread thhashtb)
4089 ;; Remove it from the list of threads.
4090 (setcdr prev (cdr threads))
4091 (setq threads prev))))
4093 (setq threads (cdr threads)))
4096 (defun gnus-sort-gathered-threads (threads)
4097 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4098 (let ((result threads))
4100 (when (stringp (caar threads))
4101 (setcdr (car threads)
4102 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4103 (setq threads (cdr threads)))
4106 (defun gnus-thread-loop-p (root thread)
4107 "Say whether ROOT is in THREAD."
4108 (let ((stack (list thread))
4111 (while (setq thread (pop stack))
4112 (setq th (cdr thread))
4114 (not (eq (caar th) root)))
4117 ;; We have found a loop.
4119 (setcdr thread (delq (car th) (cdr thread)))
4120 (if (boundp (setq ref-dep (intern "none"
4121 gnus-newsgroup-dependencies)))
4122 (setcdr (symbol-value ref-dep)
4123 (nconc (cdr (symbol-value ref-dep))
4125 (set ref-dep (list nil (car th))))
4128 ;; Push all the subthreads onto the stack.
4129 (push (cdr thread) stack)))
4132 (defun gnus-make-threads ()
4133 "Go through the dependency hashtb and find the roots. Return all threads."
4135 (while (catch 'infloop
4138 ;; Deal with self-referencing References loops.
4139 (when (and (car (symbol-value refs))
4146 (car (symbol-value refs)) thread))
4147 (cdr (symbol-value refs)))))))
4150 (unless (car (symbol-value refs))
4151 ;; These threads do not refer back to any other
4152 ;; articles, so they're roots.
4153 (setq threads (append (cdr (symbol-value refs)) threads))))
4154 gnus-newsgroup-dependencies)))
4157 ;; Build the thread tree.
4158 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4159 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4161 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4162 if it was already present.
4164 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4165 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4166 Message-IDs will be renamed to a unique Message-ID before being
4169 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4170 (let* ((id (mail-header-id header))
4171 (id-dep (and id (intern id dependencies)))
4172 parent-id ref ref-dep ref-header replaced)
4173 ;; Enter this `header' in the `dependencies' table.
4177 ;; The first two cases do the normal part: enter a new `header'
4178 ;; in the `dependencies' table.
4179 ((not (boundp id-dep))
4180 (set id-dep (list header)))
4181 ((null (car (symbol-value id-dep)))
4182 (setcar (symbol-value id-dep) header))
4184 ;; From here the `header' was already present in the
4185 ;; `dependencies' table.
4187 ;; Overrides an existing entry;
4188 ;; just set the header part of the entry.
4189 (setcar (symbol-value id-dep) header)
4192 ;; Renames the existing `header' to a unique Message-ID.
4193 ((not gnus-summary-ignore-duplicates)
4194 ;; An article with this Message-ID has already been seen.
4195 ;; We rename the Message-ID.
4196 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4198 (mail-header-set-id header id))
4200 ;; The last case ignores an existing entry, except it adds any
4201 ;; additional Xrefs (in case the two articles came from different
4203 ;; Also sets `header' to `nil' meaning that the `dependencies'
4204 ;; table was *not* modified.
4206 (mail-header-set-xref
4207 (car (symbol-value id-dep))
4208 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4210 (or (mail-header-xref header) "")))
4213 (when (and header (not replaced))
4214 ;; First check that we are not creating a References loop.
4215 (setq parent-id (gnus-parent-id (mail-header-references header)))
4216 (setq ref parent-id)
4218 (setq ref-dep (intern-soft ref dependencies))
4220 (setq ref-header (car (symbol-value ref-dep))))
4221 (if (string= id ref)
4222 ;; Yuk! This is a reference loop. Make the article be a
4225 (mail-header-set-references (car (symbol-value id-dep)) "none")
4227 (setq parent-id nil))
4228 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4229 (setq ref-dep (intern (or parent-id "none") dependencies))
4230 (if (boundp ref-dep)
4231 (setcdr (symbol-value ref-dep)
4232 (nconc (cdr (symbol-value ref-dep))
4233 (list (symbol-value id-dep))))
4234 (set ref-dep (list nil (symbol-value id-dep)))))
4237 (defun gnus-extract-message-id-from-in-reply-to (string)
4238 (if (string-match "<[^>]+>" string)
4239 (substring string (match-beginning 0) (match-end 0))
4242 (defun gnus-build-sparse-threads ()
4243 (let ((headers gnus-newsgroup-headers)
4244 (mail-parse-charset gnus-newsgroup-charset)
4245 (gnus-summary-ignore-duplicates t)
4246 header references generation relations
4247 subject child end new-child date)
4248 ;; First we create an alist of generations/relations, where
4249 ;; generations is how much we trust the relation, and the relation
4251 (gnus-message 7 "Making sparse threads...")
4253 (nnheader-set-temp-buffer " *gnus sparse threads*")
4254 (while (setq header (pop headers))
4255 (when (and (setq references (mail-header-references header))
4256 (not (string= references "")))
4258 (setq child (mail-header-id header)
4259 subject (mail-header-subject header)
4260 date (mail-header-date header)
4262 (while (search-backward ">" nil t)
4263 (setq end (1+ (point)))
4264 (when (search-backward "<" nil t)
4265 (setq new-child (buffer-substring (point) end))
4266 (push (list (incf generation)
4267 child (setq child new-child)
4271 (push (list (1+ generation) child nil subject) relations))
4273 (kill-buffer (current-buffer)))
4274 ;; Sort over trustworthiness.
4277 (when (gnus-dependencies-add-header
4278 (make-full-mail-header
4279 gnus-reffed-article-number
4280 (nth 3 relation) "" (or (nth 4 relation) "")
4282 (or (nth 2 relation) "") 0 0 "")
4283 gnus-newsgroup-dependencies nil)
4284 (push gnus-reffed-article-number gnus-newsgroup-limit)
4285 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4286 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4287 gnus-newsgroup-reads)
4288 (decf gnus-reffed-article-number)))
4289 (sort relations 'car-less-than-car))
4290 (gnus-message 7 "Making sparse threads...done")))
4292 (defun gnus-build-old-threads ()
4293 ;; Look at all the articles that refer back to old articles, and
4294 ;; fetch the headers for the articles that aren't there. This will
4295 ;; build complete threads - if the roots haven't been expired by the
4297 (let ((mail-parse-charset gnus-newsgroup-charset)
4301 (when (not (car (symbol-value refs)))
4302 (setq heads (cdr (symbol-value refs)))
4304 (if (memq (mail-header-number (caar heads))
4305 gnus-newsgroup-dormant)
4306 (setq heads (cdr heads))
4307 (setq id (symbol-name refs))
4308 (while (and (setq id (gnus-build-get-header id))
4309 (not (car (gnus-id-to-thread id)))))
4310 (setq heads nil)))))
4311 gnus-newsgroup-dependencies)))
4313 (defsubst gnus-remove-odd-characters (string)
4314 "Translate STRING into something that doesn't contain weird characters."
4315 (mm-subst-char-in-string
4317 (mm-subst-char-in-string ?\n ?\- string t) t))
4319 ;; This function has to be called with point after the article number
4320 ;; on the beginning of the line.
4321 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4322 (let ((eol (point-at-eol))
4323 (buffer (current-buffer))
4324 header references in-reply-to)
4326 ;; overview: [num subject from date id refs chars lines misc]
4329 (narrow-to-region (point) eol)
4334 (make-full-mail-header
4336 (condition-case () ; subject
4337 (gnus-remove-odd-characters
4338 (funcall gnus-decode-encoded-word-function
4339 (setq x (nnheader-nov-field))))
4341 (condition-case () ; from
4342 (gnus-remove-odd-characters
4343 (funcall gnus-decode-encoded-address-function
4344 (setq x (nnheader-nov-field))))
4346 (nnheader-nov-field) ; date
4347 (nnheader-nov-read-message-id number) ; id
4348 (setq references (nnheader-nov-field)) ; refs
4349 (nnheader-nov-read-integer) ; chars
4350 (nnheader-nov-read-integer) ; lines
4352 (if (looking-at "Xref: ")
4353 (goto-char (match-end 0)))
4354 (nnheader-nov-field)) ; Xref
4355 (nnheader-nov-parse-extra)))) ; extra
4359 (when (and (string= references "")
4360 (setq in-reply-to (mail-header-extra header))
4361 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4362 (mail-header-set-references
4363 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4365 (when gnus-alter-header-function
4366 (funcall gnus-alter-header-function header))
4367 (gnus-dependencies-add-header header dependencies force-new)))
4369 (defun gnus-build-get-header (id)
4370 "Look through the buffer of NOV lines and find the header to ID.
4371 Enter this line into the dependencies hash table, and return
4372 the id of the parent article (if any)."
4373 (let ((deps gnus-newsgroup-dependencies)
4377 (set-buffer nntp-server-buffer)
4378 (let ((case-fold-search nil))
4379 (goto-char (point-min))
4380 (while (and (not found)
4381 (search-forward id nil t))
4383 (setq found (looking-at
4384 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4385 (regexp-quote id))))
4386 (or found (beginning-of-line 2)))
4390 (setq header (gnus-nov-parse-line
4391 (read (current-buffer)) deps))
4392 (gnus-parent-id (mail-header-references header))))))
4394 (let ((number (mail-header-number header)))
4395 (push number gnus-newsgroup-limit)
4396 (push header gnus-newsgroup-headers)
4397 (if (memq number gnus-newsgroup-unselected)
4399 (setq gnus-newsgroup-unreads
4400 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4402 (setq gnus-newsgroup-unselected
4403 (delq number gnus-newsgroup-unselected)))
4404 (push number gnus-newsgroup-ancient)))))))
4406 (defun gnus-build-all-threads ()
4407 "Read all the headers."
4408 (let ((gnus-summary-ignore-duplicates t)
4409 (mail-parse-charset gnus-newsgroup-charset)
4410 (dependencies gnus-newsgroup-dependencies)
4413 (set-buffer nntp-server-buffer)
4414 (let ((case-fold-search nil))
4415 (goto-char (point-min))
4418 (setq article (read (current-buffer))
4419 header (gnus-nov-parse-line article dependencies)))
4421 (with-current-buffer gnus-summary-buffer
4422 (push header gnus-newsgroup-headers)
4423 (if (memq (setq article (mail-header-number header))
4424 gnus-newsgroup-unselected)
4426 (setq gnus-newsgroup-unreads
4427 (gnus-add-to-sorted-list
4428 gnus-newsgroup-unreads article))
4429 (setq gnus-newsgroup-unselected
4430 (delq article gnus-newsgroup-unselected)))
4431 (push article gnus-newsgroup-ancient)))
4432 (forward-line 1)))))))
4434 (defun gnus-summary-update-article-line (article header)
4435 "Update the line for ARTICLE using HEADER."
4436 (let* ((id (mail-header-id header))
4437 (thread (gnus-id-to-thread id)))
4439 (error "Article in no thread"))
4440 ;; Update the thread.
4441 (setcar thread header)
4442 (gnus-summary-goto-subject article)
4443 (let* ((datal (gnus-data-find-list article))
4445 (buffer-read-only nil)
4446 (level (gnus-summary-thread-level)))
4448 (let ((inserted (- (point)
4450 (gnus-summary-insert-line
4452 (memq article gnus-newsgroup-undownloaded)
4453 (gnus-article-mark article)
4454 (memq article gnus-newsgroup-replied)
4455 (memq article gnus-newsgroup-expirable)
4456 ;; Only insert the Subject string when it's different
4457 ;; from the previous Subject string.
4462 (mail-header-subject
4465 (gnus-data-find-list
4467 (gnus-data-list t)))))
4468 ;; Error on the side of excessive subjects.
4470 (mail-header-subject header)))
4472 (mail-header-subject header))
4473 nil (cdr (assq article gnus-newsgroup-scored))
4474 (memq article gnus-newsgroup-processable))
4477 (gnus-data-update-list
4479 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4481 (defun gnus-summary-update-article (article &optional iheader)
4482 "Update ARTICLE in the summary buffer."
4483 (set-buffer gnus-summary-buffer)
4484 (let* ((header (gnus-summary-article-header article))
4485 (id (mail-header-id header))
4486 (data (gnus-data-find article))
4487 (thread (gnus-id-to-thread id))
4488 (references (mail-header-references header))
4492 (when (and references
4493 (not (equal "" references)))
4496 (buffer-read-only nil)
4502 (delq thread parent)))
4503 (if (gnus-summary-insert-subject id header)
4504 ;; Set the (possibly) new article number in the data structure.
4505 (gnus-data-set-number data (gnus-id-to-article id))
4509 (defun gnus-rebuild-thread (id &optional line)
4510 "Rebuild the thread containing ID.
4511 If LINE, insert the rebuilt thread starting on line LINE."
4512 (let ((buffer-read-only nil)
4513 old-pos current thread data)
4514 (if (not gnus-show-threads)
4515 (setq thread (list (car (gnus-id-to-thread id))))
4516 ;; Get the thread this article is part of.
4517 (setq thread (gnus-remove-thread id)))
4518 (setq old-pos (point-at-bol))
4519 (setq current (save-excursion
4520 (and (re-search-backward "[\r\n]" nil t)
4521 (gnus-summary-article-number))))
4522 ;; If this is a gathered thread, we have to go some re-gathering.
4523 (when (stringp (car thread))
4524 (let ((subject (car thread))
4526 (setq thread (cdr thread))
4528 (unless (memq (setq thr (gnus-id-to-thread
4530 (mail-header-id (caar thread)))))
4533 (setq thread (cdr thread)))
4534 ;; We now have all (unique) roots.
4535 (if (= (length roots) 1)
4536 ;; All the loose roots are now one solid root.
4537 (setq thread (car roots))
4538 (setq thread (cons subject (gnus-sort-threads roots))))))
4540 ;; We then insert this thread into the summary buffer.
4542 (goto-char (point-min))
4543 (forward-line (1- line)))
4544 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4545 (if gnus-show-threads
4546 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4547 (gnus-summary-prepare-unthreaded thread))
4548 (setq data (nreverse gnus-newsgroup-data))
4549 (setq threads gnus-newsgroup-threads))
4550 ;; We splice the new data into the data structure.
4551 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4552 ;;!!! then we want to insert at the beginning of the buffer.
4553 ;;!!! That happens to be true with Gnus now, but that may
4554 ;;!!! change in the future. Perhaps.
4555 (gnus-data-enter-list
4556 (if line nil current) data (- (point) old-pos))
4557 (setq gnus-newsgroup-threads
4558 (nconc threads gnus-newsgroup-threads))
4559 (gnus-data-compute-positions))))
4561 (defun gnus-number-to-header (number)
4562 "Return the header for article NUMBER."
4563 (let ((headers gnus-newsgroup-headers))
4565 (not (= number (mail-header-number (car headers)))))
4570 (defun gnus-parent-headers (in-headers &optional generation)
4571 "Return the headers of the GENERATIONeth parent of HEADERS."
4573 (setq generation 1))
4575 (headers in-headers)
4578 (not (zerop generation))
4579 (setq references (mail-header-references headers)))
4580 (setq headers (if (and references
4581 (setq parent (gnus-parent-id references)))
4582 (car (gnus-id-to-thread parent))
4585 (and (not (eq headers in-headers))
4588 (defun gnus-id-to-thread (id)
4589 "Return the (sub-)thread where ID appears."
4590 (gnus-gethash id gnus-newsgroup-dependencies))
4592 (defun gnus-id-to-article (id)
4593 "Return the article number of ID."
4594 (let ((thread (gnus-id-to-thread id)))
4597 (mail-header-number (car thread)))))
4599 (defun gnus-id-to-header (id)
4600 "Return the article headers of ID."
4601 (car (gnus-id-to-thread id)))
4603 (defun gnus-article-displayed-root-p (article)
4604 "Say whether ARTICLE is a root(ish) article."
4605 (let ((level (gnus-summary-thread-level article))
4606 (refs (mail-header-references (gnus-summary-article-header article)))
4612 ((null (gnus-parent-id refs)) t)
4614 (null (setq particle (gnus-id-to-article
4615 (gnus-parent-id refs))))
4616 (null (gnus-summary-thread-level particle)))))))
4618 (defun gnus-root-id (id)
4619 "Return the id of the root of the thread where ID appears."
4621 (while (and id (setq prev (car (gnus-id-to-thread id))))
4623 id (gnus-parent-id (mail-header-references prev))))
4626 (defun gnus-articles-in-thread (thread)
4627 "Return the list of articles in THREAD."
4628 (cons (mail-header-number (car thread))
4629 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4631 (defun gnus-remove-thread (id &optional dont-remove)
4632 "Remove the thread that has ID in it."
4633 (let (headers thread last-id)
4634 ;; First go up in this thread until we find the root.
4635 (setq last-id (gnus-root-id id)
4636 headers (message-flatten-list (gnus-id-to-thread last-id)))
4637 ;; We have now found the real root of this thread. It might have
4638 ;; been gathered into some loose thread, so we have to search
4639 ;; through the threads to find the thread we wanted.
4640 (let ((threads gnus-newsgroup-threads)
4643 (setq sub (car threads))
4644 (if (stringp (car sub))
4645 ;; This is a gathered thread, so we look at the roots
4646 ;; below it to find whether this article is in this
4649 (setq sub (cdr sub))
4651 (when (member (caar sub) headers)
4652 (setq thread (car threads)
4655 (setq sub (cdr sub))))
4656 ;; It's an ordinary thread, so we check it.
4657 (when (eq (car sub) (car headers))
4660 (setq threads (cdr threads)))
4661 ;; If this article is in no thread, then it's a root.
4664 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4665 (setq thread (gnus-id-to-thread last-id)))
4668 thread ; We return this thread.
4670 (if (stringp (car thread))
4672 ;; If we use dummy roots, then we have to remove the
4673 ;; dummy root as well.
4674 (when (eq gnus-summary-make-false-root 'dummy)
4675 ;; We go to the dummy root by going to
4676 ;; the first sub-"thread", and then one line up.
4677 (gnus-summary-goto-article
4678 (mail-header-number (caadr thread)))
4681 (gnus-data-compute-positions))
4682 (setq thread (cdr thread))
4684 (gnus-remove-thread-1 (car thread))
4685 (setq thread (cdr thread))))
4686 (gnus-remove-thread-1 thread))))))))
4688 (defun gnus-remove-thread-1 (thread)
4689 "Remove the thread THREAD recursively."
4690 (let ((number (mail-header-number (pop thread)))
4692 (setq thread (reverse thread))
4694 (gnus-remove-thread-1 (pop thread)))
4695 (when (setq d (gnus-data-find number))
4696 (goto-char (gnus-data-pos d))
4697 (gnus-summary-show-thread)
4703 (gnus-delete-line)))))))
4705 (defun gnus-sort-threads-recursive (threads func)
4706 (sort (mapcar (lambda (thread)
4709 (gnus-sort-threads-recursive (cdr thread) func))))
4712 (defun gnus-sort-threads-loop (threads func)
4713 (let* ((superthread (cons nil threads))
4714 (stack (list (cons superthread threads)))
4715 remaining-threads thread)
4717 (setq remaining-threads (cdr (car stack)))
4718 (if remaining-threads
4719 (progn (setq thread (car remaining-threads))
4720 (setcdr (car stack) (cdr remaining-threads))
4722 (push (cons thread (cdr thread)) stack)))
4723 (setq thread (caar stack))
4724 (setcdr thread (sort (cdr thread) func))
4728 (defun gnus-sort-threads (threads)
4730 (if (not gnus-thread-sort-functions)
4732 (gnus-message 8 "Sorting threads...")
4735 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4736 (gnus-sort-threads-recursive
4737 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4738 ;; Even after binding max-lisp-eval-depth, the recursive
4739 ;; sorter might fail for very long threads. In that case,
4740 ;; try using a (less well-tested) non-recursive sorter.
4741 (error (gnus-sort-threads-loop
4742 threads (gnus-make-sort-function
4743 gnus-thread-sort-functions))))
4744 (gnus-message 8 "Sorting threads...done"))))
4746 (defun gnus-sort-articles (articles)
4748 (when gnus-article-sort-functions
4749 (gnus-message 7 "Sorting articles...")
4751 (setq gnus-newsgroup-headers
4752 (sort articles (gnus-make-sort-function
4753 gnus-article-sort-functions)))
4754 (gnus-message 7 "Sorting articles...done"))))
4756 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4757 (defmacro gnus-thread-header (thread)
4758 "Return header of first article in THREAD.
4759 Note that THREAD must never, ever be anything else than a variable -
4760 using some other form will lead to serious barfage."
4761 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4762 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4763 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4766 (defsubst gnus-article-sort-by-number (h1 h2)
4767 "Sort articles by article number."
4768 (< (mail-header-number h1)
4769 (mail-header-number h2)))
4771 (defun gnus-thread-sort-by-number (h1 h2)
4772 "Sort threads by root article number."
4773 (gnus-article-sort-by-number
4774 (gnus-thread-header h1) (gnus-thread-header h2)))
4776 (defsubst gnus-article-sort-by-random (h1 h2)
4777 "Sort articles by article number."
4780 (defun gnus-thread-sort-by-random (h1 h2)
4781 "Sort threads by root article number."
4782 (gnus-article-sort-by-random
4783 (gnus-thread-header h1) (gnus-thread-header h2)))
4785 (defsubst gnus-article-sort-by-lines (h1 h2)
4786 "Sort articles by article Lines header."
4787 (< (mail-header-lines h1)
4788 (mail-header-lines h2)))
4790 (defun gnus-thread-sort-by-lines (h1 h2)
4791 "Sort threads by root article Lines header."
4792 (gnus-article-sort-by-lines
4793 (gnus-thread-header h1) (gnus-thread-header h2)))
4795 (defsubst gnus-article-sort-by-chars (h1 h2)
4796 "Sort articles by octet length."
4797 (< (mail-header-chars h1)
4798 (mail-header-chars h2)))
4800 (defun gnus-thread-sort-by-chars (h1 h2)
4801 "Sort threads by root article octet length."
4802 (gnus-article-sort-by-chars
4803 (gnus-thread-header h1) (gnus-thread-header h2)))
4805 (defsubst gnus-article-sort-by-author (h1 h2)
4806 "Sort articles by root author."
4808 (let ((extract (funcall
4809 gnus-extract-address-components
4810 (mail-header-from h1))))
4811 (or (car extract) (cadr extract) ""))
4812 (let ((extract (funcall
4813 gnus-extract-address-components
4814 (mail-header-from h2))))
4815 (or (car extract) (cadr extract) ""))))
4817 (defun gnus-thread-sort-by-author (h1 h2)
4818 "Sort threads by root author."
4819 (gnus-article-sort-by-author
4820 (gnus-thread-header h1) (gnus-thread-header h2)))
4822 (defsubst gnus-article-sort-by-recipient (h1 h2)
4823 "Sort articles by recipient."
4825 (let ((extract (funcall
4826 gnus-extract-address-components
4827 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4828 (or (car extract) (cadr extract)))
4829 (let ((extract (funcall
4830 gnus-extract-address-components
4831 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4832 (or (car extract) (cadr extract)))))
4834 (defun gnus-thread-sort-by-recipient (h1 h2)
4835 "Sort threads by root recipient."
4836 (gnus-article-sort-by-recipient
4837 (gnus-thread-header h1) (gnus-thread-header h2)))
4839 (defsubst gnus-article-sort-by-subject (h1 h2)
4840 "Sort articles by root subject."
4842 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4843 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4845 (defun gnus-thread-sort-by-subject (h1 h2)
4846 "Sort threads by root subject."
4847 (gnus-article-sort-by-subject
4848 (gnus-thread-header h1) (gnus-thread-header h2)))
4850 (defsubst gnus-article-sort-by-date (h1 h2)
4851 "Sort articles by root article date."
4853 (gnus-date-get-time (mail-header-date h1))
4854 (gnus-date-get-time (mail-header-date h2))))
4856 (defun gnus-thread-sort-by-date (h1 h2)
4857 "Sort threads by root article date."
4858 (gnus-article-sort-by-date
4859 (gnus-thread-header h1) (gnus-thread-header h2)))
4861 (defsubst gnus-article-sort-by-score (h1 h2)
4862 "Sort articles by root article score.
4863 Unscored articles will be counted as having a score of zero."
4864 (> (or (cdr (assq (mail-header-number h1)
4865 gnus-newsgroup-scored))
4866 gnus-summary-default-score 0)
4867 (or (cdr (assq (mail-header-number h2)
4868 gnus-newsgroup-scored))
4869 gnus-summary-default-score 0)))
4871 (defun gnus-thread-sort-by-score (h1 h2)
4872 "Sort threads by root article score."
4873 (gnus-article-sort-by-score
4874 (gnus-thread-header h1) (gnus-thread-header h2)))
4876 (defun gnus-thread-sort-by-total-score (h1 h2)
4877 "Sort threads by the sum of all scores in the thread.
4878 Unscored articles will be counted as having a score of zero."
4879 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
4881 (defun gnus-thread-total-score (thread)
4882 ;; This function find the total score of THREAD.
4887 (if (stringp (car thread))
4888 (apply gnus-thread-score-function 0
4889 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
4890 (gnus-thread-total-score-1 thread)))
4892 (gnus-thread-total-score-1 (list thread)))))
4894 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
4895 "Sort threads such that the thread with the most recently arrived article comes first."
4896 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
4898 (defun gnus-thread-highest-number (thread)
4899 "Return the highest article number in THREAD."
4900 (apply 'max (mapcar (lambda (header)
4901 (mail-header-number header))
4902 (message-flatten-list thread))))
4904 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
4905 "Sort threads such that the thread with the most recently dated article comes first."
4906 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
4908 (defun gnus-thread-latest-date (thread)
4909 "Return the highest article date in THREAD."
4910 (let ((previous-time 0))
4916 (time-to-seconds (mail-header-parse-date
4917 (mail-header-date header)))
4918 (error previous-time))))
4920 (message-flatten-list thread)
4922 (< (mail-header-number h1)
4923 (mail-header-number h2))))))))
4925 (defun gnus-thread-total-score-1 (root)
4926 ;; This function find the total score of the thread below ROOT.
4927 (setq root (car root))
4928 (apply gnus-thread-score-function
4930 (mapcar 'gnus-thread-total-score
4931 (cdr (gnus-id-to-thread (mail-header-id root))))
4932 (when (> (mail-header-number root) 0)
4933 (list (or (cdr (assq (mail-header-number root)
4934 gnus-newsgroup-scored))
4935 gnus-summary-default-score 0))))
4936 (list gnus-summary-default-score)
4939 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
4940 (defvar gnus-tmp-prev-subject nil)
4941 (defvar gnus-tmp-false-parent nil)
4942 (defvar gnus-tmp-root-expunged nil)
4943 (defvar gnus-tmp-dummy-line nil)
4945 (eval-when-compile (defvar gnus-tmp-header))
4946 (defun gnus-extra-header (type &optional header)
4947 "Return the extra header of TYPE."
4948 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
4951 (defvar gnus-tmp-thread-tree-header-string "")
4953 (defcustom gnus-sum-thread-tree-root "> "
4954 "With %B spec, used for the root of a thread.
4955 If nil, use subject instead."
4957 :type '(radio (const :format "%v " nil) string)
4958 :group 'gnus-thread)
4960 (defcustom gnus-sum-thread-tree-false-root "> "
4961 "With %B spec, used for a false root of a thread.
4962 If nil, use subject instead."
4964 :type '(radio (const :format "%v " nil) string)
4965 :group 'gnus-thread)
4967 (defcustom gnus-sum-thread-tree-single-indent ""
4968 "With %B spec, used for a thread with just one message.
4969 If nil, use subject instead."
4971 :type '(radio (const :format "%v " nil) string)
4972 :group 'gnus-thread)
4974 (defcustom gnus-sum-thread-tree-vertical "| "
4975 "With %B spec, used for drawing a vertical line."
4978 :group 'gnus-thread)
4980 (defcustom gnus-sum-thread-tree-indent " "
4981 "With %B spec, used for indenting."
4984 :group 'gnus-thread)
4986 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
4987 "With %B spec, used for a leaf with brothers."
4990 :group 'gnus-thread)
4992 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
4993 "With %B spec, used for a leaf without brothers."
4996 :group 'gnus-thread)
4998 (defun gnus-summary-prepare-threads (threads)
4999 "Prepare summary buffer from THREADS and indentation LEVEL.
5000 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5001 or a straight list of headers."
5002 (gnus-message 7 "Generating summary...")
5004 (setq gnus-newsgroup-threads threads)
5007 (let ((gnus-tmp-level 0)
5008 (default-score (or gnus-summary-default-score 0))
5009 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5010 (building-line-count gnus-summary-display-while-building)
5011 (building-count (integerp gnus-summary-display-while-building))
5012 thread number subject stack state gnus-tmp-gathered beg-match
5013 new-roots gnus-tmp-new-adopts thread-end simp-subject
5014 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5015 gnus-tmp-replied gnus-tmp-subject-or-nil
5016 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5017 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5018 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5021 (setq gnus-tmp-prev-subject nil
5022 gnus-tmp-thread-tree-header-string "")
5024 (if (vectorp (car threads))
5025 ;; If this is a straight (sic) list of headers, then a
5026 ;; threaded summary display isn't required, so we just create
5027 ;; an unthreaded one.
5028 (gnus-summary-prepare-unthreaded threads)
5030 ;; Do the threaded display.
5032 (if gnus-summary-display-while-building
5033 (switch-to-buffer (buffer-name)))
5034 (while (or threads stack gnus-tmp-new-adopts new-roots)
5036 (if (and (= gnus-tmp-level 0)
5039 (not gnus-tmp-false-parent)
5040 (or gnus-tmp-new-adopts new-roots))
5041 (if gnus-tmp-new-adopts
5042 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5043 thread (list (car gnus-tmp-new-adopts))
5044 gnus-tmp-header (caar thread)
5045 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5047 (setq thread (list (car new-roots))
5048 gnus-tmp-header (caar thread)
5049 new-roots (cdr new-roots))))
5052 ;; If there are some threads, we do them before the
5053 ;; threads on the stack.
5054 (setq thread threads
5055 gnus-tmp-header (caar thread))
5056 ;; There were no current threads, so we pop something off
5058 (setq state (car stack)
5059 gnus-tmp-level (car state)
5060 tree-stack (cadr state)
5061 thread (caddr state)
5063 gnus-tmp-header (caar thread))))
5065 (setq gnus-tmp-false-parent nil)
5066 (setq gnus-tmp-root-expunged nil)
5067 (setq thread-end nil)
5069 (if (stringp gnus-tmp-header)
5070 ;; The header is a dummy root.
5072 ((eq gnus-summary-make-false-root 'adopt)
5073 ;; We let the first article adopt the rest.
5074 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5076 (setq gnus-tmp-gathered
5078 (lambda (h) (mail-header-number (car h)))
5081 (setq thread (cons (list (caar thread)
5084 (setq gnus-tmp-level -1
5085 gnus-tmp-false-parent t))
5086 ((eq gnus-summary-make-false-root 'empty)
5087 ;; We print adopted articles with empty subject fields.
5088 (setq gnus-tmp-gathered
5090 (lambda (h) (mail-header-number (car h)))
5093 (setq gnus-tmp-level -1))
5094 ((eq gnus-summary-make-false-root 'dummy)
5095 ;; We remember that we probably want to output a dummy
5097 (setq gnus-tmp-dummy-line gnus-tmp-header)
5098 (setq gnus-tmp-prev-subject gnus-tmp-header))
5100 ;; We do not make a root for the gathered
5101 ;; sub-threads at all.
5102 (setq gnus-tmp-level -1)))
5104 (setq number (mail-header-number gnus-tmp-header)
5105 subject (mail-header-subject gnus-tmp-header)
5106 simp-subject (gnus-simplify-subject-fully subject))
5109 ;; If the thread has changed subject, we might want to make
5110 ;; this subthread into a root.
5111 ((and (null gnus-thread-ignore-subject)
5112 (not (zerop gnus-tmp-level))
5113 gnus-tmp-prev-subject
5114 (not (string= gnus-tmp-prev-subject simp-subject)))
5115 (setq new-roots (nconc new-roots (list (car thread)))
5117 gnus-tmp-header nil))
5118 ;; If the article lies outside the current limit,
5119 ;; then we do not display it.
5120 ((not (memq number gnus-newsgroup-limit))
5121 (setq gnus-tmp-gathered
5123 (lambda (h) (mail-header-number (car h)))
5126 (setq gnus-tmp-new-adopts (if (cdar thread)
5127 (append gnus-tmp-new-adopts
5129 gnus-tmp-new-adopts)
5131 gnus-tmp-header nil)
5132 (when (zerop gnus-tmp-level)
5133 (setq gnus-tmp-root-expunged t)))
5134 ;; Perhaps this article is to be marked as read?
5135 ((and gnus-summary-mark-below
5136 (< (or (cdr (assq number gnus-newsgroup-scored))
5138 gnus-summary-mark-below)
5139 ;; Don't touch sparse articles.
5140 (not (gnus-summary-article-sparse-p number))
5141 (not (gnus-summary-article-ancient-p number)))
5142 (setq gnus-newsgroup-unreads
5143 (delq number gnus-newsgroup-unreads))
5144 (if gnus-newsgroup-auto-expire
5145 (setq gnus-newsgroup-expirable
5146 (gnus-add-to-sorted-list
5147 gnus-newsgroup-expirable number))
5148 (push (cons number gnus-low-score-mark)
5149 gnus-newsgroup-reads))))
5151 (when gnus-tmp-header
5152 ;; We may have an old dummy line to output before this
5154 (when (and gnus-tmp-dummy-line
5157 (mail-header-subject gnus-tmp-header)))
5158 (gnus-summary-insert-dummy-line
5159 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5160 (setq gnus-tmp-dummy-line nil))
5162 ;; Compute the mark.
5163 (setq gnus-tmp-unread (gnus-article-mark number))
5165 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5166 gnus-tmp-header gnus-tmp-level)
5167 gnus-newsgroup-data)
5169 ;; Actually insert the line.
5171 gnus-tmp-subject-or-nil
5173 ((and gnus-thread-ignore-subject
5174 gnus-tmp-prev-subject
5175 (not (string= gnus-tmp-prev-subject simp-subject)))
5177 ((zerop gnus-tmp-level)
5178 (if (and (eq gnus-summary-make-false-root 'empty)
5179 (memq number gnus-tmp-gathered)
5180 gnus-tmp-prev-subject
5181 (string= gnus-tmp-prev-subject simp-subject))
5182 gnus-summary-same-subject
5184 (t gnus-summary-same-subject)))
5185 (if (and (eq gnus-summary-make-false-root 'adopt)
5186 (= gnus-tmp-level 1)
5187 (memq number gnus-tmp-gathered))
5188 (setq gnus-tmp-opening-bracket ?\<
5189 gnus-tmp-closing-bracket ?\>)
5190 (setq gnus-tmp-opening-bracket ?\[
5191 gnus-tmp-closing-bracket ?\]))
5192 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5193 (gnus-make-thread-indent-array
5194 (max (* 2 (length gnus-thread-indent-array))
5197 gnus-tmp-indentation
5198 (aref gnus-thread-indent-array gnus-tmp-level)
5199 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5200 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5201 gnus-summary-default-score 0)
5203 (if (or (null gnus-summary-default-score)
5204 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5205 gnus-summary-zcore-fuzz))
5207 (if (< gnus-tmp-score gnus-summary-default-score)
5208 gnus-score-below-mark gnus-score-over-mark))
5210 (cond ((memq number gnus-newsgroup-processable)
5212 ((memq number gnus-newsgroup-cached)
5214 ((memq number gnus-newsgroup-replied)
5216 ((memq number gnus-newsgroup-forwarded)
5217 gnus-forwarded-mark)
5218 ((memq number gnus-newsgroup-saved)
5220 ((memq number gnus-newsgroup-recent)
5222 ((memq number gnus-newsgroup-unseen)
5226 (cond ((memq number gnus-newsgroup-undownloaded)
5227 gnus-undownloaded-mark)
5228 (gnus-newsgroup-agentized
5229 gnus-downloaded-mark)
5232 gnus-tmp-from (mail-header-from gnus-tmp-header)
5235 ((string-match "<[^>]+> *$" gnus-tmp-from)
5236 (setq beg-match (match-beginning 0))
5237 (or (and (string-match "^\".+\"" gnus-tmp-from)
5238 (substring gnus-tmp-from 1 (1- (match-end 0))))
5239 (substring gnus-tmp-from 0 beg-match)))
5240 ((string-match "(.+)" gnus-tmp-from)
5241 (substring gnus-tmp-from
5242 (1+ (match-beginning 0)) (1- (match-end 0))))
5246 gnus-tmp-thread-tree-header-string
5248 ((not gnus-show-threads) "")
5249 ((zerop gnus-tmp-level)
5250 (cond ((cdar thread)
5251 (or gnus-sum-thread-tree-root subject))
5252 (gnus-tmp-new-adopts
5253 (or gnus-sum-thread-tree-false-root subject))
5255 (or gnus-sum-thread-tree-single-indent subject))))
5257 (concat (apply 'concat
5258 (mapcar (lambda (item)
5260 gnus-sum-thread-tree-vertical
5261 gnus-sum-thread-tree-indent))
5262 (cdr (reverse tree-stack))))
5264 gnus-sum-thread-tree-leaf-with-other
5265 gnus-sum-thread-tree-single-leaf)))))
5266 (when (string= gnus-tmp-name "")
5267 (setq gnus-tmp-name gnus-tmp-from))
5268 (unless (numberp gnus-tmp-lines)
5269 (setq gnus-tmp-lines -1))
5270 (if (= gnus-tmp-lines -1)
5271 (setq gnus-tmp-lines "?")
5272 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5273 (gnus-put-text-property
5275 (progn (eval gnus-summary-line-format-spec) (point))
5276 'gnus-number number)
5279 (gnus-run-hooks 'gnus-summary-update-hook)
5282 (setq gnus-tmp-prev-subject simp-subject)))
5284 (when (nth 1 thread)
5285 (push (list (max 0 gnus-tmp-level)
5286 (copy-sequence tree-stack)
5289 (push (if (nth 1 thread) 1 0) tree-stack)
5290 (incf gnus-tmp-level)
5291 (setq threads (if thread-end nil (cdar thread)))
5292 (if gnus-summary-display-while-building
5295 ;; use a set frequency
5296 (setq building-line-count (1- building-line-count))
5297 (when (= building-line-count 0)
5299 (setq building-line-count
5300 gnus-summary-display-while-building)))
5304 (setq gnus-tmp-level 0)))))
5305 (gnus-message 7 "Generating summary...done"))
5307 (defun gnus-summary-prepare-unthreaded (headers)
5308 "Generate an unthreaded summary buffer based on HEADERS."
5309 (let (header number mark)
5314 ;; We may have to root out some bad articles...
5315 (when (memq (setq number (mail-header-number
5316 (setq header (pop headers))))
5317 gnus-newsgroup-limit)
5318 ;; Mark article as read when it has a low score.
5319 (when (and gnus-summary-mark-below
5320 (< (or (cdr (assq number gnus-newsgroup-scored))
5321 gnus-summary-default-score 0)
5322 gnus-summary-mark-below)
5323 (not (gnus-summary-article-ancient-p number)))
5324 (setq gnus-newsgroup-unreads
5325 (delq number gnus-newsgroup-unreads))
5326 (if gnus-newsgroup-auto-expire
5327 (push number gnus-newsgroup-expirable)
5328 (push (cons number gnus-low-score-mark)
5329 gnus-newsgroup-reads)))
5331 (setq mark (gnus-article-mark number))
5332 (push (gnus-data-make number mark (1+ (point)) header 0)
5333 gnus-newsgroup-data)
5334 (gnus-summary-insert-line
5336 (memq number gnus-newsgroup-undownloaded)
5337 mark (memq number gnus-newsgroup-replied)
5338 (memq number gnus-newsgroup-expirable)
5339 (mail-header-subject header) nil
5340 (cdr (assq number gnus-newsgroup-scored))
5341 (memq number gnus-newsgroup-processable))))))
5343 (defun gnus-summary-remove-list-identifiers ()
5344 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5345 (let ((regexp (if (consp gnus-list-identifiers)
5346 (mapconcat 'identity gnus-list-identifiers " *\\|")
5347 gnus-list-identifiers))
5350 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5351 (dolist (header gnus-newsgroup-headers)
5352 (setq subject (mail-header-subject header)
5354 (while (string-match regexp subject)
5356 (concat (substring subject 0 (match-beginning 1))
5357 (substring subject (match-end 0)))
5360 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5362 (concat (substring subject 0 (match-beginning 1))
5363 (substring subject (match-end 1)))))
5364 (mail-header-set-subject header subject))))))
5366 (defun gnus-fetch-headers (articles)
5367 "Fetch headers of ARTICLES."
5368 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5369 (gnus-message 5 "Fetching headers for %s..." name)
5372 (setq gnus-headers-retrieved-by
5373 (gnus-retrieve-headers
5374 articles gnus-newsgroup-name
5375 ;; We might want to fetch old headers, but
5376 ;; not if there is only 1 article.
5378 (not (eq gnus-fetch-old-headers 'some))
5379 (not (numberp gnus-fetch-old-headers)))
5380 (> (length articles) 1))
5381 gnus-fetch-old-headers))))
5382 (gnus-get-newsgroup-headers-xover
5383 articles nil nil gnus-newsgroup-name t)
5384 (gnus-get-newsgroup-headers))
5385 (gnus-message 5 "Fetching headers for %s...done" name))))
5387 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5388 "Select newsgroup GROUP.
5389 If READ-ALL is non-nil, all articles in the group are selected.
5390 If SELECT-ARTICLES, only select those articles from GROUP."
5391 (let* ((entry (gnus-group-entry group))
5392 ;;!!! Dirty hack; should be removed.
5393 (gnus-summary-ignore-duplicates
5394 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5396 gnus-summary-ignore-duplicates))
5397 (info (nth 2 entry))
5398 articles fetched-articles cached)
5400 (unless (gnus-check-server
5401 (set (make-local-variable 'gnus-current-select-method)
5402 (gnus-find-method-for-group group)))
5403 (error "Couldn't open server"))
5405 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5406 (gnus-activate-group group) ; Or we can activate it...
5407 (progn ; Or we bug out.
5408 (when (equal major-mode 'gnus-summary-mode)
5409 (gnus-kill-buffer (current-buffer)))
5410 (error "Couldn't activate group %s: %s"
5411 (gnus-group-decoded-name group) (gnus-status-message group))))
5413 (unless (gnus-request-group group t)
5414 (when (equal major-mode 'gnus-summary-mode)
5415 (gnus-kill-buffer (current-buffer)))
5416 (error "Couldn't request group %s: %s"
5417 (gnus-group-decoded-name group) (gnus-status-message group)))
5420 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5422 (setq gnus-summary-use-undownloaded-faces
5423 (gnus-agent-find-parameter
5425 'agent-enable-undownloaded-faces)))
5427 (setq gnus-newsgroup-name group
5428 gnus-newsgroup-unselected nil
5429 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5431 (let ((display (gnus-group-find-parameter group 'display)))
5432 (setq gnus-newsgroup-display
5434 ((not (zerop (or (car-safe read-all) 0)))
5435 ;; The user entered the group with C-u SPC/RET, let's show
5441 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5443 ;; The following is probably the "correct" solution, but
5444 ;; it makes Gnus fetch all headers and then limit the
5445 ;; articles (which is slow), so instead we hack the
5446 ;; select-articles parameter instead. -- Simon Josefsson
5449 ;; (gnus-byte-compile
5450 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5452 (setq select-articles
5453 (gnus-uncompress-range
5454 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5458 (cdr (gnus-active group)))))
5463 (gnus-summary-setup-default-charset)
5465 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5466 (when (gnus-virtual-group-p group)
5467 (setq cached gnus-newsgroup-cached))
5469 (setq gnus-newsgroup-unreads
5470 (gnus-sorted-ndifference
5471 (gnus-sorted-ndifference gnus-newsgroup-unreads
5472 gnus-newsgroup-marked)
5473 gnus-newsgroup-dormant))
5475 (setq gnus-newsgroup-processable nil)
5477 (gnus-update-read-articles group gnus-newsgroup-unreads)
5479 ;; Adjust and set lists of article marks.
5481 (gnus-adjust-marked-articles info))
5482 (if (setq articles select-articles)
5483 (setq gnus-newsgroup-unselected
5484 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5485 (setq articles (gnus-articles-to-read group read-all)))
5489 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5491 ((eq articles 0) nil)
5493 ;; Init the dependencies hash table.
5494 (setq gnus-newsgroup-dependencies
5495 (gnus-make-hashtable (length articles)))
5496 (gnus-set-global-variables)
5497 ;; Retrieve the headers and read them in.
5499 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5501 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5503 (setq gnus-newsgroup-cached cached))
5505 ;; Suppress duplicates?
5506 (when gnus-suppress-duplicates
5507 (gnus-dup-suppress-articles))
5509 ;; Set the initial limit.
5510 (setq gnus-newsgroup-limit (copy-sequence articles))
5511 ;; Remove canceled articles from the list of unread articles.
5512 (setq fetched-articles
5513 (mapcar (lambda (headers) (mail-header-number headers))
5514 gnus-newsgroup-headers))
5515 (setq gnus-newsgroup-articles fetched-articles)
5516 (setq gnus-newsgroup-unreads
5517 (gnus-sorted-nintersection
5518 gnus-newsgroup-unreads fetched-articles))
5519 (gnus-compute-unseen-list)
5521 ;; Removed marked articles that do not exist.
5522 (gnus-update-missing-marks
5523 (gnus-sorted-difference articles fetched-articles))
5524 ;; We might want to build some more threads first.
5525 (when (and gnus-fetch-old-headers
5526 (eq gnus-headers-retrieved-by 'nov))
5527 (if (eq gnus-fetch-old-headers 'invisible)
5528 (gnus-build-all-threads)
5529 (gnus-build-old-threads)))
5530 ;; Let the Gnus agent mark articles as read.
5532 (gnus-agent-get-undownloaded-list))
5533 ;; Remove list identifiers from subject
5534 (when gnus-list-identifiers
5535 (gnus-summary-remove-list-identifiers))
5536 ;; Check whether auto-expire is to be done in this group.
5537 (setq gnus-newsgroup-auto-expire
5538 (gnus-group-auto-expirable-p group))
5539 ;; Set up the article buffer now, if necessary.
5540 (unless (and gnus-single-article-buffer
5541 (equal gnus-article-buffer "*Article*"))
5542 (gnus-article-setup-buffer))
5543 ;; First and last article in this newsgroup.
5544 (when gnus-newsgroup-headers
5545 (setq gnus-newsgroup-begin
5546 (mail-header-number (car gnus-newsgroup-headers))
5549 (gnus-last-element gnus-newsgroup-headers))))
5550 ;; GROUP is successfully selected.
5551 (or gnus-newsgroup-headers t)))))
5553 (defun gnus-compute-unseen-list ()
5554 ;; The `seen' marks are treated specially.
5555 (if (not gnus-newsgroup-seen)
5556 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5557 (setq gnus-newsgroup-unseen
5558 (gnus-inverse-list-range-intersection
5559 gnus-newsgroup-articles gnus-newsgroup-seen))))
5561 (defun gnus-summary-display-make-predicate (display)
5562 (require 'gnus-agent)
5563 (when (= (length display) 1)
5564 (setq display (car display)))
5565 (unless gnus-summary-display-cache
5566 (dolist (elem (append '((unread . unread)
5569 gnus-article-mark-lists))
5570 (push (cons (cdr elem)
5572 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5573 gnus-summary-display-cache)))
5574 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5575 (gnus-category-predicate-cache gnus-summary-display-cache))
5576 (gnus-get-predicate display)))
5578 ;; Uses the dynamically bound `number' variable.
5581 (defun gnus-article-marked-p (type &optional article)
5582 (let ((article (or article number)))
5585 (memq article gnus-newsgroup-marked))
5587 (memq article gnus-newsgroup-spam-marked))
5589 (memq article gnus-newsgroup-unsendable))
5590 ((eq type 'undownload)
5591 (memq article gnus-newsgroup-undownloaded))
5592 ((eq type 'download)
5593 (memq article gnus-newsgroup-downloadable))
5595 (memq article gnus-newsgroup-unreads))
5597 (memq article gnus-newsgroup-reads))
5599 (memq article gnus-newsgroup-dormant) )
5601 (memq article gnus-newsgroup-expirable))
5603 (memq article gnus-newsgroup-replied))
5605 (memq article gnus-newsgroup-killed))
5606 ((eq type 'bookmark)
5607 (assq article gnus-newsgroup-bookmarks))
5609 (assq article gnus-newsgroup-scored))
5611 (memq article gnus-newsgroup-saved))
5613 (memq article gnus-newsgroup-cached))
5615 (memq article gnus-newsgroup-forwarded))
5617 (not (memq article gnus-newsgroup-unseen)))
5619 (memq article gnus-newsgroup-recent))
5622 (defun gnus-articles-to-read (group &optional read-all)
5623 "Find out what articles the user wants to read."
5625 ;; Select all articles if `read-all' is non-nil, or if there
5626 ;; are no unread articles.
5628 (and (zerop (length gnus-newsgroup-marked))
5629 (zerop (length gnus-newsgroup-unreads)))
5630 ;; Fetch all if the predicate is non-nil.
5631 gnus-newsgroup-display)
5632 ;; We want to select the headers for all the articles in
5633 ;; the group, so we select either all the active
5634 ;; articles in the group, or (if that's nil), the
5635 ;; articles in the cache.
5637 (gnus-uncompress-range (gnus-active group))
5638 (gnus-cache-articles-in-group group))
5639 ;; Select only the "normal" subset of articles.
5641 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5642 gnus-newsgroup-unreads)))
5643 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5644 (scored (length scored-list))
5645 (number (length articles))
5646 (marked (+ (length gnus-newsgroup-marked)
5647 (length gnus-newsgroup-dormant)))
5652 ((numberp gnus-newsgroup-display)
5653 gnus-newsgroup-display)
5657 ((and (or (<= scored marked) (= scored number))
5658 (numberp gnus-large-newsgroup)
5659 (> number gnus-large-newsgroup))
5660 (let* ((cursor-in-echo-area nil)
5661 (initial (gnus-parameter-large-newsgroup-initial
5662 gnus-newsgroup-name))
5666 "How many articles from %s (%s %d): "
5667 (gnus-group-decoded-name gnus-newsgroup-name)
5668 (if initial "max" "default")
5671 (cons (number-to-string initial)
5673 (if (string-match "^[ \t]*$" input) number input)))
5674 ((and (> scored marked) (< scored number)
5675 (> (- scored number) 20))
5678 (format "%s %s (%d scored, %d total): "
5679 "How many articles from"
5680 (gnus-group-decoded-name group)
5682 (if (string-match "^[ \t]*$" input)
5686 (message "Quit getting the articles to read")
5688 (setq select (if (stringp select) (string-to-number select) select))
5689 (if (or (null select) (zerop select))
5691 (if (and (not (zerop scored)) (<= (abs select) scored))
5693 (setq articles (sort scored-list '<))
5694 (setq number (length articles)))
5695 (setq articles (copy-sequence articles)))
5697 (when (< (abs select) number)
5699 ;; Select the N oldest articles.
5700 (setcdr (nthcdr (1- (abs select)) articles) nil)
5701 ;; Select the N most recent articles.
5702 (setq articles (nthcdr (- number select) articles))))
5703 (setq gnus-newsgroup-unselected
5704 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5705 (when gnus-alter-articles-to-read-function
5708 (funcall gnus-alter-articles-to-read-function
5709 gnus-newsgroup-name articles)
5713 (defun gnus-killed-articles (killed articles)
5716 (when (inline (gnus-member-of-range (car articles) killed))
5717 (push (car articles) out))
5718 (setq articles (cdr articles)))
5721 (defun gnus-uncompress-marks (marks)
5722 "Uncompress the mark ranges in MARKS."
5723 (let ((uncompressed '(score bookmark))
5726 (if (memq (caar marks) uncompressed)
5727 (push (car marks) out)
5728 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5729 (setq marks (cdr marks)))
5732 (defun gnus-article-mark-to-type (mark)
5733 "Return the type of MARK."
5734 (or (cadr (assq mark gnus-article-special-mark-lists))
5737 (defun gnus-article-unpropagatable-p (mark)
5738 "Return whether MARK should be propagated to back end."
5739 (memq mark gnus-article-unpropagated-mark-lists))
5741 (defun gnus-adjust-marked-articles (info)
5742 "Set all article lists and remove all marks that are no longer valid."
5743 (let* ((marked-lists (gnus-info-marks info))
5744 (active (gnus-active (gnus-info-group info)))
5747 (types gnus-article-mark-lists)
5748 marks var articles article mark mark-type
5751 (dolist (marks marked-lists)
5752 (setq mark (car marks)
5753 mark-type (gnus-article-mark-to-type mark)
5754 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5756 ;; We set the variable according to the type of the marks list,
5757 ;; and then adjust the marks to a subset of the active articles.
5759 ;; Adjust "simple" lists - compressed yet unsorted
5760 ((eq mark-type 'list)
5761 ;; Simultaneously uncompress and clip to active range
5762 ;; See gnus-uncompress-range for a description of possible marks
5764 (if (not (cadr marks))
5766 (setq articles (if (numberp (cddr marks))
5772 (while (setq article (pop articles))
5773 (cond ((consp article)
5774 (setq bgn (max (car article) min)
5775 end (min (cdr article) max))
5777 (setq l (setcdr l (cons bgn nil))
5779 ((and (<= min article)
5781 (setq l (setcdr l (cons article nil))))))
5782 (set var (cdr lh)))))
5784 ((eq mark-type 'tuple)
5785 (set var (setq articles (cdr marks)))
5786 (when (not (listp (cdr (symbol-value var))))
5787 (set var (list (symbol-value var))))
5788 (when (not (listp (cdr articles)))
5789 (setq articles (list articles)))
5791 (when (or (not (consp (setq article (pop articles))))
5792 (< (car article) min)
5793 (> (car article) max))
5794 (set var (delq article (symbol-value var))))))
5795 ;; Adjust ranges (sloppily).
5796 ((eq mark-type 'range)
5799 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5800 ;; It should be (seen (NUM1 . NUM2)).
5801 (when (numberp (cddr marks))
5802 (setcdr marks (list (cdr marks))))
5803 (setq articles (cdr marks))
5804 (while (and articles
5805 (or (and (consp (car articles))
5806 (> min (cdar articles)))
5807 (and (numberp (car articles))
5808 (> min (car articles)))))
5810 (set var articles))))))))
5812 (defun gnus-update-missing-marks (missing)
5813 "Go through the list of MISSING articles and remove them from the mark lists."
5816 ;; Go through all types.
5817 (dolist (elem gnus-article-mark-lists)
5818 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
5819 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
5820 (when (symbol-value var)
5821 ;; This list has articles. So we delete all missing
5822 ;; articles from it.
5825 (set var (delq (pop m) (symbol-value var))))))))))
5827 (defun gnus-update-marks ()
5828 "Enter the various lists of marked articles into the newsgroup info list."
5829 (let ((types gnus-article-mark-lists)
5830 (info (gnus-get-info gnus-newsgroup-name))
5831 type list newmarked symbol delta-marks)
5833 ;; Add all marks lists to the list of marks lists.
5834 (while (setq type (pop types))
5835 (setq list (symbol-value
5837 (intern (format "gnus-newsgroup-%s" (car type))))))
5840 ;; Get rid of the entries of the articles that have the
5842 (when (and (eq (cdr type) 'score)
5846 (prev (cons nil list))
5849 (if (or (not (consp (car arts)))
5850 (= (cdar arts) gnus-summary-default-score))
5851 (setcdr prev (cdr arts))
5853 (setq arts (cdr arts)))
5854 (setq list (cdr all)))))
5856 (when (eq (cdr type) 'seen)
5857 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
5859 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
5860 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
5862 (when (and (gnus-check-backend-function
5863 'request-set-mark gnus-newsgroup-name)
5864 (not (gnus-article-unpropagatable-p (cdr type))))
5865 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
5866 (del (gnus-remove-from-range (gnus-copy-sequence old) list))
5867 (add (gnus-remove-from-range
5868 (gnus-copy-sequence list) old)))
5870 (push (list add 'add (list (cdr type))) delta-marks))
5872 (push (list del 'del (list (cdr type))) delta-marks))))
5875 (push (cons (cdr type) list) newmarked)))
5878 (unless (gnus-check-group gnus-newsgroup-name)
5879 (error "Can't open server for %s" gnus-newsgroup-name))
5880 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
5882 ;; Enter these new marks into the info of the group.
5884 (setcar (nthcdr 3 info) newmarked)
5885 ;; Add the marks lists to the end of the info.
5887 (setcdr (nthcdr 2 info) (list newmarked))))
5889 ;; Cut off the end of the info if there's nothing else there.
5893 (when (nthcdr (decf i) info)
5894 (setcdr (nthcdr i info) nil)))))))
5896 (defun gnus-set-mode-line (where)
5897 "Set the mode line of the article or summary buffers.
5898 If WHERE is `summary', the summary mode line format will be used."
5899 ;; Is this mode line one we keep updated?
5900 (when (and (memq where gnus-updated-mode-lines)
5902 (intern (format "gnus-%s-mode-line-format-spec" where))))
5905 ;; We evaluate this in the summary buffer since these
5906 ;; variables are buffer-local to that buffer.
5907 (set-buffer gnus-summary-buffer)
5908 ;; We bind all these variables that are used in the `eval' form
5910 (let* ((mformat (symbol-value
5912 (format "gnus-%s-mode-line-format-spec" where))))
5913 (gnus-tmp-group-name (gnus-mode-string-quote
5914 (gnus-group-decoded-name
5915 gnus-newsgroup-name)))
5916 (gnus-tmp-article-number (or gnus-current-article 0))
5917 (gnus-tmp-unread gnus-newsgroup-unreads)
5918 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
5919 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
5920 (gnus-tmp-unread-and-unselected
5921 (cond ((and (zerop gnus-tmp-unread-and-unticked)
5922 (zerop gnus-tmp-unselected))
5924 ((zerop gnus-tmp-unselected)
5925 (format "{%d more}" gnus-tmp-unread-and-unticked))
5926 (t (format "{%d(+%d) more}"
5927 gnus-tmp-unread-and-unticked
5928 gnus-tmp-unselected))))
5930 (if (and gnus-current-headers
5931 (vectorp gnus-current-headers))
5932 (gnus-mode-string-quote
5933 (mail-header-subject gnus-current-headers))
5935 bufname-length max-len
5936 gnus-tmp-header) ;; passed as argument to any user-format-funcs
5937 (setq mode-string (eval mformat))
5938 (setq bufname-length (if (string-match "%b" mode-string)
5941 (if (eq where 'summary)
5943 (get-buffer gnus-article-buffer))))
5946 (setq max-len (max 4 (if gnus-mode-non-string-length
5948 gnus-mode-non-string-length
5950 (length mode-string))))
5951 ;; We might have to chop a bit of the string off...
5952 (when (> (length mode-string) max-len)
5954 (concat (truncate-string-to-width mode-string (- max-len 3))
5956 ;; Pad the mode string a bit.
5957 (setq mode-string (format (format "%%-%ds" max-len) mode-string))))
5958 ;; Update the mode line.
5959 (setq mode-line-buffer-identification
5960 (gnus-mode-line-buffer-identification (list mode-string)))
5961 (set-buffer-modified-p t))))
5963 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
5964 "Go through the HEADERS list and add all Xrefs to a hash table.
5965 The resulting hash table is returned, or nil if no Xrefs were found."
5966 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
5967 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
5968 (xref-hashtb (gnus-make-hashtable))
5969 start group entry number xrefs header)
5971 (setq header (pop headers))
5972 (when (and (setq xrefs (mail-header-xref header))
5973 (not (memq (setq number (mail-header-number header))
5976 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
5977 (setq start (match-end 0))
5978 (setq group (if prefix
5979 (concat prefix (substring xrefs (match-beginning 1)
5981 (substring xrefs (match-beginning 1) (match-end 1))))
5983 (string-to-number (substring xrefs (match-beginning 2)
5985 (if (setq entry (gnus-gethash group xref-hashtb))
5986 (setcdr entry (cons number (cdr entry)))
5987 (gnus-sethash group (cons number nil) xref-hashtb)))))
5988 (and start xref-hashtb)))
5990 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
5991 "Look through all the headers and mark the Xrefs as read."
5992 (let ((virtual (gnus-virtual-group-p from-newsgroup))
5993 name info xref-hashtb idlist method nth4)
5995 (set-buffer gnus-group-buffer)
5996 (when (setq xref-hashtb
5997 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6000 (unless (string= from-newsgroup (setq name (symbol-name group)))
6001 (setq idlist (symbol-value group))
6002 ;; Dead groups are not updated.
6004 (setq info (gnus-get-info name))
6005 (when (stringp (setq nth4 (gnus-info-method info)))
6006 (setq nth4 (gnus-server-to-method nth4))))
6007 ;; Only do the xrefs if the group has the same
6008 ;; select method as the group we have just read.
6009 (or (gnus-methods-equal-p
6010 nth4 (gnus-find-method-for-group from-newsgroup))
6012 (equal nth4 (setq method (gnus-find-method-for-group
6014 (and (equal (car nth4) (car method))
6015 (equal (nth 1 nth4) (nth 1 method))))
6016 gnus-use-cross-reference
6017 (or (not (eq gnus-use-cross-reference t))
6019 ;; Only do cross-references on subscribed
6020 ;; groups, if that is what is wanted.
6021 (<= (gnus-info-level info) gnus-level-subscribed))
6022 (gnus-group-make-articles-read name idlist))))
6025 (defun gnus-compute-read-articles (group articles)
6026 (let* ((entry (gnus-group-entry group))
6027 (info (nth 2 entry))
6028 (active (gnus-active group))
6031 ;; First peel off all invalid article numbers.
6033 (let ((ids articles)
6035 (while (setq id (pop ids))
6036 (when (and first (> id (cdr active)))
6037 ;; We'll end up in this situation in one particular
6038 ;; obscure situation. If you re-scan a group and get
6039 ;; a new article that is cross-posted to a different
6040 ;; group that has not been re-scanned, you might get
6041 ;; crossposted article that has a higher number than
6042 ;; Gnus believes possible. So we re-activate this
6043 ;; group as well. This might mean doing the
6044 ;; crossposting thingy will *increase* the number
6045 ;; of articles in some groups. Tsk, tsk.
6046 (setq active (or (gnus-activate-group group) active)))
6047 (when (or (> id (cdr active))
6048 (< id (car active)))
6049 (setq articles (delq id articles))))))
6050 ;; If the read list is nil, we init it.
6052 (null (gnus-info-read info))
6054 (setq ninfo (cons 1 (1- (car active))))
6055 (setq ninfo (gnus-info-read info)))
6056 ;; Then we add the read articles to the range.
6058 ninfo (setq articles (sort articles '<))))))
6060 (defun gnus-group-make-articles-read (group articles)
6061 "Update the info of GROUP to say that ARTICLES are read."
6063 (entry (gnus-group-entry group))
6064 (info (nth 2 entry))
6065 (active (gnus-active group))
6068 (setq range (gnus-compute-read-articles group articles))
6069 (with-current-buffer gnus-group-buffer
6072 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6073 (gnus-info-set-read ',info ',(gnus-info-read info))
6074 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6075 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6076 (gnus-group-update-group ,group t))))
6077 ;; Add the read articles to the range.
6078 (gnus-info-set-read info range)
6079 (gnus-request-set-mark group (list (list range 'add '(read))))
6080 ;; Then we have to re-compute how many unread
6081 ;; articles there are in this group.
6085 (setq num (- (1+ (cdr active)) (car active))))
6086 ((not (listp (cdr range)))
6087 (setq num (- (cdr active) (- (1+ (cdr range))
6091 (if (numberp (car range))
6093 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6094 (setq range (cdr range)))
6095 (setq num (- (cdr active) num))))
6096 ;; Update the number of unread articles.
6098 ;; Update the group buffer.
6099 (unless (gnus-ephemeral-group-p group)
6100 (gnus-group-update-group group t))))))
6102 (defvar gnus-newsgroup-none-id 0)
6104 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6105 (let ((cur nntp-server-buffer)
6108 (with-current-buffer gnus-summary-buffer
6109 gnus-newsgroup-dependencies)))
6110 headers id end ref number
6111 (mail-parse-charset gnus-newsgroup-charset)
6112 (mail-parse-ignored-charsets
6113 (save-excursion (condition-case nil
6114 (set-buffer gnus-summary-buffer)
6116 gnus-newsgroup-ignored-charsets)))
6118 (set-buffer nntp-server-buffer)
6119 ;; Translate all TAB characters into SPACE characters.
6120 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6121 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6122 (ietf-drums-unfold-fws)
6123 (gnus-run-hooks 'gnus-parse-headers-hook)
6124 (let ((case-fold-search t)
6125 in-reply-to header p lines chars)
6126 (goto-char (point-min))
6127 ;; Search to the beginning of the next header. Error messages
6128 ;; do not begin with 2 or 3.
6129 (while (re-search-forward "^[23][0-9]+ " nil t)
6132 ;; This implementation of this function, with nine
6133 ;; search-forwards instead of the one re-search-forward and
6134 ;; a case (which basically was the old function) is actually
6135 ;; about twice as fast, even though it looks messier. You
6136 ;; can't have everything, I guess. Speed and elegance
6137 ;; doesn't always go hand in hand.
6143 (setq number (read cur))
6146 (narrow-to-region (point)
6147 (or (and (search-forward "\n.\n" nil t)
6153 (if (search-forward "\nsubject:" nil t)
6154 (funcall gnus-decode-encoded-word-function
6155 (nnheader-header-value))
6160 (if (search-forward "\nfrom:" nil t)
6161 (funcall gnus-decode-encoded-address-function
6162 (nnheader-header-value))
6167 (if (search-forward "\ndate:" nil t)
6168 (nnheader-header-value) ""))
6172 (setq id (if (re-search-forward
6173 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6174 ;; We do it this way to make sure the Message-ID
6175 ;; is (somewhat) syntactically valid.
6176 (buffer-substring (match-beginning 1)
6178 ;; If there was no message-id, we just fake one
6179 ;; to make subsequent routines simpler.
6180 (nnheader-generate-fake-message-id number))))
6184 (if (search-forward "\nreferences:" nil t)
6188 (nnheader-header-value)
6193 (search-backward ">" end t)
6196 (search-backward "<" end t)
6198 ;; Get the references from the in-reply-to header if there
6199 ;; were no references and the in-reply-to header looks
6201 (if (and (search-forward "\nin-reply-to:" nil t)
6202 (setq in-reply-to (nnheader-header-value))
6203 (string-match "<[^>]+>" in-reply-to))
6205 (setq ref (substring in-reply-to (match-beginning 0)
6207 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6208 (setq ref2 (substring in-reply-to (match-beginning 0)
6210 (when (> (length ref2) (length ref))
6217 (if (search-forward "\nchars: " nil t)
6218 (if (numberp (setq chars (ignore-errors (read cur))))
6224 (if (search-forward "\nlines: " nil t)
6225 (if (numberp (setq lines (ignore-errors (read cur))))
6231 (and (search-forward "\nxref:" nil t)
6232 (nnheader-header-value)))
6234 (when gnus-extra-headers
6235 (let ((extra gnus-extra-headers)
6239 (when (search-forward
6240 (concat "\n" (symbol-name (car extra)) ":") nil t)
6241 (push (cons (car extra) (nnheader-header-value))
6245 (when (equal id ref)
6248 (when gnus-alter-header-function
6249 (funcall gnus-alter-header-function header)
6250 (setq id (mail-header-id header)
6251 ref (gnus-parent-id (mail-header-references header))))
6254 (gnus-dependencies-add-header
6255 header dependencies force-new))
6256 (push header headers))
6257 (goto-char (point-max))
6259 (nreverse headers)))))
6261 ;; Goes through the xover lines and returns a list of vectors
6262 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6263 force-new dependencies
6264 group also-fetch-heads)
6265 "Parse the news overview data in the server buffer.
6266 Return a list of headers that match SEQUENCE (see
6267 `nntp-retrieve-headers')."
6268 ;; Get the Xref when the users reads the articles since most/some
6269 ;; NNTP servers do not include Xrefs when using XOVER.
6270 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6271 (let ((mail-parse-charset gnus-newsgroup-charset)
6272 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6273 (cur nntp-server-buffer)
6274 (dependencies (or dependencies gnus-newsgroup-dependencies))
6276 ((eq gnus-read-all-available-headers t)
6278 ((and (stringp gnus-read-all-available-headers)
6280 (string-match gnus-read-all-available-headers group))
6283 number headers header)
6285 (set-buffer nntp-server-buffer)
6286 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6287 ;; Allow the user to mangle the headers before parsing them.
6288 (gnus-run-hooks 'gnus-parse-headers-hook)
6289 (goto-char (point-min))
6290 (gnus-parse-without-error
6291 (while (and (or sequence allp)
6293 (setq number (read cur))
6295 (while (and sequence
6296 (< (car sequence) number))
6297 (setq sequence (cdr sequence))))
6300 (eq number (car sequence))))
6302 (setq sequence (cdr sequence))
6303 (setq header (inline
6304 (gnus-nov-parse-line
6305 number dependencies force-new)))))
6306 (push header headers))
6308 ;; A common bug in inn is that if you have posted an article and
6309 ;; then retrieves the active file, it will answer correctly --
6310 ;; the new article is included. However, a NOV entry for the
6311 ;; article may not have been generated yet, so this may fail.
6312 ;; We work around this problem by retrieving the last few
6313 ;; headers using HEAD.
6314 (if (or (not also-fetch-heads)
6316 ;; We (probably) got all the headers.
6318 (let ((gnus-nov-is-evil t))
6321 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6322 (gnus-get-newsgroup-headers))))))))
6324 (defun gnus-article-get-xrefs ()
6325 "Fill in the Xref value in `gnus-current-headers', if necessary.
6326 This is meant to be called in `gnus-article-internal-prepare-hook'."
6327 (let ((headers (with-current-buffer gnus-summary-buffer
6328 gnus-current-headers)))
6329 (or (not gnus-use-cross-reference)
6331 (and (mail-header-xref headers)
6332 (not (string= (mail-header-xref headers) "")))
6333 (let ((case-fold-search t)
6336 (nnheader-narrow-to-headers)
6337 (goto-char (point-min))
6338 (when (or (and (not (eobp))
6339 (eq (downcase (char-after)) ?x)
6340 (looking-at "Xref:"))
6341 (search-forward "\nXref:" nil t))
6342 (goto-char (1+ (match-end 0)))
6343 (setq xref (buffer-substring (point) (point-at-eol)))
6344 (mail-header-set-xref headers xref)))))))
6346 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6347 "Find article ID and insert the summary line for that article.
6348 OLD-HEADER can either be a header or a line number to insert
6349 the subject line on."
6350 (let* ((line (and (numberp old-header) old-header))
6351 (old-header (and (vectorp old-header) old-header))
6352 (header (cond ((and old-header use-old-header)
6355 (gnus-number-to-header id))
6356 (gnus-number-to-header id))
6358 (gnus-read-header id))))
6359 (number (and (numberp id) id))
6362 ;; Rebuild the thread that this article is part of and go to the
6363 ;; article we have fetched.
6364 (when (and (not gnus-show-threads)
6367 (setq d (gnus-data-find (mail-header-number old-header))))
6368 (goto-char (gnus-data-pos d))
6374 (gnus-delete-line))))))
6375 ;; Remove list identifiers from subject.
6376 (when gnus-list-identifiers
6377 (let ((gnus-newsgroup-headers (list header)))
6378 (gnus-summary-remove-list-identifiers)))
6380 (mail-header-set-number header (mail-header-number old-header)))
6381 (setq gnus-newsgroup-sparse
6382 (delq (setq number (mail-header-number header))
6383 gnus-newsgroup-sparse))
6384 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6385 (push number gnus-newsgroup-limit)
6386 (gnus-rebuild-thread (mail-header-id header) line)
6387 (gnus-summary-goto-subject number nil t))
6388 (when (and (numberp number)
6390 ;; We have to update the boundaries even if we can't fetch the
6391 ;; article if ID is a number -- so that the next `P' or `N'
6392 ;; command will fetch the previous (or next) article even
6393 ;; if the one we tried to fetch this time has been canceled.
6394 (when (> number gnus-newsgroup-end)
6395 (setq gnus-newsgroup-end number))
6396 (when (< number gnus-newsgroup-begin)
6397 (setq gnus-newsgroup-begin number))
6398 (setq gnus-newsgroup-unselected
6399 (delq number gnus-newsgroup-unselected)))
6400 ;; Report back a success?
6401 (and header (mail-header-number header))))
6403 ;;; Process/prefix in the summary buffer
6405 (defun gnus-summary-work-articles (n)
6406 "Return a list of articles to be worked upon.
6407 The prefix argument, the list of process marked articles, and the
6408 current article will be taken into consideration."
6410 (set-buffer gnus-summary-buffer)
6413 ;; A numerical prefix has been given.
6414 (setq n (prefix-numeric-value n))
6415 (let ((backward (< n 0))
6416 (n (abs (prefix-numeric-value n)))
6421 (push (setq article (gnus-summary-article-number))
6424 (gnus-summary-find-prev nil article)
6425 (gnus-summary-find-next nil article)))
6427 (nreverse articles)))
6428 ((and (gnus-region-active-p) (mark))
6429 (message "region active")
6430 ;; Work on the region between point and mark.
6431 (let ((max (max (point) (mark)))
6434 (goto-char (min (point) (mark)))
6437 (push (setq article (gnus-summary-article-number)) articles)
6438 (gnus-summary-find-next nil article)
6440 (nreverse articles))))
6441 (gnus-newsgroup-processable
6442 ;; There are process-marked articles present.
6443 ;; Save current state.
6444 (gnus-summary-save-process-mark)
6446 (reverse gnus-newsgroup-processable))
6448 ;; Just return the current article.
6449 (list (gnus-summary-article-number))))))
6451 (defmacro gnus-summary-iterate (arg &rest forms)
6452 "Iterate over the process/prefixed articles and do FORMS.
6453 ARG is the interactive prefix given to the command. FORMS will be
6454 executed with point over the summary line of the articles."
6455 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6456 `(let ((,articles (gnus-summary-work-articles ,arg)))
6458 (gnus-summary-goto-subject (car ,articles))
6462 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6463 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6465 (defun gnus-summary-save-process-mark ()
6466 "Push the current set of process marked articles on the stack."
6468 (push (copy-sequence gnus-newsgroup-processable)
6469 gnus-newsgroup-process-stack))
6471 (defun gnus-summary-kill-process-mark ()
6472 "Push the current set of process marked articles on the stack and unmark."
6474 (gnus-summary-save-process-mark)
6475 (gnus-summary-unmark-all-processable))
6477 (defun gnus-summary-yank-process-mark ()
6478 "Pop the last process mark state off the stack and restore it."
6480 (unless gnus-newsgroup-process-stack
6481 (error "Empty mark stack"))
6482 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6484 (defun gnus-summary-process-mark-set (set)
6485 "Make SET into the current process marked articles."
6486 (gnus-summary-unmark-all-processable)
6487 (mapc 'gnus-summary-set-process-mark set))
6489 ;;; Searching and stuff
6491 (defun gnus-summary-search-group (&optional backward use-level)
6492 "Search for next unread newsgroup.
6493 If optional argument BACKWARD is non-nil, search backward instead."
6495 (set-buffer gnus-group-buffer)
6496 (when (gnus-group-search-forward
6497 backward nil (if use-level (gnus-group-group-level) nil))
6498 (gnus-group-group-name))))
6500 (defun gnus-summary-best-group (&optional exclude-group)
6501 "Find the name of the best unread group.
6502 If EXCLUDE-GROUP, do not go to this group."
6503 (with-current-buffer gnus-group-buffer
6505 (gnus-group-best-unread-group exclude-group))))
6507 (defun gnus-summary-find-next (&optional unread article backward)
6509 (gnus-summary-find-prev unread article)
6510 (let* ((dummy (gnus-summary-article-intangible-p))
6511 (article (or article (gnus-summary-article-number)))
6512 (data (gnus-data-find-list article))
6514 (when (and (not dummy)
6515 (or (not gnus-summary-check-current)
6517 (not (gnus-data-unread-p (car data)))))
6518 (setq data (cdr data)))
6523 (unless (memq (gnus-data-number (car data))
6525 ((eq gnus-auto-goto-ignores
6526 'always-undownloaded)
6527 gnus-newsgroup-undownloaded)
6530 ((eq gnus-auto-goto-ignores
6532 gnus-newsgroup-unfetched)
6533 ((eq gnus-auto-goto-ignores
6535 gnus-newsgroup-undownloaded)))
6536 (when (gnus-data-unread-p (car data))
6537 (setq result (car data)
6539 (setq data (cdr data)))
6542 (goto-char (gnus-data-pos result))
6543 (gnus-data-number result)))))
6545 (defun gnus-summary-find-prev (&optional unread article)
6546 (let* ((eobp (eobp))
6547 (article (or article (gnus-summary-article-number)))
6548 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6550 (when (and (not eobp)
6551 (or (not gnus-summary-check-current)
6553 (not (gnus-data-unread-p (car data)))))
6554 (setq data (cdr data)))
6559 (unless (memq (gnus-data-number (car data))
6561 ((eq gnus-auto-goto-ignores
6562 'always-undownloaded)
6563 gnus-newsgroup-undownloaded)
6566 ((eq gnus-auto-goto-ignores
6568 gnus-newsgroup-unfetched)
6569 ((eq gnus-auto-goto-ignores
6571 gnus-newsgroup-undownloaded)))
6572 (when (gnus-data-unread-p (car data))
6573 (setq result (car data)
6575 (setq data (cdr data)))
6578 (goto-char (gnus-data-pos result))
6579 (gnus-data-number result))))
6581 (defun gnus-summary-find-subject (subject &optional unread backward article)
6582 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6583 (article (or article (gnus-summary-article-number)))
6584 (articles (gnus-data-list backward))
6585 (arts (gnus-data-find-list article articles))
6587 (when (or (not gnus-summary-check-current)
6589 (not (gnus-data-unread-p (car arts))))
6590 (setq arts (cdr arts)))
6592 (and (or (not unread)
6593 (gnus-data-unread-p (car arts)))
6594 (vectorp (gnus-data-header (car arts)))
6596 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6597 (setq result (car arts)
6599 (setq arts (cdr arts)))
6601 (goto-char (gnus-data-pos result))
6602 (gnus-data-number result))))
6604 (defun gnus-summary-search-forward (&optional unread subject backward)
6605 "Search forward for an article.
6606 If UNREAD, look for unread articles. If SUBJECT, look for
6607 articles with that subject. If BACKWARD, search backward instead."
6608 (cond (subject (gnus-summary-find-subject subject unread backward))
6609 (backward (gnus-summary-find-prev unread))
6610 (t (gnus-summary-find-next unread))))
6612 (defun gnus-recenter (&optional n)
6613 "Center point in window and redisplay frame.
6614 Also do horizontal recentering."
6616 (when (and gnus-auto-center-summary
6617 (not (eq gnus-auto-center-summary 'vertical)))
6618 (gnus-horizontal-recenter))
6621 (defun gnus-summary-recenter ()
6622 "Center point in the summary window.
6623 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6624 displayed, no centering will be performed."
6625 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6626 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6628 ;; The user has to want it.
6629 (when gnus-auto-center-summary
6630 (let* ((top (cond ((< (window-height) 4) 0)
6631 ((< (window-height) 7) 1)
6632 (t (if (numberp gnus-auto-center-summary)
6633 gnus-auto-center-summary
6634 (/ (1- (window-height)) 2)))))
6635 (height (1- (window-height)))
6636 (bottom (save-excursion (goto-char (point-max))
6637 (forward-line (- height))
6639 (window (get-buffer-window (current-buffer))))
6640 (when (get-buffer-window gnus-article-buffer)
6641 ;; Only do recentering when the article buffer is displayed,
6642 ;; Set the window start to either `bottom', which is the biggest
6643 ;; possible valid number, or the second line from the top,
6644 ;; whichever is the least.
6645 (let ((top-pos (save-excursion (forward-line (- top)) (point))))
6646 (if (> bottom top-pos)
6647 ;; Keep the second line from the top visible
6648 (set-window-start window top-pos)
6649 ;; Try to keep the bottom line visible; if it's partially
6650 ;; obscured, either scroll one more line to make it fully
6651 ;; visible, or revert to using TOP-POS.
6653 (goto-char (point-max))
6655 (let ((last-line-start (point)))
6657 (set-window-start window (point) t)
6658 (when (not (pos-visible-in-window-p last-line-start window))
6660 (set-window-start window (min (point) top-pos) t)))))))
6661 ;; Do horizontal recentering while we're at it.
6662 (when (and (get-buffer-window (current-buffer) t)
6663 (not (eq gnus-auto-center-summary 'vertical)))
6664 (let ((selected (selected-window)))
6665 (select-window (get-buffer-window (current-buffer) t))
6666 (gnus-summary-position-point)
6667 (gnus-horizontal-recenter)
6668 (select-window selected))))))
6670 (defun gnus-summary-jump-to-group (newsgroup)
6671 "Move point to NEWSGROUP in group mode buffer."
6672 ;; Keep update point of group mode buffer if visible.
6673 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6674 (save-window-excursion
6675 ;; Take care of tree window mode.
6676 (when (get-buffer-window gnus-group-buffer)
6677 (pop-to-buffer gnus-group-buffer))
6678 (gnus-group-jump-to-group newsgroup))
6680 ;; Take care of tree window mode.
6681 (if (get-buffer-window gnus-group-buffer)
6682 (pop-to-buffer gnus-group-buffer)
6683 (set-buffer gnus-group-buffer))
6684 (gnus-group-jump-to-group newsgroup))))
6686 ;; This function returns a list of article numbers based on the
6687 ;; difference between the ranges of read articles in this group and
6688 ;; the range of active articles.
6689 (defun gnus-list-of-unread-articles (group)
6690 (let* ((read (gnus-info-read (gnus-get-info group)))
6691 (active (or (gnus-active group) (gnus-activate-group group)))
6692 (last (or (cdr active)
6693 (error "Group %s couldn't be activated " group)))
6695 ;; If none are read, then all are unread.
6697 (setq first (car active))
6698 ;; If the range of read articles is a single range, then the
6699 ;; first unread article is the article after the last read
6700 ;; article. Sounds logical, doesn't it?
6701 (if (and (not (listp (cdr read)))
6702 (or (< (car read) (car active))
6703 (progn (setq read (list read))
6705 (setq first (max (car active) (1+ (cdr read))))
6706 ;; `read' is a list of ranges.
6707 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6710 (setq first (car active)))
6713 (while (< first nlast)
6714 (setq unread (cons first unread)
6716 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6717 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6718 (setq read (cdr read)))))
6719 ;; And add the last unread articles.
6720 (while (<= first last)
6721 (setq unread (cons first unread)
6723 ;; Return the list of unread articles.
6724 (delq 0 (nreverse unread))))
6726 (defun gnus-list-of-read-articles (group)
6727 "Return a list of unread, unticked and non-dormant articles."
6728 (let* ((info (gnus-get-info group))
6729 (marked (gnus-info-marks info))
6730 (active (gnus-active group)))
6732 (gnus-list-range-difference
6733 (gnus-list-range-difference
6734 (gnus-sorted-complement
6735 (gnus-uncompress-range active)
6736 (gnus-list-of-unread-articles group))
6737 (cdr (assq 'dormant marked)))
6738 (cdr (assq 'tick marked))))))
6740 ;; This function returns a sequence of article numbers based on the
6741 ;; difference between the ranges of read articles in this group and
6742 ;; the range of active articles.
6743 (defun gnus-sequence-of-unread-articles (group)
6744 (let* ((read (gnus-info-read (gnus-get-info group)))
6745 (active (or (gnus-active group) (gnus-activate-group group)))
6748 ;; If none are read, then all are unread.
6750 (setq first (car active))
6751 ;; If the range of read articles is a single range, then the
6752 ;; first unread article is the article after the last read
6753 ;; article. Sounds logical, doesn't it?
6754 (if (and (not (listp (cdr read)))
6755 (or (< (car read) (car active))
6756 (progn (setq read (list read))
6758 (setq first (max (car active) (1+ (cdr read))))
6759 ;; `read' is a list of ranges.
6760 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6763 (setq first (car active)))
6766 (push (cons first nlast) unread))
6767 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6768 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6769 (setq read (cdr read)))))
6770 ;; And add the last unread articles.
6771 (cond ((not (and first last))
6774 (push (cons first last) unread))
6776 (push first unread)))
6777 ;; Return the sequence of unread articles.
6778 (delq 0 (nreverse unread))))
6780 ;; Various summary commands
6782 (defun gnus-summary-select-article-buffer ()
6783 "Reconfigure windows to show article buffer."
6785 (if (not (gnus-buffer-live-p gnus-article-buffer))
6786 (error "There is no article buffer for this summary buffer")
6787 (gnus-configure-windows 'article)
6788 (select-window (get-buffer-window gnus-article-buffer))))
6790 (defun gnus-summary-universal-argument (arg)
6791 "Perform any operation on all articles that are process/prefixed."
6793 (let ((articles (gnus-summary-work-articles arg))
6800 (substitute-command-keys
6801 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
6803 (gnus-error 1 "Undefined key")
6806 (gnus-summary-goto-subject (setq article (pop articles)))
6807 (let (gnus-newsgroup-processable)
6808 (command-execute func))
6809 (gnus-summary-remove-process-mark article)))))
6810 (gnus-summary-position-point))
6812 (defun gnus-summary-toggle-truncation (&optional arg)
6813 "Toggle truncation of summary lines.
6814 With ARG, turn line truncation on if ARG is positive."
6816 (setq truncate-lines
6817 (if (null arg) (not truncate-lines)
6818 (> (prefix-numeric-value arg) 0)))
6821 (defun gnus-summary-find-for-reselect ()
6822 "Return the number of an article to stay on across a reselect.
6823 The current article is considered, then following articles, then previous
6824 articles. An article is sought which is not cancelled and isn't a temporary
6825 insertion from another group. If there's no such then return a dummy 0."
6827 (dolist (rev '(nil t))
6828 (unless found ; don't demand the reverse list if we don't need it
6829 (let ((data (gnus-data-find-list
6830 (gnus-summary-article-number) (gnus-data-list rev))))
6831 (while (and data (not found))
6832 (if (and (< 0 (gnus-data-number (car data)))
6833 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
6834 (setq found (gnus-data-number (car data))))
6835 (setq data (cdr data))))))
6838 (defun gnus-summary-reselect-current-group (&optional all rescan)
6839 "Exit and then reselect the current newsgroup.
6840 The prefix argument ALL means to select all articles."
6842 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
6843 (error "Ephemeral groups can't be reselected"))
6844 (let ((current-subject (gnus-summary-find-for-reselect))
6845 (group gnus-newsgroup-name))
6846 (setq gnus-newsgroup-begin nil)
6847 (gnus-summary-exit nil 'leave-hidden)
6848 ;; We have to adjust the point of group mode buffer because
6849 ;; point was moved to the next unread newsgroup by exiting.
6850 (gnus-summary-jump-to-group group)
6853 (gnus-group-get-new-news-this-group 1)))
6854 (gnus-group-read-group all t)
6855 (gnus-summary-goto-subject current-subject nil t)))
6857 (defun gnus-summary-rescan-group (&optional all)
6858 "Exit the newsgroup, ask for new articles, and select the newsgroup."
6860 (gnus-summary-reselect-current-group all t))
6862 (defun gnus-summary-update-info (&optional non-destructive)
6864 (let ((group gnus-newsgroup-name))
6866 (when gnus-newsgroup-kill-headers
6867 (setq gnus-newsgroup-killed
6868 (gnus-compress-sequence
6870 (gnus-list-range-intersection
6871 gnus-newsgroup-unselected gnus-newsgroup-killed)
6872 gnus-newsgroup-unreads)
6874 (unless (listp (cdr gnus-newsgroup-killed))
6875 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
6876 (let ((headers gnus-newsgroup-headers))
6877 ;; Set the new ranges of read articles.
6878 (with-current-buffer gnus-group-buffer
6879 (gnus-undo-force-boundary))
6880 (gnus-update-read-articles
6881 group (gnus-sorted-union
6882 gnus-newsgroup-unreads gnus-newsgroup-unselected))
6883 ;; Set the current article marks.
6884 (let ((gnus-newsgroup-scored
6885 (if (and (not gnus-save-score)
6886 (not non-destructive))
6888 gnus-newsgroup-scored)))
6890 (gnus-update-marks)))
6891 ;; Do the cross-ref thing.
6892 (when gnus-use-cross-reference
6893 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
6894 ;; Do not switch windows but change the buffer to work.
6895 (set-buffer gnus-group-buffer)
6896 (unless (gnus-ephemeral-group-p group)
6897 (gnus-group-update-group group)))))))
6899 (defun gnus-summary-save-newsrc (&optional force)
6900 "Save the current number of read/marked articles in the dribble buffer.
6901 The dribble buffer will then be saved.
6902 If FORCE (the prefix), also save the .newsrc file(s)."
6904 (gnus-summary-update-info t)
6906 (gnus-save-newsrc-file)
6907 (gnus-dribble-save)))
6909 (defun gnus-summary-exit (&optional temporary leave-hidden)
6910 "Exit reading current newsgroup, and then return to group selection mode.
6911 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
6913 (gnus-set-global-variables)
6914 (when (gnus-buffer-live-p gnus-article-buffer)
6916 (set-buffer gnus-article-buffer)
6917 (mm-destroy-parts gnus-article-mime-handles)
6918 ;; Set it to nil for safety reason.
6919 (setq gnus-article-mime-handle-alist nil)
6920 (setq gnus-article-mime-handles nil)))
6921 (gnus-kill-save-kill-buffer)
6922 (gnus-async-halt-prefetch)
6923 (let* ((group gnus-newsgroup-name)
6924 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
6925 (gnus-group-is-exiting-p t)
6928 (buf (current-buffer)))
6930 ;; Do adaptive scoring, and possibly save score files.
6931 (when gnus-newsgroup-adaptive
6932 (gnus-score-adaptive))
6933 (when gnus-use-scoring
6935 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
6936 ;; If we have several article buffers, we kill them at exit.
6937 (unless gnus-single-article-buffer
6938 (gnus-kill-buffer gnus-article-buffer)
6939 (gnus-kill-buffer gnus-original-article-buffer)
6940 (setq gnus-article-current nil))
6941 (when gnus-use-cache
6942 (gnus-cache-possibly-remove-articles)
6943 (gnus-cache-save-buffers))
6944 (gnus-async-prefetch-remove-group group)
6945 (when gnus-suppress-duplicates
6946 (gnus-dup-enter-articles))
6947 (when gnus-use-trees
6948 (gnus-tree-close group))
6949 (when gnus-use-cache
6950 (gnus-cache-write-active))
6951 ;; Remove entries for this group.
6952 (nnmail-purge-split-history (gnus-group-real-name group))
6953 ;; Make all changes in this group permanent.
6955 (gnus-run-hooks 'gnus-exit-group-hook)
6956 (gnus-summary-update-info))
6957 (gnus-close-group group)
6958 ;; Make sure where we were, and go to next newsgroup.
6959 (set-buffer gnus-group-buffer)
6961 (gnus-group-jump-to-group group))
6962 (gnus-run-hooks 'gnus-summary-exit-hook)
6963 (unless (or quit-config
6964 (not gnus-summary-next-group-on-exit)
6965 ;; If this group has disappeared from the summary
6966 ;; buffer, don't skip forwards.
6967 (not (string= group (gnus-group-group-name))))
6968 (gnus-group-next-unread-group 1))
6969 (setq group-point (point))
6972 ;; If we have several article buffers, we kill them at exit.
6973 (unless gnus-single-article-buffer
6974 (gnus-kill-buffer gnus-article-buffer)
6975 (gnus-kill-buffer gnus-original-article-buffer)
6976 (setq gnus-article-current nil))
6978 (if (not gnus-kill-summary-on-exit)
6980 (gnus-deaden-summary)
6982 ;; We set all buffer-local variables to nil. It is unclear why
6983 ;; this is needed, but if we don't, buffer-local variables are
6984 ;; not garbage-collected, it seems. This would the lead to en
6985 ;; ever-growing Emacs.
6986 (gnus-summary-clear-local-variables)
6987 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
6988 (gnus-summary-clear-local-variables))
6989 (when (get-buffer gnus-article-buffer)
6990 (bury-buffer gnus-article-buffer))
6991 ;; Return to group mode buffer.
6992 (when (eq mode 'gnus-summary-mode)
6993 (gnus-kill-buffer buf)))
6994 (setq gnus-current-select-method gnus-select-method)
6995 (set-buffer gnus-group-buffer)
6997 (gnus-handle-ephemeral-exit quit-config)
6998 (goto-char group-point)
6999 ;; If gnus-group-buffer is already displayed, make sure we also move
7000 ;; the cursor in the window that displays it.
7001 (let ((win (get-buffer-window (current-buffer) 0)))
7002 (if win (set-window-point win (point))))
7003 (unless leave-hidden
7004 (gnus-configure-windows 'group 'force)))
7005 ;; Clear the current group name.
7007 (setq gnus-newsgroup-name nil)))))
7009 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7010 (defun gnus-summary-exit-no-update (&optional no-questions)
7011 "Quit reading current newsgroup without updating read article info."
7013 (let* ((group gnus-newsgroup-name)
7014 (gnus-group-is-exiting-p t)
7015 (gnus-group-is-exiting-without-update-p t)
7016 (quit-config (gnus-group-quit-config group)))
7017 (when (or no-questions
7019 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7020 (gnus-async-halt-prefetch)
7021 (run-hooks 'gnus-summary-prepare-exit-hook)
7022 (when (gnus-buffer-live-p gnus-article-buffer)
7024 (set-buffer gnus-article-buffer)
7025 (mm-destroy-parts gnus-article-mime-handles)
7026 ;; Set it to nil for safety reason.
7027 (setq gnus-article-mime-handle-alist nil)
7028 (setq gnus-article-mime-handles nil)))
7029 ;; If we have several article buffers, we kill them at exit.
7030 (unless gnus-single-article-buffer
7031 (gnus-kill-buffer gnus-article-buffer)
7032 (gnus-kill-buffer gnus-original-article-buffer)
7033 (setq gnus-article-current nil))
7034 (if (not gnus-kill-summary-on-exit)
7035 (gnus-deaden-summary)
7036 (gnus-close-group group)
7037 (gnus-summary-clear-local-variables)
7038 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
7039 (gnus-summary-clear-local-variables))
7040 (gnus-kill-buffer gnus-summary-buffer))
7041 (unless gnus-single-article-buffer
7042 (setq gnus-article-current nil))
7043 (when gnus-use-trees
7044 (gnus-tree-close group))
7045 (gnus-async-prefetch-remove-group group)
7046 (when (get-buffer gnus-article-buffer)
7047 (bury-buffer gnus-article-buffer))
7048 ;; Return to the group buffer.
7049 (gnus-configure-windows 'group 'force)
7050 ;; Clear the current group name.
7051 (setq gnus-newsgroup-name nil)
7052 (unless (gnus-ephemeral-group-p group)
7053 (gnus-group-update-group group))
7054 (when (equal (gnus-group-group-name) group)
7055 (gnus-group-next-unread-group 1))
7057 (gnus-handle-ephemeral-exit quit-config)))))
7059 (defun gnus-handle-ephemeral-exit (quit-config)
7060 "Handle movement when leaving an ephemeral group.
7061 The state which existed when entering the ephemeral is reset."
7062 (if (not (buffer-name (car quit-config)))
7063 (gnus-configure-windows 'group 'force)
7064 (set-buffer (car quit-config))
7065 (cond ((eq major-mode 'gnus-summary-mode)
7066 (gnus-set-global-variables))
7067 ((eq major-mode 'gnus-article-mode)
7069 ;; The `gnus-summary-buffer' variable may point
7070 ;; to the old summary buffer when using a single
7072 (unless (gnus-buffer-live-p gnus-summary-buffer)
7073 (set-buffer gnus-group-buffer))
7074 (set-buffer gnus-summary-buffer)
7075 (gnus-set-global-variables))))
7076 (if (or (eq (cdr quit-config) 'article)
7077 (eq (cdr quit-config) 'pick))
7078 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7079 (gnus-configure-windows 'pick 'force)
7080 (gnus-configure-windows (cdr quit-config) 'force))
7081 (gnus-configure-windows (cdr quit-config) 'force))
7082 (when (eq major-mode 'gnus-summary-mode)
7083 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7084 next-unread-noselect))
7085 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7087 (gnus-summary-next-subject 1 nil t))
7088 ((eq gnus-auto-select-on-ephemeral-exit
7089 'next-unread-noselect)
7090 (gnus-summary-next-subject 1 t t))))
7091 ;; Hide the article buffer which displays the article different
7092 ;; from the one that the cursor points to in the summary buffer.
7093 (gnus-configure-windows 'summary 'force))
7094 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7095 (gnus-summary-next-subject 1))
7096 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7097 (gnus-summary-next-subject 1 t))))
7098 (gnus-summary-recenter)
7099 (gnus-summary-position-point))))
7103 (defvar gnus-dead-summary-mode-map nil)
7105 (unless gnus-dead-summary-mode-map
7106 (setq gnus-dead-summary-mode-map (make-keymap))
7107 (suppress-keymap gnus-dead-summary-mode-map)
7108 (substitute-key-definition
7109 'undefined 'gnus-summary-wake-up-the-dead gnus-dead-summary-mode-map)
7110 (dolist (key '("\C-d" "\r" "\177" [delete]))
7111 (define-key gnus-dead-summary-mode-map
7112 key 'gnus-summary-wake-up-the-dead))
7113 (dolist (key '("q" "Q"))
7114 (define-key gnus-dead-summary-mode-map key 'bury-buffer)))
7116 (defvar gnus-dead-summary-mode nil
7117 "Minor mode for Gnus summary buffers.")
7119 (defun gnus-dead-summary-mode (&optional arg)
7120 "Minor mode for Gnus summary buffers."
7122 (when (eq major-mode 'gnus-summary-mode)
7123 (make-local-variable 'gnus-dead-summary-mode)
7124 (setq gnus-dead-summary-mode
7125 (if (null arg) (not gnus-dead-summary-mode)
7126 (> (prefix-numeric-value arg) 0)))
7127 (when gnus-dead-summary-mode
7129 'gnus-dead-summary-mode " Dead" gnus-dead-summary-mode-map))))
7131 (defun gnus-deaden-summary ()
7132 "Make the current summary buffer into a dead summary buffer."
7133 ;; Kill any previous dead summary buffer.
7134 (when (and gnus-dead-summary
7135 (buffer-name gnus-dead-summary))
7136 (with-current-buffer gnus-dead-summary
7137 (when gnus-dead-summary-mode
7138 (kill-buffer (current-buffer)))))
7139 ;; Make this the current dead summary.
7140 (setq gnus-dead-summary (current-buffer))
7141 (gnus-dead-summary-mode 1)
7142 (let ((name (buffer-name)))
7143 (when (string-match "Summary" name)
7145 (concat (substring name 0 (match-beginning 0)) "Dead "
7146 (substring name (match-beginning 0)))
7150 (defun gnus-kill-or-deaden-summary (buffer)
7151 "Kill or deaden the summary BUFFER."
7153 (when (and (buffer-name buffer)
7154 (not gnus-single-article-buffer))
7155 (with-current-buffer buffer
7156 (gnus-kill-buffer gnus-article-buffer)
7157 (gnus-kill-buffer gnus-original-article-buffer)))
7160 (gnus-kill-summary-on-exit
7161 (when (and gnus-use-trees
7162 (gnus-buffer-exists-p buffer))
7165 (gnus-tree-close gnus-newsgroup-name)))
7166 (gnus-kill-buffer buffer))
7167 ;; Deaden the buffer.
7168 ((gnus-buffer-exists-p buffer)
7171 (gnus-deaden-summary))))))
7173 (defun gnus-summary-wake-up-the-dead (&rest args)
7174 "Wake up the dead summary buffer."
7176 (gnus-dead-summary-mode -1)
7177 (let ((name (buffer-name)))
7178 (when (string-match "Dead " name)
7180 (concat (substring name 0 (match-beginning 0))
7181 (substring name (match-end 0)))
7183 (gnus-message 3 "This dead summary is now alive again"))
7185 ;; Suggested by Andrew Eskilsson <pi92ae@pt.hk-r.se>.
7186 (defun gnus-summary-fetch-faq (&optional faq-dir)
7187 "Fetch the FAQ for the current group.
7188 If FAQ-DIR (the prefix), prompt for a directory to search for the faq
7192 (when current-prefix-arg
7194 "FAQ dir: " (and (listp gnus-group-faq-directory)
7196 gnus-group-faq-directory))))))
7197 (let (gnus-faq-buffer)
7198 (when (setq gnus-faq-buffer
7199 (gnus-group-fetch-faq gnus-newsgroup-name faq-dir))
7200 (gnus-configure-windows 'summary-faq))))
7202 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7203 (defun gnus-summary-describe-group (&optional force)
7204 "Describe the current newsgroup."
7206 (gnus-group-describe-group force gnus-newsgroup-name))
7208 (defun gnus-summary-describe-briefly ()
7209 "Describe summary mode commands briefly."
7211 (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")))
7213 ;; Walking around group mode buffer from summary mode.
7215 (defun gnus-summary-next-group (&optional no-article target-group backward)
7216 "Exit current newsgroup and then select next unread newsgroup.
7217 If prefix argument NO-ARTICLE is non-nil, no article is selected
7218 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7219 previous group instead."
7221 ;; Stop pre-fetching.
7222 (gnus-async-halt-prefetch)
7223 (let ((current-group gnus-newsgroup-name)
7224 (current-buffer (current-buffer))
7226 ;; First we semi-exit this group to update Xrefs and all variables.
7227 ;; We can't do a real exit, because the window conf must remain
7228 ;; the same in case the user is prompted for info, and we don't
7229 ;; want the window conf to change before that...
7230 (gnus-summary-exit t)
7231 (while (not entered)
7232 ;; Then we find what group we are supposed to enter.
7233 (set-buffer gnus-group-buffer)
7234 (gnus-group-jump-to-group current-group)
7237 (if (eq gnus-keep-same-level 'best)
7238 (gnus-summary-best-group gnus-newsgroup-name)
7239 (gnus-summary-search-group backward gnus-keep-same-level))))
7240 (if (not target-group)
7241 ;; There are no further groups, so we return to the group
7244 (gnus-message 5 "Returning to the group buffer")
7246 (when (gnus-buffer-live-p current-buffer)
7247 (set-buffer current-buffer)
7248 (gnus-summary-exit))
7249 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7250 ;; We try to enter the target group.
7251 (gnus-group-jump-to-group target-group)
7252 (let ((unreads (gnus-group-group-unread)))
7253 (if (and (or (eq t unreads)
7254 (and unreads (not (zerop unreads))))
7255 (gnus-summary-read-group
7256 target-group nil no-article
7257 (and (buffer-name current-buffer) current-buffer)
7260 (setq current-group target-group
7261 target-group nil)))))))
7263 (defun gnus-summary-prev-group (&optional no-article)
7264 "Exit current newsgroup and then select previous unread newsgroup.
7265 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7267 (gnus-summary-next-group no-article nil t))
7269 ;; Walking around summary lines.
7271 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7272 "Go to the first subject satisfying any non-nil constraint.
7273 If UNREAD is non-nil, the article should be unread.
7274 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7275 If UNSEEN is non-nil, the article should be unseen.
7276 Returns the article selected or nil if there are no matching articles."
7280 ((null gnus-newsgroup-data)
7281 (gnus-message 3 "No articles in the group")
7283 ;; Pick the first article.
7284 ((not (or unread undownloaded unseen))
7285 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7286 (gnus-data-number (car gnus-newsgroup-data)))
7287 ;; Find the first unread article.
7289 (let ((data gnus-newsgroup-data))
7291 (let ((num (gnus-data-number (car data))))
7292 (or (memq num gnus-newsgroup-unfetched)
7293 (not (or (and unread
7294 (memq num gnus-newsgroup-unreads))
7296 (memq num gnus-newsgroup-undownloaded))
7298 (memq num gnus-newsgroup-unseen)))))))
7299 (setq data (cdr data)))
7303 (goto-char (gnus-data-pos (car data)))
7304 (gnus-data-number (car data)))
7305 (gnus-message 3 "No more%s articles"
7306 (let* ((r (when unread " unread"))
7307 (d (when undownloaded " undownloaded"))
7308 (s (when unseen " unseen"))
7309 (l (delq nil (list r d s))))
7310 (cond ((= 3 (length l))
7311 (concat r "," d ", or" s))
7313 (concat (car l) ", or" (cadr l)))
7320 (gnus-summary-position-point))))))
7322 (defun gnus-summary-next-subject (n &optional unread dont-display)
7323 "Go to next N'th summary line.
7324 If N is negative, go to the previous N'th subject line.
7325 If UNREAD is non-nil, only unread articles are selected.
7326 The difference between N and the actual number of steps taken is
7329 (let ((backward (< n 0))
7333 (gnus-summary-find-prev unread)
7334 (gnus-summary-find-next unread)))
7335 (unless (zerop (setq n (1- n)))
7336 (gnus-summary-show-thread)))
7338 (gnus-message 7 "No more%s articles"
7339 (if unread " unread" "")))
7340 (unless dont-display
7341 (gnus-summary-recenter)
7342 (gnus-summary-position-point))
7345 (defun gnus-summary-next-unread-subject (n)
7346 "Go to next N'th unread summary line."
7348 (gnus-summary-next-subject n t))
7350 (defun gnus-summary-prev-subject (n &optional unread)
7351 "Go to previous N'th summary line.
7352 If optional argument UNREAD is non-nil, only unread article is selected."
7354 (gnus-summary-next-subject (- n) unread))
7356 (defun gnus-summary-prev-unread-subject (n)
7357 "Go to previous N'th unread summary line."
7359 (gnus-summary-next-subject (- n) t))
7361 (defun gnus-summary-goto-subjects (articles)
7362 "Insert the subject header for ARTICLES in the current buffer."
7364 (dolist (article articles)
7365 (gnus-summary-goto-subject article t)))
7366 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7367 (gnus-summary-position-point))
7369 (defun gnus-summary-goto-subject (article &optional force silent)
7370 "Go the subject line of ARTICLE.
7371 If FORCE, also allow jumping to articles not currently shown."
7372 (interactive "nArticle number: ")
7373 (unless (numberp article)
7374 (error "Article %s is not a number" article))
7376 (data (gnus-data-find article)))
7377 ;; We read in the article if we have to.
7380 (gnus-summary-insert-subject
7382 (if (or (numberp force) (vectorp force)) force)
7384 (setq data (gnus-data-find article)))
7389 (gnus-message 3 "Can't find article %d" article))
7391 (let ((pt (gnus-data-pos data)))
7393 (gnus-summary-set-article-display-arrow pt))
7394 (gnus-summary-position-point)
7397 ;; Walking around summary lines with displaying articles.
7399 (defun gnus-summary-expand-window (&optional arg)
7400 "Make the summary buffer take up the entire Emacs frame.
7401 Given a prefix, will force an `article' buffer configuration."
7404 (gnus-configure-windows 'article 'force)
7405 (gnus-configure-windows 'summary 'force)))
7407 (defun gnus-summary-display-article (article &optional all-header)
7408 "Display ARTICLE in article buffer."
7409 (when (gnus-buffer-live-p gnus-article-buffer)
7410 (with-current-buffer gnus-article-buffer
7411 (mm-enable-multibyte)))
7412 (gnus-set-global-variables)
7413 (when (gnus-buffer-live-p gnus-article-buffer)
7414 (with-current-buffer gnus-article-buffer
7415 (setq gnus-article-charset gnus-newsgroup-charset)
7416 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7417 (mm-enable-multibyte)))
7421 (if gnus-summary-display-article-function
7422 (funcall gnus-summary-display-article-function article all-header)
7423 (gnus-article-prepare article all-header))
7424 (gnus-run-hooks 'gnus-select-article-hook)
7425 (when (and gnus-current-article
7426 (not (zerop gnus-current-article)))
7427 (gnus-summary-goto-subject gnus-current-article))
7428 (gnus-summary-recenter)
7429 (when (and gnus-use-trees gnus-show-threads)
7430 (gnus-possibly-generate-tree article)
7431 (gnus-highlight-selected-tree article))
7432 ;; Successfully display article.
7433 (gnus-article-set-window-start
7434 (cdr (assq article gnus-newsgroup-bookmarks))))))
7436 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7437 "Select the current article.
7438 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7439 non-nil, the article will be re-fetched even if it already present in
7440 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7442 ;; Make sure we are in the summary buffer to work around bbdb bug.
7443 (unless (eq major-mode 'gnus-summary-mode)
7444 (set-buffer gnus-summary-buffer))
7445 (let ((article (or article (gnus-summary-article-number)))
7446 (all-headers (not (not all-headers))) ;Must be t or nil.
7447 gnus-summary-display-article-function)
7449 (gnus-summary-article-pseudo-p article)
7450 (error "This is a pseudo-article"))
7452 (set-buffer gnus-summary-buffer)
7453 (if (or (and gnus-single-article-buffer
7454 (or (null gnus-current-article)
7455 (null gnus-article-current)
7456 (null (get-buffer gnus-article-buffer))
7457 (not (eq article (cdr gnus-article-current)))
7458 (not (equal (car gnus-article-current)
7459 gnus-newsgroup-name))))
7460 (and (not gnus-single-article-buffer)
7461 (or (null gnus-current-article)
7462 (not (eq gnus-current-article article))))
7464 ;; The requested article is different from the current article.
7466 (gnus-summary-display-article article all-headers)
7467 (when (gnus-buffer-live-p gnus-article-buffer)
7468 (with-current-buffer gnus-article-buffer
7469 (if (not gnus-article-decoded-p) ;; a local variable
7470 (mm-disable-multibyte))))
7471 (gnus-article-set-window-start
7472 (cdr (assq article gnus-newsgroup-bookmarks)))
7476 (defun gnus-summary-force-verify-and-decrypt ()
7477 "Display buttons for signed/encrypted parts and verify/decrypt them."
7479 (let ((mm-verify-option 'known)
7480 (mm-decrypt-option 'known)
7481 (gnus-article-emulate-mime t)
7482 (gnus-buttonized-mime-types (append (list "multipart/signed"
7483 "multipart/encrypted")
7484 gnus-buttonized-mime-types)))
7485 (gnus-summary-select-article nil 'force)))
7487 (defun gnus-summary-set-current-mark (&optional current-mark)
7488 "Obsolete function."
7491 (defun gnus-summary-next-article (&optional unread subject backward push)
7492 "Select the next article.
7493 If UNREAD, only unread articles are selected.
7494 If SUBJECT, only articles with SUBJECT are selected.
7495 If BACKWARD, the previous article is selected instead of the next."
7497 ;; Make sure we are in the summary buffer.
7498 (unless (eq major-mode 'gnus-summary-mode)
7499 (set-buffer gnus-summary-buffer))
7501 ;; Is there such an article?
7502 ((and (gnus-summary-search-forward unread subject backward)
7503 (or (gnus-summary-display-article (gnus-summary-article-number))
7504 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7505 (gnus-summary-position-point))
7506 ;; If not, we try the first unread, if that is wanted.
7508 gnus-auto-select-same
7509 (gnus-summary-first-unread-article))
7510 (gnus-summary-position-point)
7511 (gnus-message 6 "Wrapped"))
7512 ;; Try to get next/previous article not displayed in this group.
7513 ((and gnus-auto-extend-newsgroup
7514 (not unread) (not subject))
7515 (gnus-summary-goto-article
7516 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7517 nil (count-lines (point-min) (point))))
7518 ;; Go to next/previous group.
7520 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7521 (gnus-summary-jump-to-group gnus-newsgroup-name))
7522 (let ((cmd last-command-char)
7524 (with-current-buffer gnus-group-buffer
7527 (if (eq gnus-keep-same-level 'best)
7528 (gnus-summary-best-group gnus-newsgroup-name)
7529 (gnus-summary-search-group backward gnus-keep-same-level))))
7530 ;; For some reason, the group window gets selected. We change
7532 (select-window (get-buffer-window (current-buffer)))
7533 ;; Select next unread newsgroup automagically.
7535 ((or (not gnus-auto-select-next)
7537 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7538 ((or (eq gnus-auto-select-next 'quietly)
7539 (and (eq gnus-auto-select-next 'slightly-quietly)
7541 (and (eq gnus-auto-select-next 'almost-quietly)
7542 (gnus-summary-last-article-p)))
7544 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7546 (gnus-message 7 "No more%s articles (%s)..."
7547 (if unread " unread" "")
7548 (if group (concat "selecting " group)
7550 (gnus-summary-next-group nil group backward)))
7552 (when (gnus-key-press-event-p last-input-event)
7553 (gnus-summary-walk-group-buffer
7554 gnus-newsgroup-name cmd unread backward point))))))))
7556 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7557 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7558 (?\C-p (gnus-group-prev-unread-group 1))))
7559 (cursor-in-echo-area t)
7560 keve key group ended prompt)
7562 (set-buffer gnus-group-buffer)
7565 (if (eq gnus-keep-same-level 'best)
7566 (gnus-summary-best-group gnus-newsgroup-name)
7567 (gnus-summary-search-group backward gnus-keep-same-level))))
7571 "No more%s articles%s " (if unread " unread" "")
7573 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7574 (format " (Type %s for %s [%s])"
7575 (single-key-description cmd)
7576 (gnus-group-decoded-name group)
7577 (gnus-group-unread group))
7578 (format " (Type %s to exit %s)"
7579 (single-key-description cmd)
7580 (gnus-group-decoded-name gnus-newsgroup-name)))))
7581 ;; Confirm auto selection.
7582 (setq key (car (setq keve (gnus-read-event-char prompt)))
7585 ((assq key keystrokes)
7586 (let ((obuf (current-buffer)))
7587 (switch-to-buffer gnus-group-buffer)
7589 (gnus-group-jump-to-group group))
7590 (eval (cadr (assq key keystrokes)))
7591 (setq group (gnus-group-group-name))
7592 (switch-to-buffer obuf))
7596 (gnus-ephemeral-group-p gnus-newsgroup-name))
7598 (gnus-summary-next-group nil group backward)))
7600 (push (cdr keve) unread-command-events))))))
7602 (defun gnus-summary-next-unread-article ()
7603 "Select unread article after current one."
7605 (gnus-summary-next-article
7606 (or (not (eq gnus-summary-goto-unread 'never))
7607 (gnus-summary-last-article-p (gnus-summary-article-number)))
7608 (and gnus-auto-select-same
7609 (gnus-summary-article-subject))))
7611 (defun gnus-summary-prev-article (&optional unread subject)
7612 "Select the article after the current one.
7613 If UNREAD is non-nil, only unread articles are selected."
7615 (gnus-summary-next-article unread subject t))
7617 (defun gnus-summary-prev-unread-article ()
7618 "Select unread article before current one."
7620 (gnus-summary-prev-article
7621 (or (not (eq gnus-summary-goto-unread 'never))
7622 (gnus-summary-first-article-p (gnus-summary-article-number)))
7623 (and gnus-auto-select-same
7624 (gnus-summary-article-subject))))
7626 (defun gnus-summary-next-page (&optional lines circular stop)
7627 "Show next page of the selected article.
7628 If at the end of the current article, select the next article.
7629 LINES says how many lines should be scrolled up.
7631 If CIRCULAR is non-nil, go to the start of the article instead of
7632 selecting the next article when reaching the end of the current
7635 If STOP is non-nil, just stop when reaching the end of the message.
7637 Also see the variable `gnus-article-skip-boring'."
7639 (setq gnus-summary-buffer (current-buffer))
7640 (gnus-set-global-variables)
7641 (let ((article (gnus-summary-article-number))
7642 (article-window (get-buffer-window gnus-article-buffer t))
7644 ;; If the buffer is empty, we have no article.
7646 (error "No article to select"))
7647 (gnus-configure-windows 'article)
7648 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7649 (if (and (eq gnus-summary-goto-unread 'never)
7650 (not (gnus-summary-last-article-p article)))
7651 (gnus-summary-next-article)
7652 (gnus-summary-next-unread-article))
7653 (if (or (null gnus-current-article)
7654 (null gnus-article-current)
7655 (/= article (cdr gnus-article-current))
7656 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7657 ;; Selected subject is different from current article's.
7658 (gnus-summary-display-article article)
7659 (when article-window
7660 (gnus-eval-in-buffer-window gnus-article-buffer
7661 (setq endp (or (gnus-article-next-page lines)
7662 (gnus-article-only-boring-p))))
7665 (gnus-message 3 "End of message"))
7667 (gnus-summary-beginning-of-article))
7669 (gnus-message 3 "End of message"))
7671 (if (and (eq gnus-summary-goto-unread 'never)
7672 (not (gnus-summary-last-article-p article)))
7673 (gnus-summary-next-article)
7674 (gnus-summary-next-unread-article))))))))
7675 (gnus-summary-recenter)
7676 (gnus-summary-position-point)))
7678 (defun gnus-summary-prev-page (&optional lines move)
7679 "Show previous page of selected article.
7680 Argument LINES specifies lines to be scrolled down.
7681 If MOVE, move to the previous unread article if point is at
7682 the beginning of the buffer."
7684 (let ((article (gnus-summary-article-number))
7685 (article-window (get-buffer-window gnus-article-buffer t))
7687 (gnus-configure-windows 'article)
7688 (if (or (null gnus-current-article)
7689 (null gnus-article-current)
7690 (/= article (cdr gnus-article-current))
7691 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7692 ;; Selected subject is different from current article's.
7693 (gnus-summary-display-article article)
7694 (gnus-summary-recenter)
7695 (when article-window
7696 (gnus-eval-in-buffer-window gnus-article-buffer
7697 (setq endp (gnus-article-prev-page lines)))
7698 (when (and move endp)
7700 (gnus-message 3 "Beginning of message"))
7702 (if (and (eq gnus-summary-goto-unread 'never)
7703 (not (gnus-summary-first-article-p article)))
7704 (gnus-summary-prev-article)
7705 (gnus-summary-prev-unread-article))))))))
7706 (gnus-summary-position-point))
7708 (defun gnus-summary-prev-page-or-article (&optional lines)
7709 "Show previous page of selected article.
7710 Argument LINES specifies lines to be scrolled down.
7711 If at the beginning of the article, go to the next article."
7713 (gnus-summary-prev-page lines t))
7715 (defun gnus-summary-scroll-up (lines)
7716 "Scroll up (or down) one line current article.
7717 Argument LINES specifies lines to be scrolled up (or down if negative)."
7719 (gnus-configure-windows 'article)
7720 (gnus-summary-show-thread)
7721 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7722 (gnus-eval-in-buffer-window gnus-article-buffer
7724 (when (gnus-article-next-page lines)
7725 (gnus-message 3 "End of message")))
7727 (gnus-article-prev-page (- lines))))))
7728 (gnus-summary-recenter)
7729 (gnus-summary-position-point))
7731 (defun gnus-summary-scroll-down (lines)
7732 "Scroll down (or up) one line current article.
7733 Argument LINES specifies lines to be scrolled down (or up if negative)."
7735 (gnus-summary-scroll-up (- lines)))
7737 (defun gnus-summary-next-same-subject ()
7738 "Select next article which has the same subject as current one."
7740 (gnus-summary-next-article nil (gnus-summary-article-subject)))
7742 (defun gnus-summary-prev-same-subject ()
7743 "Select previous article which has the same subject as current one."
7745 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
7747 (defun gnus-summary-next-unread-same-subject ()
7748 "Select next unread article which has the same subject as current one."
7750 (gnus-summary-next-article t (gnus-summary-article-subject)))
7752 (defun gnus-summary-prev-unread-same-subject ()
7753 "Select previous unread article which has the same subject as current one."
7755 (gnus-summary-prev-article t (gnus-summary-article-subject)))
7757 (defun gnus-summary-first-unread-article ()
7758 "Select the first unread article.
7759 Return nil if there are no unread articles."
7762 (when (gnus-summary-first-subject t)
7763 (gnus-summary-show-thread)
7764 (gnus-summary-first-subject t)
7765 (gnus-summary-display-article (gnus-summary-article-number)))
7766 (gnus-summary-position-point)))
7768 (defun gnus-summary-first-unread-subject ()
7769 "Place the point on the subject line of the first unread article.
7770 Return nil if there are no unread articles."
7773 (when (gnus-summary-first-subject t)
7774 (gnus-summary-show-thread)
7775 (gnus-summary-first-subject t))
7776 (gnus-summary-position-point)))
7778 (defun gnus-summary-first-unseen-subject ()
7779 "Place the point on the subject line of the first unseen article.
7780 Return nil if there are no unseen articles."
7783 (when (gnus-summary-first-subject nil nil t)
7784 (gnus-summary-show-thread)
7785 (gnus-summary-first-subject nil nil t))
7786 (gnus-summary-position-point)))
7788 (defun gnus-summary-first-unseen-or-unread-subject ()
7789 "Place the point on the subject line of the first unseen article or,
7790 if all article have been seen, on the subject line of the first unread
7794 (unless (when (gnus-summary-first-subject nil nil t)
7795 (gnus-summary-show-thread)
7796 (gnus-summary-first-subject nil nil t))
7797 (when (gnus-summary-first-subject t)
7798 (gnus-summary-show-thread)
7799 (gnus-summary-first-subject t)))
7800 (gnus-summary-position-point)))
7802 (defun gnus-summary-first-article ()
7803 "Select the first article.
7804 Return nil if there are no articles."
7807 (when (gnus-summary-first-subject)
7808 (gnus-summary-show-thread)
7809 (gnus-summary-first-subject)
7810 (gnus-summary-display-article (gnus-summary-article-number)))
7811 (gnus-summary-position-point)))
7813 (defun gnus-summary-best-unread-article (&optional arg)
7814 "Select the unread article with the highest score.
7815 If given a prefix argument, select the next unread article that has a
7816 score higher than the default score."
7818 (let ((article (if arg
7819 (gnus-summary-better-unread-subject)
7820 (gnus-summary-best-unread-subject))))
7822 (gnus-summary-goto-article article)
7823 (error "No unread articles"))))
7825 (defun gnus-summary-best-unread-subject ()
7826 "Select the unread subject with the highest score."
7828 (let ((best -1000000)
7829 (data gnus-newsgroup-data)
7832 (and (gnus-data-unread-p (car data))
7834 (gnus-summary-article-score (gnus-data-number (car data))))
7837 article (gnus-data-number (car data))))
7838 (setq data (cdr data)))
7840 (gnus-summary-goto-subject article))
7841 (gnus-summary-position-point)
7844 (defun gnus-summary-better-unread-subject ()
7845 "Select the first unread subject that has a score over the default score."
7847 (let ((data gnus-newsgroup-data)
7849 (while (and (setq article (gnus-data-number (car data)))
7850 (or (gnus-data-read-p (car data))
7851 (not (> (gnus-summary-article-score article)
7852 gnus-summary-default-score))))
7853 (setq data (cdr data)))
7855 (gnus-summary-goto-subject article))
7856 (gnus-summary-position-point)
7859 (defun gnus-summary-last-subject ()
7860 "Go to the last displayed subject line in the group."
7861 (let ((article (gnus-data-number (car (gnus-data-list t)))))
7863 (gnus-summary-goto-subject article))))
7865 (defun gnus-summary-goto-article (article &optional all-headers force)
7866 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
7867 If ALL-HEADERS is non-nil, no header lines are hidden.
7868 If FORCE, go to the article even if it isn't displayed. If FORCE
7869 is a number, it is the line the article is to be displayed on."
7873 "Article number or Message-ID: "
7874 (mapcar (lambda (number) (list (int-to-string number)))
7875 gnus-newsgroup-limit))
7879 (if (and (stringp article)
7880 (string-match "@\\|%40" article))
7881 (gnus-summary-refer-article article)
7882 (when (stringp article)
7883 (setq article (string-to-number article)))
7884 (if (gnus-summary-goto-subject article force)
7885 (gnus-summary-display-article article all-headers)
7886 (gnus-message 4 "Couldn't go to article %s" article) nil))
7887 (gnus-summary-position-point)))
7889 (defun gnus-summary-goto-last-article ()
7890 "Go to the previously read article."
7893 (when gnus-last-article
7894 (gnus-summary-goto-article gnus-last-article nil t))
7895 (gnus-summary-position-point)))
7897 (defun gnus-summary-pop-article (number)
7898 "Pop one article off the history and go to the previous.
7899 NUMBER articles will be popped off."
7902 (setq gnus-newsgroup-history
7903 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
7905 (gnus-summary-goto-article (car to) nil t)
7906 (error "Article history empty")))
7907 (gnus-summary-position-point))
7909 ;; Summary commands and functions for limiting the summary buffer.
7911 (defun gnus-summary-limit-to-articles (n)
7912 "Limit the summary buffer to the next N articles.
7913 If not given a prefix, use the process marked articles instead."
7916 (let ((articles (gnus-summary-work-articles n)))
7917 (setq gnus-newsgroup-processable nil)
7918 (gnus-summary-limit articles))
7919 (gnus-summary-position-point)))
7921 (defun gnus-summary-pop-limit (&optional total)
7922 "Restore the previous limit.
7923 If given a prefix, remove all limits."
7926 (setq gnus-newsgroup-limits
7927 (list (mapcar (lambda (h) (mail-header-number h))
7928 gnus-newsgroup-headers))))
7929 (unless gnus-newsgroup-limits
7930 (error "No limit to pop"))
7932 (gnus-summary-limit nil 'pop)
7933 (gnus-summary-position-point)))
7935 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
7936 "Limit the summary buffer to articles that have subjects that match a regexp.
7937 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
7939 (list (read-string (if current-prefix-arg
7940 "Exclude subject (regexp): "
7941 "Limit to subject (regexp): "))
7942 nil current-prefix-arg))
7944 (setq header "subject"))
7945 (when (not (equal "" subject))
7947 (let ((articles (gnus-summary-find-matching
7948 (or header "subject") subject 'all nil nil
7951 (error "Found no matches for \"%s\"" subject))
7952 (gnus-summary-limit articles))
7953 (gnus-summary-position-point))))
7955 (defun gnus-summary-limit-to-author (from &optional not-matching)
7956 "Limit the summary buffer to articles that have authors that match a regexp.
7957 If NOT-MATCHING, excluding articles that have authors that match a regexp."
7959 (list (read-string (if current-prefix-arg
7960 "Exclude author (regexp): "
7961 "Limit to author (regexp): "))
7962 current-prefix-arg))
7963 (gnus-summary-limit-to-subject from "from" not-matching))
7965 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
7966 "Limit the summary buffer to articles with the given RECIPIENT.
7968 If NOT-MATCHING, exclude RECIPIENT.
7970 To and Cc headers are checked. You need to include them in
7971 `nnmail-extra-headers'."
7972 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
7974 (list (read-string (format "%s recipient (regexp): "
7975 (if current-prefix-arg "Exclude" "Limit to")))
7976 current-prefix-arg))
7977 (when (not (equal "" recipient))
7979 (if (memq 'To nnmail-extra-headers)
7980 (gnus-summary-find-matching
7981 (cons 'extra 'To) recipient 'all nil nil
7984 1 "`To' isn't present in `nnmail-extra-headers'")
7988 (if (memq 'Cc nnmail-extra-headers)
7989 (gnus-summary-find-matching
7990 (cons 'extra 'Cc) recipient 'all nil nil
7993 1 "`Cc' isn't present in `nnmail-extra-headers'")
7998 ;; We need the numbers that are in both lists:
8000 (and (memq a to) a))
8004 (error "Found no matches for \"%s\"" recipient))
8005 (gnus-summary-limit articles))
8006 (gnus-summary-position-point))))
8008 (defun gnus-summary-limit-strange-charsets-predicate (header)
8009 (let ((string (concat (mail-header-subject header)
8010 (mail-header-from header)))
8012 (dotimes (i (1- (length string)))
8013 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8014 (when (string-match "unicode\\|big\\|japanese" charset)
8018 (defun gnus-summary-limit-to-predicate (predicate)
8019 "Limit to articles where PREDICATE returns non-nil.
8020 PREDICATE will be called with the header structures of the
8022 (let ((articles nil)
8023 (case-fold-search t))
8024 (dolist (header gnus-newsgroup-headers)
8025 (when (funcall predicate header)
8026 (push (mail-header-number header) articles)))
8027 (gnus-summary-limit (nreverse articles))))
8029 (defun gnus-summary-limit-to-age (age &optional younger-p)
8030 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8031 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8032 articles that are younger than AGE days."
8034 (let ((younger current-prefix-arg)
8037 (while (not days-got)
8038 (setq days (if younger
8039 (read-string "Limit to articles younger than (in days, older when negative): ")
8041 "Limit to articles older than (in days, younger when negative): ")))
8042 (when (> (length days) 0)
8043 (setq days (read days)))
8048 (setq younger (not younger))
8049 (setq days (* days -1))))
8050 (message "Please enter a number.")
8052 (list days younger)))
8054 (let ((data gnus-newsgroup-data)
8055 (cutoff (days-to-time age))
8056 articles d date is-younger)
8057 (while (setq d (pop data))
8058 (when (and (vectorp (gnus-data-header d))
8059 (setq date (mail-header-date (gnus-data-header d))))
8060 (setq is-younger (time-less-p
8061 (time-since (condition-case ()
8068 (push (gnus-data-number d) articles))))
8069 (gnus-summary-limit (nreverse articles)))
8070 (gnus-summary-position-point)))
8072 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8073 "Limit the summary buffer to articles that match an 'extra' header."
8077 (gnus-completing-read-with-default
8078 (symbol-name (car gnus-extra-headers))
8079 (if current-prefix-arg
8080 "Exclude extra header"
8081 "Limit extra header")
8083 (cons (symbol-name x) x))
8088 (read-string (format "%s header %s (regexp): "
8089 (if current-prefix-arg "Exclude" "Limit to")
8091 current-prefix-arg)))
8092 (when (not (equal "" regexp))
8094 (let ((articles (gnus-summary-find-matching
8095 (cons 'extra header) regexp 'all nil nil
8098 (error "Found no matches for \"%s\"" regexp))
8099 (gnus-summary-limit articles))
8100 (gnus-summary-position-point))))
8102 (defun gnus-summary-limit-to-display-predicate ()
8103 "Limit the summary buffer to the predicated in the `display' group parameter."
8105 (unless gnus-newsgroup-display
8106 (error "There is no `display' group parameter"))
8108 (dolist (number gnus-newsgroup-articles)
8109 (when (funcall gnus-newsgroup-display)
8110 (push number articles)))
8111 (gnus-summary-limit articles))
8112 (gnus-summary-position-point))
8114 (defalias 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8116 'gnus-summary-delete-marked-as-read 'gnus-summary-limit-to-unread)
8118 (defun gnus-summary-limit-to-unread (&optional all)
8119 "Limit the summary buffer to articles that are not marked as read.
8120 If ALL is non-nil, limit strictly to unread articles."
8123 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8124 (gnus-summary-limit-to-marks
8125 ;; Concat all the marks that say that an article is read and have
8127 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8128 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8129 gnus-low-score-mark gnus-expirable-mark
8130 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8131 gnus-duplicate-mark gnus-souped-mark)
8134 (defun gnus-summary-limit-to-headers (match &optional reverse)
8135 "Limit the summary buffer to articles that have headers that match MATCH.
8136 If REVERSE (the prefix), limit to articles that don't match."
8137 (interactive "sMatch headers (regexp): \nP")
8138 (gnus-summary-limit-to-bodies match reverse t))
8140 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8141 "Limit the summary buffer to articles that have bodies that match MATCH.
8142 If REVERSE (the prefix), limit to articles that don't match."
8143 (interactive "sMatch body (regexp): \nP")
8144 (let ((articles nil)
8145 (gnus-select-article-hook nil) ;Disable hook.
8146 (gnus-article-prepare-hook nil)
8147 (gnus-use-article-prefetch nil)
8148 (gnus-keep-backlog nil)
8149 (gnus-break-pages nil)
8150 (gnus-summary-display-arrow nil)
8151 (gnus-updated-mode-lines nil)
8152 (gnus-auto-center-summary nil)
8153 (gnus-display-mime-function nil))
8154 (dolist (data gnus-newsgroup-data)
8155 (let (gnus-mark-article-hook)
8156 (gnus-summary-select-article t t nil (gnus-data-number data)))
8158 (set-buffer gnus-article-buffer)
8160 (let* ((case-fold-search t)
8162 (re-search-backward match nil t)
8163 (re-search-forward match nil t))))
8164 (when (or (and found
8168 (push (gnus-data-number data) articles)))))
8170 (message "No messages matched")
8171 (gnus-summary-limit articles)))
8172 (gnus-summary-position-point))
8174 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8175 "Limit the summary buffer to articles that aren't part on any thread.
8176 If THREADSP (the prefix), limit to articles that are in threads."
8178 (let ((articles nil)
8181 (dolist (thread gnus-newsgroup-threads)
8182 (if (stringp (car thread))
8183 (dolist (thread (cdr thread))
8184 (push thread threads))
8185 (push thread threads)))
8186 (dolist (thread threads)
8187 (setq thread-articles (gnus-articles-in-thread thread))
8188 (when (or (and threadsp
8189 (> (length thread-articles) 1))
8191 (= (length thread-articles) 1)))
8192 (setq articles (nconc thread-articles articles))))
8194 (message "No messages matched")
8195 (gnus-summary-limit articles))
8196 (gnus-summary-position-point)))
8198 (defun gnus-summary-limit-to-replied (&optional unreplied)
8199 "Limit the summary buffer to replied articles.
8200 If UNREPLIED (the prefix), limit to unreplied articles."
8204 (gnus-set-difference gnus-newsgroup-articles
8205 gnus-newsgroup-replied))
8206 (gnus-summary-limit gnus-newsgroup-replied))
8207 (gnus-summary-position-point))
8209 (defalias 'gnus-summary-delete-marked-with 'gnus-summary-limit-exclude-marks)
8210 (make-obsolete 'gnus-summary-delete-marked-with
8211 'gnus-summary-limit-exclude-marks)
8213 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8214 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8215 If REVERSE, limit the summary buffer to articles that are marked
8216 with MARKS. MARKS can either be a string of marks or a list of marks.
8217 Returns how many articles were removed."
8218 (interactive "sMarks: ")
8219 (gnus-summary-limit-to-marks marks t))
8221 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8222 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8223 If REVERSE (the prefix), limit the summary buffer to articles that are
8224 not marked with MARKS. MARKS can either be a string of marks or a
8226 Returns how many articles were removed."
8227 (interactive "sMarks: \nP")
8229 (let ((data gnus-newsgroup-data)
8230 (marks (if (listp marks) marks
8231 (append marks nil))) ; Transform to list.
8234 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8235 (memq (gnus-data-mark (car data)) marks))
8236 (push (gnus-data-number (car data)) articles))
8237 (setq data (cdr data)))
8238 (gnus-summary-limit articles))
8239 (gnus-summary-position-point)))
8241 (defun gnus-summary-limit-to-score (score)
8242 "Limit to articles with score at or above SCORE."
8243 (interactive "NLimit to articles with score of at least: ")
8244 (let ((data gnus-newsgroup-data)
8247 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8249 (push (gnus-data-number (car data)) articles))
8250 (setq data (cdr data)))
8252 (gnus-summary-limit articles)
8253 (gnus-summary-position-point))))
8255 (defun gnus-summary-limit-to-unseen ()
8256 "Limit to unseen articles."
8259 (gnus-summary-limit gnus-newsgroup-unseen)
8260 (gnus-summary-position-point)))
8262 (defun gnus-summary-limit-include-thread (id)
8263 "Display all the hidden articles that is in the thread with ID in it.
8264 When called interactively, ID is the Message-ID of the current
8266 (interactive (list (mail-header-id (gnus-summary-article-header))))
8267 (let ((articles (gnus-articles-in-thread
8268 (gnus-id-to-thread (gnus-root-id id)))))
8270 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8271 (gnus-summary-limit-include-matching-articles
8273 (regexp-quote (gnus-simplify-subject-re
8274 (mail-header-subject (gnus-id-to-header id)))))
8275 (gnus-summary-position-point))))
8277 (defun gnus-summary-limit-include-matching-articles (header regexp)
8278 "Display all the hidden articles that have HEADERs that match REGEXP."
8279 (interactive (list (read-string "Match on header: ")
8280 (read-string "Regexp: ")))
8281 (let ((articles (gnus-find-matching-articles header regexp)))
8283 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8284 (gnus-summary-position-point))))
8286 (defun gnus-summary-insert-dormant-articles ()
8287 "Insert all the dormant articles for this group into the current buffer."
8289 (let ((gnus-verbose (max 6 gnus-verbose)))
8290 (if (not gnus-newsgroup-dormant)
8291 (gnus-message 3 "No dormant articles for this group")
8292 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8294 (defun gnus-summary-insert-ticked-articles ()
8295 "Insert ticked articles for this group into the current buffer."
8297 (let ((gnus-verbose (max 6 gnus-verbose)))
8298 (if (not gnus-newsgroup-marked)
8299 (gnus-message 3 "No ticked articles for this group")
8300 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8302 (defun gnus-summary-limit-include-dormant ()
8303 "Display all the hidden articles that are marked as dormant.
8304 Note that this command only works on a subset of the articles currently
8305 fetched for this group."
8307 (unless gnus-newsgroup-dormant
8308 (error "There are no dormant articles in this group"))
8310 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8311 (gnus-summary-position-point)))
8313 (defun gnus-summary-limit-exclude-dormant ()
8314 "Hide all dormant articles."
8317 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8318 (gnus-summary-position-point)))
8320 (defun gnus-summary-limit-exclude-childless-dormant ()
8321 "Hide all dormant articles that have no children."
8323 (let ((data (gnus-data-list t))
8324 articles d children)
8325 ;; Find all articles that are either not dormant or have
8327 (while (setq d (pop data))
8328 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8330 (gnus-article-children (gnus-data-number d)))
8333 (when (memq (car children) articles)
8338 (push (gnus-data-number d) articles)))
8341 (gnus-summary-limit articles)
8342 (gnus-summary-position-point))))
8344 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8345 "Mark all unread excluded articles as read.
8346 If ALL, mark even excluded ticked and dormants as read."
8348 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8349 (let ((articles (gnus-sorted-ndifference
8351 (mapcar (lambda (h) (mail-header-number h))
8352 gnus-newsgroup-headers)
8354 gnus-newsgroup-limit))
8356 (setq gnus-newsgroup-unreads
8357 (gnus-sorted-intersection gnus-newsgroup-unreads
8358 gnus-newsgroup-limit))
8360 (setq gnus-newsgroup-dormant nil
8361 gnus-newsgroup-marked nil
8362 gnus-newsgroup-reads
8364 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8365 gnus-newsgroup-reads))
8366 (while (setq article (pop articles))
8367 (unless (or (memq article gnus-newsgroup-dormant)
8368 (memq article gnus-newsgroup-marked))
8369 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8371 (defun gnus-summary-limit (articles &optional pop)
8373 ;; We pop the previous limit off the stack and use that.
8374 (setq articles (car gnus-newsgroup-limits)
8375 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8376 ;; We use the new limit, so we push the old limit on the stack.
8377 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8379 (setq gnus-newsgroup-limit articles)
8380 (let ((total (length gnus-newsgroup-data))
8381 (data (gnus-data-find-list (gnus-summary-article-number)))
8382 (gnus-summary-mark-below nil) ; Inhibit this.
8384 ;; This will do all the work of generating the new summary buffer
8385 ;; according to the new limit.
8386 (gnus-summary-prepare)
8387 ;; Hide any threads, possibly.
8388 (gnus-summary-maybe-hide-threads)
8389 ;; Try to return to the article you were at, or one in the
8392 ;; We try to find some article after the current one.
8394 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8397 (setq data (cdr data))))
8399 ;; If there is no data, that means that we were after the last
8400 ;; article. The same goes when we can't find any articles
8401 ;; after the current one.
8402 (goto-char (point-max))
8403 (gnus-summary-find-prev))
8404 (gnus-set-mode-line 'summary)
8405 ;; We return how many articles were removed from the summary
8406 ;; buffer as a result of the new limit.
8407 (- total (length gnus-newsgroup-data))))
8409 (defsubst gnus-invisible-cut-children (threads)
8412 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8417 (defsubst gnus-cut-thread (thread)
8418 "Go forwards in the thread until we find an article that we want to display."
8419 (when (or (eq gnus-fetch-old-headers 'some)
8420 (eq gnus-fetch-old-headers 'invisible)
8421 (numberp gnus-fetch-old-headers)
8422 (eq gnus-build-sparse-threads 'some)
8423 (eq gnus-build-sparse-threads 'more))
8424 ;; Deal with old-fetched headers and sparse threads.
8428 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8429 (gnus-summary-article-ancient-p
8430 (mail-header-number (car thread))))
8431 (if (or (<= (length (cdr thread)) 1)
8432 (eq gnus-fetch-old-headers 'invisible))
8433 (setq gnus-newsgroup-limit
8434 (delq (mail-header-number (car thread))
8435 gnus-newsgroup-limit)
8436 thread (cadr thread))
8437 (when (gnus-invisible-cut-children (cdr thread))
8438 (let ((th (cdr thread)))
8440 (if (memq (mail-header-number (caar th))
8441 gnus-newsgroup-limit)
8442 (setq thread (car th)
8444 (setq th (cdr th))))))))))
8447 (defun gnus-cut-threads (threads)
8448 "Cut off all uninteresting articles from the beginning of THREADS."
8449 (when (or (eq gnus-fetch-old-headers 'some)
8450 (eq gnus-fetch-old-headers 'invisible)
8451 (numberp gnus-fetch-old-headers)
8452 (eq gnus-build-sparse-threads 'some)
8453 (eq gnus-build-sparse-threads 'more))
8456 (setcar th (gnus-cut-thread (car th)))
8457 (setq th (cdr th)))))
8458 ;; Remove nixed out threads.
8461 (defun gnus-summary-initial-limit (&optional show-if-empty)
8462 "Figure out what the initial limit is supposed to be on group entry.
8463 This entails weeding out unwanted dormants, low-scored articles,
8464 fetch-old-headers verbiage, and so on."
8465 ;; Most groups have nothing to remove.
8466 (if (or gnus-inhibit-limiting
8467 (and (null gnus-newsgroup-dormant)
8468 (eq gnus-newsgroup-display 'gnus-not-ignore)
8469 (not (eq gnus-fetch-old-headers 'some))
8470 (not (numberp gnus-fetch-old-headers))
8471 (not (eq gnus-fetch-old-headers 'invisible))
8472 (null gnus-summary-expunge-below)
8473 (not (eq gnus-build-sparse-threads 'some))
8474 (not (eq gnus-build-sparse-threads 'more))
8475 (null gnus-thread-expunge-below)
8476 (not gnus-use-nocem)))
8478 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8479 (setq gnus-newsgroup-limit nil)
8482 (unless (car (symbol-value node))
8483 ;; These threads have no parents -- they are roots.
8484 (let ((nodes (cdr (symbol-value node)))
8487 (if (and gnus-thread-expunge-below
8488 (< (gnus-thread-total-score (car nodes))
8489 gnus-thread-expunge-below))
8490 (gnus-expunge-thread (pop nodes))
8491 (setq thread (pop nodes))
8492 (gnus-summary-limit-children thread))))))
8493 gnus-newsgroup-dependencies)
8494 ;; If this limitation resulted in an empty group, we might
8495 ;; pop the previous limit and use it instead.
8496 (when (and (not gnus-newsgroup-limit)
8498 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8499 gnus-newsgroup-limit))
8501 (defun gnus-summary-limit-children (thread)
8502 "Return 1 if this subthread is visible and 0 if it is not."
8503 ;; First we get the number of visible children to this thread. This
8504 ;; is done by recursing down the thread using this function, so this
8505 ;; will really go down to a leaf article first, before slowly
8506 ;; working its way up towards the root.
8508 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8511 (apply '+ (mapcar 'gnus-summary-limit-children
8514 (number (mail-header-number (car thread)))
8517 (not (memq number gnus-newsgroup-marked))
8519 ;; If this article is dormant and has absolutely no visible
8520 ;; children, then this article isn't visible.
8521 (and (memq number gnus-newsgroup-dormant)
8523 ;; If this is "fetch-old-headered" and there is no
8524 ;; visible children, then we don't want this article.
8525 (and (or (eq gnus-fetch-old-headers 'some)
8526 (numberp gnus-fetch-old-headers))
8527 (gnus-summary-article-ancient-p number)
8529 ;; If this is "fetch-old-headered" and `invisible', then
8530 ;; we don't want this article.
8531 (and (eq gnus-fetch-old-headers 'invisible)
8532 (gnus-summary-article-ancient-p number))
8533 ;; If this is a sparsely inserted article with no children,
8534 ;; we don't want it.
8535 (and (eq gnus-build-sparse-threads 'some)
8536 (gnus-summary-article-sparse-p number)
8538 ;; If we use expunging, and this article is really
8539 ;; low-scored, then we don't want this article.
8540 (when (and gnus-summary-expunge-below
8542 (or (cdr (assq number gnus-newsgroup-scored))
8543 gnus-summary-default-score))
8544 gnus-summary-expunge-below))
8545 ;; We increase the expunge-tally here, but that has
8546 ;; nothing to do with the limits, really.
8547 (incf gnus-newsgroup-expunged-tally)
8548 ;; We also mark as read here, if that's wanted.
8549 (when (and gnus-summary-mark-below
8550 (< score gnus-summary-mark-below))
8551 (setq gnus-newsgroup-unreads
8552 (delq number gnus-newsgroup-unreads))
8553 (if gnus-newsgroup-auto-expire
8554 (push number gnus-newsgroup-expirable)
8555 (push (cons number gnus-low-score-mark)
8556 gnus-newsgroup-reads)))
8558 ;; Do the `display' group parameter.
8559 (and gnus-newsgroup-display
8560 (not (funcall gnus-newsgroup-display)))
8561 ;; Check NoCeM things.
8562 (when (and gnus-use-nocem
8563 (gnus-nocem-unwanted-article-p
8564 (mail-header-id (car thread))))
8565 (setq gnus-newsgroup-unreads
8566 (delq number gnus-newsgroup-unreads))
8568 ;; Nope, invisible article.
8570 ;; Ok, this article is to be visible, so we add it to the limit
8572 (push number gnus-newsgroup-limit)
8575 (defun gnus-expunge-thread (thread)
8576 "Mark all articles in THREAD as read."
8577 (let* ((number (mail-header-number (car thread))))
8578 (incf gnus-newsgroup-expunged-tally)
8579 ;; We also mark as read here, if that's wanted.
8580 (setq gnus-newsgroup-unreads
8581 (delq number gnus-newsgroup-unreads))
8582 (if gnus-newsgroup-auto-expire
8583 (push number gnus-newsgroup-expirable)
8584 (push (cons number gnus-low-score-mark)
8585 gnus-newsgroup-reads)))
8586 ;; Go recursively through all subthreads.
8587 (mapcar 'gnus-expunge-thread (cdr thread)))
8589 ;; Summary article oriented commands
8591 (defun gnus-summary-refer-parent-article (n)
8592 "Refer parent article N times.
8593 If N is negative, go to ancestor -N instead.
8594 The difference between N and the number of articles fetched is returned."
8598 (when (not (natnump n))
8603 (setq header (gnus-summary-article-header))
8604 (if (and (eq (mail-header-number header)
8605 (cdr gnus-article-current))
8606 (equal gnus-newsgroup-name
8607 (car gnus-article-current)))
8608 ;; If we try to find the parent of the currently
8609 ;; displayed article, then we take a look at the actual
8610 ;; References header, since this is slightly more
8611 ;; reliable than the References field we got from the
8614 (set-buffer gnus-original-article-buffer)
8615 (nnheader-narrow-to-headers)
8616 (unless (setq ref (message-fetch-field "references"))
8617 (when (setq ref (message-fetch-field "in-reply-to"))
8618 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8621 ;; It's not the current article, so we take a bet on
8622 ;; the value we got from the server.
8623 (mail-header-references header)))
8625 (not (equal ref "")))
8626 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8627 (gnus-message 1 "Couldn't find parent"))
8628 (gnus-message 1 "No references in article %d"
8629 (gnus-summary-article-number))
8632 (gnus-summary-position-point)
8635 (defun gnus-summary-refer-references ()
8636 "Fetch all articles mentioned in the References header.
8637 Return the number of articles fetched."
8639 (let ((ref (mail-header-references (gnus-summary-article-header)))
8640 (current (gnus-summary-article-number))
8644 (error "No References in the current article")
8645 ;; For each Message-ID in the References header...
8646 (while (string-match "<[^>]*>" ref)
8648 ;; ... fetch that article.
8649 (gnus-summary-refer-article
8650 (prog1 (match-string 0 ref)
8651 (setq ref (substring ref (match-end 0))))))
8652 (gnus-summary-goto-subject current)
8653 (gnus-summary-position-point)
8656 (defun gnus-summary-refer-thread (&optional limit)
8657 "Fetch all articles in the current thread.
8658 If LIMIT (the numerical prefix), fetch that many old headers instead
8659 of what's specified by the `gnus-refer-thread-limit' variable."
8661 (let ((id (mail-header-id (gnus-summary-article-header)))
8662 (limit (if limit (prefix-numeric-value limit)
8663 gnus-refer-thread-limit)))
8664 (unless (eq gnus-fetch-old-headers 'invisible)
8665 (gnus-message 5 "Fetching headers for %s..." gnus-newsgroup-name)
8666 ;; Retrieve the headers and read them in.
8667 (if (eq (if (numberp limit)
8668 (gnus-retrieve-headers
8670 (+ (mail-header-number
8671 (gnus-summary-article-header))
8673 gnus-newsgroup-end))
8674 gnus-newsgroup-name (* limit 2))
8675 ;; gnus-refer-thread-limit is t, i.e. fetch _all_
8677 (gnus-retrieve-headers (list gnus-newsgroup-end)
8678 gnus-newsgroup-name limit))
8680 (gnus-build-all-threads)
8681 (error "Can't fetch thread from back ends that don't support NOV"))
8682 (gnus-message 5 "Fetching headers for %s...done" gnus-newsgroup-name))
8683 (gnus-summary-limit-include-thread id)))
8685 (defun gnus-summary-refer-article (message-id)
8686 "Fetch an article specified by MESSAGE-ID."
8687 (interactive "sMessage-ID: ")
8688 (when (and (stringp message-id)
8689 (not (zerop (length message-id))))
8690 (setq message-id (gnus-replace-in-string message-id " " ""))
8691 ;; Construct the correct Message-ID if necessary.
8692 ;; Suggested by tale@pawl.rpi.edu.
8693 (unless (string-match "^<" message-id)
8694 (setq message-id (concat "<" message-id)))
8695 (unless (string-match ">$" message-id)
8696 (setq message-id (concat message-id ">")))
8697 ;; People often post MIDs from URLs, so unhex it:
8698 (unless (string-match "@" message-id)
8699 (setq message-id (gnus-url-unhex-string message-id)))
8700 (let* ((header (gnus-id-to-header message-id))
8702 (gnus-summary-article-sparse-p
8703 (mail-header-number header))
8704 (memq (mail-header-number header)
8705 gnus-newsgroup-limit)))
8708 ;; If the article is present in the buffer we just go to it.
8710 (or (not (gnus-summary-article-sparse-p
8711 (mail-header-number header)))
8714 (gnus-summary-goto-article
8715 (mail-header-number header) nil t)
8717 (gnus-summary-update-article (mail-header-number header)))))
8719 ;; We fetch the article.
8721 (dolist (gnus-override-method (gnus-refer-article-methods))
8722 (when (and (gnus-check-server gnus-override-method)
8723 ;; Fetch the header,
8724 (setq number (gnus-summary-insert-subject message-id)))
8725 ;; and display the article.
8726 (gnus-summary-select-article nil nil nil number)
8728 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
8730 (defun gnus-refer-article-methods ()
8731 "Return a list of referable methods."
8733 ;; No method, so we default to current and native.
8734 ((null gnus-refer-article-method)
8735 (list gnus-current-select-method gnus-select-method))
8737 ((eq 'current gnus-refer-article-method)
8738 (list gnus-current-select-method))
8739 ;; List of select methods.
8740 ((not (and (symbolp (car gnus-refer-article-method))
8741 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
8743 (dolist (method gnus-refer-article-method)
8744 (push (if (eq 'current method)
8745 gnus-current-select-method
8749 ;; One single select method.
8751 (list gnus-refer-article-method))))
8753 (defun gnus-summary-edit-parameters ()
8754 "Edit the group parameters of the current group."
8756 (gnus-group-edit-group gnus-newsgroup-name 'params))
8758 (defun gnus-summary-customize-parameters ()
8759 "Customize the group parameters of the current group."
8761 (gnus-group-customize gnus-newsgroup-name))
8763 (defun gnus-summary-enter-digest-group (&optional force)
8764 "Enter an nndoc group based on the current article.
8765 If FORCE, force a digest interpretation. If not, try
8766 to guess what the document format is."
8768 (let ((conf gnus-current-window-configuration))
8769 (save-window-excursion
8771 (let (gnus-article-prepare-hook
8772 gnus-display-mime-function
8774 (gnus-summary-select-article))))
8775 (setq gnus-current-window-configuration conf)
8776 (let* ((name (format "%s-%d"
8777 (gnus-group-prefixed-name
8778 gnus-newsgroup-name (list 'nndoc ""))
8779 (with-current-buffer gnus-summary-buffer
8780 gnus-current-article)))
8781 (ogroup gnus-newsgroup-name)
8782 (params (append (gnus-info-params (gnus-get-info ogroup))
8783 (list (cons 'to-group ogroup))
8784 (list (cons 'parent-group ogroup))
8785 (list (cons 'save-article-group ogroup))))
8786 (case-fold-search t)
8787 (buf (current-buffer))
8790 (set-buffer gnus-original-article-buffer)
8791 ;; Have the digest group inherit the main mail address of
8792 ;; the parent article.
8793 (when (setq to-address (or (gnus-fetch-field "reply-to")
8794 (gnus-fetch-field "from")))
8797 (list (cons 'to-address
8798 (funcall gnus-decode-encoded-address-function
8800 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
8801 (insert-buffer-substring gnus-original-article-buffer)
8802 ;; Remove lines that may lead nndoc to misinterpret the
8805 (goto-char (point-min))
8806 (or (search-forward "\n\n" nil t) (point)))
8807 (goto-char (point-min))
8808 (delete-matching-lines "^Path:\\|^From ")
8811 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
8812 (gnus-newsgroup-ephemeral-ignored-charsets
8813 gnus-newsgroup-ignored-charsets))
8814 (gnus-group-read-ephemeral-group
8815 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
8817 ,(if force 'mbox 'guess)))
8819 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
8821 ;; Make all postings to this group go to the parent group.
8822 (nconc (gnus-info-params (gnus-get-info name))
8824 ;; Couldn't select this doc group.
8825 (switch-to-buffer buf)
8826 (gnus-set-global-variables)
8827 (gnus-configure-windows 'summary)
8828 (gnus-message 3 "Article couldn't be entered?"))
8829 (kill-buffer dig)))))
8831 (defun gnus-summary-read-document (n)
8832 "Open a new group based on the current article(s).
8833 This will allow you to read digests and other similar
8834 documents as newsgroups.
8835 Obeys the standard process/prefix convention."
8837 (let* ((ogroup gnus-newsgroup-name)
8838 (params (append (gnus-info-params (gnus-get-info ogroup))
8839 (list (cons 'to-group ogroup))))
8840 group egroup groups vgroup)
8841 (dolist (article (gnus-summary-work-articles n))
8842 (setq group (format "%s-%d" gnus-newsgroup-name article))
8843 (gnus-summary-remove-process-mark article)
8844 (when (gnus-summary-display-article article)
8847 (insert-buffer-substring gnus-original-article-buffer)
8848 ;; Remove some headers that may lead nndoc to make
8850 (message-narrow-to-head)
8851 (goto-char (point-min))
8852 (delete-matching-lines "^Path:\\|^From ")
8855 (gnus-group-read-ephemeral-group
8856 group `(nndoc ,group (nndoc-address ,(current-buffer))
8857 (nndoc-article-type guess))
8860 ;; Make all postings to this group go to the parent group.
8861 (nconc (gnus-info-params (gnus-get-info egroup))
8863 (push egroup groups))
8864 ;; Couldn't select this doc group.
8865 (gnus-error 3 "Article couldn't be entered"))))))
8866 ;; Now we have selected all the documents.
8869 (error "None of the articles could be interpreted as documents"))
8870 ((gnus-group-read-ephemeral-group
8871 (setq vgroup (format
8872 "nnvirtual:%s-%s" gnus-newsgroup-name
8873 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
8874 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
8876 (cons (current-buffer) 'summary)))
8878 (error "Couldn't select virtual nndoc group")))))
8880 (defun gnus-summary-isearch-article (&optional regexp-p)
8881 "Do incremental search forward on the current article.
8882 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
8884 (gnus-summary-select-article)
8885 (gnus-configure-windows 'article)
8886 (gnus-eval-in-buffer-window gnus-article-buffer
8889 (isearch-forward regexp-p))))
8891 (defun gnus-summary-repeat-search-article-forward ()
8892 "Repeat the previous search forwards."
8894 (unless gnus-last-search-regexp
8895 (error "No previous search"))
8896 (gnus-summary-search-article-forward gnus-last-search-regexp))
8898 (defun gnus-summary-repeat-search-article-backward ()
8899 "Repeat the previous search backwards."
8901 (unless gnus-last-search-regexp
8902 (error "No previous search"))
8903 (gnus-summary-search-article-forward gnus-last-search-regexp t))
8905 (defun gnus-summary-search-article-forward (regexp &optional backward)
8906 "Search for an article containing REGEXP forward.
8907 If BACKWARD, search backward instead."
8910 (format "Search article %s (regexp%s): "
8911 (if current-prefix-arg "backward" "forward")
8912 (if gnus-last-search-regexp
8913 (concat ", default " gnus-last-search-regexp)
8915 current-prefix-arg))
8916 (if (string-equal regexp "")
8917 (setq regexp (or gnus-last-search-regexp ""))
8918 (setq gnus-last-search-regexp regexp)
8919 (setq gnus-article-before-search gnus-current-article))
8920 ;; Intentionally set gnus-last-article.
8921 (setq gnus-last-article gnus-article-before-search)
8922 (let ((gnus-last-article gnus-last-article))
8923 (if (gnus-summary-search-article regexp backward)
8924 (gnus-summary-show-thread)
8925 (signal 'search-failed (list regexp)))))
8927 (defun gnus-summary-search-article-backward (regexp)
8928 "Search for an article containing REGEXP backward."
8931 (format "Search article backward (regexp%s): "
8932 (if gnus-last-search-regexp
8933 (concat ", default " gnus-last-search-regexp)
8935 (gnus-summary-search-article-forward regexp 'backward))
8937 (defun gnus-summary-search-article (regexp &optional backward)
8938 "Search for an article containing REGEXP.
8939 Optional argument BACKWARD means do search for backward.
8940 `gnus-select-article-hook' is not called during the search."
8941 ;; We have to require this here to make sure that the following
8942 ;; dynamic binding isn't shadowed by autoloading.
8943 (require 'gnus-async)
8945 (let ((gnus-select-article-hook nil) ;Disable hook.
8946 (gnus-article-prepare-hook nil)
8947 (gnus-mark-article-hook nil) ;Inhibit marking as read.
8948 (gnus-use-article-prefetch nil)
8949 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
8950 (gnus-use-trees nil) ;Inhibit updating tree buffer.
8952 (gnus-keep-backlog nil)
8953 (gnus-break-pages nil)
8954 (gnus-summary-display-arrow nil)
8955 (gnus-updated-mode-lines nil)
8956 (gnus-auto-center-summary nil)
8957 (sum (current-buffer))
8958 (gnus-display-mime-function nil)
8961 (gnus-save-hidden-threads
8962 (gnus-summary-select-article)
8963 (set-buffer gnus-article-buffer)
8964 (goto-char (window-point (get-buffer-window (current-buffer))))
8968 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
8970 (re-search-backward regexp nil t)
8971 (re-search-forward regexp nil t))
8972 ;; We found the regexp.
8977 (get-buffer-window (current-buffer))
8981 (get-buffer-window (current-buffer))
8984 (setq point (point)))
8985 ;; We didn't find it, so we go to the next article.
8988 (while (eq found 'not)
8989 (if (not (if backward (gnus-summary-find-prev)
8990 (gnus-summary-find-next)))
8991 ;; No more articles.
8993 ;; Select the next article and adjust point.
8994 (unless (gnus-summary-article-sparse-p
8995 (gnus-summary-article-number))
8997 (gnus-summary-select-article)
8998 (set-buffer gnus-article-buffer)
9000 (goto-char (if backward (point-max) (point-min))))))))
9001 (gnus-message 7 ""))
9002 ;; Return whether we found the regexp.
9003 (when (eq found 'found)
9005 (gnus-summary-show-thread)
9006 (gnus-summary-goto-subject gnus-current-article)
9007 (gnus-summary-position-point)
9010 (defun gnus-find-matching-articles (header regexp)
9011 "Return a list of all articles that match REGEXP on HEADER.
9012 This search includes all articles in the current group that Gnus has
9013 fetched headers for, whether they are displayed or not."
9014 (let ((articles nil)
9015 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9016 (case-fold-search t))
9017 (dolist (header gnus-newsgroup-headers)
9018 (when (string-match regexp (funcall func header))
9019 (push (mail-header-number header) articles)))
9020 (nreverse articles)))
9022 (defun gnus-summary-find-matching (header regexp &optional backward unread
9023 not-case-fold not-matching)
9024 "Return a list of all articles that match REGEXP on HEADER.
9025 The search stars on the current article and goes forwards unless
9026 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9027 If UNREAD is non-nil, only unread articles will
9028 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9029 in the comparisons. If NOT-MATCHING, return a list of all articles that
9030 not match REGEXP on HEADER."
9031 (let ((case-fold-search (not not-case-fold))
9034 (if (eq (car header) 'extra)
9037 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9039 (error "%s is an invalid header" header))
9040 (unless (fboundp (intern (concat "mail-header-" header)))
9041 (error "%s is not a valid header" header))
9042 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9043 (dolist (d (if (eq backward 'all)
9045 (gnus-data-find-list
9046 (gnus-summary-article-number)
9047 (gnus-data-list backward))))
9048 (when (and (or (not unread) ; We want all articles...
9049 (gnus-data-unread-p d)) ; Or just unreads.
9050 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9054 (funcall func (gnus-data-header d))))
9055 (string-match regexp
9056 (funcall func (gnus-data-header d)))))
9057 (push (gnus-data-number d) articles))) ; Success!
9058 (nreverse articles)))
9060 (defun gnus-summary-execute-command (header regexp command &optional backward)
9061 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9062 If HEADER is an empty string (or nil), the match is done on the entire
9063 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9065 (list (let ((completion-ignore-case t))
9068 (mapcar (lambda (header) (list (format "%s" header)))
9070 '("Number" "Subject" "From" "Lines" "Date"
9071 "Message-ID" "Xref" "References" "Body")
9072 gnus-extra-headers))
9073 nil 'require-match))
9074 (read-string "Regexp: ")
9075 (read-key-sequence "Command: ")
9076 current-prefix-arg))
9077 (when (equal header "Body")
9079 ;; Hidden thread subtrees must be searched as well.
9080 (gnus-summary-show-all-threads)
9081 ;; We don't want to change current point nor window configuration.
9083 (save-window-excursion
9085 gnus-treat-strip-trailing-blank-lines
9086 gnus-treat-strip-leading-blank-lines
9087 gnus-treat-strip-multiple-blank-lines
9088 gnus-treat-hide-boring-headers
9089 gnus-treat-fold-newsgroups
9090 gnus-article-prepare-hook)
9091 (gnus-message 6 "Executing %s..." (key-description command))
9092 ;; We'd like to execute COMMAND interactively so as to give arguments.
9093 (gnus-execute header regexp
9094 `(call-interactively ',(key-binding command))
9096 (gnus-message 6 "Executing %s...done" (key-description command))))))
9098 (defun gnus-summary-beginning-of-article ()
9099 "Scroll the article back to the beginning."
9101 (gnus-summary-select-article)
9102 (gnus-configure-windows 'article)
9103 (gnus-eval-in-buffer-window gnus-article-buffer
9105 (goto-char (point-min))
9106 (when gnus-break-pages
9107 (gnus-narrow-to-page))))
9109 (defun gnus-summary-end-of-article ()
9110 "Scroll to the end of the article."
9112 (gnus-summary-select-article)
9113 (gnus-configure-windows 'article)
9114 (gnus-eval-in-buffer-window gnus-article-buffer
9116 (goto-char (point-max))
9118 (when gnus-break-pages
9119 (when (re-search-backward page-delimiter nil t)
9120 (narrow-to-region (match-end 0) (point-max)))
9121 (gnus-narrow-to-page))))
9123 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9124 "Truncate to LEN and quote all \"(\"'s in STRING."
9125 (gnus-replace-in-string (if (and len (> (length string) len))
9126 (substring string 0 len)
9130 (defun gnus-summary-print-article (&optional filename n)
9131 "Generate and print a PostScript image of the process-marked (mail) articles.
9133 If used interactively, print the current article if none are
9134 process-marked. With prefix arg, prompt the user for the name of the
9137 When used from Lisp, accept two optional args FILENAME and N. N means
9138 to print the next N articles. If N is negative, print the N previous
9139 articles. If N is nil and articles have been marked with the process
9140 mark, print these instead.
9142 If the optional first argument FILENAME is nil, send the image to the
9143 printer. If FILENAME is a string, save the PostScript image in a file with
9144 that name. If FILENAME is a number, prompt the user for the name of the file
9146 (interactive (list (ps-print-preprint current-prefix-arg)))
9147 (dolist (article (gnus-summary-work-articles n))
9148 (gnus-summary-select-article nil nil 'pseudo article)
9149 (gnus-eval-in-buffer-window gnus-article-buffer
9150 (gnus-print-buffer))
9151 (gnus-summary-remove-process-mark article))
9152 (ps-despool filename))
9154 (defun gnus-print-buffer ()
9155 (let ((buffer (generate-new-buffer " *print*")))
9158 (copy-to-buffer buffer (point-min) (point-max))
9160 (gnus-remove-text-with-property 'gnus-decoration)
9161 (when (gnus-visual-p 'article-highlight 'highlight)
9162 ;; Copy-to-buffer doesn't copy overlay. So redo
9164 (let ((gnus-article-buffer buffer))
9165 (gnus-article-highlight-citation t)
9166 (gnus-article-highlight-signature)
9167 (gnus-article-emphasize)
9168 (gnus-article-delete-invisible-text)))
9169 (let ((ps-left-header
9172 (gnus-summary-print-truncate-and-quote
9173 (mail-header-subject gnus-current-headers)
9176 (gnus-summary-print-truncate-and-quote
9177 (mail-header-from gnus-current-headers)
9181 "/pagenumberstring load"
9183 (mail-header-date gnus-current-headers) ")"))))
9184 (gnus-run-hooks 'gnus-ps-print-hook)
9187 (ps-spool-buffer-with-faces)
9188 (ps-spool-buffer)))))
9189 (kill-buffer buffer))))
9191 (defun gnus-summary-show-article (&optional arg)
9192 "Force redisplaying of the current article.
9193 If ARG (the prefix) is a number, show the article with the charset
9194 defined in `gnus-summary-show-article-charset-alist', or the charset
9196 If ARG (the prefix) is non-nil and not a number, show the raw article
9197 without any article massaging functions being run. Normally, the key
9198 strokes are `C-u g'."
9202 (gnus-summary-show-article t)
9203 (let ((gnus-newsgroup-charset
9204 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9205 (mm-read-coding-system
9206 "View as charset: " ;; actually it is coding system.
9207 (with-current-buffer gnus-article-buffer
9208 (mm-detect-coding-region (point) (point-max))))))
9209 (gnus-newsgroup-ignored-charsets 'gnus-all))
9210 (gnus-summary-select-article nil 'force)
9211 (let ((deps gnus-newsgroup-dependencies)
9214 (set-buffer gnus-original-article-buffer)
9216 (message-narrow-to-head)
9217 (setq head (buffer-string))
9218 (goto-char (point-min))
9219 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9220 (goto-char (point-max))
9222 (setq lines (1- (count-lines (point) (point-max))))))
9224 (insert (format "211 %d Article retrieved.\n"
9225 (cdr gnus-article-current)))
9227 (if lines (insert (format "Lines: %d\n" lines)))
9229 (let ((nntp-server-buffer (current-buffer)))
9230 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9231 (gnus-data-set-header
9232 (gnus-data-find (cdr gnus-article-current))
9234 (gnus-summary-update-article-line
9235 (cdr gnus-article-current) header)
9236 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9237 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9239 ;; Select the article the normal way.
9240 (gnus-summary-select-article nil 'force))
9242 ;; We have to require this here to make sure that the following
9243 ;; dynamic binding isn't shadowed by autoloading.
9244 (require 'gnus-async)
9246 ;; Bind the article treatment functions to nil.
9247 (let ((gnus-have-all-headers t)
9248 gnus-article-prepare-hook
9249 gnus-article-decode-hook
9250 gnus-display-mime-function
9252 ;; Destroy any MIME parts.
9253 (when (gnus-buffer-live-p gnus-article-buffer)
9255 (set-buffer gnus-article-buffer)
9256 (mm-destroy-parts gnus-article-mime-handles)
9257 ;; Set it to nil for safety reason.
9258 (setq gnus-article-mime-handle-alist nil)
9259 (setq gnus-article-mime-handles nil)))
9260 (gnus-summary-select-article nil 'force))))
9261 (gnus-summary-goto-subject gnus-current-article)
9262 (gnus-summary-position-point))
9264 (defun gnus-summary-show-raw-article ()
9265 "Show the raw article without any article massaging functions being run."
9267 (gnus-summary-show-article t))
9269 (defun gnus-summary-verbose-headers (&optional arg)
9270 "Toggle permanent full header display.
9271 If ARG is a positive number, turn header display on.
9272 If ARG is a negative number, turn header display off."
9274 (setq gnus-show-all-headers
9275 (cond ((or (not (numberp arg))
9277 (not gnus-show-all-headers))
9280 (gnus-summary-show-article))
9282 (defun gnus-summary-toggle-header (&optional arg)
9283 "Show the headers if they are hidden, or hide them if they are shown.
9284 If ARG is a positive number, show the entire header.
9285 If ARG is a negative number, hide the unwanted header lines."
9287 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9288 (get-buffer-window gnus-article-buffer t))))
9289 (with-current-buffer gnus-article-buffer
9291 (article-narrow-to-head)
9292 (let* ((buffer-read-only nil)
9293 (inhibit-point-motion-hooks t)
9294 (hidden (if (numberp arg)
9296 (or (not (looking-at "[^ \t\n]+:"))
9297 (gnus-article-hidden-text-p 'headers))))
9299 (delete-region (point-min) (point-max))
9300 (with-current-buffer gnus-original-article-buffer
9301 (goto-char (setq s (point-min)))
9302 (setq e (if (search-forward "\n\n" nil t)
9305 (insert-buffer-substring gnus-original-article-buffer s e)
9306 (run-hooks 'gnus-article-decode-hook)
9308 (let ((gnus-treat-hide-headers nil)
9309 (gnus-treat-hide-boring-headers nil))
9310 (gnus-delete-wash-type 'headers)
9311 (gnus-treat-article 'head))
9312 (gnus-treat-article 'head))
9315 (set-window-start window (goto-char (point-min))))
9316 (if gnus-break-pages
9317 (gnus-narrow-to-page)
9318 (when (gnus-visual-p 'page-marker)
9319 (let ((buffer-read-only nil))
9320 (gnus-remove-text-with-property 'gnus-prev)
9321 (gnus-remove-text-with-property 'gnus-next))))
9322 (gnus-set-mode-line 'article)))))
9324 (defun gnus-summary-show-all-headers ()
9325 "Make all header lines visible."
9327 (gnus-summary-toggle-header 1))
9329 (defun gnus-summary-caesar-message (&optional arg)
9330 "Caesar rotate the current article by 13.
9331 With a non-numerical prefix, also rotate headers. A numerical
9332 prefix specifies how many places to rotate each letter forward."
9334 (gnus-summary-select-article)
9335 (let ((mail-header-separator ""))
9336 (gnus-eval-in-buffer-window gnus-article-buffer
9339 (let ((start (window-start))
9341 (if (equal arg '(4))
9342 (message-caesar-buffer-body nil t)
9343 (message-caesar-buffer-body arg))
9344 (set-window-start (get-buffer-window (current-buffer)) start)))))
9345 ;; Create buttons and stuff...
9346 (gnus-treat-article nil))
9348 (defun gnus-summary-idna-message (&optional arg)
9349 "Decode IDNA encoded domain names in the current articles.
9350 IDNA encoded domain names looks like `xn--bar'. If a string
9351 remain unencoded after running this function, it is likely an
9352 invalid IDNA string (`xn--bar' is invalid).
9354 You must have GNU Libidn (`http://www.gnu.org/software/libidn/')
9355 installed for this command to work."
9357 (if (not (and (condition-case nil (require 'idna)
9359 (mm-coding-system-p 'utf-8)
9360 (executable-find (symbol-value 'idna-program))))
9362 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9363 (gnus-summary-select-article)
9364 (let ((mail-header-separator ""))
9365 (gnus-eval-in-buffer-window gnus-article-buffer
9368 (let ((start (window-start))
9370 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9371 (replace-match (idna-to-unicode (match-string 1))))
9372 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9374 (defun gnus-summary-morse-message (&optional arg)
9375 "Morse decode the current article."
9377 (gnus-summary-select-article)
9378 (let ((mail-header-separator ""))
9379 (gnus-eval-in-buffer-window gnus-article-buffer
9383 (let ((pos (window-start))
9385 (goto-char (point-min))
9386 (when (message-goto-body)
9387 (gnus-narrow-to-body))
9388 (goto-char (point-min))
9389 (while (search-forward "·" (point-max) t)
9390 (replace-match "."))
9391 (unmorse-region (point-min) (point-max))
9393 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9395 (defun gnus-summary-stop-page-breaking ()
9396 "Stop page breaking in the current article."
9398 (gnus-summary-select-article)
9399 (gnus-eval-in-buffer-window gnus-article-buffer
9401 (when (gnus-visual-p 'page-marker)
9402 (let ((buffer-read-only nil))
9403 (gnus-remove-text-with-property 'gnus-prev)
9404 (gnus-remove-text-with-property 'gnus-next))
9405 (setq gnus-page-broken nil))))
9407 (defun gnus-summary-move-article (&optional n to-newsgroup
9408 select-method action)
9409 "Move the current article to a different newsgroup.
9410 If N is a positive number, move the N next articles.
9411 If N is a negative number, move the N previous articles.
9412 If N is nil and any articles have been marked with the process mark,
9413 move those articles instead.
9414 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9415 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9416 re-spool using this method.
9418 When called interactively with TO-NEWSGROUP being nil, the value of
9419 the variable `gnus-move-split-methods' is used for finding a default
9420 for the target newsgroup.
9422 For this function to work, both the current newsgroup and the
9423 newsgroup that you want to move to have to support the `request-move'
9424 and `request-accept' functions.
9426 ACTION can be either `move' (the default), `crosspost' or `copy'."
9429 (setq action 'move))
9430 ;; Check whether the source group supports the required functions.
9431 (cond ((and (eq action 'move)
9432 (not (gnus-check-backend-function
9433 'request-move-article gnus-newsgroup-name)))
9434 (error "The current group does not support article moving"))
9435 ((and (eq action 'crosspost)
9436 (not (gnus-check-backend-function
9437 'request-replace-article gnus-newsgroup-name)))
9438 (error "The current group does not support article editing")))
9439 (let ((articles (gnus-summary-work-articles n))
9440 (prefix (if (gnus-check-backend-function
9441 'request-move-article gnus-newsgroup-name)
9442 (funcall gnus-move-group-prefix-function
9443 gnus-newsgroup-name)
9445 (names '((move "Move" "Moving")
9446 (copy "Copy" "Copying")
9447 (crosspost "Crosspost" "Crossposting")))
9448 (copy-buf (save-excursion
9449 (nnheader-set-temp-buffer " *copy article*")))
9450 art-group to-method new-xref article to-groups articles-to-update-marks)
9451 (unless (assq action names)
9452 (error "Unknown action %s" action))
9453 ;; Read the newsgroup name.
9454 (when (and (not to-newsgroup)
9455 (not select-method))
9456 (if (and gnus-move-split-methods
9458 (and (memq gnus-current-article articles)
9459 (gnus-buffer-live-p gnus-original-article-buffer))))
9460 ;; When `gnus-move-split-methods' is non-nil, we have to
9461 ;; select an article to give `gnus-read-move-group-name' an
9462 ;; opportunity to suggest an appropriate default. However,
9463 ;; we needn't render or mark the article.
9464 (let ((gnus-display-mime-function nil)
9465 (gnus-article-prepare-hook nil)
9466 (gnus-mark-article-hook nil))
9467 (gnus-summary-select-article nil nil nil (car articles))))
9469 (gnus-read-move-group-name
9470 (cadr (assq action names))
9471 (symbol-value (intern (format "gnus-current-%s-group" action)))
9473 (set (intern (format "gnus-current-%s-group" action)) to-newsgroup))
9474 (setq to-method (or select-method
9475 (gnus-server-to-method
9476 (gnus-group-method to-newsgroup))))
9477 ;; Check the method we are to move this article to...
9478 (unless (gnus-check-backend-function
9479 'request-accept-article (car to-method))
9480 (error "%s does not support article copying" (car to-method)))
9481 (unless (gnus-check-server to-method)
9482 (error "Can't open server %s" (car to-method)))
9483 (gnus-message 6 "%s to %s: %s..."
9484 (caddr (assq action names))
9485 (or (car select-method) to-newsgroup) articles)
9487 (setq article (pop articles))
9491 ;; Move the article.
9493 ;; Remove this article from future suppression.
9494 (gnus-dup-unsuppress-article article)
9495 (let* ((from-method (gnus-find-method-for-group
9496 gnus-newsgroup-name))
9497 (to-method (gnus-find-method-for-group
9499 (move-is-internal (gnus-method-equal from-method to-method)))
9500 (gnus-request-move-article
9501 article ; Article to move
9502 gnus-newsgroup-name ; From newsgroup
9503 (nth 1 (gnus-find-method-for-group
9504 gnus-newsgroup-name)) ; Server
9505 (list 'gnus-request-accept-article
9506 to-newsgroup (list 'quote select-method)
9507 (not articles) t) ; Accept form
9508 (not articles) ; Only save nov last time
9509 move-is-internal))) ; is this move internal?
9510 ;; Copy the article.
9513 (set-buffer copy-buf)
9514 (when (gnus-request-article-this-buffer article gnus-newsgroup-name)
9516 (nnheader-narrow-to-headers)
9517 (dolist (hdr gnus-copy-article-ignored-headers)
9518 (message-remove-header hdr t)))
9519 (gnus-request-accept-article
9520 to-newsgroup select-method (not articles) t))))
9521 ;; Crosspost the article.
9522 ((eq action 'crosspost)
9523 (let ((xref (message-tokenize-header
9524 (mail-header-xref (gnus-summary-article-header article))
9526 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9527 ":" (number-to-string article)))
9529 (setq xref (list (system-name))))
9532 (mapconcat 'identity
9533 (delete "Xref:" (delete new-xref xref))
9537 (set-buffer copy-buf)
9538 ;; First put the article in the destination group.
9539 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9540 (when (consp (setq art-group
9541 (gnus-request-accept-article
9542 to-newsgroup select-method (not articles) t)))
9543 (setq new-xref (concat new-xref " " (car art-group)
9545 (number-to-string (cdr art-group))))
9546 ;; Now we have the new Xrefs header, so we insert
9547 ;; it and replace the new article.
9548 (nnheader-replace-header "Xref" new-xref)
9549 (gnus-request-replace-article
9550 (cdr art-group) to-newsgroup (current-buffer) t)
9554 (gnus-message 1 "Couldn't %s article %s: %s"
9555 (cadr (assq action names)) article
9556 (nnheader-get-report (car to-method))))
9557 ((eq art-group 'junk)
9558 (when (eq action 'move)
9559 (gnus-summary-mark-article article gnus-canceled-mark)
9560 (gnus-message 4 "Deleted article %s" article)
9561 ;; run the delete hook
9562 (run-hook-with-args 'gnus-summary-article-delete-hook
9565 (assoc article (gnus-data-list nil)))
9566 gnus-newsgroup-name nil
9569 (let* ((pto-group (gnus-group-prefixed-name
9570 (car art-group) to-method))
9571 (info (gnus-get-info pto-group))
9572 (to-group (gnus-info-group info))
9574 ;; Update the group that has been moved to.
9576 (memq action '(move copy)))
9577 (unless (member to-group to-groups)
9578 (push to-group to-groups))
9580 (unless (memq article gnus-newsgroup-unreads)
9581 (push 'read to-marks)
9583 info (gnus-add-to-range (gnus-info-read info)
9584 (list (cdr art-group)))))
9586 ;; See whether the article is to be put in the cache.
9587 (let ((marks (if (gnus-group-auto-expirable-p to-group)
9588 gnus-article-mark-lists
9589 (delete '(expirable . expire)
9590 (copy-sequence gnus-article-mark-lists))))
9591 (to-article (cdr art-group)))
9593 ;; Enter the article into the cache in the new group,
9594 ;; if that is required.
9595 (when gnus-use-cache
9596 (gnus-cache-possibly-enter-article
9598 (memq article gnus-newsgroup-marked)
9599 (memq article gnus-newsgroup-dormant)
9600 (memq article gnus-newsgroup-unreads)))
9602 (when gnus-preserve-marks
9603 ;; Copy any marks over to the new group.
9604 (when (and (equal to-group gnus-newsgroup-name)
9605 (not (memq article gnus-newsgroup-unreads)))
9606 ;; Mark this article as read in this group.
9607 (push (cons to-article gnus-read-mark) gnus-newsgroup-reads)
9608 (setcdr (gnus-active to-group) to-article)
9609 (setcdr gnus-newsgroup-active to-article))
9612 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
9613 (when (memq article (symbol-value
9614 (intern (format "gnus-newsgroup-%s"
9616 (push (cdar marks) to-marks)
9617 ;; If the other group is the same as this group,
9618 ;; then we have to add the mark to the list.
9619 (when (equal to-group gnus-newsgroup-name)
9620 (set (intern (format "gnus-newsgroup-%s" (caar marks)))
9623 (intern (format "gnus-newsgroup-%s"
9625 ;; Copy the marks to other group.
9626 (gnus-add-marked-articles
9627 to-group (cdar marks) (list to-article) info)))
9628 (setq marks (cdr marks)))
9630 (gnus-request-set-mark
9631 to-group (list (list (list to-article) 'add to-marks))))
9634 (concat "(gnus-group-set-info '"
9635 (gnus-prin1-to-string (gnus-get-info to-group))
9638 ;; Update the Xref header in this article to point to
9639 ;; the new crossposted article we have just created.
9640 (when (eq action 'crosspost)
9642 (set-buffer copy-buf)
9643 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9644 (nnheader-replace-header "Xref" new-xref)
9645 (gnus-request-replace-article
9646 article gnus-newsgroup-name (current-buffer) t)))
9648 ;; run the move/copy/crosspost/respool hook
9649 (run-hook-with-args 'gnus-summary-article-move-hook
9652 (assoc article (gnus-data-list nil)))
9657 ;;;!!!Why is this necessary?
9658 (set-buffer gnus-summary-buffer)
9660 (gnus-summary-goto-subject article)
9661 (when (eq action 'move)
9662 (gnus-summary-mark-article article gnus-canceled-mark))))
9663 (push article articles-to-update-marks))
9665 (apply 'gnus-summary-remove-process-mark articles-to-update-marks)
9666 ;; Re-activate all groups that have been moved to.
9668 (set-buffer gnus-group-buffer)
9669 (let ((gnus-group-marked to-groups))
9670 (gnus-group-get-new-news-this-group nil t)))
9672 (gnus-kill-buffer copy-buf)
9673 (gnus-summary-position-point)
9674 (gnus-set-mode-line 'summary)))
9676 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9677 "Copy the current article to some other group.
9678 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9679 When called interactively, if TO-NEWSGROUP is nil, use the value of
9680 the variable `gnus-move-split-methods' for finding a default target
9682 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9683 re-spool using this method."
9685 (gnus-summary-move-article n to-newsgroup select-method 'copy))
9687 (defun gnus-summary-crosspost-article (&optional n)
9688 "Crosspost the current article to some other group."
9690 (gnus-summary-move-article n nil nil 'crosspost))
9692 (defcustom gnus-summary-respool-default-method nil
9693 "Default method type for respooling an article.
9694 If nil, use to the current newsgroup method."
9696 :group 'gnus-summary-mail)
9698 (defcustom gnus-summary-display-while-building nil
9699 "If non-nil, show and update the summary buffer as it's being built.
9700 If the value is t, update the buffer after every line is inserted. If
9701 the value is an integer (N), update the display every N lines."
9704 :type '(choice (const :tag "off" nil)
9706 (const :tag "frequently" t)))
9708 (defun gnus-summary-respool-article (&optional n method)
9709 "Respool the current article.
9710 The article will be squeezed through the mail spooling process again,
9711 which means that it will be put in some mail newsgroup or other
9712 depending on `nnmail-split-methods'.
9713 If N is a positive number, respool the N next articles.
9714 If N is a negative number, respool the N previous articles.
9715 If N is nil and any articles have been marked with the process mark,
9716 respool those articles instead.
9718 Respooling can be done both from mail groups and \"real\" newsgroups.
9719 In the former case, the articles in question will be moved from the
9720 current group into whatever groups they are destined to. In the
9721 latter case, they will be copied into the relevant groups."
9723 (list current-prefix-arg
9724 (let* ((methods (gnus-methods-using 'respool))
9726 (symbol-name (or gnus-summary-respool-default-method
9727 (car (gnus-find-method-for-group
9728 gnus-newsgroup-name)))))
9730 (gnus-completing-read-with-default
9731 methname "Backend to use when respooling"
9732 methods nil t nil 'gnus-mail-method-history))
9735 ((zerop (length (setq ms (gnus-servers-using-backend
9737 (list (intern method) ""))
9741 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
9742 (cdr (assoc (completing-read "Server name: " ms-alist nil t)
9745 (error "No method given for respooling"))
9746 (if (assoc (symbol-name
9747 (car (gnus-find-method-for-group gnus-newsgroup-name)))
9748 (gnus-methods-using 'respool))
9749 (gnus-summary-move-article n nil method)
9750 (gnus-summary-copy-article n nil method)))
9752 (defun gnus-summary-import-article (file &optional edit)
9753 "Import an arbitrary file into a mail newsgroup."
9754 (interactive "fImport file: \nP")
9755 (let ((group gnus-newsgroup-name)
9756 (now (current-time))
9757 atts lines group-art)
9758 (unless (gnus-check-backend-function 'request-accept-article group)
9759 (error "%s does not support article importing" group))
9760 (or (file-readable-p file)
9761 (not (file-regular-p file))
9762 (error "Can't read %s" file))
9764 (set-buffer (gnus-get-buffer-create " *import file*"))
9766 (nnheader-insert-file-contents file)
9767 (goto-char (point-min))
9768 (if (nnheader-article-p)
9770 (goto-char (point-min))
9771 (search-forward "\n\n" nil t)
9772 (narrow-to-region (point-min) (1- (point)))
9773 (goto-char (point-min))
9774 (unless (re-search-forward "^date:" nil t)
9775 (goto-char (point-max))
9776 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
9777 ;; This doesn't look like an article, so we fudge some headers.
9778 (setq atts (file-attributes file)
9779 lines (count-lines (point-min) (point-max)))
9780 (insert "From: " (read-string "From: ") "\n"
9781 "Subject: " (read-string "Subject: ") "\n"
9782 "Date: " (message-make-date (nth 5 atts)) "\n"
9783 "Message-ID: " (message-make-message-id) "\n"
9784 "Lines: " (int-to-string lines) "\n"
9785 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
9786 (setq group-art (gnus-request-accept-article group nil t))
9787 (kill-buffer (current-buffer)))
9788 (setq gnus-newsgroup-active (gnus-activate-group group))
9790 (gnus-summary-goto-article (cdr group-art) nil t)
9792 (gnus-summary-edit-article))))
9794 (defun gnus-summary-create-article ()
9795 "Create an article in a mail newsgroup."
9797 (let ((group gnus-newsgroup-name)
9798 (now (current-time))
9800 (unless (gnus-check-backend-function 'request-accept-article group)
9801 (error "%s does not support article importing" group))
9803 (set-buffer (gnus-get-buffer-create " *import file*"))
9805 (goto-char (point-min))
9806 ;; This doesn't look like an article, so we fudge some headers.
9807 (insert "From: " (read-string "From: ") "\n"
9808 "Subject: " (read-string "Subject: ") "\n"
9809 "Date: " (message-make-date now) "\n"
9810 "Message-ID: " (message-make-message-id) "\n")
9811 (setq group-art (gnus-request-accept-article group nil t))
9812 (kill-buffer (current-buffer)))
9813 (setq gnus-newsgroup-active (gnus-activate-group group))
9815 (gnus-summary-goto-article (cdr group-art) nil t)
9816 (gnus-summary-edit-article)))
9818 (defun gnus-summary-article-posted-p ()
9819 "Say whether the current (mail) article is available from news as well.
9820 This will be the case if the article has both been mailed and posted."
9822 (let ((id (mail-header-references (gnus-summary-article-header)))
9823 (gnus-override-method (car (gnus-refer-article-methods))))
9824 (if (gnus-request-head id "")
9825 (gnus-message 2 "The current message was found on %s"
9826 gnus-override-method)
9827 (gnus-message 2 "The current message couldn't be found on %s"
9828 gnus-override-method)
9831 (defun gnus-summary-expire-articles (&optional now)
9832 "Expire all articles that are marked as expirable in the current group."
9834 (when (and (not gnus-group-is-exiting-without-update-p)
9835 (gnus-check-backend-function
9836 'request-expire-articles gnus-newsgroup-name))
9837 ;; This backend supports expiry.
9838 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
9839 (expirable (if total
9841 ;; We need to update the info for
9842 ;; this group for `gnus-list-of-read-articles'
9843 ;; to give us the right answer.
9844 (gnus-run-hooks 'gnus-exit-group-hook)
9845 (gnus-summary-update-info)
9846 (gnus-list-of-read-articles gnus-newsgroup-name))
9847 (setq gnus-newsgroup-expirable
9848 (sort gnus-newsgroup-expirable '<))))
9849 (expiry-wait (if now 'immediate
9850 (gnus-group-find-parameter
9851 gnus-newsgroup-name 'expiry-wait)))
9852 (nnmail-expiry-target
9853 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
9854 nnmail-expiry-target))
9857 ;; There are expirable articles in this group, so we run them
9858 ;; through the expiry process.
9859 (gnus-message 6 "Expiring articles...")
9860 (unless (gnus-check-group gnus-newsgroup-name)
9861 (error "Can't open server for %s" gnus-newsgroup-name))
9862 ;; The list of articles that weren't expired is returned.
9865 (let ((nnmail-expiry-wait-function nil)
9866 (nnmail-expiry-wait expiry-wait))
9867 (setq es (gnus-request-expire-articles
9868 expirable gnus-newsgroup-name)))
9869 (setq es (gnus-request-expire-articles
9870 expirable gnus-newsgroup-name)))
9872 (setq gnus-newsgroup-expirable es))
9873 ;; We go through the old list of expirable, and mark all
9874 ;; really expired articles as nonexistent.
9875 (unless (eq es expirable) ;If nothing was expired, we don't mark.
9876 (let ((gnus-use-cache nil))
9877 (dolist (article expirable)
9878 (when (and (not (memq article es))
9879 (gnus-data-find article))
9880 (gnus-summary-mark-article article gnus-canceled-mark)
9881 (run-hook-with-args 'gnus-summary-article-expire-hook
9884 (assoc article (gnus-data-list nil)))
9888 (gnus-message 6 "Expiring articles...done")))))
9890 (defun gnus-summary-expire-articles-now ()
9891 "Expunge all expirable articles in the current group.
9892 This means that *all* articles that are marked as expirable will be
9893 deleted forever, right now."
9895 (or gnus-expert-user
9897 "Are you really, really sure you want to delete all expirable messages? ")
9899 (gnus-summary-expire-articles t))
9901 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
9902 (defun gnus-summary-delete-article (&optional n)
9903 "Delete the N next (mail) articles.
9904 This command actually deletes articles. This is not a marking
9905 command. The article will disappear forever from your life, never to
9908 If N is negative, delete backwards.
9909 If N is nil and articles have been marked with the process mark,
9910 delete these instead.
9912 If `gnus-novice-user' is non-nil you will be asked for
9913 confirmation before the articles are deleted."
9915 (unless (gnus-check-backend-function 'request-expire-articles
9916 gnus-newsgroup-name)
9917 (error "The current newsgroup does not support article deletion"))
9918 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
9919 (error "Couldn't open server"))
9920 ;; Compute the list of articles to delete.
9921 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
9922 (nnmail-expiry-target 'delete)
9924 (if (and gnus-novice-user
9925 (not (gnus-yes-or-no-p
9926 (format "Do you really want to delete %s forever? "
9927 (if (> (length articles) 1)
9928 (format "these %s articles" (length articles))
9931 ;; Delete the articles.
9932 (setq not-deleted (gnus-request-expire-articles
9933 articles gnus-newsgroup-name 'force))
9935 (gnus-summary-remove-process-mark (car articles))
9936 ;; The backend might not have been able to delete the article
9938 (unless (memq (car articles) not-deleted)
9939 (gnus-summary-mark-article (car articles) gnus-canceled-mark))
9940 (let* ((article (car articles))
9941 (ghead (gnus-data-header
9942 (assoc article (gnus-data-list nil)))))
9943 (run-hook-with-args 'gnus-summary-article-delete-hook
9944 'delete ghead gnus-newsgroup-name nil
9946 (setq articles (cdr articles)))
9948 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
9949 (gnus-summary-position-point)
9950 (gnus-set-mode-line 'summary)
9953 (defun gnus-summary-edit-article (&optional arg)
9954 "Edit the current article.
9955 This will have permanent effect only in mail groups.
9956 If ARG is nil, edit the decoded articles.
9957 If ARG is 1, edit the raw articles.
9958 If ARG is 2, edit the raw articles even in read-only groups.
9959 If ARG is 3, edit the articles with the current handles.
9960 Otherwise, allow editing of articles even in read-only
9963 (let (force raw current-handles)
9972 (setq current-handles
9973 (and (gnus-buffer-live-p gnus-article-buffer)
9974 (with-current-buffer gnus-article-buffer
9976 gnus-article-mime-handles
9977 (setq gnus-article-mime-handles nil))))))
9980 (when (and raw (not force)
9981 (member gnus-newsgroup-name '("nndraft:delayed"
9984 (error "Can't edit the raw article in group %s"
9985 gnus-newsgroup-name))
9987 (set-buffer gnus-summary-buffer)
9988 (let ((mail-parse-charset gnus-newsgroup-charset)
9989 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
9990 (gnus-set-global-variables)
9991 (when (and (not force)
9992 (gnus-group-read-only-p))
9993 (error "The current newsgroup does not support article editing"))
9994 (gnus-summary-show-article t)
9995 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
9996 (with-current-buffer gnus-article-buffer
9997 (mm-enable-multibyte)))
9998 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10000 (gnus-article-edit-article
10003 (let ((mbl mml-buffer-list))
10004 (setq mml-buffer-list nil)
10005 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10006 (mime-to-mml ,'current-handles))
10007 (let ((mbl1 mml-buffer-list))
10008 (setq mml-buffer-list mbl)
10009 (set (make-local-variable 'mml-buffer-list) mbl1))
10010 (gnus-make-local-hook 'kill-buffer-hook)
10011 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10012 `(lambda (no-highlight)
10013 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10014 (message-options message-options)
10015 (message-options-set-recipient)
10016 (mail-parse-ignored-charsets
10017 ',gnus-newsgroup-ignored-charsets))
10018 ,(if (not raw) '(progn
10020 (mml-destroy-buffers)
10021 (remove-hook 'kill-buffer-hook
10022 'mml-destroy-buffers t)
10023 (kill-local-variable 'mml-buffer-list)))
10024 (gnus-summary-edit-article-done
10025 ,(or (mail-header-references gnus-current-headers) "")
10026 ,(gnus-group-read-only-p)
10027 ,gnus-summary-buffer no-highlight))))))))
10029 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10031 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10033 "Make edits to the current article permanent."
10036 ;; The buffer restriction contains the entire article if it exists.
10037 (when (article-goto-body)
10038 (let ((lines (count-lines (point) (point-max)))
10039 (length (- (point-max) (point)))
10040 (case-fold-search t)
10041 (body (copy-marker (point))))
10042 (goto-char (point-min))
10043 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10044 (delete-region (match-beginning 1) (match-end 1))
10045 (insert (number-to-string length)))
10046 (goto-char (point-min))
10047 (when (re-search-forward
10048 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10049 (delete-region (match-beginning 1) (match-end 1))
10050 (insert (number-to-string length)))
10051 (goto-char (point-min))
10052 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10053 (delete-region (match-beginning 1) (match-end 1))
10054 (insert (number-to-string lines))))))
10055 ;; Replace the article.
10056 (let ((buf (current-buffer)))
10058 (insert-buffer-substring buf)
10060 (if (and (not read-only)
10061 (not (gnus-request-replace-article
10062 (cdr gnus-article-current) (car gnus-article-current)
10063 (current-buffer) t)))
10064 (error "Couldn't replace article")
10065 ;; Update the summary buffer.
10066 (if (and references
10067 (equal (message-tokenize-header references " ")
10068 (message-tokenize-header
10069 (or (message-fetch-field "references") "") " ")))
10070 ;; We only have to update this line.
10073 (message-narrow-to-head)
10074 (let ((head (buffer-substring-no-properties
10075 (point-min) (point-max)))
10078 (insert (format "211 %d Article retrieved.\n"
10079 (cdr gnus-article-current)))
10082 (let ((nntp-server-buffer (current-buffer)))
10083 (setq header (car (gnus-get-newsgroup-headers
10086 (set-buffer gnus-summary-buffer)
10087 (gnus-data-set-header
10088 (gnus-data-find (cdr gnus-article-current))
10090 (gnus-summary-update-article-line
10091 (cdr gnus-article-current) header)
10092 (if (gnus-summary-goto-subject
10093 (cdr gnus-article-current) nil t)
10094 (gnus-summary-update-secondary-mark
10095 (cdr gnus-article-current))))))))
10097 (set-buffer (or buffer gnus-summary-buffer))
10098 (gnus-summary-update-article (cdr gnus-article-current))
10099 (if (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
10100 (gnus-summary-update-secondary-mark
10101 (cdr gnus-article-current))))
10102 ;; Prettify the article buffer again.
10103 (unless no-highlight
10105 (set-buffer gnus-article-buffer)
10106 ;;;!!! Fix this -- article should be rehighlighted.
10107 ;;;(gnus-run-hooks 'gnus-article-display-hook)
10108 (set-buffer gnus-original-article-buffer)
10109 (gnus-request-article
10110 (cdr gnus-article-current)
10111 (car gnus-article-current) (current-buffer))))
10112 ;; Prettify the summary buffer line.
10113 (when (gnus-visual-p 'summary-highlight 'highlight)
10114 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10116 (defun gnus-summary-edit-wash (key)
10117 "Perform editing command KEY in the article buffer."
10121 (message "%s" (concat (this-command-keys) "- "))
10124 (gnus-summary-edit-article)
10125 (execute-kbd-macro (concat (this-command-keys) key))
10126 (gnus-article-edit-done))
10130 (defun gnus-summary-respool-query (&optional silent trace)
10131 "Query where the respool algorithm would put this article."
10133 (let (gnus-mark-article-hook)
10134 (gnus-summary-select-article)
10136 (set-buffer gnus-original-article-buffer)
10137 (let ((groups (nnmail-article-group 'identity trace)))
10140 (message "This message would go to %s"
10141 (mapconcat 'car groups ", "))
10142 (message "This message would go to no groups"))
10145 (defun gnus-summary-respool-trace ()
10146 "Trace where the respool algorithm would put this article.
10147 Display a buffer showing all fancy splitting patterns which matched."
10149 (gnus-summary-respool-query nil t))
10151 ;; Summary marking commands.
10153 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10154 "Mark articles which has the same subject as read, and then select the next.
10155 If UNMARK is positive, remove any kind of mark.
10156 If UNMARK is negative, tick articles."
10159 (setq unmark (prefix-numeric-value unmark)))
10161 (gnus-summary-mark-same-subject
10162 (gnus-summary-article-subject) unmark)))
10163 ;; Select next unread article. If auto-select-same mode, should
10164 ;; select the first unread article.
10165 (gnus-summary-next-article t (and gnus-auto-select-same
10166 (gnus-summary-article-subject)))
10167 (gnus-message 7 "%d article%s marked as %s"
10168 count (if (= count 1) " is" "s are")
10169 (if unmark "unread" "read"))))
10171 (defun gnus-summary-kill-same-subject (&optional unmark)
10172 "Mark articles which has the same subject as read.
10173 If UNMARK is positive, remove any kind of mark.
10174 If UNMARK is negative, tick articles."
10177 (setq unmark (prefix-numeric-value unmark)))
10179 (gnus-summary-mark-same-subject
10180 (gnus-summary-article-subject) unmark)))
10181 ;; If marked as read, go to next unread subject.
10182 (when (null unmark)
10183 ;; Go to next unread subject.
10184 (gnus-summary-next-subject 1 t))
10185 (gnus-message 7 "%d articles are marked as %s"
10186 count (if unmark "unread" "read"))))
10188 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10189 "Mark articles with same SUBJECT as read, and return marked number.
10190 If optional argument UNMARK is positive, remove any kinds of marks.
10191 If optional argument UNMARK is negative, mark articles as unread instead."
10195 ((null unmark) ; Mark as read.
10198 (gnus-summary-mark-article-as-read gnus-killed-mark)
10199 (gnus-summary-show-thread) t)
10200 (gnus-summary-find-subject subject))
10201 (setq count (1+ count))))
10202 ((> unmark 0) ; Tick.
10205 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10206 (gnus-summary-show-thread) t)
10207 (gnus-summary-find-subject subject))
10208 (setq count (1+ count))))
10209 (t ; Mark as unread.
10212 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10213 (gnus-summary-show-thread) t)
10214 (gnus-summary-find-subject subject))
10215 (setq count (1+ count)))))
10216 (gnus-set-mode-line 'summary)
10217 ;; Return the number of marked articles.
10220 (defun gnus-summary-mark-as-processable (n &optional unmark)
10221 "Set the process mark on the next N articles.
10222 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10223 the process mark instead. The difference between N and the actual
10224 number of articles marked is returned."
10226 (if (and (null n) (gnus-region-active-p))
10227 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10228 (setq n (prefix-numeric-value n))
10229 (let ((backward (< n 0))
10234 (gnus-summary-remove-process-mark
10235 (gnus-summary-article-number))
10236 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10237 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10240 (gnus-message 7 "No more articles"))
10241 (gnus-summary-recenter)
10242 (gnus-summary-position-point)
10245 (defun gnus-summary-unmark-as-processable (n)
10246 "Remove the process mark from the next N articles.
10247 If N is negative, unmark backward instead. The difference between N and
10248 the actual number of articles unmarked is returned."
10250 (gnus-summary-mark-as-processable n t))
10252 (defun gnus-summary-unmark-all-processable ()
10253 "Remove the process mark from all articles."
10256 (while gnus-newsgroup-processable
10257 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10258 (gnus-summary-position-point))
10260 (defun gnus-summary-add-mark (article type)
10261 "Mark ARTICLE with a mark of TYPE."
10262 (let ((vtype (car (assq type gnus-article-mark-lists)))
10265 (error "No such mark type: %s" type)
10266 (setq var (intern (format "gnus-newsgroup-%s" type)))
10267 (set var (cons article (symbol-value var)))
10268 (if (memq type '(processable cached replied forwarded recent saved))
10269 (gnus-summary-update-secondary-mark article)
10270 ;;; !!! This is bogus. We should find out what primary
10271 ;;; !!! mark we want to set.
10272 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10274 (defun gnus-summary-mark-as-expirable (n)
10275 "Mark N articles forward as expirable.
10276 If N is negative, mark backward instead. The difference between N and
10277 the actual number of articles marked is returned."
10279 (gnus-summary-mark-forward n gnus-expirable-mark))
10281 (defun gnus-summary-mark-as-spam (n)
10282 "Mark N articles forward as spam.
10283 If N is negative, mark backward instead. The difference between N and
10284 the actual number of articles marked is returned."
10286 (gnus-summary-mark-forward n gnus-spam-mark))
10288 (defun gnus-summary-mark-article-as-replied (article)
10289 "Mark ARTICLE as replied to and update the summary line.
10290 ARTICLE can also be a list of articles."
10291 (interactive (list (gnus-summary-article-number)))
10292 (let ((articles (if (listp article) article (list article))))
10293 (dolist (article articles)
10294 (unless (numberp article)
10295 (error "%s is not a number" article))
10296 (push article gnus-newsgroup-replied)
10297 (let ((buffer-read-only nil))
10298 (when (gnus-summary-goto-subject article nil t)
10299 (gnus-summary-update-secondary-mark article))))))
10301 (defun gnus-summary-mark-article-as-forwarded (article)
10302 "Mark ARTICLE as forwarded and update the summary line.
10303 ARTICLE can also be a list of articles."
10304 (let ((articles (if (listp article) article (list article))))
10305 (dolist (article articles)
10306 (push article gnus-newsgroup-forwarded)
10307 (let ((buffer-read-only nil))
10308 (when (gnus-summary-goto-subject article nil t)
10309 (gnus-summary-update-secondary-mark article))))))
10311 (defun gnus-summary-set-bookmark (article)
10312 "Set a bookmark in current article."
10313 (interactive (list (gnus-summary-article-number)))
10314 (when (or (not (get-buffer gnus-article-buffer))
10315 (not gnus-current-article)
10316 (not gnus-article-current)
10317 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10318 (error "No current article selected"))
10319 ;; Remove old bookmark, if one exists.
10320 (gnus-pull article gnus-newsgroup-bookmarks)
10321 ;; Set the new bookmark, which is on the form
10322 ;; (article-number . line-number-in-body).
10325 (with-current-buffer gnus-article-buffer
10329 (article-goto-body)
10332 gnus-newsgroup-bookmarks)
10333 (gnus-message 6 "A bookmark has been added to the current article."))
10335 (defun gnus-summary-remove-bookmark (article)
10336 "Remove the bookmark from the current article."
10337 (interactive (list (gnus-summary-article-number)))
10338 ;; Remove old bookmark, if one exists.
10339 (if (not (assq article gnus-newsgroup-bookmarks))
10340 (gnus-message 6 "No bookmark in current article.")
10341 (gnus-pull article gnus-newsgroup-bookmarks)
10342 (gnus-message 6 "Removed bookmark.")))
10344 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10345 (defun gnus-summary-mark-as-dormant (n)
10346 "Mark N articles forward as dormant.
10347 If N is negative, mark backward instead. The difference between N and
10348 the actual number of articles marked is returned."
10350 (gnus-summary-mark-forward n gnus-dormant-mark))
10352 (defun gnus-summary-set-process-mark (article)
10353 "Set the process mark on ARTICLE and update the summary line."
10354 (setq gnus-newsgroup-processable
10356 (delq article gnus-newsgroup-processable)))
10357 (when (gnus-summary-goto-subject article)
10358 (gnus-summary-show-thread)
10359 (gnus-summary-goto-subject article)
10360 (gnus-summary-update-secondary-mark article)))
10362 (defun gnus-summary-remove-process-mark (&rest articles)
10363 "Remove the process mark from ARTICLES and update the summary line."
10364 (dolist (article articles)
10365 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10366 (when (gnus-summary-goto-subject article)
10367 (gnus-summary-show-thread)
10368 (gnus-summary-goto-subject article)
10369 (gnus-summary-update-secondary-mark article)))
10372 (defun gnus-summary-set-saved-mark (article)
10373 "Set the process mark on ARTICLE and update the summary line."
10374 (push article gnus-newsgroup-saved)
10375 (when (gnus-summary-goto-subject article)
10376 (gnus-summary-update-secondary-mark article)))
10378 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10379 "Mark N articles as read forwards.
10380 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10381 The difference between N and the actual number of articles marked is
10383 If NO-EXPIRE, auto-expiry will be inhibited."
10385 (gnus-summary-show-thread)
10386 (let ((backward (< n 0))
10387 (gnus-summary-goto-unread
10388 (and gnus-summary-goto-unread
10389 (not (eq gnus-summary-goto-unread 'never))
10390 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10391 gnus-ticked-mark gnus-dormant-mark)))))
10393 (mark (or mark gnus-del-mark)))
10394 (while (and (> n 0)
10395 (gnus-summary-mark-article nil mark no-expire)
10396 (zerop (gnus-summary-next-subject
10398 (and gnus-summary-goto-unread
10399 (not (eq gnus-summary-goto-unread 'never)))
10403 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10404 (gnus-summary-recenter)
10405 (gnus-summary-position-point)
10406 (gnus-set-mode-line 'summary)
10409 (defun gnus-summary-mark-article-as-read (mark)
10410 "Mark the current article quickly as read with MARK."
10411 (let ((article (gnus-summary-article-number)))
10412 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10413 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10414 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10415 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10416 (push (cons article mark) gnus-newsgroup-reads)
10417 ;; Possibly remove from cache, if that is used.
10418 (when gnus-use-cache
10419 (gnus-cache-enter-remove-article article))
10420 ;; Allow the backend to change the mark.
10421 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10422 ;; Check for auto-expiry.
10423 (when (and gnus-newsgroup-auto-expire
10424 (memq mark gnus-auto-expirable-marks))
10425 (setq mark gnus-expirable-mark)
10426 ;; Let the backend know about the mark change.
10427 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10428 (push article gnus-newsgroup-expirable))
10429 ;; Set the mark in the buffer.
10430 (gnus-summary-update-mark mark 'unread)
10433 (defun gnus-summary-mark-article-as-unread (mark)
10434 "Mark the current article quickly as unread with MARK."
10435 (let* ((article (gnus-summary-article-number))
10436 (old-mark (gnus-summary-article-mark article)))
10437 ;; Allow the backend to change the mark.
10438 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10439 (if (eq mark old-mark)
10443 (gnus-error 1 "Can't mark negative article numbers")
10445 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10446 (setq gnus-newsgroup-spam-marked
10447 (delq article gnus-newsgroup-spam-marked))
10448 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10449 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10450 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10451 (cond ((= mark gnus-ticked-mark)
10452 (setq gnus-newsgroup-marked
10453 (gnus-add-to-sorted-list gnus-newsgroup-marked
10455 ((= mark gnus-spam-mark)
10456 (setq gnus-newsgroup-spam-marked
10457 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10459 ((= mark gnus-dormant-mark)
10460 (setq gnus-newsgroup-dormant
10461 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10464 (setq gnus-newsgroup-unreads
10465 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10467 (gnus-pull article gnus-newsgroup-reads)
10469 ;; See whether the article is to be put in the cache.
10470 (and gnus-use-cache
10471 (vectorp (gnus-summary-article-header article))
10473 (gnus-cache-possibly-enter-article
10474 gnus-newsgroup-name article
10475 (= mark gnus-ticked-mark)
10476 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10479 (gnus-summary-update-mark mark 'unread)
10482 (defun gnus-summary-mark-article (&optional article mark no-expire)
10483 "Mark ARTICLE with MARK. MARK can be any character.
10484 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10485 `??' (dormant) and `?E' (expirable).
10486 If MARK is nil, then the default character `?r' is used.
10487 If ARTICLE is nil, then the article on the current line will be
10489 If NO-EXPIRE, auto-expiry will be inhibited."
10490 ;; The mark might be a string.
10491 (when (stringp mark)
10492 (setq mark (aref mark 0)))
10493 ;; If no mark is given, then we check auto-expiring.
10495 (setq mark gnus-del-mark))
10496 (when (and (not no-expire)
10497 gnus-newsgroup-auto-expire
10498 (memq mark gnus-auto-expirable-marks))
10499 (setq mark gnus-expirable-mark))
10500 (let ((article (or article (gnus-summary-article-number)))
10501 (old-mark (gnus-summary-article-mark article)))
10502 ;; Allow the backend to change the mark.
10503 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10504 (if (eq mark old-mark)
10507 (error "No article on current line"))
10508 (if (not (if (or (= mark gnus-unread-mark)
10509 (= mark gnus-ticked-mark)
10510 (= mark gnus-spam-mark)
10511 (= mark gnus-dormant-mark))
10512 (gnus-mark-article-as-unread article mark)
10513 (gnus-mark-article-as-read article mark)))
10515 ;; See whether the article is to be put in the cache.
10516 (and gnus-use-cache
10517 (not (= mark gnus-canceled-mark))
10518 (vectorp (gnus-summary-article-header article))
10520 (gnus-cache-possibly-enter-article
10521 gnus-newsgroup-name article
10522 (= mark gnus-ticked-mark)
10523 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10525 (when (gnus-summary-goto-subject article nil t)
10526 (let ((buffer-read-only nil))
10527 (gnus-summary-show-thread)
10529 (gnus-summary-update-mark mark 'unread)
10532 (defun gnus-summary-update-secondary-mark (article)
10533 "Update the secondary (read, process, cache) mark."
10534 (gnus-summary-update-mark
10535 (cond ((memq article gnus-newsgroup-processable)
10537 ((memq article gnus-newsgroup-cached)
10539 ((memq article gnus-newsgroup-replied)
10541 ((memq article gnus-newsgroup-forwarded)
10542 gnus-forwarded-mark)
10543 ((memq article gnus-newsgroup-saved)
10545 ((memq article gnus-newsgroup-recent)
10547 ((memq article gnus-newsgroup-unseen)
10551 (when (gnus-visual-p 'summary-highlight 'highlight)
10552 (gnus-run-hooks 'gnus-summary-update-hook))
10555 (defun gnus-summary-update-download-mark (article)
10556 "Update the download mark."
10557 (gnus-summary-update-mark
10558 (cond ((memq article gnus-newsgroup-undownloaded)
10559 gnus-undownloaded-mark)
10560 (gnus-newsgroup-agentized
10561 gnus-downloaded-mark)
10565 (gnus-summary-update-line t)
10568 (defun gnus-summary-update-mark (mark type)
10569 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
10570 (buffer-read-only nil))
10571 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
10573 (when (looking-at "\r")
10575 (when (<= (+ forward (point)) (point-max))
10576 ;; Go to the right position on the line.
10577 (goto-char (+ forward (point)))
10578 ;; Replace the old mark with the new mark.
10579 (subst-char-in-region (point) (1+ (point)) (char-after) mark)
10580 ;; Optionally update the marks by some user rule.
10581 (when (eq type 'unread)
10582 (gnus-data-set-mark
10583 (gnus-data-find (gnus-summary-article-number)) mark)
10584 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
10586 (defun gnus-mark-article-as-read (article &optional mark)
10587 "Enter ARTICLE in the pertinent lists and remove it from others."
10588 ;; Make the article expirable.
10589 (let ((mark (or mark gnus-del-mark)))
10590 (setq gnus-newsgroup-expirable
10591 (if (= mark gnus-expirable-mark)
10592 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
10593 (delq article gnus-newsgroup-expirable)))
10594 ;; Remove from unread and marked lists.
10595 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10596 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10597 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10598 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10599 (push (cons article mark) gnus-newsgroup-reads)
10600 ;; Possibly remove from cache, if that is used.
10601 (when gnus-use-cache
10602 (gnus-cache-enter-remove-article article))
10605 (defun gnus-mark-article-as-unread (article &optional mark)
10606 "Enter ARTICLE in the pertinent lists and remove it from others."
10607 (let ((mark (or mark gnus-ticked-mark)))
10610 (gnus-error 1 "Can't mark negative article numbers")
10612 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
10613 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
10614 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
10615 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
10616 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10618 ;; Unsuppress duplicates?
10619 (when gnus-suppress-duplicates
10620 (gnus-dup-unsuppress-article article))
10622 (cond ((= mark gnus-ticked-mark)
10623 (setq gnus-newsgroup-marked
10624 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
10625 ((= mark gnus-spam-mark)
10626 (setq gnus-newsgroup-spam-marked
10627 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10629 ((= mark gnus-dormant-mark)
10630 (setq gnus-newsgroup-dormant
10631 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
10633 (setq gnus-newsgroup-unreads
10634 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
10635 (gnus-pull article gnus-newsgroup-reads)
10638 (defalias 'gnus-summary-mark-as-unread-forward
10639 'gnus-summary-tick-article-forward)
10640 (make-obsolete 'gnus-summary-mark-as-unread-forward
10641 'gnus-summary-tick-article-forward)
10642 (defun gnus-summary-tick-article-forward (n)
10643 "Tick N articles forwards.
10644 If N is negative, tick backwards instead.
10645 The difference between N and the number of articles ticked is returned."
10647 (gnus-summary-mark-forward n gnus-ticked-mark))
10649 (defalias 'gnus-summary-mark-as-unread-backward
10650 'gnus-summary-tick-article-backward)
10651 (make-obsolete 'gnus-summary-mark-as-unread-backward
10652 'gnus-summary-tick-article-backward)
10653 (defun gnus-summary-tick-article-backward (n)
10654 "Tick N articles backwards.
10655 The difference between N and the number of articles ticked is returned."
10657 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
10659 (defalias 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10660 (make-obsolete 'gnus-summary-mark-as-unread 'gnus-summary-tick-article)
10661 (defun gnus-summary-tick-article (&optional article clear-mark)
10662 "Mark current article as unread.
10663 Optional 1st argument ARTICLE specifies article number to be marked as unread.
10664 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
10666 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
10667 gnus-ticked-mark)))
10669 (defun gnus-summary-mark-as-read-forward (n)
10670 "Mark N articles as read forwards.
10671 If N is negative, mark backwards instead.
10672 The difference between N and the actual number of articles marked is
10675 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
10677 (defun gnus-summary-mark-as-read-backward (n)
10678 "Mark the N articles as read backwards.
10679 The difference between N and the actual number of articles marked is
10682 (gnus-summary-mark-forward
10683 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
10685 (defun gnus-summary-mark-as-read (&optional article mark)
10686 "Mark current article as read.
10687 ARTICLE specifies the article to be marked as read.
10688 MARK specifies a string to be inserted at the beginning of the line."
10689 (gnus-summary-mark-article article mark))
10691 (defun gnus-summary-clear-mark-forward (n)
10692 "Clear marks from N articles forward.
10693 If N is negative, clear backward instead.
10694 The difference between N and the number of marks cleared is returned."
10696 (gnus-summary-mark-forward n gnus-unread-mark))
10698 (defun gnus-summary-clear-mark-backward (n)
10699 "Clear marks from N articles backward.
10700 The difference between N and the number of marks cleared is returned."
10702 (gnus-summary-mark-forward (- n) gnus-unread-mark))
10704 (defun gnus-summary-mark-unread-as-read ()
10705 "Intended to be used by `gnus-summary-mark-article-hook'."
10706 (when (memq gnus-current-article gnus-newsgroup-unreads)
10707 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
10709 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
10710 "Intended to be used by `gnus-summary-mark-article-hook'."
10711 (let ((mark (gnus-summary-article-mark)))
10712 (when (or (gnus-unread-mark-p mark)
10713 (gnus-read-mark-p mark))
10714 (gnus-summary-mark-article gnus-current-article
10715 (or new-mark gnus-read-mark)))))
10717 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
10718 "Intended to be used by `gnus-summary-mark-article-hook'."
10719 (let ((mark (gnus-summary-article-mark)))
10720 (when (or (gnus-unread-mark-p mark)
10721 (gnus-read-mark-p mark))
10722 (gnus-summary-mark-article (gnus-summary-article-number)
10723 (or new-mark gnus-read-mark)))))
10725 (defun gnus-summary-mark-unread-as-ticked ()
10726 "Intended to be used by `gnus-summary-mark-article-hook'."
10727 (when (memq gnus-current-article gnus-newsgroup-unreads)
10728 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
10730 (defun gnus-summary-mark-region-as-read (point mark all)
10731 "Mark all unread articles between point and mark as read.
10732 If given a prefix, mark all articles between point and mark as read,
10733 even ticked and dormant ones."
10734 (interactive "r\nP")
10738 (beginning-of-line)
10743 (memq (setq article (gnus-summary-article-number))
10744 gnus-newsgroup-unreads))
10745 (gnus-summary-mark-article article gnus-del-mark))
10747 (gnus-summary-find-next))))))
10749 (defun gnus-summary-mark-below (score mark)
10750 "Mark articles with score less than SCORE with MARK."
10751 (interactive "P\ncMark: ")
10752 (setq score (if score
10753 (prefix-numeric-value score)
10754 (or gnus-summary-default-score 0)))
10756 (set-buffer gnus-summary-buffer)
10757 (goto-char (point-min))
10760 (and (< (gnus-summary-article-score) score)
10761 (gnus-summary-mark-article nil mark))
10762 (gnus-summary-find-next)))))
10764 (defun gnus-summary-kill-below (&optional score)
10765 "Mark articles with score below SCORE as read."
10767 (gnus-summary-mark-below score gnus-killed-mark))
10769 (defun gnus-summary-clear-above (&optional score)
10770 "Clear all marks from articles with score above SCORE."
10772 (gnus-summary-mark-above score gnus-unread-mark))
10774 (defun gnus-summary-tick-above (&optional score)
10775 "Tick all articles with score above SCORE."
10777 (gnus-summary-mark-above score gnus-ticked-mark))
10779 (defun gnus-summary-mark-above (score mark)
10780 "Mark articles with score over SCORE with MARK."
10781 (interactive "P\ncMark: ")
10782 (setq score (if score
10783 (prefix-numeric-value score)
10784 (or gnus-summary-default-score 0)))
10786 (set-buffer gnus-summary-buffer)
10787 (goto-char (point-min))
10789 (when (> (gnus-summary-article-score) score)
10790 (gnus-summary-mark-article nil mark))
10792 (gnus-summary-find-next)))))
10794 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10795 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
10796 (defun gnus-summary-limit-include-expunged (&optional no-error)
10797 "Display all the hidden articles that were expunged for low scores."
10799 (let ((buffer-read-only nil))
10800 (let ((scored gnus-newsgroup-scored)
10803 (unless (gnus-summary-article-header (caar scored))
10804 (and (setq h (gnus-number-to-header (caar scored)))
10805 (< (cdar scored) gnus-summary-expunge-below)
10807 (setq scored (cdr scored)))
10809 (when (not no-error)
10810 (error "No expunged articles hidden"))
10811 (goto-char (point-min))
10812 (push gnus-newsgroup-limit gnus-newsgroup-limits)
10813 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
10814 (mapcar (lambda (x) (push (mail-header-number x)
10815 gnus-newsgroup-limit))
10817 (gnus-summary-prepare-unthreaded (nreverse headers))
10818 (goto-char (point-min))
10819 (gnus-summary-position-point)
10822 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
10823 "Mark all unread articles in this newsgroup as read.
10824 If prefix argument ALL is non-nil, ticked and dormant articles will
10825 also be marked as read.
10826 If QUIETLY is non-nil, no questions will be asked.
10828 If TO-HERE is non-nil, it should be a point in the buffer. All
10829 articles before (after, if REVERSE is set) this point will be marked
10832 Note that this function will only catch up the unread article
10833 in the current summary buffer limitation.
10835 The number of articles marked as read is returned."
10840 (not gnus-interactive-catchup) ;Without confirmation?
10844 "Mark absolutely all articles as read? "
10845 "Mark all unread articles as read? ")))
10847 (not gnus-newsgroup-adaptive)
10848 (not gnus-newsgroup-auto-expire)
10849 (not gnus-suppress-duplicates)
10850 (or (not gnus-use-cache)
10851 (eq gnus-use-cache 'passive)))
10854 (setq gnus-newsgroup-marked nil
10855 gnus-newsgroup-spam-marked nil
10856 gnus-newsgroup-dormant nil))
10857 (setq gnus-newsgroup-unreads
10858 (gnus-sorted-nunion
10859 (gnus-sorted-intersection gnus-newsgroup-unreads
10860 gnus-newsgroup-downloadable)
10861 gnus-newsgroup-unfetched)))
10862 ;; We actually mark all articles as canceled, which we
10863 ;; have to do when using auto-expiry or adaptive scoring.
10864 (gnus-summary-show-all-threads)
10865 (if (and to-here reverse)
10867 (goto-char to-here)
10868 (gnus-summary-mark-current-read-and-unread-as-read
10870 (while (gnus-summary-find-next (not all))
10871 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
10872 (when (gnus-summary-first-subject (not all))
10874 (if to-here (< (point) to-here) t)
10875 (gnus-summary-mark-article-as-read gnus-catchup-mark)
10876 (gnus-summary-find-next (not all))))))
10877 (gnus-set-mode-line 'summary))
10879 (gnus-summary-position-point)))
10881 (defun gnus-summary-catchup-to-here (&optional all)
10882 "Mark all unticked articles before the current one as read.
10883 If ALL is non-nil, also mark ticked and dormant articles as read."
10886 (gnus-save-hidden-threads
10887 (let ((beg (point)))
10888 ;; We check that there are unread articles.
10889 (when (or all (gnus-summary-find-prev))
10890 (gnus-summary-catchup all t beg)))))
10891 (gnus-summary-position-point))
10893 (defun gnus-summary-catchup-from-here (&optional all)
10894 "Mark all unticked articles after (and including) the current one as read.
10895 If ALL is non-nil, also mark ticked and dormant articles as read."
10898 (gnus-save-hidden-threads
10899 (let ((beg (point)))
10900 ;; We check that there are unread articles.
10901 (when (or all (gnus-summary-find-next))
10902 (gnus-summary-catchup all t beg nil t)))))
10903 (gnus-summary-position-point))
10905 (defun gnus-summary-catchup-all (&optional quietly)
10906 "Mark all articles in this newsgroup as read.
10907 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
10908 instead, which marks only unread articles as read."
10910 (gnus-summary-catchup t quietly))
10912 (defun gnus-summary-catchup-and-exit (&optional all quietly)
10913 "Mark all unread articles in this group as read, then exit.
10914 If prefix argument ALL is non-nil, all articles are marked as read.
10915 If QUIETLY is non-nil, no questions will be asked."
10917 (when (gnus-summary-catchup all quietly nil 'fast)
10918 ;; Select next newsgroup or exit.
10919 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
10920 (eq gnus-auto-select-next 'quietly))
10921 (gnus-summary-next-group nil)
10922 (gnus-summary-exit))))
10924 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
10925 "Mark all articles in this newsgroup as read, and then exit.
10926 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
10927 instead, which marks only unread articles as read."
10929 (gnus-summary-catchup-and-exit t quietly))
10931 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
10932 "Mark all articles in this group as read and select the next group.
10933 If given a prefix, mark all articles, unread as well as ticked, as
10937 (gnus-summary-catchup all))
10938 (gnus-summary-next-group))
10940 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
10941 "Mark all articles in this group as read and select the previous group.
10942 If given a prefix, mark all articles, unread as well as ticked, as
10946 (gnus-summary-catchup all))
10947 (gnus-summary-next-group nil nil t))
10953 (defmacro gnus-with-article (article &rest forms)
10954 "Select ARTICLE and perform FORMS in the original article buffer.
10955 Then replace the article with the result."
10957 ;; We don't want the article to be marked as read.
10958 (let (gnus-mark-article-hook)
10959 (gnus-summary-select-article t t nil ,article))
10960 (set-buffer gnus-original-article-buffer)
10962 (if (not (gnus-check-backend-function
10963 'request-replace-article (car gnus-article-current)))
10964 (gnus-message 5 "Read-only group; not replacing")
10965 (unless (gnus-request-replace-article
10966 ,article (car gnus-article-current)
10967 (current-buffer) t)
10968 (error "Couldn't replace article")))
10969 ;; The cache and backlog have to be flushed somewhat.
10970 (when gnus-keep-backlog
10971 (gnus-backlog-remove-article
10972 (car gnus-article-current) (cdr gnus-article-current)))
10973 (when gnus-use-cache
10974 (gnus-cache-update-article
10975 (car gnus-article-current) (cdr gnus-article-current)))))
10977 (put 'gnus-with-article 'lisp-indent-function 1)
10978 (put 'gnus-with-article 'edebug-form-spec '(form body))
10980 ;; Thread-based commands.
10982 (defun gnus-summary-articles-in-thread (&optional article)
10983 "Return a list of all articles in the current thread.
10984 If ARTICLE is non-nil, return all articles in the thread that starts
10985 with that article."
10986 (let* ((article (or article (gnus-summary-article-number)))
10987 (data (gnus-data-find-list article))
10988 (top-level (gnus-data-level (car data)))
10990 (cond ((null gnus-thread-operation-ignore-subject)
10991 (gnus-simplify-subject-re
10992 (mail-header-subject (gnus-data-header (car data)))))
10993 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
10994 (gnus-simplify-subject-fuzzy
10995 (mail-header-subject (gnus-data-header (car data)))))
10997 (end-point (save-excursion
10998 (if (gnus-summary-go-to-next-thread)
10999 (point) (point-max))))
11002 (< (gnus-data-pos (car data)) end-point))
11003 (when (or (not top-subject)
11004 (string= top-subject
11005 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11006 (gnus-simplify-subject-fuzzy
11007 (mail-header-subject
11008 (gnus-data-header (car data))))
11009 (gnus-simplify-subject-re
11010 (mail-header-subject
11011 (gnus-data-header (car data)))))))
11012 (push (gnus-data-number (car data)) articles))
11013 (unless (and (setq data (cdr data))
11014 (> (gnus-data-level (car data)) top-level))
11016 ;; Return the list of articles.
11017 (nreverse articles)))
11019 (defun gnus-summary-rethread-current ()
11020 "Rethread the thread the current article is part of."
11022 (let* ((gnus-show-threads t)
11023 (article (gnus-summary-article-number))
11024 (id (mail-header-id (gnus-summary-article-header)))
11025 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11027 (error "No article on the current line"))
11028 (gnus-rebuild-thread id)
11029 (gnus-summary-goto-subject article)))
11031 (defun gnus-summary-reparent-thread ()
11032 "Make the current article child of the marked (or previous) article.
11034 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11035 is non-nil or the Subject: of both articles are the same."
11037 (unless (not (gnus-group-read-only-p))
11038 (error "The current newsgroup does not support article editing"))
11039 (unless (<= (length gnus-newsgroup-processable) 1)
11040 (error "No more than one article may be marked"))
11041 (let ((child (gnus-summary-article-number))
11042 ;; First grab the marked article, otherwise one line up.
11043 (parent (if (not (null gnus-newsgroup-processable))
11044 (car gnus-newsgroup-processable)
11046 (if (eq (forward-line -1) 0)
11047 (gnus-summary-article-number)
11048 (error "Beginning of summary buffer"))))))
11049 (gnus-summary-reparent-children parent (list child))))
11051 (defun gnus-summary-reparent-children (parent children)
11052 "Make PARENT the parent of CHILDREN.
11053 When called interactively, PARENT is the current article and CHILDREN
11054 are the process-marked articles."
11056 (list (gnus-summary-article-number)
11057 (gnus-summary-work-articles nil)))
11058 (dolist (child children)
11059 (save-window-excursion
11060 (let ((gnus-article-buffer " *reparent*"))
11061 (unless (not (eq parent child))
11062 (error "An article may not be self-referential"))
11063 (let ((message-id (mail-header-id
11064 (gnus-summary-article-header parent))))
11065 (unless (and message-id (not (equal message-id "")))
11066 (error "No message-id in desired parent"))
11067 (gnus-with-article child
11069 (goto-char (point-min))
11070 (message-narrow-to-head)
11071 (if (re-search-forward "^References: " nil t)
11073 (re-search-forward "^[^ \t]" nil t)
11076 (insert " " message-id))
11077 (insert "References: " message-id "\n"))))
11078 (set-buffer gnus-summary-buffer)
11079 (gnus-summary-unmark-all-processable)
11080 (gnus-summary-update-article child)
11081 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11082 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11083 (gnus-summary-rethread-current)
11084 (gnus-message 3 "Article %d is now the child of article %d"
11087 (defun gnus-summary-toggle-threads (&optional arg)
11088 "Toggle showing conversation threads.
11089 If ARG is positive number, turn showing conversation threads on."
11091 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11092 (setq gnus-show-threads
11093 (if (null arg) (not gnus-show-threads)
11094 (> (prefix-numeric-value arg) 0)))
11095 (gnus-summary-prepare)
11096 (gnus-summary-goto-subject current)
11097 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11098 (gnus-summary-position-point)))
11100 (defun gnus-summary-show-all-threads ()
11101 "Show all threads."
11104 (let ((buffer-read-only nil))
11105 (subst-char-in-region (point-min) (point-max) ?\^M ?\n t)))
11106 (gnus-summary-position-point))
11108 (defun gnus-summary-show-thread ()
11109 "Show thread subtrees.
11110 Returns nil if no thread was there to be shown."
11112 (let ((buffer-read-only nil)
11114 (end (point-at-eol))
11115 ;; Leave point at bol
11116 (beg (progn (beginning-of-line) (point))))
11118 ;; Any hidden lines here?
11119 (search-forward "\r" end t)
11120 (subst-char-in-region beg end ?\^M ?\n t)
11122 (gnus-summary-position-point))))
11124 (defun gnus-summary-maybe-hide-threads ()
11125 "If requested, hide the threads that should be hidden."
11126 (when (and gnus-show-threads
11127 gnus-thread-hide-subtree)
11128 (gnus-summary-hide-all-threads
11129 (if (or (consp gnus-thread-hide-subtree)
11130 (functionp gnus-thread-hide-subtree))
11131 (gnus-make-predicate gnus-thread-hide-subtree)
11134 ;;; Hiding predicates.
11136 (defun gnus-article-unread-p (header)
11137 (memq (mail-header-number header) gnus-newsgroup-unreads))
11139 (defun gnus-article-unseen-p (header)
11140 (memq (mail-header-number header) gnus-newsgroup-unseen))
11142 (defun gnus-map-articles (predicate articles)
11143 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11144 (apply 'gnus-or (mapcar predicate
11145 (mapcar (lambda (number)
11146 (gnus-summary-article-header number))
11149 (defun gnus-summary-hide-all-threads (&optional predicate)
11150 "Hide all thread subtrees.
11151 If PREDICATE is supplied, threads that satisfy this predicate
11152 will not be hidden."
11155 (goto-char (point-min))
11158 (when (or (not predicate)
11160 predicate (gnus-summary-article-children)))
11161 (gnus-summary-hide-thread))
11162 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11163 (gnus-summary-position-point))
11165 (defun gnus-summary-hide-thread ()
11166 "Hide thread subtrees.
11167 If PREDICATE is supplied, threads that satisfy this predicate
11168 will not be hidden.
11169 Returns nil if no threads were there to be hidden."
11171 (let ((buffer-read-only nil)
11173 (article (gnus-summary-article-number)))
11175 ;; Go forward until either the buffer ends or the subthread
11177 (when (and (not (eobp))
11178 (or (zerop (gnus-summary-next-thread 1 t))
11179 (goto-char (point-max))))
11181 (if (and (> (point) start)
11182 (search-backward "\n" start t))
11184 (subst-char-in-region start (point) ?\n ?\^M)
11185 (gnus-summary-goto-subject article))
11189 (defun gnus-summary-go-to-next-thread (&optional previous)
11190 "Go to the same level (or less) next thread.
11191 If PREVIOUS is non-nil, go to previous thread instead.
11192 Return the article number moved to, or nil if moving was impossible."
11193 (let ((level (gnus-summary-thread-level))
11194 (way (if previous -1 1))
11197 (while (and (not (eobp))
11198 (< level (gnus-summary-thread-level)))
11199 (forward-line way))
11206 (gnus-summary-article-number)
11207 (goto-char beg)))))
11209 (defun gnus-summary-next-thread (n &optional silent)
11210 "Go to the same level next N'th thread.
11211 If N is negative, search backward instead.
11212 Returns the difference between N and the number of skips actually
11215 If SILENT, don't output messages."
11217 (let ((backward (< n 0))
11219 (while (and (> n 0)
11220 (gnus-summary-go-to-next-thread backward))
11223 (gnus-summary-position-point))
11224 (when (and (not silent) (/= 0 n))
11225 (gnus-message 7 "No more threads"))
11228 (defun gnus-summary-prev-thread (n)
11229 "Go to the same level previous N'th thread.
11230 Returns the difference between N and the number of skips actually
11233 (gnus-summary-next-thread (- n)))
11235 (defun gnus-summary-go-down-thread ()
11236 "Go down one level in the current thread."
11237 (let ((children (gnus-summary-article-children)))
11239 (gnus-summary-goto-subject (car children)))))
11241 (defun gnus-summary-go-up-thread ()
11242 "Go up one level in the current thread."
11243 (let ((parent (gnus-summary-article-parent)))
11245 (gnus-summary-goto-subject parent))))
11247 (defun gnus-summary-down-thread (n)
11248 "Go down thread N steps.
11249 If N is negative, go up instead.
11250 Returns the difference between N and how many steps down that were
11255 (while (and (> n 0)
11256 (if up (gnus-summary-go-up-thread)
11257 (gnus-summary-go-down-thread)))
11259 (gnus-summary-position-point)
11261 (gnus-message 7 "Can't go further"))
11264 (defun gnus-summary-up-thread (n)
11265 "Go up thread N steps.
11266 If N is negative, go down instead.
11267 Returns the difference between N and how many steps down that were
11270 (gnus-summary-down-thread (- n)))
11272 (defun gnus-summary-top-thread ()
11273 "Go to the top of the thread."
11275 (while (gnus-summary-go-up-thread))
11276 (gnus-summary-article-number))
11278 (defun gnus-summary-kill-thread (&optional unmark)
11279 "Mark articles under current thread as read.
11280 If the prefix argument is positive, remove any kinds of marks.
11281 If the prefix argument is negative, tick articles instead."
11284 (setq unmark (prefix-numeric-value unmark)))
11285 (let ((articles (gnus-summary-articles-in-thread)))
11287 ;; Expand the thread.
11288 (gnus-summary-show-thread)
11289 ;; Mark all the articles.
11291 (gnus-summary-goto-subject (car articles))
11292 (cond ((null unmark)
11293 (gnus-summary-mark-article-as-read gnus-killed-mark))
11295 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11297 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11298 (setq articles (cdr articles))))
11299 ;; Hide killed subtrees.
11301 gnus-thread-hide-killed
11302 (gnus-summary-hide-thread))
11303 ;; If marked as read, go to next unread subject.
11304 (when (null unmark)
11305 ;; Go to next unread subject.
11306 (gnus-summary-next-subject 1 t)))
11307 (gnus-set-mode-line 'summary))
11309 ;; Summary sorting commands
11311 (defun gnus-summary-sort-by-number (&optional reverse)
11312 "Sort the summary buffer by article number.
11313 Argument REVERSE means reverse order."
11315 (gnus-summary-sort 'number reverse))
11317 (defun gnus-summary-sort-by-random (&optional reverse)
11318 "Randomize the order in the summary buffer.
11319 Argument REVERSE means to randomize in reverse order."
11321 (gnus-summary-sort 'random reverse))
11323 (defun gnus-summary-sort-by-author (&optional reverse)
11324 "Sort the summary buffer by author name alphabetically.
11325 If `case-fold-search' is non-nil, case of letters is ignored.
11326 Argument REVERSE means reverse order."
11328 (gnus-summary-sort 'author reverse))
11330 (defun gnus-summary-sort-by-recipient (&optional reverse)
11331 "Sort the summary buffer by recipient name alphabetically.
11332 If `case-fold-search' is non-nil, case of letters is ignored.
11333 Argument REVERSE means reverse order."
11335 (gnus-summary-sort 'recipient reverse))
11337 (defun gnus-summary-sort-by-subject (&optional reverse)
11338 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11339 If `case-fold-search' is non-nil, case of letters is ignored.
11340 Argument REVERSE means reverse order."
11342 (gnus-summary-sort 'subject reverse))
11344 (defun gnus-summary-sort-by-date (&optional reverse)
11345 "Sort the summary buffer by date.
11346 Argument REVERSE means reverse order."
11348 (gnus-summary-sort 'date reverse))
11350 (defun gnus-summary-sort-by-score (&optional reverse)
11351 "Sort the summary buffer by score.
11352 Argument REVERSE means reverse order."
11354 (gnus-summary-sort 'score reverse))
11356 (defun gnus-summary-sort-by-lines (&optional reverse)
11357 "Sort the summary buffer by the number of lines.
11358 Argument REVERSE means reverse order."
11360 (gnus-summary-sort 'lines reverse))
11362 (defun gnus-summary-sort-by-chars (&optional reverse)
11363 "Sort the summary buffer by article length.
11364 Argument REVERSE means reverse order."
11366 (gnus-summary-sort 'chars reverse))
11368 (defun gnus-summary-sort-by-original (&optional reverse)
11369 "Sort the summary buffer using the default sorting method.
11370 Argument REVERSE means reverse order."
11372 (let* ((buffer-read-only)
11373 (gnus-summary-prepare-hook nil))
11374 ;; We do the sorting by regenerating the threads.
11375 (gnus-summary-prepare)
11376 ;; Hide subthreads if needed.
11377 (gnus-summary-maybe-hide-threads)))
11379 (defun gnus-summary-sort (predicate reverse)
11380 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11381 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11382 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11383 (gnus-thread-sort-functions
11388 (gnus-sort-gathered-threads-function
11389 gnus-thread-sort-functions)
11390 (gnus-article-sort-functions
11394 (,article t2 t1))))
11396 (gnus-summary-prepare-hook nil))
11397 ;; We do the sorting by regenerating the threads.
11398 (gnus-summary-prepare)
11399 ;; Hide subthreads if needed.
11400 (gnus-summary-maybe-hide-threads)))
11402 ;; Summary saving commands.
11404 (defun gnus-summary-save-article (&optional n not-saved)
11405 "Save the current article using the default saver function.
11406 If N is a positive number, save the N next articles.
11407 If N is a negative number, save the N previous articles.
11408 If N is nil and any articles have been marked with the process mark,
11409 save those articles instead.
11410 The variable `gnus-default-article-saver' specifies the saver function.
11412 If the optional second argument NOT-SAVED is non-nil, articles saved
11413 will not be marked as saved."
11415 (require 'gnus-art)
11416 (let* ((articles (gnus-summary-work-articles n))
11417 (save-buffer (save-excursion
11418 (nnheader-set-temp-buffer " *Gnus Save*")))
11419 (num (length articles))
11420 ;; Whether to save decoded articles or raw articles.
11421 (decode (when gnus-article-save-coding-system
11422 (get gnus-default-article-saver :decode)))
11423 ;; When saving many articles in a single file, use the other
11424 ;; function to save articles other than the first one.
11425 (saver2 (get gnus-default-article-saver :function))
11426 (gnus-prompt-before-saving (if saver2
11428 gnus-prompt-before-saving))
11429 (gnus-default-article-saver gnus-default-article-saver)
11431 (dolist (article articles)
11432 (setq header (gnus-summary-article-header article))
11433 (if (not (vectorp header))
11434 ;; This is a pseudo-article.
11435 (if (assq 'name header)
11436 (gnus-copy-file (cdr (assq 'name header)))
11437 (gnus-message 1 "Article %d is unsaveable" article))
11438 ;; This is a real article.
11439 (save-window-excursion
11440 (let ((gnus-display-mime-function (when decode
11441 gnus-display-mime-function))
11442 (gnus-article-prepare-hook (when decode
11443 gnus-article-prepare-hook)))
11444 (gnus-summary-select-article t nil nil article)
11445 (gnus-summary-goto-subject article)))
11447 (set-buffer save-buffer)
11449 (insert-buffer-substring (if decode
11450 gnus-article-buffer
11451 gnus-original-article-buffer)))
11452 (setq file (gnus-article-save save-buffer file num))
11453 (gnus-summary-remove-process-mark article)
11455 (gnus-summary-set-saved-mark article)))
11457 (setq gnus-default-article-saver saver2
11459 (gnus-kill-buffer save-buffer)
11460 (gnus-summary-position-point)
11461 (gnus-set-mode-line 'summary)
11464 (defun gnus-summary-pipe-output (&optional arg headers)
11465 "Pipe the current article to a subprocess.
11466 If N is a positive number, pipe the N next articles.
11467 If N is a negative number, pipe the N previous articles.
11468 If N is nil and any articles have been marked with the process mark,
11469 pipe those articles instead.
11470 If HEADERS (the symbolic prefix), include the headers, too."
11471 (interactive (gnus-interactive "P\ny"))
11472 (require 'gnus-art)
11473 (let ((gnus-default-article-saver 'gnus-summary-save-in-pipe)
11474 (gnus-save-all-headers (or headers gnus-save-all-headers)))
11475 (gnus-summary-save-article arg t))
11476 (let ((buffer (get-buffer "*Shell Command Output*")))
11478 (not (zerop (buffer-size buffer))))
11479 (gnus-configure-windows 'pipe))))
11481 (defun gnus-summary-save-article-mail (&optional arg)
11482 "Append the current article to a Unix mail box file.
11483 If N is a positive number, save the N next articles.
11484 If N is a negative number, save the N previous articles.
11485 If N is nil and any articles have been marked with the process mark,
11486 save those articles instead."
11488 (require 'gnus-art)
11489 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
11490 (gnus-summary-save-article arg)))
11492 (defun gnus-summary-save-article-rmail (&optional arg)
11493 "Append the current article to an rmail file.
11494 If N is a positive number, save the N next articles.
11495 If N is a negative number, save the N previous articles.
11496 If N is nil and any articles have been marked with the process mark,
11497 save those articles instead."
11499 (require 'gnus-art)
11500 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
11501 (gnus-summary-save-article arg)))
11503 (defun gnus-summary-save-article-file (&optional arg)
11504 "Append the current article to a file.
11505 If N is a positive number, save the N next articles.
11506 If N is a negative number, save the N previous articles.
11507 If N is nil and any articles have been marked with the process mark,
11508 save those articles instead."
11510 (require 'gnus-art)
11511 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
11512 (gnus-summary-save-article arg)))
11514 (defun gnus-summary-write-article-file (&optional arg)
11515 "Write the current article to a file, deleting the previous file.
11516 If N is a positive number, save the N next articles.
11517 If N is a negative number, save the N previous articles.
11518 If N is nil and any articles have been marked with the process mark,
11519 save those articles instead."
11521 (require 'gnus-art)
11522 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
11523 (gnus-summary-save-article arg)))
11525 (defun gnus-summary-save-article-body-file (&optional arg)
11526 "Append the current article body to a file.
11527 If N is a positive number, save the N next articles.
11528 If N is a negative number, save the N previous articles.
11529 If N is nil and any articles have been marked with the process mark,
11530 save those articles instead."
11532 (require 'gnus-art)
11533 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
11534 (gnus-summary-save-article arg)))
11536 (defun gnus-summary-write-article-body-file (&optional arg)
11537 "Write the current article body to a file, deleting the previous file.
11538 If N is a positive number, save the N next articles.
11539 If N is a negative number, save the N previous articles.
11540 If N is nil and any articles have been marked with the process mark,
11541 save those articles instead."
11543 (require 'gnus-art)
11544 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
11545 (gnus-summary-save-article arg)))
11547 (defun gnus-summary-muttprint (&optional arg)
11548 "Print the current article using Muttprint.
11549 If N is a positive number, save the N next articles.
11550 If N is a negative number, save the N previous articles.
11551 If N is nil and any articles have been marked with the process mark,
11552 save those articles instead."
11554 (require 'gnus-art)
11555 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
11556 (gnus-summary-save-article arg t)))
11558 (defun gnus-summary-pipe-message (program)
11559 "Pipe the current article through PROGRAM."
11560 (interactive "sProgram: ")
11561 (gnus-summary-select-article)
11562 (let ((mail-header-separator ""))
11563 (gnus-eval-in-buffer-window gnus-article-buffer
11566 (let ((start (window-start))
11568 (message-pipe-buffer-body program)
11569 (set-window-start (get-buffer-window (current-buffer)) start))))))
11571 (defun gnus-get-split-value (methods)
11572 "Return a value based on the split METHODS."
11573 (let (split-name method result match)
11576 (set-buffer gnus-original-article-buffer)
11578 (nnheader-narrow-to-headers)
11579 (while (and methods (not split-name))
11580 (goto-char (point-min))
11581 (setq method (pop methods))
11582 (setq match (car method))
11585 ;; Regular expression.
11587 (re-search-forward match nil t)))
11592 (setq result (funcall match gnus-newsgroup-name))))
11597 (setq result (eval match)))))
11598 (setq split-name (cdr method))
11599 (cond ((stringp result)
11600 (push (expand-file-name
11601 result gnus-article-save-directory)
11604 (setq split-name (append result split-name)))))))))
11605 (nreverse split-name)))
11607 (defun gnus-valid-move-group-p (group)
11608 (and (boundp group)
11609 (symbol-name group)
11610 (symbol-value group)
11611 (gnus-get-function (gnus-find-method-for-group
11612 (symbol-name group)) 'request-accept-article t)))
11614 (defun gnus-read-move-group-name (prompt default articles prefix)
11615 "Read a group name."
11616 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
11617 (minibuffer-confirm-incomplete nil) ; XEmacs
11621 (if (> (length articles) 1)
11622 (format "these %d articles" (length articles))
11627 (gnus-completing-read-with-default
11630 'gnus-valid-move-group-p
11632 'gnus-group-history))
11633 ((= 1 (length split-name))
11634 (gnus-completing-read-with-default
11635 (car split-name) prom
11637 'gnus-valid-move-group-p
11639 'gnus-group-history))
11641 (gnus-completing-read-with-default
11643 (mapcar 'list (nreverse split-name))
11645 'gnus-group-history))))
11646 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
11648 (if (or (string= to-newsgroup "")
11649 (string= to-newsgroup prefix))
11650 (setq to-newsgroup default))
11651 (unless to-newsgroup
11652 (error "No group name entered"))
11653 (or (gnus-active to-newsgroup)
11654 (gnus-activate-group to-newsgroup nil nil to-method)
11655 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
11657 (or (and (gnus-request-create-group to-newsgroup to-method)
11658 (gnus-activate-group
11659 to-newsgroup nil nil to-method)
11660 (gnus-subscribe-group to-newsgroup))
11661 (error "Couldn't create group %s" to-newsgroup)))
11662 (error "No such group: %s" to-newsgroup)))
11665 (defvar gnus-summary-save-parts-counter)
11667 (defun gnus-summary-save-parts (type dir n &optional reverse)
11668 "Save parts matching TYPE to DIR.
11669 If REVERSE, save parts that do not match TYPE."
11671 (list (read-string "Save parts of type: "
11672 (or (car gnus-summary-save-parts-type-history)
11673 gnus-summary-save-parts-default-mime)
11674 'gnus-summary-save-parts-type-history)
11675 (setq gnus-summary-save-parts-last-directory
11676 (read-file-name "Save to directory: "
11677 gnus-summary-save-parts-last-directory
11679 current-prefix-arg))
11680 (gnus-summary-iterate n
11681 (let ((gnus-display-mime-function nil)
11682 (gnus-inhibit-treatment t))
11683 (gnus-summary-select-article))
11685 (set-buffer gnus-article-buffer)
11686 (let ((handles (or gnus-article-mime-handles
11687 (mm-dissect-buffer nil gnus-article-loose-mime)
11688 (and gnus-article-emulate-mime
11690 (gnus-summary-save-parts-counter 1))
11692 (gnus-summary-save-parts-1 type dir handles reverse)
11693 (unless gnus-article-mime-handles ;; Don't destroy this case.
11694 (mm-destroy-parts handles)))))))
11696 (defun gnus-summary-save-parts-1 (type dir handle reverse)
11697 (if (stringp (car handle))
11698 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
11701 (not (string-match type (mm-handle-media-type handle)))
11702 (string-match type (mm-handle-media-type handle)))
11703 (let ((file (expand-file-name
11705 mm-file-name-rewrite-functions
11706 (file-name-nondirectory
11708 (mail-content-type-get
11709 (mm-handle-disposition handle) 'filename)
11710 (mail-content-type-get
11711 (mm-handle-type handle) 'name)
11712 (format "%s.%d.%d" gnus-newsgroup-name
11713 (cdr gnus-article-current)
11714 gnus-summary-save-parts-counter))))
11716 (incf gnus-summary-save-parts-counter)
11717 (unless (file-exists-p file)
11718 (mm-save-part-to-file handle file))))))
11720 ;; Summary extract commands
11722 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
11723 (let ((buffer-read-only nil)
11724 (article (gnus-summary-article-number))
11726 (unless (gnus-summary-goto-subject article)
11727 (error "No such article: %d" article))
11728 (gnus-summary-position-point)
11729 ;; If all commands are to be bunched up on one line, we collect
11731 (unless gnus-view-pseudos-separately
11732 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
11735 (setq action (cdr (assq 'action (car ps))))
11736 (setq files (list (cdr (assq 'name (car ps)))))
11737 (while (and ps (cdr ps)
11738 (string= (or action "1")
11739 (or (cdr (assq 'action (cadr ps))) "2")))
11740 (push (cdr (assq 'name (cadr ps))) files)
11741 (setcdr ps (cddr ps)))
11743 (when (not (string-match "%s" action))
11746 (when (assq 'execute (car ps))
11747 (setcdr (assq 'execute (car ps))
11748 (funcall (if (string-match "%s" action)
11755 (shell-quote-argument f)))
11757 (setq ps (cdr ps)))))
11758 (if (and gnus-view-pseudos (not not-view))
11760 (when (assq 'execute (car pslist))
11761 (gnus-execute-command (cdr (assq 'execute (car pslist)))
11762 (eq gnus-view-pseudos 'not-confirm)))
11763 (setq pslist (cdr pslist)))
11766 (setq after-article (or (cdr (assq 'article (car pslist)))
11767 (gnus-summary-article-number)))
11768 (gnus-summary-goto-subject after-article)
11771 (insert " " (file-name-nondirectory
11772 (cdr (assq 'name (car pslist))))
11773 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
11775 (forward-line -1) ; back to `b'
11776 (gnus-add-text-properties
11777 b (1- e) (list 'gnus-number gnus-reffed-article-number
11778 gnus-mouse-face-prop gnus-mouse-face))
11780 after-article gnus-reffed-article-number
11781 gnus-unread-mark b (car pslist) 0 (- e b))
11782 (setq gnus-newsgroup-unreads
11783 (gnus-add-to-sorted-list gnus-newsgroup-unreads
11784 gnus-reffed-article-number))
11785 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
11786 (setq pslist (cdr pslist)))))))
11788 (defun gnus-pseudos< (p1 p2)
11789 (let ((c1 (cdr (assq 'action p1)))
11790 (c2 (cdr (assq 'action p2))))
11791 (and c1 c2 (string< c1 c2))))
11793 (defun gnus-request-pseudo-article (props)
11794 (cond ((assq 'execute props)
11795 (gnus-execute-command (cdr (assq 'execute props)))))
11796 (let ((gnus-current-article (gnus-summary-article-number)))
11797 (gnus-run-hooks 'gnus-mark-article-hook)))
11799 (defun gnus-execute-command (command &optional automatic)
11801 (gnus-article-setup-buffer)
11802 (set-buffer gnus-article-buffer)
11803 (setq buffer-read-only nil)
11804 (let ((command (if automatic command
11805 (read-string "Command: " (cons command 0)))))
11807 (insert "$ " command "\n\n")
11808 (if gnus-view-pseudo-asynchronously
11809 (start-process "gnus-execute" (current-buffer) shell-file-name
11810 shell-command-switch command)
11811 (call-process shell-file-name nil t nil
11812 shell-command-switch command)))))
11814 ;; Summary kill commands.
11816 (defun gnus-summary-edit-global-kill (article)
11817 "Edit the \"global\" kill file."
11818 (interactive (list (gnus-summary-article-number)))
11819 (gnus-group-edit-global-kill article))
11821 (defun gnus-summary-edit-local-kill ()
11822 "Edit a local kill file applied to the current newsgroup."
11824 (setq gnus-current-headers (gnus-summary-article-header))
11825 (gnus-group-edit-local-kill
11826 (gnus-summary-article-number) gnus-newsgroup-name))
11828 ;;; Header reading.
11830 (defun gnus-read-header (id &optional header)
11831 "Read the headers of article ID and enter them into the Gnus system."
11832 (let ((group gnus-newsgroup-name)
11833 (gnus-override-method
11835 gnus-override-method
11836 (and (gnus-news-group-p gnus-newsgroup-name)
11837 (car (gnus-refer-article-methods)))))
11839 ;; First we check to see whether the header in question is already
11842 ;; This is a Message-ID.
11843 (setq header (or header (gnus-id-to-header id)))
11844 ;; This is an article number.
11845 (setq header (or header (gnus-summary-article-header id))))
11847 (not (gnus-summary-article-sparse-p (mail-header-number header))))
11848 ;; We have found the header.
11850 ;; We have to really fetch the header to this article.
11852 (set-buffer nntp-server-buffer)
11853 (when (setq where (gnus-request-head id group))
11854 (nnheader-fold-continuation-lines)
11855 (goto-char (point-max))
11857 (goto-char (point-min))
11861 ((cdr where) (cdr where))
11862 (header (mail-header-number header))
11863 (t gnus-reffed-article-number))
11865 (insert " Article retrieved.\n"))
11866 (if (or (not where)
11867 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
11868 () ; Malformed head.
11869 (unless (gnus-summary-article-sparse-p (mail-header-number header))
11870 (when (and (stringp id)
11872 (not (string= (gnus-group-real-name group)
11874 (not (gnus-server-equal gnus-override-method
11875 (gnus-group-method group)))))
11876 ;; If we fetched by Message-ID and the article came from
11877 ;; a different group (or server), we fudge some bogus
11878 ;; article numbers for this article.
11879 (mail-header-set-number header gnus-reffed-article-number))
11881 (set-buffer gnus-summary-buffer)
11882 (decf gnus-reffed-article-number)
11883 (gnus-remove-header (mail-header-number header))
11884 (push header gnus-newsgroup-headers)
11885 (setq gnus-current-headers header)
11886 (push (mail-header-number header) gnus-newsgroup-limit)))
11889 (defun gnus-remove-header (number)
11890 "Remove header NUMBER from `gnus-newsgroup-headers'."
11891 (if (and gnus-newsgroup-headers
11892 (= number (mail-header-number (car gnus-newsgroup-headers))))
11893 (pop gnus-newsgroup-headers)
11894 (let ((headers gnus-newsgroup-headers))
11895 (while (and (cdr headers)
11896 (not (= number (mail-header-number (cadr headers)))))
11898 (when (cdr headers)
11899 (setcdr headers (cddr headers))))))
11902 ;;; summary highlights
11905 (defun gnus-highlight-selected-summary ()
11906 "Highlight selected article in summary buffer."
11907 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
11908 (when gnus-summary-selected-face
11910 (let* ((beg (point-at-bol))
11911 (end (point-at-eol))
11912 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
11913 (from (if (get-text-property beg gnus-mouse-face-prop)
11915 (or (next-single-property-change
11916 beg gnus-mouse-face-prop nil end)
11921 (or (next-single-property-change
11922 from gnus-mouse-face-prop nil end)
11924 ;; If no mouse-face prop on line we will have to = from = end,
11925 ;; so we highlight the entire line instead.
11926 (when (= (+ to 2) from)
11929 (if gnus-newsgroup-selected-overlay
11930 ;; Move old overlay.
11932 gnus-newsgroup-selected-overlay from to (current-buffer))
11933 ;; Create new overlay.
11935 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
11936 'face gnus-summary-selected-face))))))
11938 (defvar gnus-summary-highlight-line-cached nil)
11939 (defvar gnus-summary-highlight-line-trigger nil)
11941 (defun gnus-summary-highlight-line-0 ()
11942 (if (and (eq gnus-summary-highlight-line-trigger
11943 gnus-summary-highlight)
11944 gnus-summary-highlight-line-cached)
11945 gnus-summary-highlight-line-cached
11946 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
11947 gnus-summary-highlight-line-cached
11948 (let* ((cond (list 'cond))
11950 (list gnus-summary-highlight))
11952 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
11956 (gnus-byte-compile (list 'lambda nil cond))))))
11958 (defun gnus-summary-highlight-line ()
11959 "Highlight current line according to `gnus-summary-highlight'."
11960 (let* ((beg (point-at-bol))
11961 (article (or (gnus-summary-article-number) gnus-current-article))
11962 (score (or (cdr (assq article
11963 gnus-newsgroup-scored))
11964 gnus-summary-default-score 0))
11965 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
11966 (inhibit-read-only t)
11967 (default gnus-summary-default-score)
11968 (default-high gnus-summary-default-high-score)
11969 (default-low gnus-summary-default-low-score)
11970 (uncached (and gnus-summary-use-undownloaded-faces
11971 (memq article gnus-newsgroup-undownloaded)
11972 (not (memq article gnus-newsgroup-cached)))))
11973 (let ((face (funcall (gnus-summary-highlight-line-0))))
11974 (unless (eq face (get-text-property beg 'face))
11975 (gnus-put-text-property-excluding-characters-with-faces
11976 beg (point-at-eol) 'face
11977 (setq face (if (boundp face) (symbol-value face) face)))
11978 (when gnus-summary-highlight-line-function
11979 (funcall gnus-summary-highlight-line-function article face))))))
11981 (defun gnus-update-read-articles (group unread &optional compute)
11982 "Update the list of read articles in GROUP.
11983 UNREAD is a sorted list."
11984 (let ((active (or gnus-newsgroup-active (gnus-active group)))
11985 (info (gnus-get-info group))
11988 (if (or (not info) (not active))
11989 ;; There is no info on this group if it was, in fact,
11990 ;; killed. Gnus stores no information on killed groups, so
11991 ;; there's nothing to be done.
11992 ;; One could store the information somewhere temporarily,
11993 ;; perhaps... Hmmm...
11995 ;; Remove any negative articles numbers.
11996 (while (and unread (< (car unread) 0))
11997 (setq unread (cdr unread)))
11998 ;; Remove any expired article numbers
11999 (while (and unread (< (car unread) (car active)))
12000 (setq unread (cdr unread)))
12001 ;; Compute the ranges of read articles by looking at the list of
12002 ;; unread articles.
12004 (when (/= (car unread) prev)
12005 (push (if (= prev (1- (car unread))) prev
12006 (cons prev (1- (car unread))))
12008 (setq prev (1+ (car unread)))
12009 (setq unread (cdr unread)))
12010 (when (<= prev (cdr active))
12011 (push (cons prev (cdr active)) read))
12012 (setq read (if (> (length read) 1) (nreverse read) read))
12017 ;; Propagate the read marks to the backend.
12018 (when (gnus-check-backend-function 'request-set-mark group)
12019 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12020 (add (gnus-remove-from-range read (gnus-info-read info))))
12022 (unless (gnus-check-group group)
12023 (error "Can't open server for %s" group))
12024 (gnus-request-set-mark
12025 group (delq nil (list (if add (list add 'add '(read)))
12026 (if del (list del 'del '(read))))))
12028 `(gnus-request-set-mark
12031 (if del (list del 'add '(read)))
12032 (if add (list add 'del '(read))))))))))
12033 (set-buffer gnus-group-buffer)
12034 (gnus-undo-register
12036 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12037 (gnus-info-set-read ',info ',(gnus-info-read info))
12038 (gnus-get-unread-articles-in-group ',info
12039 (gnus-active ,group))
12040 (gnus-group-update-group ,group t)
12042 ;; Enter this list into the group info.
12043 (gnus-info-set-read info read)
12044 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12045 (gnus-get-unread-articles-in-group info (gnus-active group))
12048 (defun gnus-offer-save-summaries ()
12049 "Offer to save all active summary buffers."
12051 ;; Go through all buffers and find all summaries.
12052 (dolist (buffer (buffer-list))
12053 (when (and (setq buffer (buffer-name buffer))
12054 (string-match "Summary" buffer)
12055 (with-current-buffer buffer
12056 ;; We check that this is, indeed, a summary buffer.
12057 (and (eq major-mode 'gnus-summary-mode)
12058 ;; Also make sure this isn't bogus.
12059 gnus-newsgroup-prepared
12060 ;; Also make sure that this isn't a
12061 ;; dead summary buffer.
12062 (not gnus-dead-summary-mode))))
12063 (push buffer buffers)))
12064 ;; Go through all these summary buffers and offer to save them.
12068 "Update summary buffer %s? "
12070 (switch-to-buffer buf)
12071 (gnus-summary-exit))
12074 (defun gnus-summary-setup-default-charset ()
12075 "Setup newsgroup default charset."
12076 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12077 (setq gnus-newsgroup-charset nil)
12078 (let* ((ignored-charsets
12079 (or gnus-newsgroup-ephemeral-ignored-charsets
12081 (and gnus-newsgroup-name
12082 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12083 gnus-newsgroup-ignored-charsets))))
12084 (setq gnus-newsgroup-charset
12085 (or gnus-newsgroup-ephemeral-charset
12086 (and gnus-newsgroup-name
12087 (gnus-parameter-charset gnus-newsgroup-name))
12088 gnus-default-charset))
12089 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12090 ignored-charsets))))
12096 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12097 "Display the current article buffer fully MIME-buttonized.
12098 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12099 treated as multipart/mixed."
12101 (require 'gnus-art)
12102 (let ((gnus-unbuttonized-mime-types nil)
12103 (gnus-mime-display-multipart-as-mixed show-all-parts))
12104 (gnus-summary-show-article)))
12106 (defun gnus-summary-repair-multipart (article)
12107 "Add a Content-Type header to a multipart article without one."
12108 (interactive (list (gnus-summary-article-number)))
12109 (gnus-with-article article
12110 (message-narrow-to-head)
12111 (message-remove-header "Mime-Version")
12112 (goto-char (point-max))
12113 (insert "Mime-Version: 1.0\n")
12115 (when (search-forward "\n--" nil t)
12116 (let ((separator (buffer-substring (point) (point-at-eol))))
12117 (message-narrow-to-head)
12118 (message-remove-header "Content-Type")
12119 (goto-char (point-max))
12120 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12123 (let (gnus-mark-article-hook)
12124 (gnus-summary-select-article t t nil article)))
12126 (defun gnus-summary-toggle-display-buttonized ()
12127 "Toggle the buttonizing of the article buffer."
12129 (require 'gnus-art)
12130 (if (setq gnus-inhibit-mime-unbuttonizing
12131 (not gnus-inhibit-mime-unbuttonizing))
12132 (let ((gnus-unbuttonized-mime-types nil))
12133 (gnus-summary-show-article))
12134 (gnus-summary-show-article)))
12137 ;;; Generic summary marking commands
12140 (defvar gnus-summary-marking-alist
12141 '((read gnus-del-mark "d")
12142 (unread gnus-unread-mark "u")
12143 (ticked gnus-ticked-mark "!")
12144 (dormant gnus-dormant-mark "?")
12145 (expirable gnus-expirable-mark "e"))
12146 "An alist of names/marks/keystrokes.")
12148 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12149 (defvar gnus-summary-mark-map)
12151 (defun gnus-summary-make-all-marking-commands ()
12152 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12153 (dolist (elem gnus-summary-marking-alist)
12154 (apply 'gnus-summary-make-marking-command elem)))
12156 (defun gnus-summary-make-marking-command (name mark keystroke)
12157 (let ((map (make-sparse-keymap)))
12158 (define-key gnus-summary-generic-mark-map keystroke map)
12159 (dolist (lway `((next "next" next nil "n")
12160 (next-unread "next unread" next t "N")
12161 (prev "previous" prev nil "p")
12162 (prev-unread "previous unread" prev t "P")
12163 (nomove "" nil nil ,keystroke)))
12164 (let ((func (gnus-summary-make-marking-command-1
12165 mark (car lway) lway name)))
12166 (setq func (eval func))
12167 (define-key map (nth 4 lway) func)))))
12169 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12171 (format "gnus-summary-put-mark-as-%s%s"
12172 name (if (eq way 'nomove)
12174 (concat "-" (symbol-name way)))))
12177 "Mark the current article as %s%s.
12178 If N, the prefix, then repeat N times.
12179 If N is negative, move in reverse order.
12180 The difference between N and the actual number of articles marked is
12184 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12186 (defun gnus-summary-generic-mark (n mark move unread)
12187 "Mark N articles with MARK."
12188 (unless (eq major-mode 'gnus-summary-mode)
12189 (error "This command can only be used in the summary buffer"))
12190 (gnus-summary-show-thread)
12193 ((eq move 'next) 1)
12194 ((eq move 'prev) -1)
12196 (if (zerop nummove)
12200 nummove (* -1 nummove))))
12201 (while (and (> n 0)
12202 (gnus-summary-mark-article nil mark)
12203 (zerop (gnus-summary-next-subject nummove unread t)))
12206 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12207 (gnus-summary-recenter)
12208 (gnus-summary-position-point)
12209 (gnus-set-mode-line 'summary)
12212 (defun gnus-summary-insert-articles (articles)
12213 (when (setq articles
12214 (gnus-sorted-difference articles
12215 (mapcar (lambda (h)
12216 (mail-header-number h))
12217 gnus-newsgroup-headers)))
12218 (setq gnus-newsgroup-headers
12220 gnus-newsgroup-headers
12221 (gnus-fetch-headers articles)
12222 'gnus-article-sort-by-number))
12223 ;; Suppress duplicates?
12224 (when gnus-suppress-duplicates
12225 (gnus-dup-suppress-articles))
12227 ;; We might want to build some more threads first.
12228 (when (and gnus-fetch-old-headers
12229 (eq gnus-headers-retrieved-by 'nov))
12230 (if (eq gnus-fetch-old-headers 'invisible)
12231 (gnus-build-all-threads)
12232 (gnus-build-old-threads)))
12233 ;; Let the Gnus agent mark articles as read.
12235 (gnus-agent-get-undownloaded-list))
12236 ;; Remove list identifiers from subject
12237 (when gnus-list-identifiers
12238 (gnus-summary-remove-list-identifiers))
12239 ;; First and last article in this newsgroup.
12240 (when gnus-newsgroup-headers
12241 (setq gnus-newsgroup-begin
12242 (mail-header-number (car gnus-newsgroup-headers))
12244 (mail-header-number
12245 (gnus-last-element gnus-newsgroup-headers))))
12246 (when gnus-use-scoring
12247 (gnus-possibly-score-headers))))
12249 (defun gnus-summary-insert-old-articles (&optional all)
12250 "Insert all old articles in this group.
12251 If ALL is non-nil, already read articles become readable.
12252 If ALL is a number, fetch this number of articles."
12255 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12258 ;; Some nntp servers lie about their active range. When
12259 ;; this happens, the active range can be in the millions.
12260 ;; Use a compressed range to avoid creating a huge list.
12261 (gnus-range-difference (list gnus-newsgroup-active) old))
12262 (setq len (gnus-range-length older))
12267 (let ((older-range (nreverse older)))
12271 (let* ((r (pop older-range))
12272 (min (if (numberp r) r (car r)))
12273 (max (if (numberp r) r (cdr r))))
12274 (while (and (<= min max)
12279 (setq older (gnus-uncompress-range older))))
12281 (setq older (gnus-uncompress-range older)))
12283 (when (and (numberp gnus-large-newsgroup)
12284 (> len gnus-large-newsgroup))
12285 (let* ((cursor-in-echo-area nil)
12286 (initial (gnus-parameter-large-newsgroup-initial
12287 gnus-newsgroup-name))
12291 "How many articles from %s (%s %d): "
12292 (gnus-group-decoded-name gnus-newsgroup-name)
12293 (if initial "max" "default")
12296 (cons (number-to-string initial)
12298 (unless (string-match "^[ \t]*$" input)
12299 (setq all (string-to-number input))
12301 (let ((older-range (nreverse older)))
12305 (let* ((r (pop older-range))
12306 (min (if (numberp r) r (car r)))
12307 (max (if (numberp r) r (cdr r))))
12308 (while (and (<= min max)
12312 max (1- max))))))))))
12313 (setq older (gnus-uncompress-range older))))
12315 (message "No old news.")
12316 (gnus-summary-insert-articles older)
12317 (gnus-summary-limit (gnus-sorted-nunion old older))))
12318 (gnus-summary-position-point)))
12320 (defun gnus-summary-insert-new-articles ()
12321 "Insert all new articles in this group."
12324 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12325 (old-active gnus-newsgroup-active)
12326 (nnmail-fetched-sources (list t))
12328 (setq gnus-newsgroup-active
12329 (gnus-activate-group gnus-newsgroup-name 'scan))
12330 (setq i (cdr gnus-newsgroup-active))
12331 (while (> i (cdr old-active))
12335 (message "No gnus is bad news")
12336 (gnus-summary-insert-articles new)
12337 (setq gnus-newsgroup-unreads
12338 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12339 (gnus-summary-limit (gnus-sorted-nunion old new))))
12340 (gnus-summary-position-point)))
12342 (gnus-summary-make-all-marking-commands)
12344 (gnus-ems-redefine)
12346 (provide 'gnus-sum)
12348 (run-hooks 'gnus-sum-load-hook)
12350 ;; Local Variables:
12351 ;; coding: iso-8859-1
12354 ;; arch-tag: 17c6748f-6d00-4d36-bf01-835c42f31235
12355 ;;; gnus-sum.el ends here