1 ;;; gnus-sum.el --- summary mode commands for Gnus
3 ;; Copyright (C) 1996-2013 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
129 (defcustom gnus-summary-make-false-root 'adopt
130 "*nil means that Gnus won't gather loose threads.
131 If the root of a thread has expired or been read in a previous
132 session, the information necessary to build a complete thread has been
133 lost. Instead of having many small sub-threads from this original thread
134 scattered all over the summary buffer, Gnus can gather them.
136 If non-nil, Gnus will try to gather all loose sub-threads from an
137 original thread into one large thread.
139 If this variable is non-nil, it should be one of `none', `adopt',
142 If this variable is `none', Gnus will not make a false root, but just
143 present the sub-threads after another.
144 If this variable is `dummy', Gnus will create a dummy root that will
145 have all the sub-threads as children.
146 If this variable is `adopt', Gnus will make one of the \"children\"
147 the parent and mark all the step-children as such.
148 If this variable is `empty', the \"children\" are printed with empty
149 subject fields. (Or rather, they will be printed with a string
150 given by the `gnus-summary-same-subject' variable.)"
152 :type '(choice (const :tag "off" nil)
158 (defcustom gnus-summary-make-false-root-always nil
159 "Always make a false dummy root."
164 (defcustom gnus-summary-gather-exclude-subject "^ *$\\|^(none)$"
165 "*A regexp to match subjects to be excluded from loose thread gathering.
166 As loose thread gathering is done on subjects only, that means that
167 there can be many false gatherings performed. By rooting out certain
168 common subjects, gathering might become saner."
172 (defcustom gnus-summary-gather-subject-limit nil
173 "*Maximum length of subject comparisons when gathering loose threads.
174 Use nil to compare full subjects. Setting this variable to a low
175 number will help gather threads that have been corrupted by
176 newsreaders chopping off subject lines, but it might also mean that
177 unrelated articles that have subject that happen to begin with the
178 same few characters will be incorrectly gathered.
180 If this variable is `fuzzy', Gnus will use a fuzzy algorithm when
183 :type '(choice (const :tag "off" nil)
185 (sexp :menu-tag "on" t)))
187 (defcustom gnus-simplify-subject-functions nil
188 "List of functions taking a string argument that simplify subjects.
189 The functions are applied recursively.
191 Useful functions to put in this list include:
192 `gnus-simplify-subject-re', `gnus-simplify-subject-fuzzy',
193 `gnus-simplify-whitespace', and `gnus-simplify-all-whitespace'."
195 :type '(repeat function))
197 (defcustom gnus-simplify-ignored-prefixes nil
198 "*Remove matches for this regexp from subject lines when simplifying fuzzily."
200 :type '(choice (const :tag "off" nil)
203 (defcustom gnus-build-sparse-threads nil
204 "*If non-nil, fill in the gaps in threads.
205 If `some', only fill in the gaps that are needed to tie loose threads
206 together. If `more', fill in all leaf nodes that Gnus can find. If
207 non-nil and non-`some', fill in all gaps that Gnus manages to guess."
209 :type '(choice (const :tag "off" nil)
212 (sexp :menu-tag "all" t)))
214 (defcustom gnus-summary-thread-gathering-function
215 'gnus-gather-threads-by-subject
216 "*Function used for gathering loose threads.
217 There are two pre-defined functions: `gnus-gather-threads-by-subject',
218 which only takes Subjects into consideration; and
219 `gnus-gather-threads-by-references', which compared the References
220 headers of the articles to find matches."
222 :type '(radio (function-item gnus-gather-threads-by-subject)
223 (function-item gnus-gather-threads-by-references)
224 (function :tag "other")))
226 (defcustom gnus-summary-same-subject ""
227 "*String indicating that the current article has the same subject as the previous.
228 This variable will only be used if the value of
229 `gnus-summary-make-false-root' is `empty'."
230 :group 'gnus-summary-format
233 (defcustom gnus-summary-goto-unread nil
234 "*If t, many commands will go to the next unread article.
235 This applies to marking commands as well as other commands that
236 \"naturally\" select the next article, like, for instance, `SPC' at
237 the end of an article.
239 If nil, the marking commands do NOT go to the next unread article
240 \(they go to the next article instead). If `never', commands that
241 usually go to the next unread article, will go to the next article,
242 whether it is read or not."
244 :group 'gnus-summary-marks
245 :link '(custom-manual "(gnus)Setting Marks")
246 :type '(choice (const :tag "off" nil)
248 (sexp :menu-tag "on" t)))
250 (defcustom gnus-summary-default-score 0
251 "*Default article score level.
252 All scores generated by the score files will be added to this score.
253 If this variable is nil, scoring will be disabled."
254 :group 'gnus-score-default
255 :type '(choice (const :tag "disable")
258 (defcustom gnus-summary-default-high-score 0
259 "*Default threshold for a high scored article.
260 An article will be highlighted as high scored if its score is greater
263 :group 'gnus-score-default
266 (defcustom gnus-summary-default-low-score 0
267 "*Default threshold for a low scored article.
268 An article will be highlighted as low scored if its score is smaller
271 :group 'gnus-score-default
274 (defcustom gnus-summary-zcore-fuzz 0
275 "*Fuzziness factor for the zcore in the summary buffer.
276 Articles with scores closer than this to `gnus-summary-default-score'
278 :group 'gnus-summary-format
281 (defcustom gnus-simplify-subject-fuzzy-regexp nil
282 "*Strings to be removed when doing fuzzy matches.
283 This can either be a regular expression or list of regular expressions
284 that will be removed from subject strings if fuzzy subject
285 simplification is selected."
287 :type '(repeat regexp))
289 (defcustom gnus-show-threads t
290 "*If non-nil, display threads in summary mode."
294 (defcustom gnus-thread-hide-subtree nil
295 "*If non-nil, hide all threads initially.
296 This can be a predicate specifier which says which threads to hide.
297 If threads are hidden, you have to run the command
298 `gnus-summary-show-thread' by hand or select an article."
300 :type '(radio (sexp :format "Non-nil\n"
301 :match (lambda (widget value)
302 (not (or (consp value) (functionp value))))
305 (sexp :tag "Predicate specifier")))
307 (defcustom gnus-thread-hide-killed t
308 "*If non-nil, hide killed threads automatically."
312 (defcustom gnus-thread-ignore-subject t
313 "*If non-nil, which is the default, ignore subjects and do all threading based on the Reference header.
314 If nil, articles that have different subjects from their parents will
315 start separate threads."
319 (defcustom gnus-thread-operation-ignore-subject t
320 "*If non-nil, subjects will be ignored when doing thread commands.
321 This affects commands like `gnus-summary-kill-thread' and
322 `gnus-summary-lower-thread'.
324 If this variable is nil, articles in the same thread with different
325 subjects will not be included in the operation in question. If this
326 variable is `fuzzy', only articles that have subjects that are fuzzily
327 equal will be included."
329 :type '(choice (const :tag "off" nil)
333 (defcustom gnus-thread-indent-level 4
334 "*Number that says how much each sub-thread should be indented."
338 (defcustom gnus-auto-extend-newsgroup t
339 "*If non-nil, extend newsgroup forward and backward when requested."
340 :group 'gnus-summary-choose
343 (defcustom gnus-auto-select-first t
344 "If non-nil, select an article on group entry.
345 An article is selected automatically when entering a group
346 e.g. with \\<gnus-group-mode-map>\\[gnus-group-read-group], or via `gnus-summary-next-page' or
347 `gnus-summary-catchup-and-goto-next-group'.
349 Which article is selected is controlled by the variable
350 `gnus-auto-select-subject'.
352 If you want to prevent automatic selection of articles in some
353 newsgroups, set the variable to nil in `gnus-select-group-hook'."
354 ;; Commands include...
355 ;; \\<gnus-group-mode-map>\\[gnus-group-read-group]
356 ;; \\<gnus-summary-mode-map>\\[gnus-summary-next-page]
357 ;; \\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]
358 :group 'gnus-group-select
359 :type '(choice (const :tag "none" nil)
360 (sexp :menu-tag "first" t)))
362 (defcustom gnus-auto-select-subject 'unseen-or-unread
363 "*Says what subject to place under point when entering a group.
365 This variable can either be the symbols `first' (place point on the
366 first subject), `unread' (place point on the subject line of the first
367 unread article), `best' (place point on the subject line of the
368 highest-scored article), `unseen' (place point on the subject line of
369 the first unseen article), `unseen-or-unread' (place point on the subject
370 line of the first unseen article or, if all articles have been seen, on the
371 subject line of the first unread article), or a function to be called to
372 place point on some subject line."
374 :group 'gnus-group-select
375 :type '(choice (const best)
379 (const unseen-or-unread)
380 (function :tag "Function to call")))
382 (defcustom gnus-auto-select-next t
383 "*If non-nil, offer to go to the next group from the end of the previous.
384 If the value is t and the next newsgroup is empty, Gnus will exit
385 summary mode and go back to group mode. If the value is neither nil
386 nor t, Gnus will select the following unread newsgroup. In
387 particular, if the value is the symbol `quietly', the next unread
388 newsgroup will be selected without any confirmation, and if it is
389 `almost-quietly', the next group will be selected without any
390 confirmation if you are located on the last article in the group.
391 Finally, if this variable is `slightly-quietly', the `\\<gnus-summary-mode-map>\\[gnus-summary-catchup-and-goto-next-group]' command
392 will go to the next group without confirmation."
393 :group 'gnus-summary-maneuvering
394 :type '(choice (const :tag "off" nil)
396 (const almost-quietly)
397 (const slightly-quietly)
398 (sexp :menu-tag "on" t)))
400 (defcustom gnus-auto-select-same nil
401 "*If non-nil, select the next article with the same subject.
402 If there are no more articles with the same subject, go to
403 the first unread article."
404 :group 'gnus-summary-maneuvering
407 (defcustom gnus-auto-select-on-ephemeral-exit 'next-noselect
408 "What article should be selected after exiting an ephemeral group.
409 Valid values include:
412 Select the next article.
414 Select the next unread article.
416 Move the cursor to the next article. This is the default.
417 `next-unread-noselect'
418 Move the cursor to the next unread article.
420 If it has any other value or there is no next (unread) article, the
421 article selected before entering to the ephemeral group will appear."
422 :version "23.1" ;; No Gnus
423 :group 'gnus-summary-maneuvering
424 :type '(choice :format "%{%t%}:\n %[Value Menu%] %v"
425 (const next) (const next-unread)
426 (const next-noselect) (const next-unread-noselect)
427 (sexp :tag "other" :value nil)))
429 (defcustom gnus-auto-goto-ignores 'unfetched
430 "*Says how to handle unfetched articles when maneuvering.
432 This variable can either be the symbols nil (maneuver to any
433 article), `undownloaded' (maneuvering while unplugged ignores articles
434 that have not been fetched), `always-undownloaded' (maneuvering always
435 ignores articles that have not been fetched), `unfetched' (maneuvering
436 ignores articles whose headers have not been fetched).
438 NOTE: The list of unfetched articles will always be nil when plugged
439 and, when unplugged, a subset of the undownloaded article list."
441 :group 'gnus-summary-maneuvering
442 :type '(choice (const :tag "None" nil)
443 (const :tag "Undownloaded when unplugged" undownloaded)
444 (const :tag "Undownloaded" always-undownloaded)
445 (const :tag "Unfetched" unfetched)))
447 (defcustom gnus-summary-check-current nil
448 "*If non-nil, consider the current article when moving.
449 The \"unread\" movement commands will stay on the same line if the
450 current article is unread."
451 :group 'gnus-summary-maneuvering
454 (defcustom gnus-auto-center-summary
455 (max (or (bound-and-true-p scroll-margin) 0) 2)
456 "*If non-nil, always center the current summary buffer.
457 In particular, if `vertical' do only vertical recentering. If non-nil
458 and non-`vertical', do both horizontal and vertical recentering."
459 :group 'gnus-summary-maneuvering
460 :type '(choice (const :tag "none" nil)
462 (integer :tag "height")
463 (sexp :menu-tag "both" t)))
465 (defcustom gnus-auto-center-group t
466 "If non-nil, always center the group buffer."
467 :group 'gnus-summary-maneuvering
470 (defcustom gnus-show-all-headers nil
471 "*If non-nil, don't hide any headers."
472 :group 'gnus-article-hiding
473 :group 'gnus-article-headers
476 (defcustom gnus-summary-ignore-duplicates nil
477 "*If non-nil, ignore articles with identical Message-ID headers."
481 (defcustom gnus-single-article-buffer nil
482 "*If non-nil, display all articles in the same buffer.
483 If nil, each group will get its own article buffer."
485 :group 'gnus-article-various
488 (defcustom gnus-widen-article-window nil
489 "If non-nil, selecting the article buffer will display only the article buffer."
491 :group 'gnus-article-various
494 (defcustom gnus-break-pages t
495 "*If non-nil, do page breaking on articles.
496 The page delimiter is specified by the `gnus-page-delimiter'
498 :group 'gnus-article-various
501 (defcustom gnus-move-split-methods nil
502 "*Variable used to suggest where articles are to be moved to.
503 It uses the same syntax as the `gnus-split-methods' variable.
504 However, whereas `gnus-split-methods' specifies file names as targets,
505 this variable specifies group names."
506 :group 'gnus-summary-mail
507 :type '(repeat (choice (list :value (fun) function)
508 (cons :value ("" "") regexp (repeat string))
511 (defcustom gnus-move-group-prefix-function 'gnus-group-real-prefix
512 "Function used to compute default prefix for article move/copy/etc prompts.
513 The function should take one argument, a group name, and return a
514 string with the suggested prefix."
515 :group 'gnus-summary-mail
518 ;; FIXME: Although the custom type is `character' for the following variables,
519 ;; using multibyte characters (Latin-1, UTF-8) doesn't work. -- rs
521 (defcustom gnus-unread-mark ? ;Whitespace
522 "*Mark used for unread articles."
523 :group 'gnus-summary-marks
526 (defcustom gnus-ticked-mark ?!
527 "*Mark used for ticked articles."
528 :group 'gnus-summary-marks
531 (defcustom gnus-dormant-mark ??
532 "*Mark used for dormant articles."
533 :group 'gnus-summary-marks
536 (defcustom gnus-del-mark ?r
537 "*Mark used for del'd articles."
538 :group 'gnus-summary-marks
541 (defcustom gnus-read-mark ?R
542 "*Mark used for read articles."
543 :group 'gnus-summary-marks
546 (defcustom gnus-expirable-mark ?E
547 "*Mark used for expirable articles."
548 :group 'gnus-summary-marks
551 (defcustom gnus-killed-mark ?K
552 "*Mark used for killed articles."
553 :group 'gnus-summary-marks
556 (defcustom gnus-spam-mark ?$
557 "*Mark used for spam articles."
559 :group 'gnus-summary-marks
562 (defcustom gnus-kill-file-mark ?X
563 "*Mark used for articles killed by kill files."
564 :group 'gnus-summary-marks
567 (defcustom gnus-low-score-mark ?Y
568 "*Mark used for articles with a low score."
569 :group 'gnus-summary-marks
572 (defcustom gnus-catchup-mark ?C
573 "*Mark used for articles that are caught up."
574 :group 'gnus-summary-marks
577 (defcustom gnus-replied-mark ?A
578 "*Mark used for articles that have been replied to."
579 :group 'gnus-summary-marks
582 (defcustom gnus-forwarded-mark ?F
583 "*Mark used for articles that have been forwarded."
585 :group 'gnus-summary-marks
588 (defcustom gnus-recent-mark ?N
589 "*Mark used for articles that are recent."
591 :group 'gnus-summary-marks
594 (defcustom gnus-cached-mark ?*
595 "*Mark used for articles that are in the cache."
596 :group 'gnus-summary-marks
599 (defcustom gnus-saved-mark ?S
600 "*Mark used for articles that have been saved."
601 :group 'gnus-summary-marks
604 (defcustom gnus-unseen-mark ?.
605 "*Mark used for articles that haven't been seen."
607 :group 'gnus-summary-marks
610 (defcustom gnus-no-mark ? ;Whitespace
611 "*Mark used for articles that have no other secondary mark."
613 :group 'gnus-summary-marks
616 (defcustom gnus-ancient-mark ?O
617 "*Mark used for ancient articles."
618 :group 'gnus-summary-marks
621 (defcustom gnus-sparse-mark ?Q
622 "*Mark used for sparsely reffed articles."
623 :group 'gnus-summary-marks
626 (defcustom gnus-canceled-mark ?G
627 "*Mark used for canceled articles."
628 :group 'gnus-summary-marks
631 (defcustom gnus-duplicate-mark ?M
632 "*Mark used for duplicate articles."
633 :group 'gnus-summary-marks
636 (defcustom gnus-undownloaded-mark ?-
637 "*Mark used for articles that weren't downloaded."
639 :group 'gnus-summary-marks
642 (defcustom gnus-downloaded-mark ?+
643 "*Mark used for articles that were downloaded."
644 :group 'gnus-summary-marks
647 (defcustom gnus-downloadable-mark ?%
648 "*Mark used for articles that are to be downloaded."
649 :group 'gnus-summary-marks
652 (defcustom gnus-unsendable-mark ?=
653 "*Mark used for articles that won't be sent."
654 :group 'gnus-summary-marks
657 (defcustom gnus-score-over-mark ?+
658 "*Score mark used for articles with high scores."
659 :group 'gnus-summary-marks
662 (defcustom gnus-score-below-mark ?-
663 "*Score mark used for articles with low scores."
664 :group 'gnus-summary-marks
667 (defcustom gnus-empty-thread-mark ? ;Whitespace
668 "*There is no thread under the article."
669 :group 'gnus-summary-marks
672 (defcustom gnus-not-empty-thread-mark ?=
673 "*There is a thread under the article."
674 :group 'gnus-summary-marks
677 (defcustom gnus-view-pseudo-asynchronously nil
678 "*If non-nil, Gnus will view pseudo-articles asynchronously."
679 :group 'gnus-extract-view
682 (defcustom gnus-auto-expirable-marks
683 (list gnus-killed-mark gnus-del-mark gnus-catchup-mark
684 gnus-low-score-mark gnus-ancient-mark gnus-read-mark
686 "*The list of marks converted into expiration if a group is auto-expirable."
689 :type '(repeat character))
691 (defcustom gnus-inhibit-user-auto-expire t
692 "*If non-nil, user marking commands will not mark an article as expirable, even if the group has auto-expire turned on."
697 (defcustom gnus-mark-copied-or-moved-articles-as-expirable nil
698 "If non-nil, mark articles copied or moved to auto-expire group as expirable.
699 If nil, the expirable marks will be unchanged except that the marks
700 will be removed when copying or moving articles to a group that has
701 not turned auto-expire on. If non-nil, articles that have been read
702 will be marked as expirable when being copied or moved to a group in
703 which auto-expire is turned on."
706 :group 'gnus-summary-marks)
708 (defcustom gnus-view-pseudos nil
709 "*If `automatic', pseudo-articles will be viewed automatically.
710 If `not-confirm', pseudos will be viewed automatically, and the user
711 will not be asked to confirm the command."
712 :group 'gnus-extract-view
713 :type '(choice (const :tag "off" nil)
715 (const not-confirm)))
717 (defcustom gnus-view-pseudos-separately t
718 "*If non-nil, one pseudo-article will be created for each file to be viewed.
719 If nil, all files that use the same viewing command will be given as a
720 list of parameters to that command."
721 :group 'gnus-extract-view
724 (defcustom gnus-insert-pseudo-articles t
725 "*If non-nil, insert pseudo-articles when decoding articles."
726 :group 'gnus-extract-view
729 (defcustom gnus-summary-dummy-line-format
731 "*The format specification for the dummy roots in the summary buffer.
732 It works along the same lines as a normal formatting string,
733 with some simple extensions.
737 General format specifiers can also be used.
738 See `(gnus)Formatting Variables'."
739 :link '(custom-manual "(gnus)Formatting Variables")
740 :group 'gnus-threading
743 (defcustom gnus-summary-mode-line-format "Gnus: %g [%A] %Z"
744 "*The format specification for the summary mode line.
745 It works along the same lines as a normal formatting string,
746 with some simple extensions:
749 %p Unprefixed group name
750 %A Current article number
751 %z Current article score
753 %U Number of unread articles in the group
754 %e Number of unselected articles in the group
755 %Z A string with unread/unselected article counts
756 %g Shortish group name
757 %S Subject of the current article
759 %s Current score file name
760 %d Number of dormant articles
761 %r Number of articles that have been marked as read in this session
762 %E Number of articles expunged by the score files"
763 :group 'gnus-summary-format
766 (defcustom gnus-list-identifiers nil
767 "Regexp that matches list identifiers to be removed from subject.
768 This can also be a list of regexps."
770 :group 'gnus-summary-format
771 :group 'gnus-article-hiding
772 :type '(choice (const :tag "none" nil)
774 (repeat :value (".*") regexp)))
776 (defcustom gnus-summary-mark-below 0
777 "*Mark all articles with a score below this variable as read.
778 This variable is local to each summary buffer and usually set by the
780 :group 'gnus-score-default
783 (defun gnus-widget-reversible-match (widget value)
784 "Ignoring WIDGET, convert VALUE to internal form.
785 VALUE should have the form `FOO' or `(not FOO)', where FOO is an symbol."
789 (eq (length value) 2)
790 (eq (nth 0 value) 'not)
791 (symbolp (nth 1 value)))))
793 (defun gnus-widget-reversible-to-internal (widget value)
794 "Ignoring WIDGET, convert VALUE to internal form.
795 VALUE should have the form `FOO' or `(not FOO)', where FOO is an atom.
796 FOO is converted to (FOO nil) and (not FOO) is converted to (FOO t)."
800 (list (nth 1 value) t)))
802 (defun gnus-widget-reversible-to-external (widget value)
803 "Ignoring WIDGET, convert VALUE to external form.
804 VALUE should have the form `(FOO nil)' or `(FOO t)', where FOO is an atom.
805 \(FOO nil) is converted to FOO and (FOO t) is converted to (not FOO)."
808 (list 'not (nth 0 value))
811 (define-widget 'gnus-widget-reversible 'group
812 "A `group' that convert values."
813 :match 'gnus-widget-reversible-match
814 :value-to-internal 'gnus-widget-reversible-to-internal
815 :value-to-external 'gnus-widget-reversible-to-external)
817 (defcustom gnus-article-sort-functions '(gnus-article-sort-by-number)
818 "*List of functions used for sorting articles in the summary buffer.
820 Each function takes two articles and returns non-nil if the first
821 article should be sorted before the other. If you use more than one
822 function, the primary sort function should be the last. You should
823 probably always include `gnus-article-sort-by-number' in the list of
824 sorting functions -- preferably first. Also note that sorting by date
825 is often much slower than sorting by number, and the sorting order is
826 very similar. (Sorting by date means sorting by the time the message
827 was sent, sorting by number means sorting by arrival time.)
829 Each item can also be a list `(not F)' where F is a function;
830 this reverses the sort order.
832 Ready-made functions include `gnus-article-sort-by-number',
833 `gnus-article-sort-by-author', `gnus-article-sort-by-subject',
834 `gnus-article-sort-by-date', `gnus-article-sort-by-random'
835 and `gnus-article-sort-by-score'.
837 When threading is turned on, the variable `gnus-thread-sort-functions'
838 controls how articles are sorted."
839 :group 'gnus-summary-sort
840 :type '(repeat (gnus-widget-reversible
841 (choice (function-item gnus-article-sort-by-number)
842 (function-item gnus-article-sort-by-author)
843 (function-item gnus-article-sort-by-subject)
844 (function-item gnus-article-sort-by-date)
845 (function-item gnus-article-sort-by-score)
846 (function-item gnus-article-sort-by-random)
847 (function :tag "other"))
848 (boolean :tag "Reverse order"))))
850 (defcustom gnus-sort-threads-recursively t
851 "If non-nil, `gnus-thread-sort-functions' are applied recursively.
852 Setting this to nil allows sorting high-score, recent,
853 etc. threads to the top of the summary buffer while still
854 retaining chronological old to new sorting order inside threads."
855 :group 'gnus-summary-sort
858 (defcustom gnus-thread-sort-functions '(gnus-thread-sort-by-number)
859 "*List of functions used for sorting threads in the summary buffer.
860 By default, threads are sorted by article number.
862 Each function takes two threads and returns non-nil if the first
863 thread should be sorted before the other. If you use more than one
864 function, the primary sort function should be the last. You should
865 probably always include `gnus-thread-sort-by-number' in the list of
866 sorting functions -- preferably first. Also note that sorting by date
867 is often much slower than sorting by number, and the sorting order is
868 very similar. (Sorting by date means sorting by the time the message
869 was sent, sorting by number means sorting by arrival time.)
871 Each list item can also be a list `(not F)' where F is a
872 function; this specifies reversed sort order.
874 Ready-made functions include `gnus-thread-sort-by-number',
875 `gnus-thread-sort-by-author', `gnus-thread-sort-by-recipient'
876 `gnus-thread-sort-by-subject', `gnus-thread-sort-by-date',
877 `gnus-thread-sort-by-score', `gnus-thread-sort-by-most-recent-number',
878 `gnus-thread-sort-by-most-recent-date', `gnus-thread-sort-by-random',
879 and `gnus-thread-sort-by-total-score' (see
880 `gnus-thread-score-function').
882 When threading is turned off, the variable
883 `gnus-article-sort-functions' controls how articles are sorted."
884 :group 'gnus-summary-sort
886 (gnus-widget-reversible
887 (choice (function-item gnus-thread-sort-by-number)
888 (function-item gnus-thread-sort-by-author)
889 (function-item gnus-thread-sort-by-recipient)
890 (function-item gnus-thread-sort-by-subject)
891 (function-item gnus-thread-sort-by-date)
892 (function-item gnus-thread-sort-by-score)
893 (function-item gnus-thread-sort-by-most-recent-number)
894 (function-item gnus-thread-sort-by-most-recent-date)
895 (function-item gnus-thread-sort-by-random)
896 (function-item gnus-thread-sort-by-total-score)
897 (function :tag "other"))
898 (boolean :tag "Reverse order"))))
900 (defcustom gnus-thread-score-function '+
901 "*Function used for calculating the total score of a thread.
903 The function is called with the scores of the article and each
904 subthread and should then return the score of the thread.
906 Some functions you can use are `+', `max', or `min'."
907 :group 'gnus-summary-sort
910 (defcustom gnus-summary-expunge-below nil
911 "All articles that have a score less than this variable will be expunged.
912 This variable is local to the summary buffers."
913 :group 'gnus-score-default
914 :type '(choice (const :tag "off" nil)
917 (defcustom gnus-thread-expunge-below nil
918 "All threads that have a total score less than this variable will be expunged.
919 See `gnus-thread-score-function' for en explanation of what a
922 This variable is local to the summary buffers."
923 :group 'gnus-threading
924 :group 'gnus-score-default
925 :type '(choice (const :tag "off" nil)
928 (defcustom gnus-summary-mode-hook nil
929 "*A hook for Gnus summary mode.
930 This hook is run before any variables are set in the summary buffer."
931 :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
932 :group 'gnus-summary-various
935 ;; Extracted from gnus-xmas-redefine in order to preserve user settings
936 (when (featurep 'xemacs)
937 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
938 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
939 (add-hook 'gnus-summary-mode-hook
940 'gnus-xmas-switch-horizontal-scrollbar-off))
942 (defcustom gnus-summary-menu-hook nil
943 "*Hook run after the creation of the summary mode menu."
944 :group 'gnus-summary-visual
947 (defcustom gnus-summary-exit-hook nil
948 "*A hook called on exit from the summary buffer.
949 It will be called with point in the group buffer."
950 :group 'gnus-summary-exit
953 (defcustom gnus-summary-prepare-hook nil
954 "*A hook called after the summary buffer has been generated.
955 If you want to modify the summary buffer, you can use this hook."
956 :group 'gnus-summary-various
959 (defcustom gnus-summary-prepared-hook nil
960 "*A hook called as the last thing after the summary buffer has been generated."
961 :group 'gnus-summary-various
964 (defcustom gnus-summary-generate-hook nil
965 "*A hook run just before generating the summary buffer.
966 This hook is commonly used to customize threading variables and the
968 :group 'gnus-summary-various
971 (defcustom gnus-select-group-hook nil
972 "*A hook called when a newsgroup is selected.
974 If you'd like to simplify subjects like the
975 `gnus-summary-next-same-subject' command does, you can use the
978 (add-hook gnus-select-group-hook
980 (mapcar (lambda (header)
981 (mail-header-set-subject
983 (gnus-simplify-subject
984 (mail-header-subject header) 're-only)))
985 gnus-newsgroup-headers)))"
986 :group 'gnus-group-select
989 (defcustom gnus-select-article-hook nil
990 "*A hook called when an article is selected."
991 :group 'gnus-summary-choose
992 :options '(gnus-agent-fetch-selected-article)
995 (defcustom gnus-visual-mark-article-hook
996 (list 'gnus-highlight-selected-summary)
997 "*Hook run after selecting an article in the summary buffer.
998 It is meant to be used for highlighting the article in some way. It
999 is not run if `gnus-visual' is nil."
1000 :group 'gnus-summary-visual
1003 (defcustom gnus-parse-headers-hook nil
1004 "*A hook called before parsing the headers."
1005 :group 'gnus-various
1008 (defcustom gnus-exit-group-hook nil
1009 "*A hook called when exiting summary mode.
1010 This hook is not called from the non-updating exit commands like `Q'."
1011 :group 'gnus-various
1014 (defcustom gnus-summary-update-hook nil
1015 "*A hook called when a summary line is changed.
1016 The hook will not be called if `gnus-visual' is nil.
1018 The default function `gnus-summary-highlight-line' will
1019 highlight the line according to the `gnus-summary-highlight'
1021 :group 'gnus-summary-visual
1024 (defcustom gnus-mark-article-hook '(gnus-summary-mark-read-and-unread-as-read)
1025 "*A hook called when an article is selected for the first time.
1026 The hook is intended to mark an article as read (or unread)
1027 automatically when it is selected."
1028 :group 'gnus-summary-choose
1031 (defcustom gnus-group-no-more-groups-hook nil
1032 "*A hook run when returning to group mode having no more (unread) groups."
1033 :group 'gnus-group-select
1036 (defcustom gnus-ps-print-hook nil
1037 "*A hook run before ps-printing something from Gnus."
1038 :group 'gnus-summary
1041 (defcustom gnus-summary-article-move-hook nil
1042 "*A hook called after an article is moved, copied, respooled, or crossposted."
1044 :group 'gnus-summary
1047 (defcustom gnus-summary-article-delete-hook nil
1048 "*A hook called after an article is deleted."
1050 :group 'gnus-summary
1053 (defcustom gnus-summary-article-expire-hook nil
1054 "*A hook called after an article is expired."
1056 :group 'gnus-summary
1059 (defcustom gnus-summary-display-arrow
1060 (and (fboundp 'display-graphic-p)
1061 (display-graphic-p))
1062 "*If non-nil, display an arrow highlighting the current article."
1064 :group 'gnus-summary
1067 (defcustom gnus-summary-selected-face 'gnus-summary-selected
1068 "Face used for highlighting the current article in the summary buffer."
1069 :group 'gnus-summary-visual
1072 (defvar gnus-tmp-downloaded nil)
1074 (defcustom gnus-summary-highlight
1075 '(((eq mark gnus-canceled-mark)
1076 . gnus-summary-cancelled)
1077 ((and uncached (> score default-high))
1078 . gnus-summary-high-undownloaded)
1079 ((and uncached (< score default-low))
1080 . gnus-summary-low-undownloaded)
1082 . gnus-summary-normal-undownloaded)
1083 ((and (> score default-high)
1084 (or (eq mark gnus-dormant-mark)
1085 (eq mark gnus-ticked-mark)))
1086 . gnus-summary-high-ticked)
1087 ((and (< score default-low)
1088 (or (eq mark gnus-dormant-mark)
1089 (eq mark gnus-ticked-mark)))
1090 . gnus-summary-low-ticked)
1091 ((or (eq mark gnus-dormant-mark)
1092 (eq mark gnus-ticked-mark))
1093 . gnus-summary-normal-ticked)
1094 ((and (> score default-high) (eq mark gnus-ancient-mark))
1095 . gnus-summary-high-ancient)
1096 ((and (< score default-low) (eq mark gnus-ancient-mark))
1097 . gnus-summary-low-ancient)
1098 ((eq mark gnus-ancient-mark)
1099 . gnus-summary-normal-ancient)
1100 ((and (> score default-high) (eq mark gnus-unread-mark))
1101 . gnus-summary-high-unread)
1102 ((and (< score default-low) (eq mark gnus-unread-mark))
1103 . gnus-summary-low-unread)
1104 ((eq mark gnus-unread-mark)
1105 . gnus-summary-normal-unread)
1106 ((> score default-high)
1107 . gnus-summary-high-read)
1108 ((< score default-low)
1109 . gnus-summary-low-read)
1111 . gnus-summary-normal-read))
1112 "*Controls the highlighting of summary buffer lines.
1114 A list of (FORM . FACE) pairs. When deciding how a particular
1115 summary line should be displayed, each form is evaluated. The content
1116 of the face field after the first true form is used. You can change
1117 how those summary lines are displayed, by editing the face field.
1119 You can use the following variables in the FORM field.
1121 score: The article's score.
1122 default: The default article score.
1123 default-high: The default score for high scored articles.
1124 default-low: The default score for low scored articles.
1125 below: The score below which articles are automatically marked as read.
1126 mark: The article's mark.
1127 uncached: Non-nil if the article is uncached."
1128 :group 'gnus-summary-visual
1129 :type '(repeat (cons (sexp :tag "Form" nil)
1131 (put 'gnus-summary-highlight 'risky-local-variable t)
1133 (defcustom gnus-alter-header-function nil
1134 "Function called to allow alteration of article header structures.
1135 The function is called with one parameter, the article header vector,
1136 which it may alter in any way."
1137 :type '(choice (const :tag "None" nil)
1139 :group 'gnus-summary)
1141 (defvar gnus-decode-encoded-word-function 'mail-decode-encoded-word-string
1142 "Function used to decode a string with encoded words.")
1144 (defvar gnus-decode-encoded-address-function
1145 'mail-decode-encoded-address-string
1146 "Function used to decode addresses with encoded words.")
1148 (defcustom gnus-extra-headers '(To Cc Keywords Gcc Newsgroups)
1149 "*Extra headers to parse."
1150 :version "24.1" ; added Cc Keywords Gcc
1151 :group 'gnus-summary
1152 :type '(repeat symbol))
1154 (defcustom gnus-ignored-from-addresses
1155 (and user-mail-address
1156 (not (string= user-mail-address ""))
1157 (regexp-quote user-mail-address))
1158 "*From headers that may be suppressed in favor of To headers.
1159 This can be a regexp or a list of regexps."
1161 :group 'gnus-summary
1162 :type '(choice regexp
1163 (repeat :tag "Regexp List" regexp)))
1165 (defsubst gnus-ignored-from-addresses ()
1166 (gmm-regexp-concat gnus-ignored-from-addresses))
1168 (defcustom gnus-summary-to-prefix "-> "
1169 "*String prefixed to the To field in the summary line when
1170 using `gnus-ignored-from-addresses'."
1172 :group 'gnus-summary
1175 (defcustom gnus-summary-newsgroup-prefix "=> "
1176 "*String prefixed to the Newsgroup field in the summary
1177 line when using the option `gnus-ignored-from-addresses'."
1179 :group 'gnus-summary
1182 (defcustom gnus-newsgroup-ignored-charsets '(unknown-8bit x-unknown)
1183 "List of charsets that should be ignored.
1184 When these charsets are used in the \"charset\" parameter, the
1185 default charset will be used instead."
1187 :type '(repeat symbol)
1188 :group 'gnus-charset)
1190 (defcustom gnus-newsgroup-maximum-articles nil
1191 "The maximum number of articles a newsgroup.
1192 If this is a number, old articles in a newsgroup exceeding this number
1193 are silently ignored. If it is nil, no article is ignored. Note that
1194 setting this variable to a number might prevent you from reading very
1196 :group 'gnus-group-select
1198 :type '(choice (const :tag "No limit" nil)
1201 (gnus-define-group-parameter
1205 "Return the ignored charsets of GROUP."
1206 :variable gnus-group-ignored-charsets-alist
1208 '(("alt\\.chinese\\.text" iso-8859-1))
1210 "Alist of regexps (to match group names) and charsets that should be ignored.
1211 When these charsets are used in the \"charset\" parameter, the
1212 default charset will be used instead."
1213 :variable-group gnus-charset
1214 :variable-type '(repeat (cons (regexp :tag "Group")
1216 :parameter-type '(choice :tag "Ignored charsets"
1219 :parameter-document "\
1220 List of charsets that should be ignored.
1222 When these charsets are used in the \"charset\" parameter, the
1223 default charset will be used instead.")
1225 (defcustom gnus-group-highlight-words-alist nil
1226 "Alist of group regexps and highlight regexps.
1227 This variable uses the same syntax as `gnus-emphasis-alist'."
1229 :type '(repeat (cons (regexp :tag "Group")
1230 (repeat (list (regexp :tag "Highlight regexp")
1231 (number :tag "Group for entire word" 0)
1232 (number :tag "Group for displayed part" 0)
1234 gnus-emphasis-highlight-words)))))
1235 :group 'gnus-summary-visual)
1237 (defcustom gnus-summary-show-article-charset-alist
1239 "Alist of number and charset.
1240 The article will be shown with the charset corresponding to the
1242 For example: ((1 . cn-gb-2312) (2 . big5))."
1244 :type '(repeat (cons (number :tag "Argument" 1)
1245 (symbol :tag "Charset")))
1246 :group 'gnus-charset)
1248 (defcustom gnus-preserve-marks t
1249 "Whether marks are preserved when moving, copying and respooling messages."
1252 :group 'gnus-summary-marks)
1254 (defcustom gnus-alter-articles-to-read-function nil
1255 "Function to be called to alter the list of articles to be selected."
1256 :type '(choice (const nil) function)
1257 :group 'gnus-summary)
1259 (defcustom gnus-orphan-score nil
1260 "*All orphans get this score added. Set in the score file."
1261 :group 'gnus-score-default
1262 :type '(choice (const nil)
1265 (defcustom gnus-summary-save-parts-default-mime "image/.*"
1266 "*A regexp to match MIME parts when saving multiple parts of a
1267 message with `gnus-summary-save-parts' (\\<gnus-summary-mode-map>\\[gnus-summary-save-parts]).
1268 This regexp will be used by default when prompting the user for which
1269 type of files to save."
1270 :group 'gnus-summary
1273 (defcustom gnus-read-all-available-headers nil
1274 "Whether Gnus should parse all headers made available to it.
1275 This is mostly relevant for slow back ends where the user may
1276 wish to widen the summary buffer to include all headers
1279 :group 'gnus-summary
1280 :type '(choice boolean regexp))
1282 (defcustom gnus-summary-pipe-output-default-command nil
1283 "Command (and optional arguments) used to pipe article to subprocess.
1284 This will be used as the default command if it is non-nil. The value
1285 will be updated if you modify it when executing the command
1286 `gnus-summary-pipe-output' or the function `gnus-summary-save-in-pipe'."
1287 :version "23.1" ;; No Gnus
1288 :group 'gnus-summary
1289 :type '(radio (const :tag "None" nil) (string :tag "Command")))
1291 (defcustom gnus-summary-muttprint-program "muttprint"
1292 "Command (and optional arguments) used to run Muttprint.
1293 The value will be updated if you modify it when executing the command
1294 `gnus-summary-muttprint'."
1296 :group 'gnus-summary
1299 (defcustom gnus-article-loose-mime t
1300 "If non-nil, don't require MIME-Version header.
1301 Some brain-damaged MUA/MTA, e.g. Lotus Domino 5.0.6 clients, does not
1302 supply the MIME-Version header or deliberately strip it from the mail.
1303 If non-nil (the default), Gnus will treat some articles as MIME
1304 even if the MIME-Version header is missing."
1307 :group 'gnus-article-mime)
1309 (defcustom gnus-article-emulate-mime t
1310 "If non-nil, use MIME emulation for uuencode and the like.
1311 This means that Gnus will search message bodies for text that look
1312 like uuencoded bits, yEncoded bits, and so on, and present that using
1313 the normal Gnus MIME machinery."
1316 :group 'gnus-article-mime)
1318 ;;; Internal variables
1320 (defvar gnus-summary-display-cache nil)
1321 (defvar gnus-article-mime-handles nil)
1322 (defvar gnus-article-decoded-p nil)
1323 (defvar gnus-article-charset nil)
1324 (defvar gnus-article-ignored-charsets nil)
1325 (defvar gnus-scores-exclude-files nil)
1326 (defvar gnus-page-broken nil)
1328 (defvar gnus-original-article nil)
1329 (defvar gnus-article-internal-prepare-hook nil)
1330 (defvar gnus-newsgroup-process-stack nil)
1332 (defvar gnus-thread-indent-array nil)
1333 (defvar gnus-thread-indent-array-level gnus-thread-indent-level)
1334 (defvar gnus-sort-gathered-threads-function 'gnus-thread-sort-by-number
1335 "Function called to sort the articles within a thread after it has been gathered together.")
1337 (defvar gnus-summary-save-parts-type-history nil)
1338 (defvar gnus-summary-save-parts-last-directory mm-default-directory)
1340 ;; Avoid highlighting in kill files.
1341 (defvar gnus-summary-inhibit-highlight nil)
1342 (defvar gnus-newsgroup-selected-overlay nil)
1343 (defvar gnus-inhibit-limiting nil)
1344 (defvar gnus-newsgroup-adaptive-score-file nil)
1345 (defvar gnus-current-score-file nil)
1346 (defvar gnus-current-move-group nil)
1347 (defvar gnus-current-copy-group nil)
1348 (defvar gnus-current-crosspost-group nil)
1349 (defvar gnus-newsgroup-display nil)
1351 (defvar gnus-newsgroup-dependencies nil)
1352 (defvar gnus-newsgroup-adaptive nil)
1353 (defvar gnus-summary-display-article-function nil)
1354 (defvar gnus-summary-highlight-line-function nil
1355 "Function called after highlighting a summary line.")
1357 (defvar gnus-summary-line-format-alist
1358 `((?N ,(macroexpand '(mail-header-number gnus-tmp-header)) ?d)
1359 (?S ,(macroexpand '(mail-header-subject gnus-tmp-header)) ?s)
1360 (?s gnus-tmp-subject-or-nil ?s)
1361 (?n gnus-tmp-name ?s)
1362 (?A (car (cdr (funcall gnus-extract-address-components gnus-tmp-from)))
1364 (?a (or (car (funcall gnus-extract-address-components gnus-tmp-from))
1366 (?F gnus-tmp-from ?s)
1367 (?x ,(macroexpand '(mail-header-xref gnus-tmp-header)) ?s)
1368 (?D ,(macroexpand '(mail-header-date gnus-tmp-header)) ?s)
1369 (?d (gnus-dd-mmm (mail-header-date gnus-tmp-header)) ?s)
1370 (?o (gnus-date-iso8601 (mail-header-date gnus-tmp-header)) ?s)
1371 (?M ,(macroexpand '(mail-header-id gnus-tmp-header)) ?s)
1372 (?r ,(macroexpand '(mail-header-references gnus-tmp-header)) ?s)
1373 (?c (or (mail-header-chars gnus-tmp-header) 0) ?d)
1374 (?k (gnus-summary-line-message-size gnus-tmp-header) ?s)
1375 (?L gnus-tmp-lines ?s)
1376 (?Z (or (nnir-article-rsv (mail-header-number gnus-tmp-header))
1378 (?G (or (nnir-article-group (mail-header-number gnus-tmp-header))
1380 (?g (or (gnus-group-short-name
1381 (nnir-article-group (mail-header-number gnus-tmp-header)))
1383 (?O gnus-tmp-downloaded ?c)
1384 (?I gnus-tmp-indentation ?s)
1385 (?T (if (= gnus-tmp-level 0) "" (make-string (frame-width) ? )) ?s)
1386 (?R gnus-tmp-replied ?c)
1387 (?\[ gnus-tmp-opening-bracket ?c)
1388 (?\] gnus-tmp-closing-bracket ?c)
1389 (?\> (make-string gnus-tmp-level ? ) ?s)
1390 (?\< (make-string (max 0 (- 20 gnus-tmp-level)) ? ) ?s)
1391 (?i gnus-tmp-score ?d)
1392 (?z gnus-tmp-score-char ?c)
1393 (?V (gnus-thread-total-score (and (boundp 'thread) (car thread))) ?d)
1394 (?U gnus-tmp-unread ?c)
1395 (?f (gnus-summary-from-or-to-or-newsgroups gnus-tmp-header gnus-tmp-from)
1397 (?t (gnus-summary-number-of-articles-in-thread
1398 (and (boundp 'thread) (car thread)) gnus-tmp-level)
1400 (?e (gnus-summary-number-of-articles-in-thread
1401 (and (boundp 'thread) (car thread)) gnus-tmp-level t)
1403 (?u gnus-tmp-user-defined ?s)
1404 (?P (gnus-pick-line-number) ?d)
1405 (?B gnus-tmp-thread-tree-header-string ?s)
1406 (user-date (gnus-user-date
1407 ,(macroexpand '(mail-header-date gnus-tmp-header))) ?s))
1408 "An alist of format specifications that can appear in summary lines.
1409 These are paired with what variables they correspond with, along with
1410 the type of the variable (string, integer, character, etc).")
1412 (defvar gnus-summary-dummy-line-format-alist
1413 `((?S gnus-tmp-subject ?s)
1414 (?N gnus-tmp-number ?d)
1415 (?u gnus-tmp-user-defined ?s)))
1417 (defvar gnus-summary-mode-line-format-alist
1418 `((?G gnus-tmp-group-name ?s)
1419 (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
1420 (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
1421 (?A gnus-tmp-article-number ?d)
1422 (?Z gnus-tmp-unread-and-unselected ?s)
1423 (?V gnus-version ?s)
1424 (?U gnus-tmp-unread-and-unticked ?d)
1425 (?S gnus-tmp-subject ?s)
1426 (?e gnus-tmp-unselected ?d)
1427 (?u gnus-tmp-user-defined ?s)
1428 (?d (length gnus-newsgroup-dormant) ?d)
1429 (?t (length gnus-newsgroup-marked) ?d)
1430 (?h (length gnus-newsgroup-spam-marked) ?d)
1431 (?r (length gnus-newsgroup-reads) ?d)
1432 (?z (gnus-summary-article-score gnus-tmp-article-number) ?d)
1433 (?E gnus-newsgroup-expunged-tally ?d)
1434 (?s (gnus-current-score-file-nondirectory) ?s)))
1436 ;; This is here rather than in gnus-art for compilation reasons.
1437 (defvar gnus-article-mode-line-format-alist
1438 (nconc '((?w (gnus-article-wash-status) ?s)
1439 (?m (gnus-article-mime-part-status) ?s))
1440 gnus-summary-mode-line-format-alist))
1442 (defvar gnus-last-search-regexp nil
1443 "Default regexp for article search command.")
1445 (defvar gnus-last-shell-command nil
1446 "Default shell command on article.")
1448 (defvar gnus-newsgroup-agentized nil
1449 "Locally bound in each summary buffer to indicate whether the server has been agentized.")
1450 (defvar gnus-newsgroup-begin nil)
1451 (defvar gnus-newsgroup-end nil)
1452 (defvar gnus-newsgroup-last-rmail nil)
1453 (defvar gnus-newsgroup-last-mail nil)
1454 (defvar gnus-newsgroup-last-folder nil)
1455 (defvar gnus-newsgroup-last-file nil)
1456 (defvar gnus-newsgroup-last-directory nil)
1457 (defvar gnus-newsgroup-auto-expire nil)
1458 (defvar gnus-newsgroup-active nil)
1459 (defvar gnus-newsgroup-highest nil)
1461 (defvar gnus-newsgroup-data nil)
1462 (defvar gnus-newsgroup-data-reverse nil)
1463 (defvar gnus-newsgroup-limit nil)
1464 (defvar gnus-newsgroup-limits nil)
1465 (defvar gnus-summary-use-undownloaded-faces nil)
1467 (defvar gnus-newsgroup-unreads nil
1468 "Sorted list of unread articles in the current newsgroup.")
1470 (defvar gnus-newsgroup-unselected nil
1471 "Sorted list of unselected unread articles in the current newsgroup.")
1473 (defvar gnus-newsgroup-reads nil
1474 "Alist of read articles and article marks in the current newsgroup.")
1476 (defvar gnus-newsgroup-expunged-tally nil)
1478 (defvar gnus-newsgroup-marked nil
1479 "Sorted list of ticked articles in the current newsgroup (a subset of unread art).")
1481 (defvar gnus-newsgroup-spam-marked nil
1482 "List of ranges of articles that have been marked as spam.")
1484 (defvar gnus-newsgroup-killed nil
1485 "List of ranges of articles that have been through the scoring process.")
1487 (defvar gnus-newsgroup-cached nil
1488 "Sorted list of articles that come from the article cache.")
1490 (defvar gnus-newsgroup-saved nil
1491 "List of articles that have been saved.")
1493 (defvar gnus-newsgroup-kill-headers nil)
1495 (defvar gnus-newsgroup-replied nil
1496 "List of articles that have been replied to in the current newsgroup.")
1498 (defvar gnus-newsgroup-forwarded nil
1499 "List of articles that have been forwarded in the current newsgroup.")
1501 (defvar gnus-newsgroup-expirable nil
1502 "Sorted list of articles in the current newsgroup that can be expired.")
1504 (defvar gnus-newsgroup-processable nil
1505 "List of articles in the current newsgroup that can be processed.")
1507 (defvar gnus-newsgroup-downloadable nil
1508 "Sorted list of articles in the current newsgroup that can be processed.")
1510 (defvar gnus-newsgroup-unfetched nil
1511 "Sorted list of articles in the current newsgroup whose headers have
1512 not been fetched into the agent.
1514 This list will always be a subset of gnus-newsgroup-undownloaded.")
1516 (defvar gnus-newsgroup-undownloaded nil
1517 "List of articles in the current newsgroup that haven't been downloaded.")
1519 (defvar gnus-newsgroup-unsendable nil
1520 "List of articles in the current newsgroup that won't be sent.")
1522 (defvar gnus-newsgroup-bookmarks nil
1523 "List of articles in the current newsgroup that have bookmarks.")
1525 (defvar gnus-newsgroup-dormant nil
1526 "Sorted list of dormant articles in the current newsgroup.")
1528 (defvar gnus-newsgroup-unseen nil
1529 "List of unseen articles in the current newsgroup.")
1531 (defvar gnus-newsgroup-seen nil
1532 "Range of seen articles in the current newsgroup.")
1534 (defvar gnus-newsgroup-unexist nil
1535 "Range of unexisting articles in the current newsgroup.")
1537 (defvar gnus-newsgroup-articles nil
1538 "List of articles in the current newsgroup.")
1540 (defvar gnus-newsgroup-scored nil
1541 "List of scored articles in the current newsgroup.")
1543 (defvar gnus-newsgroup-headers nil
1544 "List of article headers in the current newsgroup.")
1546 (defvar gnus-newsgroup-threads nil)
1548 (defvar gnus-newsgroup-prepared nil
1549 "Whether the current group has been prepared properly.")
1551 (defvar gnus-newsgroup-ancient nil
1552 "List of `gnus-fetch-old-headers' articles in the current newsgroup.")
1554 (defvar gnus-newsgroup-sparse nil)
1556 (defvar gnus-current-article nil)
1557 (defvar gnus-article-current nil)
1558 (defvar gnus-current-headers nil)
1559 (defvar gnus-have-all-headers nil)
1560 (defvar gnus-last-article nil)
1561 (defvar gnus-newsgroup-history nil)
1562 (defvar gnus-newsgroup-charset nil)
1563 (defvar gnus-newsgroup-ephemeral-charset nil)
1564 (defvar gnus-newsgroup-ephemeral-ignored-charsets nil)
1566 (defvar gnus-article-before-search nil)
1568 (defvar gnus-summary-local-variables
1569 '(gnus-newsgroup-name
1572 gnus-newsgroup-unreads
1573 gnus-newsgroup-unselected
1574 gnus-newsgroup-marked
1575 gnus-newsgroup-spam-marked
1576 gnus-newsgroup-reads
1577 gnus-newsgroup-saved
1578 gnus-newsgroup-replied
1579 gnus-newsgroup-forwarded
1580 gnus-newsgroup-expirable
1581 gnus-newsgroup-killed
1582 gnus-newsgroup-unseen
1584 gnus-newsgroup-unexist
1585 gnus-newsgroup-cached
1586 gnus-newsgroup-downloadable
1587 gnus-newsgroup-undownloaded
1588 gnus-newsgroup-unsendable
1590 gnus-newsgroup-begin gnus-newsgroup-end
1591 gnus-newsgroup-last-rmail gnus-newsgroup-last-mail
1592 gnus-newsgroup-last-folder gnus-newsgroup-last-file
1593 gnus-newsgroup-last-directory
1594 gnus-newsgroup-auto-expire
1595 gnus-newsgroup-processable
1596 gnus-newsgroup-unfetched
1597 gnus-newsgroup-articles
1598 gnus-newsgroup-bookmarks gnus-newsgroup-dormant
1599 gnus-newsgroup-headers gnus-newsgroup-threads
1600 gnus-newsgroup-prepared gnus-summary-highlight-line-function
1601 gnus-current-article gnus-current-headers gnus-have-all-headers
1602 gnus-last-article gnus-article-internal-prepare-hook
1603 (gnus-summary-article-delete-hook . global)
1604 (gnus-summary-article-move-hook . global)
1605 gnus-newsgroup-dependencies gnus-newsgroup-selected-overlay
1606 gnus-newsgroup-scored gnus-newsgroup-kill-headers
1607 gnus-thread-expunge-below
1608 gnus-score-alist gnus-current-score-file
1609 (gnus-summary-expunge-below . global)
1610 (gnus-summary-mark-below . global)
1611 (gnus-orphan-score . global)
1612 gnus-newsgroup-active gnus-scores-exclude-files
1613 gnus-newsgroup-highest
1614 gnus-newsgroup-history gnus-newsgroup-ancient
1615 gnus-newsgroup-sparse gnus-newsgroup-process-stack
1616 (gnus-newsgroup-adaptive . gnus-use-adaptive-scoring)
1617 gnus-newsgroup-adaptive-score-file (gnus-reffed-article-number . -1)
1618 (gnus-newsgroup-expunged-tally . 0)
1619 gnus-cache-removable-articles
1620 gnus-newsgroup-data gnus-newsgroup-data-reverse
1621 gnus-newsgroup-limit gnus-newsgroup-limits
1622 gnus-newsgroup-charset gnus-newsgroup-display
1623 gnus-summary-use-undownloaded-faces)
1624 "Variables that are buffer-local to the summary buffers.")
1626 (defvar gnus-newsgroup-variables nil
1627 "A list of variables that have separate values in different newsgroups.
1628 A list of newsgroup (summary buffer) local variables, or cons of
1629 variables and their default expressions to be evalled (when the default
1630 values are not nil), that should be made global while the summary buffer
1633 Note: The default expressions will be evaluated (using function `eval')
1634 before assignment to the local variable rather than just assigned to it.
1635 If the default expression is the symbol `global', that symbol will not
1636 be evaluated but the global value of the local variable will be used
1639 These variables can be used to set variables in the group parameters
1640 while still allowing them to affect operations done in other buffers.
1643 \(setq gnus-newsgroup-variables
1644 '(message-use-followup-to
1645 (gnus-visible-headers .
1646 \"^From:\\\\|^Newsgroups:\\\\|^Subject:\\\\|^Date:\\\\|^To:\")))
1650 ;; Bind features so that require will believe that gnus-sum has
1651 ;; already been loaded (avoids infinite recursion)
1652 (let ((features (cons 'gnus-sum features)))
1653 (require 'gnus-art)))
1657 (defvar gnus-decode-encoded-word-methods
1658 '(mail-decode-encoded-word-string)
1659 "List of methods used to decode encoded words.
1661 This variable is a list of FUNCTION or (REGEXP . FUNCTION). If item
1662 is FUNCTION, FUNCTION will be apply to all newsgroups. If item is a
1663 \(REGEXP . FUNCTION), FUNCTION will be applied only to the newsgroups
1664 whose names match REGEXP.
1667 \((\"chinese\" . gnus-decode-encoded-word-string-by-guess)
1668 mail-decode-encoded-word-string
1669 (\"chinese\" . rfc1843-decode-string))")
1671 (defvar gnus-decode-encoded-word-methods-cache nil)
1673 (defun gnus-multi-decode-encoded-word-string (string)
1674 "Apply the functions from `gnus-encoded-word-methods' that match."
1675 (unless (and gnus-decode-encoded-word-methods-cache
1676 (eq gnus-newsgroup-name
1677 (car gnus-decode-encoded-word-methods-cache)))
1678 (setq gnus-decode-encoded-word-methods-cache (list gnus-newsgroup-name))
1679 (dolist (method gnus-decode-encoded-word-methods)
1680 (if (symbolp method)
1681 (nconc gnus-decode-encoded-word-methods-cache (list method))
1682 (if (and gnus-newsgroup-name
1683 (string-match (car method) gnus-newsgroup-name))
1684 (nconc gnus-decode-encoded-word-methods-cache
1685 (list (cdr method)))))))
1686 (dolist (method (cdr gnus-decode-encoded-word-methods-cache) string)
1687 (setq string (funcall method string))))
1689 ;; Subject simplification.
1691 (defun gnus-simplify-whitespace (str)
1692 "Remove excessive whitespace from STR."
1694 (while (string-match "[ \t][ \t]+" str)
1695 (setq str (concat (substring str 0 (match-beginning 0))
1697 (substring str (match-end 0)))))
1699 (when (string-match "^[ \t]+" str)
1700 (setq str (substring str (match-end 0))))
1702 (when (string-match "[ \t]+$" str)
1703 (setq str (substring str 0 (match-beginning 0))))
1706 (defun gnus-simplify-all-whitespace (str)
1707 "Remove all whitespace from STR."
1708 (while (string-match "[ \t\n]+" str)
1709 (setq str (replace-match "" nil nil str)))
1712 (defsubst gnus-simplify-subject-re (subject)
1713 "Remove \"Re:\" from subject lines."
1714 (if (string-match message-subject-re-regexp subject)
1715 (substring subject (match-end 0))
1718 (defun gnus-simplify-subject (subject &optional re-only)
1719 "Remove `Re:' and words in parentheses.
1720 If RE-ONLY is non-nil, strip leading `Re:'s only."
1721 (let ((case-fold-search t)) ;Ignore case.
1722 ;; Remove `Re:', `Re^N:', `Re(n)', and `Re[n]:'.
1723 (when (string-match "\\`\\(re\\([[(^][0-9]+[])]?\\)?:[ \t]*\\)+" subject)
1724 (setq subject (substring subject (match-end 0))))
1725 ;; Remove uninteresting prefixes.
1726 (when (and (not re-only)
1727 gnus-simplify-ignored-prefixes
1728 (string-match gnus-simplify-ignored-prefixes subject))
1729 (setq subject (substring subject (match-end 0))))
1730 ;; Remove words in parentheses from end.
1732 (while (string-match "[ \t\n]*([^()]*)[ \t\n]*\\'" subject)
1733 (setq subject (substring subject 0 (match-beginning 0)))))
1734 ;; Return subject string.
1737 ;; Remove any leading "re:"s, any trailing paren phrases, and simplify
1739 (defsubst gnus-simplify-buffer-fuzzy-step (regexp &optional newtext)
1740 (goto-char (point-min))
1741 (while (re-search-forward regexp nil t)
1742 (replace-match (or newtext ""))))
1744 (defun gnus-simplify-buffer-fuzzy (regexp)
1745 "Simplify string in the buffer fuzzily.
1746 The string in the accessible portion of the current buffer is simplified.
1747 It is assumed to be a single-line subject.
1748 Whitespace is generally cleaned up, and miscellaneous leading/trailing
1749 matter is removed. Additional things can be deleted by setting
1750 `gnus-simplify-subject-fuzzy-regexp'."
1751 (let ((case-fold-search t)
1753 (gnus-simplify-buffer-fuzzy-step "\t" " ")
1755 (while (not (eq modified-tick (buffer-modified-tick)))
1756 (setq modified-tick (buffer-modified-tick))
1759 (mapc 'gnus-simplify-buffer-fuzzy-step regexp))
1761 (gnus-simplify-buffer-fuzzy-step regexp)))
1762 (gnus-simplify-buffer-fuzzy-step "^ *\\[[-+?*!][-+?*!]\\] *")
1763 (gnus-simplify-buffer-fuzzy-step
1764 "^ *\\(re\\|fw\\|fwd\\)[[{(^0-9]*[])}]?[:;] *")
1765 (gnus-simplify-buffer-fuzzy-step "^[[].*:\\( .*\\)[]]$" "\\1"))
1767 (gnus-simplify-buffer-fuzzy-step " *[[{(][^()\n]*[]})] *$")
1768 (gnus-simplify-buffer-fuzzy-step " +" " ")
1769 (gnus-simplify-buffer-fuzzy-step " $")
1770 (gnus-simplify-buffer-fuzzy-step "^ +")))
1772 (defun gnus-simplify-subject-fuzzy (subject)
1773 "Simplify a subject string fuzzily.
1774 See `gnus-simplify-buffer-fuzzy' for details."
1776 (let ((regexp gnus-simplify-subject-fuzzy-regexp))
1777 (gnus-set-work-buffer)
1778 (let ((case-fold-search t))
1779 ;; Remove uninteresting prefixes.
1780 (when (and gnus-simplify-ignored-prefixes
1781 (string-match gnus-simplify-ignored-prefixes subject))
1782 (setq subject (substring subject (match-end 0))))
1784 (inline (gnus-simplify-buffer-fuzzy regexp))
1787 (defsubst gnus-simplify-subject-fully (subject)
1788 "Simplify a subject string according to `gnus-summary-gather-subject-limit'."
1790 (gnus-simplify-subject-functions
1791 (gnus-map-function gnus-simplify-subject-functions subject))
1792 ((null gnus-summary-gather-subject-limit)
1793 (gnus-simplify-subject-re subject))
1794 ((eq gnus-summary-gather-subject-limit 'fuzzy)
1795 (gnus-simplify-subject-fuzzy subject))
1796 ((numberp gnus-summary-gather-subject-limit)
1797 (truncate-string-to-width (gnus-simplify-subject-re subject)
1798 gnus-summary-gather-subject-limit))
1802 (defsubst gnus-subject-equal (s1 s2 &optional simple-first)
1803 "Check whether two subjects are equal.
1804 If optional argument SIMPLE-FIRST is t, first argument is already
1807 ((null simple-first)
1808 (equal (gnus-simplify-subject-fully s1)
1809 (gnus-simplify-subject-fully s2)))
1812 (gnus-simplify-subject-fully s2)))))
1814 (defun gnus-summary-bubble-group ()
1815 "Increase the score of the current group.
1816 This is a handy function to add to `gnus-summary-exit-hook' to
1817 increase the score of each group you read."
1818 (gnus-group-add-score gnus-newsgroup-name))
1822 ;;; Gnus summary mode
1825 (put 'gnus-summary-mode 'mode-class 'special)
1827 (defvar gnus-article-commands-menu)
1829 ;; Non-orthogonal keys
1831 (gnus-define-keys gnus-summary-mode-map
1832 " " gnus-summary-next-page
1833 [?\S-\ ] gnus-summary-prev-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 "\t" gnus-summary-widget-forward
1927 [backtab] gnus-summary-widget-backward
1928 "t" gnus-summary-toggle-header
1929 "g" gnus-summary-show-article
1930 "l" gnus-summary-goto-last-article
1931 "\C-c\C-v\C-v" gnus-uu-decode-uu-view
1932 "\C-d" gnus-summary-enter-digest-group
1933 "\M-\C-d" gnus-summary-read-document
1934 "\M-\C-e" gnus-summary-edit-parameters
1935 "\M-\C-a" gnus-summary-customize-parameters
1937 "*" gnus-cache-enter-article
1938 "\M-*" gnus-cache-remove-article
1939 "\M-&" gnus-summary-universal-argument
1940 "\C-l" gnus-recenter
1941 "I" gnus-summary-increase-score
1942 "L" gnus-summary-lower-score
1943 "\M-i" gnus-symbolic-argument
1944 "h" gnus-summary-select-article-buffer
1946 "b" gnus-article-view-part
1947 "\M-t" gnus-summary-toggle-display-buttonized
1949 "V" gnus-summary-score-map
1950 "X" gnus-uu-extract-map
1951 "S" gnus-summary-send-map)
1953 ;; Sort of orthogonal keymap
1954 (gnus-define-keys (gnus-summary-mark-map "M" gnus-summary-mode-map)
1955 "t" gnus-summary-tick-article-forward
1956 "!" gnus-summary-tick-article-forward
1957 "d" gnus-summary-mark-as-read-forward
1958 "r" gnus-summary-mark-as-read-forward
1959 "c" gnus-summary-clear-mark-forward
1960 " " gnus-summary-clear-mark-forward
1961 "e" gnus-summary-mark-as-expirable
1962 "x" gnus-summary-mark-as-expirable
1963 "?" gnus-summary-mark-as-dormant
1964 "b" gnus-summary-set-bookmark
1965 "B" gnus-summary-remove-bookmark
1966 "#" gnus-summary-mark-as-processable
1967 "\M-#" gnus-summary-unmark-as-processable
1968 "S" gnus-summary-limit-include-expunged
1969 "C" gnus-summary-catchup
1970 "H" gnus-summary-catchup-to-here
1971 "h" gnus-summary-catchup-from-here
1972 "\C-c" gnus-summary-catchup-all
1973 "k" gnus-summary-kill-same-subject-and-select
1974 "K" gnus-summary-kill-same-subject
1975 "P" gnus-uu-mark-map)
1977 (gnus-define-keys (gnus-summary-mscore-map "V" gnus-summary-mark-map)
1978 "c" gnus-summary-clear-above
1979 "u" gnus-summary-tick-above
1980 "m" gnus-summary-mark-above
1981 "k" gnus-summary-kill-below)
1983 (gnus-define-keys (gnus-summary-limit-map "/" gnus-summary-mode-map)
1984 "/" gnus-summary-limit-to-subject
1985 "n" gnus-summary-limit-to-articles
1986 "b" gnus-summary-limit-to-bodies
1987 "h" gnus-summary-limit-to-headers
1988 "w" gnus-summary-pop-limit
1989 "s" gnus-summary-limit-to-subject
1990 "a" gnus-summary-limit-to-author
1991 "u" gnus-summary-limit-to-unread
1992 "m" gnus-summary-limit-to-marks
1993 "M" gnus-summary-limit-exclude-marks
1994 "v" gnus-summary-limit-to-score
1995 "*" gnus-summary-limit-include-cached
1996 "D" gnus-summary-limit-include-dormant
1997 "T" gnus-summary-limit-include-thread
1998 "d" gnus-summary-limit-exclude-dormant
1999 "t" gnus-summary-limit-to-age
2000 "." gnus-summary-limit-to-unseen
2001 "x" gnus-summary-limit-to-extra
2002 "p" gnus-summary-limit-to-display-predicate
2003 "E" gnus-summary-limit-include-expunged
2004 "c" gnus-summary-limit-exclude-childless-dormant
2005 "C" gnus-summary-limit-mark-excluded-as-read
2006 "o" gnus-summary-insert-old-articles
2007 "N" gnus-summary-insert-new-articles
2008 "S" gnus-summary-limit-to-singletons
2009 "r" gnus-summary-limit-to-replied
2010 "R" gnus-summary-limit-to-recipient
2011 "A" gnus-summary-limit-to-address)
2013 (gnus-define-keys (gnus-summary-goto-map "G" gnus-summary-mode-map)
2014 "n" gnus-summary-next-unread-article
2015 "p" gnus-summary-prev-unread-article
2016 "N" gnus-summary-next-article
2017 "P" gnus-summary-prev-article
2018 "\C-n" gnus-summary-next-same-subject
2019 "\C-p" gnus-summary-prev-same-subject
2020 "\M-n" gnus-summary-next-unread-subject
2021 "\M-p" gnus-summary-prev-unread-subject
2022 "f" gnus-summary-first-unread-article
2023 "b" gnus-summary-best-unread-article
2024 "j" gnus-summary-goto-article
2025 "g" gnus-summary-goto-subject
2026 "l" gnus-summary-goto-last-article
2027 "o" gnus-summary-pop-article)
2029 (gnus-define-keys (gnus-summary-thread-map "T" gnus-summary-mode-map)
2030 "k" gnus-summary-kill-thread
2031 "E" gnus-summary-expire-thread
2032 "l" gnus-summary-lower-thread
2033 "i" gnus-summary-raise-thread
2034 "T" gnus-summary-toggle-threads
2035 "t" gnus-summary-rethread-current
2036 "^" gnus-summary-reparent-thread
2037 "\M-^" gnus-summary-reparent-children
2038 "s" gnus-summary-show-thread
2039 "S" gnus-summary-show-all-threads
2040 "h" gnus-summary-hide-thread
2041 "H" gnus-summary-hide-all-threads
2042 "n" gnus-summary-next-thread
2043 "p" gnus-summary-prev-thread
2044 "u" gnus-summary-up-thread
2045 "o" gnus-summary-top-thread
2046 "d" gnus-summary-down-thread
2047 "#" gnus-uu-mark-thread
2048 "\M-#" gnus-uu-unmark-thread)
2050 (gnus-define-keys (gnus-summary-buffer-map "Y" gnus-summary-mode-map)
2051 "g" gnus-summary-prepare
2052 "c" gnus-summary-insert-cached-articles
2053 "d" gnus-summary-insert-dormant-articles
2054 "t" gnus-summary-insert-ticked-articles)
2056 (gnus-define-keys (gnus-summary-exit-map "Z" gnus-summary-mode-map)
2057 "c" gnus-summary-catchup-and-exit
2058 "C" gnus-summary-catchup-all-and-exit
2059 "E" gnus-summary-exit-no-update
2060 "Q" gnus-summary-exit
2061 "Z" gnus-summary-exit
2062 "n" gnus-summary-catchup-and-goto-next-group
2063 "p" gnus-summary-catchup-and-goto-prev-group
2064 "R" gnus-summary-reselect-current-group
2065 "G" gnus-summary-rescan-group
2066 "N" gnus-summary-next-group
2067 "s" gnus-summary-save-newsrc
2068 "P" gnus-summary-prev-group)
2070 (gnus-define-keys (gnus-summary-article-map "A" gnus-summary-mode-map)
2071 " " gnus-summary-next-page
2072 "n" gnus-summary-next-page
2073 [?\S-\ ] gnus-summary-prev-page
2074 "\177" gnus-summary-prev-page
2075 [delete] gnus-summary-prev-page
2076 "p" gnus-summary-prev-page
2077 "\r" gnus-summary-scroll-up
2078 "\M-\r" gnus-summary-scroll-down
2079 "<" gnus-summary-beginning-of-article
2080 ">" gnus-summary-end-of-article
2081 "b" gnus-summary-beginning-of-article
2082 "e" gnus-summary-end-of-article
2083 "^" gnus-summary-refer-parent-article
2084 "r" gnus-summary-refer-parent-article
2085 "C" gnus-summary-show-complete-article
2086 "D" gnus-summary-enter-digest-group
2087 "R" gnus-summary-refer-references
2088 "T" gnus-summary-refer-thread
2089 "W" gnus-warp-to-article
2090 "g" gnus-summary-show-article
2091 "s" gnus-summary-isearch-article
2092 "\t" gnus-summary-widget-forward
2093 [backtab] gnus-summary-widget-backward
2094 "P" gnus-summary-print-article
2095 "S" gnus-sticky-article
2096 "M" gnus-mailing-list-insinuate
2097 "t" gnus-article-babel)
2099 (gnus-define-keys (gnus-summary-wash-map "W" gnus-summary-mode-map)
2100 "b" gnus-article-add-buttons
2101 "B" gnus-article-add-buttons-to-head
2102 "o" gnus-article-treat-overstrike
2103 "e" gnus-article-emphasize
2104 "w" gnus-article-fill-cited-article
2105 "Q" gnus-article-fill-long-lines
2106 "L" gnus-article-toggle-truncate-lines
2107 "C" gnus-article-capitalize-sentences
2108 "c" gnus-article-remove-cr
2109 "q" gnus-article-de-quoted-unreadable
2110 "6" gnus-article-de-base64-unreadable
2111 "Z" gnus-article-decode-HZ
2112 "A" gnus-article-treat-ansi-sequences
2113 "h" gnus-article-wash-html
2114 "u" gnus-article-unsplit-urls
2115 "s" gnus-summary-force-verify-and-decrypt
2116 "f" gnus-article-display-x-face
2117 "l" gnus-summary-stop-page-breaking
2118 "r" gnus-summary-caesar-message
2119 "m" gnus-summary-morse-message
2120 "t" gnus-summary-toggle-header
2121 "g" gnus-treat-smiley
2122 "v" gnus-summary-verbose-headers
2123 "a" gnus-article-strip-headers-in-body ;; mnemonic: wash archive
2124 "p" gnus-article-verify-x-pgp-sig
2125 "d" gnus-article-treat-dumbquotes
2126 "U" gnus-article-treat-non-ascii
2127 "i" gnus-summary-idna-message)
2129 (gnus-define-keys (gnus-summary-wash-deuglify-map "Y" gnus-summary-wash-map)
2130 ;; mnemonic: deuglif*Y*
2131 "u" gnus-article-outlook-unwrap-lines
2132 "a" gnus-article-outlook-repair-attribution
2133 "c" gnus-article-outlook-rearrange-citation
2134 "f" gnus-article-outlook-deuglify-article) ;; mnemonic: full deuglify
2136 (gnus-define-keys (gnus-summary-wash-hide-map "W" gnus-summary-wash-map)
2137 "a" gnus-article-hide
2138 "h" gnus-article-hide-headers
2139 "b" gnus-article-hide-boring-headers
2140 "s" gnus-article-hide-signature
2141 "c" gnus-article-hide-citation
2142 "C" gnus-article-hide-citation-in-followups
2143 "l" gnus-article-hide-list-identifiers
2144 "B" gnus-article-strip-banner
2145 "P" gnus-article-hide-pem
2146 "\C-c" gnus-article-hide-citation-maybe)
2148 (gnus-define-keys (gnus-summary-wash-highlight-map "H" gnus-summary-wash-map)
2149 "a" gnus-article-highlight
2150 "h" gnus-article-highlight-headers
2151 "c" gnus-article-highlight-citation
2152 "s" gnus-article-highlight-signature)
2154 (gnus-define-keys (gnus-summary-wash-header-map "G" gnus-summary-wash-map)
2155 "f" gnus-article-treat-fold-headers
2156 "u" gnus-article-treat-unfold-headers
2157 "n" gnus-article-treat-fold-newsgroups)
2159 (gnus-define-keys (gnus-summary-wash-display-map "D" gnus-summary-wash-map)
2160 "x" gnus-article-display-x-face
2161 "d" gnus-article-display-face
2162 "s" gnus-treat-smiley
2163 "D" gnus-article-remove-images
2164 "W" gnus-article-show-images
2165 "f" gnus-treat-from-picon
2166 "m" gnus-treat-mail-picon
2167 "n" gnus-treat-newsgroups-picon
2168 "g" gnus-treat-from-gravatar
2169 "h" gnus-treat-mail-gravatar)
2171 (gnus-define-keys (gnus-summary-wash-mime-map "M" gnus-summary-wash-map)
2172 "w" gnus-article-decode-mime-words
2173 "c" gnus-article-decode-charset
2174 "v" gnus-mime-view-all-parts
2175 "b" gnus-article-view-part)
2177 (gnus-define-keys (gnus-summary-wash-time-map "T" gnus-summary-wash-map)
2178 "z" gnus-article-date-ut
2179 "u" gnus-article-date-ut
2180 "l" gnus-article-date-local
2181 "p" gnus-article-date-english
2182 "e" gnus-article-date-lapsed
2183 "o" gnus-article-date-original
2184 "i" gnus-article-date-iso8601
2185 "s" gnus-article-date-user)
2187 (gnus-define-keys (gnus-summary-wash-empty-map "E" gnus-summary-wash-map)
2188 "t" gnus-article-remove-trailing-blank-lines
2189 "l" gnus-article-strip-leading-blank-lines
2190 "m" gnus-article-strip-multiple-blank-lines
2191 "a" gnus-article-strip-blank-lines
2192 "A" gnus-article-strip-all-blank-lines
2193 "s" gnus-article-strip-leading-space
2194 "e" gnus-article-strip-trailing-space
2195 "w" gnus-article-remove-leading-whitespace)
2197 (gnus-define-keys (gnus-summary-help-map "H" gnus-summary-mode-map)
2199 "d" gnus-summary-describe-group
2200 "h" gnus-summary-describe-briefly
2201 "i" gnus-info-find-node)
2203 (gnus-define-keys (gnus-summary-backend-map "B" gnus-summary-mode-map)
2204 "e" gnus-summary-expire-articles
2205 "\M-\C-e" gnus-summary-expire-articles-now
2206 "\177" gnus-summary-delete-article
2207 [delete] gnus-summary-delete-article
2208 [backspace] gnus-summary-delete-article
2209 "m" gnus-summary-move-article
2210 "r" gnus-summary-respool-article
2211 "w" gnus-summary-edit-article
2212 "c" gnus-summary-copy-article
2213 "B" gnus-summary-crosspost-article
2214 "q" gnus-summary-respool-query
2215 "t" gnus-summary-respool-trace
2216 "i" gnus-summary-import-article
2217 "I" gnus-summary-create-article
2218 "p" gnus-summary-article-posted-p)
2220 (gnus-define-keys (gnus-summary-save-map "O" gnus-summary-mode-map)
2221 "o" gnus-summary-save-article
2222 "m" gnus-summary-save-article-mail
2223 "F" gnus-summary-write-article-file
2224 "r" gnus-summary-save-article-rmail
2225 "f" gnus-summary-save-article-file
2226 "b" gnus-summary-save-article-body-file
2227 "B" gnus-summary-write-article-body-file
2228 "h" gnus-summary-save-article-folder
2229 "v" gnus-summary-save-article-vm
2230 "p" gnus-summary-pipe-output
2231 "P" gnus-summary-muttprint)
2233 (gnus-define-keys (gnus-summary-mime-map "K" gnus-summary-mode-map)
2234 "b" gnus-summary-display-buttonized
2235 "m" gnus-summary-repair-multipart
2236 "v" gnus-article-view-part
2237 "o" gnus-article-save-part
2238 "O" gnus-article-save-part-and-strip
2239 "r" gnus-article-replace-part
2240 "d" gnus-article-delete-part
2241 "t" gnus-article-view-part-as-type
2242 "j" gnus-article-jump-to-part
2243 "c" gnus-article-copy-part
2244 "C" gnus-article-view-part-as-charset
2245 "e" gnus-article-view-part-externally
2246 "H" gnus-article-browse-html-article
2247 "E" gnus-article-encrypt-body
2248 "i" gnus-article-inline-part
2249 "|" gnus-article-pipe-part)
2251 (gnus-define-keys (gnus-uu-mark-map "P" gnus-summary-mark-map)
2252 "p" gnus-summary-mark-as-processable
2253 "u" gnus-summary-unmark-as-processable
2254 "U" gnus-summary-unmark-all-processable
2255 "v" gnus-uu-mark-over
2256 "s" gnus-uu-mark-series
2257 "r" gnus-uu-mark-region
2258 "g" gnus-uu-unmark-region
2259 "R" gnus-uu-mark-by-regexp
2260 "G" gnus-uu-unmark-by-regexp
2261 "t" gnus-uu-mark-thread
2262 "T" gnus-uu-unmark-thread
2263 "a" gnus-uu-mark-all
2264 "b" gnus-uu-mark-buffer
2265 "S" gnus-uu-mark-sparse
2266 "k" gnus-summary-kill-process-mark
2267 "y" gnus-summary-yank-process-mark
2268 "w" gnus-summary-save-process-mark
2269 "i" gnus-uu-invert-processable)
2271 (gnus-define-keys (gnus-uu-extract-map "X" gnus-summary-mode-map)
2272 ;;"x" gnus-uu-extract-any
2273 "m" gnus-summary-save-parts
2274 "u" gnus-uu-decode-uu
2275 "U" gnus-uu-decode-uu-and-save
2276 "s" gnus-uu-decode-unshar
2277 "S" gnus-uu-decode-unshar-and-save
2278 "o" gnus-uu-decode-save
2279 "O" gnus-uu-decode-save
2280 "b" gnus-uu-decode-binhex
2281 "B" gnus-uu-decode-binhex
2282 "Y" gnus-uu-decode-yenc
2283 "p" gnus-uu-decode-postscript
2284 "P" gnus-uu-decode-postscript-and-save)
2287 (gnus-uu-extract-view-map "v" gnus-uu-extract-map)
2288 "u" gnus-uu-decode-uu-view
2289 "U" gnus-uu-decode-uu-and-save-view
2290 "s" gnus-uu-decode-unshar-view
2291 "S" gnus-uu-decode-unshar-and-save-view
2292 "o" gnus-uu-decode-save-view
2293 "O" gnus-uu-decode-save-view
2294 "b" gnus-uu-decode-binhex-view
2295 "B" gnus-uu-decode-binhex-view
2296 "p" gnus-uu-decode-postscript-view
2297 "P" gnus-uu-decode-postscript-and-save-view)
2299 (defvar gnus-article-post-menu nil)
2301 (defconst gnus-summary-menu-maxlen 20)
2303 (defun gnus-summary-menu-split (menu)
2304 ;; If we have lots of elements, divide them into groups of 20
2305 ;; and make a pane (or submenu) for each one.
2306 (if (> (length menu) (/ (* gnus-summary-menu-maxlen 3) 2))
2307 (let ((menu menu) sublists next
2310 ;; Pull off the next gnus-summary-menu-maxlen elements
2311 ;; and make them the next element of sublist.
2312 (setq next (nthcdr gnus-summary-menu-maxlen menu))
2314 (setcdr (nthcdr (1- gnus-summary-menu-maxlen) menu)
2316 (setq sublists (cons (cons (format "%s ... %s" (aref (car menu) 0)
2317 (aref (car (last menu)) 0)) menu)
2321 (nreverse sublists))
2322 ;; Few elements--put them all in one pane.
2325 (defun gnus-summary-make-menu-bar ()
2326 (gnus-turn-off-edit-menu 'summary)
2328 (unless (boundp 'gnus-summary-misc-menu)
2331 gnus-summary-kill-menu gnus-summary-mode-map ""
2336 ["Customize" gnus-score-customize t])
2337 (gnus-make-score-map 'increase)
2338 (gnus-make-score-map 'lower)
2340 ["Kill below" gnus-summary-kill-below t]
2341 ["Mark above" gnus-summary-mark-above t]
2342 ["Tick above" gnus-summary-tick-above t]
2343 ["Clear above" gnus-summary-clear-above t])
2344 ["Current score" gnus-summary-current-score t]
2345 ["Set score" gnus-summary-set-score t]
2346 ["Switch current score file..." gnus-score-change-score-file t]
2347 ["Set mark below..." gnus-score-set-mark-below t]
2348 ["Set expunge below..." gnus-score-set-expunge-below t]
2349 ["Edit current score file" gnus-score-edit-current-scores t]
2350 ["Edit score file..." gnus-score-edit-file t]
2351 ["Trace score" gnus-score-find-trace t]
2352 ["Find words" gnus-score-find-favourite-words t]
2353 ["Rescore buffer" gnus-summary-rescore t]
2354 ["Increase score..." gnus-summary-increase-score t]
2355 ["Lower score..." gnus-summary-lower-score t]))))
2357 ;; Define both the Article menu in the summary buffer and the
2358 ;; equivalent Commands menu in the article buffer here for
2362 ["All" gnus-article-hide t]
2363 ["Headers" gnus-article-hide-headers t]
2364 ["Signature" gnus-article-hide-signature t]
2365 ["Citation" gnus-article-hide-citation t]
2366 ["List identifiers" gnus-article-hide-list-identifiers t]
2367 ["Banner" gnus-article-strip-banner t]
2368 ["Boring headers" gnus-article-hide-boring-headers t])
2370 ["All" gnus-article-highlight t]
2371 ["Headers" gnus-article-highlight-headers t]
2372 ["Signature" gnus-article-highlight-signature t]
2373 ["Citation" gnus-article-highlight-citation t])
2375 ["Words" gnus-article-decode-mime-words t]
2376 ["Charset" gnus-article-decode-charset t]
2377 ["QP" gnus-article-de-quoted-unreadable t]
2378 ["Base64" gnus-article-de-base64-unreadable t]
2379 ["View MIME buttons" gnus-summary-display-buttonized t]
2380 ["View all" gnus-mime-view-all-parts t]
2381 ["Verify and Decrypt" gnus-summary-force-verify-and-decrypt t]
2382 ["Encrypt body" gnus-article-encrypt-body
2383 :active (not (gnus-group-read-only-p))
2384 ,@(if (featurep 'xemacs) nil
2385 '(:help "Encrypt the message body on disk"))]
2386 ["Extract all parts..." gnus-summary-save-parts t]
2388 ["Repair multipart" gnus-summary-repair-multipart t]
2389 ["Pipe part..." gnus-article-pipe-part t]
2390 ["Inline part" gnus-article-inline-part t]
2391 ["View part as type..." gnus-article-view-part-as-type t]
2392 ["Encrypt body" gnus-article-encrypt-body
2393 :active (not (gnus-group-read-only-p))
2394 ,@(if (featurep 'xemacs) nil
2395 '(:help "Encrypt the message body on disk"))]
2396 ["View part externally" gnus-article-view-part-externally t]
2397 ["View HTML parts in browser" gnus-article-browse-html-article t]
2398 ["View part with charset..." gnus-article-view-part-as-charset t]
2399 ["Copy part" gnus-article-copy-part t]
2400 ["Save part..." gnus-article-save-part t]
2401 ["View part" gnus-article-view-part t]))
2403 ["Local" gnus-article-date-local t]
2404 ["ISO8601" gnus-article-date-iso8601 t]
2405 ["UT" gnus-article-date-ut t]
2406 ["Original" gnus-article-date-original t]
2407 ["Lapsed" gnus-article-date-lapsed t]
2408 ["User-defined" gnus-article-date-user t])
2410 ["Remove images" gnus-article-remove-images t]
2411 ["Toggle smiley" gnus-treat-smiley t]
2412 ["Show X-Face" gnus-article-display-x-face t]
2413 ["Show picons in From" gnus-treat-from-picon t]
2414 ["Show picons in mail headers" gnus-treat-mail-picon t]
2415 ["Show picons in news headers" gnus-treat-newsgroups-picon t]
2416 ["Show Gravatars in From" gnus-treat-from-gravatar t]
2417 ["Show Gravatars in mail headers" gnus-treat-mail-gravatar t]
2418 ("View as different encoding"
2419 ,@(gnus-summary-menu-split
2422 ;; Since easymenu under Emacs doesn't allow
2423 ;; lambda forms for menu commands, we should
2424 ;; provide intern'ed function symbols.
2425 (let ((command (intern (format "\
2426 gnus-summary-show-article-from-menu-as-charset-%s" cs))))
2430 (let ((gnus-summary-show-article-charset-alist
2432 (gnus-summary-show-article 1))))
2433 `[,(symbol-name cs) ,command t]))
2434 (sort (if (fboundp 'coding-system-list)
2435 (coding-system-list)
2436 (mapcar 'car mm-mime-mule-charset-alist))
2440 ["Leading" gnus-article-strip-leading-blank-lines t]
2441 ["Multiple" gnus-article-strip-multiple-blank-lines t]
2442 ["Trailing" gnus-article-remove-trailing-blank-lines t]
2443 ["All of the above" gnus-article-strip-blank-lines t]
2444 ["All" gnus-article-strip-all-blank-lines t]
2445 ["Leading space" gnus-article-strip-leading-space t]
2446 ["Trailing space" gnus-article-strip-trailing-space t]
2447 ["Leading space in headers"
2448 gnus-article-remove-leading-whitespace t])
2449 ["Overstrike" gnus-article-treat-overstrike t]
2450 ["Dumb quotes" gnus-article-treat-dumbquotes t]
2451 ["Non-ASCII" gnus-article-treat-non-ascii t]
2452 ["Emphasis" gnus-article-emphasize t]
2453 ["Word wrap" gnus-article-fill-cited-article t]
2454 ["Fill long lines" gnus-article-fill-long-lines t]
2455 ["Toggle truncate long lines" gnus-article-toggle-truncate-lines t]
2456 ["Capitalize sentences" gnus-article-capitalize-sentences t]
2457 ["Remove CR" gnus-article-remove-cr t]
2458 ["Quoted-Printable" gnus-article-de-quoted-unreadable t]
2459 ["Base64" gnus-article-de-base64-unreadable t]
2460 ["Rot 13" gnus-summary-caesar-message
2461 ,@(if (featurep 'xemacs) '(t)
2462 '(:help "\"Caesar rotate\" article by 13"))]
2463 ["De-IDNA" gnus-summary-idna-message t]
2464 ["Morse decode" gnus-summary-morse-message t]
2465 ["Unix pipe..." gnus-summary-pipe-message t]
2466 ["Add buttons" gnus-article-add-buttons t]
2467 ["Add buttons to head" gnus-article-add-buttons-to-head t]
2468 ["Stop page breaking" gnus-summary-stop-page-breaking t]
2469 ["Verbose header" gnus-summary-verbose-headers t]
2470 ["Toggle header" gnus-summary-toggle-header t]
2471 ["Unfold headers" gnus-article-treat-unfold-headers t]
2472 ["Fold newsgroups" gnus-article-treat-fold-newsgroups t]
2473 ["Html" gnus-article-wash-html t]
2474 ["Unsplit URLs" gnus-article-unsplit-urls t]
2475 ["Verify X-PGP-Sig" gnus-article-verify-x-pgp-sig t]
2476 ["Decode HZ" gnus-article-decode-HZ t]
2477 ["ANSI sequences" gnus-article-treat-ansi-sequences t]
2478 ("(Outlook) Deuglify"
2479 ["Unwrap lines" gnus-article-outlook-unwrap-lines t]
2480 ["Repair attribution" gnus-article-outlook-repair-attribution t]
2481 ["Rearrange citation" gnus-article-outlook-rearrange-citation t]
2482 ["Full (Outlook) deuglify"
2483 gnus-article-outlook-deuglify-article t])
2486 ["Save in default format..." gnus-summary-save-article
2487 ,@(if (featurep 'xemacs) '(t)
2488 '(:help "Save article using default method"))]
2489 ["Save in file..." gnus-summary-save-article-file
2490 ,@(if (featurep 'xemacs) '(t)
2491 '(:help "Save article in file"))]
2492 ["Save in Unix mail format..." gnus-summary-save-article-mail t]
2493 ["Save in MH folder..." gnus-summary-save-article-folder t]
2494 ["Save in VM folder..." gnus-summary-save-article-vm t]
2495 ["Save in RMAIL mbox..." gnus-summary-save-article-rmail t]
2496 ["Save body in file..." gnus-summary-save-article-body-file t]
2497 ["Pipe through a filter..." gnus-summary-pipe-output t]
2498 ["Print with Muttprint..." gnus-summary-muttprint t]
2499 ["Print" gnus-summary-print-article
2500 ,@(if (featurep 'xemacs) '(t)
2501 '(:help "Generate and print a PostScript image"))])
2502 ("Copy, move,... (Backend)"
2503 ,@(if (featurep 'xemacs) nil
2504 '(:help "Copying, moving, expiring articles..."))
2505 ["Respool article..." gnus-summary-respool-article t]
2506 ["Move article..." gnus-summary-move-article
2507 (gnus-check-backend-function
2508 'request-move-article gnus-newsgroup-name)]
2509 ["Copy article..." gnus-summary-copy-article t]
2510 ["Crosspost article..." gnus-summary-crosspost-article
2511 (gnus-check-backend-function
2512 'request-replace-article gnus-newsgroup-name)]
2513 ["Import file..." gnus-summary-import-article
2514 (gnus-check-backend-function
2515 'request-accept-article gnus-newsgroup-name)]
2516 ["Create article..." gnus-summary-create-article
2517 (gnus-check-backend-function
2518 'request-accept-article gnus-newsgroup-name)]
2519 ["Check if posted" gnus-summary-article-posted-p t]
2520 ["Edit article" gnus-summary-edit-article
2521 (not (gnus-group-read-only-p))]
2522 ["Delete article" gnus-summary-delete-article
2523 (gnus-check-backend-function
2524 'request-expire-articles gnus-newsgroup-name)]
2525 ["Query respool" gnus-summary-respool-query t]
2526 ["Trace respool" gnus-summary-respool-trace t]
2527 ["Delete expirable articles" gnus-summary-expire-articles-now
2528 (gnus-check-backend-function
2529 'request-expire-articles gnus-newsgroup-name)])
2531 ["Uudecode" gnus-uu-decode-uu
2532 ,@(if (featurep 'xemacs) '(t)
2533 '(:help "Decode uuencoded article(s)"))]
2534 ["Uudecode and save" gnus-uu-decode-uu-and-save t]
2535 ["Unshar" gnus-uu-decode-unshar t]
2536 ["Unshar and save" gnus-uu-decode-unshar-and-save t]
2537 ["Save" gnus-uu-decode-save t]
2538 ["Binhex" gnus-uu-decode-binhex t]
2539 ["PostScript" gnus-uu-decode-postscript t]
2540 ["All MIME parts" gnus-summary-save-parts t])
2542 ["Enter article" gnus-cache-enter-article t]
2543 ["Remove article" gnus-cache-remove-article t])
2544 ["Translate" gnus-article-babel t]
2545 ["Select article buffer" gnus-summary-select-article-buffer t]
2546 ["Make article buffer sticky" gnus-sticky-article t]
2547 ["Enter digest buffer" gnus-summary-enter-digest-group t]
2548 ["Isearch article..." gnus-summary-isearch-article t]
2549 ["Beginning of the article" gnus-summary-beginning-of-article t]
2550 ["End of the article" gnus-summary-end-of-article t]
2551 ["Fetch parent of article" gnus-summary-refer-parent-article t]
2552 ["Fetch referenced articles" gnus-summary-refer-references t]
2553 ["Fetch current thread" gnus-summary-refer-thread t]
2554 ["Fetch article with id..." gnus-summary-refer-article t]
2555 ["Setup Mailing List Params" gnus-mailing-list-insinuate t]
2556 ["Redisplay" gnus-summary-show-article t]
2557 ["Raw article" gnus-summary-show-raw-article :keys "C-u g"])))
2559 gnus-summary-article-menu gnus-summary-mode-map ""
2560 (cons "Article" innards))
2562 (if (not (keymapp gnus-summary-article-menu))
2564 gnus-article-commands-menu gnus-article-mode-map ""
2565 (cons "Commands" innards))
2566 ;; in Emacs, don't share menu.
2567 (setq gnus-article-commands-menu
2568 (copy-keymap gnus-summary-article-menu))
2569 (define-key gnus-article-mode-map [menu-bar commands]
2570 (cons "Commands" gnus-article-commands-menu))))
2573 gnus-summary-thread-menu gnus-summary-mode-map ""
2575 ["Find all messages in thread" gnus-summary-refer-thread t]
2576 ["Toggle threading" gnus-summary-toggle-threads t]
2577 ["Hide threads" gnus-summary-hide-all-threads t]
2578 ["Show threads" gnus-summary-show-all-threads t]
2579 ["Hide thread" gnus-summary-hide-thread t]
2580 ["Show thread" gnus-summary-show-thread t]
2581 ["Go to next thread" gnus-summary-next-thread t]
2582 ["Go to previous thread" gnus-summary-prev-thread t]
2583 ["Go down thread" gnus-summary-down-thread t]
2584 ["Go up thread" gnus-summary-up-thread t]
2585 ["Top of thread" gnus-summary-top-thread t]
2586 ["Mark thread as read" gnus-summary-kill-thread t]
2587 ["Mark thread as expired" gnus-summary-expire-thread t]
2588 ["Lower thread score" gnus-summary-lower-thread t]
2589 ["Raise thread score" gnus-summary-raise-thread t]
2590 ["Rethread current" gnus-summary-rethread-current t]))
2593 gnus-summary-post-menu gnus-summary-mode-map ""
2595 ["Send a message (mail or news)" gnus-summary-post-news
2596 ,@(if (featurep 'xemacs) '(t)
2597 '(:help "Compose a new message (mail or news)"))]
2598 ["Followup" gnus-summary-followup
2599 ,@(if (featurep 'xemacs) '(t)
2600 '(:help "Post followup to this article"))]
2601 ["Followup and yank" gnus-summary-followup-with-original
2602 ,@(if (featurep 'xemacs) '(t)
2603 '(:help "Post followup to this article, quoting its contents"))]
2604 ["Supersede article" gnus-summary-supersede-article t]
2605 ["Cancel article" gnus-summary-cancel-article
2606 ,@(if (featurep 'xemacs) '(t)
2607 '(:help "Cancel an article you posted"))]
2608 ["Reply" gnus-summary-reply t]
2609 ["Reply and yank" gnus-summary-reply-with-original t]
2610 ["Wide reply" gnus-summary-wide-reply t]
2611 ["Wide reply and yank" gnus-summary-wide-reply-with-original
2612 ,@(if (featurep 'xemacs) '(t)
2613 '(:help "Mail a reply, quoting this article"))]
2614 ["Very wide reply" gnus-summary-very-wide-reply t]
2615 ["Very wide reply and yank" gnus-summary-very-wide-reply-with-original
2616 ,@(if (featurep 'xemacs) '(t)
2617 '(:help "Mail a very wide reply, quoting this article"))]
2618 ["Mail forward" gnus-summary-mail-forward t]
2619 ["Post forward" gnus-summary-post-forward t]
2620 ["Digest and mail" gnus-uu-digest-mail-forward t]
2621 ["Digest and post" gnus-uu-digest-post-forward t]
2622 ["Resend message" gnus-summary-resend-message t]
2623 ["Resend message edit" gnus-summary-resend-message-edit t]
2624 ["Send bounced mail" gnus-summary-resend-bounced-mail t]
2625 ["Send a mail" gnus-summary-mail-other-window t]
2626 ["Create a local message" gnus-summary-news-other-window t]
2627 ["Uuencode and post" gnus-uu-post-news
2628 ,@(if (featurep 'xemacs) '(t)
2629 '(:help "Post a uuencoded article"))]
2630 ["Followup via news" gnus-summary-followup-to-mail t]
2631 ["Followup via news and yank"
2632 gnus-summary-followup-to-mail-with-original t]
2633 ["Strip signature on reply"
2636 (if (not (memq message-cite-function
2637 '(message-cite-original-without-signature
2638 message-cite-original)))
2639 ;; Stupid workaround for XEmacs not honoring :visible.
2640 (message "Can't toggle this value of `message-cite-function'")
2641 (setq message-cite-function
2642 (if (eq message-cite-function
2643 'message-cite-original-without-signature)
2644 'message-cite-original
2645 'message-cite-original-without-signature))))
2646 ;; XEmacs barfs on :visible.
2647 ,@(if (featurep 'xemacs) nil
2648 '(:visible (memq message-cite-function
2649 '(message-cite-original-without-signature
2650 message-cite-original))))
2652 :selected (eq message-cite-function
2653 'message-cite-original-without-signature)
2654 ,@(if (featurep 'xemacs) nil
2655 '(:help "Strip signature from cited article when replying."))]
2657 ;;["Send" gnus-summary-send-draft t]
2658 ;;["Send bounced" gnus-resend-bounced-mail t])
2662 ((not (keymapp gnus-summary-post-menu))
2663 (setq gnus-article-post-menu gnus-summary-post-menu))
2664 ((not gnus-article-post-menu)
2665 ;; Don't share post menu.
2666 (setq gnus-article-post-menu
2667 (copy-keymap gnus-summary-post-menu))))
2668 (define-key gnus-article-mode-map [menu-bar post]
2669 (cons "Post" gnus-article-post-menu))
2672 gnus-summary-misc-menu gnus-summary-mode-map ""
2675 ["Mark as read" gnus-summary-mark-as-read-forward t]
2676 ["Mark same subject and select"
2677 gnus-summary-kill-same-subject-and-select t]
2678 ["Mark same subject" gnus-summary-kill-same-subject t]
2679 ["Catchup" gnus-summary-catchup
2680 ,@(if (featurep 'xemacs) '(t)
2681 '(:help "Mark unread articles in this group as read"))]
2682 ["Catchup all" gnus-summary-catchup-all t]
2683 ["Catchup to here" gnus-summary-catchup-to-here t]
2684 ["Catchup from here" gnus-summary-catchup-from-here t]
2685 ["Catchup region" gnus-summary-mark-region-as-read
2686 (gnus-mark-active-p)]
2687 ["Mark excluded" gnus-summary-limit-mark-excluded-as-read t])
2689 ["Tick" gnus-summary-tick-article-forward t]
2690 ["Mark as dormant" gnus-summary-mark-as-dormant t]
2691 ["Remove marks" gnus-summary-clear-mark-forward t]
2692 ["Set expirable mark" gnus-summary-mark-as-expirable t]
2693 ["Set bookmark" gnus-summary-set-bookmark t]
2694 ["Remove bookmark" gnus-summary-remove-bookmark t])
2696 ["Marks..." gnus-summary-limit-to-marks t]
2697 ["Subject..." gnus-summary-limit-to-subject t]
2698 ["Author..." gnus-summary-limit-to-author t]
2699 ["Recipient..." gnus-summary-limit-to-recipient t]
2700 ["Address..." gnus-summary-limit-to-address t]
2701 ["Age..." gnus-summary-limit-to-age t]
2702 ["Extra..." gnus-summary-limit-to-extra t]
2703 ["Score..." gnus-summary-limit-to-score t]
2704 ["Display Predicate" gnus-summary-limit-to-display-predicate t]
2705 ["Unread" gnus-summary-limit-to-unread t]
2706 ["Unseen" gnus-summary-limit-to-unseen t]
2707 ["Singletons" gnus-summary-limit-to-singletons t]
2708 ["Replied" gnus-summary-limit-to-replied t]
2709 ["Non-dormant" gnus-summary-limit-exclude-dormant t]
2710 ["Next or process marked articles" gnus-summary-limit-to-articles t]
2711 ["Pop limit" gnus-summary-pop-limit t]
2712 ["Show dormant" gnus-summary-limit-include-dormant t]
2713 ["Hide childless dormant"
2714 gnus-summary-limit-exclude-childless-dormant t]
2715 ;;["Hide thread" gnus-summary-limit-exclude-thread t]
2716 ["Hide marked" gnus-summary-limit-exclude-marks t]
2717 ["Show expunged" gnus-summary-limit-include-expunged t])
2719 ["Set mark" gnus-summary-mark-as-processable t]
2720 ["Remove mark" gnus-summary-unmark-as-processable t]
2721 ["Remove all marks" gnus-summary-unmark-all-processable t]
2722 ["Invert marks" gnus-uu-invert-processable t]
2723 ["Mark above" gnus-uu-mark-over t]
2724 ["Mark series" gnus-uu-mark-series t]
2725 ["Mark region" gnus-uu-mark-region (gnus-mark-active-p)]
2726 ["Unmark region" gnus-uu-unmark-region (gnus-mark-active-p)]
2727 ["Mark by regexp..." gnus-uu-mark-by-regexp t]
2728 ["Unmark by regexp..." gnus-uu-unmark-by-regexp t]
2729 ["Mark all" gnus-uu-mark-all t]
2730 ["Mark buffer" gnus-uu-mark-buffer t]
2731 ["Mark sparse" gnus-uu-mark-sparse t]
2732 ["Mark thread" gnus-uu-mark-thread t]
2733 ["Unmark thread" gnus-uu-unmark-thread t]
2734 ("Process Mark Sets"
2735 ["Kill" gnus-summary-kill-process-mark t]
2736 ["Yank" gnus-summary-yank-process-mark
2737 gnus-newsgroup-process-stack]
2738 ["Save" gnus-summary-save-process-mark t]
2739 ["Run command on marked..." gnus-summary-universal-argument t]))
2742 ["Page forward" gnus-summary-next-page
2743 ,@(if (featurep 'xemacs) '(t)
2744 '(:help "Show next page of article"))]
2745 ["Page backward" gnus-summary-prev-page
2746 ,@(if (featurep 'xemacs) '(t)
2747 '(:help "Show previous page of article"))]
2748 ["Line forward" gnus-summary-scroll-up t])
2750 ["Next unread article" gnus-summary-next-unread-article t]
2751 ["Previous unread article" gnus-summary-prev-unread-article t]
2752 ["Next article" gnus-summary-next-article t]
2753 ["Previous article" gnus-summary-prev-article t]
2754 ["Next unread subject" gnus-summary-next-unread-subject t]
2755 ["Previous unread subject" gnus-summary-prev-unread-subject t]
2756 ["Next article same subject" gnus-summary-next-same-subject t]
2757 ["Previous article same subject" gnus-summary-prev-same-subject t]
2758 ["First unread article" gnus-summary-first-unread-article t]
2759 ["Best unread article" gnus-summary-best-unread-article t]
2760 ["Go to subject number..." gnus-summary-goto-subject t]
2761 ["Go to article number..." gnus-summary-goto-article t]
2762 ["Go to the last article" gnus-summary-goto-last-article t]
2763 ["Pop article off history" gnus-summary-pop-article t])
2765 ["Sort by number" gnus-summary-sort-by-number t]
2766 ["Sort by most recent number" gnus-summary-sort-by-most-recent-number t]
2767 ["Sort by author" gnus-summary-sort-by-author t]
2768 ["Sort by recipient" gnus-summary-sort-by-recipient t]
2769 ["Sort by subject" gnus-summary-sort-by-subject t]
2770 ["Sort by date" gnus-summary-sort-by-date t]
2771 ["Sort by most recent date" gnus-summary-sort-by-most-recent-date t]
2772 ["Sort by score" gnus-summary-sort-by-score t]
2773 ["Sort by lines" gnus-summary-sort-by-lines t]
2774 ["Sort by characters" gnus-summary-sort-by-chars t]
2775 ["Randomize" gnus-summary-sort-by-random t]
2776 ["Original sort" gnus-summary-sort-by-original t])
2778 ["Describe group" gnus-summary-describe-group t]
2779 ["Read manual" gnus-info-find-node t])
2781 ["Pick and read" gnus-pick-mode t]
2782 ["Binary" gnus-binary-mode t])
2784 ["Regenerate" gnus-summary-prepare t]
2785 ["Insert cached articles" gnus-summary-insert-cached-articles t]
2786 ["Insert dormant articles" gnus-summary-insert-dormant-articles t]
2787 ["Insert ticked articles" gnus-summary-insert-ticked-articles t]
2788 ["Toggle threading" gnus-summary-toggle-threads t])
2789 ["See old articles" gnus-summary-insert-old-articles t]
2790 ["See new articles" gnus-summary-insert-new-articles t]
2791 ["Filter articles..." gnus-summary-execute-command t]
2792 ["Run command on articles..." gnus-summary-universal-argument t]
2793 ["Search articles forward..." gnus-summary-search-article-forward t]
2794 ["Search articles backward..." gnus-summary-search-article-backward t]
2795 ["Toggle line truncation" gnus-summary-toggle-truncation t]
2796 ["Expand window" gnus-summary-expand-window t]
2797 ["Expire expirable articles" gnus-summary-expire-articles
2798 (gnus-check-backend-function
2799 'request-expire-articles gnus-newsgroup-name)]
2800 ["Edit local kill file" gnus-summary-edit-local-kill t]
2801 ["Edit main kill file" gnus-summary-edit-global-kill t]
2802 ["Edit group parameters" gnus-summary-edit-parameters t]
2803 ["Customize group parameters" gnus-summary-customize-parameters t]
2804 ["Send a bug report" gnus-bug t]
2806 ["Catchup and exit" gnus-summary-catchup-and-exit
2807 ,@(if (featurep 'xemacs) '(t)
2808 '(:help "Mark unread articles in this group as read, then exit"))]
2809 ["Catchup all and exit" gnus-summary-catchup-all-and-exit t]
2810 ["Catchup and goto next" gnus-summary-catchup-and-goto-next-group t]
2811 ["Catchup and goto prev" gnus-summary-catchup-and-goto-prev-group t]
2812 ["Exit group" gnus-summary-exit
2813 ,@(if (featurep 'xemacs) '(t)
2814 '(:help "Exit current group, return to group selection mode"))]
2815 ["Exit group without updating" gnus-summary-exit-no-update t]
2816 ["Exit and goto next group" gnus-summary-next-group t]
2817 ["Exit and goto prev group" gnus-summary-prev-group t]
2818 ["Reselect group" gnus-summary-reselect-current-group t]
2819 ["Rescan group" gnus-summary-rescan-group t]
2820 ["Update dribble" gnus-summary-save-newsrc t])))
2822 (gnus-run-hooks 'gnus-summary-menu-hook)))
2824 (defvar gnus-summary-tool-bar-map nil)
2826 ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only
2827 ;; affect _new_ message buffers. We might add a function that walks thru all
2828 ;; summary-mode buffers and force the update.
2829 (defun gnus-summary-tool-bar-update (&optional symbol value)
2830 "Update summary mode toolbar.
2831 Setter function for custom variables."
2832 (setq-default gnus-summary-tool-bar-map nil)
2834 ;; When used as ":set" function:
2835 (set-default symbol value))
2836 (when (gnus-buffer-live-p gnus-summary-buffer)
2837 (with-current-buffer gnus-summary-buffer
2838 (gnus-summary-make-tool-bar))))
2840 (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
2841 'gnus-summary-tool-bar-gnome
2842 'gnus-summary-tool-bar-retro)
2843 "Specifies the Gnus summary tool bar.
2845 It can be either a list or a symbol referring to a list. See
2846 `gmm-tool-bar-from-list' for the format of the list. The
2847 default key map is `gnus-summary-mode-map'.
2849 Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
2850 `gnus-summary-tool-bar-retro'."
2851 :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome)
2852 (const :tag "Retro look" gnus-summary-tool-bar-retro)
2853 (repeat :tag "User defined list" gmm-tool-bar-item)
2855 :version "23.1" ;; No Gnus
2856 :initialize 'custom-initialize-default
2857 :set 'gnus-summary-tool-bar-update
2858 :group 'gnus-summary)
2860 (defcustom gnus-summary-tool-bar-gnome
2861 '((gnus-summary-post-news "mail/compose" nil)
2862 (gnus-summary-insert-new-articles "mail/inbox" nil
2863 :visible (or (not gnus-agent)
2865 (gnus-summary-reply-with-original "mail/reply")
2866 (gnus-summary-reply "mail/reply" nil :visible nil)
2867 (gnus-summary-followup-with-original "mail/reply-all")
2868 (gnus-summary-followup "mail/reply-all" nil :visible nil)
2869 (gnus-summary-mail-forward "mail/forward")
2870 (gnus-summary-save-article "mail/save")
2871 (gnus-summary-search-article-forward "search" nil :visible nil)
2872 (gnus-summary-print-article "print")
2873 (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
2874 ;; Some new commands that may need more suitable icons:
2875 (gnus-summary-save-newsrc "save" nil :visible nil)
2876 ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
2877 (gnus-summary-prev-article "left-arrow")
2878 (gnus-summary-next-article "right-arrow")
2879 (gnus-summary-next-page "next-page")
2880 ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
2882 ;; Maybe some sort-by-... could be added:
2883 ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
2884 ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
2885 (gnus-summary-mark-as-expirable
2887 :visible (gnus-check-backend-function 'request-expire-articles
2888 gnus-newsgroup-name))
2889 (gnus-summary-mark-as-spam
2891 :visible (and (fboundp 'spam-group-ham-contents-p)
2892 (spam-group-ham-contents-p gnus-newsgroup-name))
2893 :help "Mark as spam")
2894 (gnus-summary-mark-as-read-forward
2896 :visible (and (fboundp 'spam-group-spam-contents-p)
2897 (spam-group-spam-contents-p gnus-newsgroup-name)))
2899 (gnus-summary-exit "exit")
2900 (gmm-customize-mode "preferences" t :help "Edit mode preferences")
2901 (gnus-info-find-node "help"))
2902 "List of functions for the summary tool bar (GNOME style).
2904 See `gmm-tool-bar-from-list' for the format of the list."
2905 :type '(repeat gmm-tool-bar-item)
2906 :version "23.1" ;; No Gnus
2907 :initialize 'custom-initialize-default
2908 :set 'gnus-summary-tool-bar-update
2909 :group 'gnus-summary)
2911 (defcustom gnus-summary-tool-bar-retro
2912 '((gnus-summary-prev-unread-article "gnus/prev-ur")
2913 (gnus-summary-next-unread-article "gnus/next-ur")
2914 (gnus-summary-post-news "gnus/post")
2915 (gnus-summary-followup-with-original "gnus/fuwo")
2916 (gnus-summary-followup "gnus/followup")
2917 (gnus-summary-reply-with-original "gnus/reply-wo")
2918 (gnus-summary-reply "gnus/reply")
2919 (gnus-summary-caesar-message "gnus/rot13")
2920 (gnus-uu-decode-uu "gnus/uu-decode")
2921 (gnus-summary-save-article-file "gnus/save-aif")
2922 (gnus-summary-save-article "gnus/save-art")
2923 (gnus-uu-post-news "gnus/uu-post")
2924 (gnus-summary-catchup "gnus/catchup")
2925 (gnus-summary-catchup-and-exit "gnus/cu-exit")
2926 (gnus-summary-exit "gnus/exit-summ")
2927 ;; Some new command that may need more suitable icons:
2928 (gnus-summary-print-article "gnus/print" nil :visible nil)
2929 (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
2930 (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
2931 ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
2932 (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
2933 ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
2934 ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
2936 (gnus-info-find-node "gnus/help" nil :visible nil))
2937 "List of functions for the summary tool bar (retro look).
2939 See `gmm-tool-bar-from-list' for the format of the list."
2940 :type '(repeat gmm-tool-bar-item)
2941 :version "23.1" ;; No Gnus
2942 :initialize 'custom-initialize-default
2943 :set 'gnus-summary-tool-bar-update
2944 :group 'gnus-summary)
2946 (defcustom gnus-summary-tool-bar-zap-list t
2947 "List of icon items from the global tool bar.
2948 These items are not displayed in the Gnus summary mode tool bar.
2950 See `gmm-tool-bar-from-list' for the format of the list."
2951 :type 'gmm-tool-bar-zap-list
2952 :version "23.1" ;; No Gnus
2953 :initialize 'custom-initialize-default
2954 :set 'gnus-summary-tool-bar-update
2955 :group 'gnus-summary)
2957 (defvar image-load-path)
2958 (defvar tool-bar-map)
2960 (defun gnus-summary-make-tool-bar (&optional force)
2961 "Make a summary mode tool bar from `gnus-summary-tool-bar'.
2962 When FORCE, rebuild the tool bar."
2963 (when (and (not (featurep 'xemacs))
2964 (boundp 'tool-bar-mode)
2966 (or (not gnus-summary-tool-bar-map) force))
2968 (gmm-image-load-path-for-library "gnus"
2971 (image-load-path (cons (car load-path)
2972 (when (boundp 'image-load-path)
2974 (map (gmm-tool-bar-from-list gnus-summary-tool-bar
2975 gnus-summary-tool-bar-zap-list
2976 'gnus-summary-mode-map)))
2978 ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
2980 (setq gnus-summary-tool-bar-map map))))
2981 (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))
2983 (defun gnus-make-score-map (type)
2984 "Make a summary score map of type TYPE."
2987 (let ((headers '(("author" "from" string)
2988 ("subject" "subject" string)
2989 ("article body" "body" string)
2990 ("article head" "head" string)
2991 ("xref" "xref" string)
2992 ("extra header" "extra" string)
2993 ("lines" "lines" number)
2994 ("followups to author" "followup" string)))
2995 (types '((number ("less than" <)
2998 (string ("substring" s)
3002 (perms '(("temporary" (current-time-string))
3010 (if (eq type 'lower)
3015 (setq header (car headers))
3021 (let ((ts (cdr (assoc (nth 2 header) types)))
3037 'gnus-summary-score-entry
3039 (if (or (string= (nth 1 header)
3041 (string= (nth 1 header)
3044 (list 'gnus-summary-header
3046 (list 'quote (nth 1 (car ts)))
3047 (list 'gnus-score-delta-default
3054 (list (nreverse outp))))
3057 (list (nreverse outt))))
3059 (setq headers (cdr headers)))
3060 (list (nreverse outh))))))))
3063 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
3064 (defvar bookmark-make-record-function)
3066 (defvar bidi-paragraph-direction)
3068 (defun gnus-summary-mode (&optional group)
3069 "Major mode for reading articles.
3071 All normal editing commands are switched off.
3072 \\<gnus-summary-mode-map>
3073 Each line in this buffer represents one article. To read an
3074 article, you can, for instance, type `\\[gnus-summary-next-page]'. To move forwards
3075 and backwards while displaying articles, type `\\[gnus-summary-next-unread-article]' and `\\[gnus-summary-prev-unread-article]',
3078 You can also post articles and send mail from this buffer. To
3079 follow up an article, type `\\[gnus-summary-followup]'. To mail a reply to the author
3080 of an article, type `\\[gnus-summary-reply]'.
3082 There are approx. one gazillion commands you can execute in this
3083 buffer; read the info pages for more information (`\\[gnus-info-find-node]').
3085 The following commands are available:
3087 \\{gnus-summary-mode-map}"
3089 (kill-all-local-variables)
3090 (let ((gnus-summary-local-variables gnus-newsgroup-variables))
3091 (gnus-summary-make-local-variables))
3092 (gnus-summary-make-local-variables)
3093 (setq gnus-newsgroup-name group)
3094 (when (gnus-visual-p 'summary-menu 'menu)
3095 (gnus-summary-make-menu-bar)
3096 (gnus-summary-make-tool-bar))
3097 (gnus-make-thread-indent-array)
3098 (gnus-simplify-mode-line)
3099 (setq major-mode 'gnus-summary-mode)
3100 (setq mode-name "Summary")
3101 (use-local-map gnus-summary-mode-map)
3102 (buffer-disable-undo)
3103 (setq buffer-read-only t ;Disable modification
3104 show-trailing-whitespace nil)
3105 (setq truncate-lines t)
3106 ;; Force paragraph direction to be left-to-right. Don't make it
3107 ;; bound globally in old Emacsen and XEmacsen.
3108 (set (make-local-variable 'bidi-paragraph-direction) 'left-to-right)
3109 (add-to-invisibility-spec '(gnus-sum . t))
3110 (gnus-summary-set-display-table)
3111 (gnus-set-default-directory)
3112 (make-local-variable 'gnus-summary-line-format)
3113 (make-local-variable 'gnus-summary-line-format-spec)
3114 (make-local-variable 'gnus-summary-dummy-line-format)
3115 (make-local-variable 'gnus-summary-dummy-line-format-spec)
3116 (make-local-variable 'gnus-summary-mark-positions)
3117 (gnus-make-local-hook 'pre-command-hook)
3118 (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
3119 (gnus-run-mode-hooks 'gnus-summary-mode-hook)
3120 (turn-on-gnus-mailing-list-mode)
3121 (mm-enable-multibyte)
3122 (set (make-local-variable 'bookmark-make-record-function)
3123 'gnus-summary-bookmark-make-record)
3124 (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
3125 (gnus-update-summary-mark-positions))
3127 (defun gnus-summary-make-local-variables ()
3128 "Make all the local summary buffer variables."
3130 (dolist (local gnus-summary-local-variables)
3133 (if (eq (cdr local) 'global)
3134 ;; Copy the global value of the variable.
3135 (setq global (symbol-value (car local)))
3136 ;; Use the value from the list.
3137 (setq global (eval (cdr local))))
3138 (set (make-local-variable (car local)) global))
3139 ;; Simple nil-valued local variable.
3140 (set (make-local-variable local) nil)))))
3142 ;; Summary data functions.
3144 (defmacro gnus-data-number (data)
3147 (defmacro gnus-data-set-number (data number)
3148 `(setcar ,data ,number))
3150 (defmacro gnus-data-mark (data)
3153 (defmacro gnus-data-set-mark (data mark)
3154 `(setcar (nthcdr 1 ,data) ,mark))
3156 (defmacro gnus-data-pos (data)
3159 (defmacro gnus-data-set-pos (data pos)
3160 `(setcar (nthcdr 2 ,data) ,pos))
3162 (defmacro gnus-data-header (data)
3165 (defmacro gnus-data-set-header (data header)
3166 `(setf (nth 3 ,data) ,header))
3168 (defmacro gnus-data-level (data)
3171 (defmacro gnus-data-unread-p (data)
3172 `(= (nth 1 ,data) gnus-unread-mark))
3174 (defmacro gnus-data-read-p (data)
3175 `(/= (nth 1 ,data) gnus-unread-mark))
3177 (defmacro gnus-data-pseudo-p (data)
3178 `(consp (nth 3 ,data)))
3180 (defmacro gnus-data-find (number)
3181 `(assq ,number gnus-newsgroup-data))
3183 (defmacro gnus-data-find-list (number &optional data)
3184 `(let ((bdata ,(or data 'gnus-newsgroup-data)))
3185 (memq (assq ,number bdata)
3188 (defmacro gnus-data-make (number mark pos header level)
3189 `(list ,number ,mark ,pos ,header ,level))
3191 (defun gnus-data-enter (after-article number mark pos header level offset)
3192 (let ((data (gnus-data-find-list after-article)))
3194 (error "No such article: %d" after-article))
3195 (setcdr data (cons (gnus-data-make number mark pos header level)
3197 (setq gnus-newsgroup-data-reverse nil)
3198 (gnus-data-update-list (cddr data) offset)))
3200 (defun gnus-data-enter-list (after-article list &optional offset)
3202 (let ((data (and after-article (gnus-data-find-list after-article)))
3206 (let ((odata gnus-newsgroup-data))
3207 (setq gnus-newsgroup-data (nconc list gnus-newsgroup-data))
3209 (gnus-data-update-list odata offset)))
3210 ;; Find the last element in the list to be spliced into the main
3212 (setq list (last list))
3215 (setcdr list gnus-newsgroup-data)
3216 (setq gnus-newsgroup-data ilist)
3218 (gnus-data-update-list (cdr list) offset)))
3219 (setcdr list (cdr data))
3222 (gnus-data-update-list (cdr list) offset))))
3223 (setq gnus-newsgroup-data-reverse nil))))
3225 (defun gnus-data-remove (article &optional offset)
3226 (let ((data gnus-newsgroup-data))
3227 (if (= (gnus-data-number (car data)) article)
3229 (setq gnus-newsgroup-data (cdr gnus-newsgroup-data)
3230 gnus-newsgroup-data-reverse nil)
3232 (gnus-data-update-list gnus-newsgroup-data offset)))
3234 (when (= (gnus-data-number (cadr data)) article)
3235 (setcdr data (cddr data))
3237 (gnus-data-update-list (cdr data) offset))
3239 gnus-newsgroup-data-reverse nil))
3240 (setq data (cdr data))))))
3242 (defmacro gnus-data-list (backward)
3244 (or gnus-newsgroup-data-reverse
3245 (setq gnus-newsgroup-data-reverse
3246 (reverse gnus-newsgroup-data)))
3247 gnus-newsgroup-data))
3249 (defun gnus-data-update-list (data offset)
3250 "Add OFFSET to the POS of all data entries in DATA."
3251 (setq gnus-newsgroup-data-reverse nil)
3253 (setcar (nthcdr 2 (car data)) (+ offset (nth 2 (car data))))
3254 (setq data (cdr data))))
3256 (defun gnus-summary-article-pseudo-p (article)
3257 "Say whether this article is a pseudo article or not."
3258 (not (vectorp (gnus-data-header (gnus-data-find article)))))
3260 (defmacro gnus-summary-article-sparse-p (article)
3261 "Say whether this article is a sparse article or not."
3262 `(memq ,article gnus-newsgroup-sparse))
3264 (defmacro gnus-summary-article-ancient-p (article)
3265 "Say whether this article is a sparse article or not."
3266 `(memq ,article gnus-newsgroup-ancient))
3268 (defun gnus-article-children (number)
3269 "Return a list of all children to NUMBER."
3270 (let* ((data (gnus-data-find-list number))
3271 (level (gnus-data-level (car data)))
3273 (setq data (cdr data))
3275 (= (gnus-data-level (car data)) (1+ level)))
3276 (push (gnus-data-number (car data)) children)
3277 (setq data (cdr data)))
3280 (defmacro gnus-summary-skip-intangible ()
3281 "If the current article is intangible, then jump to a different article."
3282 '(let ((to (get-text-property (point) 'gnus-intangible)))
3283 (and to (gnus-summary-goto-subject to))))
3285 (defmacro gnus-summary-article-intangible-p ()
3286 "Say whether this article is intangible or not."
3287 '(get-text-property (point) 'gnus-intangible))
3289 ;; Some summary mode macros.
3291 (defmacro gnus-summary-article-number ()
3292 "The article number of the article on the current line.
3293 If there isn't an article number here, then we return the current
3296 (gnus-summary-skip-intangible)
3297 (or (get-text-property (point) 'gnus-number)
3298 (gnus-summary-last-subject))))
3300 (defmacro gnus-summary-article-header (&optional number)
3301 "Return the header of article NUMBER."
3302 `(gnus-data-header (gnus-data-find
3303 ,(or number '(gnus-summary-article-number)))))
3305 (defmacro gnus-summary-thread-level (&optional number)
3306 "Return the level of thread that starts with article NUMBER."
3307 `(if (and (eq gnus-summary-make-false-root 'dummy)
3308 (get-text-property (point) 'gnus-intangible))
3310 (gnus-data-level (gnus-data-find
3311 ,(or number '(gnus-summary-article-number))))))
3313 (defmacro gnus-summary-article-mark (&optional number)
3314 "Return the mark of article NUMBER."
3315 `(gnus-data-mark (gnus-data-find
3316 ,(or number '(gnus-summary-article-number)))))
3318 (defmacro gnus-summary-article-pos (&optional number)
3319 "Return the position of the line of article NUMBER."
3320 `(gnus-data-pos (gnus-data-find
3321 ,(or number '(gnus-summary-article-number)))))
3323 (defalias 'gnus-summary-subject-string 'gnus-summary-article-subject)
3324 (defmacro gnus-summary-article-subject (&optional number)
3325 "Return current subject string or nil if nothing."
3328 `(gnus-data-header (assq ,number gnus-newsgroup-data))
3329 '(gnus-data-header (assq (gnus-summary-article-number)
3330 gnus-newsgroup-data)))))
3333 (mail-header-subject headers))))
3335 (defmacro gnus-summary-article-score (&optional number)
3336 "Return current article score."
3337 `(or (cdr (assq ,(or number '(gnus-summary-article-number))
3338 gnus-newsgroup-scored))
3339 gnus-summary-default-score 0))
3341 (defun gnus-summary-article-children (&optional number)
3342 "Return a list of article numbers that are children of article NUMBER."
3343 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))))
3344 (level (gnus-data-level (car data)))
3346 (while (and (setq data (cdr data))
3347 (> (setq l (gnus-data-level (car data))) level))
3348 (and (= (1+ level) l)
3349 (push (gnus-data-number (car data))
3351 (nreverse children)))
3353 (defun gnus-summary-article-parent (&optional number)
3354 "Return the article number of the parent of article NUMBER."
3355 (let* ((data (gnus-data-find-list (or number (gnus-summary-article-number))
3356 (gnus-data-list t)))
3357 (level (gnus-data-level (car data))))
3359 () ; This is a root.
3360 ;; We search until we find an article with a level less than
3361 ;; this one. That function has to be the parent.
3362 (while (and (setq data (cdr data))
3363 (not (< (gnus-data-level (car data)) level))))
3364 (and data (gnus-data-number (car data))))))
3366 (defun gnus-unread-mark-p (mark)
3367 "Say whether MARK is the unread mark."
3368 (= mark gnus-unread-mark))
3370 (defun gnus-read-mark-p (mark)
3371 "Say whether MARK is one of the marks that mark as read.
3372 This is all marks except unread, ticked, dormant, and expirable."
3373 (not (or (= mark gnus-unread-mark)
3374 (= mark gnus-ticked-mark)
3375 (= mark gnus-spam-mark)
3376 (= mark gnus-dormant-mark)
3377 (= mark gnus-expirable-mark))))
3379 (defmacro gnus-article-mark (number)
3380 "Return the MARK of article NUMBER.
3381 This macro should only be used when computing the mark the \"first\"
3382 time; i.e., when generating the summary lines. After that,
3383 `gnus-summary-article-mark' should be used to examine the
3386 ((memq ,number gnus-newsgroup-unsendable) gnus-unsendable-mark)
3387 ((memq ,number gnus-newsgroup-downloadable) gnus-downloadable-mark)
3388 ((memq ,number gnus-newsgroup-unreads) gnus-unread-mark)
3389 ((memq ,number gnus-newsgroup-marked) gnus-ticked-mark)
3390 ((memq ,number gnus-newsgroup-spam-marked) gnus-spam-mark)
3391 ((memq ,number gnus-newsgroup-dormant) gnus-dormant-mark)
3392 ((memq ,number gnus-newsgroup-expirable) gnus-expirable-mark)
3393 (t (or (cdr (assq ,number gnus-newsgroup-reads))
3394 gnus-ancient-mark))))
3396 ;; Saving hidden threads.
3398 (defmacro gnus-save-hidden-threads (&rest forms)
3399 "Save hidden threads, eval FORMS, and restore the hidden threads."
3400 (let ((config (make-symbol "config")))
3401 `(let ((,config (gnus-hidden-threads-configuration)))
3405 (gnus-restore-hidden-threads-configuration ,config)))))
3406 (put 'gnus-save-hidden-threads 'lisp-indent-function 0)
3407 (put 'gnus-save-hidden-threads 'edebug-form-spec '(body))
3409 (defun gnus-data-compute-positions ()
3410 "Compute the positions of all articles."
3411 (setq gnus-newsgroup-data-reverse nil)
3412 (let ((data gnus-newsgroup-data))
3414 (gnus-save-hidden-threads
3415 (gnus-summary-show-all-threads)
3416 (goto-char (point-min))
3418 (while (get-text-property (point) 'gnus-intangible)
3420 (gnus-data-set-pos (car data) (+ (point) 3))
3421 (setq data (cdr data))
3422 (forward-line 1))))))
3424 (defun gnus-hidden-threads-configuration ()
3425 "Return the current hidden threads configuration."
3428 (goto-char (point-min))
3430 (when (eq (get-char-property (point-at-eol) 'invisible) 'gnus-sum)
3431 (push (save-excursion (forward-line 0) (point)) config))
3435 (defun gnus-restore-hidden-threads-configuration (config)
3436 "Restore hidden threads configuration from CONFIG."
3438 (let (point (inhibit-read-only t))
3439 (while (setq point (pop config))
3441 (gnus-summary-hide-thread)))))
3443 ;; Various summary mode internalish functions.
3445 (defun gnus-mouse-pick-article (e)
3448 (gnus-summary-next-page nil t))
3450 (defun gnus-summary-set-display-table ()
3451 "Change the display table.
3452 Odd characters have a tendency to mess
3453 up nicely formatted displays - we make all possible glyphs
3454 display only a single character."
3456 ;; We start from the standard display table, if any.
3457 (let ((table (or (copy-sequence standard-display-table)
3458 (make-display-table)))
3460 ;; Nix out all the control chars...
3461 (while (>= (setq i (1- i)) 0)
3462 (gnus-put-display-table i [??] table))
3463 ;; ... but not newline and cr, of course. (cr is necessary for the
3464 ;; selective display).
3465 (gnus-put-display-table ?\n nil table)
3466 (gnus-put-display-table ?\r nil table)
3467 ;; We keep TAB as well.
3468 (gnus-put-display-table ?\t nil table)
3469 ;; We nix out any glyphs 127 through 255, or 127 through 159 in
3470 ;; Emacs 23 (unicode), that are not set already.
3471 (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
3474 (while (>= (setq i (1- i)) 127)
3475 ;; Only modify if the entry is nil.
3476 (unless (gnus-get-display-table i table)
3477 (gnus-put-display-table i [??] table))))
3478 (setq buffer-display-table table)))
3480 (defun gnus-summary-set-article-display-arrow (pos)
3481 "Update the overlay arrow to point to line at position POS."
3482 (when gnus-summary-display-arrow
3483 (make-local-variable 'overlay-arrow-position)
3484 (make-local-variable 'overlay-arrow-string)
3488 (unless overlay-arrow-position
3489 (setq overlay-arrow-position (make-marker)))
3490 (setq overlay-arrow-string "=>"
3491 overlay-arrow-position (set-marker overlay-arrow-position
3493 (current-buffer))))))
3495 (defun gnus-summary-setup-buffer (group)
3496 "Initialize summary buffer.
3497 If the setup was successful, non-nil is returned."
3498 (let ((buffer (gnus-summary-buffer-name group))
3499 (dead-name (concat "*Dead Summary "
3500 (gnus-group-decoded-name group) "*")))
3501 ;; If a dead summary buffer exists, we kill it.
3502 (when (gnus-buffer-live-p dead-name)
3503 (gnus-kill-buffer dead-name))
3504 (if (get-buffer buffer)
3507 (setq gnus-summary-buffer (current-buffer))
3508 (not gnus-newsgroup-prepared))
3509 (set-buffer (gnus-get-buffer-create buffer))
3510 (setq gnus-summary-buffer (current-buffer))
3511 (gnus-summary-mode group)
3512 (when (gnus-group-quit-config group)
3513 (set (make-local-variable 'gnus-single-article-buffer) nil))
3514 (make-local-variable 'gnus-article-buffer)
3515 (make-local-variable 'gnus-article-current)
3516 (make-local-variable 'gnus-original-article-buffer)
3517 (setq gnus-newsgroup-name group)
3518 ;; Set any local variables in the group parameters.
3519 (gnus-summary-set-local-parameters gnus-newsgroup-name)
3522 (defun gnus-set-global-variables ()
3523 "Set the global equivalents of the buffer-local variables.
3524 They are set to the latest values they had. These reflect the summary
3525 buffer that was in action when the last article was fetched."
3526 (when (eq major-mode 'gnus-summary-mode)
3527 (setq gnus-summary-buffer (current-buffer))
3528 (let ((name gnus-newsgroup-name)
3529 (marked gnus-newsgroup-marked)
3530 (spam gnus-newsgroup-spam-marked)
3531 (unread gnus-newsgroup-unreads)
3532 (headers gnus-current-headers)
3533 (data gnus-newsgroup-data)
3534 (summary gnus-summary-buffer)
3535 (article-buffer gnus-article-buffer)
3536 (original gnus-original-article-buffer)
3537 (gac gnus-article-current)
3538 (reffed gnus-reffed-article-number)
3539 (score-file gnus-current-score-file)
3540 (default-charset gnus-newsgroup-charset)
3542 (let ((locals gnus-newsgroup-variables))
3544 (if (consp (car locals))
3545 (push (eval (caar locals)) vlist)
3546 (push (eval (car locals)) vlist))
3547 (setq locals (cdr locals)))
3548 (setq vlist (nreverse vlist)))
3550 (setq gnus-newsgroup-name name
3551 gnus-newsgroup-marked marked
3552 gnus-newsgroup-spam-marked spam
3553 gnus-newsgroup-unreads unread
3554 gnus-current-headers headers
3555 gnus-newsgroup-data data
3556 gnus-article-current gac
3557 gnus-summary-buffer summary
3558 gnus-article-buffer article-buffer
3559 gnus-original-article-buffer original
3560 gnus-reffed-article-number reffed
3561 gnus-current-score-file score-file
3562 gnus-newsgroup-charset default-charset)
3563 (let ((locals gnus-newsgroup-variables))
3565 (if (consp (car locals))
3566 (set (caar locals) (pop vlist))
3567 (set (car locals) (pop vlist)))
3568 (setq locals (cdr locals))))))))
3570 (defun gnus-summary-article-unread-p (article)
3571 "Say whether ARTICLE is unread or not."
3572 (memq article gnus-newsgroup-unreads))
3574 (defun gnus-summary-first-article-p (&optional article)
3575 "Return whether ARTICLE is the first article in the buffer."
3576 (if (not (setq article (or article (gnus-summary-article-number))))
3578 (eq article (caar gnus-newsgroup-data))))
3580 (defun gnus-summary-last-article-p (&optional article)
3581 "Return whether ARTICLE is the last article in the buffer."
3582 (if (not (setq article (or article (gnus-summary-article-number))))
3583 ;; All non-existent numbers are the last article. :-)
3585 (not (cdr (gnus-data-find-list article)))))
3587 (defun gnus-make-thread-indent-array (&optional n)
3589 (progn (setq n 200) nil)
3590 (null gnus-thread-indent-array)
3591 (/= gnus-thread-indent-level gnus-thread-indent-array-level))
3592 (setq gnus-thread-indent-array (make-vector (1+ n) "")
3593 gnus-thread-indent-array-level gnus-thread-indent-level)
3595 (aset gnus-thread-indent-array n
3596 (make-string (* n gnus-thread-indent-level) ? ))
3599 (defun gnus-update-summary-mark-positions ()
3600 "Compute where the summary marks are to go."
3602 (when (gnus-buffer-exists-p gnus-summary-buffer)
3603 (set-buffer gnus-summary-buffer))
3604 (let ((spec gnus-summary-line-format-spec)
3607 (gnus-set-work-buffer)
3608 (let ((gnus-tmp-unread ?Z)
3609 (gnus-replied-mark ?Z)
3610 (gnus-score-below-mark ?Z)
3611 (gnus-score-over-mark ?Z)
3612 (gnus-undownloaded-mark ?Z)
3613 (gnus-summary-line-format-spec spec)
3614 (gnus-newsgroup-downloadable '(0))
3615 (header [0 "" "" "05 Apr 2001 23:33:09 +0400" "" "" 0 0 "" nil])
3616 case-fold-search ignores)
3617 ;; Here, all marks are bound to Z.
3618 (gnus-summary-insert-line header
3619 0 nil t gnus-tmp-unread t nil "" nil 1)
3620 (goto-char (point-min))
3621 ;; Memorize the positions of the same characters as dummy marks.
3622 (while (re-search-forward "[A-D]" nil t)
3623 (push (point) ignores))
3625 ;; We use A-D as dummy marks in order to know column positions
3626 ;; where marks should be inserted.
3627 (setq gnus-tmp-unread ?A
3628 gnus-replied-mark ?B
3629 gnus-score-below-mark ?C
3630 gnus-score-over-mark ?C
3631 gnus-undownloaded-mark ?D)
3632 (gnus-summary-insert-line header
3633 0 nil t gnus-tmp-unread t nil "" nil 1)
3634 ;; Ignore characters which aren't dummy marks.
3636 (delete-region (goto-char (1- p)) p)
3638 (goto-char (point-min))
3639 (setq pos (list (cons 'unread
3640 (and (search-forward "A" nil t)
3641 (- (point) (point-min) 1)))))
3642 (goto-char (point-min))
3643 (push (cons 'replied (and (search-forward "B" nil t)
3644 (- (point) (point-min) 1)))
3646 (goto-char (point-min))
3647 (push (cons 'score (and (search-forward "C" nil t)
3648 (- (point) (point-min) 1)))
3650 (goto-char (point-min))
3651 (push (cons 'download (and (search-forward "D" nil t)
3652 (- (point) (point-min) 1)))
3654 (setq gnus-summary-mark-positions pos))))
3656 (defun gnus-summary-insert-dummy-line (gnus-tmp-subject gnus-tmp-number)
3657 "Insert a dummy root in the summary buffer."
3659 (gnus-add-text-properties
3660 (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
3661 (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
3663 (defun gnus-summary-extract-address-component (from)
3664 (or (car (funcall gnus-extract-address-components from))
3667 (defun gnus-summary-from-or-to-or-newsgroups (header gnus-tmp-from)
3668 (let ((mail-parse-charset gnus-newsgroup-charset)
3669 (ignored-from-addresses (gnus-ignored-from-addresses))
3670 ;; Is it really necessary to do this next part for each summary line?
3671 ;; Luckily, doesn't seem to slow things down much.
3672 (mail-parse-ignored-charsets
3673 (with-current-buffer gnus-summary-buffer
3674 gnus-newsgroup-ignored-charsets)))
3676 (and ignored-from-addresses
3677 (string-match ignored-from-addresses gnus-tmp-from)
3678 (let ((extra-headers (mail-header-extra header))
3682 ((setq to (cdr (assq 'To extra-headers)))
3683 (concat gnus-summary-to-prefix
3685 (gnus-summary-extract-address-component
3686 (funcall gnus-decode-encoded-address-function to)))))
3689 (cdr (assq 'Newsgroups extra-headers))
3691 (memq 'Newsgroups gnus-extra-headers)
3692 (eq (car (gnus-find-method-for-group
3693 gnus-newsgroup-name)) 'nntp)
3694 (gnus-group-real-name gnus-newsgroup-name))))
3695 (concat gnus-summary-newsgroup-prefix newsgroups)))))
3696 (gnus-string-mark-left-to-right
3698 (gnus-summary-extract-address-component gnus-tmp-from))))))
3700 (defun gnus-summary-insert-line (gnus-tmp-header
3701 gnus-tmp-level gnus-tmp-current
3702 undownloaded gnus-tmp-unread gnus-tmp-replied
3703 gnus-tmp-expirable gnus-tmp-subject-or-nil
3704 &optional gnus-tmp-dummy gnus-tmp-score
3706 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
3707 (gnus-make-thread-indent-array (max (* 2 (length gnus-thread-indent-array))
3709 (let* ((gnus-tmp-indentation (aref gnus-thread-indent-array gnus-tmp-level))
3710 (gnus-tmp-lines (mail-header-lines gnus-tmp-header))
3711 (gnus-tmp-score (or gnus-tmp-score gnus-summary-default-score 0))
3712 (gnus-tmp-score-char
3713 (if (or (null gnus-summary-default-score)
3714 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
3715 gnus-summary-zcore-fuzz))
3717 (if (< gnus-tmp-score gnus-summary-default-score)
3718 gnus-score-below-mark gnus-score-over-mark)))
3719 (gnus-tmp-number (mail-header-number gnus-tmp-header))
3721 (cond (gnus-tmp-process gnus-process-mark)
3722 ((memq gnus-tmp-current gnus-newsgroup-cached)
3724 (gnus-tmp-replied gnus-replied-mark)
3725 ((memq gnus-tmp-current gnus-newsgroup-forwarded)
3726 gnus-forwarded-mark)
3727 ((memq gnus-tmp-current gnus-newsgroup-saved)
3729 ((memq gnus-tmp-number gnus-newsgroup-unseen)
3732 (gnus-tmp-downloaded
3734 gnus-undownloaded-mark)
3735 (gnus-newsgroup-agentized
3736 gnus-downloaded-mark)
3739 (gnus-tmp-from (mail-header-from gnus-tmp-header))
3742 ((string-match "<[^>]+> *$" gnus-tmp-from)
3743 (let ((beg (match-beginning 0)))
3744 (or (and (string-match "^\".+\"" gnus-tmp-from)
3745 (substring gnus-tmp-from 1 (1- (match-end 0))))
3746 (substring gnus-tmp-from 0 beg))))
3747 ((string-match "(.+)" gnus-tmp-from)
3748 (substring gnus-tmp-from
3749 (1+ (match-beginning 0)) (1- (match-end 0))))
3751 (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
3752 (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
3753 (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
3754 (inhibit-read-only t))
3755 (when (string= gnus-tmp-name "")
3756 (setq gnus-tmp-name gnus-tmp-from))
3757 (unless (numberp gnus-tmp-lines)
3758 (setq gnus-tmp-lines -1))
3759 (if (= gnus-tmp-lines -1)
3760 (setq gnus-tmp-lines "?")
3761 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
3763 (gnus-put-text-property
3765 (progn (eval gnus-summary-line-format-spec) (point))
3766 'gnus-number gnus-tmp-number)
3767 (error (gnus-message 5 "Error updating the summary line")))
3768 (when (gnus-visual-p 'summary-highlight 'highlight)
3770 (gnus-summary-highlight-line)
3771 (gnus-run-hooks 'gnus-summary-update-hook)
3774 (defun gnus-summary-update-line (&optional dont-update)
3775 "Update summary line after change."
3776 (when (and gnus-summary-default-score
3777 (not gnus-summary-inhibit-highlight))
3778 (let* ((gnus-summary-inhibit-highlight t) ; Prevent recursion.
3779 (article (gnus-summary-article-number))
3780 (score (gnus-summary-article-score article)))
3782 (if (and gnus-summary-mark-below
3783 (< (gnus-summary-article-score)
3784 gnus-summary-mark-below))
3785 ;; This article has a low score, so we mark it as read.
3786 (when (memq article gnus-newsgroup-unreads)
3787 (gnus-summary-mark-article-as-read gnus-low-score-mark))
3788 (when (eq (gnus-summary-article-mark) gnus-low-score-mark)
3789 ;; This article was previously marked as read on account
3790 ;; of a low score, but now it has risen, so we mark it as
3792 (gnus-summary-mark-article-as-unread gnus-unread-mark)))
3793 (gnus-summary-update-mark
3794 (if (or (null gnus-summary-default-score)
3795 (<= (abs (- score gnus-summary-default-score))
3796 gnus-summary-zcore-fuzz))
3798 (if (< score gnus-summary-default-score)
3799 gnus-score-below-mark gnus-score-over-mark))
3801 ;; Do visual highlighting.
3802 (when (gnus-visual-p 'summary-highlight 'highlight)
3803 (gnus-summary-highlight-line)
3804 (gnus-run-hooks 'gnus-summary-update-hook)))))
3806 (defvar gnus-tmp-new-adopts nil)
3808 (defun gnus-summary-number-of-articles-in-thread (thread &optional level char)
3809 "Return the number of articles in THREAD.
3810 This may be 0 in some cases -- if none of the articles in
3811 the thread are to be displayed."
3813 ;; Fix by Luc Van Eycken <Luc.VanEycken@esat.kuleuven.ac.be>.
3815 ((not (listp thread))
3817 ((and (consp thread) (cdr thread))
3820 'gnus-summary-number-of-articles-in-thread (cdr thread))))
3823 ((memq (mail-header-number (car thread)) gnus-newsgroup-limit)
3826 (when (and level (zerop level) gnus-tmp-new-adopts)
3829 'gnus-summary-number-of-articles-in-thread
3830 gnus-tmp-new-adopts))))
3832 (if (> number 1) gnus-not-empty-thread-mark
3833 gnus-empty-thread-mark)
3836 (defsubst gnus-summary-line-message-size (head)
3837 "Return pretty-printed version of message size.
3838 This function is intended to be used in
3839 `gnus-summary-line-format-alist'."
3840 (let ((c (or (mail-header-chars head) -1)))
3841 (cond ((< c 0) "n/a") ; chars not available
3842 ((< c (* 1000 10)) (format "%1.1fk" (/ c 1024.0)))
3843 ((< c (* 1000 100)) (format "%dk" (/ c 1024.0)))
3844 ((< c (* 1000 10000)) (format "%1.1fM" (/ c (* 1024.0 1024))))
3845 (t (format "%dM" (/ c (* 1024.0 1024)))))))
3847 (defcustom gnus-user-date-format-alist
3848 '(((gnus-seconds-today) . "Today, %H:%M")
3849 ((+ 86400 (gnus-seconds-today)) . "Yesterday, %H:%M")
3850 (604800 . "%A %H:%M") ; That's one week
3851 ((gnus-seconds-month) . "%A %d")
3852 ((gnus-seconds-year) . "%B %d")
3853 (t . "%b %d %Y")) ; This one is used when no other
3855 "Specifies date format depending on age of article.
3856 This is an alist of items (AGE . FORMAT). AGE can be a number (of
3857 seconds) or a Lisp expression evaluating to a number. When the age of
3858 the article is less than this number, then use `format-time-string'
3859 with the corresponding FORMAT for displaying the date of the article.
3860 If AGE is not a number or a Lisp expression evaluating to a
3861 non-number, then the corresponding FORMAT is used as a default value.
3863 Note that the list is processed from the beginning, so it should be
3864 sorted by ascending AGE. Also note that items following the first
3865 non-number AGE will be ignored.
3867 You can use the functions `gnus-seconds-today', `gnus-seconds-month'
3868 and `gnus-seconds-year' in the AGE spec. They return the number of
3869 seconds passed since the start of today, of this month, of this year,
3872 :group 'gnus-summary-format
3873 :type '(alist :key-type sexp :value-type string))
3875 (defun gnus-user-date (messy-date)
3876 "Format the messy-date according to `gnus-user-date-format-alist'.
3877 Returns \" ? \" if there's bad input or if another error occurs.
3878 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
3880 (let* ((messy-date (gnus-float-time (gnus-date-get-time messy-date)))
3881 (now (gnus-float-time))
3882 ;;If we don't find something suitable we'll use this one
3883 (my-format "%b %d '%y"))
3884 (let* ((difference (- now messy-date))
3885 (templist gnus-user-date-format-alist)
3886 (top (eval (caar templist))))
3887 (while (if (numberp top) (< top difference) (not top))
3889 (setq templist (cdr templist))
3890 (setq top (eval (caar templist)))))
3891 (if (stringp (cdr (car templist)))
3892 (setq my-format (cdr (car templist)))))
3893 (format-time-string (eval my-format) (seconds-to-time messy-date)))
3896 (defun gnus-summary-set-local-parameters (group)
3897 "Go through the local params of GROUP and set all variable specs in that list."
3898 (let ((vars '(quit-config active))) ; Ignore things that aren't
3900 (dolist (elem (gnus-group-find-parameter group))
3901 (and (consp elem) ; Has to be a cons.
3902 (consp (cdr elem)) ; The cdr has to be a list.
3903 (symbolp (car elem)) ; Has to be a symbol in there.
3904 (not (memq (car elem) vars))
3906 (push (car elem) vars)
3907 ;; Variables like `gnus-show-threads' that are globally
3908 ;; bound, if used as group parameters, need to get to be
3909 ;; buffer-local, whereas just parameters like `gcc-self',
3910 ;; `timestamp', etc. should not be bound as variables.
3911 (if (boundp (car elem))
3912 (set (make-local-variable (car elem)) (eval (nth 1 elem)))
3913 (eval (nth 1 elem))))))))
3915 (defun gnus-summary-read-group (group &optional show-all no-article
3916 kill-buffer no-display backward
3918 "Start reading news in newsgroup GROUP.
3919 If SHOW-ALL is non-nil, already read articles are also listed.
3920 If NO-ARTICLE is non-nil, no article is selected initially.
3921 If NO-DISPLAY, don't generate the summary buffer contents.
3922 If KILL-BUFFER, it should be a buffer that's killed once the new
3923 summary buffer has been generated.
3924 If BACKWARD, move point to the previous group in the group buffer
3925 If SELECT-ARTICLES, only select those articles from GROUP."
3929 (let ((gnus-auto-select-next nil))
3930 (or (gnus-summary-read-group-1
3931 group show-all no-article
3932 kill-buffer no-display
3935 select-articles nil)))))
3936 (eq gnus-auto-select-next 'quietly))
3937 (set-buffer gnus-group-buffer)
3938 ;; The entry function called above goes to the next
3939 ;; group automatically, so we go two groups back
3940 ;; if we are searching for the previous group.
3942 (gnus-group-prev-unread-group 2))
3943 (if (not (equal group (gnus-group-group-name)))
3944 (setq group (gnus-group-group-name))
3948 (defun gnus-summary-read-group-1 (group show-all no-article
3949 kill-buffer no-display
3950 &optional select-articles)
3951 ;; Killed foreign groups can't be entered.
3952 ;; (when (and (not (gnus-group-native-p group))
3953 ;; (not (gnus-gethash group gnus-newsrc-hashtb)))
3954 ;; (error "Dead non-native groups can't be entered"))
3955 (gnus-message 7 "Retrieving newsgroup: %s..."
3956 (gnus-group-decoded-name group))
3957 (let* ((new-group (gnus-summary-setup-buffer group))
3958 (quit-config (gnus-group-quit-config group))
3959 (did-select (and new-group (gnus-select-newsgroup
3960 group show-all select-articles))))
3962 ;; This summary buffer exists already, so we just select it.
3964 (gnus-set-global-variables)
3966 (gnus-kill-or-deaden-summary kill-buffer))
3967 (gnus-configure-windows 'summary 'force)
3968 (gnus-set-mode-line 'summary)
3969 (gnus-summary-position-point)
3972 ;; We couldn't select this group.
3974 (when (and (eq major-mode 'gnus-summary-mode)
3975 (not (equal (current-buffer) kill-buffer)))
3976 (kill-buffer (current-buffer))
3977 (if (not quit-config)
3979 ;; Update the info -- marks might need to be removed,
3981 (gnus-summary-update-info)
3982 (set-buffer gnus-group-buffer)
3983 (gnus-group-jump-to-group group)
3984 (gnus-group-next-unread-group 1))
3985 (gnus-handle-ephemeral-exit quit-config)))
3986 (if (null (gnus-list-of-unread-articles group))
3987 (gnus-message 3 "Group %s contains no messages" group)
3988 (gnus-message 3 "Can't select group"))
3990 ;; The user did a `C-g' while prompting for number of articles,
3991 ;; so we exit this group.
3992 ((eq did-select 'quit)
3993 (and (eq major-mode 'gnus-summary-mode)
3994 (not (equal (current-buffer) kill-buffer))
3995 (kill-buffer (current-buffer)))
3997 (gnus-kill-or-deaden-summary kill-buffer))
3998 (if (not quit-config)
4000 (set-buffer gnus-group-buffer)
4001 (gnus-group-jump-to-group group)
4002 (gnus-configure-windows 'group 'force))
4003 (gnus-handle-ephemeral-exit quit-config))
4004 ;; Finally signal the quit.
4006 ;; The group was successfully selected.
4008 (gnus-set-global-variables)
4009 ;; Save the active value in effect when the group was entered.
4010 (setq gnus-newsgroup-active
4012 (gnus-active gnus-newsgroup-name)))
4013 (setq gnus-newsgroup-highest (cdr gnus-newsgroup-active))
4014 ;; You can change the summary buffer in some way with this hook.
4015 (gnus-run-hooks 'gnus-select-group-hook)
4016 (when (memq 'summary (gnus-update-format-specifications
4017 nil 'summary 'summary-mode 'summary-dummy))
4018 ;; The format specification for the summary line was updated,
4019 ;; so we need to update the mark positions as well.
4020 (gnus-update-summary-mark-positions))
4021 ;; Do score processing.
4022 (when gnus-use-scoring
4023 (gnus-possibly-score-headers))
4024 ;; Check whether to fill in the gaps in the threads.
4025 (when gnus-build-sparse-threads
4026 (gnus-build-sparse-threads))
4027 ;; Find the initial limit.
4029 (let ((gnus-newsgroup-dormant nil))
4030 (gnus-summary-initial-limit show-all))
4031 (gnus-summary-initial-limit show-all))
4032 ;; Generate the summary buffer.
4034 (gnus-summary-prepare))
4035 (when gnus-use-trees
4036 (gnus-tree-open group)
4037 (setq gnus-summary-highlight-line-function
4038 'gnus-tree-highlight-article))
4039 ;; If the summary buffer is empty, but there are some low-scored
4040 ;; articles or some excluded dormants, we include these in the
4042 (when (and (zerop (buffer-size))
4044 (cond (gnus-newsgroup-dormant
4045 (gnus-summary-limit-include-dormant))
4046 ((and gnus-newsgroup-scored show-all)
4047 (gnus-summary-limit-include-expunged t))))
4048 ;; Function `gnus-apply-kill-file' must be called in this hook.
4049 (gnus-run-hooks 'gnus-apply-kill-hook)
4050 (if (and (zerop (buffer-size))
4053 ;; This newsgroup is empty.
4054 (gnus-summary-catchup-and-exit nil t)
4055 (gnus-message 6 "No unread news")
4057 (gnus-kill-or-deaden-summary kill-buffer))
4058 ;; Return nil from this function.
4060 ;; Hide conversation thread subtrees. We cannot do this in
4061 ;; gnus-summary-prepare-hook since kill processing may not
4062 ;; work with hidden articles.
4063 (gnus-summary-maybe-hide-threads)
4064 (gnus-configure-windows 'summary)
4066 (gnus-kill-or-deaden-summary kill-buffer))
4067 (gnus-summary-auto-select-subject)
4068 ;; Show first unread article if requested.
4069 (if (and (not no-article)
4071 gnus-newsgroup-unreads
4072 gnus-auto-select-first)
4074 (let ((art (gnus-summary-article-number)))
4077 (not (memq art gnus-newsgroup-undownloaded))
4078 (not (memq art gnus-newsgroup-downloadable)))
4079 (gnus-summary-goto-article art))))
4080 ;; Don't select any articles.
4081 (gnus-summary-position-point)
4082 (gnus-configure-windows 'summary 'force)
4083 (gnus-set-mode-line 'summary))
4084 (when (and gnus-auto-center-group
4085 (get-buffer-window gnus-group-buffer t))
4086 ;; Gotta use windows, because recenter does weird stuff if
4087 ;; the current buffer ain't the displayed window.
4088 (let ((owin (selected-window)))
4089 (select-window (get-buffer-window gnus-group-buffer t))
4090 (when (gnus-group-goto-group group)
4092 (select-window owin)))
4093 ;; Mark this buffer as "prepared".
4094 (setq gnus-newsgroup-prepared t)
4095 (gnus-run-hooks 'gnus-summary-prepared-hook)
4096 (unless (gnus-ephemeral-group-p group)
4097 (gnus-group-update-group group nil t))
4100 (defun gnus-summary-auto-select-subject ()
4101 "Select the subject line on initial group entry."
4102 (goto-char (point-min))
4104 ((eq gnus-auto-select-subject 'best)
4105 (gnus-summary-best-unread-subject))
4106 ((eq gnus-auto-select-subject 'unread)
4107 (gnus-summary-first-unread-subject))
4108 ((eq gnus-auto-select-subject 'unseen)
4109 (gnus-summary-first-unseen-subject))
4110 ((eq gnus-auto-select-subject 'unseen-or-unread)
4111 (gnus-summary-first-unseen-or-unread-subject))
4112 ((eq gnus-auto-select-subject 'first)
4115 ((functionp gnus-auto-select-subject)
4116 (funcall gnus-auto-select-subject))))
4118 (defun gnus-summary-prepare ()
4119 "Generate the summary buffer."
4121 (let ((inhibit-read-only t))
4123 (setq gnus-newsgroup-data nil
4124 gnus-newsgroup-data-reverse nil)
4125 (gnus-run-hooks 'gnus-summary-generate-hook)
4126 ;; Generate the buffer, either with threads or without.
4127 (when gnus-newsgroup-headers
4128 (gnus-summary-prepare-threads
4129 (if gnus-show-threads
4130 (gnus-sort-gathered-threads
4131 (funcall gnus-summary-thread-gathering-function
4133 (gnus-cut-threads (gnus-make-threads)))))
4134 ;; Unthreaded display.
4135 (gnus-sort-articles gnus-newsgroup-headers))))
4136 (setq gnus-newsgroup-data (nreverse gnus-newsgroup-data))
4137 ;; Call hooks for modifying summary buffer.
4138 (goto-char (point-min))
4139 (gnus-run-hooks 'gnus-summary-prepare-hook)))
4141 (defsubst gnus-general-simplify-subject (subject)
4142 "Simplify subject by the same rules as `gnus-gather-threads-by-subject'."
4145 ;; Truncate the subject.
4146 (gnus-simplify-subject-functions
4147 (gnus-map-function gnus-simplify-subject-functions subject))
4148 ((numberp gnus-summary-gather-subject-limit)
4149 (setq subject (gnus-simplify-subject-re subject))
4150 (if (> (length subject) gnus-summary-gather-subject-limit)
4151 (substring subject 0 gnus-summary-gather-subject-limit)
4153 ;; Fuzzily simplify it.
4154 ((eq 'fuzzy gnus-summary-gather-subject-limit)
4155 (gnus-simplify-subject-fuzzy subject))
4156 ;; Just remove the leading "Re:".
4158 (gnus-simplify-subject-re subject))))
4160 (if (and gnus-summary-gather-exclude-subject
4161 (string-match gnus-summary-gather-exclude-subject subject))
4162 nil ; This article shouldn't be gathered
4165 (defun gnus-summary-simplify-subject-query ()
4166 "Query where the respool algorithm would put this article."
4168 (gnus-summary-select-article)
4169 (message "%s" (gnus-general-simplify-subject (gnus-summary-article-subject))))
4171 (defun gnus-gather-threads-by-subject (threads)
4172 "Gather threads by looking at Subject headers."
4173 (if (not gnus-summary-make-false-root)
4175 (let ((hashtb (gnus-make-hashtable 1024))
4178 subject hthread whole-subject)
4180 (setq subject (gnus-general-simplify-subject
4181 (setq whole-subject (mail-header-subject
4184 (if (setq hthread (gnus-gethash subject hashtb))
4186 ;; We enter a dummy root into the thread, if we
4187 ;; haven't done that already.
4188 (unless (stringp (caar hthread))
4189 (setcar hthread (list whole-subject (car hthread))))
4190 ;; We add this new gathered thread to this gathered
4192 (setcdr (car hthread)
4193 (nconc (cdar hthread) (list (car threads))))
4194 ;; Remove it from the list of threads.
4195 (setcdr prev (cdr threads))
4196 (setq threads prev))
4197 ;; Enter this thread into the hash table.
4198 (gnus-sethash subject
4199 (if gnus-summary-make-false-root-always
4201 ;; If you want a dummy root above all
4203 (setcar threads (list whole-subject
4209 (setq threads (cdr threads)))
4212 (defun gnus-gather-threads-by-references (threads)
4213 "Gather threads by looking at References headers."
4214 (let ((idhashtb (gnus-make-hashtable 1024))
4215 (thhashtb (gnus-make-hashtable 1024))
4218 ids references id gthread gid entered ref)
4220 (when (setq references (mail-header-references (caar threads)))
4221 (setq id (mail-header-id (caar threads))
4222 ids (inline (gnus-split-references references))
4224 (while (setq ref (pop ids))
4225 (setq ids (delete ref ids))
4226 (if (not (setq gid (gnus-gethash ref idhashtb)))
4228 (gnus-sethash ref id idhashtb)
4229 (gnus-sethash id threads thhashtb))
4230 (setq gthread (gnus-gethash gid thhashtb))
4232 ;; We enter a dummy root into the thread, if we
4233 ;; haven't done that already.
4234 (unless (stringp (caar gthread))
4235 (setcar gthread (list (mail-header-subject (caar gthread))
4237 ;; We add this new gathered thread to this gathered
4239 (setcdr (car gthread)
4240 (nconc (cdar gthread) (list (car threads)))))
4241 ;; Add it into the thread hash table.
4242 (gnus-sethash id gthread thhashtb)
4244 ;; Remove it from the list of threads.
4245 (setcdr prev (cdr threads))
4246 (setq threads prev))))
4248 (setq threads (cdr threads)))
4251 (defun gnus-sort-gathered-threads (threads)
4252 "Sort subthreads inside each gathered thread by `gnus-sort-gathered-threads-function'."
4253 (let ((result threads))
4255 (when (stringp (caar threads))
4256 (setcdr (car threads)
4257 (sort (cdar threads) gnus-sort-gathered-threads-function)))
4258 (setq threads (cdr threads)))
4261 (defun gnus-thread-loop-p (root thread)
4262 "Say whether ROOT is in THREAD."
4263 (let ((stack (list thread))
4266 (while (setq thread (pop stack))
4267 (setq th (cdr thread))
4269 (not (eq (caar th) root)))
4272 ;; We have found a loop.
4274 (setcdr thread (delq (car th) (cdr thread)))
4275 (if (boundp (setq ref-dep (intern "none"
4276 gnus-newsgroup-dependencies)))
4277 (setcdr (symbol-value ref-dep)
4278 (nconc (cdr (symbol-value ref-dep))
4280 (set ref-dep (list nil (car th))))
4283 ;; Push all the subthreads onto the stack.
4284 (push (cdr thread) stack)))
4287 (defun gnus-make-threads ()
4288 "Go through the dependency hashtb and find the roots. Return all threads."
4290 (while (catch 'infloop
4293 ;; Deal with self-referencing References loops.
4294 (when (and (car (symbol-value refs))
4301 (car (symbol-value refs)) thread))
4302 (cdr (symbol-value refs)))))))
4305 (unless (car (symbol-value refs))
4306 ;; These threads do not refer back to any other
4307 ;; articles, so they're roots.
4308 (setq threads (append (cdr (symbol-value refs)) threads))))
4309 gnus-newsgroup-dependencies)))
4312 ;; Build the thread tree.
4313 (defsubst gnus-dependencies-add-header (header dependencies force-new)
4314 "Enter HEADER into the DEPENDENCIES table if it is not already there.
4316 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
4317 if it was already present.
4319 If `gnus-summary-ignore-duplicates' is nil then duplicate Message-IDs
4320 will not be entered in the DEPENDENCIES table. Otherwise duplicate
4321 Message-IDs will be renamed to a unique Message-ID before being
4324 Returns HEADER if it was entered in the DEPENDENCIES. Returns nil otherwise."
4325 (let* ((id (mail-header-id header))
4326 (id-dep (and id (intern id dependencies)))
4327 parent-id ref ref-dep ref-header replaced)
4328 ;; Enter this `header' in the `dependencies' table.
4332 ;; The first two cases do the normal part: enter a new `header'
4333 ;; in the `dependencies' table.
4334 ((not (boundp id-dep))
4335 (set id-dep (list header)))
4336 ((null (car (symbol-value id-dep)))
4337 (setcar (symbol-value id-dep) header))
4339 ;; From here the `header' was already present in the
4340 ;; `dependencies' table.
4342 ;; Overrides an existing entry;
4343 ;; just set the header part of the entry.
4344 (setcar (symbol-value id-dep) header)
4347 ;; Renames the existing `header' to a unique Message-ID.
4348 ((not gnus-summary-ignore-duplicates)
4349 ;; An article with this Message-ID has already been seen.
4350 ;; We rename the Message-ID.
4351 (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
4353 (mail-header-set-id header id))
4355 ;; The last case ignores an existing entry, except it adds any
4356 ;; additional Xrefs (in case the two articles came from different
4358 ;; Also sets `header' to `nil' meaning that the `dependencies'
4359 ;; table was *not* modified.
4361 (mail-header-set-xref
4362 (car (symbol-value id-dep))
4363 (concat (or (mail-header-xref (car (symbol-value id-dep)))
4365 (or (mail-header-xref header) "")))
4368 (when (and header (not replaced))
4369 ;; First check that we are not creating a References loop.
4370 (setq parent-id (gnus-parent-id (mail-header-references header)))
4371 (setq ref parent-id)
4373 (setq ref-dep (intern-soft ref dependencies))
4375 (setq ref-header (car (symbol-value ref-dep))))
4376 (if (string= id ref)
4377 ;; Yuk! This is a reference loop. Make the article be a
4380 (mail-header-set-references (car (symbol-value id-dep)) "none")
4382 (setq parent-id nil))
4383 (setq ref (gnus-parent-id (mail-header-references ref-header)))))
4384 (setq ref-dep (intern (or parent-id "none") dependencies))
4385 (if (boundp ref-dep)
4386 (setcdr (symbol-value ref-dep)
4387 (nconc (cdr (symbol-value ref-dep))
4388 (list (symbol-value id-dep))))
4389 (set ref-dep (list nil (symbol-value id-dep)))))
4392 (defun gnus-extract-message-id-from-in-reply-to (string)
4393 (if (string-match "<[^>]+>" string)
4394 (substring string (match-beginning 0) (match-end 0))
4397 (defun gnus-build-sparse-threads ()
4398 (let ((headers gnus-newsgroup-headers)
4399 (mail-parse-charset gnus-newsgroup-charset)
4400 (gnus-summary-ignore-duplicates t)
4401 header references generation relations
4402 subject child end new-child date)
4403 ;; First we create an alist of generations/relations, where
4404 ;; generations is how much we trust the relation, and the relation
4406 (gnus-message 7 "Making sparse threads...")
4408 (nnheader-set-temp-buffer " *gnus sparse threads*")
4409 (while (setq header (pop headers))
4410 (when (and (setq references (mail-header-references header))
4411 (not (string= references "")))
4413 (setq child (mail-header-id header)
4414 subject (mail-header-subject header)
4415 date (mail-header-date header)
4417 (while (search-backward ">" nil t)
4418 (setq end (1+ (point)))
4419 (when (search-backward "<" nil t)
4420 (setq new-child (buffer-substring (point) end))
4421 (push (list (incf generation)
4422 child (setq child new-child)
4426 (push (list (1+ generation) child nil subject) relations))
4428 (kill-buffer (current-buffer)))
4429 ;; Sort over trustworthiness.
4430 (dolist (relation (sort relations 'car-less-than-car))
4431 (when (gnus-dependencies-add-header
4432 (make-full-mail-header
4433 gnus-reffed-article-number
4434 (nth 3 relation) "" (or (nth 4 relation) "")
4436 (or (nth 2 relation) "") 0 0 "")
4437 gnus-newsgroup-dependencies nil)
4438 (push gnus-reffed-article-number gnus-newsgroup-limit)
4439 (push gnus-reffed-article-number gnus-newsgroup-sparse)
4440 (push (cons gnus-reffed-article-number gnus-sparse-mark)
4441 gnus-newsgroup-reads)
4442 (decf gnus-reffed-article-number)))
4443 (gnus-message 7 "Making sparse threads...done")))
4445 (defun gnus-build-old-threads ()
4446 ;; Look at all the articles that refer back to old articles, and
4447 ;; fetch the headers for the articles that aren't there. This will
4448 ;; build complete threads - if the roots haven't been expired by the
4450 (let ((mail-parse-charset gnus-newsgroup-charset)
4454 (when (not (car (symbol-value refs)))
4455 (setq heads (cdr (symbol-value refs)))
4457 (if (memq (mail-header-number (caar heads))
4458 gnus-newsgroup-dormant)
4459 (setq heads (cdr heads))
4460 (setq id (symbol-name refs))
4461 (while (and (setq id (gnus-build-get-header id))
4462 (not (car (gnus-id-to-thread id)))))
4463 (setq heads nil)))))
4464 gnus-newsgroup-dependencies)))
4466 (defsubst gnus-remove-odd-characters (string)
4467 "Translate STRING into something that doesn't contain weird characters."
4468 (mm-subst-char-in-string
4470 (mm-subst-char-in-string ?\n ?\- string t) t))
4472 ;; This function has to be called with point after the article number
4473 ;; on the beginning of the line.
4474 (defsubst gnus-nov-parse-line (number dependencies &optional force-new)
4475 (let ((eol (point-at-eol))
4476 (buffer (current-buffer))
4477 header references in-reply-to)
4479 ;; overview: [num subject from date id refs chars lines misc]
4482 (narrow-to-region (point) eol)
4487 (make-full-mail-header
4489 (condition-case () ; subject
4490 (gnus-remove-odd-characters
4491 (funcall gnus-decode-encoded-word-function
4492 (setq x (nnheader-nov-field))))
4494 (condition-case () ; from
4495 (gnus-remove-odd-characters
4496 (funcall gnus-decode-encoded-address-function
4497 (setq x (nnheader-nov-field))))
4499 (nnheader-nov-field) ; date
4500 (nnheader-nov-read-message-id number) ; id
4501 (setq references (nnheader-nov-field)) ; refs
4502 (nnheader-nov-read-integer) ; chars
4503 (nnheader-nov-read-integer) ; lines
4505 (if (looking-at "Xref: ")
4506 (goto-char (match-end 0)))
4507 (nnheader-nov-field)) ; Xref
4508 (nnheader-nov-parse-extra)))) ; extra
4512 (when (and (string= references "")
4513 (setq in-reply-to (mail-header-extra header))
4514 (setq in-reply-to (cdr (assq 'In-Reply-To in-reply-to))))
4515 (mail-header-set-references
4516 header (gnus-extract-message-id-from-in-reply-to in-reply-to)))
4518 (when gnus-alter-header-function
4519 (funcall gnus-alter-header-function header))
4520 (gnus-dependencies-add-header header dependencies force-new)))
4522 (defun gnus-build-get-header (id)
4523 "Look through the buffer of NOV lines and find the header to ID.
4524 Enter this line into the dependencies hash table, and return
4525 the id of the parent article (if any)."
4526 (let ((deps gnus-newsgroup-dependencies)
4529 (with-current-buffer nntp-server-buffer
4530 (let ((case-fold-search nil))
4531 (goto-char (point-min))
4532 (while (and (not found)
4533 (search-forward id nil t))
4535 (setq found (looking-at
4536 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
4537 (regexp-quote id))))
4538 (or found (beginning-of-line 2)))
4542 (setq header (gnus-nov-parse-line
4543 (read (current-buffer)) deps))
4544 (gnus-parent-id (mail-header-references header))))))
4546 (let ((number (mail-header-number header)))
4547 (push number gnus-newsgroup-limit)
4548 (push header gnus-newsgroup-headers)
4549 (if (memq number gnus-newsgroup-unselected)
4551 (setq gnus-newsgroup-unreads
4552 (gnus-add-to-sorted-list gnus-newsgroup-unreads
4554 (setq gnus-newsgroup-unselected
4555 (delq number gnus-newsgroup-unselected)))
4556 (push number gnus-newsgroup-ancient)))))))
4558 (defun gnus-build-all-threads ()
4559 "Read all the headers."
4560 (let ((gnus-summary-ignore-duplicates t)
4561 (mail-parse-charset gnus-newsgroup-charset)
4562 (dependencies gnus-newsgroup-dependencies)
4564 (with-current-buffer nntp-server-buffer
4565 (let ((case-fold-search nil))
4566 (goto-char (point-min))
4569 (setq article (read (current-buffer))
4570 header (gnus-nov-parse-line article dependencies t)))
4572 (with-current-buffer gnus-summary-buffer
4573 (push header gnus-newsgroup-headers)
4574 (if (memq (setq article (mail-header-number header))
4575 gnus-newsgroup-unselected)
4577 (setq gnus-newsgroup-unreads
4578 (gnus-add-to-sorted-list
4579 gnus-newsgroup-unreads article))
4580 (setq gnus-newsgroup-unselected
4581 (delq article gnus-newsgroup-unselected)))
4582 (push article gnus-newsgroup-ancient)))
4583 (forward-line 1)))))))
4585 (defun gnus-summary-update-article-line (article header)
4586 "Update the line for ARTICLE using HEADER."
4587 (let* ((id (mail-header-id header))
4588 (thread (gnus-id-to-thread id)))
4590 (error "Article in no thread"))
4591 ;; Update the thread.
4592 (setcar thread header)
4593 (gnus-summary-goto-subject article)
4594 (let* ((datal (gnus-data-find-list article))
4596 (inhibit-read-only t)
4597 (level (gnus-summary-thread-level)))
4599 (let ((inserted (- (point)
4601 (gnus-summary-insert-line
4603 (memq article gnus-newsgroup-undownloaded)
4604 (gnus-article-mark article)
4605 (memq article gnus-newsgroup-replied)
4606 (memq article gnus-newsgroup-expirable)
4607 ;; Only insert the Subject string when it's different
4608 ;; from the previous Subject string.
4613 (mail-header-subject
4616 (gnus-data-find-list
4618 (gnus-data-list t)))))
4619 ;; Error on the side of excessive subjects.
4621 (mail-header-subject header)))
4623 (mail-header-subject header))
4624 nil (cdr (assq article gnus-newsgroup-scored))
4625 (memq article gnus-newsgroup-processable))
4628 (gnus-data-update-list
4630 (- (gnus-data-pos data) (gnus-data-pos (cadr datal)) inserted)))))))
4632 (defun gnus-summary-update-article (article &optional iheader)
4633 "Update ARTICLE in the summary buffer."
4634 (set-buffer gnus-summary-buffer)
4635 (let* ((header (gnus-summary-article-header article))
4636 (id (mail-header-id header))
4637 (data (gnus-data-find article))
4638 (thread (gnus-id-to-thread id))
4639 (references (mail-header-references header))
4643 (when (and references
4644 (not (equal "" references)))
4647 (inhibit-read-only t)
4653 (delq thread parent)))
4654 (if (gnus-summary-insert-subject id header)
4655 ;; Set the (possibly) new article number in the data structure.
4656 (gnus-data-set-number data (gnus-id-to-article id))
4660 (defun gnus-rebuild-thread (id &optional line)
4661 "Rebuild the thread containing ID.
4662 If LINE, insert the rebuilt thread starting on line LINE."
4663 (let ((inhibit-read-only t)
4664 old-pos current thread data)
4665 (if (not gnus-show-threads)
4666 (setq thread (list (car (gnus-id-to-thread id))))
4667 ;; Get the thread this article is part of.
4668 (setq thread (gnus-remove-thread id)))
4669 (setq old-pos (point-at-bol))
4670 (setq current (save-excursion
4671 (and (re-search-backward "[\r\n]" nil t)
4672 (gnus-summary-article-number))))
4673 ;; If this is a gathered thread, we have to go some re-gathering.
4674 (when (stringp (car thread))
4675 (let ((subject (car thread))
4677 (setq thread (cdr thread))
4679 (unless (memq (setq thr (gnus-id-to-thread
4681 (mail-header-id (caar thread)))))
4684 (setq thread (cdr thread)))
4685 ;; We now have all (unique) roots.
4686 (if (= (length roots) 1)
4687 ;; All the loose roots are now one solid root.
4688 (setq thread (car roots))
4689 (setq thread (cons subject (gnus-sort-threads roots))))))
4691 ;; We then insert this thread into the summary buffer.
4693 (goto-char (point-min))
4694 (forward-line (1- line)))
4695 (let (gnus-newsgroup-data gnus-newsgroup-threads)
4696 (if gnus-show-threads
4697 (gnus-summary-prepare-threads (gnus-cut-threads (list thread)))
4698 (gnus-summary-prepare-unthreaded thread))
4699 (setq data (nreverse gnus-newsgroup-data))
4700 (setq threads gnus-newsgroup-threads))
4701 ;; We splice the new data into the data structure.
4702 ;;!!! This is kinda bogus. We assume that in LINE is non-nil,
4703 ;;!!! then we want to insert at the beginning of the buffer.
4704 ;;!!! That happens to be true with Gnus now, but that may
4705 ;;!!! change in the future. Perhaps.
4706 (gnus-data-enter-list
4707 (if line nil current) data (- (point) old-pos))
4708 (setq gnus-newsgroup-threads
4709 (nconc threads gnus-newsgroup-threads))
4710 (gnus-data-compute-positions))))
4712 (defun gnus-number-to-header (number)
4713 "Return the header for article NUMBER."
4714 (let ((headers gnus-newsgroup-headers))
4716 (not (= number (mail-header-number (car headers)))))
4721 (defun gnus-parent-headers (in-headers &optional generation)
4722 "Return the headers of the GENERATIONth parent of HEADERS."
4724 (setq generation 1))
4726 (headers in-headers)
4729 (not (zerop generation))
4730 (setq references (mail-header-references headers)))
4731 (setq headers (if (and references
4732 (setq parent (gnus-parent-id references)))
4733 (car (gnus-id-to-thread parent))
4736 (and (not (eq headers in-headers))
4739 (defun gnus-id-to-thread (id)
4740 "Return the (sub-)thread where ID appears."
4741 (gnus-gethash id gnus-newsgroup-dependencies))
4743 (defun gnus-id-to-article (id)
4744 "Return the article number of ID."
4745 (let ((thread (gnus-id-to-thread id)))
4748 (mail-header-number (car thread)))))
4750 (defun gnus-id-to-header (id)
4751 "Return the article headers of ID."
4752 (car (gnus-id-to-thread id)))
4754 (defun gnus-article-displayed-root-p (article)
4755 "Say whether ARTICLE is a root(ish) article."
4756 (let ((level (gnus-summary-thread-level article))
4757 (refs (mail-header-references (gnus-summary-article-header article)))
4763 ((null (gnus-parent-id refs)) t)
4765 (null (setq particle (gnus-id-to-article
4766 (gnus-parent-id refs))))
4767 (null (gnus-summary-thread-level particle)))))))
4769 (defun gnus-root-id (id)
4770 "Return the id of the root of the thread where ID appears."
4772 (while (and id (setq prev (car (gnus-id-to-thread id))))
4774 id (gnus-parent-id (mail-header-references prev))))
4777 (defun gnus-articles-in-thread (thread)
4778 "Return the list of articles in THREAD."
4779 (cons (mail-header-number (car thread))
4780 (apply 'nconc (mapcar 'gnus-articles-in-thread (cdr thread)))))
4782 (defun gnus-remove-thread (id &optional dont-remove)
4783 "Remove the thread that has ID in it."
4784 (let (headers thread last-id)
4785 ;; First go up in this thread until we find the root.
4786 (setq last-id (gnus-root-id id)
4787 headers (message-flatten-list (gnus-id-to-thread last-id)))
4788 ;; We have now found the real root of this thread. It might have
4789 ;; been gathered into some loose thread, so we have to search
4790 ;; through the threads to find the thread we wanted.
4791 (let ((threads gnus-newsgroup-threads)
4794 (setq sub (car threads))
4795 (if (stringp (car sub))
4796 ;; This is a gathered thread, so we look at the roots
4797 ;; below it to find whether this article is in this
4800 (setq sub (cdr sub))
4802 (when (member (caar sub) headers)
4803 (setq thread (car threads)
4806 (setq sub (cdr sub))))
4807 ;; It's an ordinary thread, so we check it.
4808 (when (eq (car sub) (car headers))
4811 (setq threads (cdr threads)))
4812 ;; If this article is in no thread, then it's a root.
4815 (setq gnus-newsgroup-threads (delq thread gnus-newsgroup-threads)))
4816 (setq thread (gnus-id-to-thread last-id)))
4819 thread ; We return this thread.
4821 (if (stringp (car thread))
4823 ;; If we use dummy roots, then we have to remove the
4824 ;; dummy root as well.
4825 (when (eq gnus-summary-make-false-root 'dummy)
4826 ;; We go to the dummy root by going to
4827 ;; the first sub-"thread", and then one line up.
4828 (gnus-summary-goto-article
4829 (mail-header-number (caadr thread)))
4832 (gnus-data-compute-positions))
4833 (setq thread (cdr thread))
4835 (gnus-remove-thread-1 (car thread))
4836 (setq thread (cdr thread))))
4837 (gnus-remove-thread-1 thread))))))))
4839 (defun gnus-remove-thread-1 (thread)
4840 "Remove the thread THREAD recursively."
4841 (let ((number (mail-header-number (pop thread)))
4843 (setq thread (reverse thread))
4845 (gnus-remove-thread-1 (pop thread)))
4846 (when (setq d (gnus-data-find number))
4847 (goto-char (gnus-data-pos d))
4848 (gnus-summary-show-thread)
4854 (gnus-delete-line)))))))
4856 (defun gnus-sort-threads-recursive (threads func)
4857 (sort (mapcar (lambda (thread)
4860 (gnus-sort-threads-recursive (cdr thread) func))))
4863 (defun gnus-sort-threads-loop (threads func)
4864 (let* ((superthread (cons nil threads))
4865 (stack (list (cons superthread threads)))
4866 remaining-threads thread)
4868 (setq remaining-threads (cdr (car stack)))
4869 (if remaining-threads
4870 (progn (setq thread (car remaining-threads))
4871 (setcdr (car stack) (cdr remaining-threads))
4873 (push (cons thread (cdr thread)) stack)))
4874 (setq thread (caar stack))
4875 (setcdr thread (sort (cdr thread) func))
4879 (defun gnus-sort-threads (threads)
4881 (if (not gnus-thread-sort-functions)
4883 (gnus-message 8 "Sorting threads...")
4886 (let ((max-lisp-eval-depth (max max-lisp-eval-depth 5000))
4887 (sort-func (gnus-make-sort-function gnus-thread-sort-functions)))
4888 (if gnus-sort-threads-recursively
4889 (gnus-sort-threads-recursive threads sort-func)
4890 (sort threads sort-func)))
4891 ;; Even after binding max-lisp-eval-depth, the recursive
4892 ;; sorter might fail for very long threads. In that case,
4893 ;; try using a (less well-tested) non-recursive sorter.
4894 (error (gnus-message 9 "Sorting threads with loop...")
4895 (gnus-sort-threads-loop
4896 threads (gnus-make-sort-function
4897 gnus-thread-sort-functions))))
4898 (gnus-message 8 "Sorting threads...done"))))
4900 (defun gnus-sort-articles (articles)
4902 (when gnus-article-sort-functions
4903 (gnus-message 7 "Sorting articles...")
4905 (setq gnus-newsgroup-headers
4906 (sort articles (gnus-make-sort-function
4907 gnus-article-sort-functions)))
4908 (gnus-message 7 "Sorting articles...done"))))
4910 ;; Written by Hallvard B Furuseth <h.b.furuseth@usit.uio.no>.
4911 (defmacro gnus-thread-header (thread)
4912 "Return header of first article in THREAD.
4913 Note that THREAD must never, ever be anything else than a variable -
4914 using some other form will lead to serious barfage."
4915 (or (symbolp thread) (signal 'wrong-type-argument '(symbolp thread)))
4916 ;; (8% speedup to gnus-summary-prepare, just for fun :-)
4917 (list 'byte-code "\10\211:\203\17\0\211@;\203\16\0A@@\207"
4920 (defsubst gnus-article-sort-by-number (h1 h2)
4921 "Sort articles by article number."
4922 (< (mail-header-number h1)
4923 (mail-header-number h2)))
4925 (defun gnus-thread-sort-by-number (h1 h2)
4926 "Sort threads by root article number."
4927 (gnus-article-sort-by-number
4928 (gnus-thread-header h1) (gnus-thread-header h2)))
4930 (defsubst gnus-article-sort-by-random (h1 h2)
4931 "Sort articles randomly."
4934 (defun gnus-thread-sort-by-random (h1 h2)
4935 "Sort threads randomly."
4936 (gnus-article-sort-by-random
4937 (gnus-thread-header h1) (gnus-thread-header h2)))
4939 (defsubst gnus-article-sort-by-lines (h1 h2)
4940 "Sort articles by article Lines header."
4941 (< (mail-header-lines h1)
4942 (mail-header-lines h2)))
4944 (defun gnus-thread-sort-by-lines (h1 h2)
4945 "Sort threads by root article Lines header."
4946 (gnus-article-sort-by-lines
4947 (gnus-thread-header h1) (gnus-thread-header h2)))
4949 (defsubst gnus-article-sort-by-chars (h1 h2)
4950 "Sort articles by octet length."
4951 (< (mail-header-chars h1)
4952 (mail-header-chars h2)))
4954 (defun gnus-thread-sort-by-chars (h1 h2)
4955 "Sort threads by root article octet length."
4956 (gnus-article-sort-by-chars
4957 (gnus-thread-header h1) (gnus-thread-header h2)))
4959 (defsubst gnus-article-sort-by-author (h1 h2)
4960 "Sort articles by root author."
4962 (let ((extract (funcall
4963 gnus-extract-address-components
4964 (mail-header-from h1))))
4965 (or (car extract) (cadr extract) ""))
4966 (let ((extract (funcall
4967 gnus-extract-address-components
4968 (mail-header-from h2))))
4969 (or (car extract) (cadr extract) ""))))
4971 (defun gnus-thread-sort-by-author (h1 h2)
4972 "Sort threads by root author."
4973 (gnus-article-sort-by-author
4974 (gnus-thread-header h1) (gnus-thread-header h2)))
4976 (defsubst gnus-article-sort-by-recipient (h1 h2)
4977 "Sort articles by recipient."
4979 (let ((extract (funcall
4980 gnus-extract-address-components
4981 (or (cdr (assq 'To (mail-header-extra h1))) ""))))
4982 (or (car extract) (cadr extract)))
4983 (let ((extract (funcall
4984 gnus-extract-address-components
4985 (or (cdr (assq 'To (mail-header-extra h2))) ""))))
4986 (or (car extract) (cadr extract)))))
4988 (defun gnus-thread-sort-by-recipient (h1 h2)
4989 "Sort threads by root recipient."
4990 (gnus-article-sort-by-recipient
4991 (gnus-thread-header h1) (gnus-thread-header h2)))
4993 (defsubst gnus-article-sort-by-subject (h1 h2)
4994 "Sort articles by root subject."
4996 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4997 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4999 (defun gnus-thread-sort-by-subject (h1 h2)
5000 "Sort threads by root subject."
5001 (gnus-article-sort-by-subject
5002 (gnus-thread-header h1) (gnus-thread-header h2)))
5004 (defsubst gnus-article-sort-by-date (h1 h2)
5005 "Sort articles by root article date."
5007 (gnus-date-get-time (mail-header-date h1))
5008 (gnus-date-get-time (mail-header-date h2))))
5010 (defun gnus-thread-sort-by-date (h1 h2)
5011 "Sort threads by root article date."
5012 (gnus-article-sort-by-date
5013 (gnus-thread-header h1) (gnus-thread-header h2)))
5015 (defsubst gnus-article-sort-by-score (h1 h2)
5016 "Sort articles by root article score.
5017 Unscored articles will be counted as having a score of zero."
5018 (> (or (cdr (assq (mail-header-number h1)
5019 gnus-newsgroup-scored))
5020 gnus-summary-default-score 0)
5021 (or (cdr (assq (mail-header-number h2)
5022 gnus-newsgroup-scored))
5023 gnus-summary-default-score 0)))
5025 (defun gnus-thread-sort-by-score (h1 h2)
5026 "Sort threads by root article score."
5027 (gnus-article-sort-by-score
5028 (gnus-thread-header h1) (gnus-thread-header h2)))
5030 (defun gnus-thread-sort-by-total-score (h1 h2)
5031 "Sort threads by the sum of all scores in the thread.
5032 Unscored articles will be counted as having a score of zero."
5033 (> (gnus-thread-total-score h1) (gnus-thread-total-score h2)))
5035 (defun gnus-thread-total-score (thread)
5036 ;; This function find the total score of THREAD.
5041 (if (stringp (car thread))
5042 (apply gnus-thread-score-function 0
5043 (mapcar 'gnus-thread-total-score-1 (cdr thread)))
5044 (gnus-thread-total-score-1 thread)))
5046 (gnus-thread-total-score-1 (list thread)))))
5048 (defun gnus-article-sort-by-most-recent-number (h1 h2)
5049 "Sort articles by number."
5050 (gnus-article-sort-by-number h1 h2))
5052 (defun gnus-thread-sort-by-most-recent-number (h1 h2)
5053 "Sort threads such that the thread with the most recently arrived article comes first."
5054 (> (gnus-thread-highest-number h1) (gnus-thread-highest-number h2)))
5056 (defun gnus-thread-highest-number (thread)
5057 "Return the highest article number in THREAD."
5058 (apply 'max (mapcar (lambda (header)
5059 (mail-header-number header))
5060 (message-flatten-list thread))))
5062 (defun gnus-article-sort-by-most-recent-date (h1 h2)
5063 "Sort articles by number."
5064 (gnus-article-sort-by-date h1 h2))
5066 (defun gnus-thread-sort-by-most-recent-date (h1 h2)
5067 "Sort threads such that the thread with the most recently dated article comes first."
5068 (> (gnus-thread-latest-date h1) (gnus-thread-latest-date h2)))
5070 ; Since this is called not only to sort the top-level threads, but
5071 ; also in recursive sorts to order the articles within a thread, each
5072 ; article will be processed many times. Thus it speeds things up
5073 ; quite a bit to use gnus-date-get-time, which caches the time value.
5074 (defun gnus-thread-latest-date (thread)
5075 "Return the highest article date in THREAD."
5077 (mapcar (lambda (header) (gnus-float-time
5079 (mail-header-date header))))
5080 (message-flatten-list thread))))
5082 (defun gnus-thread-total-score-1 (root)
5083 ;; This function find the total score of the thread below ROOT.
5084 (setq root (car root))
5085 (apply gnus-thread-score-function
5087 (mapcar 'gnus-thread-total-score
5088 (cdr (gnus-id-to-thread (mail-header-id root))))
5089 (when (> (mail-header-number root) 0)
5090 (list (or (cdr (assq (mail-header-number root)
5091 gnus-newsgroup-scored))
5092 gnus-summary-default-score 0))))
5093 (list gnus-summary-default-score)
5096 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
5097 (defvar gnus-tmp-prev-subject nil)
5098 (defvar gnus-tmp-false-parent nil)
5099 (defvar gnus-tmp-root-expunged nil)
5100 (defvar gnus-tmp-dummy-line nil)
5102 (defun gnus-extra-header (type &optional header)
5103 "Return the extra header of TYPE."
5104 (or (cdr (assq type (mail-header-extra (or header gnus-tmp-header))))
5107 (defvar gnus-tmp-thread-tree-header-string "")
5109 (defcustom gnus-sum-thread-tree-root "> "
5110 "With %B spec, used for the root of a thread.
5111 If nil, use subject instead."
5113 :type '(radio (const :format "%v " nil) string)
5114 :group 'gnus-thread)
5116 (defcustom gnus-sum-thread-tree-false-root "> "
5117 "With %B spec, used for a false root of a thread.
5118 If nil, use subject instead."
5120 :type '(radio (const :format "%v " nil) string)
5121 :group 'gnus-thread)
5123 (defcustom gnus-sum-thread-tree-single-indent ""
5124 "With %B spec, used for a thread with just one message.
5125 If nil, use subject instead."
5127 :type '(radio (const :format "%v " nil) string)
5128 :group 'gnus-thread)
5130 (defcustom gnus-sum-thread-tree-vertical "| "
5131 "With %B spec, used for drawing a vertical line."
5134 :group 'gnus-thread)
5136 (defcustom gnus-sum-thread-tree-indent " "
5137 "With %B spec, used for indenting."
5140 :group 'gnus-thread)
5142 (defcustom gnus-sum-thread-tree-leaf-with-other "+-> "
5143 "With %B spec, used for a leaf with brothers."
5146 :group 'gnus-thread)
5148 (defcustom gnus-sum-thread-tree-single-leaf "\\-> "
5149 "With %B spec, used for a leaf without brothers."
5152 :group 'gnus-thread)
5154 (defcustom gnus-summary-display-while-building nil
5155 "If non-nil, show and update the summary buffer as it's being built.
5156 If the value is t, update the buffer after every line is inserted. If
5157 the value is an integer (N), update the display every N lines."
5160 :type '(choice (const :tag "off" nil)
5162 (const :tag "frequently" t)))
5164 (defun gnus-summary-prepare-threads (threads)
5165 "Prepare summary buffer from THREADS and indentation LEVEL.
5166 THREADS is either a list of `(PARENT [(CHILD1 [(GRANDCHILD ...]...) ...])'
5167 or a straight list of headers."
5168 (gnus-message 7 "Generating summary...")
5170 (setq gnus-newsgroup-threads threads)
5173 (let ((gnus-tmp-level 0)
5174 (default-score (or gnus-summary-default-score 0))
5175 (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
5176 (building-line-count gnus-summary-display-while-building)
5177 (building-count (integerp gnus-summary-display-while-building))
5178 thread number subject stack state gnus-tmp-gathered beg-match
5179 new-roots gnus-tmp-new-adopts thread-end simp-subject
5180 gnus-tmp-header gnus-tmp-unread gnus-tmp-downloaded
5181 gnus-tmp-replied gnus-tmp-subject-or-nil
5182 gnus-tmp-dummy gnus-tmp-indentation gnus-tmp-lines gnus-tmp-score
5183 gnus-tmp-score-char gnus-tmp-from gnus-tmp-name
5184 gnus-tmp-number gnus-tmp-opening-bracket gnus-tmp-closing-bracket
5187 (setq gnus-tmp-prev-subject nil
5188 gnus-tmp-thread-tree-header-string "")
5190 (if (vectorp (car threads))
5191 ;; If this is a straight (sic) list of headers, then a
5192 ;; threaded summary display isn't required, so we just create
5193 ;; an unthreaded one.
5194 (gnus-summary-prepare-unthreaded threads)
5196 ;; Do the threaded display.
5198 (if gnus-summary-display-while-building
5199 (switch-to-buffer (buffer-name)))
5200 (while (or threads stack gnus-tmp-new-adopts new-roots)
5202 (if (and (= gnus-tmp-level 0)
5205 (not gnus-tmp-false-parent)
5206 (or gnus-tmp-new-adopts new-roots))
5207 (if gnus-tmp-new-adopts
5208 (setq gnus-tmp-level (if gnus-tmp-root-expunged 0 1)
5209 thread (list (car gnus-tmp-new-adopts))
5210 gnus-tmp-header (caar thread)
5211 gnus-tmp-new-adopts (cdr gnus-tmp-new-adopts))
5213 (setq thread (list (car new-roots))
5214 gnus-tmp-header (caar thread)
5215 new-roots (cdr new-roots))))
5218 ;; If there are some threads, we do them before the
5219 ;; threads on the stack.
5220 (setq thread threads
5221 gnus-tmp-header (caar thread))
5222 ;; There were no current threads, so we pop something off
5224 (setq state (car stack)
5225 gnus-tmp-level (car state)
5226 tree-stack (cadr state)
5227 thread (caddr state)
5229 gnus-tmp-header (caar thread))))
5231 (setq gnus-tmp-false-parent nil)
5232 (setq gnus-tmp-root-expunged nil)
5233 (setq thread-end nil)
5235 (if (stringp gnus-tmp-header)
5236 ;; The header is a dummy root.
5238 ((eq gnus-summary-make-false-root 'adopt)
5239 ;; We let the first article adopt the rest.
5240 (setq gnus-tmp-new-adopts (nconc gnus-tmp-new-adopts
5242 (setq gnus-tmp-gathered
5244 (lambda (h) (mail-header-number (car h)))
5247 (setq thread (cons (list (caar thread)
5250 (setq gnus-tmp-level -1
5251 gnus-tmp-false-parent t))
5252 ((eq gnus-summary-make-false-root 'empty)
5253 ;; We print adopted articles with empty subject fields.
5254 (setq gnus-tmp-gathered
5256 (lambda (h) (mail-header-number (car h)))
5259 (setq gnus-tmp-level -1))
5260 ((eq gnus-summary-make-false-root 'dummy)
5261 ;; We remember that we probably want to output a dummy
5263 (setq gnus-tmp-dummy-line gnus-tmp-header)
5264 (setq gnus-tmp-prev-subject gnus-tmp-header))
5266 ;; We do not make a root for the gathered
5267 ;; sub-threads at all.
5268 (setq gnus-tmp-level -1)))
5270 (setq number (mail-header-number gnus-tmp-header)
5271 subject (mail-header-subject gnus-tmp-header)
5272 simp-subject (gnus-simplify-subject-fully subject))
5275 ;; If the thread has changed subject, we might want to make
5276 ;; this subthread into a root.
5277 ((and (null gnus-thread-ignore-subject)
5278 (not (zerop gnus-tmp-level))
5279 gnus-tmp-prev-subject
5280 (not (string= gnus-tmp-prev-subject simp-subject)))
5281 (setq new-roots (nconc new-roots (list (car thread)))
5283 gnus-tmp-header nil))
5284 ;; If the article lies outside the current limit,
5285 ;; then we do not display it.
5286 ((not (memq number gnus-newsgroup-limit))
5287 (setq gnus-tmp-gathered
5289 (lambda (h) (mail-header-number (car h)))
5292 (setq gnus-tmp-new-adopts (if (cdar thread)
5293 (append gnus-tmp-new-adopts
5295 gnus-tmp-new-adopts)
5297 gnus-tmp-header nil)
5298 (when (zerop gnus-tmp-level)
5299 (setq gnus-tmp-root-expunged t)))
5300 ;; Perhaps this article is to be marked as read?
5301 ((and gnus-summary-mark-below
5302 (< (or (cdr (assq number gnus-newsgroup-scored))
5304 gnus-summary-mark-below)
5305 ;; Don't touch sparse articles.
5306 (not (gnus-summary-article-sparse-p number))
5307 (not (gnus-summary-article-ancient-p number)))
5308 (setq gnus-newsgroup-unreads
5309 (delq number gnus-newsgroup-unreads))
5310 (if gnus-newsgroup-auto-expire
5311 (setq gnus-newsgroup-expirable
5312 (gnus-add-to-sorted-list
5313 gnus-newsgroup-expirable number))
5314 (push (cons number gnus-low-score-mark)
5315 gnus-newsgroup-reads))))
5317 (when gnus-tmp-header
5318 ;; We may have an old dummy line to output before this
5320 (when (and gnus-tmp-dummy-line
5323 (mail-header-subject gnus-tmp-header)))
5324 (gnus-summary-insert-dummy-line
5325 gnus-tmp-dummy-line (mail-header-number gnus-tmp-header))
5326 (setq gnus-tmp-dummy-line nil))
5328 ;; Compute the mark.
5329 (setq gnus-tmp-unread (gnus-article-mark number))
5331 (push (gnus-data-make number gnus-tmp-unread (1+ (point))
5332 gnus-tmp-header gnus-tmp-level)
5333 gnus-newsgroup-data)
5335 ;; Actually insert the line.
5337 gnus-tmp-subject-or-nil
5339 ((and gnus-thread-ignore-subject
5340 gnus-tmp-prev-subject
5341 (not (string= gnus-tmp-prev-subject simp-subject)))
5343 ((zerop gnus-tmp-level)
5344 (if (and (eq gnus-summary-make-false-root 'empty)
5345 (memq number gnus-tmp-gathered)
5346 gnus-tmp-prev-subject
5347 (string= gnus-tmp-prev-subject simp-subject))
5348 gnus-summary-same-subject
5350 (t gnus-summary-same-subject)))
5351 (if (and (eq gnus-summary-make-false-root 'adopt)
5352 (= gnus-tmp-level 1)
5353 (memq number gnus-tmp-gathered))
5354 (setq gnus-tmp-opening-bracket ?\<
5355 gnus-tmp-closing-bracket ?\>)
5356 (setq gnus-tmp-opening-bracket ?\[
5357 gnus-tmp-closing-bracket ?\]))
5358 (if (>= gnus-tmp-level (length gnus-thread-indent-array))
5359 (gnus-make-thread-indent-array
5360 (max (* 2 (length gnus-thread-indent-array))
5363 gnus-tmp-indentation
5364 (aref gnus-thread-indent-array gnus-tmp-level)
5365 gnus-tmp-lines (mail-header-lines gnus-tmp-header)
5366 gnus-tmp-score (or (cdr (assq number gnus-newsgroup-scored))
5367 gnus-summary-default-score 0)
5369 (if (or (null gnus-summary-default-score)
5370 (<= (abs (- gnus-tmp-score gnus-summary-default-score))
5371 gnus-summary-zcore-fuzz))
5373 (if (< gnus-tmp-score gnus-summary-default-score)
5374 gnus-score-below-mark gnus-score-over-mark))
5376 (cond ((memq number gnus-newsgroup-processable)
5378 ((memq number gnus-newsgroup-cached)
5380 ((memq number gnus-newsgroup-replied)
5382 ((memq number gnus-newsgroup-forwarded)
5383 gnus-forwarded-mark)
5384 ((memq number gnus-newsgroup-saved)
5386 ((memq number gnus-newsgroup-unseen)
5390 (cond ((memq number gnus-newsgroup-undownloaded)
5391 gnus-undownloaded-mark)
5392 (gnus-newsgroup-agentized
5393 gnus-downloaded-mark)
5396 gnus-tmp-from (mail-header-from gnus-tmp-header)
5399 ((string-match "<[^>]+> *$" gnus-tmp-from)
5400 (setq beg-match (match-beginning 0))
5401 (or (and (string-match "^\".+\"" gnus-tmp-from)
5402 (substring gnus-tmp-from 1 (1- (match-end 0))))
5403 (substring gnus-tmp-from 0 beg-match)))
5404 ((string-match "(.+)" gnus-tmp-from)
5405 (substring gnus-tmp-from
5406 (1+ (match-beginning 0)) (1- (match-end 0))))
5410 gnus-tmp-thread-tree-header-string
5412 ((not gnus-show-threads) "")
5413 ((zerop gnus-tmp-level)
5414 (cond ((cdar thread)
5415 (or gnus-sum-thread-tree-root subject))
5416 (gnus-tmp-new-adopts
5417 (or gnus-sum-thread-tree-false-root subject))
5419 (or gnus-sum-thread-tree-single-indent subject))))
5421 (concat (apply 'concat
5422 (mapcar (lambda (item)
5424 gnus-sum-thread-tree-vertical
5425 gnus-sum-thread-tree-indent))
5426 (cdr (reverse tree-stack))))
5428 gnus-sum-thread-tree-leaf-with-other
5429 gnus-sum-thread-tree-single-leaf)))))
5430 (when (string= gnus-tmp-name "")
5431 (setq gnus-tmp-name gnus-tmp-from))
5432 (unless (numberp gnus-tmp-lines)
5433 (setq gnus-tmp-lines -1))
5434 (if (= gnus-tmp-lines -1)
5435 (setq gnus-tmp-lines "?")
5436 (setq gnus-tmp-lines (number-to-string gnus-tmp-lines)))
5437 (gnus-put-text-property
5439 (progn (eval gnus-summary-line-format-spec) (point))
5440 'gnus-number number)
5443 (gnus-summary-highlight-line)
5444 (when gnus-summary-update-hook
5445 (gnus-run-hooks 'gnus-summary-update-hook))
5448 (setq gnus-tmp-prev-subject simp-subject)))
5450 (when (nth 1 thread)
5451 (push (list (max 0 gnus-tmp-level)
5452 (copy-sequence tree-stack)
5455 (push (if (nth 1 thread) 1 0) tree-stack)
5456 (incf gnus-tmp-level)
5457 (setq threads (if thread-end nil (cdar thread)))
5458 (if gnus-summary-display-while-building
5461 ;; use a set frequency
5462 (setq building-line-count (1- building-line-count))
5463 (when (= building-line-count 0)
5465 (setq building-line-count
5466 gnus-summary-display-while-building)))
5470 (setq gnus-tmp-level 0)))))
5471 (gnus-message 7 "Generating summary...done"))
5473 (defun gnus-summary-prepare-unthreaded (headers)
5474 "Generate an unthreaded summary buffer based on HEADERS."
5475 (let (header number mark)
5480 ;; We may have to root out some bad articles...
5481 (when (memq (setq number (mail-header-number
5482 (setq header (pop headers))))
5483 gnus-newsgroup-limit)
5484 ;; Mark article as read when it has a low score.
5485 (when (and gnus-summary-mark-below
5486 (< (or (cdr (assq number gnus-newsgroup-scored))
5487 gnus-summary-default-score 0)
5488 gnus-summary-mark-below)
5489 (not (gnus-summary-article-ancient-p number)))
5490 (setq gnus-newsgroup-unreads
5491 (delq number gnus-newsgroup-unreads))
5492 (if gnus-newsgroup-auto-expire
5493 (push number gnus-newsgroup-expirable)
5494 (push (cons number gnus-low-score-mark)
5495 gnus-newsgroup-reads)))
5497 (setq mark (gnus-article-mark number))
5498 (push (gnus-data-make number mark (1+ (point)) header 0)
5499 gnus-newsgroup-data)
5500 (gnus-summary-insert-line
5502 (memq number gnus-newsgroup-undownloaded)
5503 mark (memq number gnus-newsgroup-replied)
5504 (memq number gnus-newsgroup-expirable)
5505 (mail-header-subject header) nil
5506 (cdr (assq number gnus-newsgroup-scored))
5507 (memq number gnus-newsgroup-processable))))))
5509 (declare-function gnus-parameter-list-identifier "gnus-art" (name) t)
5511 (defun gnus-group-get-list-identifiers (group)
5512 "Get list identifier regexp for GROUP."
5513 (or (gnus-parameter-list-identifier group)
5514 (if (consp gnus-list-identifiers)
5515 (mapconcat 'identity gnus-list-identifiers " *\\|")
5516 gnus-list-identifiers)))
5518 (defun gnus-summary-remove-list-identifiers ()
5519 "Remove list identifiers in `gnus-list-identifiers' from articles in the current group."
5520 (let ((regexp (gnus-group-get-list-identifiers gnus-newsgroup-name))
5523 (setq regexp (concat "^\\(?:R[Ee]: +\\)*\\(" regexp " *\\)"))
5524 (dolist (header gnus-newsgroup-headers)
5525 (setq subject (mail-header-subject header)
5527 (while (string-match regexp subject)
5529 (concat (substring subject 0 (match-beginning 1))
5530 (substring subject (match-end 0)))
5533 (when (string-match "^\\(\\(?:R[Ee]: +\\)+\\)R[Ee]: +" subject)
5535 (concat (substring subject 0 (match-beginning 1))
5536 (substring subject (match-end 1)))))
5537 (mail-header-set-subject header subject))))))
5539 (defun gnus-fetch-headers (articles &optional limit force-new dependencies)
5540 "Fetch headers of ARTICLES."
5541 (let ((name (gnus-group-decoded-name gnus-newsgroup-name)))
5542 (gnus-message 7 "Fetching headers for %s..." name)
5545 (setq gnus-headers-retrieved-by
5546 (gnus-retrieve-headers
5547 articles gnus-newsgroup-name
5549 ;; We might want to fetch old headers, but
5550 ;; not if there is only 1 article.
5552 (not (eq gnus-fetch-old-headers 'some))
5553 (not (numberp gnus-fetch-old-headers)))
5554 (> (length articles) 1))
5555 gnus-fetch-old-headers)))))
5556 (gnus-get-newsgroup-headers-xover
5557 articles force-new dependencies gnus-newsgroup-name t)
5558 (gnus-get-newsgroup-headers dependencies force-new))
5559 (gnus-message 7 "Fetching headers for %s...done" name))))
5561 (defun gnus-select-newsgroup (group &optional read-all select-articles)
5562 "Select newsgroup GROUP.
5563 If READ-ALL is non-nil, all articles in the group are selected.
5564 If SELECT-ARTICLES, only select those articles from GROUP."
5565 (let* ((entry (gnus-group-entry group))
5566 ;;!!! Dirty hack; should be removed.
5567 (gnus-summary-ignore-duplicates
5568 (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
5570 gnus-summary-ignore-duplicates))
5571 (info (nth 2 entry))
5572 charset articles fetched-articles cached)
5574 (unless (gnus-check-server
5575 (set (make-local-variable 'gnus-current-select-method)
5576 (gnus-find-method-for-group group)))
5577 (error "Couldn't open server"))
5578 (setq charset (gnus-group-name-charset gnus-current-select-method group))
5580 (or (and entry (not (eq (car entry) t))) ; Either it's active...
5581 (gnus-activate-group group) ; Or we can activate it...
5582 (progn ; Or we bug out.
5583 (when (equal major-mode 'gnus-summary-mode)
5584 (gnus-kill-buffer (current-buffer)))
5586 "Couldn't activate group %s: %s"
5587 (mm-decode-coding-string group charset)
5588 (mm-decode-coding-string (gnus-status-message group) charset))))
5590 (unless (gnus-request-group group t)
5591 (when (equal major-mode 'gnus-summary-mode)
5592 (gnus-kill-buffer (current-buffer)))
5593 (error "Couldn't request group %s: %s"
5594 (mm-decode-coding-string group charset)
5595 (mm-decode-coding-string (gnus-status-message group) charset)))
5597 (when (and gnus-agent
5598 (gnus-active group))
5599 (gnus-agent-possibly-alter-active group (gnus-active group) info)
5601 (setq gnus-summary-use-undownloaded-faces
5602 (gnus-agent-find-parameter
5604 'agent-enable-undownloaded-faces)))
5606 (setq gnus-newsgroup-name group
5607 gnus-newsgroup-unselected nil
5608 gnus-newsgroup-unreads (gnus-list-of-unread-articles group))
5610 (let ((display (gnus-group-find-parameter group 'display)))
5611 (setq gnus-newsgroup-display
5613 ((not (zerop (or (car-safe read-all) 0)))
5614 ;; The user entered the group with C-u SPC/RET, let's show
5620 (gnus-summary-display-make-predicate (mapcar 'identity display)))
5622 ;; The following is probably the "correct" solution, but
5623 ;; it makes Gnus fetch all headers and then limit the
5624 ;; articles (which is slow), so instead we hack the
5625 ;; select-articles parameter instead. -- Simon Josefsson
5628 ;; (gnus-byte-compile
5629 ;; `(lambda () (> number ,(- (cdr (gnus-active group))
5631 (setq select-articles
5632 (gnus-uncompress-range
5633 (cons (let ((tmp (- (cdr (gnus-active group)) display)))
5637 (cdr (gnus-active group)))))
5642 (gnus-summary-setup-default-charset)
5644 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5645 (when (gnus-virtual-group-p group)
5646 (setq cached gnus-newsgroup-cached))
5648 (setq gnus-newsgroup-unreads
5649 (gnus-sorted-ndifference
5650 (gnus-sorted-ndifference gnus-newsgroup-unreads
5651 gnus-newsgroup-marked)
5652 gnus-newsgroup-dormant))
5654 (setq gnus-newsgroup-processable nil)
5656 (gnus-update-read-articles group gnus-newsgroup-unreads t)
5658 ;; Adjust and set lists of article marks.
5660 (gnus-adjust-marked-articles info))
5661 (if (setq articles select-articles)
5662 (setq gnus-newsgroup-unselected
5663 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5664 (setq articles (gnus-articles-to-read group read-all)))
5668 ;;(gnus-message 3 "Couldn't select newsgroup -- no articles to display")
5670 ((eq articles 0) nil)
5672 ;; Init the dependencies hash table.
5673 (setq gnus-newsgroup-dependencies
5674 (gnus-make-hashtable (length articles)))
5675 (if (gnus-buffer-live-p gnus-group-buffer)
5676 (gnus-set-global-variables)
5677 (set-default 'gnus-newsgroup-name gnus-newsgroup-name))
5678 ;; Retrieve the headers and read them in.
5680 (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
5682 ;; Kludge to avoid having cached articles nixed out in virtual groups.
5684 (setq gnus-newsgroup-cached cached))
5686 ;; Suppress duplicates?
5687 (when gnus-suppress-duplicates
5688 (gnus-dup-suppress-articles))
5690 ;; Set the initial limit.
5691 (setq gnus-newsgroup-limit (copy-sequence articles))
5692 ;; Remove canceled articles from the list of unread articles.
5693 (setq fetched-articles
5694 (mapcar (lambda (headers) (mail-header-number headers))
5695 gnus-newsgroup-headers))
5696 (setq gnus-newsgroup-articles fetched-articles)
5697 (setq gnus-newsgroup-unreads
5698 (gnus-sorted-nintersection
5699 gnus-newsgroup-unreads fetched-articles))
5700 (gnus-compute-unseen-list)
5702 ;; Removed marked articles that do not exist.
5703 (gnus-update-missing-marks
5704 (gnus-sorted-difference articles fetched-articles))
5705 ;; We might want to build some more threads first.
5706 (when (and gnus-fetch-old-headers
5707 (eq gnus-headers-retrieved-by 'nov))
5708 (if (eq gnus-fetch-old-headers 'invisible)
5709 (gnus-build-all-threads)
5710 (gnus-build-old-threads)))
5711 ;; Let the Gnus agent mark articles as read.
5713 (gnus-agent-get-undownloaded-list))
5714 ;; Remove list identifiers from subject
5715 (gnus-summary-remove-list-identifiers)
5716 ;; Check whether auto-expire is to be done in this group.
5717 (setq gnus-newsgroup-auto-expire
5718 (and (gnus-group-auto-expirable-p group)
5719 (not (gnus-group-read-only-p group))))
5720 ;; Set up the article buffer now, if necessary.
5721 (unless (and gnus-single-article-buffer
5722 (equal gnus-article-buffer "*Article*"))
5723 (gnus-article-setup-buffer))
5724 ;; First and last article in this newsgroup.
5725 (when gnus-newsgroup-headers
5726 (setq gnus-newsgroup-begin
5727 (mail-header-number (car gnus-newsgroup-headers))
5730 (gnus-last-element gnus-newsgroup-headers))))
5731 ;; GROUP is successfully selected.
5732 (or gnus-newsgroup-headers t)))))
5734 (defun gnus-compute-unseen-list ()
5735 ;; The `seen' marks are treated specially.
5736 (if (not gnus-newsgroup-seen)
5737 (setq gnus-newsgroup-unseen gnus-newsgroup-articles)
5738 (setq gnus-newsgroup-unseen
5739 (gnus-inverse-list-range-intersection
5740 gnus-newsgroup-articles gnus-newsgroup-seen))))
5742 (declare-function gnus-get-predicate "gnus-agent" (predicate))
5744 (defun gnus-summary-display-make-predicate (display)
5745 (require 'gnus-agent)
5746 (when (= (length display) 1)
5747 (setq display (car display)))
5748 (unless gnus-summary-display-cache
5749 (dolist (elem (append '((unread . unread)
5752 gnus-article-mark-lists))
5753 (push (cons (cdr elem)
5754 (gnus-byte-compile ;Why bother?
5755 `(lambda () (gnus-article-marked-p ',(cdr elem)))))
5756 gnus-summary-display-cache)))
5757 (let ((gnus-category-predicate-alist gnus-summary-display-cache)
5758 (gnus-category-predicate-cache gnus-summary-display-cache))
5759 (gnus-get-predicate display)))
5761 ;; Uses the dynamically bound `gnus-number' variable.
5762 (defvar gnus-number)
5763 (defun gnus-article-marked-p (type &optional article)
5764 (let ((article (or article gnus-number)))
5767 (memq article gnus-newsgroup-marked))
5769 (memq article gnus-newsgroup-spam-marked))
5771 (memq article gnus-newsgroup-unsendable))
5772 ((eq type 'undownload)
5773 (memq article gnus-newsgroup-undownloaded))
5774 ((eq type 'download)
5775 (memq article gnus-newsgroup-downloadable))
5777 (memq article gnus-newsgroup-unreads))
5779 (memq article gnus-newsgroup-reads))
5781 (memq article gnus-newsgroup-dormant) )
5783 (memq article gnus-newsgroup-expirable))
5785 (memq article gnus-newsgroup-replied))
5787 (memq article gnus-newsgroup-killed))
5788 ((eq type 'bookmark)
5789 (assq article gnus-newsgroup-bookmarks))
5791 (assq article gnus-newsgroup-scored))
5793 (memq article gnus-newsgroup-saved))
5795 (memq article gnus-newsgroup-cached))
5797 (memq article gnus-newsgroup-forwarded))
5799 (not (memq article gnus-newsgroup-unseen)))
5802 (defun gnus-articles-to-read (group &optional read-all)
5803 "Find out what articles the user wants to read."
5804 (let* ((only-read-p t)
5806 (gnus-list-range-difference
5807 ;; Select all articles if `read-all' is non-nil, or if there
5808 ;; are no unread articles.
5810 (and (zerop (length gnus-newsgroup-marked))
5811 (zerop (length gnus-newsgroup-unreads)))
5812 ;; Fetch all if the predicate is non-nil.
5813 gnus-newsgroup-display)
5814 ;; We want to select the headers for all the articles in
5815 ;; the group, so we select either all the active
5816 ;; articles in the group, or (if that's nil), the
5817 ;; articles in the cache.
5819 (if gnus-newsgroup-maximum-articles
5820 (let ((active (gnus-active group)))
5821 (gnus-uncompress-range
5822 (cons (max (car active)
5824 gnus-newsgroup-maximum-articles
5827 (gnus-uncompress-range (gnus-active group)))
5828 (gnus-cache-articles-in-group group))
5829 ;; Select only the "normal" subset of articles.
5830 (setq only-read-p nil)
5832 (gnus-sorted-union gnus-newsgroup-dormant gnus-newsgroup-marked)
5833 gnus-newsgroup-unreads))
5834 (cdr (assq 'unexist (gnus-info-marks (gnus-get-info group))))))
5835 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
5836 (scored (length scored-list))
5837 (number (length articles))
5838 (marked (+ (length gnus-newsgroup-marked)
5839 (length gnus-newsgroup-dormant)))
5844 ((numberp gnus-newsgroup-display)
5845 gnus-newsgroup-display)
5849 ((and (or (<= scored marked) (= scored number))
5850 (numberp gnus-large-newsgroup)
5851 (> number gnus-large-newsgroup))
5852 (let* ((cursor-in-echo-area nil)
5853 (initial (gnus-parameter-large-newsgroup-initial
5854 gnus-newsgroup-name))
5855 (default (if only-read-p
5856 (or initial gnus-large-newsgroup)
5862 "How many articles from %s (available %d, default %d): "
5863 (gnus-group-decoded-name
5864 (gnus-group-real-name gnus-newsgroup-name))
5867 "How many articles from %s (%d default): "
5868 (gnus-group-decoded-name
5869 (gnus-group-real-name gnus-newsgroup-name))
5873 (number-to-string default))))
5874 (if (string-match "^[ \t]*$" input) number input)))
5875 ((and (> scored marked) (< scored number)
5876 (> (- scored number) 20))
5879 (format "%s %s (%d scored, %d total): "
5880 "How many articles from"
5881 (gnus-group-decoded-name
5882 (gnus-group-real-name gnus-newsgroup-name))
5884 (if (string-match "^[ \t]*$" input)
5888 (message "Quit getting the articles to read")
5890 (setq select (if (stringp select) (string-to-number select) select))
5891 (if (or (null select) (zerop select))
5893 (if (and (not (zerop scored)) (<= (abs select) scored))
5895 (setq articles (sort scored-list '<))
5896 (setq number (length articles)))
5897 (setq articles (copy-sequence articles)))
5899 (when (< (abs select) number)
5901 ;; Select the N oldest articles.
5902 (setcdr (nthcdr (1- (abs select)) articles) nil)
5903 ;; Select the N most recent articles.
5904 (setq articles (nthcdr (- number select) articles))))
5905 (setq gnus-newsgroup-unselected
5906 (gnus-sorted-difference gnus-newsgroup-unreads articles))
5907 (when gnus-alter-articles-to-read-function
5910 (funcall gnus-alter-articles-to-read-function
5911 gnus-newsgroup-name articles)
5915 (defun gnus-killed-articles (killed articles)
5918 (when (inline (gnus-member-of-range (car articles) killed))
5919 (push (car articles) out))
5920 (setq articles (cdr articles)))
5923 (defun gnus-article-mark-to-type (mark)
5924 "Return the type of MARK."
5925 (or (cadr (assq mark gnus-article-special-mark-lists))
5928 (defun gnus-article-unpropagatable-p (mark)
5929 "Return whether MARK should be propagated to back end."
5930 (memq mark gnus-article-unpropagated-mark-lists))
5932 (defun gnus-adjust-marked-articles (info)
5933 "Set all article lists and remove all marks that are no longer valid."
5934 (let* ((marked-lists (gnus-info-marks info))
5935 (active (gnus-active (gnus-info-group info)))
5938 (types gnus-article-mark-lists)
5939 marks var articles article mark mark-type
5941 ;; Hack to avoid adjusting marks for imap.
5942 (when (eq (car (gnus-find-method-for-group (gnus-info-group info)))
5946 (dolist (marks marked-lists)
5947 (setq mark (car marks)
5948 mark-type (gnus-article-mark-to-type mark)
5949 var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
5950 ;; We set the variable according to the type of the marks list,
5951 ;; and then adjust the marks to a subset of the active articles.
5953 ;; Adjust "simple" lists - compressed yet unsorted
5954 ((eq mark-type 'list)
5955 ;; Simultaneously uncompress and clip to active range
5956 ;; See gnus-uncompress-range for a description of possible marks
5958 (if (not (cadr marks))
5960 (setq articles (if (numberp (cddr marks))
5966 (while (setq article (pop articles))
5967 (cond ((consp article)
5968 (setq bgn (max (car article) min)
5969 end (min (cdr article) max))
5971 (setq l (setcdr l (cons bgn nil))
5973 ((and (<= min article)
5975 (setq l (setcdr l (cons article nil))))))
5976 (set var (cdr lh)))))
5978 ((eq mark-type 'tuple)
5979 (set var (setq articles (cdr marks)))
5980 (when (not (listp (cdr (symbol-value var))))
5981 (set var (list (symbol-value var))))
5982 (when (not (listp (cdr articles)))
5983 (setq articles (list articles)))
5985 (when (or (not (consp (setq article (pop articles))))
5986 (< (car article) min)
5987 (> (car article) max))
5988 (set var (delq article (symbol-value var))))))
5989 ;; Adjust ranges (sloppily).
5990 ((eq mark-type 'range)
5993 ;; Fix the record for `seen' if it looks like (seen NUM1 . NUM2).
5994 ;; It should be (seen (NUM1 . NUM2)).
5995 (when (numberp (cddr marks))
5996 (setcdr marks (list (cdr marks))))
5997 (setq articles (cdr marks))
5998 (while (and articles
5999 (or (and (consp (car articles))
6000 (> min (cdar articles)))
6001 (and (numberp (car articles))
6002 (> min (car articles)))))
6006 (set var (cdr marks)))))))))
6008 (defun gnus-update-missing-marks (missing)
6009 "Go through the list of MISSING articles and remove them from the mark lists."
6012 ;; Go through all types.
6013 (dolist (elem gnus-article-mark-lists)
6014 (when (eq (gnus-article-mark-to-type (cdr elem)) 'list)
6015 (setq var (intern (format "gnus-newsgroup-%s" (car elem))))
6016 (when (symbol-value var)
6017 ;; This list has articles. So we delete all missing
6018 ;; articles from it.
6021 (set var (delq (pop m) (symbol-value var))))))))))
6023 (defun gnus-update-marks ()
6024 "Enter the various lists of marked articles into the newsgroup info list."
6025 (let ((types gnus-article-mark-lists)
6026 (info (gnus-get-info gnus-newsgroup-name))
6027 type list newmarked symbol delta-marks)
6029 ;; Add all marks lists to the list of marks lists.
6030 (while (setq type (pop types))
6031 (setq list (symbol-value
6033 (intern (format "gnus-newsgroup-%s" (car type))))))
6036 ;; Get rid of the entries of the articles that have the
6038 (when (and (eq (cdr type) 'score)
6042 (prev (cons nil list))
6045 (if (or (not (consp (car arts)))
6046 (= (cdar arts) gnus-summary-default-score))
6047 (setcdr prev (cdr arts))
6049 (setq arts (cdr arts)))
6050 (setq list (cdr all)))))
6052 (when (eq (cdr type) 'seen)
6053 (setq list (gnus-range-add list gnus-newsgroup-unseen)))
6055 (when (eq (gnus-article-mark-to-type (cdr type)) 'list)
6056 (setq list (gnus-compress-sequence (set symbol (sort list '<)) t)))
6058 (when (and (gnus-check-backend-function
6059 'request-set-mark gnus-newsgroup-name)
6060 (not (gnus-article-unpropagatable-p (cdr type))))
6061 (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
6062 ;; Don't do anything about marks for articles we
6063 ;; didn't actually get any headers for.
6065 (gnus-list-range-intersection
6066 gnus-newsgroup-articles
6067 (gnus-remove-from-range (gnus-copy-sequence old) list)))
6069 (gnus-list-range-intersection
6070 gnus-newsgroup-articles
6071 (gnus-remove-from-range
6072 (gnus-copy-sequence list) old))))
6074 (push (list add 'add (list (cdr type))) delta-marks))
6076 ;; Don't delete marks from outside the active range.
6077 ;; This shouldn't happen, but is a sanity check.
6078 (setq del (gnus-sorted-range-intersection
6079 (gnus-active gnus-newsgroup-name) del))
6080 (push (list del 'del (list (cdr type))) delta-marks))))
6083 (eq (cdr type) 'unexist))
6084 (push (cons (cdr type) list) newmarked)))
6087 (unless (gnus-check-group gnus-newsgroup-name)
6088 (error "Can't open server for %s" gnus-newsgroup-name))
6089 (gnus-request-set-mark gnus-newsgroup-name delta-marks))
6091 ;; Enter these new marks into the info of the group.
6093 (setcar (nthcdr 3 info) newmarked)
6094 ;; Add the marks lists to the end of the info.
6096 (setcdr (nthcdr 2 info) (list newmarked))))
6098 ;; Cut off the end of the info if there's nothing else there.
6102 (when (nthcdr (decf i) info)
6103 (setcdr (nthcdr i info) nil)))))))
6105 (defun gnus-set-mode-line (where)
6106 "Set the mode line of the article or summary buffers.
6107 If WHERE is `summary', the summary mode line format will be used."
6108 ;; Is this mode line one we keep updated?
6109 (when (and (memq where gnus-updated-mode-lines)
6111 (intern (format "gnus-%s-mode-line-format-spec" where))))
6113 ;; We evaluate this in the summary buffer since these
6114 ;; variables are buffer-local to that buffer.
6115 (with-current-buffer gnus-summary-buffer
6116 ;; We bind all these variables that are used in the `eval' form
6118 (let* ((mformat (symbol-value
6120 (format "gnus-%s-mode-line-format-spec" where))))
6121 (gnus-tmp-group-name (gnus-mode-string-quote
6122 (gnus-group-decoded-name
6123 gnus-newsgroup-name)))
6124 (gnus-tmp-article-number (or gnus-current-article 0))
6125 (gnus-tmp-unread gnus-newsgroup-unreads)
6126 (gnus-tmp-unread-and-unticked (length gnus-newsgroup-unreads))
6127 (gnus-tmp-unselected (length gnus-newsgroup-unselected))
6128 (gnus-tmp-unread-and-unselected
6129 (cond ((and (zerop gnus-tmp-unread-and-unticked)
6130 (zerop gnus-tmp-unselected))
6132 ((zerop gnus-tmp-unselected)
6133 (format "{%d more}" gnus-tmp-unread-and-unticked))
6134 (t (format "{%d(+%d) more}"
6135 gnus-tmp-unread-and-unticked
6136 gnus-tmp-unselected))))
6138 (if (and gnus-current-headers
6139 (vectorp gnus-current-headers))
6140 (gnus-mode-string-quote
6141 (mail-header-subject gnus-current-headers))
6143 bufname-length max-len
6144 gnus-tmp-header) ;; passed as argument to any user-format-funcs
6145 (setq mode-string (eval mformat))
6146 (setq bufname-length (if (string-match "%b" mode-string)
6149 (if (eq where 'summary)
6151 (get-buffer gnus-article-buffer))))
6154 (setq max-len (max 4 (if gnus-mode-non-string-length
6156 gnus-mode-non-string-length
6158 (length mode-string))))
6159 ;; We might have to chop a bit of the string off...
6160 (when (> (length mode-string) max-len)
6162 (concat (truncate-string-to-width mode-string (- max-len 3))
6164 ;; Update the mode line.
6165 (setq mode-line-buffer-identification
6166 (gnus-mode-line-buffer-identification (list mode-string)))
6167 (set-buffer-modified-p t))))
6169 (defun gnus-create-xref-hashtb (from-newsgroup headers unreads)
6170 "Go through the HEADERS list and add all Xrefs to a hash table.
6171 The resulting hash table is returned, or nil if no Xrefs were found."
6172 (let* ((virtual (gnus-virtual-group-p from-newsgroup))
6173 (prefix (if virtual "" (gnus-group-real-prefix from-newsgroup)))
6174 (xref-hashtb (gnus-make-hashtable))
6175 start group entry number xrefs header)
6177 (setq header (pop headers))
6178 (when (and (setq xrefs (mail-header-xref header))
6179 (not (memq (setq number (mail-header-number header))
6182 (while (string-match "\\([^ ]+\\)[:/]\\([0-9]+\\)" xrefs start)
6183 (setq start (match-end 0))
6184 (setq group (if prefix
6185 (concat prefix (substring xrefs (match-beginning 1)
6187 (substring xrefs (match-beginning 1) (match-end 1))))
6189 (string-to-number (substring xrefs (match-beginning 2)
6191 (if (setq entry (gnus-gethash group xref-hashtb))
6192 (setcdr entry (cons number (cdr entry)))
6193 (gnus-sethash group (cons number nil) xref-hashtb)))))
6194 (and start xref-hashtb)))
6196 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
6197 "Look through all the headers and mark the Xrefs as read."
6198 (let ((virtual (gnus-virtual-group-p from-newsgroup))
6199 name info xref-hashtb idlist method nth4)
6200 (with-current-buffer gnus-group-buffer
6201 (when (setq xref-hashtb
6202 (gnus-create-xref-hashtb from-newsgroup headers unreads))
6205 (unless (string= from-newsgroup (setq name (symbol-name group)))
6206 (setq idlist (symbol-value group))
6207 ;; Dead groups are not updated.
6209 (setq info (gnus-get-info name))
6210 (when (stringp (setq nth4 (gnus-info-method info)))
6211 (setq nth4 (gnus-server-to-method nth4))))
6212 ;; Only do the xrefs if the group has the same
6213 ;; select method as the group we have just read.
6214 (or (gnus-methods-equal-p
6215 nth4 (gnus-find-method-for-group from-newsgroup))
6217 (equal nth4 (setq method (gnus-find-method-for-group
6219 (and (equal (car nth4) (car method))
6220 (equal (nth 1 nth4) (nth 1 method))))
6221 gnus-use-cross-reference
6222 (or (not (eq gnus-use-cross-reference t))
6224 ;; Only do cross-references on subscribed
6225 ;; groups, if that is what is wanted.
6226 (<= (gnus-info-level info) gnus-level-subscribed))
6227 (gnus-group-make-articles-read name idlist))))
6230 (defun gnus-compute-read-articles (group articles)
6231 (let* ((entry (gnus-group-entry group))
6232 (info (nth 2 entry))
6233 (active (gnus-active group))
6236 ;; First peel off all invalid article numbers.
6238 (let ((ids articles)
6240 (while (setq id (pop ids))
6241 (when (and first (> id (cdr active)))
6242 ;; We'll end up in this situation in one particular
6243 ;; obscure situation. If you re-scan a group and get
6244 ;; a new article that is cross-posted to a different
6245 ;; group that has not been re-scanned, you might get
6246 ;; crossposted article that has a higher number than
6247 ;; Gnus believes possible. So we re-activate this
6248 ;; group as well. This might mean doing the
6249 ;; crossposting thingy will *increase* the number
6250 ;; of articles in some groups. Tsk, tsk.
6251 (setq active (or (gnus-activate-group group) active)))
6252 (when (or (> id (cdr active))
6253 (< id (car active)))
6254 (setq articles (delq id articles))))))
6255 ;; If the read list is nil, we init it.
6257 (null (gnus-info-read info))
6259 (setq ninfo (cons 1 (1- (car active))))
6260 (setq ninfo (gnus-info-read info)))
6261 ;; Then we add the read articles to the range.
6263 ninfo (setq articles (sort articles '<))))))
6265 (defun gnus-group-make-articles-read (group articles)
6266 "Update the info of GROUP to say that ARTICLES are read."
6268 (entry (gnus-group-entry group))
6269 (info (nth 2 entry))
6270 (active (gnus-active group))
6272 (gnus-method-option-p
6273 (gnus-find-method-for-group group)
6277 ;; Group that Gnus doesn't know exists, but still allow the
6278 ;; backend to set marks.
6280 (gnus-request-set-mark
6281 group (list (list (gnus-compress-sequence (sort articles #'<))
6283 ;; Normal, subscribed groups.
6284 (setq range (gnus-compute-read-articles group articles))
6285 (with-current-buffer gnus-group-buffer
6288 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
6289 (gnus-info-set-read ',info ',(gnus-info-read info))
6290 (gnus-get-unread-articles-in-group ',info (gnus-active ,group))
6292 (gnus-request-set-mark
6293 ,group (list (list ',range 'del '(read)))))
6294 (gnus-group-update-group ,group t))))
6295 ;; Add the read articles to the range.
6296 (gnus-info-set-read info range)
6298 (gnus-request-set-mark group (list (list range 'add '(read)))))
6299 ;; Then we have to re-compute how many unread
6300 ;; articles there are in this group.
6304 (setq num (- (1+ (cdr active)) (car active))))
6305 ((not (listp (cdr range)))
6306 (setq num (- (cdr active) (- (1+ (cdr range))
6310 (if (numberp (car range))
6312 (setq num (+ num (- (1+ (cdar range)) (caar range)))))
6313 (setq range (cdr range)))
6314 (setq num (- (cdr active) num))))
6315 ;; Update the number of unread articles.
6317 ;; Update the group buffer.
6318 (unless (gnus-ephemeral-group-p group)
6319 (gnus-group-update-group group t))))))
6321 (defun gnus-get-newsgroup-headers (&optional dependencies force-new)
6322 (let ((cur nntp-server-buffer)
6325 (with-current-buffer gnus-summary-buffer
6326 gnus-newsgroup-dependencies)))
6327 headers id end ref number
6328 (mail-parse-charset gnus-newsgroup-charset)
6329 (mail-parse-ignored-charsets
6330 (save-current-buffer (condition-case nil
6331 (set-buffer gnus-summary-buffer)
6333 gnus-newsgroup-ignored-charsets)))
6334 (with-current-buffer nntp-server-buffer
6335 ;; Translate all TAB characters into SPACE characters.
6336 (subst-char-in-region (point-min) (point-max) ?\t ? t)
6337 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6338 (ietf-drums-unfold-fws)
6339 (gnus-run-hooks 'gnus-parse-headers-hook)
6340 (let ((case-fold-search t)
6341 in-reply-to header p lines chars)
6342 (goto-char (point-min))
6343 ;; Search to the beginning of the next header. Error messages
6344 ;; do not begin with 2 or 3.
6345 (while (re-search-forward "^[23][0-9]+ " nil t)
6348 ;; This implementation of this function, with nine
6349 ;; search-forwards instead of the one re-search-forward and
6350 ;; a case (which basically was the old function) is actually
6351 ;; about twice as fast, even though it looks messier. You
6352 ;; can't have everything, I guess. Speed and elegance
6353 ;; doesn't always go hand in hand.
6359 (setq number (read cur))
6362 (narrow-to-region (point)
6363 (or (and (search-forward "\n.\n" nil t)
6369 (if (search-forward "\nsubject:" nil t)
6370 (funcall gnus-decode-encoded-word-function
6371 (nnheader-header-value))
6376 (if (search-forward "\nfrom:" nil t)
6377 (funcall gnus-decode-encoded-address-function
6378 (nnheader-header-value))
6383 (if (search-forward "\ndate:" nil t)
6384 (nnheader-header-value) ""))
6388 (setq id (if (re-search-forward
6389 "^message-id: *\\(<[^\n\t> ]+>\\)" nil t)
6390 ;; We do it this way to make sure the Message-ID
6391 ;; is (somewhat) syntactically valid.
6392 (buffer-substring (match-beginning 1)
6394 ;; If there was no message-id, we just fake one
6395 ;; to make subsequent routines simpler.
6396 (nnheader-generate-fake-message-id number))))
6400 (if (search-forward "\nreferences:" nil t)
6404 (nnheader-header-value)
6409 (search-backward ">" end t)
6412 (search-backward "<" end t)
6414 ;; Get the references from the in-reply-to header if there
6415 ;; were no references and the in-reply-to header looks
6417 (if (and (search-forward "\nin-reply-to:" nil t)
6418 (setq in-reply-to (nnheader-header-value))
6419 (string-match "<[^>]+>" in-reply-to))
6421 (setq ref (substring in-reply-to (match-beginning 0)
6423 (while (string-match "<[^>]+>" in-reply-to (match-end 0))
6424 (setq ref2 (substring in-reply-to (match-beginning 0)
6426 (when (> (length ref2) (length ref))
6433 (if (search-forward "\nchars: " nil t)
6434 (if (numberp (setq chars (ignore-errors (read cur))))
6440 (if (search-forward "\nlines: " nil t)
6441 (if (numberp (setq lines (ignore-errors (read cur))))
6447 (and (search-forward "\nxref:" nil t)
6448 (nnheader-header-value)))
6450 (when gnus-extra-headers
6451 (let ((extra gnus-extra-headers)
6455 (when (search-forward
6456 (concat "\n" (symbol-name (car extra)) ":") nil t)
6457 (push (cons (car extra) (nnheader-header-value))
6461 (when (equal id ref)
6464 (when gnus-alter-header-function
6465 (funcall gnus-alter-header-function header)
6466 (setq id (mail-header-id header)
6467 ref (gnus-parent-id (mail-header-references header))))
6470 (gnus-dependencies-add-header
6471 header dependencies force-new))
6472 (push header headers))
6473 (goto-char (point-max))
6475 (nreverse headers)))))
6477 ;; Goes through the xover lines and returns a list of vectors
6478 (defun gnus-get-newsgroup-headers-xover (sequence &optional
6479 force-new dependencies
6480 group also-fetch-heads)
6481 "Parse the news overview data in the server buffer.
6482 Return a list of headers that match SEQUENCE (see
6483 `nntp-retrieve-headers')."
6484 ;; Get the Xref when the users reads the articles since most/some
6485 ;; NNTP servers do not include Xrefs when using XOVER.
6486 (setq gnus-article-internal-prepare-hook '(gnus-article-get-xrefs))
6487 (let ((mail-parse-charset gnus-newsgroup-charset)
6488 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets)
6489 (cur nntp-server-buffer)
6490 (dependencies (or dependencies gnus-newsgroup-dependencies))
6492 ((eq gnus-read-all-available-headers t)
6494 ((and (stringp gnus-read-all-available-headers)
6496 (string-match gnus-read-all-available-headers group))
6499 number headers header)
6500 (with-current-buffer nntp-server-buffer
6501 (subst-char-in-region (point-min) (point-max) ?\r ? t)
6502 ;; Allow the user to mangle the headers before parsing them.
6503 (gnus-run-hooks 'gnus-parse-headers-hook)
6504 (goto-char (point-min))
6505 (gnus-parse-without-error
6506 (while (and (or sequence allp)
6508 (setq number (read cur))
6510 (while (and sequence
6511 (< (car sequence) number))
6512 (setq sequence (cdr sequence))))
6515 (eq number (car sequence))))
6517 (setq sequence (cdr sequence))
6518 (setq header (inline
6519 (gnus-nov-parse-line
6520 number dependencies force-new)))))
6521 (push header headers))
6523 ;; A common bug in inn is that if you have posted an article and
6524 ;; then retrieves the active file, it will answer correctly --
6525 ;; the new article is included. However, a NOV entry for the
6526 ;; article may not have been generated yet, so this may fail.
6527 ;; We work around this problem by retrieving the last few
6528 ;; headers using HEAD.
6529 (if (or (not also-fetch-heads)
6531 ;; We (probably) got all the headers.
6533 (let ((gnus-nov-is-evil t))
6536 (when (eq (gnus-retrieve-headers sequence group) 'headers)
6537 (gnus-get-newsgroup-headers))))))))
6539 (defun gnus-article-get-xrefs ()
6540 "Fill in the Xref value in `gnus-current-headers', if necessary.
6541 This is meant to be called in `gnus-article-internal-prepare-hook'."
6542 (let ((headers (with-current-buffer gnus-summary-buffer
6543 gnus-current-headers)))
6544 (or (not gnus-use-cross-reference)
6546 (and (mail-header-xref headers)
6547 (not (string= (mail-header-xref headers) "")))
6548 (let ((case-fold-search t)
6551 (nnheader-narrow-to-headers)
6552 (goto-char (point-min))
6553 (when (or (and (not (eobp))
6554 (eq (downcase (char-after)) ?x)
6555 (looking-at "Xref:"))
6556 (search-forward "\nXref:" nil t))
6557 (goto-char (1+ (match-end 0)))
6558 (setq xref (buffer-substring (point) (point-at-eol)))
6559 (mail-header-set-xref headers xref)))))))
6561 (defun gnus-summary-insert-subject (id &optional old-header use-old-header)
6562 "Find article ID and insert the summary line for that article.
6563 OLD-HEADER can either be a header or a line number to insert
6564 the subject line on.
6565 If USE-OLD-HEADER is non-nil, then OLD-HEADER should be a header,
6566 and OLD-HEADER will be used when the summary line is inserted,
6567 too, instead of trying to fetch new headers."
6568 (let* ((line (and (numberp old-header) old-header))
6569 (old-header (and (vectorp old-header) old-header))
6570 (header (cond ((and old-header use-old-header)
6573 (gnus-number-to-header id))
6574 (gnus-number-to-header id))
6576 (gnus-read-header id))))
6577 (number (and (numberp id) id))
6580 ;; Rebuild the thread that this article is part of and go to the
6581 ;; article we have fetched.
6582 (when (and (not gnus-show-threads)
6585 (setq d (gnus-data-find (mail-header-number old-header))))
6586 (goto-char (gnus-data-pos d))
6592 (gnus-delete-line))))))
6593 ;; Remove list identifiers from subject.
6594 (let ((gnus-newsgroup-headers (list header)))
6595 (gnus-summary-remove-list-identifiers))
6597 (mail-header-set-number header (mail-header-number old-header)))
6598 (setq gnus-newsgroup-sparse
6599 (delq (setq number (mail-header-number header))
6600 gnus-newsgroup-sparse))
6601 (setq gnus-newsgroup-ancient (delq number gnus-newsgroup-ancient))
6602 (push number gnus-newsgroup-limit)
6603 (gnus-rebuild-thread (mail-header-id header) line)
6604 (gnus-summary-goto-subject number nil t))
6605 (when (and (numberp number)
6607 ;; We have to update the boundaries even if we can't fetch the
6608 ;; article if ID is a number -- so that the next `P' or `N'
6609 ;; command will fetch the previous (or next) article even
6610 ;; if the one we tried to fetch this time has been canceled.
6611 (unless (and gnus-newsgroup-end (< number gnus-newsgroup-end))
6612 (setq gnus-newsgroup-end number))
6613 (unless (and gnus-newsgroup-begin (> number gnus-newsgroup-begin))
6614 (setq gnus-newsgroup-begin number))
6615 (setq gnus-newsgroup-unselected
6616 (delq number gnus-newsgroup-unselected)))
6617 ;; Report back a success?
6618 (and header (mail-header-number header))))
6620 ;;; Process/prefix in the summary buffer
6622 (defun gnus-summary-work-articles (n)
6623 "Return a list of articles to be worked upon.
6624 The prefix argument, the list of process marked articles, and the
6625 current article will be taken into consideration."
6626 (with-current-buffer gnus-summary-buffer
6629 ;; A numerical prefix has been given.
6630 (setq n (prefix-numeric-value n))
6631 (let ((backward (< n 0))
6632 (n (abs (prefix-numeric-value n)))
6637 (push (setq article (gnus-summary-article-number))
6640 (gnus-summary-find-prev nil article)
6641 (gnus-summary-find-next nil article)))
6643 (nreverse articles)))
6644 ((and (gnus-region-active-p) (mark))
6645 (message "region active")
6646 ;; Work on the region between point and mark.
6647 (let ((max (max (point) (mark)))
6650 (goto-char (min (point) (mark)))
6653 (push (setq article (gnus-summary-article-number)) articles)
6654 (gnus-summary-find-next nil article)
6656 (nreverse articles))))
6657 (gnus-newsgroup-processable
6658 ;; There are process-marked articles present.
6659 ;; Save current state.
6660 (gnus-summary-save-process-mark)
6662 (reverse gnus-newsgroup-processable))
6664 ;; Just return the current article.
6665 (list (gnus-summary-article-number))))))
6667 (defmacro gnus-summary-iterate (arg &rest forms)
6668 "Iterate over the process/prefixed articles and do FORMS.
6669 ARG is the interactive prefix given to the command. FORMS will be
6670 executed with point over the summary line of the articles."
6671 (let ((articles (make-symbol "gnus-summary-iterate-articles")))
6672 `(let ((,articles (gnus-summary-work-articles ,arg)))
6674 (gnus-summary-goto-subject (car ,articles))
6678 (put 'gnus-summary-iterate 'lisp-indent-function 1)
6679 (put 'gnus-summary-iterate 'edebug-form-spec '(form body))
6681 (defun gnus-summary-save-process-mark ()
6682 "Push the current set of process marked articles on the stack."
6684 (push (copy-sequence gnus-newsgroup-processable)
6685 gnus-newsgroup-process-stack))
6687 (defun gnus-summary-kill-process-mark ()
6688 "Push the current set of process marked articles on the stack and unmark."
6690 (gnus-summary-save-process-mark)
6691 (gnus-summary-unmark-all-processable))
6693 (defun gnus-summary-yank-process-mark ()
6694 "Pop the last process mark state off the stack and restore it."
6696 (unless gnus-newsgroup-process-stack
6697 (error "Empty mark stack"))
6698 (gnus-summary-process-mark-set (pop gnus-newsgroup-process-stack)))
6700 (defun gnus-summary-process-mark-set (set)
6701 "Make SET into the current process marked articles."
6702 (gnus-summary-unmark-all-processable)
6703 (mapc 'gnus-summary-set-process-mark set))
6705 ;;; Searching and stuff
6707 (defun gnus-summary-search-group (&optional backward use-level)
6708 "Search for next unread newsgroup.
6709 If optional argument BACKWARD is non-nil, search backward instead."
6710 (with-current-buffer gnus-group-buffer
6711 (when (gnus-group-search-forward
6712 backward nil (if use-level (gnus-group-group-level) nil))
6713 (gnus-group-group-name))))
6715 (defun gnus-summary-best-group (&optional exclude-group)
6716 "Find the name of the best unread group.
6717 If EXCLUDE-GROUP, do not go to this group."
6718 (with-current-buffer gnus-group-buffer
6720 (gnus-group-best-unread-group exclude-group))))
6722 (defun gnus-summary-find-next (&optional unread article backward)
6724 (gnus-summary-find-prev unread article)
6725 (let* ((dummy (gnus-summary-article-intangible-p))
6726 (article (or article (gnus-summary-article-number)))
6727 (data (gnus-data-find-list article))
6729 (when (and (not dummy)
6730 (or (not gnus-summary-check-current)
6732 (not (gnus-data-unread-p (car data)))))
6733 (setq data (cdr data)))
6738 (unless (memq (gnus-data-number (car data))
6740 ((eq gnus-auto-goto-ignores
6741 'always-undownloaded)
6742 gnus-newsgroup-undownloaded)
6745 ((eq gnus-auto-goto-ignores
6747 gnus-newsgroup-unfetched)
6748 ((eq gnus-auto-goto-ignores
6750 gnus-newsgroup-undownloaded)))
6751 (when (gnus-data-unread-p (car data))
6752 (setq result (car data)
6754 (setq data (cdr data)))
6757 (goto-char (gnus-data-pos result))
6758 (gnus-data-number result)))))
6760 (defun gnus-summary-find-prev (&optional unread article)
6761 (let* ((eobp (eobp))
6762 (article (or article (gnus-summary-article-number)))
6763 (data (gnus-data-find-list article (gnus-data-list 'rev)))
6765 (when (and (not eobp)
6766 (or (not gnus-summary-check-current)
6768 (not (gnus-data-unread-p (car data)))))
6769 (setq data (cdr data)))
6774 (unless (memq (gnus-data-number (car data))
6776 ((eq gnus-auto-goto-ignores
6777 'always-undownloaded)
6778 gnus-newsgroup-undownloaded)
6781 ((eq gnus-auto-goto-ignores
6783 gnus-newsgroup-unfetched)
6784 ((eq gnus-auto-goto-ignores
6786 gnus-newsgroup-undownloaded)))
6787 (when (gnus-data-unread-p (car data))
6788 (setq result (car data)
6790 (setq data (cdr data)))
6793 (goto-char (gnus-data-pos result))
6794 (gnus-data-number result))))
6796 (defun gnus-summary-find-subject (subject &optional unread backward article)
6797 (let* ((simp-subject (gnus-simplify-subject-fully subject))
6798 (article (or article (gnus-summary-article-number)))
6799 (articles (gnus-data-list backward))
6800 (arts (gnus-data-find-list article articles))
6802 (when (or (not gnus-summary-check-current)
6804 (not (gnus-data-unread-p (car arts))))
6805 (setq arts (cdr arts)))
6807 (and (or (not unread)
6808 (gnus-data-unread-p (car arts)))
6809 (vectorp (gnus-data-header (car arts)))
6811 simp-subject (mail-header-subject (gnus-data-header (car arts))) t)
6812 (setq result (car arts)
6814 (setq arts (cdr arts)))
6816 (goto-char (gnus-data-pos result))
6817 (gnus-data-number result))))
6819 (defun gnus-summary-search-forward (&optional unread subject backward)
6820 "Search forward for an article.
6821 If UNREAD, look for unread articles. If SUBJECT, look for
6822 articles with that subject. If BACKWARD, search backward instead."
6823 (cond (subject (gnus-summary-find-subject subject unread backward))
6824 (backward (gnus-summary-find-prev unread))
6825 (t (gnus-summary-find-next unread))))
6827 (defun gnus-recenter (&optional n)
6828 "Center point in window and redisplay frame.
6829 Also do horizontal recentering."
6831 (when (and gnus-auto-center-summary
6832 (not (eq gnus-auto-center-summary 'vertical)))
6833 (gnus-horizontal-recenter))
6834 (if (fboundp 'recenter-top-bottom)
6835 (recenter-top-bottom n)
6838 (put 'gnus-recenter 'isearch-scroll t)
6840 (defun gnus-forward-line-ignore-invisible (n)
6841 "Move N lines forward (backward if N is negative).
6842 Like forward-line, but skip over (and don't count) invisible lines."
6844 (while (and (> n 0) (not done))
6845 ;; If the following character is currently invisible,
6846 ;; skip all characters with that same `invisible' property value.
6847 (while (gnus-invisible-p (point))
6848 (goto-char (gnus-next-char-property-change (point))))
6853 (while (and (< n 0) (not done))
6855 (if (bobp) (setq done t)
6857 (while (and (not (bobp)) (gnus-invisible-p (1- (point))))
6858 (goto-char (gnus-previous-char-property-change (point))))))))
6860 (defun gnus-summary-recenter ()
6861 "Center point in the summary window.
6862 If `gnus-auto-center-summary' is nil, or the article buffer isn't
6863 displayed, no centering will be performed."
6864 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
6865 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
6867 ;; The user has to want it.
6868 (when gnus-auto-center-summary
6869 (let* ((top (cond ((< (window-height) 4) 0)
6870 ((< (window-height) 7) 1)
6871 (t (if (numberp gnus-auto-center-summary)
6872 gnus-auto-center-summary
6873 (/ (1- (window-height)) 2)))))
6874 (height (1- (window-height)))
6875 (bottom (save-excursion
6876 (goto-char (point-max))
6877 (gnus-forward-line-ignore-invisible (- height))
6879 (window (get-buffer-window (current-buffer))))
6880 (when (get-buffer-window gnus-article-buffer)
6881 ;; Only do recentering when the article buffer is displayed,
6882 ;; Set the window start to either `bottom', which is the biggest
6883 ;; possible valid number, or the second line from the top,
6884 ;; whichever is the least.
6885 (let ((top-pos (save-excursion
6886 (gnus-forward-line-ignore-invisible (- top))
6888 (if (> bottom top-pos)
6889 ;; Keep the second line from the top visible
6890 (set-window-start window top-pos)
6891 ;; Try to keep the bottom line visible; if it's partially
6892 ;; obscured, either scroll one more line to make it fully
6893 ;; visible, or revert to using TOP-POS.
6895 (goto-char (point-max))
6896 (gnus-forward-line-ignore-invisible -1)
6897 (let ((last-line-start (point)))
6899 (set-window-start window (point) t)
6900 (when (not (pos-visible-in-window-p last-line-start window))
6901 (gnus-forward-line-ignore-invisible 1)
6902 (set-window-start window (min (point) top-pos) t)))))))
6903 ;; Do horizontal recentering while we're at it.
6904 (when (and (get-buffer-window (current-buffer) t)
6905 (not (eq gnus-auto-center-summary 'vertical)))
6906 (let ((selected (selected-window)))
6907 (select-window (get-buffer-window (current-buffer) t))
6908 (gnus-summary-position-point)
6909 (gnus-horizontal-recenter)
6910 (select-window selected))))))
6912 (defun gnus-summary-jump-to-group (newsgroup)
6913 "Move point to NEWSGROUP in group mode buffer."
6914 ;; Keep update point of group mode buffer if visible.
6915 (if (eq (current-buffer) (get-buffer gnus-group-buffer))
6916 (save-window-excursion
6917 ;; Take care of tree window mode.
6918 (when (get-buffer-window gnus-group-buffer)
6919 (pop-to-buffer gnus-group-buffer))
6920 (gnus-group-jump-to-group newsgroup))
6922 ;; Take care of tree window mode.
6923 (if (get-buffer-window gnus-group-buffer 0)
6924 (pop-to-buffer gnus-group-buffer)
6925 (set-buffer gnus-group-buffer))
6926 (gnus-group-jump-to-group newsgroup))))
6928 ;; This function returns a list of article numbers based on the
6929 ;; difference between the ranges of read articles in this group and
6930 ;; the range of active articles.
6931 (defun gnus-list-of-unread-articles (group)
6932 (let* ((read (gnus-info-read (gnus-get-info group)))
6933 (active (or (gnus-active group) (gnus-activate-group group)))
6934 (last (or (cdr active)
6935 (error "Group %s couldn't be activated " group)))
6936 (bottom (if gnus-newsgroup-maximum-articles
6938 (- last gnus-newsgroup-maximum-articles -1))
6941 ;; If none are read, then all are unread.
6944 ;; If the range of read articles is a single range, then the
6945 ;; first unread article is the article after the last read
6946 ;; article. Sounds logical, doesn't it?
6947 (if (and (not (listp (cdr read)))
6948 (or (< (car read) bottom)
6949 (progn (setq read (list read))
6951 (setq first (max bottom (1+ (cdr read))))
6952 ;; `read' is a list of ranges.
6953 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
6956 (setq first bottom))
6959 (while (< first nlast)
6960 (setq unread (cons first unread)
6962 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
6963 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
6964 (setq read (cdr read)))))
6965 ;; And add the last unread articles.
6966 (while (<= first last)
6967 (setq unread (cons first unread)
6969 ;; Return the list of unread articles.
6970 (delq 0 (nreverse unread))))
6972 (defun gnus-list-of-read-articles (group)
6973 "Return a list of unread, unticked and non-dormant articles."
6974 (let* ((info (gnus-get-info group))
6975 (marked (gnus-info-marks info))
6976 (active (gnus-active group)))
6978 (gnus-list-range-difference
6979 (gnus-list-range-difference
6980 (gnus-sorted-complement
6981 (gnus-uncompress-range
6982 (if gnus-newsgroup-maximum-articles
6983 (cons (max (car active)
6985 gnus-newsgroup-maximum-articles
6989 (gnus-list-of-unread-articles group))
6990 (cdr (assq 'dormant marked)))
6991 (cdr (assq 'tick marked))))))
6993 ;; This function returns a sequence of article numbers based on the
6994 ;; difference between the ranges of read articles in this group and
6995 ;; the range of active articles.
6996 (defun gnus-sequence-of-unread-articles (group)
6997 (let* ((read (gnus-info-read (gnus-get-info group)))
6998 (active (or (gnus-active group) (gnus-activate-group group)))
7000 (bottom (if gnus-newsgroup-maximum-articles
7002 (- last gnus-newsgroup-maximum-articles -1))
7005 ;; If none are read, then all are unread.
7008 ;; If the range of read articles is a single range, then the
7009 ;; first unread article is the article after the last read
7010 ;; article. Sounds logical, doesn't it?
7011 (if (and (not (listp (cdr read)))
7012 (or (< (car read) bottom)
7013 (progn (setq read (list read))
7015 (setq first (max bottom (1+ (cdr read))))
7016 ;; `read' is a list of ranges.
7017 (when (/= (setq nlast (or (and (numberp (car read)) (car read))
7020 (setq first bottom))
7023 (push (cons first nlast) unread))
7024 (setq first (1+ (if (atom (car read)) (car read) (cdar read))))
7025 (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
7026 (setq read (cdr read)))))
7027 ;; And add the last unread articles.
7028 (cond ((not (and first last))
7031 (push (cons first last) unread))
7033 (push first unread)))
7034 ;; Return the sequence of unread articles.
7035 (delq 0 (nreverse unread))))
7037 ;; Various summary commands
7039 (defun gnus-summary-select-article-buffer ()
7040 "Reconfigure windows to show the article buffer.
7041 If `gnus-widen-article-window' is set, show only the article
7044 (if (not (gnus-buffer-live-p gnus-article-buffer))
7045 (error "There is no article buffer for this summary buffer")
7046 (unless (get-buffer-window gnus-article-buffer)
7047 (gnus-summary-show-article))
7048 (gnus-configure-windows
7049 (if gnus-widen-article-window
7053 (select-window (get-buffer-window gnus-article-buffer))))
7055 (defun gnus-summary-universal-argument (arg)
7056 "Perform any operation on all articles that are process/prefixed."
7058 (let ((articles (gnus-summary-work-articles arg))
7065 (substitute-command-keys
7066 "\\<gnus-summary-mode-map>\\[gnus-summary-universal-argument]"))))
7068 (gnus-error 1 "Undefined key")
7071 (gnus-summary-goto-subject (setq article (pop articles)))
7072 (let (gnus-newsgroup-processable)
7073 (command-execute func))
7074 (gnus-summary-remove-process-mark article)))))
7075 (gnus-summary-position-point))
7077 (defun gnus-summary-toggle-truncation (&optional arg)
7078 "Toggle truncation of summary lines.
7079 With ARG, turn line truncation on if ARG is positive."
7081 (setq truncate-lines
7082 (if (null arg) (not truncate-lines)
7083 (> (prefix-numeric-value arg) 0)))
7086 (defun gnus-summary-find-for-reselect ()
7087 "Return the number of an article to stay on across a reselect.
7088 The current article is considered, then following articles, then previous
7089 articles. An article is sought which is not canceled and isn't a temporary
7090 insertion from another group. If there's no such then return a dummy 0."
7092 (dolist (rev '(nil t))
7093 (unless found ; don't demand the reverse list if we don't need it
7094 (let ((data (gnus-data-find-list
7095 (gnus-summary-article-number) (gnus-data-list rev))))
7096 (while (and data (not found))
7097 (if (and (< 0 (gnus-data-number (car data)))
7098 (not (eq gnus-canceled-mark (gnus-data-mark (car data)))))
7099 (setq found (gnus-data-number (car data))))
7100 (setq data (cdr data))))))
7103 (defun gnus-summary-reselect-current-group (&optional all rescan)
7104 "Exit and then reselect the current newsgroup.
7105 The prefix argument ALL means to select all articles."
7107 (when (gnus-ephemeral-group-p gnus-newsgroup-name)
7108 (error "Ephemeral groups can't be reselected"))
7109 (let ((current-subject (gnus-summary-find-for-reselect))
7110 (group gnus-newsgroup-name))
7111 (setq gnus-newsgroup-begin nil)
7112 (gnus-summary-exit nil 'leave-hidden)
7113 ;; We have to adjust the point of group mode buffer because
7114 ;; point was moved to the next unread newsgroup by exiting.
7115 (gnus-summary-jump-to-group group)
7118 (gnus-group-get-new-news-this-group 1)))
7119 (gnus-group-read-group all t)
7120 (gnus-summary-goto-subject current-subject nil t)))
7122 (defun gnus-summary-rescan-group (&optional all)
7123 "Exit the newsgroup, ask for new articles, and select the newsgroup."
7125 (let ((config gnus-current-window-configuration))
7126 (gnus-summary-reselect-current-group all t)
7127 (gnus-configure-windows config)
7128 (when (eq config 'article)
7129 (gnus-summary-select-article))))
7131 (defun gnus-summary-update-info (&optional non-destructive)
7133 (let ((group gnus-newsgroup-name))
7135 (when gnus-newsgroup-kill-headers
7136 (setq gnus-newsgroup-killed
7137 (gnus-compress-sequence
7139 (gnus-list-range-intersection
7140 gnus-newsgroup-unselected gnus-newsgroup-killed)
7141 gnus-newsgroup-unreads)
7143 (unless (listp (cdr gnus-newsgroup-killed))
7144 (setq gnus-newsgroup-killed (list gnus-newsgroup-killed)))
7145 (let ((headers gnus-newsgroup-headers)
7146 (ephemeral-p (gnus-ephemeral-group-p group))
7149 (setq info (copy-sequence (gnus-get-info group))
7150 info (delq (gnus-info-params info) info)))
7151 ;; Set the new ranges of read articles.
7152 (with-current-buffer gnus-group-buffer
7153 (gnus-undo-force-boundary))
7154 (gnus-update-read-articles
7155 group (gnus-sorted-union
7156 gnus-newsgroup-unreads gnus-newsgroup-unselected))
7157 ;; Set the current article marks.
7158 (let ((gnus-newsgroup-scored
7159 (if (and (not gnus-save-score)
7160 (not non-destructive))
7162 gnus-newsgroup-scored)))
7164 (gnus-update-marks)))
7165 ;; Do the cross-ref thing.
7166 (when gnus-use-cross-reference
7167 (gnus-mark-xrefs-as-read group headers gnus-newsgroup-unreads))
7168 ;; Do not switch windows but change the buffer to work.
7169 (set-buffer gnus-group-buffer)
7171 (gnus-group-update-group
7174 (setq info (copy-sequence (gnus-get-info group))
7175 info (delq (gnus-info-params info) info))))))))))
7177 (defun gnus-summary-save-newsrc (&optional force)
7178 "Save the current number of read/marked articles in the dribble buffer.
7179 The dribble buffer will then be saved.
7180 If FORCE (the prefix), also save the .newsrc file(s)."
7182 (gnus-summary-update-info t)
7184 (gnus-save-newsrc-file)
7185 (gnus-dribble-save)))
7187 (declare-function gnus-cache-write-active "gnus-cache" (&optional force))
7189 (defun gnus-summary-exit (&optional temporary leave-hidden)
7190 "Exit reading current newsgroup, and then return to group selection mode.
7191 `gnus-exit-group-hook' is called with no arguments if that value is non-nil."
7193 (gnus-set-global-variables)
7194 (when (gnus-buffer-live-p gnus-article-buffer)
7195 (with-current-buffer gnus-article-buffer
7196 (mm-destroy-parts gnus-article-mime-handles)
7197 ;; Set it to nil for safety reason.
7198 (setq gnus-article-mime-handle-alist nil)
7199 (setq gnus-article-mime-handles nil)))
7200 (gnus-kill-save-kill-buffer)
7201 (gnus-async-halt-prefetch)
7202 (let* ((group gnus-newsgroup-name)
7203 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
7204 (gnus-group-is-exiting-p t)
7205 (article-buffer gnus-article-buffer)
7206 (original-article-buffer gnus-original-article-buffer)
7209 (buf (current-buffer))
7210 ;; `gnus-single-article-buffer' is nil buffer-locally in
7211 ;; ephemeral group of which summary buffer will be killed,
7212 ;; but the global value may be non-nil.
7213 (single-article-buffer gnus-single-article-buffer))
7215 ;; Do adaptive scoring, and possibly save score files.
7216 (when gnus-newsgroup-adaptive
7217 (gnus-score-adaptive))
7218 (when gnus-use-scoring
7220 (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
7221 (when gnus-use-cache
7222 (gnus-cache-possibly-remove-articles)
7223 (gnus-cache-save-buffers))
7224 (gnus-async-prefetch-remove-group group)
7225 (when gnus-suppress-duplicates
7226 (gnus-dup-enter-articles))
7227 (when gnus-use-trees
7228 (gnus-tree-close group))
7229 (when gnus-use-cache
7230 (gnus-cache-write-active))
7231 ;; Remove entries for this group.
7232 (nnmail-purge-split-history (gnus-group-real-name group))
7233 ;; Make all changes in this group permanent.
7235 (gnus-run-hooks 'gnus-exit-group-hook)
7236 (gnus-summary-update-info))
7237 (gnus-close-group group)
7238 ;; Make sure where we were, and go to next newsgroup.
7239 (when (buffer-live-p (get-buffer gnus-group-buffer))
7240 (set-buffer gnus-group-buffer))
7242 (gnus-group-jump-to-group group))
7243 (gnus-run-hooks 'gnus-summary-exit-hook)
7244 (unless (or quit-config
7245 (not gnus-summary-next-group-on-exit)
7246 ;; If this group has disappeared from the summary
7247 ;; buffer, don't skip forwards.
7248 (not (string= group (gnus-group-group-name))))
7249 (gnus-group-next-unread-group 1))
7250 (setq group-point (point))
7254 (if (not gnus-kill-summary-on-exit)
7256 (gnus-deaden-summary)
7258 (when (get-buffer gnus-article-buffer)
7259 (bury-buffer gnus-article-buffer))
7260 ;; Return to group mode buffer.
7261 (when (eq mode 'gnus-summary-mode)
7262 (gnus-kill-buffer buf)))
7264 (setq gnus-current-select-method gnus-select-method)
7265 (when (gnus-buffer-live-p gnus-group-buffer)
7266 (set-buffer gnus-group-buffer))
7268 (gnus-handle-ephemeral-exit quit-config)
7269 (goto-char group-point)
7270 ;; If gnus-group-buffer is already displayed, make sure we also move
7271 ;; the cursor in the window that displays it.
7272 (let ((win (get-buffer-window (current-buffer) 0)))
7273 (if win (set-window-point win (point))))
7274 (unless leave-hidden
7275 (gnus-configure-windows 'group 'force)))
7277 ;; If we have several article buffers, we kill them at exit.
7278 (unless single-article-buffer
7279 (when (gnus-buffer-live-p article-buffer)
7280 (with-current-buffer article-buffer
7281 ;; Don't kill sticky article buffers
7282 (unless (eq major-mode 'gnus-sticky-article-mode)
7283 (gnus-kill-buffer article-buffer)
7284 (setq gnus-article-current nil))))
7285 (gnus-kill-buffer original-article-buffer))
7287 ;; Clear the current group name.
7289 (setq gnus-newsgroup-name nil)))))
7291 (declare-function gnus-article-stop-animations "gnus-art" ())
7292 (declare-function gnus-stop-downloads "gnus-art" ())
7294 (defalias 'gnus-summary-quit 'gnus-summary-exit-no-update)
7295 (defun gnus-summary-exit-no-update (&optional no-questions)
7296 "Quit reading current newsgroup without updating read article info."
7298 (let* ((group gnus-newsgroup-name)
7299 (gnus-group-is-exiting-p t)
7300 (gnus-group-is-exiting-without-update-p t)
7301 (quit-config (gnus-group-quit-config group)))
7302 (when (or no-questions
7304 (gnus-y-or-n-p "Discard changes to this group and exit? "))
7305 (gnus-async-halt-prefetch)
7306 (run-hooks 'gnus-summary-prepare-exit-hook)
7307 (when (gnus-buffer-live-p gnus-article-buffer)
7308 (with-current-buffer gnus-article-buffer
7309 (gnus-article-stop-animations)
7310 (gnus-stop-downloads)
7311 (mm-destroy-parts gnus-article-mime-handles)
7312 ;; Set it to nil for safety reason.
7313 (setq gnus-article-mime-handle-alist nil)
7314 (setq gnus-article-mime-handles nil)))
7315 ;; If we have several article buffers, we kill them at exit.
7316 (unless gnus-single-article-buffer
7317 (gnus-kill-buffer gnus-article-buffer)
7318 (gnus-kill-buffer gnus-original-article-buffer)
7319 (setq gnus-article-current nil))
7320 ;; Return to the group buffer.
7321 (if (not gnus-kill-summary-on-exit)
7323 (gnus-deaden-summary)
7324 (gnus-configure-windows 'group 'force))
7325 (gnus-configure-windows 'group 'force)
7326 (gnus-close-group group)
7327 (gnus-kill-buffer gnus-summary-buffer))
7328 (unless gnus-single-article-buffer
7329 (setq gnus-article-current nil))
7330 (when gnus-use-trees
7331 (gnus-tree-close group))
7332 (gnus-async-prefetch-remove-group group)
7333 (when (get-buffer gnus-article-buffer)
7334 (bury-buffer gnus-article-buffer))
7335 ;; Clear the current group name.
7336 (setq gnus-newsgroup-name nil)
7337 (unless (gnus-ephemeral-group-p group)
7338 (gnus-group-update-group group nil t))
7339 (when (equal (gnus-group-group-name) group)
7340 (gnus-group-next-unread-group 1))
7342 (gnus-handle-ephemeral-exit quit-config)))))
7344 (defun gnus-handle-ephemeral-exit (quit-config)
7345 "Handle movement when leaving an ephemeral group.
7346 The state which existed when entering the ephemeral is reset."
7347 (if (not (buffer-live-p (car quit-config)))
7348 (when (gnus-buffer-live-p gnus-group-buffer)
7349 (gnus-configure-windows 'group 'force))
7350 (set-buffer (car quit-config))
7351 (unless (eq (cdr quit-config) 'group)
7352 (setq gnus-current-select-method
7353 (gnus-find-method-for-group gnus-newsgroup-name)))
7354 (cond ((eq major-mode 'gnus-summary-mode)
7355 (gnus-set-global-variables))
7356 ((eq major-mode 'gnus-article-mode)
7357 (save-current-buffer
7358 ;; The `gnus-summary-buffer' variable may point
7359 ;; to the old summary buffer when using a single
7361 (unless (gnus-buffer-live-p gnus-summary-buffer)
7362 (set-buffer gnus-group-buffer))
7363 (set-buffer gnus-summary-buffer)
7364 (gnus-set-global-variables))))
7365 (if (or (eq (cdr quit-config) 'article)
7366 (eq (cdr quit-config) 'pick))
7367 (if (and (boundp 'gnus-pick-mode) (symbol-value 'gnus-pick-mode))
7368 (gnus-configure-windows 'pick 'force)
7369 (gnus-configure-windows (cdr quit-config) 'force))
7370 (gnus-configure-windows (cdr quit-config) 'force))
7371 (when (eq major-mode 'gnus-summary-mode)
7372 (if (memq gnus-auto-select-on-ephemeral-exit '(next-noselect
7373 next-unread-noselect))
7374 (when (zerop (cond ((eq gnus-auto-select-on-ephemeral-exit
7376 (gnus-summary-next-subject 1 nil t))
7377 ((eq gnus-auto-select-on-ephemeral-exit
7378 'next-unread-noselect)
7379 (gnus-summary-next-subject 1 t t))))
7380 ;; Hide the article buffer which displays the article different
7381 ;; from the one that the cursor points to in the summary buffer.
7382 (gnus-configure-windows 'summary 'force))
7383 (cond ((eq gnus-auto-select-on-ephemeral-exit 'next)
7384 (gnus-summary-next-subject 1))
7385 ((eq gnus-auto-select-on-ephemeral-exit 'next-unread)
7386 (gnus-summary-next-subject 1 t))))
7387 (gnus-summary-recenter)
7388 (gnus-summary-position-point))))
7392 (defvar gnus-dead-summary-mode-map
7393 (let ((map (make-keymap)))
7394 (suppress-keymap map)
7395 (substitute-key-definition 'undefined 'gnus-summary-wake-up-the-dead map)
7396 (dolist (key '("\C-d" "\r" "\177" [delete]))
7397 (define-key map key 'gnus-summary-wake-up-the-dead))
7398 (dolist (key '("q" "Q"))
7399 (define-key map key 'bury-buffer))
7402 (define-minor-mode gnus-dead-summary-mode
7403 "Minor mode for Gnus summary buffers."
7404 :lighter " Dead" :keymap gnus-dead-summary-mode-map
7405 (unless (derived-mode-p 'gnus-summary-mode)
7406 (setq gnus-dead-summary-mode nil)))
7408 (defun gnus-deaden-summary ()
7409 "Make the current summary buffer into a dead summary buffer."
7410 ;; Kill any previous dead summary buffer.
7411 (when (and gnus-dead-summary
7412 (buffer-name gnus-dead-summary))
7413 (with-current-buffer gnus-dead-summary
7414 (when gnus-dead-summary-mode
7415 (kill-buffer (current-buffer)))))
7416 ;; Make this the current dead summary.
7417 (setq gnus-dead-summary (current-buffer))
7418 (gnus-dead-summary-mode 1)
7419 (let ((name (buffer-name)))
7420 (when (string-match "Summary" name)
7422 (concat (substring name 0 (match-beginning 0)) "Dead "
7423 (substring name (match-beginning 0)))
7427 (defun gnus-kill-or-deaden-summary (buffer)
7428 "Kill or deaden the summary BUFFER."
7430 (when (and (buffer-name buffer)
7431 (not gnus-single-article-buffer))
7432 (with-current-buffer buffer
7433 (gnus-kill-buffer gnus-article-buffer)
7434 (gnus-kill-buffer gnus-original-article-buffer)))
7437 (gnus-kill-summary-on-exit
7438 (when (and gnus-use-trees
7439 (gnus-buffer-exists-p buffer))
7440 (with-current-buffer buffer
7441 (gnus-tree-close gnus-newsgroup-name)))
7442 (gnus-kill-buffer buffer))
7443 ;; Deaden the buffer.
7444 ((gnus-buffer-exists-p buffer)
7445 (with-current-buffer buffer
7446 (gnus-deaden-summary))))))
7448 (defun gnus-summary-wake-up-the-dead (&rest args)
7449 "Wake up the dead summary buffer."
7451 (gnus-dead-summary-mode -1)
7452 (let ((name (buffer-name)))
7453 (when (string-match "Dead " name)
7455 (concat (substring name 0 (match-beginning 0))
7456 (substring name (match-end 0)))
7458 (gnus-message 3 "This dead summary is now alive again"))
7460 ;; Suggested by Per Abrahamsen <amanda@iesd.auc.dk>.
7461 (defun gnus-summary-describe-group (&optional force)
7462 "Describe the current newsgroup."
7464 (gnus-group-describe-group force gnus-newsgroup-name))
7466 (defun gnus-summary-describe-briefly ()
7467 "Describe summary mode commands briefly."
7469 (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")))
7471 ;; Walking around group mode buffer from summary mode.
7473 (defun gnus-summary-next-group (&optional no-article target-group backward)
7474 "Exit current newsgroup and then select next unread newsgroup.
7475 If prefix argument NO-ARTICLE is non-nil, no article is selected
7476 initially. If TARGET-GROUP, go to this group. If BACKWARD, go to
7477 previous group instead."
7479 ;; Stop pre-fetching.
7480 (gnus-async-halt-prefetch)
7481 (let ((current-group gnus-newsgroup-name)
7482 (current-buffer (current-buffer))
7484 ;; First we semi-exit this group to update Xrefs and all variables.
7485 ;; We can't do a real exit, because the window conf must remain
7486 ;; the same in case the user is prompted for info, and we don't
7487 ;; want the window conf to change before that...
7488 (gnus-summary-exit t)
7489 (while (not entered)
7490 ;; Then we find what group we are supposed to enter.
7491 (set-buffer gnus-group-buffer)
7492 (gnus-group-jump-to-group current-group)
7495 (if (eq gnus-keep-same-level 'best)
7496 (gnus-summary-best-group gnus-newsgroup-name)
7497 (gnus-summary-search-group backward gnus-keep-same-level))))
7498 (if (not target-group)
7499 ;; There are no further groups, so we return to the group
7502 (gnus-message 5 "Returning to the group buffer")
7504 (when (gnus-buffer-live-p current-buffer)
7505 (set-buffer current-buffer)
7506 (gnus-summary-exit))
7507 (gnus-run-hooks 'gnus-group-no-more-groups-hook))
7508 ;; We try to enter the target group.
7509 (gnus-group-jump-to-group target-group)
7510 (let ((unreads (gnus-group-group-unread)))
7511 (if (and (or (eq t unreads)
7512 (and unreads (not (zerop unreads))))
7513 (gnus-summary-read-group
7514 target-group nil no-article
7515 (and (buffer-name current-buffer) current-buffer)
7518 (setq current-group target-group
7519 target-group nil)))))))
7521 (defun gnus-summary-prev-group (&optional no-article)
7522 "Exit current newsgroup and then select previous unread newsgroup.
7523 If prefix argument NO-ARTICLE is non-nil, no article is selected initially."
7525 (gnus-summary-next-group no-article nil t))
7527 ;; Walking around summary lines.
7529 (defun gnus-summary-first-subject (&optional unread undownloaded unseen)
7530 "Go to the first subject satisfying any non-nil constraint.
7531 If UNREAD is non-nil, the article should be unread.
7532 If UNDOWNLOADED is non-nil, the article should be undownloaded.
7533 If UNSEEN is non-nil, the article should be unseen as well as unread.
7534 Returns the article selected or nil if there are no matching articles."
7538 ((null gnus-newsgroup-data)
7539 (gnus-message 3 "No articles in the group")
7541 ;; Pick the first article.
7542 ((not (or unread undownloaded unseen))
7543 (goto-char (gnus-data-pos (car gnus-newsgroup-data)))
7544 (gnus-data-number (car gnus-newsgroup-data)))
7545 ;; Find the first unread article.
7547 (let ((data gnus-newsgroup-data))
7549 (let ((num (gnus-data-number (car data))))
7550 (or (memq num gnus-newsgroup-unfetched)
7551 (not (or (and unread
7552 (memq num gnus-newsgroup-unreads))
7554 (memq num gnus-newsgroup-undownloaded))
7556 (memq num gnus-newsgroup-unseen)
7557 (memq num gnus-newsgroup-unreads)))))))
7558 (setq data (cdr data)))
7562 (goto-char (gnus-data-pos (car data)))
7563 (gnus-data-number (car data)))
7564 (gnus-message 3 "No more%s articles"
7565 (let* ((r (when unread " unread"))
7566 (d (when undownloaded " undownloaded"))
7567 (s (when unseen " unseen"))
7568 (l (delq nil (list r d s))))
7569 (cond ((= 3 (length l))
7570 (concat r "," d ", or" s))
7572 (concat (car l) ", or" (cadr l)))
7579 (gnus-summary-position-point))))))
7581 (defun gnus-summary-next-subject (n &optional unread dont-display)
7582 "Go to next N'th summary line.
7583 If N is negative, go to the previous N'th subject line.
7584 If UNREAD is non-nil, only unread articles are selected.
7585 The difference between N and the actual number of steps taken is
7588 (let ((backward (< n 0))
7592 (gnus-summary-find-prev unread)
7593 (gnus-summary-find-next unread)))
7594 (unless (zerop (setq n (1- n)))
7595 (gnus-summary-show-thread)))
7597 (gnus-message 7 "No more%s articles"
7598 (if unread " unread" "")))
7599 (unless dont-display
7600 (gnus-summary-recenter)
7601 (gnus-summary-position-point))
7604 (defun gnus-summary-next-unread-subject (n)
7605 "Go to next N'th unread summary line."
7607 (gnus-summary-next-subject n t))
7609 (defun gnus-summary-prev-subject (n &optional unread)
7610 "Go to previous N'th summary line.
7611 If optional argument UNREAD is non-nil, only unread article is selected."
7613 (gnus-summary-next-subject (- n) unread))
7615 (defun gnus-summary-prev-unread-subject (n)
7616 "Go to previous N'th unread summary line."
7618 (gnus-summary-next-subject (- n) t))
7620 (defun gnus-summary-goto-subjects (articles)
7621 "Insert the subject header for ARTICLES in the current buffer."
7623 (dolist (article articles)
7624 (gnus-summary-goto-subject article t)))
7625 (gnus-summary-limit (append articles gnus-newsgroup-limit))
7626 (gnus-summary-position-point))
7628 (defun gnus-summary-goto-subject (article &optional force silent)
7629 "Go to the subject line of ARTICLE.
7630 If FORCE, also allow jumping to articles not currently shown."
7631 (interactive "nArticle number: ")
7632 (unless (numberp article)
7633 (error "Article %s is not a number" article))
7635 (data (gnus-data-find article)))
7636 ;; We read in the article if we have to.
7639 (gnus-summary-insert-subject
7641 (if (or (numberp force) (vectorp force)) force)
7643 (setq data (gnus-data-find article)))
7648 (gnus-message 3 "Can't find article %d" article))
7650 (let ((pt (gnus-data-pos data)))
7652 (gnus-summary-set-article-display-arrow pt))
7653 (gnus-summary-position-point)
7656 ;; Walking around summary lines with displaying articles.
7658 (defun gnus-summary-expand-window (&optional arg)
7659 "Make the summary buffer take up the entire Emacs frame.
7660 Given a prefix, will force an `article' buffer configuration."
7663 (gnus-configure-windows 'article 'force)
7664 (gnus-configure-windows 'summary 'force)))
7666 (defun gnus-summary-display-article (article &optional all-header)
7667 "Display ARTICLE in article buffer."
7668 (unless (and (gnus-buffer-live-p gnus-article-buffer)
7669 (with-current-buffer gnus-article-buffer
7670 (eq major-mode 'gnus-article-mode)))
7671 (gnus-article-setup-buffer))
7672 (gnus-set-global-variables)
7673 (with-current-buffer gnus-article-buffer
7674 (setq gnus-article-charset gnus-newsgroup-charset)
7675 (setq gnus-article-ignored-charsets gnus-newsgroup-ignored-charsets)
7676 (mm-enable-multibyte))
7680 (if gnus-summary-display-article-function
7681 (funcall gnus-summary-display-article-function article all-header)
7682 (gnus-article-prepare article all-header))
7683 (gnus-run-hooks 'gnus-select-article-hook)
7684 (when (and gnus-current-article
7685 (not (zerop gnus-current-article)))
7686 (gnus-summary-goto-subject gnus-current-article))
7687 (gnus-summary-recenter)
7688 (when (and gnus-use-trees gnus-show-threads)
7689 (gnus-possibly-generate-tree article)
7690 (gnus-highlight-selected-tree article))
7691 ;; Successfully display article.
7692 (gnus-article-set-window-start
7693 (cdr (assq article gnus-newsgroup-bookmarks))))))
7695 (defun gnus-summary-select-article (&optional all-headers force pseudo article)
7696 "Select the current article.
7697 If ALL-HEADERS is non-nil, show all header fields. If FORCE is
7698 non-nil, the article will be re-fetched even if it already present in
7699 the article buffer. If PSEUDO is non-nil, pseudo-articles will also
7701 ;; Make sure we are in the summary buffer to work around bbdb bug.
7702 (unless (eq major-mode 'gnus-summary-mode)
7703 (set-buffer gnus-summary-buffer))
7704 (let ((article (or article (gnus-summary-article-number)))
7705 (all-headers (not (not all-headers))) ;Must be t or nil.
7706 gnus-summary-display-article-function)
7708 (gnus-summary-article-pseudo-p article)
7709 (error "This is a pseudo-article"))
7710 (with-current-buffer gnus-summary-buffer
7711 (if (or (and gnus-single-article-buffer
7712 (or (null gnus-current-article)
7713 (null gnus-article-current)
7714 (null (get-buffer gnus-article-buffer))
7715 (not (eq article (cdr gnus-article-current)))
7716 (not (equal (car gnus-article-current)
7717 gnus-newsgroup-name))
7718 (not (get-buffer gnus-original-article-buffer))))
7719 (and (not gnus-single-article-buffer)
7720 (or (null gnus-current-article)
7721 (not (get-buffer gnus-original-article-buffer))
7722 (not (eq gnus-current-article article))))
7724 ;; The requested article is different from the current article.
7726 (gnus-summary-display-article article all-headers)
7727 (when (gnus-buffer-live-p gnus-article-buffer)
7728 (with-current-buffer gnus-article-buffer
7729 (if (not gnus-article-decoded-p) ;; a local variable
7730 (mm-disable-multibyte))))
7731 (gnus-article-set-window-start
7732 (cdr (assq article gnus-newsgroup-bookmarks)))
7736 (defun gnus-summary-force-verify-and-decrypt ()
7737 "Display buttons for signed/encrypted parts and verify/decrypt them."
7739 (let ((mm-verify-option 'known)
7740 (mm-decrypt-option 'known)
7741 (gnus-article-emulate-mime t)
7742 (gnus-buttonized-mime-types (append (list "multipart/signed"
7743 "multipart/encrypted")
7744 gnus-buttonized-mime-types)))
7745 (gnus-summary-select-article nil 'force)))
7747 (defun gnus-summary-next-article (&optional unread subject backward push)
7748 "Select the next article.
7749 If UNREAD, only unread articles are selected.
7750 If SUBJECT, only articles with SUBJECT are selected.
7751 If BACKWARD, the previous article is selected instead of the next."
7753 ;; Make sure we are in the summary buffer.
7754 (unless (eq major-mode 'gnus-summary-mode)
7755 (set-buffer gnus-summary-buffer))
7757 ;; Is there such an article?
7758 ((and (gnus-summary-search-forward unread subject backward)
7759 (or (gnus-summary-display-article (gnus-summary-article-number))
7760 (eq (gnus-summary-article-mark) gnus-canceled-mark)))
7761 (gnus-summary-position-point))
7762 ;; If not, we try the first unread, if that is wanted.
7764 gnus-auto-select-same
7765 (gnus-summary-first-unread-article))
7766 (gnus-summary-position-point)
7767 (gnus-message 6 "Wrapped"))
7768 ;; Try to get next/previous article not displayed in this group.
7769 ((and gnus-auto-extend-newsgroup
7770 (not unread) (not subject))
7771 (gnus-summary-goto-article
7772 (if backward (1- gnus-newsgroup-begin) (1+ gnus-newsgroup-end))
7773 nil (count-lines (point-min) (point))))
7774 ;; Go to next/previous group.
7776 (unless (gnus-ephemeral-group-p gnus-newsgroup-name)
7777 (gnus-summary-jump-to-group gnus-newsgroup-name))
7778 (let ((cmd (if (featurep 'xemacs)
7780 last-command-event))
7782 (with-current-buffer gnus-group-buffer
7784 (current-summary (current-buffer))
7786 (if (eq gnus-keep-same-level 'best)
7787 (gnus-summary-best-group gnus-newsgroup-name)
7788 (gnus-summary-search-group backward gnus-keep-same-level))))
7789 ;; Select next unread newsgroup automagically.
7791 ((or (not gnus-auto-select-next)
7793 (gnus-message 7 "No more%s articles" (if unread " unread" "")))
7794 ((or (eq gnus-auto-select-next 'quietly)
7795 (and (eq gnus-auto-select-next 'slightly-quietly)
7797 (and (eq gnus-auto-select-next 'almost-quietly)
7798 (gnus-summary-last-article-p)))
7800 (if (gnus-ephemeral-group-p gnus-newsgroup-name)
7802 (gnus-message 7 "No more%s articles (%s)..."
7803 (if unread " unread" "")
7804 (if group (concat "selecting " group)
7806 (gnus-summary-next-group nil group backward)))
7808 (when (gnus-key-press-event-p last-input-event)
7809 ;; Somehow or other, we may now have selected a different
7810 ;; window. Make point go back to the summary buffer.
7811 (when (eq current-summary (current-buffer))
7812 ;; FIXME: This burps when get-buffer-window returns nil.
7813 (select-window (get-buffer-window current-summary 0)))
7814 (gnus-summary-walk-group-buffer
7815 gnus-newsgroup-name cmd unread backward point))))))))
7817 (defun gnus-summary-walk-group-buffer (from-group cmd unread backward start)
7818 (let ((keystrokes '((?\C-n (gnus-group-next-unread-group 1))
7819 (?\C-p (gnus-group-prev-unread-group 1))))
7820 (cursor-in-echo-area t)
7821 keve key group ended prompt)
7822 (with-current-buffer gnus-group-buffer
7825 (if (eq gnus-keep-same-level 'best)
7826 (gnus-summary-best-group gnus-newsgroup-name)
7827 (gnus-summary-search-group backward gnus-keep-same-level))))
7831 "No more%s articles%s " (if unread " unread" "")
7833 (not (gnus-ephemeral-group-p gnus-newsgroup-name)))
7834 (format " (Type %s for %s [%s])"
7835 (single-key-description cmd)
7836 (gnus-group-decoded-name group)
7837 (gnus-group-unread group))
7838 (format " (Type %s to exit %s)"
7839 (single-key-description cmd)
7840 (gnus-group-decoded-name gnus-newsgroup-name)))))
7841 ;; Confirm auto selection.
7842 (setq key (car (setq keve (gnus-read-event-char prompt)))
7845 ((assq key keystrokes)
7846 (let ((obuf (current-buffer)))
7847 (switch-to-buffer gnus-group-buffer)
7849 (gnus-group-jump-to-group group))
7850 (eval (cadr (assq key keystrokes)))
7851 (setq group (gnus-group-group-name))
7852 (switch-to-buffer obuf))
7856 (gnus-ephemeral-group-p gnus-newsgroup-name))
7858 (gnus-summary-next-group nil group backward)))
7860 (push (cdr keve) unread-command-events))))))
7862 (defun gnus-summary-next-unread-article ()
7863 "Select unread article after current one."
7865 (gnus-summary-next-article
7866 (or (not (eq gnus-summary-goto-unread 'never))
7867 (gnus-summary-last-article-p (gnus-summary-article-number)))
7868 (and gnus-auto-select-same
7869 (gnus-summary-article-subject))))
7871 (defun gnus-summary-prev-article (&optional unread subject)
7872 "Select the article before the current one.
7873 If UNREAD is non-nil, only unread articles are selected."
7875 (gnus-summary-next-article unread subject t))
7877 (defun gnus-summary-prev-unread-article ()
7878 "Select unread article before current one."
7880 (gnus-summary-prev-article
7881 (or (not (eq gnus-summary-goto-unread 'never))
7882 (gnus-summary-first-article-p (gnus-summary-article-number)))
7883 (and gnus-auto-select-same
7884 (gnus-summary-article-subject))))
7886 (declare-function gnus-article-only-boring-p "gnus-art" ())
7888 (defun gnus-summary-next-page (&optional lines circular stop)
7889 "Show next page of the selected article.
7890 If at the end of the current article, select the next article.
7891 LINES says how many lines should be scrolled up.
7893 If CIRCULAR is non-nil, go to the start of the article instead of
7894 selecting the next article when reaching the end of the current
7897 If STOP is non-nil, just stop when reaching the end of the message.
7899 Also see the variable `gnus-article-skip-boring'."
7901 (gnus-set-global-variables)
7902 (let ((article (gnus-summary-article-number))
7903 (article-window (get-buffer-window gnus-article-buffer t))
7905 ;; If the buffer is empty, we have no article.
7907 (error "No article to select"))
7908 (gnus-configure-windows 'article)
7909 (if (eq (cdr (assq article gnus-newsgroup-reads)) gnus-canceled-mark)
7910 (if (and (eq gnus-summary-goto-unread 'never)
7911 (not (gnus-summary-last-article-p article)))
7912 (gnus-summary-next-article)
7913 (gnus-summary-next-unread-article))
7914 (if (or (null gnus-current-article)
7915 (null gnus-article-current)
7916 (/= article (cdr gnus-article-current))
7917 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7918 ;; Selected subject is different from current article's.
7919 (gnus-summary-display-article article)
7920 (when article-window
7921 (gnus-eval-in-buffer-window gnus-article-buffer
7922 (setq endp (or (gnus-article-next-page lines)
7923 (gnus-article-only-boring-p))))
7925 (cond ((or stop gnus-summary-stop-at-end-of-message)
7926 (gnus-message 3 "End of message"))
7928 (gnus-summary-beginning-of-article))
7930 (gnus-message 3 "End of message"))
7932 (if (and (eq gnus-summary-goto-unread 'never)
7933 (not (gnus-summary-last-article-p article)))
7934 (gnus-summary-next-article)
7935 (gnus-summary-next-unread-article))))))))
7936 (gnus-summary-recenter)
7937 (gnus-summary-position-point)))
7939 (defun gnus-summary-prev-page (&optional lines move)
7940 "Show previous page of selected article.
7941 Argument LINES specifies lines to be scrolled down.
7942 If MOVE, move to the previous unread article if point is at
7943 the beginning of the buffer."
7945 (let ((article (gnus-summary-article-number))
7946 (article-window (get-buffer-window gnus-article-buffer t))
7948 (gnus-configure-windows 'article)
7949 (if (or (null gnus-current-article)
7950 (null gnus-article-current)
7951 (/= article (cdr gnus-article-current))
7952 (not (equal (car gnus-article-current) gnus-newsgroup-name)))
7953 ;; Selected subject is different from current article's.
7954 (gnus-summary-display-article article)
7955 (gnus-summary-recenter)
7956 (when article-window
7957 (gnus-eval-in-buffer-window gnus-article-buffer
7958 (setq endp (gnus-article-prev-page lines)))
7959 (when (and move endp)
7961 (gnus-message 3 "Beginning of message"))
7963 (if (and (eq gnus-summary-goto-unread 'never)
7964 (not (gnus-summary-first-article-p article)))
7965 (gnus-summary-prev-article)
7966 (gnus-summary-prev-unread-article))))))))
7967 (gnus-summary-position-point))
7969 (defun gnus-summary-prev-page-or-article (&optional lines)
7970 "Show previous page of selected article.
7971 Argument LINES specifies lines to be scrolled down.
7972 If at the beginning of the article, go to the next article."
7974 (gnus-summary-prev-page lines t))
7976 (defun gnus-summary-scroll-up (lines)
7977 "Scroll up (or down) one line current article.
7978 Argument LINES specifies lines to be scrolled up (or down if negative).
7979 If no article is selected, then the current article will be selected first."
7981 (gnus-configure-windows 'article)
7982 (gnus-summary-show-thread)
7983 (when (eq (gnus-summary-select-article nil nil 'pseudo) 'old)
7984 (gnus-eval-in-buffer-window gnus-article-buffer
7986 (when (gnus-article-next-page lines)
7987 (gnus-message 3 "End of message")))
7989 (gnus-article-prev-page (- lines))))))
7990 (gnus-summary-recenter)
7991 (gnus-summary-position-point))
7993 (defun gnus-summary-scroll-down (lines)
7994 "Scroll down (or up) one line current article.
7995 Argument LINES specifies lines to be scrolled down (or up if negative).
7996 If no article is selected, then the current article will be selected first."
7998 (gnus-summary-scroll-up (- lines)))
8000 (defun gnus-summary-next-same-subject ()
8001 "Select next article which has the same subject as current one."
8003 (gnus-summary-next-article nil (gnus-summary-article-subject)))
8005 (defun gnus-summary-prev-same-subject ()
8006 "Select previous article which has the same subject as current one."
8008 (gnus-summary-prev-article nil (gnus-summary-article-subject)))
8010 (defun gnus-summary-next-unread-same-subject ()
8011 "Select next unread article which has the same subject as current one."
8013 (gnus-summary-next-article t (gnus-summary-article-subject)))
8015 (defun gnus-summary-prev-unread-same-subject ()
8016 "Select previous unread article which has the same subject as current one."
8018 (gnus-summary-prev-article t (gnus-summary-article-subject)))
8020 (defun gnus-summary-first-unread-article ()
8021 "Select the first unread article.
8022 Return nil if there are no unread articles."
8025 (when (gnus-summary-first-subject t)
8026 (gnus-summary-show-thread)
8027 (gnus-summary-first-subject t)
8028 (gnus-summary-display-article (gnus-summary-article-number)))
8029 (gnus-summary-position-point)))
8031 (defun gnus-summary-first-unread-subject ()
8032 "Place the point on the subject line of the first unread article.
8033 Return nil if there are no unread articles."
8036 (when (gnus-summary-first-subject t)
8037 (gnus-summary-show-thread)
8038 (gnus-summary-first-subject t))
8039 (gnus-summary-position-point)))
8041 (defun gnus-summary-first-unseen-subject ()
8042 "Place the point on the subject line of the first unseen article.
8043 Return nil if there are no unseen articles."
8046 (when (gnus-summary-first-subject nil nil t)
8047 (gnus-summary-show-thread)
8048 (gnus-summary-first-subject nil nil t))
8049 (gnus-summary-position-point)))
8051 (defun gnus-summary-first-unseen-or-unread-subject ()
8052 "Place the point on the subject line of the first unseen and unread article.
8053 If all article have been seen, on the subject line of the first unread
8057 (unless (when (gnus-summary-first-subject nil nil t)
8058 (gnus-summary-show-thread)
8059 (gnus-summary-first-subject nil nil t))
8060 (when (gnus-summary-first-subject t)
8061 (gnus-summary-show-thread)
8062 (gnus-summary-first-subject t)))
8063 (gnus-summary-position-point)))
8065 (defun gnus-summary-first-article ()
8066 "Select the first article.
8067 Return nil if there are no articles."
8070 (when (gnus-summary-first-subject)
8071 (gnus-summary-show-thread)
8072 (gnus-summary-first-subject)
8073 (gnus-summary-display-article (gnus-summary-article-number)))
8074 (gnus-summary-position-point)))
8076 (defun gnus-summary-best-unread-article (&optional arg)
8077 "Select the unread article with the highest score.
8078 If given a prefix argument, select the next unread article that has a
8079 score higher than the default score."
8081 (let ((article (if arg
8082 (gnus-summary-better-unread-subject)
8083 (gnus-summary-best-unread-subject))))
8085 (gnus-summary-goto-article article)
8086 (error "No unread articles"))))
8088 (defun gnus-summary-best-unread-subject ()
8089 "Select the unread subject with the highest score."
8091 (let ((best -1000000)
8092 (data gnus-newsgroup-data)
8095 (and (gnus-data-unread-p (car data))
8097 (gnus-summary-article-score (gnus-data-number (car data))))
8100 article (gnus-data-number (car data))))
8101 (setq data (cdr data)))
8103 (gnus-summary-goto-subject article))
8104 (gnus-summary-position-point)
8107 (defun gnus-summary-better-unread-subject ()
8108 "Select the first unread subject that has a score over the default score."
8110 (let ((data gnus-newsgroup-data)
8112 (while (and (setq article (gnus-data-number (car data)))
8113 (or (gnus-data-read-p (car data))
8114 (not (> (gnus-summary-article-score article)
8115 gnus-summary-default-score))))
8116 (setq data (cdr data)))
8118 (gnus-summary-goto-subject article))
8119 (gnus-summary-position-point)
8122 (defun gnus-summary-last-subject ()
8123 "Go to the last displayed subject line in the group."
8124 (let ((article (gnus-data-number (car (gnus-data-list t)))))
8126 (gnus-summary-goto-subject article))))
8128 (defun gnus-summary-goto-article (article &optional all-headers force)
8129 "Fetch ARTICLE (article number or Message-ID) and display it if it exists.
8130 If ALL-HEADERS is non-nil, no header lines are hidden.
8131 If FORCE, go to the article even if it isn't displayed. If FORCE
8132 is a number, it is the line the article is to be displayed on."
8135 (gnus-completing-read
8136 "Article number or Message-ID"
8137 (mapcar 'int-to-string gnus-newsgroup-limit))
8141 (if (and (stringp article)
8142 (string-match "@\\|%40" article))
8143 (gnus-summary-refer-article article)
8144 (when (stringp article)
8145 (setq article (string-to-number article)))
8146 (if (gnus-summary-goto-subject article force)
8147 (gnus-summary-display-article article all-headers)
8148 (gnus-message 4 "Couldn't go to article %s" article) nil))
8149 (gnus-summary-position-point)))
8151 (defun gnus-summary-goto-last-article ()
8152 "Go to the previously read article."
8155 (when gnus-last-article
8156 (gnus-summary-goto-article gnus-last-article nil t))
8157 (gnus-summary-position-point)))
8159 (defun gnus-summary-pop-article (number)
8160 "Pop one article off the history and go to the previous.
8161 NUMBER articles will be popped off."
8164 (setq gnus-newsgroup-history
8165 (cdr (setq to (nthcdr number gnus-newsgroup-history))))
8167 (gnus-summary-goto-article (car to) nil t)
8168 (error "Article history empty")))
8169 (gnus-summary-position-point))
8171 ;; Summary commands and functions for limiting the summary buffer.
8173 (defun gnus-summary-limit-to-articles (n)
8174 "Limit the summary buffer to the next N articles.
8175 If not given a prefix, use the process marked articles instead."
8178 (let ((articles (gnus-summary-work-articles n)))
8179 (setq gnus-newsgroup-processable nil)
8180 (gnus-summary-limit articles))
8181 (gnus-summary-position-point)))
8183 (defun gnus-summary-pop-limit (&optional total)
8184 "Restore the previous limit.
8185 If given a prefix, remove all limits."
8188 (setq gnus-newsgroup-limits
8189 (list (mapcar (lambda (h) (mail-header-number h))
8190 gnus-newsgroup-headers))))
8191 (unless gnus-newsgroup-limits
8192 (error "No limit to pop"))
8194 (gnus-summary-limit nil 'pop)
8195 (gnus-summary-position-point)))
8197 (defun gnus-summary-limit-to-subject (subject &optional header not-matching)
8198 "Limit the summary buffer to articles that have subjects that match a regexp.
8199 If NOT-MATCHING, excluding articles that have subjects that match a regexp."
8201 (list (read-string (if current-prefix-arg
8202 "Exclude subject (regexp): "
8203 "Limit to subject (regexp): "))
8204 nil current-prefix-arg))
8206 (setq header "subject"))
8207 (when (not (equal "" subject))
8209 (let ((articles (gnus-summary-find-matching
8210 (or header "subject") subject 'all nil nil
8213 (error "Found no matches for \"%s\"" subject))
8214 (gnus-summary-limit articles))
8215 (gnus-summary-position-point))))
8217 (defun gnus-summary-limit-to-author (from &optional not-matching)
8218 "Limit the summary buffer to articles that have authors that match a regexp.
8219 If NOT-MATCHING, excluding articles that have authors that match a regexp."
8221 (list (let* ((header (gnus-summary-article-header))
8222 (default (and header (car (mail-header-parse-address
8223 (mail-header-from header))))))
8224 (read-string (concat (if current-prefix-arg
8225 "Exclude author (regexp"
8226 "Limit to author (regexp")
8228 (concat ", default \"" default "\"): ")
8232 current-prefix-arg))
8233 (gnus-summary-limit-to-subject from "from" not-matching))
8235 (defun gnus-summary-limit-to-recipient (recipient &optional not-matching)
8236 "Limit the summary buffer to articles with the given RECIPIENT.
8238 If NOT-MATCHING, exclude RECIPIENT.
8240 To and Cc headers are checked. You need to include them in
8241 `nnmail-extra-headers'."
8242 ;; Unlike `rmail-summary-by-recipients', doesn't include From.
8244 (list (read-string (format "%s recipient (regexp): "
8245 (if current-prefix-arg "Exclude" "Limit to")))
8246 current-prefix-arg))
8247 (when (not (equal "" recipient))
8249 (if (memq 'To nnmail-extra-headers)
8250 (gnus-summary-find-matching
8251 (cons 'extra 'To) recipient 'all nil nil
8254 1 "`To' isn't present in `nnmail-extra-headers'")
8258 (if (memq 'Cc nnmail-extra-headers)
8259 (gnus-summary-find-matching
8260 (cons 'extra 'Cc) recipient 'all nil nil
8263 1 "`Cc' isn't present in `nnmail-extra-headers'")
8268 ;; We need the numbers that are in both lists:
8270 (and (memq a to) a))
8274 (error "Found no matches for \"%s\"" recipient))
8275 (gnus-summary-limit articles))
8276 (gnus-summary-position-point))))
8278 (defun gnus-summary-limit-to-address (address &optional not-matching)
8279 "Limit the summary buffer to articles with the given ADDRESS.
8281 If NOT-MATCHING, exclude ADDRESS.
8283 To, Cc and From headers are checked. You need to include `To' and `Cc'
8284 in `nnmail-extra-headers'."
8286 (list (read-string (format "%s address (regexp): "
8287 (if current-prefix-arg "Exclude" "Limit to")))
8288 current-prefix-arg))
8289 (when (not (equal "" address))
8291 (if (memq 'To nnmail-extra-headers)
8292 (gnus-summary-find-matching
8293 (cons 'extra 'To) address 'all nil nil
8296 1 "`To' isn't present in `nnmail-extra-headers'")
8300 (if (memq 'Cc nnmail-extra-headers)
8301 (gnus-summary-find-matching
8302 (cons 'extra 'Cc) address 'all nil nil
8305 1 "`Cc' isn't present in `nnmail-extra-headers'")
8309 (gnus-summary-find-matching "from" address
8310 'all nil nil not-matching))
8313 ;; We need the numbers that are in all lists:
8317 (mapcar (lambda (a) (car (memq a from))) to))
8319 (mapcar (lambda (a) (car (memq a from))) cc)
8320 (mapcar (lambda (a) (car (memq a from)))
8321 (mapcar (lambda (a) (car (memq a to)))
8323 (nconc (if (eq to t) nil to)
8324 (if (eq cc t) nil cc)
8327 (error "Found no matches for \"%s\"" address))
8328 (gnus-summary-limit articles))
8329 (gnus-summary-position-point))))
8331 (defun gnus-summary-limit-strange-charsets-predicate (header)
8332 (when (fboundp 'char-charset)
8333 (let ((string (concat (mail-header-subject header)
8334 (mail-header-from header)))
8336 (dotimes (i (1- (length string)))
8337 (setq charset (format "%s" (char-charset (aref string (1+ i)))))
8338 (when (string-match "unicode\\|big\\|japanese" charset)
8342 (defun gnus-summary-limit-to-predicate (predicate)
8343 "Limit to articles where PREDICATE returns non-nil.
8344 PREDICATE will be called with the header structures of the
8346 (let ((articles nil)
8347 (case-fold-search t))
8348 (dolist (header gnus-newsgroup-headers)
8349 (when (funcall predicate header)
8350 (push (mail-header-number header) articles)))
8351 (gnus-summary-limit (nreverse articles))))
8353 (defun gnus-summary-limit-to-age (age &optional younger-p)
8354 "Limit the summary buffer to articles that are older than (or equal) AGE days.
8355 If YOUNGER-P (the prefix) is non-nil, limit the summary buffer to
8356 articles that are younger than AGE days."
8358 (let ((younger current-prefix-arg)
8361 (while (not days-got)
8362 (setq days (if younger
8363 (read-string "Limit to articles younger than (in days, older when negative): ")
8365 "Limit to articles older than (in days, younger when negative): ")))
8366 (when (> (length days) 0)
8367 (setq days (read days)))
8372 (setq younger (not younger))
8373 (setq days (* days -1))))
8374 (message "Please enter a number.")
8376 (list days younger)))
8378 (let ((data gnus-newsgroup-data)
8379 (cutoff (days-to-time age))
8380 articles d date is-younger)
8381 (while (setq d (pop data))
8382 (when (and (vectorp (gnus-data-header d))
8383 (setq date (mail-header-date (gnus-data-header d))))
8384 (setq is-younger (time-less-p
8385 (time-since (gnus-date-get-time date))
8390 (push (gnus-data-number d) articles))))
8391 (gnus-summary-limit (nreverse articles)))
8392 (gnus-summary-position-point)))
8394 (defun gnus-summary-limit-to-extra (header regexp &optional not-matching)
8395 "Limit the summary buffer to articles that match an 'extra' header."
8399 (gnus-completing-read
8400 (if current-prefix-arg
8401 "Exclude extra header"
8402 "Limit extra header")
8403 (mapcar 'symbol-name gnus-extra-headers)
8405 (symbol-name (car gnus-extra-headers))))))
8407 (read-string (format "%s header %s (regexp): "
8408 (if current-prefix-arg "Exclude" "Limit to")
8410 current-prefix-arg)))
8411 (when (not (equal "" regexp))
8413 (let ((articles (gnus-summary-find-matching
8414 (cons 'extra header) regexp 'all nil nil
8417 (error "Found no matches for \"%s\"" regexp))
8418 (gnus-summary-limit articles))
8419 (gnus-summary-position-point))))
8421 (defun gnus-summary-limit-to-display-predicate ()
8422 "Limit the summary buffer to the predicated in the `display' group parameter."
8424 (unless gnus-newsgroup-display
8425 (error "There is no `display' group parameter"))
8427 (dolist (gnus-number gnus-newsgroup-articles)
8428 (when (funcall gnus-newsgroup-display)
8429 (push gnus-number articles)))
8430 (gnus-summary-limit articles))
8431 (gnus-summary-position-point))
8433 (defun gnus-summary-limit-to-unread (&optional all)
8434 "Limit the summary buffer to articles that are not marked as read.
8435 If ALL is non-nil, limit strictly to unread articles."
8438 (gnus-summary-limit-to-marks (char-to-string gnus-unread-mark))
8439 (gnus-summary-limit-to-marks
8440 ;; Concat all the marks that say that an article is read and have
8442 (list gnus-del-mark gnus-read-mark gnus-ancient-mark
8443 gnus-killed-mark gnus-spam-mark gnus-kill-file-mark
8444 gnus-low-score-mark gnus-expirable-mark
8445 gnus-canceled-mark gnus-catchup-mark gnus-sparse-mark
8446 gnus-duplicate-mark)
8449 (defun gnus-summary-limit-to-headers (match &optional reverse)
8450 "Limit the summary buffer to articles that have headers that match MATCH.
8451 If REVERSE (the prefix), limit to articles that don't match."
8452 (interactive "sMatch headers (regexp): \nP")
8453 (gnus-summary-limit-to-bodies match reverse t))
8455 (declare-function article-goto-body "gnus-art" ())
8457 (defun gnus-summary-limit-to-bodies (match &optional reverse headersp)
8458 "Limit the summary buffer to articles that have bodies that match MATCH.
8459 If REVERSE (the prefix), limit to articles that don't match."
8460 (interactive "sMatch body (regexp): \nP")
8461 (let ((articles nil)
8462 (gnus-select-article-hook nil) ;Disable hook.
8463 (gnus-article-prepare-hook nil)
8464 (gnus-use-article-prefetch nil)
8465 (gnus-keep-backlog nil)
8466 (gnus-break-pages nil)
8467 (gnus-summary-display-arrow nil)
8468 (gnus-updated-mode-lines nil)
8469 (gnus-auto-center-summary nil)
8470 (gnus-display-mime-function nil))
8471 (dolist (data gnus-newsgroup-data)
8472 (let (gnus-mark-article-hook)
8473 (gnus-summary-select-article t t nil (gnus-data-number data)))
8474 (with-current-buffer gnus-article-buffer
8476 (let* ((case-fold-search t)
8478 (re-search-backward match nil t)
8479 (re-search-forward match nil t))))
8480 (when (or (and found
8484 (push (gnus-data-number data) articles)))))
8486 (message "No messages matched")
8487 (gnus-summary-limit articles)))
8488 (gnus-summary-position-point))
8490 (defun gnus-summary-limit-to-singletons (&optional threadsp)
8491 "Limit the summary buffer to articles that aren't part on any thread.
8492 If THREADSP (the prefix), limit to articles that are in threads."
8494 (let ((articles nil)
8497 (dolist (thread gnus-newsgroup-threads)
8498 (if (stringp (car thread))
8499 (dolist (thread (cdr thread))
8500 (push thread threads))
8501 (push thread threads)))
8502 (dolist (thread threads)
8503 (setq thread-articles (gnus-articles-in-thread thread))
8504 (when (or (and threadsp
8505 (> (length thread-articles) 1))
8507 (= (length thread-articles) 1)))
8508 (setq articles (nconc thread-articles articles))))
8510 (message "No messages matched")
8511 (gnus-summary-limit articles))
8512 (gnus-summary-position-point)))
8514 (defun gnus-summary-limit-to-replied (&optional unreplied)
8515 "Limit the summary buffer to replied articles.
8516 If UNREPLIED (the prefix), limit to unreplied articles."
8520 (gnus-set-difference gnus-newsgroup-articles
8521 gnus-newsgroup-replied))
8522 (gnus-summary-limit gnus-newsgroup-replied))
8523 (gnus-summary-position-point))
8525 (defun gnus-summary-limit-exclude-marks (marks &optional reverse)
8526 "Exclude articles that are marked with MARKS (e.g. \"DK\").
8527 If REVERSE, limit the summary buffer to articles that are marked
8528 with MARKS. MARKS can either be a string of marks or a list of marks.
8529 Returns how many articles were removed."
8530 (interactive "sMarks: ")
8531 (gnus-summary-limit-to-marks marks t))
8533 (defun gnus-summary-limit-to-marks (marks &optional reverse)
8534 "Limit the summary buffer to articles that are marked with MARKS (e.g. \"DK\").
8535 If REVERSE (the prefix), limit the summary buffer to articles that are
8536 not marked with MARKS. MARKS can either be a string of marks or a
8538 Returns how many articles were removed."
8539 (interactive "sMarks: \nP")
8541 (let ((data gnus-newsgroup-data)
8542 (marks (if (listp marks) marks
8543 (append marks nil))) ; Transform to list.
8546 (when (if reverse (not (memq (gnus-data-mark (car data)) marks))
8547 (memq (gnus-data-mark (car data)) marks))
8548 (push (gnus-data-number (car data)) articles))
8549 (setq data (cdr data)))
8550 (gnus-summary-limit articles))
8551 (gnus-summary-position-point)))
8553 (defun gnus-summary-limit-to-score (score)
8554 "Limit to articles with score at or above SCORE."
8555 (interactive "NLimit to articles with score of at least: ")
8556 (let ((data gnus-newsgroup-data)
8559 (when (>= (gnus-summary-article-score (gnus-data-number (car data)))
8561 (push (gnus-data-number (car data)) articles))
8562 (setq data (cdr data)))
8564 (gnus-summary-limit articles)
8565 (gnus-summary-position-point))))
8567 (defun gnus-summary-limit-to-unseen ()
8568 "Limit to unseen articles."
8571 (gnus-summary-limit gnus-newsgroup-unseen)
8572 (gnus-summary-position-point)))
8574 (defun gnus-summary-limit-include-thread (id)
8575 "Display all the hidden articles that is in the thread with ID in it.
8576 When called interactively, ID is the Message-ID of the current
8578 (interactive (list (mail-header-id (gnus-summary-article-header))))
8579 (let ((articles (gnus-articles-in-thread
8580 (gnus-id-to-thread (gnus-root-id id))))
8581 ;;we REALLY want the whole thread---this prevents cut-threads
8582 ;;from removing the thread we want to include.
8583 (gnus-fetch-old-headers nil)
8584 (gnus-build-sparse-threads nil))
8586 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8587 (gnus-summary-limit-include-matching-articles
8589 (regexp-quote (gnus-simplify-subject-re
8590 (mail-header-subject (gnus-id-to-header id)))))
8591 (gnus-summary-position-point))))
8593 (defun gnus-summary-limit-include-matching-articles (header regexp)
8594 "Display all the hidden articles that have HEADERs that match REGEXP."
8595 (interactive (list (read-string "Match on header: ")
8596 (read-string "Regexp: ")))
8597 (let ((articles (gnus-find-matching-articles header regexp)))
8599 (gnus-summary-limit (nconc articles gnus-newsgroup-limit))
8600 (gnus-summary-position-point))))
8602 (defun gnus-summary-insert-dormant-articles ()
8603 "Insert all the dormant articles for this group into the current buffer."
8605 (let ((gnus-verbose (max 6 gnus-verbose)))
8606 (if (not gnus-newsgroup-dormant)
8607 (gnus-message 3 "No dormant articles for this group")
8608 (gnus-summary-goto-subjects gnus-newsgroup-dormant))))
8610 (defun gnus-summary-insert-ticked-articles ()
8611 "Insert ticked articles for this group into the current buffer."
8613 (let ((gnus-verbose (max 6 gnus-verbose)))
8614 (if (not gnus-newsgroup-marked)
8615 (gnus-message 3 "No ticked articles for this group")
8616 (gnus-summary-goto-subjects gnus-newsgroup-marked))))
8618 (defun gnus-summary-limit-include-dormant ()
8619 "Display all the hidden articles that are marked as dormant.
8620 Note that this command only works on a subset of the articles currently
8621 fetched for this group."
8623 (unless gnus-newsgroup-dormant
8624 (error "There are no dormant articles in this group"))
8626 (gnus-summary-limit (append gnus-newsgroup-dormant gnus-newsgroup-limit))
8627 (gnus-summary-position-point)))
8629 (defun gnus-summary-include-articles (articles)
8630 "Fetch the headers for ARTICLES and then display the summary lines."
8631 (let ((gnus-inhibit-demon t)
8633 (gnus-read-all-available-headers t))
8634 (setq gnus-newsgroup-headers
8636 'list gnus-newsgroup-headers
8637 (gnus-fetch-headers articles nil t)
8638 'gnus-article-sort-by-number))
8639 (setq gnus-newsgroup-articles
8640 (gnus-sorted-nunion gnus-newsgroup-articles articles))
8641 (gnus-summary-limit (append articles gnus-newsgroup-limit))))
8643 (defun gnus-summary-limit-exclude-dormant ()
8644 "Hide all dormant articles."
8647 (gnus-summary-limit-to-marks (list gnus-dormant-mark) 'reverse)
8648 (gnus-summary-position-point)))
8650 (defun gnus-summary-limit-exclude-childless-dormant ()
8651 "Hide all dormant articles that have no children."
8653 (let ((data (gnus-data-list t))
8654 articles d children)
8655 ;; Find all articles that are either not dormant or have
8657 (while (setq d (pop data))
8658 (when (or (not (= (gnus-data-mark d) gnus-dormant-mark))
8660 (gnus-article-children (gnus-data-number d)))
8663 (when (memq (car children) articles)
8668 (push (gnus-data-number d) articles)))
8671 (gnus-summary-limit articles)
8672 (gnus-summary-position-point))))
8674 (defun gnus-summary-limit-mark-excluded-as-read (&optional all)
8675 "Mark all unread excluded articles as read.
8676 If ALL, mark even excluded ticked and dormants as read."
8678 (setq gnus-newsgroup-limit (sort gnus-newsgroup-limit '<))
8679 (let ((articles (gnus-sorted-ndifference
8681 (mapcar (lambda (h) (mail-header-number h))
8682 gnus-newsgroup-headers)
8684 gnus-newsgroup-limit))
8686 (setq gnus-newsgroup-unreads
8687 (gnus-sorted-intersection gnus-newsgroup-unreads
8688 gnus-newsgroup-limit))
8690 (setq gnus-newsgroup-dormant nil
8691 gnus-newsgroup-marked nil
8692 gnus-newsgroup-reads
8694 (mapcar (lambda (n) (cons n gnus-catchup-mark)) articles)
8695 gnus-newsgroup-reads))
8696 (while (setq article (pop articles))
8697 (unless (or (memq article gnus-newsgroup-dormant)
8698 (memq article gnus-newsgroup-marked))
8699 (push (cons article gnus-catchup-mark) gnus-newsgroup-reads))))))
8701 (defun gnus-summary-limit (articles &optional pop)
8703 ;; We pop the previous limit off the stack and use that.
8704 (setq articles (car gnus-newsgroup-limits)
8705 gnus-newsgroup-limits (cdr gnus-newsgroup-limits))
8706 ;; We use the new limit, so we push the old limit on the stack.
8707 (push gnus-newsgroup-limit gnus-newsgroup-limits))
8709 (setq gnus-newsgroup-limit articles)
8710 (let ((total (length gnus-newsgroup-data))
8711 (data (gnus-data-find-list (gnus-summary-article-number)))
8712 (gnus-summary-mark-below nil) ; Inhibit this.
8714 ;; This will do all the work of generating the new summary buffer
8715 ;; according to the new limit.
8716 (gnus-summary-prepare)
8717 ;; Hide any threads, possibly.
8718 (gnus-summary-maybe-hide-threads)
8719 ;; Try to return to the article you were at, or one in the
8722 ;; We try to find some article after the current one.
8724 (when (gnus-summary-goto-subject (gnus-data-number (car data)) nil t)
8727 (setq data (cdr data))))
8729 ;; If there is no data, that means that we were after the last
8730 ;; article. The same goes when we can't find any articles
8731 ;; after the current one.
8732 (goto-char (point-max))
8733 (gnus-summary-find-prev))
8734 (gnus-set-mode-line 'summary)
8735 ;; We return how many articles were removed from the summary
8736 ;; buffer as a result of the new limit.
8737 (- total (length gnus-newsgroup-data))))
8739 (defsubst gnus-invisible-cut-children (threads)
8742 (when (memq (mail-header-number (caar threads)) gnus-newsgroup-limit)
8747 (defsubst gnus-cut-thread (thread)
8748 "Go forwards in the thread until we find an article that we want to display."
8749 (when (or (eq gnus-fetch-old-headers 'some)
8750 (eq gnus-fetch-old-headers 'invisible)
8751 (numberp gnus-fetch-old-headers)
8752 (eq gnus-build-sparse-threads 'some)
8753 (eq gnus-build-sparse-threads 'more))
8754 ;; Deal with old-fetched headers and sparse threads.
8758 (gnus-summary-article-sparse-p (mail-header-number (car thread)))
8759 (gnus-summary-article-ancient-p
8760 (mail-header-number (car thread))))
8761 (if (or (<= (length (cdr thread)) 1)
8762 (eq gnus-fetch-old-headers 'invisible))
8763 (setq gnus-newsgroup-limit
8764 (delq (mail-header-number (car thread))
8765 gnus-newsgroup-limit)
8766 thread (cadr thread))
8767 (when (gnus-invisible-cut-children (cdr thread))
8768 (let ((th (cdr thread)))
8770 (if (memq (mail-header-number (caar th))
8771 gnus-newsgroup-limit)
8772 (setq thread (car th)
8774 (setq th (cdr th))))))))))
8777 (defun gnus-cut-threads (threads)
8778 "Cut off all uninteresting articles from the beginning of THREADS."
8779 (when (or (eq gnus-fetch-old-headers 'some)
8780 (eq gnus-fetch-old-headers 'invisible)
8781 (numberp gnus-fetch-old-headers)
8782 (eq gnus-build-sparse-threads 'some)
8783 (eq gnus-build-sparse-threads 'more))
8786 (setcar th (gnus-cut-thread (car th)))
8787 (setq th (cdr th)))))
8788 ;; Remove nixed out threads.
8791 (defun gnus-summary-initial-limit (&optional show-if-empty)
8792 "Figure out what the initial limit is supposed to be on group entry.
8793 This entails weeding out unwanted dormants, low-scored articles,
8794 fetch-old-headers verbiage, and so on."
8795 ;; Most groups have nothing to remove.
8796 (unless (or gnus-inhibit-limiting
8797 (and (null gnus-newsgroup-dormant)
8798 (eq gnus-newsgroup-display 'gnus-not-ignore)
8799 (not (eq gnus-fetch-old-headers 'some))
8800 (not (numberp gnus-fetch-old-headers))
8801 (not (eq gnus-fetch-old-headers 'invisible))
8802 (null gnus-summary-expunge-below)
8803 (not (eq gnus-build-sparse-threads 'some))
8804 (not (eq gnus-build-sparse-threads 'more))
8805 (null gnus-thread-expunge-below)))
8806 (push gnus-newsgroup-limit gnus-newsgroup-limits)
8807 (setq gnus-newsgroup-limit nil)
8810 (unless (car (symbol-value node))
8811 ;; These threads have no parents -- they are roots.
8812 (let ((nodes (cdr (symbol-value node)))
8815 (if (and gnus-thread-expunge-below
8816 (< (gnus-thread-total-score (car nodes))
8817 gnus-thread-expunge-below))
8818 (gnus-expunge-thread (pop nodes))
8819 (setq thread (pop nodes))
8820 (gnus-summary-limit-children thread))))))
8821 gnus-newsgroup-dependencies)
8822 ;; If this limitation resulted in an empty group, we might
8823 ;; pop the previous limit and use it instead.
8824 (when (and (not gnus-newsgroup-limit)
8826 (setq gnus-newsgroup-limit (pop gnus-newsgroup-limits)))
8827 gnus-newsgroup-limit))
8829 (defun gnus-summary-limit-children (thread)
8830 "Return 1 if this subthread is visible and 0 if it is not."
8831 ;; First we get the number of visible children to this thread. This
8832 ;; is done by recursing down the thread using this function, so this
8833 ;; will really go down to a leaf article first, before slowly
8834 ;; working its way up towards the root.
8836 (let* ((max-lisp-eval-depth (max 5000 max-lisp-eval-depth))
8839 (apply '+ (mapcar 'gnus-summary-limit-children
8842 (number (mail-header-number (car thread)))
8845 (not (memq number gnus-newsgroup-marked))
8847 ;; If this article is dormant and has absolutely no visible
8848 ;; children, then this article isn't visible.
8849 (and (memq number gnus-newsgroup-dormant)
8851 ;; If this is "fetch-old-headered" and there is no
8852 ;; visible children, then we don't want this article.
8853 (and (or (eq gnus-fetch-old-headers 'some)
8854 (numberp gnus-fetch-old-headers))
8855 (gnus-summary-article-ancient-p number)
8857 ;; If this is "fetch-old-headered" and `invisible', then
8858 ;; we don't want this article.
8859 (and (eq gnus-fetch-old-headers 'invisible)
8860 (gnus-summary-article-ancient-p number))
8861 ;; If this is a sparsely inserted article with no children,
8862 ;; we don't want it.
8863 (and (eq gnus-build-sparse-threads 'some)
8864 (gnus-summary-article-sparse-p number)
8866 ;; If we use expunging, and this article is really
8867 ;; low-scored, then we don't want this article.
8868 (when (and gnus-summary-expunge-below
8870 (or (cdr (assq number gnus-newsgroup-scored))
8871 gnus-summary-default-score))
8872 gnus-summary-expunge-below))
8873 ;; We increase the expunge-tally here, but that has
8874 ;; nothing to do with the limits, really.
8875 (incf gnus-newsgroup-expunged-tally)
8876 ;; We also mark as read here, if that's wanted.
8877 (when (and gnus-summary-mark-below
8878 (< score gnus-summary-mark-below))
8879 (setq gnus-newsgroup-unreads
8880 (delq number gnus-newsgroup-unreads))
8881 (if gnus-newsgroup-auto-expire
8882 (push number gnus-newsgroup-expirable)
8883 (push (cons number gnus-low-score-mark)
8884 gnus-newsgroup-reads)))
8886 ;; Do the `display' group parameter.
8887 (and gnus-newsgroup-display
8888 (let ((gnus-number number))
8889 (not (funcall gnus-newsgroup-display))))))
8890 ;; Nope, invisible article.
8892 ;; Ok, this article is to be visible, so we add it to the limit
8894 (push number gnus-newsgroup-limit)
8897 (defun gnus-expunge-thread (thread)
8898 "Mark all articles in THREAD as read."
8899 (let* ((number (mail-header-number (car thread))))
8900 (incf gnus-newsgroup-expunged-tally)
8901 ;; We also mark as read here, if that's wanted.
8902 (setq gnus-newsgroup-unreads
8903 (delq number gnus-newsgroup-unreads))
8904 (if gnus-newsgroup-auto-expire
8905 (push number gnus-newsgroup-expirable)
8906 (push (cons number gnus-low-score-mark)
8907 gnus-newsgroup-reads)))
8908 ;; Go recursively through all subthreads.
8909 (mapcar 'gnus-expunge-thread (cdr thread)))
8911 ;; Summary article oriented commands
8913 (defun gnus-summary-refer-parent-article (n)
8914 "Refer parent article N times.
8915 If N is negative, go to ancestor -N instead.
8916 The difference between N and the number of articles fetched is returned."
8920 (when (not (natnump n))
8925 (setq header (gnus-summary-article-header))
8926 (if (and (eq (mail-header-number header)
8927 (cdr gnus-article-current))
8928 (equal gnus-newsgroup-name
8929 (car gnus-article-current)))
8930 ;; If we try to find the parent of the currently
8931 ;; displayed article, then we take a look at the actual
8932 ;; References header, since this is slightly more
8933 ;; reliable than the References field we got from the
8935 (with-current-buffer gnus-original-article-buffer
8936 (nnheader-narrow-to-headers)
8937 (unless (setq ref (message-fetch-field "references"))
8938 (when (setq ref (message-fetch-field "in-reply-to"))
8939 (setq ref (gnus-extract-message-id-from-in-reply-to ref))))
8942 ;; It's not the current article, so we take a bet on
8943 ;; the value we got from the server.
8944 (mail-header-references header)))
8946 (not (equal ref "")))
8947 (unless (gnus-summary-refer-article (gnus-parent-id ref skip))
8948 (gnus-message 1 "Couldn't find parent"))
8949 (gnus-message 1 "No references in article %d"
8950 (gnus-summary-article-number))
8953 (gnus-summary-position-point)
8956 (defun gnus-summary-refer-references ()
8957 "Fetch all articles mentioned in the References header.
8958 Return the number of articles fetched."
8960 (let ((ref (mail-header-references (gnus-summary-article-header)))
8961 (current (gnus-summary-article-number))
8965 (error "No References in the current article")
8966 ;; For each Message-ID in the References header...
8967 (while (string-match "<[^>]*>" ref)
8969 ;; ... fetch that article.
8970 (gnus-summary-refer-article
8971 (prog1 (match-string 0 ref)
8972 (setq ref (substring ref (match-end 0))))))
8973 (gnus-summary-goto-subject current)
8974 (gnus-summary-position-point)
8977 (defun gnus-delete-duplicate-headers (headers)
8978 ;; First remove leading duplicates.
8979 (while (and (> (length headers) 1)
8980 (= (mail-header-number (car headers))
8981 (mail-header-number (cadr headers))))
8984 (let ((result headers))
8985 (while (> (length headers) 1)
8986 (if (= (mail-header-number (car headers))
8987 (mail-header-number (cadr headers)))
8988 (setcdr headers (cddr headers))
8992 (defun gnus-summary-refer-thread (&optional limit)
8993 "Fetch all articles in the current thread. For backends that
8994 know how to search for threads (currently only 'nnimap) a
8995 non-numeric prefix arg will use nnir to search the entire
8996 server; without a prefix arg only the current group is
8997 searched. If the variable `gnus-refer-thread-use-nnir' is
8998 non-nil the prefix arg has the reverse meaning. If no
8999 backend-specific 'request-thread function is available fetch
9000 LIMIT (the numerical prefix) old headers. If LIMIT is
9001 non-numeric or nil fetch the number specified by the
9002 `gnus-refer-thread-limit' variable."
9004 (gnus-warp-to-article)
9005 (let* ((header (gnus-summary-article-header))
9006 (id (mail-header-id header))
9007 (gnus-inhibit-demon t)
9008 (gnus-summary-ignore-duplicates t)
9009 (gnus-read-all-available-headers t)
9010 (gnus-refer-thread-use-nnir
9011 (if (and (not (null limit)) (listp limit))
9012 (not gnus-refer-thread-use-nnir) gnus-refer-thread-use-nnir))
9014 (if (gnus-check-backend-function
9015 'request-thread gnus-newsgroup-name)
9016 (gnus-request-thread header gnus-newsgroup-name)
9017 (let* ((limit (if (numberp limit) (prefix-numeric-value limit)
9018 gnus-refer-thread-limit))
9019 (last (if (numberp limit)
9020 (min (+ (mail-header-number header)
9022 gnus-newsgroup-highest)
9023 gnus-newsgroup-highest))
9024 (subject (gnus-simplify-subject
9025 (mail-header-subject header)))
9026 (refs (split-string (or (mail-header-references header)
9028 (gnus-parse-headers-hook
9029 `(lambda () (goto-char (point-min))
9031 (regexp-opt ',(append refs (list id subject)))))))
9032 (gnus-fetch-headers (list last) (if (numberp limit)
9033 (* 2 limit) limit) t))))
9035 (when (listp new-headers)
9036 (dolist (header new-headers)
9037 (push (mail-header-number header) article-ids)
9038 (when (member (mail-header-number header) gnus-newsgroup-unselected)
9039 (push (mail-header-number header) gnus-newsgroup-unreads)
9040 (setq gnus-newsgroup-unselected
9041 (delete (mail-header-number header)
9042 gnus-newsgroup-unselected))))
9043 (setq gnus-newsgroup-headers
9044 (gnus-delete-duplicate-headers
9046 'list gnus-newsgroup-headers new-headers
9047 'gnus-article-sort-by-number)))
9048 (setq gnus-newsgroup-articles
9049 (gnus-sorted-nunion gnus-newsgroup-articles (nreverse article-ids)))
9050 (gnus-summary-limit-include-thread id)))
9051 (gnus-summary-show-thread))
9053 (defun gnus-summary-refer-article (message-id)
9054 "Fetch an article specified by MESSAGE-ID."
9055 (interactive "sMessage-ID: ")
9056 (gnus-warp-to-article)
9057 (when (and (stringp message-id)
9058 (not (zerop (length message-id))))
9059 (setq message-id (gnus-replace-in-string message-id " " ""))
9060 ;; Construct the correct Message-ID if necessary.
9061 ;; Suggested by tale@pawl.rpi.edu.
9062 (unless (string-match "^<" message-id)
9063 (setq message-id (concat "<" message-id)))
9064 (unless (string-match ">$" message-id)
9065 (setq message-id (concat message-id ">")))
9066 ;; People often post MIDs from URLs, so unhex it:
9067 (unless (string-match "@" message-id)
9068 (setq message-id (gnus-url-unhex-string message-id)))
9069 (let* ((header (gnus-id-to-header message-id))
9071 (gnus-summary-article-sparse-p
9072 (mail-header-number header))
9073 (memq (mail-header-number header)
9074 gnus-newsgroup-limit)))
9077 ;; If the article is present in the buffer we just go to it.
9079 (or (not (gnus-summary-article-sparse-p
9080 (mail-header-number header)))
9083 (gnus-summary-goto-article
9084 (mail-header-number header) nil t)
9086 (gnus-summary-update-article (mail-header-number header)))))
9088 ;; We fetch the article.
9090 (dolist (gnus-override-method (gnus-refer-article-methods))
9091 (when (and (gnus-check-server gnus-override-method)
9092 ;; Fetch the header,
9093 (setq number (gnus-summary-insert-subject message-id)))
9094 ;; and display the article.
9095 (gnus-summary-select-article nil nil nil number)
9097 (gnus-message 3 "Couldn't fetch article %s" message-id)))))))
9099 (defun gnus-refer-article-methods ()
9100 "Return a list of referable methods."
9102 ;; No method, so we default to current and native.
9103 ((null gnus-refer-article-method)
9104 (list gnus-current-select-method gnus-select-method))
9106 ((eq 'current gnus-refer-article-method)
9107 (list gnus-current-select-method))
9108 ;; List of select methods.
9109 ((not (and (symbolp (car gnus-refer-article-method))
9110 (assq (car gnus-refer-article-method) nnoo-definition-alist)))
9112 (dolist (method gnus-refer-article-method)
9113 (push (if (eq 'current method)
9114 gnus-current-select-method
9115 (if (eq 'nnir (car method))
9119 (gnus-method-to-server gnus-current-select-method)))
9123 ;; One single select method.
9125 (list gnus-refer-article-method))))
9127 (defun gnus-summary-edit-parameters ()
9128 "Edit the group parameters of the current group."
9130 (gnus-group-edit-group gnus-newsgroup-name 'params))
9132 (defun gnus-summary-customize-parameters ()
9133 "Customize the group parameters of the current group."
9135 (gnus-group-customize gnus-newsgroup-name))
9137 (defun gnus-summary-enter-digest-group (&optional force)
9138 "Enter an nndoc group based on the current article.
9139 If FORCE, force a digest interpretation. If not, try to guess
9140 what the document format is.
9142 To control what happens when you exit the group, see the
9143 `gnus-auto-select-on-ephemeral-exit' variable."
9145 (let ((conf gnus-current-window-configuration))
9146 (save-window-excursion
9148 (let (gnus-article-prepare-hook
9149 gnus-display-mime-function
9151 (gnus-summary-select-article))))
9152 (setq gnus-current-window-configuration conf)
9153 (let* ((name (format "%s-%d"
9154 (gnus-group-prefixed-name
9155 gnus-newsgroup-name (list 'nndoc ""))
9156 (with-current-buffer gnus-summary-buffer
9157 gnus-current-article)))
9158 (ogroup gnus-newsgroup-name)
9159 (params (append (gnus-info-params (gnus-get-info ogroup))
9160 (list (cons 'to-group ogroup))
9161 (list (cons 'parent-group ogroup))
9162 (list (cons 'save-article-group ogroup))))
9163 (case-fold-search t)
9164 (buf (current-buffer))
9165 dig to-address charset)
9166 (with-current-buffer gnus-original-article-buffer
9167 ;; Have the digest group inherit the main mail address of
9168 ;; the parent article.
9169 (when (setq to-address (or (gnus-fetch-field "reply-to")
9170 (gnus-fetch-field "from")))
9173 (list (cons 'to-address
9174 (funcall gnus-decode-encoded-address-function
9176 (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
9177 (insert-buffer-substring gnus-original-article-buffer)
9179 (goto-char (point-min))
9180 (or (search-forward "\n\n" nil t) (point)))
9181 ;; Remove lines that may lead nndoc to misinterpret the
9183 (goto-char (point-min))
9184 (delete-matching-lines "^Path:\\|^From ")
9185 ;; Parse charset, and decode content transfer encoding.
9186 (setq charset (mail-content-type-get
9187 (mail-header-parse-content-type
9188 (or (gnus-fetch-field "content-type") ""))
9190 (let ((encoding (gnus-fetch-field "content-transfer-encoding")))
9192 (message-remove-header "content-transfer-encoding")
9193 (goto-char (point-max))
9195 (narrow-to-region (point) (point-max))
9196 (mm-decode-content-transfer-encoding
9197 (intern (downcase (mail-header-strip encoding))))))
9200 (if (let ((gnus-newsgroup-ephemeral-charset
9202 (intern (downcase (gnus-strip-whitespace charset)))
9203 gnus-newsgroup-charset))
9204 (gnus-newsgroup-ephemeral-ignored-charsets
9205 gnus-newsgroup-ignored-charsets))
9206 (gnus-group-read-ephemeral-group
9207 name `(nndoc ,name (nndoc-address ,(get-buffer dig))
9209 ,(if force 'mbox 'guess)))
9211 `((adapt-file . ,(gnus-score-file-name gnus-newsgroup-name
9213 ;; Make all postings to this group go to the parent group.
9214 (nconc (gnus-info-params (gnus-get-info name))
9216 ;; Couldn't select this doc group.
9217 (switch-to-buffer buf)
9218 (gnus-set-global-variables)
9219 (gnus-configure-windows 'summary)
9220 (gnus-message 3 "Article couldn't be entered?"))
9221 (kill-buffer dig)))))
9223 (defun gnus-summary-read-document (n)
9224 "Open a new group based on the current article(s).
9225 This will allow you to read digests and other similar
9226 documents as newsgroups.
9227 Obeys the standard process/prefix convention."
9229 (let* ((ogroup gnus-newsgroup-name)
9230 (params (append (gnus-info-params (gnus-get-info ogroup))
9231 (list (cons 'to-group ogroup))))
9232 group egroup groups vgroup)
9233 (dolist (article (gnus-summary-work-articles n))
9234 (setq group (format "%s-%d" gnus-newsgroup-name article))
9235 (gnus-summary-remove-process-mark article)
9236 (when (gnus-summary-display-article article)
9237 (save-excursion ;;What for?
9239 (insert-buffer-substring gnus-original-article-buffer)
9240 ;; Remove some headers that may lead nndoc to make
9242 (message-narrow-to-head)
9243 (goto-char (point-min))
9244 (delete-matching-lines "^Path:\\|^From ")
9247 (gnus-group-read-ephemeral-group
9248 group `(nndoc ,group (nndoc-address ,(current-buffer))
9249 (nndoc-article-type guess))
9252 ;; Make all postings to this group go to the parent group.
9253 (nconc (gnus-info-params (gnus-get-info egroup))
9255 (push egroup groups))
9256 ;; Couldn't select this doc group.
9257 (gnus-error 3 "Article couldn't be entered"))))))
9258 ;; Now we have selected all the documents.
9261 (error "None of the articles could be interpreted as documents"))
9262 ((gnus-group-read-ephemeral-group
9263 (setq vgroup (format
9264 "nnvirtual:%s-%s" gnus-newsgroup-name
9265 (format-time-string "%Y%m%dT%H%M%S" (current-time))))
9266 `(nnvirtual ,vgroup (nnvirtual-component-groups ,groups))
9268 (cons (current-buffer) 'summary)))
9270 (error "Couldn't select virtual nndoc group")))))
9272 (defun gnus-summary-widget-forward (arg)
9273 "Move point to the next field or button in the article.
9274 With optional ARG, move across that many fields."
9276 (gnus-summary-select-article)
9277 (gnus-configure-windows 'article)
9278 (select-window (gnus-get-buffer-window gnus-article-buffer))
9279 (widget-forward arg))
9281 (defun gnus-summary-widget-backward (arg)
9282 "Move point to the previous field or button in the article.
9283 With optional ARG, move across that many fields."
9285 (gnus-summary-select-article)
9286 (gnus-configure-windows 'article)
9287 (select-window (gnus-get-buffer-window gnus-article-buffer))
9288 (unless (widget-at (point))
9289 (goto-char (point-max)))
9290 (widget-backward arg))
9292 (defun gnus-summary-isearch-article (&optional regexp-p)
9293 "Do incremental search forward on the current article.
9294 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
9296 (gnus-summary-select-article)
9297 (gnus-configure-windows 'article)
9298 (gnus-eval-in-buffer-window gnus-article-buffer
9301 (isearch-forward regexp-p))))
9303 (defun gnus-summary-repeat-search-article-forward ()
9304 "Repeat the previous search forwards."
9306 (unless gnus-last-search-regexp
9307 (error "No previous search"))
9308 (gnus-summary-search-article-forward gnus-last-search-regexp))
9310 (defun gnus-summary-repeat-search-article-backward ()
9311 "Repeat the previous search backwards."
9313 (unless gnus-last-search-regexp
9314 (error "No previous search"))
9315 (gnus-summary-search-article-forward gnus-last-search-regexp t))
9317 (defun gnus-summary-search-article-forward (regexp &optional backward)
9318 "Search for an article containing REGEXP forward.
9319 If BACKWARD, search backward instead."
9322 (format "Search article %s (regexp%s): "
9323 (if current-prefix-arg "backward" "forward")
9324 (if gnus-last-search-regexp
9325 (concat ", default " gnus-last-search-regexp)
9327 current-prefix-arg))
9328 (if (string-equal regexp "")
9329 (setq regexp (or gnus-last-search-regexp ""))
9330 (setq gnus-last-search-regexp regexp)
9331 (setq gnus-article-before-search gnus-current-article))
9332 ;; Intentionally set gnus-last-article.
9333 (setq gnus-last-article gnus-article-before-search)
9334 (let ((gnus-last-article gnus-last-article))
9335 (if (gnus-summary-search-article regexp backward)
9336 (gnus-summary-show-thread)
9337 (signal 'search-failed (list regexp)))))
9339 (defun gnus-summary-search-article-backward (regexp)
9340 "Search for an article containing REGEXP backward."
9343 (format "Search article backward (regexp%s): "
9344 (if gnus-last-search-regexp
9345 (concat ", default " gnus-last-search-regexp)
9347 (gnus-summary-search-article-forward regexp 'backward))
9349 (defun gnus-summary-search-article (regexp &optional backward)
9350 "Search for an article containing REGEXP.
9351 Optional argument BACKWARD means do search for backward.
9352 `gnus-select-article-hook' is not called during the search."
9353 ;; We have to require this here to make sure that the following
9354 ;; dynamic binding isn't shadowed by autoloading.
9355 (require 'gnus-async)
9357 (let ((gnus-select-article-hook nil) ;Disable hook.
9358 (gnus-article-prepare-hook nil)
9359 (gnus-mark-article-hook nil) ;Inhibit marking as read.
9360 (gnus-use-article-prefetch nil)
9361 (gnus-xmas-force-redisplay nil) ;Inhibit XEmacs redisplay.
9362 (gnus-use-trees nil) ;Inhibit updating tree buffer.
9364 (gnus-keep-backlog nil)
9365 (gnus-break-pages nil)
9366 (gnus-summary-display-arrow nil)
9367 (gnus-updated-mode-lines nil)
9368 (gnus-auto-center-summary nil)
9369 (sum (current-buffer))
9370 (gnus-display-mime-function nil)
9373 (gnus-save-hidden-threads
9374 (gnus-summary-select-article)
9375 (set-buffer gnus-article-buffer)
9376 (goto-char (window-point (get-buffer-window (current-buffer))))
9380 (gnus-message 7 "Searching article: %d..." (cdr gnus-article-current))
9382 (re-search-backward regexp nil t)
9383 (re-search-forward regexp nil t))
9384 ;; We found the regexp.
9389 (get-buffer-window (current-buffer))
9393 (get-buffer-window (current-buffer))
9396 (setq point (point)))
9397 ;; We didn't find it, so we go to the next article.
9400 (while (eq found 'not)
9401 (if (not (if backward (gnus-summary-find-prev)
9402 (gnus-summary-find-next)))
9403 ;; No more articles.
9405 ;; Select the next article and adjust point.
9406 (unless (gnus-summary-article-sparse-p
9407 (gnus-summary-article-number))
9409 (gnus-summary-select-article)
9410 (set-buffer gnus-article-buffer)
9412 (goto-char (if backward (point-max) (point-min))))))))
9413 (gnus-message 7 ""))
9414 ;; Return whether we found the regexp.
9415 (when (eq found 'found)
9417 (gnus-summary-show-thread)
9418 (gnus-summary-goto-subject gnus-current-article)
9419 (gnus-summary-position-point)
9422 (defun gnus-find-matching-articles (header regexp)
9423 "Return a list of all articles that match REGEXP on HEADER.
9424 This search includes all articles in the current group that Gnus has
9425 fetched headers for, whether they are displayed or not."
9426 (let ((articles nil)
9427 ;; Can't eta-reduce because it's a macro.
9428 (func `(lambda (h) (,(intern (concat "mail-header-" header)) h)))
9429 (case-fold-search t))
9430 (dolist (header gnus-newsgroup-headers)
9431 (when (string-match regexp (funcall func header))
9432 (push (mail-header-number header) articles)))
9433 (nreverse articles)))
9435 (defun gnus-summary-find-matching (header regexp &optional backward unread
9436 not-case-fold not-matching)
9437 "Return a list of all articles that match REGEXP on HEADER.
9438 The search stars on the current article and goes forwards unless
9439 BACKWARD is non-nil. If BACKWARD is `all', do all articles.
9440 If UNREAD is non-nil, only unread articles will
9441 be taken into consideration. If NOT-CASE-FOLD, case won't be folded
9442 in the comparisons. If NOT-MATCHING, return a list of all articles that
9443 not match REGEXP on HEADER."
9444 (let ((case-fold-search (not not-case-fold))
9447 (if (eq (car header) 'extra)
9450 (or (cdr (assq ',(cdr header) (mail-header-extra h)))
9452 (error "%s is an invalid header" header))
9453 (unless (fboundp (intern (concat "mail-header-" header)))
9454 (error "%s is not a valid header" header))
9455 (setq func `(lambda (h) (,(intern (concat "mail-header-" header)) h))))
9456 (dolist (d (if (eq backward 'all)
9458 (gnus-data-find-list
9459 (gnus-summary-article-number)
9460 (gnus-data-list backward))))
9461 (when (and (or (not unread) ; We want all articles...
9462 (gnus-data-unread-p d)) ; Or just unreads.
9463 (vectorp (gnus-data-header d)) ; It's not a pseudo.
9467 (funcall func (gnus-data-header d))))
9468 (string-match regexp
9469 (funcall func (gnus-data-header d)))))
9470 (push (gnus-data-number d) articles))) ; Success!
9471 (nreverse articles)))
9473 (defun gnus-summary-execute-command (header regexp command &optional backward)
9474 "Search forward for an article whose HEADER matches REGEXP and execute COMMAND.
9475 If HEADER is an empty string (or nil), the match is done on the entire
9476 article. If BACKWARD (the prefix) is non-nil, search backward instead."
9478 (list (let ((completion-ignore-case t))
9479 (gnus-completing-read
9481 (mapcar 'symbol-name
9483 '(Number Subject From Lines Date
9484 Message-ID Xref References Body)
9485 gnus-extra-headers))
9487 (read-string "Regexp: ")
9488 (read-key-sequence "Command: ")
9489 current-prefix-arg))
9490 (when (equal header "Body")
9492 ;; Hidden thread subtrees must be searched as well.
9493 (gnus-summary-show-all-threads)
9494 ;; We don't want to change current point nor window configuration.
9496 (save-window-excursion
9498 gnus-treat-strip-trailing-blank-lines
9499 gnus-treat-strip-leading-blank-lines
9500 gnus-treat-strip-multiple-blank-lines
9501 gnus-treat-hide-boring-headers
9502 gnus-treat-fold-newsgroups
9503 gnus-article-prepare-hook)
9504 (gnus-message 6 "Executing %s..." (key-description command))
9505 ;; We'd like to execute COMMAND interactively so as to give arguments.
9506 (gnus-execute header regexp
9507 `(call-interactively ',(key-binding command))
9509 (gnus-message 6 "Executing %s...done" (key-description command))))))
9511 (defun gnus-summary-beginning-of-article ()
9512 "Scroll the article back to the beginning."
9514 (gnus-summary-select-article)
9515 (gnus-configure-windows 'article)
9516 (gnus-eval-in-buffer-window gnus-article-buffer
9518 (goto-char (point-min))
9519 (when gnus-break-pages
9520 (gnus-narrow-to-page))))
9522 (defun gnus-summary-end-of-article ()
9523 "Scroll to the end of the article."
9525 (gnus-summary-select-article)
9526 (gnus-configure-windows 'article)
9527 (gnus-eval-in-buffer-window gnus-article-buffer
9529 (goto-char (point-max))
9531 (when gnus-break-pages
9532 (gnus-narrow-to-page))))
9534 (defun gnus-summary-print-truncate-and-quote (string &optional len)
9535 "Truncate to LEN and quote all \"(\"'s in STRING."
9536 (gnus-replace-in-string (if (and len (> (length string) len))
9537 (substring string 0 len)
9541 (defun gnus-summary-print-article (&optional filename n)
9542 "Generate and print a PostScript image of the process-marked (mail) articles.
9544 If used interactively, print the current article if none are
9545 process-marked. With prefix arg, prompt the user for the name of the
9548 When used from Lisp, accept two optional args FILENAME and N. N means
9549 to print the next N articles. If N is negative, print the N previous
9550 articles. If N is nil and articles have been marked with the process
9551 mark, print these instead.
9553 If the optional first argument FILENAME is nil, send the image to the
9554 printer. If FILENAME is a string, save the PostScript image in a file with
9555 that name. If FILENAME is a number, prompt the user for the name of the file
9557 (interactive (list (ps-print-preprint current-prefix-arg)))
9558 (dolist (article (gnus-summary-work-articles n))
9559 (gnus-summary-select-article nil nil 'pseudo article)
9560 (gnus-eval-in-buffer-window gnus-article-buffer
9561 (gnus-print-buffer))
9562 (gnus-summary-remove-process-mark article))
9563 (ps-despool filename))
9565 (defun gnus-print-buffer ()
9566 (let ((ps-left-header
9569 (gnus-summary-print-truncate-and-quote
9570 (mail-header-subject gnus-current-headers)
9573 (gnus-summary-print-truncate-and-quote
9574 (mail-header-from gnus-current-headers)
9578 "/pagenumberstring load"
9580 (mail-header-date gnus-current-headers) ")"))))
9581 (gnus-run-hooks 'gnus-ps-print-hook)
9583 (if ps-print-color-p
9584 (ps-spool-buffer-with-faces)
9585 (ps-spool-buffer)))))
9587 (declare-function gnus-flush-original-article-buffer "gnus-art" ())
9589 (defun gnus-summary-show-complete-article ()
9590 "Show a complete version of the current article.
9591 This is only useful if you're looking at a partial version of the
9594 (let ((gnus-keep-backlog nil)
9595 (gnus-use-cache nil)
9598 (format "%s-fetch-partial-articles"
9599 (car (gnus-find-method-for-group
9600 gnus-newsgroup-name)))
9605 (setq old-val (symbol-value variable))
9607 (gnus-flush-original-article-buffer)
9608 (gnus-summary-show-article))
9609 (set variable old-val))))
9611 (defun gnus-summary-show-article (&optional arg)
9612 "Force redisplaying of the current article.
9613 If ARG (the prefix) is a number, show the article with the charset
9614 defined in `gnus-summary-show-article-charset-alist', or the charset
9616 If ARG (the prefix) is non-nil and not a number, show the article,
9617 but without running any of the article treatment functions
9618 article. Normally, the keystroke is `C-u g'. When using `C-u
9619 C-u g', show the raw article."
9623 (gnus-summary-show-article t)
9624 (let ((gnus-newsgroup-charset
9625 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
9626 (mm-read-coding-system
9627 "View as charset: " ;; actually it is coding system.
9628 (with-current-buffer gnus-article-buffer
9629 (mm-detect-coding-region (point) (point-max))))))
9630 (gnus-newsgroup-ignored-charsets 'gnus-all))
9631 (gnus-summary-select-article nil 'force)
9632 (let ((deps gnus-newsgroup-dependencies)
9634 (with-current-buffer gnus-original-article-buffer
9636 (message-narrow-to-head)
9637 (setq head (buffer-string))
9638 (goto-char (point-min))
9639 (unless (re-search-forward "^lines:[ \t]\\([0-9]+\\)" nil t)
9640 (goto-char (point-max))
9642 (setq lines (1- (count-lines (point) (point-max))))))
9644 (insert (format "211 %d Article retrieved.\n"
9645 (cdr gnus-article-current)))
9647 (if lines (insert (format "Lines: %d\n" lines)))
9649 (let ((nntp-server-buffer (current-buffer)))
9650 (setq header (car (gnus-get-newsgroup-headers deps t))))))
9651 (gnus-data-set-header
9652 (gnus-data-find (cdr gnus-article-current))
9654 (gnus-summary-update-article-line
9655 (cdr gnus-article-current) header)
9656 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
9657 (gnus-summary-update-secondary-mark (cdr gnus-article-current))))))
9659 ;; Select the article the normal way.
9660 (if (eq mm-text-html-renderer 'shr)
9663 (let ((shr-ignore-cache t))
9664 (gnus-summary-select-article nil 'force)))
9665 (gnus-summary-select-article nil 'force)))
9668 (let ((gnus-inhibit-article-treatments t))
9669 (gnus-summary-select-article nil 'force)))
9671 ;; We have to require this here to make sure that the following
9672 ;; dynamic binding isn't shadowed by autoloading.
9673 (require 'gnus-async)
9675 ;; Bind the article treatment functions to nil.
9676 (let ((gnus-have-all-headers t)
9677 gnus-article-prepare-hook
9678 gnus-article-decode-hook
9679 gnus-display-mime-function
9681 ;; Destroy any MIME parts.
9682 (when (gnus-buffer-live-p gnus-article-buffer)
9683 (with-current-buffer gnus-article-buffer
9684 (gnus-article-stop-animations)
9685 (gnus-stop-downloads)
9686 (mm-destroy-parts gnus-article-mime-handles)
9687 ;; Set it to nil for safety reason.
9688 (setq gnus-article-mime-handle-alist nil)
9689 (setq gnus-article-mime-handles nil)))
9690 (gnus-summary-select-article nil 'force))))
9691 (gnus-summary-goto-subject gnus-current-article)
9692 (gnus-summary-position-point))
9694 (defun gnus-summary-show-raw-article ()
9695 "Show the raw article without any article massaging functions being run."
9697 (gnus-summary-show-article t))
9699 (defun gnus-summary-verbose-headers (&optional arg)
9700 "Toggle permanent full header display.
9701 If ARG is a positive number, turn header display on.
9702 If ARG is a negative number, turn header display off."
9704 (setq gnus-show-all-headers
9705 (cond ((or (not (numberp arg))
9707 (not gnus-show-all-headers))
9710 (gnus-summary-show-article))
9712 (declare-function article-narrow-to-head "gnus-art" ())
9713 (declare-function gnus-article-hidden-text-p "gnus-art" (type))
9714 (declare-function gnus-delete-wash-type "gnus-art" (type))
9716 (defun gnus-summary-toggle-header (&optional arg)
9717 "Show the headers if they are hidden, or hide them if they are shown.
9718 If ARG is a positive number, show the entire header.
9719 If ARG is a negative number, hide the unwanted header lines."
9721 (let ((window (and (gnus-buffer-live-p gnus-article-buffer)
9722 (get-buffer-window gnus-article-buffer t))))
9723 (with-current-buffer gnus-article-buffer
9725 (article-narrow-to-head)
9726 (let* ((inhibit-read-only t)
9727 (inhibit-point-motion-hooks t)
9728 (hidden (if (numberp arg)
9730 (or (not (looking-at "[^ \t\n]+:"))
9731 (gnus-article-hidden-text-p 'headers))))
9733 (delete-region (point-min) (point-max))
9734 (with-current-buffer gnus-original-article-buffer
9735 (goto-char (setq s (point-min)))
9736 (setq e (if (search-forward "\n\n" nil t)
9739 (insert-buffer-substring gnus-original-article-buffer s e)
9740 (run-hooks 'gnus-article-decode-hook)
9742 (let ((gnus-treat-hide-headers nil)
9743 (gnus-treat-hide-boring-headers nil))
9744 (gnus-delete-wash-type 'headers)
9745 (gnus-treat-article 'head))
9746 (gnus-treat-article 'head))
9749 (set-window-start window (goto-char (point-min))))
9750 (if gnus-break-pages
9751 (gnus-narrow-to-page)
9752 (when (gnus-visual-p 'page-marker)
9753 (let ((inhibit-read-only t))
9754 (gnus-remove-text-with-property 'gnus-prev)
9755 (gnus-remove-text-with-property 'gnus-next))))
9756 (gnus-set-mode-line 'article)))))
9758 (defun gnus-summary-show-all-headers ()
9759 "Make all header lines visible."
9761 (gnus-summary-toggle-header 1))
9763 (defun gnus-summary-caesar-message (&optional arg)
9764 "Caesar rotate the current article by 13.
9765 With a non-numerical prefix, also rotate headers. A numerical
9766 prefix specifies how many places to rotate each letter forward."
9768 (gnus-summary-select-article)
9769 (let ((mail-header-separator ""))
9770 (gnus-eval-in-buffer-window gnus-article-buffer
9773 (let ((start (window-start))
9774 (inhibit-read-only t))
9775 (if (equal arg '(4))
9776 (message-caesar-buffer-body nil t)
9777 (message-caesar-buffer-body arg))
9778 (set-window-start (get-buffer-window (current-buffer)) start)))))
9779 ;; Create buttons and stuff...
9780 (gnus-treat-article nil))
9782 (declare-function idna-to-unicode "ext:idna" (str))
9784 (defun gnus-summary-idna-message (&optional arg)
9785 "Decode IDNA encoded domain names in the current articles.
9786 IDNA encoded domain names looks like `xn--bar'. If a string
9787 remain unencoded after running this function, it is likely an
9788 invalid IDNA string (`xn--bar' is invalid).
9790 You must have GNU Libidn (URL `http://www.gnu.org/software/libidn/')
9791 installed for this command to work."
9793 (if (not (and (condition-case nil (require 'idna)
9795 (mm-coding-system-p 'utf-8)
9796 (executable-find (symbol-value 'idna-program))))
9798 5 "GNU Libidn not installed properly (`idn' or `idna.el' missing)")
9799 (gnus-summary-select-article)
9800 (let ((mail-header-separator ""))
9801 (gnus-eval-in-buffer-window gnus-article-buffer
9804 (let ((start (window-start))
9806 (while (re-search-forward "\\(xn--[-0-9a-z]+\\)" nil t)
9807 (replace-match (idna-to-unicode (match-string 1))))
9808 (set-window-start (get-buffer-window (current-buffer)) start)))))))
9810 (defun gnus-summary-morse-message (&optional arg)
9811 "Morse decode the current article."
9813 (gnus-summary-select-article)
9814 (let ((mail-header-separator ""))
9815 (gnus-eval-in-buffer-window gnus-article-buffer
9819 (let ((pos (window-start))
9820 (inhibit-read-only t))
9821 (goto-char (point-min))
9822 (when (message-goto-body)
9823 (gnus-narrow-to-body))
9824 (goto-char (point-min))
9825 (while (search-forward "·" (point-max) t)
9826 (replace-match "."))
9827 (unmorse-region (point-min) (point-max))
9829 (set-window-start (get-buffer-window (current-buffer)) pos)))))))
9831 (defun gnus-summary-stop-page-breaking ()
9832 "Stop page breaking in the current article."
9834 (gnus-summary-select-article)
9835 (gnus-eval-in-buffer-window gnus-article-buffer
9837 (when (gnus-visual-p 'page-marker)
9838 (let ((inhibit-read-only t))
9839 (gnus-remove-text-with-property 'gnus-prev)
9840 (gnus-remove-text-with-property 'gnus-next))
9841 (setq gnus-page-broken nil))))
9843 (defun gnus-summary-move-article (&optional n to-newsgroup
9844 select-method action)
9845 "Move the current article to a different newsgroup.
9846 If N is a positive number, move the N next articles.
9847 If N is a negative number, move the N previous articles.
9848 If N is nil and any articles have been marked with the process mark,
9849 move those articles instead.
9850 If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to.
9851 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
9852 re-spool using this method.
9854 When called interactively with TO-NEWSGROUP being nil, the value of
9855 the variable `gnus-move-split-methods' is used for finding a default
9856 for the target newsgroup.
9858 For this function to work, both the current newsgroup and the
9859 newsgroup that you want to move to have to support the `request-move'
9860 and `request-accept' functions.
9862 ACTION can be either `move' (the default), `crosspost' or `copy'."
9865 (setq action 'move))
9866 ;; Check whether the source group supports the required functions.
9867 (cond ((and (eq action 'move)
9868 (not (gnus-check-backend-function
9869 'request-move-article gnus-newsgroup-name)))
9870 (error "The current group does not support article moving"))
9871 ((and (eq action 'crosspost)
9872 (not (gnus-check-backend-function
9873 'request-replace-article gnus-newsgroup-name)))
9874 (error "The current group does not support article editing")))
9875 (let ((articles (gnus-summary-work-articles n))
9876 (prefix (if (gnus-check-backend-function
9877 'request-move-article gnus-newsgroup-name)
9878 (funcall gnus-move-group-prefix-function
9879 gnus-newsgroup-name)
9881 (names '((move "Move" "Moving")
9882 (copy "Copy" "Copying")
9883 (crosspost "Crosspost" "Crossposting")))
9884 (copy-buf (save-excursion
9885 (nnheader-set-temp-buffer " *copy article*")))
9886 art-group to-method new-xref article to-groups
9887 articles-to-update-marks encoded)
9888 (unless (assq action names)
9889 (error "Unknown action %s" action))
9890 ;; Read the newsgroup name.
9891 (when (and (not to-newsgroup)
9892 (not select-method))
9893 (if (and gnus-move-split-methods
9895 (and (memq gnus-current-article articles)
9896 (gnus-buffer-live-p gnus-original-article-buffer))))
9897 ;; When `gnus-move-split-methods' is non-nil, we have to
9898 ;; select an article to give `gnus-read-move-group-name' an
9899 ;; opportunity to suggest an appropriate default. However,
9900 ;; we needn't render or mark the article.
9901 (let ((gnus-display-mime-function nil)
9902 (gnus-article-prepare-hook nil)
9903 (gnus-mark-article-hook nil))
9904 (gnus-summary-select-article nil nil nil (car articles))))
9905 (setq to-newsgroup (gnus-read-move-group-name
9906 (cadr (assq action names))
9908 (intern (format "gnus-current-%s-group" action)))
9910 encoded to-newsgroup
9911 to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
9912 (set (intern (format "gnus-current-%s-group" action))
9913 (mm-decode-coding-string
9915 (gnus-group-name-charset to-method to-newsgroup))))
9917 (setq to-method (or select-method
9918 (gnus-server-to-method
9919 (gnus-group-method to-newsgroup)))))
9923 (mm-encode-coding-string
9925 (gnus-group-name-charset to-method to-newsgroup)))))
9926 ;; Check the method we are to move this article to...
9927 (unless (gnus-check-backend-function
9928 'request-accept-article (car to-method))
9929 (error "%s does not support article copying" (car to-method)))
9930 (unless (gnus-check-server to-method)
9931 (error "Can't open server %s" (car to-method)))
9932 (gnus-message 6 "%s to %s: %s..."
9933 (caddr (assq action names))
9934 (or (car select-method)
9935 (gnus-group-decoded-name to-newsgroup))
9938 (setq article (pop articles))
9939 ;; Set any marks that may have changed in the summary buffer.
9940 (when gnus-preserve-marks
9941 (gnus-summary-push-marks-to-backend article))
9945 ;; Move the article.
9947 ;; Remove this article from future suppression.
9948 (gnus-dup-unsuppress-article article)
9949 (let* ((from-method (gnus-find-method-for-group
9950 gnus-newsgroup-name))
9951 (to-method (or select-method
9952 (gnus-find-method-for-group to-newsgroup)))
9953 (move-is-internal (gnus-server-equal from-method to-method)))
9954 (gnus-request-move-article
9955 article ; Article to move
9956 gnus-newsgroup-name ; From newsgroup
9957 (nth 1 (gnus-find-method-for-group
9958 gnus-newsgroup-name)) ; Server
9959 (list 'gnus-request-accept-article
9960 to-newsgroup (list 'quote select-method)
9961 (not articles) t) ; Accept form
9962 (not articles) ; Only save nov last time
9963 (and move-is-internal
9964 to-newsgroup ; Not respooling
9965 ; Is this move internal?
9966 (gnus-group-real-name to-newsgroup)))))
9967 ;; Copy the article.
9969 (with-current-buffer copy-buf
9970 (when (gnus-request-article-this-buffer article
9971 gnus-newsgroup-name)
9973 (nnheader-narrow-to-headers)
9974 (dolist (hdr gnus-copy-article-ignored-headers)
9975 (message-remove-header hdr t)))
9976 (gnus-request-accept-article
9977 to-newsgroup select-method (not articles) t))))
9978 ;; Crosspost the article.
9979 ((eq action 'crosspost)
9980 (let ((xref (message-tokenize-header
9981 (mail-header-xref (gnus-summary-article-header
9984 (setq new-xref (concat (gnus-group-real-name gnus-newsgroup-name)
9985 ":" (number-to-string article)))
9987 (setq xref (list (system-name))))
9990 (mapconcat 'identity
9991 (delete "Xref:" (delete new-xref xref))
9994 (with-current-buffer copy-buf
9995 ;; First put the article in the destination group.
9996 (gnus-request-article-this-buffer article gnus-newsgroup-name)
9997 (when (consp (setq art-group
9998 (gnus-request-accept-article
9999 to-newsgroup select-method (not articles)
10001 (setq new-xref (concat new-xref " " (car art-group)
10003 (number-to-string (cdr art-group))))
10004 ;; Now we have the new Xrefs header, so we insert
10005 ;; it and replace the new article.
10006 (nnheader-replace-header "Xref" new-xref)
10007 (gnus-request-replace-article
10008 (cdr art-group) to-newsgroup (current-buffer) t)
10012 (gnus-message 1 "Couldn't %s article %s: %s"
10013 (cadr (assq action names)) article
10014 (nnheader-get-report (car to-method))))
10015 ((eq art-group 'junk)
10016 (when (eq action 'move)
10017 (gnus-summary-mark-article article gnus-canceled-mark)
10018 (gnus-message 4 "Deleted article %s" article)
10019 ;; run the delete hook
10020 (run-hook-with-args 'gnus-summary-article-delete-hook
10023 (assoc article (gnus-data-list nil)))
10024 gnus-newsgroup-name nil
10027 (let* ((pto-group (gnus-group-prefixed-name
10028 (car art-group) to-method))
10029 (info (gnus-get-info pto-group))
10030 (to-group (gnus-info-group info))
10032 ;; Update the group that has been moved to.
10034 (memq action '(move copy)))
10035 (unless (member to-group to-groups)
10036 (push to-group to-groups))
10038 (when (and (not (memq article gnus-newsgroup-unreads))
10040 (push 'read to-marks)
10041 (gnus-info-set-read
10042 info (gnus-add-to-range (gnus-info-read info)
10043 (list (cdr art-group)))))
10045 ;; See whether the article is to be put in the cache.
10046 (let* ((expirable (gnus-group-auto-expirable-p to-group))
10047 (marks (if expirable
10048 gnus-article-mark-lists
10049 (delete '(expirable . expire)
10051 gnus-article-mark-lists))))
10052 (to-article (cdr art-group)))
10054 ;; Enter the article into the cache in the new group,
10055 ;; if that is required.
10056 (when (and to-article
10058 (gnus-cache-possibly-enter-article
10059 to-group to-article
10060 (memq article gnus-newsgroup-marked)
10061 (memq article gnus-newsgroup-dormant)
10062 (memq article gnus-newsgroup-unreads)))
10064 (when (and gnus-preserve-marks
10066 ;; Copy any marks over to the new group.
10067 (when (and (equal to-group gnus-newsgroup-name)
10068 (not (memq article gnus-newsgroup-unreads)))
10069 ;; Mark this article as read in this group.
10070 (push (cons to-article gnus-read-mark)
10071 gnus-newsgroup-reads)
10072 ;; Increase the active status of this group.
10073 (setcdr (gnus-active to-group) to-article)
10074 (setcdr gnus-newsgroup-active to-article))
10077 (when (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10078 (when (memq article (symbol-value
10079 (intern (format "gnus-newsgroup-%s"
10081 (push (cdar marks) to-marks)
10082 ;; If the other group is the same as this group,
10083 ;; then we have to add the mark to the list.
10084 (when (equal to-group gnus-newsgroup-name)
10085 (set (intern (format "gnus-newsgroup-%s"
10089 (intern (format "gnus-newsgroup-%s"
10091 ;; Copy the marks to other group.
10092 (gnus-add-marked-articles
10093 to-group (cdar marks) (list to-article) info)))
10094 (setq marks (cdr marks)))
10096 (when (and expirable
10097 gnus-mark-copied-or-moved-articles-as-expirable
10098 (not (memq 'expire to-marks)))
10099 ;; Mark this article as expirable.
10100 (push 'expire to-marks)
10101 (when (equal to-group gnus-newsgroup-name)
10102 (push to-article gnus-newsgroup-expirable))
10103 ;; Copy the expirable mark to other group.
10104 (gnus-add-marked-articles
10105 to-group 'expire (list to-article) info))
10107 (when (and to-marks
10108 (gnus-method-option-p
10109 (gnus-find-method-for-group to-group)
10111 (gnus-request-set-mark
10112 to-group (list (list (list to-article) 'add to-marks)))))
10114 (gnus-dribble-enter
10115 (concat "(gnus-group-set-info '"
10116 (gnus-prin1-to-string (gnus-get-info to-group))
10118 (concat "^(gnus-group-set-info '(\""
10119 (regexp-quote to-group) "\""))))
10121 ;; Update the Xref header in this article to point to
10122 ;; the new crossposted article we have just created.
10123 (when (eq action 'crosspost)
10124 (with-current-buffer copy-buf
10125 (gnus-request-article-this-buffer article gnus-newsgroup-name)
10126 (nnheader-replace-header "Xref" new-xref)
10127 (gnus-request-replace-article
10128 article gnus-newsgroup-name (current-buffer) t)))
10130 ;; run the move/copy/crosspost/respool hook
10131 (run-hook-with-args 'gnus-summary-article-move-hook
10134 (assoc article (gnus-data-list nil)))
10135 gnus-newsgroup-name
10139 ;;;!!!Why is this necessary?
10140 (set-buffer gnus-summary-buffer)
10142 (when (eq action 'move)
10144 (gnus-summary-goto-subject article)
10145 (gnus-summary-mark-article article gnus-canceled-mark)))))
10146 (push article articles-to-update-marks))
10149 (apply 'gnus-summary-remove-process-mark articles-to-update-marks))
10150 ;; Re-activate all groups that have been moved to.
10151 (with-current-buffer gnus-group-buffer
10152 (let ((gnus-group-marked to-groups))
10153 (gnus-group-get-new-news-this-group nil t)))
10155 (gnus-kill-buffer copy-buf)
10156 (gnus-summary-position-point)
10157 (gnus-set-mode-line 'summary)))
10159 (defun gnus-summary-push-marks-to-backend (article)
10162 (marks gnus-article-mark-lists))
10163 (unless (memq article gnus-newsgroup-unreads)
10166 (if (and (eq (gnus-article-mark-to-type (cdar marks)) 'list)
10167 (memq article (symbol-value
10168 (intern (format "gnus-newsgroup-%s"
10170 (push (cdar marks) set)
10171 (push (cdar marks) del))
10173 (gnus-request-set-mark gnus-newsgroup-name `(((,article) set ,set)
10174 ((,article) del ,del)))))
10176 (defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
10177 "Copy the current article to some other group.
10178 If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
10179 When called interactively, if TO-NEWSGROUP is nil, use the value of
10180 the variable `gnus-move-split-methods' for finding a default target
10182 If SELECT-METHOD is non-nil, do not move to a specific newsgroup, but
10183 re-spool using this method."
10185 (gnus-summary-move-article n to-newsgroup select-method 'copy))
10187 (defun gnus-summary-crosspost-article (&optional n)
10188 "Crosspost the current article to some other group."
10190 (gnus-summary-move-article n nil nil 'crosspost))
10192 (defcustom gnus-summary-respool-default-method nil
10193 "Default method type for respooling an article.
10194 If nil, use to the current newsgroup method."
10196 :group 'gnus-summary-mail)
10198 (defun gnus-summary-respool-article (&optional n method)
10199 "Respool the current article.
10200 The article will be squeezed through the mail spooling process again,
10201 which means that it will be put in some mail newsgroup or other
10202 depending on `nnmail-split-methods'.
10203 If N is a positive number, respool the N next articles.
10204 If N is a negative number, respool the N previous articles.
10205 If N is nil and any articles have been marked with the process mark,
10206 respool those articles instead.
10208 Respooling can be done both from mail groups and \"real\" newsgroups.
10209 In the former case, the articles in question will be moved from the
10210 current group into whatever groups they are destined to. In the
10211 latter case, they will be copied into the relevant groups."
10213 (list current-prefix-arg
10214 (let* ((methods (mapcar #'car (gnus-methods-using 'respool)))
10216 (symbol-name (or gnus-summary-respool-default-method
10217 (car (gnus-find-method-for-group
10218 gnus-newsgroup-name)))))
10220 (gnus-completing-read
10221 "Backend to use when respooling"
10222 methods t nil 'gnus-mail-method-history methname))
10225 ((zerop (length (setq ms (gnus-servers-using-backend
10226 (intern method)))))
10227 (list (intern method) ""))
10231 (let ((ms-alist (mapcar (lambda (m) (cons (cadr m) m)) ms)))
10232 (cdr (assoc (gnus-completing-read "Server name" ms-alist t)
10235 (error "No method given for respooling"))
10236 (if (assoc (symbol-name
10237 (car (gnus-find-method-for-group gnus-newsgroup-name)))
10238 (gnus-methods-using 'respool))
10239 (gnus-summary-move-article n nil method)
10240 (gnus-summary-copy-article n nil method)))
10242 (defun gnus-summary-import-article (file &optional edit)
10243 "Import an arbitrary file into a mail newsgroup."
10244 (interactive "fImport file: \nP")
10245 (let ((group gnus-newsgroup-name)
10246 (now (current-time))
10247 atts lines group-art)
10248 (unless (gnus-check-backend-function 'request-accept-article group)
10249 (error "%s does not support article importing" group))
10250 (or (file-readable-p file)
10251 (not (file-regular-p file))
10252 (error "Can't read %s" file))
10253 (with-current-buffer (gnus-get-buffer-create " *import file*")
10255 (nnheader-insert-file-contents file)
10256 (goto-char (point-min))
10257 (if (nnheader-article-p)
10259 (goto-char (point-min))
10260 (search-forward "\n\n" nil t)
10261 (narrow-to-region (point-min) (1- (point)))
10262 (goto-char (point-min))
10263 (unless (re-search-forward "^date:" nil t)
10264 (goto-char (point-max))
10265 (insert "Date: " (message-make-date (nth 5 atts)) "\n")))
10266 ;; This doesn't look like an article, so we fudge some headers.
10267 (setq atts (file-attributes file)
10268 lines (count-lines (point-min) (point-max)))
10269 (insert "From: " (read-string "From: ") "\n"
10270 "Subject: " (read-string "Subject: ") "\n"
10271 "Date: " (message-make-date (nth 5 atts)) "\n"
10272 "Message-ID: " (message-make-message-id) "\n"
10273 "Lines: " (int-to-string lines) "\n"
10274 "Chars: " (int-to-string (nth 7 atts)) "\n\n"))
10275 (setq group-art (gnus-request-accept-article group nil t))
10276 (kill-buffer (current-buffer)))
10277 (setq gnus-newsgroup-active (gnus-activate-group group))
10279 (gnus-summary-goto-article (cdr group-art) nil t)
10281 (gnus-summary-edit-article))))
10283 (defun gnus-summary-create-article ()
10284 "Create an article in a mail newsgroup."
10286 (let ((group gnus-newsgroup-name)
10287 (now (current-time))
10289 (unless (gnus-check-backend-function 'request-accept-article group)
10290 (error "%s does not support article importing" group))
10291 (with-current-buffer (gnus-get-buffer-create " *import file*")
10293 (goto-char (point-min))
10294 ;; This doesn't look like an article, so we fudge some headers.
10295 (insert "From: " (read-string "From: ") "\n"
10296 "Subject: " (read-string "Subject: ") "\n"
10297 "Date: " (message-make-date now) "\n"
10298 "Message-ID: " (message-make-message-id) "\n")
10299 (setq group-art (gnus-request-accept-article group nil t))
10300 (kill-buffer (current-buffer)))
10301 (setq gnus-newsgroup-active (gnus-activate-group group))
10303 (gnus-summary-goto-article (cdr group-art) nil t)
10304 (gnus-summary-edit-article)))
10306 (defun gnus-summary-article-posted-p ()
10307 "Say whether the current (mail) article is available from news as well.
10308 This will be the case if the article has both been mailed and posted."
10310 (let ((id (mail-header-references (gnus-summary-article-header)))
10311 (gnus-override-method (car (gnus-refer-article-methods))))
10312 (if (gnus-request-head id "")
10313 (gnus-message 2 "The current message was found on %s"
10314 gnus-override-method)
10315 (gnus-message 2 "The current message couldn't be found on %s"
10316 gnus-override-method)
10319 (defun gnus-summary-expire-articles (&optional now)
10320 "Expire all articles that are marked as expirable in the current group."
10322 (when (and (not gnus-group-is-exiting-without-update-p)
10323 (gnus-check-backend-function
10324 'request-expire-articles gnus-newsgroup-name))
10325 ;; This backend supports expiry.
10326 (let* ((total (gnus-group-total-expirable-p gnus-newsgroup-name))
10328 (gnus-list-range-difference
10331 ;; We need to update the info for
10332 ;; this group for `gnus-list-of-read-articles'
10333 ;; to give us the right answer.
10334 (gnus-run-hooks 'gnus-exit-group-hook)
10335 (gnus-summary-update-info)
10336 (gnus-list-of-read-articles gnus-newsgroup-name))
10337 (setq gnus-newsgroup-expirable
10338 (sort gnus-newsgroup-expirable '<)))
10339 gnus-newsgroup-unexist))
10340 (expiry-wait (if now 'immediate
10341 (gnus-group-find-parameter
10342 gnus-newsgroup-name 'expiry-wait)))
10343 (nnmail-expiry-target
10344 (or (gnus-group-find-parameter gnus-newsgroup-name 'expiry-target)
10345 nnmail-expiry-target))
10348 ;; There are expirable articles in this group, so we run them
10349 ;; through the expiry process.
10350 (gnus-message 6 "Expiring articles...")
10351 (when (gnus-check-group gnus-newsgroup-name)
10352 ;; The list of articles that weren't expired is returned.
10355 (let ((nnmail-expiry-wait-function nil)
10356 (nnmail-expiry-wait expiry-wait))
10357 (setq es (gnus-request-expire-articles
10358 expirable gnus-newsgroup-name)))
10359 (setq es (gnus-request-expire-articles
10360 expirable gnus-newsgroup-name)))
10362 (setq gnus-newsgroup-expirable es))
10363 ;; We go through the old list of expirable, and mark all
10364 ;; really expired articles as nonexistent.
10365 (unless (eq es expirable) ;If nothing was expired, we don't mark.
10366 (let ((gnus-use-cache nil))
10367 (dolist (article expirable)
10368 (when (and (not (memq article es))
10369 (gnus-data-find article))
10370 (gnus-summary-mark-article article gnus-canceled-mark)
10371 (run-hook-with-args 'gnus-summary-article-expire-hook
10374 (assoc article (gnus-data-list nil)))
10375 gnus-newsgroup-name
10378 (gnus-message 6 "Expiring articles...done")))))
10380 (defun gnus-summary-expire-articles-now ()
10381 "Expunge all expirable articles in the current group.
10382 This means that *all* articles that are marked as expirable will be
10383 deleted forever, right now."
10385 (or gnus-expert-user
10387 "Are you really, really sure you want to delete all expirable messages? ")
10389 (gnus-summary-expire-articles t))
10391 ;; Suggested by Jack Vinson <vinson@unagi.cis.upenn.edu>.
10392 (defun gnus-summary-delete-article (&optional n)
10393 "Delete the N next (mail) articles.
10394 This command actually deletes articles. This is not a marking
10395 command. The article will disappear forever from your life, never to
10398 If N is negative, delete backwards.
10399 If N is nil and articles have been marked with the process mark,
10400 delete these instead.
10402 If `gnus-novice-user' is non-nil you will be asked for
10403 confirmation before the articles are deleted."
10405 (unless (gnus-check-backend-function 'request-expire-articles
10406 gnus-newsgroup-name)
10407 (error "The current newsgroup does not support article deletion"))
10408 (unless (gnus-check-server (gnus-find-method-for-group gnus-newsgroup-name))
10409 (error "Couldn't open server"))
10410 ;; Compute the list of articles to delete.
10411 (let ((articles (sort (copy-sequence (gnus-summary-work-articles n)) '<))
10412 (nnmail-expiry-target 'delete)
10414 (if (and gnus-novice-user
10415 (not (gnus-yes-or-no-p
10416 (format "Do you really want to delete %s forever? "
10417 (if (> (length articles) 1)
10418 (format "these %s articles" (length articles))
10419 "this article")))))
10421 ;; Delete the articles.
10422 (setq not-deleted (gnus-request-expire-articles
10423 articles gnus-newsgroup-name 'force))
10426 (gnus-summary-remove-process-mark (car articles))
10427 ;; The backend might not have been able to delete the article
10429 (unless (memq (car articles) not-deleted)
10430 (gnus-summary-mark-article (car articles) gnus-canceled-mark)
10431 (let* ((article (car articles))
10432 (ghead (gnus-data-header
10433 (assoc article (gnus-data-list nil)))))
10434 (run-hook-with-args 'gnus-summary-article-delete-hook
10435 'delete ghead gnus-newsgroup-name nil
10437 (setq articles (cdr articles))))
10439 (gnus-message 4 "Couldn't delete articles %s" not-deleted)))
10440 (gnus-summary-position-point)
10441 (gnus-set-mode-line 'summary)
10444 (defun gnus-summary-edit-article (&optional arg)
10445 "Edit the current article.
10446 This will have permanent effect only in mail groups.
10447 If ARG is nil, edit the decoded articles.
10448 If ARG is 1, edit the raw articles.
10449 If ARG is 2, edit the raw articles even in read-only groups.
10450 If ARG is 3, edit the articles with the current handles.
10451 Otherwise, allow editing of articles even in read-only
10454 (let (force raw current-handles)
10463 (setq current-handles
10464 (and (gnus-buffer-live-p gnus-article-buffer)
10465 (with-current-buffer gnus-article-buffer
10467 gnus-article-mime-handles
10468 (setq gnus-article-mime-handles nil))))))
10471 (when (and raw (not force)
10472 (member gnus-newsgroup-name '("nndraft:delayed"
10475 (error "Can't edit the raw article in group %s"
10476 gnus-newsgroup-name))
10477 (with-current-buffer gnus-summary-buffer
10478 (let ((mail-parse-charset gnus-newsgroup-charset)
10479 (mail-parse-ignored-charsets gnus-newsgroup-ignored-charsets))
10480 (gnus-set-global-variables)
10481 (when (and (not force)
10482 (gnus-group-read-only-p))
10483 (error "The current newsgroup does not support article editing"))
10484 (gnus-summary-show-article t)
10485 (when (and (not raw) (gnus-buffer-live-p gnus-article-buffer))
10486 (with-current-buffer gnus-article-buffer
10487 (mm-enable-multibyte)))
10488 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
10490 (gnus-article-edit-article
10493 (let ((mbl mml-buffer-list))
10494 (setq mml-buffer-list nil)
10495 (let ((rfc2047-quote-decoded-words-containing-tspecials t))
10496 (mime-to-mml ,'current-handles))
10497 (let ((mbl1 mml-buffer-list))
10498 (setq mml-buffer-list mbl)
10499 (set (make-local-variable 'mml-buffer-list) mbl1))
10500 (gnus-make-local-hook 'kill-buffer-hook)
10501 (add-hook 'kill-buffer-hook 'mml-destroy-buffers t t))))
10502 `(lambda (no-highlight)
10503 (let ((mail-parse-charset ',gnus-newsgroup-charset)
10504 (message-options message-options)
10505 (message-options-set-recipient)
10506 (mail-parse-ignored-charsets
10507 ',gnus-newsgroup-ignored-charsets)
10508 (rfc2047-header-encoding-alist
10509 ',(let ((charset (gnus-group-name-charset
10510 (gnus-find-method-for-group
10511 gnus-newsgroup-name)
10512 gnus-newsgroup-name)))
10513 (append (list (cons "Newsgroups" charset)
10514 (cons "Followup-To" charset)
10515 (cons "Xref" charset))
10516 rfc2047-header-encoding-alist))))
10517 ,(if (not raw) '(progn
10519 (mml-destroy-buffers)
10520 (remove-hook 'kill-buffer-hook
10521 'mml-destroy-buffers t)
10522 (kill-local-variable 'mml-buffer-list)))
10523 (gnus-summary-edit-article-done
10524 ,(or (mail-header-references gnus-current-headers) "")
10525 ,(gnus-group-read-only-p)
10526 ,gnus-summary-buffer no-highlight))))))))
10528 (defalias 'gnus-summary-edit-article-postpone 'gnus-article-edit-exit)
10530 (defun gnus-summary-edit-article-done (&optional references read-only buffer
10532 "Make edits to the current article permanent."
10535 ;; The buffer restriction contains the entire article if it exists.
10536 (when (article-goto-body)
10537 (let ((lines (count-lines (point) (point-max)))
10538 (length (- (point-max) (point)))
10539 (case-fold-search t)
10540 (body (copy-marker (point))))
10541 (goto-char (point-min))
10542 (when (re-search-forward "^content-length:[ \t]\\([0-9]+\\)" body t)
10543 (delete-region (match-beginning 1) (match-end 1))
10544 (insert (number-to-string length)))
10545 (goto-char (point-min))
10546 (when (re-search-forward
10547 "^x-content-length:[ \t]\\([0-9]+\\)" body t)
10548 (delete-region (match-beginning 1) (match-end 1))
10549 (insert (number-to-string length)))
10550 (goto-char (point-min))
10551 (when (re-search-forward "^lines:[ \t]\\([0-9]+\\)" body t)
10552 (delete-region (match-beginning 1) (match-end 1))
10553 (insert (number-to-string lines))))))
10554 ;; Replace the article.
10555 (let ((buf (current-buffer))
10556 (article (cdr gnus-article-current))
10559 (insert-buffer-substring buf)
10560 (if (and (not read-only)
10561 (not (setq replace-result
10562 (gnus-request-replace-article
10563 article (car gnus-article-current)
10564 (current-buffer) t))))
10565 (error "Couldn't replace article")
10566 ;; If we got a number back, then that's the new article number
10567 ;; for this article. Otherwise, the article number didn't change.
10568 (when (numberp replace-result)
10569 (with-current-buffer gnus-summary-buffer
10570 (setq gnus-newsgroup-limit (delq article gnus-newsgroup-limit))
10571 (gnus-summary-limit gnus-newsgroup-limit)
10572 (setq article replace-result)
10573 (gnus-summary-goto-subject article t)))
10574 ;; Update the summary buffer.
10575 (if (and references
10576 (equal (message-tokenize-header references " ")
10577 (message-tokenize-header
10578 (or (message-fetch-field "references") "") " ")))
10579 ;; We only have to update this line.
10582 (message-narrow-to-head)
10583 (let ((head (buffer-substring-no-properties
10584 (point-min) (point-max)))
10587 (insert (format "211 %d Article retrieved.\n" article))
10590 (let ((nntp-server-buffer (current-buffer)))
10591 (setq header (car (gnus-get-newsgroup-headers nil t))))
10592 (with-current-buffer gnus-summary-buffer
10593 (gnus-data-set-header (gnus-data-find article) header)
10594 (gnus-summary-update-article-line article header)
10595 (if (gnus-summary-goto-subject article nil t)
10596 (gnus-summary-update-secondary-mark article)))))))
10598 (set-buffer (or buffer gnus-summary-buffer))
10599 (gnus-summary-update-article article)
10600 (if (gnus-summary-goto-subject article nil t)
10601 (gnus-summary-update-secondary-mark article)))
10602 ;; Prettify the article buffer again.
10603 (unless no-highlight
10604 (with-current-buffer gnus-article-buffer
10605 ;;!!! Fix this -- article should be rehighlighted.
10606 ;;(gnus-run-hooks 'gnus-article-display-hook)
10607 (set-buffer gnus-original-article-buffer)
10608 (gnus-request-article
10609 article (car gnus-article-current) (current-buffer))))
10610 ;; Prettify the summary buffer line.
10611 (when (gnus-visual-p 'summary-highlight 'highlight)
10612 (gnus-run-hooks 'gnus-visual-mark-article-hook))))))
10614 (defun gnus-summary-edit-wash (key)
10615 "Perform editing command KEY in the article buffer."
10619 (message "%s" (concat (this-command-keys) "- "))
10622 (gnus-summary-edit-article)
10623 (execute-kbd-macro (concat (this-command-keys) key))
10624 (gnus-article-edit-done))
10628 (defun gnus-summary-respool-query (&optional silent trace)
10629 "Query where the respool algorithm would put this article."
10631 (let (gnus-mark-article-hook)
10632 (gnus-summary-select-article)
10633 (with-current-buffer gnus-original-article-buffer
10634 (let ((groups (nnmail-article-group 'identity trace)))
10637 (message "This message would go to %s"
10638 (mapconcat 'car groups ", "))
10639 (message "This message would go to no groups"))
10642 (defun gnus-summary-respool-trace ()
10643 "Trace where the respool algorithm would put this article.
10644 Display a buffer showing all fancy splitting patterns which matched."
10646 (gnus-summary-respool-query nil t))
10648 ;; Summary marking commands.
10650 (defun gnus-summary-kill-same-subject-and-select (&optional unmark)
10651 "Mark articles which has the same subject as read, and then select the next.
10652 If UNMARK is positive, remove any kind of mark.
10653 If UNMARK is negative, tick articles."
10656 (setq unmark (prefix-numeric-value unmark)))
10658 (gnus-summary-mark-same-subject
10659 (gnus-summary-article-subject) unmark)))
10660 ;; Select next unread article. If auto-select-same mode, should
10661 ;; select the first unread article.
10662 (gnus-summary-next-article t (and gnus-auto-select-same
10663 (gnus-summary-article-subject)))
10664 (gnus-message 7 "%d article%s marked as %s"
10665 count (if (= count 1) " is" "s are")
10666 (if unmark "unread" "read"))))
10668 (defun gnus-summary-kill-same-subject (&optional unmark)
10669 "Mark articles which has the same subject as read.
10670 If UNMARK is positive, remove any kind of mark.
10671 If UNMARK is negative, tick articles."
10674 (setq unmark (prefix-numeric-value unmark)))
10676 (gnus-summary-mark-same-subject
10677 (gnus-summary-article-subject) unmark)))
10678 ;; If marked as read, go to next unread subject.
10679 (when (null unmark)
10680 ;; Go to next unread subject.
10681 (gnus-summary-next-subject 1 t))
10682 (gnus-message 7 "%d articles are marked as %s"
10683 count (if unmark "unread" "read"))))
10685 (defun gnus-summary-mark-same-subject (subject &optional unmark)
10686 "Mark articles with same SUBJECT as read, and return marked number.
10687 If optional argument UNMARK is positive, remove any kinds of marks.
10688 If optional argument UNMARK is negative, mark articles as unread instead."
10692 ((null unmark) ; Mark as read.
10695 (gnus-summary-mark-article-as-read gnus-killed-mark)
10696 (gnus-summary-show-thread) t)
10697 (gnus-summary-find-subject subject))
10698 (setq count (1+ count))))
10699 ((> unmark 0) ; Tick.
10702 (gnus-summary-mark-article-as-unread gnus-ticked-mark)
10703 (gnus-summary-show-thread) t)
10704 (gnus-summary-find-subject subject))
10705 (setq count (1+ count))))
10706 (t ; Mark as unread.
10709 (gnus-summary-mark-article-as-unread gnus-unread-mark)
10710 (gnus-summary-show-thread) t)
10711 (gnus-summary-find-subject subject))
10712 (setq count (1+ count)))))
10713 (gnus-set-mode-line 'summary)
10714 ;; Return the number of marked articles.
10717 (defun gnus-summary-mark-as-processable (n &optional unmark)
10718 "Set the process mark on the next N articles.
10719 If N is negative, mark backward instead. If UNMARK is non-nil, remove
10720 the process mark instead. The difference between N and the actual
10721 number of articles marked is returned."
10723 (if (and (null n) (gnus-region-active-p))
10724 (gnus-uu-mark-region (region-beginning) (region-end) unmark)
10725 (setq n (prefix-numeric-value n))
10726 (let ((backward (< n 0))
10731 (gnus-summary-remove-process-mark
10732 (gnus-summary-article-number))
10733 (gnus-summary-set-process-mark (gnus-summary-article-number)))
10734 (zerop (gnus-summary-next-subject (if backward -1 1) nil t)))
10737 (gnus-message 7 "No more articles"))
10738 (gnus-summary-recenter)
10739 (gnus-summary-position-point)
10742 (defun gnus-summary-unmark-as-processable (n)
10743 "Remove the process mark from the next N articles.
10744 If N is negative, unmark backward instead. The difference between N and
10745 the actual number of articles unmarked is returned."
10747 (gnus-summary-mark-as-processable n t))
10749 (defun gnus-summary-unmark-all-processable ()
10750 "Remove the process mark from all articles."
10753 (while gnus-newsgroup-processable
10754 (gnus-summary-remove-process-mark (car gnus-newsgroup-processable))))
10755 (gnus-summary-position-point))
10757 (defun gnus-summary-add-mark (article type)
10758 "Mark ARTICLE with a mark of TYPE."
10759 (let ((vtype (car (assq type gnus-article-mark-lists)))
10762 (error "No such mark type: %s" type)
10763 (setq var (intern (format "gnus-newsgroup-%s" type)))
10764 (set var (cons article (symbol-value var)))
10765 (if (memq type '(processable cached replied forwarded recent saved))
10766 (gnus-summary-update-secondary-mark article)
10767 ;;; !!! This is bogus. We should find out what primary
10768 ;;; !!! mark we want to set.
10769 (gnus-summary-update-mark gnus-del-mark 'unread)))))
10771 (defun gnus-summary-mark-as-expirable (n)
10772 "Mark N articles forward as expirable.
10773 If N is negative, mark backward instead. The difference between N and
10774 the actual number of articles marked is returned."
10776 (gnus-summary-mark-forward n gnus-expirable-mark))
10778 (defun gnus-summary-mark-as-spam (n)
10779 "Mark N articles forward as spam.
10780 If N is negative, mark backward instead. The difference between N and
10781 the actual number of articles marked is returned."
10783 (gnus-summary-mark-forward n gnus-spam-mark))
10785 (defun gnus-summary-mark-article-as-replied (article)
10786 "Mark ARTICLE as replied to and update the summary line.
10787 ARTICLE can also be a list of articles."
10788 (interactive (list (gnus-summary-article-number)))
10789 (let ((articles (if (listp article) article (list article))))
10790 (dolist (article articles)
10791 (unless (numberp article)
10792 (error "%s is not a number" article))
10793 (push article gnus-newsgroup-replied)
10794 (let ((inhibit-read-only t))
10795 (when (gnus-summary-goto-subject article nil t)
10796 (gnus-summary-update-secondary-mark article))))))
10798 (defun gnus-summary-mark-article-as-forwarded (article)
10799 "Mark ARTICLE as forwarded and update the summary line.
10800 ARTICLE can also be a list of articles."
10801 (let ((articles (if (listp article) article (list article))))
10802 (dolist (article articles)
10803 (push article gnus-newsgroup-forwarded)
10804 (let ((inhibit-read-only t))
10805 (when (gnus-summary-goto-subject article nil t)
10806 (gnus-summary-update-secondary-mark article))))))
10808 (defun gnus-summary-set-bookmark (article)
10809 "Set a bookmark in current article."
10810 (interactive (list (gnus-summary-article-number)))
10811 (when (or (not (get-buffer gnus-article-buffer))
10812 (not gnus-current-article)
10813 (not gnus-article-current)
10814 (not (equal gnus-newsgroup-name (car gnus-article-current))))
10815 (error "No current article selected"))
10816 ;; Remove old bookmark, if one exists.
10817 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10818 ;; Set the new bookmark, which is on the form
10819 ;; (article-number . line-number-in-body).
10822 (with-current-buffer gnus-article-buffer
10826 (article-goto-body)
10829 gnus-newsgroup-bookmarks)
10830 (gnus-message 6 "A bookmark has been added to the current article."))
10832 (defun gnus-summary-remove-bookmark (article)
10833 "Remove the bookmark from the current article."
10834 (interactive (list (gnus-summary-article-number)))
10835 ;; Remove old bookmark, if one exists.
10836 (if (not (assq article gnus-newsgroup-bookmarks))
10837 (gnus-message 6 "No bookmark in current article.")
10838 (gnus-alist-pull article gnus-newsgroup-bookmarks)
10839 (gnus-message 6 "Removed bookmark.")))
10841 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
10842 (defun gnus-summary-mark-as-dormant (n)
10843 "Mark N articles forward as dormant.
10844 If N is negative, mark backward instead. The difference between N and
10845 the actual number of articles marked is returned."
10847 (gnus-summary-mark-forward n gnus-dormant-mark))
10849 (defun gnus-summary-set-process-mark (article)
10850 "Set the process mark on ARTICLE and update the summary line."
10851 (setq gnus-newsgroup-processable
10853 (delq article gnus-newsgroup-processable)))
10854 (when (gnus-summary-goto-subject article)
10855 (gnus-summary-show-thread)
10856 (gnus-summary-goto-subject article)
10857 (gnus-summary-update-secondary-mark article)))
10859 (defun gnus-summary-remove-process-mark (&rest articles)
10860 "Remove the process mark from ARTICLES and update the summary line."
10861 (dolist (article articles)
10862 (setq gnus-newsgroup-processable (delq article gnus-newsgroup-processable))
10863 (when (gnus-summary-goto-subject article)
10864 (gnus-summary-show-thread)
10865 (gnus-summary-goto-subject article)
10866 (gnus-summary-update-secondary-mark article)))
10869 (defun gnus-summary-set-saved-mark (article)
10870 "Set the process mark on ARTICLE and update the summary line."
10871 (push article gnus-newsgroup-saved)
10872 (when (gnus-summary-goto-subject article)
10873 (gnus-summary-update-secondary-mark article)))
10875 (defun gnus-summary-mark-forward (n &optional mark no-expire)
10876 "Mark N articles as read forwards.
10877 If N is negative, mark backwards instead. Mark with MARK, ?r by default.
10878 The difference between N and the actual number of articles marked is
10880 If NO-EXPIRE, auto-expiry will be inhibited."
10882 (gnus-summary-show-thread)
10883 (let ((backward (< n 0))
10884 (gnus-summary-goto-unread
10885 (and gnus-summary-goto-unread
10886 (not (eq gnus-summary-goto-unread 'never))
10887 (not (memq mark (list gnus-unread-mark gnus-spam-mark
10888 gnus-ticked-mark gnus-dormant-mark)))))
10890 (mark (or mark gnus-del-mark)))
10891 (while (and (> n 0)
10892 (gnus-summary-mark-article nil mark no-expire)
10893 (zerop (gnus-summary-next-subject
10895 (and gnus-summary-goto-unread
10896 (not (eq gnus-summary-goto-unread 'never)))
10900 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
10901 (gnus-summary-recenter)
10902 (gnus-summary-position-point)
10903 (gnus-set-mode-line 'summary)
10906 (defun gnus-summary-mark-article-as-read (mark)
10907 "Mark the current article quickly as read with MARK."
10908 (let ((article (gnus-summary-article-number)))
10909 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10910 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10911 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
10912 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10913 (push (cons article mark) gnus-newsgroup-reads)
10914 ;; Possibly remove from cache, if that is used.
10915 (when gnus-use-cache
10916 (gnus-cache-enter-remove-article article))
10917 ;; Allow the backend to change the mark.
10918 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10919 ;; Check for auto-expiry.
10920 (when (and gnus-newsgroup-auto-expire
10921 (memq mark gnus-auto-expirable-marks))
10922 (setq mark gnus-expirable-mark)
10923 ;; Let the backend know about the mark change.
10924 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10925 (push article gnus-newsgroup-expirable))
10926 ;; Set the mark in the buffer.
10927 (gnus-summary-update-mark mark 'unread)
10930 (defun gnus-summary-mark-article-as-unread (mark)
10931 "Mark the current article quickly as unread with MARK."
10932 (let* ((article (gnus-summary-article-number))
10933 (old-mark (gnus-summary-article-mark article)))
10934 ;; Allow the backend to change the mark.
10935 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
10936 (if (eq mark old-mark)
10940 (gnus-error 1 "Can't mark negative article numbers")
10942 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
10943 (setq gnus-newsgroup-spam-marked
10944 (delq article gnus-newsgroup-spam-marked))
10945 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
10946 (setq gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable))
10947 (setq gnus-newsgroup-reads (delq article gnus-newsgroup-reads))
10948 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
10949 (cond ((= mark gnus-ticked-mark)
10950 (setq gnus-newsgroup-marked
10951 (gnus-add-to-sorted-list gnus-newsgroup-marked
10953 ((= mark gnus-spam-mark)
10954 (setq gnus-newsgroup-spam-marked
10955 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
10957 ((= mark gnus-dormant-mark)
10958 (setq gnus-newsgroup-dormant
10959 (gnus-add-to-sorted-list gnus-newsgroup-dormant
10962 (setq gnus-newsgroup-unreads
10963 (gnus-add-to-sorted-list gnus-newsgroup-unreads
10965 (gnus-alist-pull article gnus-newsgroup-reads)
10967 ;; See whether the article is to be put in the cache.
10968 (and gnus-use-cache
10969 (vectorp (gnus-summary-article-header article))
10971 (gnus-cache-possibly-enter-article
10972 gnus-newsgroup-name article
10973 (= mark gnus-ticked-mark)
10974 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
10977 (gnus-summary-update-mark mark 'unread)
10980 (defun gnus-summary-mark-article (&optional article mark no-expire)
10981 "Mark ARTICLE with MARK. MARK can be any character.
10982 Four MARK strings are reserved: `? ' (unread), `?!' (ticked),
10983 `??' (dormant) and `?E' (expirable).
10984 If MARK is nil, then the default character `?r' is used.
10985 If ARTICLE is nil, then the article on the current line will be
10987 If NO-EXPIRE, auto-expiry will be inhibited."
10988 ;; The mark might be a string.
10989 (when (stringp mark)
10990 (setq mark (aref mark 0)))
10991 ;; If no mark is given, then we check auto-expiring.
10993 (setq mark gnus-del-mark))
10994 (when (and (not no-expire)
10995 gnus-newsgroup-auto-expire
10996 (memq mark gnus-auto-expirable-marks))
10997 (setq mark gnus-expirable-mark))
10998 (let ((article (or article (gnus-summary-article-number)))
10999 (old-mark (gnus-summary-article-mark article)))
11000 ;; Allow the backend to change the mark.
11001 (setq mark (gnus-request-update-mark gnus-newsgroup-name article mark))
11002 (if (eq mark old-mark)
11005 (error "No article on current line"))
11006 (if (not (if (or (= mark gnus-unread-mark)
11007 (= mark gnus-ticked-mark)
11008 (= mark gnus-spam-mark)
11009 (= mark gnus-dormant-mark))
11010 (gnus-mark-article-as-unread article mark)
11011 (gnus-mark-article-as-read article mark)))
11013 ;; See whether the article is to be put in the cache.
11014 (and gnus-use-cache
11015 (not (= mark gnus-canceled-mark))
11016 (vectorp (gnus-summary-article-header article))
11018 (gnus-cache-possibly-enter-article
11019 gnus-newsgroup-name article
11020 (= mark gnus-ticked-mark)
11021 (= mark gnus-dormant-mark) (= mark gnus-unread-mark))))
11023 (when (gnus-summary-goto-subject article nil t)
11024 (let ((inhibit-read-only t))
11025 (gnus-summary-show-thread)
11027 (gnus-summary-update-mark mark 'unread)
11030 (defun gnus-summary-update-secondary-mark (article)
11031 "Update the secondary (read, process, cache) mark."
11032 (gnus-summary-update-mark
11033 (cond ((memq article gnus-newsgroup-processable)
11035 ((memq article gnus-newsgroup-cached)
11037 ((memq article gnus-newsgroup-replied)
11039 ((memq article gnus-newsgroup-forwarded)
11040 gnus-forwarded-mark)
11041 ((memq article gnus-newsgroup-saved)
11043 ((memq article gnus-newsgroup-unseen)
11047 (when (gnus-visual-p 'summary-highlight 'highlight)
11048 (gnus-summary-highlight-line)
11049 (gnus-run-hooks 'gnus-summary-update-hook))
11052 (defun gnus-summary-update-download-mark (article)
11053 "Update the download mark."
11054 (gnus-summary-update-mark
11055 (cond ((memq article gnus-newsgroup-undownloaded)
11056 gnus-undownloaded-mark)
11057 (gnus-newsgroup-agentized
11058 gnus-downloaded-mark)
11062 (gnus-summary-update-line t)
11065 (defun gnus-summary-update-mark (mark type)
11066 (let ((forward (cdr (assq type gnus-summary-mark-positions)))
11067 (inhibit-read-only t))
11068 (re-search-backward "[\n\r]" (point-at-bol) 'move-to-limit)
11070 (when (looking-at "\r")
11072 (when (<= (+ forward (point)) (point-max))
11073 ;; Go to the right position on the line.
11074 (goto-char (+ forward (point)))
11075 ;; Replace the old mark with the new mark.
11077 (mm-subst-char-in-string
11079 (buffer-substring (point) (1+ (point))))))
11080 (delete-region (point) (1+ (point)))
11081 (insert to-insert))
11082 ;; Optionally update the marks by some user rule.
11083 (when (eq type 'unread)
11084 (gnus-data-set-mark
11085 (gnus-data-find (gnus-summary-article-number)) mark)
11086 (gnus-summary-update-line (eq mark gnus-unread-mark)))))))
11088 (defun gnus-mark-article-as-read (article &optional mark)
11089 "Enter ARTICLE in the pertinent lists and remove it from others."
11090 ;; Make the article expirable.
11091 (let ((mark (or mark gnus-del-mark)))
11092 (setq gnus-newsgroup-expirable
11093 (if (= mark gnus-expirable-mark)
11094 (gnus-add-to-sorted-list gnus-newsgroup-expirable article)
11095 (delq article gnus-newsgroup-expirable)))
11096 ;; Remove from unread and marked lists.
11097 (setq gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11098 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked))
11099 (setq gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked))
11100 (setq gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant))
11101 (push (cons article mark) gnus-newsgroup-reads)
11102 ;; Possibly remove from cache, if that is used.
11103 (when gnus-use-cache
11104 (gnus-cache-enter-remove-article article))
11107 (defun gnus-mark-article-as-unread (article &optional mark)
11108 "Enter ARTICLE in the pertinent lists and remove it from others."
11109 (let ((mark (or mark gnus-ticked-mark)))
11112 (gnus-error 1 "Can't mark negative article numbers")
11114 (setq gnus-newsgroup-marked (delq article gnus-newsgroup-marked)
11115 gnus-newsgroup-spam-marked (delq article gnus-newsgroup-spam-marked)
11116 gnus-newsgroup-dormant (delq article gnus-newsgroup-dormant)
11117 gnus-newsgroup-expirable (delq article gnus-newsgroup-expirable)
11118 gnus-newsgroup-unreads (delq article gnus-newsgroup-unreads))
11120 ;; Unsuppress duplicates?
11121 (when gnus-suppress-duplicates
11122 (gnus-dup-unsuppress-article article))
11124 (cond ((= mark gnus-ticked-mark)
11125 (setq gnus-newsgroup-marked
11126 (gnus-add-to-sorted-list gnus-newsgroup-marked article)))
11127 ((= mark gnus-spam-mark)
11128 (setq gnus-newsgroup-spam-marked
11129 (gnus-add-to-sorted-list gnus-newsgroup-spam-marked
11131 ((= mark gnus-dormant-mark)
11132 (setq gnus-newsgroup-dormant
11133 (gnus-add-to-sorted-list gnus-newsgroup-dormant article)))
11135 (setq gnus-newsgroup-unreads
11136 (gnus-add-to-sorted-list gnus-newsgroup-unreads article))))
11137 (gnus-alist-pull article gnus-newsgroup-reads)
11140 (defun gnus-summary-tick-article-forward (n)
11141 "Tick N articles forwards.
11142 If N is negative, tick backwards instead.
11143 The difference between N and the number of articles ticked is returned."
11145 (gnus-summary-mark-forward n gnus-ticked-mark))
11147 (defun gnus-summary-tick-article-backward (n)
11148 "Tick N articles backwards.
11149 The difference between N and the number of articles ticked is returned."
11151 (gnus-summary-mark-forward (- n) gnus-ticked-mark))
11153 (defun gnus-summary-tick-article (&optional article clear-mark)
11154 "Mark current article as unread.
11155 Optional 1st argument ARTICLE specifies article number to be marked as unread.
11156 Optional 2nd argument CLEAR-MARK remove any kinds of mark."
11158 (gnus-summary-mark-article article (if clear-mark gnus-unread-mark
11159 gnus-ticked-mark)))
11161 (defun gnus-summary-mark-as-read-forward (n)
11162 "Mark N articles as read forwards.
11163 If N is negative, mark backwards instead.
11164 The difference between N and the actual number of articles marked is
11167 (gnus-summary-mark-forward n gnus-del-mark gnus-inhibit-user-auto-expire))
11169 (defun gnus-summary-mark-as-read-backward (n)
11170 "Mark the N articles as read backwards.
11171 The difference between N and the actual number of articles marked is
11174 (gnus-summary-mark-forward
11175 (- n) gnus-del-mark gnus-inhibit-user-auto-expire))
11177 (defun gnus-summary-mark-as-read (&optional article mark)
11178 "Mark current article as read.
11179 ARTICLE specifies the article to be marked as read.
11180 MARK specifies a string to be inserted at the beginning of the line."
11181 (gnus-summary-mark-article article mark))
11183 (defun gnus-summary-clear-mark-forward (n)
11184 "Clear marks from N articles forward.
11185 If N is negative, clear backward instead.
11186 The difference between N and the number of marks cleared is returned."
11188 (gnus-summary-mark-forward n gnus-unread-mark))
11190 (defun gnus-summary-clear-mark-backward (n)
11191 "Clear marks from N articles backward.
11192 The difference between N and the number of marks cleared is returned."
11194 (gnus-summary-mark-forward (- n) gnus-unread-mark))
11196 (defun gnus-summary-mark-unread-as-read ()
11197 "Intended to be used by `gnus-mark-article-hook'."
11198 (when (memq gnus-current-article gnus-newsgroup-unreads)
11199 (gnus-summary-mark-article gnus-current-article gnus-read-mark)))
11201 (defun gnus-summary-mark-read-and-unread-as-read (&optional new-mark)
11202 "Intended to be used by `gnus-mark-article-hook'."
11203 (let ((mark (gnus-summary-article-mark)))
11204 (when (or (gnus-unread-mark-p mark)
11205 (gnus-read-mark-p mark))
11206 (gnus-summary-mark-article gnus-current-article
11207 (or new-mark gnus-read-mark)))))
11209 (defun gnus-summary-mark-current-read-and-unread-as-read (&optional new-mark)
11210 "Intended to be used by `gnus-mark-article-hook'."
11211 (let ((mark (gnus-summary-article-mark)))
11212 (when (or (gnus-unread-mark-p mark)
11213 (gnus-read-mark-p mark))
11214 (gnus-summary-mark-article (gnus-summary-article-number)
11215 (or new-mark gnus-read-mark)))))
11217 (defun gnus-summary-mark-unread-as-ticked ()
11218 "Intended to be used by `gnus-mark-article-hook'."
11219 (when (memq gnus-current-article gnus-newsgroup-unreads)
11220 (gnus-summary-mark-article gnus-current-article gnus-ticked-mark)))
11222 (defun gnus-summary-mark-region-as-read (point mark all)
11223 "Mark all unread articles between point and mark as read.
11224 If given a prefix, mark all articles between point and mark as read,
11225 even ticked and dormant ones."
11226 (interactive "r\nP")
11230 (beginning-of-line)
11235 (memq (setq article (gnus-summary-article-number))
11236 gnus-newsgroup-unreads))
11237 (gnus-summary-mark-article article gnus-del-mark))
11239 (gnus-summary-find-next))))))
11241 (defun gnus-summary-mark-below (score mark)
11242 "Mark articles with score less than SCORE with MARK."
11243 (interactive "P\ncMark: ")
11244 (setq score (if score
11245 (prefix-numeric-value score)
11246 (or gnus-summary-default-score 0)))
11247 (with-current-buffer gnus-summary-buffer
11248 (goto-char (point-min))
11251 (and (< (gnus-summary-article-score) score)
11252 (gnus-summary-mark-article nil mark))
11253 (gnus-summary-find-next)))))
11255 (defun gnus-summary-kill-below (&optional score)
11256 "Mark articles with score below SCORE as read."
11258 (gnus-summary-mark-below score gnus-killed-mark))
11260 (defun gnus-summary-clear-above (&optional score)
11261 "Clear all marks from articles with score above SCORE."
11263 (gnus-summary-mark-above score gnus-unread-mark))
11265 (defun gnus-summary-tick-above (&optional score)
11266 "Tick all articles with score above SCORE."
11268 (gnus-summary-mark-above score gnus-ticked-mark))
11270 (defun gnus-summary-mark-above (score mark)
11271 "Mark articles with score over SCORE with MARK."
11272 (interactive "P\ncMark: ")
11273 (setq score (if score
11274 (prefix-numeric-value score)
11275 (or gnus-summary-default-score 0)))
11276 (with-current-buffer gnus-summary-buffer
11277 (goto-char (point-min))
11279 (when (> (gnus-summary-article-score) score)
11280 (gnus-summary-mark-article nil mark))
11282 (gnus-summary-find-next)))))
11284 ;; Suggested by Daniel Quinlan <quinlan@best.com>.
11285 (defalias 'gnus-summary-show-all-expunged 'gnus-summary-limit-include-expunged)
11286 (defun gnus-summary-limit-include-expunged (&optional no-error)
11287 "Display all the hidden articles that were expunged for low scores."
11289 (let ((inhibit-read-only t))
11290 (let ((scored gnus-newsgroup-scored)
11293 (unless (gnus-summary-article-header (caar scored))
11294 (and (setq h (gnus-number-to-header (caar scored)))
11295 (< (cdar scored) gnus-summary-expunge-below)
11297 (setq scored (cdr scored)))
11299 (when (not no-error)
11300 (error "No expunged articles hidden"))
11301 (goto-char (point-min))
11302 (push gnus-newsgroup-limit gnus-newsgroup-limits)
11303 (setq gnus-newsgroup-limit (copy-sequence gnus-newsgroup-limit))
11304 (dolist (x headers)
11305 (push (mail-header-number x) gnus-newsgroup-limit))
11306 (gnus-summary-prepare-unthreaded (nreverse headers))
11307 (goto-char (point-min))
11308 (gnus-summary-position-point)
11311 (defun gnus-summary-catchup (&optional all quietly to-here not-mark reverse)
11312 "Mark all unread articles in this newsgroup as read.
11313 If prefix argument ALL is non-nil, ticked and dormant articles will
11314 also be marked as read.
11315 If QUIETLY is non-nil, no questions will be asked.
11317 If TO-HERE is non-nil, it should be a point in the buffer. All
11318 articles before (after, if REVERSE is set) this point will be marked
11321 Note that this function will only catch up the unread article
11322 in the current summary buffer limitation.
11324 The number of articles marked as read is returned."
11329 (not gnus-interactive-catchup) ;Without confirmation?
11333 "Mark absolutely all articles as read? "
11334 "Mark all unread articles as read? ")))
11336 (not gnus-newsgroup-adaptive)
11337 (not gnus-newsgroup-auto-expire)
11338 (not gnus-suppress-duplicates)
11339 (or (not gnus-use-cache)
11340 (eq gnus-use-cache 'passive)))
11343 (setq gnus-newsgroup-marked nil
11344 gnus-newsgroup-spam-marked nil
11345 gnus-newsgroup-dormant nil))
11346 (setq gnus-newsgroup-unreads
11347 (gnus-sorted-nunion
11348 (gnus-sorted-intersection gnus-newsgroup-unreads
11349 gnus-newsgroup-downloadable)
11350 (gnus-sorted-difference gnus-newsgroup-unfetched
11351 gnus-newsgroup-cached))))
11352 ;; We actually mark all articles as canceled, which we
11353 ;; have to do when using auto-expiry or adaptive scoring.
11354 (gnus-summary-show-all-threads)
11355 (if (and to-here reverse)
11357 (goto-char to-here)
11358 (gnus-summary-mark-current-read-and-unread-as-read
11360 (while (gnus-summary-find-next (not all))
11361 (gnus-summary-mark-article-as-read gnus-catchup-mark)))
11362 (when (gnus-summary-first-subject (not all))
11364 (if to-here (< (point) to-here) t)
11365 (gnus-summary-mark-article-as-read gnus-catchup-mark)
11366 (gnus-summary-find-next (not all))))))
11367 (gnus-set-mode-line 'summary))
11369 (gnus-summary-position-point)))
11371 (defun gnus-summary-catchup-to-here (&optional all)
11372 "Mark all unticked articles before the current one as read.
11373 If ALL is non-nil, also mark ticked and dormant articles as read."
11376 (gnus-save-hidden-threads
11377 (let ((beg (point)))
11378 ;; We check that there are unread articles.
11379 (when (or all (gnus-summary-find-prev))
11380 (gnus-summary-catchup all t beg)))))
11381 (gnus-summary-position-point))
11383 (defun gnus-summary-catchup-from-here (&optional all)
11384 "Mark all unticked articles after (and including) the current one as read.
11385 If ALL is non-nil, also mark ticked and dormant articles as read."
11388 (gnus-save-hidden-threads
11389 (let ((beg (point)))
11390 ;; We check that there are unread articles.
11391 (when (or all (gnus-summary-find-next))
11392 (gnus-summary-catchup all t beg nil t)))))
11393 (gnus-summary-position-point))
11395 (defun gnus-summary-catchup-all (&optional quietly)
11396 "Mark all articles in this newsgroup as read.
11397 This command is dangerous. Normally, you want \\[gnus-summary-catchup]
11398 instead, which marks only unread articles as read."
11400 (gnus-summary-catchup t quietly))
11402 (defun gnus-summary-catchup-and-exit (&optional all quietly)
11403 "Mark all unread articles in this group as read, then exit.
11404 If prefix argument ALL is non-nil, all articles are marked as read.
11405 If QUIETLY is non-nil, no questions will be asked."
11407 (when (gnus-summary-catchup all quietly nil 'fast)
11408 ;; Select next newsgroup or exit.
11409 (if (and (not (gnus-group-quit-config gnus-newsgroup-name))
11410 (eq gnus-auto-select-next 'quietly))
11411 (gnus-summary-next-group nil)
11412 (gnus-summary-exit))))
11414 (defun gnus-summary-catchup-all-and-exit (&optional quietly)
11415 "Mark all articles in this newsgroup as read, and then exit.
11416 This command is dangerous. Normally, you want \\[gnus-summary-catchup-and-exit]
11417 instead, which marks only unread articles as read."
11419 (gnus-summary-catchup-and-exit t quietly))
11421 (defun gnus-summary-catchup-and-goto-next-group (&optional all)
11422 "Mark all articles in this group as read and select the next group.
11423 If given a prefix, mark all articles, unread as well as ticked, as
11427 (gnus-summary-catchup all))
11428 (gnus-summary-next-group))
11430 (defun gnus-summary-catchup-and-goto-prev-group (&optional all)
11431 "Mark all articles in this group as read and select the previous group.
11432 If given a prefix, mark all articles, unread as well as ticked, as
11436 (gnus-summary-catchup all))
11437 (gnus-summary-next-group nil nil t))
11443 (defmacro gnus-with-article (article &rest forms)
11444 "Select ARTICLE and perform FORMS in the original article buffer.
11445 Then replace the article with the result."
11447 ;; We don't want the article to be marked as read.
11448 (let (gnus-mark-article-hook)
11449 (gnus-summary-select-article t t nil ,article))
11450 (set-buffer gnus-original-article-buffer)
11452 (if (not (gnus-check-backend-function
11453 'request-replace-article (car gnus-article-current)))
11454 (gnus-message 5 "Read-only group; not replacing")
11455 (unless (gnus-request-replace-article
11456 ,article (car gnus-article-current)
11457 (current-buffer) t)
11458 (error "Couldn't replace article")))
11459 ;; The cache and backlog have to be flushed somewhat.
11460 (when gnus-keep-backlog
11461 (gnus-backlog-remove-article
11462 (car gnus-article-current) (cdr gnus-article-current)))
11463 (when gnus-use-cache
11464 (gnus-cache-update-article
11465 (car gnus-article-current) (cdr gnus-article-current)))))
11467 (put 'gnus-with-article 'lisp-indent-function 1)
11468 (put 'gnus-with-article 'edebug-form-spec '(form body))
11470 ;; Thread-based commands.
11472 (defun gnus-summary-articles-in-thread (&optional article)
11473 "Return a list of all articles in the current thread.
11474 If ARTICLE is non-nil, return all articles in the thread that starts
11475 with that article."
11476 (let* ((article (or article (gnus-summary-article-number)))
11477 (data (gnus-data-find-list article))
11478 (top-level (gnus-data-level (car data)))
11480 (cond ((null gnus-thread-operation-ignore-subject)
11481 (gnus-simplify-subject-re
11482 (mail-header-subject (gnus-data-header (car data)))))
11483 ((eq gnus-thread-operation-ignore-subject 'fuzzy)
11484 (gnus-simplify-subject-fuzzy
11485 (mail-header-subject (gnus-data-header (car data)))))
11487 (end-point (save-excursion
11488 (goto-char (gnus-data-pos (car data)))
11489 (if (gnus-summary-go-to-next-thread)
11490 (point) (point-max))))
11493 (< (gnus-data-pos (car data)) end-point))
11494 (when (or (not top-subject)
11495 (string= top-subject
11496 (if (eq gnus-thread-operation-ignore-subject 'fuzzy)
11497 (gnus-simplify-subject-fuzzy
11498 (mail-header-subject
11499 (gnus-data-header (car data))))
11500 (gnus-simplify-subject-re
11501 (mail-header-subject
11502 (gnus-data-header (car data)))))))
11503 (push (gnus-data-number (car data)) articles))
11504 (unless (and (setq data (cdr data))
11505 (> (gnus-data-level (car data)) top-level))
11507 ;; Return the list of articles.
11508 (nreverse articles)))
11510 (defun gnus-summary-rethread-current ()
11511 "Rethread the thread the current article is part of."
11513 (let* ((gnus-show-threads t)
11514 (article (gnus-summary-article-number))
11515 (id (mail-header-id (gnus-summary-article-header)))
11516 (gnus-newsgroup-threads (list (gnus-id-to-thread (gnus-root-id id)))))
11518 (error "No article on the current line"))
11519 (gnus-rebuild-thread id)
11520 (gnus-summary-goto-subject article)))
11522 (defun gnus-summary-reparent-thread ()
11523 "Make the current article child of the marked (or previous) article.
11525 Note that the re-threading will only work if `gnus-thread-ignore-subject'
11526 is non-nil or the Subject: of both articles are the same."
11528 (unless (not (gnus-group-read-only-p))
11529 (error "The current newsgroup does not support article editing"))
11530 (unless (<= (length gnus-newsgroup-processable) 1)
11531 (error "No more than one article may be marked"))
11532 (let ((child (gnus-summary-article-number))
11533 ;; First grab the marked article, otherwise one line up.
11534 (parent (if (not (null gnus-newsgroup-processable))
11535 (car gnus-newsgroup-processable)
11537 (if (eq (forward-line -1) 0)
11538 (gnus-summary-article-number)
11539 (error "Beginning of summary buffer"))))))
11540 (gnus-summary-reparent-children parent (list child))))
11542 (defun gnus-summary-reparent-children (parent children)
11543 "Make PARENT the parent of CHILDREN.
11544 When called interactively, PARENT is the current article and CHILDREN
11545 are the process-marked articles."
11547 (list (gnus-summary-article-number)
11548 (gnus-summary-work-articles nil)))
11549 (dolist (child children)
11550 (save-window-excursion
11551 (let ((gnus-article-buffer " *reparent*"))
11552 (unless (not (eq parent child))
11553 (error "An article may not be self-referential"))
11554 (let ((message-id (mail-header-id
11555 (gnus-summary-article-header parent))))
11556 (unless (and message-id (not (equal message-id "")))
11557 (error "No message-id in desired parent"))
11558 (gnus-with-article child
11560 (goto-char (point-min))
11561 (message-narrow-to-head)
11562 (if (re-search-forward "^References: " nil t)
11564 (re-search-forward "^[^ \t]" nil t)
11567 (insert " " message-id))
11568 (insert "References: " message-id "\n"))))
11569 (set-buffer gnus-summary-buffer)
11570 (gnus-summary-unmark-all-processable)
11571 (gnus-summary-update-article child)
11572 (when (gnus-summary-goto-subject (cdr gnus-article-current) nil t)
11573 (gnus-summary-update-secondary-mark (cdr gnus-article-current)))
11574 (gnus-summary-rethread-current)
11575 (gnus-message 3 "Article %d is now the child of article %d"
11578 (defun gnus-summary-toggle-threads (&optional arg)
11579 "Toggle showing conversation threads.
11580 If ARG is positive number, turn showing conversation threads on."
11582 (let ((current (or (gnus-summary-article-number) gnus-newsgroup-end)))
11583 (setq gnus-show-threads
11584 (if (null arg) (not gnus-show-threads)
11585 (> (prefix-numeric-value arg) 0)))
11586 (gnus-summary-prepare)
11587 (gnus-summary-goto-subject current)
11588 (gnus-message 6 "Threading is now %s" (if gnus-show-threads "on" "off"))
11589 (gnus-summary-position-point)))
11592 (if (fboundp 'remove-overlays)
11593 (defalias 'gnus-remove-overlays 'remove-overlays)
11594 (defun gnus-remove-overlays (beg end name val)
11595 "Clear BEG and END of overlays whose property NAME has value VAL.
11596 For compatibility with XEmacs."
11597 (dolist (ov (gnus-overlays-in beg end))
11598 (when (eq (gnus-overlay-get ov name) val)
11599 (gnus-delete-overlay ov))))))
11601 (defun gnus-summary-show-all-threads ()
11602 "Show all threads."
11604 (gnus-remove-overlays (point-min) (point-max) 'invisible 'gnus-sum)
11605 (gnus-summary-position-point))
11607 (defsubst gnus-summary--inv (p)
11608 (and (eq (get-char-property p 'invisible) 'gnus-sum) p))
11610 (defun gnus-summary-show-thread ()
11611 "Show thread subtrees.
11612 Returns nil if no thread was there to be shown."
11614 (let* ((orig (point))
11615 (end (point-at-eol))
11616 (end (or (gnus-summary--inv end) (gnus-summary--inv (1- end))))
11617 ;; Leave point at bol
11618 (beg (progn (beginning-of-line) (if (bobp) (point) (1- (point)))))
11620 (if (fboundp 'next-single-char-property-change)
11621 ;; Note: XEmacs version of n-s-c-p-c may return nil
11622 (or (next-single-char-property-change end 'invisible)
11627 (eq (get-char-property (point) 'invisible)
11631 (gnus-remove-overlays beg eoi 'invisible 'gnus-sum)
11633 (gnus-summary-position-point)
11636 (defun gnus-summary-maybe-hide-threads ()
11637 "If requested, hide the threads that should be hidden."
11638 (when (and gnus-show-threads
11639 gnus-thread-hide-subtree)
11640 (gnus-summary-hide-all-threads
11641 (if (or (consp gnus-thread-hide-subtree)
11642 (functionp gnus-thread-hide-subtree))
11643 (gnus-make-predicate gnus-thread-hide-subtree)
11646 ;;; Hiding predicates.
11648 (defun gnus-article-unread-p (header)
11649 (memq (mail-header-number header) gnus-newsgroup-unreads))
11651 (defun gnus-article-unseen-p (header)
11652 (memq (mail-header-number header) gnus-newsgroup-unseen))
11654 (defun gnus-map-articles (predicate articles)
11655 "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
11656 (apply 'gnus-or (mapcar predicate
11657 (mapcar (lambda (number)
11658 (gnus-summary-article-header number))
11661 (defun gnus-summary-hide-all-threads (&optional predicate)
11662 "Hide all thread subtrees.
11663 If PREDICATE is supplied, threads that satisfy this predicate
11664 will not be hidden."
11667 (goto-char (point-min))
11672 (when (zerop (mod count 1000))
11673 (message "Hiding all threads... %d" count))
11674 (when (or (not predicate)
11676 predicate (gnus-summary-article-children)))
11677 (gnus-summary-hide-thread))
11678 (setq end (not (zerop (gnus-summary-next-thread 1 t)))))))
11679 (gnus-summary-position-point))
11681 (defun gnus-summary-hide-thread ()
11682 "Hide thread subtrees.
11683 If PREDICATE is supplied, threads that satisfy this predicate
11684 will not be hidden.
11685 Returns nil if no threads were there to be hidden."
11687 (beginning-of-line)
11688 (let ((start (point))
11689 (starteol (line-end-position))
11690 (article (gnus-summary-article-number)))
11691 ;; Go forward until either the buffer ends or the subthread ends.
11692 (when (and (not (eobp))
11693 (or (zerop (gnus-summary-next-thread 1 t))
11694 (goto-char (point-max))))
11695 (if (and (> (point) start)
11696 ;; FIXME: this should actually search for a non-invisible \n.
11697 (search-backward "\n" start t))
11699 (when (> (point) starteol)
11700 (gnus-remove-overlays starteol (point) 'invisible 'gnus-sum)
11701 (let ((ol (gnus-make-overlay starteol (point) nil t nil)))
11702 (gnus-overlay-put ol 'invisible 'gnus-sum)
11703 (gnus-overlay-put ol 'evaporate t)))
11704 (gnus-summary-goto-subject article)
11705 (when (> start (point))
11706 (message "Hiding the thread moved us backwards, aborting!")
11707 (goto-char (point-max))))
11711 (defun gnus-summary-go-to-next-thread (&optional previous)
11712 "Go to the same level (or less) next thread.
11713 If PREVIOUS is non-nil, go to previous thread instead.
11714 Return the article number moved to, or nil if moving was impossible."
11715 (let ((level (gnus-summary-thread-level))
11716 (way (if previous -1 1))
11719 (while (and (not (eobp))
11720 (< level (gnus-summary-thread-level)))
11721 (forward-line way))
11728 (gnus-summary-article-number)
11729 (goto-char beg)))))
11731 (defun gnus-summary-next-thread (n &optional silent)
11732 "Go to the same level next N'th thread.
11733 If N is negative, search backward instead.
11734 Returns the difference between N and the number of skips actually
11737 If SILENT, don't output messages."
11739 (let ((backward (< n 0))
11741 (while (and (> n 0)
11742 (gnus-summary-go-to-next-thread backward))
11745 (gnus-summary-position-point))
11746 (when (and (not silent) (/= 0 n))
11747 (gnus-message 7 "No more threads"))
11750 (defun gnus-summary-prev-thread (n)
11751 "Go to the same level previous N'th thread.
11752 Returns the difference between N and the number of skips actually
11755 (gnus-summary-next-thread (- n)))
11757 (defun gnus-summary-go-down-thread ()
11758 "Go down one level in the current thread."
11759 (let ((children (gnus-summary-article-children)))
11761 (gnus-summary-goto-subject (car children)))))
11763 (defun gnus-summary-go-up-thread ()
11764 "Go up one level in the current thread."
11765 (let ((parent (gnus-summary-article-parent)))
11767 (gnus-summary-goto-subject parent))))
11769 (defun gnus-summary-down-thread (n)
11770 "Go down thread N steps.
11771 If N is negative, go up instead.
11772 Returns the difference between N and how many steps down that were
11777 (while (and (> n 0)
11778 (if up (gnus-summary-go-up-thread)
11779 (gnus-summary-go-down-thread)))
11781 (gnus-summary-position-point)
11783 (gnus-message 7 "Can't go further"))
11786 (defun gnus-summary-up-thread (n)
11787 "Go up thread N steps.
11788 If N is negative, go down instead.
11789 Returns the difference between N and how many steps down that were
11792 (gnus-summary-down-thread (- n)))
11794 (defun gnus-summary-top-thread ()
11795 "Go to the top of the thread."
11797 (while (gnus-summary-go-up-thread))
11798 (gnus-summary-article-number))
11800 (defun gnus-summary-expire-thread ()
11801 "Mark articles under current thread as expired."
11803 (gnus-summary-kill-thread 0))
11805 (defun gnus-summary-kill-thread (&optional unmark)
11806 "Mark articles under current thread as read.
11807 If the prefix argument is positive, remove any kinds of marks.
11808 If the prefix argument is zero, mark thread as expired.
11809 If the prefix argument is negative, tick articles instead."
11812 (setq unmark (prefix-numeric-value unmark)))
11813 (let ((articles (gnus-summary-articles-in-thread))
11814 (hide (or (null unmark) (= unmark 0))))
11816 ;; Expand the thread.
11817 (gnus-summary-show-thread)
11818 ;; Mark all the articles.
11820 (gnus-summary-goto-subject (car articles))
11821 (cond ((null unmark)
11822 (gnus-summary-mark-article-as-read gnus-killed-mark))
11824 (gnus-summary-mark-article-as-unread gnus-unread-mark))
11826 (gnus-summary-mark-article nil gnus-expirable-mark))
11828 (gnus-summary-mark-article-as-unread gnus-ticked-mark)))
11829 (setq articles (cdr articles))))
11830 ;; Hide killed subtrees when hide is true.
11832 gnus-thread-hide-killed
11833 (gnus-summary-hide-thread))
11834 ;; If hide is t, go to next unread subject.
11836 ;; Go to next unread subject.
11837 (gnus-summary-next-subject 1 t)))
11838 (gnus-set-mode-line 'summary))
11840 ;; Summary sorting commands
11842 (defun gnus-summary-sort-by-number (&optional reverse)
11843 "Sort the summary buffer by article number.
11844 Argument REVERSE means reverse order."
11846 (gnus-summary-sort 'number reverse))
11848 (defun gnus-summary-sort-by-most-recent-number (&optional reverse)
11849 "Sort the summary buffer by most recent article number.
11850 Argument REVERSE means reverse order."
11852 (gnus-summary-sort 'most-recent-number reverse))
11854 (defun gnus-summary-sort-by-random (&optional reverse)
11855 "Randomize the order in the summary buffer.
11856 Argument REVERSE means to randomize in reverse order."
11858 (gnus-summary-sort 'random reverse))
11860 (defun gnus-summary-sort-by-author (&optional reverse)
11861 "Sort the summary buffer by author name alphabetically.
11862 If `case-fold-search' is non-nil, case of letters is ignored.
11863 Argument REVERSE means reverse order."
11865 (gnus-summary-sort 'author reverse))
11867 (defun gnus-summary-sort-by-recipient (&optional reverse)
11868 "Sort the summary buffer by recipient name alphabetically.
11869 If `case-fold-search' is non-nil, case of letters is ignored.
11870 Argument REVERSE means reverse order."
11872 (gnus-summary-sort 'recipient reverse))
11874 (defun gnus-summary-sort-by-subject (&optional reverse)
11875 "Sort the summary buffer by subject alphabetically. `Re:'s are ignored.
11876 If `case-fold-search' is non-nil, case of letters is ignored.
11877 Argument REVERSE means reverse order."
11879 (gnus-summary-sort 'subject reverse))
11881 (defun gnus-summary-sort-by-date (&optional reverse)
11882 "Sort the summary buffer by date.
11883 Argument REVERSE means reverse order."
11885 (gnus-summary-sort 'date reverse))
11887 (defun gnus-summary-sort-by-most-recent-date (&optional reverse)
11888 "Sort the summary buffer by most recent date.
11889 Argument REVERSE means reverse order."
11891 (gnus-summary-sort 'most-recent-date reverse))
11893 (defun gnus-summary-sort-by-score (&optional reverse)
11894 "Sort the summary buffer by score.
11895 Argument REVERSE means reverse order."
11897 (gnus-summary-sort 'score reverse))
11899 (defun gnus-summary-sort-by-lines (&optional reverse)
11900 "Sort the summary buffer by the number of lines.
11901 Argument REVERSE means reverse order."
11903 (gnus-summary-sort 'lines reverse))
11905 (defun gnus-summary-sort-by-chars (&optional reverse)
11906 "Sort the summary buffer by article length.
11907 Argument REVERSE means reverse order."
11909 (gnus-summary-sort 'chars reverse))
11911 (defun gnus-summary-sort-by-original (&optional reverse)
11912 "Sort the summary buffer using the default sorting method.
11913 Argument REVERSE means reverse order."
11915 (let* ((inhibit-read-only t)
11916 (gnus-summary-prepare-hook nil))
11917 ;; We do the sorting by regenerating the threads.
11918 (gnus-summary-prepare)
11919 ;; Hide subthreads if needed.
11920 (gnus-summary-maybe-hide-threads)))
11922 (defun gnus-summary-sort (predicate reverse)
11923 "Sort summary buffer by PREDICATE. REVERSE means reverse order."
11924 (let* ((thread (intern (format "gnus-thread-sort-by-%s" predicate)))
11925 (article (intern (format "gnus-article-sort-by-%s" predicate)))
11926 (gnus-thread-sort-functions
11931 (gnus-sort-gathered-threads-function
11932 gnus-thread-sort-functions)
11933 (gnus-article-sort-functions
11937 (,article t2 t1))))
11938 (inhibit-read-only t)
11939 (gnus-summary-prepare-hook nil))
11940 ;; We do the sorting by regenerating the threads.
11941 (gnus-summary-prepare)
11942 ;; Hide subthreads if needed.
11943 (gnus-summary-maybe-hide-threads)))
11945 ;; Summary saving commands.
11947 (defun gnus-summary-save-article (&optional n not-saved)
11948 "Save the current article using the default saver function.
11949 If N is a positive number, save the N next articles.
11950 If N is a negative number, save the N previous articles.
11951 If N is nil and any articles have been marked with the process mark,
11952 save those articles instead.
11953 The variable `gnus-default-article-saver' specifies the saver function.
11955 If the optional second argument NOT-SAVED is non-nil, articles saved
11956 will not be marked as saved."
11958 (require 'gnus-art)
11959 (let* ((articles (gnus-summary-work-articles n))
11960 (save-buffer (save-excursion
11961 (nnheader-set-temp-buffer " *Gnus Save*")))
11962 (num (length articles))
11963 ;; Whether to save decoded articles or raw articles.
11964 (decode (when gnus-article-save-coding-system
11965 (get gnus-default-article-saver :decode)))
11966 ;; When saving many articles in a single file, use the other
11967 ;; function to save articles other than the first one.
11968 (saver2 (get gnus-default-article-saver :function))
11969 (gnus-prompt-before-saving (if saver2
11971 gnus-prompt-before-saving))
11972 (gnus-default-article-saver gnus-default-article-saver)
11974 (dolist (article articles)
11975 (setq header (gnus-summary-article-header article))
11976 (if (not (vectorp header))
11977 ;; This is a pseudo-article.
11978 (if (assq 'name header)
11979 (gnus-copy-file (cdr (assq 'name header)))
11980 (gnus-message 1 "Article %d is unsavable" article))
11981 ;; This is a real article.
11982 (save-window-excursion
11983 (gnus-summary-select-article decode decode nil article)
11984 (gnus-summary-goto-subject article))
11985 (with-current-buffer save-buffer
11987 (insert-buffer-substring (if decode
11988 gnus-article-buffer
11989 gnus-original-article-buffer)))
11990 (setq file (gnus-article-save save-buffer file num))
11991 (gnus-summary-remove-process-mark article)
11993 (gnus-summary-set-saved-mark article)))
11995 (setq gnus-default-article-saver saver2
11997 (gnus-kill-buffer save-buffer)
11998 (gnus-summary-position-point)
11999 (gnus-set-mode-line 'summary)
12002 (declare-function gnus-summary-save-in-pipe "gnus-art" (&optional command raw))
12004 (defun gnus-summary-pipe-output (&optional n sym)
12005 "Pipe the current article to a subprocess.
12006 If N is a positive number, pipe the N next articles.
12007 If N is a negative number, pipe the N previous articles.
12008 If N is nil and any articles have been marked with the process mark,
12009 pipe those articles instead.
12010 The default command to which articles are piped is specified by the
12011 variable `gnus-summary-pipe-output-default-command'; if it is nil, you
12012 will be prompted for the command.
12014 The properties `:decode' and `:headers' that are put to the function
12015 symbol `gnus-summary-save-in-pipe' control whether this function
12016 decodes articles and what headers to keep (see the doc string for the
12017 `gnus-default-article-saver' variable). If SYM (the symbolic prefix)
12018 is neither omitted nor the symbol `r', force including all headers
12019 regardless of the `:headers' property. If it is the symbol `r',
12020 articles that are not decoded and include all headers will be piped
12021 no matter what the properties `:decode' and `:headers' are."
12022 (interactive (gnus-interactive "P\ny"))
12023 (require 'gnus-art)
12024 (let* ((articles (gnus-summary-work-articles n))
12025 (result-buffer "*Shell Command Output*")
12026 (all-headers (not (memq sym '(nil r))))
12027 (gnus-save-all-headers (or all-headers gnus-save-all-headers))
12029 (headers (get 'gnus-summary-save-in-pipe :headers))
12031 (unless (numberp (car articles))
12032 (error "No article to pipe"))
12033 (setq command (gnus-read-shell-command
12034 (concat "Shell command on "
12036 (format "these %d articles" (length articles))
12039 gnus-summary-pipe-output-default-command))
12040 (when (string-equal command "")
12041 (error "A command is required"))
12043 (put 'gnus-summary-save-in-pipe :headers nil))
12046 (gnus-summary-goto-subject (pop articles))
12047 (save-window-excursion (gnus-summary-save-in-pipe command raw))
12048 (when (and (get-buffer result-buffer)
12049 (not (zerop (buffer-size (get-buffer result-buffer)))))
12050 (setq result (concat result (with-current-buffer result-buffer
12051 (buffer-string))))))
12052 (put 'gnus-summary-save-in-pipe :headers headers))
12053 (unless (zerop (length result))
12054 (if (with-current-buffer (get-buffer-create result-buffer)
12058 (and (= (count-lines (point-min) (point)) 1)
12061 (<= (current-column)
12062 (window-width (minibuffer-window)))))
12063 (goto-char (point-min))))
12064 (message "%s" (substring result 0 -1))
12066 (gnus-configure-windows 'pipe)))))
12068 (defun gnus-summary-save-article-mail (&optional arg)
12069 "Append the current article to a Unix mail box file.
12070 If N is a positive number, save the N next articles.
12071 If N is a negative number, save the N previous articles.
12072 If N is nil and any articles have been marked with the process mark,
12073 save those articles instead."
12075 (require 'gnus-art)
12076 (let ((gnus-default-article-saver 'gnus-summary-save-in-mail))
12077 (gnus-summary-save-article arg)))
12079 (defun gnus-summary-save-article-rmail (&optional arg)
12080 "Append the current article to an rmail file.
12081 If N is a positive number, save the N next articles.
12082 If N is a negative number, save the N previous articles.
12083 If N is nil and any articles have been marked with the process mark,
12084 save those articles instead."
12086 (require 'gnus-art)
12087 (let ((gnus-default-article-saver 'gnus-summary-save-in-rmail))
12088 (gnus-summary-save-article arg)))
12090 (defun gnus-summary-save-article-file (&optional arg)
12091 "Append the current article to a file.
12092 If N is a positive number, save the N next articles.
12093 If N is a negative number, save the N previous articles.
12094 If N is nil and any articles have been marked with the process mark,
12095 save those articles instead."
12097 (require 'gnus-art)
12098 (let ((gnus-default-article-saver 'gnus-summary-save-in-file))
12099 (gnus-summary-save-article arg)))
12101 (defun gnus-summary-write-article-file (&optional arg)
12102 "Write the current article to a file, deleting the previous file.
12103 If N is a positive number, save the N next articles.
12104 If N is a negative number, save the N previous articles.
12105 If N is nil and any articles have been marked with the process mark,
12106 save those articles instead."
12108 (require 'gnus-art)
12109 (let ((gnus-default-article-saver 'gnus-summary-write-to-file))
12110 (gnus-summary-save-article arg)))
12112 (defun gnus-summary-save-article-body-file (&optional arg)
12113 "Append the current article body to a file.
12114 If N is a positive number, save the N next articles.
12115 If N is a negative number, save the N previous articles.
12116 If N is nil and any articles have been marked with the process mark,
12117 save those articles instead."
12119 (require 'gnus-art)
12120 (let ((gnus-default-article-saver 'gnus-summary-save-body-in-file))
12121 (gnus-summary-save-article arg)))
12123 (defun gnus-summary-write-article-body-file (&optional arg)
12124 "Write the current article body to a file, deleting the previous file.
12125 If N is a positive number, save the N next articles.
12126 If N is a negative number, save the N previous articles.
12127 If N is nil and any articles have been marked with the process mark,
12128 save those articles instead."
12130 (require 'gnus-art)
12131 (let ((gnus-default-article-saver 'gnus-summary-write-body-to-file))
12132 (gnus-summary-save-article arg)))
12134 (defun gnus-summary-muttprint (&optional arg)
12135 "Print the current article using Muttprint.
12136 If N is a positive number, save the N next articles.
12137 If N is a negative number, save the N previous articles.
12138 If N is nil and any articles have been marked with the process mark,
12139 save those articles instead."
12141 (require 'gnus-art)
12142 (let ((gnus-default-article-saver 'gnus-summary-pipe-to-muttprint))
12143 (gnus-summary-save-article arg t)))
12145 (defun gnus-summary-pipe-message (program)
12146 "Pipe the current article through PROGRAM."
12147 (interactive "sProgram: ")
12148 (gnus-summary-select-article)
12149 (let ((mail-header-separator ""))
12150 (gnus-eval-in-buffer-window gnus-article-buffer
12153 (let ((start (window-start))
12154 (inhibit-read-only t))
12155 (message-pipe-buffer-body program)
12156 (set-window-start (get-buffer-window (current-buffer)) start))))))
12158 (defun gnus-get-split-value (methods)
12159 "Return a value based on the split METHODS."
12160 (let (split-name method result match)
12162 (with-current-buffer gnus-original-article-buffer
12164 (nnheader-narrow-to-headers)
12165 (while (and methods (not split-name))
12166 (goto-char (point-min))
12167 (setq method (pop methods))
12168 (setq match (car method))
12171 ;; Regular expression.
12173 (re-search-forward match nil t)))
12178 (setq result (funcall match gnus-newsgroup-name))))
12183 (setq result (eval match)))))
12184 (setq split-name (cdr method))
12185 (cond ((stringp result)
12186 (push (expand-file-name
12187 result gnus-article-save-directory)
12190 (setq split-name (append result split-name)))))))))
12191 (nreverse split-name)))
12193 (defun gnus-valid-move-group-p (group)
12194 (and (symbolp group)
12196 (symbol-name group)
12197 (symbol-value group)
12198 (gnus-get-function (gnus-find-method-for-group
12199 (symbol-name group)) 'request-accept-article t)))
12201 (defun gnus-read-move-group-name (prompt default articles prefix)
12202 "Read a group name."
12203 (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
12204 (minibuffer-confirm-incomplete nil) ; XEmacs
12208 (if (> (length articles) 1)
12209 (format "these %d articles" (length articles))
12214 (gnus-group-completing-read
12216 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12217 nil prefix nil default))
12218 ((= 1 (length split-name))
12219 (gnus-group-completing-read
12221 (gnus-remove-if-not 'gnus-valid-move-group-p gnus-active-hashtb t)
12222 nil prefix 'gnus-group-history (car split-name)))
12224 (gnus-completing-read
12225 prom (nreverse split-name) nil nil 'gnus-group-history))))
12226 (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
12229 (if (or (string= to-newsgroup "")
12230 (string= to-newsgroup prefix))
12231 (setq to-newsgroup default))
12232 (unless to-newsgroup
12233 (error "No group name entered"))
12234 (setq encoded (mm-encode-coding-string
12236 (gnus-group-name-charset to-method to-newsgroup)))
12237 (or (gnus-active encoded)
12238 (gnus-activate-group encoded nil nil to-method)
12239 (if (gnus-y-or-n-p (format "No such group: %s. Create it? "
12241 (or (and (gnus-request-create-group encoded to-method)
12242 (gnus-activate-group encoded nil nil to-method)
12243 (gnus-subscribe-group encoded))
12244 (error "Couldn't create group %s" to-newsgroup)))
12245 (error "No such group: %s" to-newsgroup))
12248 (defvar gnus-summary-save-parts-counter)
12249 (declare-function mm-uu-dissect "mm-uu" (&optional noheader mime-type))
12251 (defun gnus-summary-save-parts (type dir n &optional reverse)
12252 "Save parts matching TYPE to DIR.
12253 If REVERSE, save parts that do not match TYPE."
12255 (list (read-string "Save parts of type: "
12256 (or (car gnus-summary-save-parts-type-history)
12257 gnus-summary-save-parts-default-mime)
12258 'gnus-summary-save-parts-type-history)
12259 (setq gnus-summary-save-parts-last-directory
12260 (read-directory-name "Save to directory: "
12261 gnus-summary-save-parts-last-directory
12263 current-prefix-arg))
12264 (gnus-summary-iterate n
12265 (let ((gnus-display-mime-function nil)
12266 gnus-article-prepare-hook
12267 gnus-article-decode-hook
12268 gnus-display-mime-function
12270 (gnus-inhibit-treatment t))
12271 (gnus-summary-select-article))
12272 (with-current-buffer gnus-article-buffer
12273 (let ((handles (or gnus-article-mime-handles
12274 (mm-dissect-buffer nil gnus-article-loose-mime)
12275 (and gnus-article-emulate-mime
12277 (gnus-summary-save-parts-counter 1))
12279 (gnus-summary-save-parts-1 type dir handles reverse)
12280 (unless gnus-article-mime-handles ;; Don't destroy this case.
12281 (mm-destroy-parts handles)))))))
12283 (defun gnus-summary-save-parts-1 (type dir handle reverse)
12284 (if (stringp (car handle))
12285 (mapcar (lambda (h) (gnus-summary-save-parts-1 type dir h reverse))
12288 (not (string-match type (mm-handle-media-type handle)))
12289 (string-match type (mm-handle-media-type handle)))
12290 (let ((file (expand-file-name
12292 mm-file-name-rewrite-functions
12293 (file-name-nondirectory
12295 (mm-handle-filename handle)
12296 (format "%s.%d.%d" gnus-newsgroup-name
12297 (cdr gnus-article-current)
12298 gnus-summary-save-parts-counter))))
12300 (incf gnus-summary-save-parts-counter)
12301 (unless (file-exists-p file)
12302 (mm-save-part-to-file handle file))))))
12304 ;; Summary extract commands
12306 (defun gnus-summary-insert-pseudos (pslist &optional not-view)
12307 (let ((inhibit-read-only t)
12308 (article (gnus-summary-article-number))
12310 (unless (gnus-summary-goto-subject article)
12311 (error "No such article: %d" article))
12312 (gnus-summary-position-point)
12313 ;; If all commands are to be bunched up on one line, we collect
12315 (unless gnus-view-pseudos-separately
12316 (let ((ps (setq pslist (sort pslist 'gnus-pseudos<)))
12319 (setq action (cdr (assq 'action (car ps))))
12320 (setq files (list (cdr (assq 'name (car ps)))))
12321 (while (and ps (cdr ps)
12322 (string= (or action "1")
12323 (or (cdr (assq 'action (cadr ps))) "2")))
12324 (push (cdr (assq 'name (cadr ps))) files)
12325 (setcdr ps (cddr ps)))
12327 (when (not (string-match "%s" action))
12330 (when (assq 'execute (car ps))
12331 (setcdr (assq 'execute (car ps))
12332 (funcall (if (string-match "%s" action)
12339 (shell-quote-argument f)))
12341 (setq ps (cdr ps)))))
12342 (if (and gnus-view-pseudos (not not-view))
12344 (when (assq 'execute (car pslist))
12345 (gnus-execute-command (cdr (assq 'execute (car pslist)))
12346 (eq gnus-view-pseudos 'not-confirm)))
12347 (setq pslist (cdr pslist)))
12350 (setq after-article (or (cdr (assq 'article (car pslist)))
12351 (gnus-summary-article-number)))
12352 (gnus-summary-goto-subject after-article)
12355 (insert " " (file-name-nondirectory
12356 (cdr (assq 'name (car pslist))))
12357 ": " (or (cdr (assq 'execute (car pslist))) "") "\n")
12359 (forward-line -1) ; back to `b'
12360 (gnus-add-text-properties
12361 b (1- e) (list 'gnus-number gnus-reffed-article-number
12362 gnus-mouse-face-prop gnus-mouse-face))
12364 after-article gnus-reffed-article-number
12365 gnus-unread-mark b (car pslist) 0 (- e b))
12366 (setq gnus-newsgroup-unreads
12367 (gnus-add-to-sorted-list gnus-newsgroup-unreads
12368 gnus-reffed-article-number))
12369 (setq gnus-reffed-article-number (1- gnus-reffed-article-number))
12370 (setq pslist (cdr pslist)))))))
12372 (defun gnus-pseudos< (p1 p2)
12373 (let ((c1 (cdr (assq 'action p1)))
12374 (c2 (cdr (assq 'action p2))))
12375 (and c1 c2 (string< c1 c2))))
12377 (defun gnus-request-pseudo-article (props)
12378 (cond ((assq 'execute props)
12379 (gnus-execute-command (cdr (assq 'execute props)))))
12380 (let ((gnus-current-article (gnus-summary-article-number)))
12381 (gnus-run-hooks 'gnus-mark-article-hook)))
12383 (defun gnus-execute-command (command &optional automatic)
12385 (gnus-article-setup-buffer)
12386 (set-buffer gnus-article-buffer)
12387 (setq buffer-read-only nil)
12388 (let ((command (if automatic command
12389 (read-string "Command: " (cons command 0)))))
12391 (insert "$ " command "\n\n")
12392 (if gnus-view-pseudo-asynchronously
12393 (start-process "gnus-execute" (current-buffer) shell-file-name
12394 shell-command-switch command)
12395 (call-process shell-file-name nil t nil
12396 shell-command-switch command)))))
12398 ;; Summary kill commands.
12400 (defun gnus-summary-edit-global-kill (article)
12401 "Edit the \"global\" kill file."
12402 (interactive (list (gnus-summary-article-number)))
12403 (gnus-group-edit-global-kill article))
12405 (defun gnus-summary-edit-local-kill ()
12406 "Edit a local kill file applied to the current newsgroup."
12408 (setq gnus-current-headers (gnus-summary-article-header))
12409 (gnus-group-edit-local-kill
12410 (gnus-summary-article-number) gnus-newsgroup-name))
12412 ;;; Header reading.
12414 (defun gnus-read-header (id &optional header)
12415 "Read the headers of article ID and enter them into the Gnus system."
12416 (let ((group gnus-newsgroup-name)
12417 (gnus-override-method
12419 gnus-override-method
12420 (and (gnus-news-group-p gnus-newsgroup-name)
12421 (car (gnus-refer-article-methods)))))
12423 ;; First we check to see whether the header in question is already
12426 ;; This is a Message-ID.
12427 (setq header (or header (gnus-id-to-header id)))
12428 ;; This is an article number.
12429 (setq header (or header (gnus-summary-article-header id))))
12431 (not (gnus-summary-article-sparse-p (mail-header-number header))))
12432 ;; We have found the header.
12434 ;; We have to really fetch the header to this article.
12435 (with-current-buffer nntp-server-buffer
12436 (when (setq where (gnus-request-head id group))
12437 (nnheader-fold-continuation-lines)
12438 (goto-char (point-max))
12440 (goto-char (point-min))
12444 ((cdr where) (cdr where))
12445 (header (mail-header-number header))
12446 (t gnus-reffed-article-number))
12448 (insert " Article retrieved.\n"))
12449 (if (or (not where)
12450 (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
12451 () ; Malformed head.
12452 (unless (gnus-summary-article-sparse-p (mail-header-number header))
12453 (when (and (bound-and-true-p gnus-registry-enabled)
12454 (not (gnus-ephemeral-group-p (car where))))
12455 (gnus-registry-handle-action
12456 (mail-header-id header) nil
12457 (gnus-group-prefixed-name
12459 (or gnus-override-method (gnus-find-method-for-group group)))
12460 (mail-header-subject header)
12461 (mail-header-from header)))
12462 (when (and (stringp id)
12464 (not (string= (gnus-group-real-name group)
12466 (not (gnus-server-equal gnus-override-method
12467 (gnus-group-method group)))))
12468 ;; If we fetched by Message-ID and the article came from
12469 ;; a different group (or server), we fudge some bogus
12470 ;; article numbers for this article.
12471 (mail-header-set-number header gnus-reffed-article-number))
12472 (with-current-buffer gnus-summary-buffer
12473 (decf gnus-reffed-article-number)
12474 (gnus-remove-header (mail-header-number header))
12475 (push header gnus-newsgroup-headers)
12476 (setq gnus-current-headers header)
12477 (push (mail-header-number header) gnus-newsgroup-limit)))
12480 (defun gnus-remove-header (number)
12481 "Remove header NUMBER from `gnus-newsgroup-headers'."
12482 (if (and gnus-newsgroup-headers
12483 (= number (mail-header-number (car gnus-newsgroup-headers))))
12484 (pop gnus-newsgroup-headers)
12485 (let ((headers gnus-newsgroup-headers))
12486 (while (and (cdr headers)
12487 (not (= number (mail-header-number (cadr headers)))))
12489 (when (cdr headers)
12490 (setcdr headers (cddr headers))))))
12493 ;;; summary highlights
12496 (defun gnus-highlight-selected-summary ()
12497 "Highlight selected article in summary buffer."
12498 ;; Added by Per Abrahamsen <amanda@iesd.auc.dk>.
12499 (when gnus-summary-selected-face
12501 (let* ((beg (point-at-bol))
12502 (end (point-at-eol))
12503 ;; Fix by Mike Dugan <dugan@bucrf16.bu.edu>.
12504 (from (if (get-text-property beg gnus-mouse-face-prop)
12506 (or (next-single-property-change
12507 beg gnus-mouse-face-prop nil end)
12512 (or (next-single-property-change
12513 from gnus-mouse-face-prop nil end)
12515 ;; If no mouse-face prop on line we will have to = from = end,
12516 ;; so we highlight the entire line instead.
12517 (when (= (+ to 2) from)
12520 (if gnus-newsgroup-selected-overlay
12521 ;; Move old overlay.
12523 gnus-newsgroup-selected-overlay from to (current-buffer))
12524 ;; Create new overlay.
12526 (setq gnus-newsgroup-selected-overlay (gnus-make-overlay from to))
12527 'face gnus-summary-selected-face))))))
12529 (defvar gnus-summary-highlight-line-cached nil)
12530 (defvar gnus-summary-highlight-line-trigger nil)
12532 (defun gnus-summary-highlight-line-0 ()
12533 (if (and (eq gnus-summary-highlight-line-trigger
12534 gnus-summary-highlight)
12535 gnus-summary-highlight-line-cached)
12536 gnus-summary-highlight-line-cached
12537 (setq gnus-summary-highlight-line-trigger gnus-summary-highlight
12538 gnus-summary-highlight-line-cached
12539 (let* ((cond (list 'cond))
12541 (list gnus-summary-highlight))
12543 (setcdr c (cons (list (caar list) (list 'quote (cdar list)))
12547 (gnus-byte-compile (list 'lambda nil cond))))))
12549 (defun gnus-summary-highlight-line ()
12550 "Highlight current line according to `gnus-summary-highlight'."
12551 (let* ((beg (point-at-bol))
12552 (article (or (gnus-summary-article-number) gnus-current-article))
12553 (score (or (cdr (assq article
12554 gnus-newsgroup-scored))
12555 gnus-summary-default-score 0))
12556 (mark (or (gnus-summary-article-mark) gnus-unread-mark))
12557 (inhibit-read-only t)
12558 (default gnus-summary-default-score)
12559 (default-high gnus-summary-default-high-score)
12560 (default-low gnus-summary-default-low-score)
12561 (uncached (and gnus-summary-use-undownloaded-faces
12562 (memq article gnus-newsgroup-undownloaded)
12563 (not (memq article gnus-newsgroup-cached)))))
12564 (let ((face (funcall (gnus-summary-highlight-line-0))))
12565 (unless (eq face (gnus-get-text-property-excluding-characters-with-faces beg 'face))
12566 (gnus-put-text-property-excluding-characters-with-faces
12567 beg (point-at-eol) 'face
12568 (setq face (if (boundp face) (symbol-value face) face)))
12569 (when gnus-summary-highlight-line-function
12570 (funcall gnus-summary-highlight-line-function article face))))))
12572 (defun gnus-update-read-articles (group unread &optional compute)
12573 "Update the list of read articles in GROUP.
12574 UNREAD is a sorted list."
12575 (let ((active (or gnus-newsgroup-active (gnus-active group)))
12576 (info (gnus-get-info group))
12579 (if (or (not info) (not active))
12580 ;; There is no info on this group if it was, in fact,
12581 ;; killed. Gnus stores no information on killed groups, so
12582 ;; there's nothing to be done.
12583 ;; One could store the information somewhere temporarily,
12584 ;; perhaps... Hmmm...
12586 ;; Remove any negative articles numbers.
12587 (while (and unread (< (car unread) 0))
12588 (setq unread (cdr unread)))
12589 ;; Remove any expired article numbers
12590 (while (and unread (< (car unread) (car active)))
12591 (setq unread (cdr unread)))
12592 ;; Compute the ranges of read articles by looking at the list of
12593 ;; unread articles.
12595 (when (/= (car unread) prev)
12596 (push (if (= prev (1- (car unread))) prev
12597 (cons prev (1- (car unread))))
12599 (setq prev (1+ (car unread)))
12600 (setq unread (cdr unread)))
12601 (when (<= prev (cdr active))
12602 (push (cons prev (cdr active)) read))
12603 (setq read (if (> (length read) 1) (nreverse read) read))
12608 ;; Propagate the read marks to the backend.
12609 (when (and (gnus-method-option-p
12610 (gnus-find-method-for-group group)
12612 (gnus-check-backend-function 'request-set-mark group))
12613 (let ((del (gnus-remove-from-range (gnus-info-read info) read))
12614 (add (gnus-remove-from-range read (gnus-info-read info))))
12616 (unless (gnus-check-group group)
12617 (error "Can't open server for %s" group))
12618 (gnus-request-set-mark
12619 group (delq nil (list (if add (list add 'add '(read)))
12620 (if del (list del 'del '(read))))))
12622 `(gnus-request-set-mark
12625 (if del (list del 'add '(read)))
12626 (if add (list add 'del '(read))))))))))
12627 (set-buffer gnus-group-buffer)
12628 (gnus-undo-register
12630 (gnus-info-set-marks ',info ',(gnus-info-marks info) t)
12631 (gnus-info-set-read ',info ',(gnus-info-read info))
12632 (gnus-get-unread-articles-in-group ',info
12633 (gnus-active ,group))
12634 (gnus-group-update-group ,group t)
12636 ;; Enter this list into the group info.
12637 (gnus-info-set-read info read)
12638 ;; Set the number of unread articles in gnus-newsrc-hashtb.
12639 (gnus-get-unread-articles-in-group info (gnus-active group))
12642 (defun gnus-offer-save-summaries ()
12643 "Offer to save all active summary buffers."
12645 ;; Go through all buffers and find all summaries.
12646 (dolist (buffer (buffer-list))
12647 (when (and (setq buffer (buffer-name buffer))
12648 (string-match "Summary" buffer)
12649 (with-current-buffer buffer
12650 ;; We check that this is, indeed, a summary buffer.
12651 (and (eq major-mode 'gnus-summary-mode)
12652 ;; Also make sure this isn't bogus.
12653 gnus-newsgroup-prepared
12654 ;; Also make sure that this isn't a
12655 ;; dead summary buffer.
12656 (not gnus-dead-summary-mode))))
12657 (push buffer buffers)))
12658 ;; Go through all these summary buffers and offer to save them.
12661 (if (eq gnus-interactive-exit 'quiet)
12662 (dolist (buffer buffers)
12663 (switch-to-buffer buffer)
12664 (gnus-summary-exit))
12666 "Update summary buffer %s? "
12668 (switch-to-buffer buf)
12669 (gnus-summary-exit))
12672 (defun gnus-summary-setup-default-charset ()
12673 "Setup newsgroup default charset."
12674 (if (member gnus-newsgroup-name '("nndraft:delayed" "nndraft:drafts"))
12675 (setq gnus-newsgroup-charset nil)
12676 (let* ((ignored-charsets
12677 (or gnus-newsgroup-ephemeral-ignored-charsets
12679 (and gnus-newsgroup-name
12680 (gnus-parameter-ignored-charsets gnus-newsgroup-name))
12681 gnus-newsgroup-ignored-charsets))))
12682 (setq gnus-newsgroup-charset
12683 (or gnus-newsgroup-ephemeral-charset
12684 (and gnus-newsgroup-name
12685 (gnus-parameter-charset gnus-newsgroup-name))
12686 gnus-default-charset))
12687 (set (make-local-variable 'gnus-newsgroup-ignored-charsets)
12688 ignored-charsets))))
12694 (defun gnus-summary-display-buttonized (&optional show-all-parts)
12695 "Display the current article buffer fully MIME-buttonized.
12696 If SHOW-ALL-PARTS (the prefix) is non-nil, all multipart/* parts are
12697 treated as multipart/mixed."
12699 (require 'gnus-art)
12700 (let ((gnus-unbuttonized-mime-types nil)
12701 (gnus-mime-display-multipart-as-mixed show-all-parts))
12702 (gnus-summary-show-article)))
12704 (defun gnus-summary-repair-multipart (article)
12705 "Add a Content-Type header to a multipart article without one."
12706 (interactive (list (gnus-summary-article-number)))
12707 (gnus-with-article article
12708 (message-narrow-to-head)
12709 (message-remove-header "Mime-Version")
12710 (goto-char (point-max))
12711 (insert "Mime-Version: 1.0\n")
12713 (when (search-forward "\n--" nil t)
12714 (let ((separator (buffer-substring (point) (point-at-eol))))
12715 (message-narrow-to-head)
12716 (message-remove-header "Content-Type")
12717 (goto-char (point-max))
12718 (insert (format "Content-Type: multipart/mixed; boundary=\"%s\"\n"
12721 (let (gnus-mark-article-hook)
12722 (gnus-summary-select-article t t nil article)))
12724 (defun gnus-summary-toggle-display-buttonized ()
12725 "Toggle the buttonizing of the article buffer."
12727 (require 'gnus-art)
12728 (if (setq gnus-inhibit-mime-unbuttonizing
12729 (not gnus-inhibit-mime-unbuttonizing))
12730 (let ((gnus-unbuttonized-mime-types nil))
12731 (gnus-summary-show-article))
12732 (gnus-summary-show-article)))
12735 ;;; Generic summary marking commands
12738 (defvar gnus-summary-marking-alist
12739 '((read gnus-del-mark "d")
12740 (unread gnus-unread-mark "u")
12741 (ticked gnus-ticked-mark "!")
12742 (dormant gnus-dormant-mark "?")
12743 (expirable gnus-expirable-mark "e"))
12744 "An alist of names/marks/keystrokes.")
12746 (defvar gnus-summary-generic-mark-map (make-sparse-keymap))
12747 (defvar gnus-summary-mark-map)
12749 (defun gnus-summary-make-all-marking-commands ()
12750 (define-key gnus-summary-mark-map "M" gnus-summary-generic-mark-map)
12751 (dolist (elem gnus-summary-marking-alist)
12752 (apply 'gnus-summary-make-marking-command elem)))
12754 (defun gnus-summary-make-marking-command (name mark keystroke)
12755 (let ((map (make-sparse-keymap)))
12756 (define-key gnus-summary-generic-mark-map keystroke map)
12757 (dolist (lway `((next "next" next nil "n")
12758 (next-unread "next unread" next t "N")
12759 (prev "previous" prev nil "p")
12760 (prev-unread "previous unread" prev t "P")
12761 (nomove "" nil nil ,keystroke)))
12762 (let ((func (gnus-summary-make-marking-command-1
12763 mark (car lway) lway name)))
12764 (setq func (eval func))
12765 (define-key map (nth 4 lway) func)))))
12767 (defun gnus-summary-make-marking-command-1 (mark way lway name)
12769 (format "gnus-summary-put-mark-as-%s%s"
12770 name (if (eq way 'nomove)
12772 (concat "-" (symbol-name way)))))
12775 "Mark the current article as %s%s.
12776 If N, the prefix, then repeat N times.
12777 If N is negative, move in reverse order.
12778 The difference between N and the actual number of articles marked is
12782 (gnus-summary-generic-mark n ,mark ',(nth 2 lway) ,(nth 3 lway))))
12784 (defun gnus-summary-generic-mark (n mark move unread)
12785 "Mark N articles with MARK."
12786 (unless (eq major-mode 'gnus-summary-mode)
12787 (error "This command can only be used in the summary buffer"))
12788 (gnus-summary-show-thread)
12791 ((eq move 'next) 1)
12792 ((eq move 'prev) -1)
12794 (if (zerop nummove)
12798 nummove (* -1 nummove))))
12799 (while (and (> n 0)
12800 (gnus-summary-mark-article nil mark)
12801 (zerop (gnus-summary-next-subject nummove unread t)))
12804 (gnus-message 7 "No more %sarticles" (if mark "" "unread ")))
12805 (gnus-summary-recenter)
12806 (gnus-summary-position-point)
12807 (gnus-set-mode-line 'summary)
12810 (defun gnus-summary-insert-articles (articles)
12811 (when (setq articles
12812 (gnus-sorted-difference articles
12813 (mapcar (lambda (h)
12814 (mail-header-number h))
12815 gnus-newsgroup-headers)))
12816 (setq gnus-newsgroup-headers
12818 gnus-newsgroup-headers
12819 (gnus-fetch-headers articles nil t)
12820 'gnus-article-sort-by-number))
12821 (setq gnus-newsgroup-articles
12822 (gnus-sorted-nunion gnus-newsgroup-articles articles))
12823 ;; Suppress duplicates?
12824 (when gnus-suppress-duplicates
12825 (gnus-dup-suppress-articles))
12827 (if (and gnus-fetch-old-headers
12828 (eq gnus-headers-retrieved-by 'nov))
12829 ;; We might want to build some more threads first.
12830 (if (eq gnus-fetch-old-headers 'invisible)
12831 (gnus-build-all-threads)
12832 (gnus-build-old-threads))
12833 ;; Mark the inserted articles that are unread as unread.
12834 (setq gnus-newsgroup-unreads
12835 (gnus-sorted-nunion
12836 gnus-newsgroup-unreads
12837 (gnus-sorted-nintersection
12838 (gnus-list-of-unread-articles gnus-newsgroup-name)
12840 ;; Mark the inserted articles as selected so that the information
12841 ;; of the marks having been changed by a user may be updated when
12842 ;; exiting this group. See `gnus-summary-update-info'.
12843 (dolist (art articles)
12844 (setq gnus-newsgroup-unselected (delq art gnus-newsgroup-unselected))))
12845 ;; Let the Gnus agent mark articles as read.
12847 (gnus-agent-get-undownloaded-list))
12848 ;; Remove list identifiers from subject
12849 (gnus-summary-remove-list-identifiers)
12850 ;; First and last article in this newsgroup.
12851 (when gnus-newsgroup-headers
12852 (setq gnus-newsgroup-begin
12853 (mail-header-number (car gnus-newsgroup-headers))
12855 (mail-header-number
12856 (gnus-last-element gnus-newsgroup-headers))))
12857 (when gnus-use-scoring
12858 (gnus-possibly-score-headers))))
12860 (defun gnus-summary-insert-old-articles (&optional all)
12861 "Insert all old articles in this group.
12862 If ALL is non-nil, already read articles become readable.
12863 If ALL is a number, fetch this number of articles."
12866 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12869 ;; Some nntp servers lie about their active range. When
12870 ;; this happens, the active range can be in the millions.
12871 ;; Use a compressed range to avoid creating a huge list.
12872 (gnus-range-difference
12873 (gnus-range-difference (list gnus-newsgroup-active) old)
12874 gnus-newsgroup-unexist))
12875 (setq len (gnus-range-length older))
12880 (let ((older-range (nreverse older)))
12884 (let* ((r (pop older-range))
12885 (min (if (numberp r) r (car r)))
12886 (max (if (numberp r) r (cdr r))))
12887 (while (and (<= min max)
12892 (setq older (gnus-uncompress-range older))))
12894 (setq older (gnus-uncompress-range older)))
12896 (when (and (numberp gnus-large-newsgroup)
12897 (> len gnus-large-newsgroup))
12898 (let* ((cursor-in-echo-area nil)
12899 (initial (gnus-parameter-large-newsgroup-initial
12900 gnus-newsgroup-name))
12904 "How many articles from %s (%s %d): "
12905 (gnus-group-decoded-name gnus-newsgroup-name)
12906 (if initial "max" "default")
12910 (number-to-string initial)))))
12911 (unless (string-match "^[ \t]*$" input)
12912 (setq all (string-to-number input))
12914 (let ((older-range (nreverse older)))
12918 (let* ((r (pop older-range))
12919 (min (if (numberp r) r (car r)))
12920 (max (if (numberp r) r (cdr r))))
12921 (while (and (<= min max)
12925 max (1- max))))))))))
12926 (setq older (gnus-uncompress-range older))))
12928 (message "No old news.")
12929 (gnus-summary-insert-articles older)
12930 (gnus-summary-limit (gnus-sorted-nunion old older))))
12931 (gnus-summary-position-point)))
12933 (defun gnus-summary-insert-new-articles ()
12934 "Insert all new articles in this group."
12936 (let ((old (sort (mapcar 'car gnus-newsgroup-data) '<))
12937 (old-high gnus-newsgroup-highest)
12938 (nnmail-fetched-sources (list t))
12939 (new-active (gnus-activate-group gnus-newsgroup-name 'scan))
12942 (error "Couldn't fetch new data"))
12943 (setq gnus-newsgroup-active (gnus-copy-sequence new-active))
12944 (setq i (cdr gnus-newsgroup-active)
12945 gnus-newsgroup-highest i)
12946 (while (> i old-high)
12950 (message "No gnus is bad news")
12951 (gnus-summary-insert-articles new)
12952 (setq gnus-newsgroup-unreads
12953 (gnus-sorted-nunion gnus-newsgroup-unreads new))
12954 (gnus-summary-limit (gnus-sorted-nunion old new))))
12955 (gnus-summary-position-point))
12957 ;;; Bookmark support for Gnus.
12958 (declare-function gnus-article-show-summary "gnus-art" ())
12959 (declare-function bookmark-make-record-default
12960 "bookmark" (&optional no-file no-context posn))
12961 (declare-function bookmark-prop-get "bookmark" (bookmark prop))
12962 (declare-function bookmark-default-handler "bookmark" (bmk))
12963 (declare-function bookmark-get-bookmark-record "bookmark" (bmk))
12964 (defvar bookmark-yank-point)
12965 (defvar bookmark-current-buffer)
12967 (defun gnus-summary-bookmark-make-record ()
12968 "Make a bookmark entry for a Gnus summary buffer."
12970 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current)
12971 (save-restriction ; FIXME is it necessary to widen?
12972 (widen) (setq pos (point))) ; Set position in gnus-article buffer.
12973 (setq buf "art") ; We are recording bookmark from article buffer.
12974 (setq bookmark-yank-point (point))
12975 (setq bookmark-current-buffer (current-buffer))
12976 (gnus-article-show-summary)) ; Go back in summary buffer.
12977 ;; We are now recording bookmark from summary buffer.
12978 (unless buf (setq buf "sum"))
12979 (let* ((subject (elt (gnus-summary-article-header) 1))
12980 (grp (car gnus-article-current))
12981 (art (cdr gnus-article-current))
12982 (head (gnus-summary-article-header art))
12983 (id (mail-header-id head)))
12985 ,@(condition-case nil
12986 (bookmark-make-record-default 'no-file 'no-context pos)
12987 (wrong-number-of-arguments
12988 (bookmark-make-record-default 'point-only)))
12989 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id))
12990 (group . ,grp) (article . ,art)
12991 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))))
12994 (defun gnus-summary-bookmark-jump (bookmark)
12995 "Handler function for record returned by `gnus-summary-bookmark-make-record'.
12996 BOOKMARK is a bookmark name or a bookmark record."
12997 (let ((group (bookmark-prop-get bookmark 'group))
12998 (article (bookmark-prop-get bookmark 'article))
12999 (id (bookmark-prop-get bookmark 'message-id))
13000 (buf (car (split-string (bookmark-prop-get bookmark 'location)))))
13001 (gnus-fetch-group group (list article))
13002 (gnus-summary-insert-cached-articles)
13003 (gnus-summary-goto-article id nil 'force)
13004 ;; FIXME we have to wait article buffer is ready (only large buffer)
13005 ;; Is there a better solution to know that?
13006 ;; If we don't wait `bookmark-default-handler' will have no chance
13007 ;; to set position. However there is no error, just wrong pos.
13009 (when (string= buf "Gnus-art")
13011 (bookmark-default-handler
13013 (buffer . ,(current-buffer))
13014 . ,(bookmark-get-bookmark-record bookmark)))))
13016 (gnus-summary-make-all-marking-commands)
13018 (gnus-ems-redefine)
13020 (provide 'gnus-sum)
13022 (run-hooks 'gnus-sum-load-hook)
13024 ;; Local Variables:
13028 ;;; gnus-sum.el ends here