1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996-2011 Free Software Foundation, Inc.
5 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; For Emacs <22.2 and XEmacs.
29 (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
33 (when (featurep 'xemacs)
34 (require 'easy-mmode))) ; for `define-minor-mode'
36 (defvar tool-bar-mode)
37 (defvar gnus-tmp-header)
50 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
51 (autoload 'gnus-cache-write-active "gnus-cache")
52 (autoload 'gnus-mailing-list-insinuate "gnus-ml" nil t)
53 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil t)
54 (autoload 'gnus-pick-line-number "gnus-salt" nil t)
55 (autoload 'mm-uu-dissect "mm-uu")
56 (autoload 'gnus-article-outlook-deuglify-article "deuglify"
57 "Deuglify broken Outlook (Express) articles and redisplay."
59 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" nil t)
60 (autoload 'gnus-article-outlook-repair-attribution "deuglify" nil t)
61 (autoload 'gnus-article-outlook-rearrange-citation "deuglify" nil t)
62 (autoload 'nnir-article-rsv "nnir" nil nil 'macro)
63 (autoload 'nnir-article-group "nnir" nil nil 'macro)
65 (defcustom gnus-kill-summary-on-exit t
66 "*If non-nil, kill the summary buffer when you exit from it.
67 If nil, the summary will become a \"*Dead Summary*\" buffer, and
68 it will be killed sometime later."
69 :group 'gnus-summary-exit
72 (defcustom gnus-summary-next-group-on-exit t
73 "If non-nil, go to the next unread newsgroup on summary exit.
74 See `gnus-group-goto-unread'."
75 :link '(custom-manual "(gnus)Group Maneuvering")
76 :group 'gnus-summary-exit
77 :version "23.1" ;; No Gnus
80 (defcustom gnus-summary-stop-at-end-of-message nil
81 "If non-nil, don't select the next message when using `SPC'."
82 :link '(custom-manual "(gnus)Group Maneuvering")
83 :group 'gnus-summary-maneuvering
87 (defcustom gnus-fetch-old-headers nil
88 "*Non-nil means that Gnus will try to build threads by grabbing old headers.
89 If an unread article in the group refers to an older, already
90 read (or just marked as read) article, the old article will not
91 normally be displayed in the Summary buffer. If this variable is
92 t, Gnus will attempt to grab the headers to the old articles, and
93 thereby build complete threads. If it has the value `some', all
94 old headers will be fetched but only enough headers to connect
95 otherwise loose threads will be displayed. This variable can
96 also be a number. In that case, no more than that number of old
97 headers will be fetched. If it has the value `invisible', all
98 old headers will be fetched, but none will be displayed.
100 The server has to support NOV for any of this to work.
102 This feature can seriously impact performance it ignores all
103 locally cached header entries. Setting it to t for groups for a
104 server that doesn't expire articles (such as news.gmane.org),
105 leads to very slow summary generation."
107 :type '(choice (const :tag "off" nil)
112 (sexp :menu-tag "other" t)))
114 (defcustom gnus-refer-thread-limit 500
115 "*The number of old headers to fetch when doing \\<gnus-summary-mode-map>\\[gnus-summary-refer-thread].
116 If t, fetch all the available old headers."
118 :type '(choice number
119 (sexp :menu-tag "other" t)))
121 (defcustom gnus-refer-thread-use-nnir nil
122 "*Use nnir to search an entire server when referring threads. A
123 nil value will only search for thread-related articles in the
128 (defcustom gnus-summary-make-false-root 'adopt
129 "*nil means that Gnus won't gather loose threads.
130 If the root of a thread has expired or been read in a previous
131 session, the information necessary to build a complete thread has been
132 lost. Instead of having many small sub-threads from this original thread
133 scattered all over the summary buffer, Gnus can gather them.
135 If non-nil, Gnus will try to gather all loose sub-threads from an
136 original thread into one large thread.
138 If this variable is non-nil, it should be one of `none', `adopt',
141 If this variable is `none', Gnus will not make a false root, but just
142 present the sub-threads after another.
143 If this variable is `dummy', Gnus will create a dummy root that will
144 have all the sub-threads as children.
145 If this variable is `adopt', Gnus will make one of the \"children\"
146 the parent and mark all the step-children as such.
147 If this variable is `empty', the \"children\" are printed with empty
148 subject fields. (Or rather, they will be printed with a string
149 given by the `gnus-summary-same-subject' variable.)"
151 :type '(choice (const :tag "off" nil)
157 (defcustom gnus-summary-make-false-root-always nil
158 "Always make a false dummy root."
163 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
164 "*A regexp to match subjects to be excluded from loose thread gathering.
165 As loose thread gathering is done on subjects only, that means that
166 there can be many false gatherings performed. By rooting out certain
167 common subjects, gathering might become saner."
171 (defcustom gnus-summary-gather-subject-limit nil
172 "*Maximum length of subject comparisons when gathering loose threads.
173 Use nil to compare full subjects. Setting this variable to a low
174 number will help gather threads that have been corrupted by
175 newsreaders chopping off subject lines, but it might also mean that
176 unrelated articles that have subject that happen to begin with the
177 same few characters will be incorrectly gathered.
179 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
182 :type '(choice (const :tag "off" nil)
184 (sexp :menu-tag "on" t)))
186 (defcustom gnus-simplify-subject-functions nil
187 "List of functions taking a string argument that simplify subjects.
188 The functions are applied recursively.
190 Useful functions to put in this list include:
191 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
192 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
194 :type '(repeat function))
196 (defcustom gnus-simplify-ignored-prefixes nil
197 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
199 :type '(choice (const :tag "off" nil)
202 (defcustom gnus-build-sparse-threads nil
203 "*If non-nil, fill in the gaps in threads.
204 If `some', only fill in the gaps that are needed to tie loose threads
205 together. If `more', fill in all leaf nodes that Gnus can find. If
206 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
208 :type '(choice (const :tag "off" nil)
211 (sexp :menu-tag "all" t)))
213 (defcustom gnus-summary-thread-gathering-function
214 'gnus-gather-threads-by-subject
215 "*Function used for gathering loose threads.
216 There are two pre-defined functions: `gnus-gather-threads-by-subject',
217 which only takes Subjects into consideration; and
218 `gnus-gather-threads-by-references', which compared the References
219 headers of the articles to find matches."
221 :type '(radio (function-item gnus-gather-threads-by-subject)
222 (function-item gnus-gather-threads-by-references)
223 (function :tag "other")))
225 (defcustom gnus-summary-same-subject ""
226 "*String indicating that the current article has the same subject as the previous.
227 This variable will only be used if the value of
228 `gnus-summary-make-false-root' is `empty'."
229 :group 'gnus-summary-format
232 (defcustom gnus-summary-goto-unread nil
233 "*If t, many commands will go to the next unread article.
234 This applies to marking commands as well as other commands that
235 \"naturally\" select the next article, like, for instance, `SPC' at
236 the end of an article.
238 If nil, the marking commands do NOT go to the next unread article
239 \(they go to the next article instead). If `never', commands that
240 usually go to the next unread article, will go to the next article,
241 whether it is read or not."
243 :group 'gnus-summary-marks
244 :link '(custom-manual "(gnus)Setting Marks")
245 :type '(choice (const :tag "off" nil)
247 (sexp :menu-tag "on" t)))
249 (defcustom gnus-summary-default-score 0
250 "*Default article score level.
251 All scores generated by the score files will be added to this score.
252 If this variable is nil, scoring will be disabled."
253 :group 'gnus-score-default
254 :type '(choice (const :tag "disable")
257 (defcustom gnus-summary-default-high-score 0
258 "*Default threshold for a high scored article.
259 An article will be highlighted as high scored if its score is greater
262 :group 'gnus-score-default
265 (defcustom gnus-summary-default-low-score 0
266 "*Default threshold for a low scored article.
267 An article will be highlighted as low scored if its score is smaller
270 :group 'gnus-score-default
273 (defcustom gnus-summary-zcore-fuzz 0
274 "*Fuzziness factor for the zcore in the summary buffer.
275 Articles with scores closer than this to `gnus-summary-default-score'
277 :group 'gnus-summary-format
280 (defcustom gnus-simplify-subject-fuzzy-regexp nil
281 "*Strings to be removed when doing fuzzy matches.
282 This can either be a regular expression or list of regular expressions
283 that will be removed from subject strings if fuzzy subject
284 simplification is selected."
286 :type '(repeat regexp))
288 (defcustom gnus-show-threads t
289 "*If non-nil, display threads in summary mode."
293 (defcustom gnus-thread-hide-subtree nil
294 "*If non-nil, hide all threads initially.
295 This can be a predicate specifier which says which threads to hide.
296 If threads are hidden, you have to run the command
297 `gnus-summary-show-thread' by hand or select an article."
299 :type '(radio (sexp :format "Non-nil\n"
300 :match (lambda (widget value)
301 (not (or (consp value) (functionp value))))
304 (sexp :tag "Predicate specifier")))
306 (defcustom gnus-thread-hide-killed t
307 "*If non-nil, hide killed threads automatically."
311 (defcustom gnus-thread-ignore-subject t
312 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
313 If nil, articles that have different subjects from their parents will
314 start separate threads."
318 (defcustom gnus-thread-operation-ignore-subject t
319 "*If non-nil, subjects will be ignored when doing thread commands.
320 This affects commands like `gnus-summary-kill-thread' and
321 `gnus-summary-lower-thread'.
323 If this variable is nil, articles in the same thread with different
324 subjects will not be included in the operation in question. If this
325 variable is `fuzzy', only articles that have subjects that are fuzzily
326 equal will be included."
328 :type '(choice (const :tag "off" nil)
332 (defcustom gnus-thread-indent-level 4
333 "*Number that says how much each sub-thread should be indented."
337 (defcustom gnus-auto-extend-newsgroup t
338 "*If non-nil, extend newsgroup forward and backward when requested."
339 :group 'gnus-summary-choose
342 (defcustom gnus-auto-select-first t
343 "If non-nil, select an article on group entry.
344 An article is selected automatically when entering a group
345 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
346 `gnus-summary-catchup-and-goto-next-group'.
348 Which article is selected is controlled by the variable
349 `gnus-auto-select-subject'.
351 If you want to prevent automatic selection of articles in some
352 newsgroups, set the variable to nil in `gnus-select-group-hook'."
353 ;; Commands include...
354 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
355 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
356 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
357 :group 'gnus-group-select
358 :type '(choice (const :tag "none" nil)
359 (sexp :menu-tag "first" t)))
361 (defcustom gnus-auto-select-subject 'unseen-or-unread
362 "*Says what subject to place under point when entering a group.
364 This variable can either be the symbols `first' (place point on the
365 first subject), `unread' (place point on the subject line of the first
366 unread article), `best' (place point on the subject line of the
367 higest-scored article), `unseen' (place point on the subject line of
368 the first unseen article), `unseen-or-unread' (place point on the subject
369 line of the first unseen article or, if all articles have been seen, on the
370 subject line of the first unread article), or a function to be called to
371 place point on some subject line."
373 :group 'gnus-group-select
374 :type '(choice (const best)
378 (const unseen-or-unread)
379 (function :tag "Function to call")))
381 (defcustom gnus-auto-select-next t
382 "*If non-nil, offer to go to the next group from the end of the previous.
383 If the value is t and the next newsgroup is empty, Gnus will exit
384 summary mode and go back to group mode. If the value is neither nil
385 nor t, Gnus will select the following unread newsgroup. In
386 particular, if the value is the symbol `quietly', the next unread
387 newsgroup will be selected without any confirmation, and if it is
388 `almost-quietly', the next group will be selected without any
389 confirmation if you are located on the last article in the group.
390 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
391 will go to the next group without confirmation."
392 :group 'gnus-summary-maneuvering
393 :type '(choice (const :tag "off" nil)
395 (const almost-quietly)
396 (const slightly-quietly)
397 (sexp :menu-tag "on" t)))
399 (defcustom gnus-auto-select-same nil
400 "*If non-nil, select the next article with the same subject.
401 If there are no more articles with the same subject, go to
402 the first unread article."
403 :group 'gnus-summary-maneuvering
406 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
407 "What article should be selected after exiting an ephemeral group.
408 Valid values include:
411 Select the next article.
413 Select the next unread article.
415 Move the cursor to the next article. This is the default.
416 `next-unread-noselect'
417 Move the cursor to the next unread article.
419 If it has any other value or there is no next (unread) article, the
420 article selected before entering to the ephemeral group will appear."
421 :version "23.1" ;; No Gnus
422 :group 'gnus-summary-maneuvering
423 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
424 (const next) (const next-unread)
425 (const next-noselect) (const next-unread-noselect)
426 (sexp :tag "other" :value nil)))
428 (defcustom gnus-auto-goto-ignores 'unfetched
429 "*Says how to handle unfetched articles when maneuvering.
431 This variable can either be the symbols nil (maneuver to any
432 article), `undownloaded' (maneuvering while unplugged ignores articles
433 that have not been fetched), `always-undownloaded' (maneuvering always
434 ignores articles that have not been fetched), `unfetched' (maneuvering
435 ignores articles whose headers have not been fetched).
437 NOTE: The list of unfetched articles will always be nil when plugged
438 and, when unplugged, a subset of the undownloaded article list."
440 :group 'gnus-summary-maneuvering
441 :type '(choice (const :tag "None" nil)
442 (const :tag "Undownloaded when unplugged" undownloaded)
443 (const :tag "Undownloaded" always-undownloaded)
444 (const :tag "Unfetched" unfetched)))
446 (defcustom gnus-summary-check-current nil
447 "*If non-nil, consider the current article when moving.
448 The \"unread\" movement commands will stay on the same line if the
449 current article is unread."
450 :group 'gnus-summary-maneuvering
453 (defcustom gnus-auto-center-summary 2
454 "*If non-nil, always center the current summary buffer.
455 In particular, if `vertical' do only vertical recentering. If non-nil
456 and non-`vertical', do both horizontal and vertical recentering."
457 :group 'gnus-summary-maneuvering
458 :type '(choice (const :tag "none" nil)
460 (integer :tag "height")
461 (sexp :menu-tag "both" t)))
463 (defcustom gnus-auto-center-group t
464 "If non-nil, always center the group buffer."
465 :group 'gnus-summary-maneuvering
468 (defcustom gnus-show-all-headers nil
469 "*If non-nil, don't hide any headers."
470 :group 'gnus-article-hiding
471 :group 'gnus-article-headers
474 (defcustom gnus-summary-ignore-duplicates nil
475 "*If non-nil, ignore articles with identical Message-ID headers."
479 (defcustom gnus-single-article-buffer nil
480 "*If non-nil, display all articles in the same buffer.
481 If nil, each group will get its own article buffer."
483 :group 'gnus-article-various
486 (defcustom gnus-widen-article-window nil
487 "If non-nil, selecting the article buffer will display only the article buffer."
489 :group 'gnus-article-various
492 (defcustom gnus-break-pages t
493 "*If non-nil, do page breaking on articles.
494 The page delimiter is specified by the `gnus-page-delimiter'
496 :group 'gnus-article-various
499 (defcustom gnus-move-split-methods nil
500 "*Variable used to suggest where articles are to be moved to.
501 It uses the same syntax as the `gnus-split-methods' variable.
502 However, whereas `gnus-split-methods' specifies file names as targets,
503 this variable specifies group names."
504 :group 'gnus-summary-mail
505 :type '(repeat (choice (list :value (fun) function)
506 (cons :value ("" "") regexp (repeat string))
509 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
510 "Function used to compute default prefix for article move/copy/etc prompts.
511 The function should take one argument, a group name, and return a
512 string with the suggested prefix."
513 :group 'gnus-summary-mail
516 ;; FIXME: Although the custom type is `character' for the following variables,
517 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
519 (defcustom gnus-unread-mark ? ;Whitespace
520 "*Mark used for unread articles."
521 :group 'gnus-summary-marks
524 (defcustom gnus-ticked-mark ?!
525 "*Mark used for ticked articles."
526 :group 'gnus-summary-marks
529 (defcustom gnus-dormant-mark ??
530 "*Mark used for dormant articles."
531 :group 'gnus-summary-marks
534 (defcustom gnus-del-mark ?r
535 "*Mark used for del'd articles."
536 :group 'gnus-summary-marks
539 (defcustom gnus-read-mark ?R
540 "*Mark used for read articles."
541 :group 'gnus-summary-marks
544 (defcustom gnus-expirable-mark ?E
545 "*Mark used for expirable articles."
546 :group 'gnus-summary-marks
549 (defcustom gnus-killed-mark ?K
550 "*Mark used for killed articles."
551 :group 'gnus-summary-marks
554 (defcustom gnus-spam-mark ?$
555 "*Mark used for spam articles."
557 :group 'gnus-summary-marks
560 (defcustom gnus-kill-file-mark ?X
561 "*Mark used for articles killed by kill files."
562 :group 'gnus-summary-marks
565 (defcustom gnus-low-score-mark ?Y
566 "*Mark used for articles with a low score."
567 :group 'gnus-summary-marks
570 (defcustom gnus-catchup-mark ?C
571 "*Mark used for articles that are caught up."
572 :group 'gnus-summary-marks
575 (defcustom gnus-replied-mark ?A
576 "*Mark used for articles that have been replied to."
577 :group 'gnus-summary-marks
580 (defcustom gnus-forwarded-mark ?F
581 "*Mark used for articles that have been forwarded."
583 :group 'gnus-summary-marks
586 (defcustom gnus-recent-mark ?N
587 "*Mark used for articles that are recent."
589 :group 'gnus-summary-marks
592 (defcustom gnus-cached-mark ?*
593 "*Mark used for articles that are in the cache."
594 :group 'gnus-summary-marks
597 (defcustom gnus-saved-mark ?S
598 "*Mark used for articles that have been saved."
599 :group 'gnus-summary-marks
602 (defcustom gnus-unseen-mark ?.
603 "*Mark used for articles that haven't been seen."
605 :group 'gnus-summary-marks
608 (defcustom gnus-no-mark ? ;Whitespace
609 "*Mark used for articles that have no other secondary mark."
611 :group 'gnus-summary-marks
614 (defcustom gnus-ancient-mark ?O
615 "*Mark used for ancient articles."
616 :group 'gnus-summary-marks
619 (defcustom gnus-sparse-mark ?Q
620 "*Mark used for sparsely reffed articles."
621 :group 'gnus-summary-marks
624 (defcustom gnus-canceled-mark ?G
625 "*Mark used for canceled articles."
626 :group 'gnus-summary-marks
629 (defcustom gnus-duplicate-mark ?M
630 "*Mark used for duplicate articles."
631 :group 'gnus-summary-marks
634 (defcustom gnus-undownloaded-mark ?-
635 "*Mark used for articles that weren't downloaded."
637 :group 'gnus-summary-marks
640 (defcustom gnus-downloaded-mark ?+
641 "*Mark used for articles that were downloaded."
642 :group 'gnus-summary-marks
645 (defcustom gnus-downloadable-mark ?%
646 "*Mark used for articles that are to be downloaded."
647 :group 'gnus-summary-marks
650 (defcustom gnus-unsendable-mark ?=
651 "*Mark used for articles that won't be sent."
652 :group 'gnus-summary-marks
655 (defcustom gnus-score-over-mark ?+
656 "*Score mark used for articles with high scores."
657 :group 'gnus-summary-marks
660 (defcustom gnus-score-below-mark ?-
661 "*Score mark used for articles with low scores."
662 :group 'gnus-summary-marks
665 (defcustom gnus-empty-thread-mark ? ;Whitespace
666 "*There is no thread under the article."
667 :group 'gnus-summary-marks
670 (defcustom gnus-not-empty-thread-mark ?=
671 "*There is a thread under the article."
672 :group 'gnus-summary-marks
675 (defcustom gnus-view-pseudo-asynchronously nil
676 "*If non-nil, Gnus will view pseudo-articles asynchronously."
677 :group 'gnus-extract-view
680 (defcustom gnus-auto-expirable-marks
681 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
682 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
684 "*The list of marks converted into expiration if a group is auto-expirable."
687 :type '(repeat character))
689 (defcustom gnus-inhibit-user-auto-expire t
690 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
695 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
696 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
697 If nil, the expirable marks will be unchanged except that the marks
698 will be removed when copying or moving articles to a group that has
699 not turned auto-expire on. If non-nil, articles that have been read
700 will be marked as expirable when being copied or moved to a group in
701 which auto-expire is turned on."
704 :group 'gnus-summary-marks)
706 (defcustom gnus-view-pseudos nil
707 "*If `automatic', pseudo-articles will be viewed automatically.
708 If `not-confirm', pseudos will be viewed automatically, and the user
709 will not be asked to confirm the command."
710 :group 'gnus-extract-view
711 :type '(choice (const :tag "off" nil)
713 (const not-confirm)))
715 (defcustom gnus-view-pseudos-separately t
716 "*If non-nil, one pseudo-article will be created for each file to be viewed.
717 If nil, all files that use the same viewing command will be given as a
718 list of parameters to that command."
719 :group 'gnus-extract-view
722 (defcustom gnus-insert-pseudo-articles t
723 "*If non-nil, insert pseudo-articles when decoding articles."
724 :group 'gnus-extract-view
727 (defcustom gnus-summary-dummy-line-format
729 "*The format specification for the dummy roots in the summary buffer.
730 It works along the same lines as a normal formatting string,
731 with some simple extensions.
735 General format specifiers can also be used.
736 See `(gnus)Formatting Variables'."
737 :link '(custom-manual "(gnus)Formatting Variables")
738 :group 'gnus-threading
741 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
742 "*The format specification for the summary mode line.
743 It works along the same lines as a normal formatting string,
744 with some simple extensions:
747 %p Unprefixed group name
748 %A Current article number
749 %z Current article score
751 %U Number of unread articles in the group
752 %e Number of unselected articles in the group
753 %Z A string with unread/unselected article counts
754 %g Shortish group name
755 %S Subject of the current article
757 %s Current score file name
758 %d Number of dormant articles
759 %r Number of articles that have been marked as read in this session
760 %E Number of articles expunged by the score files"
761 :group 'gnus-summary-format
764 (defcustom gnus-list-identifiers nil
765 "Regexp that matches list identifiers to be removed from subject.
766 This can also be a list of regexps."
768 :group 'gnus-summary-format
769 :group 'gnus-article-hiding
770 :type '(choice (const :tag "none" nil)
772 (repeat :value (".*") regexp)))
774 (defcustom gnus-summary-mark-below 0
775 "*Mark all articles with a score below this variable as read.
776 This variable is local to each summary buffer and usually set by the
778 :group 'gnus-score-default
781 (defun gnus-widget-reversible-match (widget value)
782 "Ignoring WIDGET, convert VALUE to internal form.
783 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
787 (eq (length value) 2)
788 (eq (nth 0 value) 'not)
789 (symbolp (nth 1 value)))))
791 (defun gnus-widget-reversible-to-internal (widget value)
792 "Ignoring WIDGET, convert VALUE to internal form.
793 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
794 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
798 (list (nth 1 value) t)))
800 (defun gnus-widget-reversible-to-external (widget value)
801 "Ignoring WIDGET, convert VALUE to external form.
802 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
803 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
806 (list 'not (nth 0 value))
809 (define-widget 'gnus-widget-reversible 'group
810 "A `group' that convert values."
811 :match 'gnus-widget-reversible-match
812 :value-to-internal 'gnus-widget-reversible-to-internal
813 :value-to-external 'gnus-widget-reversible-to-external)
815 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
816 "*List of functions used for sorting articles in the summary buffer.
818 Each function takes two articles and returns non-nil if the first
819 article should be sorted before the other. If you use more than one
820 function, the primary sort function should be the last. You should
821 probably always include `gnus-article-sort-by-number' in the list of
822 sorting functions -- preferably first. Also note that sorting by date
823 is often much slower than sorting by number, and the sorting order is
824 very similar. (Sorting by date means sorting by the time the message
825 was sent, sorting by number means sorting by arrival time.)
827 Each item can also be a list `(not F)' where F is a function;
828 this reverses the sort order.
830 Ready-made functions include `gnus-article-sort-by-number',
831 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
832 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
833 and `gnus-article-sort-by-score'.
835 When threading is turned on, the variable `gnus-thread-sort-functions'
836 controls how articles are sorted."
837 :group 'gnus-summary-sort
838 :type '(repeat (gnus-widget-reversible
839 (choice (function-item gnus-article-sort-by-number)
840 (function-item gnus-article-sort-by-author)
841 (function-item gnus-article-sort-by-subject)
842 (function-item gnus-article-sort-by-date)
843 (function-item gnus-article-sort-by-score)
844 (function-item gnus-article-sort-by-random)
845 (function :tag "other"))
846 (boolean :tag "Reverse order"))))
849 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
850 "*List of functions used for sorting threads in the summary buffer.
851 By default, threads are sorted by article number.
853 Each function takes two threads and returns non-nil if the first
854 thread should be sorted before the other. If you use more than one
855 function, the primary sort function should be the last. You should
856 probably always include `gnus-thread-sort-by-number' in the list of
857 sorting functions -- preferably first. Also note that sorting by date
858 is often much slower than sorting by number, and the sorting order is
859 very similar. (Sorting by date means sorting by the time the message
860 was sent, sorting by number means sorting by arrival time.)
862 Each list item can also be a list `(not F)' where F is a
863 function; this specifies reversed sort order.
865 Ready-made functions include `gnus-thread-sort-by-number',
866 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
867 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
868 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
869 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
870 and `gnus-thread-sort-by-total-score' (see
871 `gnus-thread-score-function').
873 When threading is turned off, the variable
874 `gnus-article-sort-functions' controls how articles are sorted."
875 :group 'gnus-summary-sort
877 (gnus-widget-reversible
878 (choice (function-item gnus-thread-sort-by-number)
879 (function-item gnus-thread-sort-by-author)
880 (function-item gnus-thread-sort-by-recipient)
881 (function-item gnus-thread-sort-by-subject)
882 (function-item gnus-thread-sort-by-date)
883 (function-item gnus-thread-sort-by-score)
884 (function-item gnus-thread-sort-by-most-recent-number)
885 (function-item gnus-thread-sort-by-most-recent-date)
886 (function-item gnus-thread-sort-by-random)
887 (function-item gnus-thread-sort-by-total-score)
888 (function :tag "other"))
889 (boolean :tag "Reverse order"))))
891 (defcustom gnus-thread-score-function '+
892 "*Function used for calculating the total score of a thread.
894 The function is called with the scores of the article and each
895 subthread and should then return the score of the thread.
897 Some functions you can use are `+', `max', or `min'."
898 :group 'gnus-summary-sort
901 (defcustom gnus-summary-expunge-below nil
902 "All articles that have a score less than this variable will be expunged.
903 This variable is local to the summary buffers."
904 :group 'gnus-score-default
905 :type '(choice (const :tag "off" nil)
908 (defcustom gnus-thread-expunge-below nil
909 "All threads that have a total score less than this variable will be expunged.
910 See `gnus-thread-score-function' for en explanation of what a
913 This variable is local to the summary buffers."
914 :group 'gnus-threading
915 :group 'gnus-score-default
916 :type '(choice (const :tag "off" nil)
919 (defcustom gnus-summary-mode-hook nil
920 "*A hook for Gnus summary mode.
921 This hook is run before any variables are set in the summary buffer."
922 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
923 :group 'gnus-summary-various
926 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
927 (when (featurep 'xemacs)
928 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
929 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
930 (add-hook 'gnus-summary-mode-hook
931 'gnus-xmas-switch-horizontal-scrollbar-off))
933 (defcustom gnus-summary-menu-hook nil
934 "*Hook run after the creation of the summary mode menu."
935 :group 'gnus-summary-visual
938 (defcustom gnus-summary-exit-hook nil
939 "*A hook called on exit from the summary buffer.
940 It will be called with point in the group buffer."
941 :group 'gnus-summary-exit
944 (defcustom gnus-summary-prepare-hook nil
945 "*A hook called after the summary buffer has been generated.
946 If you want to modify the summary buffer, you can use this hook."
947 :group 'gnus-summary-various
950 (defcustom gnus-summary-prepared-hook nil
951 "*A hook called as the last thing after the summary buffer has been generated."
952 :group 'gnus-summary-various
955 (defcustom gnus-summary-generate-hook nil
956 "*A hook run just before generating the summary buffer.
957 This hook is commonly used to customize threading variables and the
959 :group 'gnus-summary-various
962 (defcustom gnus-select-group-hook nil
963 "*A hook called when a newsgroup is selected.
965 If you'd like to simplify subjects like the
966 `gnus-summary-next-same-subject' command does, you can use the
969 (add-hook gnus-select-group-hook
971 (mapcar (lambda (header)
972 (mail-header-set-subject
974 (gnus-simplify-subject
975 (mail-header-subject header) 're-only)))
976 gnus-newsgroup-headers)))"
977 :group 'gnus-group-select
980 (defcustom gnus-select-article-hook nil
981 "*A hook called when an article is selected."
982 :group 'gnus-summary-choose
983 :options '(gnus-agent-fetch-selected-article)
986 (defcustom gnus-visual-mark-article-hook
987 (list 'gnus-highlight-selected-summary)
988 "*Hook run after selecting an article in the summary buffer.
989 It is meant to be used for highlighting the article in some way. It
990 is not run if `gnus-visual' is nil."
991 :group 'gnus-summary-visual
994 (defcustom gnus-parse-headers-hook nil
995 "*A hook called before parsing the headers."
999 (defcustom gnus-exit-group-hook nil
1000 "*A hook called when exiting summary mode.
1001 This hook is not called from the non-updating exit commands like `Q'."
1002 :group 'gnus-various
1005 (defcustom gnus-summary-update-hook nil
1006 "*A hook called when a summary line is changed.
1007 The hook will not be called if `gnus-visual' is nil.
1009 The default function `gnus-summary-highlight-line' will
1010 highlight the line according to the `gnus-summary-highlight'
1012 :group 'gnus-summary-visual
1015 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
1016 "*A hook called when an article is selected for the first time.
1017 The hook is intended to mark an article as read (or unread)
1018 automatically when it is selected."
1019 :group 'gnus-summary-choose
1022 (defcustom gnus-group-no-more-groups-hook nil
1023 "*A hook run when returning to group mode having no more (unread) groups."
1024 :group 'gnus-group-select
1027 (defcustom gnus-ps-print-hook nil
1028 "*A hook run before ps-printing something from Gnus."
1029 :group 'gnus-summary
1032 (defcustom gnus-summary-article-move-hook nil
1033 "*A hook called after an article is moved, copied, respooled, or crossposted."
1035 :group 'gnus-summary
1038 (defcustom gnus-summary-article-delete-hook nil
1039 "*A hook called after an article is deleted."
1041 :group 'gnus-summary
1044 (defcustom gnus-summary-article-expire-hook nil
1045 "*A hook called after an article is expired."
1047 :group 'gnus-summary
1050 (defcustom gnus-summary-display-arrow
1051 (and (fboundp 'display-graphic-p)
1052 (display-graphic-p))
1053 "*If non-nil, display an arrow highlighting the current article."
1055 :group 'gnus-summary
1058 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1059 "Face used for highlighting the current article in the summary buffer."
1060 :group 'gnus-summary-visual
1063 (defvar gnus-tmp-downloaded nil)
1065 (defcustom gnus-summary-highlight
1066 '(((eq mark gnus-canceled-mark)
1067 . gnus-summary-cancelled)
1068 ((and uncached (> score default-high))
1069 . gnus-summary-high-undownloaded)
1070 ((and uncached (< score default-low))
1071 . gnus-summary-low-undownloaded)
1073 . gnus-summary-normal-undownloaded)
1074 ((and (> score default-high)
1075 (or (eq mark gnus-dormant-mark)
1076 (eq mark gnus-ticked-mark)))
1077 . gnus-summary-high-ticked)
1078 ((and (< score default-low)
1079 (or (eq mark gnus-dormant-mark)
1080 (eq mark gnus-ticked-mark)))
1081 . gnus-summary-low-ticked)
1082 ((or (eq mark gnus-dormant-mark)
1083 (eq mark gnus-ticked-mark))
1084 . gnus-summary-normal-ticked)
1085 ((and (> score default-high) (eq mark gnus-ancient-mark))
1086 . gnus-summary-high-ancient)
1087 ((and (< score default-low) (eq mark gnus-ancient-mark))
1088 . gnus-summary-low-ancient)
1089 ((eq mark gnus-ancient-mark)
1090 . gnus-summary-normal-ancient)
1091 ((and (> score default-high) (eq mark gnus-unread-mark))
1092 . gnus-summary-high-unread)
1093 ((and (< score default-low) (eq mark gnus-unread-mark))
1094 . gnus-summary-low-unread)
1095 ((eq mark gnus-unread-mark)
1096 . gnus-summary-normal-unread)
1097 ((> score default-high)
1098 . gnus-summary-high-read)
1099 ((< score default-low)
1100 . gnus-summary-low-read)
1102 . gnus-summary-normal-read))
1103 "*Controls the highlighting of summary buffer lines.
1105 A list of (FORM . FACE) pairs. When deciding how a particular
1106 summary line should be displayed, each form is evaluated. The content
1107 of the face field after the first true form is used. You can change
1108 how those summary lines are displayed, by editing the face field.
1110 You can use the following variables in the FORM field.
1112 score: The article's score.
1113 default: The default article score.
1114 default-high: The default score for high scored articles.
1115 default-low: The default score for low scored articles.
1116 below: The score below which articles are automatically marked as read.
1117 mark: The article's mark.
1118 uncached: Non-nil if the article is uncached."
1119 :group 'gnus-summary-visual
1120 :type '(repeat (cons (sexp :tag "Form" nil)
1122 (put 'gnus-summary-highlight 'risky-local-variable t)
1124 (defcustom gnus-alter-header-function nil
1125 "Function called to allow alteration of article header structures.
1126 The function is called with one parameter, the article header vector,
1127 which it may alter in any way."
1128 :type '(choice (const :tag "None" nil)
1130 :group 'gnus-summary)
1132 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1133 "Function used to decode a string with encoded words.")
1135 (defvar gnus-decode-encoded-address-function
1136 'mail-decode-encoded-address-string
1137 "Function used to decode addresses with encoded words.")
1139 (defcustom gnus-extra-headers '(To Cc Keywords Gcc Newsgroups)
1140 "*Extra headers to parse."
1141 :version "24.1" ; added Cc Keywords Gcc
1142 :group 'gnus-summary
1143 :type '(repeat symbol))
1145 (defcustom gnus-ignored-from-addresses
1146 (and user-mail-address
1147 (not (string= user-mail-address ""))
1148 (regexp-quote user-mail-address))
1149 "*From headers that may be suppressed in favor of To headers.
1150 This can be a regexp or a list of regexps."
1152 :group 'gnus-summary
1153 :type '(choice regexp
1154 (repeat :tag "Regexp List" regexp)))
1156 (defsubst gnus-ignored-from-addresses ()
1157 (gmm-regexp-concat gnus-ignored-from-addresses))
1159 (defcustom gnus-summary-to-prefix "-> "
1160 "*String prefixed to the To field in the summary line when
1161 using `gnus-ignored-from-addresses'."
1163 :group 'gnus-summary
1166 (defcustom gnus-summary-newsgroup-prefix "=> "
1167 "*String prefixed to the Newsgroup field in the summary
1168 line when using `gnus-ignored-from-addresses'."
1170 :group 'gnus-summary
1173 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1174 "List of charsets that should be ignored.
1175 When these charsets are used in the \"charset\" parameter, the
1176 default charset will be used instead."
1178 :type '(repeat symbol)
1179 :group 'gnus-charset)
1181 (defcustom gnus-newsgroup-maximum-articles nil
1182 "The maximum number of articles a newsgroup.
1183 If this is a number, old articles in a newsgroup exceeding this number
1184 are silently ignored. If it is nil, no article is ignored. Note that
1185 setting this variable to a number might prevent you from reading very
1187 :group 'gnus-group-select
1189 :type '(choice (const :tag "No limit" nil)
1192 (gnus-define-group-parameter
1196 "Return the ignored charsets of GROUP."
1197 :variable gnus-group-ignored-charsets-alist
1199 '(("alt\\.chinese\\.text" iso-8859-1))
1201 "Alist of regexps (to match group names) and charsets that should be ignored.
1202 When these charsets are used in the \"charset\" parameter, the
1203 default charset will be used instead."
1204 :variable-group gnus-charset
1205 :variable-type '(repeat (cons (regexp :tag "Group")
1207 :parameter-type '(choice :tag "Ignored charsets"
1210 :parameter-document "\
1211 List of charsets that should be ignored.
1213 When these charsets are used in the \"charset\" parameter, the
1214 default charset will be used instead.")
1216 (defcustom gnus-group-highlight-words-alist nil
1217 "Alist of group regexps and highlight regexps.
1218 This variable uses the same syntax as `gnus-emphasis-alist'."
1220 :type '(repeat (cons (regexp :tag "Group")
1221 (repeat (list (regexp :tag "Highlight regexp")
1222 (number :tag "Group for entire word" 0)
1223 (number :tag "Group for displayed part" 0)
1225 gnus-emphasis-highlight-words)))))
1226 :group 'gnus-summary-visual)
1228 (defcustom gnus-summary-show-article-charset-alist
1230 "Alist of number and charset.
1231 The article will be shown with the charset corresponding to the
1233 For example: ((1 . cn-gb-2312) (2 . big5))."
1235 :type '(repeat (cons (number :tag "Argument" 1)
1236 (symbol :tag "Charset")))
1237 :group 'gnus-charset)
1239 (defcustom gnus-preserve-marks t
1240 "Whether marks are preserved when moving, copying and respooling messages."
1243 :group 'gnus-summary-marks)
1245 (defcustom gnus-propagate-marks nil
1246 "If non-nil, Gnus will store and retrieve marks from the backends.
1247 This means that marks will be stored both in .newsrc.eld and in
1248 the backend, and will slow operation down somewhat."
1250 :group 'gnus-summary-marks)
1252 (defcustom gnus-alter-articles-to-read-function nil
1253 "Function to be called to alter the list of articles to be selected."
1254 :type '(choice (const nil) function)
1255 :group 'gnus-summary)
1257 (defcustom gnus-orphan-score nil
1258 "*All orphans get this score added. Set in the score file."
1259 :group 'gnus-score-default
1260 :type '(choice (const nil)
1263 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1264 "*A regexp to match MIME parts when saving multiple parts of a
1265 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1266 This regexp will be used by default when prompting the user for which
1267 type of files to save."
1268 :group 'gnus-summary
1271 (defcustom gnus-read-all-available-headers nil
1272 "Whether Gnus should parse all headers made available to it.
1273 This is mostly relevant for slow back ends where the user may
1274 wish to widen the summary buffer to include all headers
1277 :group 'gnus-summary
1278 :type '(choice boolean regexp))
1280 (defcustom gnus-summary-pipe-output-default-command nil
1281 "Command (and optional arguments) used to pipe article to subprocess.
1282 This will be used as the default command if it is non-nil. The value
1283 will be updated if you modify it when executing the command
1284 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1285 :version "23.1" ;; No Gnus
1286 :group 'gnus-summary
1287 :type '(radio (const :tag "None" nil) (string :tag "Command")))
1289 (defcustom gnus-summary-muttprint-program "muttprint"
1290 "Command (and optional arguments) used to run Muttprint.
1291 The value will be updated if you modify it when executing the command
1292 `gnus-summary-muttprint'."
1294 :group 'gnus-summary
1297 (defcustom gnus-article-loose-mime t
1298 "If non-nil, don't require MIME-Version header.
1299 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1300 supply the MIME-Version header or deliberately strip it from the mail.
1301 If non-nil (the default), Gnus will treat some articles as MIME
1302 even if the MIME-Version header is missing."
1305 :group 'gnus-article-mime)
1307 (defcustom gnus-article-emulate-mime t
1308 "If non-nil, use MIME emulation for uuencode and the like.
1309 This means that Gnus will search message bodies for text that look
1310 like uuencoded bits, yEncoded bits, and so on, and present that using
1311 the normal Gnus MIME machinery."
1314 :group 'gnus-article-mime)
1316 ;;; Internal variables
1318 (defvar gnus-summary-display-cache nil)
1319 (defvar gnus-article-mime-handles nil)
1320 (defvar gnus-article-decoded-p nil)
1321 (defvar gnus-article-charset nil)
1322 (defvar gnus-article-ignored-charsets nil)
1323 (defvar gnus-scores-exclude-files nil)
1324 (defvar gnus-page-broken nil)
1326 (defvar gnus-original-article nil)
1327 (defvar gnus-article-internal-prepare-hook nil)
1328 (defvar gnus-newsgroup-process-stack nil)
1330 (defvar gnus-thread-indent-array nil)
1331 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1332 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1333 "Function called to sort the articles within a thread after it has been gathered together.")
1335 (defvar gnus-summary-save-parts-type-history nil)
1336 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1338 ;; Avoid highlighting in kill files.
1339 (defvar gnus-summary-inhibit-highlight nil)
1340 (defvar gnus-newsgroup-selected-overlay nil)
1341 (defvar gnus-inhibit-limiting nil)
1342 (defvar gnus-newsgroup-adaptive-score-file nil)
1343 (defvar gnus-current-score-file nil)
1344 (defvar gnus-current-move-group nil)
1345 (defvar gnus-current-copy-group nil)
1346 (defvar gnus-current-crosspost-group nil)
1347 (defvar gnus-newsgroup-display nil)
1349 (defvar gnus-newsgroup-dependencies nil)
1350 (defvar gnus-newsgroup-adaptive nil)
1351 (defvar gnus-summary-display-article-function nil)
1352 (defvar gnus-summary-highlight-line-function nil
1353 "Function called after highlighting a summary line.")
1355 (defvar gnus-summary-line-format-alist
1356 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1357 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1358 (?s gnus-tmp-subject-or-nil ?s)
1359 (?n gnus-tmp-name ?s)
1360 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1362 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1364 (?F gnus-tmp-from ?s)
1365 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1366 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1367 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1368 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1369 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1370 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1371 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1372 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1373 (?L gnus-tmp-lines ?s)
1374 (?Z (or ,(gnus-macroexpand-all
1375 '(nnir-article-rsv (mail-header-number gnus-tmp-header)))
1377 (?G (or ,(gnus-macroexpand-all
1378 '(nnir-article-group (mail-header-number gnus-tmp-header)))
1380 (?g (or ,(gnus-macroexpand-all
1381 '(gnus-group-short-name
1382 (nnir-article-group (mail-header-number gnus-tmp-header))))
1384 (?O gnus-tmp-downloaded ?c)
1385 (?I gnus-tmp-indentation ?s)
1386 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1387 (?R gnus-tmp-replied ?c)
1388 (?\[ gnus-tmp-opening-bracket ?c)
1389 (?\] gnus-tmp-closing-bracket ?c)
1390 (?\> (make-string gnus-tmp-level ? ) ?s)
1391 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1392 (?i gnus-tmp-score ?d)
1393 (?z gnus-tmp-score-char ?c)
1394 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1395 (?U gnus-tmp-unread ?c)
1396 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1398 (?t (gnus-summary-number-of-articles-in-thread
1399 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1401 (?e (gnus-summary-number-of-articles-in-thread
1402 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1404 (?u gnus-tmp-user-defined ?s)
1405 (?P (gnus-pick-line-number) ?d)
1406 (?B gnus-tmp-thread-tree-header-string ?s)
1407 (user-date (gnus-user-date
1408 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1409 "An alist of format specifications that can appear in summary lines.
1410 These are paired with what variables they correspond with, along with
1411 the type of the variable (string, integer, character, etc).")
1413 (defvar gnus-summary-dummy-line-format-alist
1414 `((?S gnus-tmp-subject ?s)
1415 (?N gnus-tmp-number ?d)
1416 (?u gnus-tmp-user-defined ?s)))
1418 (defvar gnus-summary-mode-line-format-alist
1419 `((?G gnus-tmp-group-name ?s)
1420 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1421 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1422 (?A gnus-tmp-article-number ?d)
1423 (?Z gnus-tmp-unread-and-unselected ?s)
1424 (?V gnus-version ?s)
1425 (?U gnus-tmp-unread-and-unticked ?d)
1426 (?S gnus-tmp-subject ?s)
1427 (?e gnus-tmp-unselected ?d)
1428 (?u gnus-tmp-user-defined ?s)
1429 (?d (length gnus-newsgroup-dormant) ?d)
1430 (?t (length gnus-newsgroup-marked) ?d)
1431 (?h (length gnus-newsgroup-spam-marked) ?d)
1432 (?r (length gnus-newsgroup-reads) ?d)
1433 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1434 (?E gnus-newsgroup-expunged-tally ?d)
1435 (?s (gnus-current-score-file-nondirectory) ?s)))
1437 ;; This is here rather than in gnus-art for compilation reasons.
1438 (defvar gnus-article-mode-line-format-alist
1439 (nconc '((?w (gnus-article-wash-status) ?s)
1440 (?m (gnus-article-mime-part-status) ?s))
1441 gnus-summary-mode-line-format-alist))
1443 (defvar gnus-last-search-regexp nil
1444 "Default regexp for article search command.")
1446 (defvar gnus-last-shell-command nil
1447 "Default shell command on article.")
1449 (defvar gnus-newsgroup-agentized nil
1450 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1451 (defvar gnus-newsgroup-begin nil)
1452 (defvar gnus-newsgroup-end nil)
1453 (defvar gnus-newsgroup-last-rmail nil)
1454 (defvar gnus-newsgroup-last-mail nil)
1455 (defvar gnus-newsgroup-last-folder nil)
1456 (defvar gnus-newsgroup-last-file nil)
1457 (defvar gnus-newsgroup-last-directory nil)
1458 (defvar gnus-newsgroup-auto-expire nil)
1459 (defvar gnus-newsgroup-active nil)
1460 (defvar gnus-newsgroup-highest nil)
1462 (defvar gnus-newsgroup-data nil)
1463 (defvar gnus-newsgroup-data-reverse nil)
1464 (defvar gnus-newsgroup-limit nil)
1465 (defvar gnus-newsgroup-limits nil)
1466 (defvar gnus-summary-use-undownloaded-faces nil)
1468 (defvar gnus-newsgroup-unreads nil
1469 "Sorted list of unread articles in the current newsgroup.")
1471 (defvar gnus-newsgroup-unselected nil
1472 "Sorted list of unselected unread articles in the current newsgroup.")
1474 (defvar gnus-newsgroup-reads nil
1475 "Alist of read articles and article marks in the current newsgroup.")
1477 (defvar gnus-newsgroup-expunged-tally nil)
1479 (defvar gnus-newsgroup-marked nil
1480 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1482 (defvar gnus-newsgroup-spam-marked nil
1483 "List of ranges of articles that have been marked as spam.")
1485 (defvar gnus-newsgroup-killed nil
1486 "List of ranges of articles that have been through the scoring process.")
1488 (defvar gnus-newsgroup-cached nil
1489 "Sorted list of articles that come from the article cache.")
1491 (defvar gnus-newsgroup-saved nil
1492 "List of articles that have been saved.")
1494 (defvar gnus-newsgroup-kill-headers nil)
1496 (defvar gnus-newsgroup-replied nil
1497 "List of articles that have been replied to in the current newsgroup.")
1499 (defvar gnus-newsgroup-forwarded nil
1500 "List of articles that have been forwarded in the current newsgroup.")
1502 (defvar gnus-newsgroup-recent nil
1503 "List of articles that have are recent in the current newsgroup.")
1505 (defvar gnus-newsgroup-expirable nil
1506 "Sorted list of articles in the current newsgroup that can be expired.")
1508 (defvar gnus-newsgroup-processable nil
1509 "List of articles in the current newsgroup that can be processed.")
1511 (defvar gnus-newsgroup-downloadable nil
1512 "Sorted list of articles in the current newsgroup that can be processed.")
1514 (defvar gnus-newsgroup-unfetched nil
1515 "Sorted list of articles in the current newsgroup whose headers have
1516 not been fetched into the agent.
1518 This list will always be a subset of gnus-newsgroup-undownloaded.")
1520 (defvar gnus-newsgroup-undownloaded nil
1521 "List of articles in the current newsgroup that haven't been downloaded.")
1523 (defvar gnus-newsgroup-unsendable nil
1524 "List of articles in the current newsgroup that won't be sent.")
1526 (defvar gnus-newsgroup-bookmarks nil
1527 "List of articles in the current newsgroup that have bookmarks.")
1529 (defvar gnus-newsgroup-dormant nil
1530 "Sorted list of dormant articles in the current newsgroup.")
1532 (defvar gnus-newsgroup-unseen nil
1533 "List of unseen articles in the current newsgroup.")
1535 (defvar gnus-newsgroup-seen nil
1536 "Range of seen articles in the current newsgroup.")
1538 (defvar gnus-newsgroup-articles nil
1539 "List of articles in the current newsgroup.")
1541 (defvar gnus-newsgroup-scored nil
1542 "List of scored articles in the current newsgroup.")
1544 (defvar gnus-newsgroup-headers nil
1545 "List of article headers in the current newsgroup.")
1547 (defvar gnus-newsgroup-threads nil)
1549 (defvar gnus-newsgroup-prepared nil
1550 "Whether the current group has been prepared properly.")
1552 (defvar gnus-newsgroup-ancient nil
1553 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1555 (defvar gnus-newsgroup-sparse nil)
1557 (defvar gnus-current-article nil)
1558 (defvar gnus-article-current nil)
1559 (defvar gnus-current-headers nil)
1560 (defvar gnus-have-all-headers nil)
1561 (defvar gnus-last-article nil)
1562 (defvar gnus-newsgroup-history nil)
1563 (defvar gnus-newsgroup-charset nil)
1564 (defvar gnus-newsgroup-ephemeral-charset nil)
1565 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1567 (defvar gnus-article-before-search nil)
1569 (defvar gnus-summary-local-variables
1570 '(gnus-newsgroup-name
1573 gnus-newsgroup-unreads
1574 gnus-newsgroup-unselected
1575 gnus-newsgroup-marked
1576 gnus-newsgroup-spam-marked
1577 gnus-newsgroup-reads
1578 gnus-newsgroup-saved
1579 gnus-newsgroup-replied
1580 gnus-newsgroup-forwarded
1581 gnus-newsgroup-recent
1582 gnus-newsgroup-expirable
1583 gnus-newsgroup-killed
1584 gnus-newsgroup-unseen
1586 gnus-newsgroup-cached
1587 gnus-newsgroup-downloadable
1588 gnus-newsgroup-undownloaded
1589 gnus-newsgroup-unsendable
1591 gnus-newsgroup-begin gnus-newsgroup-end
1592 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1593 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1594 gnus-newsgroup-last-directory
1595 gnus-newsgroup-auto-expire
1596 gnus-newsgroup-processable
1597 gnus-newsgroup-unfetched
1598 gnus-newsgroup-articles
1599 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1600 gnus-newsgroup-headers gnus-newsgroup-threads
1601 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1602 gnus-current-article gnus-current-headers gnus-have-all-headers
1603 gnus-last-article gnus-article-internal-prepare-hook
1604 (gnus-summary-article-delete-hook . global)
1605 (gnus-summary-article-move-hook . global)
1606 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1607 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1608 gnus-thread-expunge-below
1609 gnus-score-alist gnus-current-score-file
1610 (gnus-summary-expunge-below . global)
1611 (gnus-summary-mark-below . global)
1612 (gnus-orphan-score . global)
1613 gnus-newsgroup-active gnus-scores-exclude-files
1614 gnus-newsgroup-highest
1615 gnus-newsgroup-history gnus-newsgroup-ancient
1616 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1617 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1618 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1619 (gnus-newsgroup-expunged-tally . 0)
1620 gnus-cache-removable-articles
1621 gnus-newsgroup-data gnus-newsgroup-data-reverse
1622 gnus-newsgroup-limit gnus-newsgroup-limits
1623 gnus-newsgroup-charset gnus-newsgroup-display
1624 gnus-summary-use-undownloaded-faces)
1625 "Variables that are buffer-local to the summary buffers.")
1627 (defvar gnus-newsgroup-variables nil
1628 "A list of variables that have separate values in different newsgroups.
1629 A list of newsgroup (summary buffer) local variables, or cons of
1630 variables and their default expressions to be evalled (when the default
1631 values are not nil), that should be made global while the summary buffer
1634 Note: The default expressions will be evaluated (using function `eval')
1635 before assignment to the local variable rather than just assigned to it.
1636 If the default expression is the symbol `global', that symbol will not
1637 be evaluated but the global value of the local variable will be used
1640 These variables can be used to set variables in the group parameters
1641 while still allowing them to affect operations done in other buffers.
1644 \(setq gnus-newsgroup-variables
1645 '(message-use-followup-to
1646 (gnus-visible-headers .
1647 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1651 ;; Bind features so that require will believe that gnus-sum has
1652 ;; already been loaded (avoids infinite recursion)
1653 (let ((features (cons 'gnus-sum features)))
1654 (require 'gnus-art)))
1658 (defvar gnus-decode-encoded-word-methods
1659 '(mail-decode-encoded-word-string)
1660 "List of methods used to decode encoded words.
1662 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1663 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1664 \(REGEXP . FUNCTION), FUNCTION will be only apply to thes newsgroups
1665 whose names match REGEXP.
1668 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1669 mail-decode-encoded-word-string
1670 (\"chinese\" . rfc1843-decode-string))")
1672 (defvar gnus-decode-encoded-word-methods-cache nil)
1674 (defun gnus-multi-decode-encoded-word-string (string)
1675 "Apply the functions from `gnus-encoded-word-methods' that match."
1676 (unless (and gnus-decode-encoded-word-methods-cache
1677 (eq gnus-newsgroup-name
1678 (car gnus-decode-encoded-word-methods-cache)))
1679 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1680 (dolist (method gnus-decode-encoded-word-methods)
1681 (if (symbolp method)
1682 (nconc gnus-decode-encoded-word-methods-cache (list method))
1683 (if (and gnus-newsgroup-name
1684 (string-match (car method) gnus-newsgroup-name))
1685 (nconc gnus-decode-encoded-word-methods-cache
1686 (list (cdr method)))))))
1687 (dolist (method (cdr gnus-decode-encoded-word-methods-cache) string)
1688 (setq string (funcall method string))))
1690 ;; Subject simplification.
1692 (defun gnus-simplify-whitespace (str)
1693 "Remove excessive whitespace from STR."
1695 (while (string-match "[ \t][ \t]+" str)
1696 (setq str (concat (substring str 0 (match-beginning 0))
1698 (substring str (match-end 0)))))
1700 (when (string-match "^[ \t]+" str)
1701 (setq str (substring str (match-end 0))))
1703 (when (string-match "[ \t]+$" str)
1704 (setq str (substring str 0 (match-beginning 0))))
1707 (defun gnus-simplify-all-whitespace (str)
1708 "Remove all whitespace from STR."
1709 (while (string-match "[ \t\n]+" str)
1710 (setq str (replace-match "" nil nil str)))
1713 (defsubst gnus-simplify-subject-re (subject)
1714 "Remove \"Re:\" from subject lines."
1715 (if (string-match message-subject-re-regexp subject)
1716 (substring subject (match-end 0))
1719 (defun gnus-simplify-subject (subject &optional re-only)
1720 "Remove `Re:' and words in parentheses.
1721 If RE-ONLY is non-nil, strip leading `Re:'s only."
1722 (let ((case-fold-search t)) ;Ignore case.
1723 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1724 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1725 (setq subject (substring subject (match-end 0))))
1726 ;; Remove uninteresting prefixes.
1727 (when (and (not re-only)
1728 gnus-simplify-ignored-prefixes
1729 (string-match gnus-simplify-ignored-prefixes subject))
1730 (setq subject (substring subject (match-end 0))))
1731 ;; Remove words in parentheses from end.
1733 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1734 (setq subject (substring subject 0 (match-beginning 0)))))
1735 ;; Return subject string.
1738 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1740 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1741 (goto-char (point-min))
1742 (while (re-search-forward regexp nil t)
1743 (replace-match (or newtext ""))))
1745 (defun gnus-simplify-buffer-fuzzy (regexp)
1746 "Simplify string in the buffer fuzzily.
1747 The string in the accessible portion of the current buffer is simplified.
1748 It is assumed to be a single-line subject.
1749 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1750 matter is removed. Additional things can be deleted by setting
1751 `gnus-simplify-subject-fuzzy-regexp'."
1752 (let ((case-fold-search t)
1754 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1756 (while (not (eq modified-tick (buffer-modified-tick)))
1757 (setq modified-tick (buffer-modified-tick))
1760 (mapc 'gnus-simplify-buffer-fuzzy-step regexp))
1762 (gnus-simplify-buffer-fuzzy-step regexp)))
1763 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1764 (gnus-simplify-buffer-fuzzy-step
1765 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1766 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1768 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1769 (gnus-simplify-buffer-fuzzy-step " +" " ")
1770 (gnus-simplify-buffer-fuzzy-step " $")
1771 (gnus-simplify-buffer-fuzzy-step "^ +")))
1773 (defun gnus-simplify-subject-fuzzy (subject)
1774 "Simplify a subject string fuzzily.
1775 See `gnus-simplify-buffer-fuzzy' for details."
1777 (let ((regexp gnus-simplify-subject-fuzzy-regexp))
1778 (gnus-set-work-buffer)
1779 (let ((case-fold-search t))
1780 ;; Remove uninteresting prefixes.
1781 (when (and gnus-simplify-ignored-prefixes
1782 (string-match gnus-simplify-ignored-prefixes subject))
1783 (setq subject (substring subject (match-end 0))))
1785 (inline (gnus-simplify-buffer-fuzzy regexp))
1788 (defsubst gnus-simplify-subject-fully (subject)
1789 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1791 (gnus-simplify-subject-functions
1792 (gnus-map-function gnus-simplify-subject-functions subject))
1793 ((null gnus-summary-gather-subject-limit)
1794 (gnus-simplify-subject-re subject))
1795 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1796 (gnus-simplify-subject-fuzzy subject))
1797 ((numberp gnus-summary-gather-subject-limit)
1798 (truncate-string-to-width (gnus-simplify-subject-re subject)
1799 gnus-summary-gather-subject-limit))
1803 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1804 "Check whether two subjects are equal.
1805 If optional argument SIMPLE-FIRST is t, first argument is already
1808 ((null simple-first)
1809 (equal (gnus-simplify-subject-fully s1)
1810 (gnus-simplify-subject-fully s2)))
1813 (gnus-simplify-subject-fully s2)))))
1815 (defun gnus-summary-bubble-group ()
1816 "Increase the score of the current group.
1817 This is a handy function to add to `gnus-summary-exit-hook' to
1818 increase the score of each group you read."
1819 (gnus-group-add-score gnus-newsgroup-name))
1823 ;;; Gnus summary mode
1826 (put 'gnus-summary-mode 'mode-class 'special)
1828 (defvar gnus-article-commands-menu)
1830 ;; Non-orthogonal keys
1832 (gnus-define-keys gnus-summary-mode-map
1833 " " gnus-summary-next-page
1834 "\177" gnus-summary-prev-page
1835 [delete] gnus-summary-prev-page
1836 [backspace] gnus-summary-prev-page
1837 "\r" gnus-summary-scroll-up
1838 "\M-\r" gnus-summary-scroll-down
1839 "n" gnus-summary-next-unread-article
1840 "p" gnus-summary-prev-unread-article
1841 "N" gnus-summary-next-article
1842 "P" gnus-summary-prev-article
1843 "\M-\C-n" gnus-summary-next-same-subject
1844 "\M-\C-p" gnus-summary-prev-same-subject
1845 "\M-n" gnus-summary-next-unread-subject
1846 "\M-p" gnus-summary-prev-unread-subject
1847 "." gnus-summary-first-unread-article
1848 "," gnus-summary-best-unread-article
1849 "\M-s" gnus-summary-search-article-forward
1850 "\M-r" gnus-summary-search-article-backward
1851 "\M-S" gnus-summary-repeat-search-article-forward
1852 "\M-R" gnus-summary-repeat-search-article-backward
1853 "<" gnus-summary-beginning-of-article
1854 ">" gnus-summary-end-of-article
1855 "j" gnus-summary-goto-article
1856 "^" gnus-summary-refer-parent-article
1857 "\M-^" gnus-summary-refer-article
1858 "u" gnus-summary-tick-article-forward
1859 "!" gnus-summary-tick-article-forward
1860 "U" gnus-summary-tick-article-backward
1861 "d" gnus-summary-mark-as-read-forward
1862 "D" gnus-summary-mark-as-read-backward
1863 "E" gnus-summary-mark-as-expirable
1864 "\M-u" gnus-summary-clear-mark-forward
1865 "\M-U" gnus-summary-clear-mark-backward
1866 "k" gnus-summary-kill-same-subject-and-select
1867 "\C-k" gnus-summary-kill-same-subject
1868 "\M-\C-k" gnus-summary-kill-thread
1869 "\M-\C-l" gnus-summary-lower-thread
1870 "e" gnus-summary-edit-article
1871 "#" gnus-summary-mark-as-processable
1872 "\M-#" gnus-summary-unmark-as-processable
1873 "\M-\C-t" gnus-summary-toggle-threads
1874 "\M-\C-s" gnus-summary-show-thread
1875 "\M-\C-h" gnus-summary-hide-thread
1876 "\M-\C-f" gnus-summary-next-thread
1877 "\M-\C-b" gnus-summary-prev-thread
1878 [(meta down)] gnus-summary-next-thread
1879 [(meta up)] gnus-summary-prev-thread
1880 "\M-\C-u" gnus-summary-up-thread
1881 "\M-\C-d" gnus-summary-down-thread
1882 "&" gnus-summary-execute-command
1883 "c" gnus-summary-catchup-and-exit
1884 "\C-w" gnus-summary-mark-region-as-read
1885 "\C-t" gnus-summary-toggle-truncation
1886 "?" gnus-summary-mark-as-dormant
1887 "\C-c\M-\C-s" gnus-summary-limit-include-expunged
1888 "\C-c\C-s\C-n" gnus-summary-sort-by-number
1889 "\C-c\C-s\C-m\C-n" gnus-summary-sort-by-most-recent-number
1890 "\C-c\C-s\C-l" gnus-summary-sort-by-lines
1891 "\C-c\C-s\C-c" gnus-summary-sort-by-chars
1892 "\C-c\C-s\C-a" gnus-summary-sort-by-author
1893 "\C-c\C-s\C-t" gnus-summary-sort-by-recipient
1894 "\C-c\C-s\C-s" gnus-summary-sort-by-subject
1895 "\C-c\C-s\C-d" gnus-summary-sort-by-date
1896 "\C-c\C-s\C-m\C-d" gnus-summary-sort-by-most-recent-date
1897 "\C-c\C-s\C-i" gnus-summary-sort-by-score
1898 "\C-c\C-s\C-o" gnus-summary-sort-by-original
1899 "\C-c\C-s\C-r" gnus-summary-sort-by-random
1900 "=" gnus-summary-expand-window
1901 "\C-x\C-s" gnus-summary-reselect-current-group
1902 "\M-g" gnus-summary-rescan-group
1903 "\C-c\C-r" gnus-summary-caesar-message
1904 "f" gnus-summary-followup
1905 "F" gnus-summary-followup-with-original
1906 "C" gnus-summary-cancel-article
1907 "r" gnus-summary-reply
1908 "R" gnus-summary-reply-with-original
1909 "\C-c\C-f" gnus-summary-mail-forward
1910 "o" gnus-summary-save-article
1911 "\C-o" gnus-summary-save-article-mail
1912 "|" gnus-summary-pipe-output
1913 "\M-k" gnus-summary-edit-local-kill
1914 "\M-K" gnus-summary-edit-global-kill
1916 "\C-c\C-d" gnus-summary-describe-group
1917 "q" gnus-summary-exit
1918 "Q" gnus-summary-exit-no-update
1919 "\C-c\C-i" gnus-info-find-node
1920 gnus-mouse-2 gnus-mouse-pick-article
1921 [follow-link] mouse-face
1922 "m" gnus-summary-mail-other-window
1923 "a" gnus-summary-post-news
1924 "x" gnus-summary-limit-to-unread
1925 "s" gnus-summary-isearch-article
1926 [tab] gnus-summary-widget-forward
1927 "t" gnus-summary-toggle-header
1928 "g" gnus-summary-show-article
1929 "l" gnus-summary-goto-last-article
1930 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1931 "\C-d" gnus-summary-enter-digest-group
1932 "\M-\C-d" gnus-summary-read-document
1933 "\M-\C-e" gnus-summary-edit-parameters
1934 "\M-\C-a" gnus-summary-customize-parameters
1936 "*" gnus-cache-enter-article
1937 "\M-*" gnus-cache-remove-article
1938 "\M-&" gnus-summary-universal-argument
1939 "\C-l" gnus-recenter
1940 "I" gnus-summary-increase-score
1941 "L" gnus-summary-lower-score
1942 "\M-i" gnus-symbolic-argument
1943 "h" gnus-summary-select-article-buffer
1945 "b" gnus-article-view-part
1946 "\M-t" gnus-summary-toggle-display-buttonized
1948 "V" gnus-summary-score-map
1949 "X" gnus-uu-extract-map
1950 "S" gnus-summary-send-map)
1952 ;; Sort of orthogonal keymap
1953 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1954 "t" gnus-summary-tick-article-forward
1955 "!" gnus-summary-tick-article-forward
1956 "d" gnus-summary-mark-as-read-forward
1957 "r" gnus-summary-mark-as-read-forward
1958 "c" gnus-summary-clear-mark-forward
1959 " " gnus-summary-clear-mark-forward
1960 "e" gnus-summary-mark-as-expirable
1961 "x" gnus-summary-mark-as-expirable
1962 "?" gnus-summary-mark-as-dormant
1963 "b" gnus-summary-set-bookmark
1964 "B" gnus-summary-remove-bookmark
1965 "#" gnus-summary-mark-as-processable
1966 "\M-#" gnus-summary-unmark-as-processable
1967 "S" gnus-summary-limit-include-expunged
1968 "C" gnus-summary-catchup
1969 "H" gnus-summary-catchup-to-here
1970 "h" gnus-summary-catchup-from-here
1971 "\C-c" gnus-summary-catchup-all
1972 "k" gnus-summary-kill-same-subject-and-select
1973 "K" gnus-summary-kill-same-subject
1974 "P" gnus-uu-mark-map)
1976 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1977 "c" gnus-summary-clear-above
1978 "u" gnus-summary-tick-above
1979 "m" gnus-summary-mark-above
1980 "k" gnus-summary-kill-below)
1982 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1983 "/" gnus-summary-limit-to-subject
1984 "n" gnus-summary-limit-to-articles
1985 "b" gnus-summary-limit-to-bodies
1986 "h" gnus-summary-limit-to-headers
1987 "w" gnus-summary-pop-limit
1988 "s" gnus-summary-limit-to-subject
1989 "a" gnus-summary-limit-to-author
1990 "u" gnus-summary-limit-to-unread
1991 "m" gnus-summary-limit-to-marks
1992 "M" gnus-summary-limit-exclude-marks
1993 "v" gnus-summary-limit-to-score
1994 "*" gnus-summary-limit-include-cached
1995 "D" gnus-summary-limit-include-dormant
1996 "T" gnus-summary-limit-include-thread
1997 "d" gnus-summary-limit-exclude-dormant
1998 "t" gnus-summary-limit-to-age
1999 "." gnus-summary-limit-to-unseen
2000 "x" gnus-summary-limit-to-extra
2001 "p" gnus-summary-limit-to-display-predicate
2002 "E" gnus-summary-limit-include-expunged
2003 "c" gnus-summary-limit-exclude-childless-dormant
2004 "C" gnus-summary-limit-mark-excluded-as-read
2005 "o" gnus-summary-insert-old-articles
2006 "N" gnus-summary-insert-new-articles
2007 "S" gnus-summary-limit-to-singletons
2008 "r" gnus-summary-limit-to-replied
2009 "R" gnus-summary-limit-to-recipient
2010 "A" gnus-summary-limit-to-address)
2012 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
2013 "n" gnus-summary-next-unread-article
2014 "p" gnus-summary-prev-unread-article
2015 "N" gnus-summary-next-article
2016 "P" gnus-summary-prev-article
2017 "\C-n" gnus-summary-next-same-subject
2018 "\C-p" gnus-summary-prev-same-subject
2019 "\M-n" gnus-summary-next-unread-subject
2020 "\M-p" gnus-summary-prev-unread-subject
2021 "f" gnus-summary-first-unread-article
2022 "b" gnus-summary-best-unread-article
2023 "j" gnus-summary-goto-article
2024 "g" gnus-summary-goto-subject
2025 "l" gnus-summary-goto-last-article
2026 "o" gnus-summary-pop-article)
2028 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2029 "k" gnus-summary-kill-thread
2030 "E" gnus-summary-expire-thread
2031 "l" gnus-summary-lower-thread
2032 "i" gnus-summary-raise-thread
2033 "T" gnus-summary-toggle-threads
2034 "t" gnus-summary-rethread-current
2035 "^" gnus-summary-reparent-thread
2036 "\M-^" gnus-summary-reparent-children
2037 "s" gnus-summary-show-thread
2038 "S" gnus-summary-show-all-threads
2039 "h" gnus-summary-hide-thread
2040 "H" gnus-summary-hide-all-threads
2041 "n" gnus-summary-next-thread
2042 "p" gnus-summary-prev-thread
2043 "u" gnus-summary-up-thread
2044 "o" gnus-summary-top-thread
2045 "d" gnus-summary-down-thread
2046 "#" gnus-uu-mark-thread
2047 "\M-#" gnus-uu-unmark-thread)
2049 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2050 "g" gnus-summary-prepare
2051 "c" gnus-summary-insert-cached-articles
2052 "d" gnus-summary-insert-dormant-articles
2053 "t" gnus-summary-insert-ticked-articles)
2055 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2056 "c" gnus-summary-catchup-and-exit
2057 "C" gnus-summary-catchup-all-and-exit
2058 "E" gnus-summary-exit-no-update
2059 "Q" gnus-summary-exit
2060 "Z" gnus-summary-exit
2061 "n" gnus-summary-catchup-and-goto-next-group
2062 "p" gnus-summary-catchup-and-goto-prev-group
2063 "R" gnus-summary-reselect-current-group
2064 "G" gnus-summary-rescan-group
2065 "N" gnus-summary-next-group
2066 "s" gnus-summary-save-newsrc
2067 "P" gnus-summary-prev-group)
2069 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2070 " " gnus-summary-next-page
2071 "n" gnus-summary-next-page
2072 "\177" gnus-summary-prev-page
2073 [delete] gnus-summary-prev-page
2074 "p" gnus-summary-prev-page
2075 "\r" gnus-summary-scroll-up
2076 "\M-\r" gnus-summary-scroll-down
2077 "<" gnus-summary-beginning-of-article
2078 ">" gnus-summary-end-of-article
2079 "b" gnus-summary-beginning-of-article
2080 "e" gnus-summary-end-of-article
2081 "^" gnus-summary-refer-parent-article
2082 "r" gnus-summary-refer-parent-article
2083 "C" gnus-summary-show-complete-article
2084 "D" gnus-summary-enter-digest-group
2085 "R" gnus-summary-refer-references
2086 "T" gnus-summary-refer-thread
2087 "W" gnus-warp-to-article
2088 "g" gnus-summary-show-article
2089 "s" gnus-summary-isearch-article
2090 [tab] gnus-summary-widget-forward
2091 "P" gnus-summary-print-article
2092 "S" gnus-sticky-article
2093 "M" gnus-mailing-list-insinuate
2094 "t" gnus-article-babel)
2096 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2097 "b" gnus-article-add-buttons
2098 "B" gnus-article-add-buttons-to-head
2099 "o" gnus-article-treat-overstrike
2100 "e" gnus-article-emphasize
2101 "w" gnus-article-fill-cited-article
2102 "Q" gnus-article-fill-long-lines
2103 "L" gnus-article-toggle-truncate-lines
2104 "C" gnus-article-capitalize-sentences
2105 "c" gnus-article-remove-cr
2106 "q" gnus-article-de-quoted-unreadable
2107 "6" gnus-article-de-base64-unreadable
2108 "Z" gnus-article-decode-HZ
2109 "A" gnus-article-treat-ansi-sequences
2110 "h" gnus-article-wash-html
2111 "u" gnus-article-unsplit-urls
2112 "s" gnus-summary-force-verify-and-decrypt
2113 "f" gnus-article-display-x-face
2114 "l" gnus-summary-stop-page-breaking
2115 "r" gnus-summary-caesar-message
2116 "m" gnus-summary-morse-message
2117 "t" gnus-summary-toggle-header
2118 "g" gnus-treat-smiley
2119 "v" gnus-summary-verbose-headers
2120 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2121 "p" gnus-article-verify-x-pgp-sig
2122 "d" gnus-article-treat-dumbquotes
2123 "U" gnus-article-treat-non-ascii
2124 "i" gnus-summary-idna-message)
2126 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2127 ;; mnemonic: deuglif*Y*
2128 "u" gnus-article-outlook-unwrap-lines
2129 "a" gnus-article-outlook-repair-attribution
2130 "c" gnus-article-outlook-rearrange-citation
2131 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2133 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2134 "a" gnus-article-hide
2135 "h" gnus-article-hide-headers
2136 "b" gnus-article-hide-boring-headers
2137 "s" gnus-article-hide-signature
2138 "c" gnus-article-hide-citation
2139 "C" gnus-article-hide-citation-in-followups
2140 "l" gnus-article-hide-list-identifiers
2141 "B" gnus-article-strip-banner
2142 "P" gnus-article-hide-pem
2143 "\C-c" gnus-article-hide-citation-maybe)
2145 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2146 "a" gnus-article-highlight
2147 "h" gnus-article-highlight-headers
2148 "c" gnus-article-highlight-citation
2149 "s" gnus-article-highlight-signature)
2151 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2152 "f" gnus-article-treat-fold-headers
2153 "u" gnus-article-treat-unfold-headers
2154 "n" gnus-article-treat-fold-newsgroups)
2156 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2157 "x" gnus-article-display-x-face
2158 "d" gnus-article-display-face
2159 "s" gnus-treat-smiley
2160 "D" gnus-article-remove-images
2161 "W" gnus-article-show-images
2162 "f" gnus-treat-from-picon
2163 "m" gnus-treat-mail-picon
2164 "n" gnus-treat-newsgroups-picon
2165 "g" gnus-treat-from-gravatar
2166 "h" gnus-treat-mail-gravatar)
2168 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2169 "w" gnus-article-decode-mime-words
2170 "c" gnus-article-decode-charset
2171 "v" gnus-mime-view-all-parts
2172 "b" gnus-article-view-part)
2174 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2175 "z" gnus-article-date-ut
2176 "u" gnus-article-date-ut
2177 "l" gnus-article-date-local
2178 "p" gnus-article-date-english
2179 "e" gnus-article-date-lapsed
2180 "o" gnus-article-date-original
2181 "i" gnus-article-date-iso8601
2182 "s" gnus-article-date-user)
2184 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2185 "t" gnus-article-remove-trailing-blank-lines
2186 "l" gnus-article-strip-leading-blank-lines
2187 "m" gnus-article-strip-multiple-blank-lines
2188 "a" gnus-article-strip-blank-lines
2189 "A" gnus-article-strip-all-blank-lines
2190 "s" gnus-article-strip-leading-space
2191 "e" gnus-article-strip-trailing-space
2192 "w" gnus-article-remove-leading-whitespace)
2194 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2196 "d" gnus-summary-describe-group
2197 "h" gnus-summary-describe-briefly
2198 "i" gnus-info-find-node)
2200 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2201 "e" gnus-summary-expire-articles
2202 "\M-\C-e" gnus-summary-expire-articles-now
2203 "\177" gnus-summary-delete-article
2204 [delete] gnus-summary-delete-article
2205 [backspace] gnus-summary-delete-article
2206 "m" gnus-summary-move-article
2207 "r" gnus-summary-respool-article
2208 "w" gnus-summary-edit-article
2209 "c" gnus-summary-copy-article
2210 "B" gnus-summary-crosspost-article
2211 "q" gnus-summary-respool-query
2212 "t" gnus-summary-respool-trace
2213 "i" gnus-summary-import-article
2214 "I" gnus-summary-create-article
2215 "p" gnus-summary-article-posted-p)
2217 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2218 "o" gnus-summary-save-article
2219 "m" gnus-summary-save-article-mail
2220 "F" gnus-summary-write-article-file
2221 "r" gnus-summary-save-article-rmail
2222 "f" gnus-summary-save-article-file
2223 "b" gnus-summary-save-article-body-file
2224 "B" gnus-summary-write-article-body-file
2225 "h" gnus-summary-save-article-folder
2226 "v" gnus-summary-save-article-vm
2227 "p" gnus-summary-pipe-output
2228 "P" gnus-summary-muttprint)
2230 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2231 "b" gnus-summary-display-buttonized
2232 "m" gnus-summary-repair-multipart
2233 "v" gnus-article-view-part
2234 "o" gnus-article-save-part
2235 "O" gnus-article-save-part-and-strip
2236 "r" gnus-article-replace-part
2237 "d" gnus-article-delete-part
2238 "t" gnus-article-view-part-as-type
2239 "j" gnus-article-jump-to-part
2240 "c" gnus-article-copy-part
2241 "C" gnus-article-view-part-as-charset
2242 "e" gnus-article-view-part-externally
2243 "H" gnus-article-browse-html-article
2244 "E" gnus-article-encrypt-body
2245 "i" gnus-article-inline-part
2246 "|" gnus-article-pipe-part)
2248 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2249 "p" gnus-summary-mark-as-processable
2250 "u" gnus-summary-unmark-as-processable
2251 "U" gnus-summary-unmark-all-processable
2252 "v" gnus-uu-mark-over
2253 "s" gnus-uu-mark-series
2254 "r" gnus-uu-mark-region
2255 "g" gnus-uu-unmark-region
2256 "R" gnus-uu-mark-by-regexp
2257 "G" gnus-uu-unmark-by-regexp
2258 "t" gnus-uu-mark-thread
2259 "T" gnus-uu-unmark-thread
2260 "a" gnus-uu-mark-all
2261 "b" gnus-uu-mark-buffer
2262 "S" gnus-uu-mark-sparse
2263 "k" gnus-summary-kill-process-mark
2264 "y" gnus-summary-yank-process-mark
2265 "w" gnus-summary-save-process-mark
2266 "i" gnus-uu-invert-processable)
2268 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2269 ;;"x" gnus-uu-extract-any
2270 "m" gnus-summary-save-parts
2271 "u" gnus-uu-decode-uu
2272 "U" gnus-uu-decode-uu-and-save
2273 "s" gnus-uu-decode-unshar
2274 "S" gnus-uu-decode-unshar-and-save
2275 "o" gnus-uu-decode-save
2276 "O" gnus-uu-decode-save
2277 "b" gnus-uu-decode-binhex
2278 "B" gnus-uu-decode-binhex
2279 "Y" gnus-uu-decode-yenc
2280 "p" gnus-uu-decode-postscript
2281 "P" gnus-uu-decode-postscript-and-save)
2284 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2285 "u" gnus-uu-decode-uu-view
2286 "U" gnus-uu-decode-uu-and-save-view
2287 "s" gnus-uu-decode-unshar-view
2288 "S" gnus-uu-decode-unshar-and-save-view
2289 "o" gnus-uu-decode-save-view
2290 "O" gnus-uu-decode-save-view
2291 "b" gnus-uu-decode-binhex-view
2292 "B" gnus-uu-decode-binhex-view
2293 "p" gnus-uu-decode-postscript-view
2294 "P" gnus-uu-decode-postscript-and-save-view)
2296 (defvar gnus-article-post-menu nil)
2298 (defconst gnus-summary-menu-maxlen 20)
2300 (defun gnus-summary-menu-split (menu)
2301 ;; If we have lots of elements, divide them into groups of 20
2302 ;; and make a pane (or submenu) for each one.
2303 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2304 (let ((menu menu) sublists next
2307 ;; Pull off the next gnus-summary-menu-maxlen elements
2308 ;; and make them the next element of sublist.
2309 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2311 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2313 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2314 (aref (car (last menu)) 0)) menu)
2318 (nreverse sublists))
2319 ;; Few elements--put them all in one pane.
2322 (defun gnus-summary-make-menu-bar ()
2323 (gnus-turn-off-edit-menu 'summary)
2325 (unless (boundp 'gnus-summary-misc-menu)
2328 gnus-summary-kill-menu gnus-summary-mode-map ""
2333 ["Customize" gnus-score-customize t])
2334 (gnus-make-score-map 'increase)
2335 (gnus-make-score-map 'lower)
2337 ["Kill below" gnus-summary-kill-below t]
2338 ["Mark above" gnus-summary-mark-above t]
2339 ["Tick above" gnus-summary-tick-above t]
2340 ["Clear above" gnus-summary-clear-above t])
2341 ["Current score" gnus-summary-current-score t]
2342 ["Set score" gnus-summary-set-score t]
2343 ["Switch current score file..." gnus-score-change-score-file t]
2344 ["Set mark below..." gnus-score-set-mark-below t]
2345 ["Set expunge below..." gnus-score-set-expunge-below t]
2346 ["Edit current score file" gnus-score-edit-current-scores t]
2347 ["Edit score file..." gnus-score-edit-file t]
2348 ["Trace score" gnus-score-find-trace t]
2349 ["Find words" gnus-score-find-favourite-words t]
2350 ["Rescore buffer" gnus-summary-rescore t]
2351 ["Increase score..." gnus-summary-increase-score t]
2352 ["Lower score..." gnus-summary-lower-score t]))))
2354 ;; Define both the Article menu in the summary buffer and the
2355 ;; equivalent Commands menu in the article buffer here for
2359 ["All" gnus-article-hide t]
2360 ["Headers" gnus-article-hide-headers t]
2361 ["Signature" gnus-article-hide-signature t]
2362 ["Citation" gnus-article-hide-citation t]
2363 ["List identifiers" gnus-article-hide-list-identifiers t]
2364 ["Banner" gnus-article-strip-banner t]
2365 ["Boring headers" gnus-article-hide-boring-headers t])
2367 ["All" gnus-article-highlight t]
2368 ["Headers" gnus-article-highlight-headers t]
2369 ["Signature" gnus-article-highlight-signature t]
2370 ["Citation" gnus-article-highlight-citation t])
2372 ["Words" gnus-article-decode-mime-words t]
2373 ["Charset" gnus-article-decode-charset t]
2374 ["QP" gnus-article-de-quoted-unreadable t]
2375 ["Base64" gnus-article-de-base64-unreadable t]
2376 ["View MIME buttons" gnus-summary-display-buttonized t]
2377 ["View all" gnus-mime-view-all-parts t]
2378 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2379 ["Encrypt body" gnus-article-encrypt-body
2380 :active (not (gnus-group-read-only-p))
2381 ,@(if (featurep 'xemacs) nil
2382 '(:help "Encrypt the message body on disk"))]
2383 ["Extract all parts..." gnus-summary-save-parts t]
2385 ["Repair multipart" gnus-summary-repair-multipart t]
2386 ["Pipe part..." gnus-article-pipe-part t]
2387 ["Inline part" gnus-article-inline-part t]
2388 ["View part as type..." gnus-article-view-part-as-type t]
2389 ["Encrypt body" gnus-article-encrypt-body
2390 :active (not (gnus-group-read-only-p))
2391 ,@(if (featurep 'xemacs) nil
2392 '(:help "Encrypt the message body on disk"))]
2393 ["View part externally" gnus-article-view-part-externally t]
2394 ["View HTML parts in browser" gnus-article-browse-html-article t]
2395 ["View part with charset..." gnus-article-view-part-as-charset t]
2396 ["Copy part" gnus-article-copy-part t]
2397 ["Save part..." gnus-article-save-part t]
2398 ["View part" gnus-article-view-part t]))
2400 ["Local" gnus-article-date-local t]
2401 ["ISO8601" gnus-article-date-iso8601 t]
2402 ["UT" gnus-article-date-ut t]
2403 ["Original" gnus-article-date-original t]
2404 ["Lapsed" gnus-article-date-lapsed t]
2405 ["User-defined" gnus-article-date-user t])
2407 ["Remove images" gnus-article-remove-images t]
2408 ["Toggle smiley" gnus-treat-smiley t]
2409 ["Show X-Face" gnus-article-display-x-face t]
2410 ["Show picons in From" gnus-treat-from-picon t]
2411 ["Show picons in mail headers" gnus-treat-mail-picon t]
2412 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2413 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2414 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2415 ("View as different encoding"
2416 ,@(gnus-summary-menu-split
2419 ;; Since easymenu under Emacs doesn't allow
2420 ;; lambda forms for menu commands, we should
2421 ;; provide intern'ed function symbols.
2422 (let ((command (intern (format "\
2423 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2427 (let ((gnus-summary-show-article-charset-alist
2429 (gnus-summary-show-article 1))))
2430 `[,(symbol-name cs) ,command t]))
2431 (sort (if (fboundp 'coding-system-list)
2432 (coding-system-list)
2433 (mapcar 'car mm-mime-mule-charset-alist))
2437 ["Leading" gnus-article-strip-leading-blank-lines t]
2438 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2439 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2440 ["All of the above" gnus-article-strip-blank-lines t]
2441 ["All" gnus-article-strip-all-blank-lines t]
2442 ["Leading space" gnus-article-strip-leading-space t]
2443 ["Trailing space" gnus-article-strip-trailing-space t]
2444 ["Leading space in headers"
2445 gnus-article-remove-leading-whitespace t])
2446 ["Overstrike" gnus-article-treat-overstrike t]
2447 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2448 ["Non-ASCII" gnus-article-treat-non-ascii t]
2449 ["Emphasis" gnus-article-emphasize t]
2450 ["Word wrap" gnus-article-fill-cited-article t]
2451 ["Fill long lines" gnus-article-fill-long-lines t]
2452 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2453 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2454 ["Remove CR" gnus-article-remove-cr t]
2455 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2456 ["Base64" gnus-article-de-base64-unreadable t]
2457 ["Rot 13" gnus-summary-caesar-message
2458 ,@(if (featurep 'xemacs) '(t)
2459 '(:help "\"Caesar rotate\" article by 13"))]
2460 ["De-IDNA" gnus-summary-idna-message t]
2461 ["Morse decode" gnus-summary-morse-message t]
2462 ["Unix pipe..." gnus-summary-pipe-message t]
2463 ["Add buttons" gnus-article-add-buttons t]
2464 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2465 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2466 ["Verbose header" gnus-summary-verbose-headers t]
2467 ["Toggle header" gnus-summary-toggle-header t]
2468 ["Unfold headers" gnus-article-treat-unfold-headers t]
2469 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2470 ["Html" gnus-article-wash-html t]
2471 ["Unsplit URLs" gnus-article-unsplit-urls t]
2472 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2473 ["Decode HZ" gnus-article-decode-HZ t]
2474 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2475 ("(Outlook) Deuglify"
2476 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2477 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2478 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2479 ["Full (Outlook) deuglify"
2480 gnus-article-outlook-deuglify-article t])
2483 ["Save in default format..." gnus-summary-save-article
2484 ,@(if (featurep 'xemacs) '(t)
2485 '(:help "Save article using default method"))]
2486 ["Save in file..." gnus-summary-save-article-file
2487 ,@(if (featurep 'xemacs) '(t)
2488 '(:help "Save article in file"))]
2489 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2490 ["Save in MH folder..." gnus-summary-save-article-folder t]
2491 ["Save in VM folder..." gnus-summary-save-article-vm t]
2492 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2493 ["Save body in file..." gnus-summary-save-article-body-file t]
2494 ["Pipe through a filter..." gnus-summary-pipe-output t]
2495 ["Print with Muttprint..." gnus-summary-muttprint t]
2496 ["Print" gnus-summary-print-article
2497 ,@(if (featurep 'xemacs) '(t)
2498 '(:help "Generate and print a PostScript image"))])
2499 ("Copy, move,... (Backend)"
2500 ,@(if (featurep 'xemacs) nil
2501 '(:help "Copying, moving, expiring articles..."))
2502 ["Respool article..." gnus-summary-respool-article t]
2503 ["Move article..." gnus-summary-move-article
2504 (gnus-check-backend-function
2505 'request-move-article gnus-newsgroup-name)]
2506 ["Copy article..." gnus-summary-copy-article t]
2507 ["Crosspost article..." gnus-summary-crosspost-article
2508 (gnus-check-backend-function
2509 'request-replace-article gnus-newsgroup-name)]
2510 ["Import file..." gnus-summary-import-article
2511 (gnus-check-backend-function
2512 'request-accept-article gnus-newsgroup-name)]
2513 ["Create article..." gnus-summary-create-article
2514 (gnus-check-backend-function
2515 'request-accept-article gnus-newsgroup-name)]
2516 ["Check if posted" gnus-summary-article-posted-p t]
2517 ["Edit article" gnus-summary-edit-article
2518 (not (gnus-group-read-only-p))]
2519 ["Delete article" gnus-summary-delete-article
2520 (gnus-check-backend-function
2521 'request-expire-articles gnus-newsgroup-name)]
2522 ["Query respool" gnus-summary-respool-query t]
2523 ["Trace respool" gnus-summary-respool-trace t]
2524 ["Delete expirable articles" gnus-summary-expire-articles-now
2525 (gnus-check-backend-function
2526 'request-expire-articles gnus-newsgroup-name)])
2528 ["Uudecode" gnus-uu-decode-uu
2529 ,@(if (featurep 'xemacs) '(t)
2530 '(:help "Decode uuencoded article(s)"))]
2531 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2532 ["Unshar" gnus-uu-decode-unshar t]
2533 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2534 ["Save" gnus-uu-decode-save t]
2535 ["Binhex" gnus-uu-decode-binhex t]
2536 ["Postscript" gnus-uu-decode-postscript t]
2537 ["All MIME parts" gnus-summary-save-parts t])
2539 ["Enter article" gnus-cache-enter-article t]
2540 ["Remove article" gnus-cache-remove-article t])
2541 ["Translate" gnus-article-babel t]
2542 ["Select article buffer" gnus-summary-select-article-buffer t]
2543 ["Make article buffer sticky" gnus-sticky-article t]
2544 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2545 ["Isearch article..." gnus-summary-isearch-article t]
2546 ["Beginning of the article" gnus-summary-beginning-of-article t]
2547 ["End of the article" gnus-summary-end-of-article t]
2548 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2549 ["Fetch referenced articles" gnus-summary-refer-references t]
2550 ["Fetch current thread" gnus-summary-refer-thread t]
2551 ["Fetch article with id..." gnus-summary-refer-article t]
2552 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2553 ["Redisplay" gnus-summary-show-article t]
2554 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2556 gnus-summary-article-menu gnus-summary-mode-map ""
2557 (cons "Article" innards))
2559 (if (not (keymapp gnus-summary-article-menu))
2561 gnus-article-commands-menu gnus-article-mode-map ""
2562 (cons "Commands" innards))
2563 ;; in Emacs, don't share menu.
2564 (setq gnus-article-commands-menu
2565 (copy-keymap gnus-summary-article-menu))
2566 (define-key gnus-article-mode-map [menu-bar commands]
2567 (cons "Commands" gnus-article-commands-menu))))
2570 gnus-summary-thread-menu gnus-summary-mode-map ""
2572 ["Find all messages in thread" gnus-summary-refer-thread t]
2573 ["Toggle threading" gnus-summary-toggle-threads t]
2574 ["Hide threads" gnus-summary-hide-all-threads t]
2575 ["Show threads" gnus-summary-show-all-threads t]
2576 ["Hide thread" gnus-summary-hide-thread t]
2577 ["Show thread" gnus-summary-show-thread t]
2578 ["Go to next thread" gnus-summary-next-thread t]
2579 ["Go to previous thread" gnus-summary-prev-thread t]
2580 ["Go down thread" gnus-summary-down-thread t]
2581 ["Go up thread" gnus-summary-up-thread t]
2582 ["Top of thread" gnus-summary-top-thread t]
2583 ["Mark thread as read" gnus-summary-kill-thread t]
2584 ["Mark thread as expired" gnus-summary-expire-thread t]
2585 ["Lower thread score" gnus-summary-lower-thread t]
2586 ["Raise thread score" gnus-summary-raise-thread t]
2587 ["Rethread current" gnus-summary-rethread-current t]))
2590 gnus-summary-post-menu gnus-summary-mode-map ""
2592 ["Send a message (mail or news)" gnus-summary-post-news
2593 ,@(if (featurep 'xemacs) '(t)
2594 '(:help "Compose a new message (mail or news)"))]
2595 ["Followup" gnus-summary-followup
2596 ,@(if (featurep 'xemacs) '(t)
2597 '(:help "Post followup to this article"))]
2598 ["Followup and yank" gnus-summary-followup-with-original
2599 ,@(if (featurep 'xemacs) '(t)
2600 '(:help "Post followup to this article, quoting its contents"))]
2601 ["Supersede article" gnus-summary-supersede-article t]
2602 ["Cancel article" gnus-summary-cancel-article
2603 ,@(if (featurep 'xemacs) '(t)
2604 '(:help "Cancel an article you posted"))]
2605 ["Reply" gnus-summary-reply t]
2606 ["Reply and yank" gnus-summary-reply-with-original t]
2607 ["Wide reply" gnus-summary-wide-reply t]
2608 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2609 ,@(if (featurep 'xemacs) '(t)
2610 '(:help "Mail a reply, quoting this article"))]
2611 ["Very wide reply" gnus-summary-very-wide-reply t]
2612 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2613 ,@(if (featurep 'xemacs) '(t)
2614 '(:help "Mail a very wide reply, quoting this article"))]
2615 ["Mail forward" gnus-summary-mail-forward t]
2616 ["Post forward" gnus-summary-post-forward t]
2617 ["Digest and mail" gnus-uu-digest-mail-forward t]
2618 ["Digest and post" gnus-uu-digest-post-forward t]
2619 ["Resend message" gnus-summary-resend-message t]
2620 ["Resend message edit" gnus-summary-resend-message-edit t]
2621 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2622 ["Send a mail" gnus-summary-mail-other-window t]
2623 ["Create a local message" gnus-summary-news-other-window t]
2624 ["Uuencode and post" gnus-uu-post-news
2625 ,@(if (featurep 'xemacs) '(t)
2626 '(:help "Post a uuencoded article"))]
2627 ["Followup via news" gnus-summary-followup-to-mail t]
2628 ["Followup via news and yank"
2629 gnus-summary-followup-to-mail-with-original t]
2630 ["Strip signature on reply"
2633 (if (not (memq message-cite-function
2634 '(message-cite-original-without-signature
2635 message-cite-original)))
2636 ;; Stupid workaround for XEmacs not honoring :visible.
2637 (message "Can't toggle this value of `message-cite-function'")
2638 (setq message-cite-function
2639 (if (eq message-cite-function
2640 'message-cite-original-without-signature)
2641 'message-cite-original
2642 'message-cite-original-without-signature))))
2643 ;; XEmacs barfs on :visible.
2644 ,@(if (featurep 'xemacs) nil
2645 '(:visible (memq message-cite-function
2646 '(message-cite-original-without-signature
2647 message-cite-original))))
2649 :selected (eq message-cite-function
2650 'message-cite-original-without-signature)
2651 ,@(if (featurep 'xemacs) nil
2652 '(:help "Strip signature from cited article when replying."))]
2654 ;;["Send" gnus-summary-send-draft t]
2655 ;;["Send bounced" gnus-resend-bounced-mail t])
2659 ((not (keymapp gnus-summary-post-menu))
2660 (setq gnus-article-post-menu gnus-summary-post-menu))
2661 ((not gnus-article-post-menu)
2662 ;; Don't share post menu.
2663 (setq gnus-article-post-menu
2664 (copy-keymap gnus-summary-post-menu))))
2665 (define-key gnus-article-mode-map [menu-bar post]
2666 (cons "Post" gnus-article-post-menu))
2669 gnus-summary-misc-menu gnus-summary-mode-map ""
2672 ["Mark as read" gnus-summary-mark-as-read-forward t]
2673 ["Mark same subject and select"
2674 gnus-summary-kill-same-subject-and-select t]
2675 ["Mark same subject" gnus-summary-kill-same-subject t]
2676 ["Catchup" gnus-summary-catchup
2677 ,@(if (featurep 'xemacs) '(t)
2678 '(:help "Mark unread articles in this group as read"))]
2679 ["Catchup all" gnus-summary-catchup-all t]
2680 ["Catchup to here" gnus-summary-catchup-to-here t]
2681 ["Catchup from here" gnus-summary-catchup-from-here t]
2682 ["Catchup region" gnus-summary-mark-region-as-read
2683 (gnus-mark-active-p)]
2684 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2686 ["Tick" gnus-summary-tick-article-forward t]
2687 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2688 ["Remove marks" gnus-summary-clear-mark-forward t]
2689 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2690 ["Set bookmark" gnus-summary-set-bookmark t]
2691 ["Remove bookmark" gnus-summary-remove-bookmark t])
2693 ["Marks..." gnus-summary-limit-to-marks t]
2694 ["Subject..." gnus-summary-limit-to-subject t]
2695 ["Author..." gnus-summary-limit-to-author t]
2696 ["Recipient..." gnus-summary-limit-to-recipient t]
2697 ["Address..." gnus-summary-limit-to-address t]
2698 ["Age..." gnus-summary-limit-to-age t]
2699 ["Extra..." gnus-summary-limit-to-extra t]
2700 ["Score..." gnus-summary-limit-to-score t]
2701 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2702 ["Unread" gnus-summary-limit-to-unread t]
2703 ["Unseen" gnus-summary-limit-to-unseen t]
2704 ["Singletons" gnus-summary-limit-to-singletons t]
2705 ["Replied" gnus-summary-limit-to-replied t]
2706 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2707 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2708 ["Pop limit" gnus-summary-pop-limit t]
2709 ["Show dormant" gnus-summary-limit-include-dormant t]
2710 ["Hide childless dormant"
2711 gnus-summary-limit-exclude-childless-dormant t]
2712 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2713 ["Hide marked" gnus-summary-limit-exclude-marks t]
2714 ["Show expunged" gnus-summary-limit-include-expunged t])
2716 ["Set mark" gnus-summary-mark-as-processable t]
2717 ["Remove mark" gnus-summary-unmark-as-processable t]
2718 ["Remove all marks" gnus-summary-unmark-all-processable t]
2719 ["Invert marks" gnus-uu-invert-processable t]
2720 ["Mark above" gnus-uu-mark-over t]
2721 ["Mark series" gnus-uu-mark-series t]
2722 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2723 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2724 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2725 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2726 ["Mark all" gnus-uu-mark-all t]
2727 ["Mark buffer" gnus-uu-mark-buffer t]
2728 ["Mark sparse" gnus-uu-mark-sparse t]
2729 ["Mark thread" gnus-uu-mark-thread t]
2730 ["Unmark thread" gnus-uu-unmark-thread t]
2731 ("Process Mark Sets"
2732 ["Kill" gnus-summary-kill-process-mark t]
2733 ["Yank" gnus-summary-yank-process-mark
2734 gnus-newsgroup-process-stack]
2735 ["Save" gnus-summary-save-process-mark t]
2736 ["Run command on marked..." gnus-summary-universal-argument t]))
2739 ["Page forward" gnus-summary-next-page
2740 ,@(if (featurep 'xemacs) '(t)
2741 '(:help "Show next page of article"))]
2742 ["Page backward" gnus-summary-prev-page
2743 ,@(if (featurep 'xemacs) '(t)
2744 '(:help "Show previous page of article"))]
2745 ["Line forward" gnus-summary-scroll-up t])
2747 ["Next unread article" gnus-summary-next-unread-article t]
2748 ["Previous unread article" gnus-summary-prev-unread-article t]
2749 ["Next article" gnus-summary-next-article t]
2750 ["Previous article" gnus-summary-prev-article t]
2751 ["Next unread subject" gnus-summary-next-unread-subject t]
2752 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2753 ["Next article same subject" gnus-summary-next-same-subject t]
2754 ["Previous article same subject" gnus-summary-prev-same-subject t]
2755 ["First unread article" gnus-summary-first-unread-article t]
2756 ["Best unread article" gnus-summary-best-unread-article t]
2757 ["Go to subject number..." gnus-summary-goto-subject t]
2758 ["Go to article number..." gnus-summary-goto-article t]
2759 ["Go to the last article" gnus-summary-goto-last-article t]
2760 ["Pop article off history" gnus-summary-pop-article t])
2762 ["Sort by number" gnus-summary-sort-by-number t]
2763 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2764 ["Sort by author" gnus-summary-sort-by-author t]
2765 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2766 ["Sort by subject" gnus-summary-sort-by-subject t]
2767 ["Sort by date" gnus-summary-sort-by-date t]
2768 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2769 ["Sort by score" gnus-summary-sort-by-score t]
2770 ["Sort by lines" gnus-summary-sort-by-lines t]
2771 ["Sort by characters" gnus-summary-sort-by-chars t]
2772 ["Randomize" gnus-summary-sort-by-random t]
2773 ["Original sort" gnus-summary-sort-by-original t])
2775 ["Describe group" gnus-summary-describe-group t]
2776 ["Read manual" gnus-info-find-node t])
2778 ["Pick and read" gnus-pick-mode t]
2779 ["Binary" gnus-binary-mode t])
2781 ["Regenerate" gnus-summary-prepare t]
2782 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2783 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2784 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2785 ["Toggle threading" gnus-summary-toggle-threads t])
2786 ["See old articles" gnus-summary-insert-old-articles t]
2787 ["See new articles" gnus-summary-insert-new-articles t]
2788 ["Filter articles..." gnus-summary-execute-command t]
2789 ["Run command on articles..." gnus-summary-universal-argument t]
2790 ["Search articles forward..." gnus-summary-search-article-forward t]
2791 ["Search articles backward..." gnus-summary-search-article-backward t]
2792 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2793 ["Expand window" gnus-summary-expand-window t]
2794 ["Expire expirable articles" gnus-summary-expire-articles
2795 (gnus-check-backend-function
2796 'request-expire-articles gnus-newsgroup-name)]
2797 ["Edit local kill file" gnus-summary-edit-local-kill t]
2798 ["Edit main kill file" gnus-summary-edit-global-kill t]
2799 ["Edit group parameters" gnus-summary-edit-parameters t]
2800 ["Customize group parameters" gnus-summary-customize-parameters t]
2801 ["Send a bug report" gnus-bug t]
2803 ["Catchup and exit" gnus-summary-catchup-and-exit
2804 ,@(if (featurep 'xemacs) '(t)
2805 '(:help "Mark unread articles in this group as read, then exit"))]
2806 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2807 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2808 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2809 ["Exit group" gnus-summary-exit
2810 ,@(if (featurep 'xemacs) '(t)
2811 '(:help "Exit current group, return to group selection mode"))]
2812 ["Exit group without updating" gnus-summary-exit-no-update t]
2813 ["Exit and goto next group" gnus-summary-next-group t]
2814 ["Exit and goto prev group" gnus-summary-prev-group t]
2815 ["Reselect group" gnus-summary-reselect-current-group t]
2816 ["Rescan group" gnus-summary-rescan-group t]
2817 ["Update dribble" gnus-summary-save-newsrc t])))
2819 (gnus-run-hooks 'gnus-summary-menu-hook)))
2821 (defvar gnus-summary-tool-bar-map nil)
2823 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2824 ;; affect _new_ message buffers. We might add a function that walks thru all
2825 ;; summary-mode buffers and force the update.
2826 (defun gnus-summary-tool-bar-update (&optional symbol value)
2827 "Update summary mode toolbar.
2828 Setter function for custom variables."
2829 (setq-default gnus-summary-tool-bar-map nil)
2831 ;; When used as ":set" function:
2832 (set-default symbol value))
2833 (when (gnus-buffer-live-p gnus-summary-buffer)
2834 (with-current-buffer gnus-summary-buffer
2835 (gnus-summary-make-tool-bar))))
2837 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2838 'gnus-summary-tool-bar-gnome
2839 'gnus-summary-tool-bar-retro)
2840 "Specifies the Gnus summary tool bar.
2842 It can be either a list or a symbol refering to a list. See
2843 `gmm-tool-bar-from-list' for the format of the list. The
2844 default key map is `gnus-summary-mode-map'.
2846 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2847 `gnus-summary-tool-bar-retro'."
2848 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2849 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2850 (repeat :tag "User defined list" gmm-tool-bar-item)
2852 :version "23.1" ;; No Gnus
2853 :initialize 'custom-initialize-default
2854 :set 'gnus-summary-tool-bar-update
2855 :group 'gnus-summary)
2857 (defcustom gnus-summary-tool-bar-gnome
2858 '((gnus-summary-post-news "mail/compose" nil)
2859 (gnus-summary-insert-new-articles "mail/inbox" nil
2860 :visible (or (not gnus-agent)
2862 (gnus-summary-reply-with-original "mail/reply")
2863 (gnus-summary-reply "mail/reply" nil :visible nil)
2864 (gnus-summary-followup-with-original "mail/reply-all")
2865 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2866 (gnus-summary-mail-forward "mail/forward")
2867 (gnus-summary-save-article "mail/save")
2868 (gnus-summary-search-article-forward "search" nil :visible nil)
2869 (gnus-summary-print-article "print")
2870 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2871 ;; Some new commands that may need more suitable icons:
2872 (gnus-summary-save-newsrc "save" nil :visible nil)
2873 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2874 (gnus-summary-prev-article "left-arrow")
2875 (gnus-summary-next-article "right-arrow")
2876 (gnus-summary-next-page "next-page")
2877 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2879 ;; Maybe some sort-by-... could be added:
2880 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2881 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2882 (gnus-summary-mark-as-expirable
2884 :visible (gnus-check-backend-function 'request-expire-articles
2885 gnus-newsgroup-name))
2886 (gnus-summary-mark-as-spam
2888 :visible (and (fboundp 'spam-group-ham-contents-p)
2889 (spam-group-ham-contents-p gnus-newsgroup-name))
2890 :help "Mark as spam")
2891 (gnus-summary-mark-as-read-forward
2893 :visible (and (fboundp 'spam-group-spam-contents-p)
2894 (spam-group-spam-contents-p gnus-newsgroup-name)))
2896 (gnus-summary-exit "exit")
2897 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2898 (gnus-info-find-node "help"))
2899 "List of functions for the summary tool bar (GNOME style).
2901 See `gmm-tool-bar-from-list' for the format of the list."
2902 :type '(repeat gmm-tool-bar-item)
2903 :version "23.1" ;; No Gnus
2904 :initialize 'custom-initialize-default
2905 :set 'gnus-summary-tool-bar-update
2906 :group 'gnus-summary)
2908 (defcustom gnus-summary-tool-bar-retro
2909 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2910 (gnus-summary-next-unread-article "gnus/next-ur")
2911 (gnus-summary-post-news "gnus/post")
2912 (gnus-summary-followup-with-original "gnus/fuwo")
2913 (gnus-summary-followup "gnus/followup")
2914 (gnus-summary-reply-with-original "gnus/reply-wo")
2915 (gnus-summary-reply "gnus/reply")
2916 (gnus-summary-caesar-message "gnus/rot13")
2917 (gnus-uu-decode-uu "gnus/uu-decode")
2918 (gnus-summary-save-article-file "gnus/save-aif")
2919 (gnus-summary-save-article "gnus/save-art")
2920 (gnus-uu-post-news "gnus/uu-post")
2921 (gnus-summary-catchup "gnus/catchup")
2922 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2923 (gnus-summary-exit "gnus/exit-summ")
2924 ;; Some new command that may need more suitable icons:
2925 (gnus-summary-print-article "gnus/print" nil :visible nil)
2926 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2927 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2928 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2929 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2930 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2931 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2933 (gnus-info-find-node "gnus/help" nil :visible nil))
2934 "List of functions for the summary tool bar (retro look).
2936 See `gmm-tool-bar-from-list' for the format of the list."
2937 :type '(repeat gmm-tool-bar-item)
2938 :version "23.1" ;; No Gnus
2939 :initialize 'custom-initialize-default
2940 :set 'gnus-summary-tool-bar-update
2941 :group 'gnus-summary)
2943 (defcustom gnus-summary-tool-bar-zap-list t
2944 "List of icon items from the global tool bar.
2945 These items are not displayed in the Gnus summary mode tool bar.
2947 See `gmm-tool-bar-from-list' for the format of the list."
2948 :type 'gmm-tool-bar-zap-list
2949 :version "23.1" ;; No Gnus
2950 :initialize 'custom-initialize-default
2951 :set 'gnus-summary-tool-bar-update
2952 :group 'gnus-summary)
2954 (defvar image-load-path)
2955 (defvar tool-bar-map)
2957 (defun gnus-summary-make-tool-bar (&optional force)
2958 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2959 When FORCE, rebuild the tool bar."
2960 (when (and (not (featurep 'xemacs))
2961 (boundp 'tool-bar-mode)
2963 (or (not gnus-summary-tool-bar-map) force))
2965 (gmm-image-load-path-for-library "gnus"
2968 (image-load-path (cons (car load-path)
2969 (when (boundp 'image-load-path)
2971 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2972 gnus-summary-tool-bar-zap-list
2973 'gnus-summary-mode-map)))
2975 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2977 (setq gnus-summary-tool-bar-map map))))
2978 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2980 (defun gnus-score-set-default (var value)
2981 "A version of set that updates the GNU Emacs menu-bar."
2983 ;; It is the message that forces the active status to be updated.
2986 (defun gnus-make-score-map (type)
2987 "Make a summary score map of type TYPE."
2990 (let ((headers '(("author" "from" string)
2991 ("subject" "subject" string)
2992 ("article body" "body" string)
2993 ("article head" "head" string)
2994 ("xref" "xref" string)
2995 ("extra header" "extra" string)
2996 ("lines" "lines" number)
2997 ("followups to author" "followup" string)))
2998 (types '((number ("less than" <)
3001 (string ("substring" s)
3005 (perms '(("temporary" (current-time-string))
3013 (if (eq type 'lower)
3018 (setq header (car headers))
3024 (let ((ts (cdr (assoc (nth 2 header) types)))
3040 'gnus-summary-score-entry
3042 (if (or (string= (nth 1 header)
3044 (string= (nth 1 header)
3047 (list 'gnus-summary-header
3049 (list 'quote (nth 1 (car ts)))
3050 (list 'gnus-score-delta-default
3057 (list (nreverse outp))))
3060 (list (nreverse outt))))
3062 (setq headers (cdr headers)))
3063 (list (nreverse outh))))))))
3066 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3067 (defvar bookmark-make-record-function)
3070 (defun gnus-summary-mode (&optional group)
3071 "Major mode for reading articles.
3073 All normal editing commands are switched off.
3074 \\<gnus-summary-mode-map>
3075 Each line in this buffer represents one article. To read an
3076 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3077 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3080 You can also post articles and send mail from this buffer. To
3081 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3082 of an article, type `\\[gnus-summary-reply]'.
3084 There are approx. one gazillion commands you can execute in this
3085 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3087 The following commands are available:
3089 \\{gnus-summary-mode-map}"
3091 (kill-all-local-variables)
3092 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3093 (gnus-summary-make-local-variables))
3094 (gnus-summary-make-local-variables)
3095 (setq gnus-newsgroup-name group)
3096 (when (gnus-visual-p 'summary-menu 'menu)
3097 (gnus-summary-make-menu-bar)
3098 (gnus-summary-make-tool-bar))
3099 (gnus-make-thread-indent-array)
3100 (gnus-simplify-mode-line)
3101 (setq major-mode 'gnus-summary-mode)
3102 (setq mode-name "Summary")
3103 (use-local-map gnus-summary-mode-map)
3104 (buffer-disable-undo)
3105 (setq buffer-read-only t ;Disable modification
3106 show-trailing-whitespace nil)
3107 (setq truncate-lines t)
3108 (add-to-invisibility-spec '(gnus-sum . t))
3109 (gnus-summary-set-display-table)
3110 (gnus-set-default-directory)
3111 (make-local-variable 'gnus-summary-line-format)
3112 (make-local-variable 'gnus-summary-line-format-spec)
3113 (make-local-variable 'gnus-summary-dummy-line-format)
3114 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3115 (make-local-variable 'gnus-summary-mark-positions)
3116 (gnus-make-local-hook 'pre-command-hook)
3117 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3118 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3119 (turn-on-gnus-mailing-list-mode)
3120 (mm-enable-multibyte)
3121 (set (make-local-variable 'bookmark-make-record-function)
3122 'gnus-summary-bookmark-make-record)
3123 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3124 (gnus-update-summary-mark-positions))
3126 (defun gnus-summary-make-local-variables ()
3127 "Make all the local summary buffer variables."
3129 (dolist (local gnus-summary-local-variables)
3132 (if (eq (cdr local) 'global)
3133 ;; Copy the global value of the variable.
3134 (setq global (symbol-value (car local)))
3135 ;; Use the value from the list.
3136 (setq global (eval (cdr local))))
3137 (set (make-local-variable (car local)) global))
3138 ;; Simple nil-valued local variable.
3139 (set (make-local-variable local) nil)))))
3141 ;; Summary data functions.
3143 (defmacro gnus-data-number (data)
3146 (defmacro gnus-data-set-number (data number)
3147 `(setcar ,data ,number))
3149 (defmacro gnus-data-mark (data)
3152 (defmacro gnus-data-set-mark (data mark)
3153 `(setcar (nthcdr 1 ,data) ,mark))
3155 (defmacro gnus-data-pos (data)
3158 (defmacro gnus-data-set-pos (data pos)
3159 `(setcar (nthcdr 2 ,data) ,pos))
3161 (defmacro gnus-data-header (data)
3164 (defmacro gnus-data-set-header (data header)
3165 `(setf (nth 3 ,data) ,header))
3167 (defmacro gnus-data-level (data)
3170 (defmacro gnus-data-unread-p (data)
3171 `(= (nth 1 ,data) gnus-unread-mark))
3173 (defmacro gnus-data-read-p (data)
3174 `(/= (nth 1 ,data) gnus-unread-mark))
3176 (defmacro gnus-data-pseudo-p (data)
3177 `(consp (nth 3 ,data)))
3179 (defmacro gnus-data-find (number)
3180 `(assq ,number gnus-newsgroup-data))
3182 (defmacro gnus-data-find-list (number &optional data)
3183 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3184 (memq (assq ,number bdata)
3187 (defmacro gnus-data-make (number mark pos header level)
3188 `(list ,number ,mark ,pos ,header ,level))
3190 (defun gnus-data-enter (after-article number mark pos header level offset)
3191 (let ((data (gnus-data-find-list after-article)))
3193 (error "No such article: %d" after-article))
3194 (setcdr data (cons (gnus-data-make number mark pos header level)
3196 (setq gnus-newsgroup-data-reverse nil)
3197 (gnus-data-update-list (cddr data) offset)))
3199 (defun gnus-data-enter-list (after-article list &optional offset)
3201 (let ((data (and after-article (gnus-data-find-list after-article)))
3205 (let ((odata gnus-newsgroup-data))
3206 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3208 (gnus-data-update-list odata offset)))
3209 ;; Find the last element in the list to be spliced into the main
3211 (setq list (last list))
3214 (setcdr list gnus-newsgroup-data)
3215 (setq gnus-newsgroup-data ilist)
3217 (gnus-data-update-list (cdr list) offset)))
3218 (setcdr list (cdr data))
3221 (gnus-data-update-list (cdr list) offset))))
3222 (setq gnus-newsgroup-data-reverse nil))))
3224 (defun gnus-data-remove (article &optional offset)
3225 (let ((data gnus-newsgroup-data))
3226 (if (= (gnus-data-number (car data)) article)
3228 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3229 gnus-newsgroup-data-reverse nil)
3231 (gnus-data-update-list gnus-newsgroup-data offset)))
3233 (when (= (gnus-data-number (cadr data)) article)
3234 (setcdr data (cddr data))
3236 (gnus-data-update-list (cdr data) offset))
3238 gnus-newsgroup-data-reverse nil))
3239 (setq data (cdr data))))))
3241 (defmacro gnus-data-list (backward)
3243 (or gnus-newsgroup-data-reverse
3244 (setq gnus-newsgroup-data-reverse
3245 (reverse gnus-newsgroup-data)))
3246 gnus-newsgroup-data))
3248 (defun gnus-data-update-list (data offset)
3249 "Add OFFSET to the POS of all data entries in DATA."
3250 (setq gnus-newsgroup-data-reverse nil)
3252 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3253 (setq data (cdr data))))
3255 (defun gnus-summary-article-pseudo-p (article)
3256 "Say whether this article is a pseudo article or not."
3257 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3259 (defmacro gnus-summary-article-sparse-p (article)
3260 "Say whether this article is a sparse article or not."
3261 `(memq ,article gnus-newsgroup-sparse))
3263 (defmacro gnus-summary-article-ancient-p (article)
3264 "Say whether this article is a sparse article or not."
3265 `(memq ,article gnus-newsgroup-ancient))
3267 (defun gnus-article-parent-p (number)
3268 "Say whether this article is a parent or not."
3269 (let ((data (gnus-data-find-list number)))
3270 (and (cdr data) ; There has to be an article after...
3271 (< (gnus-data-level (car data)) ; And it has to have a higher level.
3272 (gnus-data-level (nth 1 data))))))
3274 (defun gnus-article-children (number)
3275 "Return a list of all children to NUMBER."
3276 (let* ((data (gnus-data-find-list number))
3277 (level (gnus-data-level (car data)))
3279 (setq data (cdr data))
3281 (= (gnus-data-level (car data)) (1+ level)))
3282 (push (gnus-data-number (car data)) children)
3283 (setq data (cdr data)))
3286 (defmacro gnus-summary-skip-intangible ()
3287 "If the current article is intangible, then jump to a different article."
3288 '(let ((to (get-text-property (point) 'gnus-intangible)))
3289 (and to (gnus-summary-goto-subject to))))
3291 (defmacro gnus-summary-article-intangible-p ()
3292 "Say whether this article is intangible or not."
3293 '(get-text-property (point) 'gnus-intangible))
3295 (defun gnus-article-read-p (article)
3296 "Say whether ARTICLE is read or not."
3297 (not (or (memq article gnus-newsgroup-marked)
3298 (memq article gnus-newsgroup-spam-marked)
3299 (memq article gnus-newsgroup-unreads)
3300 (memq article gnus-newsgroup-unselected)
3301 (memq article gnus-newsgroup-dormant))))
3303 ;; Some summary mode macros.
3305 (defmacro gnus-summary-article-number ()
3306 "The article number of the article on the current line.
3307 If there isn't an article number here, then we return the current
3310 (gnus-summary-skip-intangible)
3311 (or (get-text-property (point) 'gnus-number)
3312 (gnus-summary-last-subject))))
3314 (defmacro gnus-summary-article-header (&optional number)
3315 "Return the header of article NUMBER."
3316 `(gnus-data-header (gnus-data-find
3317 ,(or number '(gnus-summary-article-number)))))
3319 (defmacro gnus-summary-thread-level (&optional number)
3320 "Return the level of thread that starts with article NUMBER."
3321 `(if (and (eq gnus-summary-make-false-root 'dummy)
3322 (get-text-property (point) 'gnus-intangible))
3324 (gnus-data-level (gnus-data-find
3325 ,(or number '(gnus-summary-article-number))))))
3327 (defmacro gnus-summary-article-mark (&optional number)
3328 "Return the mark of article NUMBER."
3329 `(gnus-data-mark (gnus-data-find
3330 ,(or number '(gnus-summary-article-number)))))
3332 (defmacro gnus-summary-article-pos (&optional number)
3333 "Return the position of the line of article NUMBER."
3334 `(gnus-data-pos (gnus-data-find
3335 ,(or number '(gnus-summary-article-number)))))
3337 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3338 (defmacro gnus-summary-article-subject (&optional number)
3339 "Return current subject string or nil if nothing."
3342 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3343 '(gnus-data-header (assq (gnus-summary-article-number)
3344 gnus-newsgroup-data)))))
3347 (mail-header-subject headers))))
3349 (defmacro gnus-summary-article-score (&optional number)
3350 "Return current article score."
3351 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3352 gnus-newsgroup-scored))
3353 gnus-summary-default-score 0))
3355 (defun gnus-summary-article-children (&optional number)
3356 "Return a list of article numbers that are children of article NUMBER."
3357 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3358 (level (gnus-data-level (car data)))
3360 (while (and (setq data (cdr data))
3361 (> (setq l (gnus-data-level (car data))) level))
3362 (and (= (1+ level) l)
3363 (push (gnus-data-number (car data))
3365 (nreverse children)))
3367 (defun gnus-summary-article-parent (&optional number)
3368 "Return the article number of the parent of article NUMBER."
3369 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3370 (gnus-data-list t)))
3371 (level (gnus-data-level (car data))))
3373 () ; This is a root.
3374 ;; We search until we find an article with a level less than
3375 ;; this one. That function has to be the parent.
3376 (while (and (setq data (cdr data))
3377 (not (< (gnus-data-level (car data)) level))))
3378 (and data (gnus-data-number (car data))))))
3380 (defun gnus-unread-mark-p (mark)
3381 "Say whether MARK is the unread mark."
3382 (= mark gnus-unread-mark))
3384 (defun gnus-read-mark-p (mark)
3385 "Say whether MARK is one of the marks that mark as read.
3386 This is all marks except unread, ticked, dormant, and expirable."
3387 (not (or (= mark gnus-unread-mark)
3388 (= mark gnus-ticked-mark)
3389 (= mark gnus-spam-mark)
3390 (= mark gnus-dormant-mark)
3391 (= mark gnus-expirable-mark))))
3393 (defmacro gnus-article-mark (number)
3394 "Return the MARK of article NUMBER.
3395 This macro should only be used when computing the mark the \"first\"
3396 time; i.e., when generating the summary lines. After that,
3397 `gnus-summary-article-mark' should be used to examine the
3400 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3401 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3402 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3403 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3404 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3405 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3406 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3407 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3408 gnus-ancient-mark))))
3410 ;; Saving hidden threads.
3412 (defmacro gnus-save-hidden-threads (&rest forms)
3413 "Save hidden threads, eval FORMS, and restore the hidden threads."
3414 (let ((config (make-symbol "config")))
3415 `(let ((,config (gnus-hidden-threads-configuration)))
3419 (gnus-restore-hidden-threads-configuration ,config)))))
3420 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3421 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3423 (defun gnus-data-compute-positions ()
3424 "Compute the positions of all articles."
3425 (setq gnus-newsgroup-data-reverse nil)
3426 (let ((data gnus-newsgroup-data))
3428 (gnus-save-hidden-threads
3429 (gnus-summary-show-all-threads)
3430 (goto-char (point-min))
3432 (while (get-text-property (point) 'gnus-intangible)
3434 (gnus-data-set-pos (car data) (+ (point) 3))
3435 (setq data (cdr data))
3436 (forward-line 1))))))
3438 (defun gnus-hidden-threads-configuration ()
3439 "Return the current hidden threads configuration."
3442 (goto-char (point-min))
3444 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3445 (push (save-excursion (forward-line 0) (point)) config))
3449 (defun gnus-restore-hidden-threads-configuration (config)
3450 "Restore hidden threads configuration from CONFIG."
3452 (let (point (inhibit-read-only t))
3453 (while (setq point (pop config))
3455 (gnus-summary-hide-thread)))))
3457 ;; Various summary mode internalish functions.
3459 (defun gnus-mouse-pick-article (e)
3462 (gnus-summary-next-page nil t))
3464 (defun gnus-summary-set-display-table ()
3465 "Change the display table.
3466 Odd characters have a tendency to mess
3467 up nicely formatted displays - we make all possible glyphs
3468 display only a single character."
3470 ;; We start from the standard display table, if any.
3471 (let ((table (or (copy-sequence standard-display-table)
3472 (make-display-table)))
3474 ;; Nix out all the control chars...
3475 (while (>= (setq i (1- i)) 0)
3476 (gnus-put-display-table i [??] table))
3477 ;; ... but not newline and cr, of course. (cr is necessary for the
3478 ;; selective display).
3479 (gnus-put-display-table ?\n nil table)
3480 (gnus-put-display-table ?\r nil table)
3481 ;; We keep TAB as well.
3482 (gnus-put-display-table ?\t nil table)
3483 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3484 ;; Emacs 23 (unicode), that are not set already.
3485 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3488 (while (>= (setq i (1- i)) 127)
3489 ;; Only modify if the entry is nil.
3490 (unless (gnus-get-display-table i table)
3491 (gnus-put-display-table i [??] table))))
3492 (setq buffer-display-table table)))
3494 (defun gnus-summary-set-article-display-arrow (pos)
3495 "Update the overlay arrow to point to line at position POS."
3496 (when gnus-summary-display-arrow
3497 (make-local-variable 'overlay-arrow-position)
3498 (make-local-variable 'overlay-arrow-string)
3502 (unless overlay-arrow-position
3503 (setq overlay-arrow-position (make-marker)))
3504 (setq overlay-arrow-string "=>"
3505 overlay-arrow-position (set-marker overlay-arrow-position
3507 (current-buffer))))))
3509 (defun gnus-summary-setup-buffer (group)
3510 "Initialize summary buffer."
3511 (let ((buffer (gnus-summary-buffer-name group))
3512 (dead-name (concat "*Dead Summary "
3513 (gnus-group-decoded-name group) "*")))
3514 ;; If a dead summary buffer exists, we kill it.
3515 (when (gnus-buffer-live-p dead-name)
3516 (gnus-kill-buffer dead-name))
3517 (if (get-buffer buffer)
3520 (setq gnus-summary-buffer (current-buffer))
3521 (not gnus-newsgroup-prepared))
3522 ;; Fix by Sudish Joseph <joseph@cis.ohio-state.edu>
3523 (setq gnus-summary-buffer (set-buffer (gnus-get-buffer-create buffer)))
3524 (gnus-summary-mode group)
3525 (when (gnus-group-quit-config group)
3526 (set (make-local-variable 'gnus-single-article-buffer) nil))
3527 (make-local-variable 'gnus-article-buffer)
3528 (make-local-variable 'gnus-article-current)
3529 (make-local-variable 'gnus-original-article-buffer)
3530 (setq gnus-newsgroup-name group)
3531 ;; Set any local variables in the group parameters.
3532 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3535 (defun gnus-set-global-variables ()
3536 "Set the global equivalents of the buffer-local variables.
3537 They are set to the latest values they had. These reflect the summary
3538 buffer that was in action when the last article was fetched."
3539 (when (eq major-mode 'gnus-summary-mode)
3540 (setq gnus-summary-buffer (current-buffer))
3541 (let ((name gnus-newsgroup-name)
3542 (marked gnus-newsgroup-marked)
3543 (spam gnus-newsgroup-spam-marked)
3544 (unread gnus-newsgroup-unreads)
3545 (headers gnus-current-headers)
3546 (data gnus-newsgroup-data)
3547 (summary gnus-summary-buffer)
3548 (article-buffer gnus-article-buffer)
3549 (original gnus-original-article-buffer)
3550 (gac gnus-article-current)
3551 (reffed gnus-reffed-article-number)
3552 (score-file gnus-current-score-file)
3553 (default-charset gnus-newsgroup-charset)
3555 (let ((locals gnus-newsgroup-variables))
3557 (if (consp (car locals))
3558 (push (eval (caar locals)) vlist)
3559 (push (eval (car locals)) vlist))
3560 (setq locals (cdr locals)))
3561 (setq vlist (nreverse vlist)))
3562 (with-current-buffer gnus-group-buffer
3563 (setq gnus-newsgroup-name name
3564 gnus-newsgroup-marked marked
3565 gnus-newsgroup-spam-marked spam
3566 gnus-newsgroup-unreads unread
3567 gnus-current-headers headers
3568 gnus-newsgroup-data data
3569 gnus-article-current gac
3570 gnus-summary-buffer summary
3571 gnus-article-buffer article-buffer
3572 gnus-original-article-buffer original
3573 gnus-reffed-article-number reffed
3574 gnus-current-score-file score-file
3575 gnus-newsgroup-charset default-charset)
3576 (let ((locals gnus-newsgroup-variables))
3578 (if (consp (car locals))
3579 (set (caar locals) (pop vlist))
3580 (set (car locals) (pop vlist)))
3581 (setq locals (cdr locals))))
3582 ;; The article buffer also has local variables.
3583 (when (gnus-buffer-live-p gnus-article-buffer)
3584 (set-buffer gnus-article-buffer)
3585 (setq gnus-summary-buffer summary))))))
3587 (defun gnus-summary-article-unread-p (article)
3588 "Say whether ARTICLE is unread or not."
3589 (memq article gnus-newsgroup-unreads))
3591 (defun gnus-summary-first-article-p (&optional article)
3592 "Return whether ARTICLE is the first article in the buffer."
3593 (if (not (setq article (or article (gnus-summary-article-number))))
3595 (eq article (caar gnus-newsgroup-data))))
3597 (defun gnus-summary-last-article-p (&optional article)
3598 "Return whether ARTICLE is the last article in the buffer."
3599 (if (not (setq article (or article (gnus-summary-article-number))))
3600 ;; All non-existent numbers are the last article. :-)
3602 (not (cdr (gnus-data-find-list article)))))
3604 (defun gnus-make-thread-indent-array (&optional n)
3606 (progn (setq n 200) nil)
3607 (null gnus-thread-indent-array)
3608 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3609 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3610 gnus-thread-indent-array-level gnus-thread-indent-level)
3612 (aset gnus-thread-indent-array n
3613 (make-string (* n gnus-thread-indent-level) ? ))
3616 (defun gnus-update-summary-mark-positions ()
3617 "Compute where the summary marks are to go."
3619 (when (gnus-buffer-exists-p gnus-summary-buffer)
3620 (set-buffer gnus-summary-buffer))
3621 (let ((spec gnus-summary-line-format-spec)
3624 (gnus-set-work-buffer)
3625 (let ((gnus-tmp-unread ?Z)
3626 (gnus-replied-mark ?Z)
3627 (gnus-score-below-mark ?Z)
3628 (gnus-score-over-mark ?Z)
3629 (gnus-undownloaded-mark ?Z)
3630 (gnus-summary-line-format-spec spec)
3631 (gnus-newsgroup-downloadable '(0))
3632 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3633 case-fold-search ignores)
3634 ;; Here, all marks are bound to Z.
3635 (gnus-summary-insert-line header
3636 0 nil t gnus-tmp-unread t nil "" nil 1)
3637 (goto-char (point-min))
3638 ;; Memorize the positions of the same characters as dummy marks.
3639 (while (re-search-forward "[A-D]" nil t)
3640 (push (point) ignores))
3642 ;; We use A-D as dummy marks in order to know column positions
3643 ;; where marks should be inserted.
3644 (setq gnus-tmp-unread ?A
3645 gnus-replied-mark ?B
3646 gnus-score-below-mark ?C
3647 gnus-score-over-mark ?C
3648 gnus-undownloaded-mark ?D)
3649 (gnus-summary-insert-line header
3650 0 nil t gnus-tmp-unread t nil "" nil 1)
3651 ;; Ignore characters which aren't dummy marks.
3653 (delete-region (goto-char (1- p)) p)
3655 (goto-char (point-min))
3656 (setq pos (list (cons 'unread
3657 (and (search-forward "A" nil t)
3658 (- (point) (point-min) 1)))))
3659 (goto-char (point-min))
3660 (push (cons 'replied (and (search-forward "B" nil t)
3661 (- (point) (point-min) 1)))
3663 (goto-char (point-min))
3664 (push (cons 'score (and (search-forward "C" nil t)
3665 (- (point) (point-min) 1)))
3667 (goto-char (point-min))
3668 (push (cons 'download (and (search-forward "D" nil t)
3669 (- (point) (point-min) 1)))
3671 (setq gnus-summary-mark-positions pos))))
3673 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3674 "Insert a dummy root in the summary buffer."
3676 (gnus-add-text-properties
3677 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3678 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3680 (defun gnus-summary-extract-address-component (from)
3681 (or (car (funcall gnus-extract-address-components from))
3684 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3685 (let ((mail-parse-charset gnus-newsgroup-charset)
3686 (ignored-from-addresses (gnus-ignored-from-addresses))
3687 ; Is it really necessary to do this next part for each summary line?
3688 ; Luckily, doesn't seem to slow things down much.
3689 (mail-parse-ignored-charsets
3690 (with-current-buffer gnus-summary-buffer
3691 gnus-newsgroup-ignored-charsets)))
3693 (and ignored-from-addresses
3694 (string-match ignored-from-addresses gnus-tmp-from)
3695 (let ((extra-headers (mail-header-extra header))
3699 ((setq to (cdr (assq 'To extra-headers)))
3700 (concat gnus-summary-to-prefix
3702 (gnus-summary-extract-address-component
3703 (funcall gnus-decode-encoded-address-function to)))))
3706 (cdr (assq 'Newsgroups extra-headers))
3708 (memq 'Newsgroups gnus-extra-headers)
3709 (eq (car (gnus-find-method-for-group
3710 gnus-newsgroup-name)) 'nntp)
3711 (gnus-group-real-name gnus-newsgroup-name))))
3712 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3713 (gnus-string-mark-left-to-right
3715 (gnus-summary-extract-address-component gnus-tmp-from))))))
3717 (defun gnus-summary-insert-line (gnus-tmp-header
3718 gnus-tmp-level gnus-tmp-current
3719 undownloaded gnus-tmp-unread gnus-tmp-replied
3720 gnus-tmp-expirable gnus-tmp-subject-or-nil
3721 &optional gnus-tmp-dummy gnus-tmp-score
3723 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3724 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3726 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3727 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3728 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3729 (gnus-tmp-score-char
3730 (if (or (null gnus-summary-default-score)
3731 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3732 gnus-summary-zcore-fuzz))
3734 (if (< gnus-tmp-score gnus-summary-default-score)
3735 gnus-score-below-mark gnus-score-over-mark)))
3736 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3738 (cond (gnus-tmp-process gnus-process-mark)
3739 ((memq gnus-tmp-current gnus-newsgroup-cached)
3741 (gnus-tmp-replied gnus-replied-mark)
3742 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3743 gnus-forwarded-mark)
3744 ((memq gnus-tmp-current gnus-newsgroup-saved)
3746 ((memq gnus-tmp-number gnus-newsgroup-recent)
3748 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3751 (gnus-tmp-downloaded
3753 gnus-undownloaded-mark)
3754 (gnus-newsgroup-agentized
3755 gnus-downloaded-mark)
3758 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3761 ((string-match "<[^>]+> *$" gnus-tmp-from)
3762 (let ((beg (match-beginning 0)))
3763 (or (and (string-match "^\".+\"" gnus-tmp-from)
3764 (substring gnus-tmp-from 1 (1- (match-end 0))))
3765 (substring gnus-tmp-from 0 beg))))
3766 ((string-match "(.+)" gnus-tmp-from)
3767 (substring gnus-tmp-from
3768 (1+ (match-beginning 0)) (1- (match-end 0))))
3770 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3771 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3772 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3773 (inhibit-read-only t))
3774 (when (string= gnus-tmp-name "")
3775 (setq gnus-tmp-name gnus-tmp-from))
3776 (unless (numberp gnus-tmp-lines)
3777 (setq gnus-tmp-lines -1))
3778 (if (= gnus-tmp-lines -1)
3779 (setq gnus-tmp-lines "?")
3780 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3782 (gnus-put-text-property
3784 (progn (eval gnus-summary-line-format-spec) (point))
3785 'gnus-number gnus-tmp-number)
3786 (error (gnus-message 5 "Error updating the summary line")))
3787 (when (gnus-visual-p 'summary-highlight 'highlight)
3789 (gnus-summary-highlight-line)
3790 (gnus-run-hooks 'gnus-summary-update-hook)
3793 (defun gnus-summary-update-line (&optional dont-update)
3794 "Update summary line after change."
3795 (when (and gnus-summary-default-score
3796 (not gnus-summary-inhibit-highlight))
3797 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3798 (article (gnus-summary-article-number))
3799 (score (gnus-summary-article-score article)))
3801 (if (and gnus-summary-mark-below
3802 (< (gnus-summary-article-score)
3803 gnus-summary-mark-below))
3804 ;; This article has a low score, so we mark it as read.
3805 (when (memq article gnus-newsgroup-unreads)
3806 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3807 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3808 ;; This article was previously marked as read on account
3809 ;; of a low score, but now it has risen, so we mark it as
3811 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3812 (gnus-summary-update-mark
3813 (if (or (null gnus-summary-default-score)
3814 (<= (abs (- score gnus-summary-default-score))
3815 gnus-summary-zcore-fuzz))
3817 (if (< score gnus-summary-default-score)
3818 gnus-score-below-mark gnus-score-over-mark))
3820 ;; Do visual highlighting.
3821 (when (gnus-visual-p 'summary-highlight 'highlight)
3822 (gnus-summary-highlight-line)
3823 (gnus-run-hooks 'gnus-summary-update-hook)))))
3825 (defvar gnus-tmp-new-adopts nil)
3827 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3828 "Return the number of articles in THREAD.
3829 This may be 0 in some cases -- if none of the articles in
3830 the thread are to be displayed."
3832 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3834 ((not (listp thread))
3836 ((and (consp thread) (cdr thread))
3839 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3842 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3845 (when (and level (zerop level) gnus-tmp-new-adopts)
3848 'gnus-summary-number-of-articles-in-thread
3849 gnus-tmp-new-adopts))))
3851 (if (> number 1) gnus-not-empty-thread-mark
3852 gnus-empty-thread-mark)
3855 (defsubst gnus-summary-line-message-size (head)
3856 "Return pretty-printed version of message size.
3857 This function is intended to be used in
3858 `gnus-summary-line-format-alist'."
3859 (let ((c (or (mail-header-chars head) -1)))
3860 (cond ((< c 0) "n/a") ; chars not available
3861 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3862 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3863 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3864 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3866 (defcustom gnus-user-date-format-alist
3867 '(((gnus-seconds-today) . "Today, %H:%M")
3868 ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M")
3869 (604800 . "%A %H:%M") ; That's one week
3870 ((gnus-seconds-month) . "%A %d")
3871 ((gnus-seconds-year) . "%B %d")
3872 (t . "%b %d %Y")) ; This one is used when no other
3874 "Specifies date format depending on age of article.
3875 This is an alist of items (AGE . FORMAT). AGE can be a number (of
3876 seconds) or a Lisp expression evaluating to a number. When the age of
3877 the article is less than this number, then use `format-time-string'
3878 with the corresponding FORMAT for displaying the date of the article.
3879 If AGE is not a number or a Lisp expression evaluating to a
3880 non-number, then the corresponding FORMAT is used as a default value.
3882 Note that the list is processed from the beginning, so it should be
3883 sorted by ascending AGE. Also note that items following the first
3884 non-number AGE will be ignored.
3886 You can use the functions `gnus-seconds-today', `gnus-seconds-month'
3887 and `gnus-seconds-year' in the AGE spec. They return the number of
3888 seconds passed since the start of today, of this month, of this year,
3891 :group 'gnus-summary-format
3892 :type '(alist :key-type sexp :value-type string))
3894 (defun gnus-user-date (messy-date)
3895 "Format the messy-date according to `gnus-user-date-format-alist'.
3896 Returns \" ? \" if there's bad input or if another error occurs.
3897 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3899 (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date)))
3900 (now (gnus-float-time))
3901 ;;If we don't find something suitable we'll use this one
3902 (my-format "%b %d '%y"))
3903 (let* ((difference (- now messy-date))
3904 (templist gnus-user-date-format-alist)
3905 (top (eval (caar templist))))
3906 (while (if (numberp top) (< top difference) (not top))
3908 (setq templist (cdr templist))
3909 (setq top (eval (caar templist)))))
3910 (if (stringp (cdr (car templist)))
3911 (setq my-format (cdr (car templist)))))
3912 (format-time-string (eval my-format) (seconds-to-time messy-date)))
3915 (defun gnus-summary-set-local-parameters (group)
3916 "Go through the local params of GROUP and set all variable specs in that list."
3917 (let ((vars '(quit-config active))) ; Ignore things that aren't
3919 (dolist (elem (gnus-group-find-parameter group))
3920 (and (consp elem) ; Has to be a cons.
3921 (consp (cdr elem)) ; The cdr has to be a list.
3922 (symbolp (car elem)) ; Has to be a symbol in there.
3923 (not (memq (car elem) vars))
3925 (push (car elem) vars)
3926 ;; Variables like `gnus-show-threads' that are globally
3927 ;; bound, if used as group parameters, need to get to be
3928 ;; buffer-local, whereas just parameters like `gcc-self',
3929 ;; `timestamp', etc. should not be bound as variables.
3930 (if (boundp (car elem))
3931 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3932 (eval (nth 1 elem))))))))
3934 (defun gnus-summary-read-group (group &optional show-all no-article
3935 kill-buffer no-display backward
3937 "Start reading news in newsgroup GROUP.
3938 If SHOW-ALL is non-nil, already read articles are also listed.
3939 If NO-ARTICLE is non-nil, no article is selected initially.
3940 If NO-DISPLAY, don't generate a summary buffer."
3944 (let ((gnus-auto-select-next nil))
3945 (or (gnus-summary-read-group-1
3946 group show-all no-article
3947 kill-buffer no-display
3950 select-articles nil)))))
3951 (eq gnus-auto-select-next 'quietly))
3952 (set-buffer gnus-group-buffer)
3953 ;; The entry function called above goes to the next
3954 ;; group automatically, so we go two groups back
3955 ;; if we are searching for the previous group.
3957 (gnus-group-prev-unread-group 2))
3958 (if (not (equal group (gnus-group-group-name)))
3959 (setq group (gnus-group-group-name))
3963 (defun gnus-summary-read-group-1 (group show-all no-article
3964 kill-buffer no-display
3965 &optional select-articles)
3966 ;; Killed foreign groups can't be entered.
3967 ;; (when (and (not (gnus-group-native-p group))
3968 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3969 ;; (error "Dead non-native groups can't be entered"))
3970 (gnus-message 5 "Retrieving newsgroup: %s..."
3971 (gnus-group-decoded-name group))
3972 (let* ((new-group (gnus-summary-setup-buffer group))
3973 (quit-config (gnus-group-quit-config group))
3974 (did-select (and new-group (gnus-select-newsgroup
3975 group show-all select-articles))))
3977 ;; This summary buffer exists already, so we just select it.
3979 (gnus-set-global-variables)
3981 (gnus-kill-or-deaden-summary kill-buffer))
3982 (gnus-configure-windows 'summary 'force)
3983 (gnus-set-mode-line 'summary)
3984 (gnus-summary-position-point)
3987 ;; We couldn't select this group.
3989 (when (and (eq major-mode 'gnus-summary-mode)
3990 (not (equal (current-buffer) kill-buffer)))
3991 (kill-buffer (current-buffer))
3992 (if (not quit-config)
3994 ;; Update the info -- marks might need to be removed,
3996 (gnus-summary-update-info)
3997 (set-buffer gnus-group-buffer)
3998 (gnus-group-jump-to-group group)
3999 (gnus-group-next-unread-group 1))
4000 (gnus-handle-ephemeral-exit quit-config)))
4001 (if (null (gnus-list-of-unread-articles group))
4002 (gnus-message 3 "Group %s contains no messages" group)
4003 (gnus-message 3 "Can't select group"))
4005 ;; The user did a `C-g' while prompting for number of articles,
4006 ;; so we exit this group.
4007 ((eq did-select 'quit)
4008 (and (eq major-mode 'gnus-summary-mode)
4009 (not (equal (current-buffer) kill-buffer))
4010 (kill-buffer (current-buffer)))
4012 (gnus-kill-or-deaden-summary kill-buffer))
4013 (if (not quit-config)
4015 (set-buffer gnus-group-buffer)
4016 (gnus-group-jump-to-group group)
4017 (gnus-configure-windows 'group 'force))
4018 (gnus-handle-ephemeral-exit quit-config))
4019 ;; Finally signal the quit.
4021 ;; The group was successfully selected.
4023 (gnus-set-global-variables)
4024 ;; Save the active value in effect when the group was entered.
4025 (setq gnus-newsgroup-active
4027 (gnus-active gnus-newsgroup-name)))
4028 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
4029 ;; You can change the summary buffer in some way with this hook.
4030 (gnus-run-hooks 'gnus-select-group-hook)
4031 (when (memq 'summary (gnus-update-format-specifications
4032 nil 'summary 'summary-mode 'summary-dummy))
4033 ;; The format specification for the summary line was updated,
4034 ;; so we need to update the mark positions as well.
4035 (gnus-update-summary-mark-positions))
4036 ;; Do score processing.
4037 (when gnus-use-scoring
4038 (gnus-possibly-score-headers))
4039 ;; Check whether to fill in the gaps in the threads.
4040 (when gnus-build-sparse-threads
4041 (gnus-build-sparse-threads))
4042 ;; Find the initial limit.
4044 (let ((gnus-newsgroup-dormant nil))
4045 (gnus-summary-initial-limit show-all))
4046 (gnus-summary-initial-limit show-all))
4047 ;; Generate the summary buffer.
4049 (gnus-summary-prepare))
4050 (when gnus-use-trees
4051 (gnus-tree-open group)
4052 (setq gnus-summary-highlight-line-function
4053 'gnus-tree-highlight-article))
4054 ;; If the summary buffer is empty, but there are some low-scored
4055 ;; articles or some excluded dormants, we include these in the
4057 (when (and (zerop (buffer-size))
4059 (cond (gnus-newsgroup-dormant
4060 (gnus-summary-limit-include-dormant))
4061 ((and gnus-newsgroup-scored show-all)
4062 (gnus-summary-limit-include-expunged t))))
4063 ;; Function `gnus-apply-kill-file' must be called in this hook.
4064 (gnus-run-hooks 'gnus-apply-kill-hook)
4065 (if (and (zerop (buffer-size))
4068 ;; This newsgroup is empty.
4069 (gnus-summary-catchup-and-exit nil t)
4070 (gnus-message 6 "No unread news")
4072 (gnus-kill-or-deaden-summary kill-buffer))
4073 ;; Return nil from this function.
4075 ;; Hide conversation thread subtrees. We cannot do this in
4076 ;; gnus-summary-prepare-hook since kill processing may not
4077 ;; work with hidden articles.
4078 (gnus-summary-maybe-hide-threads)
4079 (gnus-configure-windows 'summary)
4081 (gnus-kill-or-deaden-summary kill-buffer))
4082 (gnus-summary-auto-select-subject)
4083 ;; Show first unread article if requested.
4084 (if (and (not no-article)
4086 gnus-newsgroup-unreads
4087 gnus-auto-select-first)
4089 (let ((art (gnus-summary-article-number)))
4090 (unless (and (not gnus-plugged)
4091 (or (memq art gnus-newsgroup-undownloaded)
4092 (memq art gnus-newsgroup-downloadable)))
4093 (gnus-summary-goto-article art))))
4094 ;; Don't select any articles.
4095 (gnus-summary-position-point)
4096 (gnus-configure-windows 'summary 'force)
4097 (gnus-set-mode-line 'summary))
4098 (when (and gnus-auto-center-group
4099 (get-buffer-window gnus-group-buffer t))
4100 ;; Gotta use windows, because recenter does weird stuff if
4101 ;; the current buffer ain't the displayed window.
4102 (let ((owin (selected-window)))
4103 (select-window (get-buffer-window gnus-group-buffer t))
4104 (when (gnus-group-goto-group group)
4106 (select-window owin)))
4107 ;; Mark this buffer as "prepared".
4108 (setq gnus-newsgroup-prepared t)
4109 (gnus-run-hooks 'gnus-summary-prepared-hook)
4110 (unless (gnus-ephemeral-group-p group)
4111 (gnus-group-update-group group nil t))
4114 (defun gnus-summary-auto-select-subject ()
4115 "Select the subject line on initial group entry."
4116 (goto-char (point-min))
4118 ((eq gnus-auto-select-subject 'best)
4119 (gnus-summary-best-unread-subject))
4120 ((eq gnus-auto-select-subject 'unread)
4121 (gnus-summary-first-unread-subject))
4122 ((eq gnus-auto-select-subject 'unseen)
4123 (gnus-summary-first-unseen-subject))
4124 ((eq gnus-auto-select-subject 'unseen-or-unread)
4125 (gnus-summary-first-unseen-or-unread-subject))
4126 ((eq gnus-auto-select-subject 'first)
4129 ((functionp gnus-auto-select-subject)
4130 (funcall gnus-auto-select-subject))))
4132 (defun gnus-summary-prepare ()
4133 "Generate the summary buffer."
4135 (let ((inhibit-read-only t))
4137 (setq gnus-newsgroup-data nil
4138 gnus-newsgroup-data-reverse nil)
4139 (gnus-run-hooks 'gnus-summary-generate-hook)
4140 ;; Generate the buffer, either with threads or without.
4141 (when gnus-newsgroup-headers
4142 (gnus-summary-prepare-threads
4143 (if gnus-show-threads
4144 (gnus-sort-gathered-threads
4145 (funcall gnus-summary-thread-gathering-function
4147 (gnus-cut-threads (gnus-make-threads)))))
4148 ;; Unthreaded display.
4149 (gnus-sort-articles gnus-newsgroup-headers))))
4150 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4151 ;; Call hooks for modifying summary buffer.
4152 (goto-char (point-min))
4153 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4155 (defsubst gnus-general-simplify-subject (subject)
4156 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4159 ;; Truncate the subject.
4160 (gnus-simplify-subject-functions
4161 (gnus-map-function gnus-simplify-subject-functions subject))
4162 ((numberp gnus-summary-gather-subject-limit)
4163 (setq subject (gnus-simplify-subject-re subject))
4164 (if (> (length subject) gnus-summary-gather-subject-limit)
4165 (substring subject 0 gnus-summary-gather-subject-limit)
4167 ;; Fuzzily simplify it.
4168 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4169 (gnus-simplify-subject-fuzzy subject))
4170 ;; Just remove the leading "Re:".
4172 (gnus-simplify-subject-re subject))))
4174 (if (and gnus-summary-gather-exclude-subject
4175 (string-match gnus-summary-gather-exclude-subject subject))
4176 nil ; This article shouldn't be gathered
4179 (defun gnus-summary-simplify-subject-query ()
4180 "Query where the respool algorithm would put this article."
4182 (gnus-summary-select-article)
4183 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4185 (defun gnus-gather-threads-by-subject (threads)
4186 "Gather threads by looking at Subject headers."
4187 (if (not gnus-summary-make-false-root)
4189 (let ((hashtb (gnus-make-hashtable 1024))
4192 subject hthread whole-subject)
4194 (setq subject (gnus-general-simplify-subject
4195 (setq whole-subject (mail-header-subject
4198 (if (setq hthread (gnus-gethash subject hashtb))
4200 ;; We enter a dummy root into the thread, if we
4201 ;; haven't done that already.
4202 (unless (stringp (caar hthread))
4203 (setcar hthread (list whole-subject (car hthread))))
4204 ;; We add this new gathered thread to this gathered
4206 (setcdr (car hthread)
4207 (nconc (cdar hthread) (list (car threads))))
4208 ;; Remove it from the list of threads.
4209 (setcdr prev (cdr threads))
4210 (setq threads prev))
4211 ;; Enter this thread into the hash table.
4212 (gnus-sethash subject
4213 (if gnus-summary-make-false-root-always
4215 ;; If you want a dummy root above all
4217 (setcar threads (list whole-subject
4223 (setq threads (cdr threads)))
4226 (defun gnus-gather-threads-by-references (threads)
4227 "Gather threads by looking at References headers."
4228 (let ((idhashtb (gnus-make-hashtable 1024))
4229 (thhashtb (gnus-make-hashtable 1024))
4232 ids references id gthread gid entered ref)
4234 (when (setq references (mail-header-references (caar threads)))
4235 (setq id (mail-header-id (caar threads))
4236 ids (inline (gnus-split-references references))
4238 (while (setq ref (pop ids))
4239 (setq ids (delete ref ids))
4240 (if (not (setq gid (gnus-gethash ref idhashtb)))
4242 (gnus-sethash ref id idhashtb)
4243 (gnus-sethash id threads thhashtb))
4244 (setq gthread (gnus-gethash gid thhashtb))
4246 ;; We enter a dummy root into the thread, if we
4247 ;; haven't done that already.
4248 (unless (stringp (caar gthread))
4249 (setcar gthread (list (mail-header-subject (caar gthread))
4251 ;; We add this new gathered thread to this gathered
4253 (setcdr (car gthread)
4254 (nconc (cdar gthread) (list (car threads)))))
4255 ;; Add it into the thread hash table.
4256 (gnus-sethash id gthread thhashtb)
4258 ;; Remove it from the list of threads.
4259 (setcdr prev (cdr threads))
4260 (setq threads prev))))
4262 (setq threads (cdr threads)))
4265 (defun gnus-sort-gathered-threads (threads)
4266 "Sort subtreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4267 (let ((result threads))
4269 (when (stringp (caar threads))
4270 (setcdr (car threads)
4271 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4272 (setq threads (cdr threads)))
4275 (defun gnus-thread-loop-p (root thread)
4276 "Say whether ROOT is in THREAD."
4277 (let ((stack (list thread))
4280 (while (setq thread (pop stack))
4281 (setq th (cdr thread))
4283 (not (eq (caar th) root)))
4286 ;; We have found a loop.
4288 (setcdr thread (delq (car th) (cdr thread)))
4289 (if (boundp (setq ref-dep (intern "none"
4290 gnus-newsgroup-dependencies)))
4291 (setcdr (symbol-value ref-dep)
4292 (nconc (cdr (symbol-value ref-dep))
4294 (set ref-dep (list nil (car th))))
4297 ;; Push all the subthreads onto the stack.
4298 (push (cdr thread) stack)))
4301 (defun gnus-make-threads ()
4302 "Go through the dependency hashtb and find the roots. Return all threads."
4304 (while (catch 'infloop
4307 ;; Deal with self-referencing References loops.
4308 (when (and (car (symbol-value refs))
4315 (car (symbol-value refs)) thread))
4316 (cdr (symbol-value refs)))))))
4319 (unless (car (symbol-value refs))
4320 ;; These threads do not refer back to any other
4321 ;; articles, so they're roots.
4322 (setq threads (append (cdr (symbol-value refs)) threads))))
4323 gnus-newsgroup-dependencies)))
4326 ;; Build the thread tree.
4327 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4328 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4330 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4331 if it was already present.
4333 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4334 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4335 Message-IDs will be renamed to a unique Message-ID before being
4338 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4339 (let* ((id (mail-header-id header))
4340 (id-dep (and id (intern id dependencies)))
4341 parent-id ref ref-dep ref-header replaced)
4342 ;; Enter this `header' in the `dependencies' table.
4346 ;; The first two cases do the normal part: enter a new `header'
4347 ;; in the `dependencies' table.
4348 ((not (boundp id-dep))
4349 (set id-dep (list header)))
4350 ((null (car (symbol-value id-dep)))
4351 (setcar (symbol-value id-dep) header))
4353 ;; From here the `header' was already present in the
4354 ;; `dependencies' table.
4356 ;; Overrides an existing entry;
4357 ;; just set the header part of the entry.
4358 (setcar (symbol-value id-dep) header)
4361 ;; Renames the existing `header' to a unique Message-ID.
4362 ((not gnus-summary-ignore-duplicates)
4363 ;; An article with this Message-ID has already been seen.
4364 ;; We rename the Message-ID.
4365 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4367 (mail-header-set-id header id))
4369 ;; The last case ignores an existing entry, except it adds any
4370 ;; additional Xrefs (in case the two articles came from different
4372 ;; Also sets `header' to `nil' meaning that the `dependencies'
4373 ;; table was *not* modified.
4375 (mail-header-set-xref
4376 (car (symbol-value id-dep))
4377 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4379 (or (mail-header-xref header) "")))
4382 (when (and header (not replaced))
4383 ;; First check that we are not creating a References loop.
4384 (setq parent-id (gnus-parent-id (mail-header-references header)))
4385 (setq ref parent-id)
4387 (setq ref-dep (intern-soft ref dependencies))
4389 (setq ref-header (car (symbol-value ref-dep))))
4390 (if (string= id ref)
4391 ;; Yuk! This is a reference loop. Make the article be a
4394 (mail-header-set-references (car (symbol-value id-dep)) "none")
4396 (setq parent-id nil))
4397 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4398 (setq ref-dep (intern (or parent-id "none") dependencies))
4399 (if (boundp ref-dep)
4400 (setcdr (symbol-value ref-dep)
4401 (nconc (cdr (symbol-value ref-dep))
4402 (list (symbol-value id-dep))))
4403 (set ref-dep (list nil (symbol-value id-dep)))))
4406 (defun gnus-extract-message-id-from-in-reply-to (string)
4407 (if (string-match "<[^>]+>" string)
4408 (substring string (match-beginning 0) (match-end 0))
4411 (defun gnus-build-sparse-threads ()
4412 (let ((headers gnus-newsgroup-headers)
4413 (mail-parse-charset gnus-newsgroup-charset)
4414 (gnus-summary-ignore-duplicates t)
4415 header references generation relations
4416 subject child end new-child date)
4417 ;; First we create an alist of generations/relations, where
4418 ;; generations is how much we trust the relation, and the relation
4420 (gnus-message 7 "Making sparse threads...")
4422 (nnheader-set-temp-buffer " *gnus sparse threads*")
4423 (while (setq header (pop headers))
4424 (when (and (setq references (mail-header-references header))
4425 (not (string= references "")))
4427 (setq child (mail-header-id header)
4428 subject (mail-header-subject header)
4429 date (mail-header-date header)
4431 (while (search-backward ">" nil t)
4432 (setq end (1+ (point)))
4433 (when (search-backward "<" nil t)
4434 (setq new-child (buffer-substring (point) end))
4435 (push (list (incf generation)
4436 child (setq child new-child)
4440 (push (list (1+ generation) child nil subject) relations))
4442 (kill-buffer (current-buffer)))
4443 ;; Sort over trustworthiness.
4444 (dolist (relation (sort relations 'car-less-than-car))
4445 (when (gnus-dependencies-add-header
4446 (make-full-mail-header
4447 gnus-reffed-article-number
4448 (nth 3 relation) "" (or (nth 4 relation) "")
4450 (or (nth 2 relation) "") 0 0 "")
4451 gnus-newsgroup-dependencies nil)
4452 (push gnus-reffed-article-number gnus-newsgroup-limit)
4453 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4454 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4455 gnus-newsgroup-reads)
4456 (decf gnus-reffed-article-number)))
4457 (gnus-message 7 "Making sparse threads...done")))
4459 (defun gnus-build-old-threads ()
4460 ;; Look at all the articles that refer back to old articles, and
4461 ;; fetch the headers for the articles that aren't there. This will
4462 ;; build complete threads - if the roots haven't been expired by the
4464 (let ((mail-parse-charset gnus-newsgroup-charset)
4468 (when (not (car (symbol-value refs)))
4469 (setq heads (cdr (symbol-value refs)))
4471 (if (memq (mail-header-number (caar heads))
4472 gnus-newsgroup-dormant)
4473 (setq heads (cdr heads))
4474 (setq id (symbol-name refs))
4475 (while (and (setq id (gnus-build-get-header id))
4476 (not (car (gnus-id-to-thread id)))))
4477 (setq heads nil)))))
4478 gnus-newsgroup-dependencies)))
4480 (defsubst gnus-remove-odd-characters (string)
4481 "Translate STRING into something that doesn't contain weird characters."
4482 (mm-subst-char-in-string
4484 (mm-subst-char-in-string ?\n ?\- string t) t))
4486 ;; This function has to be called with point after the article number
4487 ;; on the beginning of the line.
4488 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4489 (let ((eol (point-at-eol))
4490 (buffer (current-buffer))
4491 header references in-reply-to)
4493 ;; overview: [num subject from date id refs chars lines misc]
4496 (narrow-to-region (point) eol)
4501 (make-full-mail-header
4503 (condition-case () ; subject
4504 (gnus-remove-odd-characters
4505 (funcall gnus-decode-encoded-word-function
4506 (setq x (nnheader-nov-field))))
4508 (condition-case () ; from
4509 (gnus-remove-odd-characters
4510 (funcall gnus-decode-encoded-address-function
4511 (setq x (nnheader-nov-field))))
4513 (nnheader-nov-field) ; date
4514 (nnheader-nov-read-message-id number) ; id
4515 (setq references (nnheader-nov-field)) ; refs
4516 (nnheader-nov-read-integer) ; chars
4517 (nnheader-nov-read-integer) ; lines
4519 (if (looking-at "Xref: ")
4520 (goto-char (match-end 0)))
4521 (nnheader-nov-field)) ; Xref
4522 (nnheader-nov-parse-extra)))) ; extra
4526 (when (and (string= references "")
4527 (setq in-reply-to (mail-header-extra header))
4528 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4529 (mail-header-set-references
4530 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4532 (when gnus-alter-header-function
4533 (funcall gnus-alter-header-function header))
4534 (gnus-dependencies-add-header header dependencies force-new)))
4536 (defun gnus-build-get-header (id)
4537 "Look through the buffer of NOV lines and find the header to ID.
4538 Enter this line into the dependencies hash table, and return
4539 the id of the parent article (if any)."
4540 (let ((deps gnus-newsgroup-dependencies)
4543 (with-current-buffer nntp-server-buffer
4544 (let ((case-fold-search nil))
4545 (goto-char (point-min))
4546 (while (and (not found)
4547 (search-forward id nil t))
4549 (setq found (looking-at
4550 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4551 (regexp-quote id))))
4552 (or found (beginning-of-line 2)))
4556 (setq header (gnus-nov-parse-line
4557 (read (current-buffer)) deps))
4558 (gnus-parent-id (mail-header-references header))))))
4560 (let ((number (mail-header-number header)))
4561 (push number gnus-newsgroup-limit)
4562 (push header gnus-newsgroup-headers)
4563 (if (memq number gnus-newsgroup-unselected)
4565 (setq gnus-newsgroup-unreads
4566 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4568 (setq gnus-newsgroup-unselected
4569 (delq number gnus-newsgroup-unselected)))
4570 (push number gnus-newsgroup-ancient)))))))
4572 (defun gnus-build-all-threads ()
4573 "Read all the headers."
4574 (let ((gnus-summary-ignore-duplicates t)
4575 (mail-parse-charset gnus-newsgroup-charset)
4576 (dependencies gnus-newsgroup-dependencies)
4578 (with-current-buffer nntp-server-buffer
4579 (let ((case-fold-search nil))
4580 (goto-char (point-min))
4583 (setq article (read (current-buffer))
4584 header (gnus-nov-parse-line article dependencies t)))
4586 (with-current-buffer gnus-summary-buffer
4587 (push header gnus-newsgroup-headers)
4588 (if (memq (setq article (mail-header-number header))
4589 gnus-newsgroup-unselected)
4591 (setq gnus-newsgroup-unreads
4592 (gnus-add-to-sorted-list
4593 gnus-newsgroup-unreads article))
4594 (setq gnus-newsgroup-unselected
4595 (delq article gnus-newsgroup-unselected)))
4596 (push article gnus-newsgroup-ancient)))
4597 (forward-line 1)))))))
4599 (defun gnus-summary-update-article-line (article header)
4600 "Update the line for ARTICLE using HEADER."
4601 (let* ((id (mail-header-id header))
4602 (thread (gnus-id-to-thread id)))
4604 (error "Article in no thread"))
4605 ;; Update the thread.
4606 (setcar thread header)
4607 (gnus-summary-goto-subject article)
4608 (let* ((datal (gnus-data-find-list article))
4610 (inhibit-read-only t)
4611 (level (gnus-summary-thread-level)))
4613 (let ((inserted (- (point)
4615 (gnus-summary-insert-line
4617 (memq article gnus-newsgroup-undownloaded)
4618 (gnus-article-mark article)
4619 (memq article gnus-newsgroup-replied)
4620 (memq article gnus-newsgroup-expirable)
4621 ;; Only insert the Subject string when it's different
4622 ;; from the previous Subject string.
4627 (mail-header-subject
4630 (gnus-data-find-list
4632 (gnus-data-list t)))))
4633 ;; Error on the side of excessive subjects.
4635 (mail-header-subject header)))
4637 (mail-header-subject header))
4638 nil (cdr (assq article gnus-newsgroup-scored))
4639 (memq article gnus-newsgroup-processable))
4642 (gnus-data-update-list
4644 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4646 (defun gnus-summary-update-article (article &optional iheader)
4647 "Update ARTICLE in the summary buffer."
4648 (set-buffer gnus-summary-buffer)
4649 (let* ((header (gnus-summary-article-header article))
4650 (id (mail-header-id header))
4651 (data (gnus-data-find article))
4652 (thread (gnus-id-to-thread id))
4653 (references (mail-header-references header))
4657 (when (and references
4658 (not (equal "" references)))
4661 (inhibit-read-only t)
4667 (delq thread parent)))
4668 (if (gnus-summary-insert-subject id header)
4669 ;; Set the (possibly) new article number in the data structure.
4670 (gnus-data-set-number data (gnus-id-to-article id))
4674 (defun gnus-rebuild-thread (id &optional line)
4675 "Rebuild the thread containing ID.
4676 If LINE, insert the rebuilt thread starting on line LINE."
4677 (let ((inhibit-read-only t)
4678 old-pos current thread data)
4679 (if (not gnus-show-threads)
4680 (setq thread (list (car (gnus-id-to-thread id))))
4681 ;; Get the thread this article is part of.
4682 (setq thread (gnus-remove-thread id)))
4683 (setq old-pos (point-at-bol))
4684 (setq current (save-excursion
4685 (and (re-search-backward "[\r\n]" nil t)
4686 (gnus-summary-article-number))))
4687 ;; If this is a gathered thread, we have to go some re-gathering.
4688 (when (stringp (car thread))
4689 (let ((subject (car thread))
4691 (setq thread (cdr thread))
4693 (unless (memq (setq thr (gnus-id-to-thread
4695 (mail-header-id (caar thread)))))
4698 (setq thread (cdr thread)))
4699 ;; We now have all (unique) roots.
4700 (if (= (length roots) 1)
4701 ;; All the loose roots are now one solid root.
4702 (setq thread (car roots))
4703 (setq thread (cons subject (gnus-sort-threads roots))))))
4705 ;; We then insert this thread into the summary buffer.
4707 (goto-char (point-min))
4708 (forward-line (1- line)))
4709 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4710 (if gnus-show-threads
4711 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4712 (gnus-summary-prepare-unthreaded thread))
4713 (setq data (nreverse gnus-newsgroup-data))
4714 (setq threads gnus-newsgroup-threads))
4715 ;; We splice the new data into the data structure.
4716 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4717 ;;!!! then we want to insert at the beginning of the buffer.
4718 ;;!!! That happens to be true with Gnus now, but that may
4719 ;;!!! change in the future. Perhaps.
4720 (gnus-data-enter-list
4721 (if line nil current) data (- (point) old-pos))
4722 (setq gnus-newsgroup-threads
4723 (nconc threads gnus-newsgroup-threads))
4724 (gnus-data-compute-positions))))
4726 (defun gnus-number-to-header (number)
4727 "Return the header for article NUMBER."
4728 (let ((headers gnus-newsgroup-headers))
4730 (not (= number (mail-header-number (car headers)))))
4735 (defun gnus-parent-headers (in-headers &optional generation)
4736 "Return the headers of the GENERATIONeth parent of HEADERS."
4738 (setq generation 1))
4740 (headers in-headers)
4743 (not (zerop generation))
4744 (setq references (mail-header-references headers)))
4745 (setq headers (if (and references
4746 (setq parent (gnus-parent-id references)))
4747 (car (gnus-id-to-thread parent))
4750 (and (not (eq headers in-headers))
4753 (defun gnus-id-to-thread (id)
4754 "Return the (sub-)thread where ID appears."
4755 (gnus-gethash id gnus-newsgroup-dependencies))
4757 (defun gnus-id-to-article (id)
4758 "Return the article number of ID."
4759 (let ((thread (gnus-id-to-thread id)))
4762 (mail-header-number (car thread)))))
4764 (defun gnus-id-to-header (id)
4765 "Return the article headers of ID."
4766 (car (gnus-id-to-thread id)))
4768 (defun gnus-article-displayed-root-p (article)
4769 "Say whether ARTICLE is a root(ish) article."
4770 (let ((level (gnus-summary-thread-level article))
4771 (refs (mail-header-references (gnus-summary-article-header article)))
4777 ((null (gnus-parent-id refs)) t)
4779 (null (setq particle (gnus-id-to-article
4780 (gnus-parent-id refs))))
4781 (null (gnus-summary-thread-level particle)))))))
4783 (defun gnus-root-id (id)
4784 "Return the id of the root of the thread where ID appears."
4786 (while (and id (setq prev (car (gnus-id-to-thread id))))
4788 id (gnus-parent-id (mail-header-references prev))))
4791 (defun gnus-articles-in-thread (thread)
4792 "Return the list of articles in THREAD."
4793 (cons (mail-header-number (car thread))
4794 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4796 (defun gnus-remove-thread (id &optional dont-remove)
4797 "Remove the thread that has ID in it."
4798 (let (headers thread last-id)
4799 ;; First go up in this thread until we find the root.
4800 (setq last-id (gnus-root-id id)
4801 headers (message-flatten-list (gnus-id-to-thread last-id)))
4802 ;; We have now found the real root of this thread. It might have
4803 ;; been gathered into some loose thread, so we have to search
4804 ;; through the threads to find the thread we wanted.
4805 (let ((threads gnus-newsgroup-threads)
4808 (setq sub (car threads))
4809 (if (stringp (car sub))
4810 ;; This is a gathered thread, so we look at the roots
4811 ;; below it to find whether this article is in this
4814 (setq sub (cdr sub))
4816 (when (member (caar sub) headers)
4817 (setq thread (car threads)
4820 (setq sub (cdr sub))))
4821 ;; It's an ordinary thread, so we check it.
4822 (when (eq (car sub) (car headers))
4825 (setq threads (cdr threads)))
4826 ;; If this article is in no thread, then it's a root.
4829 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4830 (setq thread (gnus-id-to-thread last-id)))
4833 thread ; We return this thread.
4835 (if (stringp (car thread))
4837 ;; If we use dummy roots, then we have to remove the
4838 ;; dummy root as well.
4839 (when (eq gnus-summary-make-false-root 'dummy)
4840 ;; We go to the dummy root by going to
4841 ;; the first sub-"thread", and then one line up.
4842 (gnus-summary-goto-article
4843 (mail-header-number (caadr thread)))
4846 (gnus-data-compute-positions))
4847 (setq thread (cdr thread))
4849 (gnus-remove-thread-1 (car thread))
4850 (setq thread (cdr thread))))
4851 (gnus-remove-thread-1 thread))))))))
4853 (defun gnus-remove-thread-1 (thread)
4854 "Remove the thread THREAD recursively."
4855 (let ((number (mail-header-number (pop thread)))
4857 (setq thread (reverse thread))
4859 (gnus-remove-thread-1 (pop thread)))
4860 (when (setq d (gnus-data-find number))
4861 (goto-char (gnus-data-pos d))
4862 (gnus-summary-show-thread)
4868 (gnus-delete-line)))))))
4870 (defun gnus-sort-threads-recursive (threads func)
4871 (sort (mapcar (lambda (thread)
4874 (gnus-sort-threads-recursive (cdr thread) func))))
4877 (defun gnus-sort-threads-loop (threads func)
4878 (let* ((superthread (cons nil threads))
4879 (stack (list (cons superthread threads)))
4880 remaining-threads thread)
4882 (setq remaining-threads (cdr (car stack)))
4883 (if remaining-threads
4884 (progn (setq thread (car remaining-threads))
4885 (setcdr (car stack) (cdr remaining-threads))
4887 (push (cons thread (cdr thread)) stack)))
4888 (setq thread (caar stack))
4889 (setcdr thread (sort (cdr thread) func))
4893 (defun gnus-sort-threads (threads)
4895 (if (not gnus-thread-sort-functions)
4897 (gnus-message 8 "Sorting threads...")
4900 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000)))
4901 (gnus-sort-threads-recursive
4902 threads (gnus-make-sort-function gnus-thread-sort-functions)))
4903 ;; Even after binding max-lisp-eval-depth, the recursive
4904 ;; sorter might fail for very long threads. In that case,
4905 ;; try using a (less well-tested) non-recursive sorter.
4906 (error (gnus-message 9 "Sorting threads with loop...")
4907 (gnus-sort-threads-loop
4908 threads (gnus-make-sort-function
4909 gnus-thread-sort-functions))))
4910 (gnus-message 8 "Sorting threads...done"))))
4912 (defun gnus-sort-articles (articles)
4914 (when gnus-article-sort-functions
4915 (gnus-message 7 "Sorting articles...")
4917 (setq gnus-newsgroup-headers
4918 (sort articles (gnus-make-sort-function
4919 gnus-article-sort-functions)))
4920 (gnus-message 7 "Sorting articles...done"))))
4922 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4923 (defmacro gnus-thread-header (thread)
4924 "Return header of first article in THREAD.
4925 Note that THREAD must never, ever be anything else than a variable -
4926 using some other form will lead to serious barfage."
4927 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4928 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4929 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4932 (defsubst gnus-article-sort-by-number (h1 h2)
4933 "Sort articles by article number."
4934 (< (mail-header-number h1)
4935 (mail-header-number h2)))
4937 (defun gnus-thread-sort-by-number (h1 h2)
4938 "Sort threads by root article number."
4939 (gnus-article-sort-by-number
4940 (gnus-thread-header h1) (gnus-thread-header h2)))
4942 (defsubst gnus-article-sort-by-random (h1 h2)
4943 "Sort articles randomly."
4946 (defun gnus-thread-sort-by-random (h1 h2)
4947 "Sort threads randomly."
4948 (gnus-article-sort-by-random
4949 (gnus-thread-header h1) (gnus-thread-header h2)))
4951 (defsubst gnus-article-sort-by-lines (h1 h2)
4952 "Sort articles by article Lines header."
4953 (< (mail-header-lines h1)
4954 (mail-header-lines h2)))
4956 (defun gnus-thread-sort-by-lines (h1 h2)
4957 "Sort threads by root article Lines header."
4958 (gnus-article-sort-by-lines
4959 (gnus-thread-header h1) (gnus-thread-header h2)))
4961 (defsubst gnus-article-sort-by-chars (h1 h2)
4962 "Sort articles by octet length."
4963 (< (mail-header-chars h1)
4964 (mail-header-chars h2)))
4966 (defun gnus-thread-sort-by-chars (h1 h2)
4967 "Sort threads by root article octet length."
4968 (gnus-article-sort-by-chars
4969 (gnus-thread-header h1) (gnus-thread-header h2)))
4971 (defsubst gnus-article-sort-by-author (h1 h2)
4972 "Sort articles by root author."
4974 (let ((extract (funcall
4975 gnus-extract-address-components
4976 (mail-header-from h1))))
4977 (or (car extract) (cadr extract) ""))
4978 (let ((extract (funcall
4979 gnus-extract-address-components
4980 (mail-header-from h2))))
4981 (or (car extract) (cadr extract) ""))))
4983 (defun gnus-thread-sort-by-author (h1 h2)
4984 "Sort threads by root author."
4985 (gnus-article-sort-by-author
4986 (gnus-thread-header h1) (gnus-thread-header h2)))
4988 (defsubst gnus-article-sort-by-recipient (h1 h2)
4989 "Sort articles by recipient."
4991 (let ((extract (funcall
4992 gnus-extract-address-components
4993 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4994 (or (car extract) (cadr extract)))
4995 (let ((extract (funcall
4996 gnus-extract-address-components
4997 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4998 (or (car extract) (cadr extract)))))
5000 (defun gnus-thread-sort-by-recipient (h1 h2)
5001 "Sort threads by root recipient."
5002 (gnus-article-sort-by-recipient
5003 (gnus-thread-header h1) (gnus-thread-header h2)))
5005 (defsubst gnus-article-sort-by-subject (h1 h2)
5006 "Sort articles by root subject."
5008 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
5009 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
5011 (defun gnus-thread-sort-by-subject (h1 h2)
5012 "Sort threads by root subject."
5013 (gnus-article-sort-by-subject
5014 (gnus-thread-header h1) (gnus-thread-header h2)))
5016 (defsubst gnus-article-sort-by-date (h1 h2)
5017 "Sort articles by root article date."
5019 (gnus-date-get-time (mail-header-date h1))
5020 (gnus-date-get-time (mail-header-date h2))))
5022 (defun gnus-thread-sort-by-date (h1 h2)
5023 "Sort threads by root article date."
5024 (gnus-article-sort-by-date
5025 (gnus-thread-header h1) (gnus-thread-header h2)))
5027 (defsubst gnus-article-sort-by-score (h1 h2)
5028 "Sort articles by root article score.
5029 Unscored articles will be counted as having a score of zero."
5030 (> (or (cdr (assq (mail-header-number h1)
5031 gnus-newsgroup-scored))
5032 gnus-summary-default-score 0)
5033 (or (cdr (assq (mail-header-number h2)
5034 gnus-newsgroup-scored))
5035 gnus-summary-default-score 0)))
5037 (defun gnus-thread-sort-by-score (h1 h2)
5038 "Sort threads by root article score."
5039 (gnus-article-sort-by-score
5040 (gnus-thread-header h1) (gnus-thread-header h2)))
5042 (defun gnus-thread-sort-by-total-score (h1 h2)
5043 "Sort threads by the sum of all scores in the thread.
5044 Unscored articles will be counted as having a score of zero."
5045 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
5047 (defun gnus-thread-total-score (thread)
5048 ;; This function find the total score of THREAD.
5053 (if (stringp (car thread))
5054 (apply gnus-thread-score-function 0
5055 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
5056 (gnus-thread-total-score-1 thread)))
5058 (gnus-thread-total-score-1 (list thread)))))
5060 (defun gnus-article-sort-by-most-recent-number (h1 h2)
5061 "Sort articles by number."
5062 (gnus-article-sort-by-number h1 h2))
5064 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
5065 "Sort threads such that the thread with the most recently arrived article comes first."
5066 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5068 (defun gnus-thread-highest-number (thread)
5069 "Return the highest article number in THREAD."
5070 (apply 'max (mapcar (lambda (header)
5071 (mail-header-number header))
5072 (message-flatten-list thread))))
5074 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5075 "Sort articles by number."
5076 (gnus-article-sort-by-date h1 h2))
5078 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5079 "Sort threads such that the thread with the most recently dated article comes first."
5080 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5082 ; Since this is called not only to sort the top-level threads, but
5083 ; also in recursive sorts to order the articles within a thread, each
5084 ; article will be processed many times. Thus it speeds things up
5085 ; quite a bit to use gnus-date-get-time, which caches the time value.
5086 (defun gnus-thread-latest-date (thread)
5087 "Return the highest article date in THREAD."
5089 (mapcar (lambda (header) (gnus-float-time
5091 (mail-header-date header))))
5092 (message-flatten-list thread))))
5094 (defun gnus-thread-total-score-1 (root)
5095 ;; This function find the total score of the thread below ROOT.
5096 (setq root (car root))
5097 (apply gnus-thread-score-function
5099 (mapcar 'gnus-thread-total-score
5100 (cdr (gnus-id-to-thread (mail-header-id root))))
5101 (when (> (mail-header-number root) 0)
5102 (list (or (cdr (assq (mail-header-number root)
5103 gnus-newsgroup-scored))
5104 gnus-summary-default-score 0))))
5105 (list gnus-summary-default-score)
5108 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5109 (defvar gnus-tmp-prev-subject nil)
5110 (defvar gnus-tmp-false-parent nil)
5111 (defvar gnus-tmp-root-expunged nil)
5112 (defvar gnus-tmp-dummy-line nil)
5114 (defun gnus-extra-header (type &optional header)
5115 "Return the extra header of TYPE."
5116 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5119 (defvar gnus-tmp-thread-tree-header-string "")
5121 (defcustom gnus-sum-thread-tree-root "> "
5122 "With %B spec, used for the root of a thread.
5123 If nil, use subject instead."
5125 :type '(radio (const :format "%v " nil) string)
5126 :group 'gnus-thread)
5128 (defcustom gnus-sum-thread-tree-false-root "> "
5129 "With %B spec, used for a false root of a thread.
5130 If nil, use subject instead."
5132 :type '(radio (const :format "%v " nil) string)
5133 :group 'gnus-thread)
5135 (defcustom gnus-sum-thread-tree-single-indent ""
5136 "With %B spec, used for a thread with just one message.
5137 If nil, use subject instead."
5139 :type '(radio (const :format "%v " nil) string)
5140 :group 'gnus-thread)
5142 (defcustom gnus-sum-thread-tree-vertical "| "
5143 "With %B spec, used for drawing a vertical line."
5146 :group 'gnus-thread)
5148 (defcustom gnus-sum-thread-tree-indent " "
5149 "With %B spec, used for indenting."
5152 :group 'gnus-thread)
5154 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5155 "With %B spec, used for a leaf with brothers."
5158 :group 'gnus-thread)
5160 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5161 "With %B spec, used for a leaf without brothers."
5164 :group 'gnus-thread)
5166 (defcustom gnus-summary-display-while-building nil
5167 "If non-nil, show and update the summary buffer as it's being built.
5168 If the value is t, update the buffer after every line is inserted. If
5169 the value is an integer (N), update the display every N lines."
5172 :type '(choice (const :tag "off" nil)
5174 (const :tag "frequently" t)))
5176 (defun gnus-summary-prepare-threads (threads)
5177 "Prepare summary buffer from THREADS and indentation LEVEL.
5178 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5179 or a straight list of headers."
5180 (gnus-message 7 "Generating summary...")
5182 (setq gnus-newsgroup-threads threads)
5185 (let ((gnus-tmp-level 0)
5186 (default-score (or gnus-summary-default-score 0))
5187 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5188 (building-line-count gnus-summary-display-while-building)
5189 (building-count (integerp gnus-summary-display-while-building))
5190 thread number subject stack state gnus-tmp-gathered beg-match
5191 new-roots gnus-tmp-new-adopts thread-end simp-subject
5192 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5193 gnus-tmp-replied gnus-tmp-subject-or-nil
5194 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5195 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5196 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5199 (setq gnus-tmp-prev-subject nil
5200 gnus-tmp-thread-tree-header-string "")
5202 (if (vectorp (car threads))
5203 ;; If this is a straight (sic) list of headers, then a
5204 ;; threaded summary display isn't required, so we just create
5205 ;; an unthreaded one.
5206 (gnus-summary-prepare-unthreaded threads)
5208 ;; Do the threaded display.
5210 (if gnus-summary-display-while-building
5211 (switch-to-buffer (buffer-name)))
5212 (while (or threads stack gnus-tmp-new-adopts new-roots)
5214 (if (and (= gnus-tmp-level 0)
5217 (not gnus-tmp-false-parent)
5218 (or gnus-tmp-new-adopts new-roots))
5219 (if gnus-tmp-new-adopts
5220 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5221 thread (list (car gnus-tmp-new-adopts))
5222 gnus-tmp-header (caar thread)
5223 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5225 (setq thread (list (car new-roots))
5226 gnus-tmp-header (caar thread)
5227 new-roots (cdr new-roots))))
5230 ;; If there are some threads, we do them before the
5231 ;; threads on the stack.
5232 (setq thread threads
5233 gnus-tmp-header (caar thread))
5234 ;; There were no current threads, so we pop something off
5236 (setq state (car stack)
5237 gnus-tmp-level (car state)
5238 tree-stack (cadr state)
5239 thread (caddr state)
5241 gnus-tmp-header (caar thread))))
5243 (setq gnus-tmp-false-parent nil)
5244 (setq gnus-tmp-root-expunged nil)
5245 (setq thread-end nil)
5247 (if (stringp gnus-tmp-header)
5248 ;; The header is a dummy root.
5250 ((eq gnus-summary-make-false-root 'adopt)
5251 ;; We let the first article adopt the rest.
5252 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5254 (setq gnus-tmp-gathered
5256 (lambda (h) (mail-header-number (car h)))
5259 (setq thread (cons (list (caar thread)
5262 (setq gnus-tmp-level -1
5263 gnus-tmp-false-parent t))
5264 ((eq gnus-summary-make-false-root 'empty)
5265 ;; We print adopted articles with empty subject fields.
5266 (setq gnus-tmp-gathered
5268 (lambda (h) (mail-header-number (car h)))
5271 (setq gnus-tmp-level -1))
5272 ((eq gnus-summary-make-false-root 'dummy)
5273 ;; We remember that we probably want to output a dummy
5275 (setq gnus-tmp-dummy-line gnus-tmp-header)
5276 (setq gnus-tmp-prev-subject gnus-tmp-header))
5278 ;; We do not make a root for the gathered
5279 ;; sub-threads at all.
5280 (setq gnus-tmp-level -1)))
5282 (setq number (mail-header-number gnus-tmp-header)
5283 subject (mail-header-subject gnus-tmp-header)
5284 simp-subject (gnus-simplify-subject-fully subject))
5287 ;; If the thread has changed subject, we might want to make
5288 ;; this subthread into a root.
5289 ((and (null gnus-thread-ignore-subject)
5290 (not (zerop gnus-tmp-level))
5291 gnus-tmp-prev-subject
5292 (not (string= gnus-tmp-prev-subject simp-subject)))
5293 (setq new-roots (nconc new-roots (list (car thread)))
5295 gnus-tmp-header nil))
5296 ;; If the article lies outside the current limit,
5297 ;; then we do not display it.
5298 ((not (memq number gnus-newsgroup-limit))
5299 (setq gnus-tmp-gathered
5301 (lambda (h) (mail-header-number (car h)))
5304 (setq gnus-tmp-new-adopts (if (cdar thread)
5305 (append gnus-tmp-new-adopts
5307 gnus-tmp-new-adopts)
5309 gnus-tmp-header nil)
5310 (when (zerop gnus-tmp-level)
5311 (setq gnus-tmp-root-expunged t)))
5312 ;; Perhaps this article is to be marked as read?
5313 ((and gnus-summary-mark-below
5314 (< (or (cdr (assq number gnus-newsgroup-scored))
5316 gnus-summary-mark-below)
5317 ;; Don't touch sparse articles.
5318 (not (gnus-summary-article-sparse-p number))
5319 (not (gnus-summary-article-ancient-p number)))
5320 (setq gnus-newsgroup-unreads
5321 (delq number gnus-newsgroup-unreads))
5322 (if gnus-newsgroup-auto-expire
5323 (setq gnus-newsgroup-expirable
5324 (gnus-add-to-sorted-list
5325 gnus-newsgroup-expirable number))
5326 (push (cons number gnus-low-score-mark)
5327 gnus-newsgroup-reads))))
5329 (when gnus-tmp-header
5330 ;; We may have an old dummy line to output before this
5332 (when (and gnus-tmp-dummy-line
5335 (mail-header-subject gnus-tmp-header)))
5336 (gnus-summary-insert-dummy-line
5337 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5338 (setq gnus-tmp-dummy-line nil))
5340 ;; Compute the mark.
5341 (setq gnus-tmp-unread (gnus-article-mark number))
5343 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5344 gnus-tmp-header gnus-tmp-level)
5345 gnus-newsgroup-data)
5347 ;; Actually insert the line.
5349 gnus-tmp-subject-or-nil
5351 ((and gnus-thread-ignore-subject
5352 gnus-tmp-prev-subject
5353 (not (string= gnus-tmp-prev-subject simp-subject)))
5355 ((zerop gnus-tmp-level)
5356 (if (and (eq gnus-summary-make-false-root 'empty)
5357 (memq number gnus-tmp-gathered)
5358 gnus-tmp-prev-subject
5359 (string= gnus-tmp-prev-subject simp-subject))
5360 gnus-summary-same-subject
5362 (t gnus-summary-same-subject)))
5363 (if (and (eq gnus-summary-make-false-root 'adopt)
5364 (= gnus-tmp-level 1)
5365 (memq number gnus-tmp-gathered))
5366 (setq gnus-tmp-opening-bracket ?\<
5367 gnus-tmp-closing-bracket ?\>)
5368 (setq gnus-tmp-opening-bracket ?\[
5369 gnus-tmp-closing-bracket ?\]))
5370 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5371 (gnus-make-thread-indent-array
5372 (max (* 2 (length gnus-thread-indent-array))
5375 gnus-tmp-indentation
5376 (aref gnus-thread-indent-array gnus-tmp-level)
5377 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5378 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5379 gnus-summary-default-score 0)
5381 (if (or (null gnus-summary-default-score)
5382 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5383 gnus-summary-zcore-fuzz))
5385 (if (< gnus-tmp-score gnus-summary-default-score)
5386 gnus-score-below-mark gnus-score-over-mark))
5388 (cond ((memq number gnus-newsgroup-processable)
5390 ((memq number gnus-newsgroup-cached)
5392 ((memq number gnus-newsgroup-replied)
5394 ((memq number gnus-newsgroup-forwarded)
5395 gnus-forwarded-mark)
5396 ((memq number gnus-newsgroup-saved)
5398 ((memq number gnus-newsgroup-recent)
5400 ((memq number gnus-newsgroup-unseen)
5404 (cond ((memq number gnus-newsgroup-undownloaded)
5405 gnus-undownloaded-mark)
5406 (gnus-newsgroup-agentized
5407 gnus-downloaded-mark)
5410 gnus-tmp-from (mail-header-from gnus-tmp-header)
5413 ((string-match "<[^>]+> *$" gnus-tmp-from)
5414 (setq beg-match (match-beginning 0))
5415 (or (and (string-match "^\".+\"" gnus-tmp-from)
5416 (substring gnus-tmp-from 1 (1- (match-end 0))))
5417 (substring gnus-tmp-from 0 beg-match)))
5418 ((string-match "(.+)" gnus-tmp-from)
5419 (substring gnus-tmp-from
5420 (1+ (match-beginning 0)) (1- (match-end 0))))
5424 gnus-tmp-thread-tree-header-string
5426 ((not gnus-show-threads) "")
5427 ((zerop gnus-tmp-level)
5428 (cond ((cdar thread)
5429 (or gnus-sum-thread-tree-root subject))
5430 (gnus-tmp-new-adopts
5431 (or gnus-sum-thread-tree-false-root subject))
5433 (or gnus-sum-thread-tree-single-indent subject))))
5435 (concat (apply 'concat
5436 (mapcar (lambda (item)
5438 gnus-sum-thread-tree-vertical
5439 gnus-sum-thread-tree-indent))
5440 (cdr (reverse tree-stack))))
5442 gnus-sum-thread-tree-leaf-with-other
5443 gnus-sum-thread-tree-single-leaf)))))
5444 (when (string= gnus-tmp-name "")
5445 (setq gnus-tmp-name gnus-tmp-from))
5446 (unless (numberp gnus-tmp-lines)
5447 (setq gnus-tmp-lines -1))
5448 (if (= gnus-tmp-lines -1)
5449 (setq gnus-tmp-lines "?")
5450 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5451 (gnus-put-text-property
5453 (progn (eval gnus-summary-line-format-spec) (point))
5454 'gnus-number number)
5457 (gnus-summary-highlight-line)
5458 (when gnus-summary-update-hook
5459 (gnus-run-hooks 'gnus-summary-update-hook))
5462 (setq gnus-tmp-prev-subject simp-subject)))
5464 (when (nth 1 thread)
5465 (push (list (max 0 gnus-tmp-level)
5466 (copy-sequence tree-stack)
5469 (push (if (nth 1 thread) 1 0) tree-stack)
5470 (incf gnus-tmp-level)
5471 (setq threads (if thread-end nil (cdar thread)))
5472 (if gnus-summary-display-while-building
5475 ;; use a set frequency
5476 (setq building-line-count (1- building-line-count))
5477 (when (= building-line-count 0)
5479 (setq building-line-count
5480 gnus-summary-display-while-building)))
5484 (setq gnus-tmp-level 0)))))
5485 (gnus-message 7 "Generating summary...done"))
5487 (defun gnus-summary-prepare-unthreaded (headers)
5488 "Generate an unthreaded summary buffer based on HEADERS."
5489 (let (header number mark)
5494 ;; We may have to root out some bad articles...
5495 (when (memq (setq number (mail-header-number
5496 (setq header (pop headers))))
5497 gnus-newsgroup-limit)
5498 ;; Mark article as read when it has a low score.
5499 (when (and gnus-summary-mark-below
5500 (< (or (cdr (assq number gnus-newsgroup-scored))
5501 gnus-summary-default-score 0)
5502 gnus-summary-mark-below)
5503 (not (gnus-summary-article-ancient-p number)))
5504 (setq gnus-newsgroup-unreads
5505 (delq number gnus-newsgroup-unreads))
5506 (if gnus-newsgroup-auto-expire
5507 (push number gnus-newsgroup-expirable)
5508 (push (cons number gnus-low-score-mark)
5509 gnus-newsgroup-reads)))
5511 (setq mark (gnus-article-mark number))
5512 (push (gnus-data-make number mark (1+ (point)) header 0)
5513 gnus-newsgroup-data)
5514 (gnus-summary-insert-line
5516 (memq number gnus-newsgroup-undownloaded)
5517 mark (memq number gnus-newsgroup-replied)
5518 (memq number gnus-newsgroup-expirable)
5519 (mail-header-subject header) nil
5520 (cdr (assq number gnus-newsgroup-scored))
5521 (memq number gnus-newsgroup-processable))))))
5523 (defun gnus-group-get-list-identifiers (group)
5524 "Get list identifier regexp for GROUP."
5525 (or (gnus-parameter-list-identifier group)
5526 (if (consp gnus-list-identifiers)
5527 (mapconcat 'identity gnus-list-identifiers " *\\|")
5528 gnus-list-identifiers)))
5530 (defun gnus-summary-remove-list-identifiers ()
5531 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5532 (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name))
5535 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5536 (dolist (header gnus-newsgroup-headers)
5537 (setq subject (mail-header-subject header)
5539 (while (string-match regexp subject)
5541 (concat (substring subject 0 (match-beginning 1))
5542 (substring subject (match-end 0)))
5545 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5547 (concat (substring subject 0 (match-beginning 1))
5548 (substring subject (match-end 1)))))
5549 (mail-header-set-subject header subject))))))
5551 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5552 "Fetch headers of ARTICLES."
5553 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5554 (gnus-message 5 "Fetching headers for %s..." name)
5557 (setq gnus-headers-retrieved-by
5558 (gnus-retrieve-headers
5559 articles gnus-newsgroup-name
5561 ;; We might want to fetch old headers, but
5562 ;; not if there is only 1 article.
5564 (not (eq gnus-fetch-old-headers 'some))
5565 (not (numberp gnus-fetch-old-headers)))
5566 (> (length articles) 1))
5567 gnus-fetch-old-headers)))))
5568 (gnus-get-newsgroup-headers-xover
5569 articles force-new dependencies gnus-newsgroup-name t)
5570 (gnus-get-newsgroup-headers dependencies force-new))
5571 (gnus-message 5 "Fetching headers for %s...done" name))))
5573 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5574 "Select newsgroup GROUP.
5575 If READ-ALL is non-nil, all articles in the group are selected.
5576 If SELECT-ARTICLES, only select those articles from GROUP."
5577 (let* ((entry (gnus-group-entry group))
5578 ;;!!! Dirty hack; should be removed.
5579 (gnus-summary-ignore-duplicates
5580 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5582 gnus-summary-ignore-duplicates))
5583 (info (nth 2 entry))
5584 charset articles fetched-articles cached)
5586 (unless (gnus-check-server
5587 (set (make-local-variable 'gnus-current-select-method)
5588 (gnus-find-method-for-group group)))
5589 (error "Couldn't open server"))
5590 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5592 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5593 (gnus-activate-group group) ; Or we can activate it...
5594 (progn ; Or we bug out.
5595 (when (equal major-mode 'gnus-summary-mode)
5596 (gnus-kill-buffer (current-buffer)))
5598 "Couldn't activate group %s: %s"
5599 (mm-decode-coding-string group charset)
5600 (mm-decode-coding-string (gnus-status-message group) charset))))
5602 (unless (gnus-request-group group t)
5603 (when (equal major-mode 'gnus-summary-mode)
5604 (gnus-kill-buffer (current-buffer)))
5605 (error "Couldn't request group %s: %s"
5606 (mm-decode-coding-string group charset)
5607 (mm-decode-coding-string (gnus-status-message group) charset)))
5609 (when (and gnus-agent
5610 (gnus-active group))
5611 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5613 (setq gnus-summary-use-undownloaded-faces
5614 (gnus-agent-find-parameter
5616 'agent-enable-undownloaded-faces)))
5618 (setq gnus-newsgroup-name group
5619 gnus-newsgroup-unselected nil
5620 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5622 (let ((display (gnus-group-find-parameter group 'display)))
5623 (setq gnus-newsgroup-display
5625 ((not (zerop (or (car-safe read-all) 0)))
5626 ;; The user entered the group with C-u SPC/RET, let's show
5632 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5634 ;; The following is probably the "correct" solution, but
5635 ;; it makes Gnus fetch all headers and then limit the
5636 ;; articles (which is slow), so instead we hack the
5637 ;; select-articles parameter instead. -- Simon Josefsson
5640 ;; (gnus-byte-compile
5641 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5643 (setq select-articles
5644 (gnus-uncompress-range
5645 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5649 (cdr (gnus-active group)))))
5654 (gnus-summary-setup-default-charset)
5656 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5657 (when (gnus-virtual-group-p group)
5658 (setq cached gnus-newsgroup-cached))
5660 (setq gnus-newsgroup-unreads
5661 (gnus-sorted-ndifference
5662 (gnus-sorted-ndifference gnus-newsgroup-unreads
5663 gnus-newsgroup-marked)
5664 gnus-newsgroup-dormant))
5666 (setq gnus-newsgroup-processable nil)
5668 (gnus-update-read-articles group gnus-newsgroup-unreads t)
5670 ;; Adjust and set lists of article marks.
5672 (gnus-adjust-marked-articles info))
5673 (if (setq articles select-articles)
5674 (setq gnus-newsgroup-unselected
5675 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5676 (setq articles (gnus-articles-to-read group read-all)))
5680 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5682 ((eq articles 0) nil)
5684 ;; Init the dependencies hash table.
5685 (setq gnus-newsgroup-dependencies
5686 (gnus-make-hashtable (length articles)))
5687 (gnus-set-global-variables)
5688 ;; Retrieve the headers and read them in.
5690 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5692 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5694 (setq gnus-newsgroup-cached cached))
5696 ;; Suppress duplicates?
5697 (when gnus-suppress-duplicates
5698 (gnus-dup-suppress-articles))
5700 ;; Set the initial limit.
5701 (setq gnus-newsgroup-limit (copy-sequence articles))
5702 ;; Remove canceled articles from the list of unread articles.
5703 (setq fetched-articles
5704 (mapcar (lambda (headers) (mail-header-number headers))
5705 gnus-newsgroup-headers))
5706 (setq gnus-newsgroup-articles fetched-articles)
5707 (setq gnus-newsgroup-unreads
5708 (gnus-sorted-nintersection
5709 gnus-newsgroup-unreads fetched-articles))
5710 (gnus-compute-unseen-list)
5712 ;; Removed marked articles that do not exist.
5713 (gnus-update-missing-marks
5714 (gnus-sorted-difference articles fetched-articles))
5715 ;; We might want to build some more threads first.
5716 (when (and gnus-fetch-old-headers
5717 (eq gnus-headers-retrieved-by 'nov))
5718 (if (eq gnus-fetch-old-headers 'invisible)
5719 (gnus-build-all-threads)
5720 (gnus-build-old-threads)))
5721 ;; Let the Gnus agent mark articles as read.
5723 (gnus-agent-get-undownloaded-list))
5724 ;; Remove list identifiers from subject
5725 (gnus-summary-remove-list-identifiers)
5726 ;; Check whether auto-expire is to be done in this group.
5727 (setq gnus-newsgroup-auto-expire
5728 (and (gnus-group-auto-expirable-p group)
5729 (not (gnus-group-read-only-p group))))
5730 ;; Set up the article buffer now, if necessary.
5731 (unless (and gnus-single-article-buffer
5732 (equal gnus-article-buffer "*Article*"))
5733 (gnus-article-setup-buffer))
5734 ;; First and last article in this newsgroup.
5735 (when gnus-newsgroup-headers
5736 (setq gnus-newsgroup-begin
5737 (mail-header-number (car gnus-newsgroup-headers))
5740 (gnus-last-element gnus-newsgroup-headers))))
5741 ;; GROUP is successfully selected.
5742 (or gnus-newsgroup-headers t)))))
5744 (defun gnus-compute-unseen-list ()
5745 ;; The `seen' marks are treated specially.
5746 (if (not gnus-newsgroup-seen)
5747 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5748 (setq gnus-newsgroup-unseen
5749 (gnus-inverse-list-range-intersection
5750 gnus-newsgroup-articles gnus-newsgroup-seen))))
5752 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5754 (defun gnus-summary-display-make-predicate (display)
5755 (require 'gnus-agent)
5756 (when (= (length display) 1)
5757 (setq display (car display)))
5758 (unless gnus-summary-display-cache
5759 (dolist (elem (append '((unread . unread)
5762 gnus-article-mark-lists))
5763 (push (cons (cdr elem)
5764 (gnus-byte-compile ;Why bother?
5765 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5766 gnus-summary-display-cache)))
5767 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5768 (gnus-category-predicate-cache gnus-summary-display-cache))
5769 (gnus-get-predicate display)))
5771 ;; Uses the dynamically bound `gnus-number' variable.
5772 (defvar gnus-number)
5773 (defun gnus-article-marked-p (type &optional article)
5774 (let ((article (or article gnus-number)))
5777 (memq article gnus-newsgroup-marked))
5779 (memq article gnus-newsgroup-spam-marked))
5781 (memq article gnus-newsgroup-unsendable))
5782 ((eq type 'undownload)
5783 (memq article gnus-newsgroup-undownloaded))
5784 ((eq type 'download)
5785 (memq article gnus-newsgroup-downloadable))
5787 (memq article gnus-newsgroup-unreads))
5789 (memq article gnus-newsgroup-reads))
5791 (memq article gnus-newsgroup-dormant) )
5793 (memq article gnus-newsgroup-expirable))
5795 (memq article gnus-newsgroup-replied))
5797 (memq article gnus-newsgroup-killed))
5798 ((eq type 'bookmark)
5799 (assq article gnus-newsgroup-bookmarks))
5801 (assq article gnus-newsgroup-scored))
5803 (memq article gnus-newsgroup-saved))
5805 (memq article gnus-newsgroup-cached))
5807 (memq article gnus-newsgroup-forwarded))
5809 (not (memq article gnus-newsgroup-unseen)))
5811 (memq article gnus-newsgroup-recent))
5814 (defun gnus-articles-to-read (group &optional read-all)
5815 "Find out what articles the user wants to read."
5816 (let* ((only-read-p t)
5818 ;; Select all articles if `read-all' is non-nil, or if there
5819 ;; are no unread articles.
5821 (and (zerop (length gnus-newsgroup-marked))
5822 (zerop (length gnus-newsgroup-unreads)))
5823 ;; Fetch all if the predicate is non-nil.
5824 gnus-newsgroup-display)
5825 ;; We want to select the headers for all the articles in
5826 ;; the group, so we select either all the active
5827 ;; articles in the group, or (if that's nil), the
5828 ;; articles in the cache.
5830 (if gnus-newsgroup-maximum-articles
5831 (let ((active (gnus-active group)))
5832 (gnus-uncompress-range
5833 (cons (max (car active)
5835 gnus-newsgroup-maximum-articles
5838 (gnus-uncompress-range (gnus-active group)))
5839 (gnus-cache-articles-in-group group))
5840 ;; Select only the "normal" subset of articles.
5841 (setq only-read-p nil)
5843 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5844 gnus-newsgroup-unreads)))
5845 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5846 (scored (length scored-list))
5847 (number (length articles))
5848 (marked (+ (length gnus-newsgroup-marked)
5849 (length gnus-newsgroup-dormant)))
5854 ((numberp gnus-newsgroup-display)
5855 gnus-newsgroup-display)
5859 ((and (or (<= scored marked) (= scored number))
5860 (numberp gnus-large-newsgroup)
5861 (> number gnus-large-newsgroup))
5862 (let* ((cursor-in-echo-area nil)
5863 (initial (gnus-parameter-large-newsgroup-initial
5864 gnus-newsgroup-name))
5865 (default (if only-read-p
5866 (or initial gnus-large-newsgroup)
5872 "How many articles from %s (available %d, default %d): "
5873 (gnus-group-decoded-name
5874 (gnus-group-real-name gnus-newsgroup-name))
5877 "How many articles from %s (%d available): "
5878 (gnus-group-decoded-name
5879 (gnus-group-real-name gnus-newsgroup-name))
5883 (number-to-string default))))
5884 (if (string-match "^[ \t]*$" input) number input)))
5885 ((and (> scored marked) (< scored number)
5886 (> (- scored number) 20))
5889 (format "%s %s (%d scored, %d total): "
5890 "How many articles from"
5891 (gnus-group-decoded-name
5892 (gnus-group-real-name gnus-newsgroup-name))
5894 (if (string-match "^[ \t]*$" input)
5898 (message "Quit getting the articles to read")
5900 (setq select (if (stringp select) (string-to-number select) select))
5901 (if (or (null select) (zerop select))
5903 (if (and (not (zerop scored)) (<= (abs select) scored))
5905 (setq articles (sort scored-list '<))
5906 (setq number (length articles)))
5907 (setq articles (copy-sequence articles)))
5909 (when (< (abs select) number)
5911 ;; Select the N oldest articles.
5912 (setcdr (nthcdr (1- (abs select)) articles) nil)
5913 ;; Select the N most recent articles.
5914 (setq articles (nthcdr (- number select) articles))))
5915 (setq gnus-newsgroup-unselected
5916 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5917 (when gnus-alter-articles-to-read-function
5920 (funcall gnus-alter-articles-to-read-function
5921 gnus-newsgroup-name articles)
5925 (defun gnus-killed-articles (killed articles)
5928 (when (inline (gnus-member-of-range (car articles) killed))
5929 (push (car articles) out))
5930 (setq articles (cdr articles)))
5933 (defun gnus-uncompress-marks (marks)
5934 "Uncompress the mark ranges in MARKS."
5935 (let ((uncompressed '(score bookmark))
5938 (if (memq (caar marks) uncompressed)
5939 (push (car marks) out)
5940 (push (cons (caar marks) (gnus-uncompress-range (cdar marks))) out))
5941 (setq marks (cdr marks)))
5944 (defun gnus-article-mark-to-type (mark)
5945 "Return the type of MARK."
5946 (or (cadr (assq mark gnus-article-special-mark-lists))
5949 (defun gnus-article-unpropagatable-p (mark)
5950 "Return whether MARK should be propagated to back end."
5951 (memq mark gnus-article-unpropagated-mark-lists))
5953 (defun gnus-adjust-marked-articles (info)
5954 "Set all article lists and remove all marks that are no longer valid."
5955 (let* ((marked-lists (gnus-info-marks info))
5956 (active (gnus-active (gnus-info-group info)))
5959 (types gnus-article-mark-lists)
5960 marks var articles article mark mark-type
5962 ;; Hack to avoid adjusting marks for imap.
5963 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5967 (dolist (marks marked-lists)
5968 (setq mark (car marks)
5969 mark-type (gnus-article-mark-to-type mark)
5970 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5972 ;; We set the variable according to the type of the marks list,
5973 ;; and then adjust the marks to a subset of the active articles.
5975 ;; Adjust "simple" lists - compressed yet unsorted
5976 ((eq mark-type 'list)
5977 ;; Simultaneously uncompress and clip to active range
5978 ;; See gnus-uncompress-range for a description of possible marks
5980 (if (not (cadr marks))
5982 (setq articles (if (numberp (cddr marks))
5988 (while (setq article (pop articles))
5989 (cond ((consp article)
5990 (setq bgn (max (car article) min)
5991 end (min (cdr article) max))
5993 (setq l (setcdr l (cons bgn nil))
5995 ((and (<= min article)
5997 (setq l (setcdr l (cons article nil))))))
5998 (set var (cdr lh)))))
6000 ((eq mark-type 'tuple)
6001 (set var (setq articles (cdr marks)))
6002 (when (not (listp (cdr (symbol-value var))))
6003 (set var (list (symbol-value var))))
6004 (when (not (listp (cdr articles)))
6005 (setq articles (list articles)))
6007 (when (or (not (consp (setq article (pop articles))))
6008 (< (car article) min)
6009 (> (car article) max))
6010 (set var (delq article (symbol-value var))))))
6011 ;; Adjust ranges (sloppily).
6012 ((eq mark-type 'range)
6015 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
6016 ;; It should be (seen (NUM1 . NUM2)).
6017 (when (numberp (cddr marks))
6018 (setcdr marks (list (cdr marks))))
6019 (setq articles (cdr marks))
6020 (while (and articles
6021 (or (and (consp (car articles))
6022 (> min (cdar articles)))
6023 (and (numberp (car articles))
6024 (> min (car articles)))))
6026 (set var articles))))))))
6028 (defun gnus-update-missing-marks (missing)
6029 "Go through the list of MISSING articles and remove them from the mark lists."
6032 ;; Go through all types.
6033 (dolist (elem gnus-article-mark-lists)
6034 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
6035 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
6036 (when (symbol-value var)
6037 ;; This list has articles. So we delete all missing
6038 ;; articles from it.
6041 (set var (delq (pop m) (symbol-value var))))))))))
6043 (defun gnus-update-marks ()
6044 "Enter the various lists of marked articles into the newsgroup info list."
6045 (let ((types gnus-article-mark-lists)
6046 (info (gnus-get-info gnus-newsgroup-name))
6047 type list newmarked symbol delta-marks)
6049 ;; Add all marks lists to the list of marks lists.
6050 (while (setq type (pop types))
6051 (setq list (symbol-value
6053 (intern (format "gnus-newsgroup-%s" (car type))))))
6056 ;; Get rid of the entries of the articles that have the
6058 (when (and (eq (cdr type) 'score)
6062 (prev (cons nil list))
6065 (if (or (not (consp (car arts)))
6066 (= (cdar arts) gnus-summary-default-score))
6067 (setcdr prev (cdr arts))
6069 (setq arts (cdr arts)))
6070 (setq list (cdr all)))))
6072 (when (eq (cdr type) 'seen)
6073 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
6075 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
6076 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
6078 (when (and (gnus-check-backend-function
6079 'request-set-mark gnus-newsgroup-name)
6080 (not (gnus-article-unpropagatable-p (cdr type))))
6081 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
6082 ;; Don't do anything about marks for articles we
6083 ;; didn't actually get any headers for.
6085 (gnus-list-range-intersection
6086 gnus-newsgroup-articles
6087 (gnus-remove-from-range (gnus-copy-sequence old) list)))
6089 (gnus-list-range-intersection
6090 gnus-newsgroup-articles
6091 (gnus-remove-from-range
6092 (gnus-copy-sequence list) old))))
6094 (push (list add 'add (list (cdr type))) delta-marks))
6096 ;; Don't delete marks from outside the active range.
6097 ;; This shouldn't happen, but is a sanity check.
6098 (setq del (gnus-sorted-range-intersection
6099 (gnus-active gnus-newsgroup-name) del))
6100 (push (list del 'del (list (cdr type))) delta-marks))))
6103 (push (cons (cdr type) list) newmarked)))
6106 (unless (gnus-check-group gnus-newsgroup-name)
6107 (error "Can't open server for %s" gnus-newsgroup-name))
6108 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6110 ;; Enter these new marks into the info of the group.
6112 (setcar (nthcdr 3 info) newmarked)
6113 ;; Add the marks lists to the end of the info.
6115 (setcdr (nthcdr 2 info) (list newmarked))))
6117 ;; Cut off the end of the info if there's nothing else there.
6121 (when (nthcdr (decf i) info)
6122 (setcdr (nthcdr i info) nil)))))))
6124 (defun gnus-set-mode-line (where)
6125 "Set the mode line of the article or summary buffers.
6126 If WHERE is `summary', the summary mode line format will be used."
6127 ;; Is this mode line one we keep updated?
6128 (when (and (memq where gnus-updated-mode-lines)
6130 (intern (format "gnus-%s-mode-line-format-spec" where))))
6132 ;; We evaluate this in the summary buffer since these
6133 ;; variables are buffer-local to that buffer.
6134 (with-current-buffer gnus-summary-buffer
6135 ;; We bind all these variables that are used in the `eval' form
6137 (let* ((mformat (symbol-value
6139 (format "gnus-%s-mode-line-format-spec" where))))
6140 (gnus-tmp-group-name (gnus-mode-string-quote
6141 (gnus-group-decoded-name
6142 gnus-newsgroup-name)))
6143 (gnus-tmp-article-number (or gnus-current-article 0))
6144 (gnus-tmp-unread gnus-newsgroup-unreads)
6145 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6146 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6147 (gnus-tmp-unread-and-unselected
6148 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6149 (zerop gnus-tmp-unselected))
6151 ((zerop gnus-tmp-unselected)
6152 (format "{%d more}" gnus-tmp-unread-and-unticked))
6153 (t (format "{%d(+%d) more}"
6154 gnus-tmp-unread-and-unticked
6155 gnus-tmp-unselected))))
6157 (if (and gnus-current-headers
6158 (vectorp gnus-current-headers))
6159 (gnus-mode-string-quote
6160 (mail-header-subject gnus-current-headers))
6162 bufname-length max-len
6163 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6164 (setq mode-string (eval mformat))
6165 (setq bufname-length (if (string-match "%b" mode-string)
6168 (if (eq where 'summary)
6170 (get-buffer gnus-article-buffer))))
6173 (setq max-len (max 4 (if gnus-mode-non-string-length
6175 gnus-mode-non-string-length
6177 (length mode-string))))
6178 ;; We might have to chop a bit of the string off...
6179 (when (> (length mode-string) max-len)
6181 (concat (truncate-string-to-width mode-string (- max-len 3))
6183 ;; Update the mode line.
6184 (setq mode-line-buffer-identification
6185 (gnus-mode-line-buffer-identification (list mode-string)))
6186 (set-buffer-modified-p t))))
6188 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6189 "Go through the HEADERS list and add all Xrefs to a hash table.
6190 The resulting hash table is returned, or nil if no Xrefs were found."
6191 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6192 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6193 (xref-hashtb (gnus-make-hashtable))
6194 start group entry number xrefs header)
6196 (setq header (pop headers))
6197 (when (and (setq xrefs (mail-header-xref header))
6198 (not (memq (setq number (mail-header-number header))
6201 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6202 (setq start (match-end 0))
6203 (setq group (if prefix
6204 (concat prefix (substring xrefs (match-beginning 1)
6206 (substring xrefs (match-beginning 1) (match-end 1))))
6208 (string-to-number (substring xrefs (match-beginning 2)
6210 (if (setq entry (gnus-gethash group xref-hashtb))
6211 (setcdr entry (cons number (cdr entry)))
6212 (gnus-sethash group (cons number nil) xref-hashtb)))))
6213 (and start xref-hashtb)))
6215 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6216 "Look through all the headers and mark the Xrefs as read."
6217 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6218 name info xref-hashtb idlist method nth4)
6219 (with-current-buffer gnus-group-buffer
6220 (when (setq xref-hashtb
6221 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6224 (unless (string= from-newsgroup (setq name (symbol-name group)))
6225 (setq idlist (symbol-value group))
6226 ;; Dead groups are not updated.
6228 (setq info (gnus-get-info name))
6229 (when (stringp (setq nth4 (gnus-info-method info)))
6230 (setq nth4 (gnus-server-to-method nth4))))
6231 ;; Only do the xrefs if the group has the same
6232 ;; select method as the group we have just read.
6233 (or (gnus-methods-equal-p
6234 nth4 (gnus-find-method-for-group from-newsgroup))
6236 (equal nth4 (setq method (gnus-find-method-for-group
6238 (and (equal (car nth4) (car method))
6239 (equal (nth 1 nth4) (nth 1 method))))
6240 gnus-use-cross-reference
6241 (or (not (eq gnus-use-cross-reference t))
6243 ;; Only do cross-references on subscribed
6244 ;; groups, if that is what is wanted.
6245 (<= (gnus-info-level info) gnus-level-subscribed))
6246 (gnus-group-make-articles-read name idlist))))
6249 (defun gnus-compute-read-articles (group articles)
6250 (let* ((entry (gnus-group-entry group))
6251 (info (nth 2 entry))
6252 (active (gnus-active group))
6255 ;; First peel off all invalid article numbers.
6257 (let ((ids articles)
6259 (while (setq id (pop ids))
6260 (when (and first (> id (cdr active)))
6261 ;; We'll end up in this situation in one particular
6262 ;; obscure situation. If you re-scan a group and get
6263 ;; a new article that is cross-posted to a different
6264 ;; group that has not been re-scanned, you might get
6265 ;; crossposted article that has a higher number than
6266 ;; Gnus believes possible. So we re-activate this
6267 ;; group as well. This might mean doing the
6268 ;; crossposting thingy will *increase* the number
6269 ;; of articles in some groups. Tsk, tsk.
6270 (setq active (or (gnus-activate-group group) active)))
6271 (when (or (> id (cdr active))
6272 (< id (car active)))
6273 (setq articles (delq id articles))))))
6274 ;; If the read list is nil, we init it.
6276 (null (gnus-info-read info))
6278 (setq ninfo (cons 1 (1- (car active))))
6279 (setq ninfo (gnus-info-read info)))
6280 ;; Then we add the read articles to the range.
6282 ninfo (setq articles (sort articles '<))))))
6284 (defun gnus-group-make-articles-read (group articles)
6285 "Update the info of GROUP to say that ARTICLES are read."
6287 (entry (gnus-group-entry group))
6288 (info (nth 2 entry))
6289 (active (gnus-active group))
6292 ;; Group that Gnus doesn't know exists, but still allow the
6293 ;; backend to set marks.
6294 (gnus-request-set-mark
6295 group (list (list (gnus-compress-sequence (sort articles #'<))
6297 ;; Normal, subscribed groups.
6298 (setq range (gnus-compute-read-articles group articles))
6299 (with-current-buffer gnus-group-buffer
6302 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6303 (gnus-info-set-read ',info ',(gnus-info-read info))
6304 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6305 (gnus-request-set-mark ,group (list (list ',range 'del '(read))))
6306 (gnus-group-update-group ,group t))))
6307 ;; Add the read articles to the range.
6308 (gnus-info-set-read info range)
6309 (gnus-request-set-mark group (list (list range 'add '(read))))
6310 ;; Then we have to re-compute how many unread
6311 ;; articles there are in this group.
6315 (setq num (- (1+ (cdr active)) (car active))))
6316 ((not (listp (cdr range)))
6317 (setq num (- (cdr active) (- (1+ (cdr range))
6321 (if (numberp (car range))
6323 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6324 (setq range (cdr range)))
6325 (setq num (- (cdr active) num))))
6326 ;; Update the number of unread articles.
6328 ;; Update the group buffer.
6329 (unless (gnus-ephemeral-group-p group)
6330 (gnus-group-update-group group t))))))
6332 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6333 (let ((cur nntp-server-buffer)
6336 (with-current-buffer gnus-summary-buffer
6337 gnus-newsgroup-dependencies)))
6338 headers id end ref number
6339 (mail-parse-charset gnus-newsgroup-charset)
6340 (mail-parse-ignored-charsets
6341 (save-current-buffer (condition-case nil
6342 (set-buffer gnus-summary-buffer)
6344 gnus-newsgroup-ignored-charsets)))
6345 (with-current-buffer nntp-server-buffer
6346 ;; Translate all TAB characters into SPACE characters.
6347 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6348 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6349 (ietf-drums-unfold-fws)
6350 (gnus-run-hooks 'gnus-parse-headers-hook)
6351 (let ((case-fold-search t)
6352 in-reply-to header p lines chars)
6353 (goto-char (point-min))
6354 ;; Search to the beginning of the next header. Error messages
6355 ;; do not begin with 2 or 3.
6356 (while (re-search-forward "^[23][0-9]+ " nil t)
6359 ;; This implementation of this function, with nine
6360 ;; search-forwards instead of the one re-search-forward and
6361 ;; a case (which basically was the old function) is actually
6362 ;; about twice as fast, even though it looks messier. You
6363 ;; can't have everything, I guess. Speed and elegance
6364 ;; doesn't always go hand in hand.
6370 (setq number (read cur))
6373 (narrow-to-region (point)
6374 (or (and (search-forward "\n.\n" nil t)
6380 (if (search-forward "\nsubject:" nil t)
6381 (funcall gnus-decode-encoded-word-function
6382 (nnheader-header-value))
6387 (if (search-forward "\nfrom:" nil t)
6388 (funcall gnus-decode-encoded-address-function
6389 (nnheader-header-value))
6394 (if (search-forward "\ndate:" nil t)
6395 (nnheader-header-value) ""))
6399 (setq id (if (re-search-forward
6400 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6401 ;; We do it this way to make sure the Message-ID
6402 ;; is (somewhat) syntactically valid.
6403 (buffer-substring (match-beginning 1)
6405 ;; If there was no message-id, we just fake one
6406 ;; to make subsequent routines simpler.
6407 (nnheader-generate-fake-message-id number))))
6411 (if (search-forward "\nreferences:" nil t)
6415 (nnheader-header-value)
6420 (search-backward ">" end t)
6423 (search-backward "<" end t)
6425 ;; Get the references from the in-reply-to header if there
6426 ;; were no references and the in-reply-to header looks
6428 (if (and (search-forward "\nin-reply-to:" nil t)
6429 (setq in-reply-to (nnheader-header-value))
6430 (string-match "<[^>]+>" in-reply-to))
6432 (setq ref (substring in-reply-to (match-beginning 0)
6434 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6435 (setq ref2 (substring in-reply-to (match-beginning 0)
6437 (when (> (length ref2) (length ref))
6444 (if (search-forward "\nchars: " nil t)
6445 (if (numberp (setq chars (ignore-errors (read cur))))
6451 (if (search-forward "\nlines: " nil t)
6452 (if (numberp (setq lines (ignore-errors (read cur))))
6458 (and (search-forward "\nxref:" nil t)
6459 (nnheader-header-value)))
6461 (when gnus-extra-headers
6462 (let ((extra gnus-extra-headers)
6466 (when (search-forward
6467 (concat "\n" (symbol-name (car extra)) ":") nil t)
6468 (push (cons (car extra) (nnheader-header-value))
6472 (when (equal id ref)
6475 (when gnus-alter-header-function
6476 (funcall gnus-alter-header-function header)
6477 (setq id (mail-header-id header)
6478 ref (gnus-parent-id (mail-header-references header))))
6481 (gnus-dependencies-add-header
6482 header dependencies force-new))
6483 (push header headers))
6484 (goto-char (point-max))
6486 (nreverse headers)))))
6488 ;; Goes through the xover lines and returns a list of vectors
6489 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6490 force-new dependencies
6491 group also-fetch-heads)
6492 "Parse the news overview data in the server buffer.
6493 Return a list of headers that match SEQUENCE (see
6494 `nntp-retrieve-headers')."
6495 ;; Get the Xref when the users reads the articles since most/some
6496 ;; NNTP servers do not include Xrefs when using XOVER.
6497 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6498 (let ((mail-parse-charset gnus-newsgroup-charset)
6499 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6500 (cur nntp-server-buffer)
6501 (dependencies (or dependencies gnus-newsgroup-dependencies))
6503 ((eq gnus-read-all-available-headers t)
6505 ((and (stringp gnus-read-all-available-headers)
6507 (string-match gnus-read-all-available-headers group))
6510 number headers header)
6511 (with-current-buffer nntp-server-buffer
6512 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6513 ;; Allow the user to mangle the headers before parsing them.
6514 (gnus-run-hooks 'gnus-parse-headers-hook)
6515 (goto-char (point-min))
6516 (gnus-parse-without-error
6517 (while (and (or sequence allp)
6519 (setq number (read cur))
6521 (while (and sequence
6522 (< (car sequence) number))
6523 (setq sequence (cdr sequence))))
6526 (eq number (car sequence))))
6528 (setq sequence (cdr sequence))
6529 (setq header (inline
6530 (gnus-nov-parse-line
6531 number dependencies force-new)))))
6532 (push header headers))
6534 ;; A common bug in inn is that if you have posted an article and
6535 ;; then retrieves the active file, it will answer correctly --
6536 ;; the new article is included. However, a NOV entry for the
6537 ;; article may not have been generated yet, so this may fail.
6538 ;; We work around this problem by retrieving the last few
6539 ;; headers using HEAD.
6540 (if (or (not also-fetch-heads)
6542 ;; We (probably) got all the headers.
6544 (let ((gnus-nov-is-evil t))
6547 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6548 (gnus-get-newsgroup-headers))))))))
6550 (defun gnus-article-get-xrefs ()
6551 "Fill in the Xref value in `gnus-current-headers', if necessary.
6552 This is meant to be called in `gnus-article-internal-prepare-hook'."
6553 (let ((headers (with-current-buffer gnus-summary-buffer
6554 gnus-current-headers)))
6555 (or (not gnus-use-cross-reference)
6557 (and (mail-header-xref headers)
6558 (not (string= (mail-header-xref headers) "")))
6559 (let ((case-fold-search t)
6562 (nnheader-narrow-to-headers)
6563 (goto-char (point-min))
6564 (when (or (and (not (eobp))
6565 (eq (downcase (char-after)) ?x)
6566 (looking-at "Xref:"))
6567 (search-forward "\nXref:" nil t))
6568 (goto-char (1+ (match-end 0)))
6569 (setq xref (buffer-substring (point) (point-at-eol)))
6570 (mail-header-set-xref headers xref)))))))
6572 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6573 "Find article ID and insert the summary line for that article.
6574 OLD-HEADER can either be a header or a line number to insert
6575 the subject line on.
6576 If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a header,
6577 and OLD-HEADER will be used when the summary line is inserted,
6578 too, instead of trying to fetch new headers."
6579 (let* ((line (and (numberp old-header) old-header))
6580 (old-header (and (vectorp old-header) old-header))
6581 (header (cond ((and old-header use-old-header)
6584 (gnus-number-to-header id))
6585 (gnus-number-to-header id))
6587 (gnus-read-header id))))
6588 (number (and (numberp id) id))
6591 ;; Rebuild the thread that this article is part of and go to the
6592 ;; article we have fetched.
6593 (when (and (not gnus-show-threads)
6596 (setq d (gnus-data-find (mail-header-number old-header))))
6597 (goto-char (gnus-data-pos d))
6603 (gnus-delete-line))))))
6604 ;; Remove list identifiers from subject.
6605 (let ((gnus-newsgroup-headers (list header)))
6606 (gnus-summary-remove-list-identifiers))
6608 (mail-header-set-number header (mail-header-number old-header)))
6609 (setq gnus-newsgroup-sparse
6610 (delq (setq number (mail-header-number header))
6611 gnus-newsgroup-sparse))
6612 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6613 (push number gnus-newsgroup-limit)
6614 (gnus-rebuild-thread (mail-header-id header) line)
6615 (gnus-summary-goto-subject number nil t))
6616 (when (and (numberp number)
6618 ;; We have to update the boundaries even if we can't fetch the
6619 ;; article if ID is a number -- so that the next `P' or `N'
6620 ;; command will fetch the previous (or next) article even
6621 ;; if the one we tried to fetch this time has been canceled.
6622 (when (> number gnus-newsgroup-end)
6623 (setq gnus-newsgroup-end number))
6624 (when (< number gnus-newsgroup-begin)
6625 (setq gnus-newsgroup-begin number))
6626 (setq gnus-newsgroup-unselected
6627 (delq number gnus-newsgroup-unselected)))
6628 ;; Report back a success?
6629 (and header (mail-header-number header))))
6631 ;;; Process/prefix in the summary buffer
6633 (defun gnus-summary-work-articles (n)
6634 "Return a list of articles to be worked upon.
6635 The prefix argument, the list of process marked articles, and the
6636 current article will be taken into consideration."
6637 (with-current-buffer gnus-summary-buffer
6640 ;; A numerical prefix has been given.
6641 (setq n (prefix-numeric-value n))
6642 (let ((backward (< n 0))
6643 (n (abs (prefix-numeric-value n)))
6648 (push (setq article (gnus-summary-article-number))
6651 (gnus-summary-find-prev nil article)
6652 (gnus-summary-find-next nil article)))
6654 (nreverse articles)))
6655 ((and (gnus-region-active-p) (mark))
6656 (message "region active")
6657 ;; Work on the region between point and mark.
6658 (let ((max (max (point) (mark)))
6661 (goto-char (min (point) (mark)))
6664 (push (setq article (gnus-summary-article-number)) articles)
6665 (gnus-summary-find-next nil article)
6667 (nreverse articles))))
6668 (gnus-newsgroup-processable
6669 ;; There are process-marked articles present.
6670 ;; Save current state.
6671 (gnus-summary-save-process-mark)
6673 (reverse gnus-newsgroup-processable))
6675 ;; Just return the current article.
6676 (list (gnus-summary-article-number))))))
6678 (defmacro gnus-summary-iterate (arg &rest forms)
6679 "Iterate over the process/prefixed articles and do FORMS.
6680 ARG is the interactive prefix given to the command. FORMS will be
6681 executed with point over the summary line of the articles."
6682 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6683 `(let ((,articles (gnus-summary-work-articles ,arg)))
6685 (gnus-summary-goto-subject (car ,articles))
6689 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6690 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6692 (defun gnus-summary-save-process-mark ()
6693 "Push the current set of process marked articles on the stack."
6695 (push (copy-sequence gnus-newsgroup-processable)
6696 gnus-newsgroup-process-stack))
6698 (defun gnus-summary-kill-process-mark ()
6699 "Push the current set of process marked articles on the stack and unmark."
6701 (gnus-summary-save-process-mark)
6702 (gnus-summary-unmark-all-processable))
6704 (defun gnus-summary-yank-process-mark ()
6705 "Pop the last process mark state off the stack and restore it."
6707 (unless gnus-newsgroup-process-stack
6708 (error "Empty mark stack"))
6709 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6711 (defun gnus-summary-process-mark-set (set)
6712 "Make SET into the current process marked articles."
6713 (gnus-summary-unmark-all-processable)
6714 (mapc 'gnus-summary-set-process-mark set))
6716 ;;; Searching and stuff
6718 (defun gnus-summary-search-group (&optional backward use-level)
6719 "Search for next unread newsgroup.
6720 If optional argument BACKWARD is non-nil, search backward instead."
6721 (with-current-buffer gnus-group-buffer
6722 (when (gnus-group-search-forward
6723 backward nil (if use-level (gnus-group-group-level) nil))
6724 (gnus-group-group-name))))
6726 (defun gnus-summary-best-group (&optional exclude-group)
6727 "Find the name of the best unread group.
6728 If EXCLUDE-GROUP, do not go to this group."
6729 (with-current-buffer gnus-group-buffer
6731 (gnus-group-best-unread-group exclude-group))))
6733 (defun gnus-summary-find-next (&optional unread article backward)
6735 (gnus-summary-find-prev unread article)
6736 (let* ((dummy (gnus-summary-article-intangible-p))
6737 (article (or article (gnus-summary-article-number)))
6738 (data (gnus-data-find-list article))
6740 (when (and (not dummy)
6741 (or (not gnus-summary-check-current)
6743 (not (gnus-data-unread-p (car data)))))
6744 (setq data (cdr data)))
6749 (unless (memq (gnus-data-number (car data))
6751 ((eq gnus-auto-goto-ignores
6752 'always-undownloaded)
6753 gnus-newsgroup-undownloaded)
6756 ((eq gnus-auto-goto-ignores
6758 gnus-newsgroup-unfetched)
6759 ((eq gnus-auto-goto-ignores
6761 gnus-newsgroup-undownloaded)))
6762 (when (gnus-data-unread-p (car data))
6763 (setq result (car data)
6765 (setq data (cdr data)))
6768 (goto-char (gnus-data-pos result))
6769 (gnus-data-number result)))))
6771 (defun gnus-summary-find-prev (&optional unread article)
6772 (let* ((eobp (eobp))
6773 (article (or article (gnus-summary-article-number)))
6774 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6776 (when (and (not eobp)
6777 (or (not gnus-summary-check-current)
6779 (not (gnus-data-unread-p (car data)))))
6780 (setq data (cdr data)))
6785 (unless (memq (gnus-data-number (car data))
6787 ((eq gnus-auto-goto-ignores
6788 'always-undownloaded)
6789 gnus-newsgroup-undownloaded)
6792 ((eq gnus-auto-goto-ignores
6794 gnus-newsgroup-unfetched)
6795 ((eq gnus-auto-goto-ignores
6797 gnus-newsgroup-undownloaded)))
6798 (when (gnus-data-unread-p (car data))
6799 (setq result (car data)
6801 (setq data (cdr data)))
6804 (goto-char (gnus-data-pos result))
6805 (gnus-data-number result))))
6807 (defun gnus-summary-find-subject (subject &optional unread backward article)
6808 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6809 (article (or article (gnus-summary-article-number)))
6810 (articles (gnus-data-list backward))
6811 (arts (gnus-data-find-list article articles))
6813 (when (or (not gnus-summary-check-current)
6815 (not (gnus-data-unread-p (car arts))))
6816 (setq arts (cdr arts)))
6818 (and (or (not unread)
6819 (gnus-data-unread-p (car arts)))
6820 (vectorp (gnus-data-header (car arts)))
6822 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6823 (setq result (car arts)
6825 (setq arts (cdr arts)))
6827 (goto-char (gnus-data-pos result))
6828 (gnus-data-number result))))
6830 (defun gnus-summary-search-forward (&optional unread subject backward)
6831 "Search forward for an article.
6832 If UNREAD, look for unread articles. If SUBJECT, look for
6833 articles with that subject. If BACKWARD, search backward instead."
6834 (cond (subject (gnus-summary-find-subject subject unread backward))
6835 (backward (gnus-summary-find-prev unread))
6836 (t (gnus-summary-find-next unread))))
6838 (defun gnus-recenter (&optional n)
6839 "Center point in window and redisplay frame.
6840 Also do horizontal recentering."
6842 (when (and gnus-auto-center-summary
6843 (not (eq gnus-auto-center-summary 'vertical)))
6844 (gnus-horizontal-recenter))
6845 (if (fboundp 'recenter-top-bottom)
6846 (recenter-top-bottom n)
6849 (put 'gnus-recenter 'isearch-scroll t)
6851 (defun gnus-forward-line-ignore-invisible (n)
6852 "Move N lines forward (backward if N is negative).
6853 Like forward-line, but skip over (and don't count) invisible lines."
6855 (while (and (> n 0) (not done))
6856 ;; If the following character is currently invisible,
6857 ;; skip all characters with that same `invisible' property value.
6858 (while (gnus-invisible-p (point))
6859 (goto-char (gnus-next-char-property-change (point))))
6864 (while (and (< n 0) (not done))
6866 (if (bobp) (setq done t)
6868 (while (and (not (bobp)) (gnus-invisible-p (1- (point))))
6869 (goto-char (gnus-previous-char-property-change (point))))))))
6871 (defun gnus-summary-recenter ()
6872 "Center point in the summary window.
6873 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6874 displayed, no centering will be performed."
6875 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6876 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6878 ;; The user has to want it.
6879 (when gnus-auto-center-summary
6880 (let* ((top (cond ((< (window-height) 4) 0)
6881 ((< (window-height) 7) 1)
6882 (t (if (numberp gnus-auto-center-summary)
6883 gnus-auto-center-summary
6884 (/ (1- (window-height)) 2)))))
6885 (height (1- (window-height)))
6886 (bottom (save-excursion
6887 (goto-char (point-max))
6888 (gnus-forward-line-ignore-invisible (- height))
6890 (window (get-buffer-window (current-buffer))))
6891 (when (get-buffer-window gnus-article-buffer)
6892 ;; Only do recentering when the article buffer is displayed,
6893 ;; Set the window start to either `bottom', which is the biggest
6894 ;; possible valid number, or the second line from the top,
6895 ;; whichever is the least.
6896 (let ((top-pos (save-excursion
6897 (gnus-forward-line-ignore-invisible (- top))
6899 (if (> bottom top-pos)
6900 ;; Keep the second line from the top visible
6901 (set-window-start window top-pos)
6902 ;; Try to keep the bottom line visible; if it's partially
6903 ;; obscured, either scroll one more line to make it fully
6904 ;; visible, or revert to using TOP-POS.
6906 (goto-char (point-max))
6907 (gnus-forward-line-ignore-invisible -1)
6908 (let ((last-line-start (point)))
6910 (set-window-start window (point) t)
6911 (when (not (pos-visible-in-window-p last-line-start window))
6912 (gnus-forward-line-ignore-invisible 1)
6913 (set-window-start window (min (point) top-pos) t)))))))
6914 ;; Do horizontal recentering while we're at it.
6915 (when (and (get-buffer-window (current-buffer) t)
6916 (not (eq gnus-auto-center-summary 'vertical)))
6917 (let ((selected (selected-window)))
6918 (select-window (get-buffer-window (current-buffer) t))
6919 (gnus-summary-position-point)
6920 (gnus-horizontal-recenter)
6921 (select-window selected))))))
6923 (defun gnus-summary-jump-to-group (newsgroup)
6924 "Move point to NEWSGROUP in group mode buffer."
6925 ;; Keep update point of group mode buffer if visible.
6926 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6927 (save-window-excursion
6928 ;; Take care of tree window mode.
6929 (when (get-buffer-window gnus-group-buffer)
6930 (pop-to-buffer gnus-group-buffer))
6931 (gnus-group-jump-to-group newsgroup))
6933 ;; Take care of tree window mode.
6934 (if (get-buffer-window gnus-group-buffer 0)
6935 (pop-to-buffer gnus-group-buffer)
6936 (set-buffer gnus-group-buffer))
6937 (gnus-group-jump-to-group newsgroup))))
6939 ;; This function returns a list of article numbers based on the
6940 ;; difference between the ranges of read articles in this group and
6941 ;; the range of active articles.
6942 (defun gnus-list-of-unread-articles (group)
6943 (let* ((read (gnus-info-read (gnus-get-info group)))
6944 (active (or (gnus-active group) (gnus-activate-group group)))
6945 (last (or (cdr active)
6946 (error "Group %s couldn't be activated " group)))
6947 (bottom (if gnus-newsgroup-maximum-articles
6949 (- last gnus-newsgroup-maximum-articles -1))
6952 ;; If none are read, then all are unread.
6955 ;; If the range of read articles is a single range, then the
6956 ;; first unread article is the article after the last read
6957 ;; article. Sounds logical, doesn't it?
6958 (if (and (not (listp (cdr read)))
6959 (or (< (car read) bottom)
6960 (progn (setq read (list read))
6962 (setq first (max bottom (1+ (cdr read))))
6963 ;; `read' is a list of ranges.
6964 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6967 (setq first bottom))
6970 (while (< first nlast)
6971 (setq unread (cons first unread)
6973 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6974 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6975 (setq read (cdr read)))))
6976 ;; And add the last unread articles.
6977 (while (<= first last)
6978 (setq unread (cons first unread)
6980 ;; Return the list of unread articles.
6981 (delq 0 (nreverse unread))))
6983 (defun gnus-list-of-read-articles (group)
6984 "Return a list of unread, unticked and non-dormant articles."
6985 (let* ((info (gnus-get-info group))
6986 (marked (gnus-info-marks info))
6987 (active (gnus-active group)))
6989 (gnus-list-range-difference
6990 (gnus-list-range-difference
6991 (gnus-sorted-complement
6992 (gnus-uncompress-range
6993 (if gnus-newsgroup-maximum-articles
6994 (cons (max (car active)
6996 gnus-newsgroup-maximum-articles
7000 (gnus-list-of-unread-articles group))
7001 (cdr (assq 'dormant marked)))
7002 (cdr (assq 'tick marked))))))
7004 ;; This function returns a sequence of article numbers based on the
7005 ;; difference between the ranges of read articles in this group and
7006 ;; the range of active articles.
7007 (defun gnus-sequence-of-unread-articles (group)
7008 (let* ((read (gnus-info-read (gnus-get-info group)))
7009 (active (or (gnus-active group) (gnus-activate-group group)))
7011 (bottom (if gnus-newsgroup-maximum-articles
7013 (- last gnus-newsgroup-maximum-articles -1))
7016 ;; If none are read, then all are unread.
7019 ;; If the range of read articles is a single range, then the
7020 ;; first unread article is the article after the last read
7021 ;; article. Sounds logical, doesn't it?
7022 (if (and (not (listp (cdr read)))
7023 (or (< (car read) bottom)
7024 (progn (setq read (list read))
7026 (setq first (max bottom (1+ (cdr read))))
7027 ;; `read' is a list of ranges.
7028 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
7031 (setq first bottom))
7034 (push (cons first nlast) unread))
7035 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
7036 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
7037 (setq read (cdr read)))))
7038 ;; And add the last unread articles.
7039 (cond ((not (and first last))
7042 (push (cons first last) unread))
7044 (push first unread)))
7045 ;; Return the sequence of unread articles.
7046 (delq 0 (nreverse unread))))
7048 ;; Various summary commands
7050 (defun gnus-summary-select-article-buffer ()
7051 "Reconfigure windows to show the article buffer.
7052 If `gnus-widen-article-window' is set, show only the article
7055 (if (not (gnus-buffer-live-p gnus-article-buffer))
7056 (error "There is no article buffer for this summary buffer")
7057 (unless (get-buffer-window gnus-article-buffer)
7058 (gnus-summary-show-article))
7059 (gnus-configure-windows
7060 (if gnus-widen-article-window
7064 (select-window (get-buffer-window gnus-article-buffer))))
7066 (defun gnus-summary-universal-argument (arg)
7067 "Perform any operation on all articles that are process/prefixed."
7069 (let ((articles (gnus-summary-work-articles arg))
7076 (substitute-command-keys
7077 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
7079 (gnus-error 1 "Undefined key")
7082 (gnus-summary-goto-subject (setq article (pop articles)))
7083 (let (gnus-newsgroup-processable)
7084 (command-execute func))
7085 (gnus-summary-remove-process-mark article)))))
7086 (gnus-summary-position-point))
7088 (defun gnus-summary-toggle-truncation (&optional arg)
7089 "Toggle truncation of summary lines.
7090 With ARG, turn line truncation on if ARG is positive."
7092 (setq truncate-lines
7093 (if (null arg) (not truncate-lines)
7094 (> (prefix-numeric-value arg) 0)))
7097 (defun gnus-summary-find-for-reselect ()
7098 "Return the number of an article to stay on across a reselect.
7099 The current article is considered, then following articles, then previous
7100 articles. An article is sought which is not cancelled and isn't a temporary
7101 insertion from another group. If there's no such then return a dummy 0."
7103 (dolist (rev '(nil t))
7104 (unless found ; don't demand the reverse list if we don't need it
7105 (let ((data (gnus-data-find-list
7106 (gnus-summary-article-number) (gnus-data-list rev))))
7107 (while (and data (not found))
7108 (if (and (< 0 (gnus-data-number (car data)))
7109 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
7110 (setq found (gnus-data-number (car data))))
7111 (setq data (cdr data))))))
7114 (defun gnus-summary-reselect-current-group (&optional all rescan)
7115 "Exit and then reselect the current newsgroup.
7116 The prefix argument ALL means to select all articles."
7118 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
7119 (error "Ephemeral groups can't be reselected"))
7120 (let ((current-subject (gnus-summary-find-for-reselect))
7121 (group gnus-newsgroup-name))
7122 (setq gnus-newsgroup-begin nil)
7123 (gnus-summary-exit nil 'leave-hidden)
7124 ;; We have to adjust the point of group mode buffer because
7125 ;; point was moved to the next unread newsgroup by exiting.
7126 (gnus-summary-jump-to-group group)
7129 (gnus-group-get-new-news-this-group 1)))
7130 (gnus-group-read-group all t)
7131 (gnus-summary-goto-subject current-subject nil t)))
7133 (defun gnus-summary-rescan-group (&optional all)
7134 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7136 (let ((config gnus-current-window-configuration))
7137 (gnus-summary-reselect-current-group all t)
7138 (gnus-configure-windows config)
7139 (when (eq config 'article)
7140 (gnus-summary-select-article))))
7142 (defun gnus-summary-update-info (&optional non-destructive)
7144 (let ((group gnus-newsgroup-name))
7146 (when gnus-newsgroup-kill-headers
7147 (setq gnus-newsgroup-killed
7148 (gnus-compress-sequence
7150 (gnus-list-range-intersection
7151 gnus-newsgroup-unselected gnus-newsgroup-killed)
7152 gnus-newsgroup-unreads)
7154 (unless (listp (cdr gnus-newsgroup-killed))
7155 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7156 (let ((headers gnus-newsgroup-headers)
7157 (ephemeral-p (gnus-ephemeral-group-p group))
7160 (setq info (copy-sequence (gnus-get-info group))
7161 info (delq (gnus-info-params info) info)))
7162 ;; Set the new ranges of read articles.
7163 (with-current-buffer gnus-group-buffer
7164 (gnus-undo-force-boundary))
7165 (gnus-update-read-articles
7166 group (gnus-sorted-union
7167 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7168 ;; Set the current article marks.
7169 (let ((gnus-newsgroup-scored
7170 (if (and (not gnus-save-score)
7171 (not non-destructive))
7173 gnus-newsgroup-scored)))
7175 (gnus-update-marks)))
7176 ;; Do the cross-ref thing.
7177 (when gnus-use-cross-reference
7178 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7179 ;; Do not switch windows but change the buffer to work.
7180 (set-buffer gnus-group-buffer)
7182 (gnus-group-update-group
7185 (setq info (copy-sequence (gnus-get-info group))
7186 info (delq (gnus-info-params info) info))))))))))
7188 (defun gnus-summary-save-newsrc (&optional force)
7189 "Save the current number of read/marked articles in the dribble buffer.
7190 The dribble buffer will then be saved.
7191 If FORCE (the prefix), also save the .newsrc file(s)."
7193 (gnus-summary-update-info t)
7195 (gnus-save-newsrc-file)
7196 (gnus-dribble-save)))
7198 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7200 (defun gnus-summary-exit (&optional temporary leave-hidden)
7201 "Exit reading current newsgroup, and then return to group selection mode.
7202 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7204 (gnus-set-global-variables)
7205 (when (gnus-buffer-live-p gnus-article-buffer)
7206 (with-current-buffer gnus-article-buffer
7207 (mm-destroy-parts gnus-article-mime-handles)
7208 ;; Set it to nil for safety reason.
7209 (setq gnus-article-mime-handle-alist nil)
7210 (setq gnus-article-mime-handles nil)))
7211 (gnus-kill-save-kill-buffer)
7212 (gnus-async-halt-prefetch)
7213 (let* ((group gnus-newsgroup-name)
7214 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7215 (gnus-group-is-exiting-p t)
7216 (article-buffer gnus-article-buffer)
7217 (original-article-buffer gnus-original-article-buffer)
7220 (buf (current-buffer))
7221 ;; `gnus-single-article-buffer' is nil buffer-locally in
7222 ;; ephemeral group of which summary buffer will be killed,
7223 ;; but the global value may be non-nil.
7224 (single-article-buffer gnus-single-article-buffer))
7226 ;; Do adaptive scoring, and possibly save score files.
7227 (when gnus-newsgroup-adaptive
7228 (gnus-score-adaptive))
7229 (when gnus-use-scoring
7231 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7232 (when gnus-use-cache
7233 (gnus-cache-possibly-remove-articles)
7234 (gnus-cache-save-buffers))
7235 (gnus-async-prefetch-remove-group group)
7236 (when gnus-suppress-duplicates
7237 (gnus-dup-enter-articles))
7238 (when gnus-use-trees
7239 (gnus-tree-close group))
7240 (when gnus-use-cache
7241 (gnus-cache-write-active))
7242 ;; Remove entries for this group.
7243 (nnmail-purge-split-history (gnus-group-real-name group))
7244 ;; Make all changes in this group permanent.
7246 (gnus-run-hooks 'gnus-exit-group-hook)
7247 (gnus-summary-update-info))
7248 (gnus-close-group group)
7249 ;; Make sure where we were, and go to next newsgroup.
7250 (set-buffer gnus-group-buffer)
7252 (gnus-group-jump-to-group group))
7253 (gnus-run-hooks 'gnus-summary-exit-hook)
7254 (unless (or quit-config
7255 (not gnus-summary-next-group-on-exit)
7256 ;; If this group has disappeared from the summary
7257 ;; buffer, don't skip forwards.
7258 (not (string= group (gnus-group-group-name))))
7259 (gnus-group-next-unread-group 1))
7260 (setq group-point (point))
7264 (if (not gnus-kill-summary-on-exit)
7266 (gnus-deaden-summary)
7268 (when (get-buffer gnus-article-buffer)
7269 (bury-buffer gnus-article-buffer))
7270 ;; Return to group mode buffer.
7271 (when (eq mode 'gnus-summary-mode)
7272 (gnus-kill-buffer buf)))
7274 (setq gnus-current-select-method gnus-select-method)
7275 (set-buffer gnus-group-buffer)
7277 (gnus-handle-ephemeral-exit quit-config)
7278 (goto-char group-point)
7279 ;; If gnus-group-buffer is already displayed, make sure we also move
7280 ;; the cursor in the window that displays it.
7281 (let ((win (get-buffer-window (current-buffer) 0)))
7282 (if win (set-window-point win (point))))
7283 (unless leave-hidden
7284 (gnus-configure-windows 'group 'force)))
7286 ;; If we have several article buffers, we kill them at exit.
7287 (unless single-article-buffer
7288 (when (gnus-buffer-live-p article-buffer)
7289 (with-current-buffer article-buffer
7290 ;; Don't kill sticky article buffers
7291 (unless (eq major-mode 'gnus-sticky-article-mode)
7292 (gnus-kill-buffer article-buffer)
7293 (setq gnus-article-current nil))))
7294 (gnus-kill-buffer original-article-buffer))
7296 ;; Clear the current group name.
7298 (setq gnus-newsgroup-name nil)))))
7300 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7301 (defun gnus-summary-exit-no-update (&optional no-questions)
7302 "Quit reading current newsgroup without updating read article info."
7304 (let* ((group gnus-newsgroup-name)
7305 (gnus-group-is-exiting-p t)
7306 (gnus-group-is-exiting-without-update-p t)
7307 (quit-config (gnus-group-quit-config group)))
7308 (when (or no-questions
7310 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7311 (gnus-async-halt-prefetch)
7312 (run-hooks 'gnus-summary-prepare-exit-hook)
7313 (when (gnus-buffer-live-p gnus-article-buffer)
7314 (with-current-buffer gnus-article-buffer
7315 (gnus-article-stop-animations)
7316 (mm-destroy-parts gnus-article-mime-handles)
7317 ;; Set it to nil for safety reason.
7318 (setq gnus-article-mime-handle-alist nil)
7319 (setq gnus-article-mime-handles nil)))
7320 ;; If we have several article buffers, we kill them at exit.
7321 (unless gnus-single-article-buffer
7322 (gnus-kill-buffer gnus-article-buffer)
7323 (gnus-kill-buffer gnus-original-article-buffer)
7324 (setq gnus-article-current nil))
7325 ;; Return to the group buffer.
7326 (gnus-configure-windows 'group 'force)
7327 (if (not gnus-kill-summary-on-exit)
7328 (gnus-deaden-summary)
7329 (gnus-close-group group)
7330 (gnus-kill-buffer gnus-summary-buffer))
7331 (unless gnus-single-article-buffer
7332 (setq gnus-article-current nil))
7333 (when gnus-use-trees
7334 (gnus-tree-close group))
7335 (gnus-async-prefetch-remove-group group)
7336 (when (get-buffer gnus-article-buffer)
7337 (bury-buffer gnus-article-buffer))
7338 ;; Clear the current group name.
7339 (setq gnus-newsgroup-name nil)
7340 (unless (gnus-ephemeral-group-p group)
7341 (gnus-group-update-group group nil t))
7342 (when (equal (gnus-group-group-name) group)
7343 (gnus-group-next-unread-group 1))
7345 (gnus-handle-ephemeral-exit quit-config)))))
7347 (defun gnus-handle-ephemeral-exit (quit-config)
7348 "Handle movement when leaving an ephemeral group.
7349 The state which existed when entering the ephemeral is reset."
7350 (if (not (buffer-name (car quit-config)))
7351 (gnus-configure-windows 'group 'force)
7352 (set-buffer (car quit-config))
7353 (unless (eq (cdr quit-config) 'group)
7354 (setq gnus-current-select-method
7355 (gnus-find-method-for-group gnus-newsgroup-name)))
7356 (cond ((eq major-mode 'gnus-summary-mode)
7357 (gnus-set-global-variables))
7358 ((eq major-mode 'gnus-article-mode)
7359 (save-current-buffer
7360 ;; The `gnus-summary-buffer' variable may point
7361 ;; to the old summary buffer when using a single
7363 (unless (gnus-buffer-live-p gnus-summary-buffer)
7364 (set-buffer gnus-group-buffer))
7365 (set-buffer gnus-summary-buffer)
7366 (gnus-set-global-variables))))
7367 (if (or (eq (cdr quit-config) 'article)
7368 (eq (cdr quit-config) 'pick))
7369 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7370 (gnus-configure-windows 'pick 'force)
7371 (gnus-configure-windows (cdr quit-config) 'force))
7372 (gnus-configure-windows (cdr quit-config) 'force))
7373 (when (eq major-mode 'gnus-summary-mode)
7374 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7375 next-unread-noselect))
7376 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7378 (gnus-summary-next-subject 1 nil t))
7379 ((eq gnus-auto-select-on-ephemeral-exit
7380 'next-unread-noselect)
7381 (gnus-summary-next-subject 1 t t))))
7382 ;; Hide the article buffer which displays the article different
7383 ;; from the one that the cursor points to in the summary buffer.
7384 (gnus-configure-windows 'summary 'force))
7385 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7386 (gnus-summary-next-subject 1))
7387 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7388 (gnus-summary-next-subject 1 t))))
7389 (gnus-summary-recenter)
7390 (gnus-summary-position-point))))
7394 (defvar gnus-dead-summary-mode-map
7395 (let ((map (make-keymap)))
7396 (suppress-keymap map)
7397 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7398 (dolist (key '("\C-d" "\r" "\177" [delete]))
7399 (define-key map key 'gnus-summary-wake-up-the-dead))
7400 (dolist (key '("q" "Q"))
7401 (define-key map key 'bury-buffer))
7404 (define-minor-mode gnus-dead-summary-mode
7405 "Minor mode for Gnus summary buffers."
7406 :lighter " Dead" :keymap gnus-dead-summary-mode-map
7407 (unless (derived-mode-p 'gnus-summary-mode)
7408 (setq gnus-dead-summary-mode nil)))
7410 (defun gnus-deaden-summary ()
7411 "Make the current summary buffer into a dead summary buffer."
7412 ;; Kill any previous dead summary buffer.
7413 (when (and gnus-dead-summary
7414 (buffer-name gnus-dead-summary))
7415 (with-current-buffer gnus-dead-summary
7416 (when gnus-dead-summary-mode
7417 (kill-buffer (current-buffer)))))
7418 ;; Make this the current dead summary.
7419 (setq gnus-dead-summary (current-buffer))
7420 (gnus-dead-summary-mode 1)
7421 (let ((name (buffer-name)))
7422 (when (string-match "Summary" name)
7424 (concat (substring name 0 (match-beginning 0)) "Dead "
7425 (substring name (match-beginning 0)))
7429 (defun gnus-kill-or-deaden-summary (buffer)
7430 "Kill or deaden the summary BUFFER."
7432 (when (and (buffer-name buffer)
7433 (not gnus-single-article-buffer))
7434 (with-current-buffer buffer
7435 (gnus-kill-buffer gnus-article-buffer)
7436 (gnus-kill-buffer gnus-original-article-buffer)))
7439 (gnus-kill-summary-on-exit
7440 (when (and gnus-use-trees
7441 (gnus-buffer-exists-p buffer))
7442 (with-current-buffer buffer
7443 (gnus-tree-close gnus-newsgroup-name)))
7444 (gnus-kill-buffer buffer))
7445 ;; Deaden the buffer.
7446 ((gnus-buffer-exists-p buffer)
7447 (with-current-buffer buffer
7448 (gnus-deaden-summary))))))
7450 (defun gnus-summary-wake-up-the-dead (&rest args)
7451 "Wake up the dead summary buffer."
7453 (gnus-dead-summary-mode -1)
7454 (let ((name (buffer-name)))
7455 (when (string-match "Dead " name)
7457 (concat (substring name 0 (match-beginning 0))
7458 (substring name (match-end 0)))
7460 (gnus-message 3 "This dead summary is now alive again"))
7462 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7463 (defun gnus-summary-describe-group (&optional force)
7464 "Describe the current newsgroup."
7466 (gnus-group-describe-group force gnus-newsgroup-name))
7468 (defun gnus-summary-describe-briefly ()
7469 "Describe summary mode commands briefly."
7471 (gnus-message 6 "%s" (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")))
7473 ;; Walking around group mode buffer from summary mode.
7475 (defun gnus-summary-next-group (&optional no-article target-group backward)
7476 "Exit current newsgroup and then select next unread newsgroup.
7477 If prefix argument NO-ARTICLE is non-nil, no article is selected
7478 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7479 previous group instead."
7481 ;; Stop pre-fetching.
7482 (gnus-async-halt-prefetch)
7483 (let ((current-group gnus-newsgroup-name)
7484 (current-buffer (current-buffer))
7486 ;; First we semi-exit this group to update Xrefs and all variables.
7487 ;; We can't do a real exit, because the window conf must remain
7488 ;; the same in case the user is prompted for info, and we don't
7489 ;; want the window conf to change before that...
7490 (gnus-summary-exit t)
7491 (while (not entered)
7492 ;; Then we find what group we are supposed to enter.
7493 (set-buffer gnus-group-buffer)
7494 (gnus-group-jump-to-group current-group)
7497 (if (eq gnus-keep-same-level 'best)
7498 (gnus-summary-best-group gnus-newsgroup-name)
7499 (gnus-summary-search-group backward gnus-keep-same-level))))
7500 (if (not target-group)
7501 ;; There are no further groups, so we return to the group
7504 (gnus-message 5 "Returning to the group buffer")
7506 (when (gnus-buffer-live-p current-buffer)
7507 (set-buffer current-buffer)
7508 (gnus-summary-exit))
7509 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7510 ;; We try to enter the target group.
7511 (gnus-group-jump-to-group target-group)
7512 (let ((unreads (gnus-group-group-unread)))
7513 (if (and (or (eq t unreads)
7514 (and unreads (not (zerop unreads))))
7515 (gnus-summary-read-group
7516 target-group nil no-article
7517 (and (buffer-name current-buffer) current-buffer)
7520 (setq current-group target-group
7521 target-group nil)))))))
7523 (defun gnus-summary-prev-group (&optional no-article)
7524 "Exit current newsgroup and then select previous unread newsgroup.
7525 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7527 (gnus-summary-next-group no-article nil t))
7529 ;; Walking around summary lines.
7531 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7532 "Go to the first subject satisfying any non-nil constraint.
7533 If UNREAD is non-nil, the article should be unread.
7534 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7535 If UNSEEN is non-nil, the article should be unseen as well as unread.
7536 Returns the article selected or nil if there are no matching articles."
7540 ((null gnus-newsgroup-data)
7541 (gnus-message 3 "No articles in the group")
7543 ;; Pick the first article.
7544 ((not (or unread undownloaded unseen))
7545 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7546 (gnus-data-number (car gnus-newsgroup-data)))
7547 ;; Find the first unread article.
7549 (let ((data gnus-newsgroup-data))
7551 (let ((num (gnus-data-number (car data))))
7552 (or (memq num gnus-newsgroup-unfetched)
7553 (not (or (and unread
7554 (memq num gnus-newsgroup-unreads))
7556 (memq num gnus-newsgroup-undownloaded))
7558 (memq num gnus-newsgroup-unseen)
7559 (memq num gnus-newsgroup-unreads)))))))
7560 (setq data (cdr data)))
7564 (goto-char (gnus-data-pos (car data)))
7565 (gnus-data-number (car data)))
7566 (gnus-message 3 "No more%s articles"
7567 (let* ((r (when unread " unread"))
7568 (d (when undownloaded " undownloaded"))
7569 (s (when unseen " unseen"))
7570 (l (delq nil (list r d s))))
7571 (cond ((= 3 (length l))
7572 (concat r "," d ", or" s))
7574 (concat (car l) ", or" (cadr l)))
7581 (gnus-summary-position-point))))))
7583 (defun gnus-summary-next-subject (n &optional unread dont-display)
7584 "Go to next N'th summary line.
7585 If N is negative, go to the previous N'th subject line.
7586 If UNREAD is non-nil, only unread articles are selected.
7587 The difference between N and the actual number of steps taken is
7590 (let ((backward (< n 0))
7594 (gnus-summary-find-prev unread)
7595 (gnus-summary-find-next unread)))
7596 (unless (zerop (setq n (1- n)))
7597 (gnus-summary-show-thread)))
7599 (gnus-message 7 "No more%s articles"
7600 (if unread " unread" "")))
7601 (unless dont-display
7602 (gnus-summary-recenter)
7603 (gnus-summary-position-point))
7606 (defun gnus-summary-next-unread-subject (n)
7607 "Go to next N'th unread summary line."
7609 (gnus-summary-next-subject n t))
7611 (defun gnus-summary-prev-subject (n &optional unread)
7612 "Go to previous N'th summary line.
7613 If optional argument UNREAD is non-nil, only unread article is selected."
7615 (gnus-summary-next-subject (- n) unread))
7617 (defun gnus-summary-prev-unread-subject (n)
7618 "Go to previous N'th unread summary line."
7620 (gnus-summary-next-subject (- n) t))
7622 (defun gnus-summary-goto-subjects (articles)
7623 "Insert the subject header for ARTICLES in the current buffer."
7625 (dolist (article articles)
7626 (gnus-summary-goto-subject article t)))
7627 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7628 (gnus-summary-position-point))
7630 (defun gnus-summary-goto-subject (article &optional force silent)
7631 "Go to the subject line of ARTICLE.
7632 If FORCE, also allow jumping to articles not currently shown."
7633 (interactive "nArticle number: ")
7634 (unless (numberp article)
7635 (error "Article %s is not a number" article))
7637 (data (gnus-data-find article)))
7638 ;; We read in the article if we have to.
7641 (gnus-summary-insert-subject
7643 (if (or (numberp force) (vectorp force)) force)
7645 (setq data (gnus-data-find article)))
7650 (gnus-message 3 "Can't find article %d" article))
7652 (let ((pt (gnus-data-pos data)))
7654 (gnus-summary-set-article-display-arrow pt))
7655 (gnus-summary-position-point)
7658 ;; Walking around summary lines with displaying articles.
7660 (defun gnus-summary-expand-window (&optional arg)
7661 "Make the summary buffer take up the entire Emacs frame.
7662 Given a prefix, will force an `article' buffer configuration."
7665 (gnus-configure-windows 'article 'force)
7666 (gnus-configure-windows 'summary 'force)))
7668 (defun gnus-summary-display-article (article &optional all-header)
7669 "Display ARTICLE in article buffer."
7670 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7671 (with-current-buffer gnus-article-buffer
7672 (eq major-mode 'gnus-article-mode)))
7673 (gnus-article-setup-buffer))
7674 (gnus-set-global-variables)
7675 (with-current-buffer gnus-article-buffer
7676 (setq gnus-article-charset gnus-newsgroup-charset)
7677 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7678 (mm-enable-multibyte))
7682 (if gnus-summary-display-article-function
7683 (funcall gnus-summary-display-article-function article all-header)
7684 (gnus-article-prepare article all-header))
7685 (gnus-run-hooks 'gnus-select-article-hook)
7686 (when (and gnus-current-article
7687 (not (zerop gnus-current-article)))
7688 (gnus-summary-goto-subject gnus-current-article))
7689 (gnus-summary-recenter)
7690 (when (and gnus-use-trees gnus-show-threads)
7691 (gnus-possibly-generate-tree article)
7692 (gnus-highlight-selected-tree article))
7693 ;; Successfully display article.
7694 (gnus-article-set-window-start
7695 (cdr (assq article gnus-newsgroup-bookmarks))))))
7697 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7698 "Select the current article.
7699 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7700 non-nil, the article will be re-fetched even if it already present in
7701 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7703 ;; Make sure we are in the summary buffer to work around bbdb bug.
7704 (unless (eq major-mode 'gnus-summary-mode)
7705 (set-buffer gnus-summary-buffer))
7706 (let ((article (or article (gnus-summary-article-number)))
7707 (all-headers (not (not all-headers))) ;Must be t or nil.
7708 gnus-summary-display-article-function)
7710 (gnus-summary-article-pseudo-p article)
7711 (error "This is a pseudo-article"))
7712 (with-current-buffer gnus-summary-buffer
7713 (if (or (and gnus-single-article-buffer
7714 (or (null gnus-current-article)
7715 (null gnus-article-current)
7716 (null (get-buffer gnus-article-buffer))
7717 (not (eq article (cdr gnus-article-current)))
7718 (not (equal (car gnus-article-current)
7719 gnus-newsgroup-name))
7720 (not (get-buffer gnus-original-article-buffer))))
7721 (and (not gnus-single-article-buffer)
7722 (or (null gnus-current-article)
7723 (not (get-buffer gnus-original-article-buffer))
7724 (not (eq gnus-current-article article))))
7726 ;; The requested article is different from the current article.
7728 (gnus-summary-display-article article all-headers)
7729 (when (gnus-buffer-live-p gnus-article-buffer)
7730 (with-current-buffer gnus-article-buffer
7731 (if (not gnus-article-decoded-p) ;; a local variable
7732 (mm-disable-multibyte))))
7733 (gnus-article-set-window-start
7734 (cdr (assq article gnus-newsgroup-bookmarks)))
7738 (defun gnus-summary-force-verify-and-decrypt ()
7739 "Display buttons for signed/encrypted parts and verify/decrypt them."
7741 (let ((mm-verify-option 'known)
7742 (mm-decrypt-option 'known)
7743 (gnus-article-emulate-mime t)
7744 (gnus-buttonized-mime-types (append (list "multipart/signed"
7745 "multipart/encrypted")
7746 gnus-buttonized-mime-types)))
7747 (gnus-summary-select-article nil 'force)))
7749 (defun gnus-summary-set-current-mark (&optional current-mark)
7750 "Obsolete function."
7753 (defun gnus-summary-next-article (&optional unread subject backward push)
7754 "Select the next article.
7755 If UNREAD, only unread articles are selected.
7756 If SUBJECT, only articles with SUBJECT are selected.
7757 If BACKWARD, the previous article is selected instead of the next."
7759 ;; Make sure we are in the summary buffer.
7760 (unless (eq major-mode 'gnus-summary-mode)
7761 (set-buffer gnus-summary-buffer))
7763 ;; Is there such an article?
7764 ((and (gnus-summary-search-forward unread subject backward)
7765 (or (gnus-summary-display-article (gnus-summary-article-number))
7766 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7767 (gnus-summary-position-point))
7768 ;; If not, we try the first unread, if that is wanted.
7770 gnus-auto-select-same
7771 (gnus-summary-first-unread-article))
7772 (gnus-summary-position-point)
7773 (gnus-message 6 "Wrapped"))
7774 ;; Try to get next/previous article not displayed in this group.
7775 ((and gnus-auto-extend-newsgroup
7776 (not unread) (not subject))
7777 (gnus-summary-goto-article
7778 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7779 nil (count-lines (point-min) (point))))
7780 ;; Go to next/previous group.
7782 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7783 (gnus-summary-jump-to-group gnus-newsgroup-name))
7784 (let ((cmd (if (featurep 'xemacs)
7786 last-command-event))
7788 (with-current-buffer gnus-group-buffer
7790 (current-summary (current-buffer))
7792 (if (eq gnus-keep-same-level 'best)
7793 (gnus-summary-best-group gnus-newsgroup-name)
7794 (gnus-summary-search-group backward gnus-keep-same-level))))
7795 ;; Select next unread newsgroup automagically.
7797 ((or (not gnus-auto-select-next)
7799 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7800 ((or (eq gnus-auto-select-next 'quietly)
7801 (and (eq gnus-auto-select-next 'slightly-quietly)
7803 (and (eq gnus-auto-select-next 'almost-quietly)
7804 (gnus-summary-last-article-p)))
7806 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7808 (gnus-message 7 "No more%s articles (%s)..."
7809 (if unread " unread" "")
7810 (if group (concat "selecting " group)
7812 (gnus-summary-next-group nil group backward)))
7814 (when (gnus-key-press-event-p last-input-event)
7815 ;; Somehow or other, we may now have selected a different
7816 ;; window. Make point go back to the summary buffer.
7817 (when (eq current-summary (current-buffer))
7818 ;; FIXME: This burps when get-buffer-window returns nil.
7819 (select-window (get-buffer-window current-summary 0)))
7820 (gnus-summary-walk-group-buffer
7821 gnus-newsgroup-name cmd unread backward point))))))))
7823 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7824 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7825 (?\C-p (gnus-group-prev-unread-group 1))))
7826 (cursor-in-echo-area t)
7827 keve key group ended prompt)
7828 (with-current-buffer gnus-group-buffer
7831 (if (eq gnus-keep-same-level 'best)
7832 (gnus-summary-best-group gnus-newsgroup-name)
7833 (gnus-summary-search-group backward gnus-keep-same-level))))
7837 "No more%s articles%s " (if unread " unread" "")
7839 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7840 (format " (Type %s for %s [%s])"
7841 (single-key-description cmd)
7842 (gnus-group-decoded-name group)
7843 (gnus-group-unread group))
7844 (format " (Type %s to exit %s)"
7845 (single-key-description cmd)
7846 (gnus-group-decoded-name gnus-newsgroup-name)))))
7847 ;; Confirm auto selection.
7848 (setq key (car (setq keve (gnus-read-event-char prompt)))
7851 ((assq key keystrokes)
7852 (let ((obuf (current-buffer)))
7853 (switch-to-buffer gnus-group-buffer)
7855 (gnus-group-jump-to-group group))
7856 (eval (cadr (assq key keystrokes)))
7857 (setq group (gnus-group-group-name))
7858 (switch-to-buffer obuf))
7862 (gnus-ephemeral-group-p gnus-newsgroup-name))
7864 (gnus-summary-next-group nil group backward)))
7866 (push (cdr keve) unread-command-events))))))
7868 (defun gnus-summary-next-unread-article ()
7869 "Select unread article after current one."
7871 (gnus-summary-next-article
7872 (or (not (eq gnus-summary-goto-unread 'never))
7873 (gnus-summary-last-article-p (gnus-summary-article-number)))
7874 (and gnus-auto-select-same
7875 (gnus-summary-article-subject))))
7877 (defun gnus-summary-prev-article (&optional unread subject)
7878 "Select the article before the current one.
7879 If UNREAD is non-nil, only unread articles are selected."
7881 (gnus-summary-next-article unread subject t))
7883 (defun gnus-summary-prev-unread-article ()
7884 "Select unread article before current one."
7886 (gnus-summary-prev-article
7887 (or (not (eq gnus-summary-goto-unread 'never))
7888 (gnus-summary-first-article-p (gnus-summary-article-number)))
7889 (and gnus-auto-select-same
7890 (gnus-summary-article-subject))))
7892 (defun gnus-summary-next-page (&optional lines circular stop)
7893 "Show next page of the selected article.
7894 If at the end of the current article, select the next article.
7895 LINES says how many lines should be scrolled up.
7897 If CIRCULAR is non-nil, go to the start of the article instead of
7898 selecting the next article when reaching the end of the current
7901 If STOP is non-nil, just stop when reaching the end of the message.
7903 Also see the variable `gnus-article-skip-boring'."
7905 (setq gnus-summary-buffer (current-buffer))
7906 (gnus-set-global-variables)
7907 (let ((article (gnus-summary-article-number))
7908 (article-window (get-buffer-window gnus-article-buffer t))
7910 ;; If the buffer is empty, we have no article.
7912 (error "No article to select"))
7913 (gnus-configure-windows 'article)
7914 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7915 (if (and (eq gnus-summary-goto-unread 'never)
7916 (not (gnus-summary-last-article-p article)))
7917 (gnus-summary-next-article)
7918 (gnus-summary-next-unread-article))
7919 (if (or (null gnus-current-article)
7920 (null gnus-article-current)
7921 (/= article (cdr gnus-article-current))
7922 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7923 ;; Selected subject is different from current article's.
7924 (gnus-summary-display-article article)
7925 (when article-window
7926 (gnus-eval-in-buffer-window gnus-article-buffer
7927 (setq endp (or (gnus-article-next-page lines)
7928 (gnus-article-only-boring-p))))
7930 (cond ((or stop gnus-summary-stop-at-end-of-message)
7931 (gnus-message 3 "End of message"))
7933 (gnus-summary-beginning-of-article))
7935 (gnus-message 3 "End of message"))
7937 (if (and (eq gnus-summary-goto-unread 'never)
7938 (not (gnus-summary-last-article-p article)))
7939 (gnus-summary-next-article)
7940 (gnus-summary-next-unread-article))))))))
7941 (gnus-summary-recenter)
7942 (gnus-summary-position-point)))
7944 (defun gnus-summary-prev-page (&optional lines move)
7945 "Show previous page of selected article.
7946 Argument LINES specifies lines to be scrolled down.
7947 If MOVE, move to the previous unread article if point is at
7948 the beginning of the buffer."
7950 (let ((article (gnus-summary-article-number))
7951 (article-window (get-buffer-window gnus-article-buffer t))
7953 (gnus-configure-windows 'article)
7954 (if (or (null gnus-current-article)
7955 (null gnus-article-current)
7956 (/= article (cdr gnus-article-current))
7957 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7958 ;; Selected subject is different from current article's.
7959 (gnus-summary-display-article article)
7960 (gnus-summary-recenter)
7961 (when article-window
7962 (gnus-eval-in-buffer-window gnus-article-buffer
7963 (setq endp (gnus-article-prev-page lines)))
7964 (when (and move endp)
7966 (gnus-message 3 "Beginning of message"))
7968 (if (and (eq gnus-summary-goto-unread 'never)
7969 (not (gnus-summary-first-article-p article)))
7970 (gnus-summary-prev-article)
7971 (gnus-summary-prev-unread-article))))))))
7972 (gnus-summary-position-point))
7974 (defun gnus-summary-prev-page-or-article (&optional lines)
7975 "Show previous page of selected article.
7976 Argument LINES specifies lines to be scrolled down.
7977 If at the beginning of the article, go to the next article."
7979 (gnus-summary-prev-page lines t))
7981 (defun gnus-summary-scroll-up (lines)
7982 "Scroll up (or down) one line current article.
7983 Argument LINES specifies lines to be scrolled up (or down if negative).
7984 If no article is selected, then the current article will be selected first."
7986 (gnus-configure-windows 'article)
7987 (gnus-summary-show-thread)
7988 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7989 (gnus-eval-in-buffer-window gnus-article-buffer
7991 (when (gnus-article-next-page lines)
7992 (gnus-message 3 "End of message")))
7994 (gnus-article-prev-page (- lines))))))
7995 (gnus-summary-recenter)
7996 (gnus-summary-position-point))
7998 (defun gnus-summary-scroll-down (lines)
7999 "Scroll down (or up) one line current article.
8000 Argument LINES specifies lines to be scrolled down (or up if negative).
8001 If no article is selected, then the current article will be selected first."
8003 (gnus-summary-scroll-up (- lines)))
8005 (defun gnus-summary-next-same-subject ()
8006 "Select next article which has the same subject as current one."
8008 (gnus-summary-next-article nil (gnus-summary-article-subject)))
8010 (defun gnus-summary-prev-same-subject ()
8011 "Select previous article which has the same subject as current one."
8013 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
8015 (defun gnus-summary-next-unread-same-subject ()
8016 "Select next unread article which has the same subject as current one."
8018 (gnus-summary-next-article t (gnus-summary-article-subject)))
8020 (defun gnus-summary-prev-unread-same-subject ()
8021 "Select previous unread article which has the same subject as current one."
8023 (gnus-summary-prev-article t (gnus-summary-article-subject)))
8025 (defun gnus-summary-first-unread-article ()
8026 "Select the first unread article.
8027 Return nil if there are no unread articles."
8030 (when (gnus-summary-first-subject t)
8031 (gnus-summary-show-thread)
8032 (gnus-summary-first-subject t)
8033 (gnus-summary-display-article (gnus-summary-article-number)))
8034 (gnus-summary-position-point)))
8036 (defun gnus-summary-first-unread-subject ()
8037 "Place the point on the subject line of the first unread article.
8038 Return nil if there are no unread articles."
8041 (when (gnus-summary-first-subject t)
8042 (gnus-summary-show-thread)
8043 (gnus-summary-first-subject t))
8044 (gnus-summary-position-point)))
8046 (defun gnus-summary-first-unseen-subject ()
8047 "Place the point on the subject line of the first unseen article.
8048 Return nil if there are no unseen articles."
8051 (when (gnus-summary-first-subject nil nil t)
8052 (gnus-summary-show-thread)
8053 (gnus-summary-first-subject nil nil t))
8054 (gnus-summary-position-point)))
8056 (defun gnus-summary-first-unseen-or-unread-subject ()
8057 "Place the point on the subject line of the first unseen and unread article.
8058 If all article have been seen, on the subject line of the first unread
8062 (unless (when (gnus-summary-first-subject nil nil t)
8063 (gnus-summary-show-thread)
8064 (gnus-summary-first-subject nil nil t))
8065 (when (gnus-summary-first-subject t)
8066 (gnus-summary-show-thread)
8067 (gnus-summary-first-subject t)))
8068 (gnus-summary-position-point)))
8070 (defun gnus-summary-first-article ()
8071 "Select the first article.
8072 Return nil if there are no articles."
8075 (when (gnus-summary-first-subject)
8076 (gnus-summary-show-thread)
8077 (gnus-summary-first-subject)
8078 (gnus-summary-display-article (gnus-summary-article-number)))
8079 (gnus-summary-position-point)))
8081 (defun gnus-summary-best-unread-article (&optional arg)
8082 "Select the unread article with the highest score.
8083 If given a prefix argument, select the next unread article that has a
8084 score higher than the default score."
8086 (let ((article (if arg
8087 (gnus-summary-better-unread-subject)
8088 (gnus-summary-best-unread-subject))))
8090 (gnus-summary-goto-article article)
8091 (error "No unread articles"))))
8093 (defun gnus-summary-best-unread-subject ()
8094 "Select the unread subject with the highest score."
8096 (let ((best -1000000)
8097 (data gnus-newsgroup-data)
8100 (and (gnus-data-unread-p (car data))
8102 (gnus-summary-article-score (gnus-data-number (car data))))
8105 article (gnus-data-number (car data))))
8106 (setq data (cdr data)))
8108 (gnus-summary-goto-subject article))
8109 (gnus-summary-position-point)
8112 (defun gnus-summary-better-unread-subject ()
8113 "Select the first unread subject that has a score over the default score."
8115 (let ((data gnus-newsgroup-data)
8117 (while (and (setq article (gnus-data-number (car data)))
8118 (or (gnus-data-read-p (car data))
8119 (not (> (gnus-summary-article-score article)
8120 gnus-summary-default-score))))
8121 (setq data (cdr data)))
8123 (gnus-summary-goto-subject article))
8124 (gnus-summary-position-point)
8127 (defun gnus-summary-last-subject ()
8128 "Go to the last displayed subject line in the group."
8129 (let ((article (gnus-data-number (car (gnus-data-list t)))))
8131 (gnus-summary-goto-subject article))))
8133 (defun gnus-summary-goto-article (article &optional all-headers force)
8134 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
8135 If ALL-HEADERS is non-nil, no header lines are hidden.
8136 If FORCE, go to the article even if it isn't displayed. If FORCE
8137 is a number, it is the line the article is to be displayed on."
8140 (gnus-completing-read
8141 "Article number or Message-ID"
8142 (mapcar 'int-to-string gnus-newsgroup-limit))
8146 (if (and (stringp article)
8147 (string-match "@\\|%40" article))
8148 (gnus-summary-refer-article article)
8149 (when (stringp article)
8150 (setq article (string-to-number article)))
8151 (if (gnus-summary-goto-subject article force)
8152 (gnus-summary-display-article article all-headers)
8153 (gnus-message 4 "Couldn't go to article %s" article) nil))
8154 (gnus-summary-position-point)))
8156 (defun gnus-summary-goto-last-article ()
8157 "Go to the previously read article."
8160 (when gnus-last-article
8161 (gnus-summary-goto-article gnus-last-article nil t))
8162 (gnus-summary-position-point)))
8164 (defun gnus-summary-pop-article (number)
8165 "Pop one article off the history and go to the previous.
8166 NUMBER articles will be popped off."
8169 (setq gnus-newsgroup-history
8170 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
8172 (gnus-summary-goto-article (car to) nil t)
8173 (error "Article history empty")))
8174 (gnus-summary-position-point))
8176 ;; Summary commands and functions for limiting the summary buffer.
8178 (defun gnus-summary-limit-to-articles (n)
8179 "Limit the summary buffer to the next N articles.
8180 If not given a prefix, use the process marked articles instead."
8183 (let ((articles (gnus-summary-work-articles n)))
8184 (setq gnus-newsgroup-processable nil)
8185 (gnus-summary-limit articles))
8186 (gnus-summary-position-point)))
8188 (defun gnus-summary-pop-limit (&optional total)
8189 "Restore the previous limit.
8190 If given a prefix, remove all limits."
8193 (setq gnus-newsgroup-limits
8194 (list (mapcar (lambda (h) (mail-header-number h))
8195 gnus-newsgroup-headers))))
8196 (unless gnus-newsgroup-limits
8197 (error "No limit to pop"))
8199 (gnus-summary-limit nil 'pop)
8200 (gnus-summary-position-point)))
8202 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
8203 "Limit the summary buffer to articles that have subjects that match a regexp.
8204 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8206 (list (read-string (if current-prefix-arg
8207 "Exclude subject (regexp): "
8208 "Limit to subject (regexp): "))
8209 nil current-prefix-arg))
8211 (setq header "subject"))
8212 (when (not (equal "" subject))
8214 (let ((articles (gnus-summary-find-matching
8215 (or header "subject") subject 'all nil nil
8218 (error "Found no matches for \"%s\"" subject))
8219 (gnus-summary-limit articles))
8220 (gnus-summary-position-point))))
8222 (defun gnus-summary-limit-to-author (from &optional not-matching)
8223 "Limit the summary buffer to articles that have authors that match a regexp.
8224 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8226 (list (read-string (if current-prefix-arg
8227 "Exclude author (regexp): "
8228 "Limit to author (regexp): "))
8229 current-prefix-arg))
8230 (gnus-summary-limit-to-subject from "from" not-matching))
8232 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
8233 "Limit the summary buffer to articles with the given RECIPIENT.
8235 If NOT-MATCHING, exclude RECIPIENT.
8237 To and Cc headers are checked. You need to include them in
8238 `nnmail-extra-headers'."
8239 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8241 (list (read-string (format "%s recipient (regexp): "
8242 (if current-prefix-arg "Exclude" "Limit to")))
8243 current-prefix-arg))
8244 (when (not (equal "" recipient))
8246 (if (memq 'To nnmail-extra-headers)
8247 (gnus-summary-find-matching
8248 (cons 'extra 'To) recipient 'all nil nil
8251 1 "`To' isn't present in `nnmail-extra-headers'")
8255 (if (memq 'Cc nnmail-extra-headers)
8256 (gnus-summary-find-matching
8257 (cons 'extra 'Cc) recipient 'all nil nil
8260 1 "`Cc' isn't present in `nnmail-extra-headers'")
8265 ;; We need the numbers that are in both lists:
8267 (and (memq a to) a))
8271 (error "Found no matches for \"%s\"" recipient))
8272 (gnus-summary-limit articles))
8273 (gnus-summary-position-point))))
8275 (defun gnus-summary-limit-to-address (address &optional not-matching)
8276 "Limit the summary buffer to articles with the given ADDRESS.
8278 If NOT-MATCHING, exclude ADDRESS.
8280 To, Cc and From headers are checked. You need to include `To' and `Cc'
8281 in `nnmail-extra-headers'."
8283 (list (read-string (format "%s address (regexp): "
8284 (if current-prefix-arg "Exclude" "Limit to")))
8285 current-prefix-arg))
8286 (when (not (equal "" address))
8288 (if (memq 'To nnmail-extra-headers)
8289 (gnus-summary-find-matching
8290 (cons 'extra 'To) address 'all nil nil
8293 1 "`To' isn't present in `nnmail-extra-headers'")
8297 (if (memq 'Cc nnmail-extra-headers)
8298 (gnus-summary-find-matching
8299 (cons 'extra 'Cc) address 'all nil nil
8302 1 "`Cc' isn't present in `nnmail-extra-headers'")
8306 (gnus-summary-find-matching "from" address
8307 'all nil nil not-matching))
8310 ;; We need the numbers that are in all lists:
8314 (mapcar (lambda (a) (car (memq a from))) to))
8316 (mapcar (lambda (a) (car (memq a from))) cc)
8317 (mapcar (lambda (a) (car (memq a from)))
8318 (mapcar (lambda (a) (car (memq a to)))
8320 (nconc (if (eq to t) nil to)
8321 (if (eq cc t) nil cc)
8324 (error "Found no matches for \"%s\"" address))
8325 (gnus-summary-limit articles))
8326 (gnus-summary-position-point))))
8328 (defun gnus-summary-limit-strange-charsets-predicate (header)
8329 (when (fboundp 'char-charset)
8330 (let ((string (concat (mail-header-subject header)
8331 (mail-header-from header)))
8333 (dotimes (i (1- (length string)))
8334 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8335 (when (string-match "unicode\\|big\\|japanese" charset)
8339 (defun gnus-summary-limit-to-predicate (predicate)
8340 "Limit to articles where PREDICATE returns non-nil.
8341 PREDICATE will be called with the header structures of the
8343 (let ((articles nil)
8344 (case-fold-search t))
8345 (dolist (header gnus-newsgroup-headers)
8346 (when (funcall predicate header)
8347 (push (mail-header-number header) articles)))
8348 (gnus-summary-limit (nreverse articles))))
8350 (defun gnus-summary-limit-to-age (age &optional younger-p)
8351 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8352 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8353 articles that are younger than AGE days."
8355 (let ((younger current-prefix-arg)
8358 (while (not days-got)
8359 (setq days (if younger
8360 (read-string "Limit to articles younger than (in days, older when negative): ")
8362 "Limit to articles older than (in days, younger when negative): ")))
8363 (when (> (length days) 0)
8364 (setq days (read days)))
8369 (setq younger (not younger))
8370 (setq days (* days -1))))
8371 (message "Please enter a number.")
8373 (list days younger)))
8375 (let ((data gnus-newsgroup-data)
8376 (cutoff (days-to-time age))
8377 articles d date is-younger)
8378 (while (setq d (pop data))
8379 (when (and (vectorp (gnus-data-header d))
8380 (setq date (mail-header-date (gnus-data-header d))))
8381 (setq is-younger (time-less-p
8382 (time-since (gnus-date-get-time date))
8387 (push (gnus-data-number d) articles))))
8388 (gnus-summary-limit (nreverse articles)))
8389 (gnus-summary-position-point)))
8391 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8392 "Limit the summary buffer to articles that match an 'extra' header."
8396 (gnus-completing-read
8397 (if current-prefix-arg
8398 "Exclude extra header"
8399 "Limit extra header")
8400 (mapcar 'symbol-name gnus-extra-headers)
8402 (symbol-name (car gnus-extra-headers))))))
8404 (read-string (format "%s header %s (regexp): "
8405 (if current-prefix-arg "Exclude" "Limit to")
8407 current-prefix-arg)))
8408 (when (not (equal "" regexp))
8410 (let ((articles (gnus-summary-find-matching
8411 (cons 'extra header) regexp 'all nil nil
8414 (error "Found no matches for \"%s\"" regexp))
8415 (gnus-summary-limit articles))
8416 (gnus-summary-position-point))))
8418 (defun gnus-summary-limit-to-display-predicate ()
8419 "Limit the summary buffer to the predicated in the `display' group parameter."
8421 (unless gnus-newsgroup-display
8422 (error "There is no `display' group parameter"))
8424 (dolist (gnus-number gnus-newsgroup-articles)
8425 (when (funcall gnus-newsgroup-display)
8426 (push gnus-number articles)))
8427 (gnus-summary-limit articles))
8428 (gnus-summary-position-point))
8430 (defun gnus-summary-limit-to-unread (&optional all)
8431 "Limit the summary buffer to articles that are not marked as read.
8432 If ALL is non-nil, limit strictly to unread articles."
8435 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8436 (gnus-summary-limit-to-marks
8437 ;; Concat all the marks that say that an article is read and have
8439 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8440 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8441 gnus-low-score-mark gnus-expirable-mark
8442 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8443 gnus-duplicate-mark)
8446 (defun gnus-summary-limit-to-headers (match &optional reverse)
8447 "Limit the summary buffer to articles that have headers that match MATCH.
8448 If REVERSE (the prefix), limit to articles that don't match."
8449 (interactive "sMatch headers (regexp): \nP")
8450 (gnus-summary-limit-to-bodies match reverse t))
8452 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8453 "Limit the summary buffer to articles that have bodies that match MATCH.
8454 If REVERSE (the prefix), limit to articles that don't match."
8455 (interactive "sMatch body (regexp): \nP")
8456 (let ((articles nil)
8457 (gnus-select-article-hook nil) ;Disable hook.
8458 (gnus-article-prepare-hook nil)
8459 (gnus-use-article-prefetch nil)
8460 (gnus-keep-backlog nil)
8461 (gnus-break-pages nil)
8462 (gnus-summary-display-arrow nil)
8463 (gnus-updated-mode-lines nil)
8464 (gnus-auto-center-summary nil)
8465 (gnus-display-mime-function nil))
8466 (dolist (data gnus-newsgroup-data)
8467 (let (gnus-mark-article-hook)
8468 (gnus-summary-select-article t t nil (gnus-data-number data)))
8469 (with-current-buffer gnus-article-buffer
8471 (let* ((case-fold-search t)
8473 (re-search-backward match nil t)
8474 (re-search-forward match nil t))))
8475 (when (or (and found
8479 (push (gnus-data-number data) articles)))))
8481 (message "No messages matched")
8482 (gnus-summary-limit articles)))
8483 (gnus-summary-position-point))
8485 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8486 "Limit the summary buffer to articles that aren't part on any thread.
8487 If THREADSP (the prefix), limit to articles that are in threads."
8489 (let ((articles nil)
8492 (dolist (thread gnus-newsgroup-threads)
8493 (if (stringp (car thread))
8494 (dolist (thread (cdr thread))
8495 (push thread threads))
8496 (push thread threads)))
8497 (dolist (thread threads)
8498 (setq thread-articles (gnus-articles-in-thread thread))
8499 (when (or (and threadsp
8500 (> (length thread-articles) 1))
8502 (= (length thread-articles) 1)))
8503 (setq articles (nconc thread-articles articles))))
8505 (message "No messages matched")
8506 (gnus-summary-limit articles))
8507 (gnus-summary-position-point)))
8509 (defun gnus-summary-limit-to-replied (&optional unreplied)
8510 "Limit the summary buffer to replied articles.
8511 If UNREPLIED (the prefix), limit to unreplied articles."
8515 (gnus-set-difference gnus-newsgroup-articles
8516 gnus-newsgroup-replied))
8517 (gnus-summary-limit gnus-newsgroup-replied))
8518 (gnus-summary-position-point))
8520 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8521 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8522 If REVERSE, limit the summary buffer to articles that are marked
8523 with MARKS. MARKS can either be a string of marks or a list of marks.
8524 Returns how many articles were removed."
8525 (interactive "sMarks: ")
8526 (gnus-summary-limit-to-marks marks t))
8528 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8529 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8530 If REVERSE (the prefix), limit the summary buffer to articles that are
8531 not marked with MARKS. MARKS can either be a string of marks or a
8533 Returns how many articles were removed."
8534 (interactive "sMarks: \nP")
8536 (let ((data gnus-newsgroup-data)
8537 (marks (if (listp marks) marks
8538 (append marks nil))) ; Transform to list.
8541 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8542 (memq (gnus-data-mark (car data)) marks))
8543 (push (gnus-data-number (car data)) articles))
8544 (setq data (cdr data)))
8545 (gnus-summary-limit articles))
8546 (gnus-summary-position-point)))
8548 (defun gnus-summary-limit-to-score (score)
8549 "Limit to articles with score at or above SCORE."
8550 (interactive "NLimit to articles with score of at least: ")
8551 (let ((data gnus-newsgroup-data)
8554 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8556 (push (gnus-data-number (car data)) articles))
8557 (setq data (cdr data)))
8559 (gnus-summary-limit articles)
8560 (gnus-summary-position-point))))
8562 (defun gnus-summary-limit-to-unseen ()
8563 "Limit to unseen articles."
8566 (gnus-summary-limit gnus-newsgroup-unseen)
8567 (gnus-summary-position-point)))
8569 (defun gnus-summary-limit-include-thread (id)
8570 "Display all the hidden articles that is in the thread with ID in it.
8571 When called interactively, ID is the Message-ID of the current
8573 (interactive (list (mail-header-id (gnus-summary-article-header))))
8574 (let ((articles (gnus-articles-in-thread
8575 (gnus-id-to-thread (gnus-root-id id))))
8576 ;;we REALLY want the whole thread---this prevents cut-threads
8577 ;;from removing the thread we want to include.
8578 (gnus-fetch-old-headers nil)
8579 (gnus-build-sparse-threads nil))
8581 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8582 (gnus-summary-limit-include-matching-articles
8584 (regexp-quote (gnus-simplify-subject-re
8585 (mail-header-subject (gnus-id-to-header id)))))
8586 (gnus-summary-position-point))))
8588 (defun gnus-summary-limit-include-matching-articles (header regexp)
8589 "Display all the hidden articles that have HEADERs that match REGEXP."
8590 (interactive (list (read-string "Match on header: ")
8591 (read-string "Regexp: ")))
8592 (let ((articles (gnus-find-matching-articles header regexp)))
8594 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8595 (gnus-summary-position-point))))
8597 (defun gnus-summary-insert-dormant-articles ()
8598 "Insert all the dormant articles for this group into the current buffer."
8600 (let ((gnus-verbose (max 6 gnus-verbose)))
8601 (if (not gnus-newsgroup-dormant)
8602 (gnus-message 3 "No dormant articles for this group")
8603 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8605 (defun gnus-summary-insert-ticked-articles ()
8606 "Insert ticked articles for this group into the current buffer."
8608 (let ((gnus-verbose (max 6 gnus-verbose)))
8609 (if (not gnus-newsgroup-marked)
8610 (gnus-message 3 "No ticked articles for this group")
8611 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8613 (defun gnus-summary-limit-include-dormant ()
8614 "Display all the hidden articles that are marked as dormant.
8615 Note that this command only works on a subset of the articles currently
8616 fetched for this group."
8618 (unless gnus-newsgroup-dormant
8619 (error "There are no dormant articles in this group"))
8621 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8622 (gnus-summary-position-point)))
8624 (defun gnus-summary-include-articles (articles)
8625 "Fetch the headers for ARTICLES and then display the summary lines."
8626 (let ((gnus-inhibit-demon t)
8628 (gnus-read-all-available-headers t))
8629 (setq gnus-newsgroup-headers
8631 'list gnus-newsgroup-headers
8632 (gnus-fetch-headers articles nil t)
8633 'gnus-article-sort-by-number))
8634 (setq gnus-newsgroup-articles
8635 (gnus-sorted-nunion gnus-newsgroup-articles articles))
8636 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8638 (defun gnus-summary-limit-exclude-dormant ()
8639 "Hide all dormant articles."
8642 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8643 (gnus-summary-position-point)))
8645 (defun gnus-summary-limit-exclude-childless-dormant ()
8646 "Hide all dormant articles that have no children."
8648 (let ((data (gnus-data-list t))
8649 articles d children)
8650 ;; Find all articles that are either not dormant or have
8652 (while (setq d (pop data))
8653 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8655 (gnus-article-children (gnus-data-number d)))
8658 (when (memq (car children) articles)
8663 (push (gnus-data-number d) articles)))
8666 (gnus-summary-limit articles)
8667 (gnus-summary-position-point))))
8669 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8670 "Mark all unread excluded articles as read.
8671 If ALL, mark even excluded ticked and dormants as read."
8673 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8674 (let ((articles (gnus-sorted-ndifference
8676 (mapcar (lambda (h) (mail-header-number h))
8677 gnus-newsgroup-headers)
8679 gnus-newsgroup-limit))
8681 (setq gnus-newsgroup-unreads
8682 (gnus-sorted-intersection gnus-newsgroup-unreads
8683 gnus-newsgroup-limit))
8685 (setq gnus-newsgroup-dormant nil
8686 gnus-newsgroup-marked nil
8687 gnus-newsgroup-reads
8689 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8690 gnus-newsgroup-reads))
8691 (while (setq article (pop articles))
8692 (unless (or (memq article gnus-newsgroup-dormant)
8693 (memq article gnus-newsgroup-marked))
8694 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8696 (defun gnus-summary-limit (articles &optional pop)
8698 ;; We pop the previous limit off the stack and use that.
8699 (setq articles (car gnus-newsgroup-limits)
8700 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8701 ;; We use the new limit, so we push the old limit on the stack.
8702 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8704 (setq gnus-newsgroup-limit articles)
8705 (let ((total (length gnus-newsgroup-data))
8706 (data (gnus-data-find-list (gnus-summary-article-number)))
8707 (gnus-summary-mark-below nil) ; Inhibit this.
8709 ;; This will do all the work of generating the new summary buffer
8710 ;; according to the new limit.
8711 (gnus-summary-prepare)
8712 ;; Hide any threads, possibly.
8713 (gnus-summary-maybe-hide-threads)
8714 ;; Try to return to the article you were at, or one in the
8717 ;; We try to find some article after the current one.
8719 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8722 (setq data (cdr data))))
8724 ;; If there is no data, that means that we were after the last
8725 ;; article. The same goes when we can't find any articles
8726 ;; after the current one.
8727 (goto-char (point-max))
8728 (gnus-summary-find-prev))
8729 (gnus-set-mode-line 'summary)
8730 ;; We return how many articles were removed from the summary
8731 ;; buffer as a result of the new limit.
8732 (- total (length gnus-newsgroup-data))))
8734 (defsubst gnus-invisible-cut-children (threads)
8737 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8742 (defsubst gnus-cut-thread (thread)
8743 "Go forwards in the thread until we find an article that we want to display."
8744 (when (or (eq gnus-fetch-old-headers 'some)
8745 (eq gnus-fetch-old-headers 'invisible)
8746 (numberp gnus-fetch-old-headers)
8747 (eq gnus-build-sparse-threads 'some)
8748 (eq gnus-build-sparse-threads 'more))
8749 ;; Deal with old-fetched headers and sparse threads.
8753 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8754 (gnus-summary-article-ancient-p
8755 (mail-header-number (car thread))))
8756 (if (or (<= (length (cdr thread)) 1)
8757 (eq gnus-fetch-old-headers 'invisible))
8758 (setq gnus-newsgroup-limit
8759 (delq (mail-header-number (car thread))
8760 gnus-newsgroup-limit)
8761 thread (cadr thread))
8762 (when (gnus-invisible-cut-children (cdr thread))
8763 (let ((th (cdr thread)))
8765 (if (memq (mail-header-number (caar th))
8766 gnus-newsgroup-limit)
8767 (setq thread (car th)
8769 (setq th (cdr th))))))))))
8772 (defun gnus-cut-threads (threads)
8773 "Cut off all uninteresting articles from the beginning of THREADS."
8774 (when (or (eq gnus-fetch-old-headers 'some)
8775 (eq gnus-fetch-old-headers 'invisible)
8776 (numberp gnus-fetch-old-headers)
8777 (eq gnus-build-sparse-threads 'some)
8778 (eq gnus-build-sparse-threads 'more))
8781 (setcar th (gnus-cut-thread (car th)))
8782 (setq th (cdr th)))))
8783 ;; Remove nixed out threads.
8786 (defun gnus-summary-initial-limit (&optional show-if-empty)
8787 "Figure out what the initial limit is supposed to be on group entry.
8788 This entails weeding out unwanted dormants, low-scored articles,
8789 fetch-old-headers verbiage, and so on."
8790 ;; Most groups have nothing to remove.
8791 (unless (or gnus-inhibit-limiting
8792 (and (null gnus-newsgroup-dormant)
8793 (eq gnus-newsgroup-display 'gnus-not-ignore)
8794 (not (eq gnus-fetch-old-headers 'some))
8795 (not (numberp gnus-fetch-old-headers))
8796 (not (eq gnus-fetch-old-headers 'invisible))
8797 (null gnus-summary-expunge-below)
8798 (not (eq gnus-build-sparse-threads 'some))
8799 (not (eq gnus-build-sparse-threads 'more))
8800 (null gnus-thread-expunge-below)))
8801 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8802 (setq gnus-newsgroup-limit nil)
8805 (unless (car (symbol-value node))
8806 ;; These threads have no parents -- they are roots.
8807 (let ((nodes (cdr (symbol-value node)))
8810 (if (and gnus-thread-expunge-below
8811 (< (gnus-thread-total-score (car nodes))
8812 gnus-thread-expunge-below))
8813 (gnus-expunge-thread (pop nodes))
8814 (setq thread (pop nodes))
8815 (gnus-summary-limit-children thread))))))
8816 gnus-newsgroup-dependencies)
8817 ;; If this limitation resulted in an empty group, we might
8818 ;; pop the previous limit and use it instead.
8819 (when (and (not gnus-newsgroup-limit)
8821 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8822 gnus-newsgroup-limit))
8824 (defun gnus-summary-limit-children (thread)
8825 "Return 1 if this subthread is visible and 0 if it is not."
8826 ;; First we get the number of visible children to this thread. This
8827 ;; is done by recursing down the thread using this function, so this
8828 ;; will really go down to a leaf article first, before slowly
8829 ;; working its way up towards the root.
8831 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8834 (apply '+ (mapcar 'gnus-summary-limit-children
8837 (number (mail-header-number (car thread)))
8840 (not (memq number gnus-newsgroup-marked))
8842 ;; If this article is dormant and has absolutely no visible
8843 ;; children, then this article isn't visible.
8844 (and (memq number gnus-newsgroup-dormant)
8846 ;; If this is "fetch-old-headered" and there is no
8847 ;; visible children, then we don't want this article.
8848 (and (or (eq gnus-fetch-old-headers 'some)
8849 (numberp gnus-fetch-old-headers))
8850 (gnus-summary-article-ancient-p number)
8852 ;; If this is "fetch-old-headered" and `invisible', then
8853 ;; we don't want this article.
8854 (and (eq gnus-fetch-old-headers 'invisible)
8855 (gnus-summary-article-ancient-p number))
8856 ;; If this is a sparsely inserted article with no children,
8857 ;; we don't want it.
8858 (and (eq gnus-build-sparse-threads 'some)
8859 (gnus-summary-article-sparse-p number)
8861 ;; If we use expunging, and this article is really
8862 ;; low-scored, then we don't want this article.
8863 (when (and gnus-summary-expunge-below
8865 (or (cdr (assq number gnus-newsgroup-scored))
8866 gnus-summary-default-score))
8867 gnus-summary-expunge-below))
8868 ;; We increase the expunge-tally here, but that has
8869 ;; nothing to do with the limits, really.
8870 (incf gnus-newsgroup-expunged-tally)
8871 ;; We also mark as read here, if that's wanted.
8872 (when (and gnus-summary-mark-below
8873 (< score gnus-summary-mark-below))
8874 (setq gnus-newsgroup-unreads
8875 (delq number gnus-newsgroup-unreads))
8876 (if gnus-newsgroup-auto-expire
8877 (push number gnus-newsgroup-expirable)
8878 (push (cons number gnus-low-score-mark)
8879 gnus-newsgroup-reads)))
8881 ;; Do the `display' group parameter.
8882 (and gnus-newsgroup-display
8883 (let ((gnus-number number))
8884 (not (funcall gnus-newsgroup-display))))))
8885 ;; Nope, invisible article.
8887 ;; Ok, this article is to be visible, so we add it to the limit
8889 (push number gnus-newsgroup-limit)
8892 (defun gnus-expunge-thread (thread)
8893 "Mark all articles in THREAD as read."
8894 (let* ((number (mail-header-number (car thread))))
8895 (incf gnus-newsgroup-expunged-tally)
8896 ;; We also mark as read here, if that's wanted.
8897 (setq gnus-newsgroup-unreads
8898 (delq number gnus-newsgroup-unreads))
8899 (if gnus-newsgroup-auto-expire
8900 (push number gnus-newsgroup-expirable)
8901 (push (cons number gnus-low-score-mark)
8902 gnus-newsgroup-reads)))
8903 ;; Go recursively through all subthreads.
8904 (mapcar 'gnus-expunge-thread (cdr thread)))
8906 ;; Summary article oriented commands
8908 (defun gnus-summary-refer-parent-article (n)
8909 "Refer parent article N times.
8910 If N is negative, go to ancestor -N instead.
8911 The difference between N and the number of articles fetched is returned."
8915 (when (not (natnump n))
8920 (setq header (gnus-summary-article-header))
8921 (if (and (eq (mail-header-number header)
8922 (cdr gnus-article-current))
8923 (equal gnus-newsgroup-name
8924 (car gnus-article-current)))
8925 ;; If we try to find the parent of the currently
8926 ;; displayed article, then we take a look at the actual
8927 ;; References header, since this is slightly more
8928 ;; reliable than the References field we got from the
8930 (with-current-buffer gnus-original-article-buffer
8931 (nnheader-narrow-to-headers)
8932 (unless (setq ref (message-fetch-field "references"))
8933 (when (setq ref (message-fetch-field "in-reply-to"))
8934 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8937 ;; It's not the current article, so we take a bet on
8938 ;; the value we got from the server.
8939 (mail-header-references header)))
8941 (not (equal ref "")))
8942 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8943 (gnus-message 1 "Couldn't find parent"))
8944 (gnus-message 1 "No references in article %d"
8945 (gnus-summary-article-number))
8948 (gnus-summary-position-point)
8951 (defun gnus-summary-refer-references ()
8952 "Fetch all articles mentioned in the References header.
8953 Return the number of articles fetched."
8955 (let ((ref (mail-header-references (gnus-summary-article-header)))
8956 (current (gnus-summary-article-number))
8960 (error "No References in the current article")
8961 ;; For each Message-ID in the References header...
8962 (while (string-match "<[^>]*>" ref)
8964 ;; ... fetch that article.
8965 (gnus-summary-refer-article
8966 (prog1 (match-string 0 ref)
8967 (setq ref (substring ref (match-end 0))))))
8968 (gnus-summary-goto-subject current)
8969 (gnus-summary-position-point)
8972 (defun gnus-delete-duplicate-headers (headers)
8973 ;; First remove leading duplicates.
8974 (while (and (> (length headers) 1)
8975 (= (mail-header-number (car headers))
8976 (mail-header-number (cadr headers))))
8979 (let ((result headers))
8980 (while (> (length headers) 1)
8981 (if (= (mail-header-number (car headers))
8982 (mail-header-number (cadr headers)))
8983 (setcdr headers (cddr headers))
8987 (defun gnus-summary-refer-thread (&optional limit)
8988 "Fetch all articles in the current thread. For backends that
8989 know how to search for threads (currently only 'nnimap) a
8990 non-numeric prefix arg will use nnir to search the entire
8991 server; without a prefix arg only the current group is
8992 searched. If the variable `gnus-refer-thread-use-nnir' is
8993 non-nil the prefix arg has the reverse meaning. If no
8994 backend-specific 'request-thread function is available fetch
8995 LIMIT (the numerical prefix) old headers. If LIMIT is
8996 non-numeric or nil fetch the number specified by the
8997 `gnus-refer-thread-limit' variable."
8999 (gnus-warp-to-article)
9000 (let* ((header (gnus-summary-article-header))
9001 (id (mail-header-id header))
9002 (gnus-inhibit-demon t)
9003 (gnus-summary-ignore-duplicates t)
9004 (gnus-read-all-available-headers t)
9005 (gnus-refer-thread-use-nnir
9006 (if (and (not (null limit)) (listp limit))
9007 (not gnus-refer-thread-use-nnir) gnus-refer-thread-use-nnir))
9009 (if (gnus-check-backend-function
9010 'request-thread gnus-newsgroup-name)
9011 (gnus-request-thread header gnus-newsgroup-name)
9012 (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
9013 gnus-refer-thread-limit))
9014 (last (if (numberp limit)
9015 (min (+ (mail-header-number header)
9017 gnus-newsgroup-highest)
9018 gnus-newsgroup-highest))
9019 (subject (gnus-simplify-subject
9020 (mail-header-subject header)))
9021 (refs (split-string (or (mail-header-references header)
9023 (gnus-parse-headers-hook
9024 `(lambda () (goto-char (point-min))
9026 (regexp-opt ',(append refs (list id subject)))))))
9027 (gnus-fetch-headers (list last) (if (numberp limit)
9028 (* 2 limit) limit) t))))
9030 (when (listp new-headers)
9031 (dolist (header new-headers)
9032 (push (mail-header-number header) article-ids)
9033 (when (member (mail-header-number header) gnus-newsgroup-unselected)
9034 (push (mail-header-number header) gnus-newsgroup-unreads)
9035 (setq gnus-newsgroup-unselected
9036 (delete (mail-header-number header)
9037 gnus-newsgroup-unselected))))
9038 (setq gnus-newsgroup-headers
9039 (gnus-delete-duplicate-headers
9041 'list gnus-newsgroup-headers new-headers
9042 'gnus-article-sort-by-number)))
9043 (setq gnus-newsgroup-articles
9044 (gnus-sorted-nunion gnus-newsgroup-articles (nreverse article-ids)))
9045 (gnus-summary-limit-include-thread id))))
9047 (defun gnus-summary-refer-article (message-id)
9048 "Fetch an article specified by MESSAGE-ID."
9049 (interactive "sMessage-ID: ")
9050 (gnus-warp-to-article)
9051 (when (and (stringp message-id)
9052 (not (zerop (length message-id))))
9053 (setq message-id (gnus-replace-in-string message-id " " ""))
9054 ;; Construct the correct Message-ID if necessary.
9055 ;; Suggested by tale@pawl.rpi.edu.
9056 (unless (string-match "^<" message-id)
9057 (setq message-id (concat "<" message-id)))
9058 (unless (string-match ">$" message-id)
9059 (setq message-id (concat message-id ">")))
9060 ;; People often post MIDs from URLs, so unhex it:
9061 (unless (string-match "@" message-id)
9062 (setq message-id (gnus-url-unhex-string message-id)))
9063 (let* ((header (gnus-id-to-header message-id))
9065 (gnus-summary-article-sparse-p
9066 (mail-header-number header))
9067 (memq (mail-header-number header)
9068 gnus-newsgroup-limit)))
9071 ;; If the article is present in the buffer we just go to it.
9073 (or (not (gnus-summary-article-sparse-p
9074 (mail-header-number header)))
9077 (gnus-summary-goto-article
9078 (mail-header-number header) nil t)
9080 (gnus-summary-update-article (mail-header-number header)))))
9082 ;; We fetch the article.
9084 (dolist (gnus-override-method (gnus-refer-article-methods))
9085 (when (and (gnus-check-server gnus-override-method)
9086 ;; Fetch the header,
9087 (setq number (gnus-summary-insert-subject message-id)))
9088 ;; and display the article.
9089 (gnus-summary-select-article nil nil nil number)
9091 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
9093 (defun gnus-refer-article-methods ()
9094 "Return a list of referable methods."
9096 ;; No method, so we default to current and native.
9097 ((null gnus-refer-article-method)
9098 (list gnus-current-select-method gnus-select-method))
9100 ((eq 'current gnus-refer-article-method)
9101 (list gnus-current-select-method))
9102 ;; List of select methods.
9103 ((not (and (symbolp (car gnus-refer-article-method))
9104 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
9106 (dolist (method gnus-refer-article-method)
9107 (push (if (eq 'current method)
9108 gnus-current-select-method
9109 (if (eq 'nnir (car method))
9113 (gnus-method-to-server gnus-current-select-method)))
9117 ;; One single select method.
9119 (list gnus-refer-article-method))))
9121 (defun gnus-summary-edit-parameters ()
9122 "Edit the group parameters of the current group."
9124 (gnus-group-edit-group gnus-newsgroup-name 'params))
9126 (defun gnus-summary-customize-parameters ()
9127 "Customize the group parameters of the current group."
9129 (gnus-group-customize gnus-newsgroup-name))
9131 (defun gnus-summary-enter-digest-group (&optional force)
9132 "Enter an nndoc group based on the current article.
9133 If FORCE, force a digest interpretation. If not, try to guess
9134 what the document format is.
9136 To control what happens when you exit the group, see the
9137 `gnus-auto-select-on-ephemeral-exit' variable."
9139 (let ((conf gnus-current-window-configuration))
9140 (save-window-excursion
9142 (let (gnus-article-prepare-hook
9143 gnus-display-mime-function
9145 (gnus-summary-select-article))))
9146 (setq gnus-current-window-configuration conf)
9147 (let* ((name (format "%s-%d"
9148 (gnus-group-prefixed-name
9149 gnus-newsgroup-name (list 'nndoc ""))
9150 (with-current-buffer gnus-summary-buffer
9151 gnus-current-article)))
9152 (ogroup gnus-newsgroup-name)
9153 (params (append (gnus-info-params (gnus-get-info ogroup))
9154 (list (cons 'to-group ogroup))
9155 (list (cons 'parent-group ogroup))
9156 (list (cons 'save-article-group ogroup))))
9157 (case-fold-search t)
9158 (buf (current-buffer))
9160 (with-current-buffer gnus-original-article-buffer
9161 ;; Have the digest group inherit the main mail address of
9162 ;; the parent article.
9163 (when (setq to-address (or (gnus-fetch-field "reply-to")
9164 (gnus-fetch-field "from")))
9167 (list (cons 'to-address
9168 (funcall gnus-decode-encoded-address-function
9170 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
9171 (insert-buffer-substring gnus-original-article-buffer)
9172 ;; Remove lines that may lead nndoc to misinterpret the
9175 (goto-char (point-min))
9176 (or (search-forward "\n\n" nil t) (point)))
9177 (goto-char (point-min))
9178 (delete-matching-lines "^Path:\\|^From ")
9181 (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
9182 (gnus-newsgroup-ephemeral-ignored-charsets
9183 gnus-newsgroup-ignored-charsets))
9184 (gnus-group-read-ephemeral-group
9185 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
9187 ,(if force 'mbox 'guess)))
9189 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
9191 ;; Make all postings to this group go to the parent group.
9192 (nconc (gnus-info-params (gnus-get-info name))
9194 ;; Couldn't select this doc group.
9195 (switch-to-buffer buf)
9196 (gnus-set-global-variables)
9197 (gnus-configure-windows 'summary)
9198 (gnus-message 3 "Article couldn't be entered?"))
9199 (kill-buffer dig)))))
9201 (defun gnus-summary-read-document (n)
9202 "Open a new group based on the current article(s).
9203 This will allow you to read digests and other similar
9204 documents as newsgroups.
9205 Obeys the standard process/prefix convention."
9207 (let* ((ogroup gnus-newsgroup-name)
9208 (params (append (gnus-info-params (gnus-get-info ogroup))
9209 (list (cons 'to-group ogroup))))
9210 group egroup groups vgroup)
9211 (dolist (article (gnus-summary-work-articles n))
9212 (setq group (format "%s-%d" gnus-newsgroup-name article))
9213 (gnus-summary-remove-process-mark article)
9214 (when (gnus-summary-display-article article)
9215 (save-excursion ;;What for?
9217 (insert-buffer-substring gnus-original-article-buffer)
9218 ;; Remove some headers that may lead nndoc to make
9220 (message-narrow-to-head)
9221 (goto-char (point-min))
9222 (delete-matching-lines "^Path:\\|^From ")
9225 (gnus-group-read-ephemeral-group
9226 group `(nndoc ,group (nndoc-address ,(current-buffer))
9227 (nndoc-article-type guess))
9230 ;; Make all postings to this group go to the parent group.
9231 (nconc (gnus-info-params (gnus-get-info egroup))
9233 (push egroup groups))
9234 ;; Couldn't select this doc group.
9235 (gnus-error 3 "Article couldn't be entered"))))))
9236 ;; Now we have selected all the documents.
9239 (error "None of the articles could be interpreted as documents"))
9240 ((gnus-group-read-ephemeral-group
9241 (setq vgroup (format
9242 "nnvirtual:%s-%s" gnus-newsgroup-name
9243 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
9244 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
9246 (cons (current-buffer) 'summary)))
9248 (error "Couldn't select virtual nndoc group")))))
9250 (defun gnus-summary-widget-forward (arg)
9251 "Move point to the next field or button in the article.
9252 With optional ARG, move across that many fields."
9254 (gnus-summary-select-article)
9255 (gnus-configure-windows 'article)
9256 (select-window (gnus-get-buffer-window gnus-article-buffer))
9257 (widget-forward arg))
9259 (defun gnus-summary-isearch-article (&optional regexp-p)
9260 "Do incremental search forward on the current article.
9261 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9263 (gnus-summary-select-article)
9264 (gnus-configure-windows 'article)
9265 (gnus-eval-in-buffer-window gnus-article-buffer
9268 (isearch-forward regexp-p))))
9270 (defun gnus-summary-repeat-search-article-forward ()
9271 "Repeat the previous search forwards."
9273 (unless gnus-last-search-regexp
9274 (error "No previous search"))
9275 (gnus-summary-search-article-forward gnus-last-search-regexp))
9277 (defun gnus-summary-repeat-search-article-backward ()
9278 "Repeat the previous search backwards."
9280 (unless gnus-last-search-regexp
9281 (error "No previous search"))
9282 (gnus-summary-search-article-forward gnus-last-search-regexp t))
9284 (defun gnus-summary-search-article-forward (regexp &optional backward)
9285 "Search for an article containing REGEXP forward.
9286 If BACKWARD, search backward instead."
9289 (format "Search article %s (regexp%s): "
9290 (if current-prefix-arg "backward" "forward")
9291 (if gnus-last-search-regexp
9292 (concat ", default " gnus-last-search-regexp)
9294 current-prefix-arg))
9295 (if (string-equal regexp "")
9296 (setq regexp (or gnus-last-search-regexp ""))
9297 (setq gnus-last-search-regexp regexp)
9298 (setq gnus-article-before-search gnus-current-article))
9299 ;; Intentionally set gnus-last-article.
9300 (setq gnus-last-article gnus-article-before-search)
9301 (let ((gnus-last-article gnus-last-article))
9302 (if (gnus-summary-search-article regexp backward)
9303 (gnus-summary-show-thread)
9304 (signal 'search-failed (list regexp)))))
9306 (defun gnus-summary-search-article-backward (regexp)
9307 "Search for an article containing REGEXP backward."
9310 (format "Search article backward (regexp%s): "
9311 (if gnus-last-search-regexp
9312 (concat ", default " gnus-last-search-regexp)
9314 (gnus-summary-search-article-forward regexp 'backward))
9316 (defun gnus-summary-search-article (regexp &optional backward)
9317 "Search for an article containing REGEXP.
9318 Optional argument BACKWARD means do search for backward.
9319 `gnus-select-article-hook' is not called during the search."
9320 ;; We have to require this here to make sure that the following
9321 ;; dynamic binding isn't shadowed by autoloading.
9322 (require 'gnus-async)
9324 (let ((gnus-select-article-hook nil) ;Disable hook.
9325 (gnus-article-prepare-hook nil)
9326 (gnus-mark-article-hook nil) ;Inhibit marking as read.
9327 (gnus-use-article-prefetch nil)
9328 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
9329 (gnus-use-trees nil) ;Inhibit updating tree buffer.
9331 (gnus-keep-backlog nil)
9332 (gnus-break-pages nil)
9333 (gnus-summary-display-arrow nil)
9334 (gnus-updated-mode-lines nil)
9335 (gnus-auto-center-summary nil)
9336 (sum (current-buffer))
9337 (gnus-display-mime-function nil)
9340 (gnus-save-hidden-threads
9341 (gnus-summary-select-article)
9342 (set-buffer gnus-article-buffer)
9343 (goto-char (window-point (get-buffer-window (current-buffer))))
9347 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
9349 (re-search-backward regexp nil t)
9350 (re-search-forward regexp nil t))
9351 ;; We found the regexp.
9356 (get-buffer-window (current-buffer))
9360 (get-buffer-window (current-buffer))
9363 (setq point (point)))
9364 ;; We didn't find it, so we go to the next article.
9367 (while (eq found 'not)
9368 (if (not (if backward (gnus-summary-find-prev)
9369 (gnus-summary-find-next)))
9370 ;; No more articles.
9372 ;; Select the next article and adjust point.
9373 (unless (gnus-summary-article-sparse-p
9374 (gnus-summary-article-number))
9376 (gnus-summary-select-article)
9377 (set-buffer gnus-article-buffer)
9379 (goto-char (if backward (point-max) (point-min))))))))
9380 (gnus-message 7 ""))
9381 ;; Return whether we found the regexp.
9382 (when (eq found 'found)
9384 (gnus-summary-show-thread)
9385 (gnus-summary-goto-subject gnus-current-article)
9386 (gnus-summary-position-point)
9389 (defun gnus-find-matching-articles (header regexp)
9390 "Return a list of all articles that match REGEXP on HEADER.
9391 This search includes all articles in the current group that Gnus has
9392 fetched headers for, whether they are displayed or not."
9393 (let ((articles nil)
9394 ;; Can't eta-reduce because it's a macro.
9395 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9396 (case-fold-search t))
9397 (dolist (header gnus-newsgroup-headers)
9398 (when (string-match regexp (funcall func header))
9399 (push (mail-header-number header) articles)))
9400 (nreverse articles)))
9402 (defun gnus-summary-find-matching (header regexp &optional backward unread
9403 not-case-fold not-matching)
9404 "Return a list of all articles that match REGEXP on HEADER.
9405 The search stars on the current article and goes forwards unless
9406 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9407 If UNREAD is non-nil, only unread articles will
9408 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9409 in the comparisons. If NOT-MATCHING, return a list of all articles that
9410 not match REGEXP on HEADER."
9411 (let ((case-fold-search (not not-case-fold))
9414 (if (eq (car header) 'extra)
9417 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9419 (error "%s is an invalid header" header))
9420 (unless (fboundp (intern (concat "mail-header-" header)))
9421 (error "%s is not a valid header" header))
9422 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9423 (dolist (d (if (eq backward 'all)
9425 (gnus-data-find-list
9426 (gnus-summary-article-number)
9427 (gnus-data-list backward))))
9428 (when (and (or (not unread) ; We want all articles...
9429 (gnus-data-unread-p d)) ; Or just unreads.
9430 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9434 (funcall func (gnus-data-header d))))
9435 (string-match regexp
9436 (funcall func (gnus-data-header d)))))
9437 (push (gnus-data-number d) articles))) ; Success!
9438 (nreverse articles)))
9440 (defun gnus-summary-execute-command (header regexp command &optional backward)
9441 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9442 If HEADER is an empty string (or nil), the match is done on the entire
9443 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9445 (list (let ((completion-ignore-case t))
9446 (gnus-completing-read
9448 (mapcar 'symbol-name
9450 '(Number Subject From Lines Date
9451 Message-ID Xref References Body)
9452 gnus-extra-headers))
9454 (read-string "Regexp: ")
9455 (read-key-sequence "Command: ")
9456 current-prefix-arg))
9457 (when (equal header "Body")
9459 ;; Hidden thread subtrees must be searched as well.
9460 (gnus-summary-show-all-threads)
9461 ;; We don't want to change current point nor window configuration.
9463 (save-window-excursion
9465 gnus-treat-strip-trailing-blank-lines
9466 gnus-treat-strip-leading-blank-lines
9467 gnus-treat-strip-multiple-blank-lines
9468 gnus-treat-hide-boring-headers
9469 gnus-treat-fold-newsgroups
9470 gnus-article-prepare-hook)
9471 (gnus-message 6 "Executing %s..." (key-description command))
9472 ;; We'd like to execute COMMAND interactively so as to give arguments.
9473 (gnus-execute header regexp
9474 `(call-interactively ',(key-binding command))
9476 (gnus-message 6 "Executing %s...done" (key-description command))))))
9478 (defun gnus-summary-beginning-of-article ()
9479 "Scroll the article back to the beginning."
9481 (gnus-summary-select-article)
9482 (gnus-configure-windows 'article)
9483 (gnus-eval-in-buffer-window gnus-article-buffer
9485 (goto-char (point-min))
9486 (when gnus-break-pages
9487 (gnus-narrow-to-page))))
9489 (defun gnus-summary-end-of-article ()
9490 "Scroll to the end of the article."
9492 (gnus-summary-select-article)
9493 (gnus-configure-windows 'article)
9494 (gnus-eval-in-buffer-window gnus-article-buffer
9496 (goto-char (point-max))
9498 (when gnus-break-pages
9499 (gnus-narrow-to-page))))
9501 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9502 "Truncate to LEN and quote all \"(\"'s in STRING."
9503 (gnus-replace-in-string (if (and len (> (length string) len))
9504 (substring string 0 len)
9508 (defun gnus-summary-print-article (&optional filename n)
9509 "Generate and print a PostScript image of the process-marked (mail) articles.
9511 If used interactively, print the current article if none are
9512 process-marked. With prefix arg, prompt the user for the name of the
9515 When used from Lisp, accept two optional args FILENAME and N. N means
9516 to print the next N articles. If N is negative, print the N previous
9517 articles. If N is nil and articles have been marked with the process
9518 mark, print these instead.
9520 If the optional first argument FILENAME is nil, send the image to the
9521 printer. If FILENAME is a string, save the PostScript image in a file with
9522 that name. If FILENAME is a number, prompt the user for the name of the file
9524 (interactive (list (ps-print-preprint current-prefix-arg)))
9525 (dolist (article (gnus-summary-work-articles n))
9526 (gnus-summary-select-article nil nil 'pseudo article)
9527 (gnus-eval-in-buffer-window gnus-article-buffer
9528 (gnus-print-buffer))
9529 (gnus-summary-remove-process-mark article))
9530 (ps-despool filename))
9532 (defun gnus-print-buffer ()
9533 (let ((ps-left-header
9536 (gnus-summary-print-truncate-and-quote
9537 (mail-header-subject gnus-current-headers)
9540 (gnus-summary-print-truncate-and-quote
9541 (mail-header-from gnus-current-headers)
9545 "/pagenumberstring load"
9547 (mail-header-date gnus-current-headers) ")"))))
9548 (gnus-run-hooks 'gnus-ps-print-hook)
9550 (if ps-print-color-p
9551 (ps-spool-buffer-with-faces)
9552 (ps-spool-buffer)))))
9554 (defun gnus-summary-show-complete-article ()
9555 "Show a complete version of the current article.
9556 This is only useful if you're looking at a partial version of the
9559 (let ((gnus-keep-backlog nil)
9560 (gnus-use-cache nil)
9563 (format "%s-fetch-partial-articles"
9564 (car (gnus-find-method-for-group
9565 gnus-newsgroup-name)))
9570 (setq old-val (symbol-value variable))
9572 (gnus-flush-original-article-buffer)
9573 (gnus-summary-show-article))
9574 (set variable old-val))))
9576 (defun gnus-summary-show-article (&optional arg)
9577 "Force redisplaying of the current article.
9578 If ARG (the prefix) is a number, show the article with the charset
9579 defined in `gnus-summary-show-article-charset-alist', or the charset
9581 If ARG (the prefix) is non-nil and not a number, show the article,
9582 but without running any of the article treatment functions
9583 article. Normally, the keystroke is `C-u g'. When using `C-u
9584 C-u g', show the raw article."
9588 (gnus-summary-show-article t)
9589 (let ((gnus-newsgroup-charset
9590 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9591 (mm-read-coding-system
9592 "View as charset: " ;; actually it is coding system.
9593 (with-current-buffer gnus-article-buffer
9594 (mm-detect-coding-region (point) (point-max))))))
9595 (gnus-newsgroup-ignored-charsets 'gnus-all))
9596 (gnus-summary-select-article nil 'force)
9597 (let ((deps gnus-newsgroup-dependencies)
9599 (with-current-buffer gnus-original-article-buffer
9601 (message-narrow-to-head)
9602 (setq head (buffer-string))
9603 (goto-char (point-min))
9604 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9605 (goto-char (point-max))
9607 (setq lines (1- (count-lines (point) (point-max))))))
9609 (insert (format "211 %d Article retrieved.\n"
9610 (cdr gnus-article-current)))
9612 (if lines (insert (format "Lines: %d\n" lines)))
9614 (let ((nntp-server-buffer (current-buffer)))
9615 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9616 (gnus-data-set-header
9617 (gnus-data-find (cdr gnus-article-current))
9619 (gnus-summary-update-article-line
9620 (cdr gnus-article-current) header)
9621 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9622 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9624 ;; Select the article the normal way.
9625 (gnus-summary-select-article nil 'force))
9628 (let ((gnus-inhibit-article-treatments t))
9629 (gnus-summary-select-article nil 'force)))
9631 ;; We have to require this here to make sure that the following
9632 ;; dynamic binding isn't shadowed by autoloading.
9633 (require 'gnus-async)
9635 ;; Bind the article treatment functions to nil.
9636 (let ((gnus-have-all-headers t)
9637 gnus-article-prepare-hook
9638 gnus-article-decode-hook
9639 gnus-display-mime-function
9641 ;; Destroy any MIME parts.
9642 (when (gnus-buffer-live-p gnus-article-buffer)
9643 (with-current-buffer gnus-article-buffer
9644 (gnus-article-stop-animations)
9645 (mm-destroy-parts gnus-article-mime-handles)
9646 ;; Set it to nil for safety reason.
9647 (setq gnus-article-mime-handle-alist nil)
9648 (setq gnus-article-mime-handles nil)))
9649 (gnus-summary-select-article nil 'force))))
9650 (gnus-summary-goto-subject gnus-current-article)
9651 (gnus-summary-position-point))
9653 (defun gnus-summary-show-raw-article ()
9654 "Show the raw article without any article massaging functions being run."
9656 (gnus-summary-show-article t))
9658 (defun gnus-summary-verbose-headers (&optional arg)
9659 "Toggle permanent full header display.
9660 If ARG is a positive number, turn header display on.
9661 If ARG is a negative number, turn header display off."
9663 (setq gnus-show-all-headers
9664 (cond ((or (not (numberp arg))
9666 (not gnus-show-all-headers))
9669 (gnus-summary-show-article))
9671 (defun gnus-summary-toggle-header (&optional arg)
9672 "Show the headers if they are hidden, or hide them if they are shown.
9673 If ARG is a positive number, show the entire header.
9674 If ARG is a negative number, hide the unwanted header lines."
9676 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9677 (get-buffer-window gnus-article-buffer t))))
9678 (with-current-buffer gnus-article-buffer
9680 (article-narrow-to-head)
9681 (let* ((inhibit-read-only t)
9682 (inhibit-point-motion-hooks t)
9683 (hidden (if (numberp arg)
9685 (or (not (looking-at "[^ \t\n]+:"))
9686 (gnus-article-hidden-text-p 'headers))))
9688 (delete-region (point-min) (point-max))
9689 (with-current-buffer gnus-original-article-buffer
9690 (goto-char (setq s (point-min)))
9691 (setq e (if (search-forward "\n\n" nil t)
9694 (insert-buffer-substring gnus-original-article-buffer s e)
9695 (run-hooks 'gnus-article-decode-hook)
9697 (let ((gnus-treat-hide-headers nil)
9698 (gnus-treat-hide-boring-headers nil))
9699 (gnus-delete-wash-type 'headers)
9700 (gnus-treat-article 'head))
9701 (gnus-treat-article 'head))
9704 (set-window-start window (goto-char (point-min))))
9705 (if gnus-break-pages
9706 (gnus-narrow-to-page)
9707 (when (gnus-visual-p 'page-marker)
9708 (let ((inhibit-read-only t))
9709 (gnus-remove-text-with-property 'gnus-prev)
9710 (gnus-remove-text-with-property 'gnus-next))))
9711 (gnus-set-mode-line 'article)))))
9713 (defun gnus-summary-show-all-headers ()
9714 "Make all header lines visible."
9716 (gnus-summary-toggle-header 1))
9718 (defun gnus-summary-caesar-message (&optional arg)
9719 "Caesar rotate the current article by 13.
9720 With a non-numerical prefix, also rotate headers. A numerical
9721 prefix specifies how many places to rotate each letter forward."
9723 (gnus-summary-select-article)
9724 (let ((mail-header-separator ""))
9725 (gnus-eval-in-buffer-window gnus-article-buffer
9728 (let ((start (window-start))
9729 (inhibit-read-only t))
9730 (if (equal arg '(4))
9731 (message-caesar-buffer-body nil t)
9732 (message-caesar-buffer-body arg))
9733 (set-window-start (get-buffer-window (current-buffer)) start)))))
9734 ;; Create buttons and stuff...
9735 (gnus-treat-article nil))
9737 (declare-function idna-to-unicode "ext:idna" (str))
9739 (defun gnus-summary-idna-message (&optional arg)
9740 "Decode IDNA encoded domain names in the current articles.
9741 IDNA encoded domain names looks like `xn--bar'. If a string
9742 remain unencoded after running this function, it is likely an
9743 invalid IDNA string (`xn--bar' is invalid).
9745 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9746 installed for this command to work."
9748 (if (not (and (condition-case nil (require 'idna)
9750 (mm-coding-system-p 'utf-8)
9751 (executable-find (symbol-value 'idna-program))))
9753 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9754 (gnus-summary-select-article)
9755 (let ((mail-header-separator ""))
9756 (gnus-eval-in-buffer-window gnus-article-buffer
9759 (let ((start (window-start))
9761 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9762 (replace-match (idna-to-unicode (match-string 1))))
9763 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9765 (defun gnus-summary-morse-message (&optional arg)
9766 "Morse decode the current article."
9768 (gnus-summary-select-article)
9769 (let ((mail-header-separator ""))
9770 (gnus-eval-in-buffer-window gnus-article-buffer
9774 (let ((pos (window-start))
9775 (inhibit-read-only t))
9776 (goto-char (point-min))
9777 (when (message-goto-body)
9778 (gnus-narrow-to-body))
9779 (goto-char (point-min))
9780 (while (search-forward "·" (point-max) t)
9781 (replace-match "."))
9782 (unmorse-region (point-min) (point-max))
9784 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9786 (defun gnus-summary-stop-page-breaking ()
9787 "Stop page breaking in the current article."
9789 (gnus-summary-select-article)
9790 (gnus-eval-in-buffer-window gnus-article-buffer
9792 (when (gnus-visual-p 'page-marker)
9793 (let ((inhibit-read-only t))
9794 (gnus-remove-text-with-property 'gnus-prev)
9795 (gnus-remove-text-with-property 'gnus-next))
9796 (setq gnus-page-broken nil))))
9798 (defun gnus-summary-move-article (&optional n to-newsgroup
9799 select-method action)
9800 "Move the current article to a different newsgroup.
9801 If N is a positive number, move the N next articles.
9802 If N is a negative number, move the N previous articles.
9803 If N is nil and any articles have been marked with the process mark,
9804 move those articles instead.
9805 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9806 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9807 re-spool using this method.
9809 When called interactively with TO-NEWSGROUP being nil, the value of
9810 the variable `gnus-move-split-methods' is used for finding a default
9811 for the target newsgroup.
9813 For this function to work, both the current newsgroup and the
9814 newsgroup that you want to move to have to support the `request-move'
9815 and `request-accept' functions.
9817 ACTION can be either `move' (the default), `crosspost' or `copy'."
9820 (setq action 'move))
9821 ;; Check whether the source group supports the required functions.
9822 (cond ((and (eq action 'move)
9823 (not (gnus-check-backend-function
9824 'request-move-article gnus-newsgroup-name)))
9825 (error "The current group does not support article moving"))
9826 ((and (eq action 'crosspost)
9827 (not (gnus-check-backend-function
9828 'request-replace-article gnus-newsgroup-name)))
9829 (error "The current group does not support article editing")))
9830 (let ((articles (gnus-summary-work-articles n))
9831 (prefix (if (gnus-check-backend-function
9832 'request-move-article gnus-newsgroup-name)
9833 (funcall gnus-move-group-prefix-function
9834 gnus-newsgroup-name)
9836 (names '((move "Move" "Moving")
9837 (copy "Copy" "Copying")
9838 (crosspost "Crosspost" "Crossposting")))
9839 (copy-buf (save-excursion
9840 (nnheader-set-temp-buffer " *copy article*")))
9841 art-group to-method new-xref article to-groups
9842 articles-to-update-marks encoded)
9843 (unless (assq action names)
9844 (error "Unknown action %s" action))
9845 ;; Read the newsgroup name.
9846 (when (and (not to-newsgroup)
9847 (not select-method))
9848 (if (and gnus-move-split-methods
9850 (and (memq gnus-current-article articles)
9851 (gnus-buffer-live-p gnus-original-article-buffer))))
9852 ;; When `gnus-move-split-methods' is non-nil, we have to
9853 ;; select an article to give `gnus-read-move-group-name' an
9854 ;; opportunity to suggest an appropriate default. However,
9855 ;; we needn't render or mark the article.
9856 (let ((gnus-display-mime-function nil)
9857 (gnus-article-prepare-hook nil)
9858 (gnus-mark-article-hook nil))
9859 (gnus-summary-select-article nil nil nil (car articles))))
9860 (setq to-newsgroup (gnus-read-move-group-name
9861 (cadr (assq action names))
9863 (intern (format "gnus-current-%s-group" action)))
9865 encoded to-newsgroup
9866 to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
9867 (set (intern (format "gnus-current-%s-group" action))
9868 (mm-decode-coding-string
9870 (gnus-group-name-charset to-method to-newsgroup))))
9872 (setq to-method (or select-method
9873 (gnus-server-to-method
9874 (gnus-group-method to-newsgroup)))))
9878 (mm-encode-coding-string
9880 (gnus-group-name-charset to-method to-newsgroup)))))
9881 ;; Check the method we are to move this article to...
9882 (unless (gnus-check-backend-function
9883 'request-accept-article (car to-method))
9884 (error "%s does not support article copying" (car to-method)))
9885 (unless (gnus-check-server to-method)
9886 (error "Can't open server %s" (car to-method)))
9887 (gnus-message 6 "%s to %s: %s..."
9888 (caddr (assq action names))
9889 (or (car select-method)
9890 (gnus-group-decoded-name to-newsgroup))
9893 (setq article (pop articles))
9894 ;; Set any marks that may have changed in the summary buffer.
9895 (when gnus-preserve-marks
9896 (gnus-summary-push-marks-to-backend article))
9900 ;; Move the article.
9902 ;; Remove this article from future suppression.
9903 (gnus-dup-unsuppress-article article)
9904 (let* ((from-method (gnus-find-method-for-group
9905 gnus-newsgroup-name))
9906 (to-method (or select-method
9907 (gnus-find-method-for-group to-newsgroup)))
9908 (move-is-internal (gnus-server-equal from-method to-method)))
9909 (gnus-request-move-article
9910 article ; Article to move
9911 gnus-newsgroup-name ; From newsgroup
9912 (nth 1 (gnus-find-method-for-group
9913 gnus-newsgroup-name)) ; Server
9914 (list 'gnus-request-accept-article
9915 to-newsgroup (list 'quote select-method)
9916 (not articles) t) ; Accept form
9917 (not articles) ; Only save nov last time
9918 (and move-is-internal
9919 to-newsgroup ; Not respooling
9920 ; Is this move internal?
9921 (gnus-group-real-name to-newsgroup)))))
9922 ;; Copy the article.
9924 (with-current-buffer copy-buf
9925 (when (gnus-request-article-this-buffer article
9926 gnus-newsgroup-name)
9928 (nnheader-narrow-to-headers)
9929 (dolist (hdr gnus-copy-article-ignored-headers)
9930 (message-remove-header hdr t)))
9931 (gnus-request-accept-article
9932 to-newsgroup select-method (not articles) t))))
9933 ;; Crosspost the article.
9934 ((eq action 'crosspost)
9935 (let ((xref (message-tokenize-header
9936 (mail-header-xref (gnus-summary-article-header
9939 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9940 ":" (number-to-string article)))
9942 (setq xref (list (system-name))))
9945 (mapconcat 'identity
9946 (delete "Xref:" (delete new-xref xref))
9949 (with-current-buffer copy-buf
9950 ;; First put the article in the destination group.
9951 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9952 (when (consp (setq art-group
9953 (gnus-request-accept-article
9954 to-newsgroup select-method (not articles)
9956 (setq new-xref (concat new-xref " " (car art-group)
9958 (number-to-string (cdr art-group))))
9959 ;; Now we have the new Xrefs header, so we insert
9960 ;; it and replace the new article.
9961 (nnheader-replace-header "Xref" new-xref)
9962 (gnus-request-replace-article
9963 (cdr art-group) to-newsgroup (current-buffer) t)
9967 (gnus-message 1 "Couldn't %s article %s: %s"
9968 (cadr (assq action names)) article
9969 (nnheader-get-report (car to-method))))
9970 ((eq art-group 'junk)
9971 (when (eq action 'move)
9972 (gnus-summary-mark-article article gnus-canceled-mark)
9973 (gnus-message 4 "Deleted article %s" article)
9974 ;; run the delete hook
9975 (run-hook-with-args 'gnus-summary-article-delete-hook
9978 (assoc article (gnus-data-list nil)))
9979 gnus-newsgroup-name nil
9982 (let* ((pto-group (gnus-group-prefixed-name
9983 (car art-group) to-method))
9984 (info (gnus-get-info pto-group))
9985 (to-group (gnus-info-group info))
9987 ;; Update the group that has been moved to.
9989 (memq action '(move copy)))
9990 (unless (member to-group to-groups)
9991 (push to-group to-groups))
9993 (when (and (not (memq article gnus-newsgroup-unreads))
9995 (push 'read to-marks)
9997 info (gnus-add-to-range (gnus-info-read info)
9998 (list (cdr art-group)))))
10000 ;; See whether the article is to be put in the cache.
10001 (let* ((expirable (gnus-group-auto-expirable-p to-group))
10002 (marks (if expirable
10003 gnus-article-mark-lists
10004 (delete '(expirable . expire)
10006 gnus-article-mark-lists))))
10007 (to-article (cdr art-group)))
10009 ;; Enter the article into the cache in the new group,
10010 ;; if that is required.
10011 (when (and to-article
10013 (gnus-cache-possibly-enter-article
10014 to-group to-article
10015 (memq article gnus-newsgroup-marked)
10016 (memq article gnus-newsgroup-dormant)
10017 (memq article gnus-newsgroup-unreads)))
10019 (when (and gnus-preserve-marks
10021 ;; Copy any marks over to the new group.
10022 (when (and (equal to-group gnus-newsgroup-name)
10023 (not (memq article gnus-newsgroup-unreads)))
10024 ;; Mark this article as read in this group.
10025 (push (cons to-article gnus-read-mark)
10026 gnus-newsgroup-reads)
10027 ;; Increase the active status of this group.
10028 (setcdr (gnus-active to-group) to-article)
10029 (setcdr gnus-newsgroup-active to-article))
10032 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10033 (when (memq article (symbol-value
10034 (intern (format "gnus-newsgroup-%s"
10036 (push (cdar marks) to-marks)
10037 ;; If the other group is the same as this group,
10038 ;; then we have to add the mark to the list.
10039 (when (equal to-group gnus-newsgroup-name)
10040 (set (intern (format "gnus-newsgroup-%s"
10044 (intern (format "gnus-newsgroup-%s"
10046 ;; Copy the marks to other group.
10047 (gnus-add-marked-articles
10048 to-group (cdar marks) (list to-article) info)))
10049 (setq marks (cdr marks)))
10051 (when (and expirable
10052 gnus-mark-copied-or-moved-articles-as-expirable
10053 (not (memq 'expire to-marks)))
10054 ;; Mark this article as expirable.
10055 (push 'expire to-marks)
10056 (when (equal to-group gnus-newsgroup-name)
10057 (push to-article gnus-newsgroup-expirable))
10058 ;; Copy the expirable mark to other group.
10059 (gnus-add-marked-articles
10060 to-group 'expire (list to-article) info))
10063 (gnus-request-set-mark
10064 to-group (list (list (list to-article) 'add to-marks)))))
10066 (gnus-dribble-enter
10067 (concat "(gnus-group-set-info '"
10068 (gnus-prin1-to-string (gnus-get-info to-group))
10070 (concat "^(gnus-group-set-info '(\""
10071 (regexp-quote to-group) "\""))))
10073 ;; Update the Xref header in this article to point to
10074 ;; the new crossposted article we have just created.
10075 (when (eq action 'crosspost)
10076 (with-current-buffer copy-buf
10077 (gnus-request-article-this-buffer article gnus-newsgroup-name)
10078 (nnheader-replace-header "Xref" new-xref)
10079 (gnus-request-replace-article
10080 article gnus-newsgroup-name (current-buffer) t)))
10082 ;; run the move/copy/crosspost/respool hook
10083 (run-hook-with-args 'gnus-summary-article-move-hook
10086 (assoc article (gnus-data-list nil)))
10087 gnus-newsgroup-name
10091 ;;;!!!Why is this necessary?
10092 (set-buffer gnus-summary-buffer)
10094 (when (eq action 'move)
10096 (gnus-summary-goto-subject article)
10097 (gnus-summary-mark-article article gnus-canceled-mark)))))
10098 (push article articles-to-update-marks))
10101 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
10102 ;; Re-activate all groups that have been moved to.
10103 (with-current-buffer gnus-group-buffer
10104 (let ((gnus-group-marked to-groups))
10105 (gnus-group-get-new-news-this-group nil t)))
10107 (gnus-kill-buffer copy-buf)
10108 (gnus-summary-position-point)
10109 (gnus-set-mode-line 'summary)))
10111 (defun gnus-summary-push-marks-to-backend (article)
10113 (marks gnus-article-mark-lists))
10114 (unless (memq article gnus-newsgroup-unreads)
10117 (when (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10118 (memq article (symbol-value
10119 (intern (format "gnus-newsgroup-%s"
10121 (push (cdar marks) set))
10123 (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)))))
10125 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
10126 "Copy the current article to some other group.
10127 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
10128 When called interactively, if TO-NEWSGROUP is nil, use the value of
10129 the variable `gnus-move-split-methods' for finding a default target
10131 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
10132 re-spool using this method."
10134 (gnus-summary-move-article n to-newsgroup select-method 'copy))
10136 (defun gnus-summary-crosspost-article (&optional n)
10137 "Crosspost the current article to some other group."
10139 (gnus-summary-move-article n nil nil 'crosspost))
10141 (defcustom gnus-summary-respool-default-method nil
10142 "Default method type for respooling an article.
10143 If nil, use to the current newsgroup method."
10145 :group 'gnus-summary-mail)
10147 (defun gnus-summary-respool-article (&optional n method)
10148 "Respool the current article.
10149 The article will be squeezed through the mail spooling process again,
10150 which means that it will be put in some mail newsgroup or other
10151 depending on `nnmail-split-methods'.
10152 If N is a positive number, respool the N next articles.
10153 If N is a negative number, respool the N previous articles.
10154 If N is nil and any articles have been marked with the process mark,
10155 respool those articles instead.
10157 Respooling can be done both from mail groups and \"real\" newsgroups.
10158 In the former case, the articles in question will be moved from the
10159 current group into whatever groups they are destined to. In the
10160 latter case, they will be copied into the relevant groups."
10162 (list current-prefix-arg
10163 (let* ((methods (mapcar #'car (gnus-methods-using 'respool)))
10165 (symbol-name (or gnus-summary-respool-default-method
10166 (car (gnus-find-method-for-group
10167 gnus-newsgroup-name)))))
10169 (gnus-completing-read
10170 "Backend to use when respooling"
10171 methods t nil 'gnus-mail-method-history methname))
10174 ((zerop (length (setq ms (gnus-servers-using-backend
10175 (intern method)))))
10176 (list (intern method) ""))
10180 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
10181 (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
10184 (error "No method given for respooling"))
10185 (if (assoc (symbol-name
10186 (car (gnus-find-method-for-group gnus-newsgroup-name)))
10187 (gnus-methods-using 'respool))
10188 (gnus-summary-move-article n nil method)
10189 (gnus-summary-copy-article n nil method)))
10191 (defun gnus-summary-import-article (file &optional edit)
10192 "Import an arbitrary file into a mail newsgroup."
10193 (interactive "fImport file: \nP")
10194 (let ((group gnus-newsgroup-name)
10195 (now (current-time))
10196 atts lines group-art)
10197 (unless (gnus-check-backend-function 'request-accept-article group)
10198 (error "%s does not support article importing" group))
10199 (or (file-readable-p file)
10200 (not (file-regular-p file))
10201 (error "Can't read %s" file))
10202 (with-current-buffer (gnus-get-buffer-create " *import file*")
10204 (nnheader-insert-file-contents file)
10205 (goto-char (point-min))
10206 (if (nnheader-article-p)
10208 (goto-char (point-min))
10209 (search-forward "\n\n" nil t)
10210 (narrow-to-region (point-min) (1- (point)))
10211 (goto-char (point-min))
10212 (unless (re-search-forward "^date:" nil t)
10213 (goto-char (point-max))
10214 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
10215 ;; This doesn't look like an article, so we fudge some headers.
10216 (setq atts (file-attributes file)
10217 lines (count-lines (point-min) (point-max)))
10218 (insert "From: " (read-string "From: ") "\n"
10219 "Subject: " (read-string "Subject: ") "\n"
10220 "Date: " (message-make-date (nth 5 atts)) "\n"
10221 "Message-ID: " (message-make-message-id) "\n"
10222 "Lines: " (int-to-string lines) "\n"
10223 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
10224 (setq group-art (gnus-request-accept-article group nil t))
10225 (kill-buffer (current-buffer)))
10226 (setq gnus-newsgroup-active (gnus-activate-group group))
10228 (gnus-summary-goto-article (cdr group-art) nil t)
10230 (gnus-summary-edit-article))))
10232 (defun gnus-summary-create-article ()
10233 "Create an article in a mail newsgroup."
10235 (let ((group gnus-newsgroup-name)
10236 (now (current-time))
10238 (unless (gnus-check-backend-function 'request-accept-article group)
10239 (error "%s does not support article importing" group))
10240 (with-current-buffer (gnus-get-buffer-create " *import file*")
10242 (goto-char (point-min))
10243 ;; This doesn't look like an article, so we fudge some headers.
10244 (insert "From: " (read-string "From: ") "\n"
10245 "Subject: " (read-string "Subject: ") "\n"
10246 "Date: " (message-make-date now) "\n"
10247 "Message-ID: " (message-make-message-id) "\n")
10248 (setq group-art (gnus-request-accept-article group nil t))
10249 (kill-buffer (current-buffer)))
10250 (setq gnus-newsgroup-active (gnus-activate-group group))
10252 (gnus-summary-goto-article (cdr group-art) nil t)
10253 (gnus-summary-edit-article)))
10255 (defun gnus-summary-article-posted-p ()
10256 "Say whether the current (mail) article is available from news as well.
10257 This will be the case if the article has both been mailed and posted."
10259 (let ((id (mail-header-references (gnus-summary-article-header)))
10260 (gnus-override-method (car (gnus-refer-article-methods))))
10261 (if (gnus-request-head id "")
10262 (gnus-message 2 "The current message was found on %s"
10263 gnus-override-method)
10264 (gnus-message 2 "The current message couldn't be found on %s"
10265 gnus-override-method)
10268 (defun gnus-summary-expire-articles (&optional now)
10269 "Expire all articles that are marked as expirable in the current group."
10271 (when (and (not gnus-group-is-exiting-without-update-p)
10272 (gnus-check-backend-function
10273 'request-expire-articles gnus-newsgroup-name))
10274 ;; This backend supports expiry.
10275 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
10276 (expirable (if total
10278 ;; We need to update the info for
10279 ;; this group for `gnus-list-of-read-articles'
10280 ;; to give us the right answer.
10281 (gnus-run-hooks 'gnus-exit-group-hook)
10282 (gnus-summary-update-info)
10283 (gnus-list-of-read-articles gnus-newsgroup-name))
10284 (setq gnus-newsgroup-expirable
10285 (sort gnus-newsgroup-expirable '<))))
10286 (expiry-wait (if now 'immediate
10287 (gnus-group-find-parameter
10288 gnus-newsgroup-name 'expiry-wait)))
10289 (nnmail-expiry-target
10290 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
10291 nnmail-expiry-target))
10294 ;; There are expirable articles in this group, so we run them
10295 ;; through the expiry process.
10296 (gnus-message 6 "Expiring articles...")
10297 (when (gnus-check-group gnus-newsgroup-name)
10298 ;; The list of articles that weren't expired is returned.
10301 (let ((nnmail-expiry-wait-function nil)
10302 (nnmail-expiry-wait expiry-wait))
10303 (setq es (gnus-request-expire-articles
10304 expirable gnus-newsgroup-name)))
10305 (setq es (gnus-request-expire-articles
10306 expirable gnus-newsgroup-name)))
10308 (setq gnus-newsgroup-expirable es))
10309 ;; We go through the old list of expirable, and mark all
10310 ;; really expired articles as nonexistent.
10311 (unless (eq es expirable) ;If nothing was expired, we don't mark.
10312 (let ((gnus-use-cache nil))
10313 (dolist (article expirable)
10314 (when (and (not (memq article es))
10315 (gnus-data-find article))
10316 (gnus-summary-mark-article article gnus-canceled-mark)
10317 (run-hook-with-args 'gnus-summary-article-expire-hook
10320 (assoc article (gnus-data-list nil)))
10321 gnus-newsgroup-name
10324 (gnus-message 6 "Expiring articles...done")))))
10326 (defun gnus-summary-expire-articles-now ()
10327 "Expunge all expirable articles in the current group.
10328 This means that *all* articles that are marked as expirable will be
10329 deleted forever, right now."
10331 (or gnus-expert-user
10333 "Are you really, really sure you want to delete all expirable messages? ")
10335 (gnus-summary-expire-articles t))
10337 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10338 (defun gnus-summary-delete-article (&optional n)
10339 "Delete the N next (mail) articles.
10340 This command actually deletes articles. This is not a marking
10341 command. The article will disappear forever from your life, never to
10344 If N is negative, delete backwards.
10345 If N is nil and articles have been marked with the process mark,
10346 delete these instead.
10348 If `gnus-novice-user' is non-nil you will be asked for
10349 confirmation before the articles are deleted."
10351 (unless (gnus-check-backend-function 'request-expire-articles
10352 gnus-newsgroup-name)
10353 (error "The current newsgroup does not support article deletion"))
10354 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
10355 (error "Couldn't open server"))
10356 ;; Compute the list of articles to delete.
10357 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
10358 (nnmail-expiry-target 'delete)
10360 (if (and gnus-novice-user
10361 (not (gnus-yes-or-no-p
10362 (format "Do you really want to delete %s forever? "
10363 (if (> (length articles) 1)
10364 (format "these %s articles" (length articles))
10365 "this article")))))
10367 ;; Delete the articles.
10368 (setq not-deleted (gnus-request-expire-articles
10369 articles gnus-newsgroup-name 'force))
10372 (gnus-summary-remove-process-mark (car articles))
10373 ;; The backend might not have been able to delete the article
10375 (unless (memq (car articles) not-deleted)
10376 (gnus-summary-mark-article (car articles) gnus-canceled-mark)
10377 (let* ((article (car articles))
10378 (ghead (gnus-data-header
10379 (assoc article (gnus-data-list nil)))))
10380 (run-hook-with-args 'gnus-summary-article-delete-hook
10381 'delete ghead gnus-newsgroup-name nil
10383 (setq articles (cdr articles))))
10385 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10386 (gnus-summary-position-point)
10387 (gnus-set-mode-line 'summary)
10390 (defun gnus-summary-edit-article (&optional arg)
10391 "Edit the current article.
10392 This will have permanent effect only in mail groups.
10393 If ARG is nil, edit the decoded articles.
10394 If ARG is 1, edit the raw articles.
10395 If ARG is 2, edit the raw articles even in read-only groups.
10396 If ARG is 3, edit the articles with the current handles.
10397 Otherwise, allow editing of articles even in read-only
10400 (let (force raw current-handles)
10409 (setq current-handles
10410 (and (gnus-buffer-live-p gnus-article-buffer)
10411 (with-current-buffer gnus-article-buffer
10413 gnus-article-mime-handles
10414 (setq gnus-article-mime-handles nil))))))
10417 (when (and raw (not force)
10418 (member gnus-newsgroup-name '("nndraft:delayed"
10421 (error "Can't edit the raw article in group %s"
10422 gnus-newsgroup-name))
10423 (with-current-buffer gnus-summary-buffer
10424 (let ((mail-parse-charset gnus-newsgroup-charset)
10425 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
10426 (gnus-set-global-variables)
10427 (when (and (not force)
10428 (gnus-group-read-only-p))
10429 (error "The current newsgroup does not support article editing"))
10430 (gnus-summary-show-article t)
10431 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
10432 (with-current-buffer gnus-article-buffer
10433 (mm-enable-multibyte)))
10434 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10436 (gnus-article-edit-article
10439 (let ((mbl mml-buffer-list))
10440 (setq mml-buffer-list nil)
10441 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10442 (mime-to-mml ,'current-handles))
10443 (let ((mbl1 mml-buffer-list))
10444 (setq mml-buffer-list mbl)
10445 (set (make-local-variable 'mml-buffer-list) mbl1))
10446 (gnus-make-local-hook 'kill-buffer-hook)
10447 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10448 `(lambda (no-highlight)
10449 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10450 (message-options message-options)
10451 (message-options-set-recipient)
10452 (mail-parse-ignored-charsets
10453 ',gnus-newsgroup-ignored-charsets)
10454 (rfc2047-header-encoding-alist
10455 ',(let ((charset (gnus-group-name-charset
10456 (gnus-find-method-for-group
10457 gnus-newsgroup-name)
10458 gnus-newsgroup-name)))
10459 (append (list (cons "Newsgroups" charset)
10460 (cons "Followup-To" charset)
10461 (cons "Xref" charset))
10462 rfc2047-header-encoding-alist))))
10463 ,(if (not raw) '(progn
10465 (mml-destroy-buffers)
10466 (remove-hook 'kill-buffer-hook
10467 'mml-destroy-buffers t)
10468 (kill-local-variable 'mml-buffer-list)))
10469 (gnus-summary-edit-article-done
10470 ,(or (mail-header-references gnus-current-headers) "")
10471 ,(gnus-group-read-only-p)
10472 ,gnus-summary-buffer no-highlight))))))))
10474 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10476 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10478 "Make edits to the current article permanent."
10481 ;; The buffer restriction contains the entire article if it exists.
10482 (when (article-goto-body)
10483 (let ((lines (count-lines (point) (point-max)))
10484 (length (- (point-max) (point)))
10485 (case-fold-search t)
10486 (body (copy-marker (point))))
10487 (goto-char (point-min))
10488 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10489 (delete-region (match-beginning 1) (match-end 1))
10490 (insert (number-to-string length)))
10491 (goto-char (point-min))
10492 (when (re-search-forward
10493 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10494 (delete-region (match-beginning 1) (match-end 1))
10495 (insert (number-to-string length)))
10496 (goto-char (point-min))
10497 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10498 (delete-region (match-beginning 1) (match-end 1))
10499 (insert (number-to-string lines))))))
10500 ;; Replace the article.
10501 (let ((buf (current-buffer))
10502 (article (cdr gnus-article-current))
10505 (insert-buffer-substring buf)
10506 (if (and (not read-only)
10507 (not (setq replace-result
10508 (gnus-request-replace-article
10509 article (car gnus-article-current)
10510 (current-buffer) t))))
10511 (error "Couldn't replace article")
10512 ;; If we got a number back, then that's the new article number
10513 ;; for this article. Otherwise, the article number didn't change.
10514 (when (numberp replace-result)
10515 (with-current-buffer gnus-summary-buffer
10516 (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
10517 (gnus-summary-limit gnus-newsgroup-limit)
10518 (setq article replace-result)
10519 (gnus-summary-goto-subject article t)))
10520 ;; Update the summary buffer.
10521 (if (and references
10522 (equal (message-tokenize-header references " ")
10523 (message-tokenize-header
10524 (or (message-fetch-field "references") "") " ")))
10525 ;; We only have to update this line.
10528 (message-narrow-to-head)
10529 (let ((head (buffer-substring-no-properties
10530 (point-min) (point-max)))
10533 (insert (format "211 %d Article retrieved.\n" article))
10536 (let ((nntp-server-buffer (current-buffer)))
10537 (setq header (car (gnus-get-newsgroup-headers nil t))))
10538 (with-current-buffer gnus-summary-buffer
10539 (gnus-data-set-header (gnus-data-find article) header)
10540 (gnus-summary-update-article-line article header)
10541 (if (gnus-summary-goto-subject article nil t)
10542 (gnus-summary-update-secondary-mark article)))))))
10544 (set-buffer (or buffer gnus-summary-buffer))
10545 (gnus-summary-update-article article)
10546 (if (gnus-summary-goto-subject article nil t)
10547 (gnus-summary-update-secondary-mark article)))
10548 ;; Prettify the article buffer again.
10549 (unless no-highlight
10550 (with-current-buffer gnus-article-buffer
10551 ;;!!! Fix this -- article should be rehighlighted.
10552 ;;(gnus-run-hooks 'gnus-article-display-hook)
10553 (set-buffer gnus-original-article-buffer)
10554 (gnus-request-article
10555 article (car gnus-article-current) (current-buffer))))
10556 ;; Prettify the summary buffer line.
10557 (when (gnus-visual-p 'summary-highlight 'highlight)
10558 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10560 (defun gnus-summary-edit-wash (key)
10561 "Perform editing command KEY in the article buffer."
10565 (message "%s" (concat (this-command-keys) "- "))
10568 (gnus-summary-edit-article)
10569 (execute-kbd-macro (concat (this-command-keys) key))
10570 (gnus-article-edit-done))
10574 (defun gnus-summary-respool-query (&optional silent trace)
10575 "Query where the respool algorithm would put this article."
10577 (let (gnus-mark-article-hook)
10578 (gnus-summary-select-article)
10579 (with-current-buffer gnus-original-article-buffer
10580 (let ((groups (nnmail-article-group 'identity trace)))
10583 (message "This message would go to %s"
10584 (mapconcat 'car groups ", "))
10585 (message "This message would go to no groups"))
10588 (defun gnus-summary-respool-trace ()
10589 "Trace where the respool algorithm would put this article.
10590 Display a buffer showing all fancy splitting patterns which matched."
10592 (gnus-summary-respool-query nil t))
10594 ;; Summary marking commands.
10596 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10597 "Mark articles which has the same subject as read, and then select the next.
10598 If UNMARK is positive, remove any kind of mark.
10599 If UNMARK is negative, tick articles."
10602 (setq unmark (prefix-numeric-value unmark)))
10604 (gnus-summary-mark-same-subject
10605 (gnus-summary-article-subject) unmark)))
10606 ;; Select next unread article. If auto-select-same mode, should
10607 ;; select the first unread article.
10608 (gnus-summary-next-article t (and gnus-auto-select-same
10609 (gnus-summary-article-subject)))
10610 (gnus-message 7 "%d article%s marked as %s"
10611 count (if (= count 1) " is" "s are")
10612 (if unmark "unread" "read"))))
10614 (defun gnus-summary-kill-same-subject (&optional unmark)
10615 "Mark articles which has the same subject as read.
10616 If UNMARK is positive, remove any kind of mark.
10617 If UNMARK is negative, tick articles."
10620 (setq unmark (prefix-numeric-value unmark)))
10622 (gnus-summary-mark-same-subject
10623 (gnus-summary-article-subject) unmark)))
10624 ;; If marked as read, go to next unread subject.
10625 (when (null unmark)
10626 ;; Go to next unread subject.
10627 (gnus-summary-next-subject 1 t))
10628 (gnus-message 7 "%d articles are marked as %s"
10629 count (if unmark "unread" "read"))))
10631 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10632 "Mark articles with same SUBJECT as read, and return marked number.
10633 If optional argument UNMARK is positive, remove any kinds of marks.
10634 If optional argument UNMARK is negative, mark articles as unread instead."
10638 ((null unmark) ; Mark as read.
10641 (gnus-summary-mark-article-as-read gnus-killed-mark)
10642 (gnus-summary-show-thread) t)
10643 (gnus-summary-find-subject subject))
10644 (setq count (1+ count))))
10645 ((> unmark 0) ; Tick.
10648 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10649 (gnus-summary-show-thread) t)
10650 (gnus-summary-find-subject subject))
10651 (setq count (1+ count))))
10652 (t ; Mark as unread.
10655 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10656 (gnus-summary-show-thread) t)
10657 (gnus-summary-find-subject subject))
10658 (setq count (1+ count)))))
10659 (gnus-set-mode-line 'summary)
10660 ;; Return the number of marked articles.
10663 (defun gnus-summary-mark-as-processable (n &optional unmark)
10664 "Set the process mark on the next N articles.
10665 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10666 the process mark instead. The difference between N and the actual
10667 number of articles marked is returned."
10669 (if (and (null n) (gnus-region-active-p))
10670 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10671 (setq n (prefix-numeric-value n))
10672 (let ((backward (< n 0))
10677 (gnus-summary-remove-process-mark
10678 (gnus-summary-article-number))
10679 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10680 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10683 (gnus-message 7 "No more articles"))
10684 (gnus-summary-recenter)
10685 (gnus-summary-position-point)
10688 (defun gnus-summary-unmark-as-processable (n)
10689 "Remove the process mark from the next N articles.
10690 If N is negative, unmark backward instead. The difference between N and
10691 the actual number of articles unmarked is returned."
10693 (gnus-summary-mark-as-processable n t))
10695 (defun gnus-summary-unmark-all-processable ()
10696 "Remove the process mark from all articles."
10699 (while gnus-newsgroup-processable
10700 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10701 (gnus-summary-position-point))
10703 (defun gnus-summary-add-mark (article type)
10704 "Mark ARTICLE with a mark of TYPE."
10705 (let ((vtype (car (assq type gnus-article-mark-lists)))
10708 (error "No such mark type: %s" type)
10709 (setq var (intern (format "gnus-newsgroup-%s" type)))
10710 (set var (cons article (symbol-value var)))
10711 (if (memq type '(processable cached replied forwarded recent saved))
10712 (gnus-summary-update-secondary-mark article)
10713 ;;; !!! This is bogus. We should find out what primary
10714 ;;; !!! mark we want to set.
10715 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10717 (defun gnus-summary-mark-as-expirable (n)
10718 "Mark N articles forward as expirable.
10719 If N is negative, mark backward instead. The difference between N and
10720 the actual number of articles marked is returned."
10722 (gnus-summary-mark-forward n gnus-expirable-mark))
10724 (defun gnus-summary-mark-as-spam (n)
10725 "Mark N articles forward as spam.
10726 If N is negative, mark backward instead. The difference between N and
10727 the actual number of articles marked is returned."
10729 (gnus-summary-mark-forward n gnus-spam-mark))
10731 (defun gnus-summary-mark-article-as-replied (article)
10732 "Mark ARTICLE as replied to and update the summary line.
10733 ARTICLE can also be a list of articles."
10734 (interactive (list (gnus-summary-article-number)))
10735 (let ((articles (if (listp article) article (list article))))
10736 (dolist (article articles)
10737 (unless (numberp article)
10738 (error "%s is not a number" article))
10739 (push article gnus-newsgroup-replied)
10740 (let ((inhibit-read-only t))
10741 (when (gnus-summary-goto-subject article nil t)
10742 (gnus-summary-update-secondary-mark article))))))
10744 (defun gnus-summary-mark-article-as-forwarded (article)
10745 "Mark ARTICLE as forwarded and update the summary line.
10746 ARTICLE can also be a list of articles."
10747 (let ((articles (if (listp article) article (list article))))
10748 (dolist (article articles)
10749 (push article gnus-newsgroup-forwarded)
10750 (let ((inhibit-read-only t))
10751 (when (gnus-summary-goto-subject article nil t)
10752 (gnus-summary-update-secondary-mark article))))))
10754 (defun gnus-summary-set-bookmark (article)
10755 "Set a bookmark in current article."
10756 (interactive (list (gnus-summary-article-number)))
10757 (when (or (not (get-buffer gnus-article-buffer))
10758 (not gnus-current-article)
10759 (not gnus-article-current)
10760 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10761 (error "No current article selected"))
10762 ;; Remove old bookmark, if one exists.
10763 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10764 ;; Set the new bookmark, which is on the form
10765 ;; (article-number . line-number-in-body).
10768 (with-current-buffer gnus-article-buffer
10772 (article-goto-body)
10775 gnus-newsgroup-bookmarks)
10776 (gnus-message 6 "A bookmark has been added to the current article."))
10778 (defun gnus-summary-remove-bookmark (article)
10779 "Remove the bookmark from the current article."
10780 (interactive (list (gnus-summary-article-number)))
10781 ;; Remove old bookmark, if one exists.
10782 (if (not (assq article gnus-newsgroup-bookmarks))
10783 (gnus-message 6 "No bookmark in current article.")
10784 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10785 (gnus-message 6 "Removed bookmark.")))
10787 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10788 (defun gnus-summary-mark-as-dormant (n)
10789 "Mark N articles forward as dormant.
10790 If N is negative, mark backward instead. The difference between N and
10791 the actual number of articles marked is returned."
10793 (gnus-summary-mark-forward n gnus-dormant-mark))
10795 (defun gnus-summary-set-process-mark (article)
10796 "Set the process mark on ARTICLE and update the summary line."
10797 (setq gnus-newsgroup-processable
10799 (delq article gnus-newsgroup-processable)))
10800 (when (gnus-summary-goto-subject article)
10801 (gnus-summary-show-thread)
10802 (gnus-summary-goto-subject article)
10803 (gnus-summary-update-secondary-mark article)))
10805 (defun gnus-summary-remove-process-mark (&rest articles)
10806 "Remove the process mark from ARTICLES and update the summary line."
10807 (dolist (article articles)
10808 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10809 (when (gnus-summary-goto-subject article)
10810 (gnus-summary-show-thread)
10811 (gnus-summary-goto-subject article)
10812 (gnus-summary-update-secondary-mark article)))
10815 (defun gnus-summary-set-saved-mark (article)
10816 "Set the process mark on ARTICLE and update the summary line."
10817 (push article gnus-newsgroup-saved)
10818 (when (gnus-summary-goto-subject article)
10819 (gnus-summary-update-secondary-mark article)))
10821 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10822 "Mark N articles as read forwards.
10823 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10824 The difference between N and the actual number of articles marked is
10826 If NO-EXPIRE, auto-expiry will be inhibited."
10828 (gnus-summary-show-thread)
10829 (let ((backward (< n 0))
10830 (gnus-summary-goto-unread
10831 (and gnus-summary-goto-unread
10832 (not (eq gnus-summary-goto-unread 'never))
10833 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10834 gnus-ticked-mark gnus-dormant-mark)))))
10836 (mark (or mark gnus-del-mark)))
10837 (while (and (> n 0)
10838 (gnus-summary-mark-article nil mark no-expire)
10839 (zerop (gnus-summary-next-subject
10841 (and gnus-summary-goto-unread
10842 (not (eq gnus-summary-goto-unread 'never)))
10846 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10847 (gnus-summary-recenter)
10848 (gnus-summary-position-point)
10849 (gnus-set-mode-line 'summary)
10852 (defun gnus-summary-mark-article-as-read (mark)
10853 "Mark the current article quickly as read with MARK."
10854 (let ((article (gnus-summary-article-number)))
10855 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10856 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10857 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10858 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10859 (push (cons article mark) gnus-newsgroup-reads)
10860 ;; Possibly remove from cache, if that is used.
10861 (when gnus-use-cache
10862 (gnus-cache-enter-remove-article article))
10863 ;; Allow the backend to change the mark.
10864 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10865 ;; Check for auto-expiry.
10866 (when (and gnus-newsgroup-auto-expire
10867 (memq mark gnus-auto-expirable-marks))
10868 (setq mark gnus-expirable-mark)
10869 ;; Let the backend know about the mark change.
10870 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10871 (push article gnus-newsgroup-expirable))
10872 ;; Set the mark in the buffer.
10873 (gnus-summary-update-mark mark 'unread)
10876 (defun gnus-summary-mark-article-as-unread (mark)
10877 "Mark the current article quickly as unread with MARK."
10878 (let* ((article (gnus-summary-article-number))
10879 (old-mark (gnus-summary-article-mark article)))
10880 ;; Allow the backend to change the mark.
10881 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10882 (if (eq mark old-mark)
10886 (gnus-error 1 "Can't mark negative article numbers")
10888 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10889 (setq gnus-newsgroup-spam-marked
10890 (delq article gnus-newsgroup-spam-marked))
10891 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10892 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10893 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10894 (cond ((= mark gnus-ticked-mark)
10895 (setq gnus-newsgroup-marked
10896 (gnus-add-to-sorted-list gnus-newsgroup-marked
10898 ((= mark gnus-spam-mark)
10899 (setq gnus-newsgroup-spam-marked
10900 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10902 ((= mark gnus-dormant-mark)
10903 (setq gnus-newsgroup-dormant
10904 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10907 (setq gnus-newsgroup-unreads
10908 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10910 (gnus-alist-pull article gnus-newsgroup-reads)
10912 ;; See whether the article is to be put in the cache.
10913 (and gnus-use-cache
10914 (vectorp (gnus-summary-article-header article))
10916 (gnus-cache-possibly-enter-article
10917 gnus-newsgroup-name article
10918 (= mark gnus-ticked-mark)
10919 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10922 (gnus-summary-update-mark mark 'unread)
10925 (defun gnus-summary-mark-article (&optional article mark no-expire)
10926 "Mark ARTICLE with MARK. MARK can be any character.
10927 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10928 `??' (dormant) and `?E' (expirable).
10929 If MARK is nil, then the default character `?r' is used.
10930 If ARTICLE is nil, then the article on the current line will be
10932 If NO-EXPIRE, auto-expiry will be inhibited."
10933 ;; The mark might be a string.
10934 (when (stringp mark)
10935 (setq mark (aref mark 0)))
10936 ;; If no mark is given, then we check auto-expiring.
10938 (setq mark gnus-del-mark))
10939 (when (and (not no-expire)
10940 gnus-newsgroup-auto-expire
10941 (memq mark gnus-auto-expirable-marks))
10942 (setq mark gnus-expirable-mark))
10943 (let ((article (or article (gnus-summary-article-number)))
10944 (old-mark (gnus-summary-article-mark article)))
10945 ;; Allow the backend to change the mark.
10946 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10947 (if (eq mark old-mark)
10950 (error "No article on current line"))
10951 (if (not (if (or (= mark gnus-unread-mark)
10952 (= mark gnus-ticked-mark)
10953 (= mark gnus-spam-mark)
10954 (= mark gnus-dormant-mark))
10955 (gnus-mark-article-as-unread article mark)
10956 (gnus-mark-article-as-read article mark)))
10958 ;; See whether the article is to be put in the cache.
10959 (and gnus-use-cache
10960 (not (= mark gnus-canceled-mark))
10961 (vectorp (gnus-summary-article-header article))
10963 (gnus-cache-possibly-enter-article
10964 gnus-newsgroup-name article
10965 (= mark gnus-ticked-mark)
10966 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10968 (when (gnus-summary-goto-subject article nil t)
10969 (let ((inhibit-read-only t))
10970 (gnus-summary-show-thread)
10972 (gnus-summary-update-mark mark 'unread)
10975 (defun gnus-summary-update-secondary-mark (article)
10976 "Update the secondary (read, process, cache) mark."
10977 (gnus-summary-update-mark
10978 (cond ((memq article gnus-newsgroup-processable)
10980 ((memq article gnus-newsgroup-cached)
10982 ((memq article gnus-newsgroup-replied)
10984 ((memq article gnus-newsgroup-forwarded)
10985 gnus-forwarded-mark)
10986 ((memq article gnus-newsgroup-saved)
10988 ((memq article gnus-newsgroup-recent)
10990 ((memq article gnus-newsgroup-unseen)
10994 (when (gnus-visual-p 'summary-highlight 'highlight)
10995 (gnus-summary-highlight-line)
10996 (gnus-run-hooks 'gnus-summary-update-hook))
10999 (defun gnus-summary-update-download-mark (article)
11000 "Update the download mark."
11001 (gnus-summary-update-mark
11002 (cond ((memq article gnus-newsgroup-undownloaded)
11003 gnus-undownloaded-mark)
11004 (gnus-newsgroup-agentized
11005 gnus-downloaded-mark)
11009 (gnus-summary-update-line t)
11012 (defun gnus-summary-update-mark (mark type)
11013 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
11014 (inhibit-read-only t))
11015 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
11017 (when (looking-at "\r")
11019 (when (<= (+ forward (point)) (point-max))
11020 ;; Go to the right position on the line.
11021 (goto-char (+ forward (point)))
11022 ;; Replace the old mark with the new mark.
11024 (mm-subst-char-in-string
11026 (buffer-substring (point) (1+ (point))))))
11027 (delete-region (point) (1+ (point)))
11028 (insert to-insert))
11029 ;; Optionally update the marks by some user rule.
11030 (when (eq type 'unread)
11031 (gnus-data-set-mark
11032 (gnus-data-find (gnus-summary-article-number)) mark)
11033 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
11035 (defun gnus-mark-article-as-read (article &optional mark)
11036 "Enter ARTICLE in the pertinent lists and remove it from others."
11037 ;; Make the article expirable.
11038 (let ((mark (or mark gnus-del-mark)))
11039 (setq gnus-newsgroup-expirable
11040 (if (= mark gnus-expirable-mark)
11041 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
11042 (delq article gnus-newsgroup-expirable)))
11043 ;; Remove from unread and marked lists.
11044 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11045 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
11046 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
11047 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
11048 (push (cons article mark) gnus-newsgroup-reads)
11049 ;; Possibly remove from cache, if that is used.
11050 (when gnus-use-cache
11051 (gnus-cache-enter-remove-article article))
11054 (defun gnus-mark-article-as-unread (article &optional mark)
11055 "Enter ARTICLE in the pertinent lists and remove it from others."
11056 (let ((mark (or mark gnus-ticked-mark)))
11059 (gnus-error 1 "Can't mark negative article numbers")
11061 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
11062 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
11063 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
11064 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
11065 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11067 ;; Unsuppress duplicates?
11068 (when gnus-suppress-duplicates
11069 (gnus-dup-unsuppress-article article))
11071 (cond ((= mark gnus-ticked-mark)
11072 (setq gnus-newsgroup-marked
11073 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
11074 ((= mark gnus-spam-mark)
11075 (setq gnus-newsgroup-spam-marked
11076 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
11078 ((= mark gnus-dormant-mark)
11079 (setq gnus-newsgroup-dormant
11080 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
11082 (setq gnus-newsgroup-unreads
11083 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
11084 (gnus-alist-pull article gnus-newsgroup-reads)
11087 (defun gnus-summary-tick-article-forward (n)
11088 "Tick N articles forwards.
11089 If N is negative, tick backwards instead.
11090 The difference between N and the number of articles ticked is returned."
11092 (gnus-summary-mark-forward n gnus-ticked-mark))
11094 (defun gnus-summary-tick-article-backward (n)
11095 "Tick N articles backwards.
11096 The difference between N and the number of articles ticked is returned."
11098 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
11100 (defun gnus-summary-tick-article (&optional article clear-mark)
11101 "Mark current article as unread.
11102 Optional 1st argument ARTICLE specifies article number to be marked as unread.
11103 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
11105 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
11106 gnus-ticked-mark)))
11108 (defun gnus-summary-mark-as-read-forward (n)
11109 "Mark N articles as read forwards.
11110 If N is negative, mark backwards instead.
11111 The difference between N and the actual number of articles marked is
11114 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
11116 (defun gnus-summary-mark-as-read-backward (n)
11117 "Mark the N articles as read backwards.
11118 The difference between N and the actual number of articles marked is
11121 (gnus-summary-mark-forward
11122 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
11124 (defun gnus-summary-mark-as-read (&optional article mark)
11125 "Mark current article as read.
11126 ARTICLE specifies the article to be marked as read.
11127 MARK specifies a string to be inserted at the beginning of the line."
11128 (gnus-summary-mark-article article mark))
11130 (defun gnus-summary-clear-mark-forward (n)
11131 "Clear marks from N articles forward.
11132 If N is negative, clear backward instead.
11133 The difference between N and the number of marks cleared is returned."
11135 (gnus-summary-mark-forward n gnus-unread-mark))
11137 (defun gnus-summary-clear-mark-backward (n)
11138 "Clear marks from N articles backward.
11139 The difference between N and the number of marks cleared is returned."
11141 (gnus-summary-mark-forward (- n) gnus-unread-mark))
11143 (defun gnus-summary-mark-unread-as-read ()
11144 "Intended to be used by `gnus-mark-article-hook'."
11145 (when (memq gnus-current-article gnus-newsgroup-unreads)
11146 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
11148 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
11149 "Intended to be used by `gnus-mark-article-hook'."
11150 (let ((mark (gnus-summary-article-mark)))
11151 (when (or (gnus-unread-mark-p mark)
11152 (gnus-read-mark-p mark))
11153 (gnus-summary-mark-article gnus-current-article
11154 (or new-mark gnus-read-mark)))))
11156 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
11157 "Intended to be used by `gnus-mark-article-hook'."
11158 (let ((mark (gnus-summary-article-mark)))
11159 (when (or (gnus-unread-mark-p mark)
11160 (gnus-read-mark-p mark))
11161 (gnus-summary-mark-article (gnus-summary-article-number)
11162 (or new-mark gnus-read-mark)))))
11164 (defun gnus-summary-mark-unread-as-ticked ()
11165 "Intended to be used by `gnus-mark-article-hook'."
11166 (when (memq gnus-current-article gnus-newsgroup-unreads)
11167 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
11169 (defun gnus-summary-mark-region-as-read (point mark all)
11170 "Mark all unread articles between point and mark as read.
11171 If given a prefix, mark all articles between point and mark as read,
11172 even ticked and dormant ones."
11173 (interactive "r\nP")
11177 (beginning-of-line)
11182 (memq (setq article (gnus-summary-article-number))
11183 gnus-newsgroup-unreads))
11184 (gnus-summary-mark-article article gnus-del-mark))
11186 (gnus-summary-find-next))))))
11188 (defun gnus-summary-mark-below (score mark)
11189 "Mark articles with score less than SCORE with MARK."
11190 (interactive "P\ncMark: ")
11191 (setq score (if score
11192 (prefix-numeric-value score)
11193 (or gnus-summary-default-score 0)))
11194 (with-current-buffer gnus-summary-buffer
11195 (goto-char (point-min))
11198 (and (< (gnus-summary-article-score) score)
11199 (gnus-summary-mark-article nil mark))
11200 (gnus-summary-find-next)))))
11202 (defun gnus-summary-kill-below (&optional score)
11203 "Mark articles with score below SCORE as read."
11205 (gnus-summary-mark-below score gnus-killed-mark))
11207 (defun gnus-summary-clear-above (&optional score)
11208 "Clear all marks from articles with score above SCORE."
11210 (gnus-summary-mark-above score gnus-unread-mark))
11212 (defun gnus-summary-tick-above (&optional score)
11213 "Tick all articles with score above SCORE."
11215 (gnus-summary-mark-above score gnus-ticked-mark))
11217 (defun gnus-summary-mark-above (score mark)
11218 "Mark articles with score over SCORE with MARK."
11219 (interactive "P\ncMark: ")
11220 (setq score (if score
11221 (prefix-numeric-value score)
11222 (or gnus-summary-default-score 0)))
11223 (with-current-buffer gnus-summary-buffer
11224 (goto-char (point-min))
11226 (when (> (gnus-summary-article-score) score)
11227 (gnus-summary-mark-article nil mark))
11229 (gnus-summary-find-next)))))
11231 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
11232 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
11233 (defun gnus-summary-limit-include-expunged (&optional no-error)
11234 "Display all the hidden articles that were expunged for low scores."
11236 (let ((inhibit-read-only t))
11237 (let ((scored gnus-newsgroup-scored)
11240 (unless (gnus-summary-article-header (caar scored))
11241 (and (setq h (gnus-number-to-header (caar scored)))
11242 (< (cdar scored) gnus-summary-expunge-below)
11244 (setq scored (cdr scored)))
11246 (when (not no-error)
11247 (error "No expunged articles hidden"))
11248 (goto-char (point-min))
11249 (push gnus-newsgroup-limit gnus-newsgroup-limits)
11250 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
11251 (dolist (x headers)
11252 (push (mail-header-number x) gnus-newsgroup-limit))
11253 (gnus-summary-prepare-unthreaded (nreverse headers))
11254 (goto-char (point-min))
11255 (gnus-summary-position-point)
11258 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
11259 "Mark all unread articles in this newsgroup as read.
11260 If prefix argument ALL is non-nil, ticked and dormant articles will
11261 also be marked as read.
11262 If QUIETLY is non-nil, no questions will be asked.
11264 If TO-HERE is non-nil, it should be a point in the buffer. All
11265 articles before (after, if REVERSE is set) this point will be marked
11268 Note that this function will only catch up the unread article
11269 in the current summary buffer limitation.
11271 The number of articles marked as read is returned."
11276 (not gnus-interactive-catchup) ;Without confirmation?
11280 "Mark absolutely all articles as read? "
11281 "Mark all unread articles as read? ")))
11283 (not gnus-newsgroup-adaptive)
11284 (not gnus-newsgroup-auto-expire)
11285 (not gnus-suppress-duplicates)
11286 (or (not gnus-use-cache)
11287 (eq gnus-use-cache 'passive)))
11290 (setq gnus-newsgroup-marked nil
11291 gnus-newsgroup-spam-marked nil
11292 gnus-newsgroup-dormant nil))
11293 (setq gnus-newsgroup-unreads
11294 (gnus-sorted-nunion
11295 (gnus-sorted-intersection gnus-newsgroup-unreads
11296 gnus-newsgroup-downloadable)
11297 (gnus-sorted-difference gnus-newsgroup-unfetched
11298 gnus-newsgroup-cached))))
11299 ;; We actually mark all articles as canceled, which we
11300 ;; have to do when using auto-expiry or adaptive scoring.
11301 (gnus-summary-show-all-threads)
11302 (if (and to-here reverse)
11304 (goto-char to-here)
11305 (gnus-summary-mark-current-read-and-unread-as-read
11307 (while (gnus-summary-find-next (not all))
11308 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
11309 (when (gnus-summary-first-subject (not all))
11311 (if to-here (< (point) to-here) t)
11312 (gnus-summary-mark-article-as-read gnus-catchup-mark)
11313 (gnus-summary-find-next (not all))))))
11314 (gnus-set-mode-line 'summary))
11316 (gnus-summary-position-point)))
11318 (defun gnus-summary-catchup-to-here (&optional all)
11319 "Mark all unticked articles before the current one as read.
11320 If ALL is non-nil, also mark ticked and dormant articles as read."
11323 (gnus-save-hidden-threads
11324 (let ((beg (point)))
11325 ;; We check that there are unread articles.
11326 (when (or all (gnus-summary-find-prev))
11327 (gnus-summary-catchup all t beg)))))
11328 (gnus-summary-position-point))
11330 (defun gnus-summary-catchup-from-here (&optional all)
11331 "Mark all unticked articles after (and including) the current one as read.
11332 If ALL is non-nil, also mark ticked and dormant articles as read."
11335 (gnus-save-hidden-threads
11336 (let ((beg (point)))
11337 ;; We check that there are unread articles.
11338 (when (or all (gnus-summary-find-next))
11339 (gnus-summary-catchup all t beg nil t)))))
11340 (gnus-summary-position-point))
11342 (defun gnus-summary-catchup-all (&optional quietly)
11343 "Mark all articles in this newsgroup as read.
11344 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11345 instead, which marks only unread articles as read."
11347 (gnus-summary-catchup t quietly))
11349 (defun gnus-summary-catchup-and-exit (&optional all quietly)
11350 "Mark all unread articles in this group as read, then exit.
11351 If prefix argument ALL is non-nil, all articles are marked as read.
11352 If QUIETLY is non-nil, no questions will be asked."
11354 (when (gnus-summary-catchup all quietly nil 'fast)
11355 ;; Select next newsgroup or exit.
11356 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
11357 (eq gnus-auto-select-next 'quietly))
11358 (gnus-summary-next-group nil)
11359 (gnus-summary-exit))))
11361 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
11362 "Mark all articles in this newsgroup as read, and then exit.
11363 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11364 instead, which marks only unread articles as read."
11366 (gnus-summary-catchup-and-exit t quietly))
11368 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
11369 "Mark all articles in this group as read and select the next group.
11370 If given a prefix, mark all articles, unread as well as ticked, as
11374 (gnus-summary-catchup all))
11375 (gnus-summary-next-group))
11377 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
11378 "Mark all articles in this group as read and select the previous group.
11379 If given a prefix, mark all articles, unread as well as ticked, as
11383 (gnus-summary-catchup all))
11384 (gnus-summary-next-group nil nil t))
11390 (defmacro gnus-with-article (article &rest forms)
11391 "Select ARTICLE and perform FORMS in the original article buffer.
11392 Then replace the article with the result."
11394 ;; We don't want the article to be marked as read.
11395 (let (gnus-mark-article-hook)
11396 (gnus-summary-select-article t t nil ,article))
11397 (set-buffer gnus-original-article-buffer)
11399 (if (not (gnus-check-backend-function
11400 'request-replace-article (car gnus-article-current)))
11401 (gnus-message 5 "Read-only group; not replacing")
11402 (unless (gnus-request-replace-article
11403 ,article (car gnus-article-current)
11404 (current-buffer) t)
11405 (error "Couldn't replace article")))
11406 ;; The cache and backlog have to be flushed somewhat.
11407 (when gnus-keep-backlog
11408 (gnus-backlog-remove-article
11409 (car gnus-article-current) (cdr gnus-article-current)))
11410 (when gnus-use-cache
11411 (gnus-cache-update-article
11412 (car gnus-article-current) (cdr gnus-article-current)))))
11414 (put 'gnus-with-article 'lisp-indent-function 1)
11415 (put 'gnus-with-article 'edebug-form-spec '(form body))
11417 ;; Thread-based commands.
11419 (defun gnus-summary-articles-in-thread (&optional article)
11420 "Return a list of all articles in the current thread.
11421 If ARTICLE is non-nil, return all articles in the thread that starts
11422 with that article."
11423 (let* ((article (or article (gnus-summary-article-number)))
11424 (data (gnus-data-find-list article))
11425 (top-level (gnus-data-level (car data)))
11427 (cond ((null gnus-thread-operation-ignore-subject)
11428 (gnus-simplify-subject-re
11429 (mail-header-subject (gnus-data-header (car data)))))
11430 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
11431 (gnus-simplify-subject-fuzzy
11432 (mail-header-subject (gnus-data-header (car data)))))
11434 (end-point (save-excursion
11435 (goto-char (gnus-data-pos (car data)))
11436 (if (gnus-summary-go-to-next-thread)
11437 (point) (point-max))))
11440 (< (gnus-data-pos (car data)) end-point))
11441 (when (or (not top-subject)
11442 (string= top-subject
11443 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11444 (gnus-simplify-subject-fuzzy
11445 (mail-header-subject
11446 (gnus-data-header (car data))))
11447 (gnus-simplify-subject-re
11448 (mail-header-subject
11449 (gnus-data-header (car data)))))))
11450 (push (gnus-data-number (car data)) articles))
11451 (unless (and (setq data (cdr data))
11452 (> (gnus-data-level (car data)) top-level))
11454 ;; Return the list of articles.
11455 (nreverse articles)))
11457 (defun gnus-summary-rethread-current ()
11458 "Rethread the thread the current article is part of."
11460 (let* ((gnus-show-threads t)
11461 (article (gnus-summary-article-number))
11462 (id (mail-header-id (gnus-summary-article-header)))
11463 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11465 (error "No article on the current line"))
11466 (gnus-rebuild-thread id)
11467 (gnus-summary-goto-subject article)))
11469 (defun gnus-summary-reparent-thread ()
11470 "Make the current article child of the marked (or previous) article.
11472 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11473 is non-nil or the Subject: of both articles are the same."
11475 (unless (not (gnus-group-read-only-p))
11476 (error "The current newsgroup does not support article editing"))
11477 (unless (<= (length gnus-newsgroup-processable) 1)
11478 (error "No more than one article may be marked"))
11479 (let ((child (gnus-summary-article-number))
11480 ;; First grab the marked article, otherwise one line up.
11481 (parent (if (not (null gnus-newsgroup-processable))
11482 (car gnus-newsgroup-processable)
11484 (if (eq (forward-line -1) 0)
11485 (gnus-summary-article-number)
11486 (error "Beginning of summary buffer"))))))
11487 (gnus-summary-reparent-children parent (list child))))
11489 (defun gnus-summary-reparent-children (parent children)
11490 "Make PARENT the parent of CHILDREN.
11491 When called interactively, PARENT is the current article and CHILDREN
11492 are the process-marked articles."
11494 (list (gnus-summary-article-number)
11495 (gnus-summary-work-articles nil)))
11496 (dolist (child children)
11497 (save-window-excursion
11498 (let ((gnus-article-buffer " *reparent*"))
11499 (unless (not (eq parent child))
11500 (error "An article may not be self-referential"))
11501 (let ((message-id (mail-header-id
11502 (gnus-summary-article-header parent))))
11503 (unless (and message-id (not (equal message-id "")))
11504 (error "No message-id in desired parent"))
11505 (gnus-with-article child
11507 (goto-char (point-min))
11508 (message-narrow-to-head)
11509 (if (re-search-forward "^References: " nil t)
11511 (re-search-forward "^[^ \t]" nil t)
11514 (insert " " message-id))
11515 (insert "References: " message-id "\n"))))
11516 (set-buffer gnus-summary-buffer)
11517 (gnus-summary-unmark-all-processable)
11518 (gnus-summary-update-article child)
11519 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11520 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11521 (gnus-summary-rethread-current)
11522 (gnus-message 3 "Article %d is now the child of article %d"
11525 (defun gnus-summary-toggle-threads (&optional arg)
11526 "Toggle showing conversation threads.
11527 If ARG is positive number, turn showing conversation threads on."
11529 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11530 (setq gnus-show-threads
11531 (if (null arg) (not gnus-show-threads)
11532 (> (prefix-numeric-value arg) 0)))
11533 (gnus-summary-prepare)
11534 (gnus-summary-goto-subject current)
11535 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11536 (gnus-summary-position-point)))
11539 (if (fboundp 'remove-overlays)
11540 (defalias 'gnus-remove-overlays 'remove-overlays)
11541 (defun gnus-remove-overlays (beg end name val)
11542 "Clear BEG and END of overlays whose property NAME has value VAL.
11543 For compatibility with XEmacs."
11544 (dolist (ov (gnus-overlays-in beg end))
11545 (when (eq (gnus-overlay-get ov name) val)
11546 (gnus-delete-overlay ov))))))
11548 (defun gnus-summary-show-all-threads ()
11549 "Show all threads."
11551 (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
11552 (gnus-summary-position-point))
11554 (defsubst gnus-summary--inv (p)
11555 (and (eq (get-char-property p 'invisible) 'gnus-sum) p))
11557 (defun gnus-summary-show-thread ()
11558 "Show thread subtrees.
11559 Returns nil if no thread was there to be shown."
11561 (let* ((orig (point))
11562 (end (point-at-eol))
11563 (end (or (gnus-summary--inv end) (gnus-summary--inv (1- end))))
11564 ;; Leave point at bol
11565 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11567 (if (fboundp 'next-single-char-property-change)
11568 (or (next-single-char-property-change end 'invisible)
11573 (eq (get-char-property (point) 'invisible)
11577 (gnus-remove-overlays beg eoi 'invisible 'gnus-sum)
11579 (gnus-summary-position-point)
11582 (defun gnus-summary-maybe-hide-threads ()
11583 "If requested, hide the threads that should be hidden."
11584 (when (and gnus-show-threads
11585 gnus-thread-hide-subtree)
11586 (gnus-summary-hide-all-threads
11587 (if (or (consp gnus-thread-hide-subtree)
11588 (functionp gnus-thread-hide-subtree))
11589 (gnus-make-predicate gnus-thread-hide-subtree)
11592 ;;; Hiding predicates.
11594 (defun gnus-article-unread-p (header)
11595 (memq (mail-header-number header) gnus-newsgroup-unreads))
11597 (defun gnus-article-unseen-p (header)
11598 (memq (mail-header-number header) gnus-newsgroup-unseen))
11600 (defun gnus-map-articles (predicate articles)
11601 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11602 (apply 'gnus-or (mapcar predicate
11603 (mapcar (lambda (number)
11604 (gnus-summary-article-header number))
11607 (defun gnus-summary-hide-all-threads (&optional predicate)
11608 "Hide all thread subtrees.
11609 If PREDICATE is supplied, threads that satisfy this predicate
11610 will not be hidden."
11613 (goto-char (point-min))
11618 (when (zerop (mod count 1000))
11619 (message "Hiding all threads... %d" count))
11620 (when (or (not predicate)
11622 predicate (gnus-summary-article-children)))
11623 (gnus-summary-hide-thread))
11624 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11625 (gnus-summary-position-point))
11627 (defun gnus-summary-hide-thread ()
11628 "Hide thread subtrees.
11629 If PREDICATE is supplied, threads that satisfy this predicate
11630 will not be hidden.
11631 Returns nil if no threads were there to be hidden."
11633 (let ((start (point))
11634 (starteol (line-end-position))
11635 (article (gnus-summary-article-number)))
11637 ;; Go forward until either the buffer ends or the subthread ends.
11638 (when (and (not (eobp))
11639 (or (zerop (gnus-summary-next-thread 1 t))
11640 (goto-char (point-max))))
11641 (if (and (> (point) start)
11642 ;; FIXME: this should actually search for a non-invisible \n.
11643 (search-backward "\n" start t))
11645 (when (> (point) starteol)
11646 (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum)
11647 (let ((ol (gnus-make-overlay starteol (point) nil t nil)))
11648 (gnus-overlay-put ol 'invisible 'gnus-sum)
11649 (gnus-overlay-put ol 'evaporate t)))
11650 (gnus-summary-goto-subject article)
11651 (when (> start (point))
11652 (message "Hiding the thread moved us backwards, aborting!")
11653 (goto-char (point-max))))
11657 (defun gnus-summary-go-to-next-thread (&optional previous)
11658 "Go to the same level (or less) next thread.
11659 If PREVIOUS is non-nil, go to previous thread instead.
11660 Return the article number moved to, or nil if moving was impossible."
11661 (let ((level (gnus-summary-thread-level))
11662 (way (if previous -1 1))
11665 (while (and (not (eobp))
11666 (< level (gnus-summary-thread-level)))
11667 (forward-line way))
11674 (gnus-summary-article-number)
11675 (goto-char beg)))))
11677 (defun gnus-summary-next-thread (n &optional silent)
11678 "Go to the same level next N'th thread.
11679 If N is negative, search backward instead.
11680 Returns the difference between N and the number of skips actually
11683 If SILENT, don't output messages."
11685 (let ((backward (< n 0))
11687 (while (and (> n 0)
11688 (gnus-summary-go-to-next-thread backward))
11691 (gnus-summary-position-point))
11692 (when (and (not silent) (/= 0 n))
11693 (gnus-message 7 "No more threads"))
11696 (defun gnus-summary-prev-thread (n)
11697 "Go to the same level previous N'th thread.
11698 Returns the difference between N and the number of skips actually
11701 (gnus-summary-next-thread (- n)))
11703 (defun gnus-summary-go-down-thread ()
11704 "Go down one level in the current thread."
11705 (let ((children (gnus-summary-article-children)))
11707 (gnus-summary-goto-subject (car children)))))
11709 (defun gnus-summary-go-up-thread ()
11710 "Go up one level in the current thread."
11711 (let ((parent (gnus-summary-article-parent)))
11713 (gnus-summary-goto-subject parent))))
11715 (defun gnus-summary-down-thread (n)
11716 "Go down thread N steps.
11717 If N is negative, go up instead.
11718 Returns the difference between N and how many steps down that were
11723 (while (and (> n 0)
11724 (if up (gnus-summary-go-up-thread)
11725 (gnus-summary-go-down-thread)))
11727 (gnus-summary-position-point)
11729 (gnus-message 7 "Can't go further"))
11732 (defun gnus-summary-up-thread (n)
11733 "Go up thread N steps.
11734 If N is negative, go down instead.
11735 Returns the difference between N and how many steps down that were
11738 (gnus-summary-down-thread (- n)))
11740 (defun gnus-summary-top-thread ()
11741 "Go to the top of the thread."
11743 (while (gnus-summary-go-up-thread))
11744 (gnus-summary-article-number))
11746 (defun gnus-summary-expire-thread ()
11747 "Mark articles under current thread as expired."
11749 (gnus-summary-kill-thread 0))
11751 (defun gnus-summary-kill-thread (&optional unmark)
11752 "Mark articles under current thread as read.
11753 If the prefix argument is positive, remove any kinds of marks.
11754 If the prefix argument is zero, mark thread as expired.
11755 If the prefix argument is negative, tick articles instead."
11758 (setq unmark (prefix-numeric-value unmark)))
11759 (let ((articles (gnus-summary-articles-in-thread))
11760 (hide (or (null unmark) (= unmark 0))))
11762 ;; Expand the thread.
11763 (gnus-summary-show-thread)
11764 ;; Mark all the articles.
11766 (gnus-summary-goto-subject (car articles))
11767 (cond ((null unmark)
11768 (gnus-summary-mark-article-as-read gnus-killed-mark))
11770 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11772 (gnus-summary-mark-article nil gnus-expirable-mark))
11774 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11775 (setq articles (cdr articles))))
11776 ;; Hide killed subtrees when hide is true.
11778 gnus-thread-hide-killed
11779 (gnus-summary-hide-thread))
11780 ;; If hide is t, go to next unread subject.
11782 ;; Go to next unread subject.
11783 (gnus-summary-next-subject 1 t)))
11784 (gnus-set-mode-line 'summary))
11786 ;; Summary sorting commands
11788 (defun gnus-summary-sort-by-number (&optional reverse)
11789 "Sort the summary buffer by article number.
11790 Argument REVERSE means reverse order."
11792 (gnus-summary-sort 'number reverse))
11794 (defun gnus-summary-sort-by-most-recent-number (&optional reverse)
11795 "Sort the summary buffer by most recent article number.
11796 Argument REVERSE means reverse order."
11798 (gnus-summary-sort 'most-recent-number reverse))
11800 (defun gnus-summary-sort-by-random (&optional reverse)
11801 "Randomize the order in the summary buffer.
11802 Argument REVERSE means to randomize in reverse order."
11804 (gnus-summary-sort 'random reverse))
11806 (defun gnus-summary-sort-by-author (&optional reverse)
11807 "Sort the summary buffer by author name alphabetically.
11808 If `case-fold-search' is non-nil, case of letters is ignored.
11809 Argument REVERSE means reverse order."
11811 (gnus-summary-sort 'author reverse))
11813 (defun gnus-summary-sort-by-recipient (&optional reverse)
11814 "Sort the summary buffer by recipient name alphabetically.
11815 If `case-fold-search' is non-nil, case of letters is ignored.
11816 Argument REVERSE means reverse order."
11818 (gnus-summary-sort 'recipient reverse))
11820 (defun gnus-summary-sort-by-subject (&optional reverse)
11821 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11822 If `case-fold-search' is non-nil, case of letters is ignored.
11823 Argument REVERSE means reverse order."
11825 (gnus-summary-sort 'subject reverse))
11827 (defun gnus-summary-sort-by-date (&optional reverse)
11828 "Sort the summary buffer by date.
11829 Argument REVERSE means reverse order."
11831 (gnus-summary-sort 'date reverse))
11833 (defun gnus-summary-sort-by-most-recent-date (&optional reverse)
11834 "Sort the summary buffer by most recent date.
11835 Argument REVERSE means reverse order."
11837 (gnus-summary-sort 'most-recent-date reverse))
11839 (defun gnus-summary-sort-by-score (&optional reverse)
11840 "Sort the summary buffer by score.
11841 Argument REVERSE means reverse order."
11843 (gnus-summary-sort 'score reverse))
11845 (defun gnus-summary-sort-by-lines (&optional reverse)
11846 "Sort the summary buffer by the number of lines.
11847 Argument REVERSE means reverse order."
11849 (gnus-summary-sort 'lines reverse))
11851 (defun gnus-summary-sort-by-chars (&optional reverse)
11852 "Sort the summary buffer by article length.
11853 Argument REVERSE means reverse order."
11855 (gnus-summary-sort 'chars reverse))
11857 (defun gnus-summary-sort-by-original (&optional reverse)
11858 "Sort the summary buffer using the default sorting method.
11859 Argument REVERSE means reverse order."
11861 (let* ((inhibit-read-only t)
11862 (gnus-summary-prepare-hook nil))
11863 ;; We do the sorting by regenerating the threads.
11864 (gnus-summary-prepare)
11865 ;; Hide subthreads if needed.
11866 (gnus-summary-maybe-hide-threads)))
11868 (defun gnus-summary-sort (predicate reverse)
11869 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11870 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11871 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11872 (gnus-thread-sort-functions
11877 (gnus-sort-gathered-threads-function
11878 gnus-thread-sort-functions)
11879 (gnus-article-sort-functions
11883 (,article t2 t1))))
11884 (inhibit-read-only t)
11885 (gnus-summary-prepare-hook nil))
11886 ;; We do the sorting by regenerating the threads.
11887 (gnus-summary-prepare)
11888 ;; Hide subthreads if needed.
11889 (gnus-summary-maybe-hide-threads)))
11891 ;; Summary saving commands.
11893 (defun gnus-summary-save-article (&optional n not-saved)
11894 "Save the current article using the default saver function.
11895 If N is a positive number, save the N next articles.
11896 If N is a negative number, save the N previous articles.
11897 If N is nil and any articles have been marked with the process mark,
11898 save those articles instead.
11899 The variable `gnus-default-article-saver' specifies the saver function.
11901 If the optional second argument NOT-SAVED is non-nil, articles saved
11902 will not be marked as saved."
11904 (require 'gnus-art)
11905 (let* ((articles (gnus-summary-work-articles n))
11906 (save-buffer (save-excursion
11907 (nnheader-set-temp-buffer " *Gnus Save*")))
11908 (num (length articles))
11909 ;; Whether to save decoded articles or raw articles.
11910 (decode (when gnus-article-save-coding-system
11911 (get gnus-default-article-saver :decode)))
11912 ;; When saving many articles in a single file, use the other
11913 ;; function to save articles other than the first one.
11914 (saver2 (get gnus-default-article-saver :function))
11915 (gnus-prompt-before-saving (if saver2
11917 gnus-prompt-before-saving))
11918 (gnus-default-article-saver gnus-default-article-saver)
11920 (dolist (article articles)
11921 (setq header (gnus-summary-article-header article))
11922 (if (not (vectorp header))
11923 ;; This is a pseudo-article.
11924 (if (assq 'name header)
11925 (gnus-copy-file (cdr (assq 'name header)))
11926 (gnus-message 1 "Article %d is unsaveable" article))
11927 ;; This is a real article.
11928 (save-window-excursion
11929 (gnus-summary-select-article decode decode nil article)
11930 (gnus-summary-goto-subject article))
11931 (with-current-buffer save-buffer
11933 (insert-buffer-substring (if decode
11934 gnus-article-buffer
11935 gnus-original-article-buffer)))
11936 (setq file (gnus-article-save save-buffer file num))
11937 (gnus-summary-remove-process-mark article)
11939 (gnus-summary-set-saved-mark article)))
11941 (setq gnus-default-article-saver saver2
11943 (gnus-kill-buffer save-buffer)
11944 (gnus-summary-position-point)
11945 (gnus-set-mode-line 'summary)
11948 (defun gnus-summary-pipe-output (&optional n sym)
11949 "Pipe the current article to a subprocess.
11950 If N is a positive number, pipe the N next articles.
11951 If N is a negative number, pipe the N previous articles.
11952 If N is nil and any articles have been marked with the process mark,
11953 pipe those articles instead.
11954 The default command to which articles are piped is specified by the
11955 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
11956 will be prompted for the command.
11958 The properties `:decode' and `:headers' that are put to the function
11959 symbol `gnus-summary-save-in-pipe' control whether this function
11960 decodes articles and what headers to keep (see the doc string for the
11961 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
11962 is neither omitted nor the symbol `r', force including all headers
11963 regardless of the `:headers' property. If it is the symbol `r',
11964 articles that are not decoded and include all headers will be piped
11965 no matter what the properties `:decode' and `:headers' are."
11966 (interactive (gnus-interactive "P\ny"))
11967 (require 'gnus-art)
11968 (let* ((articles (gnus-summary-work-articles n))
11969 (result-buffer "*Shell Command Output*")
11970 (all-headers (not (memq sym '(nil r))))
11971 (gnus-save-all-headers (or all-headers gnus-save-all-headers))
11973 (headers (get 'gnus-summary-save-in-pipe :headers))
11975 (unless (numberp (car articles))
11976 (error "No article to pipe"))
11977 (setq command (gnus-read-shell-command
11978 (concat "Shell command on "
11980 (format "these %d articles" (length articles))
11983 gnus-summary-pipe-output-default-command))
11984 (when (string-equal command "")
11985 (error "A command is required"))
11987 (put 'gnus-summary-save-in-pipe :headers nil))
11990 (gnus-summary-goto-subject (pop articles))
11991 (save-window-excursion (gnus-summary-save-in-pipe command raw))
11992 (when (and (get-buffer result-buffer)
11993 (not (zerop (buffer-size (get-buffer result-buffer)))))
11994 (setq result (concat result (with-current-buffer result-buffer
11995 (buffer-string))))))
11996 (put 'gnus-summary-save-in-pipe :headers headers))
11997 (unless (zerop (length result))
11998 (if (with-current-buffer (get-buffer-create result-buffer)
12002 (and (= (count-lines (point-min) (point)) 1)
12005 (<= (current-column)
12006 (window-width (minibuffer-window)))))
12007 (goto-char (point-min))))
12008 (message "%s" (substring result 0 -1))
12010 (gnus-configure-windows 'pipe)))))
12012 (defun gnus-summary-save-article-mail (&optional arg)
12013 "Append the current article to a Unix mail box file.
12014 If N is a positive number, save the N next articles.
12015 If N is a negative number, save the N previous articles.
12016 If N is nil and any articles have been marked with the process mark,
12017 save those articles instead."
12019 (require 'gnus-art)
12020 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
12021 (gnus-summary-save-article arg)))
12023 (defun gnus-summary-save-article-rmail (&optional arg)
12024 "Append the current article to an rmail file.
12025 If N is a positive number, save the N next articles.
12026 If N is a negative number, save the N previous articles.
12027 If N is nil and any articles have been marked with the process mark,
12028 save those articles instead."
12030 (require 'gnus-art)
12031 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
12032 (gnus-summary-save-article arg)))
12034 (defun gnus-summary-save-article-file (&optional arg)
12035 "Append the current article to a file.
12036 If N is a positive number, save the N next articles.
12037 If N is a negative number, save the N previous articles.
12038 If N is nil and any articles have been marked with the process mark,
12039 save those articles instead."
12041 (require 'gnus-art)
12042 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
12043 (gnus-summary-save-article arg)))
12045 (defun gnus-summary-write-article-file (&optional arg)
12046 "Write the current article to a file, deleting the previous file.
12047 If N is a positive number, save the N next articles.
12048 If N is a negative number, save the N previous articles.
12049 If N is nil and any articles have been marked with the process mark,
12050 save those articles instead."
12052 (require 'gnus-art)
12053 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
12054 (gnus-summary-save-article arg)))
12056 (defun gnus-summary-save-article-body-file (&optional arg)
12057 "Append the current article body to a file.
12058 If N is a positive number, save the N next articles.
12059 If N is a negative number, save the N previous articles.
12060 If N is nil and any articles have been marked with the process mark,
12061 save those articles instead."
12063 (require 'gnus-art)
12064 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
12065 (gnus-summary-save-article arg)))
12067 (defun gnus-summary-write-article-body-file (&optional arg)
12068 "Write the current article body to a file, deleting the previous file.
12069 If N is a positive number, save the N next articles.
12070 If N is a negative number, save the N previous articles.
12071 If N is nil and any articles have been marked with the process mark,
12072 save those articles instead."
12074 (require 'gnus-art)
12075 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
12076 (gnus-summary-save-article arg)))
12078 (defun gnus-summary-muttprint (&optional arg)
12079 "Print the current article using Muttprint.
12080 If N is a positive number, save the N next articles.
12081 If N is a negative number, save the N previous articles.
12082 If N is nil and any articles have been marked with the process mark,
12083 save those articles instead."
12085 (require 'gnus-art)
12086 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
12087 (gnus-summary-save-article arg t)))
12089 (defun gnus-summary-pipe-message (program)
12090 "Pipe the current article through PROGRAM."
12091 (interactive "sProgram: ")
12092 (gnus-summary-select-article)
12093 (let ((mail-header-separator ""))
12094 (gnus-eval-in-buffer-window gnus-article-buffer
12097 (let ((start (window-start))
12098 (inhibit-read-only t))
12099 (message-pipe-buffer-body program)
12100 (set-window-start (get-buffer-window (current-buffer)) start))))))
12102 (defun gnus-get-split-value (methods)
12103 "Return a value based on the split METHODS."
12104 (let (split-name method result match)
12106 (with-current-buffer gnus-original-article-buffer
12108 (nnheader-narrow-to-headers)
12109 (while (and methods (not split-name))
12110 (goto-char (point-min))
12111 (setq method (pop methods))
12112 (setq match (car method))
12115 ;; Regular expression.
12117 (re-search-forward match nil t)))
12122 (setq result (funcall match gnus-newsgroup-name))))
12127 (setq result (eval match)))))
12128 (setq split-name (cdr method))
12129 (cond ((stringp result)
12130 (push (expand-file-name
12131 result gnus-article-save-directory)
12134 (setq split-name (append result split-name)))))))))
12135 (nreverse split-name)))
12137 (defun gnus-valid-move-group-p (group)
12138 (and (symbolp group)
12140 (symbol-name group)
12141 (symbol-value group)
12142 (gnus-get-function (gnus-find-method-for-group
12143 (symbol-name group)) 'request-accept-article t)))
12145 (defun gnus-read-move-group-name (prompt default articles prefix)
12146 "Read a group name."
12147 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
12148 (minibuffer-confirm-incomplete nil) ; XEmacs
12152 (if (> (length articles) 1)
12153 (format "these %d articles" (length articles))
12158 (gnus-group-completing-read
12160 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12161 nil prefix nil default))
12162 ((= 1 (length split-name))
12163 (gnus-group-completing-read
12165 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12166 nil prefix 'gnus-group-history (car split-name)))
12168 (gnus-completing-read
12169 prom (nreverse split-name) nil nil 'gnus-group-history))))
12170 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
12173 (if (or (string= to-newsgroup "")
12174 (string= to-newsgroup prefix))
12175 (setq to-newsgroup default))
12176 (unless to-newsgroup
12177 (error "No group name entered"))
12178 (setq encoded (mm-encode-coding-string
12180 (gnus-group-name-charset to-method to-newsgroup)))
12181 (or (gnus-active encoded)
12182 (gnus-activate-group encoded nil nil to-method)
12183 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
12185 (or (and (gnus-request-create-group encoded to-method)
12186 (gnus-activate-group encoded nil nil to-method)
12187 (gnus-subscribe-group encoded))
12188 (error "Couldn't create group %s" to-newsgroup)))
12189 (error "No such group: %s" to-newsgroup))
12192 (defvar gnus-summary-save-parts-counter)
12193 (declare-function mm-uu-dissect "mm-uu" (&optional noheader mime-type))
12195 (defun gnus-summary-save-parts (type dir n &optional reverse)
12196 "Save parts matching TYPE to DIR.
12197 If REVERSE, save parts that do not match TYPE."
12199 (list (read-string "Save parts of type: "
12200 (or (car gnus-summary-save-parts-type-history)
12201 gnus-summary-save-parts-default-mime)
12202 'gnus-summary-save-parts-type-history)
12203 (setq gnus-summary-save-parts-last-directory
12204 (read-directory-name "Save to directory: "
12205 gnus-summary-save-parts-last-directory
12207 current-prefix-arg))
12208 (gnus-summary-iterate n
12209 (let ((gnus-display-mime-function nil)
12210 gnus-article-prepare-hook
12211 gnus-article-decode-hook
12212 gnus-display-mime-function
12214 (gnus-inhibit-treatment t))
12215 (gnus-summary-select-article))
12216 (with-current-buffer gnus-article-buffer
12217 (let ((handles (or gnus-article-mime-handles
12218 (mm-dissect-buffer nil gnus-article-loose-mime)
12219 (and gnus-article-emulate-mime
12221 (gnus-summary-save-parts-counter 1))
12223 (gnus-summary-save-parts-1 type dir handles reverse)
12224 (unless gnus-article-mime-handles ;; Don't destroy this case.
12225 (mm-destroy-parts handles)))))))
12227 (defun gnus-summary-save-parts-1 (type dir handle reverse)
12228 (if (stringp (car handle))
12229 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
12232 (not (string-match type (mm-handle-media-type handle)))
12233 (string-match type (mm-handle-media-type handle)))
12234 (let ((file (expand-file-name
12236 mm-file-name-rewrite-functions
12237 (file-name-nondirectory
12239 (mm-handle-filename handle)
12240 (format "%s.%d.%d" gnus-newsgroup-name
12241 (cdr gnus-article-current)
12242 gnus-summary-save-parts-counter))))
12244 (incf gnus-summary-save-parts-counter)
12245 (unless (file-exists-p file)
12246 (mm-save-part-to-file handle file))))))
12248 ;; Summary extract commands
12250 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
12251 (let ((inhibit-read-only t)
12252 (article (gnus-summary-article-number))
12254 (unless (gnus-summary-goto-subject article)
12255 (error "No such article: %d" article))
12256 (gnus-summary-position-point)
12257 ;; If all commands are to be bunched up on one line, we collect
12259 (unless gnus-view-pseudos-separately
12260 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
12263 (setq action (cdr (assq 'action (car ps))))
12264 (setq files (list (cdr (assq 'name (car ps)))))
12265 (while (and ps (cdr ps)
12266 (string= (or action "1")
12267 (or (cdr (assq 'action (cadr ps))) "2")))
12268 (push (cdr (assq 'name (cadr ps))) files)
12269 (setcdr ps (cddr ps)))
12271 (when (not (string-match "%s" action))
12274 (when (assq 'execute (car ps))
12275 (setcdr (assq 'execute (car ps))
12276 (funcall (if (string-match "%s" action)
12283 (shell-quote-argument f)))
12285 (setq ps (cdr ps)))))
12286 (if (and gnus-view-pseudos (not not-view))
12288 (when (assq 'execute (car pslist))
12289 (gnus-execute-command (cdr (assq 'execute (car pslist)))
12290 (eq gnus-view-pseudos 'not-confirm)))
12291 (setq pslist (cdr pslist)))
12294 (setq after-article (or (cdr (assq 'article (car pslist)))
12295 (gnus-summary-article-number)))
12296 (gnus-summary-goto-subject after-article)
12299 (insert " " (file-name-nondirectory
12300 (cdr (assq 'name (car pslist))))
12301 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
12303 (forward-line -1) ; back to `b'
12304 (gnus-add-text-properties
12305 b (1- e) (list 'gnus-number gnus-reffed-article-number
12306 gnus-mouse-face-prop gnus-mouse-face))
12308 after-article gnus-reffed-article-number
12309 gnus-unread-mark b (car pslist) 0 (- e b))
12310 (setq gnus-newsgroup-unreads
12311 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12312 gnus-reffed-article-number))
12313 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
12314 (setq pslist (cdr pslist)))))))
12316 (defun gnus-pseudos< (p1 p2)
12317 (let ((c1 (cdr (assq 'action p1)))
12318 (c2 (cdr (assq 'action p2))))
12319 (and c1 c2 (string< c1 c2))))
12321 (defun gnus-request-pseudo-article (props)
12322 (cond ((assq 'execute props)
12323 (gnus-execute-command (cdr (assq 'execute props)))))
12324 (let ((gnus-current-article (gnus-summary-article-number)))
12325 (gnus-run-hooks 'gnus-mark-article-hook)))
12327 (defun gnus-execute-command (command &optional automatic)
12329 (gnus-article-setup-buffer)
12330 (set-buffer gnus-article-buffer)
12331 (setq buffer-read-only nil)
12332 (let ((command (if automatic command
12333 (read-string "Command: " (cons command 0)))))
12335 (insert "$ " command "\n\n")
12336 (if gnus-view-pseudo-asynchronously
12337 (start-process "gnus-execute" (current-buffer) shell-file-name
12338 shell-command-switch command)
12339 (call-process shell-file-name nil t nil
12340 shell-command-switch command)))))
12342 ;; Summary kill commands.
12344 (defun gnus-summary-edit-global-kill (article)
12345 "Edit the \"global\" kill file."
12346 (interactive (list (gnus-summary-article-number)))
12347 (gnus-group-edit-global-kill article))
12349 (defun gnus-summary-edit-local-kill ()
12350 "Edit a local kill file applied to the current newsgroup."
12352 (setq gnus-current-headers (gnus-summary-article-header))
12353 (gnus-group-edit-local-kill
12354 (gnus-summary-article-number) gnus-newsgroup-name))
12356 ;;; Header reading.
12358 (defun gnus-read-header (id &optional header)
12359 "Read the headers of article ID and enter them into the Gnus system."
12360 (let ((group gnus-newsgroup-name)
12361 (gnus-override-method
12363 gnus-override-method
12364 (and (gnus-news-group-p gnus-newsgroup-name)
12365 (car (gnus-refer-article-methods)))))
12367 ;; First we check to see whether the header in question is already
12370 ;; This is a Message-ID.
12371 (setq header (or header (gnus-id-to-header id)))
12372 ;; This is an article number.
12373 (setq header (or header (gnus-summary-article-header id))))
12375 (not (gnus-summary-article-sparse-p (mail-header-number header))))
12376 ;; We have found the header.
12378 ;; We have to really fetch the header to this article.
12379 (with-current-buffer nntp-server-buffer
12380 (when (setq where (gnus-request-head id group))
12381 (nnheader-fold-continuation-lines)
12382 (goto-char (point-max))
12384 (goto-char (point-min))
12388 ((cdr where) (cdr where))
12389 (header (mail-header-number header))
12390 (t gnus-reffed-article-number))
12392 (insert " Article retrieved.\n"))
12393 (if (or (not where)
12394 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
12395 () ; Malformed head.
12396 (unless (gnus-summary-article-sparse-p (mail-header-number header))
12397 (when (and (stringp id)
12399 (not (string= (gnus-group-real-name group)
12401 (not (gnus-server-equal gnus-override-method
12402 (gnus-group-method group)))))
12403 ;; If we fetched by Message-ID and the article came from
12404 ;; a different group (or server), we fudge some bogus
12405 ;; article numbers for this article.
12406 (mail-header-set-number header gnus-reffed-article-number))
12407 (with-current-buffer gnus-summary-buffer
12408 (decf gnus-reffed-article-number)
12409 (gnus-remove-header (mail-header-number header))
12410 (push header gnus-newsgroup-headers)
12411 (setq gnus-current-headers header)
12412 (push (mail-header-number header) gnus-newsgroup-limit)))
12415 (defun gnus-remove-header (number)
12416 "Remove header NUMBER from `gnus-newsgroup-headers'."
12417 (if (and gnus-newsgroup-headers
12418 (= number (mail-header-number (car gnus-newsgroup-headers))))
12419 (pop gnus-newsgroup-headers)
12420 (let ((headers gnus-newsgroup-headers))
12421 (while (and (cdr headers)
12422 (not (= number (mail-header-number (cadr headers)))))
12424 (when (cdr headers)
12425 (setcdr headers (cddr headers))))))
12428 ;;; summary highlights
12431 (defun gnus-highlight-selected-summary ()
12432 "Highlight selected article in summary buffer."
12433 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12434 (when gnus-summary-selected-face
12436 (let* ((beg (point-at-bol))
12437 (end (point-at-eol))
12438 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12439 (from (if (get-text-property beg gnus-mouse-face-prop)
12441 (or (next-single-property-change
12442 beg gnus-mouse-face-prop nil end)
12447 (or (next-single-property-change
12448 from gnus-mouse-face-prop nil end)
12450 ;; If no mouse-face prop on line we will have to = from = end,
12451 ;; so we highlight the entire line instead.
12452 (when (= (+ to 2) from)
12455 (if gnus-newsgroup-selected-overlay
12456 ;; Move old overlay.
12458 gnus-newsgroup-selected-overlay from to (current-buffer))
12459 ;; Create new overlay.
12461 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
12462 'face gnus-summary-selected-face))))))
12464 (defvar gnus-summary-highlight-line-cached nil)
12465 (defvar gnus-summary-highlight-line-trigger nil)
12467 (defun gnus-summary-highlight-line-0 ()
12468 (if (and (eq gnus-summary-highlight-line-trigger
12469 gnus-summary-highlight)
12470 gnus-summary-highlight-line-cached)
12471 gnus-summary-highlight-line-cached
12472 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12473 gnus-summary-highlight-line-cached
12474 (let* ((cond (list 'cond))
12476 (list gnus-summary-highlight))
12478 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
12482 (gnus-byte-compile (list 'lambda nil cond))))))
12484 (defun gnus-summary-highlight-line ()
12485 "Highlight current line according to `gnus-summary-highlight'."
12486 (let* ((beg (point-at-bol))
12487 (article (or (gnus-summary-article-number) gnus-current-article))
12488 (score (or (cdr (assq article
12489 gnus-newsgroup-scored))
12490 gnus-summary-default-score 0))
12491 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
12492 (inhibit-read-only t)
12493 (default gnus-summary-default-score)
12494 (default-high gnus-summary-default-high-score)
12495 (default-low gnus-summary-default-low-score)
12496 (uncached (and gnus-summary-use-undownloaded-faces
12497 (memq article gnus-newsgroup-undownloaded)
12498 (not (memq article gnus-newsgroup-cached)))))
12499 (let ((face (funcall (gnus-summary-highlight-line-0))))
12500 (unless (eq face (get-text-property beg 'face))
12501 (gnus-put-text-property-excluding-characters-with-faces
12502 beg (point-at-eol) 'face
12503 (setq face (if (boundp face) (symbol-value face) face)))
12504 (when gnus-summary-highlight-line-function
12505 (funcall gnus-summary-highlight-line-function article face))))))
12507 (defun gnus-update-read-articles (group unread &optional compute)
12508 "Update the list of read articles in GROUP.
12509 UNREAD is a sorted list."
12510 (let ((active (or gnus-newsgroup-active (gnus-active group)))
12511 (info (gnus-get-info group))
12514 (if (or (not info) (not active))
12515 ;; There is no info on this group if it was, in fact,
12516 ;; killed. Gnus stores no information on killed groups, so
12517 ;; there's nothing to be done.
12518 ;; One could store the information somewhere temporarily,
12519 ;; perhaps... Hmmm...
12521 ;; Remove any negative articles numbers.
12522 (while (and unread (< (car unread) 0))
12523 (setq unread (cdr unread)))
12524 ;; Remove any expired article numbers
12525 (while (and unread (< (car unread) (car active)))
12526 (setq unread (cdr unread)))
12527 ;; Compute the ranges of read articles by looking at the list of
12528 ;; unread articles.
12530 (when (/= (car unread) prev)
12531 (push (if (= prev (1- (car unread))) prev
12532 (cons prev (1- (car unread))))
12534 (setq prev (1+ (car unread)))
12535 (setq unread (cdr unread)))
12536 (when (<= prev (cdr active))
12537 (push (cons prev (cdr active)) read))
12538 (setq read (if (> (length read) 1) (nreverse read) read))
12543 ;; Propagate the read marks to the backend.
12544 (when (and (or gnus-propagate-marks
12545 (gnus-method-option-p
12546 (gnus-find-method-for-group group)
12548 (gnus-check-backend-function 'request-set-mark group))
12549 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12550 (add (gnus-remove-from-range read (gnus-info-read info))))
12552 (unless (gnus-check-group group)
12553 (error "Can't open server for %s" group))
12554 (gnus-request-set-mark
12555 group (delq nil (list (if add (list add 'add '(read)))
12556 (if del (list del 'del '(read))))))
12558 `(gnus-request-set-mark
12561 (if del (list del 'add '(read)))
12562 (if add (list add 'del '(read))))))))))
12563 (set-buffer gnus-group-buffer)
12564 (gnus-undo-register
12566 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12567 (gnus-info-set-read ',info ',(gnus-info-read info))
12568 (gnus-get-unread-articles-in-group ',info
12569 (gnus-active ,group))
12570 (gnus-group-update-group ,group t)
12572 ;; Enter this list into the group info.
12573 (gnus-info-set-read info read)
12574 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12575 (gnus-get-unread-articles-in-group info (gnus-active group))
12578 (defun gnus-offer-save-summaries ()
12579 "Offer to save all active summary buffers."
12581 ;; Go through all buffers and find all summaries.
12582 (dolist (buffer (buffer-list))
12583 (when (and (setq buffer (buffer-name buffer))
12584 (string-match "Summary" buffer)
12585 (with-current-buffer buffer
12586 ;; We check that this is, indeed, a summary buffer.
12587 (and (eq major-mode 'gnus-summary-mode)
12588 ;; Also make sure this isn't bogus.
12589 gnus-newsgroup-prepared
12590 ;; Also make sure that this isn't a
12591 ;; dead summary buffer.
12592 (not gnus-dead-summary-mode))))
12593 (push buffer buffers)))
12594 ;; Go through all these summary buffers and offer to save them.
12598 "Update summary buffer %s? "
12600 (switch-to-buffer buf)
12601 (gnus-summary-exit))
12604 (defun gnus-summary-setup-default-charset ()
12605 "Setup newsgroup default charset."
12606 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12607 (setq gnus-newsgroup-charset nil)
12608 (let* ((ignored-charsets
12609 (or gnus-newsgroup-ephemeral-ignored-charsets
12611 (and gnus-newsgroup-name
12612 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12613 gnus-newsgroup-ignored-charsets))))
12614 (setq gnus-newsgroup-charset
12615 (or gnus-newsgroup-ephemeral-charset
12616 (and gnus-newsgroup-name
12617 (gnus-parameter-charset gnus-newsgroup-name))
12618 gnus-default-charset))
12619 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12620 ignored-charsets))))
12626 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12627 "Display the current article buffer fully MIME-buttonized.
12628 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12629 treated as multipart/mixed."
12631 (require 'gnus-art)
12632 (let ((gnus-unbuttonized-mime-types nil)
12633 (gnus-mime-display-multipart-as-mixed show-all-parts))
12634 (gnus-summary-show-article)))
12636 (defun gnus-summary-repair-multipart (article)
12637 "Add a Content-Type header to a multipart article without one."
12638 (interactive (list (gnus-summary-article-number)))
12639 (gnus-with-article article
12640 (message-narrow-to-head)
12641 (message-remove-header "Mime-Version")
12642 (goto-char (point-max))
12643 (insert "Mime-Version: 1.0\n")
12645 (when (search-forward "\n--" nil t)
12646 (let ((separator (buffer-substring (point) (point-at-eol))))
12647 (message-narrow-to-head)
12648 (message-remove-header "Content-Type")
12649 (goto-char (point-max))
12650 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12653 (let (gnus-mark-article-hook)
12654 (gnus-summary-select-article t t nil article)))
12656 (defun gnus-summary-toggle-display-buttonized ()
12657 "Toggle the buttonizing of the article buffer."
12659 (require 'gnus-art)
12660 (if (setq gnus-inhibit-mime-unbuttonizing
12661 (not gnus-inhibit-mime-unbuttonizing))
12662 (let ((gnus-unbuttonized-mime-types nil))
12663 (gnus-summary-show-article))
12664 (gnus-summary-show-article)))
12667 ;;; Generic summary marking commands
12670 (defvar gnus-summary-marking-alist
12671 '((read gnus-del-mark "d")
12672 (unread gnus-unread-mark "u")
12673 (ticked gnus-ticked-mark "!")
12674 (dormant gnus-dormant-mark "?")
12675 (expirable gnus-expirable-mark "e"))
12676 "An alist of names/marks/keystrokes.")
12678 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12679 (defvar gnus-summary-mark-map)
12681 (defun gnus-summary-make-all-marking-commands ()
12682 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12683 (dolist (elem gnus-summary-marking-alist)
12684 (apply 'gnus-summary-make-marking-command elem)))
12686 (defun gnus-summary-make-marking-command (name mark keystroke)
12687 (let ((map (make-sparse-keymap)))
12688 (define-key gnus-summary-generic-mark-map keystroke map)
12689 (dolist (lway `((next "next" next nil "n")
12690 (next-unread "next unread" next t "N")
12691 (prev "previous" prev nil "p")
12692 (prev-unread "previous unread" prev t "P")
12693 (nomove "" nil nil ,keystroke)))
12694 (let ((func (gnus-summary-make-marking-command-1
12695 mark (car lway) lway name)))
12696 (setq func (eval func))
12697 (define-key map (nth 4 lway) func)))))
12699 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12701 (format "gnus-summary-put-mark-as-%s%s"
12702 name (if (eq way 'nomove)
12704 (concat "-" (symbol-name way)))))
12707 "Mark the current article as %s%s.
12708 If N, the prefix, then repeat N times.
12709 If N is negative, move in reverse order.
12710 The difference between N and the actual number of articles marked is
12714 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12716 (defun gnus-summary-generic-mark (n mark move unread)
12717 "Mark N articles with MARK."
12718 (unless (eq major-mode 'gnus-summary-mode)
12719 (error "This command can only be used in the summary buffer"))
12720 (gnus-summary-show-thread)
12723 ((eq move 'next) 1)
12724 ((eq move 'prev) -1)
12726 (if (zerop nummove)
12730 nummove (* -1 nummove))))
12731 (while (and (> n 0)
12732 (gnus-summary-mark-article nil mark)
12733 (zerop (gnus-summary-next-subject nummove unread t)))
12736 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12737 (gnus-summary-recenter)
12738 (gnus-summary-position-point)
12739 (gnus-set-mode-line 'summary)
12742 (defun gnus-summary-insert-articles (articles)
12743 (when (setq articles
12744 (gnus-sorted-difference articles
12745 (mapcar (lambda (h)
12746 (mail-header-number h))
12747 gnus-newsgroup-headers)))
12748 (setq gnus-newsgroup-headers
12750 gnus-newsgroup-headers
12751 (gnus-fetch-headers articles)
12752 'gnus-article-sort-by-number))
12753 (setq gnus-newsgroup-articles
12754 (gnus-sorted-nunion gnus-newsgroup-articles articles))
12755 ;; Suppress duplicates?
12756 (when gnus-suppress-duplicates
12757 (gnus-dup-suppress-articles))
12759 (if (and gnus-fetch-old-headers
12760 (eq gnus-headers-retrieved-by 'nov))
12761 ;; We might want to build some more threads first.
12762 (if (eq gnus-fetch-old-headers 'invisible)
12763 (gnus-build-all-threads)
12764 (gnus-build-old-threads))
12765 ;; Mark the inserted articles that are unread as unread.
12766 (setq gnus-newsgroup-unreads
12767 (gnus-sorted-nunion
12768 gnus-newsgroup-unreads
12769 (gnus-sorted-nintersection
12770 (gnus-list-of-unread-articles gnus-newsgroup-name)
12772 ;; Mark the inserted articles as selected so that the information
12773 ;; of the marks having been changed by a user may be updated when
12774 ;; exiting this group. See `gnus-summary-update-info'.
12775 (dolist (art articles)
12776 (setq gnus-newsgroup-unselected (delq art gnus-newsgroup-unselected))))
12777 ;; Let the Gnus agent mark articles as read.
12779 (gnus-agent-get-undownloaded-list))
12780 ;; Remove list identifiers from subject
12781 (gnus-summary-remove-list-identifiers)
12782 ;; First and last article in this newsgroup.
12783 (when gnus-newsgroup-headers
12784 (setq gnus-newsgroup-begin
12785 (mail-header-number (car gnus-newsgroup-headers))
12787 (mail-header-number
12788 (gnus-last-element gnus-newsgroup-headers))))
12789 (when gnus-use-scoring
12790 (gnus-possibly-score-headers))))
12792 (defun gnus-summary-insert-old-articles (&optional all)
12793 "Insert all old articles in this group.
12794 If ALL is non-nil, already read articles become readable.
12795 If ALL is a number, fetch this number of articles."
12798 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12801 ;; Some nntp servers lie about their active range. When
12802 ;; this happens, the active range can be in the millions.
12803 ;; Use a compressed range to avoid creating a huge list.
12804 (gnus-range-difference (list gnus-newsgroup-active) old))
12805 (setq len (gnus-range-length older))
12810 (let ((older-range (nreverse older)))
12814 (let* ((r (pop older-range))
12815 (min (if (numberp r) r (car r)))
12816 (max (if (numberp r) r (cdr r))))
12817 (while (and (<= min max)
12822 (setq older (gnus-uncompress-range older))))
12824 (setq older (gnus-uncompress-range older)))
12826 (when (and (numberp gnus-large-newsgroup)
12827 (> len gnus-large-newsgroup))
12828 (let* ((cursor-in-echo-area nil)
12829 (initial (gnus-parameter-large-newsgroup-initial
12830 gnus-newsgroup-name))
12834 "How many articles from %s (%s %d): "
12835 (gnus-group-decoded-name gnus-newsgroup-name)
12836 (if initial "max" "default")
12839 (cons (number-to-string initial)
12841 (unless (string-match "^[ \t]*$" input)
12842 (setq all (string-to-number input))
12844 (let ((older-range (nreverse older)))
12848 (let* ((r (pop older-range))
12849 (min (if (numberp r) r (car r)))
12850 (max (if (numberp r) r (cdr r))))
12851 (while (and (<= min max)
12855 max (1- max))))))))))
12856 (setq older (gnus-uncompress-range older))))
12858 (message "No old news.")
12859 (gnus-summary-insert-articles older)
12860 (gnus-summary-limit (gnus-sorted-nunion old older))))
12861 (gnus-summary-position-point)))
12863 (defun gnus-summary-insert-new-articles ()
12864 "Insert all new articles in this group."
12866 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12867 (old-high gnus-newsgroup-highest)
12868 (nnmail-fetched-sources (list t))
12869 (new-active (gnus-activate-group gnus-newsgroup-name 'scan))
12872 (error "Couldn't fetch new data"))
12873 (setq gnus-newsgroup-active (gnus-copy-sequence new-active))
12874 (setq i (cdr gnus-newsgroup-active)
12875 gnus-newsgroup-highest i)
12876 (while (> i old-high)
12880 (message "No gnus is bad news")
12881 (gnus-summary-insert-articles new)
12882 (setq gnus-newsgroup-unreads
12883 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12884 (gnus-summary-limit (gnus-sorted-nunion old new))))
12885 (gnus-summary-position-point))
12887 ;;; Bookmark support for Gnus.
12888 (declare-function bookmark-make-record-default
12889 "bookmark" (&optional no-file no-context posn))
12890 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
12891 (declare-function bookmark-default-handler "bookmark" (bmk))
12892 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
12893 (defvar bookmark-yank-point)
12894 (defvar bookmark-current-buffer)
12896 (defun gnus-summary-bookmark-make-record ()
12897 "Make a bookmark entry for a Gnus summary buffer."
12899 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
12900 (save-restriction ; FIXME is it necessary to widen?
12901 (widen) (setq pos (point))) ; Set position in gnus-article buffer.
12902 (setq buf "art") ; We are recording bookmark from article buffer.
12903 (setq bookmark-yank-point (point))
12904 (setq bookmark-current-buffer (current-buffer))
12905 (gnus-article-show-summary)) ; Go back in summary buffer.
12906 ;; We are now recording bookmark from summary buffer.
12907 (unless buf (setq buf "sum"))
12908 (let* ((subject (elt (gnus-summary-article-header) 1))
12909 (grp (car gnus-article-current))
12910 (art (cdr gnus-article-current))
12911 (head (gnus-summary-article-header art))
12912 (id (mail-header-id head)))
12914 ,@(condition-case nil
12915 (bookmark-make-record-default 'no-file 'no-context pos)
12916 (wrong-number-of-arguments
12917 (bookmark-make-record-default 'point-only)))
12918 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
12919 (group . ,grp) (article . ,art)
12920 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
12923 (defun gnus-summary-bookmark-jump (bookmark)
12924 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12925 BOOKMARK is a bookmark name or a bookmark record."
12926 (let ((group (bookmark-prop-get bookmark 'group))
12927 (article (bookmark-prop-get bookmark 'article))
12928 (id (bookmark-prop-get bookmark 'message-id))
12929 (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
12930 (gnus-fetch-group group (list article))
12931 (gnus-summary-insert-cached-articles)
12932 (gnus-summary-goto-article id nil 'force)
12933 ;; FIXME we have to wait article buffer is ready (only large buffer)
12934 ;; Is there a better solution to know that?
12935 ;; If we don't wait `bookmark-default-handler' will have no chance
12936 ;; to set position. However there is no error, just wrong pos.
12938 (when (string= buf "Gnus-art")
12940 (bookmark-default-handler
12942 (buffer . ,(current-buffer))
12943 . ,(bookmark-get-bookmark-record bookmark)))))
12945 (gnus-summary-make-all-marking-commands)
12947 (gnus-ems-redefine)
12949 (provide 'gnus-sum)
12951 (run-hooks 'gnus-sum-load-hook)
12953 ;; Local Variables:
12954 ;; coding: iso-8859-1
12957 ;;; gnus-sum.el ends here